From 522f2bbb10f727026237d0f18c23a15e1035b95d Mon Sep 17 00:00:00 2001 From: Andrey Makar-Uvarov Date: Wed, 28 Jun 2017 17:59:34 +0300 Subject: [PATCH 1/5] added prop defaultNotification. this prop object use variables for all notifications --- src/notifications.js | 8 +++++++- test/__tests__/notifications.js | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/notifications.js b/src/notifications.js index 066654a..bfd5af7 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -13,7 +13,7 @@ class Notifications extends React.Component { } componentWillReceiveProps(nextProps) { - const {notifications} = nextProps; + const {notifications, defaultNotification} = nextProps; const notificationIds = notifications.map(notification => notification.uid); const systemNotifications = this.system().state.notifications || []; @@ -27,6 +27,11 @@ class Notifications extends React.Component { }); notifications.forEach(notification => { + if(defaultNotification) { + // assign defaultNotification for notification + notification = Object.assign(defaultNotification, notification); + } + this.system().addNotification({ ...notification, onRemove: () => { @@ -56,6 +61,7 @@ class Notifications extends React.Component { } Notifications.propTypes = { + defaultNotification: PropTypes.object, notifications: PropTypes.array }; diff --git a/test/__tests__/notifications.js b/test/__tests__/notifications.js index 853c24d..53d07b9 100644 --- a/test/__tests__/notifications.js +++ b/test/__tests__/notifications.js @@ -54,6 +54,31 @@ describe('NotificationsComponent', () => { expect(warning).to.match(/Invalid prop `notifications` of type `number` supplied to `Notifications`, expected `array`./); }); + it('should assign defaultNotification for notifications', (done) => { + const wrapper = mountComponent({ + defaultNotification: { autoDismiss: 1 } + }); + const onRemove = sinon.spy(); + const shortNotification = { + title: 'test', + message: 'test message', + level: 'info', + onRemove + }; + + wrapper.setProps({ + notifications: [shortNotification] + }); + + expect(wrapper.html()).to.have.string(shortNotification.title); + expect(wrapper.html()).to.have.string(shortNotification.message); + + setTimeout(() => { + expect(onRemove.called).to.be.true; + done(); + }, 1100); + }); + it('should render a single notification', () => { const wrapper = mountComponent(); From 83d7163e1212e8bb061a5c8ea2cc25ba45f639c1 Mon Sep 17 00:00:00 2001 From: Andrey Makar-Uvarov Date: Wed, 28 Jun 2017 18:32:46 +0300 Subject: [PATCH 2/5] rebuild and migrate to new version library --- dist/react-notification-system-redux.js | 603 ++++++++------------ dist/react-notification-system-redux.min.js | 2 +- lib/notifications.js | 9 +- package.json | 4 +- 4 files changed, 240 insertions(+), 378 deletions(-) diff --git a/dist/react-notification-system-redux.js b/dist/react-notification-system-redux.js index ce106a6..302700a 100644 --- a/dist/react-notification-system-redux.js +++ b/dist/react-notification-system-redux.js @@ -1,5 +1,166 @@ (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 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){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -11,7 +172,7 @@ 'use strict'; -if (process.env.NODE_ENV !== 'production') { +if ("production" !== 'production') { var invariant = require('fbjs/lib/invariant'); var warning = require('fbjs/lib/warning'); var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); @@ -30,7 +191,7 @@ if (process.env.NODE_ENV !== 'production') { * @private */ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { - if (process.env.NODE_ENV !== 'production') { + if ("production" !== 'production') { for (var typeSpecName in typeSpecs) { if (typeSpecs.hasOwnProperty(typeSpecName)) { var error; @@ -62,8 +223,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { module.exports = checkPropTypes; -}).call(this,require('_process')) -},{"./lib/ReactPropTypesSecret":5,"_process":9,"fbjs/lib/invariant":7,"fbjs/lib/warning":8}],2:[function(require,module,exports){ +},{"./lib/ReactPropTypesSecret":8,"fbjs/lib/invariant":2,"fbjs/lib/warning":3}],5:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -77,11 +237,14 @@ module.exports = checkPropTypes; var emptyFunction = require('fbjs/lib/emptyFunction'); var invariant = require('fbjs/lib/invariant'); +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); module.exports = function() { - // Important! - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. - function shim() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } invariant( false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + @@ -93,6 +256,8 @@ module.exports = function() { function getShim() { return shim; }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bool: shim, @@ -119,8 +284,7 @@ module.exports = function() { return ReactPropTypes; }; -},{"fbjs/lib/emptyFunction":6,"fbjs/lib/invariant":7}],3:[function(require,module,exports){ -(function (process){ +},{"./lib/ReactPropTypesSecret":8,"fbjs/lib/emptyFunction":1,"fbjs/lib/invariant":2}],6:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -269,7 +433,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { PropTypeError.prototype = Error.prototype; function createChainableTypeChecker(validate) { - if (process.env.NODE_ENV !== 'production') { + if ("production" !== 'production') { var manualPropTypeCallCache = {}; var manualPropTypeWarningCount = 0; } @@ -286,7 +450,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); - } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { + } else if ("production" !== 'production' && typeof console !== 'undefined') { // Old behavior for people using React.PropTypes var cacheKey = componentName + ':' + propName; if ( @@ -396,7 +560,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { - process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; + "production" !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } @@ -439,10 +603,24 @@ module.exports = function(isValidElement, throwOnDirectAccess) { function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { - process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + "production" !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + warning( + false, + 'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' + + 'received %s at index %s.', + getPostfixForTypeWarning(checker), + i + ); + return emptyFunction.thatReturnsNull; + } + } + function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; @@ -575,6 +753,9 @@ module.exports = function(isValidElement, throwOnDirectAccess) { // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { @@ -586,6 +767,23 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return propType; } + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + // Returns class name of the object, if any. function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { @@ -600,9 +798,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return ReactPropTypes; }; -}).call(this,require('_process')) -},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"_process":9,"fbjs/lib/emptyFunction":6,"fbjs/lib/invariant":7,"fbjs/lib/warning":8}],4:[function(require,module,exports){ -(function (process){ +},{"./checkPropTypes":4,"./lib/ReactPropTypesSecret":8,"fbjs/lib/emptyFunction":1,"fbjs/lib/invariant":2,"fbjs/lib/warning":3}],7:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -612,7 +808,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { * of patent rights can be found in the PATENTS file in the same directory. */ -if (process.env.NODE_ENV !== 'production') { +if ("production" !== 'production') { var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element')) || @@ -634,8 +830,7 @@ if (process.env.NODE_ENV !== 'production') { module.exports = require('./factoryWithThrowingShims')(); } -}).call(this,require('_process')) -},{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3,"_process":9}],5:[function(require,module,exports){ +},{"./factoryWithThrowingShims":5,"./factoryWithTypeCheckers":6}],8:[function(require,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -651,355 +846,7 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; -},{}],6:[function(require,module,exports){ -"use strict"; - -/** - * Copyright (c) 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * - */ - -function makeEmptyFunction(arg) { - return function () { - return arg; - }; -} - -/** - * 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. - */ -var emptyFunction = function emptyFunction() {}; - -emptyFunction.thatReturns = makeEmptyFunction; -emptyFunction.thatReturnsFalse = makeEmptyFunction(false); -emptyFunction.thatReturnsTrue = makeEmptyFunction(true); -emptyFunction.thatReturnsNull = makeEmptyFunction(null); -emptyFunction.thatReturnsThis = function () { - return this; -}; -emptyFunction.thatReturnsArgument = function (arg) { - return arg; -}; - -module.exports = emptyFunction; -},{}],7:[function(require,module,exports){ -/** - * Copyright (c) 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - -'use strict'; - -/** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - -var validateFormat = function validateFormat(format) {}; - -if ("production" !== 'production') { - validateFormat = function validateFormat(format) { - 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.'); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - 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; -},{}],8:[function(require,module,exports){ -/** - * Copyright 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - -'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') { - (function () { - 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":6}],9:[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; }; - -},{}],10:[function(require,module,exports){ +},{}],9:[function(require,module,exports){ Object.defineProperty(exports, "__esModule", { value: true }); @@ -1069,7 +916,7 @@ function removeAll() { return { type: _const.RNS_REMOVE_ALL_NOTIFICATIONS }; } -},{"./const":11}],11:[function(require,module,exports){ +},{"./const":10}],10:[function(require,module,exports){ Object.defineProperty(exports, "__esModule", { value: true }); @@ -1077,7 +924,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'; -},{}],12:[function(require,module,exports){ +},{}],11:[function(require,module,exports){ (function (global){ 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; }; @@ -1139,7 +986,8 @@ var Notifications = function (_React$Component) { function componentWillReceiveProps(nextProps) { var _this2 = this; - var notifications = nextProps.notifications; + var notifications = nextProps.notifications, + defaultNotification = nextProps.defaultNotification; var notificationIds = notifications.map(function (notification) { return notification.uid; @@ -1151,12 +999,16 @@ var Notifications = function (_React$Component) { /// and remove all where uid is not found in the reducer systemNotifications.forEach(function (notification) { if (notificationIds.indexOf(notification.uid) < 0) { - console.log('removing', _this2.system().state.notifications); _this2.system().removeNotification(notification.uid); } }); notifications.forEach(function (notification) { + if (defaultNotification) { + // assign defaultNotification for notification + notification = Object.assign(defaultNotification, notification); + } + _this2.system().addNotification(_extends({}, notification, { onRemove: function () { function onRemove() { @@ -1205,6 +1057,7 @@ var Notifications = function (_React$Component) { }(_react2['default'].Component); Notifications.propTypes = { + defaultNotification: _propTypes2['default'].object, notifications: _propTypes2['default'].array }; @@ -1222,7 +1075,7 @@ Notifications.reducer = _reducer2['default']; module.exports = Notifications; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./actions":10,"./reducer":13,"prop-types":4,"react-notification-system":undefined}],13:[function(require,module,exports){ +},{"./actions":9,"./reducer":12,"prop-types":7,"react-notification-system":undefined}],12:[function(require,module,exports){ Object.defineProperty(exports, "__esModule", { value: true }); @@ -1257,5 +1110,5 @@ function Notifications() { return state; } -},{"./const":11}]},{},[12])(12) +},{"./const":10}]},{},[11])(11) }); \ No newline at end of file diff --git a/dist/react-notification-system-redux.min.js b/dist/react-notification-system-redux.min.js index a749635..abfe158 100644 --- a/dist/react-notification-system-redux.min.js +++ b/dist/react-notification-system-redux.min.js @@ -1 +1 @@ -!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 c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}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;u1)for(var t=1;t0&&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 c(e){return{type:l.RNS_HIDE_NOTIFICATION,uid:e}}function f(){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 c(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 f=Object.assign||function(e){for(var n=1;n0&&(o.forEach(function(e){r.indexOf(e.uid)<0&&(console.log("removing",n.system().state.notifications),n.system().removeNotification(e.uid))}),t.forEach(function(e){n.system().addNotification(f({},e,{onRemove:function(){function t(){n.context.store.dispatch(h.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(T["default"],f({ref:"notify"},n))}return e}()}]),n}(p["default"].Component);g.propTypes={notifications:d["default"].array},g.contextTypes={store:d["default"].object},Object.keys(h).forEach(function(e){g[e]=h[e]}),g.reducer=m["default"],n.exports=g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./actions":10,"./reducer":13,"prop-types":4,"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;n0&&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&&(i.forEach(function(e){o.indexOf(e.uid)<0&&n.system().removeNotification(e.uid)}),t.forEach(function(e){r&&(e=Object.assign(r,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(T["default"],c({ref:"notify"},n))}return e}()}]),n}(p["default"].Component);g.propTypes={defaultNotification:d["default"].object,notifications:d["default"].array},g.contextTypes={store:d["default"].object},Object.keys(b).forEach(function(e){g[e]=b[e]}),g.reducer=O["default"],n.exports=g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./actions":9,"./reducer":12,"prop-types":7,"react-notification-system":void 0}],12:[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 Date: Wed, 28 Jun 2017 18:37:24 +0300 Subject: [PATCH 3/5] move require-dir for dev --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9e76d81..407c433 100644 --- a/package.json +++ b/package.json @@ -30,24 +30,24 @@ "eslint": "^1.6.0", "eslint-plugin-react": "^3.5.1", "gulp": "^3.9.0", + "gulp-git": "^2.4.1", "jest-cli": "^14.1.0", "jsdom": "^9.8.3", "lodash": "^4.14.2", "mocha": "^3.2.0", "react": "^0.14 || ^15.0.0-rc || ^15.0", - "gulp-git": "^2.4.1", "react-addons-test-utils": "^15.3.1", "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-notification-system": "^0.2.7", "react-redux": "^4.4.5", "redux": "^3.5.2", + "require-dir": "^0.3.2", "sinon": "^1.17.6" }, "dependencies": { "prop-types": "^15.5.8", - "react-notification-system": "^0.2.x", - "require-dir": "^0.3.2" + "react-notification-system": "^0.2.x" }, "peerDependencies": { "react": "^0.14 || ^15.0.0-rc || ^15.0", From a03220690bc7da593ebf62ce907a73b649ee31bb Mon Sep 17 00:00:00 2001 From: Andrey Makar-Uvarov Date: Wed, 28 Jun 2017 19:34:29 +0300 Subject: [PATCH 4/5] rename defaultNotification to defaults --- dist/react-notification-system-redux.js | 6 +++--- dist/react-notification-system-redux.min.js | 2 +- lib/notifications.js | 6 +++--- src/notifications.js | 6 +++--- test/__tests__/notifications.js | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dist/react-notification-system-redux.js b/dist/react-notification-system-redux.js index 302700a..6d5f204 100644 --- a/dist/react-notification-system-redux.js +++ b/dist/react-notification-system-redux.js @@ -987,7 +987,7 @@ var Notifications = function (_React$Component) { var _this2 = this; var notifications = nextProps.notifications, - defaultNotification = nextProps.defaultNotification; + defaults = nextProps.defaults; var notificationIds = notifications.map(function (notification) { return notification.uid; @@ -1004,9 +1004,9 @@ var Notifications = function (_React$Component) { }); notifications.forEach(function (notification) { - if (defaultNotification) { + if (defaults) { // assign defaultNotification for notification - notification = Object.assign(defaultNotification, notification); + notification = Object.assign(defaults, notification); } _this2.system().addNotification(_extends({}, notification, { diff --git a/dist/react-notification-system-redux.min.js b/dist/react-notification-system-redux.min.js index abfe158..c1fea36 100644 --- a/dist/react-notification-system-redux.min.js +++ b/dist/react-notification-system-redux.min.js @@ -1 +1 @@ -!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&&(i.forEach(function(e){o.indexOf(e.uid)<0&&n.system().removeNotification(e.uid)}),t.forEach(function(e){r&&(e=Object.assign(r,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(T["default"],c({ref:"notify"},n))}return e}()}]),n}(p["default"].Component);g.propTypes={defaultNotification:d["default"].object,notifications:d["default"].array},g.contextTypes={store:d["default"].object},Object.keys(b).forEach(function(e){g[e]=b[e]}),g.reducer=O["default"],n.exports=g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./actions":9,"./reducer":12,"prop-types":7,"react-notification-system":void 0}],12:[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;n0&&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&&(i.forEach(function(e){o.indexOf(e.uid)<0&&n.system().removeNotification(e.uid)}),t.forEach(function(e){r&&(e=Object.assign(r,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(T["default"],c({ref:"notify"},n))}return e}()}]),n}(p["default"].Component);g.propTypes={defaultNotification:d["default"].object,notifications:d["default"].array},g.contextTypes={store:d["default"].object},Object.keys(b).forEach(function(e){g[e]=b[e]}),g.reducer=O["default"],n.exports=g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./actions":9,"./reducer":12,"prop-types":7,"react-notification-system":void 0}],12:[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 notification.uid); const systemNotifications = this.system().state.notifications || []; @@ -27,9 +27,9 @@ class Notifications extends React.Component { }); notifications.forEach(notification => { - if(defaultNotification) { + if(defaults) { // assign defaultNotification for notification - notification = Object.assign(defaultNotification, notification); + notification = Object.assign(defaults, notification); } this.system().addNotification({ diff --git a/test/__tests__/notifications.js b/test/__tests__/notifications.js index 53d07b9..6aa3206 100644 --- a/test/__tests__/notifications.js +++ b/test/__tests__/notifications.js @@ -56,7 +56,7 @@ describe('NotificationsComponent', () => { it('should assign defaultNotification for notifications', (done) => { const wrapper = mountComponent({ - defaultNotification: { autoDismiss: 1 } + defaults: { autoDismiss: 1 } }); const onRemove = sinon.spy(); const shortNotification = { From 02b2ba2325e0dce598aabbee6b05c66b98b967b6 Mon Sep 17 00:00:00 2001 From: Anatoly Bubenkov Date: Fri, 16 Aug 2019 04:15:28 +0200 Subject: [PATCH 5/5] pin version of require-dir --- dist/react-notification-system-redux.js | 3508 +++++++++++++++++++ dist/react-notification-system-redux.min.js | 1 - lib/notifications.js | 12 +- package.json | 7 +- yarn.lock | 13 +- 5 files changed, 3520 insertions(+), 21 deletions(-) create mode 100644 dist/react-notification-system-redux.js 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 new file mode 100644 index 0000000..8c6e9c3 --- /dev/null +++ b/dist/react-notification-system-redux.js @@ -0,0 +1,3508 @@ +(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'; + +/** + * 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 +}; + +var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + callee: true, + arguments: true, + arity: true +}; + +var FORWARD_REF_STATICS = { + '$$typeof': true, + render: true, + defaultProps: true, + displayName: true, + propTypes: true +}; + +var MEMO_STATICS = { + '$$typeof': true, + compare: true, + defaultProps: true, + displayName: true, + propTypes: true, + type: true +}; + +var TYPE_STATICS = {}; +TYPE_STATICS[ReactIs.ForwardRef] = FORWARD_REF_STATICS; + +function getStatics(component) { + if (ReactIs.isMemo(component)) { + return MEMO_STATICS; + } + return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; +} + +var defineProperty = Object.defineProperty; +var getOwnPropertyNames = Object.getOwnPropertyNames; +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var getPrototypeOf = Object.getPrototypeOf; +var objectPrototype = Object.prototype; + +function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { + if (typeof sourceComponent !== 'string') { + // don't hoist over string (html) components + + if (objectPrototype) { + var inheritedComponent = getPrototypeOf(sourceComponent); + if (inheritedComponent && inheritedComponent !== objectPrototype) { + hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); + } + } + + var keys = getOwnPropertyNames(sourceComponent); + + if (getOwnPropertySymbols) { + keys = keys.concat(getOwnPropertySymbols(sourceComponent)); + } + + var targetStatics = getStatics(targetComponent); + var sourceStatics = getStatics(sourceComponent); + + 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'; + +/** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + +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'); + } + } + + 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.' + ); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + 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; + +},{}],9:[function(require,module,exports){ +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ + +'use strict'; +/* eslint-disable no-unused-vars */ +var getOwnPropertySymbols = Object.getOwnPropertySymbols; +var hasOwnProperty = Object.prototype.hasOwnProperty; +var propIsEnumerable = Object.prototype.propertyIsEnumerable; + +function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); +} + +function shouldUseNative() { + try { + if (!Object.assign) { + return false; + } + + // Detect buggy property enumeration order in older V8 versions. + + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 + var test1 = new String('abc'); // eslint-disable-line no-new-wrappers + test1[5] = 'de'; + if (Object.getOwnPropertyNames(test1)[0] === '5') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test2 = {}; + for (var i = 0; i < 10; i++) { + test2['_' + String.fromCharCode(i)] = i; + } + var order2 = Object.getOwnPropertyNames(test2).map(function (n) { + return test2[n]; + }); + if (order2.join('') !== '0123456789') { + return false; + } + + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 + var test3 = {}; + 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { + test3[letter] = letter; + }); + if (Object.keys(Object.assign({}, test3)).join('') !== + 'abcdefghijklmnopqrst') { + return false; + } + + return true; + } catch (err) { + // We don't expect any of the above to throw, but better to be safe. + return false; + } +} + +module.exports = shouldUseNative() ? Object.assign : function (target, source) { + var from; + var to = toObject(target); + var symbols; + + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); + + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + + if (getOwnPropertySymbols) { + symbols = getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } + + return to; +}; + +},{}],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. + * + * 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 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; + 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) {} + }; +} + +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ +function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if ("production" !== 'production') { + for (var typeSpecName in typeSpecs) { + 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. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + 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; + } + 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. + loggedTypeFailures[error.message] = true; + + var stack = getStack ? getStack() : ''; + + printWarning( + 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') + ); + } + } + } + } +} + +/** + * Resets warning cache when testing. + * + * @private + */ +checkPropTypes.resetWarningCache = function() { + if ("production" !== 'production') { + loggedTypeFailures = {}; + } +} + +module.exports = checkPropTypes; + +},{"./lib/ReactPropTypesSecret":15}],12:[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'; + +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); + +function emptyFunction() {} +function emptyFunctionWithReset() {} +emptyFunctionWithReset.resetWarningCache = emptyFunction; + +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } + 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() { + return shim; + }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + + any: shim, + arrayOf: getShim, + element: shim, + elementType: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim, + + checkPropTypes: emptyFunctionWithReset, + resetWarningCache: emptyFunction + }; + + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + +},{"./lib/ReactPropTypesSecret":15}],13:[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'; + +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') { + 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; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } + + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + elementType: createElementTypeTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker, + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message) { + this.message = message; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + if ("production" !== 'production') { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + 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; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + printWarning( + 'You are manually calling a React.PropTypes validation ' + + '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.' + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunctionThatReturnsNull); + } + + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + 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)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + 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; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + 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); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (has(propValue, key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + "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') { + printWarning( + 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' + ); + return emptyFunctionThatReturnsNull; + } + } + + function validate(props, propName, componentName, location, propFullName) { + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { + return null; + } + } + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (!checker) { + continue; + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + // We need to check all keys in case some are required but missing from + // props. + var allKeys = assign({}, props[propName], shapeTypes); + for (var key in allKeys) { + var checker = shapeTypes[key]; + if (!checker) { + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') + ); + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + 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; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; +}; + +},{"./checkPropTypes":11,"./lib/ReactPropTypesSecret":15,"object-assign":9,"react-is":18}],14:[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. + */ + +if ("production" !== 'production') { + 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')(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,"react-is":18}],15:[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'; + +var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + +module.exports = ReactPropTypesSecret; + +},{}],16:[function(require,module,exports){ +(function (process){ +/** @license React v16.9.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. + */ + +'use strict'; + + + +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; +// 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_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; +var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; + +function isValidElementType(type) { + return typeof type === 'string' || typeof type === 'function' || + // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE); +} + +/** + * 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.9.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.suspense_list"): +60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.fundamental"):60117,w=b?Symbol.for("react.responder"):60118;function x(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 t:case r:case d:return u}}}function y(a){return x(a)===m}exports.typeOf=x;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.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===v||a.$$typeof===w)};exports.isAsyncMode=function(a){return y(a)||x(a)===l};exports.isConcurrentMode=y;exports.isContextConsumer=function(a){return x(a)===k};exports.isContextProvider=function(a){return x(a)===h}; +exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return x(a)===n};exports.isFragment=function(a){return x(a)===e};exports.isLazy=function(a){return x(a)===t};exports.isMemo=function(a){return x(a)===r};exports.isPortal=function(a){return x(a)===d};exports.isProfiler=function(a){return x(a)===g};exports.isStrictMode=function(a){return x(a)===f};exports.isSuspense=function(a){return x(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 _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")); + +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"); + +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 + 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 " + stringifyComponent(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; + + if (pure) { + OuterBaseComponent = _react.PureComponent; + } + + function makeDerivedPropsSelector() { + var lastProps; + var lastState; + var lastDerivedProps; + var lastStore; + var lastSelectorFactoryOptions; + var sourceSelector; + return function selectDerivedProps(state, props, store, selectorFactoryOptions) { + if (pure && lastProps === props && lastState === state) { + return lastDerivedProps; + } + + if (store !== lastStore || lastSelectorFactoryOptions !== selectorFactoryOptions) { + lastStore = store; + lastSelectorFactoryOptions = selectorFactoryOptions; + sourceSelector = selectorFactory(store.dispatch, selectorFactoryOptions); + } + + lastProps = props; + lastState = state; + var nextProps = sourceSelector(state, props); + lastDerivedProps = nextProps; + return lastDerivedProps; + }; + } + + function makeChildElementSelector() { + var lastChildProps, lastForwardRef, lastChildElement, lastComponent; + return function selectChildElement(WrappedComponent, childProps, forwardRef) { + if (childProps !== lastChildProps || forwardRef !== lastForwardRef || lastComponent !== WrappedComponent) { + lastChildProps = childProps; + lastForwardRef = forwardRef; + lastComponent = WrappedComponent; + lastChildElement = _react.default.createElement(WrappedComponent, (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.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, + 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, selectorFactoryOptions); + return this.selectChildElement(WrappedComponent, derivedProps, forwardedRef); + }; + + _proto.render = function render() { + 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; + }(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; + /** + * 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) { + 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; // 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 + }); + } + /** + * 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); // This is used to make sure we don't warn about the same + // keys multiple times. + + 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 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` + * 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 boundActionCreators = {}; + + for (var key in actionCreators) { + 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 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] : {}; + + 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)); + }); + } + } + + 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 _objectSpread2({}, 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.__DO_NOT_USE__ActionTypes = ActionTypes; +exports.applyMiddleware = applyMiddleware; +exports.bindActionCreators = bindActionCreators; +exports.combineReducers = combineReducers; +exports.compose = compose; +exports.createStore = createStore; + +},{"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 + }); +} + +function success(opts) { + return show(opts, 'success'); +} + +function error(opts) { + return show(opts, 'error'); +} + +function warning(opts) { + return show(opts, 'warning'); +} + +function info(opts) { + return show(opts, 'info'); +} + +function hide(uid) { + return { + type: _const.RNS_HIDE_NOTIFICATION, + uid: uid + }; +} + +function removeAll() { + return { type: _const.RNS_REMOVE_ALL_NOTIFICATIONS }; +} + +},{"./const":38}],38:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var RNS_SHOW_NOTIFICATION = exports.RNS_SHOW_NOTIFICATION = 'RNS_SHOW_NOTIFICATION'; +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){ +(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; }; }(); + +var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require('prop-types'); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _reactRedux = require('react-redux'); + +var _actions = require('./actions'); + +var actions = _interopRequireWildcard(_actions); + +var _reducer = require('./reducer'); + +var _reducer2 = _interopRequireDefault(_reducer); + +var _reactNotificationSystem = require('react-notification-system'); + +var _reactNotificationSystem2 = _interopRequireDefault(_reactNotificationSystem); + +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)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var Notifications = function (_React$Component) { + _inherits(Notifications, _React$Component); + + function Notifications(props) { + _classCallCheck(this, Notifications); + + 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.notifyRef.current; + } + + return system; + }() + }, { + key: 'componentDidUpdate', + value: function () { + function componentDidUpdate(prevProps) { + var _this2 = this; + + var _props = this.props, + notifications = _props.notifications, + store = _props.store, + defaults = _props.defaults; + + var notificationIds = notifications.map(function (notification) { + return notification.uid; + }); + var systemNotifications = this.system().state.notifications || []; + + if (notifications.length > 0) { + // Get all active notifications from react-notification-system + /// and remove all where uid is not found in the reducer + systemNotifications.forEach(function (notification) { + if (notificationIds.indexOf(notification.uid) < 0) { + _this2.system().removeNotification(notification.uid); + } + }); + + notifications.forEach(function (notification) { + if (defaults) { + // assign defaultNotification for notification + notification = Object.assign(defaults, notification); + } + + _this2.system().addNotification(_extends({}, notification, { + onRemove: function () { + function onRemove() { + store.dispatch(actions.hide(notification.uid)); + notification.onRemove && notification.onRemove(); + } + + return onRemove; + }() + })); + }); + } + + if (prevProps.notifications !== notifications && notifications.length === 0) { + this.system().clearNotifications(); + } + } + + return componentDidUpdate; + }() + }, { + key: 'shouldComponentUpdate', + value: function () { + function shouldComponentUpdate(nextProps) { + return this.props !== nextProps; + } + + return shouldComponentUpdate; + }() + }, { + key: 'render', + value: function () { + function render() { + var _props2 = this.props, + notifications = _props2.notifications, + store = _props2.store, + rest = _objectWithoutProperties(_props2, ['notifications', 'store']); + + return _react2['default'].createElement(_reactNotificationSystem2['default'], _extends({ ref: this.notifyRef }, rest)); + } + + return render; + }() + }]); + + return Notifications; +}(_react2['default'].Component); + +Notifications.propTypes = { + defaultNotification: _propTypes2['default'].object, + 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)); + } + ); +}; + +NotificationsWithContext.propTypes = { + context: _propTypes2['default'].object +}; + +// Tie actions to Notifications component instance +Object.keys(actions).forEach(function (key) { + NotificationsWithContext[key] = actions[key]; +}); + +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){ +'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['default'] = Notifications; + +var _const = require('./const'); + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +function Notifications() { + var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + switch (action.type) { + case _const.RNS_SHOW_NOTIFICATION: + var type = action.type, + rest = _objectWithoutProperties(action, ['type']); + + return [].concat(_toConsumableArray(state), [_extends({}, rest, { uid: action.uid })]); + case _const.RNS_HIDE_NOTIFICATION: + return state.filter(function (notification) { + return notification.uid !== action.uid; + }); + case _const.RNS_REMOVE_ALL_NOTIFICATIONS: + return []; + } + return state; +} + +},{"./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 c1fea36..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&&(i.forEach(function(e){o.indexOf(e.uid)<0&&n.system().removeNotification(e.uid)}),t.forEach(function(e){r&&(e=Object.assign(r,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(T["default"],c({ref:"notify"},n))}return e}()}]),n}(p["default"].Component);g.propTypes={defaultNotification:d["default"].object,notifications:d["default"].array},g.contextTypes={store:d["default"].object},Object.keys(b).forEach(function(e){g[e]=b[e]}),g.reducer=O["default"],n.exports=g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./actions":9,"./reducer":12,"prop-types":7,"react-notification-system":void 0}],12:[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>>>>>> master + store = _props.store, + defaults = _props.defaults; var notificationIds = notifications.map(function (notification) { return notification.uid; @@ -143,10 +139,7 @@ var Notifications = function (_React$Component) { }(_react2['default'].Component); Notifications.propTypes = { -<<<<<<< HEAD defaultNotification: _propTypes2['default'].object, - notifications: _propTypes2['default'].array -======= notifications: _propTypes2['default'].array, store: _propTypes2['default'].shape({ dispatch: _propTypes2['default'].func.isRequired @@ -169,7 +162,6 @@ var NotificationsWithContext = function NotificationsWithContext(props) { return _react2['default'].createElement(Notifications, _extends({ store: store }, props)); } ); ->>>>>>> master }; NotificationsWithContext.propTypes = { diff --git a/package.json b/package.json index 544cb50..eb985d0 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,8 @@ }, "dependencies": { "prop-types": "^15.6.0", - "react-notification-system": "^0.2.x" + "react-notification-system": "^0.2.x", + "require-dir": "1.0.0" }, "peerDependencies": { "react": "^16.4.0-0", @@ -56,6 +57,9 @@ "react-redux": "^6.0.0", "redux": "^3.6.0 || ^4.0.0" }, + "resolutions": { + "require-dir": "1.0.0" + }, "browserify-shim": { "react": "global:React" }, @@ -70,6 +74,7 @@ "test-dev": "mocha test/__tests__/**/* --watch", "watch": "gulp watch:lib" }, + "keywords": [ "react-notification-system", "redux" diff --git a/yarn.lock b/yarn.lock index d37b500..69bd2eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7987,15 +7987,10 @@ request@^2.79.0: tunnel-agent "^0.6.0" uuid "^3.3.2" -require-dir@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/require-dir/-/require-dir-0.1.0.tgz#81e01e299faf5b74c34b6594f8e5add5985ddec5" - integrity sha1-geAeKZ+vW3TDS2WU+OWt1Zhd3sU= - -require-dir@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/require-dir/-/require-dir-1.2.0.tgz#0d443b75e96012d3ca749cf19f529a789ae74817" - integrity sha512-LY85DTSu+heYgDqq/mK+7zFHWkttVNRXC9NKcKGyuGLdlsfbjEPrIEYdCVrx6hqnJb+xSu3Lzaoo8VnmOhhjNA== +require-dir@1.0.0, require-dir@^0.1.0, require-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/require-dir/-/require-dir-1.0.0.tgz#c2639de72960ea1ee280279f2da35e03c6536b2d" + integrity sha512-PUJcQVTP4n6F8Un1GEEWhqnmBMfukVsL5gqwBxt7RF+nP+9hSOLJ/vSs5iUoXw1UWDgzqg9B/IIb15kfQKWsAQ== require-directory@^2.1.1: version "2.1.1"