@spothero/ui 13.10.0-beta.2 → 13.10.0-beta.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 13.10.0-beta.3 - 02/22/2022
2
+
3
+ ## Miscellaneous Updates
4
+ * [[2437627](https://github.com/spothero/fe-ui/commit/2437627)] - `chore:` Reworked proptypes and location biasing (Nathan)
5
+
1
6
  # 13.10.0-beta.2 - 02/22/2022
2
7
 
3
8
  ## Miscellaneous Updates
package/CHANGELOG.tmp CHANGED
@@ -1,5 +1,5 @@
1
- # 13.10.0-beta.2 - 02/22/2022
1
+ # 13.10.0-beta.3 - 02/22/2022
2
2
 
3
3
  ## Miscellaneous Updates
4
- * [[762fc94](https://github.com/spothero/fe-ui/commit/762fc94)] - `chore:` Removed logging (Nathan)
4
+ * [[2437627](https://github.com/spothero/fe-ui/commit/2437627)] - `chore:` Reworked proptypes and location biasing (Nathan)
5
5
 
@@ -145,6 +145,8 @@ var GooglePlacesSearchInput = /*#__PURE__*/function (_Component) {
145
145
  });
146
146
  });
147
147
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_searchSuggestions", function (value) {
148
+ var _biasOptions$location, _biasOptions$location2, _biasOptions$location3, _biasOptions$location4;
149
+
148
150
  var _this$props = _this.props,
149
151
  country = _this$props.country,
150
152
  types = _this$props.types,
@@ -162,14 +164,16 @@ var GooglePlacesSearchInput = /*#__PURE__*/function (_Component) {
162
164
  }
163
165
  }), types && {
164
166
  types: types
165
- }), (biasOptions === null || biasOptions === void 0 ? void 0 : biasOptions.location) && {
166
- location: new _this._gmaps.LatLng(location.latitude, location.longitude),
167
+ }), biasOptions && {
168
+ location: new _this._gmaps.LatLng(biasOptions === null || biasOptions === void 0 ? void 0 : (_biasOptions$location = biasOptions.location) === null || _biasOptions$location === void 0 ? void 0 : _biasOptions$location.latitude, biasOptions === null || biasOptions === void 0 ? void 0 : (_biasOptions$location2 = biasOptions.location) === null || _biasOptions$location2 === void 0 ? void 0 : _biasOptions$location2.longitude),
167
169
  radius: biasOptions === null || biasOptions === void 0 ? void 0 : biasOptions.radius,
168
- origin: new _this._gmaps.LatLng(location.latitude, location.longitude)
170
+ origin: new _this._gmaps.LatLng(biasOptions === null || biasOptions === void 0 ? void 0 : (_biasOptions$location3 = biasOptions.location) === null || _biasOptions$location3 === void 0 ? void 0 : _biasOptions$location3.latitude, biasOptions === null || biasOptions === void 0 ? void 0 : (_biasOptions$location4 = biasOptions.location) === null || _biasOptions$location4 === void 0 ? void 0 : _biasOptions$location4.longitude)
169
171
  }), {}, {
170
172
  sessionToken: autocompleteSessionToken
171
173
  });
172
174
 
175
+ console.log(options);
176
+
173
177
  _this._autocompleteService.getPlacePredictions(options, function (suggestions) {
174
178
  if (suggestions) {
175
179
  (0, _map.default)(suggestions).call(suggestions, function (suggestion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spothero/ui",
3
- "version": "13.10.0-beta.2",
3
+ "version": "13.10.0-beta.3",
4
4
  "description": "SpotHero's React component UI library.",
5
5
  "main": "v2/index-bundled-cjs/index.js",
6
6
  "module": "v2/index.js",
@@ -37,14 +37,7 @@ export default class GooglePlacesSearchInput extends Component {
37
37
  longitude: PropTypes.number,
38
38
  }),
39
39
  /** The radius, in meters, to bias the search results within - required when providing a location for biasing */
40
- radius: (props, propName) =>
41
- props.biasOptions.location.latitude &&
42
- props.biasOptions.location.longitude &&
43
- (Boolean(props[propName]) === false ||
44
- typeof props[propName] !== 'number') &&
45
- new Error(
46
- 'A radius value is required when biasing autocomplete suggestions'
47
- ),
40
+ radius: PropTypes.number,
48
41
  }),
49
42
  };
50
43
  static defaultProps = {
@@ -145,20 +138,22 @@ export default class GooglePlacesSearchInput extends Component {
145
138
  },
146
139
  }),
147
140
  ...(types && {types}),
148
- ...(biasOptions?.location && {
141
+ ...(biasOptions && {
149
142
  location: new this._gmaps.LatLng(
150
- location.latitude,
151
- location.longitude
143
+ biasOptions?.location?.latitude,
144
+ biasOptions?.location?.longitude
152
145
  ),
153
146
  radius: biasOptions?.radius,
154
147
  origin: new this._gmaps.LatLng(
155
- location.latitude,
156
- location.longitude
148
+ biasOptions?.location?.latitude,
149
+ biasOptions?.location?.longitude
157
150
  ),
158
151
  }),
159
152
  sessionToken: autocompleteSessionToken,
160
153
  };
161
154
 
155
+ console.log(options);
156
+
162
157
  this._autocompleteService.getPlacePredictions(options, suggestions => {
163
158
  if (suggestions) {
164
159
  suggestions.map(suggestion => {