mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
🚚 Remove non-Redux files from the data folder
This commit is contained in:
parent
13947a5d01
commit
d5e47d93a0
4 changed files with 177 additions and 184 deletions
|
@ -1,178 +0,0 @@
|
|||
import { __, sprintf } from '@wordpress/i18n';
|
||||
import { InputSettingsBlock } from '../../Components/ReusableComponents/SettingsBlocks';
|
||||
import { Button } from '@wordpress/components';
|
||||
|
||||
/**
|
||||
* Generates options for the environment mode settings.
|
||||
*
|
||||
* @param {Object} config - Configuration for the mode.
|
||||
* @param {Object} settings - Current settings.
|
||||
* @param {Function} updateFormValue - Callback to update settings.
|
||||
* @return {Array} Options array.
|
||||
*/
|
||||
const generateOptions = ( config, settings, updateFormValue ) => [
|
||||
{
|
||||
id: `${ config.mode }_mode`,
|
||||
value: `${ config.mode }_mode`,
|
||||
label: config.labelTitle,
|
||||
description: config.labelDescription,
|
||||
additionalContent: (
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={ () => {
|
||||
updateFormValue( `${ config.mode }Connected`, true );
|
||||
if ( config.mode === 'production' ) {
|
||||
global.ppcpSettings.startOnboarding();
|
||||
}
|
||||
} }
|
||||
>
|
||||
{ config.buttonText }
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'manual_connect',
|
||||
value: 'manual_connect',
|
||||
label: __( 'Manual Connect', 'woocommerce-paypal-payments' ),
|
||||
description: sprintf(
|
||||
__(
|
||||
'For advanced users: Connect a custom PayPal REST app for full control over your integration. For more information on creating a PayPal REST application, <a target="_blank" href="%s">click here</a>.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
'#'
|
||||
),
|
||||
additionalContent: (
|
||||
<>
|
||||
<InputSettingsBlock
|
||||
title={ config.clientIdTitle }
|
||||
actionProps={ {
|
||||
value: settings[ `${ config.mode }ClientId` ],
|
||||
callback: updateFormValue,
|
||||
key: `${ config.mode }ClientId`,
|
||||
placeholder: __(
|
||||
'Enter Client ID',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
} }
|
||||
/>
|
||||
<InputSettingsBlock
|
||||
title={ config.secretKeyTitle }
|
||||
actionProps={ {
|
||||
value: settings[ `${ config.mode }SecretKey` ],
|
||||
callback: updateFormValue,
|
||||
key: `${ config.mode }SecretKey`,
|
||||
placeholder: __(
|
||||
'Enter Secret Key',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
} }
|
||||
/>
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={ () =>
|
||||
updateFormValue(
|
||||
`${ config.mode }ManuallyConnected`,
|
||||
true
|
||||
)
|
||||
}
|
||||
>
|
||||
{ __( 'Connect Account', 'woocommerce-paypal-payments' ) }
|
||||
</Button>
|
||||
</>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* Generates data for a given mode (sandbox or production).
|
||||
*
|
||||
* @param {Object} config - Configuration for the mode.
|
||||
* @param {Object} settings - Current settings.
|
||||
* @param {Function} updateFormValue - Callback to update settings.
|
||||
* @return {Object} Mode configuration.
|
||||
*/
|
||||
const generateModeData = ( config, settings, updateFormValue ) => ( {
|
||||
title: config.title,
|
||||
description: config.description,
|
||||
connectTitle: __(
|
||||
`Connect ${ config.label } Account`,
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
connectDescription: config.connectDescription,
|
||||
options: generateOptions( config, settings, updateFormValue ),
|
||||
} );
|
||||
|
||||
export const sandboxData = ( { settings = {}, updateFormValue = () => {} } ) =>
|
||||
generateModeData(
|
||||
{
|
||||
mode: 'sandbox',
|
||||
label: 'Sandbox',
|
||||
title: __( 'Sandbox', 'woocommerce-paypal-payments' ),
|
||||
description: __(
|
||||
"Test your site in PayPal's Sandbox environment.",
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
connectDescription: __(
|
||||
'Connect a PayPal Sandbox account in order to test your website. Transactions made will not result in actual money movement. Do not fulfil orders completed in Sandbox mode.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
labelTitle: __( 'Sandbox Mode', 'woocommerce-paypal-payments' ),
|
||||
labelDescription: __(
|
||||
'Activate Sandbox mode to safely test PayPal with sample data. Once your store is ready to go live, you can easily switch to your production account.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
buttonText: __(
|
||||
'Connect Sandbox Account',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
clientIdTitle: __(
|
||||
'Sandbox Client ID',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
secretKeyTitle: __(
|
||||
'Sandbox Secret Key',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
},
|
||||
settings,
|
||||
updateFormValue
|
||||
);
|
||||
|
||||
export const productionData = ( {
|
||||
settings = {},
|
||||
updateFormValue = () => {},
|
||||
} ) =>
|
||||
generateModeData(
|
||||
{
|
||||
mode: 'production',
|
||||
label: 'Live',
|
||||
title: __( 'Live Payments', 'woocommerce-paypal-payments' ),
|
||||
description: __(
|
||||
'Your site is currently configured in Sandbox mode to test payments. When you are ready, launch your site and receive live payments via PayPal.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
connectDescription: __(
|
||||
'Connect a live PayPal account to launch your site and receive live payments via PayPal. PayPal will guide you through the setup process.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
labelTitle: __( 'Production Mode', 'woocommerce-paypal-payments' ),
|
||||
labelDescription: __(
|
||||
'Activate Production mode to connect your live account and receive live payments via PayPal. Stay connected in Sandbox mode to continue testing payments before going live.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
buttonText: __(
|
||||
'Set up and connect live PayPal Account',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
clientIdTitle: __(
|
||||
'Live Account Client ID',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
secretKeyTitle: __(
|
||||
'Live Account Secret Key',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
},
|
||||
settings,
|
||||
updateFormValue
|
||||
);
|
|
@ -1,170 +0,0 @@
|
|||
import { __ } from '@wordpress/i18n';
|
||||
import { selectTab, TAB_IDS } from '../../utils/tabSelector';
|
||||
|
||||
export const todosData = [
|
||||
{
|
||||
id: 'enable_fastlane',
|
||||
title: __( 'Enable Fastlane', 'woocommerce-paypal-payments' ),
|
||||
description: __(
|
||||
'Accelerate your guest checkout with Fastlane by PayPal.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
isCompleted: () => {
|
||||
return false;
|
||||
},
|
||||
onClick: () => {
|
||||
selectTab( TAB_IDS.PAYMENT_METHODS, 'ppcp-card-payments-card' );
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'enable_credit_debit_cards',
|
||||
title: __(
|
||||
'Enable Credit and Debit Cards on your checkout',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
description: __(
|
||||
'Credit and Debit Cards is now available for Blocks checkout pages.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
isCompleted: () => {
|
||||
return false;
|
||||
},
|
||||
onClick: () => {
|
||||
selectTab( TAB_IDS.PAYMENT_METHODS, 'ppcp-card-payments-card' );
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'enable_pay_later_messaging',
|
||||
title: __(
|
||||
'Enable Pay Later messaging',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
description: __(
|
||||
'Show Pay Later messaging to boost conversion rate and increase cart size.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
isCompleted: () => {
|
||||
return false;
|
||||
},
|
||||
onClick: () => {
|
||||
selectTab( TAB_IDS.OVERVIEW, 'pay_later_messaging' );
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'configure_paypal_subscription',
|
||||
title: __(
|
||||
'Configure a PayPal Subscription',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
description: __(
|
||||
'Connect a subscriptions-type product from WooCommerce with PayPal.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
isCompleted: () => {
|
||||
return false;
|
||||
},
|
||||
onClick: () => {
|
||||
console.log(
|
||||
'Take merchant to product list, filtered with subscription-type products'
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'register_domain_apple_pay',
|
||||
title: __(
|
||||
'Register Domain for Apple Pay',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
description: __(
|
||||
'To enable Apple Pay, you must register your domain with PayPal.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
isCompleted: () => {
|
||||
return false;
|
||||
},
|
||||
onClick: () => {
|
||||
selectTab( TAB_IDS.OVERVIEW, 'apple_pay' );
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'add_digital_wallets_to_account',
|
||||
title: __(
|
||||
'Add digital wallets to your account',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
description: __(
|
||||
'Add the ability to accept Apple Pay & Google Pay to your PayPal account.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
isCompleted: () => {
|
||||
return false;
|
||||
},
|
||||
onClick: () => {
|
||||
console.log(
|
||||
'Take merchant to PayPal to enable Apple Pay & Google Pay'
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'add_apple_pay_to_account',
|
||||
title: __(
|
||||
'Add Apple Pay to your account',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
description: __(
|
||||
'Add the ability to accept Apple Pay to your PayPal account.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
isCompleted: () => {
|
||||
return false;
|
||||
},
|
||||
onClick: () => {
|
||||
console.log( 'Take merchant to PayPal to enable Apple Pay' );
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'add_google_pay_to_account',
|
||||
title: __(
|
||||
'Add Google Pay to your account',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
description: __(
|
||||
'Add the ability to accept Google Pay to your PayPal account.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
isCompleted: () => {
|
||||
return false;
|
||||
},
|
||||
onClick: () => {
|
||||
console.log( 'Take merchant to PayPal to enable Google Pay' );
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'enable_apple_pay',
|
||||
title: __( 'Enable Apple Pay', 'woocommerce-paypal-payments' ),
|
||||
description: __(
|
||||
'Allow your buyers to check out via Apple Pay.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
isCompleted: () => {
|
||||
return false;
|
||||
},
|
||||
onClick: () => {
|
||||
selectTab( TAB_IDS.OVERVIEW, 'apple_pay' );
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'enable_google_pay',
|
||||
title: __( 'Enable Google Pay', 'woocommerce-paypal-payments' ),
|
||||
description: __(
|
||||
'Allow your buyers to check out via Google Pay.',
|
||||
'woocommerce-paypal-payments'
|
||||
),
|
||||
isCompleted: () => {
|
||||
return false;
|
||||
},
|
||||
onClick: () => {
|
||||
selectTab( TAB_IDS.OVERVIEW, 'google_pay' );
|
||||
},
|
||||
},
|
||||
];
|
Loading…
Add table
Add a link
Reference in a new issue