sfc-utils 1.4.68 → 1.4.70

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.
@@ -1,4 +1,4 @@
1
- import React, { useRef, useState } from "react";
1
+ import React, { useRef, useState, useEffect } from "react";
2
2
  import * as geocoderStyles from "../styles/modules/geocoder.module.less";
3
3
 
4
4
  // This is a singleton event listener that we can use to add/remove event listeners
@@ -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
- formData.append("region", filterRegion);
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} />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.4.68",
3
+ "version": "1.4.70",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",