diff --git a/docs/demo.js b/docs/demo.js index 515d406..616647f 100644 --- a/docs/demo.js +++ b/docs/demo.js @@ -13,19 +13,20 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _src_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../src/index */ "./src/index.js"); -class Demo extends react__WEBPACK_IMPORTED_MODULE_0__.PureComponent { +class Demo extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComponent) { constructor(props) { super(props); this.state = {}; this.state = { numberFocused: false }; - this.numberField = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createRef(); - this.braintree = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createRef(); + this.numberField = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createRef(); + this.braintree = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createRef(); ['onError', 'getToken', 'onCardTypeChange', 'onAuthorizationSuccess'].forEach(prop => this[prop] = this[prop].bind(this)); } @@ -77,7 +78,7 @@ class Demo extends react__WEBPACK_IMPORTED_MODULE_0__.PureComponent { return null; } - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("b", null, title, ":"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("pre", null, JSON.stringify(obj, null, 4))); + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("b", null, title, ":"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("pre", null, JSON.stringify(obj, null, 4))); } onAuthorizationSuccess() { @@ -85,7 +86,7 @@ class Demo extends react__WEBPACK_IMPORTED_MODULE_0__.PureComponent { } render() { - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("h1", null, "Braintree Hosted Fields Demo"), this.renderResult('Error', this.state.error), this.renderResult('Token', this.state.token), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.Braintree, { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("h1", null, "Braintree Hosted Fields Demo"), this.renderResult('Error', this.state.error), this.renderResult('Token', this.state.token), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.Braintree, { ref: this.braintree, authorization: this.state.authorization, onAuthorizationSuccess: this.onAuthorizationSuccess, @@ -102,7 +103,7 @@ class Demo extends react__WEBPACK_IMPORTED_MODULE_0__.PureComponent { color: 'black' } } - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", null, "Number:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null, "Number:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { type: "number", onBlur: () => this.setState({ numberFocused: false @@ -113,30 +114,30 @@ class Demo extends react__WEBPACK_IMPORTED_MODULE_0__.PureComponent { className: this.state.numberFocused ? 'focused' : '', prefill: "4111 1111 1111 1111", ref: this.numberField - }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("p", null, "Card type: ", this.state.card), "Name:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { + }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("p", null, "Card type: ", this.state.card), "Name:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { type: "cardholderName" - }), "Date:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { + }), "Date:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { type: "expirationDate" - }), "Month:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { + }), "Month:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { type: "expirationMonth" - }), "Year:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { + }), "Year:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { type: "expirationYear", options: { maskInput: { character: 'X' } } - }), "CVV:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { + }), "CVV:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { type: "cvv", placeholder: "CVV", ref: cvvField => { this.cvvField = cvvField; } - }), "Zip:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { + }), "Zip:", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_src_index__WEBPACK_IMPORTED_MODULE_1__.HostedField, { type: "postalCode" - }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { + }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { className: "footer" - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("button", { + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { onClick: this.getToken }, "Get nonce token"))); } @@ -166,13 +167,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var braintree_web_data_collector__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(braintree_web_data_collector__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var braintree_web_three_d_secure__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! braintree-web/three-d-secure */ "./node_modules/braintree-web/dist/browser/three-d-secure.js"); /* harmony import */ var braintree_web_three_d_secure__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(braintree_web_three_d_secure__WEBPACK_IMPORTED_MODULE_3__); -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } +function _extends() { _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; }; return _extends.apply(this, arguments); } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } @@ -192,7 +187,7 @@ class BraintreeClientApi { styles, onAuthorizationSuccess } = _ref, - callbacks = _objectWithoutProperties(_ref, ["authorization", "styles", "onAuthorizationSuccess"]); + callbacks = _objectWithoutPropertiesLoose(_ref, ["authorization", "styles", "onAuthorizationSuccess"]); this.fields = Object.create(null); this._nextFieldId = 0; @@ -230,7 +225,8 @@ class BraintreeClientApi { if (this.wrapperHandlers.onThreeDSecureReady) { braintree_web_three_d_secure__WEBPACK_IMPORTED_MODULE_3___default().create({ - client: clientInstance + client: clientInstance, + version: 2 }, this.wrapperHandlers.onThreeDSecureReady); } @@ -274,7 +270,7 @@ class BraintreeClientApi { this.hostedFields = hostedFields; ['blur', 'focus', 'empty', 'notEmpty', 'cardTypeChange', 'validityChange'].forEach(eventName => { - hostedFields.on(eventName, ev => this.onFieldEvent("on".concat(cap(eventName)), ev)); + hostedFields.on(eventName, ev => this.onFieldEvent("on" + cap(eventName), ev)); }); this.onError(err); @@ -305,21 +301,21 @@ class BraintreeClientApi { type, prefill, rejectUnsupportedCards, - id = "braintree-field-wrapper-".concat(this.nextFieldId()), + id = "braintree-field-wrapper-" + this.nextFieldId(), options = {} } = _ref2, - handlers = _objectWithoutProperties(_ref2, ["formatInput", "maxlength", "minlength", "placeholder", "select", "type", "prefill", "rejectUnsupportedCards", "id", "options"]); + handlers = _objectWithoutPropertiesLoose(_ref2, ["formatInput", "maxlength", "minlength", "placeholder", "select", "type", "prefill", "rejectUnsupportedCards", "id", "options"]); var onRenderComplete = () => { this.fieldHandlers[type] = handlers; - this.fields[type] = _objectSpread({ + this.fields[type] = _extends({ formatInput, maxlength, minlength, placeholder, select, prefill, - selector: "#".concat(id) + selector: "#" + id }, options); if ('number' === type && rejectUnsupportedCards) { @@ -358,8 +354,11 @@ class BraintreeClientApi { } } - tokenize() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + tokenize(options) { + if (options === void 0) { + options = {}; + } + return new Promise((resolve, reject) => { // eslint-disable-line no-undef this.hostedFields.tokenize(options, (err, payload) => { @@ -389,18 +388,19 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ "default": () => (/* binding */ Braintree) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./api */ "./src/api.js"); -/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./context */ "./src/context.js"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); +/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./api */ "./src/api.js"); +/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./context */ "./src/context.js"); -class Braintree extends react__WEBPACK_IMPORTED_MODULE_0__.Component { +class Braintree extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) { constructor(props) { super(props); - this.api = new _api__WEBPACK_IMPORTED_MODULE_2__.default(props); + this.api = new _api__WEBPACK_IMPORTED_MODULE_1__.default(props); this.contextValue = { braintreeApi: this.api }; @@ -434,28 +434,28 @@ class Braintree extends react__WEBPACK_IMPORTED_MODULE_0__.Component { var className = 'braintree-hosted-fields-wrapper'; if (providedClass) { - className += " ".concat(providedClass); + className += " " + providedClass; } - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_context__WEBPACK_IMPORTED_MODULE_3__.Context.Provider, { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_context__WEBPACK_IMPORTED_MODULE_2__.Context.Provider, { value: this.contextValue - }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Tag, { + }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(Tag, { className: className }, this.props.children)); } } Braintree.propTypes = { - children: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().node.isRequired), - onAuthorizationSuccess: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - authorization: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string), - getTokenRef: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - onValidityChange: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - onCardTypeChange: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - onError: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - styles: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().object), - className: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string), - tagName: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string) + children: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().node.isRequired), + onAuthorizationSuccess: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func), + authorization: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().string), + getTokenRef: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func), + onValidityChange: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func), + onCardTypeChange: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func), + onError: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().func), + styles: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().object), + className: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().string), + tagName: (prop_types__WEBPACK_IMPORTED_MODULE_3___default().string) }; Braintree.defaultProps = { tagName: 'div' @@ -475,8 +475,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ "Context": () => (/* binding */ Context) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -var Context = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createContext({ +var Context = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createContext({ braintreeApi: null }); @@ -494,13 +495,14 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ "default": () => (/* binding */ BraintreeHostedField) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); -/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./context */ "./src/context.js"); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); +/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./context */ "./src/context.js"); -class BraintreeHostedField extends react__WEBPACK_IMPORTED_MODULE_0__.Component { +class BraintreeHostedField extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) { constructor() { super(...arguments); this.state = {}; @@ -544,7 +546,7 @@ class BraintreeHostedField extends react__WEBPACK_IMPORTED_MODULE_0__.Component return null; } - return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", { + return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { id: fieldId, className: this.className }); @@ -552,19 +554,19 @@ class BraintreeHostedField extends react__WEBPACK_IMPORTED_MODULE_0__.Component } BraintreeHostedField.propTypes = { - type: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOf(['number', 'expirationDate', 'expirationMonth', 'expirationYear', 'cvv', 'postalCode', 'cardholderName']).isRequired, - id: prop_types__WEBPACK_IMPORTED_MODULE_1___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_1___default().string), (prop_types__WEBPACK_IMPORTED_MODULE_1___default().number)]), - placeholder: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string), - className: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string), - onCardTypeChange: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - onValidityChange: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - onNotEmpty: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - onFocus: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - onEmpty: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - onBlur: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().func), - prefill: (prop_types__WEBPACK_IMPORTED_MODULE_1___default().string) -}; -BraintreeHostedField.contextType = _context__WEBPACK_IMPORTED_MODULE_2__.Context; + type: prop_types__WEBPACK_IMPORTED_MODULE_2___default().oneOf(['number', 'expirationDate', 'expirationMonth', 'expirationYear', 'cvv', 'postalCode', 'cardholderName']).isRequired, + id: prop_types__WEBPACK_IMPORTED_MODULE_2___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_2___default().string), (prop_types__WEBPACK_IMPORTED_MODULE_2___default().number)]), + placeholder: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string), + className: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string), + onCardTypeChange: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func), + onValidityChange: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func), + onNotEmpty: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func), + onFocus: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func), + onEmpty: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func), + onBlur: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().func), + prefill: (prop_types__WEBPACK_IMPORTED_MODULE_2___default().string) +}; +BraintreeHostedField.contextType = _context__WEBPACK_IMPORTED_MODULE_1__.Context; /***/ }), @@ -2003,7 +2005,7 @@ module.exports = { var BraintreeError = _dereq_("../lib/braintree-error"); var Client = _dereq_("./client"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; var Promise = _dereq_("../lib/promise"); var wrapPromise = _dereq_("@braintree/wrap-promise"); var sharedErrors = _dereq_("../lib/errors"); @@ -3565,7 +3567,7 @@ module.exports = BraintreeError; },{"./enumerate":48}],43:[function(_dereq_,module,exports){ "use strict"; -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; var PLATFORM = "web"; var CLIENT_API_URLS = { @@ -4848,7 +4850,7 @@ var createDeferredClient = _dereq_("../lib/create-deferred-client"); var createAssetsUrl = _dereq_("../lib/create-assets-url"); var methods = _dereq_("../lib/methods"); var convertMethodsToError = _dereq_("../lib/convert-methods-to-error"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; var Promise = _dereq_("../lib/promise"); var wrapPromise = _dereq_("@braintree/wrap-promise"); var errors = _dereq_("./errors"); @@ -5951,7 +5953,7 @@ module.exports = { var BraintreeError = _dereq_("./braintree-error"); var Promise = _dereq_("./promise"); var sharedErrors = _dereq_("./errors"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; function basicComponentVerification(options) { var client, authorization, name; @@ -6120,7 +6122,7 @@ module.exports = function (obj) { },{}],19:[function(_dereq_,module,exports){ "use strict"; -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; var PLATFORM = "web"; var CLIENT_API_URLS = { @@ -6201,7 +6203,7 @@ var Promise = _dereq_("./promise"); var assets = _dereq_("./assets"); var sharedErrors = _dereq_("./errors"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; function createDeferredClient(options) { var promise = Promise.resolve(); @@ -10178,7 +10180,7 @@ var supportsInputFormatting = _dereq_("restricted-input/supports-input-formattin var wrapPromise = _dereq_("@braintree/wrap-promise"); var BraintreeError = _dereq_("../lib/braintree-error"); var Promise = _dereq_("../lib/promise"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; /** * Fields used in {@link module:braintree-web/hosted-fields~fieldOptions fields options} @@ -10568,7 +10570,7 @@ module.exports = { var enumerate = _dereq_("../../lib/enumerate"); var errors = _dereq_("./errors"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; var constants = { VERSION: VERSION, @@ -11128,7 +11130,7 @@ module.exports = { var BraintreeError = _dereq_("./braintree-error"); var Promise = _dereq_("./promise"); var sharedErrors = _dereq_("./errors"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; function basicComponentVerification(options) { var client, authorization, name; @@ -11322,7 +11324,7 @@ module.exports = BraintreeError; },{"./enumerate":94}],88:[function(_dereq_,module,exports){ "use strict"; -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; var PLATFORM = "web"; var CLIENT_API_URLS = { @@ -11454,7 +11456,7 @@ var Promise = _dereq_("./promise"); var assets = _dereq_("./assets"); var sharedErrors = _dereq_("./errors"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; function createDeferredClient(options) { var promise = Promise.resolve(); @@ -13290,7 +13292,7 @@ module.exports = { var BraintreeError = _dereq_("./braintree-error"); var Promise = _dereq_("./promise"); var sharedErrors = _dereq_("./errors"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; function basicComponentVerification(options) { var client, authorization, name; @@ -13438,7 +13440,7 @@ module.exports = BraintreeError; },{"./enumerate":44}],37:[function(_dereq_,module,exports){ "use strict"; -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; var PLATFORM = "web"; var CLIENT_API_URLS = { @@ -13592,7 +13594,7 @@ var Promise = _dereq_("./promise"); var assets = _dereq_("./assets"); var sharedErrors = _dereq_("./errors"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; function createDeferredClient(options) { var promise = Promise.resolve(); @@ -13883,7 +13885,7 @@ var useMin = _dereq_("../../../lib/use-min"); var BUS_CONFIGURATION_REQUEST_EVENT = _dereq_("../../../lib/constants").BUS_CONFIGURATION_REQUEST_EVENT; -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; var IFRAME_HEIGHT = 400; var IFRAME_WIDTH = 400; @@ -14737,7 +14739,7 @@ var ExtendedPromise = _dereq_("@braintree/extended-promise"); var INTEGRATION_TIMEOUT_MS = _dereq_("../../../lib/constants").INTEGRATION_TIMEOUT_MS; var PLATFORM = _dereq_("../../../lib/constants").PLATFORM; -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; var CUSTOMER_CANCELED_SONGBIRD_MODAL = "01"; var SONGBIRD_UI_EVENTS = [ "ui.close", @@ -15646,7 +15648,6 @@ var FRAMEWORKS = _dereq_("./frameworks"); * @property {object} threeDSecureInfo 3DS information about the card. Note: This information should be verified on the server by using the [payment method nonce find method](https://developer.paypal.com/braintree/docs/reference/request/payment-method-nonce/find). The values provided here are merely for convenience. Only values looked up on the server should determine the logic about how to process a transaction. * @property {string} threeDSecureInfo.acsTransactionId The transaction identifier from the issuing bank. * @property {string} threeDSecureInfo.cavv Cardholder authentication verification value or CAVV. The main encrypted message issuers and card networks use to verify authentication has occurred. Mastercard uses an AVV message and American Express uses an AEVV message, each of which should also be passed in the cavv parameter. - * @property {boolean} threeDSecureInfo.dataOnlyRequested Indicates whether to use the data only flow. In this flow, frictionless 3DS is ensured for Mastercard cardholders as the card scheme provides a risk score for the issuer to determine whether to approve. If data only is not supported by the processor, a validation error will be raised. Non-Mastercard cardholders will fallback to a normal 3DS flow. * @property {string} threeDSecureInfo.dsTransactionId Transaction identifier resulting from 3D Secure 2 authentication. * @property {string} threeDSecureInfo.eciFlag The value of the electronic commerce indicator (ECI) flag, which indicates the outcome of the 3DS authentication. This will be a two-digit value. * @property {boolean} threeDSecureInfo.enrolled Indicates the status of 3D Secure authentication eligibility with the card issuer. @@ -15985,6 +15986,7 @@ EventEmitter.createChild(ThreeDSecure); * @param {boolean} [options.cardAdd] *Deprecated:* Use `cardAddChallengeRequested` instead. * @param {boolean} [options.challengeRequested] If set to true, an authentication challenge will be forced if possible. * @param {boolean} [options.exemptionRequested] If set to true, an exemption to the authentication challenge will be requested. + * @param {boolean} [options.dataOnlyRequested] Indicates whether to use the data only flow. In this flow, frictionless 3DS is ensured for Mastercard cardholders as the card scheme provides a risk score for the issuer to determine whether to approve. If data only is not supported by the processor, a validation error will be raised. Non-Mastercard cardholders will fallback to a normal 3DS flow. * @param {function} [options.onLookupComplete] *Deprecated:* Use {@link ThreeDSecure#event:lookup-complete|`threeDSecureInstance.on('lookup-complete')`} instead. Function to execute when lookup completes. The first argument, `data`, is a {@link ThreeDSecure~verificationData|verificationData} object, and the second argument, `next`, is a callback. `next` must be called to continue. * @param {string} [options.email] The email used for verification. (maximum length 255) * @param {string} [options.mobilePhoneNumber] The mobile phone number used for verification. Only numbers; remove dashes, parenthesis and other characters. (maximum length 25) @@ -16382,7 +16384,7 @@ var createAssetsUrl = _dereq_("../lib/create-assets-url"); var BraintreeError = _dereq_("../lib/braintree-error"); var analytics = _dereq_("../lib/analytics"); var errors = _dereq_("./shared/errors"); -var VERSION = "3.88.3"; +var VERSION = "3.90.0"; var Promise = _dereq_("../lib/promise"); var wrapPromise = _dereq_("@braintree/wrap-promise"); @@ -16930,7 +16932,7 @@ var printWarning = function() {}; if (true) { var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); var loggedTypeFailures = {}; - var has = Function.call.bind(Object.prototype.hasOwnProperty); + var has = __webpack_require__(/*! ./lib/has */ "./node_modules/prop-types/lib/has.js"); printWarning = function(text) { var message = 'Warning: ' + text; @@ -16942,7 +16944,7 @@ if (true) { // 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) {} + } catch (x) { /**/ } }; } @@ -16971,7 +16973,8 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { 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] + '`.' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.' ); err.name = 'Invariant Violation'; throw err; @@ -17042,9 +17045,9 @@ var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index var assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); +var has = __webpack_require__(/*! ./lib/has */ "./node_modules/prop-types/lib/has.js"); var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); -var has = Function.call.bind(Object.prototype.hasOwnProperty); var printWarning = function() {}; if (true) { @@ -17145,6 +17148,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. var ReactPropTypes = { array: createPrimitiveTypeChecker('array'), + bigint: createPrimitiveTypeChecker('bigint'), bool: createPrimitiveTypeChecker('boolean'), func: createPrimitiveTypeChecker('function'), number: createPrimitiveTypeChecker('number'), @@ -17190,8 +17194,9 @@ module.exports = function(isValidElement, throwOnDirectAccess) { * 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) { + function PropTypeError(message, data) { this.message = message; + this.data = data && typeof data === 'object' ? data: {}; this.stack = ''; } // Make `instanceof Error` still work for returned errors. @@ -17226,7 +17231,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { ) { printWarning( 'You are manually calling a React.PropTypes validation ' + - 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' @@ -17265,7 +17270,10 @@ module.exports = function(isValidElement, throwOnDirectAccess) { // 'of type `object`'. var preciseType = getPreciseType(propValue); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + return new PropTypeError( + 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), + {expectedType: expectedType} + ); } return null; } @@ -17409,14 +17417,19 @@ module.exports = function(isValidElement, throwOnDirectAccess) { } function validate(props, propName, componentName, location, propFullName) { + var expectedTypes = []; for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; - if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { + var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); + if (checkerResult == null) { return null; } + if (checkerResult.data && has(checkerResult.data, 'expectedType')) { + expectedTypes.push(checkerResult.data.expectedType); + } } - - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); + var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); } return createChainableTypeChecker(validate); } @@ -17431,6 +17444,13 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return createChainableTypeChecker(validate); } + function invalidValidatorError(componentName, location, propFullName, key, type) { + return new PropTypeError( + (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' + ); + } + function createShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; @@ -17440,8 +17460,8 @@ module.exports = function(isValidElement, throwOnDirectAccess) { } for (var key in shapeTypes) { var checker = shapeTypes[key]; - if (!checker) { - continue; + if (typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); } var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error) { @@ -17460,16 +17480,18 @@ module.exports = function(isValidElement, throwOnDirectAccess) { 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. + // 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 (has(shapeTypes, key) && typeof checker !== 'function') { + return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + } 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, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') ); } var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); @@ -17670,6 +17692,17 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; +/***/ }), + +/***/ "./node_modules/prop-types/lib/has.js": +/*!********************************************!*\ + !*** ./node_modules/prop-types/lib/has.js ***! + \********************************************/ +/***/ ((module) => { + +module.exports = Function.call.bind(Object.prototype.hasOwnProperty); + + /***/ }), /***/ "./node_modules/react-dom/cjs/react-dom.development.js": @@ -17679,7 +17712,8 @@ module.exports = ReactPropTypesSecret; /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; -/** @license React v16.14.0 +/** + * @license React * react-dom.development.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -17690,34 +17724,30 @@ module.exports = ReactPropTypesSecret; - - if (true) { (function() { -'use strict'; - -var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); -var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); -var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js"); -var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); -var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/scheduler/tracing.js"); -var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions. -// Current owner and dispatcher used to share the same ref, -// but PR #14548 split them out to better support the react-debug-tools package. + 'use strict'; -if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) { - ReactSharedInternals.ReactCurrentDispatcher = { - current: null - }; +/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } + var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); +var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js"); -if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) { - ReactSharedInternals.ReactCurrentBatchConfig = { - suspense: null - }; -} +var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; +var suppressWarning = false; +function setSuppressWarning(newSuppressWarning) { + { + suppressWarning = newSuppressWarning; + } +} // In DEV, calls to console.warn and console.error get replaced // by calls to these methods by a Babel plugin. // // In PROD (or in packages without access to React internals), @@ -17725,20 +17755,24 @@ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) { function warn(format) { { - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } + if (!suppressWarning) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } - printWarning('warn', format, args); + printWarning('warn', format, args); + } } } function error(format) { { - for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { - args[_key2 - 1] = arguments[_key2]; - } + if (!suppressWarning) { + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } - printWarning('error', format, args); + printWarning('error', format, args); + } } } @@ -17746,20 +17780,17 @@ function printWarning(level, format, args) { // When changing this logic, you might want to also // update consoleWithStackDev.www.js as well. { - var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0; + var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; + var stack = ReactDebugCurrentFrame.getStackAddendum(); - if (!hasExistingStack) { - var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; - var stack = ReactDebugCurrentFrame.getStackAddendum(); + if (stack !== '') { + format += '%s'; + args = args.concat([stack]); + } // eslint-disable-next-line react-internal/safe-string-coercion - if (stack !== '') { - format += '%s'; - args = args.concat([stack]); - } - } var argsWithFormat = args.map(function (item) { - return '' + item; + return String(item); }); // Careful: RN currently depends on this prefix argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it @@ -17767,336 +17798,7 @@ function printWarning(level, format, args) { // eslint-disable-next-line react-internal/no-production-logging Function.prototype.apply.call(console[level], console, argsWithFormat); - - 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. - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - throw new Error(message); - } catch (x) {} - } -} - -if (!React) { - { - throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." ); - } -} - -var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) { - var funcArgs = Array.prototype.slice.call(arguments, 3); - - try { - func.apply(context, funcArgs); - } catch (error) { - this.onError(error); } -}; - -{ - // In DEV mode, we swap out invokeGuardedCallback for a special version - // that plays more nicely with the browser's DevTools. The idea is to preserve - // "Pause on exceptions" behavior. Because React wraps all user-provided - // functions in invokeGuardedCallback, and the production version of - // invokeGuardedCallback uses a try-catch, all user exceptions are treated - // like caught exceptions, and the DevTools won't pause unless the developer - // takes the extra step of enabling pause on caught exceptions. This is - // unintuitive, though, because even though React has caught the error, from - // the developer's perspective, the error is uncaught. - // - // To preserve the expected "Pause on exceptions" behavior, we don't use a - // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake - // DOM node, and call the user-provided callback from inside an event handler - // for that fake event. If the callback throws, the error is "captured" using - // a global event handler. But because the error happens in a different - // event loop context, it does not interrupt the normal program flow. - // Effectively, this gives us try-catch behavior without actually using - // try-catch. Neat! - // Check that the browser supports the APIs we need to implement our special - // DEV version of invokeGuardedCallback - if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { - var fakeNode = document.createElement('react'); - - var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) { - // If document doesn't exist we know for sure we will crash in this method - // when we call document.createEvent(). However this can cause confusing - // errors: https://github.com/facebookincubator/create-react-app/issues/3482 - // So we preemptively throw with a better message instead. - if (!(typeof document !== 'undefined')) { - { - throw Error( "The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous." ); - } - } - - var evt = document.createEvent('Event'); // Keeps track of whether the user-provided callback threw an error. We - // set this to true at the beginning, then set it to false right after - // calling the function. If the function errors, `didError` will never be - // set to false. This strategy works even if the browser is flaky and - // fails to call our global error handler, because it doesn't rely on - // the error event at all. - - var didError = true; // Keeps track of the value of window.event so that we can reset it - // during the callback to let user code access window.event in the - // browsers that support it. - - var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event - // dispatching: https://github.com/facebook/react/issues/13688 - - var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); // Create an event handler for our fake event. We will synchronously - // dispatch our fake event using `dispatchEvent`. Inside the handler, we - // call the user-provided callback. - - var funcArgs = Array.prototype.slice.call(arguments, 3); - - function callCallback() { - // We immediately remove the callback from event listeners so that - // nested `invokeGuardedCallback` calls do not clash. Otherwise, a - // nested call would trigger the fake event handlers of any call higher - // in the stack. - fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the - // window.event assignment in both IE <= 10 as they throw an error - // "Member not found" in strict mode, and in Firefox which does not - // support window.event. - - if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) { - window.event = windowEvent; - } - - func.apply(context, funcArgs); - didError = false; - } // Create a global error event handler. We use this to capture the value - // that was thrown. It's possible that this error handler will fire more - // than once; for example, if non-React code also calls `dispatchEvent` - // and a handler for that event throws. We should be resilient to most of - // those cases. Even if our error event handler fires more than once, the - // last error event is always used. If the callback actually does error, - // we know that the last error event is the correct one, because it's not - // possible for anything else to have happened in between our callback - // erroring and the code that follows the `dispatchEvent` call below. If - // the callback doesn't error, but the error event was fired, we know to - // ignore it because `didError` will be false, as described above. - - - var error; // Use this to track whether the error event is ever called. - - var didSetError = false; - var isCrossOriginError = false; - - function handleWindowError(event) { - error = event.error; - didSetError = true; - - if (error === null && event.colno === 0 && event.lineno === 0) { - isCrossOriginError = true; - } - - if (event.defaultPrevented) { - // Some other error handler has prevented default. - // Browsers silence the error report if this happens. - // We'll remember this to later decide whether to log it or not. - if (error != null && typeof error === 'object') { - try { - error._suppressLogging = true; - } catch (inner) {// Ignore. - } - } - } - } // Create a fake event type. - - - var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers - - window.addEventListener('error', handleWindowError); - fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function - // errors, it will trigger our global error handler. - - evt.initEvent(evtType, false, false); - fakeNode.dispatchEvent(evt); - - if (windowEventDescriptor) { - Object.defineProperty(window, 'event', windowEventDescriptor); - } - - if (didError) { - if (!didSetError) { - // The callback errored, but the error event never fired. - error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); - } else if (isCrossOriginError) { - error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.'); - } - - this.onError(error); - } // Remove our event listeners - - - window.removeEventListener('error', handleWindowError); - }; - - invokeGuardedCallbackImpl = invokeGuardedCallbackDev; - } -} - -var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; - -var hasError = false; -var caughtError = null; // Used by event system to capture/rethrow the first error. - -var hasRethrowError = false; -var rethrowError = null; -var reporter = { - onError: function (error) { - hasError = true; - caughtError = error; - } -}; -/** - * Call a function while guarding against errors that happens within it. - * Returns an error if it throws, otherwise null. - * - * In production, this is implemented using a try-catch. The reason we don't - * use a try-catch directly is so that we can swap out a different - * implementation in DEV mode. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - -function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { - hasError = false; - caughtError = null; - invokeGuardedCallbackImpl$1.apply(reporter, arguments); -} -/** - * Same as invokeGuardedCallback, but instead of returning an error, it stores - * it in a global so it can be rethrown by `rethrowCaughtError` later. - * TODO: See if caughtError and rethrowError can be unified. - * - * @param {String} name of the guard to use for logging or debugging - * @param {Function} func The function to invoke - * @param {*} context The context to use when calling the function - * @param {...*} args Arguments for function - */ - -function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) { - invokeGuardedCallback.apply(this, arguments); - - if (hasError) { - var error = clearCaughtError(); - - if (!hasRethrowError) { - hasRethrowError = true; - rethrowError = error; - } - } -} -/** - * During execution of guarded functions we will capture the first error which - * we will rethrow to be handled by the top level error handler. - */ - -function rethrowCaughtError() { - if (hasRethrowError) { - var error = rethrowError; - hasRethrowError = false; - rethrowError = null; - throw error; - } -} -function hasCaughtError() { - return hasError; -} -function clearCaughtError() { - if (hasError) { - var error = caughtError; - hasError = false; - caughtError = null; - return error; - } else { - { - { - throw Error( "clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue." ); - } - } - } -} - -var getFiberCurrentPropsFromNode = null; -var getInstanceFromNode = null; -var getNodeFromInstance = null; -function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) { - getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl; - getInstanceFromNode = getInstanceFromNodeImpl; - getNodeFromInstance = getNodeFromInstanceImpl; - - { - if (!getNodeFromInstance || !getInstanceFromNode) { - error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.'); - } - } -} -var validateEventDispatches; - -{ - validateEventDispatches = function (event) { - var dispatchListeners = event._dispatchListeners; - var dispatchInstances = event._dispatchInstances; - var listenersIsArr = Array.isArray(dispatchListeners); - var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; - var instancesIsArr = Array.isArray(dispatchInstances); - var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; - - if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) { - error('EventPluginUtils: Invalid `event`.'); - } - }; -} -/** - * Dispatch the event to the listener. - * @param {SyntheticEvent} event SyntheticEvent to handle - * @param {function} listener Application-level callback - * @param {*} inst Internal component instance - */ - - -function executeDispatch(event, listener, inst) { - var type = event.type || 'unknown-event'; - event.currentTarget = getNodeFromInstance(inst); - invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); - event.currentTarget = null; -} -/** - * Standard/simple iteration through an event's collected dispatches. - */ - -function executeDispatchesInOrder(event) { - var dispatchListeners = event._dispatchListeners; - var dispatchInstances = event._dispatchInstances; - - { - validateEventDispatches(event); - } - - if (Array.isArray(dispatchListeners)) { - for (var i = 0; i < dispatchListeners.length; i++) { - if (event.isPropagationStopped()) { - break; - } // Listeners and Instances are two parallel arrays that are always in sync. - - - executeDispatch(event, dispatchListeners[i], dispatchInstances[i]); - } - } else if (dispatchListeners) { - executeDispatch(event, dispatchListeners, dispatchInstances); - } - - event._dispatchListeners = null; - event._dispatchInstances = null; } var FunctionComponent = 0; @@ -18122,151 +17824,56 @@ var LazyComponent = 16; var IncompleteClassComponent = 17; var DehydratedFragment = 18; var SuspenseListComponent = 19; -var FundamentalComponent = 20; var ScopeComponent = 21; -var Block = 22; +var OffscreenComponent = 22; +var LegacyHiddenComponent = 23; +var CacheComponent = 24; +var TracingMarkerComponent = 25; -/** - * Injectable ordering of event plugins. - */ -var eventPluginOrder = null; -/** - * Injectable mapping from names to event plugin modules. - */ +// ----------------------------------------------------------------------------- -var namesToPlugins = {}; -/** - * Recomputes the plugin list using the injected plugins and plugin ordering. - * - * @private - */ +var enableClientRenderFallbackOnTextMismatch = true; // TODO: Need to review this code one more time before landing +// the react-reconciler package. -function recomputePluginOrdering() { - if (!eventPluginOrder) { - // Wait until an `eventPluginOrder` is injected. - return; - } - - for (var pluginName in namesToPlugins) { - var pluginModule = namesToPlugins[pluginName]; - var pluginIndex = eventPluginOrder.indexOf(pluginName); - - if (!(pluginIndex > -1)) { - { - throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`." ); - } - } +var enableNewReconciler = false; // Support legacy Primer support on internal FB www - if (plugins[pluginIndex]) { - continue; - } - - if (!pluginModule.extractEvents) { - { - throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not." ); - } - } - - plugins[pluginIndex] = pluginModule; - var publishedEvents = pluginModule.eventTypes; - - for (var eventName in publishedEvents) { - if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) { - { - throw Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`." ); - } - } - } - } -} -/** - * Publishes an event so that it can be dispatched by the supplied plugin. - * - * @param {object} dispatchConfig Dispatch configuration for the event. - * @param {object} PluginModule Plugin publishing the event. - * @return {boolean} True if the event was successfully published. - * @private - */ +var enableLazyContextPropagation = false; // FB-only usage. The new API has different semantics. +var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber -function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { - if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { - { - throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + eventName + "`." ); - } - } - - eventNameDispatchConfigs[eventName] = dispatchConfig; - var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; - - if (phasedRegistrationNames) { - for (var phaseName in phasedRegistrationNames) { - if (phasedRegistrationNames.hasOwnProperty(phaseName)) { - var phasedRegistrationName = phasedRegistrationNames[phaseName]; - publishRegistrationName(phasedRegistrationName, pluginModule, eventName); - } - } - - return true; - } else if (dispatchConfig.registrationName) { - publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); - return true; - } - - return false; -} -/** - * Publishes a registration name that is used to identify dispatched events. - * - * @param {string} registrationName Registration name to add. - * @param {object} PluginModule Plugin publishing the event. - * @private - */ +var enableSuspenseAvoidThisFallback = false; // Enables unstable_avoidThisFallback feature in Fizz +// React DOM Chopping Block +// +// Similar to main Chopping Block but only flags related to React DOM. These are +// grouped because we will likely batch all of them into a single major release. +// ----------------------------------------------------------------------------- +// Disable support for comment nodes as React DOM containers. Already disabled +// in open source, but www codebase still relies on it. Need to remove. +var disableCommentsAsDOMContainers = true; // Disable javascript: URL strings in href for XSS protection. +// and client rendering, mostly to allow JSX attributes to apply to the custom +// element's object properties instead of only HTML attributes. +// https://github.com/facebook/react/issues/11347 -function publishRegistrationName(registrationName, pluginModule, eventName) { - if (!!registrationNameModules[registrationName]) { - { - throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" + registrationName + "`." ); - } - } +var enableCustomElementPropertySupport = false; // Disables children for