pay-sdk-react 1.1.4 → 1.1.6

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 (103) hide show
  1. package/dist/es/Airwallex/airwallex-button.js +20 -13
  2. package/dist/es/Airwallex/airwallex-modal.js +9 -3
  3. package/dist/es/Airwallex/airwallex-popup.js +13 -4
  4. package/dist/es/Airwallex/airwallex.js +7 -3
  5. package/dist/es/Alipay/alipay-button.js +14 -12
  6. package/dist/es/Alipay/alipay-modal.js +9 -3
  7. package/dist/es/Alipay/alipay.js +10 -2
  8. package/dist/es/Button/button.js +26 -17
  9. package/dist/es/FullScreenLoading/index.js +4 -1
  10. package/dist/es/MAlipay/m-alipay-button.js +24 -14
  11. package/dist/es/MWeChat/m-wechat-button.js +24 -14
  12. package/dist/es/Mask/mask.js +10 -2
  13. package/dist/es/PayButton/index.js +1 -1
  14. package/dist/es/PayMask/interface.d.ts +6 -0
  15. package/dist/es/PayMask/pay-mask.js +18 -6
  16. package/dist/es/Paypal/interface.d.ts +16 -0
  17. package/dist/es/Paypal/paypal-button.js +111 -18
  18. package/dist/es/Payssion/payssion-button.js +20 -13
  19. package/dist/es/Stripe/stripe-button.js +14 -12
  20. package/dist/es/Stripe/stripe-modal.js +9 -3
  21. package/dist/es/Stripe/stripe-popup.js +13 -4
  22. package/dist/es/Stripe/stripe.js +3 -2
  23. package/dist/es/Wechat/wechat-button.js +14 -12
  24. package/dist/es/Wechat/wechat-modal.js +9 -3
  25. package/dist/es/Wechat/wechat.js +7 -2
  26. package/dist/es/confirm-modal/index.js +6 -2
  27. package/dist/es/hooks/use-inner-visible.js +6 -1
  28. package/dist/es/hooks/usePayWindowOpen.d.ts +6 -0
  29. package/dist/es/hooks/usePayWindowOpen.js +15 -5
  30. package/dist/es/icons/IconAlipay/index.js +1 -1
  31. package/dist/es/icons/IconClose/index.js +1 -1
  32. package/dist/es/icons/IconPaypalText/index.js +1 -1
  33. package/dist/es/icons/IconPaypalWhite/index.js +1 -1
  34. package/dist/es/icons/IconPayssionPay/index.js +1 -1
  35. package/dist/es/icons/IconStripe/index.js +1 -1
  36. package/dist/es/icons/IconStripeText/index.js +1 -1
  37. package/dist/es/icons/IconWechatPay/index.js +1 -1
  38. package/dist/es/pay-modal/pay-modal.js +3 -2
  39. package/dist/es/pay-popup/index.js +11 -3
  40. package/dist/es/utils/classNames.js +6 -1
  41. package/dist/es/utils/is.js +10 -12
  42. package/dist/es/utils/native-props.js +4 -1
  43. package/dist/es/utils/omit.js +4 -1
  44. package/dist/es/utils/with-stop-propagation.js +4 -1
  45. package/dist/lib/Airwallex/airwallex-button.js +6 -6
  46. package/dist/lib/Airwallex/airwallex-modal.js +4 -4
  47. package/dist/lib/Airwallex/airwallex-popup.js +4 -4
  48. package/dist/lib/Airwallex/airwallex.js +2 -3
  49. package/dist/lib/Airwallex/index.js +1 -1
  50. package/dist/lib/Alipay/alipay-button.js +4 -4
  51. package/dist/lib/Alipay/alipay-modal.js +3 -3
  52. package/dist/lib/Alipay/alipay.js +1 -1
  53. package/dist/lib/Alipay/index.js +1 -1
  54. package/dist/lib/Button/button.js +1 -1
  55. package/dist/lib/Button/index.js +1 -1
  56. package/dist/lib/FullScreenLoading/index.js +1 -1
  57. package/dist/lib/MAlipay/index.js +1 -1
  58. package/dist/lib/MAlipay/m-alipay-button.js +5 -5
  59. package/dist/lib/MWeChat/index.js +2 -2
  60. package/dist/lib/MWeChat/m-wechat-button.js +5 -5
  61. package/dist/lib/Mask/index.js +1 -1
  62. package/dist/lib/Mask/mask.js +1 -1
  63. package/dist/lib/PayButton/index.js +10 -10
  64. package/dist/lib/PayMask/index.js +1 -1
  65. package/dist/lib/PayMask/pay-mask.js +5 -3
  66. package/dist/lib/Paypal/index.js +2 -2
  67. package/dist/lib/Paypal/paypal-button.js +69 -6
  68. package/dist/lib/Payssion/index.js +2 -2
  69. package/dist/lib/Payssion/payssion-button.js +4 -4
  70. package/dist/lib/Stripe/index.js +1 -1
  71. package/dist/lib/Stripe/stripe-button.js +5 -5
  72. package/dist/lib/Stripe/stripe-modal.js +3 -3
  73. package/dist/lib/Stripe/stripe-popup.js +3 -3
  74. package/dist/lib/Stripe/stripe.js +3 -3
  75. package/dist/lib/Wechat/index.js +1 -1
  76. package/dist/lib/Wechat/wechat-button.js +4 -4
  77. package/dist/lib/Wechat/wechat-modal.js +3 -3
  78. package/dist/lib/Wechat/wechat.js +2 -2
  79. package/dist/lib/confirm-modal/index.js +1 -1
  80. package/dist/lib/dot-loading/dot-loading.js +1 -1
  81. package/dist/lib/dot-loading/index.js +1 -1
  82. package/dist/lib/hooks/usePayWindowOpen.js +8 -4
  83. package/dist/lib/icons/IconAlipay/index.js +3 -3
  84. package/dist/lib/icons/IconClose/index.js +3 -3
  85. package/dist/lib/icons/IconPaypalText/index.js +3 -3
  86. package/dist/lib/icons/IconPaypalWhite/index.js +3 -3
  87. package/dist/lib/icons/IconPayssionPay/index.js +3 -3
  88. package/dist/lib/icons/IconStripe/index.js +3 -3
  89. package/dist/lib/icons/IconStripeText/index.js +3 -3
  90. package/dist/lib/icons/IconWechatPay/index.js +3 -3
  91. package/dist/lib/icons/index.js +2 -2
  92. package/dist/lib/index.js +2 -2
  93. package/dist/lib/pay-modal/index.js +1 -1
  94. package/dist/lib/pay-modal/pay-modal.js +4 -4
  95. package/dist/lib/pay-popup/index.js +3 -3
  96. package/dist/lib/utils/classNames.js +1 -1
  97. package/dist/lib/utils/is.js +1 -3
  98. package/dist/lib/utils/native-props.js +1 -1
  99. package/dist/lib/utils/qrcode.js +1 -1
  100. package/dist/lib/utils/with-stop-propagation.js +1 -1
  101. package/dist/umd/pay-sdk-react.umd.js +68 -7
  102. package/dist/umd/pay-sdk-react.umd.js.map +1 -1
  103. package/package.json +2 -2
@@ -22,6 +22,22 @@ export interface PaypalButtonProps extends ButtonProps {
22
22
  * @en Function to create order, returns Paypal required params
23
23
  */
24
24
  createOrder?: CreateOrderPaypalFn;
25
+ /**
26
+ * @zh 支付成功检测函数,返回支付状态
27
+ * @en Function to check payment status
28
+ */
29
+ checkPaymentStatus?: () => Promise<boolean>;
30
+ /**
31
+ * @zh 支付成功回调
32
+ * @en Payment success callback
33
+ */
34
+ onPaymentSuccess?: () => void;
35
+ /**
36
+ * @zh 组件卸载时是否关闭第三方支付页面,只在 “checkPaymentStatus” 检测支付状态函数调用时且 openMode 为 “window” 时生效
37
+ * @en Whether to close the third-party payment page when component unmounts, only effective when "checkPaymentStatus" is called and openMode is "window"
38
+ * @default true
39
+ */
40
+ closeWindowOnUnmount?: boolean;
25
41
  }
26
42
  export type PaypalButtonRef = ButtonRef;
27
43
  /**
@@ -1,11 +1,19 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
3
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
4
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["className", "children", "onClick", "paypalUrl", "createOrder", "maskProps"],
1
+ var _excluded = ["className", "children", "onClick", "paypalUrl", "createOrder", "maskProps", "checkPaymentStatus", "onPaymentSuccess", "closeWindowOnUnmount"],
6
2
  _excluded2 = ["onClose"];
7
- import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
8
- import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef, useState } from 'react';
3
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
5
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
6
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
7
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
8
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
11
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
12
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
14
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
15
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
16
+ import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef, useState, useEffect } from 'react';
9
17
  import { IconPaypalText, IconPaypalWhite } from '../icons';
10
18
  import cs from '../utils/classNames';
11
19
  import PayMask from '../PayMask';
@@ -19,6 +27,10 @@ var PaypalButton = /*#__PURE__*/forwardRef(function (props, ref) {
19
27
  propsPaypalUrl = props.paypalUrl,
20
28
  createOrder = props.createOrder,
21
29
  maskProps = props.maskProps,
30
+ checkPaymentStatus = props.checkPaymentStatus,
31
+ onPaymentSuccess = props.onPaymentSuccess,
32
+ _props$closeWindowOnU = props.closeWindowOnUnmount,
33
+ closeWindowOnUnmount = _props$closeWindowOnU === void 0 ? true : _props$closeWindowOnU,
22
34
  others = _objectWithoutProperties(props, _excluded);
23
35
  var _ref = maskProps || {},
24
36
  onMaskClose = _ref.onClose,
@@ -34,34 +46,106 @@ var PaypalButton = /*#__PURE__*/forwardRef(function (props, ref) {
34
46
  _useState4 = _slicedToArray(_useState3, 2),
35
47
  paypalUrl = _useState4[0],
36
48
  setPaypalUrl = _useState4[1];
49
+ var pollingTimerRef = useRef(null);
37
50
  useImperativeHandle(ref, function () {
38
51
  return paypalButtonRef.current;
39
52
  });
40
- var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
53
+
54
+ // 支付状态轮询
55
+ var startPaymentPolling = useCallback(function () {
56
+ if (!checkPaymentStatus) return;
57
+
58
+ // 先清除之前的定时器
59
+ if (pollingTimerRef.current) {
60
+ clearTimeout(pollingTimerRef.current);
61
+ pollingTimerRef.current = null;
62
+ }
63
+ var _poll = /*#__PURE__*/function () {
64
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
65
+ var isSuccess, _t;
66
+ return _regenerator().w(function (_context) {
67
+ while (1) switch (_context.n) {
68
+ case 0:
69
+ _context.p = 0;
70
+ _context.n = 1;
71
+ return checkPaymentStatus();
72
+ case 1:
73
+ isSuccess = _context.v;
74
+ if (!isSuccess) {
75
+ _context.n = 2;
76
+ break;
77
+ }
78
+ setShowMask(false);
79
+ onPaymentSuccess === null || onPaymentSuccess === void 0 || onPaymentSuccess();
80
+ if (pollingTimerRef.current) {
81
+ clearTimeout(pollingTimerRef.current);
82
+ pollingTimerRef.current = null;
83
+ }
84
+ return _context.a(2);
85
+ case 2:
86
+ // 继续轮询
87
+ if (pollingTimerRef.current) {
88
+ clearTimeout(pollingTimerRef.current);
89
+ }
90
+ pollingTimerRef.current = setTimeout(_poll, 3000);
91
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
92
+ _context.n = 4;
93
+ break;
94
+ case 3:
95
+ _context.p = 3;
96
+ _t = _context.v;
97
+ // 出错时继续轮询
98
+ if (pollingTimerRef.current) {
99
+ clearTimeout(pollingTimerRef.current);
100
+ }
101
+ pollingTimerRef.current = setTimeout(_poll, 3000);
102
+ case 4:
103
+ return _context.a(2);
104
+ }
105
+ }, _callee, null, [[0, 3]]);
106
+ }));
107
+ return function poll() {
108
+ return _ref2.apply(this, arguments);
109
+ };
110
+ }();
111
+ _poll();
112
+ }, [checkPaymentStatus, onPaymentSuccess]);
113
+
114
+ // 停止轮询
115
+ var stopPaymentPolling = useCallback(function () {
116
+ if (pollingTimerRef.current) {
117
+ clearTimeout(pollingTimerRef.current);
118
+ pollingTimerRef.current = null;
119
+ }
120
+ }, []);
121
+ var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
41
122
  var _yield$createOrder, _paypalUrl;
42
- return _regeneratorRuntime.wrap(function (_context) {
43
- while (1) switch (_context.prev = _context.next) {
123
+ return _regenerator().w(function (_context2) {
124
+ while (1) switch (_context2.n) {
44
125
  case 0:
45
126
  if (!createOrder) {
46
- _context.next = 2;
127
+ _context2.n = 2;
47
128
  break;
48
129
  }
49
- _context.next = 1;
130
+ _context2.n = 1;
50
131
  return createOrder();
51
132
  case 1:
52
- _yield$createOrder = _context.sent;
133
+ _yield$createOrder = _context2.v;
53
134
  _paypalUrl = _yield$createOrder.paypalUrl;
54
135
  if (_paypalUrl) {
55
136
  // 2. 唤起蒙层
56
137
  setShowMask(true);
57
138
  setPaypalUrl(_paypalUrl);
139
+ // 3. 开始轮询支付状态
140
+ if (checkPaymentStatus) {
141
+ startPaymentPolling();
142
+ }
58
143
  }
59
144
  case 2:
60
- case "end":
61
- return _context.stop();
145
+ return _context2.a(2);
62
146
  }
63
- }, _callee);
64
- })), [createOrder]);
147
+ }, _callee2);
148
+ })), [createOrder, checkPaymentStatus, startPaymentPolling]);
65
149
  var handleOpen = useCallback(function () {
66
150
  if (propsPaypalUrl) {
67
151
  setShowMask(true);
@@ -76,6 +160,13 @@ var PaypalButton = /*#__PURE__*/forwardRef(function (props, ref) {
76
160
  }
77
161
  onClick === null || onClick === void 0 || onClick(e);
78
162
  }, [onClick, createOrder, handlePayCreateOrder, handleOpen]);
163
+
164
+ // 组件卸载时清理轮询
165
+ useEffect(function () {
166
+ return function () {
167
+ stopPaymentPolling();
168
+ };
169
+ }, [stopPaymentPolling]);
79
170
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({
80
171
  ref: paypalButtonRef,
81
172
  className: cs(getPrefixCls('paypal-btn'), className),
@@ -84,10 +175,12 @@ var PaypalButton = /*#__PURE__*/forwardRef(function (props, ref) {
84
175
  visible: showMask,
85
176
  onClose: function onClose() {
86
177
  setShowMask(false);
178
+ stopPaymentPolling();
87
179
  onMaskClose === null || onMaskClose === void 0 || onMaskClose();
88
180
  },
89
181
  payUrl: paypalUrl,
90
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconPaypalWhite, null), "PayPal")
182
+ title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconPaypalWhite, null), "PayPal"),
183
+ closeWindowOnUnmount: closeWindowOnUnmount
91
184
  }, restMaskProps)));
92
185
  });
93
186
  PaypalButton.displayName = 'PaypalButton';
@@ -1,10 +1,18 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
3
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
4
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
5
1
  var _excluded = ["className", "children", "onClick", "payssionUrl", "createOrder", "maskProps"],
6
2
  _excluded2 = ["onClose"];
7
- import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
3
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
4
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
5
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
6
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
7
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
8
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
9
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
11
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
12
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
14
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
15
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
8
16
  import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef, useState } from 'react';
9
17
  import cs from '../utils/classNames';
10
18
  import PayMask from '../PayMask';
@@ -37,19 +45,19 @@ var PayssionButton = /*#__PURE__*/forwardRef(function (props, ref) {
37
45
  useImperativeHandle(ref, function () {
38
46
  return payssionButtonRef.current;
39
47
  });
40
- var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
48
+ var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
41
49
  var _yield$createOrder, _payssionUrl;
42
- return _regeneratorRuntime.wrap(function (_context) {
43
- while (1) switch (_context.prev = _context.next) {
50
+ return _regenerator().w(function (_context) {
51
+ while (1) switch (_context.n) {
44
52
  case 0:
45
53
  if (!createOrder) {
46
- _context.next = 2;
54
+ _context.n = 2;
47
55
  break;
48
56
  }
49
- _context.next = 1;
57
+ _context.n = 1;
50
58
  return createOrder();
51
59
  case 1:
52
- _yield$createOrder = _context.sent;
60
+ _yield$createOrder = _context.v;
53
61
  _payssionUrl = _yield$createOrder.payssionUrl;
54
62
  if (_payssionUrl) {
55
63
  // 2. 唤起蒙层
@@ -57,8 +65,7 @@ var PayssionButton = /*#__PURE__*/forwardRef(function (props, ref) {
57
65
  setPayssionUrl(_payssionUrl);
58
66
  }
59
67
  case 2:
60
- case "end":
61
- return _context.stop();
68
+ return _context.a(2);
62
69
  }
63
70
  }, _callee);
64
71
  })), [createOrder]);
@@ -1,8 +1,11 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
3
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
4
1
  var _excluded = ["children", "onClick", "displayType", "stripePopupProps", "stripeModalProps", "createOrder"];
5
- import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
4
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
5
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
6
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
7
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
8
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
6
9
  import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef } from 'react';
7
10
  import StripePopup from './stripe-popup';
8
11
  import StripeModal from './stripe-modal';
@@ -25,19 +28,19 @@ var StripeButton = /*#__PURE__*/forwardRef(function (props, ref) {
25
28
  useImperativeHandle(ref, function () {
26
29
  return stripeButtonRef.current;
27
30
  });
28
- var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
31
+ var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
29
32
  var options, _stripeModalRef$curre, _stripePopupRef$curre;
30
- return _regeneratorRuntime.wrap(function (_context) {
31
- while (1) switch (_context.prev = _context.next) {
33
+ return _regenerator().w(function (_context) {
34
+ while (1) switch (_context.n) {
32
35
  case 0:
33
36
  if (!createOrder) {
34
- _context.next = 2;
37
+ _context.n = 2;
35
38
  break;
36
39
  }
37
- _context.next = 1;
40
+ _context.n = 1;
38
41
  return createOrder();
39
42
  case 1:
40
- options = _context.sent;
43
+ options = _context.v;
41
44
  if (options !== null && options !== void 0 && options.clientSecret && options !== null && options !== void 0 && options.stripeKey) {
42
45
  // 2. 唤起弹窗
43
46
  if (displayType === 'modal') {
@@ -47,8 +50,7 @@ var StripeButton = /*#__PURE__*/forwardRef(function (props, ref) {
47
50
  }
48
51
  }
49
52
  case 2:
50
- case "end":
51
- return _context.stop();
53
+ return _context.a(2);
52
54
  }
53
55
  }, _callee);
54
56
  })), [createOrder, displayType]);
@@ -1,7 +1,13 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
4
1
  var _excluded = ["stripeProps", "visible", "onClose", "className"];
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
10
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
11
  import React, { memo, useImperativeHandle, useRef, useState } from 'react';
6
12
  import cs from '../utils/classNames';
7
13
  import PayModal from '../pay-modal';
@@ -1,10 +1,19 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
3
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
4
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
2
  var _excluded = ["visible", "onClose", "closeOnMaskClick", "className", "bodyStyle", "stripeProps"];
3
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
6
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
10
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
12
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
14
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
15
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
16
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
8
17
  import React, { memo, useImperativeHandle, useRef, useState } from 'react';
9
18
  import cs from '../utils/classNames';
10
19
  import Stripe from '.';
@@ -1,6 +1,7 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
1
  var _excluded = ["stripeKey", "clientSecret", "className"];
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
5
  import React, { memo, useImperativeHandle, useMemo, useRef } from 'react';
5
6
  import { EmbeddedCheckout, EmbeddedCheckoutProvider } from '@stripe/react-stripe-js';
6
7
  import { loadStripe } from '@stripe/stripe-js';
@@ -1,8 +1,11 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
3
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
4
1
  var _excluded = ["className", "children", "onClick", "createOrder", "modalProps"];
5
- import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
4
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
5
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
6
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
7
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
8
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
6
9
  import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef } from 'react';
7
10
  import cs from '../utils/classNames';
8
11
  import WechatModal from './wechat-modal';
@@ -24,23 +27,22 @@ var WechatButton = /*#__PURE__*/forwardRef(function (props, ref) {
24
27
  useImperativeHandle(ref, function () {
25
28
  return wechatButtonRef.current;
26
29
  });
27
- var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
30
+ var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
28
31
  var _wechatModalRef$curre, options;
29
- return _regeneratorRuntime.wrap(function (_context) {
30
- while (1) switch (_context.prev = _context.next) {
32
+ return _regenerator().w(function (_context) {
33
+ while (1) switch (_context.n) {
31
34
  case 0:
32
35
  if (!createOrder) {
33
- _context.next = 2;
36
+ _context.n = 2;
34
37
  break;
35
38
  }
36
- _context.next = 1;
39
+ _context.n = 1;
37
40
  return createOrder();
38
41
  case 1:
39
- options = _context.sent;
42
+ options = _context.v;
40
43
  (_wechatModalRef$curre = wechatModalRef.current) === null || _wechatModalRef$curre === void 0 || _wechatModalRef$curre.open(options);
41
44
  case 2:
42
- case "end":
43
- return _context.stop();
45
+ return _context.a(2);
44
46
  }
45
47
  }, _callee);
46
48
  })), [createOrder]);
@@ -1,7 +1,13 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
4
1
  var _excluded = ["wechatProps", "visible", "onClose"];
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
10
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
11
  import React, { memo, useImperativeHandle, useRef, useState } from 'react';
6
12
  import PayModal from '../pay-modal';
7
13
  import Wechat from './wechat';
@@ -1,9 +1,14 @@
1
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
2
7
  import React, { memo, useEffect, useState } from 'react';
3
8
  import cs from '../utils/classNames';
4
9
  import makeQrcode from '../utils/qrcode';
5
10
  import { getPrefixCls } from '../utils/getPrefixCls';
6
- var classPrefix = getPrefixCls('wechat');
11
+ var classPrefix = getPrefixCls('wechat-qrcode');
7
12
  var WechatQrCode = function WechatQrCode(_ref) {
8
13
  var _ref$wechatType = _ref.wechatType,
9
14
  wechatType = _ref$wechatType === void 0 ? 'qrcode' : _ref$wechatType,
@@ -1,9 +1,13 @@
1
- import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
2
  var _excluded = ["children"],
4
3
  _excluded2 = ["children"];
5
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
10
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
7
11
  import React, { useCallback } from 'react';
8
12
  import { usePayWindowOpen } from '../hooks/usePayWindowOpen';
9
13
  import PayModal from '../pay-modal';
@@ -1,4 +1,9 @@
1
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
2
7
  import { useState } from 'react';
3
8
  import { useIsomorphicLayoutEffect } from 'ahooks';
4
9
  export function useInnerVisible(outerVisible) {
@@ -5,6 +5,12 @@ interface BaseUsePayWindowOpenOptions {
5
5
  onClose?: () => void;
6
6
  onSuccess?: () => void;
7
7
  autoOpen?: boolean;
8
+ /**
9
+ * @zh 组件卸载时是否关闭支付窗口
10
+ * @en Whether to close payment window when component unmounts
11
+ * @default true
12
+ */
13
+ closeWindowOnUnmount?: boolean;
8
14
  }
9
15
  interface WindowModeOptions extends BaseUsePayWindowOpenOptions {
10
16
  openMode?: OpenPayUrlMode.Window;
@@ -1,4 +1,9 @@
1
- import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
2
7
  import { isMobileDevice, isTouchDevice } from '../utils/is';
3
8
  import { mergeProps } from '../utils/with-default-props';
4
9
  import { useEffect, useRef, useCallback, useState } from 'react';
@@ -14,7 +19,8 @@ function getScreenWidth() {
14
19
  }
15
20
  var defaultProps = {
16
21
  payUrl: '',
17
- openMode: OpenPayUrlMode.Window
22
+ openMode: OpenPayUrlMode.Window,
23
+ closeWindowOnUnmount: true
18
24
  };
19
25
  export function usePayWindowOpen(p) {
20
26
  var props = mergeProps(defaultProps, p);
@@ -22,7 +28,9 @@ export function usePayWindowOpen(p) {
22
28
  onClose = props.onClose,
23
29
  onSuccess = props.onSuccess,
24
30
  _props$autoOpen = props.autoOpen,
25
- autoOpen = _props$autoOpen === void 0 ? true : _props$autoOpen;
31
+ autoOpen = _props$autoOpen === void 0 ? true : _props$autoOpen,
32
+ _props$closeWindowOnU = props.closeWindowOnUnmount,
33
+ closeWindowOnUnmount = _props$closeWindowOnU === void 0 ? true : _props$closeWindowOnU;
26
34
  var payWindowRef = useRef(null);
27
35
  var pollTimerRef = useRef(null);
28
36
  var _useState = useState(false),
@@ -117,10 +125,12 @@ export function usePayWindowOpen(p) {
117
125
  }
118
126
  window.addEventListener('message', handleMessage);
119
127
  return function () {
120
- var _payWindowRef$current3;
121
128
  clearInterval(pollTimerRef.current);
122
129
  window.removeEventListener('message', handleMessage);
123
- (_payWindowRef$current3 = payWindowRef.current) === null || _payWindowRef$current3 === void 0 || _payWindowRef$current3.close();
130
+ if (closeWindowOnUnmount) {
131
+ var _payWindowRef$current3;
132
+ (_payWindowRef$current3 = payWindowRef.current) === null || _payWindowRef$current3 === void 0 || _payWindowRef$current3.close();
133
+ }
124
134
  };
125
135
  }, [isWindowMonitoring, props, onClose, onSuccess]);
126
136
  return {
@@ -1,4 +1,4 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
2
  import React from 'react';
3
3
  import omit from '../../utils/omit';
4
4
  import { getPrefixCls } from '../../utils/getPrefixCls';
@@ -1,4 +1,4 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
2
  import React from 'react';
3
3
  import omit from '../../utils/omit';
4
4
  import { getPrefixCls } from '../../utils/getPrefixCls';