PluginProbe
PayPlug for WooCommerce (Official) / 3.1.0
PayPlug for WooCommerce (Official) v3.1.0
3.1.0 3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 All 102 releases
payplug / assets / js / blocks / wc-payplug-american_express-blocks.js

wc-payplug-american_express-blocks.js in PayPlug for WooCommerce (Official) 3.1.0, at assets/js/blocks/wc-payplug-american_express-blocks.js

1,728 lines 56.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /******/ "use strict";
3 /******/ var __webpack_modules__ = ({
4
5 /***/ "./resources/js/frontend/helper/wc-payplug-requests.js":
6 /*!*************************************************************!*\
7 !*** ./resources/js/frontend/helper/wc-payplug-requests.js ***!
8 \*************************************************************/
9 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10
11 __webpack_require__.r(__webpack_exports__);
12 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13 /* harmony export */ check_payment: () => (/* binding */ check_payment),
14 /* harmony export */ getPayment: () => (/* binding */ getPayment)
15 /* harmony export */ });
16 /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings");
17 /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__);
18 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ "jquery");
19 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);
20
21
22 const settings = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('payplug_data', {});
23 const getPayment = (props, _settings, order_id) => {
24 const data = getPaymentData(props);
25 return new Promise((resolve, reject) => {
26 return jquery__WEBPACK_IMPORTED_MODULE_1___default().ajax({
27 type: 'POST',
28 data: data,
29 url: settings.payplug_create_intent_payment
30 }).done(function (response) {
31 resolve(response);
32 }).fail(function (error) {
33 reject(error);
34 });
35 });
36 function getPaymentData(props) {
37 return {
38 "order_id": order_id,
39 "woocommerce-process-checkout-nonce": settings.wp_nonce,
40 "gateway": _settings?.payment_method
41 };
42 }
43 };
44 const check_payment = data => {
45 return new Promise((resolve, reject) => {
46 jquery__WEBPACK_IMPORTED_MODULE_1___default().ajax({
47 type: 'POST',
48 data: data,
49 url: settings.payplug_integrated_payment_check_payment_url
50 }).done(function (response) {
51 resolve(response);
52 }).fail(function (error) {
53 reject(error); // NOT WORKING!!
54 });
55 });
56 };
57
58 /***/ }),
59
60 /***/ "./resources/js/frontend/wc-payplug-popup-blocks.js":
61 /*!**********************************************************!*\
62 !*** ./resources/js/frontend/wc-payplug-popup-blocks.js ***!
63 \**********************************************************/
64 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
65
66 __webpack_require__.r(__webpack_exports__);
67 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
68 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
69 /* harmony export */ });
70 /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings");
71 /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__);
72 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react");
73 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
74 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
75 /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__);
76 /* harmony import */ var _helper_wc_payplug_requests__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helper/wc-payplug-requests */ "./resources/js/frontend/helper/wc-payplug-requests.js");
77 /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js");
78
79
80
81
82
83 const settings = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_0__.getSetting)('payplug_data', {});
84 const Popup = ({
85 props: props,
86 settings: _settings
87 }) => {
88 const {
89 eventRegistration,
90 emitResponse,
91 shouldSavePayment
92 } = props;
93 const {
94 onPaymentSetup,
95 onCheckoutSuccess
96 } = eventRegistration;
97 const {
98 CHECKOUT_STORE_KEY
99 } = window.wc.wcBlocksData;
100 const order_id = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.useSelect)(select => select(CHECKOUT_STORE_KEY).getOrderId());
101 let getPaymentData;
102 (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
103 const handlePaymentProcessing = async () => {
104 let result = {};
105 await (0,_helper_wc_payplug_requests__WEBPACK_IMPORTED_MODULE_3__.getPayment)(props, _settings, order_id).then(async response => {
106 getPaymentData = response;
107 });
108 return {
109 type: 'success'
110 };
111 };
112 const unsubscribeAfterProcessing = onPaymentSetup(handlePaymentProcessing);
113 return () => {
114 unsubscribeAfterProcessing();
115 };
116 }, [shouldSavePayment, onPaymentSetup, emitResponse.noticeContexts.PAYMENTS, emitResponse.responseTypes.ERROR, emitResponse.responseTypes.SUCCESS]);
117 (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => {
118 const handlePaymentProcessing = async ({
119 processingResponse: {
120 paymentDetails
121 }
122 }) => {
123 await showPopupPayment(getPaymentData).then(() => {
124 return {
125 type: "error",
126 message: "Timeout",
127 messageContext: emitResponse.noticeContexts.PAYMENTS
128 };
129 });
130 function showPopupPayment(getPaymentData) {
131 return new Promise(async (resolve, reject) => {
132 try {
133 window.redirection_url = getPaymentData.data.cancel || false;
134 await Payplug.showPayment(getPaymentData.data.redirect);
135 } catch (e) {
136 reject(e);
137 }
138 });
139 }
140 };
141 const unsubscribeAfterProcessing = onCheckoutSuccess(handlePaymentProcessing);
142 return () => {
143 unsubscribeAfterProcessing();
144 };
145 }, [onCheckoutSuccess]);
146 return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, {});
147 };
148 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Popup);
149
150 /***/ }),
151
152 /***/ "./node_modules/react/cjs/react-jsx-runtime.development.js":
153 /*!*****************************************************************!*\
154 !*** ./node_modules/react/cjs/react-jsx-runtime.development.js ***!
155 \*****************************************************************/
156 /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
157
158 /**
159 * @license React
160 * react-jsx-runtime.development.js
161 *
162 * Copyright (c) Facebook, Inc. and its affiliates.
163 *
164 * This source code is licensed under the MIT license found in the
165 * LICENSE file in the root directory of this source tree.
166 */
167
168
169
170 if (true) {
171 (function() {
172 'use strict';
173
174 var React = __webpack_require__(/*! react */ "react");
175
176 // ATTENTION
177 // When adding new symbols to this file,
178 // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
179 // The Symbol used to tag the ReactElement-like types.
180 var REACT_ELEMENT_TYPE = Symbol.for('react.element');
181 var REACT_PORTAL_TYPE = Symbol.for('react.portal');
182 var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
183 var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
184 var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
185 var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
186 var REACT_CONTEXT_TYPE = Symbol.for('react.context');
187 var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
188 var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
189 var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
190 var REACT_MEMO_TYPE = Symbol.for('react.memo');
191 var REACT_LAZY_TYPE = Symbol.for('react.lazy');
192 var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
193 var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
194 var FAUX_ITERATOR_SYMBOL = '@@iterator';
195 function getIteratorFn(maybeIterable) {
196 if (maybeIterable === null || typeof maybeIterable !== 'object') {
197 return null;
198 }
199
200 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
201
202 if (typeof maybeIterator === 'function') {
203 return maybeIterator;
204 }
205
206 return null;
207 }
208
209 var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
210
211 function error(format) {
212 {
213 {
214 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
215 args[_key2 - 1] = arguments[_key2];
216 }
217
218 printWarning('error', format, args);
219 }
220 }
221 }
222
223 function printWarning(level, format, args) {
224 // When changing this logic, you might want to also
225 // update consoleWithStackDev.www.js as well.
226 {
227 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
228 var stack = ReactDebugCurrentFrame.getStackAddendum();
229
230 if (stack !== '') {
231 format += '%s';
232 args = args.concat([stack]);
233 } // eslint-disable-next-line react-internal/safe-string-coercion
234
235
236 var argsWithFormat = args.map(function (item) {
237 return String(item);
238 }); // Careful: RN currently depends on this prefix
239
240 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
241 // breaks IE9: https://github.com/facebook/react/issues/13610
242 // eslint-disable-next-line react-internal/no-production-logging
243
244 Function.prototype.apply.call(console[level], console, argsWithFormat);
245 }
246 }
247
248 // -----------------------------------------------------------------------------
249
250 var enableScopeAPI = false; // Experimental Create Event Handle API.
251 var enableCacheElement = false;
252 var enableTransitionTracing = false; // No known bugs, but needs performance testing
253
254 var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
255 // stuff. Intended to enable React core members to more easily debug scheduling
256 // issues in DEV builds.
257
258 var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
259
260 var REACT_MODULE_REFERENCE;
261
262 {
263 REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
264 }
265
266 function isValidElementType(type) {
267 if (typeof type === 'string' || typeof type === 'function') {
268 return true;
269 } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
270
271
272 if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
273 return true;
274 }
275
276 if (typeof type === 'object' && type !== null) {
277 if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
278 // types supported by any Flight configuration anywhere since
279 // we don't know which Flight build this will end up being used
280 // with.
281 type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
282 return true;
283 }
284 }
285
286 return false;
287 }
288
289 function getWrappedName(outerType, innerType, wrapperName) {
290 var displayName = outerType.displayName;
291
292 if (displayName) {
293 return displayName;
294 }
295
296 var functionName = innerType.displayName || innerType.name || '';
297 return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
298 } // Keep in sync with react-reconciler/getComponentNameFromFiber
299
300
301 function getContextName(type) {
302 return type.displayName || 'Context';
303 } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
304
305
306 function getComponentNameFromType(type) {
307 if (type == null) {
308 // Host root, text node or just invalid type.
309 return null;
310 }
311
312 {
313 if (typeof type.tag === 'number') {
314 error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
315 }
316 }
317
318 if (typeof type === 'function') {
319 return type.displayName || type.name || null;
320 }
321
322 if (typeof type === 'string') {
323 return type;
324 }
325
326 switch (type) {
327 case REACT_FRAGMENT_TYPE:
328 return 'Fragment';
329
330 case REACT_PORTAL_TYPE:
331 return 'Portal';
332
333 case REACT_PROFILER_TYPE:
334 return 'Profiler';
335
336 case REACT_STRICT_MODE_TYPE:
337 return 'StrictMode';
338
339 case REACT_SUSPENSE_TYPE:
340 return 'Suspense';
341
342 case REACT_SUSPENSE_LIST_TYPE:
343 return 'SuspenseList';
344
345 }
346
347 if (typeof type === 'object') {
348 switch (type.$$typeof) {
349 case REACT_CONTEXT_TYPE:
350 var context = type;
351 return getContextName(context) + '.Consumer';
352
353 case REACT_PROVIDER_TYPE:
354 var provider = type;
355 return getContextName(provider._context) + '.Provider';
356
357 case REACT_FORWARD_REF_TYPE:
358 return getWrappedName(type, type.render, 'ForwardRef');
359
360 case REACT_MEMO_TYPE:
361 var outerName = type.displayName || null;
362
363 if (outerName !== null) {
364 return outerName;
365 }
366
367 return getComponentNameFromType(type.type) || 'Memo';
368
369 case REACT_LAZY_TYPE:
370 {
371 var lazyComponent = type;
372 var payload = lazyComponent._payload;
373 var init = lazyComponent._init;
374
375 try {
376 return getComponentNameFromType(init(payload));
377 } catch (x) {
378 return null;
379 }
380 }
381
382 // eslint-disable-next-line no-fallthrough
383 }
384 }
385
386 return null;
387 }
388
389 var assign = Object.assign;
390
391 // Helpers to patch console.logs to avoid logging during side-effect free
392 // replaying on render function. This currently only patches the object
393 // lazily which won't cover if the log function was extracted eagerly.
394 // We could also eagerly patch the method.
395 var disabledDepth = 0;
396 var prevLog;
397 var prevInfo;
398 var prevWarn;
399 var prevError;
400 var prevGroup;
401 var prevGroupCollapsed;
402 var prevGroupEnd;
403
404 function disabledLog() {}
405
406 disabledLog.__reactDisabledLog = true;
407 function disableLogs() {
408 {
409 if (disabledDepth === 0) {
410 /* eslint-disable react-internal/no-production-logging */
411 prevLog = console.log;
412 prevInfo = console.info;
413 prevWarn = console.warn;
414 prevError = console.error;
415 prevGroup = console.group;
416 prevGroupCollapsed = console.groupCollapsed;
417 prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
418
419 var props = {
420 configurable: true,
421 enumerable: true,
422 value: disabledLog,
423 writable: true
424 }; // $FlowFixMe Flow thinks console is immutable.
425
426 Object.defineProperties(console, {
427 info: props,
428 log: props,
429 warn: props,
430 error: props,
431 group: props,
432 groupCollapsed: props,
433 groupEnd: props
434 });
435 /* eslint-enable react-internal/no-production-logging */
436 }
437
438 disabledDepth++;
439 }
440 }
441 function reenableLogs() {
442 {
443 disabledDepth--;
444
445 if (disabledDepth === 0) {
446 /* eslint-disable react-internal/no-production-logging */
447 var props = {
448 configurable: true,
449 enumerable: true,
450 writable: true
451 }; // $FlowFixMe Flow thinks console is immutable.
452
453 Object.defineProperties(console, {
454 log: assign({}, props, {
455 value: prevLog
456 }),
457 info: assign({}, props, {
458 value: prevInfo
459 }),
460 warn: assign({}, props, {
461 value: prevWarn
462 }),
463 error: assign({}, props, {
464 value: prevError
465 }),
466 group: assign({}, props, {
467 value: prevGroup
468 }),
469 groupCollapsed: assign({}, props, {
470 value: prevGroupCollapsed
471 }),
472 groupEnd: assign({}, props, {
473 value: prevGroupEnd
474 })
475 });
476 /* eslint-enable react-internal/no-production-logging */
477 }
478
479 if (disabledDepth < 0) {
480 error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
481 }
482 }
483 }
484
485 var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
486 var prefix;
487 function describeBuiltInComponentFrame(name, source, ownerFn) {
488 {
489 if (prefix === undefined) {
490 // Extract the VM specific prefix used by each line.
491 try {
492 throw Error();
493 } catch (x) {
494 var match = x.stack.trim().match(/\n( *(at )?)/);
495 prefix = match && match[1] || '';
496 }
497 } // We use the prefix to ensure our stacks line up with native stack frames.
498
499
500 return '\n' + prefix + name;
501 }
502 }
503 var reentry = false;
504 var componentFrameCache;
505
506 {
507 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
508 componentFrameCache = new PossiblyWeakMap();
509 }
510
511 function describeNativeComponentFrame(fn, construct) {
512 // If something asked for a stack inside a fake render, it should get ignored.
513 if ( !fn || reentry) {
514 return '';
515 }
516
517 {
518 var frame = componentFrameCache.get(fn);
519
520 if (frame !== undefined) {
521 return frame;
522 }
523 }
524
525 var control;
526 reentry = true;
527 var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
528
529 Error.prepareStackTrace = undefined;
530 var previousDispatcher;
531
532 {
533 previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
534 // for warnings.
535
536 ReactCurrentDispatcher.current = null;
537 disableLogs();
538 }
539
540 try {
541 // This should throw.
542 if (construct) {
543 // Something should be setting the props in the constructor.
544 var Fake = function () {
545 throw Error();
546 }; // $FlowFixMe
547
548
549 Object.defineProperty(Fake.prototype, 'props', {
550 set: function () {
551 // We use a throwing setter instead of frozen or non-writable props
552 // because that won't throw in a non-strict mode function.
553 throw Error();
554 }
555 });
556
557 if (typeof Reflect === 'object' && Reflect.construct) {
558 // We construct a different control for this case to include any extra
559 // frames added by the construct call.
560 try {
561 Reflect.construct(Fake, []);
562 } catch (x) {
563 control = x;
564 }
565
566 Reflect.construct(fn, [], Fake);
567 } else {
568 try {
569 Fake.call();
570 } catch (x) {
571 control = x;
572 }
573
574 fn.call(Fake.prototype);
575 }
576 } else {
577 try {
578 throw Error();
579 } catch (x) {
580 control = x;
581 }
582
583 fn();
584 }
585 } catch (sample) {
586 // This is inlined manually because closure doesn't do it for us.
587 if (sample && control && typeof sample.stack === 'string') {
588 // This extracts the first frame from the sample that isn't also in the control.
589 // Skipping one frame that we assume is the frame that calls the two.
590 var sampleLines = sample.stack.split('\n');
591 var controlLines = control.stack.split('\n');
592 var s = sampleLines.length - 1;
593 var c = controlLines.length - 1;
594
595 while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
596 // We expect at least one stack frame to be shared.
597 // Typically this will be the root most one. However, stack frames may be
598 // cut off due to maximum stack limits. In this case, one maybe cut off
599 // earlier than the other. We assume that the sample is longer or the same
600 // and there for cut off earlier. So we should find the root most frame in
601 // the sample somewhere in the control.
602 c--;
603 }
604
605 for (; s >= 1 && c >= 0; s--, c--) {
606 // Next we find the first one that isn't the same which should be the
607 // frame that called our sample function and the control.
608 if (sampleLines[s] !== controlLines[c]) {
609 // In V8, the first line is describing the message but other VMs don't.
610 // If we're about to return the first line, and the control is also on the same
611 // line, that's a pretty good indicator that our sample threw at same line as
612 // the control. I.e. before we entered the sample frame. So we ignore this result.
613 // This can happen if you passed a class to function component, or non-function.
614 if (s !== 1 || c !== 1) {
615 do {
616 s--;
617 c--; // We may still have similar intermediate frames from the construct call.
618 // The next one that isn't the same should be our match though.
619
620 if (c < 0 || sampleLines[s] !== controlLines[c]) {
621 // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
622 var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
623 // but we have a user-provided "displayName"
624 // splice it in to make the stack more readable.
625
626
627 if (fn.displayName && _frame.includes('<anonymous>')) {
628 _frame = _frame.replace('<anonymous>', fn.displayName);
629 }
630
631 {
632 if (typeof fn === 'function') {
633 componentFrameCache.set(fn, _frame);
634 }
635 } // Return the line we found.
636
637
638 return _frame;
639 }
640 } while (s >= 1 && c >= 0);
641 }
642
643 break;
644 }
645 }
646 }
647 } finally {
648 reentry = false;
649
650 {
651 ReactCurrentDispatcher.current = previousDispatcher;
652 reenableLogs();
653 }
654
655 Error.prepareStackTrace = previousPrepareStackTrace;
656 } // Fallback to just using the name if we couldn't make it throw.
657
658
659 var name = fn ? fn.displayName || fn.name : '';
660 var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
661
662 {
663 if (typeof fn === 'function') {
664 componentFrameCache.set(fn, syntheticFrame);
665 }
666 }
667
668 return syntheticFrame;
669 }
670 function describeFunctionComponentFrame(fn, source, ownerFn) {
671 {
672 return describeNativeComponentFrame(fn, false);
673 }
674 }
675
676 function shouldConstruct(Component) {
677 var prototype = Component.prototype;
678 return !!(prototype && prototype.isReactComponent);
679 }
680
681 function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
682
683 if (type == null) {
684 return '';
685 }
686
687 if (typeof type === 'function') {
688 {
689 return describeNativeComponentFrame(type, shouldConstruct(type));
690 }
691 }
692
693 if (typeof type === 'string') {
694 return describeBuiltInComponentFrame(type);
695 }
696
697 switch (type) {
698 case REACT_SUSPENSE_TYPE:
699 return describeBuiltInComponentFrame('Suspense');
700
701 case REACT_SUSPENSE_LIST_TYPE:
702 return describeBuiltInComponentFrame('SuspenseList');
703 }
704
705 if (typeof type === 'object') {
706 switch (type.$$typeof) {
707 case REACT_FORWARD_REF_TYPE:
708 return describeFunctionComponentFrame(type.render);
709
710 case REACT_MEMO_TYPE:
711 // Memo may contain any component type so we recursively resolve it.
712 return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
713
714 case REACT_LAZY_TYPE:
715 {
716 var lazyComponent = type;
717 var payload = lazyComponent._payload;
718 var init = lazyComponent._init;
719
720 try {
721 // Lazy may contain any component type so we recursively resolve it.
722 return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
723 } catch (x) {}
724 }
725 }
726 }
727
728 return '';
729 }
730
731 var hasOwnProperty = Object.prototype.hasOwnProperty;
732
733 var loggedTypeFailures = {};
734 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
735
736 function setCurrentlyValidatingElement(element) {
737 {
738 if (element) {
739 var owner = element._owner;
740 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
741 ReactDebugCurrentFrame.setExtraStackFrame(stack);
742 } else {
743 ReactDebugCurrentFrame.setExtraStackFrame(null);
744 }
745 }
746 }
747
748 function checkPropTypes(typeSpecs, values, location, componentName, element) {
749 {
750 // $FlowFixMe This is okay but Flow doesn't know it.
751 var has = Function.call.bind(hasOwnProperty);
752
753 for (var typeSpecName in typeSpecs) {
754 if (has(typeSpecs, typeSpecName)) {
755 var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
756 // fail the render phase where it didn't fail before. So we log it.
757 // After these have been cleaned up, we'll let them throw.
758
759 try {
760 // This is intentionally an invariant that gets caught. It's the same
761 // behavior as without this statement except with a better message.
762 if (typeof typeSpecs[typeSpecName] !== 'function') {
763 // eslint-disable-next-line react-internal/prod-error-codes
764 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] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
765 err.name = 'Invariant Violation';
766 throw err;
767 }
768
769 error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
770 } catch (ex) {
771 error$1 = ex;
772 }
773
774 if (error$1 && !(error$1 instanceof Error)) {
775 setCurrentlyValidatingElement(element);
776
777 error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
778
779 setCurrentlyValidatingElement(null);
780 }
781
782 if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
783 // Only monitor this failure once because there tends to be a lot of the
784 // same error.
785 loggedTypeFailures[error$1.message] = true;
786 setCurrentlyValidatingElement(element);
787
788 error('Failed %s type: %s', location, error$1.message);
789
790 setCurrentlyValidatingElement(null);
791 }
792 }
793 }
794 }
795 }
796
797 var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
798
799 function isArray(a) {
800 return isArrayImpl(a);
801 }
802
803 /*
804 * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
805 * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
806 *
807 * The functions in this module will throw an easier-to-understand,
808 * easier-to-debug exception with a clear errors message message explaining the
809 * problem. (Instead of a confusing exception thrown inside the implementation
810 * of the `value` object).
811 */
812 // $FlowFixMe only called in DEV, so void return is not possible.
813 function typeName(value) {
814 {
815 // toStringTag is needed for namespaced types like Temporal.Instant
816 var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
817 var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
818 return type;
819 }
820 } // $FlowFixMe only called in DEV, so void return is not possible.
821
822
823 function willCoercionThrow(value) {
824 {
825 try {
826 testStringCoercion(value);
827 return false;
828 } catch (e) {
829 return true;
830 }
831 }
832 }
833
834 function testStringCoercion(value) {
835 // If you ended up here by following an exception call stack, here's what's
836 // happened: you supplied an object or symbol value to React (as a prop, key,
837 // DOM attribute, CSS property, string ref, etc.) and when React tried to
838 // coerce it to a string using `'' + value`, an exception was thrown.
839 //
840 // The most common types that will cause this exception are `Symbol` instances
841 // and Temporal objects like `Temporal.Instant`. But any object that has a
842 // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
843 // exception. (Library authors do this to prevent users from using built-in
844 // numeric operators like `+` or comparison operators like `>=` because custom
845 // methods are needed to perform accurate arithmetic or comparison.)
846 //
847 // To fix the problem, coerce this object or symbol value to a string before
848 // passing it to React. The most reliable way is usually `String(value)`.
849 //
850 // To find which value is throwing, check the browser or debugger console.
851 // Before this exception was thrown, there should be `console.error` output
852 // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
853 // problem and how that type was used: key, atrribute, input value prop, etc.
854 // In most cases, this console output also shows the component and its
855 // ancestor components where the exception happened.
856 //
857 // eslint-disable-next-line react-internal/safe-string-coercion
858 return '' + value;
859 }
860 function checkKeyStringCoercion(value) {
861 {
862 if (willCoercionThrow(value)) {
863 error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
864
865 return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
866 }
867 }
868 }
869
870 var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
871 var RESERVED_PROPS = {
872 key: true,
873 ref: true,
874 __self: true,
875 __source: true
876 };
877 var specialPropKeyWarningShown;
878 var specialPropRefWarningShown;
879 var didWarnAboutStringRefs;
880
881 {
882 didWarnAboutStringRefs = {};
883 }
884
885 function hasValidRef(config) {
886 {
887 if (hasOwnProperty.call(config, 'ref')) {
888 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
889
890 if (getter && getter.isReactWarning) {
891 return false;
892 }
893 }
894 }
895
896 return config.ref !== undefined;
897 }
898
899 function hasValidKey(config) {
900 {
901 if (hasOwnProperty.call(config, 'key')) {
902 var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
903
904 if (getter && getter.isReactWarning) {
905 return false;
906 }
907 }
908 }
909
910 return config.key !== undefined;
911 }
912
913 function warnIfStringRefCannotBeAutoConverted(config, self) {
914 {
915 if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
916 var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
917
918 if (!didWarnAboutStringRefs[componentName]) {
919 error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
920
921 didWarnAboutStringRefs[componentName] = true;
922 }
923 }
924 }
925 }
926
927 function defineKeyPropWarningGetter(props, displayName) {
928 {
929 var warnAboutAccessingKey = function () {
930 if (!specialPropKeyWarningShown) {
931 specialPropKeyWarningShown = true;
932
933 error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
934 }
935 };
936
937 warnAboutAccessingKey.isReactWarning = true;
938 Object.defineProperty(props, 'key', {
939 get: warnAboutAccessingKey,
940 configurable: true
941 });
942 }
943 }
944
945 function defineRefPropWarningGetter(props, displayName) {
946 {
947 var warnAboutAccessingRef = function () {
948 if (!specialPropRefWarningShown) {
949 specialPropRefWarningShown = true;
950
951 error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
952 }
953 };
954
955 warnAboutAccessingRef.isReactWarning = true;
956 Object.defineProperty(props, 'ref', {
957 get: warnAboutAccessingRef,
958 configurable: true
959 });
960 }
961 }
962 /**
963 * Factory method to create a new React element. This no longer adheres to
964 * the class pattern, so do not use new to call it. Also, instanceof check
965 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
966 * if something is a React Element.
967 *
968 * @param {*} type
969 * @param {*} props
970 * @param {*} key
971 * @param {string|object} ref
972 * @param {*} owner
973 * @param {*} self A *temporary* helper to detect places where `this` is
974 * different from the `owner` when React.createElement is called, so that we
975 * can warn. We want to get rid of owner and replace string `ref`s with arrow
976 * functions, and as long as `this` and owner are the same, there will be no
977 * change in behavior.
978 * @param {*} source An annotation object (added by a transpiler or otherwise)
979 * indicating filename, line number, and/or other information.
980 * @internal
981 */
982
983
984 var ReactElement = function (type, key, ref, self, source, owner, props) {
985 var element = {
986 // This tag allows us to uniquely identify this as a React Element
987 $$typeof: REACT_ELEMENT_TYPE,
988 // Built-in properties that belong on the element
989 type: type,
990 key: key,
991 ref: ref,
992 props: props,
993 // Record the component responsible for creating this element.
994 _owner: owner
995 };
996
997 {
998 // The validation flag is currently mutative. We put it on
999 // an external backing store so that we can freeze the whole object.
1000 // This can be replaced with a WeakMap once they are implemented in
1001 // commonly used development environments.
1002 element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
1003 // the validation flag non-enumerable (where possible, which should
1004 // include every environment we run tests in), so the test framework
1005 // ignores it.
1006
1007 Object.defineProperty(element._store, 'validated', {
1008 configurable: false,
1009 enumerable: false,
1010 writable: true,
1011 value: false
1012 }); // self and source are DEV only properties.
1013
1014 Object.defineProperty(element, '_self', {
1015 configurable: false,
1016 enumerable: false,
1017 writable: false,
1018 value: self
1019 }); // Two elements created in two different places should be considered
1020 // equal for testing purposes and therefore we hide it from enumeration.
1021
1022 Object.defineProperty(element, '_source', {
1023 configurable: false,
1024 enumerable: false,
1025 writable: false,
1026 value: source
1027 });
1028
1029 if (Object.freeze) {
1030 Object.freeze(element.props);
1031 Object.freeze(element);
1032 }
1033 }
1034
1035 return element;
1036 };
1037 /**
1038 * https://github.com/reactjs/rfcs/pull/107
1039 * @param {*} type
1040 * @param {object} props
1041 * @param {string} key
1042 */
1043
1044 function jsxDEV(type, config, maybeKey, source, self) {
1045 {
1046 var propName; // Reserved names are extracted
1047
1048 var props = {};
1049 var key = null;
1050 var ref = null; // Currently, key can be spread in as a prop. This causes a potential
1051 // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
1052 // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
1053 // but as an intermediary step, we will use jsxDEV for everything except
1054 // <div {...props} key="Hi" />, because we aren't currently able to tell if
1055 // key is explicitly declared to be undefined or not.
1056
1057 if (maybeKey !== undefined) {
1058 {
1059 checkKeyStringCoercion(maybeKey);
1060 }
1061
1062 key = '' + maybeKey;
1063 }
1064
1065 if (hasValidKey(config)) {
1066 {
1067 checkKeyStringCoercion(config.key);
1068 }
1069
1070 key = '' + config.key;
1071 }
1072
1073 if (hasValidRef(config)) {
1074 ref = config.ref;
1075 warnIfStringRefCannotBeAutoConverted(config, self);
1076 } // Remaining properties are added to a new props object
1077
1078
1079 for (propName in config) {
1080 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
1081 props[propName] = config[propName];
1082 }
1083 } // Resolve default props
1084
1085
1086 if (type && type.defaultProps) {
1087 var defaultProps = type.defaultProps;
1088
1089 for (propName in defaultProps) {
1090 if (props[propName] === undefined) {
1091 props[propName] = defaultProps[propName];
1092 }
1093 }
1094 }
1095
1096 if (key || ref) {
1097 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
1098
1099 if (key) {
1100 defineKeyPropWarningGetter(props, displayName);
1101 }
1102
1103 if (ref) {
1104 defineRefPropWarningGetter(props, displayName);
1105 }
1106 }
1107
1108 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1109 }
1110 }
1111
1112 var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
1113 var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1114
1115 function setCurrentlyValidatingElement$1(element) {
1116 {
1117 if (element) {
1118 var owner = element._owner;
1119 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1120 ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1121 } else {
1122 ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1123 }
1124 }
1125 }
1126
1127 var propTypesMisspellWarningShown;
1128
1129 {
1130 propTypesMisspellWarningShown = false;
1131 }
1132 /**
1133 * Verifies the object is a ReactElement.
1134 * See https://reactjs.org/docs/react-api.html#isvalidelement
1135 * @param {?object} object
1136 * @return {boolean} True if `object` is a ReactElement.
1137 * @final
1138 */
1139
1140
1141 function isValidElement(object) {
1142 {
1143 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1144 }
1145 }
1146
1147 function getDeclarationErrorAddendum() {
1148 {
1149 if (ReactCurrentOwner$1.current) {
1150 var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1151
1152 if (name) {
1153 return '\n\nCheck the render method of `' + name + '`.';
1154 }
1155 }
1156
1157 return '';
1158 }
1159 }
1160
1161 function getSourceInfoErrorAddendum(source) {
1162 {
1163 if (source !== undefined) {
1164 var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1165 var lineNumber = source.lineNumber;
1166 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1167 }
1168
1169 return '';
1170 }
1171 }
1172 /**
1173 * Warn if there's no key explicitly set on dynamic arrays of children or
1174 * object keys are not valid. This allows us to keep track of children between
1175 * updates.
1176 */
1177
1178
1179 var ownerHasKeyUseWarning = {};
1180
1181 function getCurrentComponentErrorInfo(parentType) {
1182 {
1183 var info = getDeclarationErrorAddendum();
1184
1185 if (!info) {
1186 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1187
1188 if (parentName) {
1189 info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1190 }
1191 }
1192
1193 return info;
1194 }
1195 }
1196 /**
1197 * Warn if the element doesn't have an explicit key assigned to it.
1198 * This element is in an array. The array could grow and shrink or be
1199 * reordered. All children that haven't already been validated are required to
1200 * have a "key" property assigned to it. Error statuses are cached so a warning
1201 * will only be shown once.
1202 *
1203 * @internal
1204 * @param {ReactElement} element Element that requires a key.
1205 * @param {*} parentType element's parent's type.
1206 */
1207
1208
1209 function validateExplicitKey(element, parentType) {
1210 {
1211 if (!element._store || element._store.validated || element.key != null) {
1212 return;
1213 }
1214
1215 element._store.validated = true;
1216 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1217
1218 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1219 return;
1220 }
1221
1222 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1223 // property, it may be the creator of the child that's responsible for
1224 // assigning it a key.
1225
1226 var childOwner = '';
1227
1228 if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1229 // Give the component that originally created this child.
1230 childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1231 }
1232
1233 setCurrentlyValidatingElement$1(element);
1234
1235 error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1236
1237 setCurrentlyValidatingElement$1(null);
1238 }
1239 }
1240 /**
1241 * Ensure that every element either is passed in a static location, in an
1242 * array with an explicit keys property defined, or in an object literal
1243 * with valid key property.
1244 *
1245 * @internal
1246 * @param {ReactNode} node Statically passed child of any type.
1247 * @param {*} parentType node's parent's type.
1248 */
1249
1250
1251 function validateChildKeys(node, parentType) {
1252 {
1253 if (typeof node !== 'object') {
1254 return;
1255 }
1256
1257 if (isArray(node)) {
1258 for (var i = 0; i < node.length; i++) {
1259 var child = node[i];
1260
1261 if (isValidElement(child)) {
1262 validateExplicitKey(child, parentType);
1263 }
1264 }
1265 } else if (isValidElement(node)) {
1266 // This element was passed in a valid location.
1267 if (node._store) {
1268 node._store.validated = true;
1269 }
1270 } else if (node) {
1271 var iteratorFn = getIteratorFn(node);
1272
1273 if (typeof iteratorFn === 'function') {
1274 // Entry iterators used to provide implicit keys,
1275 // but now we print a separate warning for them later.
1276 if (iteratorFn !== node.entries) {
1277 var iterator = iteratorFn.call(node);
1278 var step;
1279
1280 while (!(step = iterator.next()).done) {
1281 if (isValidElement(step.value)) {
1282 validateExplicitKey(step.value, parentType);
1283 }
1284 }
1285 }
1286 }
1287 }
1288 }
1289 }
1290 /**
1291 * Given an element, validate that its props follow the propTypes definition,
1292 * provided by the type.
1293 *
1294 * @param {ReactElement} element
1295 */
1296
1297
1298 function validatePropTypes(element) {
1299 {
1300 var type = element.type;
1301
1302 if (type === null || type === undefined || typeof type === 'string') {
1303 return;
1304 }
1305
1306 var propTypes;
1307
1308 if (typeof type === 'function') {
1309 propTypes = type.propTypes;
1310 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1311 // Inner props are checked in the reconciler.
1312 type.$$typeof === REACT_MEMO_TYPE)) {
1313 propTypes = type.propTypes;
1314 } else {
1315 return;
1316 }
1317
1318 if (propTypes) {
1319 // Intentionally inside to avoid triggering lazy initializers:
1320 var name = getComponentNameFromType(type);
1321 checkPropTypes(propTypes, element.props, 'prop', name, element);
1322 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1323 propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1324
1325 var _name = getComponentNameFromType(type);
1326
1327 error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1328 }
1329
1330 if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1331 error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1332 }
1333 }
1334 }
1335 /**
1336 * Given a fragment, validate that it can only be provided with fragment props
1337 * @param {ReactElement} fragment
1338 */
1339
1340
1341 function validateFragmentProps(fragment) {
1342 {
1343 var keys = Object.keys(fragment.props);
1344
1345 for (var i = 0; i < keys.length; i++) {
1346 var key = keys[i];
1347
1348 if (key !== 'children' && key !== 'key') {
1349 setCurrentlyValidatingElement$1(fragment);
1350
1351 error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1352
1353 setCurrentlyValidatingElement$1(null);
1354 break;
1355 }
1356 }
1357
1358 if (fragment.ref !== null) {
1359 setCurrentlyValidatingElement$1(fragment);
1360
1361 error('Invalid attribute `ref` supplied to `React.Fragment`.');
1362
1363 setCurrentlyValidatingElement$1(null);
1364 }
1365 }
1366 }
1367
1368 var didWarnAboutKeySpread = {};
1369 function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1370 {
1371 var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1372 // succeed and there will likely be errors in render.
1373
1374 if (!validType) {
1375 var info = '';
1376
1377 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1378 info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
1379 }
1380
1381 var sourceInfo = getSourceInfoErrorAddendum(source);
1382
1383 if (sourceInfo) {
1384 info += sourceInfo;
1385 } else {
1386 info += getDeclarationErrorAddendum();
1387 }
1388
1389 var typeString;
1390
1391 if (type === null) {
1392 typeString = 'null';
1393 } else if (isArray(type)) {
1394 typeString = 'array';
1395 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1396 typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1397 info = ' Did you accidentally export a JSX literal instead of a component?';
1398 } else {
1399 typeString = typeof type;
1400 }
1401
1402 error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1403 }
1404
1405 var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1406 // TODO: Drop this when these are no longer allowed as the type argument.
1407
1408 if (element == null) {
1409 return element;
1410 } // Skip key warning if the type isn't valid since our key validation logic
1411 // doesn't expect a non-string/function type and can throw confusing errors.
1412 // We don't want exception behavior to differ between dev and prod.
1413 // (Rendering will throw with a helpful message and as soon as the type is
1414 // fixed, the key warnings will appear.)
1415
1416
1417 if (validType) {
1418 var children = props.children;
1419
1420 if (children !== undefined) {
1421 if (isStaticChildren) {
1422 if (isArray(children)) {
1423 for (var i = 0; i < children.length; i++) {
1424 validateChildKeys(children[i], type);
1425 }
1426
1427 if (Object.freeze) {
1428 Object.freeze(children);
1429 }
1430 } else {
1431 error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
1432 }
1433 } else {
1434 validateChildKeys(children, type);
1435 }
1436 }
1437 }
1438
1439 {
1440 if (hasOwnProperty.call(props, 'key')) {
1441 var componentName = getComponentNameFromType(type);
1442 var keys = Object.keys(props).filter(function (k) {
1443 return k !== 'key';
1444 });
1445 var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1446
1447 if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1448 var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1449
1450 error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
1451
1452 didWarnAboutKeySpread[componentName + beforeExample] = true;
1453 }
1454 }
1455 }
1456
1457 if (type === REACT_FRAGMENT_TYPE) {
1458 validateFragmentProps(element);
1459 } else {
1460 validatePropTypes(element);
1461 }
1462
1463 return element;
1464 }
1465 } // These two functions exist to still get child warnings in dev
1466 // even with the prod transform. This means that jsxDEV is purely
1467 // opt-in behavior for better messages but that we won't stop
1468 // giving you warnings if you use production apis.
1469
1470 function jsxWithValidationStatic(type, props, key) {
1471 {
1472 return jsxWithValidation(type, props, key, true);
1473 }
1474 }
1475 function jsxWithValidationDynamic(type, props, key) {
1476 {
1477 return jsxWithValidation(type, props, key, false);
1478 }
1479 }
1480
1481 var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1482 // for now we can ship identical prod functions
1483
1484 var jsxs = jsxWithValidationStatic ;
1485
1486 exports.Fragment = REACT_FRAGMENT_TYPE;
1487 exports.jsx = jsx;
1488 exports.jsxs = jsxs;
1489 })();
1490 }
1491
1492
1493 /***/ }),
1494
1495 /***/ "./node_modules/react/jsx-runtime.js":
1496 /*!*******************************************!*\
1497 !*** ./node_modules/react/jsx-runtime.js ***!
1498 \*******************************************/
1499 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1500
1501
1502
1503 if (false) {} else {
1504 module.exports = __webpack_require__(/*! ./cjs/react-jsx-runtime.development.js */ "./node_modules/react/cjs/react-jsx-runtime.development.js");
1505 }
1506
1507
1508 /***/ }),
1509
1510 /***/ "react":
1511 /*!************************!*\
1512 !*** external "React" ***!
1513 \************************/
1514 /***/ ((module) => {
1515
1516 module.exports = window["React"];
1517
1518 /***/ }),
1519
1520 /***/ "jquery":
1521 /*!*************************!*\
1522 !*** external "jQuery" ***!
1523 \*************************/
1524 /***/ ((module) => {
1525
1526 module.exports = window["jQuery"];
1527
1528 /***/ }),
1529
1530 /***/ "@woocommerce/blocks-registry":
1531 /*!******************************************!*\
1532 !*** external ["wc","wcBlocksRegistry"] ***!
1533 \******************************************/
1534 /***/ ((module) => {
1535
1536 module.exports = window["wc"]["wcBlocksRegistry"];
1537
1538 /***/ }),
1539
1540 /***/ "@woocommerce/settings":
1541 /*!************************************!*\
1542 !*** external ["wc","wcSettings"] ***!
1543 \************************************/
1544 /***/ ((module) => {
1545
1546 module.exports = window["wc"]["wcSettings"];
1547
1548 /***/ }),
1549
1550 /***/ "@wordpress/data":
1551 /*!******************************!*\
1552 !*** external ["wp","data"] ***!
1553 \******************************/
1554 /***/ ((module) => {
1555
1556 module.exports = window["wp"]["data"];
1557
1558 /***/ }),
1559
1560 /***/ "@wordpress/html-entities":
1561 /*!**************************************!*\
1562 !*** external ["wp","htmlEntities"] ***!
1563 \**************************************/
1564 /***/ ((module) => {
1565
1566 module.exports = window["wp"]["htmlEntities"];
1567
1568 /***/ }),
1569
1570 /***/ "@wordpress/i18n":
1571 /*!******************************!*\
1572 !*** external ["wp","i18n"] ***!
1573 \******************************/
1574 /***/ ((module) => {
1575
1576 module.exports = window["wp"]["i18n"];
1577
1578 /***/ })
1579
1580 /******/ });
1581 /************************************************************************/
1582 /******/ // The module cache
1583 /******/ var __webpack_module_cache__ = {};
1584 /******/
1585 /******/ // The require function
1586 /******/ function __webpack_require__(moduleId) {
1587 /******/ // Check if module is in cache
1588 /******/ var cachedModule = __webpack_module_cache__[moduleId];
1589 /******/ if (cachedModule !== undefined) {
1590 /******/ return cachedModule.exports;
1591 /******/ }
1592 /******/ // Create a new module (and put it into the cache)
1593 /******/ var module = __webpack_module_cache__[moduleId] = {
1594 /******/ // no module.id needed
1595 /******/ // no module.loaded needed
1596 /******/ exports: {}
1597 /******/ };
1598 /******/
1599 /******/ // Execute the module function
1600 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1601 /******/
1602 /******/ // Return the exports of the module
1603 /******/ return module.exports;
1604 /******/ }
1605 /******/
1606 /************************************************************************/
1607 /******/ /* webpack/runtime/compat get default export */
1608 /******/ (() => {
1609 /******/ // getDefaultExport function for compatibility with non-harmony modules
1610 /******/ __webpack_require__.n = (module) => {
1611 /******/ var getter = module && module.__esModule ?
1612 /******/ () => (module['default']) :
1613 /******/ () => (module);
1614 /******/ __webpack_require__.d(getter, { a: getter });
1615 /******/ return getter;
1616 /******/ };
1617 /******/ })();
1618 /******/
1619 /******/ /* webpack/runtime/define property getters */
1620 /******/ (() => {
1621 /******/ // define getter functions for harmony exports
1622 /******/ __webpack_require__.d = (exports, definition) => {
1623 /******/ for(var key in definition) {
1624 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
1625 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
1626 /******/ }
1627 /******/ }
1628 /******/ };
1629 /******/ })();
1630 /******/
1631 /******/ /* webpack/runtime/hasOwnProperty shorthand */
1632 /******/ (() => {
1633 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
1634 /******/ })();
1635 /******/
1636 /******/ /* webpack/runtime/make namespace object */
1637 /******/ (() => {
1638 /******/ // define __esModule on exports
1639 /******/ __webpack_require__.r = (exports) => {
1640 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1641 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1642 /******/ }
1643 /******/ Object.defineProperty(exports, '__esModule', { value: true });
1644 /******/ };
1645 /******/ })();
1646 /******/
1647 /************************************************************************/
1648 var __webpack_exports__ = {};
1649 // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
1650 (() => {
1651 /*!*********************************************************************!*\
1652 !*** ./resources/js/frontend/wc-payplug-american_express-blocks.js ***!
1653 \*********************************************************************/
1654 __webpack_require__.r(__webpack_exports__);
1655 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
1656 /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__);
1657 /* harmony import */ var _woocommerce_blocks_registry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @woocommerce/blocks-registry */ "@woocommerce/blocks-registry");
1658 /* harmony import */ var _woocommerce_blocks_registry__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_blocks_registry__WEBPACK_IMPORTED_MODULE_1__);
1659 /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities");
1660 /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__);
1661 /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings");
1662 /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_3__);
1663 /* harmony import */ var _wc_payplug_popup_blocks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./wc-payplug-popup-blocks */ "./resources/js/frontend/wc-payplug-popup-blocks.js");
1664 /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js");
1665
1666
1667
1668
1669
1670
1671 const settings = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_3__.getSetting)('american_express_data', {});
1672 const defaultLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__.__)('Gateway method title', 'payplug');
1673 const label = (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_2__.decodeEntities)(settings?.title) || defaultLabel;
1674 /**
1675 * Content component
1676 */
1677 const Content = props => {
1678 if (settings?.popup === true) {
1679 return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(_wc_payplug_popup_blocks__WEBPACK_IMPORTED_MODULE_4__["default"], {
1680 settings: settings,
1681 props: props
1682 });
1683 }
1684 return window.wp.htmlEntities.decodeEntities(settings?.description || '');
1685 };
1686 /**
1687 * Label component
1688 *
1689 */
1690 const Label = () => {
1691 return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)("span", {
1692 style: {
1693 width: '100%'
1694 },
1695 children: [label, /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(Icon, {})]
1696 });
1697 };
1698 const Icon = () => {
1699 return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)("img", {
1700 src: settings?.icon.src,
1701 alt: settings?.icon.icon_alt,
1702 className: "payplug-payment-icon",
1703 style: {
1704 float: 'right'
1705 }
1706 });
1707 };
1708
1709 /**
1710 * Payplug payment method config object.
1711 */
1712 const Amex = {
1713 name: "american_express",
1714 label: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(Label, {}),
1715 content: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(Content, {}),
1716 edit: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx)(Content, {}),
1717 canMakePayment: () => true,
1718 ariaLabel: label,
1719 supports: {
1720 features: settings.supports
1721 }
1722 };
1723 (0,_woocommerce_blocks_registry__WEBPACK_IMPORTED_MODULE_1__.registerPaymentMethod)(Amex);
1724 })();
1725
1726 /******/ })()
1727 ;
1728 //# sourceMappingURL=wc-payplug-american_express-blocks.js.map