sfc-utils 1.4.68 → 1.4.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/geocoder.mjs +12 -2
- package/package.json +1 -1
package/components/geocoder.mjs
CHANGED
|
@@ -23,8 +23,9 @@ const Geocoder = ({
|
|
|
23
23
|
filterRegion, // You need to test results, but could also pass in a neighbourhood, district, city, county, state or administrative area
|
|
24
24
|
market, // Will filter by the market's state if no filterRegion provided
|
|
25
25
|
resultFunc,
|
|
26
|
-
buttonTrackingId,
|
|
26
|
+
// buttonTrackingId, // To be used for analytics once system is more finalized
|
|
27
27
|
placeholder,
|
|
28
|
+
inputValueOverride, // Used to clear/change the input value from the parent component
|
|
28
29
|
}) => {
|
|
29
30
|
// Show a loader when we're requesting
|
|
30
31
|
const [loading, setLoading] = useState(false);
|
|
@@ -66,7 +67,9 @@ const Geocoder = ({
|
|
|
66
67
|
// POST as form url encoded data
|
|
67
68
|
let formData = new FormData();
|
|
68
69
|
formData.append("query", query);
|
|
69
|
-
|
|
70
|
+
if(filterRegion != "United States"){
|
|
71
|
+
formData.append("region", filterRegion);
|
|
72
|
+
}
|
|
70
73
|
// Remove any existing event listeners
|
|
71
74
|
setSingletonEventListener("keydown");
|
|
72
75
|
// Make req
|
|
@@ -176,6 +179,13 @@ const Geocoder = ({
|
|
|
176
179
|
}
|
|
177
180
|
};
|
|
178
181
|
|
|
182
|
+
// If the parent component passes in a string for inputValueOverride, use it
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
if (typeof inputValueOverride === 'string' || inputValueOverride instanceof String) {
|
|
185
|
+
setInputValue(inputValueOverride)
|
|
186
|
+
}
|
|
187
|
+
}, [inputValueOverride])
|
|
188
|
+
|
|
179
189
|
return (
|
|
180
190
|
<div className={geocoderStyles.wrapper}>
|
|
181
191
|
<div className={geocoderStyles.icon} />
|