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,44 @@
1
+ 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; }
2
+ 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; }
3
+ 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; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ 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); }
6
+ import React, { useState } from 'react';
7
+ import FullScreenLoading from '../FullScreenLoading';
8
+ import { getPrefixCls } from '../utils/getPrefixCls';
9
+ import cs from '../utils/classNames';
10
+ const classPrefix = getPrefixCls('alipay-qr-iframe');
11
+ const AlipayQrIframe = _ref => {
12
+ let {
13
+ formHtml,
14
+ tipText = '请使用支付宝APP扫码支付',
15
+ className = '',
16
+ style = {}
17
+ } = _ref;
18
+ const [loading, setLoading] = useState(true);
19
+ return /*#__PURE__*/React.createElement(FullScreenLoading, {
20
+ loading: loading,
21
+ type: 'spin-dots',
22
+ text: null,
23
+ fullscreen: false
24
+ }, /*#__PURE__*/React.createElement("div", {
25
+ className: classPrefix,
26
+ style: _objectSpread({
27
+ position: 'relative'
28
+ }, style)
29
+ }, /*#__PURE__*/React.createElement("iframe", {
30
+ srcDoc: formHtml,
31
+ className: cs("".concat(classPrefix, "__iframe"), className),
32
+ style: {
33
+ width: 210,
34
+ height: 210,
35
+ border: 'none'
36
+ },
37
+ title: "alipay-qrcode",
38
+ scrolling: "no",
39
+ onLoad: () => setLoading(false)
40
+ }), !!tipText && /*#__PURE__*/React.createElement("span", {
41
+ className: "".concat(classPrefix, "__tip")
42
+ }, tipText)));
43
+ };
44
+ export default AlipayQrIframe;
@@ -0,0 +1,10 @@
1
+ import Alipay from "./alipay";
2
+ import AlipayButton from "./alipay-button";
3
+ import AlipayModal from "./alipay-modal";
4
+ type AlipayComponentType = typeof Alipay & {
5
+ Button: typeof AlipayButton;
6
+ Modal: typeof AlipayModal;
7
+ };
8
+ declare const AlipayComponent: AlipayComponentType;
9
+ export * from "./interface";
10
+ export default AlipayComponent;
@@ -0,0 +1,8 @@
1
+ import Alipay from "./alipay";
2
+ import AlipayButton from "./alipay-button";
3
+ import AlipayModal from "./alipay-modal";
4
+ const AlipayComponent = Alipay;
5
+ AlipayComponent.Button = AlipayButton;
6
+ AlipayComponent.Modal = AlipayModal;
7
+ export * from "./interface";
8
+ export default AlipayComponent;
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { PayModalProps } from '../pay-modal';
3
+ import { ButtonProps, ButtonRef } from '../Button';
4
+ export interface AlipayProps {
5
+ /** 后端返回的 form 字符串,必须包含自动提交脚本 */
6
+ formHtml: string;
7
+ /** 下方提示文字,可选,传 null/undefined/空字符串则不显示 */
8
+ tipText?: string | null;
9
+ /** iframe 样式,可选 */
10
+ className?: string;
11
+ /** iframe 容器样式,可选 */
12
+ style?: React.CSSProperties;
13
+ }
14
+ export interface AlipayModalProps extends PayModalProps {
15
+ alipayProps?: AlipayProps;
16
+ }
17
+ export interface AlipayButtonProps extends ButtonProps {
18
+ /**
19
+ * @zh 创建订单函数,返回 Paypal 所需参数
20
+ * @en Function to create order, returns Paypal required params
21
+ */
22
+ createOrder?: CreateOrderAlipayFn;
23
+ /**
24
+ * @zh 弹窗属性
25
+ * @en Modal props
26
+ */
27
+ modalProps?: Omit<AlipayModalProps, 'visible'>;
28
+ }
29
+ export type AlipayButtonRef = ButtonRef;
30
+ export interface AlipayFormData {
31
+ /**
32
+ * @zh 支付宝支付 html 字符串
33
+ * @en Alipay payment html string
34
+ */
35
+ formHtml: string;
36
+ }
37
+ /**
38
+ * @zh 创建订单函数,返回 Paypal 所需参数
39
+ * @en Function to create order, returns Paypal required params
40
+ */
41
+ export type CreateOrderAlipayFn = () => Promise<AlipayFormData>;
42
+ export interface AlipayModalRef {
43
+ /**
44
+ * @zh 打开弹窗
45
+ * @en Open the popup
46
+ */
47
+ open: (options?: AlipayProps) => void;
48
+ /**
49
+ * @zh 关闭弹窗
50
+ * @en Close the popup
51
+ */
52
+ close: () => void;
53
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ .pay-alipay-qr-iframe{display:flex;flex-direction:column;align-items:center}.pay-alipay-qr-iframe__iframe{border:none;width:210px;height:210px;margin-top:10px;margin-bottom:8px}.pay-alipay-qr-iframe__tip{text-align:center;color:#333;font-size:14px;line-height:20px}
@@ -0,0 +1,3 @@
1
+ import './index.css';
2
+ import '../../Button/style/index.css';
3
+ import '../../pay-modal/style/index.css';
@@ -0,0 +1,3 @@
1
+ import './index.css';
2
+ import '../../Button/style/index.css';
3
+ import '../../pay-modal/style/index.css';
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { ButtonRef } from './interface';
3
+ export declare const Button: React.ForwardRefExoticComponent<{
4
+ color?: "default" | "primary" | "success" | "warning" | "danger" | undefined;
5
+ fill?: "none" | "solid" | "outline" | undefined;
6
+ size?: "small" | "mini" | "middle" | "large" | undefined;
7
+ block?: boolean | undefined;
8
+ loading?: boolean | "auto" | undefined;
9
+ loadingText?: string | undefined;
10
+ loadingIcon?: React.ReactNode;
11
+ disabled?: boolean | undefined;
12
+ onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>) | undefined;
13
+ type?: "button" | "submit" | "reset" | undefined;
14
+ shape?: "default" | "rounded" | "rectangular" | undefined;
15
+ children?: React.ReactNode;
16
+ } & Pick<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement>, "form" | "onMouseDown" | "onMouseUp" | "onTouchStart" | "onTouchEnd" | "id"> & {
17
+ className?: string | undefined;
18
+ style?: (React.CSSProperties & Partial<Record<never, string>>) | undefined;
19
+ tabIndex?: number | undefined;
20
+ } & React.AriaAttributes & React.RefAttributes<ButtonRef>>;
21
+ export default Button;
@@ -0,0 +1,74 @@
1
+ import React, { useImperativeHandle, useRef, useState } from 'react';
2
+ import cs from '../utils/classNames';
3
+ import { withNativeProps } from '../utils/native-props';
4
+ import { mergeProps } from '../utils/with-default-props';
5
+ import { isPromise } from '../utils/is';
6
+ import DotLoading from '../dot-loading';
7
+ import { getPrefixCls } from '../utils/getPrefixCls';
8
+ const classPrefix = getPrefixCls('button');
9
+ const defaultProps = {
10
+ color: 'default',
11
+ fill: 'solid',
12
+ block: false,
13
+ loading: false,
14
+ loadingIcon: /*#__PURE__*/React.createElement(DotLoading, {
15
+ color: "currentColor"
16
+ }),
17
+ type: 'button',
18
+ shape: 'default',
19
+ size: 'middle'
20
+ };
21
+ export const Button = /*#__PURE__*/React.forwardRef((p, ref) => {
22
+ const props = mergeProps(defaultProps, p);
23
+ const [innerLoading, setInnerLoading] = useState(false);
24
+ const nativeButtonRef = useRef(null);
25
+ const loading = props.loading === 'auto' ? innerLoading : props.loading;
26
+ const disabled = props.disabled || loading;
27
+ useImperativeHandle(ref, () => ({
28
+ get nativeElement() {
29
+ return nativeButtonRef.current;
30
+ }
31
+ }));
32
+ const handleClick = async e => {
33
+ if (!props.onClick) return;
34
+ const promise = props.onClick(e);
35
+ if (isPromise(promise)) {
36
+ try {
37
+ setInnerLoading(true);
38
+ await promise;
39
+ setInnerLoading(false);
40
+ } catch (e) {
41
+ setInnerLoading(false);
42
+ throw e;
43
+ }
44
+ }
45
+ };
46
+ return withNativeProps(props, /*#__PURE__*/React.createElement("button", {
47
+ ref: nativeButtonRef,
48
+ type: props.type,
49
+ form: props.form,
50
+ onClick: handleClick,
51
+ className: cs(classPrefix, {
52
+ ["".concat(classPrefix, "-").concat(props.color)]: props.color,
53
+ ["".concat(classPrefix, "-block")]: props.block,
54
+ ["".concat(classPrefix, "-disabled")]: disabled,
55
+ ["".concat(classPrefix, "-fill-outline")]: props.fill === 'outline',
56
+ ["".concat(classPrefix, "-fill-none")]: props.fill === 'none',
57
+ ["".concat(classPrefix, "-mini")]: props.size === 'mini',
58
+ ["".concat(classPrefix, "-small")]: props.size === 'small',
59
+ ["".concat(classPrefix, "-large")]: props.size === 'large',
60
+ ["".concat(classPrefix, "-loading")]: loading
61
+ }, "".concat(classPrefix, "-shape-").concat(props.shape)),
62
+ disabled: disabled,
63
+ onMouseDown: props.onMouseDown,
64
+ onMouseUp: props.onMouseUp,
65
+ onTouchStart: props.onTouchStart,
66
+ onTouchEnd: props.onTouchEnd
67
+ }, loading ? /*#__PURE__*/React.createElement("div", {
68
+ className: "".concat(classPrefix, "-loading-wrapper")
69
+ }, props.loadingIcon, props.loadingText) : /*#__PURE__*/React.createElement("span", {
70
+ className: "".concat(classPrefix, "-content")
71
+ }, props.children)));
72
+ });
73
+ Button.displayName = 'Button';
74
+ export default Button;
@@ -0,0 +1,3 @@
1
+ import Button from "./button";
2
+ export * from "./interface";
3
+ export default Button;
@@ -0,0 +1,3 @@
1
+ import Button from "./button";
2
+ export * from "./interface";
3
+ export default Button;
@@ -0,0 +1,21 @@
1
+ import type { NativeProps } from "../utils/native-props";
2
+ import type { ButtonHTMLAttributes, DetailedHTMLProps, ReactNode } from "react";
3
+ type NativeButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
4
+ export type ButtonProps = {
5
+ color?: "default" | "primary" | "success" | "warning" | "danger";
6
+ fill?: "solid" | "outline" | "none";
7
+ size?: "mini" | "small" | "middle" | "large";
8
+ block?: boolean;
9
+ loading?: boolean | "auto";
10
+ loadingText?: string;
11
+ loadingIcon?: ReactNode;
12
+ disabled?: boolean;
13
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void | Promise<void>;
14
+ type?: "submit" | "reset" | "button";
15
+ shape?: "default" | "rounded" | "rectangular";
16
+ children?: ReactNode;
17
+ } & Pick<NativeButtonProps, "onMouseDown" | "onMouseUp" | "onTouchStart" | "onTouchEnd" | "id" | "form"> & NativeProps;
18
+ export type ButtonRef = {
19
+ nativeElement: HTMLButtonElement | null;
20
+ };
21
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ .pay-dot-loading{display:inline-block}.pay-button{display:inline-block;padding:7px 12px;font-size:16px;border-radius:4px;border:1px solid #eee;background:#fff;color:#333;cursor:pointer;transition:all .2s;user-select:none;position:relative;text-align:center}.pay-button-content{display:flex;align-items:center;justify-content:center;gap:6px}.pay-button-block{display:block;width:100%}.pay-button-disabled{opacity:.4;cursor:not-allowed}.pay-button-loading{cursor:wait}.pay-button-loading-wrapper{display:flex;align-items:center;justify-content:center;gap:6px}.pay-button-primary{background:#1677ff;border-color:#1677ff;color:#fff}.pay-button-primary:hover{background:#409eff}.pay-button-success{background:#00b578;border-color:#00b578;color:#fff}.pay-button-danger{background:#ff3141;border-color:#ff3141;color:#fff}.pay-button-warning{background:#ff8f1f;border-color:#ff8f1f;color:#fff}.pay-button-default{background:#fff;border-color:#eee;color:#333}.pay-button-fill-outline{background:0 0;color:inherit}.pay-button-fill-none{background:0 0;border:none;color:inherit}.pay-button-mini{font-size:12px;padding:2px 8px}.pay-button-small{font-size:14px;padding:4px 10px}.pay-button-large{font-size:18px;padding:10px 18px}.pay-button-shape-rounded{border-radius:1000px}.pay-button-shape-rectangular{border-radius:0}
@@ -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 { FullScreenLoadingProps } from './interface';
3
+ declare const FullScreenLoading: React.FC<FullScreenLoadingProps>;
4
+ export default FullScreenLoading;
@@ -0,0 +1,116 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import cs from '../utils/classNames';
3
+ import { useLockScroll } from '../hooks/use-lock-scroll';
4
+ import { getPrefixCls } from '../utils/getPrefixCls';
5
+ const classPrefix = getPrefixCls('fullscreen-loading');
6
+ const FullScreenLoading = _ref => {
7
+ let {
8
+ loading = false,
9
+ text = 'Loading...',
10
+ children,
11
+ fullscreen = true,
12
+ className = '',
13
+ size = 'default',
14
+ type = 'circle'
15
+ } = _ref;
16
+ const containerRef = useRef(null);
17
+ const sizeClass = size ? "".concat(classPrefix, "--").concat(size) : '';
18
+ const typeClass = type ? "".concat(classPrefix, "--").concat(type) : '';
19
+ const classNames = cs({
20
+ [classPrefix]: fullscreen,
21
+ ["".concat(classPrefix, "__container")]: !fullscreen,
22
+ [sizeClass]: size,
23
+ [typeClass]: type
24
+ }, className);
25
+ useLockScroll(containerRef, fullscreen && loading);
26
+ useEffect(() => {
27
+ if (!fullscreen || !loading) return;
28
+ const originalPointerEvents = document.body.style.pointerEvents;
29
+ const originalUserSelect = document.body.style.userSelect;
30
+ document.body.style.pointerEvents = 'none';
31
+ document.body.style.userSelect = 'none';
32
+ return () => {
33
+ document.body.style.pointerEvents = originalPointerEvents;
34
+ document.body.style.userSelect = originalUserSelect;
35
+ };
36
+ }, [fullscreen, loading]);
37
+
38
+ // 局部 loading 时禁止容器操作
39
+ useEffect(() => {
40
+ if (fullscreen || !containerRef.current) return;
41
+ const container = containerRef.current;
42
+ if (loading) {
43
+ container.style.pointerEvents = 'none';
44
+ container.style.userSelect = 'none';
45
+ } else {
46
+ container.style.pointerEvents = '';
47
+ container.style.userSelect = '';
48
+ }
49
+ return () => {
50
+ container.style.pointerEvents = '';
51
+ container.style.userSelect = '';
52
+ };
53
+ }, [fullscreen, loading]);
54
+ const renderLoadingIcon = () => {
55
+ switch (type) {
56
+ case 'circle':
57
+ return /*#__PURE__*/React.createElement("div", {
58
+ className: "".concat(classPrefix, "__circle")
59
+ });
60
+ case 'dots':
61
+ return /*#__PURE__*/React.createElement("div", {
62
+ className: "".concat(classPrefix, "__dots")
63
+ }, /*#__PURE__*/React.createElement("div", {
64
+ className: "".concat(classPrefix, "__dot")
65
+ }), /*#__PURE__*/React.createElement("div", {
66
+ className: "".concat(classPrefix, "__dot")
67
+ }), /*#__PURE__*/React.createElement("div", {
68
+ className: "".concat(classPrefix, "__dot")
69
+ }));
70
+ case 'spin-dots':
71
+ return /*#__PURE__*/React.createElement("div", {
72
+ className: "".concat(classPrefix, "__spin-dots")
73
+ }, Array.from({
74
+ length: 12
75
+ }).map((_, index) => /*#__PURE__*/React.createElement("div", {
76
+ key: index,
77
+ className: "".concat(classPrefix, "__spin-dot"),
78
+ style: {
79
+ transform: "rotate(".concat(index * 30, "deg)"),
80
+ opacity: 1 - index * 0.08
81
+ }
82
+ })));
83
+ default:
84
+ return /*#__PURE__*/React.createElement("div", {
85
+ className: "".concat(classPrefix, "__circle")
86
+ });
87
+ }
88
+ };
89
+ const loadingContent = /*#__PURE__*/React.createElement("div", {
90
+ className: "".concat(classPrefix, "__center")
91
+ }, /*#__PURE__*/React.createElement("div", {
92
+ className: cs("".concat(classPrefix, "__spinner-box"), {
93
+ ["".concat(classPrefix, "__spinner-box--no-text")]: text === null
94
+ })
95
+ }, /*#__PURE__*/React.createElement("div", {
96
+ className: "".concat(classPrefix, "__spinner")
97
+ }, renderLoadingIcon()), text !== null && /*#__PURE__*/React.createElement("div", {
98
+ className: "".concat(classPrefix, "__text")
99
+ }, text)));
100
+
101
+ // 局部 loading 包裹 children
102
+ if (children) {
103
+ return /*#__PURE__*/React.createElement("div", {
104
+ className: classNames,
105
+ ref: containerRef
106
+ }, children, loading && /*#__PURE__*/React.createElement("div", {
107
+ className: "".concat(classPrefix, "__mask")
108
+ }, loadingContent));
109
+ }
110
+
111
+ // 全屏 loading
112
+ return loading ? /*#__PURE__*/React.createElement("div", {
113
+ className: classNames
114
+ }, loadingContent) : null;
115
+ };
116
+ export default FullScreenLoading;
@@ -0,0 +1,43 @@
1
+ /// <reference types="react" />
2
+ export interface FullScreenLoadingProps {
3
+ /**
4
+ * @zh 是否显示 loading
5
+ * @en Whether to show loading
6
+ * @default false
7
+ */
8
+ loading?: boolean;
9
+ /**
10
+ * @zh 显示的文本,传入 null 则不显示
11
+ * @en The text to display, pass null to hide
12
+ * @default "Loading..."
13
+ */
14
+ text?: string | null;
15
+ /**
16
+ * @zh 局部 loading 包裹的子元素
17
+ * @en The children of the loading
18
+ */
19
+ children?: React.ReactNode;
20
+ /**
21
+ * @zh 是否全屏显示
22
+ * @en Whether to display fullscreen
23
+ * @default true
24
+ */
25
+ fullscreen?: boolean;
26
+ /**
27
+ * @zh 类名
28
+ * @en The class name of the loading
29
+ */
30
+ className?: string;
31
+ /**
32
+ * @zh 大小
33
+ * @en The size of the loading
34
+ * @default "default"
35
+ */
36
+ size?: "small" | "medium" | "large" | "default";
37
+ /**
38
+ * @zh 类型
39
+ * @en The type of the loading
40
+ * @default "circle"
41
+ */
42
+ type?: "circle" | "dots" | "spin-dots";
43
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ .pay-fullscreen-loading{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center;pointer-events:auto;user-select:none}.pay-fullscreen-loading__center{display:flex;flex-direction:column;align-items:center;justify-content:center}.pay-fullscreen-loading__spinner-box{display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(17,17,17,.8);border-radius:16px;transition:width .2s,height .2s;box-sizing:border-box;padding:8px}.pay-fullscreen-loading__spinner-box--no-text{padding:4px}.pay-fullscreen-loading__spinner{margin-bottom:8px}.pay-fullscreen-loading__spinner-box--no-text .pay-fullscreen-loading__spinner{margin-bottom:0}.pay-fullscreen-loading__circle{border:3px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:spin 1.2s linear infinite}.pay-fullscreen-loading__text{color:#fff;font-weight:600;letter-spacing:.25px;text-align:center;width:100%;word-break:break-all;line-height:1.2;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.pay-fullscreen-loading__dots{display:flex;align-items:center;gap:10px}.pay-fullscreen-loading__dot{background:#fff;border-radius:50%;animation:bounce .5s ease-in-out infinite}.pay-fullscreen-loading__dot:nth-child(2){animation-delay:.1s}.pay-fullscreen-loading__dot:nth-child(3){animation-delay:.2s}.pay-fullscreen-loading__spin-dots{position:relative;animation:spin 1.2s steps(12) infinite}.pay-fullscreen-loading__spin-dot{position:absolute;top:0;left:50%;background:#fff;border-radius:50%}.pay-fullscreen-loading--small .pay-fullscreen-loading__spinner-box{width:88px;height:88px}.pay-fullscreen-loading--small .pay-fullscreen-loading__spinner-box--no-text{width:48px;height:48px}.pay-fullscreen-loading--small .pay-fullscreen-loading__circle{width:24px;height:24px;border-width:3px}.pay-fullscreen-loading--small .pay-fullscreen-loading__text{font-size:14px}.pay-fullscreen-loading--small .pay-fullscreen-loading__dot{width:6px;height:6px}.pay-fullscreen-loading--small .pay-fullscreen-loading__spin-dots{width:28px;height:28px}.pay-fullscreen-loading--small .pay-fullscreen-loading__spin-dot{width:3.5px;height:3.5px;margin-left:-1.75px;transform-origin:50% 14px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spinner-box{width:112px;height:112px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spinner-box--no-text{width:62px;height:62px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__circle{width:36px;height:36px;border-width:4px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__text{font-size:16px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__dot{width:10px;height:10px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spin-dots{width:40px;height:40px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spin-dot{width:4.5px;height:4.5px;margin-left:-2.25px;transform-origin:50% 20px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spinner-box{width:144px;height:144px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spinner-box--no-text{width:80px;height:80px}.pay-fullscreen-loading--large .pay-fullscreen-loading__circle{width:42px;height:42px;border-width:5px}.pay-fullscreen-loading--large .pay-fullscreen-loading__text{font-size:18px}.pay-fullscreen-loading--large .pay-fullscreen-loading__dot{width:12px;height:12px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spin-dots{width:48px;height:48px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spin-dot{width:5.5px;height:5.5px;margin-left:-2.75px;transform-origin:50% 24px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spinner-box{width:100px;height:100px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spinner-box--no-text{width:56px;height:56px}.pay-fullscreen-loading--default .pay-fullscreen-loading__circle{width:32px;height:32px;border-width:4px}.pay-fullscreen-loading--default .pay-fullscreen-loading__text{font-size:16px}.pay-fullscreen-loading--default .pay-fullscreen-loading__dot{width:9px;height:9px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spin-dots{width:32px;height:32px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spin-dot{width:4px;height:4px;margin-left:-2px;transform-origin:50% 16px}.pay-fullscreen-loading__container{position:relative;display:block}.pay-fullscreen-loading__mask{position:absolute;left:0;top:0;right:0;bottom:0;background:hsla(0,0%,100%,.8);z-index:10;display:flex;align-items:center;justify-content:center}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes bounce{0%,100%{transform:translateY(0)}50%{transform:translateY(-12px)}}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1,8 @@
1
+ import MAlipay from './m-alipay-auto-submit';
2
+ import MAlipayButton from './m-alipay-button';
3
+ export * from './interface';
4
+ type MAlipayComponentType = typeof MAlipay & {
5
+ Button: typeof MAlipayButton;
6
+ };
7
+ declare const MAlipayComponent: MAlipayComponentType;
8
+ export default MAlipayComponent;
@@ -0,0 +1,6 @@
1
+ import MAlipay from './m-alipay-auto-submit';
2
+ import MAlipayButton from './m-alipay-button';
3
+ export * from './interface';
4
+ const MAlipayComponent = MAlipay;
5
+ MAlipayComponent.Button = MAlipayButton;
6
+ export default MAlipayComponent;
@@ -0,0 +1,44 @@
1
+ import { ButtonProps, ButtonRef } from '../Button';
2
+ import { ConfirmModalProps } from '../confirm-modal';
3
+ import { PayMaskProps } from '../PayMask';
4
+ export interface MAlipayButtonProps extends ButtonProps {
5
+ /**
6
+ * @zh 支付宝支付 html 字符串
7
+ * @en Alipay payment html string
8
+ */
9
+ formHtml?: string;
10
+ /**
11
+ * @zh 创建订单函数,返回 Paypal 所需参数
12
+ * @en Function to create order, returns Paypal required params
13
+ */
14
+ createOrder?: CreateOrderMAlipayFn;
15
+ /**
16
+ * @zh 显示类型,默认值为 "modal"
17
+ * @en Display type, default is "modal"
18
+ * @default "modal"
19
+ */
20
+ displayType?: 'modal' | 'mask';
21
+ /**
22
+ * @zh 弹窗属性
23
+ * @en Modal props
24
+ */
25
+ modalProps?: Omit<ConfirmModalProps, 'visible' | 'payUrl' | 'autoOpenWindow' | 'openMode'>;
26
+ /**
27
+ * @zh 蒙层属性
28
+ * @en Mask props
29
+ */
30
+ maskProps?: Omit<PayMaskProps, 'visible' | 'payUrl' | 'autoOpenWindow' | 'openMode'>;
31
+ }
32
+ export type MAlipayButtonRef = ButtonRef;
33
+ export interface MAlipayFormData {
34
+ /**
35
+ * @zh 支付宝支付 html 字符串
36
+ * @en Alipay payment html string
37
+ */
38
+ formHtml: string;
39
+ }
40
+ /**
41
+ * @zh 创建订单函数,返回 Paypal 所需参数
42
+ * @en Function to create order, returns Paypal required params
43
+ */
44
+ export type CreateOrderMAlipayFn = () => Promise<MAlipayFormData>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface MAlipayAutoSubmitProps {
3
+ formHtml: string;
4
+ }
5
+ declare const MAlipayAutoSubmit: React.FC<MAlipayAutoSubmitProps>;
6
+ export default MAlipayAutoSubmit;
@@ -0,0 +1,37 @@
1
+ import { useEffect } from 'react';
2
+ const MAlipayAutoSubmit = _ref => {
3
+ let {
4
+ formHtml
5
+ } = _ref;
6
+ useEffect(() => {
7
+ // 1. 移除之前的表单
8
+ const oldForm = document.getElementById('alipaysubmit');
9
+ if (oldForm && oldForm.parentNode) {
10
+ oldForm.parentNode.removeChild(oldForm);
11
+ }
12
+
13
+ // 2. 创建一个 div 容器,插入 form 字符串
14
+ const div = document.createElement('div');
15
+ div.innerHTML = formHtml;
16
+
17
+ // 3. 获取 form 元素
18
+ const form = div.querySelector('form#alipaysubmit');
19
+ if (form) {
20
+ form.acceptCharset = 'UTF-8';
21
+ document.body.appendChild(form);
22
+ setTimeout(() => {
23
+ form.submit();
24
+ }, 100);
25
+ }
26
+
27
+ // 4. 卸载时
28
+ return () => {
29
+ const existForm = document.getElementById('alipaysubmit');
30
+ if (existForm && existForm.parentNode) {
31
+ existForm.parentNode.removeChild(existForm);
32
+ }
33
+ };
34
+ }, [formHtml]);
35
+ return null; // 这个组件不渲染任何内容
36
+ };
37
+ export default MAlipayAutoSubmit;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { MAlipayButtonProps } from './interface';
3
+ declare const MAlipayButton: React.ForwardRefExoticComponent<MAlipayButtonProps & {
4
+ children?: React.ReactNode;
5
+ } & React.RefAttributes<import("../Button").ButtonRef>>;
6
+ export default MAlipayButton;