mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Adds all expert settings
This commit is contained in:
parent
51b7b48381
commit
e72cc8a213
6 changed files with 101 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Button, ToggleControl, Dropdown } from '@wordpress/components';
|
||||
import { Button, ToggleControl, SelectControl } from '@wordpress/components';
|
||||
import data from '../../utils/data';
|
||||
import { useState } from '@wordpress/element';
|
||||
|
||||
|
@ -113,7 +113,22 @@ const SettingsBlock = ( {
|
|||
</div>
|
||||
) }
|
||||
{ actionProps?.type === SETTINGS_BLOCK_TYPE_SELECT && (
|
||||
<Dropdown />
|
||||
<SelectControl
|
||||
className={
|
||||
actionProps.value === '' &&
|
||||
'ppcp-r-select-no-value-assigned'
|
||||
}
|
||||
value={ actionProps.value }
|
||||
options={ actionProps?.options }
|
||||
multiple={ true }
|
||||
onChange={ ( newValue ) =>
|
||||
actionProps?.callback &&
|
||||
actionProps.callback(
|
||||
actionProps?.key,
|
||||
newValue
|
||||
)
|
||||
}
|
||||
/>
|
||||
) }
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -17,6 +17,7 @@ const TabSettings = () => {
|
|||
brandName: '',
|
||||
softDescriptor: '',
|
||||
paypalLandingPage: null,
|
||||
buttonLanguage: '',
|
||||
} );
|
||||
const updateFormValue = ( key, value ) => {
|
||||
console.log( key, value );
|
||||
|
|
|
@ -4,6 +4,7 @@ import SettingsBlock, {
|
|||
SETTINGS_BLOCK_STYLING_TYPE_SECONDARY,
|
||||
SETTINGS_BLOCK_TYPE_EMPTY,
|
||||
SETTINGS_BLOCK_TYPE_INPUT,
|
||||
SETTINGS_BLOCK_TYPE_SELECT,
|
||||
SETTINGS_BLOCK_TYPE_TOGGLE,
|
||||
SETTINGS_BLOCK_TYPE_TOGGLE_CONTENT,
|
||||
} from '../../../../ReusableComponents/SettingsBlock';
|
||||
|
@ -204,8 +205,37 @@ const PaypalSettings = ( { updateFormValue, settings } ) => {
|
|||
/>
|
||||
</div>
|
||||
</SettingsBlock>
|
||||
<SettingsBlock
|
||||
title={ __( 'Button Language', 'woocommerce-paypal-payments' ) }
|
||||
description={ __(
|
||||
'If left blank, PayPal and other buttons will present in the user’s detected language. Enter a language here to force all buttons to display in that language.',
|
||||
'woocommerce-paypal-payments'
|
||||
) }
|
||||
style={ SETTINGS_BLOCK_STYLING_TYPE_SECONDARY }
|
||||
actionProps={ {
|
||||
type: SETTINGS_BLOCK_TYPE_SELECT,
|
||||
value: settings.buttonLanguage,
|
||||
callback: updateFormValue,
|
||||
options: languagesExample,
|
||||
key: 'buttonLanguage',
|
||||
placeholder: __(
|
||||
'Browser language',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
} }
|
||||
/>
|
||||
</SettingsBlock>
|
||||
);
|
||||
};
|
||||
|
||||
const languagesExample = [
|
||||
{
|
||||
value: '',
|
||||
label: __( 'Browser language', 'woocommerce-paypal-payments' ),
|
||||
},
|
||||
{ value: 'en', label: 'English' },
|
||||
{ value: 'de', label: 'German' },
|
||||
{ value: 'es', label: 'Spanish' },
|
||||
{ value: 'it', label: 'Italian' },
|
||||
];
|
||||
export default PaypalSettings;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import SettingsBlock, {
|
||||
SETTINGS_BLOCK_STYLING_TYPE_PRIMARY,
|
||||
SETTINGS_BLOCK_STYLING_TYPE_SECONDARY,
|
||||
SETTINGS_BLOCK_TYPE_SELECT,
|
||||
SETTINGS_BLOCK_TYPE_TOGGLE_CONTENT,
|
||||
} from '../../../ReusableComponents/SettingsBlock';
|
||||
import SettingsCard from '../../../ReusableComponents/SettingsCard';
|
||||
|
@ -49,13 +51,47 @@ const ExpertSettings = ( { updateFormValue, settings } ) => {
|
|||
style={ SETTINGS_BLOCK_STYLING_TYPE_PRIMARY }
|
||||
actionProps={ {
|
||||
type: SETTINGS_BLOCK_TYPE_TOGGLE_CONTENT,
|
||||
callback: updateFormValue,
|
||||
key: 'payNowExperience',
|
||||
value: settings.payNowExperience,
|
||||
} }
|
||||
/>
|
||||
>
|
||||
<SettingsBlock
|
||||
title={ __(
|
||||
'Disable specific credit cards',
|
||||
'woocommerce-paypal-payments'
|
||||
) }
|
||||
description={ __(
|
||||
'If left blank, PayPal and other buttons will present in the user’s detected language. Enter a language here to force all buttons to display in that language.',
|
||||
'woocommerce-paypal-payments'
|
||||
) }
|
||||
style={ SETTINGS_BLOCK_STYLING_TYPE_SECONDARY }
|
||||
actionProps={ {
|
||||
type: SETTINGS_BLOCK_TYPE_SELECT,
|
||||
options: creditCardExamples,
|
||||
value: settings.buttonLanguage,
|
||||
callback: updateFormValue,
|
||||
key: 'buttonLanguage',
|
||||
} }
|
||||
/>
|
||||
</SettingsBlock>
|
||||
</SettingsCard>
|
||||
);
|
||||
};
|
||||
|
||||
const creditCardExamples = [
|
||||
{ value: '', label: __( 'Select', 'woocommerce-paypal-payments' ) },
|
||||
{
|
||||
value: 'mastercard',
|
||||
label: __( 'Mastercard', 'woocommerce-paypal-payments' ),
|
||||
},
|
||||
{ value: 'visa', label: __( 'Visa', 'woocommerce-paypal-payments' ) },
|
||||
{
|
||||
value: 'amex',
|
||||
label: __( 'American Express', 'woocommerce-paypal-payments' ),
|
||||
},
|
||||
{ value: 'jcb', label: __( 'JCB', 'woocommerce-paypal-payments' ) },
|
||||
{
|
||||
value: 'diners-club',
|
||||
label: __( 'Diners Club', 'woocommerce-paypal-payments' ),
|
||||
},
|
||||
];
|
||||
|
||||
export default ExpertSettings;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue