From c0609295bc911cbb674f0ed678797b9f11d48a23 Mon Sep 17 00:00:00 2001 From: leon-zhang-awx Date: Fri, 18 Oct 2024 10:40:20 +0800 Subject: [PATCH] optmize reCaptcha --- .../js/view/payment/method-renderer/express-checkout.js | 7 +++++++ .../js/view/payment/method-renderer/express/applepay.js | 6 ++++++ .../js/view/payment/method-renderer/express/googlepay.js | 2 ++ view/frontend/web/template/payment/express-checkout.html | 4 ++-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/view/frontend/web/js/view/payment/method-renderer/express-checkout.js b/view/frontend/web/js/view/payment/method-renderer/express-checkout.js index 82e005a6..ef2935bb 100644 --- a/view/frontend/web/js/view/payment/method-renderer/express-checkout.js +++ b/view/frontend/web/js/view/payment/method-renderer/express-checkout.js @@ -196,6 +196,13 @@ define( return this.paymentConfig.checkout.indexOf('apple_pay') !== -1; }, + deviceSupportApplePay() { + const APPLE_PAY_VERSION = 4; + return 'ApplePaySession' in window && ApplePaySession.supportsVersion && ApplePaySession.canMakePayments && + ApplePaySession.supportsVersion(APPLE_PAY_VERSION) && + ApplePaySession.canMakePayments() + }, + createPays() { if (this.isGooglePayActive()) { googlepay.create(this); diff --git a/view/frontend/web/js/view/payment/method-renderer/express/applepay.js b/view/frontend/web/js/view/payment/method-renderer/express/applepay.js index 1d4f76d7..59ca088b 100644 --- a/view/frontend/web/js/view/payment/method-renderer/express/applepay.js +++ b/view/frontend/web/js/view/payment/method-renderer/express/applepay.js @@ -34,6 +34,12 @@ define([ let el = this.applepay.mount('awx-apple-pay-' + this.from); el.addEventListener('onReady', (event) => { utils.initCheckoutPageExpressCheckoutClick(); + if (that.deviceSupportApplePay()) { + $(".express-title").show(); + $(".airwallex-express-checkout .checkout-agreements").show(); + } else { + if (!that.isGooglePayActive()) $(".airwallex-recaptcha").hide(); + } }); this.attachEvents(that); utils.loadRecaptcha(that.isShowRecaptcha); diff --git a/view/frontend/web/js/view/payment/method-renderer/express/googlepay.js b/view/frontend/web/js/view/payment/method-renderer/express/googlepay.js index bc795e23..ceed360d 100644 --- a/view/frontend/web/js/view/payment/method-renderer/express/googlepay.js +++ b/view/frontend/web/js/view/payment/method-renderer/express/googlepay.js @@ -22,6 +22,8 @@ define([ let el = this.googlepay.mount('awx-google-pay-' + this.from); el.addEventListener('onReady', (event) => { utils.initCheckoutPageExpressCheckoutClick(); + $(".express-title").show(); + $(".airwallex-express-checkout .checkout-agreements").show(); }); this.attachEvents(that); utils.loadRecaptcha(that.isShowRecaptcha); diff --git a/view/frontend/web/template/payment/express-checkout.html b/view/frontend/web/template/payment/express-checkout.html index 928e8297..c0830c66 100644 --- a/view/frontend/web/template/payment/express-checkout.html +++ b/view/frontend/web/template/payment/express-checkout.html @@ -4,7 +4,7 @@ -
+ @@ -23,7 +23,7 @@
-
+