pay-sdk-react 1.1.1 → 1.1.3
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 +38 -20
- package/README.zh-CN.md +38 -20
- package/dist/css/index.css +703 -1
- package/dist/css/index.min.css +1 -0
- package/dist/es/Airwallex/airwallex-button.js +56 -36
- package/dist/es/Airwallex/airwallex-modal.js +41 -34
- package/dist/es/Airwallex/airwallex-popup.js +43 -38
- package/dist/es/Airwallex/airwallex.js +26 -28
- package/dist/es/Airwallex/index.js +1 -1
- package/dist/es/Airwallex/style/index.css +335 -1
- package/dist/es/Airwallex/style/index.min.css +1 -0
- package/dist/es/Alipay/alipay-button.js +39 -24
- package/dist/es/Alipay/alipay-modal.js +38 -32
- package/dist/es/Alipay/alipay.js +22 -15
- package/dist/es/Alipay/index.d.ts +4 -4
- package/dist/es/Alipay/index.js +5 -5
- package/dist/es/Alipay/interface.d.ts +7 -9
- package/dist/es/Alipay/style/index.css +18 -1
- package/dist/es/Alipay/style/index.min.css +1 -0
- package/dist/es/Button/button.js +62 -37
- package/dist/es/Button/index.d.ts +2 -2
- package/dist/es/Button/index.js +2 -2
- package/dist/es/Button/interface.d.ts +4 -0
- package/dist/es/Button/style/index.css +95 -1
- package/dist/es/Button/style/index.min.css +1 -0
- package/dist/es/FullScreenLoading/index.js +40 -40
- package/dist/es/FullScreenLoading/interface.d.ts +2 -2
- package/dist/es/FullScreenLoading/style/index.css +239 -1
- package/dist/es/FullScreenLoading/style/index.min.css +1 -0
- package/dist/es/MAlipay/index.js +1 -1
- package/dist/es/MAlipay/m-alipay-auto-submit.js +9 -11
- package/dist/es/MAlipay/m-alipay-button.js +86 -55
- package/dist/es/MAlipay/style/index.css +252 -1
- package/dist/es/MAlipay/style/index.min.css +1 -0
- package/dist/es/MWeChat/index.d.ts +2 -2
- package/dist/es/MWeChat/index.js +2 -2
- package/dist/es/MWeChat/m-wechat-button.js +86 -54
- package/dist/es/MWeChat/style/index.css +252 -1
- package/dist/es/MWeChat/style/index.min.css +1 -0
- package/dist/es/Mask/index.d.ts +2 -2
- package/dist/es/Mask/index.js +2 -2
- package/dist/es/Mask/mask.js +48 -45
- package/dist/es/Mask/style/index.css +11 -1
- package/dist/es/Mask/style/index.min.css +1 -0
- package/dist/es/PayButton/index.js +2 -2
- package/dist/es/PayButton/interface.d.ts +9 -9
- package/dist/es/PayButton/interface.js +1 -1
- package/dist/es/PayMask/index.d.ts +2 -2
- package/dist/es/PayMask/index.js +2 -2
- package/dist/es/PayMask/interface.d.ts +2 -2
- package/dist/es/PayMask/pay-mask.js +41 -40
- package/dist/es/PayMask/style/index.css +62 -1
- package/dist/es/PayMask/style/index.min.css +1 -0
- package/dist/es/Paypal/index.d.ts +2 -2
- package/dist/es/Paypal/index.js +2 -2
- package/dist/es/Paypal/paypal-button.js +55 -36
- package/dist/es/Paypal/style/index.css +207 -1
- package/dist/es/Paypal/style/index.min.css +1 -0
- package/dist/es/Payssion/index.d.ts +2 -2
- package/dist/es/Payssion/index.js +2 -2
- package/dist/es/Payssion/payssion-button.js +56 -37
- package/dist/es/Payssion/style/index.css +157 -1
- package/dist/es/Payssion/style/index.min.css +1 -0
- package/dist/es/Stripe/index.d.ts +5 -5
- package/dist/es/Stripe/index.js +6 -6
- package/dist/es/Stripe/stripe-button.js +47 -33
- package/dist/es/Stripe/stripe-modal.js +38 -32
- package/dist/es/Stripe/stripe-popup.js +42 -37
- package/dist/es/Stripe/stripe.js +15 -15
- package/dist/es/Stripe/style/index.css +365 -1
- package/dist/es/Stripe/style/index.min.css +1 -0
- package/dist/es/Wechat/index.d.ts +4 -4
- package/dist/es/Wechat/index.js +5 -5
- package/dist/es/Wechat/style/index.css +25 -1
- package/dist/es/Wechat/style/index.min.css +1 -0
- package/dist/es/Wechat/wechat-button.js +38 -23
- package/dist/es/Wechat/wechat-modal.js +37 -31
- package/dist/es/Wechat/wechat.js +16 -12
- package/dist/es/confirm-modal/index.d.ts +3 -3
- package/dist/es/confirm-modal/index.js +53 -35
- package/dist/es/confirm-modal/interface.d.ts +2 -2
- package/dist/es/confirm-modal/style/index.css +95 -1
- package/dist/es/confirm-modal/style/index.min.css +1 -0
- package/dist/es/dot-loading/dot-loading.js +25 -23
- package/dist/es/dot-loading/index.d.ts +2 -2
- package/dist/es/dot-loading/index.js +2 -2
- package/dist/es/dot-loading/style/index.css +3 -1
- package/dist/es/dot-loading/style/index.min.css +1 -0
- package/dist/es/hooks/use-initialized.js +2 -2
- package/dist/es/hooks/use-inner-visible.js +8 -4
- package/dist/es/hooks/use-lock-scroll.d.ts +2 -2
- package/dist/es/hooks/use-lock-scroll.js +30 -34
- package/dist/es/hooks/use-touch.d.ts +1 -1
- package/dist/es/hooks/use-touch.js +35 -31
- package/dist/es/hooks/usePayWindowOpen.d.ts +1 -1
- package/dist/es/hooks/usePayWindowOpen.js +31 -27
- package/dist/es/icons/IconAlipay/index.js +18 -16
- package/dist/es/icons/IconClose/index.js +24 -22
- package/dist/es/icons/IconPaypalText/index.js +24 -22
- package/dist/es/icons/IconPaypalWhite/index.js +19 -17
- package/dist/es/icons/IconPayssionPay/index.js +47 -45
- package/dist/es/icons/IconStripe/index.js +19 -17
- package/dist/es/icons/IconStripeText/index.js +19 -17
- package/dist/es/icons/IconWechatPay/index.js +18 -16
- package/dist/es/icons/interface.d.ts +1 -1
- package/dist/es/icons/style/index.css +45 -1
- package/dist/es/icons/style/index.min.css +1 -0
- package/dist/es/index.d.ts +1 -1
- package/dist/es/pay-modal/index.d.ts +2 -2
- package/dist/es/pay-modal/index.js +2 -2
- package/dist/es/pay-modal/interface.d.ts +8 -18
- package/dist/es/pay-modal/pay-modal.js +53 -42
- package/dist/es/pay-modal/style/index.css +95 -1
- package/dist/es/pay-modal/style/index.min.css +1 -0
- package/dist/es/pay-popup/index.js +51 -53
- package/dist/es/pay-popup/interface.d.ts +6 -6
- package/dist/es/pay-popup/style/index.css +145 -1
- package/dist/es/pay-popup/style/index.min.css +1 -0
- package/dist/es/shared/enums/index.js +1 -1
- package/dist/es/shared/index.d.ts +1 -1
- package/dist/es/shared/index.js +1 -1
- package/dist/es/utils/can-use-dom.js +1 -1
- package/dist/es/utils/classNames.js +15 -11
- package/dist/es/utils/dom.js +18 -18
- package/dist/es/utils/get-container.js +2 -2
- package/dist/es/utils/get-scroll-parent.js +8 -9
- package/dist/es/utils/is.js +54 -32
- package/dist/es/utils/native-props.d.ts +2 -2
- package/dist/es/utils/native-props.js +7 -9
- package/dist/es/utils/omit.js +3 -5
- package/dist/es/utils/qrcode.js +5 -5
- package/dist/es/utils/render-to-container.d.ts +1 -1
- package/dist/es/utils/render-to-container.js +4 -4
- package/dist/es/utils/should-render.d.ts +1 -1
- package/dist/es/utils/should-render.js +4 -4
- package/dist/es/utils/supports-passive.js +8 -7
- package/dist/es/utils/warning.js +0 -1
- package/dist/es/utils/with-default-props.js +6 -4
- package/dist/es/utils/with-stop-propagation.d.ts +3 -3
- package/dist/es/utils/with-stop-propagation.js +27 -14
- package/dist/lib/Airwallex/airwallex-button.js +12 -15
- package/dist/lib/Airwallex/airwallex-modal.js +11 -14
- package/dist/lib/Airwallex/airwallex-popup.js +16 -23
- package/dist/lib/Airwallex/airwallex.js +20 -25
- package/dist/lib/Airwallex/index.js +1 -1
- package/dist/lib/Airwallex/style/index.css +335 -1
- package/dist/lib/Airwallex/style/index.min.css +1 -0
- package/dist/lib/Alipay/alipay-button.js +12 -15
- package/dist/lib/Alipay/alipay-modal.js +10 -13
- package/dist/lib/Alipay/alipay.js +19 -23
- package/dist/lib/Alipay/index.js +1 -1
- package/dist/lib/Alipay/style/index.css +18 -1
- package/dist/lib/Alipay/style/index.min.css +1 -0
- package/dist/lib/Button/button.js +13 -13
- package/dist/lib/Button/index.js +1 -1
- package/dist/lib/Button/style/index.css +95 -1
- package/dist/lib/Button/style/index.min.css +1 -0
- package/dist/lib/FullScreenLoading/index.js +28 -29
- package/dist/lib/FullScreenLoading/style/index.css +239 -1
- package/dist/lib/FullScreenLoading/style/index.min.css +1 -0
- package/dist/lib/MAlipay/index.js +1 -1
- package/dist/lib/MAlipay/m-alipay-auto-submit.js +3 -4
- package/dist/lib/MAlipay/m-alipay-button.js +42 -41
- package/dist/lib/MAlipay/style/index.css +252 -1
- package/dist/lib/MAlipay/style/index.min.css +1 -0
- package/dist/lib/MWeChat/index.js +2 -2
- package/dist/lib/MWeChat/m-wechat-button.js +43 -41
- package/dist/lib/MWeChat/style/index.css +252 -1
- package/dist/lib/MWeChat/style/index.min.css +1 -0
- package/dist/lib/Mask/index.js +1 -1
- package/dist/lib/Mask/mask.js +6 -11
- package/dist/lib/Mask/style/index.css +11 -1
- package/dist/lib/Mask/style/index.min.css +1 -0
- package/dist/lib/PayButton/index.js +10 -10
- package/dist/lib/PayMask/index.js +1 -1
- package/dist/lib/PayMask/pay-mask.js +20 -23
- package/dist/lib/PayMask/style/index.css +62 -1
- package/dist/lib/PayMask/style/index.min.css +1 -0
- package/dist/lib/Paypal/index.js +2 -2
- package/dist/lib/Paypal/paypal-button.js +17 -22
- package/dist/lib/Paypal/style/index.css +207 -1
- package/dist/lib/Paypal/style/index.min.css +1 -0
- package/dist/lib/Payssion/index.js +2 -2
- package/dist/lib/Payssion/payssion-button.js +17 -22
- package/dist/lib/Payssion/style/index.css +157 -1
- package/dist/lib/Payssion/style/index.min.css +1 -0
- package/dist/lib/Stripe/index.js +1 -1
- package/dist/lib/Stripe/stripe-button.js +14 -17
- package/dist/lib/Stripe/stripe-modal.js +10 -13
- package/dist/lib/Stripe/stripe-popup.js +16 -23
- package/dist/lib/Stripe/stripe.js +8 -11
- package/dist/lib/Stripe/style/index.css +365 -1
- package/dist/lib/Stripe/style/index.min.css +1 -0
- package/dist/lib/Wechat/index.js +1 -1
- package/dist/lib/Wechat/style/index.css +25 -1
- package/dist/lib/Wechat/style/index.min.css +1 -0
- package/dist/lib/Wechat/wechat-button.js +12 -15
- package/dist/lib/Wechat/wechat-modal.js +9 -12
- package/dist/lib/Wechat/wechat.js +11 -12
- package/dist/lib/confirm-modal/index.js +22 -12
- package/dist/lib/confirm-modal/style/index.css +95 -1
- package/dist/lib/confirm-modal/style/index.min.css +1 -0
- package/dist/lib/dot-loading/dot-loading.js +3 -4
- package/dist/lib/dot-loading/index.js +1 -1
- package/dist/lib/dot-loading/style/index.css +3 -1
- package/dist/lib/dot-loading/style/index.min.css +1 -0
- package/dist/lib/hooks/use-lock-scroll.js +11 -12
- package/dist/lib/hooks/use-touch.js +10 -10
- package/dist/lib/hooks/usePayWindowOpen.js +14 -15
- package/dist/lib/icons/IconAlipay/index.js +6 -6
- package/dist/lib/icons/IconClose/index.js +8 -8
- package/dist/lib/icons/IconPaypalText/index.js +7 -7
- package/dist/lib/icons/IconPaypalWhite/index.js +6 -6
- package/dist/lib/icons/IconPayssionPay/index.js +13 -13
- package/dist/lib/icons/IconStripe/index.js +6 -6
- package/dist/lib/icons/IconStripeText/index.js +6 -6
- package/dist/lib/icons/IconWechatPay/index.js +6 -6
- package/dist/lib/icons/index.js +2 -2
- package/dist/lib/icons/style/index.css +45 -1
- package/dist/lib/icons/style/index.min.css +1 -0
- package/dist/lib/index.js +2 -2
- package/dist/lib/pay-modal/index.js +1 -1
- package/dist/lib/pay-modal/pay-modal.js +29 -21
- package/dist/lib/pay-modal/style/index.css +95 -1
- package/dist/lib/pay-modal/style/index.min.css +1 -0
- package/dist/lib/pay-popup/index.js +24 -28
- package/dist/lib/pay-popup/style/index.css +145 -1
- package/dist/lib/pay-popup/style/index.min.css +1 -0
- package/dist/lib/utils/can-use-dom.js +1 -1
- package/dist/lib/utils/classNames.js +6 -7
- package/dist/lib/utils/dom.js +9 -11
- package/dist/lib/utils/get-scroll-parent.js +2 -3
- package/dist/lib/utils/getPrefixCls.js +1 -1
- package/dist/lib/utils/is.js +16 -14
- package/dist/lib/utils/native-props.js +10 -10
- package/dist/lib/utils/omit.js +3 -6
- package/dist/lib/utils/qrcode.js +1 -1
- package/dist/lib/utils/supports-passive.js +4 -3
- package/dist/lib/utils/warning.js +2 -6
- package/dist/lib/utils/with-default-props.js +4 -8
- package/dist/lib/utils/with-stop-propagation.js +6 -9
- package/dist/umd/pay-sdk-react.umd.js +106 -86
- package/dist/umd/pay-sdk-react.umd.js.map +1 -1
- package/package.json +5 -2
package/dist/es/Wechat/wechat.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
1
2
|
import React, { memo, useEffect, useState } from 'react';
|
|
2
3
|
import cs from '../utils/classNames';
|
|
3
4
|
import makeQrcode from '../utils/qrcode';
|
|
4
5
|
import { getPrefixCls } from '../utils/getPrefixCls';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
wechatType = 'qrcode',
|
|
9
|
-
wechatUrl,
|
|
10
|
-
tipText =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
var classPrefix = getPrefixCls('wechat');
|
|
7
|
+
var WechatQrCode = function WechatQrCode(_ref) {
|
|
8
|
+
var _ref$wechatType = _ref.wechatType,
|
|
9
|
+
wechatType = _ref$wechatType === void 0 ? 'qrcode' : _ref$wechatType,
|
|
10
|
+
wechatUrl = _ref.wechatUrl,
|
|
11
|
+
_ref$tipText = _ref.tipText,
|
|
12
|
+
tipText = _ref$tipText === void 0 ? '请使用微信APP扫码支付' : _ref$tipText,
|
|
13
|
+
className = _ref.className,
|
|
14
|
+
style = _ref.style;
|
|
15
|
+
var _useState = useState(''),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
imageUrl = _useState2[0],
|
|
18
|
+
setImageUrl = _useState2[1];
|
|
19
|
+
useEffect(function () {
|
|
16
20
|
if (wechatType === 'qrcode') {
|
|
17
|
-
makeQrcode(wechatUrl).then(url
|
|
21
|
+
makeQrcode(wechatUrl).then(function (url) {
|
|
18
22
|
setImageUrl(url);
|
|
19
23
|
});
|
|
20
24
|
} else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { ConfirmModalProps } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConfirmModalProps } from './interface';
|
|
3
3
|
declare const ConfirmModal: React.FC<ConfirmModalProps>;
|
|
4
|
-
export * from
|
|
4
|
+
export * from './interface';
|
|
5
5
|
export default ConfirmModal;
|
|
@@ -1,35 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["children"],
|
|
4
|
+
_excluded2 = ["children"];
|
|
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
|
+
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
|
+
import React, { useCallback } from 'react';
|
|
8
|
+
import { usePayWindowOpen } from '../hooks/usePayWindowOpen';
|
|
9
|
+
import PayModal from '../pay-modal';
|
|
10
|
+
var ConfirmModal = function ConfirmModal(props) {
|
|
11
|
+
var visible = props.visible,
|
|
12
|
+
_props$title = props.title,
|
|
13
|
+
title = _props$title === void 0 ? '支付确认' : _props$title,
|
|
14
|
+
_props$desc = props.desc,
|
|
15
|
+
desc = _props$desc === void 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, "1. \u5982\u679C\u60A8\u5DF2\u5B8C\u6210\u652F\u4ED8\uFF0C\u8BF7\u70B9\u51FB[\u652F\u4ED8\u5B8C\u6210]"), /*#__PURE__*/React.createElement("div", null, "2. \u5982\u679C\u672A\u652F\u4ED8\u6210\u529F\uFF0C\u53EF\u70B9\u51FB[\u91CD\u65B0\u652F\u4ED8]")) : _props$desc,
|
|
16
|
+
retryButtonProps = props.retryButtonProps,
|
|
17
|
+
finishButtonProps = props.finishButtonProps,
|
|
18
|
+
_props$icon = props.icon,
|
|
19
|
+
icon = _props$icon === void 0 ? /*#__PURE__*/React.createElement("span", {
|
|
14
20
|
role: "img",
|
|
15
21
|
"aria-label": "success"
|
|
16
|
-
}, "\u2714\uFE0F"),
|
|
17
|
-
showClose =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
22
|
+
}, "\u2714\uFE0F") : _props$icon,
|
|
23
|
+
_props$showClose = props.showClose,
|
|
24
|
+
showClose = _props$showClose === void 0 ? true : _props$showClose,
|
|
25
|
+
_props$maskClosable = props.maskClosable,
|
|
26
|
+
maskClosable = _props$maskClosable === void 0 ? false : _props$maskClosable,
|
|
27
|
+
onClose = props.onClose,
|
|
28
|
+
payUrl = props.payUrl,
|
|
29
|
+
_props$autoOpenWindow = props.autoOpenWindow,
|
|
30
|
+
autoOpenWindow = _props$autoOpenWindow === void 0 ? false : _props$autoOpenWindow,
|
|
31
|
+
_props$openMode = props.openMode,
|
|
32
|
+
openMode = _props$openMode === void 0 ? 'window' : _props$openMode;
|
|
33
|
+
var _ref = retryButtonProps || {},
|
|
34
|
+
_ref$children = _ref.children,
|
|
35
|
+
retryButtonChildren = _ref$children === void 0 ? '重新支付' : _ref$children,
|
|
36
|
+
retryButtonPropsRest = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
var _ref2 = finishButtonProps || {},
|
|
38
|
+
_ref2$children = _ref2.children,
|
|
39
|
+
finishButtonChildren = _ref2$children === void 0 ? '支付完成' : _ref2$children,
|
|
40
|
+
finishButtonPropsRest = _objectWithoutProperties(_ref2, _excluded2);
|
|
41
|
+
var _usePayWindowOpen = usePayWindowOpen({
|
|
42
|
+
payUrl: payUrl || '',
|
|
43
|
+
onClose: onClose,
|
|
44
|
+
autoOpen: autoOpenWindow,
|
|
45
|
+
openMode: openMode
|
|
46
|
+
}),
|
|
47
|
+
closeWindow = _usePayWindowOpen.closeWindow;
|
|
48
|
+
var handleClose = useCallback(function () {
|
|
33
49
|
onClose === null || onClose === void 0 || onClose();
|
|
34
50
|
if (autoOpenWindow) closeWindow();
|
|
35
51
|
}, [onClose, autoOpenWindow, closeWindow]);
|
|
@@ -42,11 +58,13 @@ const ConfirmModal = props => {
|
|
|
42
58
|
showClose: showClose,
|
|
43
59
|
maskClosable: maskClosable,
|
|
44
60
|
onClose: handleClose,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
retryButtonProps: _objectSpread({
|
|
62
|
+
children: retryButtonChildren
|
|
63
|
+
}, retryButtonPropsRest),
|
|
64
|
+
finishButtonProps: _objectSpread({
|
|
65
|
+
children: finishButtonChildren
|
|
66
|
+
}, finishButtonPropsRest)
|
|
49
67
|
});
|
|
50
68
|
};
|
|
51
|
-
export * from
|
|
69
|
+
export * from './interface';
|
|
52
70
|
export default ConfirmModal;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OpenPayUrlMode } from
|
|
2
|
-
import { PayModalProps } from
|
|
1
|
+
import { OpenPayUrlMode } from '../hooks/usePayWindowOpen';
|
|
2
|
+
import { PayModalProps } from '../pay-modal';
|
|
3
3
|
export interface ConfirmModalProps extends PayModalProps {
|
|
4
4
|
/**
|
|
5
5
|
* @zh 支付页面 url
|
|
@@ -1 +1,95 @@
|
|
|
1
|
-
.pay-modal
|
|
1
|
+
.pay-modal {
|
|
2
|
+
position: fixed;
|
|
3
|
+
z-index: 9999;
|
|
4
|
+
left: 0;
|
|
5
|
+
top: 0;
|
|
6
|
+
right: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
}
|
|
12
|
+
.pay-modal__mask {
|
|
13
|
+
position: absolute;
|
|
14
|
+
left: 0;
|
|
15
|
+
top: 0;
|
|
16
|
+
right: 0;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
background: rgba(0, 0, 0, 0.55);
|
|
19
|
+
z-index: 0;
|
|
20
|
+
}
|
|
21
|
+
.pay-modal__content {
|
|
22
|
+
position: relative;
|
|
23
|
+
z-index: 1;
|
|
24
|
+
background: #fff;
|
|
25
|
+
border-radius: 16px;
|
|
26
|
+
padding: 42px 20px 20px 20px;
|
|
27
|
+
min-width: 280px;
|
|
28
|
+
max-width: 80vw;
|
|
29
|
+
box-shadow: 0 4px 24px #0001;
|
|
30
|
+
text-align: center;
|
|
31
|
+
max-height: 60vh;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
}
|
|
35
|
+
.pay-modal__close {
|
|
36
|
+
position: absolute;
|
|
37
|
+
right: 12px;
|
|
38
|
+
top: 12px;
|
|
39
|
+
background: none;
|
|
40
|
+
border: none;
|
|
41
|
+
font-size: 28px;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
text-align: left;
|
|
44
|
+
}
|
|
45
|
+
.pay-modal__icon {
|
|
46
|
+
margin-bottom: 8px;
|
|
47
|
+
font-size: 40px;
|
|
48
|
+
}
|
|
49
|
+
.pay-modal__title {
|
|
50
|
+
font-size: 20px;
|
|
51
|
+
font-weight: 700;
|
|
52
|
+
color: #222;
|
|
53
|
+
margin-bottom: 12px;
|
|
54
|
+
}
|
|
55
|
+
.pay-modal__desc {
|
|
56
|
+
color: #222;
|
|
57
|
+
font-size: 15px;
|
|
58
|
+
margin-bottom: 24px;
|
|
59
|
+
line-height: 1.7;
|
|
60
|
+
text-align: left;
|
|
61
|
+
}
|
|
62
|
+
.pay-modal__content-wrapper {
|
|
63
|
+
position: relative;
|
|
64
|
+
z-index: 1;
|
|
65
|
+
text-align: center;
|
|
66
|
+
overflow-y: auto;
|
|
67
|
+
flex: 1;
|
|
68
|
+
min-height: 0;
|
|
69
|
+
}
|
|
70
|
+
.pay-modal__actions {
|
|
71
|
+
display: flex;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
gap: 16px;
|
|
74
|
+
margin-top: 16px;
|
|
75
|
+
}
|
|
76
|
+
.pay-modal__btn {
|
|
77
|
+
min-width: 96px;
|
|
78
|
+
padding: 8px 0;
|
|
79
|
+
border-radius: 24px;
|
|
80
|
+
border: none;
|
|
81
|
+
font-size: 15px;
|
|
82
|
+
font-weight: 600;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
transition: background 0.2s;
|
|
85
|
+
}
|
|
86
|
+
.pay-modal__btn--retry {
|
|
87
|
+
background: #fff;
|
|
88
|
+
color: #f25a5a;
|
|
89
|
+
border: 1.5px solid #f25a5a;
|
|
90
|
+
}
|
|
91
|
+
.pay-modal__btn--finish {
|
|
92
|
+
background: #f25a5a;
|
|
93
|
+
color: #fff;
|
|
94
|
+
border: none;
|
|
95
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pay-modal{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-modal__mask{position:absolute;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.55);z-index:0}.pay-modal__content{position:relative;z-index:1;background:#fff;border-radius:16px;padding:42px 20px 20px;min-width:280px;max-width:80vw;box-shadow:0 4px 24px #0001;text-align:center;max-height:60vh;display:flex;flex-direction:column}.pay-modal__close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:28px;cursor:pointer;text-align:left}.pay-modal__icon{margin-bottom:8px;font-size:40px}.pay-modal__title{font-size:20px;font-weight:700;color:#222;margin-bottom:12px}.pay-modal__desc{color:#222;font-size:15px;margin-bottom:24px;line-height:1.7;text-align:left}.pay-modal__content-wrapper{position:relative;z-index:1;text-align:center;overflow-y:auto;flex:1;min-height:0}.pay-modal__actions{display:flex;justify-content:center;gap:16px;margin-top:16px}.pay-modal__btn{min-width:96px;padding:8px 0;border-radius:24px;border:none;font-size:15px;font-weight:600;cursor:pointer;transition:background .2s}.pay-modal__btn--retry{background:#fff;color:#f25a5a;border:1.5px solid #f25a5a}.pay-modal__btn--finish{background:#f25a5a;color:#fff;border:none}
|
|
@@ -3,18 +3,18 @@ import cs from '../utils/classNames';
|
|
|
3
3
|
import { mergeProps } from '../utils/with-default-props';
|
|
4
4
|
import { withNativeProps } from '../utils/native-props';
|
|
5
5
|
import { getPrefixCls } from '../utils/getPrefixCls';
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
var classPrefix = getPrefixCls('dot-loading');
|
|
7
|
+
var colorRecord = {
|
|
8
8
|
default: 'var(--adm-color-weak)',
|
|
9
9
|
primary: 'var(--adm-color-primary)',
|
|
10
10
|
white: 'var(--adm-color-white)'
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
var defaultProps = {
|
|
13
13
|
color: 'default'
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
var DotLoading = /*#__PURE__*/React.memo(function (p) {
|
|
16
16
|
var _colorRecord$props$co;
|
|
17
|
-
|
|
17
|
+
var props = mergeProps(defaultProps, p);
|
|
18
18
|
return withNativeProps(props, /*#__PURE__*/React.createElement("div", {
|
|
19
19
|
style: {
|
|
20
20
|
color: (_colorRecord$props$co = colorRecord[props.color]) !== null && _colorRecord$props$co !== void 0 ? _colorRecord$props$co : props.color
|
|
@@ -37,24 +37,26 @@ const DotLoading = /*#__PURE__*/React.memo(p => {
|
|
|
37
37
|
transform: "translate(95.000000, 71.000000)"
|
|
38
38
|
}, /*#__PURE__*/React.createElement("g", {
|
|
39
39
|
transform: "translate(5.000000, 0.000000)"
|
|
40
|
-
}, [0, 1, 2].map(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
}, [0, 1, 2].map(function (i) {
|
|
41
|
+
return /*#__PURE__*/React.createElement("rect", {
|
|
42
|
+
key: i,
|
|
43
|
+
fill: "currentColor",
|
|
44
|
+
x: 20 + i * 26,
|
|
45
|
+
y: "16",
|
|
46
|
+
width: "8",
|
|
47
|
+
height: "8",
|
|
48
|
+
rx: "2"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("animate", {
|
|
50
|
+
attributeName: "y",
|
|
51
|
+
from: "16",
|
|
52
|
+
to: "16",
|
|
53
|
+
dur: "2s",
|
|
54
|
+
begin: "".concat(i * 0.2, "s"),
|
|
55
|
+
repeatCount: "indefinite",
|
|
56
|
+
values: "16; 6; 26; 16; 16",
|
|
57
|
+
keyTimes: "0; 0.1; 0.3; 0.4; 1"
|
|
58
|
+
}));
|
|
59
|
+
}))))))));
|
|
58
60
|
});
|
|
59
61
|
DotLoading.displayName = 'DotLoading';
|
|
60
62
|
export default DotLoading;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import DotLoading from
|
|
2
|
-
export * from
|
|
1
|
+
import DotLoading from './dot-loading';
|
|
2
|
+
export * from './interface';
|
|
3
3
|
export default DotLoading;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import DotLoading from
|
|
2
|
-
export * from
|
|
1
|
+
import DotLoading from './dot-loading';
|
|
2
|
+
export * from './interface';
|
|
3
3
|
export default DotLoading;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pay-dot-loading{display:inline-block}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useIsomorphicLayoutEffect } from 'ahooks';
|
|
3
4
|
export function useInnerVisible(outerVisible) {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
var _useState = useState(outerVisible),
|
|
6
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
7
|
+
innerVisible = _useState2[0],
|
|
8
|
+
setInnerVisible = _useState2[1];
|
|
9
|
+
useIsomorphicLayoutEffect(function () {
|
|
6
10
|
setInnerVisible(outerVisible);
|
|
7
11
|
}, [outerVisible]);
|
|
8
12
|
return innerVisible;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RefObject } from
|
|
2
|
-
export declare function useLockScroll(rootRef: RefObject<HTMLElement>, shouldLock: boolean |
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export declare function useLockScroll(rootRef: RefObject<HTMLElement>, shouldLock: boolean | 'strict'): void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useEffect } from
|
|
2
|
-
import { getScrollParent } from
|
|
3
|
-
import { supportsPassive } from
|
|
4
|
-
import { useTouch } from
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { getScrollParent } from '../utils/get-scroll-parent';
|
|
3
|
+
import { supportsPassive } from '../utils/supports-passive';
|
|
4
|
+
import { useTouch } from './use-touch';
|
|
5
|
+
var totalLockCount = 0;
|
|
6
|
+
var BODY_LOCK_CLASS = 'yfm-overflow-hidden';
|
|
7
7
|
function getScrollableElement(el) {
|
|
8
|
-
|
|
8
|
+
var current = el === null || el === void 0 ? void 0 : el.parentElement;
|
|
9
9
|
while (current) {
|
|
10
10
|
if (current.clientHeight < current.scrollHeight) {
|
|
11
11
|
return current;
|
|
@@ -15,44 +15,41 @@ function getScrollableElement(el) {
|
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
17
|
export function useLockScroll(rootRef, shouldLock) {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
var touch = useTouch();
|
|
19
|
+
var onTouchMove = function onTouchMove(event) {
|
|
20
20
|
touch.move(event);
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
var direction = touch.deltaY.current > 0 ? '10' : '01';
|
|
22
|
+
var el = getScrollParent(event.target, rootRef.current);
|
|
23
23
|
if (!el) return;
|
|
24
24
|
|
|
25
25
|
// This has perf cost but we have to compatible with iOS 12
|
|
26
|
-
if (shouldLock ===
|
|
27
|
-
|
|
26
|
+
if (shouldLock === 'strict') {
|
|
27
|
+
var scrollableParent = getScrollableElement(event.target);
|
|
28
28
|
if (scrollableParent === document.body || scrollableParent === document.documentElement) {
|
|
29
29
|
event.preventDefault();
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
height
|
|
40
|
-
} = el.getBoundingClientRect();
|
|
41
|
-
let status = "11";
|
|
33
|
+
var scrollHeight = el.scrollHeight,
|
|
34
|
+
offsetHeight = el.offsetHeight,
|
|
35
|
+
scrollTop = el.scrollTop;
|
|
36
|
+
var _el$getBoundingClient = el.getBoundingClientRect(),
|
|
37
|
+
height = _el$getBoundingClient.height;
|
|
38
|
+
var status = '11';
|
|
42
39
|
if (scrollTop === 0) {
|
|
43
|
-
status = offsetHeight >= scrollHeight ?
|
|
40
|
+
status = offsetHeight >= scrollHeight ? '00' : '01';
|
|
44
41
|
} else if (scrollHeight <= Math.round(height + scrollTop)) {
|
|
45
|
-
status =
|
|
42
|
+
status = '10';
|
|
46
43
|
}
|
|
47
|
-
if (status !==
|
|
44
|
+
if (status !== '11' && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
|
|
48
45
|
if (event.cancelable && supportsPassive) {
|
|
49
46
|
event.preventDefault();
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
};
|
|
53
|
-
|
|
54
|
-
document.addEventListener(
|
|
55
|
-
document.addEventListener(
|
|
50
|
+
var lock = function lock() {
|
|
51
|
+
document.addEventListener('touchstart', touch.start);
|
|
52
|
+
document.addEventListener('touchmove', onTouchMove, supportsPassive ? {
|
|
56
53
|
passive: false
|
|
57
54
|
} : false);
|
|
58
55
|
if (!totalLockCount) {
|
|
@@ -60,23 +57,22 @@ export function useLockScroll(rootRef, shouldLock) {
|
|
|
60
57
|
}
|
|
61
58
|
totalLockCount++;
|
|
62
59
|
};
|
|
63
|
-
|
|
60
|
+
var unlock = function unlock() {
|
|
64
61
|
if (totalLockCount) {
|
|
65
|
-
document.removeEventListener(
|
|
66
|
-
document.removeEventListener(
|
|
62
|
+
document.removeEventListener('touchstart', touch.start);
|
|
63
|
+
document.removeEventListener('touchmove', onTouchMove);
|
|
67
64
|
totalLockCount--;
|
|
68
65
|
if (!totalLockCount) {
|
|
69
66
|
document.body.classList.remove(BODY_LOCK_CLASS);
|
|
70
67
|
}
|
|
71
68
|
}
|
|
72
69
|
};
|
|
73
|
-
useEffect(()
|
|
70
|
+
useEffect(function () {
|
|
74
71
|
if (shouldLock) {
|
|
75
72
|
lock();
|
|
76
|
-
return ()
|
|
73
|
+
return function () {
|
|
77
74
|
unlock();
|
|
78
75
|
};
|
|
79
76
|
}
|
|
80
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
77
|
}, [shouldLock]);
|
|
82
78
|
}
|
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
import { useRef } from
|
|
2
|
-
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
var MIN_DISTANCE = 10;
|
|
3
3
|
function getDirection(x, y) {
|
|
4
4
|
if (x > y && x > MIN_DISTANCE) {
|
|
5
|
-
return
|
|
5
|
+
return 'horizontal';
|
|
6
6
|
}
|
|
7
7
|
if (y > x && y > MIN_DISTANCE) {
|
|
8
|
-
return
|
|
8
|
+
return 'vertical';
|
|
9
9
|
}
|
|
10
|
-
return
|
|
10
|
+
return '';
|
|
11
11
|
}
|
|
12
12
|
export function useTouch() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
var startX = useRef(0);
|
|
14
|
+
var startY = useRef(0);
|
|
15
|
+
var deltaX = useRef(0);
|
|
16
|
+
var deltaY = useRef(0);
|
|
17
|
+
var offsetX = useRef(0);
|
|
18
|
+
var offsetY = useRef(0);
|
|
19
|
+
var direction = useRef('');
|
|
20
|
+
var isVertical = function isVertical() {
|
|
21
|
+
return direction.current === 'vertical';
|
|
22
|
+
};
|
|
23
|
+
var isHorizontal = function isHorizontal() {
|
|
24
|
+
return direction.current === 'horizontal';
|
|
25
|
+
};
|
|
26
|
+
var reset = function reset() {
|
|
23
27
|
deltaX.current = 0;
|
|
24
28
|
deltaY.current = 0;
|
|
25
29
|
offsetX.current = 0;
|
|
26
30
|
offsetY.current = 0;
|
|
27
|
-
direction.current =
|
|
31
|
+
direction.current = '';
|
|
28
32
|
};
|
|
29
|
-
|
|
33
|
+
var start = function start(event) {
|
|
30
34
|
var _event$touches$0$clie, _event$touches$, _event$touches$0$clie2, _event$touches$2;
|
|
31
35
|
reset();
|
|
32
36
|
startX.current = (_event$touches$0$clie = (_event$touches$ = event.touches[0]) === null || _event$touches$ === void 0 ? void 0 : _event$touches$.clientX) !== null && _event$touches$0$clie !== void 0 ? _event$touches$0$clie : 0;
|
|
33
37
|
startY.current = (_event$touches$0$clie2 = (_event$touches$2 = event.touches[0]) === null || _event$touches$2 === void 0 ? void 0 : _event$touches$2.clientY) !== null && _event$touches$0$clie2 !== void 0 ? _event$touches$0$clie2 : 0;
|
|
34
38
|
};
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
var move = function move(event) {
|
|
40
|
+
var touch = event.touches[0];
|
|
37
41
|
if (!touch) return;
|
|
38
42
|
deltaX.current = touch.clientX - startX.current;
|
|
39
43
|
deltaY.current = (touch === null || touch === void 0 ? void 0 : touch.clientY) - startY.current;
|
|
@@ -44,17 +48,17 @@ export function useTouch() {
|
|
|
44
48
|
}
|
|
45
49
|
};
|
|
46
50
|
return {
|
|
47
|
-
move,
|
|
48
|
-
start,
|
|
49
|
-
reset,
|
|
50
|
-
startX,
|
|
51
|
-
startY,
|
|
52
|
-
deltaX,
|
|
53
|
-
deltaY,
|
|
54
|
-
offsetX,
|
|
55
|
-
offsetY,
|
|
56
|
-
direction,
|
|
57
|
-
isVertical,
|
|
58
|
-
isHorizontal
|
|
51
|
+
move: move,
|
|
52
|
+
start: start,
|
|
53
|
+
reset: reset,
|
|
54
|
+
startX: startX,
|
|
55
|
+
startY: startY,
|
|
56
|
+
deltaX: deltaX,
|
|
57
|
+
deltaY: deltaY,
|
|
58
|
+
offsetX: offsetX,
|
|
59
|
+
offsetY: offsetY,
|
|
60
|
+
direction: direction,
|
|
61
|
+
isVertical: isVertical,
|
|
62
|
+
isHorizontal: isHorizontal
|
|
59
63
|
};
|
|
60
64
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @zh 使用 replace: 如果您的业务逻辑是"一旦点击支付,就不能轻易返回",replace 会更合适。例如,点击支付后,您的后端已经创建了一张"待支付"的订单。为了防止用户通过"后退"按钮回到上一个页面再次创建订单,使用 replace 可以强制用户要么完成支付,要么关闭页面,而不能"后退"到上一步。
|
|
6
6
|
* @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.
|
|
7
7
|
*/
|
|
8
|
-
export type OpenPayUrlMode =
|
|
8
|
+
export type OpenPayUrlMode = 'window' | 'replace' | 'href';
|
|
9
9
|
interface UsePayWindowOpenOptions {
|
|
10
10
|
payUrl: string;
|
|
11
11
|
onClose?: () => void;
|