|
5 | 5 | } from '@stripe/react-stripe-js'
|
6 | 6 | import { StripeCardCvcElementChangeEvent, StripeCardExpiryElementChangeEvent, StripeCardNumberElementChangeEvent } from '@stripe/stripe-js'
|
7 | 7 | import cn from 'classnames'
|
8 |
| -import React, { Dispatch, SetStateAction, useState } from 'react' |
| 8 | +import React, { Dispatch, SetStateAction, useContext, useState } from 'react' |
9 | 9 |
|
10 |
| -import { Button, OrderContractModal } from '..' |
| 10 | +import { Button, OrderContractModal, profileContext, ProfileContextData } from '..' |
11 | 11 | import { InputText } from '../form/form-groups/form-input'
|
12 | 12 | import { InputWrapper } from '../form/form-groups/form-input/input-wrapper'
|
13 | 13 | import ReactSelect from '../react-select/ReactSelect'
|
@@ -52,6 +52,7 @@ const PaymentForm: React.FC<PaymentFormProps> = (props: PaymentFormProps) => {
|
52 | 52 | const [cardNumberError, setCardNumberError]: [string, Dispatch<string>] = useState<string>('')
|
53 | 53 | const [cardExpiryError, setCardExpiryError]: [string, Dispatch<string>] = useState<string>('')
|
54 | 54 | const [cardCVVError, setCardCVVError]: [string, Dispatch<string>] = useState<string>('')
|
| 55 | + const { profile }: ProfileContextData = useContext<ProfileContextData>(profileContext) |
55 | 56 |
|
56 | 57 | const [formState, setFormState]: [FieldDirtyState, Dispatch<SetStateAction<FieldDirtyState>>] = useState<FieldDirtyState>({
|
57 | 58 | cardCvv: false,
|
@@ -100,7 +101,7 @@ const PaymentForm: React.FC<PaymentFormProps> = (props: PaymentFormProps) => {
|
100 | 101 | tabIndex={1}
|
101 | 102 | type='text'
|
102 | 103 | onChange={(event) => props.onUpdateField('email', event.target.value)}
|
103 |
| - value={props.formData.email} |
| 104 | + value={profile?.email} |
104 | 105 | />
|
105 | 106 |
|
106 | 107 | <div className={styles['label']}>Card Information</div>
|
@@ -174,7 +175,7 @@ const PaymentForm: React.FC<PaymentFormProps> = (props: PaymentFormProps) => {
|
174 | 175 | tabIndex={1}
|
175 | 176 | type='text'
|
176 | 177 | onChange={(event) => props.onUpdateField('name', event.target.value)}
|
177 |
| - value={props.formData.name} |
| 178 | + value={`${profile?.firstName} ${profile?.lastName}`} |
178 | 179 | />
|
179 | 180 |
|
180 | 181 | <InputWrapper className={styles['input-wrapper']} label='Country' tabIndex={3} type='text' disabled={false}>
|
|
0 commit comments