react-cookie
Advanced tools
Comparing version 4.1.1 to 5.0.0
import Cookies from 'universal-cookie'; | ||
export default Cookies; |
@@ -7,9 +7,6 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _universalCookie = _interopRequireDefault(require("universal-cookie")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _default = _universalCookie["default"]; | ||
exports["default"] = _default; | ||
module.exports = exports.default; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = exports.Consumer = exports.Provider = void 0; | ||
exports["default"] = exports.Provider = exports.Consumer = void 0; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _Cookies = _interopRequireDefault(require("./Cookies")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var CookiesContext = /*#__PURE__*/React.createContext(new _Cookies["default"]()); | ||
var Provider = CookiesContext.Provider, | ||
Consumer = CookiesContext.Consumer; | ||
Consumer = CookiesContext.Consumer; | ||
exports.Consumer = Consumer; | ||
@@ -24,0 +17,0 @@ exports.Provider = Provider; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,47 +8,27 @@ value: true | ||
exports["default"] = void 0; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _universalCookie = _interopRequireDefault(require("universal-cookie")); | ||
var _CookiesContext = require("./CookiesContext"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var __extends = void 0 && (void 0).__extends || function () { | ||
var _extendStatics = function extendStatics(d, b) { | ||
_extendStatics = Object.setPrototypeOf || { | ||
__proto__: [] | ||
} instanceof Array && function (d, b) { | ||
d.__proto__ = b; | ||
} || function (d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
} | ||
}; | ||
return _extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
_extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
}(); | ||
var CookiesProvider = function (_super) { | ||
__extends(CookiesProvider, _super); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var CookiesProvider = /*#__PURE__*/function (_React$Component) { | ||
_inherits(CookiesProvider, _React$Component); | ||
var _super = _createSuper(CookiesProvider); | ||
function CookiesProvider(props) { | ||
var _this = _super.call(this, props) || this; | ||
var _this; | ||
_classCallCheck(this, CookiesProvider); | ||
_this = _super.call(this, props); | ||
if (props.cookies) { | ||
@@ -60,17 +39,15 @@ _this.cookies = props.cookies; | ||
} | ||
return _this; | ||
} | ||
CookiesProvider.prototype.render = function () { | ||
return /*#__PURE__*/React.createElement(_CookiesContext.Provider, { | ||
value: this.cookies | ||
}, this.props.children); | ||
}; | ||
_createClass(CookiesProvider, [{ | ||
key: "render", | ||
value: function render() { | ||
return /*#__PURE__*/React.createElement(_CookiesContext.Provider, { | ||
value: this.cookies | ||
}, this.props.children); | ||
} | ||
}]); | ||
return CookiesProvider; | ||
}(React.Component); | ||
var _default = CookiesProvider; | ||
exports["default"] = _default; | ||
exports["default"] = CookiesProvider; | ||
module.exports = exports.default; |
@@ -0,0 +0,0 @@ export { default as Cookies } from './Cookies'; |
@@ -24,25 +24,19 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "withCookies", { | ||
Object.defineProperty(exports, "useCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _withCookies["default"]; | ||
return _useCookies["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "useCookies", { | ||
Object.defineProperty(exports, "withCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _useCookies["default"]; | ||
return _withCookies["default"]; | ||
} | ||
}); | ||
var _Cookies = _interopRequireDefault(require("./Cookies")); | ||
var _CookiesProvider = _interopRequireDefault(require("./CookiesProvider")); | ||
var _withCookies = _interopRequireDefault(require("./withCookies")); | ||
var _useCookies = _interopRequireDefault(require("./useCookies")); | ||
var _types = require("./types"); | ||
Object.keys(_types).forEach(function (key) { | ||
@@ -59,3 +53,2 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
/// <reference types="react" /> | ||
import Cookies, { Cookie } from 'universal-cookie'; | ||
export declare type ReactCookieProps = { | ||
export type ReactCookieProps = { | ||
cookies?: Cookies; | ||
@@ -5,0 +5,0 @@ allCookies?: { |
@@ -1,1 +0,5 @@ | ||
"use strict"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); |
import { Cookie, CookieSetOptions } from 'universal-cookie'; | ||
export default function useCookies<T extends string, U = { | ||
[K in T]?: any; | ||
}>(dependencies?: T[]): [U, (name: T, value: Cookie, options?: CookieSetOptions) => void, (name: T, options?: CookieSetOptions) => void]; | ||
}>(dependencies?: T[]): [ | ||
U, | ||
(name: T, value: Cookie, options?: CookieSetOptions) => void, | ||
(name: T, options?: CookieSetOptions) => void | ||
]; |
@@ -7,26 +7,24 @@ "use strict"; | ||
exports["default"] = useCookies; | ||
var _react = require("react"); | ||
var _CookiesContext = _interopRequireDefault(require("./CookiesContext")); | ||
var _utils = require("./utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
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]; | ||
var _useState = (0, _react.useState)(initialCookies), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
allCookies = _useState2[0], | ||
setCookies = _useState2[1]; | ||
var previousCookiesRef = (0, _react.useRef)(allCookies); | ||
if ((0, _utils.isInBrowser)()) { | ||
@@ -36,10 +34,7 @@ (0, _react.useLayoutEffect)(function () { | ||
var newCookies = cookies.getAll(); | ||
if (shouldUpdate(dependencies || null, newCookies, previousCookiesRef.current)) { | ||
setCookies(newCookies); | ||
} | ||
previousCookiesRef.current = newCookies; | ||
} | ||
cookies.addChangeListener(onChange); | ||
@@ -51,3 +46,2 @@ return function () { | ||
} | ||
var setCookie = (0, _react.useMemo)(function () { | ||
@@ -61,3 +55,2 @@ return cookies.set.bind(cookies); | ||
} | ||
function shouldUpdate(dependencies, newCookies, oldCookies) { | ||
@@ -67,14 +60,18 @@ if (!dependencies) { | ||
} | ||
for (var _i = 0, dependencies_1 = dependencies; _i < dependencies_1.length; _i++) { | ||
var dependency = dependencies_1[_i]; | ||
if (newCookies[dependency] !== oldCookies[dependency]) { | ||
return true; | ||
var _iterator = _createForOfIteratorHelper(dependencies), | ||
_step; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var dependency = _step.value; | ||
if (newCookies[dependency] !== oldCookies[dependency]) { | ||
return true; | ||
} | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
return false; | ||
} | ||
module.exports = exports.default; |
export declare function isInBrowser(): boolean; |
@@ -7,5 +7,4 @@ "use strict"; | ||
exports.isInBrowser = isInBrowser; | ||
function isInBrowser() { | ||
return typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'; | ||
} |
import * as React from 'react'; | ||
import { ReactCookieProps } from './types'; | ||
declare type Diff<T, U> = T extends U ? never : T; | ||
declare type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>; | ||
type Diff<T, U> = T extends U ? never : T; | ||
type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>; | ||
export default function withCookies<T extends ReactCookieProps>(WrappedComponent: React.ComponentType<T>): React.ComponentType<Omit<T, keyof ReactCookieProps>>; | ||
export {}; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,64 +8,23 @@ value: true | ||
exports["default"] = withCookies; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics")); | ||
var _CookiesContext = require("./CookiesContext"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var __extends = void 0 && (void 0).__extends || function () { | ||
var _extendStatics = function extendStatics(d, b) { | ||
_extendStatics = Object.setPrototypeOf || { | ||
__proto__: [] | ||
} instanceof Array && function (d, b) { | ||
d.__proto__ = b; | ||
} || function (d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
} | ||
}; | ||
return _extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
_extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
}(); | ||
var __assign = void 0 && (void 0).__assign || function () { | ||
__assign = Object.assign || function (t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var __rest = void 0 && (void 0).__rest || function (s, e) { | ||
var t = {}; | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; | ||
} | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
@@ -77,13 +35,12 @@ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; | ||
}; | ||
function withCookies(WrappedComponent) { | ||
// @ts-ignore | ||
var name = WrappedComponent.displayName || WrappedComponent.name; | ||
var CookieWrapper = function (_super) { | ||
__extends(CookieWrapper, _super); | ||
var CookieWrapper = /*#__PURE__*/function (_React$Component) { | ||
_inherits(CookieWrapper, _React$Component); | ||
var _super = _createSuper(CookieWrapper); | ||
function CookieWrapper() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
var _this; | ||
_classCallCheck(this, CookieWrapper); | ||
_this = _super.apply(this, arguments); | ||
_this.onChange = function () { | ||
@@ -93,51 +50,54 @@ // Make sure to update children with new values | ||
}; | ||
return _this; | ||
} | ||
CookieWrapper.prototype.listen = function () { | ||
this.props.cookies.addChangeListener(this.onChange); | ||
}; | ||
CookieWrapper.prototype.unlisten = function (cookies) { | ||
(cookies || this.props.cookies).removeChangeListener(this.onChange); | ||
}; | ||
CookieWrapper.prototype.componentDidMount = function () { | ||
this.listen(); | ||
}; | ||
CookieWrapper.prototype.componentDidUpdate = function (prevProps) { | ||
if (prevProps.cookies !== this.props.cookies) { | ||
this.unlisten(prevProps.cookies); | ||
_createClass(CookieWrapper, [{ | ||
key: "listen", | ||
value: function listen() { | ||
this.props.cookies.addChangeListener(this.onChange); | ||
} | ||
}, { | ||
key: "unlisten", | ||
value: function unlisten(cookies) { | ||
(cookies || this.props.cookies).removeChangeListener(this.onChange); | ||
} | ||
}, { | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.listen(); | ||
} | ||
}; | ||
CookieWrapper.prototype.componentWillUnmount = function () { | ||
this.unlisten(); | ||
}; | ||
CookieWrapper.prototype.render = function () { | ||
var _a = this.props, | ||
}, { | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps) { | ||
if (prevProps.cookies !== this.props.cookies) { | ||
this.unlisten(prevProps.cookies); | ||
this.listen(); | ||
} | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.unlisten(); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var _a = this.props, | ||
forwardedRef = _a.forwardedRef, | ||
cookies = _a.cookies, | ||
restProps = __rest(_a, ["forwardedRef", "cookies"]); | ||
var allCookies = cookies.getAll(); | ||
return /*#__PURE__*/React.createElement(WrappedComponent, __assign({}, restProps, { | ||
ref: forwardedRef, | ||
cookies: cookies, | ||
allCookies: allCookies | ||
})); | ||
}; | ||
CookieWrapper.displayName = "withCookies(" + name + ")"; | ||
CookieWrapper.WrappedComponent = WrappedComponent; | ||
var allCookies = cookies.getAll(); | ||
return /*#__PURE__*/React.createElement(WrappedComponent, Object.assign({}, restProps, { | ||
ref: forwardedRef, | ||
cookies: cookies, | ||
allCookies: allCookies | ||
})); | ||
} | ||
}]); | ||
return CookieWrapper; | ||
}(React.Component); | ||
CookieWrapper.displayName = "withCookies(".concat(name, ")"); | ||
CookieWrapper.WrappedComponent = WrappedComponent; | ||
var ForwardedComponent = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
return /*#__PURE__*/React.createElement(_CookiesContext.Consumer, null, function (cookies) { | ||
return /*#__PURE__*/React.createElement(CookieWrapper, __assign({ | ||
return /*#__PURE__*/React.createElement(CookieWrapper, Object.assign({ | ||
cookies: cookies | ||
@@ -153,3 +113,2 @@ }, props, { | ||
} | ||
module.exports = exports.default; |
import Cookies from 'universal-cookie'; | ||
export default Cookies; |
import Cookies from 'universal-cookie'; | ||
export default Cookies; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
import * as React from 'react'; | ||
import Cookies from './Cookies'; | ||
var CookiesContext = React.createContext(new Cookies()); | ||
export var Provider = CookiesContext.Provider, Consumer = CookiesContext.Consumer; | ||
const CookiesContext = React.createContext(new Cookies()); | ||
export const { Provider, Consumer } = CookiesContext; | ||
export default CookiesContext; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
@@ -1,34 +0,17 @@ | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
import * as React from 'react'; | ||
import Cookies from 'universal-cookie'; | ||
import { Provider } from './CookiesContext'; | ||
var CookiesProvider = /** @class */ (function (_super) { | ||
__extends(CookiesProvider, _super); | ||
function CookiesProvider(props) { | ||
var _this = _super.call(this, props) || this; | ||
export default class CookiesProvider extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
if (props.cookies) { | ||
_this.cookies = props.cookies; | ||
this.cookies = props.cookies; | ||
} | ||
else { | ||
_this.cookies = new Cookies(); | ||
this.cookies = new Cookies(); | ||
} | ||
return _this; | ||
} | ||
CookiesProvider.prototype.render = function () { | ||
render() { | ||
return React.createElement(Provider, { value: this.cookies }, this.props.children); | ||
}; | ||
return CookiesProvider; | ||
}(React.Component)); | ||
export default CookiesProvider; | ||
} | ||
} |
@@ -0,0 +0,0 @@ export { default as Cookies } from './Cookies'; |
@@ -0,0 +0,0 @@ export { default as Cookies } from './Cookies'; |
/// <reference types="react" /> | ||
import Cookies, { Cookie } from 'universal-cookie'; | ||
export declare type ReactCookieProps = { | ||
export type ReactCookieProps = { | ||
cookies?: Cookies; | ||
@@ -5,0 +5,0 @@ allCookies?: { |
import { Cookie, CookieSetOptions } from 'universal-cookie'; | ||
export default function useCookies<T extends string, U = { | ||
[K in T]?: any; | ||
}>(dependencies?: T[]): [U, (name: T, value: Cookie, options?: CookieSetOptions) => void, (name: T, options?: CookieSetOptions) => void]; | ||
}>(dependencies?: T[]): [ | ||
U, | ||
(name: T, value: Cookie, options?: CookieSetOptions) => void, | ||
(name: T, options?: CookieSetOptions) => void | ||
]; |
@@ -5,13 +5,13 @@ import { useContext, useLayoutEffect, useState, useRef, useMemo } from 'react'; | ||
export default function useCookies(dependencies) { | ||
var cookies = useContext(CookiesContext); | ||
const cookies = useContext(CookiesContext); | ||
if (!cookies) { | ||
throw new Error('Missing <CookiesProvider>'); | ||
} | ||
var initialCookies = cookies.getAll(); | ||
var _a = useState(initialCookies), allCookies = _a[0], setCookies = _a[1]; | ||
var previousCookiesRef = useRef(allCookies); | ||
const initialCookies = cookies.getAll(); | ||
const [allCookies, setCookies] = useState(initialCookies); | ||
const previousCookiesRef = useRef(allCookies); | ||
if (isInBrowser()) { | ||
useLayoutEffect(function () { | ||
useLayoutEffect(() => { | ||
function onChange() { | ||
var newCookies = cookies.getAll(); | ||
const newCookies = cookies.getAll(); | ||
if (shouldUpdate(dependencies || null, newCookies, previousCookiesRef.current)) { | ||
@@ -23,3 +23,3 @@ setCookies(newCookies); | ||
cookies.addChangeListener(onChange); | ||
return function () { | ||
return () => { | ||
cookies.removeChangeListener(onChange); | ||
@@ -29,4 +29,4 @@ }; | ||
} | ||
var setCookie = useMemo(function () { return cookies.set.bind(cookies); }, [cookies]); | ||
var removeCookie = useMemo(function () { return cookies.remove.bind(cookies); }, [cookies]); | ||
const setCookie = useMemo(() => cookies.set.bind(cookies), [cookies]); | ||
const removeCookie = useMemo(() => cookies.remove.bind(cookies), [cookies]); | ||
return [allCookies, setCookie, removeCookie]; | ||
@@ -38,4 +38,3 @@ } | ||
} | ||
for (var _i = 0, dependencies_1 = dependencies; _i < dependencies_1.length; _i++) { | ||
var dependency = dependencies_1[_i]; | ||
for (let dependency of dependencies) { | ||
if (newCookies[dependency] !== oldCookies[dependency]) { | ||
@@ -42,0 +41,0 @@ return true; |
export declare function isInBrowser(): boolean; |
@@ -0,0 +0,0 @@ export function isInBrowser() { |
import * as React from 'react'; | ||
import { ReactCookieProps } from './types'; | ||
declare type Diff<T, U> = T extends U ? never : T; | ||
declare type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>; | ||
type Diff<T, U> = T extends U ? never : T; | ||
type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>; | ||
export default function withCookies<T extends ReactCookieProps>(WrappedComponent: React.ComponentType<T>): React.ComponentType<Omit<T, keyof ReactCookieProps>>; | ||
export {}; |
@@ -1,25 +0,1 @@ | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
@@ -41,23 +17,21 @@ var t = {}; | ||
// @ts-ignore | ||
var name = WrappedComponent.displayName || WrappedComponent.name; | ||
var CookieWrapper = /** @class */ (function (_super) { | ||
__extends(CookieWrapper, _super); | ||
function CookieWrapper() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.onChange = function () { | ||
const name = WrappedComponent.displayName || WrappedComponent.name; | ||
class CookieWrapper extends React.Component { | ||
constructor() { | ||
super(...arguments); | ||
this.onChange = () => { | ||
// Make sure to update children with new values | ||
_this.forceUpdate(); | ||
this.forceUpdate(); | ||
}; | ||
return _this; | ||
} | ||
CookieWrapper.prototype.listen = function () { | ||
listen() { | ||
this.props.cookies.addChangeListener(this.onChange); | ||
}; | ||
CookieWrapper.prototype.unlisten = function (cookies) { | ||
} | ||
unlisten(cookies) { | ||
(cookies || this.props.cookies).removeChangeListener(this.onChange); | ||
}; | ||
CookieWrapper.prototype.componentDidMount = function () { | ||
} | ||
componentDidMount() { | ||
this.listen(); | ||
}; | ||
CookieWrapper.prototype.componentDidUpdate = function (prevProps) { | ||
} | ||
componentDidUpdate(prevProps) { | ||
if (prevProps.cookies !== this.props.cookies) { | ||
@@ -67,17 +41,16 @@ this.unlisten(prevProps.cookies); | ||
} | ||
}; | ||
CookieWrapper.prototype.componentWillUnmount = function () { | ||
} | ||
componentWillUnmount() { | ||
this.unlisten(); | ||
}; | ||
CookieWrapper.prototype.render = function () { | ||
var _a = this.props, forwardedRef = _a.forwardedRef, cookies = _a.cookies, restProps = __rest(_a, ["forwardedRef", "cookies"]); | ||
var allCookies = cookies.getAll(); | ||
return (React.createElement(WrappedComponent, __assign({}, restProps, { ref: forwardedRef, cookies: cookies, allCookies: allCookies }))); | ||
}; | ||
CookieWrapper.displayName = "withCookies(" + name + ")"; | ||
CookieWrapper.WrappedComponent = WrappedComponent; | ||
return CookieWrapper; | ||
}(React.Component)); | ||
var ForwardedComponent = React.forwardRef(function (props, ref) { | ||
return (React.createElement(Consumer, null, function (cookies) { return (React.createElement(CookieWrapper, __assign({ cookies: cookies }, props, { forwardedRef: ref }))); })); | ||
} | ||
render() { | ||
const _a = this.props, { forwardedRef, cookies } = _a, restProps = __rest(_a, ["forwardedRef", "cookies"]); | ||
const allCookies = cookies.getAll(); | ||
return (React.createElement(WrappedComponent, Object.assign({}, restProps, { ref: forwardedRef, cookies: cookies, allCookies: allCookies }))); | ||
} | ||
} | ||
CookieWrapper.displayName = `withCookies(${name})`; | ||
CookieWrapper.WrappedComponent = WrappedComponent; | ||
const ForwardedComponent = React.forwardRef((props, ref) => { | ||
return (React.createElement(Consumer, null, (cookies) => (React.createElement(CookieWrapper, Object.assign({ cookies: cookies }, props, { forwardedRef: ref }))))); | ||
}); | ||
@@ -84,0 +57,0 @@ ForwardedComponent.displayName = CookieWrapper.displayName; |
import Cookies from 'universal-cookie'; | ||
export default Cookies; |
@@ -7,9 +7,6 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _universalCookie = _interopRequireDefault(require("universal-cookie")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _default = _universalCookie["default"]; | ||
exports["default"] = _default; | ||
module.exports = exports.default; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = exports.Consumer = exports.Provider = void 0; | ||
exports["default"] = exports.Provider = exports.Consumer = void 0; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _Cookies = _interopRequireDefault(require("./Cookies")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var CookiesContext = /*#__PURE__*/React.createContext(new _Cookies["default"]()); | ||
var Provider = CookiesContext.Provider, | ||
Consumer = CookiesContext.Consumer; | ||
Consumer = CookiesContext.Consumer; | ||
exports.Consumer = Consumer; | ||
@@ -24,0 +17,0 @@ exports.Provider = Provider; |
@@ -0,0 +0,0 @@ import * as React from 'react'; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,47 +8,27 @@ value: true | ||
exports["default"] = void 0; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _universalCookie = _interopRequireDefault(require("universal-cookie")); | ||
var _CookiesContext = require("./CookiesContext"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var __extends = void 0 && (void 0).__extends || function () { | ||
var _extendStatics = function extendStatics(d, b) { | ||
_extendStatics = Object.setPrototypeOf || { | ||
__proto__: [] | ||
} instanceof Array && function (d, b) { | ||
d.__proto__ = b; | ||
} || function (d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
} | ||
}; | ||
return _extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
_extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
}(); | ||
var CookiesProvider = function (_super) { | ||
__extends(CookiesProvider, _super); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var CookiesProvider = /*#__PURE__*/function (_React$Component) { | ||
_inherits(CookiesProvider, _React$Component); | ||
var _super = _createSuper(CookiesProvider); | ||
function CookiesProvider(props) { | ||
var _this = _super.call(this, props) || this; | ||
var _this; | ||
_classCallCheck(this, CookiesProvider); | ||
_this = _super.call(this, props); | ||
if (props.cookies) { | ||
@@ -60,17 +39,15 @@ _this.cookies = props.cookies; | ||
} | ||
return _this; | ||
} | ||
CookiesProvider.prototype.render = function () { | ||
return /*#__PURE__*/React.createElement(_CookiesContext.Provider, { | ||
value: this.cookies | ||
}, this.props.children); | ||
}; | ||
_createClass(CookiesProvider, [{ | ||
key: "render", | ||
value: function render() { | ||
return /*#__PURE__*/React.createElement(_CookiesContext.Provider, { | ||
value: this.cookies | ||
}, this.props.children); | ||
} | ||
}]); | ||
return CookiesProvider; | ||
}(React.Component); | ||
var _default = CookiesProvider; | ||
exports["default"] = _default; | ||
exports["default"] = CookiesProvider; | ||
module.exports = exports.default; |
@@ -0,0 +0,0 @@ export { default as Cookies } from './Cookies'; |
@@ -24,25 +24,19 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "withCookies", { | ||
Object.defineProperty(exports, "useCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _withCookies["default"]; | ||
return _useCookies["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "useCookies", { | ||
Object.defineProperty(exports, "withCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _useCookies["default"]; | ||
return _withCookies["default"]; | ||
} | ||
}); | ||
var _Cookies = _interopRequireDefault(require("./Cookies")); | ||
var _CookiesProvider = _interopRequireDefault(require("./CookiesProvider")); | ||
var _withCookies = _interopRequireDefault(require("./withCookies")); | ||
var _useCookies = _interopRequireDefault(require("./useCookies")); | ||
var _types = require("./types"); | ||
Object.keys(_types).forEach(function (key) { | ||
@@ -59,3 +53,2 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
/// <reference types="react" /> | ||
import Cookies, { Cookie } from 'universal-cookie'; | ||
export declare type ReactCookieProps = { | ||
export type ReactCookieProps = { | ||
cookies?: Cookies; | ||
@@ -5,0 +5,0 @@ allCookies?: { |
@@ -1,1 +0,5 @@ | ||
"use strict"; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); |
import { Cookie, CookieSetOptions } from 'universal-cookie'; | ||
export default function useCookies<T extends string, U = { | ||
[K in T]?: any; | ||
}>(dependencies?: T[]): [U, (name: T, value: Cookie, options?: CookieSetOptions) => void, (name: T, options?: CookieSetOptions) => void]; | ||
}>(dependencies?: T[]): [ | ||
U, | ||
(name: T, value: Cookie, options?: CookieSetOptions) => void, | ||
(name: T, options?: CookieSetOptions) => void | ||
]; |
@@ -7,26 +7,24 @@ "use strict"; | ||
exports["default"] = useCookies; | ||
var _react = require("react"); | ||
var _CookiesContext = _interopRequireDefault(require("./CookiesContext")); | ||
var _utils = require("./utils"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
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]; | ||
var _useState = (0, _react.useState)(initialCookies), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
allCookies = _useState2[0], | ||
setCookies = _useState2[1]; | ||
var previousCookiesRef = (0, _react.useRef)(allCookies); | ||
if ((0, _utils.isInBrowser)()) { | ||
@@ -36,10 +34,7 @@ (0, _react.useLayoutEffect)(function () { | ||
var newCookies = cookies.getAll(); | ||
if (shouldUpdate(dependencies || null, newCookies, previousCookiesRef.current)) { | ||
setCookies(newCookies); | ||
} | ||
previousCookiesRef.current = newCookies; | ||
} | ||
cookies.addChangeListener(onChange); | ||
@@ -51,3 +46,2 @@ return function () { | ||
} | ||
var setCookie = (0, _react.useMemo)(function () { | ||
@@ -61,3 +55,2 @@ return cookies.set.bind(cookies); | ||
} | ||
function shouldUpdate(dependencies, newCookies, oldCookies) { | ||
@@ -67,14 +60,18 @@ if (!dependencies) { | ||
} | ||
for (var _i = 0, dependencies_1 = dependencies; _i < dependencies_1.length; _i++) { | ||
var dependency = dependencies_1[_i]; | ||
if (newCookies[dependency] !== oldCookies[dependency]) { | ||
return true; | ||
var _iterator = _createForOfIteratorHelper(dependencies), | ||
_step; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var dependency = _step.value; | ||
if (newCookies[dependency] !== oldCookies[dependency]) { | ||
return true; | ||
} | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
return false; | ||
} | ||
module.exports = exports.default; |
export declare function isInBrowser(): boolean; |
@@ -7,5 +7,4 @@ "use strict"; | ||
exports.isInBrowser = isInBrowser; | ||
function isInBrowser() { | ||
return typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'; | ||
} |
import * as React from 'react'; | ||
import { ReactCookieProps } from './types'; | ||
declare type Diff<T, U> = T extends U ? never : T; | ||
declare type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>; | ||
type Diff<T, U> = T extends U ? never : T; | ||
type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>; | ||
export default function withCookies<T extends ReactCookieProps>(WrappedComponent: React.ComponentType<T>): React.ComponentType<Omit<T, keyof ReactCookieProps>>; | ||
export {}; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,64 +8,23 @@ value: true | ||
exports["default"] = withCookies; | ||
var React = _interopRequireWildcard(require("react")); | ||
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics")); | ||
var _CookiesContext = require("./CookiesContext"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var __extends = void 0 && (void 0).__extends || function () { | ||
var _extendStatics = function extendStatics(d, b) { | ||
_extendStatics = Object.setPrototypeOf || { | ||
__proto__: [] | ||
} instanceof Array && function (d, b) { | ||
d.__proto__ = b; | ||
} || function (d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
} | ||
}; | ||
return _extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
_extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
}(); | ||
var __assign = void 0 && (void 0).__assign || function () { | ||
__assign = Object.assign || function (t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var __rest = void 0 && (void 0).__rest || function (s, e) { | ||
var t = {}; | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; | ||
} | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
@@ -77,13 +35,12 @@ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; | ||
}; | ||
function withCookies(WrappedComponent) { | ||
// @ts-ignore | ||
var name = WrappedComponent.displayName || WrappedComponent.name; | ||
var CookieWrapper = function (_super) { | ||
__extends(CookieWrapper, _super); | ||
var CookieWrapper = /*#__PURE__*/function (_React$Component) { | ||
_inherits(CookieWrapper, _React$Component); | ||
var _super = _createSuper(CookieWrapper); | ||
function CookieWrapper() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
var _this; | ||
_classCallCheck(this, CookieWrapper); | ||
_this = _super.apply(this, arguments); | ||
_this.onChange = function () { | ||
@@ -93,51 +50,54 @@ // Make sure to update children with new values | ||
}; | ||
return _this; | ||
} | ||
CookieWrapper.prototype.listen = function () { | ||
this.props.cookies.addChangeListener(this.onChange); | ||
}; | ||
CookieWrapper.prototype.unlisten = function (cookies) { | ||
(cookies || this.props.cookies).removeChangeListener(this.onChange); | ||
}; | ||
CookieWrapper.prototype.componentDidMount = function () { | ||
this.listen(); | ||
}; | ||
CookieWrapper.prototype.componentDidUpdate = function (prevProps) { | ||
if (prevProps.cookies !== this.props.cookies) { | ||
this.unlisten(prevProps.cookies); | ||
_createClass(CookieWrapper, [{ | ||
key: "listen", | ||
value: function listen() { | ||
this.props.cookies.addChangeListener(this.onChange); | ||
} | ||
}, { | ||
key: "unlisten", | ||
value: function unlisten(cookies) { | ||
(cookies || this.props.cookies).removeChangeListener(this.onChange); | ||
} | ||
}, { | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.listen(); | ||
} | ||
}; | ||
CookieWrapper.prototype.componentWillUnmount = function () { | ||
this.unlisten(); | ||
}; | ||
CookieWrapper.prototype.render = function () { | ||
var _a = this.props, | ||
}, { | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps) { | ||
if (prevProps.cookies !== this.props.cookies) { | ||
this.unlisten(prevProps.cookies); | ||
this.listen(); | ||
} | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.unlisten(); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var _a = this.props, | ||
forwardedRef = _a.forwardedRef, | ||
cookies = _a.cookies, | ||
restProps = __rest(_a, ["forwardedRef", "cookies"]); | ||
var allCookies = cookies.getAll(); | ||
return /*#__PURE__*/React.createElement(WrappedComponent, __assign({}, restProps, { | ||
ref: forwardedRef, | ||
cookies: cookies, | ||
allCookies: allCookies | ||
})); | ||
}; | ||
CookieWrapper.displayName = "withCookies(" + name + ")"; | ||
CookieWrapper.WrappedComponent = WrappedComponent; | ||
var allCookies = cookies.getAll(); | ||
return /*#__PURE__*/React.createElement(WrappedComponent, Object.assign({}, restProps, { | ||
ref: forwardedRef, | ||
cookies: cookies, | ||
allCookies: allCookies | ||
})); | ||
} | ||
}]); | ||
return CookieWrapper; | ||
}(React.Component); | ||
CookieWrapper.displayName = "withCookies(".concat(name, ")"); | ||
CookieWrapper.WrappedComponent = WrappedComponent; | ||
var ForwardedComponent = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
return /*#__PURE__*/React.createElement(_CookiesContext.Consumer, null, function (cookies) { | ||
return /*#__PURE__*/React.createElement(CookieWrapper, __assign({ | ||
return /*#__PURE__*/React.createElement(CookieWrapper, Object.assign({ | ||
cookies: cookies | ||
@@ -153,3 +113,2 @@ }, props, { | ||
} | ||
module.exports = exports.default; |
{ | ||
"name": "react-cookie", | ||
"version": "4.1.1", | ||
"version": "5.0.0", | ||
"description": "Universal cookies for React", | ||
@@ -39,13 +39,13 @@ "main": "cjs/index.js", | ||
"dependencies": { | ||
"@types/hoist-non-react-statics": "^3.0.1", | ||
"hoist-non-react-statics": "^3.0.0", | ||
"@types/hoist-non-react-statics": "^3.3.1", | ||
"hoist-non-react-statics": "^3.3.2", | ||
"universal-cookie": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0", | ||
"react": "^16.8.0", | ||
"react-dom": "^16.8.0", | ||
"rimraf": "^2.6.1", | ||
"rollup": "^1.16.4", | ||
"typescript": "^3.0.1" | ||
"@babel/cli": "^7.22.10", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"rimraf": "^2.7.1", | ||
"rollup": "^3.28.0", | ||
"typescript": "^5.1.6" | ||
}, | ||
@@ -52,0 +52,0 @@ "peerDependencies": { |
@@ -8,8 +8,5 @@ <h3 align="center"> | ||
<a href="https://badge.fury.io/js/react-cookie"><img src="https://badge.fury.io/js/react-cookie.svg" /></a> | ||
![Test Status](https://github.com/github/docs/actions/workflows/test.yml/badge.svg) | ||
</p> | ||
[![Build Status](https://travis-ci.org/reactivestack/cookies.svg?branch=master)](https://travis-ci.org/reactivestack/cookies) | ||
<br /> | ||
[![Sauce Test Status](https://saucelabs.com/browser-matrix/coookies.svg)](https://saucelabs.com/u/coookies) | ||
## Integrations | ||
@@ -236,3 +233,3 @@ | ||
static propTypes = { | ||
cookies: instanceOf(Cookies).isRequired | ||
cookies: instanceOf(Cookies).isRequired, | ||
}; | ||
@@ -245,3 +242,3 @@ | ||
this.state = { | ||
name: cookies.get('name') || 'Ben' | ||
name: cookies.get('name') || 'Ben', | ||
}; | ||
@@ -312,3 +309,3 @@ } | ||
<App /> | ||
</CookiesProvider> | ||
</CookiesProvider>, | ||
); | ||
@@ -336,3 +333,3 @@ | ||
</CookiesProvider>, | ||
appEl | ||
appEl, | ||
); | ||
@@ -356,5 +353,5 @@ ``` | ||
app.listen(8080, function() { | ||
app.listen(8080, function () { | ||
console.log('Listening on 8080...'); | ||
}); | ||
``` |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('universal-cookie'), require('react')) : | ||
typeof define === 'function' && define.amd ? define(['universal-cookie', 'react'], factory) : | ||
(global = global || self, global.ReactCookie = factory(global.UniversalCookie, global.React)); | ||
}(this, (function (universalCookie, react) { 'use strict'; | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ReactCookie = factory(global.UniversalCookie, global.React)); | ||
})(this, (function (require$$0, require$$0$1) { 'use strict'; | ||
universalCookie = universalCookie && Object.prototype.hasOwnProperty.call(universalCookie, 'default') ? universalCookie['default'] : universalCookie; | ||
react = react && Object.prototype.hasOwnProperty.call(react, 'default') ? react['default'] : react; | ||
function unwrapExports (x) { | ||
function getDefaultExportFromCjs (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
var cjs = {}; | ||
var Cookies = createCommonjsModule(function (module, exports) { | ||
var Cookies = {exports: {}}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
(function (module, exports) { | ||
var _universalCookie = _interopRequireDefault(universalCookie); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _universalCookie = _interopRequireDefault(require$$0); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _default = _universalCookie["default"]; | ||
exports["default"] = _default; | ||
module.exports = exports.default; | ||
} (Cookies, Cookies.exports)); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var CookiesExports = Cookies.exports; | ||
var _default = _universalCookie["default"]; | ||
exports["default"] = _default; | ||
module.exports = exports.default; | ||
}); | ||
var CookiesProvider = {exports: {}}; | ||
unwrapExports(Cookies); | ||
var CookiesContext = {}; | ||
var CookiesContext_1 = createCommonjsModule(function (module, exports) { | ||
(function (exports) { | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = exports.Provider = exports.Consumer = void 0; | ||
var React = _interopRequireWildcard(require$$0$1); | ||
var _Cookies = _interopRequireDefault(CookiesExports); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var CookiesContext = /*#__PURE__*/React.createContext(new _Cookies["default"]()); | ||
var Provider = CookiesContext.Provider, | ||
Consumer = CookiesContext.Consumer; | ||
exports.Consumer = Consumer; | ||
exports.Provider = Provider; | ||
var _default = CookiesContext; | ||
exports["default"] = _default; | ||
} (CookiesContext)); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = exports.Consumer = exports.Provider = void 0; | ||
(function (module, exports) { | ||
var React = _interopRequireWildcard(react); | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var React = _interopRequireWildcard(require$$0$1); | ||
var _universalCookie = _interopRequireDefault(require$$0); | ||
var _CookiesContext = CookiesContext; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var CookiesProvider = /*#__PURE__*/function (_React$Component) { | ||
_inherits(CookiesProvider, _React$Component); | ||
var _super = _createSuper(CookiesProvider); | ||
function CookiesProvider(props) { | ||
var _this; | ||
_classCallCheck(this, CookiesProvider); | ||
_this = _super.call(this, props); | ||
if (props.cookies) { | ||
_this.cookies = props.cookies; | ||
} else { | ||
_this.cookies = new _universalCookie["default"](); | ||
} | ||
return _this; | ||
} | ||
_createClass(CookiesProvider, [{ | ||
key: "render", | ||
value: function render() { | ||
return /*#__PURE__*/React.createElement(_CookiesContext.Provider, { | ||
value: this.cookies | ||
}, this.props.children); | ||
} | ||
}]); | ||
return CookiesProvider; | ||
}(React.Component); | ||
exports["default"] = CookiesProvider; | ||
module.exports = exports.default; | ||
} (CookiesProvider, CookiesProvider.exports)); | ||
var _Cookies = _interopRequireDefault(Cookies); | ||
var CookiesProviderExports = CookiesProvider.exports; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var withCookies = {exports: {}}; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
var reactIs$1 = {exports: {}}; | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var reactIs_development = {}; | ||
var CookiesContext = /*#__PURE__*/React.createContext(new _Cookies["default"]()); | ||
var Provider = CookiesContext.Provider, | ||
Consumer = CookiesContext.Consumer; | ||
exports.Consumer = Consumer; | ||
exports.Provider = Provider; | ||
var _default = CookiesContext; | ||
exports["default"] = _default; | ||
}); | ||
/** @license React v16.13.1 | ||
* react-is.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
unwrapExports(CookiesContext_1); | ||
var CookiesContext_2 = CookiesContext_1.Consumer; | ||
var CookiesContext_3 = CookiesContext_1.Provider; | ||
var hasRequiredReactIs_development; | ||
var CookiesProvider_1 = createCommonjsModule(function (module, exports) { | ||
function requireReactIs_development () { | ||
if (hasRequiredReactIs_development) return reactIs_development; | ||
hasRequiredReactIs_development = 1; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var React = _interopRequireWildcard(react); | ||
{ | ||
(function() { | ||
var _universalCookie = _interopRequireDefault(universalCookie); | ||
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol | ||
// nor polyfill, then a plain number is used for performance. | ||
var hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; | ||
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; | ||
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; | ||
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; | ||
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; | ||
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary | ||
// (unstable) APIs that have been removed. Can we remove the symbols? | ||
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_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; | ||
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; | ||
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; | ||
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; | ||
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; | ||
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; | ||
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; | ||
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; | ||
function isValidElementType(type) { | ||
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. | ||
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); | ||
} | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function typeOf(object) { | ||
if (typeof object === 'object' && object !== null) { | ||
var $$typeof = object.$$typeof; | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
switch ($$typeof) { | ||
case REACT_ELEMENT_TYPE: | ||
var type = object.type; | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
switch (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; | ||
var __extends = function () { | ||
var _extendStatics = function extendStatics(d, b) { | ||
_extendStatics = Object.setPrototypeOf || { | ||
__proto__: [] | ||
} instanceof Array && function (d, b) { | ||
d.__proto__ = b; | ||
} || function (d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
} | ||
}; | ||
default: | ||
var $$typeofType = type && type.$$typeof; | ||
return _extendStatics(d, b); | ||
}; | ||
switch ($$typeofType) { | ||
case REACT_CONTEXT_TYPE: | ||
case REACT_FORWARD_REF_TYPE: | ||
case REACT_LAZY_TYPE: | ||
case REACT_MEMO_TYPE: | ||
case REACT_PROVIDER_TYPE: | ||
return $$typeofType; | ||
return function (d, b) { | ||
_extendStatics(d, b); | ||
default: | ||
return $$typeof; | ||
} | ||
function __() { | ||
this.constructor = d; | ||
} | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
}(); | ||
case REACT_PORTAL_TYPE: | ||
return $$typeof; | ||
} | ||
} | ||
var CookiesProvider = function (_super) { | ||
__extends(CookiesProvider, _super); | ||
return undefined; | ||
} // AsyncMode is deprecated along with isAsyncMode | ||
function CookiesProvider(props) { | ||
var _this = _super.call(this, props) || this; | ||
var AsyncMode = REACT_ASYNC_MODE_TYPE; | ||
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; | ||
var ContextConsumer = REACT_CONTEXT_TYPE; | ||
var ContextProvider = REACT_PROVIDER_TYPE; | ||
var Element = REACT_ELEMENT_TYPE; | ||
var ForwardRef = REACT_FORWARD_REF_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 StrictMode = REACT_STRICT_MODE_TYPE; | ||
var Suspense = REACT_SUSPENSE_TYPE; | ||
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated | ||
if (props.cookies) { | ||
_this.cookies = props.cookies; | ||
} else { | ||
_this.cookies = new _universalCookie["default"](); | ||
} | ||
function isAsyncMode(object) { | ||
{ | ||
if (!hasWarnedAboutDeprecatedIsAsyncMode) { | ||
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint | ||
return _this; | ||
} | ||
console['warn']('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.'); | ||
} | ||
} | ||
CookiesProvider.prototype.render = function () { | ||
return /*#__PURE__*/React.createElement(CookiesContext_1.Provider, { | ||
value: this.cookies | ||
}, this.props.children); | ||
}; | ||
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; | ||
} | ||
function isConcurrentMode(object) { | ||
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; | ||
} | ||
function isContextConsumer(object) { | ||
return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} | ||
function isContextProvider(object) { | ||
return typeOf(object) === REACT_PROVIDER_TYPE; | ||
} | ||
function isElement(object) { | ||
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
} | ||
function isForwardRef(object) { | ||
return typeOf(object) === REACT_FORWARD_REF_TYPE; | ||
} | ||
function isFragment(object) { | ||
return typeOf(object) === REACT_FRAGMENT_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; | ||
} | ||
return CookiesProvider; | ||
}(React.Component); | ||
reactIs_development.AsyncMode = AsyncMode; | ||
reactIs_development.ConcurrentMode = ConcurrentMode; | ||
reactIs_development.ContextConsumer = ContextConsumer; | ||
reactIs_development.ContextProvider = ContextProvider; | ||
reactIs_development.Element = Element; | ||
reactIs_development.ForwardRef = ForwardRef; | ||
reactIs_development.Fragment = Fragment; | ||
reactIs_development.Lazy = Lazy; | ||
reactIs_development.Memo = Memo; | ||
reactIs_development.Portal = Portal; | ||
reactIs_development.Profiler = Profiler; | ||
reactIs_development.StrictMode = StrictMode; | ||
reactIs_development.Suspense = Suspense; | ||
reactIs_development.isAsyncMode = isAsyncMode; | ||
reactIs_development.isConcurrentMode = isConcurrentMode; | ||
reactIs_development.isContextConsumer = isContextConsumer; | ||
reactIs_development.isContextProvider = isContextProvider; | ||
reactIs_development.isElement = isElement; | ||
reactIs_development.isForwardRef = isForwardRef; | ||
reactIs_development.isFragment = isFragment; | ||
reactIs_development.isLazy = isLazy; | ||
reactIs_development.isMemo = isMemo; | ||
reactIs_development.isPortal = isPortal; | ||
reactIs_development.isProfiler = isProfiler; | ||
reactIs_development.isStrictMode = isStrictMode; | ||
reactIs_development.isSuspense = isSuspense; | ||
reactIs_development.isValidElementType = isValidElementType; | ||
reactIs_development.typeOf = typeOf; | ||
})(); | ||
} | ||
return reactIs_development; | ||
} | ||
var _default = CookiesProvider; | ||
exports["default"] = _default; | ||
module.exports = exports.default; | ||
}); | ||
unwrapExports(CookiesProvider_1); | ||
var reactIs_development = createCommonjsModule(function (module, exports) { | ||
{ | ||
(function() { | ||
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol | ||
// nor polyfill, then a plain number is used for performance. | ||
var hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; | ||
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; | ||
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; | ||
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; | ||
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; | ||
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary | ||
// (unstable) APIs that have been removed. Can we remove the symbols? | ||
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_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; | ||
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; | ||
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; | ||
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; | ||
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; | ||
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; | ||
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; | ||
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; | ||
function isValidElementType(type) { | ||
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. | ||
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_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 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); | ||
reactIs$1.exports = requireReactIs_development(); | ||
} | ||
function typeOf(object) { | ||
if (typeof object === 'object' && object !== null) { | ||
var $$typeof = object.$$typeof; | ||
var reactIsExports = reactIs$1.exports; | ||
switch ($$typeof) { | ||
case REACT_ELEMENT_TYPE: | ||
var type = object.type; | ||
var reactIs = reactIsExports; | ||
switch (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; | ||
default: | ||
var $$typeofType = type && type.$$typeof; | ||
switch ($$typeofType) { | ||
case REACT_CONTEXT_TYPE: | ||
case REACT_FORWARD_REF_TYPE: | ||
case REACT_LAZY_TYPE: | ||
case REACT_MEMO_TYPE: | ||
case REACT_PROVIDER_TYPE: | ||
return $$typeofType; | ||
default: | ||
return $$typeof; | ||
} | ||
} | ||
case REACT_PORTAL_TYPE: | ||
return $$typeof; | ||
} | ||
} | ||
return undefined; | ||
} // AsyncMode is deprecated along with isAsyncMode | ||
var AsyncMode = REACT_ASYNC_MODE_TYPE; | ||
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; | ||
var ContextConsumer = REACT_CONTEXT_TYPE; | ||
var ContextProvider = REACT_PROVIDER_TYPE; | ||
var Element = REACT_ELEMENT_TYPE; | ||
var ForwardRef = REACT_FORWARD_REF_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 StrictMode = REACT_STRICT_MODE_TYPE; | ||
var Suspense = REACT_SUSPENSE_TYPE; | ||
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated | ||
function isAsyncMode(object) { | ||
{ | ||
if (!hasWarnedAboutDeprecatedIsAsyncMode) { | ||
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint | ||
console['warn']('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) { | ||
return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} | ||
function isContextProvider(object) { | ||
return typeOf(object) === REACT_PROVIDER_TYPE; | ||
} | ||
function isElement(object) { | ||
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
} | ||
function isForwardRef(object) { | ||
return typeOf(object) === REACT_FORWARD_REF_TYPE; | ||
} | ||
function isFragment(object) { | ||
return typeOf(object) === REACT_FRAGMENT_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.AsyncMode = AsyncMode; | ||
exports.ConcurrentMode = ConcurrentMode; | ||
exports.ContextConsumer = ContextConsumer; | ||
exports.ContextProvider = ContextProvider; | ||
exports.Element = Element; | ||
exports.ForwardRef = ForwardRef; | ||
exports.Fragment = Fragment; | ||
exports.Lazy = Lazy; | ||
exports.Memo = Memo; | ||
exports.Portal = Portal; | ||
exports.Profiler = Profiler; | ||
exports.StrictMode = StrictMode; | ||
exports.Suspense = Suspense; | ||
exports.isAsyncMode = isAsyncMode; | ||
exports.isConcurrentMode = isConcurrentMode; | ||
exports.isContextConsumer = isContextConsumer; | ||
exports.isContextProvider = isContextProvider; | ||
exports.isElement = isElement; | ||
exports.isForwardRef = isForwardRef; | ||
exports.isFragment = isFragment; | ||
exports.isLazy = isLazy; | ||
exports.isMemo = isMemo; | ||
exports.isPortal = isPortal; | ||
exports.isProfiler = isProfiler; | ||
exports.isStrictMode = isStrictMode; | ||
exports.isSuspense = isSuspense; | ||
exports.isValidElementType = isValidElementType; | ||
exports.typeOf = typeOf; | ||
})(); | ||
} | ||
}); | ||
var reactIs_development_1 = reactIs_development.AsyncMode; | ||
var reactIs_development_2 = reactIs_development.ConcurrentMode; | ||
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.Lazy; | ||
var reactIs_development_9 = reactIs_development.Memo; | ||
var reactIs_development_10 = reactIs_development.Portal; | ||
var reactIs_development_11 = reactIs_development.Profiler; | ||
var reactIs_development_12 = reactIs_development.StrictMode; | ||
var reactIs_development_13 = reactIs_development.Suspense; | ||
var reactIs_development_14 = reactIs_development.isAsyncMode; | ||
var reactIs_development_15 = reactIs_development.isConcurrentMode; | ||
var reactIs_development_16 = reactIs_development.isContextConsumer; | ||
var reactIs_development_17 = reactIs_development.isContextProvider; | ||
var reactIs_development_18 = reactIs_development.isElement; | ||
var reactIs_development_19 = reactIs_development.isForwardRef; | ||
var reactIs_development_20 = reactIs_development.isFragment; | ||
var reactIs_development_21 = reactIs_development.isLazy; | ||
var reactIs_development_22 = reactIs_development.isMemo; | ||
var reactIs_development_23 = reactIs_development.isPortal; | ||
var reactIs_development_24 = reactIs_development.isProfiler; | ||
var reactIs_development_25 = reactIs_development.isStrictMode; | ||
var reactIs_development_26 = reactIs_development.isSuspense; | ||
var reactIs_development_27 = reactIs_development.isValidElementType; | ||
var reactIs_development_28 = reactIs_development.typeOf; | ||
var reactIs = createCommonjsModule(function (module) { | ||
{ | ||
module.exports = reactIs_development; | ||
} | ||
}); | ||
/** | ||
@@ -454,322 +411,268 @@ * Copyright 2015, Yahoo! Inc. | ||
var withCookies_1 = createCommonjsModule(function (module, exports) { | ||
(function (module, exports) { | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = withCookies; | ||
var React = _interopRequireWildcard(require$$0$1); | ||
var _hoistNonReactStatics = _interopRequireDefault(hoistNonReactStatics_cjs); | ||
var _CookiesContext = CookiesContext; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
var __rest = function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
function withCookies(WrappedComponent) { | ||
// @ts-ignore | ||
var name = WrappedComponent.displayName || WrappedComponent.name; | ||
var CookieWrapper = /*#__PURE__*/function (_React$Component) { | ||
_inherits(CookieWrapper, _React$Component); | ||
var _super = _createSuper(CookieWrapper); | ||
function CookieWrapper() { | ||
var _this; | ||
_classCallCheck(this, CookieWrapper); | ||
_this = _super.apply(this, arguments); | ||
_this.onChange = function () { | ||
// Make sure to update children with new values | ||
_this.forceUpdate(); | ||
}; | ||
return _this; | ||
} | ||
_createClass(CookieWrapper, [{ | ||
key: "listen", | ||
value: function listen() { | ||
this.props.cookies.addChangeListener(this.onChange); | ||
} | ||
}, { | ||
key: "unlisten", | ||
value: function unlisten(cookies) { | ||
(cookies || this.props.cookies).removeChangeListener(this.onChange); | ||
} | ||
}, { | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.listen(); | ||
} | ||
}, { | ||
key: "componentDidUpdate", | ||
value: function componentDidUpdate(prevProps) { | ||
if (prevProps.cookies !== this.props.cookies) { | ||
this.unlisten(prevProps.cookies); | ||
this.listen(); | ||
} | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.unlisten(); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var _a = this.props, | ||
forwardedRef = _a.forwardedRef, | ||
cookies = _a.cookies, | ||
restProps = __rest(_a, ["forwardedRef", "cookies"]); | ||
var allCookies = cookies.getAll(); | ||
return /*#__PURE__*/React.createElement(WrappedComponent, Object.assign({}, restProps, { | ||
ref: forwardedRef, | ||
cookies: cookies, | ||
allCookies: allCookies | ||
})); | ||
} | ||
}]); | ||
return CookieWrapper; | ||
}(React.Component); | ||
CookieWrapper.displayName = "withCookies(".concat(name, ")"); | ||
CookieWrapper.WrappedComponent = WrappedComponent; | ||
var ForwardedComponent = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
return /*#__PURE__*/React.createElement(_CookiesContext.Consumer, null, function (cookies) { | ||
return /*#__PURE__*/React.createElement(CookieWrapper, Object.assign({ | ||
cookies: cookies | ||
}, props, { | ||
forwardedRef: ref | ||
})); | ||
}); | ||
}); | ||
ForwardedComponent.displayName = CookieWrapper.displayName; | ||
ForwardedComponent.WrappedComponent = CookieWrapper.WrappedComponent; | ||
return (0, _hoistNonReactStatics["default"])(ForwardedComponent, WrappedComponent); | ||
} | ||
module.exports = exports.default; | ||
} (withCookies, withCookies.exports)); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = withCookies; | ||
var withCookiesExports = withCookies.exports; | ||
var React = _interopRequireWildcard(react); | ||
var useCookies = {exports: {}}; | ||
var _hoistNonReactStatics = _interopRequireDefault(hoistNonReactStatics_cjs); | ||
var utils = {}; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var __extends = function () { | ||
var _extendStatics = function extendStatics(d, b) { | ||
_extendStatics = Object.setPrototypeOf || { | ||
__proto__: [] | ||
} instanceof Array && function (d, b) { | ||
d.__proto__ = b; | ||
} || function (d, b) { | ||
for (var p in b) { | ||
if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
} | ||
}; | ||
return _extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
_extendStatics(d, b); | ||
function __() { | ||
this.constructor = d; | ||
} | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
}(); | ||
var __assign = function () { | ||
__assign = Object.assign || function (t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __rest = function (s, e) { | ||
var t = {}; | ||
for (var p in s) { | ||
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; | ||
} | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
function withCookies(WrappedComponent) { | ||
// @ts-ignore | ||
var name = WrappedComponent.displayName || WrappedComponent.name; | ||
var CookieWrapper = function (_super) { | ||
__extends(CookieWrapper, _super); | ||
function CookieWrapper() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.onChange = function () { | ||
// Make sure to update children with new values | ||
_this.forceUpdate(); | ||
}; | ||
return _this; | ||
} | ||
CookieWrapper.prototype.listen = function () { | ||
this.props.cookies.addChangeListener(this.onChange); | ||
}; | ||
CookieWrapper.prototype.unlisten = function (cookies) { | ||
(cookies || this.props.cookies).removeChangeListener(this.onChange); | ||
}; | ||
CookieWrapper.prototype.componentDidMount = function () { | ||
this.listen(); | ||
}; | ||
CookieWrapper.prototype.componentDidUpdate = function (prevProps) { | ||
if (prevProps.cookies !== this.props.cookies) { | ||
this.unlisten(prevProps.cookies); | ||
this.listen(); | ||
} | ||
}; | ||
CookieWrapper.prototype.componentWillUnmount = function () { | ||
this.unlisten(); | ||
}; | ||
CookieWrapper.prototype.render = function () { | ||
var _a = this.props, | ||
forwardedRef = _a.forwardedRef, | ||
cookies = _a.cookies, | ||
restProps = __rest(_a, ["forwardedRef", "cookies"]); | ||
var allCookies = cookies.getAll(); | ||
return /*#__PURE__*/React.createElement(WrappedComponent, __assign({}, restProps, { | ||
ref: forwardedRef, | ||
cookies: cookies, | ||
allCookies: allCookies | ||
})); | ||
}; | ||
CookieWrapper.displayName = "withCookies(" + name + ")"; | ||
CookieWrapper.WrappedComponent = WrappedComponent; | ||
return CookieWrapper; | ||
}(React.Component); | ||
var ForwardedComponent = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
return /*#__PURE__*/React.createElement(CookiesContext_1.Consumer, null, function (cookies) { | ||
return /*#__PURE__*/React.createElement(CookieWrapper, __assign({ | ||
cookies: cookies | ||
}, props, { | ||
forwardedRef: ref | ||
})); | ||
}); | ||
}); | ||
ForwardedComponent.displayName = CookieWrapper.displayName; | ||
ForwardedComponent.WrappedComponent = CookieWrapper.WrappedComponent; | ||
return (0, _hoistNonReactStatics["default"])(ForwardedComponent, WrappedComponent); | ||
} | ||
module.exports = exports.default; | ||
}); | ||
unwrapExports(withCookies_1); | ||
var utils = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
Object.defineProperty(utils, "__esModule", { | ||
value: true | ||
}); | ||
exports.isInBrowser = isInBrowser; | ||
utils.isInBrowser = isInBrowser; | ||
function isInBrowser() { | ||
return typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'; | ||
} | ||
}); | ||
unwrapExports(utils); | ||
var utils_1 = utils.isInBrowser; | ||
(function (module, exports) { | ||
var useCookies_1 = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = useCookies; | ||
var _react = require$$0$1; | ||
var _CookiesContext = _interopRequireDefault(CookiesContext); | ||
var _utils = utils; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function useCookies(dependencies) { | ||
var cookies = (0, _react.useContext)(_CookiesContext["default"]); | ||
if (!cookies) { | ||
throw new Error('Missing <CookiesProvider>'); | ||
} | ||
var initialCookies = cookies.getAll(); | ||
var _useState = (0, _react.useState)(initialCookies), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
allCookies = _useState2[0], | ||
setCookies = _useState2[1]; | ||
var previousCookiesRef = (0, _react.useRef)(allCookies); | ||
if ((0, _utils.isInBrowser)()) { | ||
(0, _react.useLayoutEffect)(function () { | ||
function onChange() { | ||
var newCookies = cookies.getAll(); | ||
if (shouldUpdate(dependencies || null, newCookies, previousCookiesRef.current)) { | ||
setCookies(newCookies); | ||
} | ||
previousCookiesRef.current = newCookies; | ||
} | ||
cookies.addChangeListener(onChange); | ||
return function () { | ||
cookies.removeChangeListener(onChange); | ||
}; | ||
}, [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]; | ||
} | ||
function shouldUpdate(dependencies, newCookies, oldCookies) { | ||
if (!dependencies) { | ||
return true; | ||
} | ||
var _iterator = _createForOfIteratorHelper(dependencies), | ||
_step; | ||
try { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var dependency = _step.value; | ||
if (newCookies[dependency] !== oldCookies[dependency]) { | ||
return true; | ||
} | ||
} | ||
} catch (err) { | ||
_iterator.e(err); | ||
} finally { | ||
_iterator.f(); | ||
} | ||
return false; | ||
} | ||
module.exports = exports.default; | ||
} (useCookies, useCookies.exports)); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = useCookies; | ||
var useCookiesExports = useCookies.exports; | ||
var types = {}; | ||
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]; | ||
var previousCookiesRef = (0, react.useRef)(allCookies); | ||
if ((0, utils.isInBrowser)()) { | ||
(0, react.useLayoutEffect)(function () { | ||
function onChange() { | ||
var newCookies = cookies.getAll(); | ||
if (shouldUpdate(dependencies || null, newCookies, previousCookiesRef.current)) { | ||
setCookies(newCookies); | ||
} | ||
previousCookiesRef.current = newCookies; | ||
} | ||
cookies.addChangeListener(onChange); | ||
return function () { | ||
cookies.removeChangeListener(onChange); | ||
}; | ||
}, [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]; | ||
} | ||
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 types = /*#__PURE__*/Object.freeze({ | ||
__proto__: null | ||
}); | ||
var cjs = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
Object.defineProperty(types, "__esModule", { | ||
value: true | ||
}); | ||
var _exportNames = { | ||
Cookies: true, | ||
CookiesProvider: true, | ||
withCookies: true, | ||
useCookies: true | ||
}; | ||
Object.defineProperty(exports, "Cookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Cookies["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "CookiesProvider", { | ||
enumerable: true, | ||
get: function get() { | ||
return _CookiesProvider["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "withCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _withCookies["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "useCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _useCookies["default"]; | ||
} | ||
}); | ||
var _Cookies = _interopRequireDefault(Cookies); | ||
(function (exports) { | ||
var _CookiesProvider = _interopRequireDefault(CookiesProvider_1); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _exportNames = { | ||
Cookies: true, | ||
CookiesProvider: true, | ||
withCookies: true, | ||
useCookies: true | ||
}; | ||
Object.defineProperty(exports, "Cookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Cookies["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "CookiesProvider", { | ||
enumerable: true, | ||
get: function get() { | ||
return _CookiesProvider["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "useCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _useCookies["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "withCookies", { | ||
enumerable: true, | ||
get: function get() { | ||
return _withCookies["default"]; | ||
} | ||
}); | ||
var _Cookies = _interopRequireDefault(CookiesExports); | ||
var _CookiesProvider = _interopRequireDefault(CookiesProviderExports); | ||
var _withCookies = _interopRequireDefault(withCookiesExports); | ||
var _useCookies = _interopRequireDefault(useCookiesExports); | ||
var _types = types; | ||
Object.keys(_types).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _types[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _types[key]; | ||
} | ||
}); | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
} (cjs)); | ||
var _withCookies = _interopRequireDefault(withCookies_1); | ||
var index = /*@__PURE__*/getDefaultExportFromCjs(cjs); | ||
var _useCookies = _interopRequireDefault(useCookies_1); | ||
Object.keys(types).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === types[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return types[key]; | ||
} | ||
}); | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
}); | ||
var index = unwrapExports(cjs); | ||
return index; | ||
}))); | ||
})); |
@@ -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=e||self).ReactCookie=t(e.UniversalCookie,e.React)}(this,function(l,p){"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}l=l&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l,p=p&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p;var c=t(function(e,t){var o;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=((o=l)&&o.__esModule?o:{default:o}).default;t.default=r,e.exports=t.default});e(c);var y=t(function(e,t){function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Consumer=t.Provider=void 0;var o,r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};t=f(t);if(t&&t.has(e))return t.get(e);var o,r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(o in e){var u;"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&((u=n?Object.getOwnPropertyDescriptor(e,o):null)&&(u.get||u.set)?Object.defineProperty(r,o,u):r[o]=e[o])}r.default=e,t&&t.set(e,r);return r}(p),n=(o=c)&&o.__esModule?o:{default:o};function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(f=function(e){return e?o:t})(e)}var u=r.createContext(new n.default),r=u.Provider,n=u.Consumer;t.Consumer=n,t.Provider=r,t.default=u});e(y);y.Consumer,y.Provider;var a=t(function(e,t){function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o,r=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};t=f(t);if(t&&t.has(e))return t.get(e);var o,r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(o in e){var u;"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&((u=n?Object.getOwnPropertyDescriptor(e,o):null)&&(u.get||u.set)?Object.defineProperty(r,o,u):r[o]=e[o])}r.default=e,t&&t.set(e,r);return r}(p),n=(o=l)&&o.__esModule?o:{default:o};function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(f=function(e){return e?o:t})(e)}var u,c,a=(u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)},function(e,t){function o(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),a=(c=r.Component,a(s,c),s.prototype.render=function(){return r.createElement(y.Provider,{value:this.cookies},this.props.children)},s);function s(e){var t=c.call(this,e)||this;return e.cookies?t.cookies=e.cookies:t.cookies=new n.default,t}t.default=a,e.exports=t.default});e(a);var o="function"==typeof Symbol&&Symbol.for,r=o?Symbol.for("react.element"):60103,n=o?Symbol.for("react.portal"):60106,u=o?Symbol.for("react.fragment"):60107,i=o?Symbol.for("react.strict_mode"):60108,f=o?Symbol.for("react.profiler"):60114,s=o?Symbol.for("react.provider"):60109,d=o?Symbol.for("react.context"):60110,m=o?Symbol.for("react.async_mode"):60111,b=o?Symbol.for("react.concurrent_mode"):60111,v=o?Symbol.for("react.forward_ref"):60112,O=o?Symbol.for("react.suspense"):60113,P=o?Symbol.for("react.suspense_list"):60120,_=o?Symbol.for("react.memo"):60115,w=o?Symbol.for("react.lazy"):60116,h=o?Symbol.for("react.block"):60121,j=o?Symbol.for("react.fundamental"):60117,g=o?Symbol.for("react.responder"):60118,C=o?Symbol.for("react.scope"):60119;function M(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case m:case b:case u:case f:case i:case O:return e;default:switch(e=e&&e.$$typeof){case d:case v:case w:case _:case s:return e;default:return t}}case n:return t}}}function S(e){return M(e)===b}var k={AsyncMode:m,ConcurrentMode:b,ContextConsumer:d,ContextProvider:s,Element:r,ForwardRef:v,Fragment:u,Lazy:w,Memo:_,Portal:n,Profiler:f,StrictMode:i,Suspense:O,isAsyncMode:function(e){return S(e)||M(e)===m},isConcurrentMode:S,isContextConsumer:function(e){return M(e)===d},isContextProvider:function(e){return M(e)===s},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},isForwardRef:function(e){return M(e)===v},isFragment:function(e){return M(e)===u},isLazy:function(e){return M(e)===w},isMemo:function(e){return M(e)===_},isPortal:function(e){return M(e)===n},isProfiler:function(e){return M(e)===f},isStrictMode:function(e){return M(e)===i},isSuspense:function(e){return M(e)===O},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===u||e===b||e===f||e===i||e===O||e===P||"object"==typeof e&&null!==e&&(e.$$typeof===w||e.$$typeof===_||e.$$typeof===s||e.$$typeof===d||e.$$typeof===v||e.$$typeof===j||e.$$typeof===g||e.$$typeof===C||e.$$typeof===h)},typeOf:M},o=t(function(e,t){}),$=(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.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,o.isValidElementType,o.typeOf,t(function(e){e.exports=k})),x={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},E={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},W={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},D={};function R(e){return $.isMemo(e)?W:D[e.$$typeof]||x}D[$.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},D[$.Memo]=W;var F=Object.defineProperty,A=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols,N=Object.getOwnPropertyDescriptor,T=Object.getPrototypeOf,z=Object.prototype;function I(e,t,o){if("string"!=typeof t){var r;!z||(r=T(t))&&r!==z&&I(e,r,o);var n=A(t);L&&(n=n.concat(L(t)));for(var u=R(e),i=R(t),f=0;f<n.length;++f){var c=n[f];if(!(E[c]||o&&o[c]||i&&i[c]||u&&u[c])){var a=N(t,c);try{F(e,c,a)}catch(e){}}}}return e}var U=t(function(e,t){function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(n){var o=n.displayName||n.name,r=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onChange=function(){e.forceUpdate()},e}return a(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,o=e.cookies,r=l(e,["forwardedRef","cookies"]),e=o.getAll();return u.createElement(n,s({},r,{ref:t,cookies:o,allCookies:e}))},e.displayName="withCookies("+o+")",e.WrappedComponent=n,e}(u.Component),e=u.forwardRef(function(t,o){return u.createElement(y.Consumer,null,function(e){return u.createElement(r,s({cookies:e},t,{forwardedRef:o}))})});return e.displayName=r.displayName,e.WrappedComponent=r.WrappedComponent,(0,f.default)(e,n)};var o,u=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};t=c(t);if(t&&t.has(e))return t.get(e);var o,r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(o in e){var u;"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&((u=n?Object.getOwnPropertyDescriptor(e,o):null)&&(u.get||u.set)?Object.defineProperty(r,o,u):r[o]=e[o])}r.default=e,t&&t.set(e,r);return r}(p),f=(o=I)&&o.__esModule?o:{default:o};function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(c=function(e){return e?o:t})(e)}var r,a=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)},function(e,t){function o(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),s=function(){return(s=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},l=function(e,t){var o={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]]);return o};e.exports=t.default});e(U);var B=t(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isInBrowser=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement}});e(B);B.isInBrowser;var q=t(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var o=(0,p.useContext)(f.default);if(!o)throw new Error("Missing <CookiesProvider>");var e=o.getAll(),r=(0,p.useState)(e),n=r[0],u=r[1],i=(0,p.useRef)(n);(0,B.isInBrowser)()&&(0,p.useLayoutEffect)(function(){function e(){var e=o.getAll();!function(e,t,o){if(!e)return!0;for(var r=0,n=e;r<n.length;r++){var u=n[r];if(t[u]!==o[u])return!0}return!1}(t||null,e,i.current)||u(e),i.current=e}return o.addChangeListener(e),function(){o.removeChangeListener(e)}},[o]);e=(0,p.useMemo)(function(){return o.set.bind(o)},[o]),r=(0,p.useMemo)(function(){return o.remove.bind(o)},[o]);return[n,e,r]};var o,f=(o=y)&&o.__esModule?o:{default:o};e.exports=t.default});e(q);var V=Object.freeze({__proto__:null});return e(t(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var o={Cookies:!0,CookiesProvider:!0,withCookies:!0,useCookies:!0};Object.defineProperty(t,"Cookies",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"CookiesProvider",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"withCookies",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"useCookies",{enumerable:!0,get:function(){return i.default}});var r=f(c),n=f(a),u=f(U),i=f(q);function f(e){return e&&e.__esModule?e:{default:e}}Object.keys(V).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(o,e)||e in t&&t[e]===V[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return V[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="undefined"!=typeof globalThis?globalThis:e||self).ReactCookie=t(e.UniversalCookie,e.React)}(this,(function(e,t){"use strict";function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var o={},n={exports:{}};!function(t,r){var o;Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=((o=e)&&o.__esModule?o:{default:o}).default;r.default=n,t.exports=r.default}(n,n.exports);var i=n.exports,u={exports:{}},f={};!function(e){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.Provider=e.Consumer=void 0;var o,n=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var o=f(t);if(o&&o.has(e))return o.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var a=i?Object.getOwnPropertyDescriptor(e,u):null;a&&(a.get||a.set)?Object.defineProperty(n,u,a):n[u]=e[u]}n.default=e,o&&o.set(e,n);return n}(t),u=(o=i)&&o.__esModule?o:{default:o};function f(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(f=function(e){return e?r:t})(e)}var a=n.createContext(new u.default),c=a.Provider,l=a.Consumer;e.Consumer=l,e.Provider=c;var s=a;e.default=s}(f),function(r,o){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var i,u=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==n(e)&&"function"!=typeof e)return{default:e};var r=l(t);if(r&&r.has(e))return r.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var f=i?Object.getOwnPropertyDescriptor(e,u):null;f&&(f.get||f.set)?Object.defineProperty(o,u,f):o[u]=e[u]}o.default=e,r&&r.set(e,o);return o}(t),a=(i=e)&&i.__esModule?i:{default:i},c=f;function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(l=function(e){return e?r:t})(e)}function s(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(i=o.key,u=void 0,u=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return function(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}var b=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(i,e);var t,r,o,n=y(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),t=n.call(this,e),e.cookies?t.cookies=e.cookies:t.cookies=new a.default,t}return t=i,(r=[{key:"render",value:function(){return u.createElement(c.Provider,{value:this.cookies},this.props.children)}}])&&s(t.prototype,r),o&&s(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(u.Component);o.default=b,r.exports=o.default}(u,u.exports);var a,c=u.exports,l={exports:{}},s={exports:{}},p={};s.exports=function(){if(a)return p;a=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,n=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,u=e?Symbol.for("react.provider"):60109,f=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,s=e?Symbol.for("react.forward_ref"):60112,y=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,b=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,O=e?Symbol.for("react.fundamental"):60117,h=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function j(e){if("object"==typeof e&&null!==e){var a=e.$$typeof;switch(a){case t:switch(e=e.type){case c:case l:case o:case i:case n:case y:return e;default:switch(e=e&&e.$$typeof){case f:case s:case m:case b:case u:return e;default:return a}}case r:return a}}}function P(e){return j(e)===l}return p.AsyncMode=c,p.ConcurrentMode=l,p.ContextConsumer=f,p.ContextProvider=u,p.Element=t,p.ForwardRef=s,p.Fragment=o,p.Lazy=m,p.Memo=b,p.Portal=r,p.Profiler=i,p.StrictMode=n,p.Suspense=y,p.isAsyncMode=function(e){return P(e)||j(e)===c},p.isConcurrentMode=P,p.isContextConsumer=function(e){return j(e)===f},p.isContextProvider=function(e){return j(e)===u},p.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},p.isForwardRef=function(e){return j(e)===s},p.isFragment=function(e){return j(e)===o},p.isLazy=function(e){return j(e)===m},p.isMemo=function(e){return j(e)===b},p.isPortal=function(e){return j(e)===r},p.isProfiler=function(e){return j(e)===i},p.isStrictMode=function(e){return j(e)===n},p.isSuspense=function(e){return j(e)===y},p.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===l||e===i||e===n||e===y||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===b||e.$$typeof===u||e.$$typeof===f||e.$$typeof===s||e.$$typeof===O||e.$$typeof===h||e.$$typeof===w||e.$$typeof===v)},p.typeOf=j,p}();var y=s.exports,d={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},b={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},m={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},v={};function O(e){return y.isMemo(e)?m:v[e.$$typeof]||d}v[y.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},v[y.Memo]=m;var h=Object.defineProperty,w=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols,P=Object.getOwnPropertyDescriptor,g=Object.getPrototypeOf,S=Object.prototype;var _=function e(t,r,o){if("string"!=typeof r){if(S){var n=g(r);n&&n!==S&&e(t,n,o)}var i=w(r);j&&(i=i.concat(j(r)));for(var u=O(t),f=O(r),a=0;a<i.length;++a){var c=i[a];if(!(b[c]||o&&o[c]||f&&f[c]||u&&u[c])){var l=P(r,c);try{h(t,c,l)}catch(e){}}}}return t};!function(e,r){function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=e.displayName||e.name,r=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}(f,t);var r,n,u=(r=f,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=p(r);if(n){var i=p(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function f(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),(e=u.apply(this,arguments)).onChange=function(){e.forceUpdate()},e}return function(e,t,r){t&&l(e.prototype,t);r&&l(e,r);Object.defineProperty(e,"prototype",{writable:!1})}(f,[{key:"listen",value:function(){this.props.cookies.addChangeListener(this.onChange)}},{key:"unlisten",value:function(e){(e||this.props.cookies).removeChangeListener(this.onChange)}},{key:"componentDidMount",value:function(){this.listen()}},{key:"componentDidUpdate",value:function(e){e.cookies!==this.props.cookies&&(this.unlisten(e.cookies),this.listen())}},{key:"componentWillUnmount",value:function(){this.unlisten()}},{key:"render",value:function(){var t=this.props,r=t.forwardedRef,o=t.cookies,n=y(t,["forwardedRef","cookies"]),u=o.getAll();return i.createElement(e,Object.assign({},n,{ref:r,cookies:o,allCookies:u}))}}]),f}(i.Component);r.displayName="withCookies(".concat(t,")"),r.WrappedComponent=e;var n=i.forwardRef((function(e,t){return i.createElement(a.Consumer,null,(function(o){return i.createElement(r,Object.assign({cookies:o},e,{forwardedRef:t}))}))}));return n.displayName=r.displayName,n.WrappedComponent=r.WrappedComponent,(0,u.default)(n,e)};var n,i=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==o(e)&&"function"!=typeof e)return{default:e};var r=c(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var f=i?Object.getOwnPropertyDescriptor(e,u):null;f&&(f.get||f.set)?Object.defineProperty(n,u,f):n[u]=e[u]}n.default=e,r&&r.set(e,n);return n}(t),u=(n=_)&&n.__esModule?n:{default:n},a=f;function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(c=function(e){return e?r:t})(e)}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(i=n.key,u=void 0,u=function(e,t){if("object"!==o(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(i,"string"),"symbol"===o(u)?u:String(u)),n)}var i,u}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}var y=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&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r};e.exports=r.default}(l,l.exports);var k=l.exports,C={exports:{}},M={};Object.defineProperty(M,"__esModule",{value:!0}),M.isInBrowser=function(){return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement},function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=(0,n.useContext)(i.default);if(!t)throw new Error("Missing <CookiesProvider>");var r=t.getAll(),o=(s=(0,n.useState)(r),p=2,function(e){if(Array.isArray(e))return e}(s)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,n,i,u,f=[],a=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;a=!1}else for(;!(a=(o=i.call(r)).done)&&(f.push(o.value),f.length!==t);a=!0);}catch(e){c=!0,n=e}finally{try{if(!a&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw n}}return f}}(s,p)||a(s,p)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f=o[0],c=o[1],l=(0,n.useRef)(f);var s,p;(0,u.isInBrowser)()&&(0,n.useLayoutEffect)((function(){function r(){var r=t.getAll();(function(e,t,r){if(!e)return!0;var o,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,n=function(){};return{s:n,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,f=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){f=!0,i=e},f:function(){try{u||null==r.return||r.return()}finally{if(f)throw i}}}}(e);try{for(n.s();!(o=n.n()).done;){var i=o.value;if(t[i]!==r[i])return!0}}catch(e){n.e(e)}finally{n.f()}return!1})(e||null,r,l.current)&&c(r),l.current=r}return t.addChangeListener(r),function(){t.removeChangeListener(r)}}),[t]);var y=(0,n.useMemo)((function(){return t.set.bind(t)}),[t]),d=(0,n.useMemo)((function(){return t.remove.bind(t)}),[t]);return[f,y,d]};var o,n=t,i=(o=f)&&o.__esModule?o:{default:o},u=M;function a(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}e.exports=r.default}(C,C.exports);var x=C.exports,$={};return Object.defineProperty($,"__esModule",{value:!0}),function(e){Object.defineProperty(e,"__esModule",{value:!0});var t={Cookies:!0,CookiesProvider:!0,withCookies:!0,useCookies:!0};Object.defineProperty(e,"Cookies",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(e,"CookiesProvider",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"useCookies",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(e,"withCookies",{enumerable:!0,get:function(){return n.default}});var r=a(i),o=a(c),n=a(k),u=a(x),f=$;function a(e){return e&&e.__esModule?e:{default:e}}Object.keys(f).forEach((function(r){"default"!==r&&"__esModule"!==r&&(Object.prototype.hasOwnProperty.call(t,r)||r in e&&e[r]===f[r]||Object.defineProperty(e,r,{enumerable:!0,get:function(){return f[r]}}))}))}(o),r(o)})); |
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
121551
1651
352