mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Save pay later messaging config to database
This commit is contained in:
parent
a652f21629
commit
66c6fb17b8
6 changed files with 70 additions and 37 deletions
|
@ -34,7 +34,7 @@ const useHooks = () => {
|
|||
};
|
||||
};
|
||||
|
||||
export const useState = () => {
|
||||
export const useStore = () => {
|
||||
const { persist, isReady } = useHooks();
|
||||
return { persist, isReady };
|
||||
};
|
||||
|
|
|
@ -23,47 +23,52 @@ const useHooks = () => {
|
|||
const [ isReady ] = useTransient( 'isReady' );
|
||||
|
||||
// Persistent accessors.
|
||||
// TODO: Replace with real property.
|
||||
const [ sampleValue, setSampleValue ] = usePersistent( 'sampleValue' );
|
||||
|
||||
const [ cart ] = usePersistent( 'cart' );
|
||||
const [ checkout ] = usePersistent( 'checkout' );
|
||||
const [ product ] = usePersistent( 'product' );
|
||||
const [ shop ] = usePersistent( 'shop' );
|
||||
const [ home ] = usePersistent( 'home' );
|
||||
const [ custom_placement ] = usePersistent( 'custom_placement' );
|
||||
const [ cart, setCart ] = usePersistent( 'cart' );
|
||||
const [ checkout, setCheckout ] = usePersistent( 'checkout' );
|
||||
const [ product, setProduct ] = usePersistent( 'product' );
|
||||
const [ shop, setShop ] = usePersistent( 'shop' );
|
||||
const [ home, setHome ] = usePersistent( 'home' );
|
||||
const [ custom_placement, setCustom_placement ] =
|
||||
usePersistent( 'custom_placement' );
|
||||
|
||||
return {
|
||||
persist,
|
||||
isReady,
|
||||
sampleValue,
|
||||
setSampleValue,
|
||||
cart,
|
||||
setCart,
|
||||
checkout,
|
||||
setCheckout,
|
||||
product,
|
||||
setProduct,
|
||||
shop,
|
||||
setShop,
|
||||
home,
|
||||
setHome,
|
||||
custom_placement,
|
||||
setCustom_placement,
|
||||
};
|
||||
};
|
||||
|
||||
export const useState = () => {
|
||||
export const useStore = () => {
|
||||
const { persist, isReady } = useHooks();
|
||||
return { persist, isReady };
|
||||
};
|
||||
|
||||
// TODO: Replace with real hook.
|
||||
export const useSampleValue = () => {
|
||||
const { sampleValue, setSampleValue } = useHooks();
|
||||
|
||||
return {
|
||||
sampleValue,
|
||||
setSampleValue,
|
||||
};
|
||||
};
|
||||
|
||||
export const usePayLaterMessaging = () => {
|
||||
const { cart, checkout, product, shop, home, customPlacement } = useHooks();
|
||||
const {
|
||||
cart,
|
||||
setCart,
|
||||
checkout,
|
||||
setCheckout,
|
||||
product,
|
||||
setProduct,
|
||||
shop,
|
||||
setShop,
|
||||
home,
|
||||
setHome,
|
||||
custom_placement,
|
||||
setCustom_placement,
|
||||
} = useHooks();
|
||||
|
||||
return {
|
||||
config: {
|
||||
|
@ -72,7 +77,13 @@ export const usePayLaterMessaging = () => {
|
|||
product,
|
||||
shop,
|
||||
home,
|
||||
customPlacement,
|
||||
custom_placement,
|
||||
},
|
||||
setCart,
|
||||
setCheckout,
|
||||
setProduct,
|
||||
setShop,
|
||||
setHome,
|
||||
setCustom_placement,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -19,8 +19,6 @@ const defaultTransient = Object.freeze( {
|
|||
|
||||
// Persistent: Values that are loaded from the DB.
|
||||
const defaultPersistent = Object.freeze( {
|
||||
// TODO: Add real DB properties here.
|
||||
sampleValue: 'foo',
|
||||
cart: {},
|
||||
checkout: {},
|
||||
product: {},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue