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.
- package/README.md +1059 -0
- package/README.zh-CN.md +1061 -0
- package/dist/css/index.css +1 -0
- package/dist/es/Airwallex/airwallex-button.d.ts +4 -0
- package/dist/es/Airwallex/airwallex-button.js +86 -0
- package/dist/es/Airwallex/airwallex-modal.d.ts +6 -0
- package/dist/es/Airwallex/airwallex-modal.js +63 -0
- package/dist/es/Airwallex/airwallex-popup.d.ts +6 -0
- package/dist/es/Airwallex/airwallex-popup.js +74 -0
- package/dist/es/Airwallex/airwallex.d.ts +6 -0
- package/dist/es/Airwallex/airwallex.js +77 -0
- package/dist/es/Airwallex/index.d.ts +12 -0
- package/dist/es/Airwallex/index.js +10 -0
- package/dist/es/Airwallex/interface.d.ts +75 -0
- package/dist/es/Airwallex/interface.js +1 -0
- package/dist/es/Airwallex/style/index.css +1 -0
- package/dist/es/Airwallex/style/index.d.ts +1 -0
- package/dist/es/Airwallex/style/index.js +1 -0
- package/dist/es/Alipay/alipay-button.d.ts +6 -0
- package/dist/es/Alipay/alipay-button.js +52 -0
- package/dist/es/Alipay/alipay-modal.d.ts +6 -0
- package/dist/es/Alipay/alipay-modal.js +45 -0
- package/dist/es/Alipay/alipay.d.ts +4 -0
- package/dist/es/Alipay/alipay.js +44 -0
- package/dist/es/Alipay/index.d.ts +10 -0
- package/dist/es/Alipay/index.js +8 -0
- package/dist/es/Alipay/interface.d.ts +53 -0
- package/dist/es/Alipay/interface.js +1 -0
- package/dist/es/Alipay/style/index.css +1 -0
- package/dist/es/Alipay/style/index.d.ts +3 -0
- package/dist/es/Alipay/style/index.js +3 -0
- package/dist/es/Button/button.d.ts +21 -0
- package/dist/es/Button/button.js +74 -0
- package/dist/es/Button/index.d.ts +3 -0
- package/dist/es/Button/index.js +3 -0
- package/dist/es/Button/interface.d.ts +21 -0
- package/dist/es/Button/interface.js +1 -0
- package/dist/es/Button/style/index.css +1 -0
- package/dist/es/Button/style/index.d.ts +1 -0
- package/dist/es/Button/style/index.js +1 -0
- package/dist/es/FullScreenLoading/index.d.ts +4 -0
- package/dist/es/FullScreenLoading/index.js +116 -0
- package/dist/es/FullScreenLoading/interface.d.ts +43 -0
- package/dist/es/FullScreenLoading/interface.js +1 -0
- package/dist/es/FullScreenLoading/style/index.css +1 -0
- package/dist/es/FullScreenLoading/style/index.d.ts +1 -0
- package/dist/es/FullScreenLoading/style/index.js +1 -0
- package/dist/es/MAlipay/index.d.ts +8 -0
- package/dist/es/MAlipay/index.js +6 -0
- package/dist/es/MAlipay/interface.d.ts +44 -0
- package/dist/es/MAlipay/interface.js +1 -0
- package/dist/es/MAlipay/m-alipay-auto-submit.d.ts +6 -0
- package/dist/es/MAlipay/m-alipay-auto-submit.js +37 -0
- package/dist/es/MAlipay/m-alipay-button.d.ts +6 -0
- package/dist/es/MAlipay/m-alipay-button.js +127 -0
- package/dist/es/MAlipay/style/index.css +1 -0
- package/dist/es/MAlipay/style/index.d.ts +1 -0
- package/dist/es/MAlipay/style/index.js +1 -0
- package/dist/es/MWeChat/index.d.ts +2 -0
- package/dist/es/MWeChat/index.js +2 -0
- package/dist/es/MWeChat/interface.d.ts +50 -0
- package/dist/es/MWeChat/interface.js +1 -0
- package/dist/es/MWeChat/m-wechat-button.d.ts +6 -0
- package/dist/es/MWeChat/m-wechat-button.js +117 -0
- package/dist/es/MWeChat/style/index.css +1 -0
- package/dist/es/MWeChat/style/index.d.ts +1 -0
- package/dist/es/MWeChat/style/index.js +1 -0
- package/dist/es/Mask/index.d.ts +3 -0
- package/dist/es/Mask/index.js +3 -0
- package/dist/es/Mask/interface.d.ts +81 -0
- package/dist/es/Mask/interface.js +1 -0
- package/dist/es/Mask/mask.d.ts +5 -0
- package/dist/es/Mask/mask.js +97 -0
- package/dist/es/Mask/style/index.css +1 -0
- package/dist/es/Mask/style/index.d.ts +1 -0
- package/dist/es/Mask/style/index.js +1 -0
- package/dist/es/PayButton/index.d.ts +5 -0
- package/dist/es/PayButton/index.js +57 -0
- package/dist/es/PayButton/interface.d.ts +130 -0
- package/dist/es/PayButton/interface.js +93 -0
- package/dist/es/PayMask/index.d.ts +3 -0
- package/dist/es/PayMask/index.js +3 -0
- package/dist/es/PayMask/interface.d.ts +56 -0
- package/dist/es/PayMask/interface.js +1 -0
- package/dist/es/PayMask/pay-mask.d.ts +5 -0
- package/dist/es/PayMask/pay-mask.js +92 -0
- package/dist/es/PayMask/style/index.css +1 -0
- package/dist/es/PayMask/style/index.d.ts +1 -0
- package/dist/es/PayMask/style/index.js +1 -0
- package/dist/es/Paypal/index.d.ts +2 -0
- package/dist/es/Paypal/index.js +2 -0
- package/dist/es/Paypal/interface.d.ts +42 -0
- package/dist/es/Paypal/interface.js +1 -0
- package/dist/es/Paypal/paypal-button.d.ts +6 -0
- package/dist/es/Paypal/paypal-button.js +75 -0
- package/dist/es/Paypal/style/index.css +1 -0
- package/dist/es/Paypal/style/index.d.ts +1 -0
- package/dist/es/Paypal/style/index.js +1 -0
- package/dist/es/Payssion/index.d.ts +2 -0
- package/dist/es/Payssion/index.js +2 -0
- package/dist/es/Payssion/interface.d.ts +38 -0
- package/dist/es/Payssion/interface.js +1 -0
- package/dist/es/Payssion/payssion-button.d.ts +6 -0
- package/dist/es/Payssion/payssion-button.js +75 -0
- package/dist/es/Payssion/style/index.css +1 -0
- package/dist/es/Payssion/style/index.d.ts +1 -0
- package/dist/es/Payssion/style/index.js +1 -0
- package/dist/es/Stripe/index.d.ts +12 -0
- package/dist/es/Stripe/index.js +10 -0
- package/dist/es/Stripe/interface.d.ts +91 -0
- package/dist/es/Stripe/interface.js +1 -0
- package/dist/es/Stripe/stripe-button.d.ts +6 -0
- package/dist/es/Stripe/stripe-button.js +65 -0
- package/dist/es/Stripe/stripe-modal.d.ts +6 -0
- package/dist/es/Stripe/stripe-modal.js +50 -0
- package/dist/es/Stripe/stripe-popup.d.ts +6 -0
- package/dist/es/Stripe/stripe-popup.js +61 -0
- package/dist/es/Stripe/stripe.d.ts +5 -0
- package/dist/es/Stripe/stripe.js +38 -0
- package/dist/es/Stripe/style/index.css +1 -0
- package/dist/es/Stripe/style/index.d.ts +1 -0
- package/dist/es/Stripe/style/index.js +1 -0
- package/dist/es/Wechat/index.d.ts +10 -0
- package/dist/es/Wechat/index.js +8 -0
- package/dist/es/Wechat/interface.d.ts +69 -0
- package/dist/es/Wechat/interface.js +1 -0
- package/dist/es/Wechat/style/index.css +1 -0
- package/dist/es/Wechat/style/index.d.ts +1 -0
- package/dist/es/Wechat/style/index.js +1 -0
- package/dist/es/Wechat/wechat-button.d.ts +6 -0
- package/dist/es/Wechat/wechat-button.js +50 -0
- package/dist/es/Wechat/wechat-modal.d.ts +6 -0
- package/dist/es/Wechat/wechat-modal.js +45 -0
- package/dist/es/Wechat/wechat.d.ts +4 -0
- package/dist/es/Wechat/wechat.js +40 -0
- package/dist/es/confirm-modal/index.d.ts +5 -0
- package/dist/es/confirm-modal/index.js +52 -0
- package/dist/es/confirm-modal/interface.d.ts +21 -0
- package/dist/es/confirm-modal/interface.js +1 -0
- package/dist/es/confirm-modal/style/index.css +1 -0
- package/dist/es/confirm-modal/style/index.d.ts +1 -0
- package/dist/es/confirm-modal/style/index.js +1 -0
- package/dist/es/dot-loading/dot-loading.d.ts +4 -0
- package/dist/es/dot-loading/dot-loading.js +60 -0
- package/dist/es/dot-loading/index.d.ts +3 -0
- package/dist/es/dot-loading/index.js +3 -0
- package/dist/es/dot-loading/interface.d.ts +4 -0
- package/dist/es/dot-loading/interface.js +1 -0
- package/dist/es/dot-loading/style/index.css +1 -0
- package/dist/es/dot-loading/style/index.d.ts +1 -0
- package/dist/es/dot-loading/style/index.js +1 -0
- package/dist/es/hooks/use-initialized.d.ts +1 -0
- package/dist/es/hooks/use-initialized.js +8 -0
- package/dist/es/hooks/use-inner-visible.d.ts +1 -0
- package/dist/es/hooks/use-inner-visible.js +9 -0
- package/dist/es/hooks/use-lock-scroll.d.ts +2 -0
- package/dist/es/hooks/use-lock-scroll.js +82 -0
- package/dist/es/hooks/use-touch.d.ts +17 -0
- package/dist/es/hooks/use-touch.js +60 -0
- package/dist/es/hooks/usePayWindowOpen.d.ts +21 -0
- package/dist/es/hooks/usePayWindowOpen.js +87 -0
- package/dist/es/icons/IconAlipay/index.d.ts +4 -0
- package/dist/es/icons/IconAlipay/index.js +21 -0
- package/dist/es/icons/IconClose/index.d.ts +4 -0
- package/dist/es/icons/IconClose/index.js +27 -0
- package/dist/es/icons/IconPaypalText/index.d.ts +4 -0
- package/dist/es/icons/IconPaypalText/index.js +27 -0
- package/dist/es/icons/IconPaypalWhite/index.d.ts +4 -0
- package/dist/es/icons/IconPaypalWhite/index.js +22 -0
- package/dist/es/icons/IconPayssionPay/index.d.ts +4 -0
- package/dist/es/icons/IconPayssionPay/index.js +50 -0
- package/dist/es/icons/IconStripe/index.d.ts +4 -0
- package/dist/es/icons/IconStripe/index.js +22 -0
- package/dist/es/icons/IconStripeText/index.d.ts +4 -0
- package/dist/es/icons/IconStripeText/index.js +22 -0
- package/dist/es/icons/IconWechatPay/index.d.ts +4 -0
- package/dist/es/icons/IconWechatPay/index.js +21 -0
- package/dist/es/icons/index.d.ts +9 -0
- package/dist/es/icons/index.js +9 -0
- package/dist/es/icons/interface.d.ts +5 -0
- package/dist/es/icons/interface.js +1 -0
- package/dist/es/icons/style/index.css +1 -0
- package/dist/es/icons/style/index.d.ts +1 -0
- package/dist/es/icons/style/index.js +1 -0
- package/dist/es/index.d.ts +19 -0
- package/dist/es/index.js +10 -0
- package/dist/es/pay-modal/index.d.ts +3 -0
- package/dist/es/pay-modal/index.js +3 -0
- package/dist/es/pay-modal/interface.d.ts +94 -0
- package/dist/es/pay-modal/interface.js +1 -0
- package/dist/es/pay-modal/pay-modal.d.ts +5 -0
- package/dist/es/pay-modal/pay-modal.js +93 -0
- package/dist/es/pay-modal/style/index.css +1 -0
- package/dist/es/pay-modal/style/index.d.ts +1 -0
- package/dist/es/pay-modal/style/index.js +1 -0
- package/dist/es/pay-popup/index.d.ts +5 -0
- package/dist/es/pay-popup/index.js +156 -0
- package/dist/es/pay-popup/interface.d.ts +148 -0
- package/dist/es/pay-popup/interface.js +1 -0
- package/dist/es/pay-popup/style/index.css +1 -0
- package/dist/es/pay-popup/style/index.d.ts +1 -0
- package/dist/es/pay-popup/style/index.js +1 -0
- package/dist/es/shared/enums/index.d.ts +57 -0
- package/dist/es/shared/enums/index.js +58 -0
- package/dist/es/shared/index.d.ts +1 -0
- package/dist/es/shared/index.js +1 -0
- package/dist/es/utils/can-use-dom.d.ts +1 -0
- package/dist/es/utils/can-use-dom.js +1 -0
- package/dist/es/utils/classNames.d.ts +5 -0
- package/dist/es/utils/classNames.js +27 -0
- package/dist/es/utils/dom.d.ts +8 -0
- package/dist/es/utils/dom.js +80 -0
- package/dist/es/utils/get-container.d.ts +2 -0
- package/dist/es/utils/get-container.js +5 -0
- package/dist/es/utils/get-scroll-parent.d.ts +3 -0
- package/dist/es/utils/get-scroll-parent.js +24 -0
- package/dist/es/utils/getPrefixCls.d.ts +1 -0
- package/dist/es/utils/getPrefixCls.js +3 -0
- package/dist/es/utils/is.d.ts +35 -0
- package/dist/es/utils/is.js +122 -0
- package/dist/es/utils/native-props.d.ts +8 -0
- package/dist/es/utils/native-props.js +26 -0
- package/dist/es/utils/omit.d.ts +1 -0
- package/dist/es/utils/omit.js +15 -0
- package/dist/es/utils/qrcode.d.ts +7 -0
- package/dist/es/utils/qrcode.js +17 -0
- package/dist/es/utils/render-to-container.d.ts +3 -0
- package/dist/es/utils/render-to-container.js +10 -0
- package/dist/es/utils/should-render.d.ts +10 -0
- package/dist/es/utils/should-render.js +12 -0
- package/dist/es/utils/supports-passive.d.ts +1 -0
- package/dist/es/utils/supports-passive.js +14 -0
- package/dist/es/utils/warning.d.ts +1 -0
- package/dist/es/utils/warning.js +13 -0
- package/dist/es/utils/with-default-props.d.ts +9 -0
- package/dist/es/utils/with-default-props.js +33 -0
- package/dist/es/utils/with-stop-propagation.d.ts +4 -0
- package/dist/es/utils/with-stop-propagation.js +22 -0
- package/dist/lib/Airwallex/airwallex-button.js +94 -0
- package/dist/lib/Airwallex/airwallex-modal.js +70 -0
- package/dist/lib/Airwallex/airwallex-popup.js +81 -0
- package/dist/lib/Airwallex/airwallex.js +83 -0
- package/dist/lib/Airwallex/index.js +29 -0
- package/dist/lib/Airwallex/interface.js +5 -0
- package/dist/lib/Airwallex/style/index.css +1 -0
- package/dist/lib/Airwallex/style/index.js +3 -0
- package/dist/lib/Alipay/alipay-button.js +60 -0
- package/dist/lib/Alipay/alipay-modal.js +53 -0
- package/dist/lib/Alipay/alipay.js +52 -0
- package/dist/lib/Alipay/index.js +27 -0
- package/dist/lib/Alipay/interface.js +5 -0
- package/dist/lib/Alipay/style/index.css +1 -0
- package/dist/lib/Alipay/style/index.js +5 -0
- package/dist/lib/Button/button.js +82 -0
- package/dist/lib/Button/index.js +22 -0
- package/dist/lib/Button/interface.js +5 -0
- package/dist/lib/Button/style/index.css +1 -0
- package/dist/lib/Button/style/index.js +3 -0
- package/dist/lib/FullScreenLoading/index.js +124 -0
- package/dist/lib/FullScreenLoading/interface.js +5 -0
- package/dist/lib/FullScreenLoading/style/index.css +1 -0
- package/dist/lib/FullScreenLoading/style/index.js +3 -0
- package/dist/lib/MAlipay/index.js +25 -0
- package/dist/lib/MAlipay/interface.js +5 -0
- package/dist/lib/MAlipay/m-alipay-auto-submit.js +43 -0
- package/dist/lib/MAlipay/m-alipay-button.js +135 -0
- package/dist/lib/MAlipay/style/index.css +1 -0
- package/dist/lib/MAlipay/style/index.js +3 -0
- package/dist/lib/MWeChat/index.js +28 -0
- package/dist/lib/MWeChat/interface.js +5 -0
- package/dist/lib/MWeChat/m-wechat-button.js +125 -0
- package/dist/lib/MWeChat/style/index.css +1 -0
- package/dist/lib/MWeChat/style/index.js +3 -0
- package/dist/lib/Mask/index.js +22 -0
- package/dist/lib/Mask/interface.js +5 -0
- package/dist/lib/Mask/mask.js +117 -0
- package/dist/lib/Mask/style/index.css +1 -0
- package/dist/lib/Mask/style/index.js +3 -0
- package/dist/lib/PayButton/index.js +76 -0
- package/dist/lib/PayButton/interface.js +3 -0
- package/dist/lib/PayMask/index.js +22 -0
- package/dist/lib/PayMask/interface.js +5 -0
- package/dist/lib/PayMask/pay-mask.js +112 -0
- package/dist/lib/PayMask/style/index.css +1 -0
- package/dist/lib/PayMask/style/index.js +3 -0
- package/dist/lib/Paypal/index.js +28 -0
- package/dist/lib/Paypal/interface.js +5 -0
- package/dist/lib/Paypal/paypal-button.js +83 -0
- package/dist/lib/Paypal/style/index.css +1 -0
- package/dist/lib/Paypal/style/index.js +3 -0
- package/dist/lib/Payssion/index.js +28 -0
- package/dist/lib/Payssion/interface.js +5 -0
- package/dist/lib/Payssion/payssion-button.js +83 -0
- package/dist/lib/Payssion/style/index.css +1 -0
- package/dist/lib/Payssion/style/index.js +3 -0
- package/dist/lib/Stripe/index.js +29 -0
- package/dist/lib/Stripe/interface.js +5 -0
- package/dist/lib/Stripe/stripe-button.js +73 -0
- package/dist/lib/Stripe/stripe-modal.js +57 -0
- package/dist/lib/Stripe/stripe-popup.js +68 -0
- package/dist/lib/Stripe/stripe.js +46 -0
- package/dist/lib/Stripe/style/index.css +1 -0
- package/dist/lib/Stripe/style/index.js +3 -0
- package/dist/lib/Wechat/index.js +27 -0
- package/dist/lib/Wechat/interface.js +5 -0
- package/dist/lib/Wechat/style/index.css +1 -0
- package/dist/lib/Wechat/style/index.js +3 -0
- package/dist/lib/Wechat/wechat-button.js +58 -0
- package/dist/lib/Wechat/wechat-modal.js +52 -0
- package/dist/lib/Wechat/wechat.js +48 -0
- package/dist/lib/confirm-modal/index.js +72 -0
- package/dist/lib/confirm-modal/interface.js +5 -0
- package/dist/lib/confirm-modal/style/index.css +1 -0
- package/dist/lib/confirm-modal/style/index.js +3 -0
- package/dist/lib/dot-loading/dot-loading.js +67 -0
- package/dist/lib/dot-loading/index.js +22 -0
- package/dist/lib/dot-loading/interface.js +5 -0
- package/dist/lib/dot-loading/style/index.css +1 -0
- package/dist/lib/dot-loading/style/index.js +3 -0
- package/dist/lib/hooks/use-initialized.js +14 -0
- package/dist/lib/hooks/use-inner-visible.js +15 -0
- package/dist/lib/hooks/use-lock-scroll.js +88 -0
- package/dist/lib/hooks/use-touch.js +66 -0
- package/dist/lib/hooks/usePayWindowOpen.js +92 -0
- package/dist/lib/icons/IconAlipay/index.js +28 -0
- package/dist/lib/icons/IconClose/index.js +34 -0
- package/dist/lib/icons/IconPaypalText/index.js +34 -0
- package/dist/lib/icons/IconPaypalWhite/index.js +29 -0
- package/dist/lib/icons/IconPayssionPay/index.js +57 -0
- package/dist/lib/icons/IconStripe/index.js +29 -0
- package/dist/lib/icons/IconStripeText/index.js +29 -0
- package/dist/lib/icons/IconWechatPay/index.js +28 -0
- package/dist/lib/icons/index.js +84 -0
- package/dist/lib/icons/interface.js +5 -0
- package/dist/lib/icons/style/index.css +1 -0
- package/dist/lib/icons/style/index.js +3 -0
- package/dist/lib/index.js +92 -0
- package/dist/lib/pay-modal/index.js +22 -0
- package/dist/lib/pay-modal/interface.js +5 -0
- package/dist/lib/pay-modal/pay-modal.js +113 -0
- package/dist/lib/pay-modal/style/index.css +1 -0
- package/dist/lib/pay-modal/style/index.js +3 -0
- package/dist/lib/pay-popup/index.js +176 -0
- package/dist/lib/pay-popup/interface.js +5 -0
- package/dist/lib/pay-popup/style/index.css +1 -0
- package/dist/lib/pay-popup/style/index.js +3 -0
- package/dist/lib/shared/enums/index.js +64 -0
- package/dist/lib/shared/index.js +16 -0
- package/dist/lib/utils/can-use-dom.js +7 -0
- package/dist/lib/utils/classNames.js +34 -0
- package/dist/lib/utils/dom.js +86 -0
- package/dist/lib/utils/get-container.js +11 -0
- package/dist/lib/utils/get-scroll-parent.js +30 -0
- package/dist/lib/utils/getPrefixCls.js +9 -0
- package/dist/lib/utils/is.js +160 -0
- package/dist/lib/utils/native-props.js +33 -0
- package/dist/lib/utils/omit.js +21 -0
- package/dist/lib/utils/qrcode.js +23 -0
- package/dist/lib/utils/render-to-container.js +16 -0
- package/dist/lib/utils/should-render.js +20 -0
- package/dist/lib/utils/supports-passive.js +20 -0
- package/dist/lib/utils/warning.js +19 -0
- package/dist/lib/utils/with-default-props.js +40 -0
- package/dist/lib/utils/with-stop-propagation.js +29 -0
- package/dist/umd/pay-sdk-react.umd.js +16360 -0
- package/dist/umd/pay-sdk-react.umd.js.map +1 -0
- 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,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,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,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,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,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;
|