pay-sdk-react 1.1.13 → 1.2.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 +465 -84
- package/README.zh-CN.md +466 -85
- package/dist/css/index.css +86 -6
- package/dist/css/index.min.css +1 -1
- package/dist/es/Airwallex/airwallex-button.js +48 -16
- package/dist/es/Airwallex/airwallex-checkout-button.d.ts +4 -0
- package/dist/es/Airwallex/airwallex-checkout-button.js +73 -0
- package/dist/es/Airwallex/airwallex-managed.d.ts +4 -0
- package/dist/es/Airwallex/airwallex-managed.js +87 -0
- package/dist/es/Airwallex/airwallex-modal.js +7 -3
- package/dist/es/Airwallex/airwallex-popup.js +7 -3
- package/dist/es/Airwallex/airwallex.d.ts +1 -3
- package/dist/es/Airwallex/airwallex.js +10 -1
- package/dist/es/Airwallex/hooks/useAirwallexCheckout.d.ts +7 -0
- package/dist/es/Airwallex/hooks/useAirwallexCheckout.js +155 -0
- package/dist/es/Airwallex/index.d.ts +4 -0
- package/dist/es/Airwallex/index.js +5 -1
- package/dist/es/Airwallex/interface.d.ts +146 -0
- package/dist/es/Airwallex/style/index.css +2 -2
- package/dist/es/Airwallex/style/index.min.css +1 -1
- package/dist/es/Alipay/alipay-button.js +26 -7
- package/dist/es/Alipay/alipay.js +39 -12
- package/dist/es/Alipay/interface.d.ts +26 -1
- package/dist/es/Alipay/style/index.css +2 -2
- package/dist/es/Alipay/style/index.min.css +1 -1
- package/dist/es/MAlipay/style/index.css +2 -2
- package/dist/es/MAlipay/style/index.min.css +1 -1
- package/dist/es/MPix/index.d.ts +2 -0
- package/dist/es/MPix/index.js +2 -0
- package/dist/es/MPix/interface.d.ts +44 -0
- package/dist/es/MPix/interface.js +1 -0
- package/dist/es/MPix/m-pix-button.d.ts +6 -0
- package/dist/es/MPix/m-pix-button.js +159 -0
- package/dist/es/MPix/style/index.css +256 -0
- package/dist/es/MPix/style/index.d.ts +1 -0
- package/dist/es/MPix/style/index.js +1 -0
- package/dist/es/MPix/style/index.min.css +1 -0
- package/dist/es/MWeChat/style/index.css +2 -2
- package/dist/es/MWeChat/style/index.min.css +1 -1
- package/dist/es/PayButton/index.js +12 -0
- package/dist/es/PayButton/interface.d.ts +28 -2
- package/dist/es/Paypal/index.d.ts +2 -0
- package/dist/es/Paypal/index.js +3 -1
- package/dist/es/Paypal/interface.d.ts +40 -0
- package/dist/es/Paypal/paypal-button.js +24 -3
- package/dist/es/Paypal/paypal-smart-button.d.ts +4 -0
- package/dist/es/Paypal/paypal-smart-button.js +48 -0
- package/dist/es/Payssion/interface.d.ts +7 -0
- package/dist/es/Payssion/payssion-button.js +25 -4
- package/dist/es/Pix/index.d.ts +11 -0
- package/dist/es/Pix/index.js +10 -0
- package/dist/es/Pix/interface.d.ts +147 -0
- package/dist/es/Pix/interface.js +1 -0
- package/dist/es/Pix/pix-button.d.ts +6 -0
- package/dist/es/Pix/pix-button.js +99 -0
- package/dist/es/Pix/pix-enhanced.d.ts +4 -0
- package/dist/es/Pix/pix-enhanced.js +182 -0
- package/dist/es/Pix/pix-modal.d.ts +6 -0
- package/dist/es/Pix/pix-modal.js +57 -0
- package/dist/es/Pix/pix.d.ts +4 -0
- package/dist/es/Pix/pix.js +125 -0
- package/dist/es/Pix/style/index.css +80 -0
- package/dist/es/Pix/style/index.d.ts +1 -0
- package/dist/es/Pix/style/index.js +1 -0
- package/dist/es/Pix/style/index.min.css +1 -0
- package/dist/es/Stripe/hooks/useStripeCheckout.d.ts +7 -0
- package/dist/es/Stripe/hooks/useStripeCheckout.js +86 -0
- package/dist/es/Stripe/index.d.ts +4 -0
- package/dist/es/Stripe/index.js +5 -1
- package/dist/es/Stripe/interface.d.ts +120 -0
- package/dist/es/Stripe/stripe-button.js +32 -10
- package/dist/es/Stripe/stripe-checkout-button.d.ts +4 -0
- package/dist/es/Stripe/stripe-checkout-button.js +70 -0
- package/dist/es/Stripe/stripe-modal.js +19 -2
- package/dist/es/Stripe/stripe-popup.js +13 -2
- package/dist/es/Stripe/stripe.js +38 -4
- package/dist/es/Stripe/style/index.css +2 -2
- package/dist/es/Stripe/style/index.min.css +1 -1
- package/dist/es/Wechat/interface.d.ts +13 -0
- package/dist/es/Wechat/style/index.css +2 -2
- package/dist/es/Wechat/style/index.min.css +1 -1
- package/dist/es/Wechat/wechat-button.js +26 -7
- package/dist/es/Wechat/wechat-content.d.ts +4 -0
- package/dist/es/Wechat/wechat-content.js +61 -0
- package/dist/es/Wechat/wechat.d.ts +1 -1
- package/dist/es/Wechat/wechat.js +5 -1
- package/dist/es/confirm-modal/style/index.css +2 -2
- package/dist/es/confirm-modal/style/index.min.css +1 -1
- package/dist/es/hooks/useLatestCallback.d.ts +1 -0
- package/dist/es/hooks/useLatestCallback.js +8 -0
- package/dist/es/hooks/useManagedOrder.d.ts +8 -0
- package/dist/es/hooks/useManagedOrder.js +67 -0
- package/dist/es/hooks/usePaymentExecution.d.ts +13 -0
- package/dist/es/hooks/usePaymentExecution.js +176 -0
- package/dist/es/hooks/usePaymentQr.d.ts +6 -0
- package/dist/es/hooks/usePaymentQr.js +52 -0
- package/dist/es/hooks/usePaymentRedirect.d.ts +5 -0
- package/dist/es/hooks/usePaymentRedirect.js +83 -0
- package/dist/es/icons/IconCheck/index.d.ts +4 -0
- package/dist/es/icons/IconCheck/index.js +22 -0
- package/dist/es/icons/IconCopy/index.d.ts +4 -0
- package/dist/es/icons/IconCopy/index.js +27 -0
- package/dist/es/icons/IconPix/index.d.ts +4 -0
- package/dist/es/icons/IconPix/index.js +33 -0
- package/dist/es/icons/index.d.ts +3 -0
- package/dist/es/icons/index.js +4 -1
- package/dist/es/index.d.ts +50 -6
- package/dist/es/index.js +28 -1
- package/dist/es/pay-modal/interface.d.ts +22 -2
- package/dist/es/pay-modal/pay-modal.js +36 -16
- package/dist/es/pay-modal/style/index.css +2 -2
- package/dist/es/pay-modal/style/index.min.css +1 -1
- package/dist/es/shared/entitys/payment.d.ts +227 -0
- package/dist/es/shared/entitys/payment.js +75 -0
- package/dist/es/shared/enums/index.d.ts +1 -78
- package/dist/es/shared/enums/index.js +1 -81
- package/dist/es/shared/enums/payment.d.ts +162 -0
- package/dist/es/shared/enums/payment.js +168 -0
- package/dist/es/shared/index.d.ts +2 -0
- package/dist/es/shared/index.js +2 -1
- package/dist/lib/Airwallex/airwallex-button.js +31 -10
- package/dist/lib/Airwallex/airwallex-checkout-button.js +52 -0
- package/dist/lib/Airwallex/airwallex-managed.js +86 -0
- package/dist/lib/Airwallex/airwallex-modal.js +4 -2
- package/dist/lib/Airwallex/airwallex-popup.js +4 -2
- package/dist/lib/Airwallex/airwallex.js +9 -1
- package/dist/lib/Airwallex/hooks/useAirwallexCheckout.js +83 -0
- package/dist/lib/Airwallex/index.js +18 -1
- package/dist/lib/Airwallex/style/index.css +2 -2
- package/dist/lib/Airwallex/style/index.min.css +1 -1
- package/dist/lib/Alipay/alipay-button.js +21 -6
- package/dist/lib/Alipay/alipay.js +36 -9
- package/dist/lib/Alipay/style/index.css +2 -2
- package/dist/lib/Alipay/style/index.min.css +1 -1
- package/dist/lib/MAlipay/style/index.css +2 -2
- package/dist/lib/MAlipay/style/index.min.css +1 -1
- package/dist/lib/MPix/index.js +28 -0
- package/dist/lib/MPix/interface.js +5 -0
- package/dist/lib/MPix/m-pix-button.js +127 -0
- package/dist/lib/MPix/style/index.css +256 -0
- package/dist/lib/MPix/style/index.js +3 -0
- package/dist/lib/MPix/style/index.min.css +1 -0
- package/dist/lib/MWeChat/style/index.css +2 -2
- package/dist/lib/MWeChat/style/index.min.css +1 -1
- package/dist/lib/PayButton/index.js +12 -0
- package/dist/lib/Paypal/index.js +17 -1
- package/dist/lib/Paypal/paypal-button.js +19 -2
- package/dist/lib/Paypal/paypal-smart-button.js +45 -0
- package/dist/lib/Payssion/payssion-button.js +20 -3
- package/dist/lib/Pix/index.js +43 -0
- package/dist/lib/Pix/interface.js +5 -0
- package/dist/lib/Pix/pix-button.js +83 -0
- package/dist/lib/Pix/pix-enhanced.js +143 -0
- package/dist/lib/Pix/pix-modal.js +50 -0
- package/dist/lib/Pix/pix.js +97 -0
- package/dist/lib/Pix/style/index.css +80 -0
- package/dist/lib/Pix/style/index.js +3 -0
- package/dist/lib/Pix/style/index.min.css +1 -0
- package/dist/lib/Stripe/hooks/useStripeCheckout.js +41 -0
- package/dist/lib/Stripe/index.js +18 -1
- package/dist/lib/Stripe/stripe-button.js +28 -10
- package/dist/lib/Stripe/stripe-checkout-button.js +50 -0
- package/dist/lib/Stripe/stripe-modal.js +12 -1
- package/dist/lib/Stripe/stripe-popup.js +12 -1
- package/dist/lib/Stripe/stripe.js +30 -1
- package/dist/lib/Stripe/style/index.css +2 -2
- package/dist/lib/Stripe/style/index.min.css +1 -1
- package/dist/lib/Wechat/style/index.css +2 -2
- package/dist/lib/Wechat/style/index.min.css +1 -1
- package/dist/lib/Wechat/wechat-button.js +21 -6
- package/dist/lib/Wechat/wechat-content.js +65 -0
- package/dist/lib/Wechat/wechat.js +3 -1
- package/dist/lib/confirm-modal/style/index.css +2 -2
- package/dist/lib/confirm-modal/style/index.min.css +1 -1
- package/dist/lib/hooks/useLatestCallback.js +13 -0
- package/dist/lib/hooks/useManagedOrder.js +29 -0
- package/dist/lib/hooks/usePaymentExecution.js +113 -0
- package/dist/lib/hooks/usePaymentQr.js +51 -0
- package/dist/lib/hooks/usePaymentRedirect.js +87 -0
- package/dist/lib/icons/IconCheck/index.js +27 -0
- package/dist/lib/icons/IconCopy/index.js +32 -0
- package/dist/lib/icons/IconPix/index.js +38 -0
- package/dist/lib/icons/index.js +25 -1
- package/dist/lib/index.js +86 -1
- package/dist/lib/pay-modal/pay-modal.js +33 -16
- package/dist/lib/pay-modal/style/index.css +2 -2
- package/dist/lib/pay-modal/style/index.min.css +1 -1
- package/dist/lib/shared/entitys/payment.js +61 -0
- package/dist/lib/shared/enums/index.js +11 -81
- package/dist/lib/shared/enums/payment.js +172 -0
- package/dist/lib/shared/index.js +12 -1
- package/dist/umd/pay-sdk-react.umd.js +10455 -11463
- package/dist/umd/pay-sdk-react.umd.js.map +1 -1
- package/package.json +44 -25
package/dist/css/index.css
CHANGED
|
@@ -558,7 +558,7 @@
|
|
|
558
558
|
max-width: 80vw;
|
|
559
559
|
box-shadow: 0 4px 24px #0001;
|
|
560
560
|
text-align: center;
|
|
561
|
-
max-height:
|
|
561
|
+
max-height: 80vh;
|
|
562
562
|
display: flex;
|
|
563
563
|
flex-direction: column;
|
|
564
564
|
}
|
|
@@ -598,7 +598,7 @@
|
|
|
598
598
|
z-index: 1;
|
|
599
599
|
text-align: center;
|
|
600
600
|
overflow-y: auto;
|
|
601
|
-
flex: 1;
|
|
601
|
+
flex: 0 1 auto;
|
|
602
602
|
min-height: 0;
|
|
603
603
|
}
|
|
604
604
|
.pay-modal__actions {
|
|
@@ -669,8 +669,8 @@
|
|
|
669
669
|
}
|
|
670
670
|
.pay-alipay-qr-iframe__iframe {
|
|
671
671
|
border: none;
|
|
672
|
-
width:
|
|
673
|
-
height:
|
|
672
|
+
width: 180px;
|
|
673
|
+
height: 180px;
|
|
674
674
|
margin-top: 10px;
|
|
675
675
|
margin-bottom: 8px;
|
|
676
676
|
}
|
|
@@ -691,8 +691,8 @@
|
|
|
691
691
|
display: flex;
|
|
692
692
|
justify-content: center;
|
|
693
693
|
align-items: center;
|
|
694
|
-
width:
|
|
695
|
-
height:
|
|
694
|
+
width: 180px;
|
|
695
|
+
height: 180px;
|
|
696
696
|
}
|
|
697
697
|
.pay-wechat-qrcode__image {
|
|
698
698
|
width: 100%;
|
|
@@ -705,3 +705,83 @@
|
|
|
705
705
|
font-size: 14px;
|
|
706
706
|
line-height: 20px;
|
|
707
707
|
}
|
|
708
|
+
.pay-pix-qrcode {
|
|
709
|
+
display: flex;
|
|
710
|
+
flex-direction: column;
|
|
711
|
+
align-items: center;
|
|
712
|
+
}
|
|
713
|
+
.pay-pix-qrcode__container {
|
|
714
|
+
background-color: #fff;
|
|
715
|
+
border-radius: 8px;
|
|
716
|
+
display: flex;
|
|
717
|
+
justify-content: center;
|
|
718
|
+
align-items: center;
|
|
719
|
+
width: 180px;
|
|
720
|
+
height: 180px;
|
|
721
|
+
}
|
|
722
|
+
.pay-pix-qrcode__image {
|
|
723
|
+
width: 100%;
|
|
724
|
+
height: 100%;
|
|
725
|
+
object-fit: cover;
|
|
726
|
+
}
|
|
727
|
+
.pay-pix-qrcode__tip {
|
|
728
|
+
text-align: center;
|
|
729
|
+
color: #333;
|
|
730
|
+
font-size: 14px;
|
|
731
|
+
line-height: 20px;
|
|
732
|
+
margin-top: 12px;
|
|
733
|
+
}
|
|
734
|
+
.pay-pix-qrcode__code-section {
|
|
735
|
+
width: 100%;
|
|
736
|
+
max-width: 320px;
|
|
737
|
+
margin-top: 16px;
|
|
738
|
+
}
|
|
739
|
+
.pay-pix-qrcode__copy-btn {
|
|
740
|
+
width: 100%;
|
|
741
|
+
padding: 10px 16px;
|
|
742
|
+
border: 1px solid #32bcad;
|
|
743
|
+
background-color: #fff;
|
|
744
|
+
color: #32bcad;
|
|
745
|
+
border-radius: 8px;
|
|
746
|
+
font-size: 13px;
|
|
747
|
+
font-weight: 600;
|
|
748
|
+
cursor: pointer;
|
|
749
|
+
transition: all 0.2s ease;
|
|
750
|
+
display: flex;
|
|
751
|
+
align-items: center;
|
|
752
|
+
justify-content: center;
|
|
753
|
+
gap: 6px;
|
|
754
|
+
}
|
|
755
|
+
.pay-pix-qrcode__copy-btn:hover {
|
|
756
|
+
background-color: rgba(50, 188, 173, 0.06);
|
|
757
|
+
}
|
|
758
|
+
.pay-pix-qrcode__copy-btn:active {
|
|
759
|
+
background-color: rgba(50, 188, 173, 0.12);
|
|
760
|
+
}
|
|
761
|
+
.pay-pix-qrcode__copy-btn--copied {
|
|
762
|
+
color: #2ecc71;
|
|
763
|
+
border-color: #2ecc71;
|
|
764
|
+
background-color: rgba(46, 204, 113, 0.04);
|
|
765
|
+
}
|
|
766
|
+
.pay-pix-qrcode__copy-btn--copied:hover {
|
|
767
|
+
background-color: rgba(46, 204, 113, 0.08);
|
|
768
|
+
}
|
|
769
|
+
.pay-pix-qrcode__copy-btn--copied:active {
|
|
770
|
+
background-color: rgba(46, 204, 113, 0.14);
|
|
771
|
+
}
|
|
772
|
+
.pay-pix-qrcode__copy-icon {
|
|
773
|
+
width: 16px;
|
|
774
|
+
height: 16px;
|
|
775
|
+
flex-shrink: 0;
|
|
776
|
+
}
|
|
777
|
+
.pay-pix-qrcode__code {
|
|
778
|
+
display: block;
|
|
779
|
+
max-width: 100%;
|
|
780
|
+
overflow-wrap: anywhere;
|
|
781
|
+
padding: 8px;
|
|
782
|
+
}
|
|
783
|
+
.pay-pix-qrcode__confirm-btn {
|
|
784
|
+
cursor: pointer;
|
|
785
|
+
margin-top: 12px;
|
|
786
|
+
padding: 8px 16px;
|
|
787
|
+
}
|
package/dist/css/index.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.pay-dot-loading{display:inline-block}.pay-fullscreen-loading{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center;pointer-events:auto;user-select:none}.pay-fullscreen-loading__center{display:flex;flex-direction:column;align-items:center;justify-content:center}.pay-fullscreen-loading__spinner-box{display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(17,17,17,.8);border-radius:16px;transition:width .2s,height .2s;box-sizing:border-box;padding:8px}.pay-fullscreen-loading__spinner-box--no-text{padding:4px}.pay-fullscreen-loading__spinner{margin-bottom:8px}.pay-fullscreen-loading__spinner-box--no-text .pay-fullscreen-loading__spinner{margin-bottom:0}.pay-fullscreen-loading__circle{border:3px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:1.2s linear infinite spin}.pay-fullscreen-loading__text{color:#fff;font-weight:600;letter-spacing:.25px;text-align:center;width:100%;word-break:break-all;line-height:1.2;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.pay-fullscreen-loading__dots{display:flex;align-items:center;gap:10px}.pay-fullscreen-loading__dot{background:#fff;border-radius:50%;animation:.5s ease-in-out infinite bounce}.pay-fullscreen-loading__dot:nth-child(2){animation-delay:.1s}.pay-fullscreen-loading__dot:nth-child(3){animation-delay:.2s}.pay-fullscreen-loading__spin-dots{position:relative;animation:1.2s steps(12) infinite spin}.pay-fullscreen-loading__spin-dot{position:absolute;top:0;left:50%;background:#fff;border-radius:50%}.pay-fullscreen-loading--small .pay-fullscreen-loading__spinner-box{width:88px;height:88px}.pay-fullscreen-loading--small .pay-fullscreen-loading__spinner-box--no-text{width:48px;height:48px}.pay-fullscreen-loading--small .pay-fullscreen-loading__circle{width:24px;height:24px;border-width:3px}.pay-fullscreen-loading--small .pay-fullscreen-loading__text{font-size:14px}.pay-fullscreen-loading--small .pay-fullscreen-loading__dot{width:6px;height:6px}.pay-fullscreen-loading--small .pay-fullscreen-loading__spin-dots{width:28px;height:28px}.pay-fullscreen-loading--small .pay-fullscreen-loading__spin-dot{width:3.5px;height:3.5px;margin-left:-1.75px;transform-origin:50% 14px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spinner-box{width:112px;height:112px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spinner-box--no-text{width:62px;height:62px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__circle{width:36px;height:36px;border-width:4px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__text{font-size:16px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__dot{width:10px;height:10px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spin-dots{width:40px;height:40px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spin-dot{width:4.5px;height:4.5px;margin-left:-2.25px;transform-origin:50% 20px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spinner-box{width:144px;height:144px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spinner-box--no-text{width:80px;height:80px}.pay-fullscreen-loading--large .pay-fullscreen-loading__circle{width:42px;height:42px;border-width:5px}.pay-fullscreen-loading--large .pay-fullscreen-loading__text{font-size:18px}.pay-fullscreen-loading--large .pay-fullscreen-loading__dot{width:12px;height:12px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spin-dots{width:48px;height:48px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spin-dot{width:5.5px;height:5.5px;margin-left:-2.75px;transform-origin:50% 24px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spinner-box{width:100px;height:100px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spinner-box--no-text{width:56px;height:56px}.pay-fullscreen-loading--default .pay-fullscreen-loading__circle{width:32px;height:32px;border-width:4px}.pay-fullscreen-loading--default .pay-fullscreen-loading__text{font-size:16px}.pay-fullscreen-loading--default .pay-fullscreen-loading__dot{width:9px;height:9px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spin-dots{width:32px;height:32px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spin-dot{width:4px;height:4px;margin-left:-2px;transform-origin:50% 16px}.pay-fullscreen-loading__container{position:relative;display:block}.pay-fullscreen-loading__mask{position:absolute;left:0;top:0;right:0;bottom:0;background:hsla(0,0%,100%,.8);z-index:10;display:flex;align-items:center;justify-content:center}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes bounce{0%,100%{transform:translateY(0)}50%{transform:translateY(-12px)}}.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:.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-popup{position:fixed;z-index:1001}.pay-popup-body{position:fixed;display:flex;flex-direction:column;background-color:#fff;z-index:1010;box-sizing:border-box}.pay-popup-body.pay-popup-body-position-bottom{width:100%;left:0;bottom:0}.pay-popup-body.pay-popup-body-position-top{width:100%;left:0;top:0}.pay-popup-body.pay-popup-body-position-left{height:100%;width:80vw;left:0;top:0}.pay-popup-body.pay-popup-body-position-right{height:100%;width:80vw;right:0;top:0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-bottom{border-radius:16px 16px 0 0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-top{border-radius:0 0 16px 16px}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-left{border-radius:0 16px 16px 0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-right{border-radius:16px 0 0 16px}.pay-popup-close-icon{position:absolute;z-index:1;cursor:pointer;padding:4px;font-size:18px;line-height:1;color:#999}.pay-popup-body.pay-popup-body-position-bottom .pay-popup-close-icon,.pay-popup-body.pay-popup-body-position-left .pay-popup-close-icon{top:8px;right:8px}.pay-popup-body.pay-popup-body-position-top .pay-popup-close-icon{bottom:8px;right:8px}.pay-popup-body.pay-popup-body-position-right .pay-popup-close-icon{top:8px;left:8px}.pay-popup-content{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-bottom .pay-popup-content,.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-left .pay-popup-content{padding-top:40px}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-right .pay-popup-content{padding-top:40px}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-top .pay-popup-content{padding-bottom:40px}.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-mask{position:fixed;z-index:1000;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.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;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:32px;font-weight:500;line-height:32px;cursor:pointer;text-align:left}.pay-modal__icon{display:flex;justify-content:center;margin-bottom:8px;font-size:40px}.pay-modal__title{font-size:20px;font-weight:700;color:#222;margin-bottom:12px}.pay-modal__desc{color:#222;font-size:15px;margin-bottom:24px;line-height:1.7;text-align:left}.pay-modal__content-wrapper{position:relative;z-index:1;text-align:center;overflow-y:auto;flex:1;min-height:0}.pay-modal__actions{display:flex;justify-content:center;gap:16px;margin-top:16px}.pay-modal__btn{min-width:96px;padding:8px 0;border-radius:24px;border:none;font-size:15px;font-weight:600;cursor:pointer;transition:background .2s}.pay-modal__btn--retry{background:#fff;color:#f25a5a;border:1.5px solid #f25a5a}.pay-modal__btn--finish{background:#f25a5a;color:#fff;border:none}.pay-paypal-btn.pay-button>span{display:flex;align-items:center;gap:.5rem}@media (min-width:576px){.pay-stripe-modal.pay-modal .pay-modal__content{width:72%}}@media (min-width:768px){.pay-stripe-modal.pay-modal .pay-modal__content{width:50%}}@media (min-width:992px){.pay-stripe-modal.pay-modal .pay-modal__content{width:40%}}@media (min-width:1200px){.pay-stripe-modal.pay-modal .pay-modal__content{width:27%}}@media (min-width:1600px){.pay-stripe-modal.pay-modal .pay-modal__content{width:26%}}@media (min-width:2000px){.pay-stripe-modal.pay-modal .pay-modal__content{width:20%}}.pay-alipay-qr-iframe{display:flex;flex-direction:column;align-items:center}.pay-alipay-qr-iframe__iframe{border:none;width:210px;height:210px;margin-top:10px;margin-bottom:8px}.pay-alipay-qr-iframe__tip{text-align:center;color:#333;font-size:14px;line-height:20px}.pay-wechat-qrcode{display:flex;flex-direction:column;align-items:center}.pay-wechat-qrcode__container{background-color:#fff;border-radius:8px;display:flex;justify-content:center;align-items:center;width:210px;height:210px}.pay-wechat-qrcode__image{width:100%;height:100%;object-fit:cover}.pay-wechat-qrcode__tip{text-align:center;color:#333;font-size:14px;line-height:20px}
|
|
1
|
+
.pay-dot-loading{display:inline-block}.pay-fullscreen-loading{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;background:hsla(0,0%,100%,.8);display:flex;align-items:center;justify-content:center;pointer-events:auto;user-select:none}.pay-fullscreen-loading__center{display:flex;flex-direction:column;align-items:center;justify-content:center}.pay-fullscreen-loading__spinner-box{display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(17,17,17,.8);border-radius:16px;transition:width .2s,height .2s;box-sizing:border-box;padding:8px}.pay-fullscreen-loading__spinner-box--no-text{padding:4px}.pay-fullscreen-loading__spinner{margin-bottom:8px}.pay-fullscreen-loading__spinner-box--no-text .pay-fullscreen-loading__spinner{margin-bottom:0}.pay-fullscreen-loading__circle{border:3px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:1.2s linear infinite spin}.pay-fullscreen-loading__text{color:#fff;font-weight:600;letter-spacing:.25px;text-align:center;width:100%;word-break:break-all;line-height:1.2;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.pay-fullscreen-loading__dots{display:flex;align-items:center;gap:10px}.pay-fullscreen-loading__dot{background:#fff;border-radius:50%;animation:.5s ease-in-out infinite bounce}.pay-fullscreen-loading__dot:nth-child(2){animation-delay:.1s}.pay-fullscreen-loading__dot:nth-child(3){animation-delay:.2s}.pay-fullscreen-loading__spin-dots{position:relative;animation:1.2s steps(12) infinite spin}.pay-fullscreen-loading__spin-dot{position:absolute;top:0;left:50%;background:#fff;border-radius:50%}.pay-fullscreen-loading--small .pay-fullscreen-loading__spinner-box{width:88px;height:88px}.pay-fullscreen-loading--small .pay-fullscreen-loading__spinner-box--no-text{width:48px;height:48px}.pay-fullscreen-loading--small .pay-fullscreen-loading__circle{width:24px;height:24px;border-width:3px}.pay-fullscreen-loading--small .pay-fullscreen-loading__text{font-size:14px}.pay-fullscreen-loading--small .pay-fullscreen-loading__dot{width:6px;height:6px}.pay-fullscreen-loading--small .pay-fullscreen-loading__spin-dots{width:28px;height:28px}.pay-fullscreen-loading--small .pay-fullscreen-loading__spin-dot{width:3.5px;height:3.5px;margin-left:-1.75px;transform-origin:50% 14px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spinner-box{width:112px;height:112px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spinner-box--no-text{width:62px;height:62px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__circle{width:36px;height:36px;border-width:4px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__text{font-size:16px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__dot{width:10px;height:10px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spin-dots{width:40px;height:40px}.pay-fullscreen-loading--medium .pay-fullscreen-loading__spin-dot{width:4.5px;height:4.5px;margin-left:-2.25px;transform-origin:50% 20px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spinner-box{width:144px;height:144px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spinner-box--no-text{width:80px;height:80px}.pay-fullscreen-loading--large .pay-fullscreen-loading__circle{width:42px;height:42px;border-width:5px}.pay-fullscreen-loading--large .pay-fullscreen-loading__text{font-size:18px}.pay-fullscreen-loading--large .pay-fullscreen-loading__dot{width:12px;height:12px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spin-dots{width:48px;height:48px}.pay-fullscreen-loading--large .pay-fullscreen-loading__spin-dot{width:5.5px;height:5.5px;margin-left:-2.75px;transform-origin:50% 24px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spinner-box{width:100px;height:100px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spinner-box--no-text{width:56px;height:56px}.pay-fullscreen-loading--default .pay-fullscreen-loading__circle{width:32px;height:32px;border-width:4px}.pay-fullscreen-loading--default .pay-fullscreen-loading__text{font-size:16px}.pay-fullscreen-loading--default .pay-fullscreen-loading__dot{width:9px;height:9px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spin-dots{width:32px;height:32px}.pay-fullscreen-loading--default .pay-fullscreen-loading__spin-dot{width:4px;height:4px;margin-left:-2px;transform-origin:50% 16px}.pay-fullscreen-loading__container{position:relative;display:block}.pay-fullscreen-loading__mask{position:absolute;left:0;top:0;right:0;bottom:0;background:hsla(0,0%,100%,.8);z-index:10;display:flex;align-items:center;justify-content:center}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes bounce{0%,100%{transform:translateY(0)}50%{transform:translateY(-12px)}}.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:.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-popup{position:fixed;z-index:1001}.pay-popup-body{position:fixed;display:flex;flex-direction:column;background-color:#fff;z-index:1010;box-sizing:border-box}.pay-popup-body.pay-popup-body-position-bottom{width:100%;left:0;bottom:0}.pay-popup-body.pay-popup-body-position-top{width:100%;left:0;top:0}.pay-popup-body.pay-popup-body-position-left{height:100%;width:80vw;left:0;top:0}.pay-popup-body.pay-popup-body-position-right{height:100%;width:80vw;right:0;top:0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-bottom{border-radius:16px 16px 0 0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-top{border-radius:0 0 16px 16px}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-left{border-radius:0 16px 16px 0}.pay-popup-body.pay-popup-body-round.pay-popup-body-position-right{border-radius:16px 0 0 16px}.pay-popup-close-icon{position:absolute;z-index:1;cursor:pointer;padding:4px;font-size:18px;line-height:1;color:#999}.pay-popup-body.pay-popup-body-position-bottom .pay-popup-close-icon,.pay-popup-body.pay-popup-body-position-left .pay-popup-close-icon{top:8px;right:8px}.pay-popup-body.pay-popup-body-position-top .pay-popup-close-icon{bottom:8px;right:8px}.pay-popup-body.pay-popup-body-position-right .pay-popup-close-icon{top:8px;left:8px}.pay-popup-content{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-bottom .pay-popup-content,.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-left .pay-popup-content{padding-top:40px}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-right .pay-popup-content{padding-top:40px}.pay-popup-body.pay-popup-body-with-close.pay-popup-body-position-top .pay-popup-content{padding-bottom:40px}.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-mask{position:fixed;z-index:1000;left:0;top:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.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;min-width:280px;max-width:80vw;box-shadow:0 4px 24px #0001;text-align:center;max-height:80vh;display:flex;flex-direction:column}.pay-modal__close{position:absolute;right:12px;top:12px;background:0 0;border:none;font-size:32px;font-weight:500;line-height:32px;cursor:pointer;text-align:left}.pay-modal__icon{display:flex;justify-content:center;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:0 1 auto;min-height:0}.pay-modal__actions{display:flex;justify-content:center;gap:16px;margin-top:16px}.pay-modal__btn{min-width:96px;padding:8px 0;border-radius:24px;border:none;font-size:15px;font-weight:600;cursor:pointer;transition:background .2s}.pay-modal__btn--retry{background:#fff;color:#f25a5a;border:1.5px solid #f25a5a}.pay-modal__btn--finish{background:#f25a5a;color:#fff;border:none}.pay-paypal-btn.pay-button>span{display:flex;align-items:center;gap:.5rem}@media (min-width:576px){.pay-stripe-modal.pay-modal .pay-modal__content{width:72%}}@media (min-width:768px){.pay-stripe-modal.pay-modal .pay-modal__content{width:50%}}@media (min-width:992px){.pay-stripe-modal.pay-modal .pay-modal__content{width:40%}}@media (min-width:1200px){.pay-stripe-modal.pay-modal .pay-modal__content{width:27%}}@media (min-width:1600px){.pay-stripe-modal.pay-modal .pay-modal__content{width:26%}}@media (min-width:2000px){.pay-stripe-modal.pay-modal .pay-modal__content{width:20%}}.pay-alipay-qr-iframe{display:flex;flex-direction:column;align-items:center}.pay-alipay-qr-iframe__iframe{border:none;width:180px;height:180px;margin-top:10px;margin-bottom:8px}.pay-alipay-qr-iframe__tip{text-align:center;color:#333;font-size:14px;line-height:20px}.pay-wechat-qrcode{display:flex;flex-direction:column;align-items:center}.pay-wechat-qrcode__container{background-color:#fff;border-radius:8px;display:flex;justify-content:center;align-items:center;width:180px;height:180px}.pay-wechat-qrcode__image{width:100%;height:100%;object-fit:cover}.pay-wechat-qrcode__tip{text-align:center;color:#333;font-size:14px;line-height:20px}.pay-pix-qrcode{display:flex;flex-direction:column;align-items:center}.pay-pix-qrcode__container{background-color:#fff;border-radius:8px;display:flex;justify-content:center;align-items:center;width:180px;height:180px}.pay-pix-qrcode__image{width:100%;height:100%;object-fit:cover}.pay-pix-qrcode__tip{text-align:center;color:#333;font-size:14px;line-height:20px;margin-top:12px}.pay-pix-qrcode__code-section{width:100%;max-width:320px;margin-top:16px}.pay-pix-qrcode__copy-btn{width:100%;padding:10px 16px;border:1px solid #32bcad;background-color:#fff;color:#32bcad;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;transition:.2s;display:flex;align-items:center;justify-content:center;gap:6px}.pay-pix-qrcode__copy-btn:hover{background-color:rgba(50,188,173,.06)}.pay-pix-qrcode__copy-btn:active{background-color:rgba(50,188,173,.12)}.pay-pix-qrcode__copy-btn--copied{color:#2ecc71;border-color:#2ecc71;background-color:rgba(46,204,113,.04)}.pay-pix-qrcode__copy-btn--copied:hover{background-color:rgba(46,204,113,.08)}.pay-pix-qrcode__copy-btn--copied:active{background-color:rgba(46,204,113,.14)}.pay-pix-qrcode__copy-icon{width:16px;height:16px;flex-shrink:0}.pay-pix-qrcode__code{display:block;max-width:100%;overflow-wrap:anywhere;padding:8px}.pay-pix-qrcode__confirm-btn{cursor:pointer;margin-top:12px;padding:8px 16px}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children", "onClick", "createOrder"];
|
|
1
|
+
var _excluded = ["children", "onClick", "createOrder", "executionOptions"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
4
4
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
|
|
@@ -12,6 +12,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
12
12
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
|
+
import { useManagedOrder } from '../hooks/useManagedOrder';
|
|
15
16
|
import React, { forwardRef, memo, useCallback, useImperativeHandle, useRef, useState } from 'react';
|
|
16
17
|
import AirwallexPopup from './airwallex-popup';
|
|
17
18
|
import AirwallexModal from './airwallex-modal';
|
|
@@ -23,6 +24,7 @@ var AirwallexButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
23
24
|
children = _props$children === void 0 ? 'Airwallex' : _props$children,
|
|
24
25
|
onClick = props.onClick,
|
|
25
26
|
createOrder = props.createOrder,
|
|
27
|
+
executionOptions = props.executionOptions,
|
|
26
28
|
others = _objectWithoutProperties(props, _excluded);
|
|
27
29
|
var airwallexButtonRef = useRef(null);
|
|
28
30
|
var airwallexPopupRef = useRef(null);
|
|
@@ -47,6 +49,7 @@ var AirwallexButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
47
49
|
},
|
|
48
50
|
closeModal: function closeModal() {
|
|
49
51
|
var _airwallexModalRef$cu2;
|
|
52
|
+
if (executionOptions) managed.cancel();
|
|
50
53
|
(_airwallexModalRef$cu2 = airwallexModalRef.current) === null || _airwallexModalRef$cu2 === void 0 || _airwallexModalRef$cu2.close();
|
|
51
54
|
},
|
|
52
55
|
openPopup: function openPopup(options) {
|
|
@@ -55,6 +58,7 @@ var AirwallexButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
55
58
|
},
|
|
56
59
|
closePopup: function closePopup() {
|
|
57
60
|
var _airwallexPopupRef$cu2;
|
|
61
|
+
if (executionOptions) managed.cancel();
|
|
58
62
|
(_airwallexPopupRef$cu2 = airwallexPopupRef.current) === null || _airwallexPopupRef$cu2 === void 0 || _airwallexPopupRef$cu2.close();
|
|
59
63
|
},
|
|
60
64
|
openPayment: function openPayment(options) {
|
|
@@ -64,30 +68,50 @@ var AirwallexButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
64
68
|
}
|
|
65
69
|
},
|
|
66
70
|
closePayment: function closePayment() {
|
|
71
|
+
if (executionOptions) managed.cancel();
|
|
67
72
|
setShowMask(false);
|
|
68
73
|
},
|
|
69
74
|
current: airwallexButtonRef.current
|
|
70
75
|
};
|
|
71
76
|
});
|
|
72
|
-
var
|
|
73
|
-
var options, _airwallexModalRef$cu3, _airwallexPopupRef$cu3;
|
|
77
|
+
var managed = useManagedOrder(createOrder ? /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
74
78
|
return _regenerator().w(function (_context) {
|
|
75
79
|
while (1) switch (_context.n) {
|
|
80
|
+
case 0:
|
|
81
|
+
return _context.a(2, createOrder());
|
|
82
|
+
}
|
|
83
|
+
}, _callee);
|
|
84
|
+
})) : undefined, function (target) {
|
|
85
|
+
if (props.payMode === 'embedded') {
|
|
86
|
+
var _airwallexModalRef$cu3, _airwallexPopupRef$cu3;
|
|
87
|
+
if (props.displayType === 'modal') (_airwallexModalRef$cu3 = airwallexModalRef.current) === null || _airwallexModalRef$cu3 === void 0 || _airwallexModalRef$cu3.open(target);else (_airwallexPopupRef$cu3 = airwallexPopupRef.current) === null || _airwallexPopupRef$cu3 === void 0 || _airwallexPopupRef$cu3.open(target);
|
|
88
|
+
} else {
|
|
89
|
+
setAirwallexUrl(target.airwallexUrl);
|
|
90
|
+
setShowMask(true);
|
|
91
|
+
}
|
|
92
|
+
}, executionOptions, function (target) {
|
|
93
|
+
return props.payMode === 'embedded' ? Boolean(target.type && target.options) : typeof target.airwallexUrl === 'string' && Boolean(target.airwallexUrl.trim());
|
|
94
|
+
});
|
|
95
|
+
var managedRun = managed.run;
|
|
96
|
+
var handlePayCreateOrder = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
97
|
+
var options, _airwallexModalRef$cu4, _airwallexPopupRef$cu4;
|
|
98
|
+
return _regenerator().w(function (_context2) {
|
|
99
|
+
while (1) switch (_context2.n) {
|
|
76
100
|
case 0:
|
|
77
101
|
if (!createOrder) {
|
|
78
|
-
|
|
102
|
+
_context2.n = 2;
|
|
79
103
|
break;
|
|
80
104
|
}
|
|
81
|
-
|
|
105
|
+
_context2.n = 1;
|
|
82
106
|
return createOrder();
|
|
83
107
|
case 1:
|
|
84
|
-
options =
|
|
108
|
+
options = _context2.v;
|
|
85
109
|
if (options) {
|
|
86
110
|
if ((props === null || props === void 0 ? void 0 : props.payMode) === 'embedded') {
|
|
87
111
|
if ((props === null || props === void 0 ? void 0 : props.displayType) === 'modal') {
|
|
88
|
-
airwallexModalRef === null || airwallexModalRef === void 0 || (_airwallexModalRef$
|
|
112
|
+
airwallexModalRef === null || airwallexModalRef === void 0 || (_airwallexModalRef$cu4 = airwallexModalRef.current) === null || _airwallexModalRef$cu4 === void 0 || _airwallexModalRef$cu4.open(options);
|
|
89
113
|
} else {
|
|
90
|
-
(_airwallexPopupRef$
|
|
114
|
+
(_airwallexPopupRef$cu4 = airwallexPopupRef.current) === null || _airwallexPopupRef$cu4 === void 0 || _airwallexPopupRef$cu4.open(options);
|
|
91
115
|
}
|
|
92
116
|
} else {
|
|
93
117
|
setShowMask(true);
|
|
@@ -95,13 +119,19 @@ var AirwallexButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
95
119
|
}
|
|
96
120
|
}
|
|
97
121
|
case 2:
|
|
98
|
-
return
|
|
122
|
+
return _context2.a(2);
|
|
99
123
|
}
|
|
100
|
-
},
|
|
124
|
+
}, _callee2);
|
|
101
125
|
})), [createOrder, props]);
|
|
102
126
|
var handleClick = useCallback(function (e) {
|
|
103
127
|
onClick === null || onClick === void 0 || onClick(e);
|
|
104
128
|
if (createOrder) {
|
|
129
|
+
if (executionOptions) {
|
|
130
|
+
if (e.defaultPrevented) return;
|
|
131
|
+
return managedRun().then(function () {
|
|
132
|
+
return undefined;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
105
135
|
handlePayCreateOrder();
|
|
106
136
|
return;
|
|
107
137
|
}
|
|
@@ -109,14 +139,14 @@ var AirwallexButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
109
139
|
if ((props === null || props === void 0 ? void 0 : props.displayType) === 'modal') {
|
|
110
140
|
var _props$modalProps;
|
|
111
141
|
if (props !== null && props !== void 0 && (_props$modalProps = props.modalProps) !== null && _props$modalProps !== void 0 && (_props$modalProps = _props$modalProps.airwallexProps) !== null && _props$modalProps !== void 0 && _props$modalProps.initOptions) {
|
|
112
|
-
var _airwallexModalRef$
|
|
113
|
-
airwallexModalRef === null || airwallexModalRef === void 0 || (_airwallexModalRef$
|
|
142
|
+
var _airwallexModalRef$cu5;
|
|
143
|
+
airwallexModalRef === null || airwallexModalRef === void 0 || (_airwallexModalRef$cu5 = airwallexModalRef.current) === null || _airwallexModalRef$cu5 === void 0 || _airwallexModalRef$cu5.open();
|
|
114
144
|
}
|
|
115
145
|
} else {
|
|
116
146
|
var _props$popupProps;
|
|
117
147
|
if (props !== null && props !== void 0 && (_props$popupProps = props.popupProps) !== null && _props$popupProps !== void 0 && (_props$popupProps = _props$popupProps.airwallexProps) !== null && _props$popupProps !== void 0 && _props$popupProps.initOptions) {
|
|
118
|
-
var _airwallexPopupRef$
|
|
119
|
-
airwallexPopupRef === null || airwallexPopupRef === void 0 || (_airwallexPopupRef$
|
|
148
|
+
var _airwallexPopupRef$cu5;
|
|
149
|
+
airwallexPopupRef === null || airwallexPopupRef === void 0 || (_airwallexPopupRef$cu5 = airwallexPopupRef.current) === null || _airwallexPopupRef$cu5 === void 0 || _airwallexPopupRef$cu5.open();
|
|
120
150
|
}
|
|
121
151
|
}
|
|
122
152
|
return;
|
|
@@ -125,11 +155,13 @@ var AirwallexButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
125
155
|
setShowMask(true);
|
|
126
156
|
setAirwallexUrl(props === null || props === void 0 ? void 0 : props.airwallexUrl);
|
|
127
157
|
}
|
|
128
|
-
}, [onClick, createOrder, handlePayCreateOrder, props]);
|
|
158
|
+
}, [executionOptions, managedRun, onClick, createOrder, handlePayCreateOrder, props]);
|
|
129
159
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
130
160
|
ref: airwallexButtonRef,
|
|
131
161
|
onClick: handleClick
|
|
132
|
-
}, omit(others, ['payMode', 'displayType', 'createOrder', 'airwallexUrl', 'maskProps', 'popupProps', 'modalProps'])
|
|
162
|
+
}, omit(others, ['payMode', 'displayType', 'createOrder', 'airwallexUrl', 'maskProps', 'popupProps', 'modalProps']), {
|
|
163
|
+
loading: executionOptions ? managed.loading || others.loading : others.loading
|
|
164
|
+
}), children), (props === null || props === void 0 ? void 0 : props.payMode) === 'embedded' && (props === null || props === void 0 ? void 0 : props.displayType) === 'popup' && /*#__PURE__*/React.createElement(AirwallexPopup, _extends({
|
|
133
165
|
ref: airwallexPopupRef
|
|
134
166
|
}, props === null || props === void 0 ? void 0 : props.popupProps)), (props === null || props === void 0 ? void 0 : props.payMode) === 'embedded' && (props === null || props === void 0 ? void 0 : props.displayType) === 'modal' && /*#__PURE__*/React.createElement(AirwallexModal, _extends({
|
|
135
167
|
ref: airwallexModalRef
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
var _excluded = ["target", "createOrder", "redirectOptions", "initOptions", "beforePay", "onLoadingChange", "onPaymentError", "onCancel", "children", "onClick", "loading"];
|
|
4
|
+
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); }
|
|
5
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
6
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
|
|
7
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
8
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import Button from '../Button';
|
|
13
|
+
import { useAirwallexCheckout } from './hooks/useAirwallexCheckout';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @zh Airwallex 托管支付按钮,复用 useAirwallexCheckout。
|
|
17
|
+
* @en Hosted Airwallex button sharing useAirwallexCheckout.
|
|
18
|
+
* @since 1.2.0
|
|
19
|
+
*/
|
|
20
|
+
var AirwallexCheckoutButton = function AirwallexCheckoutButton(props) {
|
|
21
|
+
var target = props.target,
|
|
22
|
+
createOrder = props.createOrder,
|
|
23
|
+
redirectOptions = props.redirectOptions,
|
|
24
|
+
initOptions = props.initOptions,
|
|
25
|
+
beforePay = props.beforePay,
|
|
26
|
+
onLoadingChange = props.onLoadingChange,
|
|
27
|
+
onPaymentError = props.onPaymentError,
|
|
28
|
+
onCancel = props.onCancel,
|
|
29
|
+
_props$children = props.children,
|
|
30
|
+
children = _props$children === void 0 ? 'Airwallex' : _props$children,
|
|
31
|
+
onClick = props.onClick,
|
|
32
|
+
loading = props.loading,
|
|
33
|
+
buttonProps = _objectWithoutProperties(props, _excluded);
|
|
34
|
+
var checkout = useAirwallexCheckout({
|
|
35
|
+
redirectOptions: redirectOptions,
|
|
36
|
+
initOptions: initOptions,
|
|
37
|
+
beforePay: beforePay,
|
|
38
|
+
onLoadingChange: onLoadingChange,
|
|
39
|
+
onPaymentError: onPaymentError,
|
|
40
|
+
onCancel: onCancel
|
|
41
|
+
});
|
|
42
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, buttonProps, {
|
|
43
|
+
loading: checkout.loading || loading,
|
|
44
|
+
onClick: (/*#__PURE__*/function () {
|
|
45
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
|
|
46
|
+
var _ref2;
|
|
47
|
+
return _regenerator().w(function (_context) {
|
|
48
|
+
while (1) switch (_context.n) {
|
|
49
|
+
case 0:
|
|
50
|
+
event.persist();
|
|
51
|
+
_context.n = 1;
|
|
52
|
+
return onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
53
|
+
case 1:
|
|
54
|
+
if (event.defaultPrevented) {
|
|
55
|
+
_context.n = 2;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
_context.n = 2;
|
|
59
|
+
return checkout.openCheckout((_ref2 = createOrder !== null && createOrder !== void 0 ? createOrder : target) !== null && _ref2 !== void 0 ? _ref2 : {
|
|
60
|
+
url: ''
|
|
61
|
+
});
|
|
62
|
+
case 2:
|
|
63
|
+
return _context.a(2);
|
|
64
|
+
}
|
|
65
|
+
}, _callee);
|
|
66
|
+
}));
|
|
67
|
+
return function (_x) {
|
|
68
|
+
return _ref.apply(this, arguments);
|
|
69
|
+
};
|
|
70
|
+
}())
|
|
71
|
+
}), children);
|
|
72
|
+
};
|
|
73
|
+
export default /*#__PURE__*/React.memo(AirwallexCheckoutButton);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _excluded = ["type", "options", "initOptions", "instanceOptions", "onReady", "onSuccess", "onError", "style"];
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
import React, { useEffect, useImperativeHandle, useRef } from 'react';
|
|
14
|
+
import { loadAirwallex } from 'airwallex-payment-elements';
|
|
15
|
+
var AirwallexManaged = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
16
|
+
var type = props.type,
|
|
17
|
+
options = props.options,
|
|
18
|
+
initOptions = props.initOptions,
|
|
19
|
+
instanceOptions = props.instanceOptions,
|
|
20
|
+
onReady = props.onReady,
|
|
21
|
+
onSuccess = props.onSuccess,
|
|
22
|
+
onError = props.onError,
|
|
23
|
+
style = props.style,
|
|
24
|
+
others = _objectWithoutProperties(props, _excluded);
|
|
25
|
+
var container = useRef(null);
|
|
26
|
+
var latest = useRef(props);
|
|
27
|
+
latest.current = props;
|
|
28
|
+
var configuration = JSON.stringify([type, options, initOptions]);
|
|
29
|
+
useImperativeHandle(ref, function () {
|
|
30
|
+
return container.current;
|
|
31
|
+
});
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
var active = true;
|
|
34
|
+
var element = null;
|
|
35
|
+
var node = container.current;
|
|
36
|
+
if (!node) return;
|
|
37
|
+
var ready = function ready(event) {
|
|
38
|
+
var _latest$current$onRea, _latest$current;
|
|
39
|
+
return (_latest$current$onRea = (_latest$current = latest.current).onReady) === null || _latest$current$onRea === void 0 ? void 0 : _latest$current$onRea.call(_latest$current, event);
|
|
40
|
+
};
|
|
41
|
+
var success = function success(event) {
|
|
42
|
+
var _latest$current$onSuc, _latest$current2;
|
|
43
|
+
return (_latest$current$onSuc = (_latest$current2 = latest.current).onSuccess) === null || _latest$current$onSuc === void 0 ? void 0 : _latest$current$onSuc.call(_latest$current2, event);
|
|
44
|
+
};
|
|
45
|
+
var error = function error(event) {
|
|
46
|
+
var _latest$current$onErr, _latest$current3;
|
|
47
|
+
return (_latest$current$onErr = (_latest$current3 = latest.current).onError) === null || _latest$current$onErr === void 0 ? void 0 : _latest$current$onErr.call(_latest$current3, event);
|
|
48
|
+
};
|
|
49
|
+
node.addEventListener('onReady', ready);
|
|
50
|
+
node.addEventListener('onSuccess', success);
|
|
51
|
+
node.addEventListener('onError', error);
|
|
52
|
+
var snapshot = latest.current;
|
|
53
|
+
loadAirwallex(_objectSpread({
|
|
54
|
+
env: 'demo'
|
|
55
|
+
}, snapshot.initOptions)).then(function (sdk) {
|
|
56
|
+
if (!active || !sdk) return;
|
|
57
|
+
var created = sdk.createElement(snapshot.type, snapshot.options);
|
|
58
|
+
if (!created) throw new Error('Payment element unavailable.');
|
|
59
|
+
element = created;
|
|
60
|
+
created.mount(node);
|
|
61
|
+
}).catch(function () {
|
|
62
|
+
var _latest$current$onErr2, _latest$current4;
|
|
63
|
+
if (active) (_latest$current$onErr2 = (_latest$current4 = latest.current).onError) === null || _latest$current$onErr2 === void 0 || _latest$current$onErr2.call(_latest$current4, new Error('Unable to initialize Airwallex element.'));
|
|
64
|
+
});
|
|
65
|
+
return function () {
|
|
66
|
+
var _element;
|
|
67
|
+
active = false;
|
|
68
|
+
node.removeEventListener('onReady', ready);
|
|
69
|
+
node.removeEventListener('onSuccess', success);
|
|
70
|
+
node.removeEventListener('onError', error);
|
|
71
|
+
(_element = element) === null || _element === void 0 || _element.unmount();
|
|
72
|
+
};
|
|
73
|
+
}, [configuration]);
|
|
74
|
+
// callbacks are read through latest; keep them out of the DOM.
|
|
75
|
+
void onReady;
|
|
76
|
+
void onSuccess;
|
|
77
|
+
void onError;
|
|
78
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, others, {
|
|
79
|
+
ref: container,
|
|
80
|
+
id: instanceOptions === null || instanceOptions === void 0 ? void 0 : instanceOptions.containerId,
|
|
81
|
+
style: _objectSpread({
|
|
82
|
+
width: '100%'
|
|
83
|
+
}, style)
|
|
84
|
+
}));
|
|
85
|
+
});
|
|
86
|
+
AirwallexManaged.displayName = 'AirwallexManaged';
|
|
87
|
+
export default AirwallexManaged;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["airwallexProps", "visible", "onClose", "footer"];
|
|
1
|
+
var _excluded = ["airwallexProps", "visible", "onClose", "closeOnSuccess", "closeOnError", "footer"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
4
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -16,6 +16,10 @@ var AirwallexModal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
16
16
|
var propsAirwallexProps = props.airwallexProps,
|
|
17
17
|
visible = props.visible,
|
|
18
18
|
_onClose = props.onClose,
|
|
19
|
+
_props$closeOnSuccess = props.closeOnSuccess,
|
|
20
|
+
closeOnSuccess = _props$closeOnSuccess === void 0 ? true : _props$closeOnSuccess,
|
|
21
|
+
_props$closeOnError = props.closeOnError,
|
|
22
|
+
closeOnError = _props$closeOnError === void 0 ? true : _props$closeOnError,
|
|
19
23
|
_props$footer = props.footer,
|
|
20
24
|
footer = _props$footer === void 0 ? null : _props$footer,
|
|
21
25
|
rest = _objectWithoutProperties(props, _excluded);
|
|
@@ -58,14 +62,14 @@ var AirwallexModal = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
58
62
|
}, rest), _airwallexProps && /*#__PURE__*/React.createElement(Airwallex, _extends({
|
|
59
63
|
onSuccess: function onSuccess(event) {
|
|
60
64
|
var _airwallexProps$onSuc;
|
|
61
|
-
if (!isControlled) {
|
|
65
|
+
if (closeOnSuccess && !isControlled) {
|
|
62
66
|
setUncontrolledVisible(false);
|
|
63
67
|
}
|
|
64
68
|
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onSuc = _airwallexProps.onSuccess) === null || _airwallexProps$onSuc === void 0 || _airwallexProps$onSuc.call(_airwallexProps, event);
|
|
65
69
|
},
|
|
66
70
|
onError: function onError(event) {
|
|
67
71
|
var _airwallexProps$onErr;
|
|
68
|
-
if (!isControlled) {
|
|
72
|
+
if (closeOnError && !isControlled) {
|
|
69
73
|
setUncontrolledVisible(false);
|
|
70
74
|
}
|
|
71
75
|
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onErr = _airwallexProps.onError) === null || _airwallexProps$onErr === void 0 || _airwallexProps$onErr.call(_airwallexProps, event);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["visible", "onClose", "closeOnMaskClick", "bodyStyle", "airwallexProps"];
|
|
2
|
+
var _excluded = ["visible", "onClose", "closeOnSuccess", "closeOnError", "closeOnMaskClick", "bodyStyle", "airwallexProps"];
|
|
3
3
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
@@ -21,6 +21,10 @@ import omit from '../utils/omit';
|
|
|
21
21
|
var AirwallexPopup = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
22
22
|
var controlledVisible = props.visible,
|
|
23
23
|
_onClose = props.onClose,
|
|
24
|
+
_props$closeOnSuccess = props.closeOnSuccess,
|
|
25
|
+
closeOnSuccess = _props$closeOnSuccess === void 0 ? true : _props$closeOnSuccess,
|
|
26
|
+
_props$closeOnError = props.closeOnError,
|
|
27
|
+
closeOnError = _props$closeOnError === void 0 ? true : _props$closeOnError,
|
|
24
28
|
_props$closeOnMaskCli = props.closeOnMaskClick,
|
|
25
29
|
closeOnMaskClick = _props$closeOnMaskCli === void 0 ? true : _props$closeOnMaskCli,
|
|
26
30
|
bodyStyle = props.bodyStyle,
|
|
@@ -70,14 +74,14 @@ var AirwallexPopup = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
70
74
|
}, others), _airwallexProps && /*#__PURE__*/React.createElement(Airwallex, _extends({
|
|
71
75
|
onSuccess: function onSuccess(event) {
|
|
72
76
|
var _airwallexProps$onSuc;
|
|
73
|
-
if (!isControlled) {
|
|
77
|
+
if (closeOnSuccess && !isControlled) {
|
|
74
78
|
setUncontrolledVisible(false);
|
|
75
79
|
}
|
|
76
80
|
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onSuc = _airwallexProps.onSuccess) === null || _airwallexProps$onSuc === void 0 || _airwallexProps$onSuc.call(_airwallexProps, event);
|
|
77
81
|
},
|
|
78
82
|
onError: function onError(event) {
|
|
79
83
|
var _airwallexProps$onErr;
|
|
80
|
-
if (!isControlled) {
|
|
84
|
+
if (closeOnError && !isControlled) {
|
|
81
85
|
setUncontrolledVisible(false);
|
|
82
86
|
}
|
|
83
87
|
_airwallexProps === null || _airwallexProps === void 0 || (_airwallexProps$onErr = _airwallexProps.onError) === null || _airwallexProps$onErr === void 0 || _airwallexProps$onErr.call(_airwallexProps, event);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AirwallexProps } from './interface';
|
|
3
|
-
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<AirwallexProps &
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
} & React.RefAttributes<HTMLElement>>>;
|
|
3
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<AirwallexProps & React.RefAttributes<HTMLElement>>>;
|
|
6
4
|
export default _default;
|
|
@@ -9,6 +9,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
11
11
|
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
12
|
+
import AirwallexManaged from './airwallex-managed';
|
|
12
13
|
import { loadAirwallex } from 'airwallex-payment-elements';
|
|
13
14
|
import { clientDocument, off, on } from '../utils/dom';
|
|
14
15
|
var Airwallex = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
@@ -70,4 +71,12 @@ var Airwallex = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
70
71
|
}, others));
|
|
71
72
|
});
|
|
72
73
|
Airwallex.displayName = 'Airwallex';
|
|
73
|
-
|
|
74
|
+
var AirwallexEntry = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
75
|
+
return props.instanceOptions ? /*#__PURE__*/React.createElement(AirwallexManaged, _extends({}, props, {
|
|
76
|
+
ref: ref
|
|
77
|
+
})) : /*#__PURE__*/React.createElement(Airwallex, _extends({}, props, {
|
|
78
|
+
ref: ref
|
|
79
|
+
}));
|
|
80
|
+
});
|
|
81
|
+
AirwallexEntry.displayName = 'AirwallexEntry';
|
|
82
|
+
export default /*#__PURE__*/React.memo(AirwallexEntry);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UseAirwallexCheckoutOptions, UseAirwallexCheckoutReturn } from '../interface';
|
|
2
|
+
/**
|
|
3
|
+
* @zh URL 跳转或官方托管 Checkout;不在挂载时执行。
|
|
4
|
+
* @en URL or official hosted checkout; no mount-time execution.
|
|
5
|
+
* @since 1.2.0
|
|
6
|
+
*/
|
|
7
|
+
export declare const useAirwallexCheckout: (options?: UseAirwallexCheckoutOptions) => UseAirwallexCheckoutReturn;
|