|
|
@ -147,8 +147,6 @@ export function QuestionBirthplace({ |
|
|
if (typeof window !== "undefined") { |
|
|
if (typeof window !== "undefined") { |
|
|
const stored = localStorage.getItem(`residence_mode_${question.id}`); |
|
|
const stored = localStorage.getItem(`residence_mode_${question.id}`); |
|
|
if (stored === "manual" || stored === "auto") return stored; |
|
|
if (stored === "manual" || stored === "auto") return stored; |
|
|
const legacyChecked = localStorage.getItem("hasCheckedGeoIPResidence"); |
|
|
|
|
|
if (legacyChecked === "true") return "manual"; |
|
|
|
|
|
} |
|
|
} |
|
|
return "auto"; |
|
|
return "auto"; |
|
|
}); |
|
|
}); |
|
|
@ -280,15 +278,12 @@ export function QuestionBirthplace({ |
|
|
|
|
|
|
|
|
const storedMode = |
|
|
const storedMode = |
|
|
typeof window !== "undefined" |
|
|
typeof window !== "undefined" |
|
|
? localStorage.getItem(`residence_mode_${question.id}`) || |
|
|
|
|
|
(localStorage.getItem("hasCheckedGeoIPResidence") === "true" |
|
|
|
|
|
? "manual" |
|
|
|
|
|
: null) |
|
|
|
|
|
|
|
|
? localStorage.getItem(`residence_mode_${question.id}`) |
|
|
: null; |
|
|
: null; |
|
|
|
|
|
|
|
|
if (storedMode === "manual") { |
|
|
if (storedMode === "manual") { |
|
|
setMode("manual"); |
|
|
setMode("manual"); |
|
|
} else if (storedMode === "auto") { |
|
|
|
|
|
|
|
|
} else { |
|
|
setMode("auto"); |
|
|
setMode("auto"); |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
|
@ -342,10 +337,7 @@ export function QuestionBirthplace({ |
|
|
hasAutoDetectedRef.current = true; |
|
|
hasAutoDetectedRef.current = true; |
|
|
const storedMode = |
|
|
const storedMode = |
|
|
typeof window !== "undefined" |
|
|
typeof window !== "undefined" |
|
|
? localStorage.getItem(`residence_mode_${question.id}`) || |
|
|
|
|
|
(localStorage.getItem("hasCheckedGeoIPResidence") === "true" |
|
|
|
|
|
? "manual" |
|
|
|
|
|
: null) |
|
|
|
|
|
|
|
|
? localStorage.getItem(`residence_mode_${question.id}`) |
|
|
: null; |
|
|
: null; |
|
|
|
|
|
|
|
|
if (storedMode === "manual") { |
|
|
if (storedMode === "manual") { |
|
|
@ -355,7 +347,7 @@ export function QuestionBirthplace({ |
|
|
|
|
|
|
|
|
const parsed = parseValue(rawValue); |
|
|
const parsed = parseValue(rawValue); |
|
|
if (!parsed.country && !parsed.city) { |
|
|
if (!parsed.country && !parsed.city) { |
|
|
void detectLocation(); |
|
|
|
|
|
|
|
|
void detectLocation(false); |
|
|
} else { |
|
|
} else { |
|
|
void detectLocation(false); |
|
|
void detectLocation(false); |
|
|
} |
|
|
} |
|
|
@ -373,7 +365,6 @@ export function QuestionBirthplace({ |
|
|
const handleManualClick = () => { |
|
|
const handleManualClick = () => { |
|
|
if (typeof window !== "undefined") { |
|
|
if (typeof window !== "undefined") { |
|
|
localStorage.setItem(`residence_mode_${question.id}`, "manual"); |
|
|
localStorage.setItem(`residence_mode_${question.id}`, "manual"); |
|
|
localStorage.setItem("hasCheckedGeoIPResidence", "true"); |
|
|
|
|
|
} |
|
|
} |
|
|
setMode("manual"); |
|
|
setMode("manual"); |
|
|
const parsed = parseValue(rawValue); |
|
|
const parsed = parseValue(rawValue); |
|
|
@ -438,7 +429,6 @@ export function QuestionBirthplace({ |
|
|
const handleSelectCountry = (country: string) => { |
|
|
const handleSelectCountry = (country: string) => { |
|
|
if (typeof window !== "undefined") { |
|
|
if (typeof window !== "undefined") { |
|
|
localStorage.setItem(`residence_mode_${question.id}`, "manual"); |
|
|
localStorage.setItem(`residence_mode_${question.id}`, "manual"); |
|
|
localStorage.setItem("hasCheckedGeoIPResidence", "true"); |
|
|
|
|
|
} |
|
|
} |
|
|
setSelectedCountry(country); |
|
|
setSelectedCountry(country); |
|
|
selectedCountryStateRef.current = country; |
|
|
selectedCountryStateRef.current = country; |
|
|
@ -453,7 +443,6 @@ export function QuestionBirthplace({ |
|
|
const handleCityChange = (e: React.ChangeEvent<HTMLInputElement>) => { |
|
|
const handleCityChange = (e: React.ChangeEvent<HTMLInputElement>) => { |
|
|
if (typeof window !== "undefined") { |
|
|
if (typeof window !== "undefined") { |
|
|
localStorage.setItem(`residence_mode_${question.id}`, "manual"); |
|
|
localStorage.setItem(`residence_mode_${question.id}`, "manual"); |
|
|
localStorage.setItem("hasCheckedGeoIPResidence", "true"); |
|
|
|
|
|
} |
|
|
} |
|
|
const newCity = e.target.value; |
|
|
const newCity = e.target.value; |
|
|
cityInputStateRef.current = newCity; |
|
|
cityInputStateRef.current = newCity; |
|
|
|