Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/components/shared/ContactSalesForm.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -141,6 +142,20 @@ export const ContactSalesForm = ({
const [isSubmitting, setIsSubmitting] = useState(false);
const [formStatus, setFormStatus] = useState<FormStatus>('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<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => {
const { id, value } = e.target;

Expand Down
Loading