mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Merge branch 'refs/heads/trunk' into modularity-module-migration
# Conflicts: # composer.lock # modules/ppcp-axo/src/AxoModule.php # modules/ppcp-blocks/src/BlocksModule.php # modules/ppcp-compat/src/CompatModule.php # modules/ppcp-googlepay/src/GooglepayModule.php # modules/ppcp-order-tracking/src/OrderTrackingModule.php # modules/ppcp-wc-subscriptions/src/WcSubscriptionsModule.php
This commit is contained in:
commit
4d9f23e315
301 changed files with 33875 additions and 13196 deletions
|
@ -96,21 +96,21 @@ class OnboardingAssets {
|
|||
*/
|
||||
public function register(): bool {
|
||||
|
||||
$url = untrailingslashit( $this->module_url ) . '/assets/css/onboarding.css';
|
||||
wp_register_style(
|
||||
'ppcp-onboarding',
|
||||
$url,
|
||||
$this->module_url . '/assets/css/onboarding.css',
|
||||
array(),
|
||||
$this->version
|
||||
);
|
||||
$url = untrailingslashit( $this->module_url ) . '/assets/js/settings.js';
|
||||
|
||||
wp_register_script(
|
||||
'ppcp-settings',
|
||||
$url,
|
||||
$this->module_url . '/assets/js/settings.js',
|
||||
array(),
|
||||
$this->version,
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
'ppcp-settings',
|
||||
'PayPalCommerceSettings',
|
||||
|
@ -122,14 +122,14 @@ class OnboardingAssets {
|
|||
)
|
||||
);
|
||||
|
||||
$url = untrailingslashit( $this->module_url ) . '/assets/js/onboarding.js';
|
||||
wp_register_script(
|
||||
'ppcp-onboarding',
|
||||
$url,
|
||||
$this->module_url . '/assets/js/onboarding.js',
|
||||
array( 'jquery' ),
|
||||
$this->version,
|
||||
true
|
||||
);
|
||||
|
||||
wp_localize_script(
|
||||
'ppcp-onboarding',
|
||||
'PayPalCommerceGatewayOnboarding',
|
||||
|
@ -164,17 +164,22 @@ class OnboardingAssets {
|
|||
/**
|
||||
* Enqueues the necessary scripts.
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue(): bool {
|
||||
wp_enqueue_style( 'ppcp-onboarding' );
|
||||
wp_enqueue_script( 'ppcp-settings' );
|
||||
if ( ! $this->should_render_onboarding_script() ) {
|
||||
return false;
|
||||
public function enqueue(): void {
|
||||
// Do not enqueue anything when we are not on a PayPal Payments settings tab.
|
||||
if ( ! $this->page_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_script( 'ppcp-onboarding' );
|
||||
return true;
|
||||
// Enqueue general assets for the plugin's settings page.
|
||||
wp_enqueue_script( 'ppcp-settings' );
|
||||
wp_enqueue_style( 'ppcp-onboarding' ); // File also contains general settings styles.
|
||||
|
||||
// Conditionally enqueue the onboarding script, when needed.
|
||||
if ( $this->should_render_onboarding_script() ) {
|
||||
wp_enqueue_script( 'ppcp-onboarding' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,8 @@ namespace WooCommerce\PayPalCommerce\Onboarding\Endpoint;
|
|||
use Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\PayPalBearer;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\SdkClientToken;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\UserIdToken;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\LoginSeller;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Repository\PartnerReferralsData;
|
||||
|
@ -76,6 +78,13 @@ class LoginSellerEndpoint implements EndpointInterface {
|
|||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* The client credentials cache.
|
||||
*
|
||||
* @var Cache
|
||||
*/
|
||||
private $client_credentials_cache;
|
||||
|
||||
/**
|
||||
* LoginSellerEndpoint constructor.
|
||||
*
|
||||
|
@ -86,6 +95,7 @@ class LoginSellerEndpoint implements EndpointInterface {
|
|||
* @param Settings $settings The Settings.
|
||||
* @param Cache $cache The Cache.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
* @param Cache $client_credentials_cache The client credentials cache.
|
||||
*/
|
||||
public function __construct(
|
||||
RequestData $request_data,
|
||||
|
@ -94,16 +104,18 @@ class LoginSellerEndpoint implements EndpointInterface {
|
|||
PartnerReferralsData $partner_referrals_data,
|
||||
Settings $settings,
|
||||
Cache $cache,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
Cache $client_credentials_cache
|
||||
) {
|
||||
|
||||
$this->request_data = $request_data;
|
||||
$this->login_seller_production = $login_seller_production;
|
||||
$this->login_seller_sandbox = $login_seller_sandbox;
|
||||
$this->partner_referrals_data = $partner_referrals_data;
|
||||
$this->settings = $settings;
|
||||
$this->cache = $cache;
|
||||
$this->logger = $logger;
|
||||
$this->request_data = $request_data;
|
||||
$this->login_seller_production = $login_seller_production;
|
||||
$this->login_seller_sandbox = $login_seller_sandbox;
|
||||
$this->partner_referrals_data = $partner_referrals_data;
|
||||
$this->settings = $settings;
|
||||
$this->cache = $cache;
|
||||
$this->logger = $logger;
|
||||
$this->client_credentials_cache = $client_credentials_cache;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,6 +187,9 @@ class LoginSellerEndpoint implements EndpointInterface {
|
|||
if ( $this->cache->has( PayPalBearer::CACHE_KEY ) ) {
|
||||
$this->cache->delete( PayPalBearer::CACHE_KEY );
|
||||
}
|
||||
if ( $this->client_credentials_cache->has( SdkClientToken::CACHE_KEY ) ) {
|
||||
$this->client_credentials_cache->delete( SdkClientToken::CACHE_KEY );
|
||||
}
|
||||
|
||||
wp_schedule_single_event(
|
||||
time() + 5,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue