mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Merge pull request #3180 from woocommerce/PCP-4280-uncaught-type-error-cannot-read-properties-of-null-reading-checked
Uncaught type error cannot read properties of null reading checked (4280)
This commit is contained in:
commit
eb576afc5b
2 changed files with 11 additions and 7 deletions
|
@ -326,9 +326,9 @@ window.ppcp_onboarding_productionCallback = function ( ...args ) {
|
|||
|
||||
isDisconnecting = true;
|
||||
|
||||
const saveButton = document.querySelector( '.woocommerce-save-button' );
|
||||
saveButton.removeAttribute( 'disabled' );
|
||||
saveButton.click();
|
||||
const saveButton = document.querySelector( '.woocommerce-save-button' );
|
||||
saveButton.removeAttribute( 'disabled' );
|
||||
saveButton.click();
|
||||
};
|
||||
|
||||
// Prevent the message about unsaved checkbox/radiobutton when reloading the page.
|
||||
|
@ -345,9 +345,11 @@ window.ppcp_onboarding_productionCallback = function ( ...args ) {
|
|||
|
||||
const sandboxSwitchElement = document.querySelector( '#ppcp-sandbox_on' );
|
||||
|
||||
sandboxSwitchElement?.addEventListener( 'click', () => {
|
||||
document.querySelector( '.woocommerce-save-button' )?.removeAttribute( 'disabled' );
|
||||
});
|
||||
sandboxSwitchElement?.addEventListener( 'click', () => {
|
||||
document
|
||||
.querySelector( '.woocommerce-save-button' )
|
||||
?.removeAttribute( 'disabled' );
|
||||
} );
|
||||
|
||||
const validate = () => {
|
||||
const selectors = sandboxSwitchElement.checked
|
||||
|
@ -389,7 +391,8 @@ window.ppcp_onboarding_productionCallback = function ( ...args ) {
|
|||
|
||||
const isSandboxInBackend =
|
||||
PayPalCommerceGatewayOnboarding.current_env === 'sandbox';
|
||||
if ( sandboxSwitchElement.checked !== isSandboxInBackend ) {
|
||||
|
||||
if ( sandboxSwitchElement?.checked !== isSandboxInBackend ) {
|
||||
sandboxSwitchElement.checked = isSandboxInBackend;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ const defaultPersistent = Object.freeze( {
|
|||
threeDSecure: 'no-3d-secure',
|
||||
fastlaneCardholderName: false,
|
||||
fastlaneDisplayWatermark: false,
|
||||
__meta: false,
|
||||
} );
|
||||
|
||||
// Reducer logic.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue