From ca93e8e56dfefd564a2c586d17bf6f2142b51ed7 Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Wed, 9 Oct 2024 14:31:36 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20Remove=20more=20legacy=20code?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../resources/js/ApplepayButton.js | 38 -------------------
1 file changed, 38 deletions(-)
diff --git a/modules/ppcp-applepay/resources/js/ApplepayButton.js b/modules/ppcp-applepay/resources/js/ApplepayButton.js
index d03e21b5f..39dadd9fa 100644
--- a/modules/ppcp-applepay/resources/js/ApplepayButton.js
+++ b/modules/ppcp-applepay/resources/js/ApplepayButton.js
@@ -2,8 +2,6 @@
/* global PayPalCommerceGateway */
import { createAppleErrors } from './Helper/applePayError';
-import { setVisible } from '../../../ppcp-button/resources/js/modules/Helper/Hiding';
-import { setEnabled } from '../../../ppcp-button/resources/js/modules/Helper/ButtonDisabler';
import FormValidator from '../../../ppcp-button/resources/js/modules/Helper/FormValidator';
import ErrorHandler from '../../../ppcp-button/resources/js/modules/ErrorHandler';
import widgetBuilder from '../../../ppcp-button/resources/js/modules/Renderer/WidgetBuilder';
@@ -234,7 +232,6 @@ class ApplePayButton extends PaymentButton {
}
super.init();
- this.initEventHandlers();
if ( this.isSeparateGateway ) {
document
@@ -283,41 +280,6 @@ class ApplePayButton extends PaymentButton {
this.transactionInfo = await this.contextHandler.transactionInfo();
}
- initEventHandlers() {
- const ppcpButtonWrapper = `#${ this.ppcpButtonWrapperId }`;
- const wrapperId = `#${ this.wrapperId }`;
-
- if ( wrapperId === ppcpButtonWrapper ) {
- throw new Error(
- `[ApplePayButton] "wrapper" and "ppcpButtonWrapper" values must differ to avoid infinite loop. Current value: "${ wrapperId }"`
- );
- }
-
- const syncButtonVisibility = () => {
- if ( ! this.isEligible ) {
- return;
- }
-
- const $ppcpButtonWrapper = jQuery( ppcpButtonWrapper );
- setVisible( wrapperId, $ppcpButtonWrapper.is( ':visible' ) );
- setEnabled(
- wrapperId,
- ! $ppcpButtonWrapper.hasClass( 'ppcp-disabled' )
- );
- };
-
- jQuery( document ).on(
- 'ppcp-shown ppcp-hidden ppcp-enabled ppcp-disabled',
- ( ev, data ) => {
- if ( jQuery( data.selector ).is( ppcpButtonWrapper ) ) {
- syncButtonVisibility();
- }
- }
- );
-
- syncButtonVisibility();
- }
-
/**
* Starts an Apple Pay session, which means that the user interacted with the Apple Pay button.
*