mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
Further separate code into hooks: useAxoCleanup, useAxoSetup, usePayPalScript and usePaymentSetup. Hide Shipping and Billing details on load.
This commit is contained in:
parent
90aa261c8b
commit
4bda191f0e
13 changed files with 282 additions and 165 deletions
|
@ -1,7 +1,7 @@
|
|||
import { populateWooFields } from '../helpers/fieldHelpers';
|
||||
import { injectShippingChangeButton } from '../components/Shipping';
|
||||
import { injectCardChangeButton } from '../components/Card';
|
||||
import { setIsGuest } from '../stores/axoStore';
|
||||
import { setIsGuest, setIsEmailLookupCompleted } from '../stores/axoStore';
|
||||
|
||||
export const createEmailLookupHandler = (
|
||||
fastlaneSdk,
|
||||
|
@ -34,6 +34,11 @@ export const createEmailLookupHandler = (
|
|||
|
||||
console.log( 'Lookup response:', lookup );
|
||||
|
||||
// Gary flow
|
||||
if ( lookup && lookup.customerContextId === '' ) {
|
||||
setIsEmailLookupCompleted( true );
|
||||
}
|
||||
|
||||
if ( ! lookup || ! lookup.customerContextId ) {
|
||||
console.warn( 'No customerContextId found in the response' );
|
||||
return;
|
||||
|
@ -50,9 +55,13 @@ export const createEmailLookupHandler = (
|
|||
|
||||
const { authenticationState, profileData } = authResponse;
|
||||
|
||||
// OTP success/fail/cancel flow
|
||||
if ( authResponse ) {
|
||||
setIsEmailLookupCompleted( true );
|
||||
}
|
||||
|
||||
if ( authenticationState === 'succeeded' ) {
|
||||
snapshotFields( wooShippingAddress, wooBillingAddress );
|
||||
|
||||
setIsGuest( false );
|
||||
|
||||
if ( profileData && profileData.shippingAddress ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue