mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
init hosted fields functionality
This commit is contained in:
parent
1225ad83c8
commit
23dd407fc8
21 changed files with 212 additions and 45 deletions
|
@ -1,40 +0,0 @@
|
|||
import ErrorHandler from './ErrorHandler';
|
||||
import CartActionHandler from './CartActionHandler';
|
||||
|
||||
class MiniCartBootstap {
|
||||
constructor(gateway, renderer) {
|
||||
this.gateway = gateway;
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
init() {
|
||||
this.render();
|
||||
|
||||
jQuery(document.body).on('wc_fragments_loaded wc_fragments_refreshed', () => {
|
||||
this.render();
|
||||
});
|
||||
}
|
||||
|
||||
shouldRender() {
|
||||
return document.querySelector(this.gateway.button.mini_cart_wrapper) !==
|
||||
null;
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this.shouldRender()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const actionHandler = new CartActionHandler(
|
||||
PayPalCommerceGateway,
|
||||
new ErrorHandler(),
|
||||
);
|
||||
|
||||
this.renderer.render(
|
||||
this.gateway.button.mini_cart_wrapper,
|
||||
actionHandler.configuration()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default MiniCartBootstap;
|
Loading…
Add table
Add a link
Reference in a new issue