mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
split up where to show the credit cards
This commit is contained in:
parent
bc59efeb3c
commit
9938103edb
9 changed files with 115 additions and 36 deletions
|
@ -20,7 +20,9 @@ class CartBootstrap {
|
|||
}
|
||||
|
||||
shouldRender() {
|
||||
return document.querySelector(this.gateway.button.wrapper) !== null;
|
||||
return document.querySelector(this.gateway.button.wrapper) !==
|
||||
null || document.querySelector(this.gateway.hosted_fields.wrapper) !==
|
||||
null;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -5,9 +5,15 @@ class MiniCartBootstap {
|
|||
constructor(gateway, renderer) {
|
||||
this.gateway = gateway;
|
||||
this.renderer = renderer;
|
||||
this.actionHandler = null;
|
||||
}
|
||||
|
||||
init() {
|
||||
|
||||
this.actionHandler = new CartActionHandler(
|
||||
PayPalCommerceGateway,
|
||||
new ErrorHandler(),
|
||||
);
|
||||
this.render();
|
||||
|
||||
jQuery(document.body).on('wc_fragments_loaded wc_fragments_refreshed', () => {
|
||||
|
@ -17,7 +23,8 @@ class MiniCartBootstap {
|
|||
|
||||
shouldRender() {
|
||||
return document.querySelector(this.gateway.button.mini_cart_wrapper) !==
|
||||
null;
|
||||
null || document.querySelector(this.gateway.hosted_fields.mini_cart_wrapper) !==
|
||||
null;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -25,15 +32,10 @@ class MiniCartBootstap {
|
|||
return;
|
||||
}
|
||||
|
||||
const actionHandler = new CartActionHandler(
|
||||
PayPalCommerceGateway,
|
||||
new ErrorHandler(),
|
||||
);
|
||||
|
||||
this.renderer.render(
|
||||
this.gateway.button.mini_cart_wrapper,
|
||||
null,
|
||||
actionHandler.configuration()
|
||||
this.gateway.hosted_fields.mini_cart_wrapper,
|
||||
this.actionHandler.configuration()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class SingleProductBootstap {
|
|||
return false;
|
||||
}
|
||||
|
||||
return document.querySelector(this.gateway.button.wrapper) !== null;
|
||||
return true;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue