diff --git a/src/components/shared/ContactSalesForm.tsx b/src/components/shared/ContactSalesForm.tsx index f241e8fc7..00fe01210 100644 --- a/src/components/shared/ContactSalesForm.tsx +++ b/src/components/shared/ContactSalesForm.tsx @@ -1,7 +1,8 @@ import { CaretDown, CheckCircle, WarningCircle } from '@phosphor-icons/react'; import axios from 'axios'; -import { useState, useCallback } from 'react'; +import { useState, useEffect, useCallback } from 'react'; import debounce from 'lodash.debounce'; +import { currencyService } from '@/services/currency.service'; interface ContactSalesFormProps { textContent: any; @@ -141,6 +142,20 @@ export const ContactSalesForm = ({ const [isSubmitting, setIsSubmitting] = useState(false); const [formStatus, setFormStatus] = useState('default'); + useEffect(() => { + currencyService + .getCountry() + .then(({ country }) => { + const prefix = PHONE_PREFIXES.find((prefix) => prefix.label.includes(country)); + if(prefix) { + setPhonePrefix(prefix.code); + } + }) + .catch(() => { + // No OP + }) + },[]) + const handleChange = (e: React.ChangeEvent) => { const { id, value } = e.target;