instantsearch.js 4.41.2 → 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.
@@ -1,6 +1,6 @@
1
1
  import type { SendEventForHits } from '../../lib/utils';
2
2
  import type { Connector, GeoLoc, Hit, TransformItems, WidgetRenderState } from '../../types';
3
- export declare type GeoHit = Hit & Required<Pick<Hit, '_geoLoc'>>;
3
+ export declare type GeoHit = Hit & Required<Pick<Hit, '_geoloc'>>;
4
4
  declare type Bounds = {
5
5
  /**
6
6
  * The top right corner of the map view.
@@ -215,7 +215,7 @@ var connectRatingMenu = function connectRatingMenu(renderFn) {
215
215
  var maxValuesPerFacet = facetResults.length;
216
216
  var maxDecimalPlaces = getFacetsMaxDecimalPlaces(facetResults);
217
217
  var maxFacets = Math.pow(10, maxDecimalPlaces) * max;
218
- process.env.NODE_ENV === 'development' ? warning(maxFacets <= maxValuesPerFacet, getFacetValuesWarningMessage({
218
+ process.env.NODE_ENV === 'development' ? warning(maxFacets <= maxValuesPerFacet || Boolean(results.__isArtificial), getFacetValuesWarningMessage({
219
219
  maxDecimalPlaces: maxDecimalPlaces,
220
220
  maxFacets: maxFacets,
221
221
  maxValuesPerFacet: maxValuesPerFacet
package/es/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import { createInfiniteHitsSessionStorageCache } from './lib/infiniteHitsCache';
6
6
  declare type InstantSearchModule = {
7
7
  <TUiState = Record<string, unknown>, TRouteState = TUiState>(options: InstantSearchOptions<Expand<UiState & TUiState>, TRouteState>): InstantSearch<Expand<UiState & TUiState>, TRouteState>;
8
8
  version: string;
9
- /** @deprecated import { createInfiniteHitsSessionStorageCache } from 'instantsearch.js/es/helpers' */
9
+ /** @deprecated import { createInfiniteHitsSessionStorageCache } from 'instantsearch.js/es/lib/infiniteHitsCache' */
10
10
  createInfiniteHitsSessionStorageCache: typeof createInfiniteHitsSessionStorageCache;
11
11
  /** @deprecated import { highlight } from 'instantsearch.js/es/helpers' */
12
12
  highlight: typeof highlight;
package/es/index.js CHANGED
@@ -24,7 +24,7 @@ var instantsearch = function instantsearch(options) {
24
24
  };
25
25
 
26
26
  instantsearch.version = version;
27
- instantsearch.createInfiniteHitsSessionStorageCache = deprecate(createInfiniteHitsSessionStorageCache, "import { createInfiniteHitsSessionStorageCache } from 'instantsearch.js/es/helpers'");
27
+ instantsearch.createInfiniteHitsSessionStorageCache = deprecate(createInfiniteHitsSessionStorageCache, "import { createInfiniteHitsSessionStorageCache } from 'instantsearch.js/es/lib/infiniteHitsCache'");
28
28
  instantsearch.highlight = deprecate(highlight, "import { highlight } from 'instantsearch.js/es/helpers'");
29
29
  instantsearch.reverseHighlight = deprecate(reverseHighlight, "import { reverseHighlight } from 'instantsearch.js/es/helpers'");
30
30
  instantsearch.snippet = deprecate(snippet, "import { snippet } from 'instantsearch.js/es/helpers'");
@@ -424,12 +424,22 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
424
424
 
425
425
  mainHelper.on('error', function (_ref4) {
426
426
  var error = _ref4.error;
427
- // If an error is emitted, it is re-thrown by events. In previous versions
427
+
428
+ if (!(error instanceof Error)) {
429
+ // typescript lies here, error is in some cases { name: string, message: string }
430
+ var err = error;
431
+ error = Object.keys(err).reduce(function (acc, key) {
432
+ acc[key] = err[key];
433
+ return acc;
434
+ }, new Error(err.message));
435
+ } // If an error is emitted, it is re-thrown by events. In previous versions
428
436
  // we emitted {error}, which is thrown as:
429
437
  // "Uncaught, unspecified \"error\" event. ([object Object])"
430
438
  // To avoid breaking changes, we make the error available in both
431
439
  // `error` and `error.error`
432
440
  // @MAJOR emit only error
441
+
442
+
433
443
  error.error = error;
434
444
 
435
445
  _this3.emit('error', error);
@@ -1,2 +1,2 @@
1
- declare const _default: "4.41.2";
1
+ declare const _default: "4.43.1";
2
2
  export default _default;
package/es/lib/version.js CHANGED
@@ -1 +1 @@
1
- export default '4.41.2';
1
+ export default '4.43.1';
@@ -1,41 +1,2 @@
1
- import type algoliasearch from 'algoliasearch/lite';
2
- import type * as AlgoliaSearch from 'algoliasearch/lite';
3
- // @ts-ignore
4
- import type * as ClientSearch from '@algolia/client-search';
5
- // @ts-ignore
6
- declare type SearchResponseV3<TObject> = AlgoliaSearch.Response<TObject>;
7
- // @ts-ignore
8
- declare type SearchResponseV4<TObject> = ClientSearch.SearchResponse<TObject>;
9
- declare type SearchForFacetValuesResponseV3 =
10
- // @ts-ignore
11
- AlgoliaSearch.SearchForFacetValues.Response;
12
- // @ts-ignore
13
- declare type SearchForFacetValuesResponseV4 = ClientSearch.SearchForFacetValuesResponse;
14
- declare type RelevantSortResponse = {
15
- appliedRelevancyStrictness?: number;
16
- nbSortedHits?: number;
17
- };
18
- declare type DummySearchClientV4 = {
19
- readonly transporter: any;
20
- };
21
- declare type DefaultSearchClient = ReturnType<typeof algoliasearch>;
22
- declare type SearchIndex = ReturnType<DefaultSearchClient['initIndex']>;
23
- export declare type SearchClient = {
24
- search: DefaultSearchClient['search'];
25
- searchForFacetValues: DefaultSearchClient['searchForFacetValues'];
26
- addAlgoliaAgent?: DefaultSearchClient['addAlgoliaAgent'];
27
- initIndex?: (indexName: string) => SearchIndex extends {
28
- findAnswers: any;
29
- } ? Partial<Pick<SearchIndex, 'findAnswers'>> : SearchIndex;
30
- };
31
- export declare type MultiResponse<THit = any> = {
32
- results: Array<SearchResponse<THit>>;
33
- };
34
- export declare type SearchResponse<THit> = DefaultSearchClient extends DummySearchClientV4 ? SearchResponseV4<THit> : SearchResponseV3<THit> & RelevantSortResponse;
35
- export declare type SearchForFacetValuesResponse = DefaultSearchClient extends DummySearchClientV4 ? SearchForFacetValuesResponseV4 : SearchForFacetValuesResponseV3;
36
- export declare type FindAnswersParameters = SearchIndex extends {
37
- findAnswers: (...params: infer Params) => any;
38
- } ? Params : any;
39
- export declare type FindAnswersOptions = DefaultSearchClient extends DummySearchClientV4 ? ClientSearch.FindAnswersOptions : any;
40
- export declare type FindAnswersResponse<TObject> = DefaultSearchClient extends DummySearchClientV4 ? ClientSearch.FindAnswersResponse<TObject> : any;
1
+ export * from 'algoliasearch-helper/types/algoliasearch.js';
41
2
  export {};
@@ -0,0 +1,2 @@
1
+ export * from 'algoliasearch-helper/types/algoliasearch.js';
2
+ export {};
package/es/types/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // internal
2
2
  export * from "./utils.js"; // Algolia-related
3
+ // eslint-disable-next-line import/export
3
4
 
4
5
  export * from "./algoliasearch.js";
5
6
  export * from "./results.js"; // component-related
@@ -38,7 +38,7 @@ export declare type AlgoliaHit<THit extends BaseHit = Record<string, any>> = {
38
38
  };
39
39
  };
40
40
  _distinctSeqID?: number;
41
- _geoLoc?: GeoLoc;
41
+ _geoloc?: GeoLoc;
42
42
  } & THit;
43
43
  export declare type BaseHit = Record<string, unknown>;
44
44
  export declare type Hit<THit extends BaseHit = Record<string, any>> = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instantsearch.js",
3
- "version": "4.41.2",
3
+ "version": "4.43.1",
4
4
  "description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
5
5
  "homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
6
6
  "types": "es/index.d.ts",
@@ -57,7 +57,7 @@
57
57
  "@types/google.maps": "^3.45.3",
58
58
  "@types/hogan.js": "^3.0.0",
59
59
  "@types/qs": "^6.5.3",
60
- "algoliasearch-helper": "^3.8.3",
60
+ "algoliasearch-helper": "^3.10.0",
61
61
  "classnames": "^2.2.5",
62
62
  "hogan.js": "^3.0.2",
63
63
  "preact": "^10.6.0",
@@ -146,7 +146,7 @@
146
146
  "webpack": "4.41.5"
147
147
  },
148
148
  "peerDependencies": {
149
- "algoliasearch": ">= 3.1 < 5"
149
+ "algoliasearch": ">= 3.1 < 6"
150
150
  },
151
151
  "resolutions": {
152
152
  "places.js/algoliasearch": "3.35.0"