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,112 @@
|
|
|
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 _Mask = _interopRequireDefault(require("../Mask"));
|
|
10
|
+
var _usePayWindowOpen = require("../hooks/usePayWindowOpen");
|
|
11
|
+
var _withDefaultProps = require("../utils/with-default-props");
|
|
12
|
+
var _classNames = _interopRequireDefault(require("../utils/classNames"));
|
|
13
|
+
var _getPrefixCls = require("../utils/getPrefixCls");
|
|
14
|
+
var _interface = require("./interface");
|
|
15
|
+
Object.keys(_interface).forEach(function (key) {
|
|
16
|
+
if (key === "default" || key === "__esModule") return;
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
18
|
+
if (key in exports && exports[key] === _interface[key]) return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _interface[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
const _excluded = ["visible", "payUrl", "onClose", "onMaskClick", "onContinue", "openMode", "autoOpenWindow", "className", "destroyOnClose"];
|
|
27
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
28
|
+
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); }
|
|
29
|
+
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); }
|
|
30
|
+
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; }
|
|
31
|
+
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; }
|
|
32
|
+
const classPrefix = (0, _getPrefixCls.getPrefixCls)('mask');
|
|
33
|
+
const defaultProps = {
|
|
34
|
+
visible: false,
|
|
35
|
+
title: 'Pay',
|
|
36
|
+
desc: "Don't see the secure pay browser? We'll help you re-launch the window to complete your purchase",
|
|
37
|
+
buttonText: 'Click to Continue',
|
|
38
|
+
autoOpenWindow: true
|
|
39
|
+
};
|
|
40
|
+
const PayMask = p => {
|
|
41
|
+
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
42
|
+
const {
|
|
43
|
+
visible,
|
|
44
|
+
payUrl,
|
|
45
|
+
onClose,
|
|
46
|
+
onMaskClick,
|
|
47
|
+
onContinue,
|
|
48
|
+
openMode,
|
|
49
|
+
autoOpenWindow,
|
|
50
|
+
className,
|
|
51
|
+
destroyOnClose = true
|
|
52
|
+
} = props,
|
|
53
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
54
|
+
const [isWindowMonitoring, setIsWindowMonitoring] = (0, _react.useState)(false);
|
|
55
|
+
const {
|
|
56
|
+
openWindow,
|
|
57
|
+
closeWindow
|
|
58
|
+
} = (0, _usePayWindowOpen.usePayWindowOpen)({
|
|
59
|
+
payUrl: payUrl || '',
|
|
60
|
+
onClose: () => {
|
|
61
|
+
onClose === null || onClose === void 0 || onClose();
|
|
62
|
+
setIsWindowMonitoring(false);
|
|
63
|
+
},
|
|
64
|
+
autoOpen: autoOpenWindow,
|
|
65
|
+
openMode
|
|
66
|
+
});
|
|
67
|
+
(0, _react.useEffect)(() => {
|
|
68
|
+
if (visible && autoOpenWindow) {
|
|
69
|
+
openWindow();
|
|
70
|
+
}
|
|
71
|
+
}, [visible, autoOpenWindow, openWindow]);
|
|
72
|
+
(0, _react.useEffect)(() => {
|
|
73
|
+
if (visible && isWindowMonitoring && !autoOpenWindow) {
|
|
74
|
+
openWindow();
|
|
75
|
+
}
|
|
76
|
+
}, [visible, isWindowMonitoring, autoOpenWindow, openWindow]);
|
|
77
|
+
const handleContinue = () => {
|
|
78
|
+
if (!autoOpenWindow) {
|
|
79
|
+
setIsWindowMonitoring(true);
|
|
80
|
+
} else {
|
|
81
|
+
openWindow();
|
|
82
|
+
}
|
|
83
|
+
onContinue === null || onContinue === void 0 || onContinue();
|
|
84
|
+
};
|
|
85
|
+
const handleClose = () => {
|
|
86
|
+
onClose === null || onClose === void 0 || onClose();
|
|
87
|
+
closeWindow();
|
|
88
|
+
};
|
|
89
|
+
const classNames = (0, _classNames.default)(classPrefix, className);
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement(_Mask.default, _extends({
|
|
91
|
+
visible: visible,
|
|
92
|
+
onMaskClick: e => {
|
|
93
|
+
handleClose();
|
|
94
|
+
onMaskClick === null || onMaskClick === void 0 || onMaskClick(e);
|
|
95
|
+
},
|
|
96
|
+
className: classNames,
|
|
97
|
+
destroyOnClose: destroyOnClose
|
|
98
|
+
}, rest), /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
className: "".concat(classPrefix, "-content")
|
|
100
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
101
|
+
className: "".concat(classPrefix, "-close"),
|
|
102
|
+
onClick: handleClose
|
|
103
|
+
}, "\xD7"), /*#__PURE__*/_react.default.createElement("div", {
|
|
104
|
+
className: "".concat(classPrefix, "-title")
|
|
105
|
+
}, props.title), /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
+
className: "".concat(classPrefix, "-desc")
|
|
107
|
+
}, props.desc), /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
+
className: "".concat(classPrefix, "-continue"),
|
|
109
|
+
onClick: handleContinue
|
|
110
|
+
}, props.buttonText)));
|
|
111
|
+
};
|
|
112
|
+
var _default = exports.default = PayMask;
|
|
@@ -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}.pay-mask-content{position:relative;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0 88px}.pay-mask-close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:28px;color:#fff;cursor:pointer;z-index:1}.pay-mask-title{display:flex;align-items:center;gap:4px;font-weight:700;font-size:28px;color:#fff;margin-bottom:16px;text-shadow:0 2px 8px #000}.pay-mask-title>.pay-icon-paypal-white{width:36px;height:36px}.pay-mask-desc{color:#fff;text-align:center;margin-bottom:24px;line-height:1.5;white-space:pre-line}.pay-mask-continue{color:#fff;font-weight:700;text-decoration:underline;text-underline-offset:4px;cursor:pointer;text-align:center;font-size:18px}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
PaypalButton: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "PaypalButton", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _paypalButton.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 _paypalButton = _interopRequireDefault(require("./paypal-button"));
|
|
28
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,83 @@
|
|
|
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 _icons = require("../icons");
|
|
9
|
+
var _classNames = _interopRequireDefault(require("../utils/classNames"));
|
|
10
|
+
var _PayMask = _interopRequireDefault(require("../PayMask"));
|
|
11
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
12
|
+
var _getPrefixCls = require("../utils/getPrefixCls");
|
|
13
|
+
const _excluded = ["className", "children", "onClick", "paypalUrl", "createOrder", "maskProps"],
|
|
14
|
+
_excluded2 = ["onClose"];
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
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); }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
const PaypalButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
21
|
+
const {
|
|
22
|
+
className,
|
|
23
|
+
children = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_icons.IconPaypalText, null), " Buy Now"),
|
|
24
|
+
onClick,
|
|
25
|
+
paypalUrl: propsPaypalUrl,
|
|
26
|
+
createOrder,
|
|
27
|
+
maskProps
|
|
28
|
+
} = props,
|
|
29
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
30
|
+
const _ref = maskProps || {},
|
|
31
|
+
{
|
|
32
|
+
onClose: onMaskClose
|
|
33
|
+
} = _ref,
|
|
34
|
+
restMaskProps = _objectWithoutProperties(_ref, _excluded2);
|
|
35
|
+
const paypalButtonRef = (0, _react.useRef)({
|
|
36
|
+
nativeElement: null
|
|
37
|
+
});
|
|
38
|
+
const [showMask, setShowMask] = (0, _react.useState)(false);
|
|
39
|
+
const [paypalUrl, setPaypalUrl] = (0, _react.useState)();
|
|
40
|
+
(0, _react.useImperativeHandle)(ref, () => paypalButtonRef.current);
|
|
41
|
+
const handlePayCreateOrder = (0, _react.useCallback)(async () => {
|
|
42
|
+
if (createOrder) {
|
|
43
|
+
// 1. 业务侧创建订单,获取参数
|
|
44
|
+
const {
|
|
45
|
+
paypalUrl
|
|
46
|
+
} = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
|
|
47
|
+
if (paypalUrl) {
|
|
48
|
+
// 2. 唤起蒙层
|
|
49
|
+
setShowMask(true);
|
|
50
|
+
setPaypalUrl(paypalUrl);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, [createOrder]);
|
|
54
|
+
const handleOpen = (0, _react.useCallback)(() => {
|
|
55
|
+
if (propsPaypalUrl) {
|
|
56
|
+
setShowMask(true);
|
|
57
|
+
setPaypalUrl(propsPaypalUrl);
|
|
58
|
+
}
|
|
59
|
+
}, [propsPaypalUrl]);
|
|
60
|
+
const handleClick = (0, _react.useCallback)(e => {
|
|
61
|
+
if (createOrder) {
|
|
62
|
+
handlePayCreateOrder();
|
|
63
|
+
} else {
|
|
64
|
+
handleOpen();
|
|
65
|
+
}
|
|
66
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
67
|
+
}, [onClick, createOrder, handlePayCreateOrder, handleOpen]);
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
|
|
69
|
+
ref: paypalButtonRef,
|
|
70
|
+
className: (0, _classNames.default)((0, _getPrefixCls.getPrefixCls)('paypal-btn'), className),
|
|
71
|
+
onClick: handleClick
|
|
72
|
+
}, others), children), showMask && paypalUrl && /*#__PURE__*/_react.default.createElement(_PayMask.default, _extends({
|
|
73
|
+
visible: showMask,
|
|
74
|
+
onClose: () => {
|
|
75
|
+
setShowMask(false);
|
|
76
|
+
onMaskClose === null || onMaskClose === void 0 || onMaskClose();
|
|
77
|
+
},
|
|
78
|
+
payUrl: paypalUrl,
|
|
79
|
+
title: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_icons.IconPaypalWhite, null), "PayPal")
|
|
80
|
+
}, restMaskProps)));
|
|
81
|
+
});
|
|
82
|
+
PaypalButton.displayName = 'PaypalButton';
|
|
83
|
+
var _default = exports.default = PaypalButton;
|
|
@@ -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-icon{display:inline-block;color:inherit;width:16px;vertical-align:-2px;stroke:currentColor}.pay-icon[fill=currentColor]{fill:currentColor;stroke:none}.pay-icon[stroke=currentColor]{stroke:currentColor;fill:none}.pay-icon[fill=currentColor][stroke=currentColor]{fill:currentColor;stroke:currentColor}.pay-icon-paypal-text{width:64px;height:26px;max-width:72px;max-height:32px}.pay-icon-close{width:18px;height:18px}.pay-icon-stripe-text{width:24px;height:24px}.pay-icon-alipay{width:20px;height:20px}.pay-icon-wechat-pay{width:20px;height:20px}.pay-icon-payssion-pay{width:36px;height:20px}.pay-paypal-btn.pay-button>span{display:flex;align-items:center;gap:.5rem}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
PayssionButton: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "PayssionButton", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _payssionButton.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 _payssionButton = _interopRequireDefault(require("./payssion-button"));
|
|
28
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,83 @@
|
|
|
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 _Button = _interopRequireDefault(require("../Button"));
|
|
11
|
+
var _icons = require("../icons");
|
|
12
|
+
var _getPrefixCls = require("../utils/getPrefixCls");
|
|
13
|
+
const _excluded = ["className", "children", "onClick", "payssionUrl", "createOrder", "maskProps"],
|
|
14
|
+
_excluded2 = ["onClose"];
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
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); }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
const PayssionButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
21
|
+
const {
|
|
22
|
+
className,
|
|
23
|
+
children = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_icons.IconPayssionPay, null), "Payssion"),
|
|
24
|
+
onClick,
|
|
25
|
+
payssionUrl: propsPayssionUrl,
|
|
26
|
+
createOrder,
|
|
27
|
+
maskProps
|
|
28
|
+
} = props,
|
|
29
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
30
|
+
const _ref = maskProps || {},
|
|
31
|
+
{
|
|
32
|
+
onClose
|
|
33
|
+
} = _ref,
|
|
34
|
+
restMaskProps = _objectWithoutProperties(_ref, _excluded2);
|
|
35
|
+
const payssionButtonRef = (0, _react.useRef)({
|
|
36
|
+
nativeElement: null
|
|
37
|
+
});
|
|
38
|
+
const [showMask, setShowMask] = (0, _react.useState)(false);
|
|
39
|
+
const [payssionUrl, setPayssionUrl] = (0, _react.useState)();
|
|
40
|
+
(0, _react.useImperativeHandle)(ref, () => payssionButtonRef.current);
|
|
41
|
+
const handlePayCreateOrder = (0, _react.useCallback)(async () => {
|
|
42
|
+
if (createOrder) {
|
|
43
|
+
// 1. 业务侧创建订单,获取参数
|
|
44
|
+
const {
|
|
45
|
+
payssionUrl
|
|
46
|
+
} = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
|
|
47
|
+
if (payssionUrl) {
|
|
48
|
+
// 2. 唤起蒙层
|
|
49
|
+
setShowMask(true);
|
|
50
|
+
setPayssionUrl(payssionUrl);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, [createOrder]);
|
|
54
|
+
const handleOpen = (0, _react.useCallback)(() => {
|
|
55
|
+
if (propsPayssionUrl) {
|
|
56
|
+
setShowMask(true);
|
|
57
|
+
setPayssionUrl(propsPayssionUrl);
|
|
58
|
+
}
|
|
59
|
+
}, [propsPayssionUrl]);
|
|
60
|
+
const handleClick = (0, _react.useCallback)(e => {
|
|
61
|
+
if (createOrder) {
|
|
62
|
+
handlePayCreateOrder();
|
|
63
|
+
} else {
|
|
64
|
+
handleOpen();
|
|
65
|
+
}
|
|
66
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
67
|
+
}, [onClick, createOrder, handlePayCreateOrder, handleOpen]);
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
|
|
69
|
+
ref: payssionButtonRef,
|
|
70
|
+
className: (0, _classNames.default)((0, _getPrefixCls.getPrefixCls)('payssion-btn'), className),
|
|
71
|
+
onClick: handleClick
|
|
72
|
+
}, others), children), payssionUrl && showMask && /*#__PURE__*/_react.default.createElement(_PayMask.default, _extends({
|
|
73
|
+
visible: showMask,
|
|
74
|
+
onClose: () => {
|
|
75
|
+
setShowMask(false);
|
|
76
|
+
onClose === null || onClose === void 0 || onClose();
|
|
77
|
+
},
|
|
78
|
+
payUrl: payssionUrl,
|
|
79
|
+
title: 'Payssion'
|
|
80
|
+
}, restMaskProps)));
|
|
81
|
+
});
|
|
82
|
+
PayssionButton.displayName = 'PayssionButton';
|
|
83
|
+
var _default = exports.default = PayssionButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pay-dot-loading{display:inline-block}.pay-button{display:inline-block;padding:7px 12px;font-size:16px;border-radius:4px;border:1px solid #eee;background:#fff;color:#333;cursor:pointer;transition:all .2s;user-select:none;position:relative;text-align:center}.pay-button-content{display:flex;align-items:center;justify-content:center;gap:6px}.pay-button-block{display:block;width:100%}.pay-button-disabled{opacity:.4;cursor:not-allowed}.pay-button-loading{cursor:wait}.pay-button-loading-wrapper{display:flex;align-items:center;justify-content:center;gap:6px}.pay-button-primary{background:#1677ff;border-color:#1677ff;color:#fff}.pay-button-primary:hover{background:#409eff}.pay-button-success{background:#00b578;border-color:#00b578;color:#fff}.pay-button-danger{background:#ff3141;border-color:#ff3141;color:#fff}.pay-button-warning{background:#ff8f1f;border-color:#ff8f1f;color:#fff}.pay-button-default{background:#fff;border-color:#eee;color:#333}.pay-button-fill-outline{background:0 0;color:inherit}.pay-button-fill-none{background:0 0;border:none;color:inherit}.pay-button-mini{font-size:12px;padding:2px 8px}.pay-button-small{font-size:14px;padding:4px 10px}.pay-button-large{font-size:18px;padding:10px 18px}.pay-button-shape-rounded{border-radius:1000px}.pay-button-shape-rectangular{border-radius:0}.pay-mask{position:fixed;z-index:1000;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.pay-mask-content{position:relative;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:0 88px}.pay-mask-close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:28px;color:#fff;cursor:pointer;z-index:1}.pay-mask-title{display:flex;align-items:center;gap:4px;font-weight:700;font-size:28px;color:#fff;margin-bottom:16px;text-shadow:0 2px 8px #000}.pay-mask-title>.pay-icon-paypal-white{width:36px;height:36px}.pay-mask-desc{color:#fff;text-align:center;margin-bottom:24px;line-height:1.5;white-space:pre-line}.pay-mask-continue{color:#fff;font-weight:700;text-decoration:underline;text-underline-offset:4px;cursor:pointer;text-align:center;font-size:18px}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _stripe = _interopRequireDefault(require("./stripe"));
|
|
9
|
+
var _stripePopup = _interopRequireDefault(require("./stripe-popup"));
|
|
10
|
+
var _stripeButton = _interopRequireDefault(require("./stripe-button"));
|
|
11
|
+
var _stripeModal = _interopRequireDefault(require("./stripe-modal"));
|
|
12
|
+
var _interface = require("./interface");
|
|
13
|
+
Object.keys(_interface).forEach(function (key) {
|
|
14
|
+
if (key === "default" || key === "__esModule") return;
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
+
if (key in exports && exports[key] === _interface[key]) return;
|
|
17
|
+
Object.defineProperty(exports, key, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return _interface[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
|
+
const StripeComponent = _stripe.default;
|
|
26
|
+
StripeComponent.Button = _stripeButton.default;
|
|
27
|
+
StripeComponent.Popup = _stripePopup.default;
|
|
28
|
+
StripeComponent.Modal = _stripeModal.default;
|
|
29
|
+
var _default = exports.default = StripeComponent;
|
|
@@ -0,0 +1,73 @@
|
|
|
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 _stripePopup = _interopRequireDefault(require("./stripe-popup"));
|
|
9
|
+
var _stripeModal = _interopRequireDefault(require("./stripe-modal"));
|
|
10
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
11
|
+
const _excluded = ["children", "onClick", "displayType", "stripePopupProps", "stripeModalProps", "createOrder"];
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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); }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
const StripeButton = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
18
|
+
const {
|
|
19
|
+
children = 'Stripe',
|
|
20
|
+
onClick,
|
|
21
|
+
displayType = 'popup',
|
|
22
|
+
stripePopupProps,
|
|
23
|
+
stripeModalProps,
|
|
24
|
+
createOrder
|
|
25
|
+
} = props,
|
|
26
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
27
|
+
const stripeButtonRef = (0, _react.useRef)({
|
|
28
|
+
nativeElement: null
|
|
29
|
+
});
|
|
30
|
+
const stripePopupRef = (0, _react.useRef)(null);
|
|
31
|
+
const stripeModalRef = (0, _react.useRef)(null);
|
|
32
|
+
(0, _react.useImperativeHandle)(ref, () => stripeButtonRef.current);
|
|
33
|
+
const handlePayCreateOrder = (0, _react.useCallback)(async () => {
|
|
34
|
+
if (createOrder) {
|
|
35
|
+
// 1. 业务侧创建订单,获取参数
|
|
36
|
+
const options = await (createOrder === null || createOrder === void 0 ? void 0 : createOrder());
|
|
37
|
+
if (options !== null && options !== void 0 && options.clientSecret && options !== null && options !== void 0 && options.stripeKey) {
|
|
38
|
+
// 2. 唤起弹窗
|
|
39
|
+
if (displayType === 'modal') {
|
|
40
|
+
var _stripeModalRef$curre;
|
|
41
|
+
(_stripeModalRef$curre = stripeModalRef.current) === null || _stripeModalRef$curre === void 0 || _stripeModalRef$curre.open(options);
|
|
42
|
+
} else {
|
|
43
|
+
var _stripePopupRef$curre;
|
|
44
|
+
(_stripePopupRef$curre = stripePopupRef.current) === null || _stripePopupRef$curre === void 0 || _stripePopupRef$curre.open(options);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, [createOrder, displayType]);
|
|
49
|
+
const handleClick = (0, _react.useCallback)(e => {
|
|
50
|
+
if (createOrder) {
|
|
51
|
+
handlePayCreateOrder();
|
|
52
|
+
} else {
|
|
53
|
+
if (displayType === 'modal') {
|
|
54
|
+
var _stripeModalRef$curre2;
|
|
55
|
+
stripeModalRef === null || stripeModalRef === void 0 || (_stripeModalRef$curre2 = stripeModalRef.current) === null || _stripeModalRef$curre2 === void 0 || _stripeModalRef$curre2.open();
|
|
56
|
+
} else {
|
|
57
|
+
var _stripePopupRef$curre2;
|
|
58
|
+
stripePopupRef === null || stripePopupRef === void 0 || (_stripePopupRef$curre2 = stripePopupRef.current) === null || _stripePopupRef$curre2 === void 0 || _stripePopupRef$curre2.open();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
62
|
+
}, [onClick, createOrder, handlePayCreateOrder, displayType]);
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
|
|
64
|
+
ref: stripeButtonRef,
|
|
65
|
+
onClick: handleClick
|
|
66
|
+
}, others), children), displayType === 'popup' && /*#__PURE__*/_react.default.createElement(_stripePopup.default, _extends({
|
|
67
|
+
ref: stripePopupRef
|
|
68
|
+
}, stripePopupProps)), displayType === 'modal' && /*#__PURE__*/_react.default.createElement(_stripeModal.default, _extends({
|
|
69
|
+
ref: stripeModalRef
|
|
70
|
+
}, stripeModalProps)));
|
|
71
|
+
});
|
|
72
|
+
StripeButton.displayName = 'StripeButton';
|
|
73
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(StripeButton);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _classNames = _interopRequireDefault(require("../utils/classNames"));
|
|
9
|
+
var _payModal = _interopRequireDefault(require("../pay-modal"));
|
|
10
|
+
var _stripe = _interopRequireDefault(require("./stripe"));
|
|
11
|
+
var _getPrefixCls = require("../utils/getPrefixCls");
|
|
12
|
+
const _excluded = ["stripeProps", "visible", "onClose", "className"];
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
const StripeModal = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
18
|
+
const {
|
|
19
|
+
stripeProps: propsStripeProps,
|
|
20
|
+
visible,
|
|
21
|
+
onClose,
|
|
22
|
+
className
|
|
23
|
+
} = props,
|
|
24
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
25
|
+
const stripeRef = (0, _react.useRef)(null);
|
|
26
|
+
const [uncontrolledVisible, setUncontrolledVisible] = (0, _react.useState)(false);
|
|
27
|
+
const [stripeProps, setStripeProps] = (0, _react.useState)();
|
|
28
|
+
const isControlled = visible !== undefined;
|
|
29
|
+
const _visible = isControlled ? visible : uncontrolledVisible;
|
|
30
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
31
|
+
open: value => {
|
|
32
|
+
if (value) {
|
|
33
|
+
setStripeProps(value);
|
|
34
|
+
}
|
|
35
|
+
setUncontrolledVisible(true);
|
|
36
|
+
},
|
|
37
|
+
close: () => {
|
|
38
|
+
setUncontrolledVisible(false);
|
|
39
|
+
onClose === null || onClose === void 0 || onClose();
|
|
40
|
+
},
|
|
41
|
+
current: stripeRef.current
|
|
42
|
+
}));
|
|
43
|
+
const _stripeProps = propsStripeProps !== null && propsStripeProps !== void 0 ? propsStripeProps : stripeProps;
|
|
44
|
+
return /*#__PURE__*/React.createElement(_payModal.default, _extends({
|
|
45
|
+
className: (0, _classNames.default)((0, _getPrefixCls.getPrefixCls)('stripe-modal'), className),
|
|
46
|
+
visible: _visible,
|
|
47
|
+
onClose: () => {
|
|
48
|
+
if (!isControlled) {
|
|
49
|
+
setUncontrolledVisible(false);
|
|
50
|
+
}
|
|
51
|
+
onClose === null || onClose === void 0 || onClose();
|
|
52
|
+
},
|
|
53
|
+
footer: null
|
|
54
|
+
}, rest), _stripeProps && /*#__PURE__*/React.createElement(_stripe.default, _stripeProps));
|
|
55
|
+
});
|
|
56
|
+
StripeModal.displayName = 'StripeModal';
|
|
57
|
+
var _default = exports.default = StripeModal;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _classNames = _interopRequireDefault(require("../utils/classNames"));
|
|
9
|
+
var _ = _interopRequireDefault(require("."));
|
|
10
|
+
var _payPopup = _interopRequireDefault(require("../pay-popup"));
|
|
11
|
+
var _getPrefixCls = require("../utils/getPrefixCls");
|
|
12
|
+
const _excluded = ["visible", "onClose", "closeOnMaskClick", "className", "bodyStyle", "stripeProps"];
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
+
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); }
|
|
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 StripePopup = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
23
|
+
const {
|
|
24
|
+
visible: controlledVisible,
|
|
25
|
+
onClose,
|
|
26
|
+
closeOnMaskClick = true,
|
|
27
|
+
className,
|
|
28
|
+
bodyStyle,
|
|
29
|
+
stripeProps: propsStripeProps
|
|
30
|
+
} = props,
|
|
31
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
32
|
+
const [uncontrolledVisible, setUncontrolledVisible] = (0, _react.useState)(false);
|
|
33
|
+
const [stripeProps, setStripeProps] = (0, _react.useState)();
|
|
34
|
+
const stripeRef = (0, _react.useRef)(null);
|
|
35
|
+
const isControlled = controlledVisible !== undefined;
|
|
36
|
+
const visible = isControlled ? controlledVisible : uncontrolledVisible;
|
|
37
|
+
(0, _react.useImperativeHandle)(ref, () => ({
|
|
38
|
+
open: value => {
|
|
39
|
+
if (value) {
|
|
40
|
+
setStripeProps(value);
|
|
41
|
+
}
|
|
42
|
+
setUncontrolledVisible(true);
|
|
43
|
+
},
|
|
44
|
+
close: () => {
|
|
45
|
+
setUncontrolledVisible(false);
|
|
46
|
+
onClose === null || onClose === void 0 || onClose();
|
|
47
|
+
},
|
|
48
|
+
current: stripeRef.current
|
|
49
|
+
}));
|
|
50
|
+
const _stripeProps = propsStripeProps !== null && propsStripeProps !== void 0 ? propsStripeProps : stripeProps;
|
|
51
|
+
return /*#__PURE__*/React.createElement(_payPopup.default, _extends({
|
|
52
|
+
className: (0, _classNames.default)((0, _getPrefixCls.getPrefixCls)('stripe-popup'), className),
|
|
53
|
+
visible: visible,
|
|
54
|
+
onClose: () => {
|
|
55
|
+
if (!isControlled) {
|
|
56
|
+
setUncontrolledVisible(false);
|
|
57
|
+
}
|
|
58
|
+
onClose === null || onClose === void 0 || onClose();
|
|
59
|
+
},
|
|
60
|
+
closeOnMaskClick: closeOnMaskClick,
|
|
61
|
+
bodyStyle: _objectSpread({
|
|
62
|
+
height: '40vh',
|
|
63
|
+
overflowY: 'scroll'
|
|
64
|
+
}, bodyStyle)
|
|
65
|
+
}, others), _stripeProps && /*#__PURE__*/React.createElement(_.default, _stripeProps));
|
|
66
|
+
});
|
|
67
|
+
StripePopup.displayName = 'StripePopup';
|
|
68
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(StripePopup);
|