mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 17:51:41 +08:00
🚧 Remove more legacy code
This commit is contained in:
parent
8aa4d47b68
commit
ca93e8e56d
1 changed files with 0 additions and 38 deletions
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue