pay-sdk-react 1.1.3 → 1.1.5
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.
- package/dist/es/Airwallex/airwallex-button.js +20 -13
- package/dist/es/Airwallex/airwallex-modal.js +9 -3
- package/dist/es/Airwallex/airwallex-popup.js +13 -4
- package/dist/es/Airwallex/airwallex.js +7 -3
- package/dist/es/Alipay/alipay-button.js +14 -12
- package/dist/es/Alipay/alipay-modal.js +9 -3
- package/dist/es/Alipay/alipay.js +10 -2
- package/dist/es/Button/button.js +26 -17
- package/dist/es/FullScreenLoading/index.js +4 -1
- package/dist/es/MAlipay/m-alipay-button.js +24 -14
- package/dist/es/MWeChat/m-wechat-button.js +24 -14
- package/dist/es/Mask/mask.js +10 -2
- package/dist/es/PayButton/index.js +1 -1
- package/dist/es/PayMask/interface.d.ts +7 -1
- package/dist/es/PayMask/pay-mask.js +22 -6
- package/dist/es/Paypal/paypal-button.js +20 -13
- package/dist/es/Payssion/payssion-button.js +20 -13
- package/dist/es/Stripe/stripe-button.js +14 -12
- package/dist/es/Stripe/stripe-modal.js +9 -3
- package/dist/es/Stripe/stripe-popup.js +13 -4
- package/dist/es/Stripe/stripe.js +3 -2
- package/dist/es/Wechat/wechat-button.js +14 -12
- package/dist/es/Wechat/wechat-modal.js +9 -3
- package/dist/es/Wechat/wechat.js +6 -1
- package/dist/es/confirm-modal/index.js +13 -5
- package/dist/es/confirm-modal/interface.d.ts +7 -1
- package/dist/es/hooks/use-inner-visible.js +6 -1
- package/dist/es/hooks/usePayWindowOpen.d.ts +16 -10
- package/dist/es/hooks/usePayWindowOpen.js +68 -23
- package/dist/es/icons/IconAlipay/index.js +1 -1
- package/dist/es/icons/IconClose/index.js +1 -1
- package/dist/es/icons/IconPaypalText/index.js +1 -1
- package/dist/es/icons/IconPaypalWhite/index.js +1 -1
- package/dist/es/icons/IconPayssionPay/index.js +1 -1
- package/dist/es/icons/IconStripe/index.js +1 -1
- package/dist/es/icons/IconStripeText/index.js +1 -1
- package/dist/es/icons/IconWechatPay/index.js +1 -1
- package/dist/es/pay-modal/pay-modal.js +3 -2
- package/dist/es/pay-popup/index.js +11 -3
- package/dist/es/shared/enums/index.d.ts +21 -0
- package/dist/es/shared/enums/index.js +23 -0
- package/dist/es/utils/classNames.js +6 -1
- package/dist/es/utils/is.d.ts +10 -1
- package/dist/es/utils/is.js +24 -14
- package/dist/es/utils/native-props.js +4 -1
- package/dist/es/utils/omit.js +4 -1
- package/dist/es/utils/with-stop-propagation.js +4 -1
- package/dist/lib/Airwallex/airwallex-button.js +6 -6
- package/dist/lib/Airwallex/airwallex-modal.js +4 -4
- package/dist/lib/Airwallex/airwallex-popup.js +4 -4
- package/dist/lib/Airwallex/airwallex.js +2 -3
- package/dist/lib/Airwallex/index.js +1 -1
- package/dist/lib/Alipay/alipay-button.js +4 -4
- package/dist/lib/Alipay/alipay-modal.js +3 -3
- package/dist/lib/Alipay/alipay.js +1 -1
- package/dist/lib/Alipay/index.js +1 -1
- package/dist/lib/Button/button.js +1 -1
- package/dist/lib/Button/index.js +1 -1
- package/dist/lib/FullScreenLoading/index.js +1 -1
- package/dist/lib/MAlipay/index.js +1 -1
- package/dist/lib/MAlipay/m-alipay-button.js +5 -5
- package/dist/lib/MWeChat/index.js +2 -2
- package/dist/lib/MWeChat/m-wechat-button.js +5 -5
- package/dist/lib/Mask/index.js +1 -1
- package/dist/lib/Mask/mask.js +1 -1
- package/dist/lib/PayButton/index.js +10 -10
- package/dist/lib/PayMask/index.js +1 -1
- package/dist/lib/PayMask/pay-mask.js +9 -4
- package/dist/lib/Paypal/index.js +2 -2
- package/dist/lib/Paypal/paypal-button.js +4 -4
- package/dist/lib/Payssion/index.js +2 -2
- package/dist/lib/Payssion/payssion-button.js +4 -4
- package/dist/lib/Stripe/index.js +1 -1
- package/dist/lib/Stripe/stripe-button.js +5 -5
- package/dist/lib/Stripe/stripe-modal.js +3 -3
- package/dist/lib/Stripe/stripe-popup.js +3 -3
- package/dist/lib/Stripe/stripe.js +3 -3
- package/dist/lib/Wechat/index.js +1 -1
- package/dist/lib/Wechat/wechat-button.js +4 -4
- package/dist/lib/Wechat/wechat-modal.js +3 -3
- package/dist/lib/Wechat/wechat.js +1 -1
- package/dist/lib/confirm-modal/index.js +8 -3
- package/dist/lib/dot-loading/dot-loading.js +1 -1
- package/dist/lib/dot-loading/index.js +1 -1
- package/dist/lib/hooks/usePayWindowOpen.js +63 -20
- package/dist/lib/icons/IconAlipay/index.js +3 -3
- package/dist/lib/icons/IconClose/index.js +3 -3
- package/dist/lib/icons/IconPaypalText/index.js +3 -3
- package/dist/lib/icons/IconPaypalWhite/index.js +3 -3
- package/dist/lib/icons/IconPayssionPay/index.js +3 -3
- package/dist/lib/icons/IconStripe/index.js +3 -3
- package/dist/lib/icons/IconStripeText/index.js +3 -3
- package/dist/lib/icons/IconWechatPay/index.js +3 -3
- package/dist/lib/icons/index.js +2 -2
- package/dist/lib/index.js +2 -2
- package/dist/lib/pay-modal/index.js +1 -1
- package/dist/lib/pay-modal/pay-modal.js +4 -4
- package/dist/lib/pay-popup/index.js +3 -3
- package/dist/lib/shared/enums/index.js +23 -1
- package/dist/lib/utils/classNames.js +1 -1
- package/dist/lib/utils/is.js +17 -6
- package/dist/lib/utils/native-props.js +1 -1
- package/dist/lib/utils/qrcode.js +1 -1
- package/dist/lib/utils/with-stop-propagation.js +1 -1
- package/dist/umd/pay-sdk-react.umd.js +162 -72
- package/dist/umd/pay-sdk-react.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,21 +1,33 @@
|
|
|
1
|
-
|
|
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; }
|
|
7
|
+
import { isMobileDevice, isTouchDevice } from '../utils/is';
|
|
8
|
+
import { mergeProps } from '../utils/with-default-props';
|
|
2
9
|
import { useEffect, useRef, useCallback, useState } from 'react';
|
|
3
|
-
|
|
10
|
+
import { OpenPayUrlMode } from '../shared/enums';
|
|
11
|
+
import { clientDocument, clientWindow } from '../utils/dom';
|
|
4
12
|
/**
|
|
5
|
-
* @zh
|
|
6
|
-
* @en
|
|
7
|
-
* @zh 使用 replace: 如果您的业务逻辑是"一旦点击支付,就不能轻易返回",replace 会更合适。例如,点击支付后,您的后端已经创建了一张"待支付"的订单。为了防止用户通过"后退"按钮回到上一个页面再次创建订单,使用 replace 可以强制用户要么完成支付,要么关闭页面,而不能"后退"到上一步。
|
|
8
|
-
* @en Use replace: If your business logic is "once clicked, payment cannot be easily returned", replace is more suitable. For example, after clicking payment, your backend has already created an "awaiting payment" order. To prevent users from returning to the previous page by clicking the "back" button and creating an order again, using replace can force users to either complete payment or close the page, and cannot "back" to the previous step.
|
|
13
|
+
* @zh 获取屏幕宽度
|
|
14
|
+
* @en Get screen width
|
|
9
15
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
function getScreenWidth() {
|
|
17
|
+
var _clientDocument$docum, _clientDocument$body;
|
|
18
|
+
return (clientWindow === null || clientWindow === void 0 ? void 0 : clientWindow.innerWidth) || (clientDocument === null || clientDocument === void 0 || (_clientDocument$docum = clientDocument.documentElement) === null || _clientDocument$docum === void 0 ? void 0 : _clientDocument$docum.clientWidth) || (clientDocument === null || clientDocument === void 0 || (_clientDocument$body = clientDocument.body) === null || _clientDocument$body === void 0 ? void 0 : _clientDocument$body.clientWidth);
|
|
19
|
+
}
|
|
20
|
+
var defaultProps = {
|
|
21
|
+
payUrl: '',
|
|
22
|
+
openMode: OpenPayUrlMode.Window
|
|
23
|
+
};
|
|
24
|
+
export function usePayWindowOpen(p) {
|
|
25
|
+
var props = mergeProps(defaultProps, p);
|
|
26
|
+
var payUrl = props.payUrl,
|
|
27
|
+
onClose = props.onClose,
|
|
28
|
+
onSuccess = props.onSuccess,
|
|
29
|
+
_props$autoOpen = props.autoOpen,
|
|
30
|
+
autoOpen = _props$autoOpen === void 0 ? true : _props$autoOpen;
|
|
19
31
|
var payWindowRef = useRef(null);
|
|
20
32
|
var pollTimerRef = useRef(null);
|
|
21
33
|
var _useState = useState(false),
|
|
@@ -23,21 +35,54 @@ export function usePayWindowOpen(_ref) {
|
|
|
23
35
|
isWindowMonitoring = _useState2[0],
|
|
24
36
|
setWindowMonitoring = _useState2[1];
|
|
25
37
|
|
|
38
|
+
// 创建弹窗的公共函数
|
|
39
|
+
var createPopupWindow = useCallback(function (url) {
|
|
40
|
+
// 计算弹窗尺寸和位置,实现垂直水平居中
|
|
41
|
+
var width = Math.min(550, window.outerWidth * 0.9);
|
|
42
|
+
var height = Math.min(700, window.outerHeight);
|
|
43
|
+
|
|
44
|
+
// 使用多种定位方法确保居中
|
|
45
|
+
var left = Math.round((window.screen.availWidth - width) / 2);
|
|
46
|
+
var top = Math.round((window.screen.availHeight - height) / 2);
|
|
47
|
+
var screenX = left;
|
|
48
|
+
var screenY = top;
|
|
49
|
+
return window.open(url, 'paypal_payment', "width=".concat(width, ",height=").concat(height, ",left=").concat(left, ",top=").concat(top, ",screenX=").concat(screenX, ",screenY=").concat(screenY, ",scrollbars=yes,resizable=yes"));
|
|
50
|
+
}, [onClose, onSuccess]);
|
|
51
|
+
|
|
26
52
|
// 打开支付窗口
|
|
27
53
|
var openWindow = useCallback(function () {
|
|
28
|
-
if (openMode ===
|
|
54
|
+
if ((props === null || props === void 0 ? void 0 : props.openMode) === OpenPayUrlMode.Window) {
|
|
29
55
|
if (payWindowRef.current && !payWindowRef.current.closed) {
|
|
30
56
|
payWindowRef.current.focus();
|
|
31
57
|
} else {
|
|
32
|
-
|
|
33
|
-
|
|
58
|
+
var isMobile = isMobileDevice() || isTouchDevice();
|
|
59
|
+
var forceNewWindow = props === null || props === void 0 ? void 0 : props.forceNewWindow;
|
|
60
|
+
if (isMobile) {
|
|
61
|
+
payWindowRef.current = window.open(payUrl);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (forceNewWindow) {
|
|
65
|
+
payWindowRef.current = createPopupWindow(payUrl);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
var screenWidth = getScreenWidth() || 0;
|
|
69
|
+
if (screenWidth >= 768) {
|
|
70
|
+
payWindowRef.current = createPopupWindow(payUrl);
|
|
71
|
+
} else {
|
|
72
|
+
payWindowRef.current = window.open(payUrl);
|
|
73
|
+
}
|
|
34
74
|
}
|
|
35
|
-
|
|
75
|
+
setWindowMonitoring(true);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if ((props === null || props === void 0 ? void 0 : props.openMode) === OpenPayUrlMode.Replace) {
|
|
36
79
|
window.location.replace(payUrl);
|
|
37
|
-
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if ((props === null || props === void 0 ? void 0 : props.openMode) === OpenPayUrlMode.Href) {
|
|
38
83
|
window.location.href = payUrl;
|
|
39
84
|
}
|
|
40
|
-
}, [payUrl,
|
|
85
|
+
}, [payUrl, props, createPopupWindow]);
|
|
41
86
|
|
|
42
87
|
// 关闭窗口
|
|
43
88
|
var closeWindow = useCallback(function () {
|
|
@@ -55,7 +100,7 @@ export function usePayWindowOpen(_ref) {
|
|
|
55
100
|
|
|
56
101
|
// 轮询和消息监听
|
|
57
102
|
useEffect(function () {
|
|
58
|
-
if (!isWindowMonitoring || openMode !==
|
|
103
|
+
if (!isWindowMonitoring || (props === null || props === void 0 ? void 0 : props.openMode) !== OpenPayUrlMode.Window) {
|
|
59
104
|
return;
|
|
60
105
|
}
|
|
61
106
|
pollTimerRef.current = setInterval(function () {
|
|
@@ -82,7 +127,7 @@ export function usePayWindowOpen(_ref) {
|
|
|
82
127
|
window.removeEventListener('message', handleMessage);
|
|
83
128
|
(_payWindowRef$current3 = payWindowRef.current) === null || _payWindowRef$current3 === void 0 || _payWindowRef$current3.close();
|
|
84
129
|
};
|
|
85
|
-
}, [isWindowMonitoring,
|
|
130
|
+
}, [isWindowMonitoring, props, onClose, onSuccess]);
|
|
86
131
|
return {
|
|
87
132
|
openWindow: openWindow,
|
|
88
133
|
closeWindow: closeWindow,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,7 +1,8 @@
|
|
|
1
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
3
1
|
var _excluded = ["className", "children"],
|
|
4
2
|
_excluded2 = ["className", "children"];
|
|
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 _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; }
|
|
5
|
+
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
6
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
6
7
|
import ReactDOM from 'react-dom';
|
|
7
8
|
import { isFunction } from '../utils/is';
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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); }
|
|
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; }
|
|
4
9
|
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; }
|
|
5
10
|
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
|
+
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); }
|
|
6
14
|
import cs from '../utils/classNames';
|
|
7
15
|
import React, { useState, useRef } from 'react';
|
|
8
16
|
import { useIsomorphicLayoutEffect, useUnmountedRef } from 'ahooks';
|
|
@@ -55,3 +55,24 @@ export declare enum PaymentMethod {
|
|
|
55
55
|
*/
|
|
56
56
|
Airwallex = "airwallex"
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @zh 支付页面打开模式枚举
|
|
60
|
+
* @en Payment page opening mode enum
|
|
61
|
+
*/
|
|
62
|
+
export declare enum OpenPayUrlMode {
|
|
63
|
+
/**
|
|
64
|
+
* @zh 新页面或弹窗模式 - 使用 window.open() 打开新页面或弹窗,支持智能设备检测
|
|
65
|
+
* @en New page or popup mode - Use window.open() to open new page or popup, supports smart device detection
|
|
66
|
+
*/
|
|
67
|
+
Window = "window",
|
|
68
|
+
/**
|
|
69
|
+
* @zh 新页面模式 - 使用 window.location.href 跳转到新页面
|
|
70
|
+
* @en New page mode - Use window.location.href to navigate to new page
|
|
71
|
+
*/
|
|
72
|
+
Href = "href",
|
|
73
|
+
/**
|
|
74
|
+
* @zh 替换页面模式 - 使用 window.location.replace 替换当前页面
|
|
75
|
+
* @en Replace page mode - Use window.location.replace to replace current page
|
|
76
|
+
*/
|
|
77
|
+
Replace = "replace"
|
|
78
|
+
}
|
|
@@ -55,4 +55,27 @@ export var PaymentMethod = /*#__PURE__*/function (PaymentMethod) {
|
|
|
55
55
|
*/
|
|
56
56
|
PaymentMethod["Airwallex"] = "airwallex";
|
|
57
57
|
return PaymentMethod;
|
|
58
|
+
}({});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @zh 支付页面打开模式枚举
|
|
62
|
+
* @en Payment page opening mode enum
|
|
63
|
+
*/
|
|
64
|
+
export var OpenPayUrlMode = /*#__PURE__*/function (OpenPayUrlMode) {
|
|
65
|
+
/**
|
|
66
|
+
* @zh 新页面或弹窗模式 - 使用 window.open() 打开新页面或弹窗,支持智能设备检测
|
|
67
|
+
* @en New page or popup mode - Use window.open() to open new page or popup, supports smart device detection
|
|
68
|
+
*/
|
|
69
|
+
OpenPayUrlMode["Window"] = "window";
|
|
70
|
+
/**
|
|
71
|
+
* @zh 新页面模式 - 使用 window.location.href 跳转到新页面
|
|
72
|
+
* @en New page mode - Use window.location.href to navigate to new page
|
|
73
|
+
*/
|
|
74
|
+
OpenPayUrlMode["Href"] = "href";
|
|
75
|
+
/**
|
|
76
|
+
* @zh 替换页面模式 - 使用 window.location.replace 替换当前页面
|
|
77
|
+
* @en Replace page mode - Use window.location.replace to replace current page
|
|
78
|
+
*/
|
|
79
|
+
OpenPayUrlMode["Replace"] = "replace";
|
|
80
|
+
return OpenPayUrlMode;
|
|
58
81
|
}({});
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
5
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
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; }
|
|
2
7
|
import { isArray, isObject, isString } from './is';
|
|
3
8
|
import warning from './warning';
|
|
4
9
|
export default function () {
|
package/dist/es/utils/is.d.ts
CHANGED
|
@@ -22,7 +22,16 @@ export declare const isClassComponent: (element: any) => boolean;
|
|
|
22
22
|
export declare const isDOMElement: (element: any) => boolean;
|
|
23
23
|
export declare const isLink: (text?: React.ReactNode) => boolean;
|
|
24
24
|
export declare function isImageLinkAvailable(url: string): Promise<boolean>;
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* @zh 检测是否为移动设备
|
|
27
|
+
* @en Detect if it's a mobile device
|
|
28
|
+
*/
|
|
29
|
+
export declare function isMobileDevice(): boolean | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* @zh 检测是否为触摸设备
|
|
32
|
+
* @en Detect if it's a touch device
|
|
33
|
+
*/
|
|
34
|
+
export declare function isTouchDevice(): boolean;
|
|
26
35
|
export declare function isEmail(email: string): boolean;
|
|
27
36
|
export declare function isSmsCode(code: string): boolean;
|
|
28
37
|
export declare function isUsPhoneNumber(phone: string): boolean;
|
package/dist/es/utils/is.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
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 }; })(); }
|
|
2
|
+
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); }
|
|
3
|
+
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); }
|
|
4
|
+
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); }
|
|
5
|
+
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); }); }; }
|
|
5
6
|
import { isValidElement } from 'react';
|
|
6
7
|
import { canUseDom } from './can-use-dom';
|
|
7
8
|
import { clientWindow } from './dom';
|
|
@@ -58,7 +59,7 @@ export function isEmptyReactNode(content, trim) {
|
|
|
58
59
|
if (content === null || content === undefined || content === false) {
|
|
59
60
|
return true;
|
|
60
61
|
}
|
|
61
|
-
if (typeof content === 'string' && (trim ?
|
|
62
|
+
if (typeof content === 'string' && (trim ? content.trim() === '' : content === '')) {
|
|
62
63
|
return true;
|
|
63
64
|
}
|
|
64
65
|
return false;
|
|
@@ -90,12 +91,17 @@ export var isLink = function isLink(text) {
|
|
|
90
91
|
export function isImageLinkAvailable(_x) {
|
|
91
92
|
return _isImageLinkAvailable.apply(this, arguments);
|
|
92
93
|
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @zh 检测是否为移动设备
|
|
97
|
+
* @en Detect if it's a mobile device
|
|
98
|
+
*/
|
|
93
99
|
function _isImageLinkAvailable() {
|
|
94
|
-
_isImageLinkAvailable = _asyncToGenerator(/*#__PURE__*/
|
|
95
|
-
return
|
|
96
|
-
while (1) switch (_context.
|
|
100
|
+
_isImageLinkAvailable = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(url) {
|
|
101
|
+
return _regenerator().w(function (_context) {
|
|
102
|
+
while (1) switch (_context.n) {
|
|
97
103
|
case 0:
|
|
98
|
-
return _context.
|
|
104
|
+
return _context.a(2, new Promise(function (resolve) {
|
|
99
105
|
var img = new Image();
|
|
100
106
|
img.onload = function () {
|
|
101
107
|
return resolve(true);
|
|
@@ -105,16 +111,20 @@ function _isImageLinkAvailable() {
|
|
|
105
111
|
};
|
|
106
112
|
img.src = url;
|
|
107
113
|
}));
|
|
108
|
-
case 1:
|
|
109
|
-
case "end":
|
|
110
|
-
return _context.stop();
|
|
111
114
|
}
|
|
112
115
|
}, _callee);
|
|
113
116
|
}));
|
|
114
117
|
return _isImageLinkAvailable.apply(this, arguments);
|
|
115
118
|
}
|
|
116
|
-
export function
|
|
117
|
-
return clientWindow && /Android|iPhone|iPad|iPod|Windows Phone|BlackBerry|Mobile/i.test(clientWindow === null || clientWindow === void 0 ? void 0 : clientWindow.navigator.userAgent);
|
|
119
|
+
export function isMobileDevice() {
|
|
120
|
+
return clientWindow && /Android|webOS|iPhone|iPad|iPod|Windows Phone|BlackBerry|Mobile|IEMobile|Opera Mini/i.test(clientWindow === null || clientWindow === void 0 ? void 0 : clientWindow.navigator.userAgent);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* @zh 检测是否为触摸设备
|
|
124
|
+
* @en Detect if it's a touch device
|
|
125
|
+
*/
|
|
126
|
+
export function isTouchDevice() {
|
|
127
|
+
return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
118
128
|
}
|
|
119
129
|
export function isEmail(email) {
|
|
120
130
|
var emailReg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
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); }
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
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); }
|
|
4
7
|
import React from 'react';
|
|
5
8
|
import cs from './classNames';
|
|
6
9
|
export function withNativeProps(props, element) {
|
package/dist/es/utils/omit.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
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); }
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
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); }
|
|
4
7
|
// delete keys from object
|
|
5
8
|
export default function omit(obj, keys) {
|
|
6
9
|
var clone = _objectSpread({}, obj);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
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); }
|
|
2
2
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
3
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
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
5
|
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
6
|
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; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
+
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); }
|
|
7
10
|
import React from 'react';
|
|
8
11
|
var eventToPropRecord = {
|
|
9
12
|
click: 'onClick',
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
9
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
8
|
var _airwallexPopup = _interopRequireDefault(require("./airwallex-popup"));
|
|
11
9
|
var _airwallexModal = _interopRequireDefault(require("./airwallex-modal"));
|
|
12
10
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
13
11
|
var _PayMask = _interopRequireDefault(require("../PayMask"));
|
|
14
12
|
var _omit = _interopRequireDefault(require("../utils/omit"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
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); }
|
|
16
16
|
const AirwallexButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
17
17
|
const {
|
|
18
18
|
children = 'Airwallex',
|
|
@@ -69,14 +69,14 @@ const AirwallexButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
69
69
|
setAirwallexUrl(props === null || props === void 0 ? void 0 : props.airwallexUrl);
|
|
70
70
|
}
|
|
71
71
|
}, [onClick, createOrder, handlePayCreateOrder, props]);
|
|
72
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, (
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
|
|
73
73
|
ref: airwallexButtonRef,
|
|
74
74
|
onClick: handleClick
|
|
75
|
-
}, (0, _omit.default)(others, ['payMode', 'displayType', 'createOrder', 'airwallexUrl', 'maskProps', 'popupProps', 'modalProps'])), children), (props === null || props === void 0 ? void 0 : props.payMode) === 'embedded' && (props === null || props === void 0 ? void 0 : props.displayType) === 'popup' && /*#__PURE__*/_react.default.createElement(_airwallexPopup.default, (
|
|
75
|
+
}, (0, _omit.default)(others, ['payMode', 'displayType', 'createOrder', 'airwallexUrl', 'maskProps', 'popupProps', 'modalProps'])), children), (props === null || props === void 0 ? void 0 : props.payMode) === 'embedded' && (props === null || props === void 0 ? void 0 : props.displayType) === 'popup' && /*#__PURE__*/_react.default.createElement(_airwallexPopup.default, _extends({
|
|
76
76
|
ref: airwallexPopupRef
|
|
77
|
-
}, props === null || props === void 0 ? void 0 : props.popupProps)), (props === null || props === void 0 ? void 0 : props.payMode) === 'embedded' && (props === null || props === void 0 ? void 0 : props.displayType) === 'modal' && /*#__PURE__*/_react.default.createElement(_airwallexModal.default, (
|
|
77
|
+
}, props === null || props === void 0 ? void 0 : props.popupProps)), (props === null || props === void 0 ? void 0 : props.payMode) === 'embedded' && (props === null || props === void 0 ? void 0 : props.displayType) === 'modal' && /*#__PURE__*/_react.default.createElement(_airwallexModal.default, _extends({
|
|
78
78
|
ref: airwallexModalRef
|
|
79
|
-
}, props === null || props === void 0 ? void 0 : props.modalProps)), (props === null || props === void 0 ? void 0 : props.payMode) === 'redirect' && showMask && airwallexUrl && /*#__PURE__*/_react.default.createElement(_PayMask.default, (
|
|
79
|
+
}, props === null || props === void 0 ? void 0 : props.modalProps)), (props === null || props === void 0 ? void 0 : props.payMode) === 'redirect' && showMask && airwallexUrl && /*#__PURE__*/_react.default.createElement(_PayMask.default, _extends({
|
|
80
80
|
visible: showMask,
|
|
81
81
|
onClose: () => {
|
|
82
82
|
var _props$maskProps, _props$maskProps$onCl;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
9
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
8
|
var _payModal = _interopRequireDefault(require("../pay-modal"));
|
|
11
9
|
var _airwallex = _interopRequireDefault(require("./airwallex"));
|
|
12
10
|
var _omit = _interopRequireDefault(require("../utils/omit"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
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); }
|
|
14
14
|
const AirwallexModal = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
15
15
|
const {
|
|
16
16
|
airwallexProps: propsAirwallexProps,
|
|
@@ -38,7 +38,7 @@ const AirwallexModal = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
38
38
|
current: airwallexRef.current
|
|
39
39
|
}));
|
|
40
40
|
const _airwallexProps = propsAirwallexProps ?? airwallexProps;
|
|
41
|
-
return /*#__PURE__*/_react.default.createElement(_payModal.default, (
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_payModal.default, _extends({
|
|
42
42
|
visible: _visible,
|
|
43
43
|
onClose: () => {
|
|
44
44
|
if (!isControlled) {
|
|
@@ -47,7 +47,7 @@ const AirwallexModal = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
47
47
|
onClose === null || onClose === void 0 || onClose();
|
|
48
48
|
},
|
|
49
49
|
footer: footer
|
|
50
|
-
}, rest), _airwallexProps && /*#__PURE__*/_react.default.createElement(_airwallex.default, (
|
|
50
|
+
}, rest), _airwallexProps && /*#__PURE__*/_react.default.createElement(_airwallex.default, _extends({
|
|
51
51
|
onSuccess: event => {
|
|
52
52
|
var _airwallexProps$onSuc;
|
|
53
53
|
if (!isControlled) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
9
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
8
|
var _airwallex = _interopRequireDefault(require("./airwallex"));
|
|
11
9
|
var _payPopup = _interopRequireDefault(require("../pay-popup"));
|
|
12
10
|
var _omit = _interopRequireDefault(require("../utils/omit"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
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); }
|
|
14
14
|
const AirwallexPopup = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
15
15
|
const {
|
|
16
16
|
visible: controlledVisible,
|
|
@@ -39,7 +39,7 @@ const AirwallexPopup = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
39
39
|
},
|
|
40
40
|
current: airwallexRef.current
|
|
41
41
|
}));
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement(_payPopup.default, (
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_payPopup.default, _extends({
|
|
43
43
|
visible: visible,
|
|
44
44
|
closeOnMaskClick: closeOnMaskClick,
|
|
45
45
|
onClose: () => {
|
|
@@ -54,7 +54,7 @@ const AirwallexPopup = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
54
54
|
overflowY: 'scroll',
|
|
55
55
|
...bodyStyle
|
|
56
56
|
}
|
|
57
|
-
}, others), _airwallexProps && /*#__PURE__*/_react.default.createElement(_airwallex.default, (
|
|
57
|
+
}, others), _airwallexProps && /*#__PURE__*/_react.default.createElement(_airwallex.default, _extends({
|
|
58
58
|
onSuccess: event => {
|
|
59
59
|
var _airwallexProps$onSuc;
|
|
60
60
|
if (!isControlled) {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
9
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
8
|
var _airwallexPaymentElements = require("airwallex-payment-elements");
|
|
11
9
|
var _dom = require("../utils/dom");
|
|
12
10
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
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); }
|
|
13
12
|
const Airwallex = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
14
13
|
const {
|
|
15
14
|
type = 'fullFeaturedCard',
|
|
@@ -60,7 +59,7 @@ const Airwallex = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
60
59
|
}
|
|
61
60
|
};
|
|
62
61
|
}, [type, propsOnReady, propsOnSuccess, propsOnError]);
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement("div", (
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
64
63
|
ref: airwallexRef,
|
|
65
64
|
id: String(type),
|
|
66
65
|
style: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -22,6 +21,7 @@ Object.keys(_interface).forEach(function (key) {
|
|
|
22
21
|
}
|
|
23
22
|
});
|
|
24
23
|
});
|
|
24
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
25
|
const AirwallexComponent = _airwallex.default;
|
|
26
26
|
AirwallexComponent.Button = _airwallexButton.default;
|
|
27
27
|
AirwallexComponent.Popup = _airwallexPopup.default;
|