mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 12:25:15 +08:00
Merge branch 'trunk' of github.com:woocommerce/woocommerce-paypal-payments into PCP-3770-fastlane-implement-insights-sdk-for-block-checkout-ver2
This commit is contained in:
commit
d84f29a274
111 changed files with 5597 additions and 2508 deletions
|
@ -12,6 +12,7 @@ const DEFAULT_STATE = {
|
|||
shippingAddress: null,
|
||||
cardDetails: null,
|
||||
phoneNumber: '',
|
||||
cardChangeHandler: null,
|
||||
};
|
||||
|
||||
// Action creators for updating the store state
|
||||
|
@ -52,6 +53,10 @@ const actions = {
|
|||
type: 'SET_PHONE_NUMBER',
|
||||
payload: phoneNumber,
|
||||
} ),
|
||||
setCardChangeHandler: ( cardChangeHandler ) => ( {
|
||||
type: 'SET_CARD_CHANGE_HANDLER',
|
||||
payload: cardChangeHandler,
|
||||
} ),
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -81,6 +86,8 @@ const reducer = ( state = DEFAULT_STATE, action ) => {
|
|||
return { ...state, cardDetails: action.payload };
|
||||
case 'SET_PHONE_NUMBER':
|
||||
return { ...state, phoneNumber: action.payload };
|
||||
case 'SET_CARD_CHANGE_HANDLER':
|
||||
return { ...state, cardChangeHandler: action.payload };
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
@ -97,6 +104,7 @@ const selectors = {
|
|||
getShippingAddress: ( state ) => state.shippingAddress,
|
||||
getCardDetails: ( state ) => state.cardDetails,
|
||||
getPhoneNumber: ( state ) => state.phoneNumber,
|
||||
getCardChangeHandler: ( state ) => state.cardChangeHandler,
|
||||
};
|
||||
|
||||
// Create and register the Redux store for the AXO block
|
||||
|
@ -165,3 +173,12 @@ export const setCardDetails = ( cardDetails ) => {
|
|||
export const setPhoneNumber = ( phoneNumber ) => {
|
||||
dispatch( STORE_NAME ).setPhoneNumber( phoneNumber );
|
||||
};
|
||||
|
||||
/**
|
||||
* Action dispatcher to update the card change handler in the store.
|
||||
*
|
||||
* @param {Function} cardChangeHandler - The card change handler function.
|
||||
*/
|
||||
export const setCardChangeHandler = ( cardChangeHandler ) => {
|
||||
dispatch( STORE_NAME ).setCardChangeHandler( cardChangeHandler );
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue