🔀 Merge branch ‘trunk'

This commit is contained in:
Philipp Stracker 2025-03-21 18:03:42 +01:00
commit c4a1217e6a
No known key found for this signature in database
4 changed files with 33 additions and 31 deletions

View file

@ -56,9 +56,9 @@ class CardFieldsRenderer {
onApprove( data ) { onApprove( data ) {
return contextConfig.onApprove( data ); return contextConfig.onApprove( data );
}, },
onError( error ) { onError: ( error ) => {
console.error( error ); console.error( error );
this.spinner.unblock(); this.spinner.unblock();
}, },
} ); } );
@ -105,11 +105,13 @@ class CardFieldsRenderer {
} }
cardFields.submit().catch( ( error ) => { cardFields.submit().catch( ( error ) => {
this.spinner.unblock(); this.spinner.unblock();
console.error( error ); if (!error.type || error.type !== 'create-order-error') {
this.errorHandler.message( console.error( error );
this.defaultConfig.hosted_fields.labels.fields_not_valid this.errorHandler.message(
); this.defaultConfig.hosted_fields.labels.fields_not_valid
);
}
} ); } );
} ); } );
} }

View file

@ -32,7 +32,10 @@ const FeatureItem = ( {
); );
const handleClick = async ( feature ) => { const handleClick = async ( feature ) => {
if ( feature.action?.type === 'tab' ) { if ( feature.action?.type === 'tab' ) {
const highlight = Boolean( feature.action?.highlight ); const highlight =
feature.action?.highlight === undefined
? true
: Boolean( feature.action.highlight );
const tabId = TAB_IDS[ feature.action.tab.toUpperCase() ]; const tabId = TAB_IDS[ feature.action.tab.toUpperCase() ];
await selectTab( tabId, feature.action.section, highlight ); await selectTab( tabId, feature.action.section, highlight );
} }

View file

@ -150,11 +150,10 @@ class FeaturesDefinition {
'type' => 'secondary', 'type' => 'secondary',
'text' => __( 'Configure', 'woocommerce-paypal-payments' ), 'text' => __( 'Configure', 'woocommerce-paypal-payments' ),
'action' => array( 'action' => array(
'type' => 'tab', 'type' => 'tab',
'tab' => 'payment_methods', 'tab' => 'payment_methods',
'section' => 'ppcp-credit-card-gateway', 'section' => 'ppcp-credit-card-gateway',
'highlight' => 'ppcp-credit-card-gateway', 'modal' => 'ppcp-credit-card-gateway',
'modal' => 'ppcp-credit-card-gateway',
), ),
'showWhen' => 'enabled', 'showWhen' => 'enabled',
'class' => 'small-button', 'class' => 'small-button',
@ -189,7 +188,7 @@ class FeaturesDefinition {
'type' => 'tab', 'type' => 'tab',
'tab' => 'payment_methods', 'tab' => 'payment_methods',
'section' => 'ppcp-alternative-payments-card', 'section' => 'ppcp-alternative-payments-card',
'highlight' => 'ppcp-alternative-payments-card', 'highlight' => false,
), ),
'showWhen' => 'enabled', 'showWhen' => 'enabled',
'class' => 'small-button', 'class' => 'small-button',
@ -218,11 +217,10 @@ class FeaturesDefinition {
'type' => 'secondary', 'type' => 'secondary',
'text' => __( 'Configure', 'woocommerce-paypal-payments' ), 'text' => __( 'Configure', 'woocommerce-paypal-payments' ),
'action' => array( 'action' => array(
'type' => 'tab', 'type' => 'tab',
'tab' => 'payment_methods', 'tab' => 'payment_methods',
'section' => 'ppcp-googlepay', 'section' => 'ppcp-googlepay',
'highlight' => 'ppcp-googlepay', 'modal' => 'ppcp-googlepay',
'modal' => 'ppcp-googlepay',
), ),
'showWhen' => 'enabled', 'showWhen' => 'enabled',
'class' => 'small-button', 'class' => 'small-button',
@ -257,11 +255,10 @@ class FeaturesDefinition {
'type' => 'secondary', 'type' => 'secondary',
'text' => __( 'Configure', 'woocommerce-paypal-payments' ), 'text' => __( 'Configure', 'woocommerce-paypal-payments' ),
'action' => array( 'action' => array(
'type' => 'tab', 'type' => 'tab',
'tab' => 'payment_methods', 'tab' => 'payment_methods',
'section' => 'ppcp-card-payments-card', 'section' => 'ppcp-applepay',
'highlight' => 'ppcp-applepay', 'modal' => 'ppcp-applepay',
'modal' => 'ppcp-applepay',
), ),
'showWhen' => 'enabled', 'showWhen' => 'enabled',
'class' => 'small-button', 'class' => 'small-button',

View file

@ -32,20 +32,20 @@ return array(
'prefix' => 'WooCommerce\\PayPalCommerce\\Vendor', 'prefix' => 'WooCommerce\\PayPalCommerce\\Vendor',
'finders' => $finders, 'finders' => $finders,
'patchers' => array(), 'patchers' => array(),
'exclude-files' => array(), // list<string>. 'exclude-files' => array( 'vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php' ), // list<string>.
'exclude-namespaces' => array( 'exclude-namespaces' => array(
'/^(?!Psr).*/', // Exclude all namespaces except those starting with "Psr". '/^(?!Psr).*/', // Exclude all namespaces except those starting with "Psr".
), // list<string|regex>. ), // list<string|regex>.
'exclude-constants' => array(), // list<string|regex>. 'exclude-constants' => array(), // list<string|regex>.
'exclude-classes' => array(), // list<string|regex>. 'exclude-classes' => array(), // list<string|regex>.
'exclude-functions' => array(), // list<string|regex>. 'exclude-functions' => array(), // list<string|regex>.
'expose-global-constants' => false, // bool. 'expose-global-constants' => false, // bool.
'expose-global-classes' => false, // bool. 'expose-global-classes' => false, // bool.
'expose-global-functions' => false, // bool. 'expose-global-functions' => false, // bool.
'expose-namespaces' => array(), // list<string|regex>. 'expose-namespaces' => array(), // list<string|regex>.
'expose-constants' => array(), // list<string|regex>. 'expose-constants' => array(), // list<string|regex>.
'expose-classes' => array(), // list<string|regex>. 'expose-classes' => array(), // list<string|regex>.
'expose-functions' => array(), // list<string|regex>. 'expose-functions' => array(), // list<string|regex>.
); );