From 4660950eeed460b4a54da10a582dc5ac04ce5b9a Mon Sep 17 00:00:00 2001 From: internxt-yu Date: Thu, 2 Jul 2026 15:52:45 +0200 Subject: [PATCH] the flags and phone prefix in Contact sales form changes depending the client location --- src/components/shared/ContactSalesForm.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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;