react-cookie
Advanced tools
Comparing version 3.0.8 to 3.1.0
@@ -14,2 +14,2 @@ "use strict"; | ||
exports.default = _default; | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; |
import * as React from 'react'; | ||
import Cookies from 'universal-cookie'; | ||
export declare const Provider: React.ComponentType<React.ProviderProps<Cookies>>, Consumer: React.ComponentType<React.ConsumerProps<Cookies>>; | ||
import Cookies from './Cookies'; | ||
declare const CookiesContext: React.Context<Cookies>; | ||
export declare const Provider: React.ProviderExoticComponent<React.ProviderProps<Cookies>>, Consumer: React.ExoticComponent<React.ConsumerProps<Cookies>>; | ||
export default CookiesContext; |
@@ -6,7 +6,7 @@ "use strict"; | ||
}); | ||
exports.Consumer = exports.Provider = void 0; | ||
exports.default = exports.Consumer = exports.Provider = void 0; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _universalCookie = _interopRequireDefault(require("universal-cookie")); | ||
var _Cookies = _interopRequireDefault(require("./Cookies")); | ||
@@ -17,7 +17,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _a; | ||
var Provider = (_a = React.createContext(new _universalCookie.default()), _a.Provider), | ||
Consumer = _a.Consumer; | ||
var CookiesContext = React.createContext(new _Cookies.default()); | ||
var Provider = CookiesContext.Provider, | ||
Consumer = CookiesContext.Consumer; | ||
exports.Consumer = Consumer; | ||
exports.Provider = Provider; | ||
exports.Provider = Provider; | ||
var _default = CookiesContext; | ||
exports.default = _default; |
@@ -72,2 +72,2 @@ "use strict"; | ||
exports.default = _default; | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; |
export { default as Cookies } from './Cookies'; | ||
export { default as CookiesProvider } from './CookiesProvider'; | ||
export { default as withCookies } from './withCookies'; | ||
export { default as useCookies } from './useCookies'; | ||
export * from './types'; |
@@ -24,2 +24,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "useCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _useCookies.default; | ||
} | ||
}); | ||
@@ -32,2 +38,4 @@ var _Cookies = _interopRequireDefault(require("./Cookies")); | ||
var _useCookies = _interopRequireDefault(require("./useCookies")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -148,2 +148,2 @@ "use strict"; | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; |
import * as React from 'react'; | ||
import Cookies from 'universal-cookie'; | ||
export declare const Provider: React.ComponentType<React.ProviderProps<Cookies>>, Consumer: React.ComponentType<React.ConsumerProps<Cookies>>; | ||
import Cookies from './Cookies'; | ||
declare const CookiesContext: React.Context<Cookies>; | ||
export declare const Provider: React.ProviderExoticComponent<React.ProviderProps<Cookies>>, Consumer: React.ExoticComponent<React.ConsumerProps<Cookies>>; | ||
export default CookiesContext; |
@@ -1,4 +0,5 @@ | ||
var _a; | ||
import * as React from 'react'; | ||
import Cookies from 'universal-cookie'; | ||
export var Provider = (_a = React.createContext(new Cookies()), _a.Provider), Consumer = _a.Consumer; | ||
import Cookies from './Cookies'; | ||
var CookiesContext = React.createContext(new Cookies()); | ||
export var Provider = CookiesContext.Provider, Consumer = CookiesContext.Consumer; | ||
export default CookiesContext; |
export { default as Cookies } from './Cookies'; | ||
export { default as CookiesProvider } from './CookiesProvider'; | ||
export { default as withCookies } from './withCookies'; | ||
export { default as useCookies } from './useCookies'; | ||
export * from './types'; |
export { default as Cookies } from './Cookies'; | ||
export { default as CookiesProvider } from './CookiesProvider'; | ||
export { default as withCookies } from './withCookies'; | ||
export { default as useCookies } from './useCookies'; |
@@ -14,2 +14,2 @@ "use strict"; | ||
exports.default = _default; | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; |
import * as React from 'react'; | ||
import Cookies from 'universal-cookie'; | ||
export declare const Provider: React.ComponentType<React.ProviderProps<Cookies>>, Consumer: React.ComponentType<React.ConsumerProps<Cookies>>; | ||
import Cookies from './Cookies'; | ||
declare const CookiesContext: React.Context<Cookies>; | ||
export declare const Provider: React.ProviderExoticComponent<React.ProviderProps<Cookies>>, Consumer: React.ExoticComponent<React.ConsumerProps<Cookies>>; | ||
export default CookiesContext; |
@@ -6,7 +6,7 @@ "use strict"; | ||
}); | ||
exports.Consumer = exports.Provider = void 0; | ||
exports.default = exports.Consumer = exports.Provider = void 0; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _universalCookie = _interopRequireDefault(require("universal-cookie")); | ||
var _Cookies = _interopRequireDefault(require("./Cookies")); | ||
@@ -17,7 +17,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _a; | ||
var Provider = (_a = React.createContext(new _universalCookie.default()), _a.Provider), | ||
Consumer = _a.Consumer; | ||
var CookiesContext = React.createContext(new _Cookies.default()); | ||
var Provider = CookiesContext.Provider, | ||
Consumer = CookiesContext.Consumer; | ||
exports.Consumer = Consumer; | ||
exports.Provider = Provider; | ||
exports.Provider = Provider; | ||
var _default = CookiesContext; | ||
exports.default = _default; |
@@ -72,2 +72,2 @@ "use strict"; | ||
exports.default = _default; | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; |
export { default as Cookies } from './Cookies'; | ||
export { default as CookiesProvider } from './CookiesProvider'; | ||
export { default as withCookies } from './withCookies'; | ||
export { default as useCookies } from './useCookies'; | ||
export * from './types'; |
@@ -24,2 +24,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "useCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _useCookies.default; | ||
} | ||
}); | ||
@@ -32,2 +38,4 @@ var _Cookies = _interopRequireDefault(require("./Cookies")); | ||
var _useCookies = _interopRequireDefault(require("./useCookies")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -148,2 +148,2 @@ "use strict"; | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; |
{ | ||
"name": "react-cookie", | ||
"version": "3.0.8", | ||
"version": "3.1.0", | ||
"description": "Universal cookies for React", | ||
@@ -39,8 +39,8 @@ "main": "cjs/index.js", | ||
"hoist-non-react-statics": "^3.0.0", | ||
"universal-cookie": "^3.0.7" | ||
"universal-cookie": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0-rc.1", | ||
"react": "^16.3.0", | ||
"react-dom": "^16.3.0", | ||
"@babel/cli": "^7.0.0", | ||
"react": "^16.8.0", | ||
"react-dom": "^16.8.0", | ||
"rimraf": "^2.6.1", | ||
@@ -52,4 +52,3 @@ "rollup": "^0.64.1", | ||
"react": ">= 16.3.0" | ||
}, | ||
"gitHead": "9ef292c706eaeb3baf6f6e60189f2105c8d6f0b0" | ||
} | ||
} |
175
README.md
@@ -15,12 +15,16 @@ <h3 align="center"> | ||
## Integrations | ||
- [`universal-cookie`](https://www.npmjs.com/package/universal-cookie) - Universal cookies for JavaScript | ||
- [`universal-cookie-express`](https://www.npmjs.com/package/universal-cookie-express) - Hook cookies get/set on Express for server-rendering | ||
- [`universal-cookie`](https://www.npmjs.com/package/universal-cookie) - Universal cookies for JavaScript | ||
- [`universal-cookie-express`](https://www.npmjs.com/package/universal-cookie-express) - Hook cookies get/set on Express for server-rendering | ||
## Minimum requirement | ||
### react-cookie @ v3.0+ | ||
- React.js >= 16.3.0 (new context API + forward ref) | ||
- React.js >= 16.3.0 (new context API + forward ref) | ||
### react-cookie @ v0.0-v2.2 | ||
- React.js >= 15 | ||
- React.js >= 15 | ||
## Getting started | ||
@@ -39,2 +43,3 @@ | ||
## `<CookiesProvider />` | ||
Set the user cookies | ||
@@ -44,22 +49,77 @@ | ||
## `useCookies()` | ||
Access and modify cookies using React hooks. | ||
```jsx | ||
const [cookies, setCookie, removeCookie] = useCookies([dependencies]); | ||
``` | ||
**React hooks are available starting from React 16.8** | ||
### `dependencies` (optional) | ||
Let you optionally specify a list of cookie names your component depend on or that should trigger a re-render. If unspecified, it will render on every cookie change. | ||
### `cookies` | ||
Javascript object with all your cookies. The key is the cookie name. | ||
### `setCookie(name, value, [options])` | ||
Set a cookie value | ||
- name (string): cookie name | ||
- value (string|object): save the value and stringify the object if needed | ||
- options (object): Support all the cookie options from RFC 6265 | ||
- path (string): cookie path, use `/` as the path if you want your cookie to be accessible on all pages | ||
- expires (Date): absolute expiration date for the cookie | ||
- maxAge (number): relative max age of the cookie from when the client receives it in second | ||
- domain (string): domain for the cookie (sub.domain.com or .allsubdomains.com) | ||
- secure (boolean): Is only accessible through HTTPS? | ||
- httpOnly (boolean): Is only the server can access the cookie? | ||
- sameSite (boolean|lax|strict): Strict or Lax enforcement | ||
### `removeCookie(name, [options])` | ||
Remove a cookie | ||
- name (string): cookie name | ||
- options (object): Support all the cookie options from RFC 6265 | ||
- path (string): cookie path, use `/` as the path if you want your cookie to be accessible on all pages | ||
- expires (Date): absolute expiration date for the cookie | ||
- maxAge (number): relative max age of the cookie from when the client receives it in second | ||
- domain (string): domain for the cookie (sub.domain.com or .allsubdomains.com) | ||
- secure (boolean): Is only accessible through HTTPS? | ||
- httpOnly (boolean): Is only the server can access the cookie? | ||
- sameSite (boolean|lax|strict): Strict or Lax enforcement | ||
## `withCookies(Component)` | ||
Give access to your cookies anywhere. Add the following props to your component: | ||
- cookies: Cookies instance allowing you to get, set and remove cookies. | ||
- allCookies: All your current cookies in an object. | ||
- cookies: Cookies instance allowing you to get, set and remove cookies. | ||
- allCookies: All your current cookies in an object. | ||
## Cookies | ||
### `get(name, [options])` | ||
Get a cookie value | ||
- name (string): cookie name | ||
- options (object): | ||
- doNotParse (boolean): do not convert the cookie into an object no matter what | ||
- name (string): cookie name | ||
- options (object): | ||
- doNotParse (boolean): do not convert the cookie into an object no matter what | ||
### `getAll([options])` | ||
Get all cookies | ||
- options (object): | ||
- doNotParse (boolean): do not convert the cookie into an object no matter what | ||
- options (object): | ||
- doNotParse (boolean): do not convert the cookie into an object no matter what | ||
### `set(name, value, [options])` | ||
Set a cookie value | ||
- name (string): cookie name | ||
@@ -77,3 +137,5 @@ - value (string|object): save the value and stringify the object if needed | ||
### `remove(name, [options])` | ||
Remove a cookie | ||
- name (string): cookie name | ||
@@ -89,3 +151,4 @@ - options (object): Support all the cookie options from RFC 6265 | ||
## Simple Example | ||
## Simple Example with React hooks | ||
```js | ||
@@ -108,47 +171,44 @@ // Root.jsx | ||
// App.jsx | ||
import React, { Component } from 'react'; | ||
import { instanceOf } from 'prop-types'; | ||
import { withCookies, Cookies } from 'react-cookie'; | ||
import React from 'react'; | ||
import { useCookies } from 'react-cookie'; | ||
import NameForm from './NameForm'; | ||
class App extends Component { | ||
static propTypes = { | ||
cookies: instanceOf(Cookies).isRequired | ||
}; | ||
function App() { | ||
const [cookies, setCookie] = useCookies(['name']); | ||
constructor(props) { | ||
super(props); | ||
const { cookies } = props; | ||
this.state = { | ||
name: cookies.get('name') || 'Ben' | ||
}; | ||
function onChange(newName) { | ||
setCookie('name', newName, { path: '/' }); | ||
} | ||
handleNameChange(name) { | ||
const { cookies } = this.props; | ||
return ( | ||
<div> | ||
<NameForm name={cookies.name} onChange={onChange} /> | ||
{cookies.name && <h1>Hello {cookies.name}!</h1>} | ||
</div> | ||
); | ||
} | ||
cookies.set('name', name, { path: '/' }); | ||
this.setState({ name }); | ||
} | ||
export default App; | ||
``` | ||
render() { | ||
const { name } = this.state; | ||
## Simple Example with Higher-Order Component | ||
return ( | ||
<div> | ||
<NameForm name={name} onChange={this.handleNameChange.bind(this)} /> | ||
{this.state.name && <h1>Hello {this.state.name}!</h1>} | ||
</div> | ||
); | ||
} | ||
```js | ||
// Root.jsx | ||
import React from 'react'; | ||
import App from './App'; | ||
import { CookiesProvider } from 'react-cookie'; | ||
export default function Root() { | ||
return ( | ||
<CookiesProvider> | ||
<App /> | ||
</CookiesProvider> | ||
); | ||
} | ||
export default withCookies(App); | ||
``` | ||
## Server-Rendering Example | ||
```js | ||
// src/components/App.js | ||
// App.jsx | ||
import React, { Component } from 'react'; | ||
@@ -196,3 +256,30 @@ import { instanceOf } from 'prop-types'; | ||
## Server-Rendering Example | ||
```js | ||
// src/components/App.js | ||
import React from 'react'; | ||
import { useCookies } from 'react-cookie'; | ||
import NameForm from './NameForm'; | ||
function App() { | ||
const [cookies, setCookie] = useCookies(['name']); | ||
function onChange(newName) { | ||
setCookie('name', newName, { path: '/' }); | ||
} | ||
return ( | ||
<div> | ||
<NameForm name={cookies.name} onChange={onChange} /> | ||
{cookies.name && <h1>Hello {cookies.name}!</h1>} | ||
</div> | ||
); | ||
} | ||
export default App; | ||
``` | ||
```js | ||
// src/server.js | ||
@@ -199,0 +286,0 @@ import React from 'react'; |
@@ -5,6 +5,6 @@ (function (global, factory) { | ||
(global.ReactCookie = factory(global.UniversalCookie,global.React)); | ||
}(this, (function (require$$1,require$$0) { 'use strict'; | ||
}(this, (function (universalCookie,_react) { 'use strict'; | ||
require$$1 = require$$1 && require$$1.hasOwnProperty('default') ? require$$1['default'] : require$$1; | ||
require$$0 = require$$0 && require$$0.hasOwnProperty('default') ? require$$0['default'] : require$$0; | ||
universalCookie = universalCookie && universalCookie.hasOwnProperty('default') ? universalCookie['default'] : universalCookie; | ||
_react = _react && _react.hasOwnProperty('default') ? _react['default'] : _react; | ||
@@ -26,3 +26,3 @@ function unwrapExports (x) { | ||
var _universalCookie = _interopRequireDefault(require$$1); | ||
var _universalCookie = _interopRequireDefault(universalCookie); | ||
@@ -33,3 +33,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = _default; | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; | ||
}); | ||
@@ -39,3 +39,3 @@ | ||
var CookiesContext = createCommonjsModule(function (module, exports) { | ||
var CookiesContext_1 = createCommonjsModule(function (module, exports) { | ||
@@ -45,7 +45,7 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.Consumer = exports.Provider = void 0; | ||
exports.default = exports.Consumer = exports.Provider = void 0; | ||
var React = _interopRequireWildcard(require$$0); | ||
var React = _interopRequireWildcard(_react); | ||
var _universalCookie = _interopRequireDefault(require$$1); | ||
var _Cookies = _interopRequireDefault(Cookies); | ||
@@ -56,13 +56,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _a; | ||
var Provider = (_a = React.createContext(new _universalCookie.default()), _a.Provider), | ||
Consumer = _a.Consumer; | ||
var CookiesContext = React.createContext(new _Cookies.default()); | ||
var Provider = CookiesContext.Provider, | ||
Consumer = CookiesContext.Consumer; | ||
exports.Consumer = Consumer; | ||
exports.Provider = Provider; | ||
var _default = CookiesContext; | ||
exports.default = _default; | ||
}); | ||
unwrapExports(CookiesContext); | ||
var CookiesContext_1 = CookiesContext.Consumer; | ||
var CookiesContext_2 = CookiesContext.Provider; | ||
unwrapExports(CookiesContext_1); | ||
var CookiesContext_2 = CookiesContext_1.Consumer; | ||
var CookiesContext_3 = CookiesContext_1.Provider; | ||
@@ -76,5 +77,5 @@ var CookiesProvider_1 = createCommonjsModule(function (module, exports) { | ||
var React = _interopRequireWildcard(require$$0); | ||
var React = _interopRequireWildcard(_react); | ||
var _universalCookie = _interopRequireDefault(require$$1); | ||
var _universalCookie = _interopRequireDefault(universalCookie); | ||
@@ -131,3 +132,3 @@ | ||
CookiesProvider.prototype.render = function () { | ||
return React.createElement(CookiesContext.Provider, { | ||
return React.createElement(CookiesContext_1.Provider, { | ||
value: this.cookies | ||
@@ -142,3 +143,3 @@ }, this.props.children); | ||
exports.default = _default; | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; | ||
}); | ||
@@ -149,6 +150,8 @@ | ||
var reactIs_production_min = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports,"__esModule",{value:!0});var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.forward_ref"):60112,n=b?Symbol.for("react.timeout"):60113; | ||
function q(a){if("object"===typeof a&&null!==a){var p=a.$$typeof;switch(p){case c:switch(a=a.type,a){case l:case e:case g:case f:return a;default:switch(a=a&&a.$$typeof,a){case k:case m:case h:return a;default:return p}}case d:return p}}}exports.typeOf=q;exports.AsyncMode=l;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=m;exports.Fragment=e;exports.Profiler=g;exports.Portal=d;exports.StrictMode=f; | ||
exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===l||a===g||a===f||a===n||"object"===typeof a&&null!==a&&(a.$$typeof===h||a.$$typeof===k||a.$$typeof===m)};exports.isAsyncMode=function(a){return q(a)===l};exports.isContextConsumer=function(a){return q(a)===k};exports.isContextProvider=function(a){return q(a)===h};exports.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return q(a)===m}; | ||
exports.isFragment=function(a){return q(a)===e};exports.isProfiler=function(a){return q(a)===g};exports.isPortal=function(a){return q(a)===d};exports.isStrictMode=function(a){return q(a)===f}; | ||
Object.defineProperty(exports,"__esModule",{value:!0}); | ||
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"): | ||
60115,r=b?Symbol.for("react.lazy"):60116;function t(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return u}}case r:case q:case d:return u}}}function v(a){return t(a)===m}exports.typeOf=t;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n; | ||
exports.Fragment=e;exports.Lazy=r;exports.Memo=q;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n)};exports.isAsyncMode=function(a){return v(a)||t(a)===l};exports.isConcurrentMode=v;exports.isContextConsumer=function(a){return t(a)===k}; | ||
exports.isContextProvider=function(a){return t(a)===h};exports.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return t(a)===n};exports.isFragment=function(a){return t(a)===e};exports.isLazy=function(a){return t(a)===r};exports.isMemo=function(a){return t(a)===q};exports.isPortal=function(a){return t(a)===d};exports.isProfiler=function(a){return t(a)===g};exports.isStrictMode=function(a){return t(a)===f}; | ||
exports.isSuspense=function(a){return t(a)===p}; | ||
}); | ||
@@ -159,20 +162,28 @@ | ||
var reactIs_production_min_2 = reactIs_production_min.AsyncMode; | ||
var reactIs_production_min_3 = reactIs_production_min.ContextConsumer; | ||
var reactIs_production_min_4 = reactIs_production_min.ContextProvider; | ||
var reactIs_production_min_5 = reactIs_production_min.Element; | ||
var reactIs_production_min_6 = reactIs_production_min.ForwardRef; | ||
var reactIs_production_min_7 = reactIs_production_min.Fragment; | ||
var reactIs_production_min_8 = reactIs_production_min.Profiler; | ||
var reactIs_production_min_9 = reactIs_production_min.Portal; | ||
var reactIs_production_min_10 = reactIs_production_min.StrictMode; | ||
var reactIs_production_min_11 = reactIs_production_min.isValidElementType; | ||
var reactIs_production_min_12 = reactIs_production_min.isAsyncMode; | ||
var reactIs_production_min_13 = reactIs_production_min.isContextConsumer; | ||
var reactIs_production_min_14 = reactIs_production_min.isContextProvider; | ||
var reactIs_production_min_15 = reactIs_production_min.isElement; | ||
var reactIs_production_min_16 = reactIs_production_min.isForwardRef; | ||
var reactIs_production_min_17 = reactIs_production_min.isFragment; | ||
var reactIs_production_min_18 = reactIs_production_min.isProfiler; | ||
var reactIs_production_min_19 = reactIs_production_min.isPortal; | ||
var reactIs_production_min_20 = reactIs_production_min.isStrictMode; | ||
var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode; | ||
var reactIs_production_min_4 = reactIs_production_min.ContextConsumer; | ||
var reactIs_production_min_5 = reactIs_production_min.ContextProvider; | ||
var reactIs_production_min_6 = reactIs_production_min.Element; | ||
var reactIs_production_min_7 = reactIs_production_min.ForwardRef; | ||
var reactIs_production_min_8 = reactIs_production_min.Fragment; | ||
var reactIs_production_min_9 = reactIs_production_min.Lazy; | ||
var reactIs_production_min_10 = reactIs_production_min.Memo; | ||
var reactIs_production_min_11 = reactIs_production_min.Portal; | ||
var reactIs_production_min_12 = reactIs_production_min.Profiler; | ||
var reactIs_production_min_13 = reactIs_production_min.StrictMode; | ||
var reactIs_production_min_14 = reactIs_production_min.Suspense; | ||
var reactIs_production_min_15 = reactIs_production_min.isValidElementType; | ||
var reactIs_production_min_16 = reactIs_production_min.isAsyncMode; | ||
var reactIs_production_min_17 = reactIs_production_min.isConcurrentMode; | ||
var reactIs_production_min_18 = reactIs_production_min.isContextConsumer; | ||
var reactIs_production_min_19 = reactIs_production_min.isContextProvider; | ||
var reactIs_production_min_20 = reactIs_production_min.isElement; | ||
var reactIs_production_min_21 = reactIs_production_min.isForwardRef; | ||
var reactIs_production_min_22 = reactIs_production_min.isFragment; | ||
var reactIs_production_min_23 = reactIs_production_min.isLazy; | ||
var reactIs_production_min_24 = reactIs_production_min.isMemo; | ||
var reactIs_production_min_25 = reactIs_production_min.isPortal; | ||
var reactIs_production_min_26 = reactIs_production_min.isProfiler; | ||
var reactIs_production_min_27 = reactIs_production_min.isStrictMode; | ||
var reactIs_production_min_28 = reactIs_production_min.isSuspense; | ||
@@ -200,4 +211,7 @@ var reactIs_development = createCommonjsModule(function (module, exports) { | ||
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; | ||
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; | ||
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; | ||
var REACT_TIMEOUT_TYPE = hasSymbol ? Symbol.for('react.timeout') : 0xead1; | ||
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; | ||
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; | ||
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; | ||
@@ -207,9 +221,61 @@ function isValidElementType(type) { | ||
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. | ||
type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_TIMEOUT_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE); | ||
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE); | ||
} | ||
/** | ||
* Forked from fbjs/warning: | ||
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js | ||
* | ||
* Only change is we use console.warn instead of console.error, | ||
* and do nothing when 'console' is not supported. | ||
* This really simplifies the code. | ||
* --- | ||
* Similar to invariant but only logs a warning if the condition is not met. | ||
* This can be used to log issues in development environments in critical | ||
* paths. Removing the logging code for production environments will keep the | ||
* same logic and follow the same code paths. | ||
*/ | ||
var lowPriorityWarning = function () {}; | ||
{ | ||
var printWarning = function (format) { | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
var argIndex = 0; | ||
var message = 'Warning: ' + format.replace(/%s/g, function () { | ||
return args[argIndex++]; | ||
}); | ||
if (typeof console !== 'undefined') { | ||
console.warn(message); | ||
} | ||
try { | ||
// --- Welcome to debugging React --- | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch (x) {} | ||
}; | ||
lowPriorityWarning = function (condition, format) { | ||
if (format === undefined) { | ||
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument'); | ||
} | ||
if (!condition) { | ||
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
args[_key2 - 2] = arguments[_key2]; | ||
} | ||
printWarning.apply(undefined, [format].concat(args)); | ||
} | ||
}; | ||
} | ||
var lowPriorityWarning$1 = lowPriorityWarning; | ||
function typeOf(object) { | ||
if (typeof object === 'object' && object !== null) { | ||
var $$typeof = object.$$typeof; | ||
switch ($$typeof) { | ||
@@ -221,5 +287,7 @@ case REACT_ELEMENT_TYPE: | ||
case REACT_ASYNC_MODE_TYPE: | ||
case REACT_CONCURRENT_MODE_TYPE: | ||
case REACT_FRAGMENT_TYPE: | ||
case REACT_PROFILER_TYPE: | ||
case REACT_STRICT_MODE_TYPE: | ||
case REACT_SUSPENSE_TYPE: | ||
return type; | ||
@@ -238,2 +306,4 @@ default: | ||
} | ||
case REACT_LAZY_TYPE: | ||
case REACT_MEMO_TYPE: | ||
case REACT_PORTAL_TYPE: | ||
@@ -247,3 +317,5 @@ return $$typeof; | ||
// AsyncMode is deprecated along with isAsyncMode | ||
var AsyncMode = REACT_ASYNC_MODE_TYPE; | ||
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; | ||
var ContextConsumer = REACT_CONTEXT_TYPE; | ||
@@ -254,9 +326,24 @@ var ContextProvider = REACT_PROVIDER_TYPE; | ||
var Fragment = REACT_FRAGMENT_TYPE; | ||
var Lazy = REACT_LAZY_TYPE; | ||
var Memo = REACT_MEMO_TYPE; | ||
var Portal = REACT_PORTAL_TYPE; | ||
var Profiler = REACT_PROFILER_TYPE; | ||
var Portal = REACT_PORTAL_TYPE; | ||
var StrictMode = REACT_STRICT_MODE_TYPE; | ||
var Suspense = REACT_SUSPENSE_TYPE; | ||
var hasWarnedAboutDeprecatedIsAsyncMode = false; | ||
// AsyncMode should be deprecated | ||
function isAsyncMode(object) { | ||
return typeOf(object) === REACT_ASYNC_MODE_TYPE; | ||
{ | ||
if (!hasWarnedAboutDeprecatedIsAsyncMode) { | ||
hasWarnedAboutDeprecatedIsAsyncMode = true; | ||
lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); | ||
} | ||
} | ||
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; | ||
} | ||
function isConcurrentMode(object) { | ||
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; | ||
} | ||
function isContextConsumer(object) { | ||
@@ -277,14 +364,24 @@ return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} | ||
function isProfiler(object) { | ||
return typeOf(object) === REACT_PROFILER_TYPE; | ||
function isLazy(object) { | ||
return typeOf(object) === REACT_LAZY_TYPE; | ||
} | ||
function isMemo(object) { | ||
return typeOf(object) === REACT_MEMO_TYPE; | ||
} | ||
function isPortal(object) { | ||
return typeOf(object) === REACT_PORTAL_TYPE; | ||
} | ||
function isProfiler(object) { | ||
return typeOf(object) === REACT_PROFILER_TYPE; | ||
} | ||
function isStrictMode(object) { | ||
return typeOf(object) === REACT_STRICT_MODE_TYPE; | ||
} | ||
function isSuspense(object) { | ||
return typeOf(object) === REACT_SUSPENSE_TYPE; | ||
} | ||
exports.typeOf = typeOf; | ||
exports.AsyncMode = AsyncMode; | ||
exports.ConcurrentMode = ConcurrentMode; | ||
exports.ContextConsumer = ContextConsumer; | ||
@@ -295,7 +392,11 @@ exports.ContextProvider = ContextProvider; | ||
exports.Fragment = Fragment; | ||
exports.Lazy = Lazy; | ||
exports.Memo = Memo; | ||
exports.Portal = Portal; | ||
exports.Profiler = Profiler; | ||
exports.Portal = Portal; | ||
exports.StrictMode = StrictMode; | ||
exports.Suspense = Suspense; | ||
exports.isValidElementType = isValidElementType; | ||
exports.isAsyncMode = isAsyncMode; | ||
exports.isConcurrentMode = isConcurrentMode; | ||
exports.isContextConsumer = isContextConsumer; | ||
@@ -306,5 +407,8 @@ exports.isContextProvider = isContextProvider; | ||
exports.isFragment = isFragment; | ||
exports.isLazy = isLazy; | ||
exports.isMemo = isMemo; | ||
exports.isPortal = isPortal; | ||
exports.isProfiler = isProfiler; | ||
exports.isPortal = isPortal; | ||
exports.isStrictMode = isStrictMode; | ||
exports.isSuspense = isSuspense; | ||
})(); | ||
@@ -317,20 +421,28 @@ } | ||
var reactIs_development_2 = reactIs_development.AsyncMode; | ||
var reactIs_development_3 = reactIs_development.ContextConsumer; | ||
var reactIs_development_4 = reactIs_development.ContextProvider; | ||
var reactIs_development_5 = reactIs_development.Element; | ||
var reactIs_development_6 = reactIs_development.ForwardRef; | ||
var reactIs_development_7 = reactIs_development.Fragment; | ||
var reactIs_development_8 = reactIs_development.Profiler; | ||
var reactIs_development_9 = reactIs_development.Portal; | ||
var reactIs_development_10 = reactIs_development.StrictMode; | ||
var reactIs_development_11 = reactIs_development.isValidElementType; | ||
var reactIs_development_12 = reactIs_development.isAsyncMode; | ||
var reactIs_development_13 = reactIs_development.isContextConsumer; | ||
var reactIs_development_14 = reactIs_development.isContextProvider; | ||
var reactIs_development_15 = reactIs_development.isElement; | ||
var reactIs_development_16 = reactIs_development.isForwardRef; | ||
var reactIs_development_17 = reactIs_development.isFragment; | ||
var reactIs_development_18 = reactIs_development.isProfiler; | ||
var reactIs_development_19 = reactIs_development.isPortal; | ||
var reactIs_development_20 = reactIs_development.isStrictMode; | ||
var reactIs_development_3 = reactIs_development.ConcurrentMode; | ||
var reactIs_development_4 = reactIs_development.ContextConsumer; | ||
var reactIs_development_5 = reactIs_development.ContextProvider; | ||
var reactIs_development_6 = reactIs_development.Element; | ||
var reactIs_development_7 = reactIs_development.ForwardRef; | ||
var reactIs_development_8 = reactIs_development.Fragment; | ||
var reactIs_development_9 = reactIs_development.Lazy; | ||
var reactIs_development_10 = reactIs_development.Memo; | ||
var reactIs_development_11 = reactIs_development.Portal; | ||
var reactIs_development_12 = reactIs_development.Profiler; | ||
var reactIs_development_13 = reactIs_development.StrictMode; | ||
var reactIs_development_14 = reactIs_development.Suspense; | ||
var reactIs_development_15 = reactIs_development.isValidElementType; | ||
var reactIs_development_16 = reactIs_development.isAsyncMode; | ||
var reactIs_development_17 = reactIs_development.isConcurrentMode; | ||
var reactIs_development_18 = reactIs_development.isContextConsumer; | ||
var reactIs_development_19 = reactIs_development.isContextProvider; | ||
var reactIs_development_20 = reactIs_development.isElement; | ||
var reactIs_development_21 = reactIs_development.isForwardRef; | ||
var reactIs_development_22 = reactIs_development.isFragment; | ||
var reactIs_development_23 = reactIs_development.isLazy; | ||
var reactIs_development_24 = reactIs_development.isMemo; | ||
var reactIs_development_25 = reactIs_development.isPortal; | ||
var reactIs_development_26 = reactIs_development.isProfiler; | ||
var reactIs_development_27 = reactIs_development.isStrictMode; | ||
var reactIs_development_28 = reactIs_development.isSuspense; | ||
@@ -344,6 +456,2 @@ var reactIs = createCommonjsModule(function (module) { | ||
var _ReactIs$ForwardRef; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
/** | ||
@@ -354,5 +462,5 @@ * Copyright 2015, Yahoo! Inc. | ||
var REACT_STATICS = { | ||
childContextTypes: true, | ||
contextType: true, | ||
contextTypes: true, | ||
@@ -362,2 +470,3 @@ defaultProps: true, | ||
getDefaultProps: true, | ||
getDerivedStateFromError: true, | ||
getDerivedStateFromProps: true, | ||
@@ -379,4 +488,29 @@ mixins: true, | ||
var TYPE_STATICS = _defineProperty({}, reactIs.ForwardRef, (_ReactIs$ForwardRef = {}, _defineProperty(_ReactIs$ForwardRef, '$$typeof', true), _defineProperty(_ReactIs$ForwardRef, 'render', true), _ReactIs$ForwardRef)); | ||
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; | ||
function getStatics(component) { | ||
if (reactIs.isMemo(component)) { | ||
return MEMO_STATICS; | ||
} | ||
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; | ||
} | ||
var defineProperty = Object.defineProperty; | ||
@@ -406,4 +540,4 @@ var getOwnPropertyNames = Object.getOwnPropertyNames; | ||
var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS; | ||
var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS; | ||
var targetStatics = getStatics(targetComponent); | ||
var sourceStatics = getStatics(sourceComponent); | ||
@@ -436,3 +570,3 @@ for (var i = 0; i < keys.length; ++i) { | ||
var React = _interopRequireWildcard(require$$0); | ||
var React = _interopRequireWildcard(_react); | ||
@@ -564,3 +698,3 @@ | ||
var CookieWrapperWithRefAndCookieConsumer = React.forwardRef(function (props, ref) { | ||
return React.createElement(CookiesContext.Consumer, null, function (cookies) { | ||
return React.createElement(CookiesContext_1.Consumer, null, function (cookies) { | ||
return React.createElement(CookieWrapper, __assign({ | ||
@@ -578,3 +712,3 @@ cookies: cookies | ||
module.exports = exports["default"]; | ||
module.exports = exports.default; | ||
}); | ||
@@ -584,2 +718,66 @@ | ||
var useCookies_1 = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = useCookies; | ||
var _CookiesContext = _interopRequireDefault(CookiesContext_1); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function useCookies(dependencies) { | ||
var cookies = (0, _react.useContext)(_CookiesContext.default); | ||
if (!cookies) { | ||
throw new Error('Missing <CookiesProvider>'); | ||
} | ||
var initialCookies = cookies.getAll(); | ||
var _a = (0, _react.useState)(initialCookies), | ||
allCookies = _a[0], | ||
setCookies = _a[1]; | ||
(0, _react.useEffect)(function () { | ||
function onChange() { | ||
var newCookies = cookies.getAll(); | ||
if (shouldUpdate(dependencies || null, newCookies, allCookies)) { | ||
setCookies(cookies.getAll()); | ||
} | ||
} | ||
cookies.addChangeListener(onChange); | ||
return function () { | ||
cookies.removeChangeListener(onChange); | ||
}; | ||
}, [cookies]); | ||
return [allCookies, cookies.set.bind(cookies), cookies.remove.bind(cookies)]; | ||
} | ||
function shouldUpdate(dependencies, newCookies, oldCookies) { | ||
if (!dependencies) { | ||
return true; | ||
} | ||
for (var _i = 0, dependencies_1 = dependencies; _i < dependencies_1.length; _i++) { | ||
var dependency = dependencies_1[_i]; | ||
if (newCookies[dependency] !== oldCookies[dependency]) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
module.exports = exports.default; | ||
}); | ||
unwrapExports(useCookies_1); | ||
var cjs = createCommonjsModule(function (module, exports) { | ||
@@ -608,2 +806,8 @@ | ||
}); | ||
Object.defineProperty(exports, "useCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _useCookies.default; | ||
} | ||
}); | ||
@@ -616,2 +820,4 @@ var _Cookies = _interopRequireDefault(Cookies); | ||
var _useCookies = _interopRequireDefault(useCookies_1); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -618,0 +824,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(u,a){"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}u=u&&u.hasOwnProperty("default")?u.default:u,a=a&&a.hasOwnProperty("default")?a.default:a;var f=t(function(e,t){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=((r=u)&&r.__esModule?r:{default:r}).default;t.default=o,e.exports=t.default});e(f);var s=t(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Consumer=t.Provider=void 0;var r,o,n=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}}(a),i=(r=u)&&r.__esModule?r:{default:r};var f=(o=n.createContext(new i.default)).Provider,c=o.Consumer;t.Consumer=c,t.Provider=f});e(s);s.Consumer,s.Provider;var c=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}}(a),n=(r=u)&&r.__esModule?r:{default:r};var i,f=(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)}),c=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 f(e,r),e.prototype.render=function(){return o.createElement(s.Provider,{value:this.cookies},this.props.children)},e}(o.Component);t.default=c,e.exports=t.default});e(c);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,f=r?Symbol.for("react.strict_mode"):60108,c=r?Symbol.for("react.profiler"):60114,u=r?Symbol.for("react.provider"):60109,a=r?Symbol.for("react.context"):60110,s=r?Symbol.for("react.async_mode"):60111,l=r?Symbol.for("react.forward_ref"):60112,p=r?Symbol.for("react.timeout"):60113;function d(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case s:case i:case c:case f:return e;default:switch(e=e&&e.$$typeof){case a:case l:case u:return e;default:return t}}case n:return t}}}t.typeOf=d,t.AsyncMode=s,t.ContextConsumer=a,t.ContextProvider=u,t.Element=o,t.ForwardRef=l,t.Fragment=i,t.Profiler=c,t.Portal=n,t.StrictMode=f,t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===s||e===c||e===f||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===u||e.$$typeof===a||e.$$typeof===l)},t.isAsyncMode=function(e){return d(e)===s},t.isContextConsumer=function(e){return d(e)===a},t.isContextProvider=function(e){return d(e)===u},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return d(e)===l},t.isFragment=function(e){return d(e)===i},t.isProfiler=function(e){return d(e)===c},t.isPortal=function(e){return d(e)===n},t.isStrictMode=function(e){return d(e)===f}});e(r);r.typeOf,r.AsyncMode,r.ContextConsumer,r.ContextProvider,r.Element,r.ForwardRef,r.Fragment,r.Profiler,r.Portal,r.StrictMode,r.isValidElementType,r.isAsyncMode,r.isContextConsumer,r.isContextProvider,r.isElement,r.isForwardRef,r.isFragment,r.isProfiler,r.isPortal,r.isStrictMode;var o=t(function(e,t){});e(o);o.typeOf,o.AsyncMode,o.ContextConsumer,o.ContextProvider,o.Element,o.ForwardRef,o.Fragment,o.Profiler,o.Portal,o.StrictMode,o.isValidElementType,o.isAsyncMode,o.isContextConsumer,o.isContextProvider,o.isElement,o.isForwardRef,o.isFragment,o.isProfiler,o.isPortal,o.isStrictMode;var n,i=t(function(e){e.exports=r});function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var p={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},d={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},y=l({},i.ForwardRef,(l(n={},"$$typeof",!0),l(n,"render",!0),n)),m=Object.defineProperty,v=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols,P=Object.getOwnPropertyDescriptor,b=Object.getPrototypeOf,h=Object.prototype;var _=function e(t,r,o){if("string"!=typeof r){if(h){var n=b(r);n&&n!==h&&e(t,n,o)}var i=v(r);O&&(i=i.concat(O(r)));for(var f=y[t.$$typeof]||p,c=y[r.$$typeof]||p,u=0;u<i.length;++u){var a=i[u];if(!(d[a]||o&&o[a]||c&&c[a]||f&&f[a])){var s=P(r,a);try{m(t,a,s)}catch(e){}}}return t}return t},j=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=u(e,["forwardedRef","cookies"]),n=r.getAll();return f.createElement(i,c({},o,{ref:t,cookies:r,allCookies:n}))},e.displayName="withCookies("+r+")",e.WrapperComponent=i,e}(f.Component),e=f.forwardRef(function(t,r){return f.createElement(s.Consumer,null,function(e){return f.createElement(o,c({cookies:e},t,{forwardedRef:r}))})});return _(e,i,{WrappedComponent:!0})};var f=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}}(a);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)}),c=function(){return(c=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)},u=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});return e(j),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}});var r=i(f),o=i(c),n=i(j);function i(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 l=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(l);l.Consumer,l.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(l.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,s=r?Symbol.for("react.context"):60110,c=r?Symbol.for("react.async_mode"):60111,l=r?Symbol.for("react.concurrent_mode"):60111,p=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 c:case l:case i:case a:case u:case d:return e;default:switch(e=e&&e.$$typeof){case s:case p:case f:return e;default:return t}}case m:case y:case n:return t}}}function P(e){return v(e)===l}t.typeOf=v,t.AsyncMode=c,t.ConcurrentMode=l,t.ContextConsumer=s,t.ContextProvider=f,t.Element=o,t.ForwardRef=p,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===l||e===a||e===u||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===y||e.$$typeof===f||e.$$typeof===s||e.$$typeof===p)},t.isAsyncMode=function(e){return P(e)||v(e)===c},t.isConcurrentMode=P,t.isContextConsumer=function(e){return v(e)===s},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)===p},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},p={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 s=i[f];if(!(p[s]||o&&o[s]||a&&a[s]||u&&u[s])){var c=O(r,s);try{m(t,s,c)}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(l.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)(u.default);if(!r)throw new Error("Missing <CookiesProvider>");var e=r.getAll(),o=(0,s.useState)(e),n=o[0],i=o[1];return(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,n)&&i(r.getAll())}return r.addChangeListener(e),function(){r.removeChangeListener(e)}},[r]),[n,r.set.bind(r),r.remove.bind(r)]};var r,u=(r=l)&&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}}}))}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81527
47
1510
336
Updateduniversal-cookie@^3.1.0