mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Add better state management utilizing Redux
This commit is contained in:
parent
db449b5d70
commit
bccfe4c436
11 changed files with 432 additions and 172 deletions
|
@ -1,13 +1,18 @@
|
|||
import { useEffect, useCallback } from '@wordpress/element';
|
||||
import { useSelect } from '@wordpress/data';
|
||||
import { CreditCard } from './CreditCard';
|
||||
import { STORE_NAME } from '../stores/axoStore';
|
||||
|
||||
export const Payment = ( {
|
||||
fastlaneSdk,
|
||||
card,
|
||||
shippingAddress,
|
||||
isGuest,
|
||||
onPaymentLoad,
|
||||
} ) => {
|
||||
const isGuest = useSelect( ( select ) =>
|
||||
select( STORE_NAME ).getIsGuest()
|
||||
);
|
||||
|
||||
// Memoized Fastlane card rendering
|
||||
const loadPaymentComponent = useCallback( async () => {
|
||||
if ( isGuest ) {
|
||||
|
@ -31,6 +36,7 @@ export const Payment = ( {
|
|||
card={ card }
|
||||
shippingAddress={ shippingAddress }
|
||||
fastlaneSdk={ fastlaneSdk }
|
||||
showWatermark={ ! isGuest }
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue