// lib/getStateInfoClient.js import citiesData from "@/data/city.json"; import statesData from "@/data/state.json"; export function getStateInfoClient() { if (typeof window === "undefined") return { matchedCity: null, matchedState: null }; const host = window.location.host || ""; const subdomain = host.split(".")[0]; const matchedCity = citiesData.find((city) => city.domain.includes(subdomain) ); const matchedState = matchedCity && statesData.find((state) => state.id === matchedCity.province_id); return { matchedCity, matchedState }; }