mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Merge pull request #3201 from woocommerce/PCP-4285-configure-buttons-in-features-section-does-not-work-as-expected
Configure buttons in Features section does not work as expected (4285)
This commit is contained in:
commit
80a99c75d3
2 changed files with 8 additions and 3 deletions
|
@ -3,7 +3,8 @@ import { FeatureSettingsBlock } from '../../../../../ReusableComponents/Settings
|
|||
import { Content } from '../../../../../ReusableComponents/Elements';
|
||||
import { TITLE_BADGE_POSITIVE } from '../../../../../ReusableComponents/TitleBadge';
|
||||
import { selectTab, TAB_IDS } from '../../../../../../utils/tabSelector';
|
||||
import { setActiveModal } from '../../../../../../data/common/actions';
|
||||
import { useDispatch } from '@wordpress/data';
|
||||
import { STORE_NAME as COMMON_STORE_NAME } from '../../../../../../data/common';
|
||||
|
||||
const FeatureItem = ( {
|
||||
isBusy,
|
||||
|
@ -14,6 +15,7 @@ const FeatureItem = ( {
|
|||
enabled,
|
||||
notes,
|
||||
} ) => {
|
||||
const { setActiveModal } = useDispatch( COMMON_STORE_NAME );
|
||||
const getButtonUrl = ( button ) => {
|
||||
if ( button.urls ) {
|
||||
return isSandbox ? button.urls.sandbox : button.urls.live;
|
||||
|
@ -30,9 +32,11 @@ const FeatureItem = ( {
|
|||
);
|
||||
const handleClick = async ( feature ) => {
|
||||
if ( feature.action?.type === 'tab' ) {
|
||||
const highlight = Boolean( feature.action?.highlight );
|
||||
const tabId = TAB_IDS[ feature.action.tab.toUpperCase() ];
|
||||
await selectTab( tabId, feature.action.section );
|
||||
await selectTab( tabId, feature.action.section, highlight );
|
||||
}
|
||||
|
||||
if ( feature.action?.modal ) {
|
||||
setActiveModal( feature.action.modal );
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ class FeaturesDefinition {
|
|||
'action' => array(
|
||||
'type' => 'tab',
|
||||
'tab' => 'settings',
|
||||
'section' => 'ppcp-save-paypal-and-venmo',
|
||||
),
|
||||
'showWhen' => 'enabled',
|
||||
'class' => 'small-button',
|
||||
|
@ -207,7 +208,7 @@ class FeaturesDefinition {
|
|||
'action' => array(
|
||||
'type' => 'tab',
|
||||
'tab' => 'payment_methods',
|
||||
'section' => 'ppcp-card-payments-card',
|
||||
'section' => 'ppcp-googlepay',
|
||||
'highlight' => 'ppcp-googlepay',
|
||||
'modal' => 'ppcp-googlepay',
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue