From d3b53e5abeef231f39afe06247bdf33161fdac7e Mon Sep 17 00:00:00 2001 From: Karl Date: Tue, 31 Oct 2017 09:24:10 +0100 Subject: [PATCH 01/10] Added React 16 to peerDependencies and upgrade enzyme (#56) --- package.json | 14 +++++++------- test/mocha.opts | 1 + test/utils/enzyme.js | 5 +++++ test/utils/rafPolyfill.js | 5 +++++ 4 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 test/utils/enzyme.js create mode 100644 test/utils/rafPolyfill.js diff --git a/package.json b/package.json index 39cdb35..a7fdd85 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "babelify": "^7.3.0", "brfs": "^1.4.3", "chai": "^3.5.0", - "enzyme": "^2.4.1", + "enzyme": "^3.1.0", + "enzyme-adapter-react-16": "^1.0.2", "eslint": "^1.6.0", "eslint-plugin-react": "^3.5.1", "gulp": "^3.9.0", @@ -34,22 +35,21 @@ "jsdom": "^9.8.3", "lodash": "^4.14.2", "mocha": "^3.2.0", - "react": "^0.14 || ^15.0.0-rc || ^15.0", - "react-addons-test-utils": "^15.3.1", + "react": "^0.14 || ^15.0.0-rc || ^15.0 || ^16.0", "react-component-gulp-tasks": "git+https://github.com/gor181/react-component-gulp-tasks.git", - "react-dom": "^0.14 || ^15.0.0-rc || ^15.0", + "react-dom": "^0.14 || ^15.0.0-rc || ^15.0 || ^16.0", "react-notification-system": "^0.2.7", "react-redux": "^4.4.5", "redux": "^3.5.2", "sinon": "^1.17.6" }, "dependencies": { - "prop-types": "^15.5.8", + "prop-types": "^15.6.0", "react-notification-system": "^0.2.x" }, "peerDependencies": { - "react": "^0.14 || ^15.0.0-rc || ^15.0", - "react-dom": "^0.14 || ^15.0.0-rc || ^15.0" + "react": "^0.14 || ^15.0.0-rc || ^15.0 || ^16.0", + "react-dom": "^0.14 || ^15.0.0-rc || ^15.0 || ^16.0" }, "browserify-shim": { "react": "global:React" diff --git a/test/mocha.opts b/test/mocha.opts index 7cfa710..b645feb 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1,3 +1,4 @@ --compilers js:babel-register --require test/utils/dom.js +--require test/utils/enzyme.js --reporter spec diff --git a/test/utils/enzyme.js b/test/utils/enzyme.js new file mode 100644 index 0000000..927f0e0 --- /dev/null +++ b/test/utils/enzyme.js @@ -0,0 +1,5 @@ +import './rafPolyfill'; +import { configure } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; + +configure({ adapter: new Adapter() }); diff --git a/test/utils/rafPolyfill.js b/test/utils/rafPolyfill.js new file mode 100644 index 0000000..b89e314 --- /dev/null +++ b/test/utils/rafPolyfill.js @@ -0,0 +1,5 @@ +const raf = global.requestAnimationFrame = (cb) => { + setTimeout(cb, 0); +}; + +export default raf; \ No newline at end of file From 53236f649cf2d5888036ff133081ad1b6d24e27e Mon Sep 17 00:00:00 2001 From: Evgeny Potockiy Date: Thu, 31 Jan 2019 15:15:40 +0300 Subject: [PATCH 02/10] Rewriten notification component to latest version of React and react-redux (#70) Replaced unsafe componentWillReceiveProps lifecycle method by componentDidUpdate Updated tests and example --- dist/react-notification-system-redux.js | 2586 +++++++++++++++++-- dist/react-notification-system-redux.min.js | 1 - example/src/components/container.js | 38 +- lib/actions.js | 2 + lib/const.js | 2 + lib/notifications.js | 69 +- lib/reducer.js | 2 + package.json | 22 +- src/notifications.js | 53 +- test/__tests__/notifications.js | 40 +- 10 files changed, 2544 insertions(+), 271 deletions(-) delete mode 100644 dist/react-notification-system-redux.min.js diff --git a/dist/react-notification-system-redux.js b/dist/react-notification-system-redux.js index 1342222..5d6db05 100644 --- a/dist/react-notification-system-redux.js +++ b/dist/react-notification-system-redux.js @@ -1,47 +1,188 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.notifications = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0) continue; + target[key] = source[key]; + } + + return target; } +module.exports = _objectWithoutPropertiesLoose; +},{}],7:[function(require,module,exports){ +'use strict'; + /** - * This function accepts and discards inputs; it has no side effects. This is - * primarily useful idiomatically for overridable function endpoints which - * always need to be callable, since JS lacks a null-call idiom ala Cocoa. + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ -var emptyFunction = function emptyFunction() {}; - -emptyFunction.thatReturns = makeEmptyFunction; -emptyFunction.thatReturnsFalse = makeEmptyFunction(false); -emptyFunction.thatReturnsTrue = makeEmptyFunction(true); -emptyFunction.thatReturnsNull = makeEmptyFunction(null); -emptyFunction.thatReturnsThis = function () { - return this; +var ReactIs = require('react-is'); +var REACT_STATICS = { + childContextTypes: true, + contextType: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromError: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true +}; + +var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true }; -emptyFunction.thatReturnsArgument = function (arg) { - return arg; + +var FORWARD_REF_STATICS = { + '$$typeof': true, + render: true, + defaultProps: true, + displayName: true, + propTypes: true }; -module.exports = emptyFunction; -},{}],2:[function(require,module,exports){ +var TYPE_STATICS = {}; +TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS; + +var defineProperty = Object.defineProperty; +var getOwnPropertyNames = Object.getOwnPropertyNames; +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var getPrototypeOf = Object.getPrototypeOf; +var objectPrototype = Object.prototype; + +function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { + // don't hoist over string (html) components + + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS; + var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS; + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + try { + // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } + } + + return targetComponent; + } + + return targetComponent; +} + +module.exports = hoistNonReactStatics; + +},{"react-is":18}],8:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - * */ 'use strict'; @@ -57,102 +198,37 @@ module.exports = emptyFunction; * will remain to ensure logic does not differ in production. */ -var validateFormat = function validateFormat(format) {}; - -if ("production" !== 'production') { - validateFormat = function validateFormat(format) { +var invariant = function(condition, format, a, b, c, d, e, f) { + if ("production" !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); } - }; -} - -function invariant(condition, format, a, b, c, d, e, f) { - validateFormat(format); + } if (!condition) { var error; if (format === undefined) { - error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + error = new Error( + 'Minified exception occurred; use the non-minified dev environment ' + + 'for the full error message and additional helpful warnings.' + ); } else { var args = [a, b, c, d, e, f]; var argIndex = 0; - error = new Error(format.replace(/%s/g, function () { - return args[argIndex++]; - })); + error = new Error( + format.replace(/%s/g, function() { return args[argIndex++]; }) + ); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } -} +}; module.exports = invariant; -},{}],3:[function(require,module,exports){ -/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - -'use strict'; - -var emptyFunction = require('./emptyFunction'); - -/** - * Similar to invariant but only logs a warning if the condition is not met. - * This can be used to log issues in development environments in critical - * paths. Removing the logging code for production environments will keep the - * same logic and follow the same code paths. - */ - -var warning = emptyFunction; - -if ("production" !== 'production') { - var printWarning = function printWarning(format) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - if (typeof console !== 'undefined') { - console.error(message); - } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; - - warning = function warning(condition, format) { - if (format === undefined) { - throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); - } - - if (format.indexOf('Failed Composite propType: ') === 0) { - return; // Ignore CompositeComponent proptype check. - } - - if (!condition) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; - } - - printWarning.apply(undefined, [format].concat(args)); - } - }; -} -module.exports = warning; -},{"./emptyFunction":1}],4:[function(require,module,exports){ +},{}],9:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @@ -244,7 +320,193 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],5:[function(require,module,exports){ +},{}],10:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],11:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -254,11 +516,24 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { 'use strict'; +var printWarning = function() {}; + if ("production" !== 'production') { - var invariant = require('fbjs/lib/invariant'); - var warning = require('fbjs/lib/warning'); var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); var loggedTypeFailures = {}; + + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; } /** @@ -283,12 +558,29 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { try { // This is intentionally an invariant that gets caught. It's the same // behavior as without this statement except with a better message. - invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); + if (typeof typeSpecs[typeSpecName] !== 'function') { + var err = Error( + (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + ); + err.name = 'Invariant Violation'; + throw err; + } error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); } catch (ex) { error = ex; } - warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); + if (error && !(error instanceof Error)) { + printWarning( + (componentName || 'React class') + ': type specification of ' + + location + ' `' + typeSpecName + '` is invalid; the type checker ' + + 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + + 'You may have forgotten to pass an argument to the type checker ' + + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + + 'shape all require an argument).' + ) + + } if (error instanceof Error && !(error.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the // same error. @@ -296,7 +588,9 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { var stack = getStack ? getStack() : ''; - warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); + printWarning( + 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') + ); } } } @@ -305,7 +599,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { module.exports = checkPropTypes; -},{"./lib/ReactPropTypesSecret":9,"fbjs/lib/invariant":2,"fbjs/lib/warning":3}],6:[function(require,module,exports){ +},{"./lib/ReactPropTypesSecret":15}],12:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -315,22 +609,23 @@ module.exports = checkPropTypes; 'use strict'; -var emptyFunction = require('fbjs/lib/emptyFunction'); -var invariant = require('fbjs/lib/invariant'); var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); +function emptyFunction() {} + module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret === ReactPropTypesSecret) { // It is still safe when called from React. return; } - invariant( - false, + var err = new Error( 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); + err.name = 'Invariant Violation'; + throw err; }; shim.isRequired = shim; function getShim() { @@ -365,7 +660,7 @@ module.exports = function() { return ReactPropTypes; }; -},{"./lib/ReactPropTypesSecret":9,"fbjs/lib/emptyFunction":1,"fbjs/lib/invariant":2}],7:[function(require,module,exports){ +},{"./lib/ReactPropTypesSecret":15}],13:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -375,14 +670,32 @@ module.exports = function() { 'use strict'; -var emptyFunction = require('fbjs/lib/emptyFunction'); -var invariant = require('fbjs/lib/invariant'); -var warning = require('fbjs/lib/warning'); var assign = require('object-assign'); var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); var checkPropTypes = require('./checkPropTypes'); +var printWarning = function() {}; + +if ("production" !== 'production') { + printWarning = function(text) { + var message = 'Warning: ' + text; + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; +} + +function emptyFunctionThatReturnsNull() { + return null; +} + module.exports = function(isValidElement, throwOnDirectAccess) { /* global Symbol */ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; @@ -525,12 +838,13 @@ module.exports = function(isValidElement, throwOnDirectAccess) { if (secret !== ReactPropTypesSecret) { if (throwOnDirectAccess) { // New behavior only for users of `prop-types` package - invariant( - false, + var err = new Error( 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); + err.name = 'Invariant Violation'; + throw err; } else if ("production" !== 'production' && typeof console !== 'undefined') { // Old behavior for people using React.PropTypes var cacheKey = componentName + ':' + propName; @@ -539,15 +853,12 @@ module.exports = function(isValidElement, throwOnDirectAccess) { // Avoid spamming the console because they are often not actionable except for lib authors manualPropTypeWarningCount < 3 ) { - warning( - false, + printWarning( 'You are manually calling a React.PropTypes validation ' + - 'function for the `%s` prop on `%s`. This is deprecated ' + + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + - 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', - propFullName, - componentName + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' ); manualPropTypeCallCache[cacheKey] = true; manualPropTypeWarningCount++; @@ -591,7 +902,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { } function createAnyTypeChecker() { - return createChainableTypeChecker(emptyFunction.thatReturnsNull); + return createChainableTypeChecker(emptyFunctionThatReturnsNull); } function createArrayOfTypeChecker(typeChecker) { @@ -641,8 +952,8 @@ module.exports = function(isValidElement, throwOnDirectAccess) { function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { - "production" !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; - return emptyFunction.thatReturnsNull; + "production" !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; } function validate(props, propName, componentName, location, propFullName) { @@ -684,21 +995,18 @@ module.exports = function(isValidElement, throwOnDirectAccess) { function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { - "production" !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; - return emptyFunction.thatReturnsNull; + "production" !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunctionThatReturnsNull; } for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (typeof checker !== 'function') { - warning( - false, + printWarning( 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + - 'received %s at index %s.', - getPostfixForTypeWarning(checker), - i + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' ); - return emptyFunction.thatReturnsNull; + return emptyFunctionThatReturnsNull; } } @@ -909,7 +1217,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return ReactPropTypes; }; -},{"./checkPropTypes":5,"./lib/ReactPropTypesSecret":9,"fbjs/lib/emptyFunction":1,"fbjs/lib/invariant":2,"fbjs/lib/warning":3,"object-assign":4}],8:[function(require,module,exports){ +},{"./checkPropTypes":11,"./lib/ReactPropTypesSecret":15,"object-assign":9}],14:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -939,7 +1247,7 @@ if ("production" !== 'production') { module.exports = require('./factoryWithThrowingShims')(); } -},{"./factoryWithThrowingShims":6,"./factoryWithTypeCheckers":7}],9:[function(require,module,exports){ +},{"./factoryWithThrowingShims":12,"./factoryWithTypeCheckers":13}],15:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -953,46 +1261,1891 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; -},{}],10:[function(require,module,exports){ -Object.defineProperty(exports, "__esModule", { - value: true -}); +},{}],16:[function(require,module,exports){ +(function (process){ +/** @license React v16.7.0 + * 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. + */ -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; +'use strict'; -exports.show = show; -exports.success = success; -exports.error = error; -exports.warning = warning; -exports.info = info; -exports.hide = hide; -exports.removeAll = removeAll; -var _const = require('./const'); -//Example opts -// { -// title: 'Hey, it\'s good to see you!', -// message: 'Now you can see how easy it is to use notifications in React!', -// position: 'tr', -// autoDismiss: 0, -// action: { -// label: 'Awesome!', -// callback: function() { -// console.log('Clicked'); -// } -// } -// } +if (process.env.NODE_ENV !== "production") { + (function() { +'use strict'; -function show() { - var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'success'; +Object.defineProperty(exports, '__esModule', { value: true }); + +// 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; +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_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; +var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; + +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 || 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); +} - return _extends({ - type: _const.RNS_SHOW_NOTIFICATION - }, opts, { - uid: opts.uid || Date.now(), - level: level +/** + * Forked from fbjs/warning: + * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js + * + * Only change is we use console.warn instead of console.error, + * and do nothing when 'console' is not supported. + * This really simplifies the code. + * --- + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + +var lowPriorityWarning = function () {}; + +{ + var printWarning = function (format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.warn(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + lowPriorityWarning = function (condition, format) { + if (format === undefined) { + throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + printWarning.apply(undefined, [format].concat(args)); + } + }; +} + +var lowPriorityWarning$1 = lowPriorityWarning; + +function typeOf(object) { + if (typeof object === 'object' && object !== null) { + var $$typeof = object.$$typeof; + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + + 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_PROVIDER_TYPE: + return $$typeofType; + default: + return $$typeof; + } + } + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + 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; + lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); + } + } + return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; +} +function isConcurrentMode(object) { + return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; +} +function isContextConsumer(object) { + 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.typeOf = typeOf; +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.isValidElementType = isValidElementType; +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; + })(); +} + +}).call(this,require('_process')) +},{"_process":10}],17:[function(require,module,exports){ +/** @license React v16.7.0 + * react-is.production.min.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. + */ + +'use strict';Object.defineProperty(exports,"__esModule",{value:!0}); +var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"): +60115,r=b?Symbol.for("react.lazy"):60116;function t(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return u}}case r:case q:case d:return u}}}function v(a){return t(a)===m}exports.typeOf=t;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n; +exports.Fragment=e;exports.Lazy=r;exports.Memo=q;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n)};exports.isAsyncMode=function(a){return v(a)||t(a)===l};exports.isConcurrentMode=v;exports.isContextConsumer=function(a){return t(a)===k}; +exports.isContextProvider=function(a){return t(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return t(a)===n};exports.isFragment=function(a){return t(a)===e};exports.isLazy=function(a){return t(a)===r};exports.isMemo=function(a){return t(a)===q};exports.isPortal=function(a){return t(a)===d};exports.isProfiler=function(a){return t(a)===g};exports.isStrictMode=function(a){return t(a)===f}; +exports.isSuspense=function(a){return t(a)===p}; + +},{}],18:[function(require,module,exports){ +(function (process){ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-is.production.min.js'); +} else { + module.exports = require('./cjs/react-is.development.js'); +} + +}).call(this,require('_process')) +},{"./cjs/react-is.development.js":16,"./cjs/react-is.production.min.js":17,"_process":10}],19:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = exports.ReactReduxContext = void 0; + +var _react = _interopRequireDefault(require("react")); + +var ReactReduxContext = _react.default.createContext(null); + +exports.ReactReduxContext = ReactReduxContext; +var _default = ReactReduxContext; +exports.default = _default; +},{"@babel/runtime/helpers/interopRequireDefault":4,"react":undefined}],20:[function(require,module,exports){ +"use strict"; + +var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = void 0; + +var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose")); + +var _react = _interopRequireWildcard(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _Context = require("./Context"); + +var Provider = +/*#__PURE__*/ +function (_Component) { + (0, _inheritsLoose2.default)(Provider, _Component); + + function Provider(props) { + var _this; + + _this = _Component.call(this, props) || this; + var store = props.store; + _this.state = { + storeState: store.getState(), + store: store + }; + return _this; + } + + var _proto = Provider.prototype; + + _proto.componentDidMount = function componentDidMount() { + this._isMounted = true; + this.subscribe(); + }; + + _proto.componentWillUnmount = function componentWillUnmount() { + if (this.unsubscribe) this.unsubscribe(); + this._isMounted = false; + }; + + _proto.componentDidUpdate = function componentDidUpdate(prevProps) { + if (this.props.store !== prevProps.store) { + if (this.unsubscribe) this.unsubscribe(); + this.subscribe(); + } + }; + + _proto.subscribe = function subscribe() { + var _this2 = this; + + var store = this.props.store; + this.unsubscribe = store.subscribe(function () { + var newStoreState = store.getState(); + + if (!_this2._isMounted) { + return; + } + + _this2.setState(function (providerState) { + // If the value is the same, skip the unnecessary state update. + if (providerState.storeState === newStoreState) { + return null; + } + + return { + storeState: newStoreState + }; + }); + }); // Actions might have been dispatched between render and mount - handle those + + var postMountStoreState = store.getState(); + + if (postMountStoreState !== this.state.storeState) { + this.setState({ + storeState: postMountStoreState + }); + } + }; + + _proto.render = function render() { + var Context = this.props.context || _Context.ReactReduxContext; + return _react.default.createElement(Context.Provider, { + value: this.state + }, this.props.children); + }; + + return Provider; +}(_react.Component); + +Provider.propTypes = { + store: _propTypes.default.shape({ + subscribe: _propTypes.default.func.isRequired, + dispatch: _propTypes.default.func.isRequired, + getState: _propTypes.default.func.isRequired + }), + context: _propTypes.default.object, + children: _propTypes.default.any +}; +var _default = Provider; +exports.default = _default; +},{"./Context":19,"@babel/runtime/helpers/inheritsLoose":3,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/interopRequireWildcard":5,"prop-types":14,"react":undefined}],21:[function(require,module,exports){ +"use strict"; + +var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = connectAdvanced; + +var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose")); + +var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); + +var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose")); + +var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics")); + +var _invariant = _interopRequireDefault(require("invariant")); + +var _react = _interopRequireWildcard(require("react")); + +var _reactIs = require("react-is"); + +var _Context = require("./Context"); + +function connectAdvanced( +/* + selectorFactory is a func that is responsible for returning the selector function used to + compute new props from state, props, and dispatch. For example: + export default connectAdvanced((dispatch, options) => (state, props) => ({ + thing: state.things[props.thingId], + saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)), + }))(YourComponent) + Access to dispatch is provided to the factory so selectorFactories can bind actionCreators + outside of their selector as an optimization. Options passed to connectAdvanced are passed to + the selectorFactory, along with displayName and WrappedComponent, as the second argument. + Note that selectorFactory is responsible for all caching/memoization of inbound and outbound + props. Do not use connectAdvanced directly without memoizing results between calls to your + selector, otherwise the Connect component will re-render on every state or props change. +*/ +selectorFactory, // options object: +_ref) { + if (_ref === void 0) { + _ref = {}; + } + + var _ref2 = _ref, + _ref2$getDisplayName = _ref2.getDisplayName, + getDisplayName = _ref2$getDisplayName === void 0 ? function (name) { + return "ConnectAdvanced(" + name + ")"; + } : _ref2$getDisplayName, + _ref2$methodName = _ref2.methodName, + methodName = _ref2$methodName === void 0 ? 'connectAdvanced' : _ref2$methodName, + _ref2$renderCountProp = _ref2.renderCountProp, + renderCountProp = _ref2$renderCountProp === void 0 ? undefined : _ref2$renderCountProp, + _ref2$shouldHandleSta = _ref2.shouldHandleStateChanges, + shouldHandleStateChanges = _ref2$shouldHandleSta === void 0 ? true : _ref2$shouldHandleSta, + _ref2$storeKey = _ref2.storeKey, + storeKey = _ref2$storeKey === void 0 ? 'store' : _ref2$storeKey, + _ref2$withRef = _ref2.withRef, + withRef = _ref2$withRef === void 0 ? false : _ref2$withRef, + _ref2$forwardRef = _ref2.forwardRef, + forwardRef = _ref2$forwardRef === void 0 ? false : _ref2$forwardRef, + _ref2$context = _ref2.context, + context = _ref2$context === void 0 ? _Context.ReactReduxContext : _ref2$context, + connectOptions = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef", "forwardRef", "context"]); + (0, _invariant.default)(renderCountProp === undefined, "renderCountProp is removed. render counting is built into the latest React dev tools profiling extension"); + (0, _invariant.default)(!withRef, 'withRef is removed. To access the wrapped instance, use a ref on the connected component'); + var customStoreWarningMessage = 'To use a custom Redux store for specific components, create a custom React context with ' + "React.createContext(), and pass the context object to React-Redux's Provider and specific components" + ' like: . ' + 'You may also pass a {context : MyContext} option to connect'; + (0, _invariant.default)(storeKey === 'store', 'storeKey has been removed and does not do anything. ' + customStoreWarningMessage); + var Context = context; + return function wrapWithConnect(WrappedComponent) { + if ("production" !== 'production') { + (0, _invariant.default)((0, _reactIs.isValidElementType)(WrappedComponent), "You must pass a component to the function returned by " + (methodName + ". Instead received " + JSON.stringify(WrappedComponent))); + } + + var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component'; + var displayName = getDisplayName(wrappedComponentName); + var selectorFactoryOptions = (0, _extends2.default)({}, connectOptions, { + getDisplayName: getDisplayName, + methodName: methodName, + renderCountProp: renderCountProp, + shouldHandleStateChanges: shouldHandleStateChanges, + storeKey: storeKey, + displayName: displayName, + wrappedComponentName: wrappedComponentName, + WrappedComponent: WrappedComponent + }); + var pure = connectOptions.pure; + var OuterBaseComponent = _react.Component; + var FinalWrappedComponent = WrappedComponent; + + if (pure) { + OuterBaseComponent = _react.PureComponent; + } + + function makeDerivedPropsSelector() { + var lastProps; + var lastState; + var lastDerivedProps; + var lastStore; + var sourceSelector; + return function selectDerivedProps(state, props, store) { + if (pure && lastProps === props && lastState === state) { + return lastDerivedProps; + } + + if (store !== lastStore) { + lastStore = store; + sourceSelector = selectorFactory(store.dispatch, selectorFactoryOptions); + } + + lastProps = props; + lastState = state; + var nextProps = sourceSelector(state, props); + + if (lastDerivedProps === nextProps) { + return lastDerivedProps; + } + + lastDerivedProps = nextProps; + return lastDerivedProps; + }; + } + + function makeChildElementSelector() { + var lastChildProps, lastForwardRef, lastChildElement; + return function selectChildElement(childProps, forwardRef) { + if (childProps !== lastChildProps || forwardRef !== lastForwardRef) { + lastChildProps = childProps; + lastForwardRef = forwardRef; + lastChildElement = _react.default.createElement(FinalWrappedComponent, (0, _extends2.default)({}, childProps, { + ref: forwardRef + })); + } + + return lastChildElement; + }; + } + + var Connect = + /*#__PURE__*/ + function (_OuterBaseComponent) { + (0, _inheritsLoose2.default)(Connect, _OuterBaseComponent); + + function Connect(props) { + var _this; + + _this = _OuterBaseComponent.call(this, props) || this; + (0, _invariant.default)(forwardRef ? !props.wrapperProps[storeKey] : !props[storeKey], 'Passing redux store in props has been removed and does not do anything. ' + customStoreWarningMessage); + _this.selectDerivedProps = makeDerivedPropsSelector(); + _this.selectChildElement = makeChildElementSelector(); + _this.renderWrappedComponent = _this.renderWrappedComponent.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this))); + return _this; + } + + var _proto = Connect.prototype; + + _proto.renderWrappedComponent = function renderWrappedComponent(value) { + (0, _invariant.default)(value, "Could not find \"store\" in the context of " + ("\"" + displayName + "\". Either wrap the root component in a , ") + "or pass a custom React context provider to and the corresponding " + ("React context consumer to " + displayName + " in connect options.")); + var storeState = value.storeState, + store = value.store; + var wrapperProps = this.props; + var forwardedRef; + + if (forwardRef) { + wrapperProps = this.props.wrapperProps; + forwardedRef = this.props.forwardedRef; + } + + var derivedProps = this.selectDerivedProps(storeState, wrapperProps, store); + return this.selectChildElement(derivedProps, forwardedRef); + }; + + _proto.render = function render() { + var ContextToUse = this.props.context || Context; + return _react.default.createElement(ContextToUse.Consumer, null, this.renderWrappedComponent); + }; + + return Connect; + }(OuterBaseComponent); + + Connect.WrappedComponent = WrappedComponent; + Connect.displayName = displayName; + + if (forwardRef) { + var forwarded = _react.default.forwardRef(function forwardConnectRef(props, ref) { + return _react.default.createElement(Connect, { + wrapperProps: props, + forwardedRef: ref + }); + }); + + forwarded.displayName = displayName; + forwarded.WrappedComponent = WrappedComponent; + return (0, _hoistNonReactStatics.default)(forwarded, WrappedComponent); + } + + return (0, _hoistNonReactStatics.default)(Connect, WrappedComponent); + }; +} +},{"./Context":19,"@babel/runtime/helpers/assertThisInitialized":1,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/inheritsLoose":3,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/interopRequireWildcard":5,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6,"hoist-non-react-statics":7,"invariant":8,"react":undefined,"react-is":18}],22:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.createConnect = createConnect; +exports.default = void 0; + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); + +var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose")); + +var _connectAdvanced = _interopRequireDefault(require("../components/connectAdvanced")); + +var _shallowEqual = _interopRequireDefault(require("../utils/shallowEqual")); + +var _mapDispatchToProps = _interopRequireDefault(require("./mapDispatchToProps")); + +var _mapStateToProps = _interopRequireDefault(require("./mapStateToProps")); + +var _mergeProps = _interopRequireDefault(require("./mergeProps")); + +var _selectorFactory = _interopRequireDefault(require("./selectorFactory")); + +/* + connect is a facade over connectAdvanced. It turns its args into a compatible + selectorFactory, which has the signature: + + (dispatch, options) => (nextState, nextOwnProps) => nextFinalProps + + connect passes its args to connectAdvanced as options, which will in turn pass them to + selectorFactory each time a Connect component instance is instantiated or hot reloaded. + + selectorFactory returns a final props selector from its mapStateToProps, + mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps, + mergePropsFactories, and pure args. + + The resulting final props selector is called by the Connect component instance whenever + it receives new props or store state. + */ +function match(arg, factories, name) { + for (var i = factories.length - 1; i >= 0; i--) { + var result = factories[i](arg); + if (result) return result; + } + + return function (dispatch, options) { + throw new Error("Invalid value of type " + typeof arg + " for " + name + " argument when connecting component " + options.wrappedComponentName + "."); + }; +} + +function strictEqual(a, b) { + return a === b; +} // createConnect with default args builds the 'official' connect behavior. Calling it with +// different options opens up some testing and extensibility scenarios + + +function createConnect(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + _ref$connectHOC = _ref.connectHOC, + connectHOC = _ref$connectHOC === void 0 ? _connectAdvanced.default : _ref$connectHOC, + _ref$mapStateToPropsF = _ref.mapStateToPropsFactories, + mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? _mapStateToProps.default : _ref$mapStateToPropsF, + _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories, + mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? _mapDispatchToProps.default : _ref$mapDispatchToPro, + _ref$mergePropsFactor = _ref.mergePropsFactories, + mergePropsFactories = _ref$mergePropsFactor === void 0 ? _mergeProps.default : _ref$mergePropsFactor, + _ref$selectorFactory = _ref.selectorFactory, + selectorFactory = _ref$selectorFactory === void 0 ? _selectorFactory.default : _ref$selectorFactory; + + return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _ref2) { + if (_ref2 === void 0) { + _ref2 = {}; + } + + var _ref3 = _ref2, + _ref3$pure = _ref3.pure, + pure = _ref3$pure === void 0 ? true : _ref3$pure, + _ref3$areStatesEqual = _ref3.areStatesEqual, + areStatesEqual = _ref3$areStatesEqual === void 0 ? strictEqual : _ref3$areStatesEqual, + _ref3$areOwnPropsEqua = _ref3.areOwnPropsEqual, + areOwnPropsEqual = _ref3$areOwnPropsEqua === void 0 ? _shallowEqual.default : _ref3$areOwnPropsEqua, + _ref3$areStatePropsEq = _ref3.areStatePropsEqual, + areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? _shallowEqual.default : _ref3$areStatePropsEq, + _ref3$areMergedPropsE = _ref3.areMergedPropsEqual, + areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? _shallowEqual.default : _ref3$areMergedPropsE, + extraOptions = (0, _objectWithoutPropertiesLoose2.default)(_ref3, ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"]); + var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps'); + var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps'); + var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps'); + return connectHOC(selectorFactory, (0, _extends2.default)({ + // used in error messages + methodName: 'connect', + // used to compute Connect's displayName from the wrapped component's displayName. + getDisplayName: function getDisplayName(name) { + return "Connect(" + name + ")"; + }, + // if mapStateToProps is falsy, the Connect component doesn't subscribe to store state changes + shouldHandleStateChanges: Boolean(mapStateToProps), + // passed through to selectorFactory + initMapStateToProps: initMapStateToProps, + initMapDispatchToProps: initMapDispatchToProps, + initMergeProps: initMergeProps, + pure: pure, + areStatesEqual: areStatesEqual, + areOwnPropsEqual: areOwnPropsEqual, + areStatePropsEqual: areStatePropsEqual, + areMergedPropsEqual: areMergedPropsEqual + }, extraOptions)); + }; +} + +var _default = createConnect(); + +exports.default = _default; +},{"../components/connectAdvanced":21,"../utils/shallowEqual":31,"./mapDispatchToProps":23,"./mapStateToProps":24,"./mergeProps":25,"./selectorFactory":26,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6}],23:[function(require,module,exports){ +"use strict"; + +exports.__esModule = true; +exports.whenMapDispatchToPropsIsFunction = whenMapDispatchToPropsIsFunction; +exports.whenMapDispatchToPropsIsMissing = whenMapDispatchToPropsIsMissing; +exports.whenMapDispatchToPropsIsObject = whenMapDispatchToPropsIsObject; +exports.default = void 0; + +var _redux = require("redux"); + +var _wrapMapToProps = require("./wrapMapToProps"); + +function whenMapDispatchToPropsIsFunction(mapDispatchToProps) { + return typeof mapDispatchToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapDispatchToProps, 'mapDispatchToProps') : undefined; +} + +function whenMapDispatchToPropsIsMissing(mapDispatchToProps) { + return !mapDispatchToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) { + return { + dispatch: dispatch + }; + }) : undefined; +} + +function whenMapDispatchToPropsIsObject(mapDispatchToProps) { + return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) { + return (0, _redux.bindActionCreators)(mapDispatchToProps, dispatch); + }) : undefined; +} + +var _default = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject]; +exports.default = _default; +},{"./wrapMapToProps":28,"redux":34}],24:[function(require,module,exports){ +"use strict"; + +exports.__esModule = true; +exports.whenMapStateToPropsIsFunction = whenMapStateToPropsIsFunction; +exports.whenMapStateToPropsIsMissing = whenMapStateToPropsIsMissing; +exports.default = void 0; + +var _wrapMapToProps = require("./wrapMapToProps"); + +function whenMapStateToPropsIsFunction(mapStateToProps) { + return typeof mapStateToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapStateToProps, 'mapStateToProps') : undefined; +} + +function whenMapStateToPropsIsMissing(mapStateToProps) { + return !mapStateToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function () { + return {}; + }) : undefined; +} + +var _default = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing]; +exports.default = _default; +},{"./wrapMapToProps":28}],25:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.defaultMergeProps = defaultMergeProps; +exports.wrapMergePropsFunc = wrapMergePropsFunc; +exports.whenMergePropsIsFunction = whenMergePropsIsFunction; +exports.whenMergePropsIsOmitted = whenMergePropsIsOmitted; +exports.default = void 0; + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); + +var _verifyPlainObject = _interopRequireDefault(require("../utils/verifyPlainObject")); + +function defaultMergeProps(stateProps, dispatchProps, ownProps) { + return (0, _extends2.default)({}, ownProps, stateProps, dispatchProps); +} + +function wrapMergePropsFunc(mergeProps) { + return function initMergePropsProxy(dispatch, _ref) { + var displayName = _ref.displayName, + pure = _ref.pure, + areMergedPropsEqual = _ref.areMergedPropsEqual; + var hasRunOnce = false; + var mergedProps; + return function mergePropsProxy(stateProps, dispatchProps, ownProps) { + var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps); + + if (hasRunOnce) { + if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps; + } else { + hasRunOnce = true; + mergedProps = nextMergedProps; + if ("production" !== 'production') (0, _verifyPlainObject.default)(mergedProps, displayName, 'mergeProps'); + } + + return mergedProps; + }; + }; +} + +function whenMergePropsIsFunction(mergeProps) { + return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined; +} + +function whenMergePropsIsOmitted(mergeProps) { + return !mergeProps ? function () { + return defaultMergeProps; + } : undefined; +} + +var _default = [whenMergePropsIsFunction, whenMergePropsIsOmitted]; +exports.default = _default; +},{"../utils/verifyPlainObject":32,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/interopRequireDefault":4}],26:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.impureFinalPropsSelectorFactory = impureFinalPropsSelectorFactory; +exports.pureFinalPropsSelectorFactory = pureFinalPropsSelectorFactory; +exports.default = finalPropsSelectorFactory; + +var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose")); + +var _verifySubselectors = _interopRequireDefault(require("./verifySubselectors")); + +function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) { + return function impureFinalPropsSelector(state, ownProps) { + return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps); + }; +} + +function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) { + var areStatesEqual = _ref.areStatesEqual, + areOwnPropsEqual = _ref.areOwnPropsEqual, + areStatePropsEqual = _ref.areStatePropsEqual; + var hasRunAtLeastOnce = false; + var state; + var ownProps; + var stateProps; + var dispatchProps; + var mergedProps; + + function handleFirstCall(firstState, firstOwnProps) { + state = firstState; + ownProps = firstOwnProps; + stateProps = mapStateToProps(state, ownProps); + dispatchProps = mapDispatchToProps(dispatch, ownProps); + mergedProps = mergeProps(stateProps, dispatchProps, ownProps); + hasRunAtLeastOnce = true; + return mergedProps; + } + + function handleNewPropsAndNewState() { + stateProps = mapStateToProps(state, ownProps); + if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps); + mergedProps = mergeProps(stateProps, dispatchProps, ownProps); + return mergedProps; + } + + function handleNewProps() { + if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps); + if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps); + mergedProps = mergeProps(stateProps, dispatchProps, ownProps); + return mergedProps; + } + + function handleNewState() { + var nextStateProps = mapStateToProps(state, ownProps); + var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps); + stateProps = nextStateProps; + if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps); + return mergedProps; + } + + function handleSubsequentCalls(nextState, nextOwnProps) { + var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps); + var stateChanged = !areStatesEqual(nextState, state); + state = nextState; + ownProps = nextOwnProps; + if (propsChanged && stateChanged) return handleNewPropsAndNewState(); + if (propsChanged) return handleNewProps(); + if (stateChanged) return handleNewState(); + return mergedProps; + } + + return function pureFinalPropsSelector(nextState, nextOwnProps) { + return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps); + }; +} // TODO: Add more comments +// If pure is true, the selector returned by selectorFactory will memoize its results, +// allowing connectAdvanced's shouldComponentUpdate to return false if final +// props have not changed. If false, the selector will always return a new +// object and shouldComponentUpdate will always return true. + + +function finalPropsSelectorFactory(dispatch, _ref2) { + var initMapStateToProps = _ref2.initMapStateToProps, + initMapDispatchToProps = _ref2.initMapDispatchToProps, + initMergeProps = _ref2.initMergeProps, + options = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"]); + var mapStateToProps = initMapStateToProps(dispatch, options); + var mapDispatchToProps = initMapDispatchToProps(dispatch, options); + var mergeProps = initMergeProps(dispatch, options); + + if ("production" !== 'production') { + (0, _verifySubselectors.default)(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName); + } + + var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory; + return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options); +} +},{"./verifySubselectors":27,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6}],27:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = verifySubselectors; + +var _warning = _interopRequireDefault(require("../utils/warning")); + +function verify(selector, methodName, displayName) { + if (!selector) { + throw new Error("Unexpected value for " + methodName + " in " + displayName + "."); + } else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') { + if (!selector.hasOwnProperty('dependsOnOwnProps')) { + (0, _warning.default)("The selector for " + methodName + " of " + displayName + " did not specify a value for dependsOnOwnProps."); + } + } +} + +function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) { + verify(mapStateToProps, 'mapStateToProps', displayName); + verify(mapDispatchToProps, 'mapDispatchToProps', displayName); + verify(mergeProps, 'mergeProps', displayName); +} +},{"../utils/warning":33,"@babel/runtime/helpers/interopRequireDefault":4}],28:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.wrapMapToPropsConstant = wrapMapToPropsConstant; +exports.getDependsOnOwnProps = getDependsOnOwnProps; +exports.wrapMapToPropsFunc = wrapMapToPropsFunc; + +var _verifyPlainObject = _interopRequireDefault(require("../utils/verifyPlainObject")); + +function wrapMapToPropsConstant(getConstant) { + return function initConstantSelector(dispatch, options) { + var constant = getConstant(dispatch, options); + + function constantSelector() { + return constant; + } + + constantSelector.dependsOnOwnProps = false; + return constantSelector; + }; +} // dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args +// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine +// whether mapToProps needs to be invoked when props have changed. +// +// A length of one signals that mapToProps does not depend on props from the parent component. +// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and +// therefore not reporting its length accurately.. + + +function getDependsOnOwnProps(mapToProps) { + return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1; +} // Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction, +// this function wraps mapToProps in a proxy function which does several things: +// +// * Detects whether the mapToProps function being called depends on props, which +// is used by selectorFactory to decide if it should reinvoke on props changes. +// +// * On first call, handles mapToProps if returns another function, and treats that +// new function as the true mapToProps for subsequent calls. +// +// * On first call, verifies the first result is a plain object, in order to warn +// the developer that their mapToProps function is not returning a valid result. +// + + +function wrapMapToPropsFunc(mapToProps, methodName) { + return function initProxySelector(dispatch, _ref) { + var displayName = _ref.displayName; + + var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) { + return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch); + }; // allow detectFactoryAndVerify to get ownProps + + + proxy.dependsOnOwnProps = true; + + proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) { + proxy.mapToProps = mapToProps; + proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps); + var props = proxy(stateOrDispatch, ownProps); + + if (typeof props === 'function') { + proxy.mapToProps = props; + proxy.dependsOnOwnProps = getDependsOnOwnProps(props); + props = proxy(stateOrDispatch, ownProps); + } + + if ("production" !== 'production') (0, _verifyPlainObject.default)(props, displayName, methodName); + return props; + }; + + return proxy; + }; +} +},{"../utils/verifyPlainObject":32,"@babel/runtime/helpers/interopRequireDefault":4}],29:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; + +var _Provider = _interopRequireDefault(require("./components/Provider")); + +exports.Provider = _Provider.default; + +var _connectAdvanced = _interopRequireDefault(require("./components/connectAdvanced")); + +exports.connectAdvanced = _connectAdvanced.default; + +var _Context = require("./components/Context"); + +exports.ReactReduxContext = _Context.ReactReduxContext; + +var _connect = _interopRequireDefault(require("./connect/connect")); + +exports.connect = _connect.default; +},{"./components/Context":19,"./components/Provider":20,"./components/connectAdvanced":21,"./connect/connect":22,"@babel/runtime/helpers/interopRequireDefault":4}],30:[function(require,module,exports){ +"use strict"; + +exports.__esModule = true; +exports.default = isPlainObject; + +/** + * @param {any} obj The object to inspect. + * @returns {boolean} True if the argument appears to be a plain object. + */ +function isPlainObject(obj) { + if (typeof obj !== 'object' || obj === null) return false; + var proto = Object.getPrototypeOf(obj); + if (proto === null) return true; + var baseProto = proto; + + while (Object.getPrototypeOf(baseProto) !== null) { + baseProto = Object.getPrototypeOf(baseProto); + } + + return proto === baseProto; +} +},{}],31:[function(require,module,exports){ +"use strict"; + +exports.__esModule = true; +exports.default = shallowEqual; +var hasOwn = Object.prototype.hasOwnProperty; + +function is(x, y) { + if (x === y) { + return x !== 0 || y !== 0 || 1 / x === 1 / y; + } else { + return x !== x && y !== y; + } +} + +function shallowEqual(objA, objB) { + if (is(objA, objB)) return true; + + if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { + return false; + } + + var keysA = Object.keys(objA); + var keysB = Object.keys(objB); + if (keysA.length !== keysB.length) return false; + + for (var i = 0; i < keysA.length; i++) { + if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { + return false; + } + } + + return true; +} +},{}],32:[function(require,module,exports){ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = verifyPlainObject; + +var _isPlainObject = _interopRequireDefault(require("./isPlainObject")); + +var _warning = _interopRequireDefault(require("./warning")); + +function verifyPlainObject(value, displayName, methodName) { + if (!(0, _isPlainObject.default)(value)) { + (0, _warning.default)(methodName + "() in " + displayName + " must return a plain object. Instead received " + value + "."); + } +} +},{"./isPlainObject":30,"./warning":33,"@babel/runtime/helpers/interopRequireDefault":4}],33:[function(require,module,exports){ +"use strict"; + +exports.__esModule = true; +exports.default = warning; + +/** + * Prints a warning in the console if it exists. + * + * @param {String} message The warning message. + * @returns {void} + */ +function warning(message) { + /* eslint-disable no-console */ + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(message); + } + /* eslint-enable no-console */ + + + try { + // This error was thrown as a convenience so that if you enable + // "break on all exceptions" in your console, + // it would pause the execution at this line. + throw new Error(message); + /* eslint-disable no-empty */ + } catch (e) {} + /* eslint-enable no-empty */ + +} +},{}],34:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var $$observable = _interopDefault(require('symbol-observable')); + +/** + * These are private action types reserved by Redux. + * For any unknown actions, you must return the current state. + * If the current state is undefined, you must return the initial state. + * Do not reference these action types directly in your code. + */ +var randomString = function randomString() { + return Math.random().toString(36).substring(7).split('').join('.'); +}; + +var ActionTypes = { + INIT: "@@redux/INIT" + randomString(), + REPLACE: "@@redux/REPLACE" + randomString(), + PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() { + return "@@redux/PROBE_UNKNOWN_ACTION" + randomString(); + } +}; + +/** + * @param {any} obj The object to inspect. + * @returns {boolean} True if the argument appears to be a plain object. + */ +function isPlainObject(obj) { + if (typeof obj !== 'object' || obj === null) return false; + var proto = obj; + + while (Object.getPrototypeOf(proto) !== null) { + proto = Object.getPrototypeOf(proto); + } + + return Object.getPrototypeOf(obj) === proto; +} + +/** + * Creates a Redux store that holds the state tree. + * The only way to change the data in the store is to call `dispatch()` on it. + * + * There should only be a single store in your app. To specify how different + * parts of the state tree respond to actions, you may combine several reducers + * into a single reducer function by using `combineReducers`. + * + * @param {Function} reducer A function that returns the next state tree, given + * the current state tree and the action to handle. + * + * @param {any} [preloadedState] The initial state. You may optionally specify it + * to hydrate the state from the server in universal apps, or to restore a + * previously serialized user session. + * If you use `combineReducers` to produce the root reducer function, this must be + * an object with the same shape as `combineReducers` keys. + * + * @param {Function} [enhancer] The store enhancer. You may optionally specify it + * to enhance the store with third-party capabilities such as middleware, + * time travel, persistence, etc. The only store enhancer that ships with Redux + * is `applyMiddleware()`. + * + * @returns {Store} A Redux store that lets you read the state, dispatch actions + * and subscribe to changes. + */ + +function createStore(reducer, preloadedState, enhancer) { + var _ref2; + + if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') { + throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function'); + } + + if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { + enhancer = preloadedState; + preloadedState = undefined; + } + + if (typeof enhancer !== 'undefined') { + if (typeof enhancer !== 'function') { + throw new Error('Expected the enhancer to be a function.'); + } + + return enhancer(createStore)(reducer, preloadedState); + } + + if (typeof reducer !== 'function') { + throw new Error('Expected the reducer to be a function.'); + } + + var currentReducer = reducer; + var currentState = preloadedState; + var currentListeners = []; + var nextListeners = currentListeners; + var isDispatching = false; + + function ensureCanMutateNextListeners() { + if (nextListeners === currentListeners) { + nextListeners = currentListeners.slice(); + } + } + /** + * Reads the state tree managed by the store. + * + * @returns {any} The current state tree of your application. + */ + + + function getState() { + if (isDispatching) { + throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.'); + } + + return currentState; + } + /** + * Adds a change listener. It will be called any time an action is dispatched, + * and some part of the state tree may potentially have changed. You may then + * call `getState()` to read the current state tree inside the callback. + * + * You may call `dispatch()` from a change listener, with the following + * caveats: + * + * 1. The subscriptions are snapshotted just before every `dispatch()` call. + * If you subscribe or unsubscribe while the listeners are being invoked, this + * will not have any effect on the `dispatch()` that is currently in progress. + * However, the next `dispatch()` call, whether nested or not, will use a more + * recent snapshot of the subscription list. + * + * 2. The listener should not expect to see all state changes, as the state + * might have been updated multiple times during a nested `dispatch()` before + * the listener is called. It is, however, guaranteed that all subscribers + * registered before the `dispatch()` started will be called with the latest + * state by the time it exits. + * + * @param {Function} listener A callback to be invoked on every dispatch. + * @returns {Function} A function to remove this change listener. + */ + + + function subscribe(listener) { + if (typeof listener !== 'function') { + throw new Error('Expected the listener to be a function.'); + } + + if (isDispatching) { + throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.'); + } + + var isSubscribed = true; + ensureCanMutateNextListeners(); + nextListeners.push(listener); + return function unsubscribe() { + if (!isSubscribed) { + return; + } + + if (isDispatching) { + throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.'); + } + + isSubscribed = false; + ensureCanMutateNextListeners(); + var index = nextListeners.indexOf(listener); + nextListeners.splice(index, 1); + }; + } + /** + * Dispatches an action. It is the only way to trigger a state change. + * + * The `reducer` function, used to create the store, will be called with the + * current state tree and the given `action`. Its return value will + * be considered the **next** state of the tree, and the change listeners + * will be notified. + * + * The base implementation only supports plain object actions. If you want to + * dispatch a Promise, an Observable, a thunk, or something else, you need to + * wrap your store creating function into the corresponding middleware. For + * example, see the documentation for the `redux-thunk` package. Even the + * middleware will eventually dispatch plain object actions using this method. + * + * @param {Object} action A plain object representing “what changed”. It is + * a good idea to keep actions serializable so you can record and replay user + * sessions, or use the time travelling `redux-devtools`. An action must have + * a `type` property which may not be `undefined`. It is a good idea to use + * string constants for action types. + * + * @returns {Object} For convenience, the same action object you dispatched. + * + * Note that, if you use a custom middleware, it may wrap `dispatch()` to + * return something else (for example, a Promise you can await). + */ + + + function dispatch(action) { + if (!isPlainObject(action)) { + throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.'); + } + + if (typeof action.type === 'undefined') { + throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?'); + } + + if (isDispatching) { + throw new Error('Reducers may not dispatch actions.'); + } + + try { + isDispatching = true; + currentState = currentReducer(currentState, action); + } finally { + isDispatching = false; + } + + var listeners = currentListeners = nextListeners; + + for (var i = 0; i < listeners.length; i++) { + var listener = listeners[i]; + listener(); + } + + return action; + } + /** + * Replaces the reducer currently used by the store to calculate the state. + * + * You might need this if your app implements code splitting and you want to + * load some of the reducers dynamically. You might also need this if you + * implement a hot reloading mechanism for Redux. + * + * @param {Function} nextReducer The reducer for the store to use instead. + * @returns {void} + */ + + + function replaceReducer(nextReducer) { + if (typeof nextReducer !== 'function') { + throw new Error('Expected the nextReducer to be a function.'); + } + + currentReducer = nextReducer; + dispatch({ + type: ActionTypes.REPLACE + }); + } + /** + * Interoperability point for observable/reactive libraries. + * @returns {observable} A minimal observable of state changes. + * For more information, see the observable proposal: + * https://github.com/tc39/proposal-observable + */ + + + function observable() { + var _ref; + + var outerSubscribe = subscribe; + return _ref = { + /** + * The minimal observable subscription method. + * @param {Object} observer Any object that can be used as an observer. + * The observer object should have a `next` method. + * @returns {subscription} An object with an `unsubscribe` method that can + * be used to unsubscribe the observable from the store, and prevent further + * emission of values from the observable. + */ + subscribe: function subscribe(observer) { + if (typeof observer !== 'object' || observer === null) { + throw new TypeError('Expected the observer to be an object.'); + } + + function observeState() { + if (observer.next) { + observer.next(getState()); + } + } + + observeState(); + var unsubscribe = outerSubscribe(observeState); + return { + unsubscribe: unsubscribe + }; + } + }, _ref[$$observable] = function () { + return this; + }, _ref; + } // When a store is created, an "INIT" action is dispatched so that every + // reducer returns their initial state. This effectively populates + // the initial state tree. + + + dispatch({ + type: ActionTypes.INIT + }); + return _ref2 = { + dispatch: dispatch, + subscribe: subscribe, + getState: getState, + replaceReducer: replaceReducer + }, _ref2[$$observable] = observable, _ref2; +} + +/** + * Prints a warning in the console if it exists. + * + * @param {String} message The warning message. + * @returns {void} + */ +function warning(message) { + /* eslint-disable no-console */ + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(message); + } + /* eslint-enable no-console */ + + + try { + // This error was thrown as a convenience so that if you enable + // "break on all exceptions" in your console, + // it would pause the execution at this line. + throw new Error(message); + } catch (e) {} // eslint-disable-line no-empty + +} + +function getUndefinedStateErrorMessage(key, action) { + var actionType = action && action.type; + var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action'; + return "Given " + actionDescription + ", reducer \"" + key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined."; +} + +function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) { + var reducerKeys = Object.keys(reducers); + var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer'; + + if (reducerKeys.length === 0) { + return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.'; + } + + if (!isPlainObject(inputState)) { + return "The " + argumentName + " has unexpected type of \"" + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\""); + } + + var unexpectedKeys = Object.keys(inputState).filter(function (key) { + return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]; + }); + unexpectedKeys.forEach(function (key) { + unexpectedKeyCache[key] = true; + }); + if (action && action.type === ActionTypes.REPLACE) return; + + if (unexpectedKeys.length > 0) { + return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored."); + } +} + +function assertReducerShape(reducers) { + Object.keys(reducers).forEach(function (key) { + var reducer = reducers[key]; + var initialState = reducer(undefined, { + type: ActionTypes.INIT + }); + + if (typeof initialState === 'undefined') { + throw new Error("Reducer \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined."); + } + + if (typeof reducer(undefined, { + type: ActionTypes.PROBE_UNKNOWN_ACTION() + }) === 'undefined') { + throw new Error("Reducer \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle " + ActionTypes.INIT + " or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null."); + } + }); +} +/** + * Turns an object whose values are different reducer functions, into a single + * reducer function. It will call every child reducer, and gather their results + * into a single state object, whose keys correspond to the keys of the passed + * reducer functions. + * + * @param {Object} reducers An object whose values correspond to different + * reducer functions that need to be combined into one. One handy way to obtain + * it is to use ES6 `import * as reducers` syntax. The reducers may never return + * undefined for any action. Instead, they should return their initial state + * if the state passed to them was undefined, and the current state for any + * unrecognized action. + * + * @returns {Function} A reducer function that invokes every reducer inside the + * passed object, and builds a state object with the same shape. + */ + + +function combineReducers(reducers) { + var reducerKeys = Object.keys(reducers); + var finalReducers = {}; + + for (var i = 0; i < reducerKeys.length; i++) { + var key = reducerKeys[i]; + + if ("production" !== 'production') { + if (typeof reducers[key] === 'undefined') { + warning("No reducer provided for key \"" + key + "\""); + } + } + + if (typeof reducers[key] === 'function') { + finalReducers[key] = reducers[key]; + } + } + + var finalReducerKeys = Object.keys(finalReducers); + var unexpectedKeyCache; + + if ("production" !== 'production') { + unexpectedKeyCache = {}; + } + + var shapeAssertionError; + + try { + assertReducerShape(finalReducers); + } catch (e) { + shapeAssertionError = e; + } + + return function combination(state, action) { + if (state === void 0) { + state = {}; + } + + if (shapeAssertionError) { + throw shapeAssertionError; + } + + if ("production" !== 'production') { + var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache); + + if (warningMessage) { + warning(warningMessage); + } + } + + var hasChanged = false; + var nextState = {}; + + for (var _i = 0; _i < finalReducerKeys.length; _i++) { + var _key = finalReducerKeys[_i]; + var reducer = finalReducers[_key]; + var previousStateForKey = state[_key]; + var nextStateForKey = reducer(previousStateForKey, action); + + if (typeof nextStateForKey === 'undefined') { + var errorMessage = getUndefinedStateErrorMessage(_key, action); + throw new Error(errorMessage); + } + + nextState[_key] = nextStateForKey; + hasChanged = hasChanged || nextStateForKey !== previousStateForKey; + } + + return hasChanged ? nextState : state; + }; +} + +function bindActionCreator(actionCreator, dispatch) { + return function () { + return dispatch(actionCreator.apply(this, arguments)); + }; +} +/** + * Turns an object whose values are action creators, into an object with the + * same keys, but with every function wrapped into a `dispatch` call so they + * may be invoked directly. This is just a convenience method, as you can call + * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. + * + * For convenience, you can also pass a single function as the first argument, + * and get a function in return. + * + * @param {Function|Object} actionCreators An object whose values are action + * creator functions. One handy way to obtain it is to use ES6 `import * as` + * syntax. You may also pass a single function. + * + * @param {Function} dispatch The `dispatch` function available on your Redux + * store. + * + * @returns {Function|Object} The object mimicking the original object, but with + * every action creator wrapped into the `dispatch` call. If you passed a + * function as `actionCreators`, the return value will also be a single + * function. + */ + + +function bindActionCreators(actionCreators, dispatch) { + if (typeof actionCreators === 'function') { + return bindActionCreator(actionCreators, dispatch); + } + + if (typeof actionCreators !== 'object' || actionCreators === null) { + throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?"); + } + + var keys = Object.keys(actionCreators); + var boundActionCreators = {}; + + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var actionCreator = actionCreators[key]; + + if (typeof actionCreator === 'function') { + boundActionCreators[key] = bindActionCreator(actionCreator, dispatch); + } + } + + return boundActionCreators; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + var ownKeys = Object.keys(source); + + if (typeof Object.getOwnPropertySymbols === 'function') { + ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { + return Object.getOwnPropertyDescriptor(source, sym).enumerable; + })); + } + + ownKeys.forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } + + return target; +} + +/** + * Composes single-argument functions from right to left. The rightmost + * function can take multiple arguments as it provides the signature for + * the resulting composite function. + * + * @param {...Function} funcs The functions to compose. + * @returns {Function} A function obtained by composing the argument functions + * from right to left. For example, compose(f, g, h) is identical to doing + * (...args) => f(g(h(...args))). + */ +function compose() { + for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) { + funcs[_key] = arguments[_key]; + } + + if (funcs.length === 0) { + return function (arg) { + return arg; + }; + } + + if (funcs.length === 1) { + return funcs[0]; + } + + return funcs.reduce(function (a, b) { + return function () { + return a(b.apply(void 0, arguments)); + }; + }); +} + +/** + * Creates a store enhancer that applies middleware to the dispatch method + * of the Redux store. This is handy for a variety of tasks, such as expressing + * asynchronous actions in a concise manner, or logging every action payload. + * + * See `redux-thunk` package as an example of the Redux middleware. + * + * Because middleware is potentially asynchronous, this should be the first + * store enhancer in the composition chain. + * + * Note that each middleware will be given the `dispatch` and `getState` functions + * as named arguments. + * + * @param {...Function} middlewares The middleware chain to be applied. + * @returns {Function} A store enhancer applying the middleware. + */ + +function applyMiddleware() { + for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) { + middlewares[_key] = arguments[_key]; + } + + return function (createStore) { + return function () { + var store = createStore.apply(void 0, arguments); + + var _dispatch = function dispatch() { + throw new Error("Dispatching while constructing your middleware is not allowed. " + "Other middleware would not be applied to this dispatch."); + }; + + var middlewareAPI = { + getState: store.getState, + dispatch: function dispatch() { + return _dispatch.apply(void 0, arguments); + } + }; + var chain = middlewares.map(function (middleware) { + return middleware(middlewareAPI); + }); + _dispatch = compose.apply(void 0, chain)(store.dispatch); + return _objectSpread({}, store, { + dispatch: _dispatch + }); + }; + }; +} + +/* + * This is a dummy function to check if the function name has been altered by minification. + * If the function has been minified and NODE_ENV !== 'production', warn the user. + */ + +function isCrushed() {} + +if ("production" !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') { + warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.'); +} + +exports.createStore = createStore; +exports.combineReducers = combineReducers; +exports.bindActionCreators = bindActionCreators; +exports.applyMiddleware = applyMiddleware; +exports.compose = compose; +exports.__DO_NOT_USE__ActionTypes = ActionTypes; + +},{"symbol-observable":35}],35:[function(require,module,exports){ +(function (global){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _ponyfill = require('./ponyfill.js'); + +var _ponyfill2 = _interopRequireDefault(_ponyfill); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var root; /* global window */ + + +if (typeof self !== 'undefined') { + root = self; +} else if (typeof window !== 'undefined') { + root = window; +} else if (typeof global !== 'undefined') { + root = global; +} else if (typeof module !== 'undefined') { + root = module; +} else { + root = Function('return this')(); +} + +var result = (0, _ponyfill2['default'])(root); +exports['default'] = result; +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./ponyfill.js":36}],36:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports['default'] = symbolObservablePonyfill; +function symbolObservablePonyfill(root) { + var result; + var _Symbol = root.Symbol; + + if (typeof _Symbol === 'function') { + if (_Symbol.observable) { + result = _Symbol.observable; + } else { + result = _Symbol('observable'); + _Symbol.observable = result; + } + } else { + result = '@@observable'; + } + + return result; +}; +},{}],37:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.show = show; +exports.success = success; +exports.error = error; +exports.warning = warning; +exports.info = info; +exports.hide = hide; +exports.removeAll = removeAll; + +var _const = require('./const'); + +//Example opts +// { +// title: 'Hey, it\'s good to see you!', +// message: 'Now you can see how easy it is to use notifications in React!', +// position: 'tr', +// autoDismiss: 0, +// action: { +// label: 'Awesome!', +// callback: function() { +// console.log('Clicked'); +// } +// } +// } + +function show() { + var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'success'; + + return _extends({ + type: _const.RNS_SHOW_NOTIFICATION + }, opts, { + uid: opts.uid || Date.now(), + level: level }); } @@ -1023,7 +3176,9 @@ function removeAll() { return { type: _const.RNS_REMOVE_ALL_NOTIFICATIONS }; } -},{"./const":11}],11:[function(require,module,exports){ +},{"./const":38}],38:[function(require,module,exports){ +'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); @@ -1031,8 +3186,10 @@ var RNS_SHOW_NOTIFICATION = exports.RNS_SHOW_NOTIFICATION = 'RNS_SHOW_NOTIFICATI var RNS_HIDE_NOTIFICATION = exports.RNS_HIDE_NOTIFICATION = 'RNS_HIDE_NOTIFICATION'; var RNS_REMOVE_ALL_NOTIFICATIONS = exports.RNS_REMOVE_ALL_NOTIFICATIONS = 'RNS_REMOVE_ALL_NOTIFICATIONS'; -},{}],12:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ (function (global){ +'use strict'; + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _createClass = 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); @@ -1045,6 +3202,8 @@ var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); +var _reactRedux = require('react-redux'); + var _actions = require('./actions'); var actions = _interopRequireWildcard(_actions); @@ -1072,28 +3231,33 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var Notifications = function (_React$Component) { _inherits(Notifications, _React$Component); - function Notifications() { + function Notifications(props) { _classCallCheck(this, Notifications); - return _possibleConstructorReturn(this, (Notifications.__proto__ || Object.getPrototypeOf(Notifications)).apply(this, arguments)); + var _this = _possibleConstructorReturn(this, (Notifications.__proto__ || Object.getPrototypeOf(Notifications)).call(this, props)); + + _this.notifyRef = _react2['default'].createRef(); + return _this; } _createClass(Notifications, [{ key: 'system', value: function () { function system() { - return this.refs.notify; + return this.notifyRef.current; } return system; }() }, { - key: 'componentWillReceiveProps', + key: 'componentDidUpdate', value: function () { - function componentWillReceiveProps(nextProps) { + function componentDidUpdate(prevProps) { var _this2 = this; - var notifications = nextProps.notifications; + var _props = this.props, + notifications = _props.notifications, + store = _props.store; var notificationIds = notifications.map(function (notification) { return notification.uid; @@ -1113,7 +3277,7 @@ var Notifications = function (_React$Component) { _this2.system().addNotification(_extends({}, notification, { onRemove: function () { function onRemove() { - _this2.context.store.dispatch(actions.hide(notification.uid)); + store.dispatch(actions.hide(notification.uid)); notification.onRemove && notification.onRemove(); } @@ -1123,12 +3287,12 @@ var Notifications = function (_React$Component) { }); } - if (this.props.notifications !== notifications && notifications.length === 0) { + if (prevProps.notifications !== notifications && notifications.length === 0) { this.system().clearNotifications(); } } - return componentWillReceiveProps; + return componentDidUpdate; }() }, { key: 'shouldComponentUpdate', @@ -1143,11 +3307,12 @@ var Notifications = function (_React$Component) { key: 'render', value: function () { function render() { - var _props = this.props, - notifications = _props.notifications, - rest = _objectWithoutProperties(_props, ['notifications']); + var _props2 = this.props, + notifications = _props2.notifications, + store = _props2.store, + rest = _objectWithoutProperties(_props2, ['notifications', 'store']); - return _react2['default'].createElement(_reactNotificationSystem2['default'], _extends({ ref: 'notify' }, rest)); + return _react2['default'].createElement(_reactNotificationSystem2['default'], _extends({ ref: this.notifyRef }, rest)); } return render; @@ -1158,24 +3323,47 @@ var Notifications = function (_React$Component) { }(_react2['default'].Component); Notifications.propTypes = { - notifications: _propTypes2['default'].array + notifications: _propTypes2['default'].array, + store: _propTypes2['default'].shape({ + dispatch: _propTypes2['default'].func.isRequired + }).isRequired +}; + +var NotificationsWithContext = function NotificationsWithContext(props) { + var Context = props.context || _reactRedux.ReactReduxContext; + + if (Context == null) { + throw 'Please upgrade to react-redux v6'; + } + + return _react2['default'].createElement( + Context.Consumer, + null, + function (otherProps) { + var store = otherProps.store; + + return _react2['default'].createElement(Notifications, _extends({ store: store }, props)); + } + ); }; -Notifications.contextTypes = { - store: _propTypes2['default'].object +NotificationsWithContext.propTypes = { + context: _propTypes2['default'].object }; // Tie actions to Notifications component instance Object.keys(actions).forEach(function (key) { - Notifications[key] = actions[key]; + NotificationsWithContext[key] = actions[key]; }); -Notifications.reducer = _reducer2['default']; +NotificationsWithContext.reducer = _reducer2['default']; -module.exports = Notifications; +module.exports = NotificationsWithContext; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./actions":10,"./reducer":13,"prop-types":8,"react-notification-system":undefined}],13:[function(require,module,exports){ +},{"./actions":37,"./reducer":40,"prop-types":14,"react-notification-system":undefined,"react-redux":29}],40:[function(require,module,exports){ +'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); @@ -1210,5 +3398,5 @@ function Notifications() { return state; } -},{"./const":11}]},{},[12])(12) -}); \ No newline at end of file +},{"./const":38}]},{},[39])(39) +}); diff --git a/dist/react-notification-system-redux.min.js b/dist/react-notification-system-redux.min.js deleted file mode 100644 index 46b9f48..0000000 --- a/dist/react-notification-system-redux.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.notifications=e()}}(function(){return function e(n,t,r){function o(u,a){if(!t[u]){if(!n[u]){var f="function"==typeof require&&require;if(!a&&f)return f(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var s=t[u]={exports:{}};n[u][0].call(s.exports,function(e){var t=n[u][1][e];return o(t?t:e)},s,s.exports,e,n,t,r)}return t[u].exports}for(var i="function"==typeof require&&require,u=0;u0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"success";return s({type:l.RNS_SHOW_NOTIFICATION},e,{uid:e.uid||Date.now(),level:n})}function o(e){return r(e,"success")}function i(e){return r(e,"error")}function u(e){return r(e,"warning")}function a(e){return r(e,"info")}function f(e){return{type:l.RNS_HIDE_NOTIFICATION,uid:e}}function c(){return{type:l.RNS_REMOVE_ALL_NOTIFICATIONS}}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var n=1;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}function u(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function a(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}function f(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}var c=Object.assign||function(e){for(var n=1;n0&&(o.forEach(function(e){r.indexOf(e.uid)<0&&n.system().removeNotification(e.uid)}),t.forEach(function(e){n.system().addNotification(c({},e,{onRemove:function(){function t(){n.context.store.dispatch(b.hide(e.uid)),e.onRemove&&e.onRemove()}return t}()}))})),this.props.notifications!==t&&0===t.length&&this.system().clearNotifications()}return e}()},{key:"shouldComponentUpdate",value:function(){function e(e){return this.props!==e}return e}()},{key:"render",value:function(){function e(){var e=this.props,n=(e.notifications,i(e,["notifications"]));return p["default"].createElement(g["default"],c({ref:"notify"},n))}return e}()}]),n}(p["default"].Component);j.propTypes={notifications:d["default"].array},j.contextTypes={store:d["default"].object},Object.keys(b).forEach(function(e){j[e]=b[e]}),j.reducer=O["default"],n.exports=j}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./actions":10,"./reducer":13,"prop-types":8,"react-notification-system":void 0}],13:[function(e,n,t){function r(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n=0||Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(n.type){case a.RNS_SHOW_NOTIFICATION:var t=(n.type,o(n,["type"]));return[].concat(r(e),[u({},t,{uid:n.uid})]);case a.RNS_HIDE_NOTIFICATION:return e.filter(function(e){return e.uid!==n.uid});case a.RNS_REMOVE_ALL_NOTIFICATIONS:return[]}return e}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var n=1;n { - this.context.store.dispatch(fn(notificationOpts)); + fn(notificationOpts); }, timeout); } handleClick() { + const { success, error, warning, info, removeAll } = this.props; this.dispatchNotification(success, 250); this.dispatchNotification(error, 500); this.dispatchNotification(warning, 750); @@ -40,30 +40,34 @@ class Container extends React.Component { } handleRemoveAll() { - this.context.store.dispatch(removeAll()); + this.props.removeAll(); } - render() { + render() { const {notifications} = this.props; - return ( -
+ return ( +
- ); - } + ); + } } -Container.contextTypes = { - store: PropTypes.object -}; - Container.propTypes = { - notifications: PropTypes.array + error: PropTypes.func.isRequired, + info: PropTypes.func.isRequired, + notifications: PropTypes.array, + removeAll: PropTypes.func.isRequired, + success: PropTypes.func.isRequired, + warning: PropTypes.func.isRequired }; export default connect( - state => ({ notifications: state.notifications }) + state => ({ notifications: state.notifications }), + { + success, error, warning, info, removeAll + } )(Container); diff --git a/lib/actions.js b/lib/actions.js index 18e897f..a1ebfcb 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -1,3 +1,5 @@ +'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/const.js b/lib/const.js index 51ad7b5..eda5d66 100644 --- a/lib/const.js +++ b/lib/const.js @@ -1,3 +1,5 @@ +'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/notifications.js b/lib/notifications.js index 3b58f11..2d75e9a 100644 --- a/lib/notifications.js +++ b/lib/notifications.js @@ -1,3 +1,5 @@ +'use strict'; + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _createClass = 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); @@ -10,6 +12,8 @@ var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); +var _reactRedux = require('react-redux'); + var _actions = require('./actions'); var actions = _interopRequireWildcard(_actions); @@ -37,28 +41,33 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var Notifications = function (_React$Component) { _inherits(Notifications, _React$Component); - function Notifications() { + function Notifications(props) { _classCallCheck(this, Notifications); - return _possibleConstructorReturn(this, (Notifications.__proto__ || Object.getPrototypeOf(Notifications)).apply(this, arguments)); + var _this = _possibleConstructorReturn(this, (Notifications.__proto__ || Object.getPrototypeOf(Notifications)).call(this, props)); + + _this.notifyRef = _react2['default'].createRef(); + return _this; } _createClass(Notifications, [{ key: 'system', value: function () { function system() { - return this.refs.notify; + return this.notifyRef.current; } return system; }() }, { - key: 'componentWillReceiveProps', + key: 'componentDidUpdate', value: function () { - function componentWillReceiveProps(nextProps) { + function componentDidUpdate(prevProps) { var _this2 = this; - var notifications = nextProps.notifications; + var _props = this.props, + notifications = _props.notifications, + store = _props.store; var notificationIds = notifications.map(function (notification) { return notification.uid; @@ -78,7 +87,7 @@ var Notifications = function (_React$Component) { _this2.system().addNotification(_extends({}, notification, { onRemove: function () { function onRemove() { - _this2.context.store.dispatch(actions.hide(notification.uid)); + store.dispatch(actions.hide(notification.uid)); notification.onRemove && notification.onRemove(); } @@ -88,12 +97,12 @@ var Notifications = function (_React$Component) { }); } - if (this.props.notifications !== notifications && notifications.length === 0) { + if (prevProps.notifications !== notifications && notifications.length === 0) { this.system().clearNotifications(); } } - return componentWillReceiveProps; + return componentDidUpdate; }() }, { key: 'shouldComponentUpdate', @@ -108,11 +117,12 @@ var Notifications = function (_React$Component) { key: 'render', value: function () { function render() { - var _props = this.props, - notifications = _props.notifications, - rest = _objectWithoutProperties(_props, ['notifications']); + var _props2 = this.props, + notifications = _props2.notifications, + store = _props2.store, + rest = _objectWithoutProperties(_props2, ['notifications', 'store']); - return _react2['default'].createElement(_reactNotificationSystem2['default'], _extends({ ref: 'notify' }, rest)); + return _react2['default'].createElement(_reactNotificationSystem2['default'], _extends({ ref: this.notifyRef }, rest)); } return render; @@ -123,18 +133,39 @@ var Notifications = function (_React$Component) { }(_react2['default'].Component); Notifications.propTypes = { - notifications: _propTypes2['default'].array + notifications: _propTypes2['default'].array, + store: _propTypes2['default'].shape({ + dispatch: _propTypes2['default'].func.isRequired + }).isRequired +}; + +var NotificationsWithContext = function NotificationsWithContext(props) { + var Context = props.context || _reactRedux.ReactReduxContext; + + if (Context == null) { + throw 'Please upgrade to react-redux v6'; + } + + return _react2['default'].createElement( + Context.Consumer, + null, + function (otherProps) { + var store = otherProps.store; + + return _react2['default'].createElement(Notifications, _extends({ store: store }, props)); + } + ); }; -Notifications.contextTypes = { - store: _propTypes2['default'].object +NotificationsWithContext.propTypes = { + context: _propTypes2['default'].object }; // Tie actions to Notifications component instance Object.keys(actions).forEach(function (key) { - Notifications[key] = actions[key]; + NotificationsWithContext[key] = actions[key]; }); -Notifications.reducer = _reducer2['default']; +NotificationsWithContext.reducer = _reducer2['default']; -module.exports = Notifications; \ No newline at end of file +module.exports = NotificationsWithContext; \ No newline at end of file diff --git a/lib/reducer.js b/lib/reducer.js index 448b6f1..e40366f 100644 --- a/lib/reducer.js +++ b/lib/reducer.js @@ -1,3 +1,5 @@ +'use strict'; + Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/package.json b/package.json index a7fdd85..8c58161 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "babelify": "^7.3.0", "brfs": "^1.4.3", "chai": "^3.5.0", + "cross-env": "^5.2.0", "enzyme": "^3.1.0", "enzyme-adapter-react-16": "^1.0.2", "eslint": "^1.6.0", @@ -35,12 +36,13 @@ "jsdom": "^9.8.3", "lodash": "^4.14.2", "mocha": "^3.2.0", - "react": "^0.14 || ^15.0.0-rc || ^15.0 || ^16.0", + "react": "^16.7.0", "react-component-gulp-tasks": "git+https://github.com/gor181/react-component-gulp-tasks.git", - "react-dom": "^0.14 || ^15.0.0-rc || ^15.0 || ^16.0", + "react-dom": "^16.7.0", "react-notification-system": "^0.2.7", - "react-redux": "^4.4.5", - "redux": "^3.5.2", + "react-redux": "^6.0.0", + "redux": "^4.0.1", + "redux-mock-store": "^1.5.3", "sinon": "^1.17.6" }, "dependencies": { @@ -48,18 +50,20 @@ "react-notification-system": "^0.2.x" }, "peerDependencies": { - "react": "^0.14 || ^15.0.0-rc || ^15.0 || ^16.0", - "react-dom": "^0.14 || ^15.0.0-rc || ^15.0 || ^16.0" + "react": "^16.4.0-0", + "react-dom": "^16.4.0-0", + "react-redux": "^6.0.0", + "redux": "^3.6.0 || ^4.0.0" }, "browserify-shim": { "react": "global:React" }, "scripts": { - "build": "gulp clean && NODE_ENV=production gulp build", + "build": "gulp clean && cross-env NODE_ENV=production gulp build", "examples": "gulp dev:server", "lint": "eslint ./; true", - "publish:site": "NODE_ENV=production gulp publish:examples", - "release": "NODE_ENV=production gulp release", + "publish:site": "cross-env NODE_ENV=production gulp publish:examples", + "release": "cross-env NODE_ENV=production gulp release", "start": "gulp dev", "test": "mocha test/__tests__/**/*", "test-dev": "mocha test/__tests__/**/* --watch", diff --git a/src/notifications.js b/src/notifications.js index 066654a..174bf85 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { ReactReduxContext } from 'react-redux'; import * as actions from './actions'; import reducer from './reducer'; @@ -8,12 +9,18 @@ import NotifySystem from 'react-notification-system'; class Notifications extends React.Component { + constructor (props) { + super(props); + + this.notifyRef = React.createRef(); + } + system() { - return this.refs.notify; + return this.notifyRef.current; } - componentWillReceiveProps(nextProps) { - const {notifications} = nextProps; + componentDidUpdate(prevProps) { + const {notifications, store} = this.props; const notificationIds = notifications.map(notification => notification.uid); const systemNotifications = this.system().state.notifications || []; @@ -30,14 +37,14 @@ class Notifications extends React.Component { this.system().addNotification({ ...notification, onRemove: () => { - this.context.store.dispatch(actions.hide(notification.uid)); + store.dispatch(actions.hide(notification.uid)); notification.onRemove && notification.onRemove(); } }); }); } - if ((this.props.notifications !== notifications) && notifications.length === 0) { + if ((prevProps.notifications !== notifications) && notifications.length === 0) { this.system().clearNotifications(); } } @@ -47,27 +54,47 @@ class Notifications extends React.Component { } render() { - const {notifications, ...rest} = this.props; + const {notifications, store, ...rest} = this.props; return ( - + ); } } Notifications.propTypes = { - notifications: PropTypes.array + notifications: PropTypes.array, + store: PropTypes.shape({ + dispatch: PropTypes.func.isRequired + }).isRequired +}; + +const NotificationsWithContext = props => { + const Context = props.context || ReactReduxContext; + + if (Context == null) { + throw 'Please upgrade to react-redux v6'; + } + + return ( + + {(otherProps) => { + const { store } = otherProps; + return ; + }} + + ); }; -Notifications.contextTypes = { - store: PropTypes.object +NotificationsWithContext.propTypes = { + context: PropTypes.object, }; // Tie actions to Notifications component instance Object.keys(actions).forEach(key => { - Notifications[key] = actions[key]; + NotificationsWithContext[key] = actions[key]; }); -Notifications.reducer = reducer; +NotificationsWithContext.reducer = reducer; -module.exports = Notifications; +module.exports = NotificationsWithContext; diff --git a/test/__tests__/notifications.js b/test/__tests__/notifications.js index 0632a9e..ad6d20d 100644 --- a/test/__tests__/notifications.js +++ b/test/__tests__/notifications.js @@ -1,4 +1,5 @@ import React from 'react'; +import configureStore from 'redux-mock-store'; import { mount } from 'enzyme'; import { expect } from 'chai'; import { jsdom } from 'jsdom'; @@ -9,7 +10,8 @@ import NotifySystem from 'react-notification-system'; const createDOM = () => jsdom('
'); describe('NotificationsComponent', () => { - let DOM; + let DOM; + let store; const notification = { title: 'Hey, it\'s good to see you!', @@ -18,10 +20,20 @@ describe('NotificationsComponent', () => { level: 'info', uid: 'demo-uid', autoDismiss: 5, - }; + }; + + beforeEach(() => { + const mockStore = configureStore(); + store = mockStore({ + notifications: [] + }); + + DOM = createDOM(); + }); const mountComponent = props => mount( , { @@ -33,10 +45,6 @@ describe('NotificationsComponent', () => { } } ); - - beforeEach(() => { - DOM = createDOM(); - }); it('exports all actions', () => { expect(show).to.be.a('function'); @@ -73,7 +81,8 @@ describe('NotificationsComponent', () => { wrapper.setProps({ notifications: [notification] - }); + }); + wrapper.update(); expect(wrapper.html()).to.have.string(notification.title); expect(wrapper.html()).to.have.string(notification.message); @@ -91,7 +100,8 @@ describe('NotificationsComponent', () => { { ...notification, uid: 2, title: '5th' }, { ...notification, uid: 3, title: '6th' } ] - }); + }); + wrapper.update(); const html = wrapper.html(); @@ -114,7 +124,8 @@ describe('NotificationsComponent', () => { autoDismiss: 1, onRemove }] - }); + }); + wrapper.update(); setTimeout(() => { expect(onRemove.called).to.be.true; @@ -137,8 +148,9 @@ describe('NotificationsComponent', () => { }, onRemove }] - }); - + }); + wrapper.update(); + wrapper.find('button').simulate('click'); setTimeout(() => { @@ -158,7 +170,8 @@ describe('NotificationsComponent', () => { autoDismiss: 1, onRemove }] - }); + }); + wrapper.update(); setTimeout(() => { expect(onRemove.called).to.be.true; @@ -182,8 +195,9 @@ describe('NotificationsComponent', () => { onRemove }] }); + wrapper.update(); - wrapper.find('button').simulate('click'); + wrapper.find('button').simulate('click'); setTimeout(() => { expect(onCallback.called).to.be.true; From 0265516cb0d7d22a1a96e27c22b6dccb96ec1879 Mon Sep 17 00:00:00 2001 From: Goran Date: Thu, 31 Jan 2019 13:18:34 +0100 Subject: [PATCH 03/10] 2.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8c58161..0aa8adb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-notification-system-redux", - "version": "1.1.6", + "version": "2.0.0", "description": "react-notification-system-redux", "main": "lib/notifications.js", "author": "Goran Udosic", From 2abc237f1bc604ba30db4dba8af1a844ab6b6c6e Mon Sep 17 00:00:00 2001 From: Goran Udosic Date: Thu, 31 Jan 2019 13:20:06 +0100 Subject: [PATCH 04/10] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1231256..7a12863 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ Wraps [react-notification-system](https://github.com/igorprado/react-notificatio Open for PR's and contributions! +Use versions below v2.0.0 for react versions lower than 16. + ## Demo & Examples Live demo: [gor181.github.io/react-notification-system-redux](http://gor181.github.io/react-notification-system-redux/) From 9decbb8d9efcbb2e87395df5c2087918ad049bce Mon Sep 17 00:00:00 2001 From: Goran Date: Thu, 31 Jan 2019 13:29:42 +0100 Subject: [PATCH 05/10] Lint --- test/__tests__/notifications.js | 318 +++++++++++++++++--------------- 1 file changed, 170 insertions(+), 148 deletions(-) diff --git a/test/__tests__/notifications.js b/test/__tests__/notifications.js index ad6d20d..4fcaf81 100644 --- a/test/__tests__/notifications.js +++ b/test/__tests__/notifications.js @@ -4,48 +4,60 @@ import { mount } from 'enzyme'; import { expect } from 'chai'; import { jsdom } from 'jsdom'; import sinon from 'sinon'; -import Component, { show, success, error, warning, info, hide, removeAll, reducer } from '../../src/notifications'; +import Component, { + show, + success, + error, + warning, + info, + hide, + removeAll, + reducer +} from '../../src/notifications'; import NotifySystem from 'react-notification-system'; -const createDOM = () => jsdom('
'); +const createDOM = () => + jsdom('
'); describe('NotificationsComponent', () => { let DOM; let store; - const notification = { - title: 'Hey, it\'s good to see you!', - message: 'Now you can see how easy it is to use notifications in React!', - dismissible: false, - level: 'info', - uid: 'demo-uid', - autoDismiss: 5, + const notification = { + title: "Hey, it's good to see you!", + message: 'Now you can see how easy it is to use notifications in React!', + dismissible: false, + level: 'info', + uid: 'demo-uid', + autoDismiss: 5 }; - + beforeEach(() => { const mockStore = configureStore(); store = mockStore({ - notifications: [] - }); + notifications: [] + }); - DOM = createDOM(); + DOM = createDOM(); }); - const mountComponent = props => mount( - , { - attachTo: DOM.body.firstChild, - context: { - store: { - dispatch: () => {} - } - } - } - ); - + const mountComponent = props => + mount( + , + { + attachTo: DOM.body.firstChild, + context: { + store: { + dispatch: () => {} + } + } + } + ); + it('exports all actions', () => { expect(show).to.be.a('function'); expect(success).to.be.a('function'); @@ -60,149 +72,159 @@ describe('NotificationsComponent', () => { expect(reducer).to.be.a('function'); }); - it('should render one component', () => { - const wrapper = mountComponent(); - expect(wrapper.find(NotifySystem).length).to.equal(1); - }); + it('should render one component', () => { + const wrapper = mountComponent(); + expect(wrapper.find(NotifySystem).length).to.equal(1); + }); - it('should warn if prop:notifications is not array', () => { - const c = sinon.stub(console, 'error'); + it('should warn if prop:notifications is not array', () => { + const c = sinon.stub(console, 'error'); - const wrapper = mountComponent({ notifications: 1 }); - const warning = c.args[0][0]; + const wrapper = mountComponent({ notifications: 1 }); + const warning = c.args[0][0]; - c.restore(); + c.restore(); - expect(warning).to.match(/Invalid prop `notifications` of type `number` supplied to `Notifications`, expected `array`./); - }); + expect(warning).to.match( + /Invalid prop `notifications` of type `number` supplied to `Notifications`, expected `array`./ + ); + }); - it('should render a single notification', () => { - const wrapper = mountComponent(); + it('should render a single notification', () => { + const wrapper = mountComponent(); - wrapper.setProps({ - notifications: [notification] + wrapper.setProps({ + notifications: [notification] }); wrapper.update(); - expect(wrapper.html()).to.have.string(notification.title); - expect(wrapper.html()).to.have.string(notification.message); - }); - - it('should not add notification if it already exists based on the uid', () => { - const wrapper = mountComponent(); - - wrapper.setProps({ - notifications: [ - { ...notification, uid: 1, title: '1st' }, - { ...notification, uid: 2, title: '2nd' }, - { ...notification, uid: 3, title: '3rd' }, - { ...notification, uid: 1, title: '4th' }, - { ...notification, uid: 2, title: '5th' }, - { ...notification, uid: 3, title: '6th' } - ] + expect(wrapper.html()).to.have.string(notification.title); + expect(wrapper.html()).to.have.string(notification.message); + }); + + it('should not add notification if it already exists based on the uid', () => { + const wrapper = mountComponent(); + + wrapper.setProps({ + notifications: [ + { ...notification, uid: 1, title: '1st' }, + { ...notification, uid: 2, title: '2nd' }, + { ...notification, uid: 3, title: '3rd' }, + { ...notification, uid: 1, title: '4th' }, + { ...notification, uid: 2, title: '5th' }, + { ...notification, uid: 3, title: '6th' } + ] }); wrapper.update(); - const html = wrapper.html(); - - expect(html).to.have.string('1st'); - expect(html).to.have.string('2nd'); - expect(html).to.have.string('3rd'); + const html = wrapper.html(); - expect(html).not.to.have.string('4th'); - expect(html).not.to.have.string('5th'); - expect(html).not.to.have.string('6th'); - }); + expect(html).to.have.string('1st'); + expect(html).to.have.string('2nd'); + expect(html).to.have.string('3rd'); - it('calls onRemove once the notification is auto dismissed', (done) => { - const wrapper = mountComponent(); - const onRemove = sinon.spy(); + expect(html).not.to.have.string('4th'); + expect(html).not.to.have.string('5th'); + expect(html).not.to.have.string('6th'); + }); - wrapper.setProps({ - notifications: [{ - ...notification, - autoDismiss: 1, - onRemove - }] + it('calls onRemove once the notification is auto dismissed', done => { + const wrapper = mountComponent(); + const onRemove = sinon.spy(); + + wrapper.setProps({ + notifications: [ + { + ...notification, + autoDismiss: 1, + onRemove + } + ] }); wrapper.update(); - setTimeout(() => { - expect(onRemove.called).to.be.true; - done(); - }, 1100); - }); - - it('calls onRemove once the notification is manually dismissed', (done) => { - const wrapper = mountComponent(); - const onRemove = sinon.spy(); - const onCallback = sinon.spy(); - - wrapper.setProps({ - notifications: [{ - ...notification, - autoDismiss: 0, - action: { - label: 'Dismiss', - callback: onCallback - }, - onRemove - }] - }); + setTimeout(() => { + expect(onRemove.called).to.be.true; + done(); + }, 1100); + }); + + it('calls onRemove once the notification is manually dismissed', done => { + const wrapper = mountComponent(); + const onRemove = sinon.spy(); + const onCallback = sinon.spy(); + + wrapper.setProps({ + notifications: [ + { + ...notification, + autoDismiss: 0, + action: { + label: 'Dismiss', + callback: onCallback + }, + onRemove + } + ] + }); wrapper.update(); - - wrapper.find('button').simulate('click'); - - setTimeout(() => { - expect(onCallback.called).to.be.true; - expect(onRemove.called).to.be.true; - done(); - }, 50); - }); - - it('calls onRemove once the notification is auto dismissed while style is false', (done) => { - const wrapper = mountComponent({ style: false }); - const onRemove = sinon.spy(); - - wrapper.setProps({ - notifications: [{ - ...notification, - autoDismiss: 1, - onRemove - }] + + wrapper.find('button').simulate('click'); + + setTimeout(() => { + expect(onCallback.called).to.be.true; + expect(onRemove.called).to.be.true; + done(); + }, 50); + }); + + it('calls onRemove once the notification is auto dismissed while style is false', done => { + const wrapper = mountComponent({ style: false }); + const onRemove = sinon.spy(); + + wrapper.setProps({ + notifications: [ + { + ...notification, + autoDismiss: 1, + onRemove + } + ] }); wrapper.update(); - setTimeout(() => { - expect(onRemove.called).to.be.true; - done(); - }, 1100); - }); - - it('calls onRemove once the notification is manually dismissed while style is false', (done) => { - const wrapper = mountComponent({ style: false }); - const onRemove = sinon.spy(); - const onCallback = sinon.spy(); - - wrapper.setProps({ - notifications: [{ - ...notification, - autoDismiss: 0, - action: { - label: 'Dismiss', - callback: onCallback - }, - onRemove - }] - }); + setTimeout(() => { + expect(onRemove.called).to.be.true; + done(); + }, 1100); + }); + + it('calls onRemove once the notification is manually dismissed while style is false', done => { + const wrapper = mountComponent({ style: false }); + const onRemove = sinon.spy(); + const onCallback = sinon.spy(); + + wrapper.setProps({ + notifications: [ + { + ...notification, + autoDismiss: 0, + action: { + label: 'Dismiss', + callback: onCallback + }, + onRemove + } + ] + }); wrapper.update(); - wrapper.find('button').simulate('click'); + wrapper.find('button').simulate('click'); - setTimeout(() => { - expect(onCallback.called).to.be.true; - expect(onRemove.called).to.be.true; - done(); - }, 50); - }); + setTimeout(() => { + expect(onCallback.called).to.be.true; + expect(onRemove.called).to.be.true; + done(); + }, 50); + }); }); From 87e620b7a9adf7cb52495ea800cb25dd9116ed64 Mon Sep 17 00:00:00 2001 From: Saibamen Date: Fri, 27 Mar 2020 13:26:57 +0100 Subject: [PATCH 06/10] Update package.json (#75) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0aa8adb..5014072 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "peerDependencies": { "react": "^16.4.0-0", "react-dom": "^16.4.0-0", - "react-redux": "^6.0.0", + "react-redux": "^6.0.0 || ^7.0.0", "redux": "^3.6.0 || ^4.0.0" }, "browserify-shim": { From a2764522336398f42615b0a7c43eef523e9c1125 Mon Sep 17 00:00:00 2001 From: Goran Udosic Date: Fri, 27 Mar 2020 14:26:27 +0100 Subject: [PATCH 07/10] Compile --- dist/react-notification-system-redux.js | 607 ++++++++++++++---------- 1 file changed, 352 insertions(+), 255 deletions(-) diff --git a/dist/react-notification-system-redux.js b/dist/react-notification-system-redux.js index 5d6db05..4f80e97 100644 --- a/dist/react-notification-system-redux.js +++ b/dist/react-notification-system-redux.js @@ -39,39 +39,68 @@ module.exports = _inheritsLoose; },{}],4:[function(require,module,exports){ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { - default: obj + "default": obj }; } module.exports = _interopRequireDefault; },{}],5:[function(require,module,exports){ +var _typeof = require("../helpers/typeof"); + +function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + + _getRequireWildcardCache = function _getRequireWildcardCache() { + return cache; + }; + + return cache; +} + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; - } else { - var newObj = {}; + } - if (obj != null) { - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { + return { + "default": obj + }; + } - if (desc.get || desc.set) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } + var cache = _getRequireWildcardCache(); + + if (cache && cache.has(obj)) { + return cache.get(obj); + } + + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + + for (var key in obj) { + if (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; - return newObj; + newObj["default"] = obj; + + if (cache) { + cache.set(obj, newObj); } + + return newObj; } module.exports = _interopRequireWildcard; -},{}],6:[function(require,module,exports){ +},{"../helpers/typeof":7}],6:[function(require,module,exports){ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; @@ -89,47 +118,82 @@ function _objectWithoutPropertiesLoose(source, excluded) { module.exports = _objectWithoutPropertiesLoose; },{}],7:[function(require,module,exports){ +function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + module.exports = _typeof = function _typeof(obj) { + return typeof obj; + }; + } else { + module.exports = _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); +} + +module.exports = _typeof; +},{}],8:[function(require,module,exports){ 'use strict'; +var reactIs = require('react-is'); + /** * Copyright 2015, Yahoo! Inc. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. */ -var ReactIs = require('react-is'); var REACT_STATICS = { - childContextTypes: true, - contextType: true, - contextTypes: true, - defaultProps: true, - displayName: true, - getDefaultProps: true, - getDerivedStateFromError: true, - getDerivedStateFromProps: true, - mixins: true, - propTypes: true, - type: true + childContextTypes: true, + contextType: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + getDerivedStateFromError: true, + getDerivedStateFromProps: true, + mixins: true, + propTypes: true, + type: true }; - var KNOWN_STATICS = { - name: true, - length: true, - prototype: true, - caller: true, - callee: true, - arguments: true, - arity: true + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true }; - var FORWARD_REF_STATICS = { - '$$typeof': true, - render: true, - defaultProps: true, - displayName: true, - propTypes: true + '$$typeof': true, + render: true, + defaultProps: true, + displayName: true, + propTypes: true +}; +var MEMO_STATICS = { + '$$typeof': true, + compare: true, + defaultProps: true, + displayName: true, + propTypes: true, + type: true }; - var TYPE_STATICS = {}; -TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS; +TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; +TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; + +function getStatics(component) { + // React v16.11 and below + if (reactIs.isMemo(component)) { + return MEMO_STATICS; + } // React v16.12 and above + + + return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; +} var defineProperty = Object.defineProperty; var getOwnPropertyNames = Object.getOwnPropertyNames; @@ -137,47 +201,46 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var getPrototypeOf = Object.getPrototypeOf; var objectPrototype = Object.prototype; - function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { - if (typeof sourceComponent !== 'string') { - // don't hoist over string (html) components + if (typeof sourceComponent !== 'string') { + // don't hoist over string (html) components + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); - if (objectPrototype) { - var inheritedComponent = getPrototypeOf(sourceComponent); - if (inheritedComponent && inheritedComponent !== objectPrototype) { - hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); - } - } + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } - var keys = getOwnPropertyNames(sourceComponent); + var keys = getOwnPropertyNames(sourceComponent); - if (getOwnPropertySymbols) { - keys = keys.concat(getOwnPropertySymbols(sourceComponent)); - } + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } - var targetStatics = TYPE_STATICS[targetComponent['$$typeof']] || REACT_STATICS; - var sourceStatics = TYPE_STATICS[sourceComponent['$$typeof']] || REACT_STATICS; - - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { - var descriptor = getOwnPropertyDescriptor(sourceComponent, key); - try { - // Avoid failures from read-only properties - defineProperty(targetComponent, key, descriptor); - } catch (e) {} - } - } + var targetStatics = getStatics(targetComponent); + var sourceStatics = getStatics(sourceComponent); + + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; - return targetComponent; + if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { + var descriptor = getOwnPropertyDescriptor(sourceComponent, key); + + try { + // Avoid failures from read-only properties + defineProperty(targetComponent, key, descriptor); + } catch (e) {} + } } + } - return targetComponent; + return targetComponent; } module.exports = hoistNonReactStatics; -},{"react-is":18}],8:[function(require,module,exports){ +},{"react-is":19}],9:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -228,7 +291,7 @@ var invariant = function(condition, format, a, b, c, d, e, f) { module.exports = invariant; -},{}],9:[function(require,module,exports){ +},{}],10:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @@ -320,7 +383,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],10:[function(require,module,exports){ +},{}],11:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -506,7 +569,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],11:[function(require,module,exports){ +},{}],12:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -521,6 +584,7 @@ var printWarning = function() {}; if ("production" !== 'production') { var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); var loggedTypeFailures = {}; + var has = Function.call.bind(Object.prototype.hasOwnProperty); printWarning = function(text) { var message = 'Warning: ' + text; @@ -550,7 +614,7 @@ if ("production" !== 'production') { function checkPropTypes(typeSpecs, values, location, componentName, getStack) { if ("production" !== 'production') { for (var typeSpecName in typeSpecs) { - if (typeSpecs.hasOwnProperty(typeSpecName)) { + if (has(typeSpecs, typeSpecName)) { var error; // Prop type validation may throw. In case they do, we don't want to // fail the render phase where it didn't fail before. So we log it. @@ -578,8 +642,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).' - ) - + ); } if (error instanceof Error && !(error.message in loggedTypeFailures)) { // Only monitor this failure once because there tends to be a lot of the @@ -597,9 +660,20 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { } } +/** + * Resets warning cache when testing. + * + * @private + */ +checkPropTypes.resetWarningCache = function() { + if ("production" !== 'production') { + loggedTypeFailures = {}; + } +} + module.exports = checkPropTypes; -},{"./lib/ReactPropTypesSecret":15}],12:[function(require,module,exports){ +},{"./lib/ReactPropTypesSecret":16}],13:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -612,6 +686,8 @@ module.exports = checkPropTypes; var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); function emptyFunction() {} +function emptyFunctionWithReset() {} +emptyFunctionWithReset.resetWarningCache = emptyFunction; module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { @@ -645,22 +721,25 @@ module.exports = function() { any: shim, arrayOf: getShim, element: shim, + elementType: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim, - exact: getShim + exact: getShim, + + checkPropTypes: emptyFunctionWithReset, + resetWarningCache: emptyFunction }; - ReactPropTypes.checkPropTypes = emptyFunction; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; -},{"./lib/ReactPropTypesSecret":15}],13:[function(require,module,exports){ +},{"./lib/ReactPropTypesSecret":16}],14:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -670,11 +749,13 @@ module.exports = function() { 'use strict'; +var ReactIs = require('react-is'); var assign = require('object-assign'); var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); var checkPropTypes = require('./checkPropTypes'); +var has = Function.call.bind(Object.prototype.hasOwnProperty); var printWarning = function() {}; if ("production" !== 'production') { @@ -785,6 +866,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { any: createAnyTypeChecker(), arrayOf: createArrayOfTypeChecker, element: createElementTypeChecker(), + elementType: createElementTypeTypeChecker(), instanceOf: createInstanceTypeChecker, node: createNodeChecker(), objectOf: createObjectOfTypeChecker, @@ -938,6 +1020,18 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return createChainableTypeChecker(validate); } + function createElementTypeTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!ReactIs.isValidElementType(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + function createInstanceTypeChecker(expectedClass) { function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { @@ -952,7 +1046,16 @@ module.exports = function(isValidElement, throwOnDirectAccess) { function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { - "production" !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0; + if ("production" !== 'production') { + if (arguments.length > 1) { + printWarning( + 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' + ); + } else { + printWarning('Invalid argument supplied to oneOf, expected an array.'); + } + } return emptyFunctionThatReturnsNull; } @@ -964,8 +1067,14 @@ module.exports = function(isValidElement, throwOnDirectAccess) { } } - var valuesString = JSON.stringify(expectedValues); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { + var type = getPreciseType(value); + if (type === 'symbol') { + return String(value); + } + return value; + }); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); } return createChainableTypeChecker(validate); } @@ -981,7 +1090,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); } for (var key in propValue) { - if (propValue.hasOwnProperty(key)) { + if (has(propValue, key)) { var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error instanceof Error) { return error; @@ -1138,6 +1247,11 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return true; } + // falsy value can't be a Symbol + if (!propValue) { + return false; + } + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' if (propValue['@@toStringTag'] === 'Symbol') { return true; @@ -1212,12 +1326,13 @@ module.exports = function(isValidElement, throwOnDirectAccess) { } ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; -},{"./checkPropTypes":11,"./lib/ReactPropTypesSecret":15,"object-assign":9}],14:[function(require,module,exports){ +},{"./checkPropTypes":12,"./lib/ReactPropTypesSecret":16,"object-assign":10,"react-is":19}],15:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -1226,28 +1341,19 @@ module.exports = function(isValidElement, throwOnDirectAccess) { */ if ("production" !== 'production') { - var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && - Symbol.for && - Symbol.for('react.element')) || - 0xeac7; - - var isValidElement = function(object) { - return typeof object === 'object' && - object !== null && - object.$$typeof === REACT_ELEMENT_TYPE; - }; + var ReactIs = require('react-is'); // By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true; - module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess); + module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess); } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = require('./factoryWithThrowingShims')(); } -},{"./factoryWithThrowingShims":12,"./factoryWithTypeCheckers":13}],15:[function(require,module,exports){ +},{"./factoryWithThrowingShims":13,"./factoryWithTypeCheckers":14,"react-is":19}],16:[function(require,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * @@ -1261,9 +1367,9 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; -},{}],16:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ (function (process){ -/** @license React v16.7.0 +/** @license React v16.13.1 * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -1280,88 +1386,39 @@ if (process.env.NODE_ENV !== "production") { (function() { 'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); - // 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; +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 || 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); + 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); } -/** - * Forked from fbjs/warning: - * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js - * - * Only change is we use console.warn instead of console.error, - * and do nothing when 'console' is not supported. - * This really simplifies the code. - * --- - * Similar to invariant but only logs a warning if the condition is not met. - * This can be used to log issues in development environments in critical - * paths. Removing the logging code for production environments will keep the - * same logic and follow the same code paths. - */ - -var lowPriorityWarning = function () {}; - -{ - var printWarning = function (format) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - if (typeof console !== 'undefined') { - console.warn(message); - } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; - - lowPriorityWarning = function (condition, format) { - if (format === undefined) { - throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument'); - } - if (!condition) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; - } - - printWarning.apply(undefined, [format].concat(args)); - } - }; -} - -var lowPriorityWarning$1 = lowPriorityWarning; - function typeOf(object) { if (typeof object === 'object' && object !== null) { var $$typeof = object.$$typeof; + switch ($$typeof) { case REACT_ELEMENT_TYPE: var type = object.type; @@ -1374,29 +1431,32 @@ function typeOf(object) { 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_LAZY_TYPE: - case REACT_MEMO_TYPE: + case REACT_PORTAL_TYPE: return $$typeof; } } return undefined; -} +} // AsyncMode is deprecated along with isAsyncMode -// AsyncMode is deprecated along with isAsyncMode var AsyncMode = REACT_ASYNC_MODE_TYPE; var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; var ContextConsumer = REACT_CONTEXT_TYPE; @@ -1410,17 +1470,17 @@ 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 -var hasWarnedAboutDeprecatedIsAsyncMode = false; - -// AsyncMode should be deprecated function isAsyncMode(object) { { if (!hasWarnedAboutDeprecatedIsAsyncMode) { - hasWarnedAboutDeprecatedIsAsyncMode = true; - lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); + 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) { @@ -1460,7 +1520,6 @@ function isSuspense(object) { return typeOf(object) === REACT_SUSPENSE_TYPE; } -exports.typeOf = typeOf; exports.AsyncMode = AsyncMode; exports.ConcurrentMode = ConcurrentMode; exports.ContextConsumer = ContextConsumer; @@ -1474,7 +1533,6 @@ exports.Portal = Portal; exports.Profiler = Profiler; exports.StrictMode = StrictMode; exports.Suspense = Suspense; -exports.isValidElementType = isValidElementType; exports.isAsyncMode = isAsyncMode; exports.isConcurrentMode = isConcurrentMode; exports.isContextConsumer = isContextConsumer; @@ -1488,12 +1546,14 @@ exports.isPortal = isPortal; exports.isProfiler = isProfiler; exports.isStrictMode = isStrictMode; exports.isSuspense = isSuspense; +exports.isValidElementType = isValidElementType; +exports.typeOf = typeOf; })(); } }).call(this,require('_process')) -},{"_process":10}],17:[function(require,module,exports){ -/** @license React v16.7.0 +},{"_process":11}],18:[function(require,module,exports){ +/** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -1502,14 +1562,14 @@ exports.isSuspense = isSuspense; * LICENSE file in the root directory of this source tree. */ -'use strict';Object.defineProperty(exports,"__esModule",{value:!0}); -var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"): -60115,r=b?Symbol.for("react.lazy"):60116;function t(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return u}}case r:case q:case d:return u}}}function v(a){return t(a)===m}exports.typeOf=t;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n; -exports.Fragment=e;exports.Lazy=r;exports.Memo=q;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n)};exports.isAsyncMode=function(a){return v(a)||t(a)===l};exports.isConcurrentMode=v;exports.isContextConsumer=function(a){return t(a)===k}; -exports.isContextProvider=function(a){return t(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return t(a)===n};exports.isFragment=function(a){return t(a)===e};exports.isLazy=function(a){return t(a)===r};exports.isMemo=function(a){return t(a)===q};exports.isPortal=function(a){return t(a)===d};exports.isProfiler=function(a){return t(a)===g};exports.isStrictMode=function(a){return t(a)===f}; -exports.isSuspense=function(a){return t(a)===p}; +'use strict';var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b? +Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; +function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d; +exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; +exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p}; +exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; -},{}],18:[function(require,module,exports){ +},{}],19:[function(require,module,exports){ (function (process){ 'use strict'; @@ -1520,7 +1580,7 @@ if (process.env.NODE_ENV === 'production') { } }).call(this,require('_process')) -},{"./cjs/react-is.development.js":16,"./cjs/react-is.production.min.js":17,"_process":10}],19:[function(require,module,exports){ +},{"./cjs/react-is.development.js":17,"./cjs/react-is.production.min.js":18,"_process":11}],20:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -1535,7 +1595,7 @@ var ReactReduxContext = _react.default.createContext(null); exports.ReactReduxContext = ReactReduxContext; var _default = ReactReduxContext; exports.default = _default; -},{"@babel/runtime/helpers/interopRequireDefault":4,"react":undefined}],20:[function(require,module,exports){ +},{"@babel/runtime/helpers/interopRequireDefault":4,"react":undefined}],21:[function(require,module,exports){ "use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); @@ -1642,7 +1702,7 @@ Provider.propTypes = { }; var _default = Provider; exports.default = _default; -},{"./Context":19,"@babel/runtime/helpers/inheritsLoose":3,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/interopRequireWildcard":5,"prop-types":14,"react":undefined}],21:[function(require,module,exports){ +},{"./Context":20,"@babel/runtime/helpers/inheritsLoose":3,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/interopRequireWildcard":5,"prop-types":15,"react":undefined}],22:[function(require,module,exports){ "use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); @@ -1652,10 +1712,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau exports.__esModule = true; exports.default = connectAdvanced; -var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose")); - var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); +var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose")); + var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose")); @@ -1670,6 +1730,14 @@ var _reactIs = require("react-is"); var _Context = require("./Context"); +var stringifyComponent = function stringifyComponent(Comp) { + try { + return JSON.stringify(Comp); + } catch (err) { + return String(Comp); + } +}; + function connectAdvanced( /* selectorFactory is a func that is responsible for returning the selector function used to @@ -1713,12 +1781,12 @@ _ref) { connectOptions = (0, _objectWithoutPropertiesLoose2.default)(_ref2, ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef", "forwardRef", "context"]); (0, _invariant.default)(renderCountProp === undefined, "renderCountProp is removed. render counting is built into the latest React dev tools profiling extension"); (0, _invariant.default)(!withRef, 'withRef is removed. To access the wrapped instance, use a ref on the connected component'); - var customStoreWarningMessage = 'To use a custom Redux store for specific components, create a custom React context with ' + "React.createContext(), and pass the context object to React-Redux's Provider and specific components" + ' like: . ' + 'You may also pass a {context : MyContext} option to connect'; + var customStoreWarningMessage = 'To use a custom Redux store for specific components, create a custom React context with ' + "React.createContext(), and pass the context object to React Redux's Provider and specific components" + ' like: . ' + 'You may also pass a {context : MyContext} option to connect'; (0, _invariant.default)(storeKey === 'store', 'storeKey has been removed and does not do anything. ' + customStoreWarningMessage); var Context = context; return function wrapWithConnect(WrappedComponent) { if ("production" !== 'production') { - (0, _invariant.default)((0, _reactIs.isValidElementType)(WrappedComponent), "You must pass a component to the function returned by " + (methodName + ". Instead received " + JSON.stringify(WrappedComponent))); + (0, _invariant.default)((0, _reactIs.isValidElementType)(WrappedComponent), "You must pass a component to the function returned by " + (methodName + ". Instead received " + stringifyComponent(WrappedComponent))); } var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component'; @@ -1735,7 +1803,6 @@ _ref) { }); var pure = connectOptions.pure; var OuterBaseComponent = _react.Component; - var FinalWrappedComponent = WrappedComponent; if (pure) { OuterBaseComponent = _react.PureComponent; @@ -1746,37 +1813,35 @@ _ref) { var lastState; var lastDerivedProps; var lastStore; + var lastSelectorFactoryOptions; var sourceSelector; - return function selectDerivedProps(state, props, store) { + return function selectDerivedProps(state, props, store, selectorFactoryOptions) { if (pure && lastProps === props && lastState === state) { return lastDerivedProps; } - if (store !== lastStore) { + if (store !== lastStore || lastSelectorFactoryOptions !== selectorFactoryOptions) { lastStore = store; + lastSelectorFactoryOptions = selectorFactoryOptions; sourceSelector = selectorFactory(store.dispatch, selectorFactoryOptions); } lastProps = props; lastState = state; var nextProps = sourceSelector(state, props); - - if (lastDerivedProps === nextProps) { - return lastDerivedProps; - } - lastDerivedProps = nextProps; return lastDerivedProps; }; } function makeChildElementSelector() { - var lastChildProps, lastForwardRef, lastChildElement; - return function selectChildElement(childProps, forwardRef) { - if (childProps !== lastChildProps || forwardRef !== lastForwardRef) { + var lastChildProps, lastForwardRef, lastChildElement, lastComponent; + return function selectChildElement(WrappedComponent, childProps, forwardRef) { + if (childProps !== lastChildProps || forwardRef !== lastForwardRef || lastComponent !== WrappedComponent) { lastChildProps = childProps; lastForwardRef = forwardRef; - lastChildElement = _react.default.createElement(FinalWrappedComponent, (0, _extends2.default)({}, childProps, { + lastComponent = WrappedComponent; + lastChildElement = _react.default.createElement(WrappedComponent, (0, _extends2.default)({}, childProps, { ref: forwardRef })); } @@ -1797,12 +1862,17 @@ _ref) { (0, _invariant.default)(forwardRef ? !props.wrapperProps[storeKey] : !props[storeKey], 'Passing redux store in props has been removed and does not do anything. ' + customStoreWarningMessage); _this.selectDerivedProps = makeDerivedPropsSelector(); _this.selectChildElement = makeChildElementSelector(); - _this.renderWrappedComponent = _this.renderWrappedComponent.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this))); + _this.indirectRenderWrappedComponent = _this.indirectRenderWrappedComponent.bind((0, _assertThisInitialized2.default)(_this)); return _this; } var _proto = Connect.prototype; + _proto.indirectRenderWrappedComponent = function indirectRenderWrappedComponent(value) { + // calling renderWrappedComponent on prototype from indirectRenderWrappedComponent bound to `this` + return this.renderWrappedComponent(value); + }; + _proto.renderWrappedComponent = function renderWrappedComponent(value) { (0, _invariant.default)(value, "Could not find \"store\" in the context of " + ("\"" + displayName + "\". Either wrap the root component in a , ") + "or pass a custom React context provider to and the corresponding " + ("React context consumer to " + displayName + " in connect options.")); var storeState = value.storeState, @@ -1815,13 +1885,13 @@ _ref) { forwardedRef = this.props.forwardedRef; } - var derivedProps = this.selectDerivedProps(storeState, wrapperProps, store); - return this.selectChildElement(derivedProps, forwardedRef); + var derivedProps = this.selectDerivedProps(storeState, wrapperProps, store, selectorFactoryOptions); + return this.selectChildElement(WrappedComponent, derivedProps, forwardedRef); }; _proto.render = function render() { - var ContextToUse = this.props.context || Context; - return _react.default.createElement(ContextToUse.Consumer, null, this.renderWrappedComponent); + var ContextToUse = this.props.context && this.props.context.Consumer && (0, _reactIs.isContextConsumer)(_react.default.createElement(this.props.context.Consumer, null)) ? this.props.context : Context; + return _react.default.createElement(ContextToUse.Consumer, null, this.indirectRenderWrappedComponent); }; return Connect; @@ -1846,7 +1916,7 @@ _ref) { return (0, _hoistNonReactStatics.default)(Connect, WrappedComponent); }; } -},{"./Context":19,"@babel/runtime/helpers/assertThisInitialized":1,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/inheritsLoose":3,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/interopRequireWildcard":5,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6,"hoist-non-react-statics":7,"invariant":8,"react":undefined,"react-is":18}],22:[function(require,module,exports){ +},{"./Context":20,"@babel/runtime/helpers/assertThisInitialized":1,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/inheritsLoose":3,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/interopRequireWildcard":5,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6,"hoist-non-react-statics":8,"invariant":9,"react":undefined,"react-is":19}],23:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -1962,7 +2032,7 @@ function createConnect(_temp) { var _default = createConnect(); exports.default = _default; -},{"../components/connectAdvanced":21,"../utils/shallowEqual":31,"./mapDispatchToProps":23,"./mapStateToProps":24,"./mergeProps":25,"./selectorFactory":26,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6}],23:[function(require,module,exports){ +},{"../components/connectAdvanced":22,"../utils/shallowEqual":32,"./mapDispatchToProps":24,"./mapStateToProps":25,"./mergeProps":26,"./selectorFactory":27,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6}],24:[function(require,module,exports){ "use strict"; exports.__esModule = true; @@ -1995,7 +2065,7 @@ function whenMapDispatchToPropsIsObject(mapDispatchToProps) { var _default = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject]; exports.default = _default; -},{"./wrapMapToProps":28,"redux":34}],24:[function(require,module,exports){ +},{"./wrapMapToProps":29,"redux":35}],25:[function(require,module,exports){ "use strict"; exports.__esModule = true; @@ -2017,7 +2087,7 @@ function whenMapStateToPropsIsMissing(mapStateToProps) { var _default = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing]; exports.default = _default; -},{"./wrapMapToProps":28}],25:[function(require,module,exports){ +},{"./wrapMapToProps":29}],26:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2072,7 +2142,7 @@ function whenMergePropsIsOmitted(mergeProps) { var _default = [whenMergePropsIsFunction, whenMergePropsIsOmitted]; exports.default = _default; -},{"../utils/verifyPlainObject":32,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/interopRequireDefault":4}],26:[function(require,module,exports){ +},{"../utils/verifyPlainObject":33,"@babel/runtime/helpers/extends":2,"@babel/runtime/helpers/interopRequireDefault":4}],27:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2172,7 +2242,7 @@ function finalPropsSelectorFactory(dispatch, _ref2) { var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory; return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options); } -},{"./verifySubselectors":27,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6}],27:[function(require,module,exports){ +},{"./verifySubselectors":28,"@babel/runtime/helpers/interopRequireDefault":4,"@babel/runtime/helpers/objectWithoutPropertiesLoose":6}],28:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2197,7 +2267,7 @@ function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, dis verify(mapDispatchToProps, 'mapDispatchToProps', displayName); verify(mergeProps, 'mergeProps', displayName); } -},{"../utils/warning":33,"@babel/runtime/helpers/interopRequireDefault":4}],28:[function(require,module,exports){ +},{"../utils/warning":34,"@babel/runtime/helpers/interopRequireDefault":4}],29:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2274,7 +2344,7 @@ function wrapMapToPropsFunc(mapToProps, methodName) { return proxy; }; } -},{"../utils/verifyPlainObject":32,"@babel/runtime/helpers/interopRequireDefault":4}],29:[function(require,module,exports){ +},{"../utils/verifyPlainObject":33,"@babel/runtime/helpers/interopRequireDefault":4}],30:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2296,15 +2366,15 @@ exports.ReactReduxContext = _Context.ReactReduxContext; var _connect = _interopRequireDefault(require("./connect/connect")); exports.connect = _connect.default; -},{"./components/Context":19,"./components/Provider":20,"./components/connectAdvanced":21,"./connect/connect":22,"@babel/runtime/helpers/interopRequireDefault":4}],30:[function(require,module,exports){ +},{"./components/Context":20,"./components/Provider":21,"./components/connectAdvanced":22,"./connect/connect":23,"@babel/runtime/helpers/interopRequireDefault":4}],31:[function(require,module,exports){ "use strict"; exports.__esModule = true; exports.default = isPlainObject; -/** - * @param {any} obj The object to inspect. - * @returns {boolean} True if the argument appears to be a plain object. +/** + * @param {any} obj The object to inspect. + * @returns {boolean} True if the argument appears to be a plain object. */ function isPlainObject(obj) { if (typeof obj !== 'object' || obj === null) return false; @@ -2318,7 +2388,7 @@ function isPlainObject(obj) { return proto === baseProto; } -},{}],31:[function(require,module,exports){ +},{}],32:[function(require,module,exports){ "use strict"; exports.__esModule = true; @@ -2352,7 +2422,7 @@ function shallowEqual(objA, objB) { return true; } -},{}],32:[function(require,module,exports){ +},{}],33:[function(require,module,exports){ "use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); @@ -2369,7 +2439,7 @@ function verifyPlainObject(value, displayName, methodName) { (0, _warning.default)(methodName + "() in " + displayName + " must return a plain object. Instead received " + value + "."); } } -},{"./isPlainObject":30,"./warning":33,"@babel/runtime/helpers/interopRequireDefault":4}],33:[function(require,module,exports){ +},{"./isPlainObject":31,"./warning":34,"@babel/runtime/helpers/interopRequireDefault":4}],34:[function(require,module,exports){ "use strict"; exports.__esModule = true; @@ -2399,7 +2469,7 @@ function warning(message) { /* eslint-enable no-empty */ } -},{}],34:[function(require,module,exports){ +},{}],35:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); @@ -2471,7 +2541,7 @@ function createStore(reducer, preloadedState, enhancer) { var _ref2; if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') { - throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function'); + throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.'); } if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { @@ -2496,6 +2566,13 @@ function createStore(reducer, preloadedState, enhancer) { var currentListeners = []; var nextListeners = currentListeners; var isDispatching = false; + /** + * This makes a shallow copy of currentListeners so we can use + * nextListeners as a temporary list while dispatching. + * + * This prevents any bugs around consumers calling + * subscribe/unsubscribe in the middle of a dispatch. + */ function ensureCanMutateNextListeners() { if (nextListeners === currentListeners) { @@ -2547,7 +2624,7 @@ function createStore(reducer, preloadedState, enhancer) { } if (isDispatching) { - throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.'); + throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.'); } var isSubscribed = true; @@ -2559,13 +2636,14 @@ function createStore(reducer, preloadedState, enhancer) { } if (isDispatching) { - throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.'); + throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.'); } isSubscribed = false; ensureCanMutateNextListeners(); var index = nextListeners.indexOf(listener); nextListeners.splice(index, 1); + currentListeners = null; }; } /** @@ -2641,7 +2719,11 @@ function createStore(reducer, preloadedState, enhancer) { throw new Error('Expected the nextReducer to be a function.'); } - currentReducer = nextReducer; + currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT. + // Any reducers that existed in both the new and old rootReducer + // will receive the previous state. This effectively populates + // the new state tree with any relevant data from the old one. + dispatch({ type: ActionTypes.REPLACE }); @@ -2811,7 +2893,9 @@ function combineReducers(reducers) { } } - var finalReducerKeys = Object.keys(finalReducers); + var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same + // keys multiple times. + var unexpectedKeyCache; if ("production" !== 'production') { @@ -2861,6 +2945,7 @@ function combineReducers(reducers) { hasChanged = hasChanged || nextStateForKey !== previousStateForKey; } + hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length; return hasChanged ? nextState : state; }; } @@ -2876,8 +2961,8 @@ function bindActionCreator(actionCreator, dispatch) { * may be invoked directly. This is just a convenience method, as you can call * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. * - * For convenience, you can also pass a single function as the first argument, - * and get a function in return. + * For convenience, you can also pass an action creator as the first argument, + * and get a dispatch wrapped function in return. * * @param {Function|Object} actionCreators An object whose values are action * creator functions. One handy way to obtain it is to use ES6 `import * as` @@ -2902,11 +2987,9 @@ function bindActionCreators(actionCreators, dispatch) { throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?"); } - var keys = Object.keys(actionCreators); var boundActionCreators = {}; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; + for (var key in actionCreators) { var actionCreator = actionCreators[key]; if (typeof actionCreator === 'function') { @@ -2932,20 +3015,34 @@ function _defineProperty(obj, key, value) { return obj; } -function _objectSpread(target) { +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + keys.push.apply(keys, Object.getOwnPropertySymbols(object)); + } + + if (enumerableOnly) keys = keys.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + return keys; +} + +function _objectSpread2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); + if (i % 2) { + ownKeys(source, true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(source).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); } - - ownKeys.forEach(function (key) { - _defineProperty(target, key, source[key]); - }); } return target; @@ -3010,7 +3107,7 @@ function applyMiddleware() { var store = createStore.apply(void 0, arguments); var _dispatch = function dispatch() { - throw new Error("Dispatching while constructing your middleware is not allowed. " + "Other middleware would not be applied to this dispatch."); + throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.'); }; var middlewareAPI = { @@ -3023,7 +3120,7 @@ function applyMiddleware() { return middleware(middlewareAPI); }); _dispatch = compose.apply(void 0, chain)(store.dispatch); - return _objectSpread({}, store, { + return _objectSpread2({}, store, { dispatch: _dispatch }); }; @@ -3041,14 +3138,14 @@ if ("production" !== 'production' && typeof isCrushed.name === 'string' && isCru warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.'); } -exports.createStore = createStore; -exports.combineReducers = combineReducers; -exports.bindActionCreators = bindActionCreators; +exports.__DO_NOT_USE__ActionTypes = ActionTypes; exports.applyMiddleware = applyMiddleware; +exports.bindActionCreators = bindActionCreators; +exports.combineReducers = combineReducers; exports.compose = compose; -exports.__DO_NOT_USE__ActionTypes = ActionTypes; +exports.createStore = createStore; -},{"symbol-observable":35}],35:[function(require,module,exports){ +},{"symbol-observable":36}],36:[function(require,module,exports){ (function (global){ 'use strict'; @@ -3080,7 +3177,7 @@ if (typeof self !== 'undefined') { var result = (0, _ponyfill2['default'])(root); exports['default'] = result; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./ponyfill.js":36}],36:[function(require,module,exports){ +},{"./ponyfill.js":37}],37:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3104,7 +3201,7 @@ function symbolObservablePonyfill(root) { return result; }; -},{}],37:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3176,7 +3273,7 @@ function removeAll() { return { type: _const.RNS_REMOVE_ALL_NOTIFICATIONS }; } -},{"./const":38}],38:[function(require,module,exports){ +},{"./const":39}],39:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3186,7 +3283,7 @@ var RNS_SHOW_NOTIFICATION = exports.RNS_SHOW_NOTIFICATION = 'RNS_SHOW_NOTIFICATI var RNS_HIDE_NOTIFICATION = exports.RNS_HIDE_NOTIFICATION = 'RNS_HIDE_NOTIFICATION'; var RNS_REMOVE_ALL_NOTIFICATIONS = exports.RNS_REMOVE_ALL_NOTIFICATIONS = 'RNS_REMOVE_ALL_NOTIFICATIONS'; -},{}],39:[function(require,module,exports){ +},{}],40:[function(require,module,exports){ (function (global){ 'use strict'; @@ -3361,7 +3458,7 @@ NotificationsWithContext.reducer = _reducer2['default']; module.exports = NotificationsWithContext; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./actions":37,"./reducer":40,"prop-types":14,"react-notification-system":undefined,"react-redux":29}],40:[function(require,module,exports){ +},{"./actions":38,"./reducer":41,"prop-types":15,"react-notification-system":undefined,"react-redux":30}],41:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -3398,5 +3495,5 @@ function Notifications() { return state; } -},{"./const":38}]},{},[39])(39) +},{"./const":39}]},{},[40])(40) }); From 0087fb40b9ad784209785fc1874cc50a08e2eec7 Mon Sep 17 00:00:00 2001 From: Goran Udosic Date: Fri, 27 Mar 2020 14:26:34 +0100 Subject: [PATCH 08/10] 2.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5014072..0493003 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-notification-system-redux", - "version": "2.0.0", + "version": "2.0.1", "description": "react-notification-system-redux", "main": "lib/notifications.js", "author": "Goran Udosic", From 425a57ac845e54ecabb66401ca7b0d5a3ddf1450 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2020 14:37:34 +0100 Subject: [PATCH 09/10] Bump eslint from 1.10.3 to 6.6.0 (#78) Bumps [eslint](https://github.com/eslint/eslint) from 1.10.3 to 6.6.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v1.10.3...v6.6.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0493003..60ff61e 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "cross-env": "^5.2.0", "enzyme": "^3.1.0", "enzyme-adapter-react-16": "^1.0.2", - "eslint": "^1.6.0", + "eslint": "^6.6.0", "eslint-plugin-react": "^3.5.1", "gulp": "^3.9.0", "jest-cli": "^14.1.0", From 8663e73efd68a51b8fa0e2966a18051f6a13b735 Mon Sep 17 00:00:00 2001 From: Osku <77615959+Oskku@users.noreply.github.com> Date: Thu, 1 Jun 2023 20:56:16 +0300 Subject: [PATCH 10/10] Make react-notification-system-redux work with 17 (#83) * Update package.json * Update package.json * Update package.json * Update package.json * Update package.json * Update package.json * Update package.json * Update package.json * Update package.json * Update package.json * Update package.json * Update package.json * Update package.json * Update package.json Make it work with react 17 or 18 --------- Co-authored-by: Osku <77615959+Osamah-learn@users.noreply.github.com> --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 60ff61e..9dcb3db 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "react": "^16.7.0", "react-component-gulp-tasks": "git+https://github.com/gor181/react-component-gulp-tasks.git", "react-dom": "^16.7.0", - "react-notification-system": "^0.2.7", "react-redux": "^6.0.0", "redux": "^4.0.1", "redux-mock-store": "^1.5.3", @@ -50,8 +49,8 @@ "react-notification-system": "^0.2.x" }, "peerDependencies": { - "react": "^16.4.0-0", - "react-dom": "^16.4.0-0", + "react": ">=16.4.0-0 || 17.0.2", + "react-dom": ">=16.4.0-0 || 17.0.2", "react-redux": "^6.0.0 || ^7.0.0", "redux": "^3.6.0 || ^4.0.0" },