pay-sdk-react 1.1.0 → 1.1.2
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/es/Airwallex/airwallex-modal.d.ts +4 -4
- package/dist/es/Airwallex/airwallex-modal.js +6 -6
- package/dist/es/Airwallex/airwallex-popup.d.ts +5 -5
- package/dist/es/Airwallex/airwallex-popup.js +13 -13
- package/dist/es/Airwallex/airwallex.d.ts +5 -5
- package/dist/es/Airwallex/airwallex.js +18 -24
- package/dist/es/Airwallex/interface.d.ts +59 -10
- package/dist/es/Alipay/alipay-button.d.ts +3 -3
- package/dist/es/Alipay/alipay-button.js +2 -2
- package/dist/es/Alipay/alipay-modal.d.ts +5 -5
- package/dist/es/Alipay/alipay-modal.js +6 -6
- package/dist/es/Alipay/alipay.d.ts +2 -2
- package/dist/es/Alipay/alipay.js +11 -9
- package/dist/es/Alipay/interface.d.ts +33 -14
- package/dist/es/Button/button.d.ts +1 -1
- package/dist/es/Button/interface.d.ts +65 -10
- package/dist/es/MAlipay/interface.d.ts +1 -6
- package/dist/es/MAlipay/m-alipay-auto-submit.d.ts +2 -2
- package/dist/es/MAlipay/m-alipay-auto-submit.js +2 -2
- package/dist/es/MAlipay/m-alipay-button.d.ts +3 -3
- package/dist/es/MAlipay/m-alipay-button.js +24 -13
- package/dist/es/MWeChat/interface.d.ts +1 -1
- package/dist/es/MWeChat/m-wechat-button.d.ts +3 -3
- package/dist/es/MWeChat/m-wechat-button.js +25 -13
- package/dist/es/Mask/interface.d.ts +6 -6
- package/dist/es/PayButton/index.d.ts +2 -2
- package/dist/es/PayButton/index.js +2 -2
- package/dist/es/Paypal/interface.d.ts +1 -1
- package/dist/es/Paypal/paypal-button.d.ts +3 -3
- package/dist/es/Paypal/paypal-button.js +2 -2
- package/dist/es/Payssion/interface.d.ts +1 -1
- package/dist/es/Payssion/payssion-button.d.ts +3 -3
- package/dist/es/Payssion/payssion-button.js +2 -2
- package/dist/es/Stripe/interface.d.ts +3 -3
- package/dist/es/Stripe/stripe-modal.d.ts +5 -5
- package/dist/es/Stripe/stripe-modal.js +3 -3
- package/dist/es/Stripe/stripe-popup.d.ts +4 -4
- package/dist/es/Stripe/stripe-popup.js +2 -2
- package/dist/es/Wechat/wechat-button.d.ts +3 -3
- package/dist/es/Wechat/wechat-button.js +2 -2
- package/dist/es/Wechat/wechat-modal.d.ts +6 -6
- package/dist/es/Wechat/wechat-modal.js +6 -6
- package/dist/es/Wechat/wechat.d.ts +2 -2
- package/dist/es/Wechat/wechat.js +2 -2
- package/dist/es/confirm-modal/index.d.ts +3 -3
- package/dist/es/confirm-modal/index.js +34 -15
- package/dist/es/dot-loading/interface.d.ts +6 -2
- package/dist/es/index.d.ts +2 -2
- package/dist/es/pay-modal/interface.d.ts +8 -18
- package/dist/es/pay-modal/pay-modal.js +26 -12
- package/dist/lib/Airwallex/airwallex-modal.js +9 -8
- package/dist/lib/Airwallex/airwallex-popup.js +13 -12
- package/dist/lib/Airwallex/airwallex.js +18 -23
- package/dist/lib/Alipay/alipay-button.js +1 -1
- package/dist/lib/Alipay/alipay-modal.js +3 -3
- package/dist/lib/Alipay/alipay.js +10 -8
- package/dist/lib/MAlipay/m-alipay-auto-submit.js +1 -1
- package/dist/lib/MAlipay/m-alipay-button.js +23 -12
- package/dist/lib/MWeChat/m-wechat-button.js +24 -12
- package/dist/lib/PayButton/index.js +3 -2
- package/dist/lib/Paypal/paypal-button.js +1 -1
- package/dist/lib/Payssion/payssion-button.js +1 -1
- package/dist/lib/Stripe/stripe-modal.js +6 -5
- package/dist/lib/Stripe/stripe-popup.js +5 -4
- package/dist/lib/Wechat/wechat-button.js +1 -1
- package/dist/lib/Wechat/wechat-modal.js +7 -6
- package/dist/lib/Wechat/wechat.js +1 -1
- package/dist/lib/confirm-modal/index.js +30 -11
- package/dist/lib/pay-modal/pay-modal.js +26 -12
- package/dist/umd/pay-sdk-react.umd.js +108 -79
- package/dist/umd/pay-sdk-react.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/es/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export type { PaypalButtonProps, PaypalButtonRef, CreateOrderPaypalFn, PaypalSec
|
|
|
2
2
|
export { PaypalButton } from './Paypal';
|
|
3
3
|
export type { BasesStripeProps, StripeProps, StripePopupProps, StripePopupRef, StripeButtonProps, StripeButtonRef, CreateOrderStripeFn, StripeModalRef, } from './Stripe/interface';
|
|
4
4
|
export { default as Stripe } from './Stripe';
|
|
5
|
-
export type { AirwallexProps, AirwallexPopupProps, AirwallexPopupRef, AirwallexButtonProps, AirwallexButtonRef,
|
|
5
|
+
export type { AirwallexProps, AirwallexPopupProps, AirwallexPopupRef, AirwallexButtonProps, AirwallexButtonRef, CreateOrderAirwallexEmbeddedFn, CreateOrderAirwallexRedirectFn, AirwallexModalProps, AirwallexModalRef, } from './Airwallex/interface';
|
|
6
6
|
export { default as Airwallex } from './Airwallex';
|
|
7
7
|
export type { PayssionButtonProps, PayssionButtonRef, CreateOrderPayssionFn, PayssionSecretMap, } from './Payssion/interface';
|
|
8
8
|
export { PayssionButton } from './Payssion';
|
|
@@ -10,7 +10,7 @@ export type { MWeChatButtonProps, MWeChatButtonRef, CreateOrderMWeChatFn, MWeCha
|
|
|
10
10
|
export { MWechatButton } from './MWeChat';
|
|
11
11
|
export type { MAlipayButtonProps, MAlipayButtonRef, CreateOrderMAlipayFn, MAlipayFormData, } from './MAlipay/interface';
|
|
12
12
|
export { default as MAlipay } from './MAlipay';
|
|
13
|
-
export type { AlipayProps, AlipayModalProps, AlipayButtonProps, AlipayButtonRef,
|
|
13
|
+
export type { AlipayProps, AlipayModalProps, AlipayButtonProps, AlipayButtonRef, AlipayModalRef, } from './Alipay/interface';
|
|
14
14
|
export { default as Alipay } from './Alipay';
|
|
15
15
|
export type { WechatProps, WechatModalProps, WechatButtonProps, WechatButtonRef, WechatModalRef, } from './Wechat/interface';
|
|
16
16
|
export { default as Wechat } from './Wechat';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { ReactNode } from
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '../Button';
|
|
2
3
|
export interface PayModalProps {
|
|
3
4
|
/**
|
|
4
5
|
* @zh 是否显示弹窗
|
|
@@ -26,18 +27,17 @@ export interface PayModalProps {
|
|
|
26
27
|
*/
|
|
27
28
|
children?: React.ReactNode;
|
|
28
29
|
/**
|
|
29
|
-
* @zh
|
|
30
|
-
* @en Retry button
|
|
30
|
+
* @zh 重试按钮 props
|
|
31
|
+
* @en Retry button props
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
+
retryButtonProps?: ButtonProps;
|
|
33
34
|
/**
|
|
34
|
-
* @zh
|
|
35
|
-
* @en Finish button
|
|
35
|
+
* @zh 完成按钮 props
|
|
36
|
+
* @en Finish button props
|
|
36
37
|
*/
|
|
37
|
-
|
|
38
|
+
finishButtonProps?: ButtonProps;
|
|
38
39
|
/**
|
|
39
40
|
* @zh 是否显示右上角关闭按钮,默认 true
|
|
40
|
-
* @en Whether to show the close button in the top right corner, default is true
|
|
41
41
|
*/
|
|
42
42
|
showClose?: boolean;
|
|
43
43
|
/**
|
|
@@ -45,16 +45,6 @@ export interface PayModalProps {
|
|
|
45
45
|
* @en Whether to close the modal when clicking the mask, default is false
|
|
46
46
|
*/
|
|
47
47
|
maskClosable?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* @zh 重试按钮回调
|
|
50
|
-
* @en Retry button callback
|
|
51
|
-
*/
|
|
52
|
-
onRetry?: () => void;
|
|
53
|
-
/**
|
|
54
|
-
* @zh 完成按钮回调
|
|
55
|
-
* @en Finish button callback
|
|
56
|
-
*/
|
|
57
|
-
onFinish?: () => void;
|
|
58
48
|
/**
|
|
59
49
|
* @zh 关闭弹窗回调
|
|
60
50
|
* @en Close modal callback
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
const _excluded = ["className", "children"],
|
|
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; }
|
|
1
6
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
2
7
|
import ReactDOM from 'react-dom';
|
|
3
8
|
import { isFunction } from '../utils/is';
|
|
@@ -5,19 +10,18 @@ import cs from '../utils/classNames';
|
|
|
5
10
|
import { useLockScroll } from '../hooks/use-lock-scroll';
|
|
6
11
|
import { clientDocument } from '../utils/dom';
|
|
7
12
|
import { getPrefixCls } from '../utils/getPrefixCls';
|
|
13
|
+
import Button from '../Button';
|
|
8
14
|
const classPrefix = getPrefixCls('modal');
|
|
9
15
|
const PayModal = props => {
|
|
10
16
|
const {
|
|
11
17
|
visible,
|
|
12
18
|
title,
|
|
13
19
|
desc,
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
retryButtonProps,
|
|
21
|
+
finishButtonProps,
|
|
16
22
|
icon,
|
|
17
23
|
showClose = true,
|
|
18
24
|
maskClosable = false,
|
|
19
|
-
onRetry,
|
|
20
|
-
onFinish,
|
|
21
25
|
onClose,
|
|
22
26
|
children,
|
|
23
27
|
footer,
|
|
@@ -27,6 +31,18 @@ const PayModal = props => {
|
|
|
27
31
|
contentStyle,
|
|
28
32
|
container
|
|
29
33
|
} = props;
|
|
34
|
+
const _ref = retryButtonProps || {},
|
|
35
|
+
{
|
|
36
|
+
className: retryButtonClassName,
|
|
37
|
+
children: retryButtonChildren = '重新支付'
|
|
38
|
+
} = _ref,
|
|
39
|
+
retryButtonPropsRest = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
+
const _ref2 = finishButtonProps || {},
|
|
41
|
+
{
|
|
42
|
+
className: finishButtonClassName,
|
|
43
|
+
children: finishButtonChildren = '支付完成'
|
|
44
|
+
} = _ref2,
|
|
45
|
+
finishButtonPropsRest = _objectWithoutProperties(_ref2, _excluded2);
|
|
30
46
|
const el = useRef(clientDocument === null || clientDocument === void 0 ? void 0 : clientDocument.createElement('div'));
|
|
31
47
|
const ref = useRef(null);
|
|
32
48
|
useLockScroll(ref, !!visible);
|
|
@@ -51,14 +67,12 @@ const PayModal = props => {
|
|
|
51
67
|
}, [maskClosable, onClose]);
|
|
52
68
|
const renderFooter = () => {
|
|
53
69
|
if (footer === null) return;
|
|
54
|
-
const retryButtonNode = /*#__PURE__*/React.createElement(
|
|
55
|
-
className: "".concat(classPrefix, "__btn "
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
onClick: onFinish
|
|
61
|
-
}, finishText);
|
|
70
|
+
const retryButtonNode = /*#__PURE__*/React.createElement(Button, _extends({
|
|
71
|
+
className: cs("".concat(classPrefix, "__btn"), "".concat(classPrefix, "__btn--retry"), retryButtonClassName)
|
|
72
|
+
}, retryButtonPropsRest), retryButtonChildren);
|
|
73
|
+
const finishButtonNode = /*#__PURE__*/React.createElement(Button, _extends({
|
|
74
|
+
className: cs("".concat(classPrefix, "__btn"), "".concat(classPrefix, "__btn--finish"), finishButtonClassName)
|
|
75
|
+
}, finishButtonPropsRest), finishButtonChildren);
|
|
62
76
|
const footerContent = isFunction(footer) ? footer(retryButtonNode, finishButtonNode) : footer || /*#__PURE__*/React.createElement(React.Fragment, null, retryButtonNode, finishButtonNode);
|
|
63
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
64
78
|
className: "".concat(classPrefix, "__actions")
|
|
@@ -4,16 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _payModal = _interopRequireDefault(require("../pay-modal"));
|
|
9
9
|
var _airwallex = _interopRequireDefault(require("./airwallex"));
|
|
10
10
|
var _omit = _interopRequireDefault(require("../utils/omit"));
|
|
11
11
|
const _excluded = ["airwallexProps", "visible", "onClose", "footer"];
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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
14
|
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
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; }
|
|
15
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; }
|
|
16
|
-
const AirwallexModal = /*#__PURE__*/
|
|
17
|
+
const AirwallexModal = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
17
18
|
const {
|
|
18
19
|
airwallexProps: propsAirwallexProps,
|
|
19
20
|
visible,
|
|
@@ -40,7 +41,7 @@ const AirwallexModal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
40
41
|
current: airwallexRef.current
|
|
41
42
|
}));
|
|
42
43
|
const _airwallexProps = propsAirwallexProps !== null && propsAirwallexProps !== void 0 ? propsAirwallexProps : airwallexProps;
|
|
43
|
-
return /*#__PURE__*/
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_payModal.default, _extends({
|
|
44
45
|
visible: _visible,
|
|
45
46
|
onClose: () => {
|
|
46
47
|
if (!isControlled) {
|
|
@@ -49,20 +50,20 @@ const AirwallexModal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
49
50
|
onClose === null || onClose === void 0 || onClose();
|
|
50
51
|
},
|
|
51
52
|
footer: footer
|
|
52
|
-
}, rest), _airwallexProps && /*#__PURE__*/
|
|
53
|
-
onSuccess:
|
|
53
|
+
}, rest), _airwallexProps && /*#__PURE__*/_react.default.createElement(_airwallex.default, _extends({
|
|
54
|
+
onSuccess: event => {
|
|
54
55
|
var _airwallexProps$onSuc;
|
|
55
56
|
if (!isControlled) {
|
|
56
57
|
setUncontrolledVisible(false);
|
|
57
58
|
}
|
|
58
|
-
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onSuc = _airwallexProps.onSuccess) === null || _airwallexProps$onSuc === void 0 || _airwallexProps$onSuc.call(_airwallexProps);
|
|
59
|
+
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onSuc = _airwallexProps.onSuccess) === null || _airwallexProps$onSuc === void 0 || _airwallexProps$onSuc.call(_airwallexProps, event);
|
|
59
60
|
},
|
|
60
|
-
onError:
|
|
61
|
+
onError: event => {
|
|
61
62
|
var _airwallexProps$onErr;
|
|
62
63
|
if (!isControlled) {
|
|
63
64
|
setUncontrolledVisible(false);
|
|
64
65
|
}
|
|
65
|
-
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onErr = _airwallexProps.onError) === null || _airwallexProps$onErr === void 0 || _airwallexProps$onErr.call(_airwallexProps);
|
|
66
|
+
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onErr = _airwallexProps.onError) === null || _airwallexProps$onErr === void 0 || _airwallexProps$onErr.call(_airwallexProps, event);
|
|
66
67
|
}
|
|
67
68
|
}, (0, _omit.default)(_airwallexProps, ['onSuccess', 'onError']))));
|
|
68
69
|
});
|
|
@@ -4,12 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _airwallex = _interopRequireDefault(require("./airwallex"));
|
|
9
9
|
var _payPopup = _interopRequireDefault(require("../pay-popup"));
|
|
10
10
|
var _omit = _interopRequireDefault(require("../utils/omit"));
|
|
11
11
|
const _excluded = ["visible", "onClose", "closeOnMaskClick", "bodyStyle", "airwallexProps"];
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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
14
|
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
15
|
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; }
|
|
15
16
|
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; }
|
|
@@ -18,7 +19,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
18
19
|
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); }
|
|
19
20
|
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; }
|
|
20
21
|
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; }
|
|
21
|
-
const AirwallexPopup = /*#__PURE__*/
|
|
22
|
+
const AirwallexPopup = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
22
23
|
const {
|
|
23
24
|
visible: controlledVisible,
|
|
24
25
|
onClose,
|
|
@@ -46,7 +47,7 @@ const AirwallexPopup = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
46
47
|
},
|
|
47
48
|
current: airwallexRef.current
|
|
48
49
|
}));
|
|
49
|
-
return /*#__PURE__*/
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(_payPopup.default, _extends({
|
|
50
51
|
visible: visible,
|
|
51
52
|
closeOnMaskClick: closeOnMaskClick,
|
|
52
53
|
onClose: () => {
|
|
@@ -57,25 +58,25 @@ const AirwallexPopup = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
57
58
|
},
|
|
58
59
|
bodyStyle: _objectSpread({
|
|
59
60
|
padding: 12,
|
|
60
|
-
height:
|
|
61
|
-
overflowY:
|
|
61
|
+
height: '40vh',
|
|
62
|
+
overflowY: 'scroll'
|
|
62
63
|
}, bodyStyle)
|
|
63
|
-
}, others), _airwallexProps && /*#__PURE__*/
|
|
64
|
-
onSuccess:
|
|
64
|
+
}, others), _airwallexProps && /*#__PURE__*/_react.default.createElement(_airwallex.default, _extends({
|
|
65
|
+
onSuccess: event => {
|
|
65
66
|
var _airwallexProps$onSuc;
|
|
66
67
|
if (!isControlled) {
|
|
67
68
|
setUncontrolledVisible(false);
|
|
68
69
|
}
|
|
69
|
-
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onSuc = _airwallexProps.onSuccess) === null || _airwallexProps$onSuc === void 0 || _airwallexProps$onSuc.call(_airwallexProps);
|
|
70
|
+
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onSuc = _airwallexProps.onSuccess) === null || _airwallexProps$onSuc === void 0 || _airwallexProps$onSuc.call(_airwallexProps, event);
|
|
70
71
|
},
|
|
71
|
-
onError:
|
|
72
|
+
onError: event => {
|
|
72
73
|
var _airwallexProps$onErr;
|
|
73
74
|
if (!isControlled) {
|
|
74
75
|
setUncontrolledVisible(false);
|
|
75
76
|
}
|
|
76
|
-
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onErr = _airwallexProps.onError) === null || _airwallexProps$onErr === void 0 || _airwallexProps$onErr.call(_airwallexProps);
|
|
77
|
+
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onErr = _airwallexProps.onError) === null || _airwallexProps$onErr === void 0 || _airwallexProps$onErr.call(_airwallexProps, event);
|
|
77
78
|
}
|
|
78
|
-
}, (0, _omit.default)(_airwallexProps, [
|
|
79
|
+
}, (0, _omit.default)(_airwallexProps, ['onSuccess', 'onError']))));
|
|
79
80
|
});
|
|
80
|
-
AirwallexPopup.displayName =
|
|
81
|
+
AirwallexPopup.displayName = 'AirwallexPopup';
|
|
81
82
|
var _default = exports.default = AirwallexPopup;
|
|
@@ -4,10 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _airwallexPaymentElements = require("airwallex-payment-elements");
|
|
9
9
|
var _dom = require("../utils/dom");
|
|
10
10
|
const _excluded = ["type", "options", "initOptions", "style", "onReady", "onSuccess", "onError"];
|
|
11
|
+
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
12
|
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); }
|
|
12
13
|
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; }
|
|
13
14
|
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; }
|
|
@@ -18,7 +19,7 @@ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i
|
|
|
18
19
|
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; }
|
|
19
20
|
const Airwallex = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
20
21
|
const {
|
|
21
|
-
type =
|
|
22
|
+
type = 'fullFeaturedCard',
|
|
22
23
|
options,
|
|
23
24
|
initOptions,
|
|
24
25
|
style,
|
|
@@ -31,12 +32,12 @@ const Airwallex = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
31
32
|
(0, _react.useImperativeHandle)(ref, () => airwallexRef.current);
|
|
32
33
|
(0, _react.useEffect)(() => {
|
|
33
34
|
(0, _airwallexPaymentElements.loadAirwallex)(_objectSpread({
|
|
34
|
-
env:
|
|
35
|
+
env: 'demo'
|
|
35
36
|
}, initOptions)).then(airwallex => {
|
|
36
37
|
if (airwallex) {
|
|
37
38
|
const cardElement = airwallex.createElement(type, options);
|
|
38
39
|
if (cardElement) {
|
|
39
|
-
cardElement.mount(type);
|
|
40
|
+
cardElement.mount(type);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
});
|
|
@@ -44,40 +45,34 @@ const Airwallex = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
44
45
|
(0, _react.useEffect)(() => {
|
|
45
46
|
const el = _dom.clientDocument === null || _dom.clientDocument === void 0 ? void 0 : _dom.clientDocument.getElementById(type);
|
|
46
47
|
const onReady = event => {
|
|
47
|
-
|
|
48
|
-
console.log("onReady", event);
|
|
49
|
-
propsOnReady === null || propsOnReady === void 0 || propsOnReady();
|
|
48
|
+
propsOnReady === null || propsOnReady === void 0 || propsOnReady(event);
|
|
50
49
|
};
|
|
51
50
|
const onSuccess = event => {
|
|
52
|
-
|
|
53
|
-
console.log("onSuccess", event);
|
|
54
|
-
propsOnSuccess === null || propsOnSuccess === void 0 || propsOnSuccess();
|
|
51
|
+
propsOnSuccess === null || propsOnSuccess === void 0 || propsOnSuccess(event);
|
|
55
52
|
};
|
|
56
53
|
const onError = event => {
|
|
57
|
-
|
|
58
|
-
console.log("onError", event);
|
|
59
|
-
propsOnError === null || propsOnError === void 0 || propsOnError();
|
|
54
|
+
propsOnError === null || propsOnError === void 0 || propsOnError(event);
|
|
60
55
|
};
|
|
61
56
|
if (el) {
|
|
62
|
-
(0, _dom.on)(el,
|
|
63
|
-
(0, _dom.on)(el,
|
|
64
|
-
(0, _dom.on)(el,
|
|
57
|
+
(0, _dom.on)(el, 'onReady', onReady);
|
|
58
|
+
(0, _dom.on)(el, 'onSuccess', onSuccess);
|
|
59
|
+
(0, _dom.on)(el, 'onError', onError);
|
|
65
60
|
}
|
|
66
61
|
return () => {
|
|
67
62
|
if (el) {
|
|
68
|
-
(0, _dom.off)(el,
|
|
69
|
-
(0, _dom.off)(el,
|
|
70
|
-
(0, _dom.off)(el,
|
|
63
|
+
(0, _dom.off)(el, 'onReady', onReady);
|
|
64
|
+
(0, _dom.off)(el, 'onSuccess', onSuccess);
|
|
65
|
+
(0, _dom.off)(el, 'onError', onError);
|
|
71
66
|
}
|
|
72
67
|
};
|
|
73
68
|
}, [type, propsOnReady, propsOnSuccess, propsOnError]);
|
|
74
|
-
return /*#__PURE__*/
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
75
70
|
ref: airwallexRef,
|
|
76
71
|
id: String(type),
|
|
77
72
|
style: _objectSpread({
|
|
78
|
-
width:
|
|
73
|
+
width: '100%'
|
|
79
74
|
}, style)
|
|
80
75
|
}, others));
|
|
81
76
|
});
|
|
82
|
-
Airwallex.displayName =
|
|
83
|
-
var _default = exports.default = /*#__PURE__*/
|
|
77
|
+
Airwallex.displayName = 'Airwallex';
|
|
78
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(Airwallex);
|
|
@@ -57,4 +57,4 @@ const AlipayButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
57
57
|
}, modalProps)));
|
|
58
58
|
});
|
|
59
59
|
AlipayButton.displayName = 'AlipayButton';
|
|
60
|
-
var _default = exports.default = AlipayButton;
|
|
60
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(AlipayButton);
|
|
@@ -47,7 +47,7 @@ const AlipayModal = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
47
47
|
}
|
|
48
48
|
onClose === null || onClose === void 0 || onClose();
|
|
49
49
|
}
|
|
50
|
-
}, others),
|
|
50
|
+
}, others), _alipayProps && /*#__PURE__*/_react.default.createElement(_alipay.default, _alipayProps));
|
|
51
51
|
});
|
|
52
|
-
AlipayModal.displayName =
|
|
53
|
-
var _default = exports.default = AlipayModal;
|
|
52
|
+
AlipayModal.displayName = 'AlipayModal';
|
|
53
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(AlipayModal);
|
|
@@ -20,8 +20,10 @@ const AlipayQrIframe = _ref => {
|
|
|
20
20
|
let {
|
|
21
21
|
formHtml,
|
|
22
22
|
tipText = '请使用支付宝APP扫码支付',
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
wrapperClassName = '',
|
|
24
|
+
wrapperStyle = {},
|
|
25
|
+
iframeClassName = '',
|
|
26
|
+
iframeStyle = {}
|
|
25
27
|
} = _ref;
|
|
26
28
|
const [loading, setLoading] = (0, _react.useState)(true);
|
|
27
29
|
return /*#__PURE__*/_react.default.createElement(_FullScreenLoading.default, {
|
|
@@ -30,18 +32,18 @@ const AlipayQrIframe = _ref => {
|
|
|
30
32
|
text: null,
|
|
31
33
|
fullscreen: false
|
|
32
34
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
33
|
-
className: classPrefix,
|
|
35
|
+
className: (0, _classNames.default)(classPrefix, wrapperClassName),
|
|
34
36
|
style: _objectSpread({
|
|
35
37
|
position: 'relative'
|
|
36
|
-
},
|
|
38
|
+
}, wrapperStyle)
|
|
37
39
|
}, /*#__PURE__*/_react.default.createElement("iframe", {
|
|
38
40
|
srcDoc: formHtml,
|
|
39
|
-
className: (0, _classNames.default)("".concat(classPrefix, "__iframe"),
|
|
40
|
-
style: {
|
|
41
|
+
className: (0, _classNames.default)("".concat(classPrefix, "__iframe"), iframeClassName),
|
|
42
|
+
style: _objectSpread({
|
|
41
43
|
width: 210,
|
|
42
44
|
height: 210,
|
|
43
45
|
border: 'none'
|
|
44
|
-
},
|
|
46
|
+
}, iframeStyle),
|
|
45
47
|
title: "alipay-qrcode",
|
|
46
48
|
scrolling: "no",
|
|
47
49
|
onLoad: () => setLoading(false)
|
|
@@ -49,4 +51,4 @@ const AlipayQrIframe = _ref => {
|
|
|
49
51
|
className: "".concat(classPrefix, "__tip")
|
|
50
52
|
}, tipText)));
|
|
51
53
|
};
|
|
52
|
-
var _default = exports.default = AlipayQrIframe;
|
|
54
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(AlipayQrIframe);
|
|
@@ -14,10 +14,15 @@ var _Button = _interopRequireDefault(require("../Button"));
|
|
|
14
14
|
var _icons = require("../icons");
|
|
15
15
|
var _getPrefixCls = require("../utils/getPrefixCls");
|
|
16
16
|
const _excluded = ["className", "children", "onClick", "formHtml", "createOrder", "displayType", "modalProps", "maskProps"],
|
|
17
|
-
_excluded2 = ["
|
|
17
|
+
_excluded2 = ["retryButtonProps", "finishButtonProps", "onClose"],
|
|
18
18
|
_excluded3 = ["onClose"];
|
|
19
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
20
|
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); }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
25
|
+
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); }
|
|
21
26
|
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); }
|
|
22
27
|
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; }
|
|
23
28
|
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; }
|
|
@@ -35,8 +40,8 @@ const MAlipayButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
35
40
|
others = _objectWithoutProperties(props, _excluded);
|
|
36
41
|
const _ref = modalProps || {},
|
|
37
42
|
{
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
retryButtonProps,
|
|
44
|
+
finishButtonProps,
|
|
40
45
|
onClose
|
|
41
46
|
} = _ref,
|
|
42
47
|
modalPropsOthers = _objectWithoutProperties(_ref, _excluded2);
|
|
@@ -52,18 +57,20 @@ const MAlipayButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
52
57
|
const [showMask, setShowMask] = (0, _react.useState)(false);
|
|
53
58
|
const [showModal, setShowModal] = (0, _react.useState)(false);
|
|
54
59
|
(0, _react.useImperativeHandle)(ref, () => mAlipayButtonRef.current);
|
|
55
|
-
const handleRetry = (0, _react.useCallback)(
|
|
60
|
+
const handleRetry = (0, _react.useCallback)(event => {
|
|
56
61
|
if (displayType === 'modal') {
|
|
57
|
-
|
|
62
|
+
var _retryButtonProps$onC;
|
|
63
|
+
retryButtonProps === null || retryButtonProps === void 0 || (_retryButtonProps$onC = retryButtonProps.onClick) === null || _retryButtonProps$onC === void 0 || _retryButtonProps$onC.call(retryButtonProps, event);
|
|
58
64
|
setShowModal(false);
|
|
59
65
|
}
|
|
60
|
-
}, [
|
|
61
|
-
const handleFinish = (0, _react.useCallback)(
|
|
66
|
+
}, [retryButtonProps, displayType]);
|
|
67
|
+
const handleFinish = (0, _react.useCallback)(event => {
|
|
62
68
|
if (displayType === 'modal') {
|
|
63
|
-
|
|
69
|
+
var _finishButtonProps$on;
|
|
70
|
+
finishButtonProps === null || finishButtonProps === void 0 || (_finishButtonProps$on = finishButtonProps.onClick) === null || _finishButtonProps$on === void 0 || _finishButtonProps$on.call(finishButtonProps, event);
|
|
64
71
|
setShowModal(false);
|
|
65
72
|
}
|
|
66
|
-
}, [
|
|
73
|
+
}, [finishButtonProps, displayType]);
|
|
67
74
|
const handleDisplay = (0, _react.useCallback)(() => {
|
|
68
75
|
if (displayType === 'modal') {
|
|
69
76
|
setShowModal(true);
|
|
@@ -116,8 +123,12 @@ const MAlipayButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
116
123
|
formHtml: formHtmlString
|
|
117
124
|
}), displayType === 'modal' && formHtmlString && /*#__PURE__*/_react.default.createElement(_confirmModal.default, _extends({
|
|
118
125
|
visible: showModal,
|
|
119
|
-
|
|
120
|
-
|
|
126
|
+
retryButtonProps: _objectSpread({
|
|
127
|
+
onClick: handleRetry
|
|
128
|
+
}, (0, _omit.default)(retryButtonProps || {}, ['onClick'])),
|
|
129
|
+
finishButtonProps: _objectSpread({
|
|
130
|
+
onClick: handleFinish
|
|
131
|
+
}, (0, _omit.default)(finishButtonProps || {}, ['onClick'])),
|
|
121
132
|
onClose: handleOnCloseModal,
|
|
122
133
|
autoOpenWindow: false
|
|
123
134
|
}, modalPropsOthers)), showMask && formHtmlString && /*#__PURE__*/_react.default.createElement(_PayMask.default, _extends({
|
|
@@ -132,4 +143,4 @@ const MAlipayButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
132
143
|
}, restMaskProps)));
|
|
133
144
|
});
|
|
134
145
|
MAlipayButton.displayName = 'MAlipayButton';
|
|
135
|
-
var _default = exports.default = MAlipayButton;
|
|
146
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(MAlipayButton);
|
|
@@ -11,11 +11,17 @@ var _confirmModal = _interopRequireDefault(require("../confirm-modal"));
|
|
|
11
11
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
12
12
|
var _icons = require("../icons");
|
|
13
13
|
var _getPrefixCls = require("../utils/getPrefixCls");
|
|
14
|
+
var _omit = _interopRequireDefault(require("../utils/omit"));
|
|
14
15
|
const _excluded = ["className", "children", "onClick", "wechatUrl", "createOrder", "displayType", "modalProps", "maskProps"],
|
|
15
|
-
_excluded2 = ["
|
|
16
|
+
_excluded2 = ["retryButtonProps", "finishButtonProps", "onClose"],
|
|
16
17
|
_excluded3 = ["onClose"];
|
|
17
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
19
|
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); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
24
|
+
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); }
|
|
19
25
|
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); }
|
|
20
26
|
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; }
|
|
21
27
|
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; }
|
|
@@ -33,8 +39,8 @@ const MWechatButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
33
39
|
others = _objectWithoutProperties(props, _excluded);
|
|
34
40
|
const _ref = modalProps || {},
|
|
35
41
|
{
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
retryButtonProps,
|
|
43
|
+
finishButtonProps,
|
|
38
44
|
onClose
|
|
39
45
|
} = _ref,
|
|
40
46
|
modalPropsOthers = _objectWithoutProperties(_ref, _excluded2);
|
|
@@ -50,18 +56,20 @@ const MWechatButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
50
56
|
const [showModal, setShowModal] = (0, _react.useState)(false);
|
|
51
57
|
const [wechatUrl, setWechatUrl] = (0, _react.useState)();
|
|
52
58
|
(0, _react.useImperativeHandle)(ref, () => mWeChatButtonRef.current);
|
|
53
|
-
const handleRetry = (0, _react.useCallback)(
|
|
59
|
+
const handleRetry = (0, _react.useCallback)(event => {
|
|
54
60
|
if (displayType === 'modal') {
|
|
55
|
-
|
|
61
|
+
var _retryButtonProps$onC;
|
|
62
|
+
retryButtonProps === null || retryButtonProps === void 0 || (_retryButtonProps$onC = retryButtonProps.onClick) === null || _retryButtonProps$onC === void 0 || _retryButtonProps$onC.call(retryButtonProps, event);
|
|
56
63
|
setShowModal(false);
|
|
57
64
|
}
|
|
58
|
-
}, [
|
|
59
|
-
const handleFinish = (0, _react.useCallback)(
|
|
65
|
+
}, [retryButtonProps, displayType]);
|
|
66
|
+
const handleFinish = (0, _react.useCallback)(event => {
|
|
60
67
|
if (displayType === 'modal') {
|
|
61
|
-
|
|
68
|
+
var _finishButtonProps$on;
|
|
69
|
+
finishButtonProps === null || finishButtonProps === void 0 || (_finishButtonProps$on = finishButtonProps.onClick) === null || _finishButtonProps$on === void 0 || _finishButtonProps$on.call(finishButtonProps, event);
|
|
62
70
|
setShowModal(false);
|
|
63
71
|
}
|
|
64
|
-
}, [
|
|
72
|
+
}, [finishButtonProps, displayType]);
|
|
65
73
|
const handleDisplay = (0, _react.useCallback)(() => {
|
|
66
74
|
if (displayType === 'modal') {
|
|
67
75
|
setShowModal(true);
|
|
@@ -115,11 +123,15 @@ const MWechatButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
115
123
|
}, restMaskProps)), displayType === 'modal' && showModal && wechatUrl && /*#__PURE__*/_react.default.createElement(_confirmModal.default, _extends({
|
|
116
124
|
visible: showModal,
|
|
117
125
|
onClose: handleOnCloseModal,
|
|
118
|
-
|
|
119
|
-
|
|
126
|
+
retryButtonProps: _objectSpread({
|
|
127
|
+
onClick: handleRetry
|
|
128
|
+
}, (0, _omit.default)(retryButtonProps || {}, ['onClick'])),
|
|
129
|
+
finishButtonProps: _objectSpread({
|
|
130
|
+
onClick: handleFinish
|
|
131
|
+
}, (0, _omit.default)(finishButtonProps || {}, ['onClick'])),
|
|
120
132
|
payUrl: wechatUrl,
|
|
121
133
|
autoOpenWindow: true
|
|
122
134
|
}, modalPropsOthers)));
|
|
123
135
|
});
|
|
124
136
|
MWechatButton.displayName = 'MWechatButton';
|
|
125
|
-
var _default = exports.default = MWechatButton;
|
|
137
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(MWechatButton);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {};
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _shared = require("../shared");
|
|
10
10
|
var _Paypal = require("../Paypal");
|
|
11
11
|
var _Stripe = _interopRequireDefault(require("../Stripe"));
|
|
@@ -28,6 +28,7 @@ Object.keys(_interface).forEach(function (key) {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
31
|
+
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); }
|
|
31
32
|
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); }
|
|
32
33
|
const PayButton = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
33
34
|
if (props.payMethod === _shared.PaymentMethod.PaypalH5 || props.payMethod === _shared.PaymentMethod.PaypalPc) {
|
|
@@ -73,4 +74,4 @@ const PayButton = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
73
74
|
return null;
|
|
74
75
|
});
|
|
75
76
|
PayButton.displayName = 'PayButton';
|
|
76
|
-
var _default = exports.default = PayButton;
|
|
77
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(PayButton);
|
|
@@ -80,4 +80,4 @@ const PaypalButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
80
80
|
}, restMaskProps)));
|
|
81
81
|
});
|
|
82
82
|
PaypalButton.displayName = 'PaypalButton';
|
|
83
|
-
var _default = exports.default = PaypalButton;
|
|
83
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(PaypalButton);
|
|
@@ -80,4 +80,4 @@ const PayssionButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
|
80
80
|
}, restMaskProps)));
|
|
81
81
|
});
|
|
82
82
|
PayssionButton.displayName = 'PayssionButton';
|
|
83
|
-
var _default = exports.default = PayssionButton;
|
|
83
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(PayssionButton);
|