@hanzo/commerce 7.0.13 → 7.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,23 +26,28 @@ const PaymentStepForm: React.FC<CheckoutStepComponentProps> = observer(({
|
|
|
26
26
|
setOrderId
|
|
27
27
|
}) => {
|
|
28
28
|
const cmmc = useCommerce()
|
|
29
|
-
const auth = useAuth()
|
|
29
|
+
const auth = useAuth() // may be null in some cases
|
|
30
|
+
|
|
30
31
|
const [transactionStatus, setTransactionStatus] = useState<TransactionStatus>('unpaid')
|
|
31
32
|
|
|
33
|
+
if (!auth) {
|
|
34
|
+
console.log("PAYMENT STEP FORM: auth service is null! ")
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
const contactForm = useForm<z.infer<typeof contactFormSchema>>({
|
|
33
38
|
resolver: zodResolver(contactFormSchema),
|
|
34
39
|
defaultValues: {
|
|
35
|
-
name: auth
|
|
36
|
-
email: auth
|
|
40
|
+
name: auth?.user?.displayName ?? '',
|
|
41
|
+
email: auth?.user?.email ?? '',
|
|
37
42
|
},
|
|
38
43
|
})
|
|
39
44
|
|
|
40
45
|
useEffect(() => {
|
|
41
|
-
if (auth
|
|
42
|
-
contactForm.setValue('name', auth
|
|
43
|
-
contactForm.setValue('email', auth
|
|
46
|
+
if (auth?.loggedIn) {
|
|
47
|
+
contactForm.setValue('name', auth!.user?.displayName ?? '')
|
|
48
|
+
contactForm.setValue('email', auth!.user?.email ?? '')
|
|
44
49
|
}
|
|
45
|
-
}, [auth
|
|
50
|
+
}, [auth?.loggedIn])
|
|
46
51
|
|
|
47
52
|
const storePaymentInfo = async (paymentInfo: any) => {
|
|
48
53
|
const {name, email} = contactForm.getValues()
|