pay-sdk-react 1.1.2 → 1.1.4

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 (242) hide show
  1. package/README.md +37 -19
  2. package/README.zh-CN.md +37 -19
  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 +37 -31
  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/style/index.css +18 -1
  18. package/dist/es/Alipay/style/index.min.css +1 -0
  19. package/dist/es/Button/button.js +62 -37
  20. package/dist/es/Button/index.d.ts +2 -2
  21. package/dist/es/Button/index.js +2 -2
  22. package/dist/es/Button/style/index.css +95 -1
  23. package/dist/es/Button/style/index.min.css +1 -0
  24. package/dist/es/FullScreenLoading/index.js +40 -40
  25. package/dist/es/FullScreenLoading/interface.d.ts +2 -2
  26. package/dist/es/FullScreenLoading/style/index.css +239 -1
  27. package/dist/es/FullScreenLoading/style/index.min.css +1 -0
  28. package/dist/es/MAlipay/index.js +1 -1
  29. package/dist/es/MAlipay/m-alipay-auto-submit.js +9 -11
  30. package/dist/es/MAlipay/m-alipay-button.js +71 -51
  31. package/dist/es/MAlipay/style/index.css +252 -1
  32. package/dist/es/MAlipay/style/index.min.css +1 -0
  33. package/dist/es/MWeChat/index.d.ts +2 -2
  34. package/dist/es/MWeChat/index.js +2 -2
  35. package/dist/es/MWeChat/m-wechat-button.js +70 -50
  36. package/dist/es/MWeChat/style/index.css +252 -1
  37. package/dist/es/MWeChat/style/index.min.css +1 -0
  38. package/dist/es/Mask/index.d.ts +2 -2
  39. package/dist/es/Mask/index.js +2 -2
  40. package/dist/es/Mask/mask.js +48 -45
  41. package/dist/es/Mask/style/index.css +11 -1
  42. package/dist/es/Mask/style/index.min.css +1 -0
  43. package/dist/es/PayButton/index.js +2 -2
  44. package/dist/es/PayButton/interface.d.ts +9 -9
  45. package/dist/es/PayButton/interface.js +1 -1
  46. package/dist/es/PayMask/index.d.ts +2 -2
  47. package/dist/es/PayMask/index.js +2 -2
  48. package/dist/es/PayMask/interface.d.ts +8 -2
  49. package/dist/es/PayMask/pay-mask.js +48 -40
  50. package/dist/es/PayMask/style/index.css +62 -1
  51. package/dist/es/PayMask/style/index.min.css +1 -0
  52. package/dist/es/Paypal/index.d.ts +2 -2
  53. package/dist/es/Paypal/index.js +2 -2
  54. package/dist/es/Paypal/paypal-button.js +55 -36
  55. package/dist/es/Paypal/style/index.css +207 -1
  56. package/dist/es/Paypal/style/index.min.css +1 -0
  57. package/dist/es/Payssion/index.d.ts +2 -2
  58. package/dist/es/Payssion/index.js +2 -2
  59. package/dist/es/Payssion/payssion-button.js +56 -37
  60. package/dist/es/Payssion/style/index.css +157 -1
  61. package/dist/es/Payssion/style/index.min.css +1 -0
  62. package/dist/es/Stripe/index.d.ts +5 -5
  63. package/dist/es/Stripe/index.js +6 -6
  64. package/dist/es/Stripe/stripe-button.js +47 -33
  65. package/dist/es/Stripe/stripe-modal.js +38 -32
  66. package/dist/es/Stripe/stripe-popup.js +42 -37
  67. package/dist/es/Stripe/stripe.js +15 -15
  68. package/dist/es/Stripe/style/index.css +365 -1
  69. package/dist/es/Stripe/style/index.min.css +1 -0
  70. package/dist/es/Wechat/index.d.ts +4 -4
  71. package/dist/es/Wechat/index.js +5 -5
  72. package/dist/es/Wechat/style/index.css +25 -1
  73. package/dist/es/Wechat/style/index.min.css +1 -0
  74. package/dist/es/Wechat/wechat-button.js +38 -23
  75. package/dist/es/Wechat/wechat-modal.js +37 -31
  76. package/dist/es/Wechat/wechat.js +16 -12
  77. package/dist/es/confirm-modal/index.js +42 -39
  78. package/dist/es/confirm-modal/interface.d.ts +8 -2
  79. package/dist/es/confirm-modal/style/index.css +95 -1
  80. package/dist/es/confirm-modal/style/index.min.css +1 -0
  81. package/dist/es/dot-loading/dot-loading.js +25 -23
  82. package/dist/es/dot-loading/index.d.ts +2 -2
  83. package/dist/es/dot-loading/index.js +2 -2
  84. package/dist/es/dot-loading/style/index.css +3 -1
  85. package/dist/es/dot-loading/style/index.min.css +1 -0
  86. package/dist/es/hooks/use-initialized.js +2 -2
  87. package/dist/es/hooks/use-inner-visible.js +8 -4
  88. package/dist/es/hooks/use-lock-scroll.d.ts +2 -2
  89. package/dist/es/hooks/use-lock-scroll.js +30 -34
  90. package/dist/es/hooks/use-touch.d.ts +1 -1
  91. package/dist/es/hooks/use-touch.js +35 -31
  92. package/dist/es/hooks/usePayWindowOpen.d.ts +16 -10
  93. package/dist/es/hooks/usePayWindowOpen.js +81 -37
  94. package/dist/es/icons/IconAlipay/index.js +18 -16
  95. package/dist/es/icons/IconClose/index.js +24 -22
  96. package/dist/es/icons/IconPaypalText/index.js +24 -22
  97. package/dist/es/icons/IconPaypalWhite/index.js +19 -17
  98. package/dist/es/icons/IconPayssionPay/index.js +47 -45
  99. package/dist/es/icons/IconStripe/index.js +19 -17
  100. package/dist/es/icons/IconStripeText/index.js +19 -17
  101. package/dist/es/icons/IconWechatPay/index.js +18 -16
  102. package/dist/es/icons/interface.d.ts +1 -1
  103. package/dist/es/icons/style/index.css +45 -1
  104. package/dist/es/icons/style/index.min.css +1 -0
  105. package/dist/es/pay-modal/index.d.ts +2 -2
  106. package/dist/es/pay-modal/index.js +2 -2
  107. package/dist/es/pay-modal/pay-modal.js +45 -48
  108. package/dist/es/pay-modal/style/index.css +95 -1
  109. package/dist/es/pay-modal/style/index.min.css +1 -0
  110. package/dist/es/pay-popup/index.js +51 -53
  111. package/dist/es/pay-popup/interface.d.ts +6 -6
  112. package/dist/es/pay-popup/style/index.css +145 -1
  113. package/dist/es/pay-popup/style/index.min.css +1 -0
  114. package/dist/es/shared/enums/index.d.ts +21 -0
  115. package/dist/es/shared/enums/index.js +24 -1
  116. package/dist/es/shared/index.d.ts +1 -1
  117. package/dist/es/shared/index.js +1 -1
  118. package/dist/es/utils/can-use-dom.js +1 -1
  119. package/dist/es/utils/classNames.js +15 -11
  120. package/dist/es/utils/dom.js +18 -18
  121. package/dist/es/utils/get-container.js +2 -2
  122. package/dist/es/utils/get-scroll-parent.js +8 -9
  123. package/dist/es/utils/is.d.ts +10 -1
  124. package/dist/es/utils/is.js +68 -34
  125. package/dist/es/utils/native-props.d.ts +2 -2
  126. package/dist/es/utils/native-props.js +7 -9
  127. package/dist/es/utils/omit.js +3 -5
  128. package/dist/es/utils/qrcode.js +5 -5
  129. package/dist/es/utils/render-to-container.d.ts +1 -1
  130. package/dist/es/utils/render-to-container.js +4 -4
  131. package/dist/es/utils/should-render.d.ts +1 -1
  132. package/dist/es/utils/should-render.js +4 -4
  133. package/dist/es/utils/supports-passive.js +8 -7
  134. package/dist/es/utils/warning.js +0 -1
  135. package/dist/es/utils/with-default-props.js +6 -4
  136. package/dist/es/utils/with-stop-propagation.d.ts +3 -3
  137. package/dist/es/utils/with-stop-propagation.js +27 -14
  138. package/dist/lib/Airwallex/airwallex-button.js +12 -15
  139. package/dist/lib/Airwallex/airwallex-modal.js +11 -14
  140. package/dist/lib/Airwallex/airwallex-popup.js +16 -23
  141. package/dist/lib/Airwallex/airwallex.js +20 -25
  142. package/dist/lib/Airwallex/index.js +1 -1
  143. package/dist/lib/Airwallex/style/index.css +335 -1
  144. package/dist/lib/Airwallex/style/index.min.css +1 -0
  145. package/dist/lib/Alipay/alipay-button.js +12 -15
  146. package/dist/lib/Alipay/alipay-modal.js +9 -12
  147. package/dist/lib/Alipay/alipay.js +19 -23
  148. package/dist/lib/Alipay/index.js +1 -1
  149. package/dist/lib/Alipay/style/index.css +18 -1
  150. package/dist/lib/Alipay/style/index.min.css +1 -0
  151. package/dist/lib/Button/button.js +13 -13
  152. package/dist/lib/Button/index.js +1 -1
  153. package/dist/lib/Button/style/index.css +95 -1
  154. package/dist/lib/Button/style/index.min.css +1 -0
  155. package/dist/lib/FullScreenLoading/index.js +28 -29
  156. package/dist/lib/FullScreenLoading/style/index.css +239 -1
  157. package/dist/lib/FullScreenLoading/style/index.min.css +1 -0
  158. package/dist/lib/MAlipay/index.js +1 -1
  159. package/dist/lib/MAlipay/m-alipay-auto-submit.js +3 -4
  160. package/dist/lib/MAlipay/m-alipay-button.js +34 -44
  161. package/dist/lib/MAlipay/style/index.css +252 -1
  162. package/dist/lib/MAlipay/style/index.min.css +1 -0
  163. package/dist/lib/MWeChat/index.js +2 -2
  164. package/dist/lib/MWeChat/m-wechat-button.js +34 -44
  165. package/dist/lib/MWeChat/style/index.css +252 -1
  166. package/dist/lib/MWeChat/style/index.min.css +1 -0
  167. package/dist/lib/Mask/index.js +1 -1
  168. package/dist/lib/Mask/mask.js +6 -11
  169. package/dist/lib/Mask/style/index.css +11 -1
  170. package/dist/lib/Mask/style/index.min.css +1 -0
  171. package/dist/lib/PayButton/index.js +10 -10
  172. package/dist/lib/PayMask/index.js +1 -1
  173. package/dist/lib/PayMask/pay-mask.js +26 -24
  174. package/dist/lib/PayMask/style/index.css +62 -1
  175. package/dist/lib/PayMask/style/index.min.css +1 -0
  176. package/dist/lib/Paypal/index.js +2 -2
  177. package/dist/lib/Paypal/paypal-button.js +17 -22
  178. package/dist/lib/Paypal/style/index.css +207 -1
  179. package/dist/lib/Paypal/style/index.min.css +1 -0
  180. package/dist/lib/Payssion/index.js +2 -2
  181. package/dist/lib/Payssion/payssion-button.js +17 -22
  182. package/dist/lib/Payssion/style/index.css +157 -1
  183. package/dist/lib/Payssion/style/index.min.css +1 -0
  184. package/dist/lib/Stripe/index.js +1 -1
  185. package/dist/lib/Stripe/stripe-button.js +14 -17
  186. package/dist/lib/Stripe/stripe-modal.js +10 -13
  187. package/dist/lib/Stripe/stripe-popup.js +16 -23
  188. package/dist/lib/Stripe/stripe.js +8 -11
  189. package/dist/lib/Stripe/style/index.css +365 -1
  190. package/dist/lib/Stripe/style/index.min.css +1 -0
  191. package/dist/lib/Wechat/index.js +1 -1
  192. package/dist/lib/Wechat/style/index.css +25 -1
  193. package/dist/lib/Wechat/style/index.min.css +1 -0
  194. package/dist/lib/Wechat/wechat-button.js +12 -15
  195. package/dist/lib/Wechat/wechat-modal.js +9 -12
  196. package/dist/lib/Wechat/wechat.js +11 -12
  197. package/dist/lib/confirm-modal/index.js +24 -28
  198. package/dist/lib/confirm-modal/style/index.css +95 -1
  199. package/dist/lib/confirm-modal/style/index.min.css +1 -0
  200. package/dist/lib/dot-loading/dot-loading.js +3 -4
  201. package/dist/lib/dot-loading/index.js +1 -1
  202. package/dist/lib/dot-loading/style/index.css +3 -1
  203. package/dist/lib/dot-loading/style/index.min.css +1 -0
  204. package/dist/lib/hooks/use-lock-scroll.js +11 -12
  205. package/dist/lib/hooks/use-touch.js +10 -10
  206. package/dist/lib/hooks/usePayWindowOpen.js +63 -21
  207. package/dist/lib/icons/IconAlipay/index.js +6 -6
  208. package/dist/lib/icons/IconClose/index.js +8 -8
  209. package/dist/lib/icons/IconPaypalText/index.js +7 -7
  210. package/dist/lib/icons/IconPaypalWhite/index.js +6 -6
  211. package/dist/lib/icons/IconPayssionPay/index.js +13 -13
  212. package/dist/lib/icons/IconStripe/index.js +6 -6
  213. package/dist/lib/icons/IconStripeText/index.js +6 -6
  214. package/dist/lib/icons/IconWechatPay/index.js +6 -6
  215. package/dist/lib/icons/index.js +2 -2
  216. package/dist/lib/icons/style/index.css +45 -1
  217. package/dist/lib/icons/style/index.min.css +1 -0
  218. package/dist/lib/index.js +2 -2
  219. package/dist/lib/pay-modal/index.js +1 -1
  220. package/dist/lib/pay-modal/pay-modal.js +24 -30
  221. package/dist/lib/pay-modal/style/index.css +95 -1
  222. package/dist/lib/pay-modal/style/index.min.css +1 -0
  223. package/dist/lib/pay-popup/index.js +24 -28
  224. package/dist/lib/pay-popup/style/index.css +145 -1
  225. package/dist/lib/pay-popup/style/index.min.css +1 -0
  226. package/dist/lib/shared/enums/index.js +23 -1
  227. package/dist/lib/utils/can-use-dom.js +1 -1
  228. package/dist/lib/utils/classNames.js +6 -7
  229. package/dist/lib/utils/dom.js +9 -11
  230. package/dist/lib/utils/get-scroll-parent.js +2 -3
  231. package/dist/lib/utils/getPrefixCls.js +1 -1
  232. package/dist/lib/utils/is.js +32 -17
  233. package/dist/lib/utils/native-props.js +10 -10
  234. package/dist/lib/utils/omit.js +3 -6
  235. package/dist/lib/utils/qrcode.js +1 -1
  236. package/dist/lib/utils/supports-passive.js +4 -3
  237. package/dist/lib/utils/warning.js +2 -6
  238. package/dist/lib/utils/with-default-props.js +4 -8
  239. package/dist/lib/utils/with-stop-propagation.js +6 -9
  240. package/dist/umd/pay-sdk-react.umd.js +218 -130
  241. package/dist/umd/pay-sdk-react.umd.js.map +1 -1
  242. package/package.json +6 -3
@@ -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,52 +1,55 @@
1
- const _excluded = ["children"],
1
+ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["children"],
2
4
  _excluded2 = ["children"];
3
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; }
4
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; }
5
- 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; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
7
- 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); }
8
- 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; }
9
- 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; }
10
7
  import React, { useCallback } from 'react';
11
8
  import { usePayWindowOpen } from '../hooks/usePayWindowOpen';
12
9
  import PayModal from '../pay-modal';
13
- const ConfirmModal = props => {
14
- const {
15
- visible,
16
- title = '支付确认',
17
- 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]")),
18
- retryButtonProps,
19
- finishButtonProps,
20
- icon = /*#__PURE__*/React.createElement("span", {
10
+ import { OpenPayUrlMode } from '../shared/enums';
11
+ var ConfirmModal = function ConfirmModal(props) {
12
+ var visible = props.visible,
13
+ _props$title = props.title,
14
+ title = _props$title === void 0 ? '支付确认' : _props$title,
15
+ _props$desc = props.desc,
16
+ 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,
17
+ retryButtonProps = props.retryButtonProps,
18
+ finishButtonProps = props.finishButtonProps,
19
+ _props$icon = props.icon,
20
+ icon = _props$icon === void 0 ? /*#__PURE__*/React.createElement("span", {
21
21
  role: "img",
22
22
  "aria-label": "success"
23
- }, "\u2714\uFE0F"),
24
- showClose = true,
25
- maskClosable = false,
26
- onClose,
27
- payUrl,
28
- autoOpenWindow = false,
29
- openMode = 'window'
30
- } = props;
31
- const _ref = retryButtonProps || {},
32
- {
33
- children: retryButtonChildren = '重新支付'
34
- } = _ref,
23
+ }, "\u2714\uFE0F") : _props$icon,
24
+ _props$showClose = props.showClose,
25
+ showClose = _props$showClose === void 0 ? true : _props$showClose,
26
+ _props$maskClosable = props.maskClosable,
27
+ maskClosable = _props$maskClosable === void 0 ? false : _props$maskClosable,
28
+ onClose = props.onClose,
29
+ payUrl = props.payUrl,
30
+ _props$autoOpenWindow = props.autoOpenWindow,
31
+ autoOpenWindow = _props$autoOpenWindow === void 0 ? false : _props$autoOpenWindow,
32
+ _props$openMode = props.openMode,
33
+ openMode = _props$openMode === void 0 ? OpenPayUrlMode.Window : _props$openMode,
34
+ forceNewWindow = props.forceNewWindow;
35
+ var _ref = retryButtonProps || {},
36
+ _ref$children = _ref.children,
37
+ retryButtonChildren = _ref$children === void 0 ? '重新支付' : _ref$children,
35
38
  retryButtonPropsRest = _objectWithoutProperties(_ref, _excluded);
36
- const _ref2 = finishButtonProps || {},
37
- {
38
- children: finishButtonChildren = '支付完成'
39
- } = _ref2,
39
+ var _ref2 = finishButtonProps || {},
40
+ _ref2$children = _ref2.children,
41
+ finishButtonChildren = _ref2$children === void 0 ? '支付完成' : _ref2$children,
40
42
  finishButtonPropsRest = _objectWithoutProperties(_ref2, _excluded2);
41
- const {
42
- closeWindow
43
- } = usePayWindowOpen({
44
- payUrl: payUrl || '',
45
- onClose,
46
- autoOpen: autoOpenWindow,
47
- openMode: openMode
48
- });
49
- const handleClose = useCallback(() => {
43
+ var _usePayWindowOpen = usePayWindowOpen(_objectSpread({
44
+ payUrl: payUrl || '',
45
+ onClose: onClose,
46
+ autoOpen: autoOpenWindow,
47
+ openMode: openMode
48
+ }, openMode === OpenPayUrlMode.Window && {
49
+ forceNewWindow: forceNewWindow
50
+ })),
51
+ closeWindow = _usePayWindowOpen.closeWindow;
52
+ var handleClose = useCallback(function () {
50
53
  onClose === null || onClose === void 0 || onClose();
51
54
  if (autoOpenWindow) closeWindow();
52
55
  }, [onClose, autoOpenWindow, closeWindow]);
@@ -1,5 +1,5 @@
1
- import { OpenPayUrlMode } from "../hooks/usePayWindowOpen";
2
- import { PayModalProps } from "../pay-modal";
1
+ import { OpenPayUrlMode } from '../shared/enums';
2
+ import { PayModalProps } from '../pay-modal';
3
3
  export interface ConfirmModalProps extends PayModalProps {
4
4
  /**
5
5
  * @zh 支付页面 url
@@ -18,4 +18,10 @@ export interface ConfirmModalProps extends PayModalProps {
18
18
  * @default "window"
19
19
  */
20
20
  openMode?: OpenPayUrlMode;
21
+ /**
22
+ * @zh 是否强制打开新窗口(仅在 openMode 为 'window' 且非移动端设备时生效)
23
+ * @en Whether to force open new window (only effective when openMode is 'window' and on non-mobile devices)
24
+ * @default false
25
+ */
26
+ forceNewWindow?: boolean;
21
27
  }
@@ -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
  }
@@ -1,19 +1,25 @@
1
1
  /// <reference types="react" />
2
- /**
3
- * @zh 如果您希望用户在支付过程中随时可以通过"后退"按钮放弃支付并返回到您的应用,那么 href 是一个好选择;
4
- * @en If you want users to be able to abandon payment at any time and return to your application, then href is a good choice;
5
- * @zh 使用 replace: 如果您的业务逻辑是"一旦点击支付,就不能轻易返回",replace 会更合适。例如,点击支付后,您的后端已经创建了一张"待支付"的订单。为了防止用户通过"后退"按钮回到上一个页面再次创建订单,使用 replace 可以强制用户要么完成支付,要么关闭页面,而不能"后退"到上一步。
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
- */
8
- export type OpenPayUrlMode = "window" | "replace" | "href";
9
- interface UsePayWindowOpenOptions {
2
+ import { OpenPayUrlMode } from '../shared/enums';
3
+ interface BaseUsePayWindowOpenOptions {
10
4
  payUrl: string;
11
5
  onClose?: () => void;
12
6
  onSuccess?: () => void;
13
7
  autoOpen?: boolean;
14
- openMode?: OpenPayUrlMode;
15
8
  }
16
- export declare function usePayWindowOpen({ payUrl, onClose, onSuccess, autoOpen, openMode, }: UsePayWindowOpenOptions): {
9
+ interface WindowModeOptions extends BaseUsePayWindowOpenOptions {
10
+ openMode?: OpenPayUrlMode.Window;
11
+ /**
12
+ * @zh 是否强制打开新窗口(仅在非移动端设备生效)
13
+ * @en Whether to force open new window (only effective on non-mobile devices)
14
+ * @default false
15
+ */
16
+ forceNewWindow?: boolean;
17
+ }
18
+ interface OtherModeOptions extends BaseUsePayWindowOpenOptions {
19
+ openMode?: OpenPayUrlMode.Replace | OpenPayUrlMode.Href;
20
+ }
21
+ type UsePayWindowOpenProps = WindowModeOptions | OtherModeOptions;
22
+ export declare function usePayWindowOpen(p: UsePayWindowOpenProps): {
17
23
  openWindow: () => void;
18
24
  closeWindow: () => void;
19
25
  payWindowRef: import("react").MutableRefObject<Window | null>;