woocommerce-paypal-payments/modules/ppcp-axo/resources/js/boot.js

34 lines
763 B
JavaScript
Raw Normal View History

2024-02-09 17:49:45 +00:00
import AxoManager from "./AxoManager";
2024-02-12 18:06:48 +00:00
import {loadPaypalScript} from "../../../ppcp-button/resources/js/modules/Helper/ScriptLoading";
2024-02-08 14:37:56 +00:00
2024-02-12 18:06:48 +00:00
(function ({
axoConfig,
2024-02-12 18:06:48 +00:00
ppcpConfig,
jQuery
}) {
2024-02-08 14:37:56 +00:00
const bootstrap = () => {
2024-03-25 10:28:15 +00:00
new AxoManager(axoConfig, ppcpConfig);
}
2024-02-12 18:06:48 +00:00
document.addEventListener(
'DOMContentLoaded',
() => {
if (!typeof (PayPalCommerceGateway)) {
console.error('AXO could not be configured.');
return;
}
// Load PayPal
loadPaypalScript(ppcpConfig, () => {
bootstrap();
2024-02-12 18:06:48 +00:00
});
},
);
})({
axoConfig: window.wc_ppcp_axo,
2024-02-12 18:06:48 +00:00
ppcpConfig: window.PayPalCommerceGateway,
jQuery: window.jQuery
});