Skip to content

Commit

Permalink
optmize reCaptcha
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-zhang-awx committed Oct 18, 2024
1 parent 76cf93b commit c060929
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions view/frontend/web/template/payment/express-checkout.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</div>


<div data-role="title" class="express-title">
<div data-role="title" class="express-title" style="display: none;">
<!-- ko i18n: 'Express Checkout' --><!-- /ko -->
</div>

Expand All @@ -23,7 +23,7 @@


<div class="payment-method">
<div class="checkout-agreements checkout-agreements-block">
<div class="checkout-agreements checkout-agreements-block" style="display: none;">
<!-- ko foreach: getRegion('beforeMethods') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
Expand Down

0 comments on commit c060929

Please sign in to comment.