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.
Files changed (244) hide show
  1. package/README.md +38 -20
  2. package/README.zh-CN.md +38 -20
  3. package/dist/css/index.css +703 -1
  4. package/dist/css/index.min.css +1 -0
  5. package/dist/es/Airwallex/airwallex-button.js +56 -36
  6. package/dist/es/Airwallex/airwallex-modal.js +41 -34
  7. package/dist/es/Airwallex/airwallex-popup.js +43 -38
  8. package/dist/es/Airwallex/airwallex.js +26 -28
  9. package/dist/es/Airwallex/index.js +1 -1
  10. package/dist/es/Airwallex/style/index.css +335 -1
  11. package/dist/es/Airwallex/style/index.min.css +1 -0
  12. package/dist/es/Alipay/alipay-button.js +39 -24
  13. package/dist/es/Alipay/alipay-modal.js +38 -32
  14. package/dist/es/Alipay/alipay.js +22 -15
  15. package/dist/es/Alipay/index.d.ts +4 -4
  16. package/dist/es/Alipay/index.js +5 -5
  17. package/dist/es/Alipay/interface.d.ts +7 -9
  18. package/dist/es/Alipay/style/index.css +18 -1
  19. package/dist/es/Alipay/style/index.min.css +1 -0
  20. package/dist/es/Button/button.js +62 -37
  21. package/dist/es/Button/index.d.ts +2 -2
  22. package/dist/es/Button/index.js +2 -2
  23. package/dist/es/Button/interface.d.ts +4 -0
  24. package/dist/es/Button/style/index.css +95 -1
  25. package/dist/es/Button/style/index.min.css +1 -0
  26. package/dist/es/FullScreenLoading/index.js +40 -40
  27. package/dist/es/FullScreenLoading/interface.d.ts +2 -2
  28. package/dist/es/FullScreenLoading/style/index.css +239 -1
  29. package/dist/es/FullScreenLoading/style/index.min.css +1 -0
  30. package/dist/es/MAlipay/index.js +1 -1
  31. package/dist/es/MAlipay/m-alipay-auto-submit.js +9 -11
  32. package/dist/es/MAlipay/m-alipay-button.js +86 -55
  33. package/dist/es/MAlipay/style/index.css +252 -1
  34. package/dist/es/MAlipay/style/index.min.css +1 -0
  35. package/dist/es/MWeChat/index.d.ts +2 -2
  36. package/dist/es/MWeChat/index.js +2 -2
  37. package/dist/es/MWeChat/m-wechat-button.js +86 -54
  38. package/dist/es/MWeChat/style/index.css +252 -1
  39. package/dist/es/MWeChat/style/index.min.css +1 -0
  40. package/dist/es/Mask/index.d.ts +2 -2
  41. package/dist/es/Mask/index.js +2 -2
  42. package/dist/es/Mask/mask.js +48 -45
  43. package/dist/es/Mask/style/index.css +11 -1
  44. package/dist/es/Mask/style/index.min.css +1 -0
  45. package/dist/es/PayButton/index.js +2 -2
  46. package/dist/es/PayButton/interface.d.ts +9 -9
  47. package/dist/es/PayButton/interface.js +1 -1
  48. package/dist/es/PayMask/index.d.ts +2 -2
  49. package/dist/es/PayMask/index.js +2 -2
  50. package/dist/es/PayMask/interface.d.ts +2 -2
  51. package/dist/es/PayMask/pay-mask.js +41 -40
  52. package/dist/es/PayMask/style/index.css +62 -1
  53. package/dist/es/PayMask/style/index.min.css +1 -0
  54. package/dist/es/Paypal/index.d.ts +2 -2
  55. package/dist/es/Paypal/index.js +2 -2
  56. package/dist/es/Paypal/paypal-button.js +55 -36
  57. package/dist/es/Paypal/style/index.css +207 -1
  58. package/dist/es/Paypal/style/index.min.css +1 -0
  59. package/dist/es/Payssion/index.d.ts +2 -2
  60. package/dist/es/Payssion/index.js +2 -2
  61. package/dist/es/Payssion/payssion-button.js +56 -37
  62. package/dist/es/Payssion/style/index.css +157 -1
  63. package/dist/es/Payssion/style/index.min.css +1 -0
  64. package/dist/es/Stripe/index.d.ts +5 -5
  65. package/dist/es/Stripe/index.js +6 -6
  66. package/dist/es/Stripe/stripe-button.js +47 -33
  67. package/dist/es/Stripe/stripe-modal.js +38 -32
  68. package/dist/es/Stripe/stripe-popup.js +42 -37
  69. package/dist/es/Stripe/stripe.js +15 -15
  70. package/dist/es/Stripe/style/index.css +365 -1
  71. package/dist/es/Stripe/style/index.min.css +1 -0
  72. package/dist/es/Wechat/index.d.ts +4 -4
  73. package/dist/es/Wechat/index.js +5 -5
  74. package/dist/es/Wechat/style/index.css +25 -1
  75. package/dist/es/Wechat/style/index.min.css +1 -0
  76. package/dist/es/Wechat/wechat-button.js +38 -23
  77. package/dist/es/Wechat/wechat-modal.js +37 -31
  78. package/dist/es/Wechat/wechat.js +16 -12
  79. package/dist/es/confirm-modal/index.d.ts +3 -3
  80. package/dist/es/confirm-modal/index.js +53 -35
  81. package/dist/es/confirm-modal/interface.d.ts +2 -2
  82. package/dist/es/confirm-modal/style/index.css +95 -1
  83. package/dist/es/confirm-modal/style/index.min.css +1 -0
  84. package/dist/es/dot-loading/dot-loading.js +25 -23
  85. package/dist/es/dot-loading/index.d.ts +2 -2
  86. package/dist/es/dot-loading/index.js +2 -2
  87. package/dist/es/dot-loading/style/index.css +3 -1
  88. package/dist/es/dot-loading/style/index.min.css +1 -0
  89. package/dist/es/hooks/use-initialized.js +2 -2
  90. package/dist/es/hooks/use-inner-visible.js +8 -4
  91. package/dist/es/hooks/use-lock-scroll.d.ts +2 -2
  92. package/dist/es/hooks/use-lock-scroll.js +30 -34
  93. package/dist/es/hooks/use-touch.d.ts +1 -1
  94. package/dist/es/hooks/use-touch.js +35 -31
  95. package/dist/es/hooks/usePayWindowOpen.d.ts +1 -1
  96. package/dist/es/hooks/usePayWindowOpen.js +31 -27
  97. package/dist/es/icons/IconAlipay/index.js +18 -16
  98. package/dist/es/icons/IconClose/index.js +24 -22
  99. package/dist/es/icons/IconPaypalText/index.js +24 -22
  100. package/dist/es/icons/IconPaypalWhite/index.js +19 -17
  101. package/dist/es/icons/IconPayssionPay/index.js +47 -45
  102. package/dist/es/icons/IconStripe/index.js +19 -17
  103. package/dist/es/icons/IconStripeText/index.js +19 -17
  104. package/dist/es/icons/IconWechatPay/index.js +18 -16
  105. package/dist/es/icons/interface.d.ts +1 -1
  106. package/dist/es/icons/style/index.css +45 -1
  107. package/dist/es/icons/style/index.min.css +1 -0
  108. package/dist/es/index.d.ts +1 -1
  109. package/dist/es/pay-modal/index.d.ts +2 -2
  110. package/dist/es/pay-modal/index.js +2 -2
  111. package/dist/es/pay-modal/interface.d.ts +8 -18
  112. package/dist/es/pay-modal/pay-modal.js +53 -42
  113. package/dist/es/pay-modal/style/index.css +95 -1
  114. package/dist/es/pay-modal/style/index.min.css +1 -0
  115. package/dist/es/pay-popup/index.js +51 -53
  116. package/dist/es/pay-popup/interface.d.ts +6 -6
  117. package/dist/es/pay-popup/style/index.css +145 -1
  118. package/dist/es/pay-popup/style/index.min.css +1 -0
  119. package/dist/es/shared/enums/index.js +1 -1
  120. package/dist/es/shared/index.d.ts +1 -1
  121. package/dist/es/shared/index.js +1 -1
  122. package/dist/es/utils/can-use-dom.js +1 -1
  123. package/dist/es/utils/classNames.js +15 -11
  124. package/dist/es/utils/dom.js +18 -18
  125. package/dist/es/utils/get-container.js +2 -2
  126. package/dist/es/utils/get-scroll-parent.js +8 -9
  127. package/dist/es/utils/is.js +54 -32
  128. package/dist/es/utils/native-props.d.ts +2 -2
  129. package/dist/es/utils/native-props.js +7 -9
  130. package/dist/es/utils/omit.js +3 -5
  131. package/dist/es/utils/qrcode.js +5 -5
  132. package/dist/es/utils/render-to-container.d.ts +1 -1
  133. package/dist/es/utils/render-to-container.js +4 -4
  134. package/dist/es/utils/should-render.d.ts +1 -1
  135. package/dist/es/utils/should-render.js +4 -4
  136. package/dist/es/utils/supports-passive.js +8 -7
  137. package/dist/es/utils/warning.js +0 -1
  138. package/dist/es/utils/with-default-props.js +6 -4
  139. package/dist/es/utils/with-stop-propagation.d.ts +3 -3
  140. package/dist/es/utils/with-stop-propagation.js +27 -14
  141. package/dist/lib/Airwallex/airwallex-button.js +12 -15
  142. package/dist/lib/Airwallex/airwallex-modal.js +11 -14
  143. package/dist/lib/Airwallex/airwallex-popup.js +16 -23
  144. package/dist/lib/Airwallex/airwallex.js +20 -25
  145. package/dist/lib/Airwallex/index.js +1 -1
  146. package/dist/lib/Airwallex/style/index.css +335 -1
  147. package/dist/lib/Airwallex/style/index.min.css +1 -0
  148. package/dist/lib/Alipay/alipay-button.js +12 -15
  149. package/dist/lib/Alipay/alipay-modal.js +10 -13
  150. package/dist/lib/Alipay/alipay.js +19 -23
  151. package/dist/lib/Alipay/index.js +1 -1
  152. package/dist/lib/Alipay/style/index.css +18 -1
  153. package/dist/lib/Alipay/style/index.min.css +1 -0
  154. package/dist/lib/Button/button.js +13 -13
  155. package/dist/lib/Button/index.js +1 -1
  156. package/dist/lib/Button/style/index.css +95 -1
  157. package/dist/lib/Button/style/index.min.css +1 -0
  158. package/dist/lib/FullScreenLoading/index.js +28 -29
  159. package/dist/lib/FullScreenLoading/style/index.css +239 -1
  160. package/dist/lib/FullScreenLoading/style/index.min.css +1 -0
  161. package/dist/lib/MAlipay/index.js +1 -1
  162. package/dist/lib/MAlipay/m-alipay-auto-submit.js +3 -4
  163. package/dist/lib/MAlipay/m-alipay-button.js +42 -41
  164. package/dist/lib/MAlipay/style/index.css +252 -1
  165. package/dist/lib/MAlipay/style/index.min.css +1 -0
  166. package/dist/lib/MWeChat/index.js +2 -2
  167. package/dist/lib/MWeChat/m-wechat-button.js +43 -41
  168. package/dist/lib/MWeChat/style/index.css +252 -1
  169. package/dist/lib/MWeChat/style/index.min.css +1 -0
  170. package/dist/lib/Mask/index.js +1 -1
  171. package/dist/lib/Mask/mask.js +6 -11
  172. package/dist/lib/Mask/style/index.css +11 -1
  173. package/dist/lib/Mask/style/index.min.css +1 -0
  174. package/dist/lib/PayButton/index.js +10 -10
  175. package/dist/lib/PayMask/index.js +1 -1
  176. package/dist/lib/PayMask/pay-mask.js +20 -23
  177. package/dist/lib/PayMask/style/index.css +62 -1
  178. package/dist/lib/PayMask/style/index.min.css +1 -0
  179. package/dist/lib/Paypal/index.js +2 -2
  180. package/dist/lib/Paypal/paypal-button.js +17 -22
  181. package/dist/lib/Paypal/style/index.css +207 -1
  182. package/dist/lib/Paypal/style/index.min.css +1 -0
  183. package/dist/lib/Payssion/index.js +2 -2
  184. package/dist/lib/Payssion/payssion-button.js +17 -22
  185. package/dist/lib/Payssion/style/index.css +157 -1
  186. package/dist/lib/Payssion/style/index.min.css +1 -0
  187. package/dist/lib/Stripe/index.js +1 -1
  188. package/dist/lib/Stripe/stripe-button.js +14 -17
  189. package/dist/lib/Stripe/stripe-modal.js +10 -13
  190. package/dist/lib/Stripe/stripe-popup.js +16 -23
  191. package/dist/lib/Stripe/stripe.js +8 -11
  192. package/dist/lib/Stripe/style/index.css +365 -1
  193. package/dist/lib/Stripe/style/index.min.css +1 -0
  194. package/dist/lib/Wechat/index.js +1 -1
  195. package/dist/lib/Wechat/style/index.css +25 -1
  196. package/dist/lib/Wechat/style/index.min.css +1 -0
  197. package/dist/lib/Wechat/wechat-button.js +12 -15
  198. package/dist/lib/Wechat/wechat-modal.js +9 -12
  199. package/dist/lib/Wechat/wechat.js +11 -12
  200. package/dist/lib/confirm-modal/index.js +22 -12
  201. package/dist/lib/confirm-modal/style/index.css +95 -1
  202. package/dist/lib/confirm-modal/style/index.min.css +1 -0
  203. package/dist/lib/dot-loading/dot-loading.js +3 -4
  204. package/dist/lib/dot-loading/index.js +1 -1
  205. package/dist/lib/dot-loading/style/index.css +3 -1
  206. package/dist/lib/dot-loading/style/index.min.css +1 -0
  207. package/dist/lib/hooks/use-lock-scroll.js +11 -12
  208. package/dist/lib/hooks/use-touch.js +10 -10
  209. package/dist/lib/hooks/usePayWindowOpen.js +14 -15
  210. package/dist/lib/icons/IconAlipay/index.js +6 -6
  211. package/dist/lib/icons/IconClose/index.js +8 -8
  212. package/dist/lib/icons/IconPaypalText/index.js +7 -7
  213. package/dist/lib/icons/IconPaypalWhite/index.js +6 -6
  214. package/dist/lib/icons/IconPayssionPay/index.js +13 -13
  215. package/dist/lib/icons/IconStripe/index.js +6 -6
  216. package/dist/lib/icons/IconStripeText/index.js +6 -6
  217. package/dist/lib/icons/IconWechatPay/index.js +6 -6
  218. package/dist/lib/icons/index.js +2 -2
  219. package/dist/lib/icons/style/index.css +45 -1
  220. package/dist/lib/icons/style/index.min.css +1 -0
  221. package/dist/lib/index.js +2 -2
  222. package/dist/lib/pay-modal/index.js +1 -1
  223. package/dist/lib/pay-modal/pay-modal.js +29 -21
  224. package/dist/lib/pay-modal/style/index.css +95 -1
  225. package/dist/lib/pay-modal/style/index.min.css +1 -0
  226. package/dist/lib/pay-popup/index.js +24 -28
  227. package/dist/lib/pay-popup/style/index.css +145 -1
  228. package/dist/lib/pay-popup/style/index.min.css +1 -0
  229. package/dist/lib/utils/can-use-dom.js +1 -1
  230. package/dist/lib/utils/classNames.js +6 -7
  231. package/dist/lib/utils/dom.js +9 -11
  232. package/dist/lib/utils/get-scroll-parent.js +2 -3
  233. package/dist/lib/utils/getPrefixCls.js +1 -1
  234. package/dist/lib/utils/is.js +16 -14
  235. package/dist/lib/utils/native-props.js +10 -10
  236. package/dist/lib/utils/omit.js +3 -6
  237. package/dist/lib/utils/qrcode.js +1 -1
  238. package/dist/lib/utils/supports-passive.js +4 -3
  239. package/dist/lib/utils/warning.js +2 -6
  240. package/dist/lib/utils/with-default-props.js +4 -8
  241. package/dist/lib/utils/with-stop-propagation.js +6 -9
  242. package/dist/umd/pay-sdk-react.umd.js +106 -86
  243. package/dist/umd/pay-sdk-react.umd.js.map +1 -1
  244. package/package.json +5 -2
@@ -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
- const classPrefix = getPrefixCls('wechat');
6
- const WechatQrCode = _ref => {
7
- let {
8
- wechatType = 'qrcode',
9
- wechatUrl,
10
- tipText = '请使用微信APP扫码支付',
11
- className,
12
- style
13
- } = _ref;
14
- const [imageUrl, setImageUrl] = useState('');
15
- useEffect(() => {
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 "react";
2
- import { ConfirmModalProps } from "./interface";
1
+ import React from 'react';
2
+ import { ConfirmModalProps } from './interface';
3
3
  declare const ConfirmModal: React.FC<ConfirmModalProps>;
4
- export * from "./interface";
4
+ export * from './interface';
5
5
  export default ConfirmModal;
@@ -1,35 +1,51 @@
1
- import React, { useCallback } from "react";
2
- import { usePayWindowOpen } from "../hooks/usePayWindowOpen";
3
- import PayModal from "../pay-modal";
4
- const ConfirmModal = props => {
5
- const {
6
- visible,
7
- onRetry,
8
- onFinish,
9
- title = "支付确认",
10
- desc = /*#__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]")),
11
- retryText = "重新支付",
12
- finishText = "支付完成",
13
- icon = /*#__PURE__*/React.createElement("span", {
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 = true,
18
- maskClosable = false,
19
- onClose,
20
- payUrl,
21
- autoOpenWindow = false,
22
- openMode = "window"
23
- } = props;
24
- const {
25
- closeWindow
26
- } = usePayWindowOpen({
27
- payUrl: payUrl || "",
28
- onClose,
29
- autoOpen: autoOpenWindow,
30
- openMode: openMode
31
- });
32
- const handleClose = useCallback(() => {
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
- onRetry: onRetry,
46
- onFinish: onFinish,
47
- retryText: retryText,
48
- finishText: finishText
61
+ retryButtonProps: _objectSpread({
62
+ children: retryButtonChildren
63
+ }, retryButtonPropsRest),
64
+ finishButtonProps: _objectSpread({
65
+ children: finishButtonChildren
66
+ }, finishButtonPropsRest)
49
67
  });
50
68
  };
51
- export * from "./interface";
69
+ export * from './interface';
52
70
  export default ConfirmModal;
@@ -1,5 +1,5 @@
1
- import { OpenPayUrlMode } from "../hooks/usePayWindowOpen";
2
- import { PayModalProps } from "../pay-modal";
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{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 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}
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
- const classPrefix = getPrefixCls('dot-loading');
7
- const colorRecord = {
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
- const defaultProps = {
12
+ var defaultProps = {
13
13
  color: 'default'
14
14
  };
15
- const DotLoading = /*#__PURE__*/React.memo(p => {
15
+ var DotLoading = /*#__PURE__*/React.memo(function (p) {
16
16
  var _colorRecord$props$co;
17
- const props = mergeProps(defaultProps, p);
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(i => /*#__PURE__*/React.createElement("rect", {
41
- key: i,
42
- fill: "currentColor",
43
- x: 20 + i * 26,
44
- y: "16",
45
- width: "8",
46
- height: "8",
47
- rx: "2"
48
- }, /*#__PURE__*/React.createElement("animate", {
49
- attributeName: "y",
50
- from: "16",
51
- to: "16",
52
- dur: "2s",
53
- begin: "".concat(i * 0.2, "s"),
54
- repeatCount: "indefinite",
55
- values: "16; 6; 26; 16; 16",
56
- keyTimes: "0; 0.1; 0.3; 0.4; 1"
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 "./dot-loading";
2
- export * from "./interface";
1
+ import DotLoading from './dot-loading';
2
+ export * from './interface';
3
3
  export default DotLoading;
@@ -1,3 +1,3 @@
1
- import DotLoading from "./dot-loading";
2
- export * from "./interface";
1
+ import DotLoading from './dot-loading';
2
+ export * from './interface';
3
3
  export default DotLoading;
@@ -1 +1,3 @@
1
- .pay-dot-loading{display:inline-block}
1
+ .pay-dot-loading {
2
+ display: inline-block;
3
+ }
@@ -0,0 +1 @@
1
+ .pay-dot-loading{display:inline-block}
@@ -1,6 +1,6 @@
1
- import { useRef } from "react";
1
+ import { useRef } from 'react';
2
2
  export function useInitialized(check) {
3
- const initializedRef = useRef(check);
3
+ var initializedRef = useRef(check);
4
4
  if (check) {
5
5
  initializedRef.current = true;
6
6
  }
@@ -1,8 +1,12 @@
1
- import { useState } from "react";
2
- import { useIsomorphicLayoutEffect } from "ahooks";
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
- const [innerVisible, setInnerVisible] = useState(outerVisible);
5
- useIsomorphicLayoutEffect(() => {
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 "react";
2
- export declare function useLockScroll(rootRef: RefObject<HTMLElement>, shouldLock: boolean | "strict"): void;
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 "react";
2
- import { getScrollParent } from "../utils/get-scroll-parent";
3
- import { supportsPassive } from "../utils/supports-passive";
4
- import { useTouch } from "./use-touch";
5
- let totalLockCount = 0;
6
- const BODY_LOCK_CLASS = "yfm-overflow-hidden";
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
- let current = el === null || el === void 0 ? void 0 : el.parentElement;
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
- const touch = useTouch();
19
- const onTouchMove = event => {
18
+ var touch = useTouch();
19
+ var onTouchMove = function onTouchMove(event) {
20
20
  touch.move(event);
21
- const direction = touch.deltaY.current > 0 ? "10" : "01";
22
- const el = getScrollParent(event.target, rootRef.current);
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 === "strict") {
27
- const scrollableParent = getScrollableElement(event.target);
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
- const {
34
- scrollHeight,
35
- offsetHeight,
36
- scrollTop
37
- } = el;
38
- const {
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 ? "00" : "01";
40
+ status = offsetHeight >= scrollHeight ? '00' : '01';
44
41
  } else if (scrollHeight <= Math.round(height + scrollTop)) {
45
- status = "10";
42
+ status = '10';
46
43
  }
47
- if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
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
- const lock = () => {
54
- document.addEventListener("touchstart", touch.start);
55
- document.addEventListener("touchmove", onTouchMove, supportsPassive ? {
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
- const unlock = () => {
60
+ var unlock = function unlock() {
64
61
  if (totalLockCount) {
65
- document.removeEventListener("touchstart", touch.start);
66
- document.removeEventListener("touchmove", onTouchMove);
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,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- type Direction = "" | "vertical" | "horizontal";
2
+ type Direction = '' | 'vertical' | 'horizontal';
3
3
  export declare function useTouch(): {
4
4
  move: EventListener;
5
5
  start: EventListener;
@@ -1,39 +1,43 @@
1
- import { useRef } from "react";
2
- const MIN_DISTANCE = 10;
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 "horizontal";
5
+ return 'horizontal';
6
6
  }
7
7
  if (y > x && y > MIN_DISTANCE) {
8
- return "vertical";
8
+ return 'vertical';
9
9
  }
10
- return "";
10
+ return '';
11
11
  }
12
12
  export function useTouch() {
13
- const startX = useRef(0);
14
- const startY = useRef(0);
15
- const deltaX = useRef(0);
16
- const deltaY = useRef(0);
17
- const offsetX = useRef(0);
18
- const offsetY = useRef(0);
19
- const direction = useRef("");
20
- const isVertical = () => direction.current === "vertical";
21
- const isHorizontal = () => direction.current === "horizontal";
22
- const reset = () => {
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
- const start = event => {
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
- const move = event => {
36
- const touch = event.touches[0];
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 = "window" | "replace" | "href";
8
+ export type OpenPayUrlMode = 'window' | 'replace' | 'href';
9
9
  interface UsePayWindowOpenOptions {
10
10
  payUrl: string;
11
11
  onClose?: () => void;