mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
♻️ Improve the reducer by using defined constants
This commit is contained in:
parent
fa67abc8e4
commit
e9644ba026
2 changed files with 21 additions and 15 deletions
|
@ -33,6 +33,7 @@ export const STYLING_LOCATIONS = {
|
||||||
cart: {
|
cart: {
|
||||||
value: 'cart',
|
value: 'cart',
|
||||||
label: __( 'Cart', 'woocommerce-paypal-payments' ),
|
label: __( 'Cart', 'woocommerce-paypal-payments' ),
|
||||||
|
// translators: %s is the URL to a documentation page.
|
||||||
description: __(
|
description: __(
|
||||||
'Customize the appearance of the PayPal smart buttons on the <a href="%s">Cart page</a> and select which additional payment buttons to display in this location.',
|
'Customize the appearance of the PayPal smart buttons on the <a href="%s">Cart page</a> and select which additional payment buttons to display in this location.',
|
||||||
'wooocommerce-paypal-payments'
|
'wooocommerce-paypal-payments'
|
||||||
|
@ -42,6 +43,7 @@ export const STYLING_LOCATIONS = {
|
||||||
'classic-checkout': {
|
'classic-checkout': {
|
||||||
value: 'classic-checkout',
|
value: 'classic-checkout',
|
||||||
label: __( 'Classic Checkout', 'woocommerce-paypal-payments' ),
|
label: __( 'Classic Checkout', 'woocommerce-paypal-payments' ),
|
||||||
|
// translators: %s is the URL to a documentation page.
|
||||||
description: __(
|
description: __(
|
||||||
'Customize the appearance of the PayPal smart buttons on the <a href="%s">Classic Checkout page</a> and choose which additional payment buttons to display in this location.',
|
'Customize the appearance of the PayPal smart buttons on the <a href="%s">Classic Checkout page</a> and choose which additional payment buttons to display in this location.',
|
||||||
'wooocommerce-paypal-payments'
|
'wooocommerce-paypal-payments'
|
||||||
|
@ -51,6 +53,7 @@ export const STYLING_LOCATIONS = {
|
||||||
'express-checkout': {
|
'express-checkout': {
|
||||||
value: 'express-checkout',
|
value: 'express-checkout',
|
||||||
label: __( 'Express Checkout', 'woocommerce-paypal-payments' ),
|
label: __( 'Express Checkout', 'woocommerce-paypal-payments' ),
|
||||||
|
// translators: %s is the URL to a documentation page.
|
||||||
description: __(
|
description: __(
|
||||||
'Customize the appearance of the PayPal smart buttons on the <a href="%s">Express Checkout location</a> and choose which additional payment buttons to display in this location.',
|
'Customize the appearance of the PayPal smart buttons on the <a href="%s">Express Checkout location</a> and choose which additional payment buttons to display in this location.',
|
||||||
'wooocommerce-paypal-payments'
|
'wooocommerce-paypal-payments'
|
||||||
|
@ -60,6 +63,7 @@ export const STYLING_LOCATIONS = {
|
||||||
'mini-cart': {
|
'mini-cart': {
|
||||||
value: 'mini-cart',
|
value: 'mini-cart',
|
||||||
label: __( 'Mini Cart', 'woocommerce-paypel-payements' ),
|
label: __( 'Mini Cart', 'woocommerce-paypel-payements' ),
|
||||||
|
// translators: %s is the URL to a documentation page.
|
||||||
description: __(
|
description: __(
|
||||||
'Customize the appearance of the PayPal smart buttons on the <a href="%s">Mini Cart</a> and choose which additional payment buttons to display in this location.',
|
'Customize the appearance of the PayPal smart buttons on the <a href="%s">Mini Cart</a> and choose which additional payment buttons to display in this location.',
|
||||||
'wooocommerce-paypal-payments'
|
'wooocommerce-paypal-payments'
|
||||||
|
@ -69,6 +73,7 @@ export const STYLING_LOCATIONS = {
|
||||||
'product-page': {
|
'product-page': {
|
||||||
value: 'product-page',
|
value: 'product-page',
|
||||||
label: __( 'Product Page', 'woocommerce-paypal-payments' ),
|
label: __( 'Product Page', 'woocommerce-paypal-payments' ),
|
||||||
|
// translators: %s is the URL to a documentation page.
|
||||||
description: __(
|
description: __(
|
||||||
'Customize the appearance of the PayPal smart buttons on the <a href="%s">Product Page</a> and choose which additional payment buttons to display in this location.',
|
'Customize the appearance of the PayPal smart buttons on the <a href="%s">Product Page</a> and choose which additional payment buttons to display in this location.',
|
||||||
'wooocommerce-paypal-payments'
|
'wooocommerce-paypal-payments'
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
import { createReducer, createSetters } from '../utils';
|
import { createReducer, createSetters } from '../utils';
|
||||||
import ACTION_TYPES from './action-types';
|
import ACTION_TYPES from './action-types';
|
||||||
|
import { STYLING_COLORS, STYLING_SHAPES } from './constants';
|
||||||
|
|
||||||
// Store structure.
|
// Store structure.
|
||||||
|
|
||||||
|
@ -21,38 +22,38 @@ const defaultTransient = Object.freeze( {
|
||||||
const defaultPersistent = Object.freeze( {
|
const defaultPersistent = Object.freeze( {
|
||||||
cart: {
|
cart: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
methods: [ 'venmo', 'applepay', 'googlepay', 'credit card' ],
|
methods: [],
|
||||||
shape: 'rect',
|
|
||||||
label: 'Pay',
|
label: 'Pay',
|
||||||
color: 'gold',
|
shape: STYLING_SHAPES.rect.value,
|
||||||
|
color: STYLING_COLORS.gold.value,
|
||||||
},
|
},
|
||||||
'classic-checkout': {
|
'classic-checkout': {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
methods: [ 'venmo', 'applepay', 'googlepay', 'credit card' ],
|
methods: [],
|
||||||
shape: 'rect',
|
|
||||||
label: 'Checkout',
|
label: 'Checkout',
|
||||||
color: 'gold',
|
shape: STYLING_SHAPES.rect.value,
|
||||||
|
color: STYLING_COLORS.gold.value,
|
||||||
},
|
},
|
||||||
'express-checkout': {
|
'express-checkout': {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
methods: [ 'venmo', 'applepay', 'googlepay', 'credit card' ],
|
methods: [],
|
||||||
shape: 'rect',
|
|
||||||
label: 'Checkout',
|
label: 'Checkout',
|
||||||
color: 'gold',
|
shape: STYLING_SHAPES.rect.value,
|
||||||
|
color: STYLING_COLORS.gold.value,
|
||||||
},
|
},
|
||||||
'mini-cart': {
|
'mini-cart': {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
methods: [ 'venmo', 'applepay', 'googlepay', 'credit card' ],
|
methods: [],
|
||||||
shape: 'rect',
|
|
||||||
label: 'Pay',
|
label: 'Pay',
|
||||||
color: 'gold',
|
shape: STYLING_SHAPES.rect.value,
|
||||||
|
color: STYLING_COLORS.gold.value,
|
||||||
},
|
},
|
||||||
product: {
|
product: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
methods: [ 'venmo', 'applepay', 'googlepay', 'credit card' ],
|
methods: [],
|
||||||
shape: 'rect',
|
|
||||||
label: 'Buy',
|
label: 'Buy',
|
||||||
color: 'gold',
|
shape: STYLING_SHAPES.rect.value,
|
||||||
|
color: STYLING_COLORS.gold.value,
|
||||||
},
|
},
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue