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,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _mAlipayAutoSubmit = _interopRequireDefault(require("./m-alipay-auto-submit"));
|
|
9
|
+
var _mAlipayButton = _interopRequireDefault(require("./m-alipay-button"));
|
|
10
|
+
var _interface = require("./interface");
|
|
11
|
+
Object.keys(_interface).forEach(function (key) {
|
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
14
|
+
if (key in exports && exports[key] === _interface[key]) return;
|
|
15
|
+
Object.defineProperty(exports, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () {
|
|
18
|
+
return _interface[key];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
const MAlipayComponent = _mAlipayAutoSubmit.default;
|
|
24
|
+
MAlipayComponent.Button = _mAlipayButton.default;
|
|
25
|
+
var _default = exports.default = MAlipayComponent;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
const MAlipayAutoSubmit = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
formHtml
|
|
11
|
+
} = _ref;
|
|
12
|
+
(0, _react.useEffect)(() => {
|
|
13
|
+
// 1. 移除之前的表单
|
|
14
|
+
const oldForm = document.getElementById('alipaysubmit');
|
|
15
|
+
if (oldForm && oldForm.parentNode) {
|
|
16
|
+
oldForm.parentNode.removeChild(oldForm);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 2. 创建一个 div 容器,插入 form 字符串
|
|
20
|
+
const div = document.createElement('div');
|
|
21
|
+
div.innerHTML = formHtml;
|
|
22
|
+
|
|
23
|
+
// 3. 获取 form 元素
|
|
24
|
+
const form = div.querySelector('form#alipaysubmit');
|
|
25
|
+
if (form) {
|
|
26
|
+
form.acceptCharset = 'UTF-8';
|
|
27
|
+
document.body.appendChild(form);
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
form.submit();
|
|
30
|
+
}, 100);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 4. 卸载时
|
|
34
|
+
return () => {
|
|
35
|
+
const existForm = document.getElementById('alipaysubmit');
|
|
36
|
+
if (existForm && existForm.parentNode) {
|
|
37
|
+
existForm.parentNode.removeChild(existForm);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}, [formHtml]);
|
|
41
|
+
return null; // 这个组件不渲染任何内容
|
|
42
|
+
};
|
|
43
|
+
var _default = exports.default = MAlipayAutoSubmit;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classNames = _interopRequireDefault(require("../utils/classNames"));
|
|
9
|
+
var _mAlipayAutoSubmit = _interopRequireDefault(require("./m-alipay-auto-submit"));
|
|
10
|
+
var _confirmModal = _interopRequireDefault(require("../confirm-modal"));
|
|
11
|
+
var _omit = _interopRequireDefault(require("../utils/omit"));
|
|
12
|
+
var _PayMask = _interopRequireDefault(require("../PayMask"));
|
|
13
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
14
|
+
var _icons = require("../icons");
|
|
15
|
+
var _getPrefixCls = require("../utils/getPrefixCls");
|
|
16
|
+
const _excluded = ["className", "children", "onClick", "formHtml", "createOrder", "displayType", "modalProps", "maskProps"],
|
|
17
|
+
_excluded2 = ["onFinish", "onRetry", "onClose"],
|
|
18
|
+
_excluded3 = ["onClose"];
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
const MAlipayButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
25
|
+
const {
|
|
26
|
+
className,
|
|
27
|
+
children = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_icons.IconAlipay, null), "\u652F\u4ED8\u5B9D\u652F\u4ED8"),
|
|
28
|
+
onClick,
|
|
29
|
+
formHtml: propsFormHtml,
|
|
30
|
+
createOrder,
|
|
31
|
+
displayType = 'modal',
|
|
32
|
+
modalProps,
|
|
33
|
+
maskProps
|
|
34
|
+
} = props,
|
|
35
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
36
|
+
const _ref = modalProps || {},
|
|
37
|
+
{
|
|
38
|
+
onFinish,
|
|
39
|
+
onRetry,
|
|
40
|
+
onClose
|
|
41
|
+
} = _ref,
|
|
42
|
+
modalPropsOthers = _objectWithoutProperties(_ref, _excluded2);
|
|
43
|
+
const _ref2 = maskProps || {},
|
|
44
|
+
{
|
|
45
|
+
onClose: onMaskClose
|
|
46
|
+
} = _ref2,
|
|
47
|
+
restMaskProps = _objectWithoutProperties(_ref2, _excluded3);
|
|
48
|
+
const mAlipayButtonRef = (0, _react.useRef)({
|
|
49
|
+
nativeElement: null
|
|
50
|
+
});
|
|
51
|
+
const [formHtmlString, setFormHtmlString] = (0, _react.useState)();
|
|
52
|
+
const [showMask, setShowMask] = (0, _react.useState)(false);
|
|
53
|
+
const [showModal, setShowModal] = (0, _react.useState)(false);
|
|
54
|
+
(0, _react.useImperativeHandle)(ref, () => mAlipayButtonRef.current);
|
|
55
|
+
const handleRetry = (0, _react.useCallback)(() => {
|
|
56
|
+
if (displayType === 'modal') {
|
|
57
|
+
onRetry === null || onRetry === void 0 || onRetry();
|
|
58
|
+
setShowModal(false);
|
|
59
|
+
}
|
|
60
|
+
}, [onRetry, displayType]);
|
|
61
|
+
const handleFinish = (0, _react.useCallback)(() => {
|
|
62
|
+
if (displayType === 'modal') {
|
|
63
|
+
onFinish === null || onFinish === void 0 || onFinish();
|
|
64
|
+
setShowModal(false);
|
|
65
|
+
}
|
|
66
|
+
}, [onFinish, displayType]);
|
|
67
|
+
const handleDisplay = (0, _react.useCallback)(() => {
|
|
68
|
+
if (displayType === 'modal') {
|
|
69
|
+
setShowModal(true);
|
|
70
|
+
} else {
|
|
71
|
+
setShowMask(true);
|
|
72
|
+
}
|
|
73
|
+
}, [displayType]);
|
|
74
|
+
const handleOnCloseModal = (0, _react.useCallback)(() => {
|
|
75
|
+
if (displayType === 'modal') {
|
|
76
|
+
onClose === null || onClose === void 0 || onClose();
|
|
77
|
+
setShowModal(false);
|
|
78
|
+
}
|
|
79
|
+
}, [onClose, displayType]);
|
|
80
|
+
const handlePayCreateOrder = (0, _react.useCallback)(async () => {
|
|
81
|
+
if (createOrder) {
|
|
82
|
+
const {
|
|
83
|
+
formHtml
|
|
84
|
+
} = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
|
|
85
|
+
if (formHtml) {
|
|
86
|
+
handleDisplay();
|
|
87
|
+
setFormHtmlString(formHtml);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, [createOrder, handleDisplay]);
|
|
91
|
+
const handleOpen = (0, _react.useCallback)(() => {
|
|
92
|
+
if (propsFormHtml) {
|
|
93
|
+
handleDisplay();
|
|
94
|
+
setFormHtmlString(propsFormHtml);
|
|
95
|
+
}
|
|
96
|
+
}, [propsFormHtml, handleDisplay]);
|
|
97
|
+
const handleClick = (0, _react.useCallback)(e => {
|
|
98
|
+
if (createOrder) {
|
|
99
|
+
handlePayCreateOrder();
|
|
100
|
+
} else {
|
|
101
|
+
handleOpen();
|
|
102
|
+
}
|
|
103
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
104
|
+
}, [onClick, createOrder, handlePayCreateOrder, handleOpen]);
|
|
105
|
+
const isShowAutoSubmit = (0, _react.useMemo)(() => {
|
|
106
|
+
if (displayType === 'modal') {
|
|
107
|
+
return showModal;
|
|
108
|
+
}
|
|
109
|
+
return showMask;
|
|
110
|
+
}, [displayType, showModal, showMask]);
|
|
111
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
|
|
112
|
+
ref: mAlipayButtonRef,
|
|
113
|
+
className: (0, _classNames.default)((0, _getPrefixCls.getPrefixCls)('m-alipay-btn'), className),
|
|
114
|
+
onClick: handleClick
|
|
115
|
+
}, (0, _omit.default)(others, ['displayType', 'displayProps'])), children), isShowAutoSubmit && formHtmlString && /*#__PURE__*/_react.default.createElement(_mAlipayAutoSubmit.default, {
|
|
116
|
+
formHtml: formHtmlString
|
|
117
|
+
}), displayType === 'modal' && formHtmlString && /*#__PURE__*/_react.default.createElement(_confirmModal.default, _extends({
|
|
118
|
+
visible: showModal,
|
|
119
|
+
onRetry: handleRetry,
|
|
120
|
+
onFinish: handleFinish,
|
|
121
|
+
onClose: handleOnCloseModal,
|
|
122
|
+
autoOpenWindow: false
|
|
123
|
+
}, modalPropsOthers)), showMask && formHtmlString && /*#__PURE__*/_react.default.createElement(_PayMask.default, _extends({
|
|
124
|
+
visible: showMask,
|
|
125
|
+
onClose: () => {
|
|
126
|
+
setShowMask(false);
|
|
127
|
+
onMaskClose === null || onMaskClose === void 0 || onMaskClose();
|
|
128
|
+
},
|
|
129
|
+
payUrl: formHtmlString,
|
|
130
|
+
title: '支付宝',
|
|
131
|
+
autoOpenWindow: false
|
|
132
|
+
}, restMaskProps)));
|
|
133
|
+
});
|
|
134
|
+
MAlipayButton.displayName = 'MAlipayButton';
|
|
135
|
+
var _default = exports.default = MAlipayButton;
|
|
@@ -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}.pay-modal{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-modal__mask{position:absolute;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.55);z-index:0}.pay-modal__content{position:relative;z-index:1;background:#fff;border-radius:16px;padding:42px 20px 20px 20px;min-width:280px;max-width:80vw;box-shadow:0 4px 24px #0001;text-align:center;max-height:60vh;display:flex;flex-direction:column}.pay-modal__close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:28px;cursor:pointer;text-align:left}.pay-modal__icon{margin-bottom:8px;font-size:40px}.pay-modal__title{font-size:20px;font-weight:700;color:#222;margin-bottom:12px}.pay-modal__desc{color:#222;font-size:15px;margin-bottom:24px;line-height:1.7;text-align:left}.pay-modal__content-wrapper{position:relative;z-index:1;text-align:center;overflow-y:auto;flex:1;min-height:0}.pay-modal__actions{display:flex;justify-content:center;gap:16px;margin-top:16px}.pay-modal__btn{min-width:96px;padding:8px 0;border-radius:24px;border:none;font-size:15px;font-weight:600;cursor:pointer;transition:background .2s}.pay-modal__btn--retry{background:#fff;color:#f25a5a;border:1.5px solid #f25a5a}.pay-modal__btn--finish{background:#f25a5a;color:#fff;border:none}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
MWechatButton: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "MWechatButton", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _mWechatButton.default;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _interface = require("./interface");
|
|
16
|
+
Object.keys(_interface).forEach(function (key) {
|
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
19
|
+
if (key in exports && exports[key] === _interface[key]) return;
|
|
20
|
+
Object.defineProperty(exports, key, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return _interface[key];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
var _mWechatButton = _interopRequireDefault(require("./m-wechat-button"));
|
|
28
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classNames = _interopRequireDefault(require("../utils/classNames"));
|
|
9
|
+
var _PayMask = _interopRequireDefault(require("../PayMask"));
|
|
10
|
+
var _confirmModal = _interopRequireDefault(require("../confirm-modal"));
|
|
11
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
12
|
+
var _icons = require("../icons");
|
|
13
|
+
var _getPrefixCls = require("../utils/getPrefixCls");
|
|
14
|
+
const _excluded = ["className", "children", "onClick", "wechatUrl", "createOrder", "displayType", "modalProps", "maskProps"],
|
|
15
|
+
_excluded2 = ["onFinish", "onRetry", "onClose"],
|
|
16
|
+
_excluded3 = ["onClose"];
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
const MWechatButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
23
|
+
const {
|
|
24
|
+
className,
|
|
25
|
+
children = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_icons.IconWechatPay, null), "\u5FAE\u4FE1\u652F\u4ED8"),
|
|
26
|
+
onClick,
|
|
27
|
+
wechatUrl: propsWechatUrl,
|
|
28
|
+
createOrder,
|
|
29
|
+
displayType = 'modal',
|
|
30
|
+
modalProps,
|
|
31
|
+
maskProps
|
|
32
|
+
} = props,
|
|
33
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
34
|
+
const _ref = modalProps || {},
|
|
35
|
+
{
|
|
36
|
+
onFinish,
|
|
37
|
+
onRetry,
|
|
38
|
+
onClose
|
|
39
|
+
} = _ref,
|
|
40
|
+
modalPropsOthers = _objectWithoutProperties(_ref, _excluded2);
|
|
41
|
+
const _ref2 = maskProps || {},
|
|
42
|
+
{
|
|
43
|
+
onClose: onMaskClose
|
|
44
|
+
} = _ref2,
|
|
45
|
+
restMaskProps = _objectWithoutProperties(_ref2, _excluded3);
|
|
46
|
+
const mWeChatButtonRef = (0, _react.useRef)({
|
|
47
|
+
nativeElement: null
|
|
48
|
+
});
|
|
49
|
+
const [showMask, setShowMask] = (0, _react.useState)(false);
|
|
50
|
+
const [showModal, setShowModal] = (0, _react.useState)(false);
|
|
51
|
+
const [wechatUrl, setWechatUrl] = (0, _react.useState)();
|
|
52
|
+
(0, _react.useImperativeHandle)(ref, () => mWeChatButtonRef.current);
|
|
53
|
+
const handleRetry = (0, _react.useCallback)(() => {
|
|
54
|
+
if (displayType === 'modal') {
|
|
55
|
+
onRetry === null || onRetry === void 0 || onRetry();
|
|
56
|
+
setShowModal(false);
|
|
57
|
+
}
|
|
58
|
+
}, [onRetry, displayType]);
|
|
59
|
+
const handleFinish = (0, _react.useCallback)(() => {
|
|
60
|
+
if (displayType === 'modal') {
|
|
61
|
+
onFinish === null || onFinish === void 0 || onFinish();
|
|
62
|
+
setShowModal(false);
|
|
63
|
+
}
|
|
64
|
+
}, [onFinish, displayType]);
|
|
65
|
+
const handleDisplay = (0, _react.useCallback)(() => {
|
|
66
|
+
if (displayType === 'modal') {
|
|
67
|
+
setShowModal(true);
|
|
68
|
+
} else {
|
|
69
|
+
setShowMask(true);
|
|
70
|
+
}
|
|
71
|
+
}, [displayType]);
|
|
72
|
+
const handleOnCloseModal = (0, _react.useCallback)(() => {
|
|
73
|
+
if (displayType === 'modal') {
|
|
74
|
+
onClose === null || onClose === void 0 || onClose();
|
|
75
|
+
setShowModal(false);
|
|
76
|
+
}
|
|
77
|
+
}, [onClose, displayType]);
|
|
78
|
+
const handlePayCreateOrder = (0, _react.useCallback)(async () => {
|
|
79
|
+
if (createOrder) {
|
|
80
|
+
const {
|
|
81
|
+
wechatUrl
|
|
82
|
+
} = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
|
|
83
|
+
if (wechatUrl) {
|
|
84
|
+
handleDisplay();
|
|
85
|
+
setWechatUrl(wechatUrl);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, [createOrder, handleDisplay]);
|
|
89
|
+
const handleOpen = (0, _react.useCallback)(() => {
|
|
90
|
+
if (propsWechatUrl) {
|
|
91
|
+
handleDisplay();
|
|
92
|
+
setWechatUrl(propsWechatUrl);
|
|
93
|
+
}
|
|
94
|
+
}, [propsWechatUrl, handleDisplay]);
|
|
95
|
+
const handleClick = (0, _react.useCallback)(e => {
|
|
96
|
+
if (createOrder) {
|
|
97
|
+
handlePayCreateOrder();
|
|
98
|
+
} else {
|
|
99
|
+
handleOpen();
|
|
100
|
+
}
|
|
101
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
102
|
+
}, [onClick, createOrder, handlePayCreateOrder, handleOpen]);
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
|
|
104
|
+
ref: mWeChatButtonRef,
|
|
105
|
+
className: (0, _classNames.default)((0, _getPrefixCls.getPrefixCls)('m-wechat-btn'), className),
|
|
106
|
+
onClick: handleClick
|
|
107
|
+
}, others), children), displayType === 'mask' && showMask && wechatUrl && /*#__PURE__*/_react.default.createElement(_PayMask.default, _extends({
|
|
108
|
+
visible: showMask,
|
|
109
|
+
onClose: () => {
|
|
110
|
+
setShowMask(false);
|
|
111
|
+
onMaskClose === null || onMaskClose === void 0 || onMaskClose();
|
|
112
|
+
},
|
|
113
|
+
payUrl: wechatUrl,
|
|
114
|
+
title: 'WeChat'
|
|
115
|
+
}, restMaskProps)), displayType === 'modal' && showModal && wechatUrl && /*#__PURE__*/_react.default.createElement(_confirmModal.default, _extends({
|
|
116
|
+
visible: showModal,
|
|
117
|
+
onClose: handleOnCloseModal,
|
|
118
|
+
onRetry: handleRetry,
|
|
119
|
+
onFinish: handleFinish,
|
|
120
|
+
payUrl: wechatUrl,
|
|
121
|
+
autoOpenWindow: true
|
|
122
|
+
}, modalPropsOthers)));
|
|
123
|
+
});
|
|
124
|
+
MWechatButton.displayName = 'MWechatButton';
|
|
125
|
+
var _default = exports.default = MWechatButton;
|
|
@@ -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}.pay-modal{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-modal__mask{position:absolute;left:0;top:0;right:0;bottom:0;background:rgba(0,0,0,.55);z-index:0}.pay-modal__content{position:relative;z-index:1;background:#fff;border-radius:16px;padding:42px 20px 20px 20px;min-width:280px;max-width:80vw;box-shadow:0 4px 24px #0001;text-align:center;max-height:60vh;display:flex;flex-direction:column}.pay-modal__close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:28px;cursor:pointer;text-align:left}.pay-modal__icon{margin-bottom:8px;font-size:40px}.pay-modal__title{font-size:20px;font-weight:700;color:#222;margin-bottom:12px}.pay-modal__desc{color:#222;font-size:15px;margin-bottom:24px;line-height:1.7;text-align:left}.pay-modal__content-wrapper{position:relative;z-index:1;text-align:center;overflow-y:auto;flex:1;min-height:0}.pay-modal__actions{display:flex;justify-content:center;gap:16px;margin-top:16px}.pay-modal__btn{min-width:96px;padding:8px 0;border-radius:24px;border:none;font-size:15px;font-weight:600;cursor:pointer;transition:background .2s}.pay-modal__btn--retry{background:#fff;color:#f25a5a;border:1.5px solid #f25a5a}.pay-modal__btn--finish{background:#f25a5a;color:#fff;border:none}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _mask = _interopRequireDefault(require("./mask"));
|
|
9
|
+
var _interface = require("./interface");
|
|
10
|
+
Object.keys(_interface).forEach(function (key) {
|
|
11
|
+
if (key === "default" || key === "__esModule") return;
|
|
12
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
13
|
+
if (key in exports && exports[key] === _interface[key]) return;
|
|
14
|
+
Object.defineProperty(exports, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _interface[key];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
var _default = exports.default = _mask.default;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _ahooks = require("ahooks");
|
|
10
|
+
var _web = require("@react-spring/web");
|
|
11
|
+
var _withDefaultProps = require("../utils/with-default-props");
|
|
12
|
+
var _shouldRender = require("../utils/should-render");
|
|
13
|
+
var _withStopPropagation = require("../utils/with-stop-propagation");
|
|
14
|
+
var _renderToContainer = require("../utils/render-to-container");
|
|
15
|
+
var _useLockScroll = require("../hooks/use-lock-scroll");
|
|
16
|
+
var _classNames = _interopRequireDefault(require("../utils/classNames"));
|
|
17
|
+
var _getPrefixCls = require("../utils/getPrefixCls");
|
|
18
|
+
var _interface = require("./interface");
|
|
19
|
+
Object.keys(_interface).forEach(function (key) {
|
|
20
|
+
if (key === "default" || key === "__esModule") return;
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
22
|
+
if (key in exports && exports[key] === _interface[key]) return;
|
|
23
|
+
Object.defineProperty(exports, key, {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return _interface[key];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
31
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
32
|
+
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; }
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
35
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
36
|
+
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); }
|
|
37
|
+
const classPrefix = (0, _getPrefixCls.getPrefixCls)('mask');
|
|
38
|
+
const opacityRecord = {
|
|
39
|
+
default: 0.7,
|
|
40
|
+
thin: 0.35,
|
|
41
|
+
thick: 0.75
|
|
42
|
+
};
|
|
43
|
+
const colorRecord = {
|
|
44
|
+
black: '0, 0, 0',
|
|
45
|
+
white: '255, 255, 255'
|
|
46
|
+
};
|
|
47
|
+
const defaultProps = {
|
|
48
|
+
visible: true,
|
|
49
|
+
destroyOnClose: false,
|
|
50
|
+
forceRender: false,
|
|
51
|
+
color: 'black',
|
|
52
|
+
opacity: 'default',
|
|
53
|
+
disableBodyScroll: true,
|
|
54
|
+
getContainer: () => document.body,
|
|
55
|
+
stopPropagation: ['click']
|
|
56
|
+
};
|
|
57
|
+
const Mask = p => {
|
|
58
|
+
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
59
|
+
const ref = (0, _react.useRef)(null);
|
|
60
|
+
(0, _useLockScroll.useLockScroll)(ref, props.visible && props.disableBodyScroll);
|
|
61
|
+
const background = (0, _react.useMemo)(() => {
|
|
62
|
+
var _opacityRecord;
|
|
63
|
+
const opacity = (_opacityRecord = opacityRecord[props.opacity]) !== null && _opacityRecord !== void 0 ? _opacityRecord : props.opacity;
|
|
64
|
+
const rgb = colorRecord[props.color];
|
|
65
|
+
return rgb ? "rgba(".concat(rgb, ", ").concat(opacity, ")") : props.color;
|
|
66
|
+
}, [props.color, props.opacity]);
|
|
67
|
+
const [active, setActive] = (0, _react.useState)(props.visible);
|
|
68
|
+
const unmountedRef = (0, _ahooks.useUnmountedRef)();
|
|
69
|
+
const {
|
|
70
|
+
opacity
|
|
71
|
+
} = (0, _web.useSpring)({
|
|
72
|
+
opacity: props.visible ? 1 : 0,
|
|
73
|
+
config: {
|
|
74
|
+
precision: 0.01,
|
|
75
|
+
mass: 1,
|
|
76
|
+
tension: 250,
|
|
77
|
+
friction: 30,
|
|
78
|
+
clamp: true
|
|
79
|
+
},
|
|
80
|
+
onStart: () => {
|
|
81
|
+
setActive(true);
|
|
82
|
+
},
|
|
83
|
+
onRest: () => {
|
|
84
|
+
if (unmountedRef.current) return;
|
|
85
|
+
setActive(props.visible);
|
|
86
|
+
if (props.visible) {
|
|
87
|
+
var _props$afterShow;
|
|
88
|
+
(_props$afterShow = props.afterShow) === null || _props$afterShow === void 0 || _props$afterShow.call(props);
|
|
89
|
+
} else {
|
|
90
|
+
var _props$afterClose;
|
|
91
|
+
(_props$afterClose = props.afterClose) === null || _props$afterClose === void 0 || _props$afterClose.call(props);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const node = (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, /*#__PURE__*/_react.default.createElement(_web.animated.div, {
|
|
96
|
+
className: (0, _classNames.default)(classPrefix, props.className),
|
|
97
|
+
ref: ref,
|
|
98
|
+
"aria-hidden": true,
|
|
99
|
+
style: _objectSpread(_objectSpread({}, props.style), {}, {
|
|
100
|
+
background,
|
|
101
|
+
opacity,
|
|
102
|
+
display: active ? undefined : 'none'
|
|
103
|
+
}),
|
|
104
|
+
onClick: e => {
|
|
105
|
+
if (e.target === e.currentTarget) {
|
|
106
|
+
var _props$onMaskClick;
|
|
107
|
+
(_props$onMaskClick = props.onMaskClick) === null || _props$onMaskClick === void 0 || _props$onMaskClick.call(props, e);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, props.children));
|
|
111
|
+
return /*#__PURE__*/_react.default.createElement(_shouldRender.ShouldRender, {
|
|
112
|
+
active: active,
|
|
113
|
+
forceRender: props.forceRender,
|
|
114
|
+
destroyOnClose: props.destroyOnClose
|
|
115
|
+
}, (0, _renderToContainer.renderToContainer)(props.getContainer, node));
|
|
116
|
+
};
|
|
117
|
+
var _default = exports.default = Mask;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pay-mask{position:fixed;z-index:1000;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _shared = require("../shared");
|
|
10
|
+
var _Paypal = require("../Paypal");
|
|
11
|
+
var _Stripe = _interopRequireDefault(require("../Stripe"));
|
|
12
|
+
var _Airwallex = _interopRequireDefault(require("../Airwallex"));
|
|
13
|
+
var _Payssion = require("../Payssion");
|
|
14
|
+
var _MWeChat = require("../MWeChat");
|
|
15
|
+
var _Alipay = _interopRequireDefault(require("../Alipay"));
|
|
16
|
+
var _Wechat = _interopRequireDefault(require("../Wechat"));
|
|
17
|
+
var _MAlipay = _interopRequireDefault(require("../MAlipay"));
|
|
18
|
+
var _interface = require("./interface");
|
|
19
|
+
Object.keys(_interface).forEach(function (key) {
|
|
20
|
+
if (key === "default" || key === "__esModule") return;
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
22
|
+
if (key in exports && exports[key] === _interface[key]) return;
|
|
23
|
+
Object.defineProperty(exports, key, {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return _interface[key];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
31
|
+
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); }
|
|
32
|
+
const PayButton = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
33
|
+
if (props.payMethod === _shared.PaymentMethod.PaypalH5 || props.payMethod === _shared.PaymentMethod.PaypalPc) {
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_Paypal.PaypalButton, _extends({
|
|
35
|
+
ref: ref
|
|
36
|
+
}, props));
|
|
37
|
+
}
|
|
38
|
+
if (props.payMethod === _shared.PaymentMethod.StripeH5 || props.payMethod === _shared.PaymentMethod.StripePc) {
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_Stripe.default.Button, _extends({
|
|
40
|
+
ref: ref
|
|
41
|
+
}, props));
|
|
42
|
+
}
|
|
43
|
+
if (props.payMethod === _shared.PaymentMethod.Airwallex) {
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_Airwallex.default.Button, _extends({
|
|
45
|
+
ref: ref
|
|
46
|
+
}, props));
|
|
47
|
+
}
|
|
48
|
+
if (props.payMethod === _shared.PaymentMethod.Payssion) {
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_Payssion.PayssionButton, _extends({
|
|
50
|
+
ref: ref
|
|
51
|
+
}, props));
|
|
52
|
+
}
|
|
53
|
+
if (props.payMethod === _shared.PaymentMethod.WechatH5) {
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_MWeChat.MWechatButton, _extends({
|
|
55
|
+
ref: ref
|
|
56
|
+
}, props));
|
|
57
|
+
}
|
|
58
|
+
if (props.payMethod === _shared.PaymentMethod.AlipayH5) {
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_MAlipay.default.Button, _extends({
|
|
60
|
+
ref: ref
|
|
61
|
+
}, props));
|
|
62
|
+
}
|
|
63
|
+
if (props.payMethod === _shared.PaymentMethod.AlipayPc) {
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement(_Alipay.default.Button, _extends({
|
|
65
|
+
ref: ref
|
|
66
|
+
}, props));
|
|
67
|
+
}
|
|
68
|
+
if (props.payMethod === _shared.PaymentMethod.WechatPc) {
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_Wechat.default.Button, _extends({
|
|
70
|
+
ref: ref
|
|
71
|
+
}, props));
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
});
|
|
75
|
+
PayButton.displayName = 'PayButton';
|
|
76
|
+
var _default = exports.default = PayButton;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _payMask = _interopRequireDefault(require("./pay-mask"));
|
|
9
|
+
var _interface = require("./interface");
|
|
10
|
+
Object.keys(_interface).forEach(function (key) {
|
|
11
|
+
if (key === "default" || key === "__esModule") return;
|
|
12
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
13
|
+
if (key in exports && exports[key] === _interface[key]) return;
|
|
14
|
+
Object.defineProperty(exports, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _interface[key];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
var _default = exports.default = _payMask.default;
|