2024-10-09 16:38:11 +02:00
|
|
|
import GooglepayButton from './Block/components/GooglepayButton';
|
|
|
|
import usePayPalScript from './Block/hooks/usePayPalScript';
|
|
|
|
import useGooglepayScript from './Block/hooks/useGooglepayScript';
|
|
|
|
import useGooglepayConfig from './Block/hooks/useGooglepayConfig';
|
|
|
|
|
|
|
|
const GooglepayManagerBlockEditor = ( {
|
|
|
|
namespace,
|
|
|
|
buttonConfig,
|
|
|
|
ppcpConfig,
|
|
|
|
} ) => {
|
|
|
|
const isPayPalLoaded = usePayPalScript( namespace, ppcpConfig );
|
|
|
|
const isGooglepayLoaded = useGooglepayScript(
|
|
|
|
buttonConfig,
|
|
|
|
isPayPalLoaded
|
|
|
|
);
|
|
|
|
const googlepayConfig = useGooglepayConfig( namespace, isGooglepayLoaded );
|
|
|
|
|
|
|
|
if ( ! googlepayConfig ) {
|
|
|
|
return <div>Loading Google Pay...</div>; // Or any other loading indicator
|
2024-07-26 12:39:38 +02:00
|
|
|
}
|
|
|
|
|
2024-10-09 16:38:11 +02:00
|
|
|
return (
|
|
|
|
<GooglepayButton
|
|
|
|
namespace={ namespace }
|
|
|
|
buttonConfig={ buttonConfig }
|
|
|
|
ppcpConfig={ ppcpConfig }
|
|
|
|
googlepayConfig={ googlepayConfig }
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
2024-07-26 12:39:38 +02:00
|
|
|
|
|
|
|
export default GooglepayManagerBlockEditor;
|