instantsearch.js 4.43.0 → 4.43.1

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,14 @@
1
+ ## [4.43.1](https://github.com/algolia/instantsearch.js/compare/v4.43.0...v4.43.1) (2022-07-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **errors:** rethrow error as error if it's an object ([#5075](https://github.com/algolia/instantsearch.js/issues/5075)) ([34132bb](https://github.com/algolia/instantsearch.js/commit/34132bba38c05fa2f5e4e54c6889e9335e62e4f4))
7
+ * **ratingMenu:** don't warn if results are artificial ([#5073](https://github.com/algolia/instantsearch.js/issues/5073)) ([d747d23](https://github.com/algolia/instantsearch.js/commit/d747d23b28c380fe82a40eeab06c57359af8004a))
8
+ * **types:** use correct case for _geoloc property ([#5074](https://github.com/algolia/instantsearch.js/issues/5074)) ([6fed7d8](https://github.com/algolia/instantsearch.js/commit/6fed7d870c3607980776d33a3697f8e2789aa08b))
9
+
10
+
11
+
1
12
  # [4.43.0](https://github.com/algolia/instantsearch.js/compare/v4.42.0...v4.43.0) (2022-06-28)
2
13
 
3
14
 
@@ -223,7 +223,7 @@ var connectRatingMenu = function connectRatingMenu(renderFn) {
223
223
  var maxValuesPerFacet = facetResults.length;
224
224
  var maxDecimalPlaces = getFacetsMaxDecimalPlaces(facetResults);
225
225
  var maxFacets = Math.pow(10, maxDecimalPlaces) * max;
226
- process.env.NODE_ENV === 'development' ? (0, _index.warning)(maxFacets <= maxValuesPerFacet, getFacetValuesWarningMessage({
226
+ process.env.NODE_ENV === 'development' ? (0, _index.warning)(maxFacets <= maxValuesPerFacet || Boolean(results.__isArtificial), getFacetValuesWarningMessage({
227
227
  maxDecimalPlaces: maxDecimalPlaces,
228
228
  maxFacets: maxFacets,
229
229
  maxValuesPerFacet: maxValuesPerFacet
@@ -445,12 +445,22 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
445
445
 
446
446
  mainHelper.on('error', function (_ref4) {
447
447
  var error = _ref4.error;
448
- // If an error is emitted, it is re-thrown by events. In previous versions
448
+
449
+ if (!(error instanceof Error)) {
450
+ // typescript lies here, error is in some cases { name: string, message: string }
451
+ var err = error;
452
+ error = Object.keys(err).reduce(function (acc, key) {
453
+ acc[key] = err[key];
454
+ return acc;
455
+ }, new Error(err.message));
456
+ } // If an error is emitted, it is re-thrown by events. In previous versions
449
457
  // we emitted {error}, which is thrown as:
450
458
  // "Uncaught, unspecified \"error\" event. ([object Object])"
451
459
  // To avoid breaking changes, we make the error available in both
452
460
  // `error` and `error.error`
453
461
  // @MAJOR emit only error
462
+
463
+
454
464
  error.error = error;
455
465
 
456
466
  _this3.emit('error', error);
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.43.0';
7
+ var _default = '4.43.1';
8
8
  exports.default = _default;
@@ -34,7 +34,7 @@ declare type AlgoliaHit<THit extends BaseHit = Record<string, any>> = {
34
34
  };
35
35
  };
36
36
  _distinctSeqID?: number;
37
- _geoLoc?: GeoLoc;
37
+ _geoloc?: GeoLoc;
38
38
  } & THit;
39
39
 
40
40
  declare const analytics: AnalyticsWidget;
@@ -1169,7 +1169,7 @@ declare const EXPERIMENTAL_connectDynamicWidgets: DynamicWidgetsConnector;
1169
1169
  /** @deprecated use dynamicWidgets */
1170
1170
  declare const EXPERIMENTAL_dynamicWidgets: DynamicWidgetsWidget;
1171
1171
 
1172
- declare type GeoHit = Hit & Required<Pick<Hit, '_geoLoc'>>;
1172
+ declare type GeoHit = Hit & Required<Pick<Hit, '_geoloc'>>;
1173
1173
 
1174
1174
  declare type GeoLoc = {
1175
1175
  lat: number;
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.43.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
1
+ /*! InstantSearch.js 4.43.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -8603,7 +8603,7 @@
8603
8603
  instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
8604
8604
  }
8605
8605
 
8606
- var version$1 = '4.43.0';
8606
+ var version$1 = '4.43.1';
8607
8607
 
8608
8608
  var NAMESPACE = 'ais';
8609
8609
  var component = function component(componentName) {
@@ -10477,12 +10477,22 @@
10477
10477
 
10478
10478
  mainHelper.on('error', function (_ref4) {
10479
10479
  var error = _ref4.error;
10480
- // If an error is emitted, it is re-thrown by events. In previous versions
10480
+
10481
+ if (!(error instanceof Error)) {
10482
+ // typescript lies here, error is in some cases { name: string, message: string }
10483
+ var err = error;
10484
+ error = Object.keys(err).reduce(function (acc, key) {
10485
+ acc[key] = err[key];
10486
+ return acc;
10487
+ }, new Error(err.message));
10488
+ } // If an error is emitted, it is re-thrown by events. In previous versions
10481
10489
  // we emitted {error}, which is thrown as:
10482
10490
  // "Uncaught, unspecified \"error\" event. ([object Object])"
10483
10491
  // To avoid breaking changes, we make the error available in both
10484
10492
  // `error` and `error.error`
10485
10493
  // @MAJOR emit only error
10494
+
10495
+
10486
10496
  error.error = error;
10487
10497
 
10488
10498
  _this3.emit('error', error);
@@ -13612,7 +13622,7 @@
13612
13622
  var maxValuesPerFacet = facetResults.length;
13613
13623
  var maxDecimalPlaces = getFacetsMaxDecimalPlaces(facetResults);
13614
13624
  var maxFacets = Math.pow(10, maxDecimalPlaces) * max;
13615
- _warning(maxFacets <= maxValuesPerFacet, getFacetValuesWarningMessage({
13625
+ _warning(maxFacets <= maxValuesPerFacet || Boolean(results.__isArtificial), getFacetValuesWarningMessage({
13616
13626
  maxDecimalPlaces: maxDecimalPlaces,
13617
13627
  maxFacets: maxFacets,
13618
13628
  maxValuesPerFacet: maxValuesPerFacet