mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
♻️ Move constants to a central config file
Reason: The constants are also used by the store and are synced to the server. Their use is not isolated to the specific component
This commit is contained in:
parent
6a30bb01b3
commit
ee2c374f79
3 changed files with 22 additions and 12 deletions
|
@ -5,6 +5,9 @@ import { __ } from '@wordpress/i18n';
|
|||
import PaymentMethodIcons from '../../ReusableComponents/PaymentMethodIcons';
|
||||
import { useState } from '@wordpress/element';
|
||||
import Navigation from '../../ReusableComponents/Navigation';
|
||||
import { BUSINESS_TYPES } from '../../../data/constants';
|
||||
|
||||
const BUSINESS_RADIO_GROUP_NAME = 'business';
|
||||
|
||||
const StepBusiness = ( {
|
||||
setStep,
|
||||
|
@ -13,9 +16,6 @@ const StepBusiness = ( {
|
|||
setCompleted,
|
||||
} ) => {
|
||||
const [ businessCategory, setBusinessCategory ] = useState( null );
|
||||
const BUSINESS_RADIO_GROUP_NAME = 'business';
|
||||
const CASUAL_SELLER_CHECKBOX_VALUE = 'casual_seller';
|
||||
const BUSINESS_CHECKBOX_VALUE = 'business';
|
||||
|
||||
return (
|
||||
<div className="ppcp-r-page-business">
|
||||
|
@ -38,7 +38,7 @@ const StepBusiness = ( {
|
|||
) }
|
||||
icon="icon-business-casual-seller.svg"
|
||||
name={ BUSINESS_RADIO_GROUP_NAME }
|
||||
value={ CASUAL_SELLER_CHECKBOX_VALUE }
|
||||
value={ BUSINESS_TYPES.CASUAL_SELLER }
|
||||
changeCallback={ setBusinessCategory }
|
||||
currentValue={ businessCategory }
|
||||
checked={
|
||||
|
@ -69,7 +69,7 @@ const StepBusiness = ( {
|
|||
) }
|
||||
icon="icon-business-business.svg"
|
||||
name={ BUSINESS_RADIO_GROUP_NAME }
|
||||
value={ BUSINESS_CHECKBOX_VALUE }
|
||||
value={ BUSINESS_TYPES.BUSINESS }
|
||||
currentValue={ businessCategory }
|
||||
changeCallback={ setBusinessCategory }
|
||||
checked={
|
||||
|
|
|
@ -4,6 +4,9 @@ import { __ } from '@wordpress/i18n';
|
|||
import SelectBox from '../../ReusableComponents/SelectBox';
|
||||
import SelectBoxWrapper from '../../ReusableComponents/SelectBoxWrapper';
|
||||
import { useState } from '@wordpress/element';
|
||||
import { PRODUCT_TYPES } from '../../../data/constants';
|
||||
|
||||
const PRODUCTS_CHECKBOX_GROUP_NAME = 'products';
|
||||
|
||||
const StepProducts = ( {
|
||||
setStep,
|
||||
|
@ -12,10 +15,6 @@ const StepProducts = ( {
|
|||
setCompleted,
|
||||
} ) => {
|
||||
const [ products, setProducts ] = useState( [] );
|
||||
const PRODUCTS_CHECKBOX_GROUP_NAME = 'products';
|
||||
const VIRTUAL_CHECKBOX_VALUE = 'virtual';
|
||||
const PHYSICAL_CHECKBOX_VALUE = 'physical';
|
||||
const SUBSCRIPTIONS_CHECKBOX_VALUE = 'subscriptions';
|
||||
|
||||
return (
|
||||
<div className="ppcp-r-page-products">
|
||||
|
@ -35,7 +34,7 @@ const StepProducts = ( {
|
|||
) }
|
||||
icon="icon-product-virtual.svg"
|
||||
name={ PRODUCTS_CHECKBOX_GROUP_NAME }
|
||||
value={ VIRTUAL_CHECKBOX_VALUE }
|
||||
value={ PRODUCT_TYPES.VIRTUAL }
|
||||
changeCallback={ setProducts }
|
||||
currentValue={ products }
|
||||
type="checkbox"
|
||||
|
@ -78,7 +77,7 @@ const StepProducts = ( {
|
|||
) }
|
||||
icon="icon-product-physical.svg"
|
||||
name={ PRODUCTS_CHECKBOX_GROUP_NAME }
|
||||
value={ PHYSICAL_CHECKBOX_VALUE }
|
||||
value={ PRODUCT_TYPES.PHYSICAL }
|
||||
changeCallback={ setProducts }
|
||||
currentValue={ products }
|
||||
type="checkbox"
|
||||
|
@ -106,7 +105,7 @@ const StepProducts = ( {
|
|||
) }
|
||||
icon="icon-product-subscription.svg"
|
||||
name={ PRODUCTS_CHECKBOX_GROUP_NAME }
|
||||
value={ SUBSCRIPTIONS_CHECKBOX_VALUE }
|
||||
value={ PRODUCT_TYPES.SUBSCRIPTIONS }
|
||||
changeCallback={ setProducts }
|
||||
currentValue={ products }
|
||||
type="checkbox"
|
||||
|
|
|
@ -1,2 +1,13 @@
|
|||
export const NAMESPACE = '/wc/v3/wc_paypal';
|
||||
export const STORE_NAME = 'wc/paypal';
|
||||
|
||||
export const BUSINESS_TYPES = {
|
||||
CASUAL_SELLER: 'casual_seller',
|
||||
BUSINESS: 'business',
|
||||
};
|
||||
|
||||
export const PRODUCT_TYPES = {
|
||||
VIRTUAL: 'virtual',
|
||||
PHYSICAL: 'physical',
|
||||
SUBSCRIPTIONS: 'subscriptions',
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue