Add the UnifiedScriptLoader and usePayPalCommerceGateway hook

This commit is contained in:
Daniel Dudzic 2024-10-07 10:42:56 +02:00
parent 5e1c2a22d2
commit 07bedc4460
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
4 changed files with 111 additions and 5 deletions

View file

@ -1,5 +1,6 @@
import AxoManager from './AxoManager';
import UnifiedScriptLoader from '../../../ppcp-button/resources/js/modules/Helper/UnifiedScriptLoader';
import { log } from './Helper/Debug';
( function ( { axoConfig, ppcpConfig, jQuery } ) {
const namespace = 'ppcpPaypalClassicAxo';
@ -16,11 +17,10 @@ import UnifiedScriptLoader from '../../../ppcp-button/resources/js/modules/Helpe
// Load PayPal
UnifiedScriptLoader.loadPayPalScript( namespace, ppcpConfig )
.then( () => {
console.log( 'PayPal script loaded successfully' );
bootstrap();
} )
.catch( ( error ) => {
console.error( 'Failed to load PayPal script:', error );
log( `Failed to load PayPal script: ${ error }`, 'error' );
} );
} );
} )( {