Fix GooglePay general fixes / improvements

This commit is contained in:
Pedro Silva 2023-09-06 11:55:26 +01:00
parent d6a564f24f
commit 318217acb9
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
9 changed files with 85 additions and 41 deletions

View file

@ -24,6 +24,13 @@ const GooglePayComponent = () => {
manager.init();
};
useEffect(() => {
const bodyClass = 'ppcp-has-googlepay-block';
if (!document.body.classList.contains(bodyClass)) {
document.body.classList.add(bodyClass);
}
}, []);
useEffect(() => {
// Load GooglePay SDK
loadCustomScript({ url: buttonConfig.sdk_url }).then(() => {
@ -44,7 +51,7 @@ const GooglePayComponent = () => {
}, [paypalLoaded, googlePayLoaded]);
return (
<div id={buttonConfig.button.wrapper.replace('#', '')}></div>
<div id={buttonConfig.button.wrapper.replace('#', '')} className="ppcp-button-googlepay"></div>
);
}