import React from 'react' import type { ReactParentComponent } from '@packages/shared' import { useNeoRegionBootstrap } from '@/src/hooks/useRegionNeo' import { useNeoRegionStore } from '@/src/store/neoRegionStore' import NeoAddressFlow from '@/src/components/location/neo/NeoAddressFlow' import NeoConfirmLocation from '@/src/components/location/neo/NeoConfirmLocation' import NeoLoadingScreen from '@/src/components/location/neo/NeoLoadingScreen' /** * The neo region gate. It runs the launch decision and watches the store * directly — it never calls `useRegionNeo`, because that hook is only valid for * components behind this gate. Children appear once the store holds a complete * region; the two flow flags take over when the decision needs input. */ const LocationWrapperNeo: React.FC = ({ children }) => { useNeoRegionBootstrap() const regionId = useNeoRegionStore((state) => state.regionId) const boundId = useNeoRegionStore((state) => state.boundId) const regionName = useNeoRegionStore((state) => state.regionName) const coords = useNeoRegionStore((state) => state.coords) const needsAddressFormFlow = useNeoRegionStore((state) => state.needsAddressFormFlow) const needsAddressConfirmation = useNeoRegionStore((state) => state.needsAddressConfirmation) if (needsAddressFormFlow) return if (regionId == null || boundId == null || regionName == null || coords == null) { return } if (needsAddressConfirmation) return return <>{children} } export default LocationWrapperNeo