Merge branch 'trunk' into pcp-475-free-trial

This commit is contained in:
Alex P 2022-04-07 09:42:32 +03:00
commit 0da5758656
11 changed files with 76 additions and 40 deletions

View file

@ -22,10 +22,6 @@ class MiniCartBootstap {
}
shouldRender() {
if (!this.gateway.can_save_vault_token) {
return;
}
return document.querySelector(this.gateway.button.mini_cart_wrapper) !== null
|| document.querySelector(this.gateway.hosted_fields.mini_cart_wrapper) !== null;
}

View file

@ -48,8 +48,8 @@ class SingleProductBootstap {
else if (document.querySelector('form.cart .woocommerce-Price-amount')) {
priceText = document.querySelector('form.cart .woocommerce-Price-amount').innerText;
}
else if (document.querySelector('.woocommerce-Price-amount')) {
priceText = document.querySelector('.woocommerce-Price-amount').innerText;
else if (document.querySelector('.product .woocommerce-Price-amount')) {
priceText = document.querySelector('.product .woocommerce-Price-amount').innerText;
}
const amount = parseFloat(priceText.replace(/([^\d,\.\s]*)/g, ''));
return amount === 0;

View file

@ -218,7 +218,8 @@ class CreditCardRenderer {
}).catch(err => {
this.spinner.unblock();
this.errorHandler.clear();
if (err.details.length > 0) {
if (err.details) {
this.errorHandler.message(err.details.map(d => `${d.issue} ${d.description}`).join('<br/>'), true);
}
});

View file

@ -352,6 +352,29 @@ class SmartButton implements SmartButtonInterface {
);
}
add_action( $this->pay_order_renderer_hook(), array( $this, 'button_renderer' ), 10 );
$not_enabled_on_minicart = $this->settings->has( 'button_mini_cart_enabled' ) &&
! $this->settings->get( 'button_mini_cart_enabled' );
if (
! $not_enabled_on_minicart
) {
add_action(
$this->mini_cart_button_renderer_hook(),
function () {
if ( $this->is_cart_price_total_zero() ) {
return;
}
echo '<p
id="ppc-button-minicart"
class="woocommerce-mini-cart__buttons buttons"
></p>';
},
30
);
}
if ( $this->is_cart_price_total_zero() ) {
return false;
}
@ -372,25 +395,7 @@ class SmartButton implements SmartButtonInterface {
);
}
$not_enabled_on_minicart = $this->settings->has( 'button_mini_cart_enabled' ) &&
! $this->settings->get( 'button_mini_cart_enabled' );
if (
! $not_enabled_on_minicart
) {
add_action(
$this->mini_cart_button_renderer_hook(),
static function () {
echo '<p
id="ppc-button-minicart"
class="woocommerce-mini-cart__buttons buttons"
></p>';
},
30
);
}
add_action( $this->checkout_button_renderer_hook(), array( $this, 'button_renderer' ), 10 );
add_action( $this->pay_order_renderer_hook(), array( $this, 'button_renderer' ), 10 );
return true;
}

View file

@ -26,6 +26,8 @@ class MessagesApply {
'GB',
'FR',
'AU',
'IT',
'ES',
);
/**

View file

@ -23,19 +23,25 @@ class MessagesDisclaimers {
*/
private $disclaimers = array(
'US' => array(
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/us/',
'link' => 'https://developer.paypal.com/docs/checkout/pay-later/us/commerce-platforms/woocommerce/',
),
'GB' => array(
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/uk/',
'link' => 'https://developer.paypal.com/docs/checkout/pay-later/gb/commerce-platforms/woocommerce/',
),
'DE' => array(
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/de/',
'link' => 'https://developer.paypal.com/docs/checkout/pay-later/de/commerce-platforms/woocommerce/',
),
'AU' => array(
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/au/',
'link' => 'https://developer.paypal.com/docs/checkout/pay-later/au/commerce-platforms/woocommerce/',
),
'FR' => array(
'link' => 'https://developer.paypal.com/docs/commerce-platforms/admin-panel/woocommerce/fr/',
'link' => 'https://developer.paypal.com/docs/checkout/pay-later/fr/commerce-platforms/woocommerce/',
),
'IT' => array(
'link' => 'https://developer.paypal.com/docs/checkout/pay-later/it/commerce-platforms/woocommerce/',
),
'ES' => array(
'link' => 'https://developer.paypal.com/docs/checkout/pay-later/es/commerce-platforms/woocommerce/',
),
);