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,75 @@
1
+ const _excluded = ["className", "children", "onClick", "payssionUrl", "createOrder", "maskProps"],
2
+ _excluded2 = ["onClose"];
3
+ 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); }
4
+ 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; }
5
+ 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; }
6
+ import React, { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';
7
+ import cs from '../utils/classNames';
8
+ import PayMask from '../PayMask';
9
+ import Button from '../Button';
10
+ import { IconPayssionPay } from '../icons';
11
+ import { getPrefixCls } from '../utils/getPrefixCls';
12
+ const PayssionButton = /*#__PURE__*/forwardRef((props, ref) => {
13
+ const {
14
+ className,
15
+ children = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconPayssionPay, null), "Payssion"),
16
+ onClick,
17
+ payssionUrl: propsPayssionUrl,
18
+ createOrder,
19
+ maskProps
20
+ } = props,
21
+ others = _objectWithoutProperties(props, _excluded);
22
+ const _ref = maskProps || {},
23
+ {
24
+ onClose
25
+ } = _ref,
26
+ restMaskProps = _objectWithoutProperties(_ref, _excluded2);
27
+ const payssionButtonRef = useRef({
28
+ nativeElement: null
29
+ });
30
+ const [showMask, setShowMask] = useState(false);
31
+ const [payssionUrl, setPayssionUrl] = useState();
32
+ useImperativeHandle(ref, () => payssionButtonRef.current);
33
+ const handlePayCreateOrder = useCallback(async () => {
34
+ if (createOrder) {
35
+ // 1. 业务侧创建订单,获取参数
36
+ const {
37
+ payssionUrl
38
+ } = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
39
+ if (payssionUrl) {
40
+ // 2. 唤起蒙层
41
+ setShowMask(true);
42
+ setPayssionUrl(payssionUrl);
43
+ }
44
+ }
45
+ }, [createOrder]);
46
+ const handleOpen = useCallback(() => {
47
+ if (propsPayssionUrl) {
48
+ setShowMask(true);
49
+ setPayssionUrl(propsPayssionUrl);
50
+ }
51
+ }, [propsPayssionUrl]);
52
+ const handleClick = useCallback(e => {
53
+ if (createOrder) {
54
+ handlePayCreateOrder();
55
+ } else {
56
+ handleOpen();
57
+ }
58
+ onClick === null || onClick === void 0 || onClick(e);
59
+ }, [onClick, createOrder, handlePayCreateOrder, handleOpen]);
60
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({
61
+ ref: payssionButtonRef,
62
+ className: cs(getPrefixCls('payssion-btn'), className),
63
+ onClick: handleClick
64
+ }, others), children), payssionUrl && showMask && /*#__PURE__*/React.createElement(PayMask, _extends({
65
+ visible: showMask,
66
+ onClose: () => {
67
+ setShowMask(false);
68
+ onClose === null || onClose === void 0 || onClose();
69
+ },
70
+ payUrl: payssionUrl,
71
+ title: 'Payssion'
72
+ }, restMaskProps)));
73
+ });
74
+ PayssionButton.displayName = 'PayssionButton';
75
+ export default PayssionButton;
@@ -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}.pay-mask{position:fixed;z-index:1000;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-mask-content{position:relative;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0 88px}.pay-mask-close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:28px;color:#fff;cursor:pointer;z-index:1}.pay-mask-title{display:flex;align-items:center;gap:4px;font-weight:700;font-size:28px;color:#fff;margin-bottom:16px;text-shadow:0 2px 8px #000}.pay-mask-title>.pay-icon-paypal-white{width:36px;height:36px}.pay-mask-desc{color:#fff;text-align:center;margin-bottom:24px;line-height:1.5;white-space:pre-line}.pay-mask-continue{color:#fff;font-weight:700;text-decoration:underline;text-underline-offset:4px;cursor:pointer;text-align:center;font-size:18px}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1,12 @@
1
+ import Stripe from "./stripe";
2
+ import StripePopup from "./stripe-popup";
3
+ import StripeButton from "./stripe-button";
4
+ import StripeModal from "./stripe-modal";
5
+ export * from "./interface";
6
+ type StripeComponentType = typeof Stripe & {
7
+ Button: typeof StripeButton;
8
+ Popup: typeof StripePopup;
9
+ Modal: typeof StripeModal;
10
+ };
11
+ declare const StripeComponent: StripeComponentType;
12
+ export default StripeComponent;
@@ -0,0 +1,10 @@
1
+ import Stripe from "./stripe";
2
+ import StripePopup from "./stripe-popup";
3
+ import StripeButton from "./stripe-button";
4
+ import StripeModal from "./stripe-modal";
5
+ export * from "./interface";
6
+ const StripeComponent = Stripe;
7
+ StripeComponent.Button = StripeButton;
8
+ StripeComponent.Popup = StripePopup;
9
+ StripeComponent.Modal = StripeModal;
10
+ export default StripeComponent;
@@ -0,0 +1,91 @@
1
+ import { ButtonProps, ButtonRef } from '../Button';
2
+ import { HTMLAttributes } from 'react';
3
+ import { PayModalProps } from '../pay-modal';
4
+ import { PayPopupBaseProps } from '../pay-popup';
5
+ export interface BasesStripeProps {
6
+ /**
7
+ * @zh Stripe 支付的 clientSecret
8
+ * @en The clientSecret for Stripe payment
9
+ */
10
+ clientSecret: string;
11
+ /**
12
+ * @zh Stripe 公钥
13
+ * @en The public key for Stripe
14
+ */
15
+ stripeKey: string;
16
+ }
17
+ /**
18
+ * @version 1.0.0
19
+ * @description
20
+ * @zh Stripe 组件属性定义,包含基础属性和原生 div 属性
21
+ * @en Props for Stripe component, including base props and native div attributes
22
+ */
23
+ export type StripeProps = BasesStripeProps & HTMLAttributes<HTMLDivElement>;
24
+ /**
25
+ * @version 1.0.0
26
+ * @description
27
+ * @zh Stripe 弹窗组件属性定义
28
+ * @en Props for Stripe popup component
29
+ */
30
+ export interface StripePopupProps extends PayPopupBaseProps {
31
+ /**
32
+ * @zh Stripe 属性
33
+ * @en Stripe props
34
+ */
35
+ stripeProps?: BasesStripeProps;
36
+ }
37
+ /**
38
+ * @version 1.0.0
39
+ * @description
40
+ * @zh Stripe 弹窗组件 Ref 实例方法
41
+ * @en Ref methods for Stripe popup component
42
+ */
43
+ export interface StripePopupRef {
44
+ /**
45
+ * @zh 打开弹窗
46
+ * @en Open the popup
47
+ */
48
+ open: (secretMap?: BasesStripeProps) => void;
49
+ /**
50
+ * @zh 关闭弹窗
51
+ * @en Close the popup
52
+ */
53
+ close: () => void;
54
+ }
55
+ /**
56
+ * @zh 创建订单函数,返回 Stripe 所需参数
57
+ * @en Function to create order, returns Stripe required params
58
+ */
59
+ export type CreateOrderStripeFn = () => Promise<BasesStripeProps>;
60
+ export interface StripeButtonProps extends ButtonProps {
61
+ /**
62
+ * @zh 显示类型,默认值为 "modal"
63
+ * @en Display type, default is "modal"
64
+ * @default "popup"
65
+ */
66
+ displayType?: 'modal' | 'popup';
67
+ /**
68
+ * @zh Stripe 弹窗属性
69
+ * @en Stripe popup props
70
+ */
71
+ stripePopupProps?: StripePopupProps;
72
+ /**
73
+ * @zh Stripe 弹窗属性
74
+ * @en Stripe modal props
75
+ */
76
+ stripeModalProps?: StripeModalProps;
77
+ /**
78
+ * @zh 创建订单函数
79
+ * @en Function to create order
80
+ */
81
+ createOrder?: CreateOrderStripeFn;
82
+ }
83
+ export type StripeButtonRef = ButtonRef;
84
+ export interface StripeModalProps extends PayModalProps {
85
+ /**
86
+ * @zh Stripe 属性
87
+ * @en Stripe props
88
+ */
89
+ stripeProps?: BasesStripeProps;
90
+ }
91
+ export type StripeModalRef = StripePopupRef;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { StripeButtonProps } from './interface';
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<StripeButtonProps & {
4
+ children?: React.ReactNode;
5
+ } & React.RefAttributes<import("../Button").ButtonRef>>>;
6
+ export default _default;
@@ -0,0 +1,65 @@
1
+ const _excluded = ["children", "onClick", "displayType", "stripePopupProps", "stripeModalProps", "createOrder"];
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 React, { forwardRef, memo, useCallback, useImperativeHandle, useRef } from 'react';
6
+ import StripePopup from './stripe-popup';
7
+ import StripeModal from './stripe-modal';
8
+ import Button from '../Button';
9
+ const StripeButton = /*#__PURE__*/forwardRef((props, ref) => {
10
+ const {
11
+ children = 'Stripe',
12
+ onClick,
13
+ displayType = 'popup',
14
+ stripePopupProps,
15
+ stripeModalProps,
16
+ createOrder
17
+ } = props,
18
+ others = _objectWithoutProperties(props, _excluded);
19
+ const stripeButtonRef = useRef({
20
+ nativeElement: null
21
+ });
22
+ const stripePopupRef = useRef(null);
23
+ const stripeModalRef = useRef(null);
24
+ useImperativeHandle(ref, () => stripeButtonRef.current);
25
+ const handlePayCreateOrder = useCallback(async () => {
26
+ if (createOrder) {
27
+ // 1. 业务侧创建订单,获取参数
28
+ const options = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
29
+ if (options !== null && options !== void 0 && options.clientSecret && options !== null && options !== void 0 && options.stripeKey) {
30
+ // 2. 唤起弹窗
31
+ if (displayType === 'modal') {
32
+ var _stripeModalRef$curre;
33
+ (_stripeModalRef$curre = stripeModalRef.current) === null || _stripeModalRef$curre === void 0 || _stripeModalRef$curre.open(options);
34
+ } else {
35
+ var _stripePopupRef$curre;
36
+ (_stripePopupRef$curre = stripePopupRef.current) === null || _stripePopupRef$curre === void 0 || _stripePopupRef$curre.open(options);
37
+ }
38
+ }
39
+ }
40
+ }, [createOrder, displayType]);
41
+ const handleClick = useCallback(e => {
42
+ if (createOrder) {
43
+ handlePayCreateOrder();
44
+ } else {
45
+ if (displayType === 'modal') {
46
+ var _stripeModalRef$curre2;
47
+ stripeModalRef === null || stripeModalRef === void 0 || (_stripeModalRef$curre2 = stripeModalRef.current) === null || _stripeModalRef$curre2 === void 0 || _stripeModalRef$curre2.open();
48
+ } else {
49
+ var _stripePopupRef$curre2;
50
+ stripePopupRef === null || stripePopupRef === void 0 || (_stripePopupRef$curre2 = stripePopupRef.current) === null || _stripePopupRef$curre2 === void 0 || _stripePopupRef$curre2.open();
51
+ }
52
+ }
53
+ onClick === null || onClick === void 0 || onClick(e);
54
+ }, [onClick, createOrder, handlePayCreateOrder, displayType]);
55
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({
56
+ ref: stripeButtonRef,
57
+ onClick: handleClick
58
+ }, others), children), displayType === 'popup' && /*#__PURE__*/React.createElement(StripePopup, _extends({
59
+ ref: stripePopupRef
60
+ }, stripePopupProps)), displayType === 'modal' && /*#__PURE__*/React.createElement(StripeModal, _extends({
61
+ ref: stripeModalRef
62
+ }, stripeModalProps)));
63
+ });
64
+ StripeButton.displayName = 'StripeButton';
65
+ export default /*#__PURE__*/memo(StripeButton);
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { StripeModalProps } from './interface';
3
+ declare const StripeModal: import("react").ForwardRefExoticComponent<StripeModalProps & {
4
+ children?: import("react").ReactNode;
5
+ } & import("react").RefAttributes<import("./interface").StripePopupRef>>;
6
+ export default StripeModal;
@@ -0,0 +1,50 @@
1
+ const _excluded = ["stripeProps", "visible", "onClose", "className"];
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 cs from '../utils/classNames';
7
+ import PayModal from '../pay-modal';
8
+ import Stripe from './stripe';
9
+ import { getPrefixCls } from '../utils/getPrefixCls';
10
+ const StripeModal = /*#__PURE__*/forwardRef((props, ref) => {
11
+ const {
12
+ stripeProps: propsStripeProps,
13
+ visible,
14
+ onClose,
15
+ className
16
+ } = props,
17
+ rest = _objectWithoutProperties(props, _excluded);
18
+ const stripeRef = useRef(null);
19
+ const [uncontrolledVisible, setUncontrolledVisible] = useState(false);
20
+ const [stripeProps, setStripeProps] = useState();
21
+ const isControlled = visible !== undefined;
22
+ const _visible = isControlled ? visible : uncontrolledVisible;
23
+ useImperativeHandle(ref, () => ({
24
+ open: value => {
25
+ if (value) {
26
+ setStripeProps(value);
27
+ }
28
+ setUncontrolledVisible(true);
29
+ },
30
+ close: () => {
31
+ setUncontrolledVisible(false);
32
+ onClose === null || onClose === void 0 || onClose();
33
+ },
34
+ current: stripeRef.current
35
+ }));
36
+ const _stripeProps = propsStripeProps !== null && propsStripeProps !== void 0 ? propsStripeProps : stripeProps;
37
+ return /*#__PURE__*/React.createElement(PayModal, _extends({
38
+ className: cs(getPrefixCls('stripe-modal'), className),
39
+ visible: _visible,
40
+ onClose: () => {
41
+ if (!isControlled) {
42
+ setUncontrolledVisible(false);
43
+ }
44
+ onClose === null || onClose === void 0 || onClose();
45
+ },
46
+ footer: null
47
+ }, rest), _stripeProps && /*#__PURE__*/React.createElement(Stripe, _stripeProps));
48
+ });
49
+ StripeModal.displayName = 'StripeModal';
50
+ export default StripeModal;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { StripePopupProps, StripePopupRef } from './interface';
3
+ declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<StripePopupProps & {
4
+ children?: import("react").ReactNode;
5
+ } & import("react").RefAttributes<StripePopupRef>>>;
6
+ export default _default;
@@ -0,0 +1,61 @@
1
+ const _excluded = ["visible", "onClose", "closeOnMaskClick", "className", "bodyStyle", "stripeProps"];
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 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
+ 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
+ import { forwardRef, memo, useImperativeHandle, useRef, useState } from 'react';
11
+ import cs from '../utils/classNames';
12
+ import Stripe from '.';
13
+ import PayPopup from '../pay-popup';
14
+ import { getPrefixCls } from '../utils/getPrefixCls';
15
+ const StripePopup = /*#__PURE__*/forwardRef((props, ref) => {
16
+ const {
17
+ visible: controlledVisible,
18
+ onClose,
19
+ closeOnMaskClick = true,
20
+ className,
21
+ bodyStyle,
22
+ stripeProps: propsStripeProps
23
+ } = props,
24
+ others = _objectWithoutProperties(props, _excluded);
25
+ const [uncontrolledVisible, setUncontrolledVisible] = useState(false);
26
+ const [stripeProps, setStripeProps] = useState();
27
+ const stripeRef = useRef(null);
28
+ const isControlled = controlledVisible !== undefined;
29
+ const visible = isControlled ? controlledVisible : uncontrolledVisible;
30
+ useImperativeHandle(ref, () => ({
31
+ open: value => {
32
+ if (value) {
33
+ setStripeProps(value);
34
+ }
35
+ setUncontrolledVisible(true);
36
+ },
37
+ close: () => {
38
+ setUncontrolledVisible(false);
39
+ onClose === null || onClose === void 0 || onClose();
40
+ },
41
+ current: stripeRef.current
42
+ }));
43
+ const _stripeProps = propsStripeProps !== null && propsStripeProps !== void 0 ? propsStripeProps : stripeProps;
44
+ return /*#__PURE__*/React.createElement(PayPopup, _extends({
45
+ className: cs(getPrefixCls('stripe-popup'), className),
46
+ visible: visible,
47
+ onClose: () => {
48
+ if (!isControlled) {
49
+ setUncontrolledVisible(false);
50
+ }
51
+ onClose === null || onClose === void 0 || onClose();
52
+ },
53
+ closeOnMaskClick: closeOnMaskClick,
54
+ bodyStyle: _objectSpread({
55
+ height: '40vh',
56
+ overflowY: 'scroll'
57
+ }, bodyStyle)
58
+ }, others), _stripeProps && /*#__PURE__*/React.createElement(Stripe, _stripeProps));
59
+ });
60
+ StripePopup.displayName = 'StripePopup';
61
+ export default /*#__PURE__*/memo(StripePopup);
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("./interface").BasesStripeProps & React.HTMLAttributes<HTMLDivElement> & {
3
+ children?: React.ReactNode;
4
+ } & React.RefAttributes<HTMLElement>>>;
5
+ export default _default;
@@ -0,0 +1,38 @@
1
+ const _excluded = ["stripeKey", "clientSecret", "className"];
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 React, { memo, useImperativeHandle, useMemo, useRef } from 'react';
6
+ import { EmbeddedCheckout, EmbeddedCheckoutProvider } from '@stripe/react-stripe-js';
7
+ import { loadStripe } from '@stripe/stripe-js';
8
+ import cs from '../utils/classNames';
9
+ import { getPrefixCls } from '../utils/getPrefixCls';
10
+ const Stripe = /*#__PURE__*/React.forwardRef((props, ref) => {
11
+ const {
12
+ stripeKey,
13
+ clientSecret,
14
+ className = ''
15
+ } = props,
16
+ others = _objectWithoutProperties(props, _excluded);
17
+ const stripeRef = useRef(null);
18
+ useImperativeHandle(ref, () => stripeRef.current);
19
+ const stripePromise = useMemo(() => {
20
+ if (!stripeKey) {
21
+ return null;
22
+ }
23
+ return loadStripe === null || loadStripe === void 0 ? void 0 : loadStripe(stripeKey);
24
+ }, [stripeKey]);
25
+ const classNames = cs(getPrefixCls('pay-stripe'), className);
26
+ return /*#__PURE__*/React.createElement("div", _extends({
27
+ ref: stripeRef
28
+ }, others, {
29
+ className: classNames
30
+ }), clientSecret && stripePromise && /*#__PURE__*/React.createElement(EmbeddedCheckoutProvider, {
31
+ stripe: stripePromise,
32
+ options: {
33
+ clientSecret
34
+ }
35
+ }, /*#__PURE__*/React.createElement(EmbeddedCheckout, null)));
36
+ });
37
+ Stripe.displayName = 'Stripe';
38
+ export default /*#__PURE__*/memo(Stripe);
@@ -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}.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}.pay-mask{position:fixed;z-index:1000;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-icon{display:inline-block;color:inherit;width:16px;vertical-align:-2px;stroke:currentColor}.pay-icon[fill=currentColor]{fill:currentColor;stroke:none}.pay-icon[stroke=currentColor]{stroke:currentColor;fill:none}.pay-icon[fill=currentColor][stroke=currentColor]{fill:currentColor;stroke:currentColor}.pay-icon-paypal-text{width:64px;height:26px;max-width:72px;max-height:32px}.pay-icon-close{width:18px;height:18px}.pay-icon-stripe-text{width:24px;height:24px}.pay-icon-alipay{width:20px;height:20px}.pay-icon-wechat-pay{width:20px;height:20px}.pay-icon-payssion-pay{width:36px;height:20px}.pay-popup{position:fixed;z-index:1001}.pay-popup-body{position:fixed;display:flex;flex-direction:column;background-color:#fff;z-index:1010;box-sizing:border-box}.pay-popup-body.pay-popup-body-position-bottom{width:100%;left:0;bottom:0}.pay-popup-body.pay-popup-body-position-top{width:100%;left:0;top:0}.pay-popup-body.pay-popup-body-position-left{height:100%;width:80vw;left:0;top:0}.pay-popup-body.pay-popup-body-position-right{height:100%;width:80vw;right:0;top:0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-bottom{border-radius:16px 16px 0 0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-top{border-radius:0 0 16px 16px}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-left{border-radius:0 16px 16px 0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-right{border-radius:16px 0 0 16px}.pay-popup-close-icon{position:absolute;z-index:1;cursor:pointer;padding:4px;font-size:18px;line-height:1;color:#999}.pay-popup-body.pay-popup-body-position-bottom .pay-popup-close-icon,.pay-popup-body.pay-popup-body-position-left .pay-popup-close-icon{top:8px;right:8px}.pay-popup-body.pay-popup-body-position-top .pay-popup-close-icon{bottom:8px;right:8px}.pay-popup-body.pay-popup-body-position-right .pay-popup-close-icon{top:8px;left:8px}.pay-popup-content{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-bottom .pay-popup-content,.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-left .pay-popup-content{padding-top:40px}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-right .pay-popup-content{padding-top:40px}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-top .pay-popup-content{padding-bottom:40px}@media (min-width:576px){.pay-stripe-modal.pay-modal .pay-modal__content{width:72%}}@media (min-width:768px){.pay-stripe-modal.pay-modal .pay-modal__content{width:50%}}@media (min-width:992px){.pay-stripe-modal.pay-modal .pay-modal__content{width:40%}}@media (min-width:1200px){.pay-stripe-modal.pay-modal .pay-modal__content{width:27%}}@media (min-width:1600px){.pay-stripe-modal.pay-modal .pay-modal__content{width:26%}}@media (min-width:2000px){.pay-stripe-modal.pay-modal .pay-modal__content{width:20%}}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1,10 @@
1
+ import Wechat from "./wechat";
2
+ import WechatButton from "./wechat-button";
3
+ import WechatModal from "./wechat-modal";
4
+ type WechatComponentType = typeof Wechat & {
5
+ Button: typeof WechatButton;
6
+ Modal: typeof WechatModal;
7
+ };
8
+ declare const WechatComponent: WechatComponentType;
9
+ export * from "./interface";
10
+ export default WechatComponent;
@@ -0,0 +1,8 @@
1
+ import Wechat from "./wechat";
2
+ import WechatButton from "./wechat-button";
3
+ import WechatModal from "./wechat-modal";
4
+ const WechatComponent = Wechat;
5
+ WechatComponent.Button = WechatButton;
6
+ WechatComponent.Modal = WechatModal;
7
+ export * from "./interface";
8
+ export default WechatComponent;
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import { PayModalProps } from '../pay-modal';
3
+ import { ButtonProps, ButtonRef } from '../Button';
4
+ export interface WechatProps {
5
+ /**
6
+ * @zh 传入的是二维码字符串还是二维码图片url
7
+ * @en Whether the input is a QR code string or a QR code image URL
8
+ * @default "qrcode"
9
+ */
10
+ wechatType?: 'qrcode' | 'image';
11
+ /**
12
+ * @zh 微信支付 url
13
+ * @en Wechat payment url
14
+ */
15
+ wechatUrl: string;
16
+ /**
17
+ * @zh 二维码下方提示文字
18
+ * @en Tip text below the QR code
19
+ * @default '请使用微信APP扫码支付'
20
+ */
21
+ tipText?: string;
22
+ /**
23
+ * @zh 容器自定义 class
24
+ * @en Custom class for the container
25
+ */
26
+ className?: string;
27
+ /**
28
+ * @zh 容器自定义 style
29
+ * @en Custom style for the container
30
+ */
31
+ style?: React.CSSProperties;
32
+ }
33
+ export interface WechatButtonProps extends ButtonProps {
34
+ /**
35
+ * @zh 创建订单函数,返回 Paypal 所需参数
36
+ * @en Function to create order, returns Paypal required params
37
+ */
38
+ createOrder?: CreateOrderWechatFn;
39
+ /**
40
+ * @zh 弹窗属性
41
+ * @en Modal props
42
+ */
43
+ modalProps?: Omit<WechatModalProps, 'visible'>;
44
+ }
45
+ export type WechatButtonRef = ButtonRef;
46
+ /**
47
+ * @zh 创建订单函数,返回 Paypal 所需参数
48
+ * @en Function to create order, returns Paypal required params
49
+ */
50
+ export type CreateOrderWechatFn = () => Promise<WechatProps>;
51
+ export interface WechatModalRef {
52
+ /**
53
+ * @zh 打开弹窗
54
+ * @en Open the popup
55
+ */
56
+ open: (options?: WechatProps) => void;
57
+ /**
58
+ * @zh 关闭弹窗
59
+ * @en Close the popup
60
+ */
61
+ close: () => void;
62
+ }
63
+ export interface WechatModalProps extends PayModalProps {
64
+ /**
65
+ * @zh Wechat 属性
66
+ * @en Wechat props
67
+ */
68
+ wechatProps?: WechatProps;
69
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ .pay-wechat-qrcode{display:flex;flex-direction:column;align-items:center}.pay-wechat-qrcode__container{background-color:#fff;border-radius:8px;display:flex;justify-content:center;align-items:center;width:210px;height:210px}.pay-wechat-qrcode__image{width:100%;height:100%;object-fit:cover}.pay-wechat-qrcode__tip{text-align:center;color:#333;font-size:14px;line-height:20px}
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1 @@
1
+ import './index.css';
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { WechatButtonProps } from './interface';
3
+ declare const WechatButton: React.ForwardRefExoticComponent<WechatButtonProps & {
4
+ children?: React.ReactNode;
5
+ } & React.RefAttributes<import("../Button").ButtonRef>>;
6
+ export default WechatButton;
@@ -0,0 +1,50 @@
1
+ const _excluded = ["className", "children", "onClick", "createOrder", "modalProps"];
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 React, { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
6
+ import cs from '../utils/classNames';
7
+ import WechatModal from './wechat-modal';
8
+ import Button from '../Button';
9
+ import { IconWechatPay } from '../icons';
10
+ import { getPrefixCls } from '../utils/getPrefixCls';
11
+ const WechatButton = /*#__PURE__*/forwardRef((props, ref) => {
12
+ const {
13
+ className,
14
+ children = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IconWechatPay, null), "\u5FAE\u4FE1\u652F\u4ED8"),
15
+ onClick,
16
+ createOrder,
17
+ modalProps
18
+ } = props,
19
+ others = _objectWithoutProperties(props, _excluded);
20
+ const wechatButtonRef = useRef({
21
+ nativeElement: null
22
+ });
23
+ const wechatModalRef = useRef(null);
24
+ useImperativeHandle(ref, () => wechatButtonRef.current);
25
+ const handlePayCreateOrder = useCallback(async () => {
26
+ if (createOrder) {
27
+ var _wechatModalRef$curre;
28
+ const options = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
29
+ (_wechatModalRef$curre = wechatModalRef.current) === null || _wechatModalRef$curre === void 0 || _wechatModalRef$curre.open(options);
30
+ }
31
+ }, [createOrder]);
32
+ const handleClick = useCallback(e => {
33
+ if (createOrder) {
34
+ handlePayCreateOrder();
35
+ } else {
36
+ var _wechatModalRef$curre2;
37
+ wechatModalRef === null || wechatModalRef === void 0 || (_wechatModalRef$curre2 = wechatModalRef.current) === null || _wechatModalRef$curre2 === void 0 || _wechatModalRef$curre2.open();
38
+ }
39
+ onClick === null || onClick === void 0 || onClick(e);
40
+ }, [onClick, createOrder, handlePayCreateOrder]);
41
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({
42
+ ref: wechatButtonRef,
43
+ className: cs(getPrefixCls('wechat-btn'), className),
44
+ onClick: handleClick
45
+ }, others), children), /*#__PURE__*/React.createElement(WechatModal, _extends({
46
+ ref: wechatModalRef
47
+ }, modalProps)));
48
+ });
49
+ WechatButton.displayName = 'WechatButton';
50
+ export default WechatButton;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { WechatModalProps, WechatModalRef } from "./interface";
3
+ declare const WechatModal: import("react").ForwardRefExoticComponent<WechatModalProps & {
4
+ children?: import("react").ReactNode;
5
+ } & import("react").RefAttributes<WechatModalRef>>;
6
+ export default WechatModal;