Add ButtonModuleWatcher

Adjustments for APM support
This commit is contained in:
Pedro Silva 2023-08-29 15:26:59 +01:00
parent e7e5ebde4e
commit 93afeeba68
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
6 changed files with 59 additions and 14 deletions

View file

@ -2,6 +2,7 @@ import {useEffect, useState} from '@wordpress/element';
import {registerExpressPaymentMethod, registerPaymentMethod} from '@woocommerce/blocks-registry';
import {paypalAddressToWc, paypalOrderToWcAddresses} from "./Helper/Address";
import {loadPaypalScript} from '../../../ppcp-button/resources/js/modules/Helper/ScriptLoading'
import buttonModuleWatcher from "../../../ppcp-button/resources/js/modules/ButtonModuleWatcher";
const config = wc.wcSettings.getSetting('ppcp-gateway_data');
@ -28,6 +29,7 @@ const PayPalComponent = ({
if (!loaded) {
loadPaypalScript(config.scriptData, () => {
setLoaded(true);
buttonModuleWatcher.registerContextBootstrap(config.scriptData.context, this);
});
}
}, [loaded]);