@rebilly/framepay-react 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/.env.example +2 -0
  2. package/CHANGELOG.md +8 -0
  3. package/README.md +7 -6
  4. package/env.js +7 -0
  5. package/package.json +23 -17
  6. package/src/index.spec.ts +19 -0
  7. package/src/index.ts +42 -0
  8. package/src/lib/components/elements/applepay-element.tsx +36 -0
  9. package/src/lib/components/elements/bank-element.spec.tsx +119 -0
  10. package/src/lib/components/elements/bank-element.tsx +74 -0
  11. package/src/lib/components/elements/base-element.tsx +100 -0
  12. package/src/lib/components/elements/card-element.spec.tsx +113 -0
  13. package/src/lib/components/elements/card-element.tsx +73 -0
  14. package/src/lib/components/elements/googlepay-element.tsx +36 -0
  15. package/src/lib/components/elements/iban-element.spec.tsx +104 -0
  16. package/src/lib/components/elements/iban-element.tsx +75 -0
  17. package/src/lib/components/elements/paypal-element.tsx +36 -0
  18. package/src/lib/components/injector.spec.tsx +162 -0
  19. package/src/lib/components/injector.tsx +495 -0
  20. package/src/lib/components/provider.spec.tsx +98 -0
  21. package/src/lib/components/provider.tsx +111 -0
  22. package/src/lib/constants.ts +43 -0
  23. package/src/lib/context.ts +24 -0
  24. package/src/lib/dom-util.ts +35 -0
  25. package/src/lib/framepay-error.ts +59 -0
  26. package/src/lib/get-rebilly-api.ts +11 -0
  27. package/test/e2e/assets/prop-types.js +849 -0
  28. package/test/e2e/assets/react-0.14.0.js +18759 -0
  29. package/test/e2e/assets/react-15.0.0.js +19309 -0
  30. package/test/e2e/assets/react-16.js +3318 -0
  31. package/test/e2e/assets/react-17.js +3357 -0
  32. package/test/e2e/assets/react-18.js +3342 -0
  33. package/test/e2e/assets/react-dom-0.14.0.js +42 -0
  34. package/test/e2e/assets/react-dom-15.0.0.js +42 -0
  35. package/test/e2e/assets/react-dom-16.js +25147 -0
  36. package/test/e2e/assets/react-dom-17.js +26292 -0
  37. package/test/e2e/assets/react-dom-18.js +29869 -0
  38. package/test/e2e/cypress-support.js +2 -0
  39. package/test/e2e/cypress.d.ts +1 -0
  40. package/test/e2e/fixtures/apple-pay.html +15 -0
  41. package/test/e2e/fixtures/apple-pay.js +63 -0
  42. package/test/e2e/fixtures/bank-separate.html +12 -0
  43. package/test/e2e/fixtures/bank-separate.js +323 -0
  44. package/test/e2e/fixtures/card-separate-brands.html +12 -0
  45. package/test/e2e/fixtures/card-separate-brands.js +260 -0
  46. package/test/e2e/fixtures/card-separate-rebilly-fields.html +12 -0
  47. package/test/e2e/fixtures/card-separate-rebilly-fields.js +281 -0
  48. package/test/e2e/fixtures/card-separate.html +12 -0
  49. package/test/e2e/fixtures/card-separate.js +227 -0
  50. package/test/e2e/fixtures/checkout-combined.html +12 -0
  51. package/test/e2e/fixtures/checkout-combined.js +199 -0
  52. package/test/e2e/fixtures/google-pay.html +15 -0
  53. package/test/e2e/fixtures/google-pay.js +63 -0
  54. package/test/e2e/fixtures/iban.html +12 -0
  55. package/test/e2e/fixtures/iban.js +239 -0
  56. package/test/e2e/fixtures/multiple-methods.html +12 -0
  57. package/test/e2e/fixtures/multiple-methods.js +470 -0
  58. package/test/e2e/fixtures/nav.js +20 -0
  59. package/test/e2e/fixtures/paypal.html +15 -0
  60. package/test/e2e/fixtures/paypal.js +62 -0
  61. package/test/e2e/fixtures/style.css +55 -0
  62. package/test/e2e/fixtures/util.js +71 -0
  63. package/test/e2e/local-server.mjs +12 -0
  64. package/test/e2e/server.mjs +43 -0
  65. package/test/e2e/specs/bank-separate.cy.ts +27 -0
  66. package/test/e2e/specs/card-separate-brands.cy.ts +70 -0
  67. package/test/e2e/specs/card-separate.cy.ts +27 -0
  68. package/test/e2e/specs/checkout-combined.cy.ts +24 -0
  69. package/test/e2e/specs/google-pay.cy.ts +13 -0
  70. package/test/e2e/specs/iban.cy.ts +17 -0
  71. package/test/e2e/specs/multiple-methods.cy.ts +130 -0
  72. package/test/e2e/specs/paypal.cy.ts +13 -0
  73. package/test/e2e/specs/react-version.cy.ts +12 -0
  74. package/test/e2e/switch-react-version.js +42 -0
  75. package/test/e2e/tsconfig.json +8 -0
  76. package/test/unit/jest.config.js +29 -0
  77. package/test/unit/specs/declaration-mock.spec.tsx +143 -0
  78. package/tsconfig.json +31 -0
  79. package/tsconfig.spec.json +13 -0
  80. package/tslint.json +36 -0
@@ -0,0 +1,849 @@
1
+ (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.PropTypes = 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<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
+ /**
3
+ * Copyright (c) 2013-present, Facebook, Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ 'use strict';
10
+
11
+ var printWarning = function() {};
12
+
13
+ if ("development" !== 'production') {
14
+ var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
15
+ var loggedTypeFailures = {};
16
+
17
+ printWarning = function(text) {
18
+ var message = 'Warning: ' + text;
19
+ if (typeof console !== 'undefined') {
20
+ console.error(message);
21
+ }
22
+ try {
23
+ // --- Welcome to debugging React ---
24
+ // This error was thrown as a convenience so that you can use this stack
25
+ // to find the callsite that caused this warning to fire.
26
+ throw new Error(message);
27
+ } catch (x) {}
28
+ };
29
+ }
30
+
31
+ /**
32
+ * Assert that the values match with the type specs.
33
+ * Error messages are memorized and will only be shown once.
34
+ *
35
+ * @param {object} typeSpecs Map of name to a ReactPropType
36
+ * @param {object} values Runtime values that need to be type-checked
37
+ * @param {string} location e.g. "prop", "context", "child context"
38
+ * @param {string} componentName Name of the component for error messages.
39
+ * @param {?Function} getStack Returns the component stack.
40
+ * @private
41
+ */
42
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
43
+ if ("development" !== 'production') {
44
+ for (var typeSpecName in typeSpecs) {
45
+ if (typeSpecs.hasOwnProperty(typeSpecName)) {
46
+ var error;
47
+ // Prop type validation may throw. In case they do, we don't want to
48
+ // fail the render phase where it didn't fail before. So we log it.
49
+ // After these have been cleaned up, we'll let them throw.
50
+ try {
51
+ // This is intentionally an invariant that gets caught. It's the same
52
+ // behavior as without this statement except with a better message.
53
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
54
+ var err = Error(
55
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
56
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
57
+ );
58
+ err.name = 'Invariant Violation';
59
+ throw err;
60
+ }
61
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
62
+ } catch (ex) {
63
+ error = ex;
64
+ }
65
+ if (error && !(error instanceof Error)) {
66
+ printWarning(
67
+ (componentName || 'React class') + ': type specification of ' +
68
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
69
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
70
+ 'You may have forgotten to pass an argument to the type checker ' +
71
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
72
+ 'shape all require an argument).'
73
+ )
74
+
75
+ }
76
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
77
+ // Only monitor this failure once because there tends to be a lot of the
78
+ // same error.
79
+ loggedTypeFailures[error.message] = true;
80
+
81
+ var stack = getStack ? getStack() : '';
82
+
83
+ printWarning(
84
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
85
+ );
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ module.exports = checkPropTypes;
93
+
94
+ },{"./lib/ReactPropTypesSecret":5}],2:[function(require,module,exports){
95
+ /**
96
+ * Copyright (c) 2013-present, Facebook, Inc.
97
+ *
98
+ * This source code is licensed under the MIT license found in the
99
+ * LICENSE file in the root directory of this source tree.
100
+ */
101
+
102
+ 'use strict';
103
+
104
+ var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
105
+
106
+ function emptyFunction() {}
107
+
108
+ module.exports = function() {
109
+ function shim(props, propName, componentName, location, propFullName, secret) {
110
+ if (secret === ReactPropTypesSecret) {
111
+ // It is still safe when called from React.
112
+ return;
113
+ }
114
+ var err = new Error(
115
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
116
+ 'Use PropTypes.checkPropTypes() to call them. ' +
117
+ 'Read more at http://fb.me/use-check-prop-types'
118
+ );
119
+ err.name = 'Invariant Violation';
120
+ throw err;
121
+ };
122
+ shim.isRequired = shim;
123
+ function getShim() {
124
+ return shim;
125
+ };
126
+ // Important!
127
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
128
+ var ReactPropTypes = {
129
+ array: shim,
130
+ bool: shim,
131
+ func: shim,
132
+ number: shim,
133
+ object: shim,
134
+ string: shim,
135
+ symbol: shim,
136
+
137
+ any: shim,
138
+ arrayOf: getShim,
139
+ element: shim,
140
+ instanceOf: getShim,
141
+ node: shim,
142
+ objectOf: getShim,
143
+ oneOf: getShim,
144
+ oneOfType: getShim,
145
+ shape: getShim,
146
+ exact: getShim
147
+ };
148
+
149
+ ReactPropTypes.checkPropTypes = emptyFunction;
150
+ ReactPropTypes.PropTypes = ReactPropTypes;
151
+
152
+ return ReactPropTypes;
153
+ };
154
+
155
+ },{"./lib/ReactPropTypesSecret":5}],3:[function(require,module,exports){
156
+ /**
157
+ * Copyright (c) 2013-present, Facebook, Inc.
158
+ *
159
+ * This source code is licensed under the MIT license found in the
160
+ * LICENSE file in the root directory of this source tree.
161
+ */
162
+
163
+ 'use strict';
164
+
165
+ var assign = require('object-assign');
166
+
167
+ var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
168
+ var checkPropTypes = require('./checkPropTypes');
169
+
170
+ var printWarning = function() {};
171
+
172
+ if ("development" !== 'production') {
173
+ printWarning = function(text) {
174
+ var message = 'Warning: ' + text;
175
+ if (typeof console !== 'undefined') {
176
+ console.error(message);
177
+ }
178
+ try {
179
+ // --- Welcome to debugging React ---
180
+ // This error was thrown as a convenience so that you can use this stack
181
+ // to find the callsite that caused this warning to fire.
182
+ throw new Error(message);
183
+ } catch (x) {}
184
+ };
185
+ }
186
+
187
+ function emptyFunctionThatReturnsNull() {
188
+ return null;
189
+ }
190
+
191
+ module.exports = function(isValidElement, throwOnDirectAccess) {
192
+ /* global Symbol */
193
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
194
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
195
+
196
+ /**
197
+ * Returns the iterator method function contained on the iterable object.
198
+ *
199
+ * Be sure to invoke the function with the iterable as context:
200
+ *
201
+ * var iteratorFn = getIteratorFn(myIterable);
202
+ * if (iteratorFn) {
203
+ * var iterator = iteratorFn.call(myIterable);
204
+ * ...
205
+ * }
206
+ *
207
+ * @param {?object} maybeIterable
208
+ * @return {?function}
209
+ */
210
+ function getIteratorFn(maybeIterable) {
211
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
212
+ if (typeof iteratorFn === 'function') {
213
+ return iteratorFn;
214
+ }
215
+ }
216
+
217
+ /**
218
+ * Collection of methods that allow declaration and validation of props that are
219
+ * supplied to React components. Example usage:
220
+ *
221
+ * var Props = require('ReactPropTypes');
222
+ * var MyArticle = React.createClass({
223
+ * propTypes: {
224
+ * // An optional string prop named "description".
225
+ * description: Props.string,
226
+ *
227
+ * // A required enum prop named "category".
228
+ * category: Props.oneOf(['News','Photos']).isRequired,
229
+ *
230
+ * // A prop named "dialog" that requires an instance of Dialog.
231
+ * dialog: Props.instanceOf(Dialog).isRequired
232
+ * },
233
+ * render: function() { ... }
234
+ * });
235
+ *
236
+ * A more formal specification of how these methods are used:
237
+ *
238
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
239
+ * decl := ReactPropTypes.{type}(.isRequired)?
240
+ *
241
+ * Each and every declaration produces a function with the same signature. This
242
+ * allows the creation of custom validation functions. For example:
243
+ *
244
+ * var MyLink = React.createClass({
245
+ * propTypes: {
246
+ * // An optional string or URI prop named "href".
247
+ * href: function(props, propName, componentName) {
248
+ * var propValue = props[propName];
249
+ * if (propValue != null && typeof propValue !== 'string' &&
250
+ * !(propValue instanceof URI)) {
251
+ * return new Error(
252
+ * 'Expected a string or an URI for ' + propName + ' in ' +
253
+ * componentName
254
+ * );
255
+ * }
256
+ * }
257
+ * },
258
+ * render: function() {...}
259
+ * });
260
+ *
261
+ * @internal
262
+ */
263
+
264
+ var ANONYMOUS = '<<anonymous>>';
265
+
266
+ // Important!
267
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
268
+ var ReactPropTypes = {
269
+ array: createPrimitiveTypeChecker('array'),
270
+ bool: createPrimitiveTypeChecker('boolean'),
271
+ func: createPrimitiveTypeChecker('function'),
272
+ number: createPrimitiveTypeChecker('number'),
273
+ object: createPrimitiveTypeChecker('object'),
274
+ string: createPrimitiveTypeChecker('string'),
275
+ symbol: createPrimitiveTypeChecker('symbol'),
276
+
277
+ any: createAnyTypeChecker(),
278
+ arrayOf: createArrayOfTypeChecker,
279
+ element: createElementTypeChecker(),
280
+ instanceOf: createInstanceTypeChecker,
281
+ node: createNodeChecker(),
282
+ objectOf: createObjectOfTypeChecker,
283
+ oneOf: createEnumTypeChecker,
284
+ oneOfType: createUnionTypeChecker,
285
+ shape: createShapeTypeChecker,
286
+ exact: createStrictShapeTypeChecker,
287
+ };
288
+
289
+ /**
290
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
291
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
292
+ */
293
+ /*eslint-disable no-self-compare*/
294
+ function is(x, y) {
295
+ // SameValue algorithm
296
+ if (x === y) {
297
+ // Steps 1-5, 7-10
298
+ // Steps 6.b-6.e: +0 != -0
299
+ return x !== 0 || 1 / x === 1 / y;
300
+ } else {
301
+ // Step 6.a: NaN == NaN
302
+ return x !== x && y !== y;
303
+ }
304
+ }
305
+ /*eslint-enable no-self-compare*/
306
+
307
+ /**
308
+ * We use an Error-like object for backward compatibility as people may call
309
+ * PropTypes directly and inspect their output. However, we don't use real
310
+ * Errors anymore. We don't inspect their stack anyway, and creating them
311
+ * is prohibitively expensive if they are created too often, such as what
312
+ * happens in oneOfType() for any type before the one that matched.
313
+ */
314
+ function PropTypeError(message) {
315
+ this.message = message;
316
+ this.stack = '';
317
+ }
318
+ // Make `instanceof Error` still work for returned errors.
319
+ PropTypeError.prototype = Error.prototype;
320
+
321
+ function createChainableTypeChecker(validate) {
322
+ if ("development" !== 'production') {
323
+ var manualPropTypeCallCache = {};
324
+ var manualPropTypeWarningCount = 0;
325
+ }
326
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
327
+ componentName = componentName || ANONYMOUS;
328
+ propFullName = propFullName || propName;
329
+
330
+ if (secret !== ReactPropTypesSecret) {
331
+ if (throwOnDirectAccess) {
332
+ // New behavior only for users of `prop-types` package
333
+ var err = new Error(
334
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
335
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
336
+ 'Read more at http://fb.me/use-check-prop-types'
337
+ );
338
+ err.name = 'Invariant Violation';
339
+ throw err;
340
+ } else if ("development" !== 'production' && typeof console !== 'undefined') {
341
+ // Old behavior for people using React.PropTypes
342
+ var cacheKey = componentName + ':' + propName;
343
+ if (
344
+ !manualPropTypeCallCache[cacheKey] &&
345
+ // Avoid spamming the console because they are often not actionable except for lib authors
346
+ manualPropTypeWarningCount < 3
347
+ ) {
348
+ printWarning(
349
+ 'You are manually calling a React.PropTypes validation ' +
350
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
351
+ 'and will throw in the standalone `prop-types` package. ' +
352
+ 'You may be seeing this warning due to a third-party PropTypes ' +
353
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
354
+ );
355
+ manualPropTypeCallCache[cacheKey] = true;
356
+ manualPropTypeWarningCount++;
357
+ }
358
+ }
359
+ }
360
+ if (props[propName] == null) {
361
+ if (isRequired) {
362
+ if (props[propName] === null) {
363
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
364
+ }
365
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
366
+ }
367
+ return null;
368
+ } else {
369
+ return validate(props, propName, componentName, location, propFullName);
370
+ }
371
+ }
372
+
373
+ var chainedCheckType = checkType.bind(null, false);
374
+ chainedCheckType.isRequired = checkType.bind(null, true);
375
+
376
+ return chainedCheckType;
377
+ }
378
+
379
+ function createPrimitiveTypeChecker(expectedType) {
380
+ function validate(props, propName, componentName, location, propFullName, secret) {
381
+ var propValue = props[propName];
382
+ var propType = getPropType(propValue);
383
+ if (propType !== expectedType) {
384
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
385
+ // check, but we can offer a more precise error message here rather than
386
+ // 'of type `object`'.
387
+ var preciseType = getPreciseType(propValue);
388
+
389
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
390
+ }
391
+ return null;
392
+ }
393
+ return createChainableTypeChecker(validate);
394
+ }
395
+
396
+ function createAnyTypeChecker() {
397
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
398
+ }
399
+
400
+ function createArrayOfTypeChecker(typeChecker) {
401
+ function validate(props, propName, componentName, location, propFullName) {
402
+ if (typeof typeChecker !== 'function') {
403
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
404
+ }
405
+ var propValue = props[propName];
406
+ if (!Array.isArray(propValue)) {
407
+ var propType = getPropType(propValue);
408
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
409
+ }
410
+ for (var i = 0; i < propValue.length; i++) {
411
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
412
+ if (error instanceof Error) {
413
+ return error;
414
+ }
415
+ }
416
+ return null;
417
+ }
418
+ return createChainableTypeChecker(validate);
419
+ }
420
+
421
+ function createElementTypeChecker() {
422
+ function validate(props, propName, componentName, location, propFullName) {
423
+ var propValue = props[propName];
424
+ if (!isValidElement(propValue)) {
425
+ var propType = getPropType(propValue);
426
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
427
+ }
428
+ return null;
429
+ }
430
+ return createChainableTypeChecker(validate);
431
+ }
432
+
433
+ function createInstanceTypeChecker(expectedClass) {
434
+ function validate(props, propName, componentName, location, propFullName) {
435
+ if (!(props[propName] instanceof expectedClass)) {
436
+ var expectedClassName = expectedClass.name || ANONYMOUS;
437
+ var actualClassName = getClassName(props[propName]);
438
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
439
+ }
440
+ return null;
441
+ }
442
+ return createChainableTypeChecker(validate);
443
+ }
444
+
445
+ function createEnumTypeChecker(expectedValues) {
446
+ if (!Array.isArray(expectedValues)) {
447
+ "development" !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
448
+ return emptyFunctionThatReturnsNull;
449
+ }
450
+
451
+ function validate(props, propName, componentName, location, propFullName) {
452
+ var propValue = props[propName];
453
+ for (var i = 0; i < expectedValues.length; i++) {
454
+ if (is(propValue, expectedValues[i])) {
455
+ return null;
456
+ }
457
+ }
458
+
459
+ var valuesString = JSON.stringify(expectedValues);
460
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
461
+ }
462
+ return createChainableTypeChecker(validate);
463
+ }
464
+
465
+ function createObjectOfTypeChecker(typeChecker) {
466
+ function validate(props, propName, componentName, location, propFullName) {
467
+ if (typeof typeChecker !== 'function') {
468
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
469
+ }
470
+ var propValue = props[propName];
471
+ var propType = getPropType(propValue);
472
+ if (propType !== 'object') {
473
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
474
+ }
475
+ for (var key in propValue) {
476
+ if (propValue.hasOwnProperty(key)) {
477
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
478
+ if (error instanceof Error) {
479
+ return error;
480
+ }
481
+ }
482
+ }
483
+ return null;
484
+ }
485
+ return createChainableTypeChecker(validate);
486
+ }
487
+
488
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
489
+ if (!Array.isArray(arrayOfTypeCheckers)) {
490
+ "development" !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
491
+ return emptyFunctionThatReturnsNull;
492
+ }
493
+
494
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
495
+ var checker = arrayOfTypeCheckers[i];
496
+ if (typeof checker !== 'function') {
497
+ printWarning(
498
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
499
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
500
+ );
501
+ return emptyFunctionThatReturnsNull;
502
+ }
503
+ }
504
+
505
+ function validate(props, propName, componentName, location, propFullName) {
506
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
507
+ var checker = arrayOfTypeCheckers[i];
508
+ if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
509
+ return null;
510
+ }
511
+ }
512
+
513
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
514
+ }
515
+ return createChainableTypeChecker(validate);
516
+ }
517
+
518
+ function createNodeChecker() {
519
+ function validate(props, propName, componentName, location, propFullName) {
520
+ if (!isNode(props[propName])) {
521
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
522
+ }
523
+ return null;
524
+ }
525
+ return createChainableTypeChecker(validate);
526
+ }
527
+
528
+ function createShapeTypeChecker(shapeTypes) {
529
+ function validate(props, propName, componentName, location, propFullName) {
530
+ var propValue = props[propName];
531
+ var propType = getPropType(propValue);
532
+ if (propType !== 'object') {
533
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
534
+ }
535
+ for (var key in shapeTypes) {
536
+ var checker = shapeTypes[key];
537
+ if (!checker) {
538
+ continue;
539
+ }
540
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
541
+ if (error) {
542
+ return error;
543
+ }
544
+ }
545
+ return null;
546
+ }
547
+ return createChainableTypeChecker(validate);
548
+ }
549
+
550
+ function createStrictShapeTypeChecker(shapeTypes) {
551
+ function validate(props, propName, componentName, location, propFullName) {
552
+ var propValue = props[propName];
553
+ var propType = getPropType(propValue);
554
+ if (propType !== 'object') {
555
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
556
+ }
557
+ // We need to check all keys in case some are required but missing from
558
+ // props.
559
+ var allKeys = assign({}, props[propName], shapeTypes);
560
+ for (var key in allKeys) {
561
+ var checker = shapeTypes[key];
562
+ if (!checker) {
563
+ return new PropTypeError(
564
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
565
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
566
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
567
+ );
568
+ }
569
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
570
+ if (error) {
571
+ return error;
572
+ }
573
+ }
574
+ return null;
575
+ }
576
+
577
+ return createChainableTypeChecker(validate);
578
+ }
579
+
580
+ function isNode(propValue) {
581
+ switch (typeof propValue) {
582
+ case 'number':
583
+ case 'string':
584
+ case 'undefined':
585
+ return true;
586
+ case 'boolean':
587
+ return !propValue;
588
+ case 'object':
589
+ if (Array.isArray(propValue)) {
590
+ return propValue.every(isNode);
591
+ }
592
+ if (propValue === null || isValidElement(propValue)) {
593
+ return true;
594
+ }
595
+
596
+ var iteratorFn = getIteratorFn(propValue);
597
+ if (iteratorFn) {
598
+ var iterator = iteratorFn.call(propValue);
599
+ var step;
600
+ if (iteratorFn !== propValue.entries) {
601
+ while (!(step = iterator.next()).done) {
602
+ if (!isNode(step.value)) {
603
+ return false;
604
+ }
605
+ }
606
+ } else {
607
+ // Iterator will provide entry [k,v] tuples rather than values.
608
+ while (!(step = iterator.next()).done) {
609
+ var entry = step.value;
610
+ if (entry) {
611
+ if (!isNode(entry[1])) {
612
+ return false;
613
+ }
614
+ }
615
+ }
616
+ }
617
+ } else {
618
+ return false;
619
+ }
620
+
621
+ return true;
622
+ default:
623
+ return false;
624
+ }
625
+ }
626
+
627
+ function isSymbol(propType, propValue) {
628
+ // Native Symbol.
629
+ if (propType === 'symbol') {
630
+ return true;
631
+ }
632
+
633
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
634
+ if (propValue['@@toStringTag'] === 'Symbol') {
635
+ return true;
636
+ }
637
+
638
+ // Fallback for non-spec compliant Symbols which are polyfilled.
639
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
640
+ return true;
641
+ }
642
+
643
+ return false;
644
+ }
645
+
646
+ // Equivalent of `typeof` but with special handling for array and regexp.
647
+ function getPropType(propValue) {
648
+ var propType = typeof propValue;
649
+ if (Array.isArray(propValue)) {
650
+ return 'array';
651
+ }
652
+ if (propValue instanceof RegExp) {
653
+ // Old webkits (at least until Android 4.0) return 'function' rather than
654
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
655
+ // passes PropTypes.object.
656
+ return 'object';
657
+ }
658
+ if (isSymbol(propType, propValue)) {
659
+ return 'symbol';
660
+ }
661
+ return propType;
662
+ }
663
+
664
+ // This handles more types than `getPropType`. Only used for error messages.
665
+ // See `createPrimitiveTypeChecker`.
666
+ function getPreciseType(propValue) {
667
+ if (typeof propValue === 'undefined' || propValue === null) {
668
+ return '' + propValue;
669
+ }
670
+ var propType = getPropType(propValue);
671
+ if (propType === 'object') {
672
+ if (propValue instanceof Date) {
673
+ return 'date';
674
+ } else if (propValue instanceof RegExp) {
675
+ return 'regexp';
676
+ }
677
+ }
678
+ return propType;
679
+ }
680
+
681
+ // Returns a string that is postfixed to a warning about an invalid type.
682
+ // For example, "undefined" or "of type array"
683
+ function getPostfixForTypeWarning(value) {
684
+ var type = getPreciseType(value);
685
+ switch (type) {
686
+ case 'array':
687
+ case 'object':
688
+ return 'an ' + type;
689
+ case 'boolean':
690
+ case 'date':
691
+ case 'regexp':
692
+ return 'a ' + type;
693
+ default:
694
+ return type;
695
+ }
696
+ }
697
+
698
+ // Returns class name of the object, if any.
699
+ function getClassName(propValue) {
700
+ if (!propValue.constructor || !propValue.constructor.name) {
701
+ return ANONYMOUS;
702
+ }
703
+ return propValue.constructor.name;
704
+ }
705
+
706
+ ReactPropTypes.checkPropTypes = checkPropTypes;
707
+ ReactPropTypes.PropTypes = ReactPropTypes;
708
+
709
+ return ReactPropTypes;
710
+ };
711
+
712
+ },{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"object-assign":6}],4:[function(require,module,exports){
713
+ /**
714
+ * Copyright (c) 2013-present, Facebook, Inc.
715
+ *
716
+ * This source code is licensed under the MIT license found in the
717
+ * LICENSE file in the root directory of this source tree.
718
+ */
719
+
720
+ if ("development" !== 'production') {
721
+ var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
722
+ Symbol.for &&
723
+ Symbol.for('react.element')) ||
724
+ 0xeac7;
725
+
726
+ var isValidElement = function(object) {
727
+ return typeof object === 'object' &&
728
+ object !== null &&
729
+ object.$$typeof === REACT_ELEMENT_TYPE;
730
+ };
731
+
732
+ // By explicitly using `prop-types` you are opting into new development behavior.
733
+ // http://fb.me/prop-types-in-prod
734
+ var throwOnDirectAccess = true;
735
+ module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);
736
+ } else {
737
+ // By explicitly using `prop-types` you are opting into new production behavior.
738
+ // http://fb.me/prop-types-in-prod
739
+ module.exports = require('./factoryWithThrowingShims')();
740
+ }
741
+
742
+ },{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3}],5:[function(require,module,exports){
743
+ /**
744
+ * Copyright (c) 2013-present, Facebook, Inc.
745
+ *
746
+ * This source code is licensed under the MIT license found in the
747
+ * LICENSE file in the root directory of this source tree.
748
+ */
749
+
750
+ 'use strict';
751
+
752
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
753
+
754
+ module.exports = ReactPropTypesSecret;
755
+
756
+ },{}],6:[function(require,module,exports){
757
+ /*
758
+ object-assign
759
+ (c) Sindre Sorhus
760
+ @license MIT
761
+ */
762
+
763
+ 'use strict';
764
+ /* eslint-disable no-unused-vars */
765
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
766
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
767
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
768
+
769
+ function toObject(val) {
770
+ if (val === null || val === undefined) {
771
+ throw new TypeError('Object.assign cannot be called with null or undefined');
772
+ }
773
+
774
+ return Object(val);
775
+ }
776
+
777
+ function shouldUseNative() {
778
+ try {
779
+ if (!Object.assign) {
780
+ return false;
781
+ }
782
+
783
+ // Detect buggy property enumeration order in older V8 versions.
784
+
785
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
786
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
787
+ test1[5] = 'de';
788
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
789
+ return false;
790
+ }
791
+
792
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
793
+ var test2 = {};
794
+ for (var i = 0; i < 10; i++) {
795
+ test2['_' + String.fromCharCode(i)] = i;
796
+ }
797
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
798
+ return test2[n];
799
+ });
800
+ if (order2.join('') !== '0123456789') {
801
+ return false;
802
+ }
803
+
804
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
805
+ var test3 = {};
806
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
807
+ test3[letter] = letter;
808
+ });
809
+ if (Object.keys(Object.assign({}, test3)).join('') !==
810
+ 'abcdefghijklmnopqrst') {
811
+ return false;
812
+ }
813
+
814
+ return true;
815
+ } catch (err) {
816
+ // We don't expect any of the above to throw, but better to be safe.
817
+ return false;
818
+ }
819
+ }
820
+
821
+ module.exports = shouldUseNative() ? Object.assign : function (target, source) {
822
+ var from;
823
+ var to = toObject(target);
824
+ var symbols;
825
+
826
+ for (var s = 1; s < arguments.length; s++) {
827
+ from = Object(arguments[s]);
828
+
829
+ for (var key in from) {
830
+ if (hasOwnProperty.call(from, key)) {
831
+ to[key] = from[key];
832
+ }
833
+ }
834
+
835
+ if (getOwnPropertySymbols) {
836
+ symbols = getOwnPropertySymbols(from);
837
+ for (var i = 0; i < symbols.length; i++) {
838
+ if (propIsEnumerable.call(from, symbols[i])) {
839
+ to[symbols[i]] = from[symbols[i]];
840
+ }
841
+ }
842
+ }
843
+ }
844
+
845
+ return to;
846
+ };
847
+
848
+ },{}]},{},[4])(4)
849
+ });