pay-sdk-react 1.1.0

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 (367) hide show
  1. package/README.md +1059 -0
  2. package/README.zh-CN.md +1061 -0
  3. package/dist/css/index.css +1 -0
  4. package/dist/es/Airwallex/airwallex-button.d.ts +4 -0
  5. package/dist/es/Airwallex/airwallex-button.js +86 -0
  6. package/dist/es/Airwallex/airwallex-modal.d.ts +6 -0
  7. package/dist/es/Airwallex/airwallex-modal.js +63 -0
  8. package/dist/es/Airwallex/airwallex-popup.d.ts +6 -0
  9. package/dist/es/Airwallex/airwallex-popup.js +74 -0
  10. package/dist/es/Airwallex/airwallex.d.ts +6 -0
  11. package/dist/es/Airwallex/airwallex.js +77 -0
  12. package/dist/es/Airwallex/index.d.ts +12 -0
  13. package/dist/es/Airwallex/index.js +10 -0
  14. package/dist/es/Airwallex/interface.d.ts +75 -0
  15. package/dist/es/Airwallex/interface.js +1 -0
  16. package/dist/es/Airwallex/style/index.css +1 -0
  17. package/dist/es/Airwallex/style/index.d.ts +1 -0
  18. package/dist/es/Airwallex/style/index.js +1 -0
  19. package/dist/es/Alipay/alipay-button.d.ts +6 -0
  20. package/dist/es/Alipay/alipay-button.js +52 -0
  21. package/dist/es/Alipay/alipay-modal.d.ts +6 -0
  22. package/dist/es/Alipay/alipay-modal.js +45 -0
  23. package/dist/es/Alipay/alipay.d.ts +4 -0
  24. package/dist/es/Alipay/alipay.js +44 -0
  25. package/dist/es/Alipay/index.d.ts +10 -0
  26. package/dist/es/Alipay/index.js +8 -0
  27. package/dist/es/Alipay/interface.d.ts +53 -0
  28. package/dist/es/Alipay/interface.js +1 -0
  29. package/dist/es/Alipay/style/index.css +1 -0
  30. package/dist/es/Alipay/style/index.d.ts +3 -0
  31. package/dist/es/Alipay/style/index.js +3 -0
  32. package/dist/es/Button/button.d.ts +21 -0
  33. package/dist/es/Button/button.js +74 -0
  34. package/dist/es/Button/index.d.ts +3 -0
  35. package/dist/es/Button/index.js +3 -0
  36. package/dist/es/Button/interface.d.ts +21 -0
  37. package/dist/es/Button/interface.js +1 -0
  38. package/dist/es/Button/style/index.css +1 -0
  39. package/dist/es/Button/style/index.d.ts +1 -0
  40. package/dist/es/Button/style/index.js +1 -0
  41. package/dist/es/FullScreenLoading/index.d.ts +4 -0
  42. package/dist/es/FullScreenLoading/index.js +116 -0
  43. package/dist/es/FullScreenLoading/interface.d.ts +43 -0
  44. package/dist/es/FullScreenLoading/interface.js +1 -0
  45. package/dist/es/FullScreenLoading/style/index.css +1 -0
  46. package/dist/es/FullScreenLoading/style/index.d.ts +1 -0
  47. package/dist/es/FullScreenLoading/style/index.js +1 -0
  48. package/dist/es/MAlipay/index.d.ts +8 -0
  49. package/dist/es/MAlipay/index.js +6 -0
  50. package/dist/es/MAlipay/interface.d.ts +44 -0
  51. package/dist/es/MAlipay/interface.js +1 -0
  52. package/dist/es/MAlipay/m-alipay-auto-submit.d.ts +6 -0
  53. package/dist/es/MAlipay/m-alipay-auto-submit.js +37 -0
  54. package/dist/es/MAlipay/m-alipay-button.d.ts +6 -0
  55. package/dist/es/MAlipay/m-alipay-button.js +127 -0
  56. package/dist/es/MAlipay/style/index.css +1 -0
  57. package/dist/es/MAlipay/style/index.d.ts +1 -0
  58. package/dist/es/MAlipay/style/index.js +1 -0
  59. package/dist/es/MWeChat/index.d.ts +2 -0
  60. package/dist/es/MWeChat/index.js +2 -0
  61. package/dist/es/MWeChat/interface.d.ts +50 -0
  62. package/dist/es/MWeChat/interface.js +1 -0
  63. package/dist/es/MWeChat/m-wechat-button.d.ts +6 -0
  64. package/dist/es/MWeChat/m-wechat-button.js +117 -0
  65. package/dist/es/MWeChat/style/index.css +1 -0
  66. package/dist/es/MWeChat/style/index.d.ts +1 -0
  67. package/dist/es/MWeChat/style/index.js +1 -0
  68. package/dist/es/Mask/index.d.ts +3 -0
  69. package/dist/es/Mask/index.js +3 -0
  70. package/dist/es/Mask/interface.d.ts +81 -0
  71. package/dist/es/Mask/interface.js +1 -0
  72. package/dist/es/Mask/mask.d.ts +5 -0
  73. package/dist/es/Mask/mask.js +97 -0
  74. package/dist/es/Mask/style/index.css +1 -0
  75. package/dist/es/Mask/style/index.d.ts +1 -0
  76. package/dist/es/Mask/style/index.js +1 -0
  77. package/dist/es/PayButton/index.d.ts +5 -0
  78. package/dist/es/PayButton/index.js +57 -0
  79. package/dist/es/PayButton/interface.d.ts +130 -0
  80. package/dist/es/PayButton/interface.js +93 -0
  81. package/dist/es/PayMask/index.d.ts +3 -0
  82. package/dist/es/PayMask/index.js +3 -0
  83. package/dist/es/PayMask/interface.d.ts +56 -0
  84. package/dist/es/PayMask/interface.js +1 -0
  85. package/dist/es/PayMask/pay-mask.d.ts +5 -0
  86. package/dist/es/PayMask/pay-mask.js +92 -0
  87. package/dist/es/PayMask/style/index.css +1 -0
  88. package/dist/es/PayMask/style/index.d.ts +1 -0
  89. package/dist/es/PayMask/style/index.js +1 -0
  90. package/dist/es/Paypal/index.d.ts +2 -0
  91. package/dist/es/Paypal/index.js +2 -0
  92. package/dist/es/Paypal/interface.d.ts +42 -0
  93. package/dist/es/Paypal/interface.js +1 -0
  94. package/dist/es/Paypal/paypal-button.d.ts +6 -0
  95. package/dist/es/Paypal/paypal-button.js +75 -0
  96. package/dist/es/Paypal/style/index.css +1 -0
  97. package/dist/es/Paypal/style/index.d.ts +1 -0
  98. package/dist/es/Paypal/style/index.js +1 -0
  99. package/dist/es/Payssion/index.d.ts +2 -0
  100. package/dist/es/Payssion/index.js +2 -0
  101. package/dist/es/Payssion/interface.d.ts +38 -0
  102. package/dist/es/Payssion/interface.js +1 -0
  103. package/dist/es/Payssion/payssion-button.d.ts +6 -0
  104. package/dist/es/Payssion/payssion-button.js +75 -0
  105. package/dist/es/Payssion/style/index.css +1 -0
  106. package/dist/es/Payssion/style/index.d.ts +1 -0
  107. package/dist/es/Payssion/style/index.js +1 -0
  108. package/dist/es/Stripe/index.d.ts +12 -0
  109. package/dist/es/Stripe/index.js +10 -0
  110. package/dist/es/Stripe/interface.d.ts +91 -0
  111. package/dist/es/Stripe/interface.js +1 -0
  112. package/dist/es/Stripe/stripe-button.d.ts +6 -0
  113. package/dist/es/Stripe/stripe-button.js +65 -0
  114. package/dist/es/Stripe/stripe-modal.d.ts +6 -0
  115. package/dist/es/Stripe/stripe-modal.js +50 -0
  116. package/dist/es/Stripe/stripe-popup.d.ts +6 -0
  117. package/dist/es/Stripe/stripe-popup.js +61 -0
  118. package/dist/es/Stripe/stripe.d.ts +5 -0
  119. package/dist/es/Stripe/stripe.js +38 -0
  120. package/dist/es/Stripe/style/index.css +1 -0
  121. package/dist/es/Stripe/style/index.d.ts +1 -0
  122. package/dist/es/Stripe/style/index.js +1 -0
  123. package/dist/es/Wechat/index.d.ts +10 -0
  124. package/dist/es/Wechat/index.js +8 -0
  125. package/dist/es/Wechat/interface.d.ts +69 -0
  126. package/dist/es/Wechat/interface.js +1 -0
  127. package/dist/es/Wechat/style/index.css +1 -0
  128. package/dist/es/Wechat/style/index.d.ts +1 -0
  129. package/dist/es/Wechat/style/index.js +1 -0
  130. package/dist/es/Wechat/wechat-button.d.ts +6 -0
  131. package/dist/es/Wechat/wechat-button.js +50 -0
  132. package/dist/es/Wechat/wechat-modal.d.ts +6 -0
  133. package/dist/es/Wechat/wechat-modal.js +45 -0
  134. package/dist/es/Wechat/wechat.d.ts +4 -0
  135. package/dist/es/Wechat/wechat.js +40 -0
  136. package/dist/es/confirm-modal/index.d.ts +5 -0
  137. package/dist/es/confirm-modal/index.js +52 -0
  138. package/dist/es/confirm-modal/interface.d.ts +21 -0
  139. package/dist/es/confirm-modal/interface.js +1 -0
  140. package/dist/es/confirm-modal/style/index.css +1 -0
  141. package/dist/es/confirm-modal/style/index.d.ts +1 -0
  142. package/dist/es/confirm-modal/style/index.js +1 -0
  143. package/dist/es/dot-loading/dot-loading.d.ts +4 -0
  144. package/dist/es/dot-loading/dot-loading.js +60 -0
  145. package/dist/es/dot-loading/index.d.ts +3 -0
  146. package/dist/es/dot-loading/index.js +3 -0
  147. package/dist/es/dot-loading/interface.d.ts +4 -0
  148. package/dist/es/dot-loading/interface.js +1 -0
  149. package/dist/es/dot-loading/style/index.css +1 -0
  150. package/dist/es/dot-loading/style/index.d.ts +1 -0
  151. package/dist/es/dot-loading/style/index.js +1 -0
  152. package/dist/es/hooks/use-initialized.d.ts +1 -0
  153. package/dist/es/hooks/use-initialized.js +8 -0
  154. package/dist/es/hooks/use-inner-visible.d.ts +1 -0
  155. package/dist/es/hooks/use-inner-visible.js +9 -0
  156. package/dist/es/hooks/use-lock-scroll.d.ts +2 -0
  157. package/dist/es/hooks/use-lock-scroll.js +82 -0
  158. package/dist/es/hooks/use-touch.d.ts +17 -0
  159. package/dist/es/hooks/use-touch.js +60 -0
  160. package/dist/es/hooks/usePayWindowOpen.d.ts +21 -0
  161. package/dist/es/hooks/usePayWindowOpen.js +87 -0
  162. package/dist/es/icons/IconAlipay/index.d.ts +4 -0
  163. package/dist/es/icons/IconAlipay/index.js +21 -0
  164. package/dist/es/icons/IconClose/index.d.ts +4 -0
  165. package/dist/es/icons/IconClose/index.js +27 -0
  166. package/dist/es/icons/IconPaypalText/index.d.ts +4 -0
  167. package/dist/es/icons/IconPaypalText/index.js +27 -0
  168. package/dist/es/icons/IconPaypalWhite/index.d.ts +4 -0
  169. package/dist/es/icons/IconPaypalWhite/index.js +22 -0
  170. package/dist/es/icons/IconPayssionPay/index.d.ts +4 -0
  171. package/dist/es/icons/IconPayssionPay/index.js +50 -0
  172. package/dist/es/icons/IconStripe/index.d.ts +4 -0
  173. package/dist/es/icons/IconStripe/index.js +22 -0
  174. package/dist/es/icons/IconStripeText/index.d.ts +4 -0
  175. package/dist/es/icons/IconStripeText/index.js +22 -0
  176. package/dist/es/icons/IconWechatPay/index.d.ts +4 -0
  177. package/dist/es/icons/IconWechatPay/index.js +21 -0
  178. package/dist/es/icons/index.d.ts +9 -0
  179. package/dist/es/icons/index.js +9 -0
  180. package/dist/es/icons/interface.d.ts +5 -0
  181. package/dist/es/icons/interface.js +1 -0
  182. package/dist/es/icons/style/index.css +1 -0
  183. package/dist/es/icons/style/index.d.ts +1 -0
  184. package/dist/es/icons/style/index.js +1 -0
  185. package/dist/es/index.d.ts +19 -0
  186. package/dist/es/index.js +10 -0
  187. package/dist/es/pay-modal/index.d.ts +3 -0
  188. package/dist/es/pay-modal/index.js +3 -0
  189. package/dist/es/pay-modal/interface.d.ts +94 -0
  190. package/dist/es/pay-modal/interface.js +1 -0
  191. package/dist/es/pay-modal/pay-modal.d.ts +5 -0
  192. package/dist/es/pay-modal/pay-modal.js +93 -0
  193. package/dist/es/pay-modal/style/index.css +1 -0
  194. package/dist/es/pay-modal/style/index.d.ts +1 -0
  195. package/dist/es/pay-modal/style/index.js +1 -0
  196. package/dist/es/pay-popup/index.d.ts +5 -0
  197. package/dist/es/pay-popup/index.js +156 -0
  198. package/dist/es/pay-popup/interface.d.ts +148 -0
  199. package/dist/es/pay-popup/interface.js +1 -0
  200. package/dist/es/pay-popup/style/index.css +1 -0
  201. package/dist/es/pay-popup/style/index.d.ts +1 -0
  202. package/dist/es/pay-popup/style/index.js +1 -0
  203. package/dist/es/shared/enums/index.d.ts +57 -0
  204. package/dist/es/shared/enums/index.js +58 -0
  205. package/dist/es/shared/index.d.ts +1 -0
  206. package/dist/es/shared/index.js +1 -0
  207. package/dist/es/utils/can-use-dom.d.ts +1 -0
  208. package/dist/es/utils/can-use-dom.js +1 -0
  209. package/dist/es/utils/classNames.d.ts +5 -0
  210. package/dist/es/utils/classNames.js +27 -0
  211. package/dist/es/utils/dom.d.ts +8 -0
  212. package/dist/es/utils/dom.js +80 -0
  213. package/dist/es/utils/get-container.d.ts +2 -0
  214. package/dist/es/utils/get-container.js +5 -0
  215. package/dist/es/utils/get-scroll-parent.d.ts +3 -0
  216. package/dist/es/utils/get-scroll-parent.js +24 -0
  217. package/dist/es/utils/getPrefixCls.d.ts +1 -0
  218. package/dist/es/utils/getPrefixCls.js +3 -0
  219. package/dist/es/utils/is.d.ts +35 -0
  220. package/dist/es/utils/is.js +122 -0
  221. package/dist/es/utils/native-props.d.ts +8 -0
  222. package/dist/es/utils/native-props.js +26 -0
  223. package/dist/es/utils/omit.d.ts +1 -0
  224. package/dist/es/utils/omit.js +15 -0
  225. package/dist/es/utils/qrcode.d.ts +7 -0
  226. package/dist/es/utils/qrcode.js +17 -0
  227. package/dist/es/utils/render-to-container.d.ts +3 -0
  228. package/dist/es/utils/render-to-container.js +10 -0
  229. package/dist/es/utils/should-render.d.ts +10 -0
  230. package/dist/es/utils/should-render.js +12 -0
  231. package/dist/es/utils/supports-passive.d.ts +1 -0
  232. package/dist/es/utils/supports-passive.js +14 -0
  233. package/dist/es/utils/warning.d.ts +1 -0
  234. package/dist/es/utils/warning.js +13 -0
  235. package/dist/es/utils/with-default-props.d.ts +9 -0
  236. package/dist/es/utils/with-default-props.js +33 -0
  237. package/dist/es/utils/with-stop-propagation.d.ts +4 -0
  238. package/dist/es/utils/with-stop-propagation.js +22 -0
  239. package/dist/lib/Airwallex/airwallex-button.js +94 -0
  240. package/dist/lib/Airwallex/airwallex-modal.js +70 -0
  241. package/dist/lib/Airwallex/airwallex-popup.js +81 -0
  242. package/dist/lib/Airwallex/airwallex.js +83 -0
  243. package/dist/lib/Airwallex/index.js +29 -0
  244. package/dist/lib/Airwallex/interface.js +5 -0
  245. package/dist/lib/Airwallex/style/index.css +1 -0
  246. package/dist/lib/Airwallex/style/index.js +3 -0
  247. package/dist/lib/Alipay/alipay-button.js +60 -0
  248. package/dist/lib/Alipay/alipay-modal.js +53 -0
  249. package/dist/lib/Alipay/alipay.js +52 -0
  250. package/dist/lib/Alipay/index.js +27 -0
  251. package/dist/lib/Alipay/interface.js +5 -0
  252. package/dist/lib/Alipay/style/index.css +1 -0
  253. package/dist/lib/Alipay/style/index.js +5 -0
  254. package/dist/lib/Button/button.js +82 -0
  255. package/dist/lib/Button/index.js +22 -0
  256. package/dist/lib/Button/interface.js +5 -0
  257. package/dist/lib/Button/style/index.css +1 -0
  258. package/dist/lib/Button/style/index.js +3 -0
  259. package/dist/lib/FullScreenLoading/index.js +124 -0
  260. package/dist/lib/FullScreenLoading/interface.js +5 -0
  261. package/dist/lib/FullScreenLoading/style/index.css +1 -0
  262. package/dist/lib/FullScreenLoading/style/index.js +3 -0
  263. package/dist/lib/MAlipay/index.js +25 -0
  264. package/dist/lib/MAlipay/interface.js +5 -0
  265. package/dist/lib/MAlipay/m-alipay-auto-submit.js +43 -0
  266. package/dist/lib/MAlipay/m-alipay-button.js +135 -0
  267. package/dist/lib/MAlipay/style/index.css +1 -0
  268. package/dist/lib/MAlipay/style/index.js +3 -0
  269. package/dist/lib/MWeChat/index.js +28 -0
  270. package/dist/lib/MWeChat/interface.js +5 -0
  271. package/dist/lib/MWeChat/m-wechat-button.js +125 -0
  272. package/dist/lib/MWeChat/style/index.css +1 -0
  273. package/dist/lib/MWeChat/style/index.js +3 -0
  274. package/dist/lib/Mask/index.js +22 -0
  275. package/dist/lib/Mask/interface.js +5 -0
  276. package/dist/lib/Mask/mask.js +117 -0
  277. package/dist/lib/Mask/style/index.css +1 -0
  278. package/dist/lib/Mask/style/index.js +3 -0
  279. package/dist/lib/PayButton/index.js +76 -0
  280. package/dist/lib/PayButton/interface.js +3 -0
  281. package/dist/lib/PayMask/index.js +22 -0
  282. package/dist/lib/PayMask/interface.js +5 -0
  283. package/dist/lib/PayMask/pay-mask.js +112 -0
  284. package/dist/lib/PayMask/style/index.css +1 -0
  285. package/dist/lib/PayMask/style/index.js +3 -0
  286. package/dist/lib/Paypal/index.js +28 -0
  287. package/dist/lib/Paypal/interface.js +5 -0
  288. package/dist/lib/Paypal/paypal-button.js +83 -0
  289. package/dist/lib/Paypal/style/index.css +1 -0
  290. package/dist/lib/Paypal/style/index.js +3 -0
  291. package/dist/lib/Payssion/index.js +28 -0
  292. package/dist/lib/Payssion/interface.js +5 -0
  293. package/dist/lib/Payssion/payssion-button.js +83 -0
  294. package/dist/lib/Payssion/style/index.css +1 -0
  295. package/dist/lib/Payssion/style/index.js +3 -0
  296. package/dist/lib/Stripe/index.js +29 -0
  297. package/dist/lib/Stripe/interface.js +5 -0
  298. package/dist/lib/Stripe/stripe-button.js +73 -0
  299. package/dist/lib/Stripe/stripe-modal.js +57 -0
  300. package/dist/lib/Stripe/stripe-popup.js +68 -0
  301. package/dist/lib/Stripe/stripe.js +46 -0
  302. package/dist/lib/Stripe/style/index.css +1 -0
  303. package/dist/lib/Stripe/style/index.js +3 -0
  304. package/dist/lib/Wechat/index.js +27 -0
  305. package/dist/lib/Wechat/interface.js +5 -0
  306. package/dist/lib/Wechat/style/index.css +1 -0
  307. package/dist/lib/Wechat/style/index.js +3 -0
  308. package/dist/lib/Wechat/wechat-button.js +58 -0
  309. package/dist/lib/Wechat/wechat-modal.js +52 -0
  310. package/dist/lib/Wechat/wechat.js +48 -0
  311. package/dist/lib/confirm-modal/index.js +72 -0
  312. package/dist/lib/confirm-modal/interface.js +5 -0
  313. package/dist/lib/confirm-modal/style/index.css +1 -0
  314. package/dist/lib/confirm-modal/style/index.js +3 -0
  315. package/dist/lib/dot-loading/dot-loading.js +67 -0
  316. package/dist/lib/dot-loading/index.js +22 -0
  317. package/dist/lib/dot-loading/interface.js +5 -0
  318. package/dist/lib/dot-loading/style/index.css +1 -0
  319. package/dist/lib/dot-loading/style/index.js +3 -0
  320. package/dist/lib/hooks/use-initialized.js +14 -0
  321. package/dist/lib/hooks/use-inner-visible.js +15 -0
  322. package/dist/lib/hooks/use-lock-scroll.js +88 -0
  323. package/dist/lib/hooks/use-touch.js +66 -0
  324. package/dist/lib/hooks/usePayWindowOpen.js +92 -0
  325. package/dist/lib/icons/IconAlipay/index.js +28 -0
  326. package/dist/lib/icons/IconClose/index.js +34 -0
  327. package/dist/lib/icons/IconPaypalText/index.js +34 -0
  328. package/dist/lib/icons/IconPaypalWhite/index.js +29 -0
  329. package/dist/lib/icons/IconPayssionPay/index.js +57 -0
  330. package/dist/lib/icons/IconStripe/index.js +29 -0
  331. package/dist/lib/icons/IconStripeText/index.js +29 -0
  332. package/dist/lib/icons/IconWechatPay/index.js +28 -0
  333. package/dist/lib/icons/index.js +84 -0
  334. package/dist/lib/icons/interface.js +5 -0
  335. package/dist/lib/icons/style/index.css +1 -0
  336. package/dist/lib/icons/style/index.js +3 -0
  337. package/dist/lib/index.js +92 -0
  338. package/dist/lib/pay-modal/index.js +22 -0
  339. package/dist/lib/pay-modal/interface.js +5 -0
  340. package/dist/lib/pay-modal/pay-modal.js +113 -0
  341. package/dist/lib/pay-modal/style/index.css +1 -0
  342. package/dist/lib/pay-modal/style/index.js +3 -0
  343. package/dist/lib/pay-popup/index.js +176 -0
  344. package/dist/lib/pay-popup/interface.js +5 -0
  345. package/dist/lib/pay-popup/style/index.css +1 -0
  346. package/dist/lib/pay-popup/style/index.js +3 -0
  347. package/dist/lib/shared/enums/index.js +64 -0
  348. package/dist/lib/shared/index.js +16 -0
  349. package/dist/lib/utils/can-use-dom.js +7 -0
  350. package/dist/lib/utils/classNames.js +34 -0
  351. package/dist/lib/utils/dom.js +86 -0
  352. package/dist/lib/utils/get-container.js +11 -0
  353. package/dist/lib/utils/get-scroll-parent.js +30 -0
  354. package/dist/lib/utils/getPrefixCls.js +9 -0
  355. package/dist/lib/utils/is.js +160 -0
  356. package/dist/lib/utils/native-props.js +33 -0
  357. package/dist/lib/utils/omit.js +21 -0
  358. package/dist/lib/utils/qrcode.js +23 -0
  359. package/dist/lib/utils/render-to-container.js +16 -0
  360. package/dist/lib/utils/should-render.js +20 -0
  361. package/dist/lib/utils/supports-passive.js +20 -0
  362. package/dist/lib/utils/warning.js +19 -0
  363. package/dist/lib/utils/with-default-props.js +40 -0
  364. package/dist/lib/utils/with-stop-propagation.js +29 -0
  365. package/dist/umd/pay-sdk-react.umd.js +16360 -0
  366. package/dist/umd/pay-sdk-react.umd.js.map +1 -0
  367. package/package.json +181 -0
@@ -0,0 +1,45 @@
1
+ const _excluded = ["wechatProps", "visible", "onClose"];
2
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
+ function _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; }
4
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
5
+ import { forwardRef, useImperativeHandle, useRef, useState } from "react";
6
+ import PayModal from "../pay-modal";
7
+ import Wechat from "./wechat";
8
+ const WechatModal = /*#__PURE__*/forwardRef((props, ref) => {
9
+ const {
10
+ wechatProps: propsWechatProps,
11
+ visible,
12
+ onClose
13
+ } = props,
14
+ others = _objectWithoutProperties(props, _excluded);
15
+ const wechatRef = useRef(null);
16
+ const [uncontrolledVisible, setUncontrolledVisible] = useState(false);
17
+ const [wechatProps, setWechatProps] = useState();
18
+ const isControlled = visible !== undefined;
19
+ const _visible = isControlled ? visible : uncontrolledVisible;
20
+ useImperativeHandle(ref, () => ({
21
+ open: value => {
22
+ if (value) {
23
+ setWechatProps(value);
24
+ }
25
+ setUncontrolledVisible(true);
26
+ },
27
+ close: () => {
28
+ setUncontrolledVisible(false);
29
+ onClose === null || onClose === void 0 || onClose();
30
+ },
31
+ current: wechatRef.current
32
+ }));
33
+ const _wechatProps = propsWechatProps !== null && propsWechatProps !== void 0 ? propsWechatProps : wechatProps;
34
+ return /*#__PURE__*/React.createElement(PayModal, _extends({
35
+ visible: _visible,
36
+ onClose: () => {
37
+ if (!isControlled) {
38
+ setUncontrolledVisible(false);
39
+ }
40
+ onClose === null || onClose === void 0 || onClose();
41
+ }
42
+ }, others), (_wechatProps === null || _wechatProps === void 0 ? void 0 : _wechatProps.wechatUrl) && /*#__PURE__*/React.createElement(Wechat, _wechatProps));
43
+ });
44
+ WechatModal.displayName = "WechatModal";
45
+ export default WechatModal;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { WechatProps } from './interface';
3
+ declare const WechatQrCode: React.FC<WechatProps>;
4
+ export default WechatQrCode;
@@ -0,0 +1,40 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import cs from '../utils/classNames';
3
+ import makeQrcode from '../utils/qrcode';
4
+ 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(() => {
16
+ if (wechatType === 'qrcode') {
17
+ makeQrcode(wechatUrl).then(url => {
18
+ setImageUrl(url);
19
+ });
20
+ } else {
21
+ setImageUrl(wechatUrl);
22
+ }
23
+ }, [wechatUrl, wechatType]);
24
+ if (!imageUrl) {
25
+ return null;
26
+ }
27
+ return /*#__PURE__*/React.createElement("div", {
28
+ className: cs(classPrefix, className),
29
+ style: style
30
+ }, /*#__PURE__*/React.createElement("div", {
31
+ className: "".concat(classPrefix, "__container")
32
+ }, /*#__PURE__*/React.createElement("img", {
33
+ className: "".concat(classPrefix, "__image"),
34
+ src: imageUrl,
35
+ alt: '微信支付二维码'
36
+ })), tipText && /*#__PURE__*/React.createElement("span", {
37
+ className: "".concat(classPrefix, "__tip")
38
+ }, tipText));
39
+ };
40
+ export default WechatQrCode;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { ConfirmModalProps } from "./interface";
3
+ declare const ConfirmModal: React.FC<ConfirmModalProps>;
4
+ export * from "./interface";
5
+ export default ConfirmModal;
@@ -0,0 +1,52 @@
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", {
14
+ role: "img",
15
+ "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(() => {
33
+ onClose === null || onClose === void 0 || onClose();
34
+ if (autoOpenWindow) closeWindow();
35
+ }, [onClose, autoOpenWindow, closeWindow]);
36
+ if (!visible) return null;
37
+ return /*#__PURE__*/React.createElement(PayModal, {
38
+ visible: visible,
39
+ icon: icon,
40
+ title: title,
41
+ desc: desc,
42
+ showClose: showClose,
43
+ maskClosable: maskClosable,
44
+ onClose: handleClose,
45
+ onRetry: onRetry,
46
+ onFinish: onFinish,
47
+ retryText: retryText,
48
+ finishText: finishText
49
+ });
50
+ };
51
+ export * from "./interface";
52
+ export default ConfirmModal;
@@ -0,0 +1,21 @@
1
+ import { OpenPayUrlMode } from "../hooks/usePayWindowOpen";
2
+ import { PayModalProps } from "../pay-modal";
3
+ export interface ConfirmModalProps extends PayModalProps {
4
+ /**
5
+ * @zh 支付页面 url
6
+ * @en Payment page url
7
+ */
8
+ payUrl?: string;
9
+ /**
10
+ * @zh 是否自动打开支付页面,默认 true
11
+ * @en Whether to automatically open the payment page, default is true
12
+ * @default true
13
+ */
14
+ autoOpenWindow?: boolean;
15
+ /**
16
+ * @zh 打开支付页面模式
17
+ * @en Mode for opening the payment page
18
+ * @default "window"
19
+ */
20
+ openMode?: OpenPayUrlMode;
21
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -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 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}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { DotLoadingProps } from './interface';
3
+ declare const DotLoading: React.NamedExoticComponent<DotLoadingProps>;
4
+ export default DotLoading;
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+ import cs from '../utils/classNames';
3
+ import { mergeProps } from '../utils/with-default-props';
4
+ import { withNativeProps } from '../utils/native-props';
5
+ import { getPrefixCls } from '../utils/getPrefixCls';
6
+ const classPrefix = getPrefixCls('dot-loading');
7
+ const colorRecord = {
8
+ default: 'var(--adm-color-weak)',
9
+ primary: 'var(--adm-color-primary)',
10
+ white: 'var(--adm-color-white)'
11
+ };
12
+ const defaultProps = {
13
+ color: 'default'
14
+ };
15
+ const DotLoading = /*#__PURE__*/React.memo(p => {
16
+ var _colorRecord$props$co;
17
+ const props = mergeProps(defaultProps, p);
18
+ return withNativeProps(props, /*#__PURE__*/React.createElement("div", {
19
+ style: {
20
+ color: (_colorRecord$props$co = colorRecord[props.color]) !== null && _colorRecord$props$co !== void 0 ? _colorRecord$props$co : props.color
21
+ },
22
+ className: cs('adm-loading', classPrefix)
23
+ }, /*#__PURE__*/React.createElement("svg", {
24
+ height: "1em",
25
+ viewBox: "0 0 100 40",
26
+ style: {
27
+ verticalAlign: '-0.125em'
28
+ }
29
+ }, /*#__PURE__*/React.createElement("g", {
30
+ stroke: "none",
31
+ strokeWidth: "1",
32
+ fill: "none",
33
+ fillRule: "evenodd"
34
+ }, /*#__PURE__*/React.createElement("g", {
35
+ transform: "translate(-100.000000, -71.000000)"
36
+ }, /*#__PURE__*/React.createElement("g", {
37
+ transform: "translate(95.000000, 71.000000)"
38
+ }, /*#__PURE__*/React.createElement("g", {
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
+ }))))))))));
58
+ });
59
+ DotLoading.displayName = 'DotLoading';
60
+ export default DotLoading;
@@ -0,0 +1,3 @@
1
+ import DotLoading from "./dot-loading";
2
+ export * from "./interface";
3
+ export default DotLoading;
@@ -0,0 +1,3 @@
1
+ import DotLoading from "./dot-loading";
2
+ export * from "./interface";
3
+ export default DotLoading;
@@ -0,0 +1,4 @@
1
+ import type { NativeProps } from "../utils/native-props";
2
+ export type DotLoadingProps = {
3
+ color?: "default" | "primary" | "white" | (string & {});
4
+ } & NativeProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ .pay-dot-loading{display:inline-block}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ export declare function useInitialized(check?: boolean): boolean;
@@ -0,0 +1,8 @@
1
+ import { useRef } from "react";
2
+ export function useInitialized(check) {
3
+ const initializedRef = useRef(check);
4
+ if (check) {
5
+ initializedRef.current = true;
6
+ }
7
+ return !!initializedRef.current;
8
+ }
@@ -0,0 +1 @@
1
+ export declare function useInnerVisible(outerVisible: boolean): boolean;
@@ -0,0 +1,9 @@
1
+ import { useState } from "react";
2
+ import { useIsomorphicLayoutEffect } from "ahooks";
3
+ export function useInnerVisible(outerVisible) {
4
+ const [innerVisible, setInnerVisible] = useState(outerVisible);
5
+ useIsomorphicLayoutEffect(() => {
6
+ setInnerVisible(outerVisible);
7
+ }, [outerVisible]);
8
+ return innerVisible;
9
+ }
@@ -0,0 +1,2 @@
1
+ import { RefObject } from "react";
2
+ export declare function useLockScroll(rootRef: RefObject<HTMLElement>, shouldLock: boolean | "strict"): void;
@@ -0,0 +1,82 @@
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";
7
+ function getScrollableElement(el) {
8
+ let current = el === null || el === void 0 ? void 0 : el.parentElement;
9
+ while (current) {
10
+ if (current.clientHeight < current.scrollHeight) {
11
+ return current;
12
+ }
13
+ current = current.parentElement;
14
+ }
15
+ return null;
16
+ }
17
+ export function useLockScroll(rootRef, shouldLock) {
18
+ const touch = useTouch();
19
+ const onTouchMove = event => {
20
+ touch.move(event);
21
+ const direction = touch.deltaY.current > 0 ? "10" : "01";
22
+ const el = getScrollParent(event.target, rootRef.current);
23
+ if (!el) return;
24
+
25
+ // This has perf cost but we have to compatible with iOS 12
26
+ if (shouldLock === "strict") {
27
+ const scrollableParent = getScrollableElement(event.target);
28
+ if (scrollableParent === document.body || scrollableParent === document.documentElement) {
29
+ event.preventDefault();
30
+ return;
31
+ }
32
+ }
33
+ const {
34
+ scrollHeight,
35
+ offsetHeight,
36
+ scrollTop
37
+ } = el;
38
+ const {
39
+ height
40
+ } = el.getBoundingClientRect();
41
+ let status = "11";
42
+ if (scrollTop === 0) {
43
+ status = offsetHeight >= scrollHeight ? "00" : "01";
44
+ } else if (scrollHeight <= Math.round(height + scrollTop)) {
45
+ status = "10";
46
+ }
47
+ if (status !== "11" && touch.isVertical() && !(parseInt(status, 2) & parseInt(direction, 2))) {
48
+ if (event.cancelable && supportsPassive) {
49
+ event.preventDefault();
50
+ }
51
+ }
52
+ };
53
+ const lock = () => {
54
+ document.addEventListener("touchstart", touch.start);
55
+ document.addEventListener("touchmove", onTouchMove, supportsPassive ? {
56
+ passive: false
57
+ } : false);
58
+ if (!totalLockCount) {
59
+ document.body.classList.add(BODY_LOCK_CLASS);
60
+ }
61
+ totalLockCount++;
62
+ };
63
+ const unlock = () => {
64
+ if (totalLockCount) {
65
+ document.removeEventListener("touchstart", touch.start);
66
+ document.removeEventListener("touchmove", onTouchMove);
67
+ totalLockCount--;
68
+ if (!totalLockCount) {
69
+ document.body.classList.remove(BODY_LOCK_CLASS);
70
+ }
71
+ }
72
+ };
73
+ useEffect(() => {
74
+ if (shouldLock) {
75
+ lock();
76
+ return () => {
77
+ unlock();
78
+ };
79
+ }
80
+ // eslint-disable-next-line react-hooks/exhaustive-deps
81
+ }, [shouldLock]);
82
+ }
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ type Direction = "" | "vertical" | "horizontal";
3
+ export declare function useTouch(): {
4
+ move: EventListener;
5
+ start: EventListener;
6
+ reset: () => void;
7
+ startX: import("react").MutableRefObject<number>;
8
+ startY: import("react").MutableRefObject<number>;
9
+ deltaX: import("react").MutableRefObject<number>;
10
+ deltaY: import("react").MutableRefObject<number>;
11
+ offsetX: import("react").MutableRefObject<number>;
12
+ offsetY: import("react").MutableRefObject<number>;
13
+ direction: import("react").MutableRefObject<Direction>;
14
+ isVertical: () => boolean;
15
+ isHorizontal: () => boolean;
16
+ };
17
+ export {};
@@ -0,0 +1,60 @@
1
+ import { useRef } from "react";
2
+ const MIN_DISTANCE = 10;
3
+ function getDirection(x, y) {
4
+ if (x > y && x > MIN_DISTANCE) {
5
+ return "horizontal";
6
+ }
7
+ if (y > x && y > MIN_DISTANCE) {
8
+ return "vertical";
9
+ }
10
+ return "";
11
+ }
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 = () => {
23
+ deltaX.current = 0;
24
+ deltaY.current = 0;
25
+ offsetX.current = 0;
26
+ offsetY.current = 0;
27
+ direction.current = "";
28
+ };
29
+ const start = event => {
30
+ var _event$touches$0$clie, _event$touches$, _event$touches$0$clie2, _event$touches$2;
31
+ reset();
32
+ 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
+ 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
+ };
35
+ const move = event => {
36
+ const touch = event.touches[0];
37
+ if (!touch) return;
38
+ deltaX.current = touch.clientX - startX.current;
39
+ deltaY.current = (touch === null || touch === void 0 ? void 0 : touch.clientY) - startY.current;
40
+ offsetX.current = Math.abs(deltaX.current);
41
+ offsetY.current = Math.abs(deltaY.current);
42
+ if (!direction.current) {
43
+ direction.current = getDirection(offsetX.current, offsetY.current);
44
+ }
45
+ };
46
+ 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
59
+ };
60
+ }
@@ -0,0 +1,21 @@
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 {
10
+ payUrl: string;
11
+ onClose?: () => void;
12
+ onSuccess?: () => void;
13
+ autoOpen?: boolean;
14
+ openMode?: OpenPayUrlMode;
15
+ }
16
+ export declare function usePayWindowOpen({ payUrl, onClose, onSuccess, autoOpen, openMode, }: UsePayWindowOpenOptions): {
17
+ openWindow: () => void;
18
+ closeWindow: () => void;
19
+ payWindowRef: import("react").MutableRefObject<Window | null>;
20
+ };
21
+ export {};
@@ -0,0 +1,87 @@
1
+ import { useEffect, useRef, useCallback, useState } from "react";
2
+
3
+ /**
4
+ * @zh 如果您希望用户在支付过程中随时可以通过"后退"按钮放弃支付并返回到您的应用,那么 href 是一个好选择;
5
+ * @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;
6
+ * @zh 使用 replace: 如果您的业务逻辑是"一旦点击支付,就不能轻易返回",replace 会更合适。例如,点击支付后,您的后端已经创建了一张"待支付"的订单。为了防止用户通过"后退"按钮回到上一个页面再次创建订单,使用 replace 可以强制用户要么完成支付,要么关闭页面,而不能"后退"到上一步。
7
+ * @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.
8
+ */
9
+
10
+ export function usePayWindowOpen(_ref) {
11
+ let {
12
+ payUrl,
13
+ onClose,
14
+ onSuccess,
15
+ autoOpen = true,
16
+ openMode = "window"
17
+ } = _ref;
18
+ const payWindowRef = useRef(null);
19
+ const pollTimerRef = useRef(null);
20
+ const [isWindowMonitoring, setWindowMonitoring] = useState(false);
21
+
22
+ // 打开支付窗口
23
+ const openWindow = useCallback(() => {
24
+ if (openMode === "window") {
25
+ if (payWindowRef.current && !payWindowRef.current.closed) {
26
+ payWindowRef.current.focus();
27
+ } else {
28
+ payWindowRef.current = window.open(payUrl);
29
+ setWindowMonitoring(true);
30
+ }
31
+ } else if (openMode === "replace") {
32
+ window.location.replace(payUrl);
33
+ } else if (openMode === "href") {
34
+ window.location.href = payUrl;
35
+ }
36
+ }, [payUrl, openMode]);
37
+
38
+ // 关闭窗口
39
+ const closeWindow = useCallback(() => {
40
+ var _payWindowRef$current;
41
+ (_payWindowRef$current = payWindowRef.current) === null || _payWindowRef$current === void 0 || _payWindowRef$current.close();
42
+ setWindowMonitoring(false);
43
+ }, []);
44
+
45
+ // 自动打开
46
+ useEffect(() => {
47
+ if (autoOpen) {
48
+ openWindow();
49
+ }
50
+ }, [autoOpen, openWindow]);
51
+
52
+ // 轮询和消息监听
53
+ useEffect(() => {
54
+ if (!isWindowMonitoring || openMode !== "window") {
55
+ return;
56
+ }
57
+ pollTimerRef.current = setInterval(() => {
58
+ if (payWindowRef.current && payWindowRef.current.closed) {
59
+ onClose === null || onClose === void 0 || onClose();
60
+ clearInterval(pollTimerRef.current);
61
+ setWindowMonitoring(false);
62
+ }
63
+ }, 1500);
64
+ function handleMessage(event) {
65
+ if (event.data === "PAYMENT_SUCCESS") {
66
+ var _payWindowRef$current2;
67
+ onSuccess === null || onSuccess === void 0 || onSuccess();
68
+ onClose === null || onClose === void 0 || onClose();
69
+ (_payWindowRef$current2 = payWindowRef.current) === null || _payWindowRef$current2 === void 0 || _payWindowRef$current2.close();
70
+ clearInterval(pollTimerRef.current);
71
+ setWindowMonitoring(false);
72
+ }
73
+ }
74
+ window.addEventListener("message", handleMessage);
75
+ return () => {
76
+ var _payWindowRef$current3;
77
+ clearInterval(pollTimerRef.current);
78
+ window.removeEventListener("message", handleMessage);
79
+ (_payWindowRef$current3 = payWindowRef.current) === null || _payWindowRef$current3 === void 0 || _payWindowRef$current3.close();
80
+ };
81
+ }, [isWindowMonitoring, openMode, onClose, onSuccess]);
82
+ return {
83
+ openWindow,
84
+ closeWindow,
85
+ payWindowRef
86
+ };
87
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { IconProps } from '../interface';
3
+ declare const IconAlipay: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
4
+ export default IconAlipay;
@@ -0,0 +1,21 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React from 'react';
3
+ import omit from '../../utils/omit';
4
+ import { getPrefixCls } from '../../utils/getPrefixCls';
5
+ const classPrefix = getPrefixCls('icon');
6
+ const IconAlipay = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
7
+ ref: ref,
8
+ d: "1750766022943",
9
+ viewBox: "0 0 1024 1024",
10
+ version: "1.1",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ "p-id": "7113",
13
+ stroke: "currentColor",
14
+ className: "".concat(classPrefix, " ").concat(classPrefix, "-alipay")
15
+ }, omit(props, ['className'])), /*#__PURE__*/React.createElement("path", {
16
+ d: "M1024.0512 701.0304V196.864A196.9664 196.9664 0 0 0 827.136 0H196.864A196.9664 196.9664 0 0 0 0 196.864v630.272A196.9152 196.9152 0 0 0 196.864 1024h630.272a197.12 197.12 0 0 0 193.8432-162.0992c-52.224-22.6304-278.528-120.32-396.4416-176.64-89.7024 108.6976-183.7056 173.9264-325.3248 173.9264s-236.1856-87.2448-224.8192-194.048c7.4752-70.0416 55.552-184.576 264.2944-164.9664 110.08 10.3424 160.4096 30.8736 250.1632 60.5184 23.1936-42.5984 42.496-89.4464 57.1392-139.264H248.064v-39.424h196.9152V311.1424H204.8V267.776h240.128V165.632s2.1504-15.9744 19.8144-15.9744h98.4576V267.776h256v43.4176h-256V381.952h208.8448a805.9904 805.9904 0 0 1-84.8384 212.6848c60.672 22.016 336.7936 106.3936 336.7936 106.3936zM283.5456 791.6032c-149.6576 0-173.312-94.464-165.376-133.9392 7.8336-39.3216 51.2-90.624 134.4-90.624 95.5904 0 181.248 24.4736 284.0576 74.5472-72.192 94.0032-160.9216 150.016-253.0816 150.016z",
17
+ fill: "#009FE8",
18
+ "p-id": "7114"
19
+ })));
20
+ IconAlipay.displayName = 'IconAlipay';
21
+ export default IconAlipay;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { IconProps } from '../interface';
3
+ declare const IconClose: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
4
+ export default IconClose;
@@ -0,0 +1,27 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import React from 'react';
3
+ import omit from '../../utils/omit';
4
+ import { getPrefixCls } from '../../utils/getPrefixCls';
5
+ const classPrefix = getPrefixCls('icon');
6
+ const IconClose = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement("svg", _extends({
7
+ ref: ref,
8
+ d: "1750733458208",
9
+ viewBox: "0 0 1024 1024",
10
+ version: "1.1",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ "p-id": "4564",
13
+ stroke: "currentColor",
14
+ strokeWidth: "4",
15
+ className: "".concat(classPrefix, " ").concat(classPrefix, "-close")
16
+ }, omit(props, ['className'])), /*#__PURE__*/React.createElement("path", {
17
+ d: "M0 0h1024v1024H0z",
18
+ fill: "#999999",
19
+ "fill-opacity": "0",
20
+ "p-id": "4565"
21
+ }), /*#__PURE__*/React.createElement("path", {
22
+ d: "M240.448 168l2.346667 2.154667 289.92 289.941333 279.253333-279.253333a42.666667 42.666667 0 0 1 62.506667 58.026666l-2.133334 2.346667-279.296 279.210667 279.274667 279.253333a42.666667 42.666667 0 0 1-58.005333 62.528l-2.346667-2.176-279.253333-279.253333-289.92 289.962666a42.666667 42.666667 0 0 1-62.506667-58.005333l2.154667-2.346667 289.941333-289.962666-289.92-289.92a42.666667 42.666667 0 0 1 57.984-62.506667z",
23
+ fill: "#999999",
24
+ "p-id": "4566"
25
+ })));
26
+ IconClose.displayName = 'IconClose';
27
+ export default IconClose;