instantsearch.js 4.45.0 → 4.45.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,11 +1,11 @@
1
1
  /** @jsx h */
2
2
  import { h } from 'preact';
3
3
  import type { AnswersCSSClasses, AnswersTemplates } from '../../widgets/answers/answers';
4
- import type { ComponentCSSClasses, Hits } from '../../types';
4
+ import type { ComponentCSSClasses, Hit } from '../../types';
5
5
  export declare type AnswersComponentCSSClasses = ComponentCSSClasses<AnswersCSSClasses>;
6
6
  export declare type AnswersComponentTemplates = Required<AnswersTemplates>;
7
7
  export declare type AnswersProps = {
8
- hits: Hits;
8
+ hits: Hit[];
9
9
  isLoading: boolean;
10
10
  cssClasses: AnswersComponentCSSClasses;
11
11
  templateProps: {
@@ -2,14 +2,14 @@
2
2
  import { h } from 'preact';
3
3
  import type { SearchResults } from 'algoliasearch-helper';
4
4
  import type { BindEventForHits, SendEventForHits } from '../../lib/utils';
5
- import type { ComponentCSSClasses, Hits as HitsArray } from '../../types';
5
+ import type { ComponentCSSClasses, Hit } from '../../types';
6
6
  import type { HitsCSSClasses, HitsTemplates } from '../../widgets/hits/hits';
7
7
  import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps';
8
8
  export declare type HitsComponentCSSClasses = ComponentCSSClasses<HitsCSSClasses>;
9
9
  export declare type HitsComponentTemplates = Required<HitsTemplates>;
10
10
  export declare type HitsProps = {
11
11
  results: SearchResults;
12
- hits: HitsArray;
12
+ hits: Hit[];
13
13
  sendEvent?: SendEventForHits;
14
14
  bindEvent?: BindEventForHits;
15
15
  cssClasses: HitsComponentCSSClasses;
@@ -1,14 +1,14 @@
1
1
  /** @jsx h */
2
2
  import { h } from 'preact';
3
3
  import type { SearchResults } from 'algoliasearch-helper';
4
- import type { ComponentCSSClasses, Hits } from '../../types';
4
+ import type { ComponentCSSClasses, Hit } from '../../types';
5
5
  import type { InfiniteHitsCSSClasses, InfiniteHitsTemplates } from '../../widgets/infinite-hits/infinite-hits';
6
6
  import type { SendEventForHits, BindEventForHits } from '../../lib/utils';
7
7
  export declare type InfiniteHitsComponentCSSClasses = ComponentCSSClasses<InfiniteHitsCSSClasses>;
8
8
  export declare type InfiniteHitsComponentTemplates = Required<InfiniteHitsTemplates>;
9
9
  export declare type InfiniteHitsProps = {
10
10
  cssClasses: InfiniteHitsComponentCSSClasses;
11
- hits: Hits;
11
+ hits: Hit[];
12
12
  results: SearchResults;
13
13
  hasShowPrevious: boolean;
14
14
  showPrevious: () => void;
@@ -1,9 +1,9 @@
1
- import type { Connector, Hits, FindAnswersOptions, WidgetRenderState } from '../../types';
1
+ import type { Connector, Hit, FindAnswersOptions, WidgetRenderState } from '../../types';
2
2
  export declare type AnswersRenderState = {
3
3
  /**
4
4
  * The matched hits from Algolia API.
5
5
  */
6
- hits: Hits;
6
+ hits: Hit[];
7
7
  /**
8
8
  * Whether it's still loading the results from the Answers API.
9
9
  */
@@ -1,6 +1,6 @@
1
1
  import type { SearchResults } from 'algoliasearch-helper';
2
2
  import type { SendEventForHits } from '../../lib/utils';
3
- import type { Hits, Connector, WidgetRenderState } from '../../types';
3
+ import type { Hit, Connector, WidgetRenderState } from '../../types';
4
4
  export declare type AutocompleteConnectorParams = {
5
5
  /**
6
6
  * Escapes HTML entities from hits string values.
@@ -25,7 +25,7 @@ export declare type AutocompleteRenderState = {
25
25
  /**
26
26
  * The resolved hits from the index matching the query.
27
27
  */
28
- hits: Hits;
28
+ hits: Hit[];
29
29
  /**
30
30
  * The full results object from the Algolia API.
31
31
  */
@@ -212,9 +212,9 @@ var connectRatingMenu = function connectRatingMenu(renderFn) {
212
212
 
213
213
  var refinementIsApplied = false;
214
214
  var totalCount = 0;
215
+ var facetResults = results === null || results === void 0 ? void 0 : results.getFacetValues(attribute, {});
215
216
 
216
- if (results) {
217
- var facetResults = results.getFacetValues(attribute, {});
217
+ if (results && facetResults) {
218
218
  var maxValuesPerFacet = facetResults.length;
219
219
  var maxDecimalPlaces = getFacetsMaxDecimalPlaces(facetResults);
220
220
  var maxFacets = Math.pow(10, maxDecimalPlaces) * max;
@@ -1,9 +1,9 @@
1
1
  import type { SearchResults } from 'algoliasearch-helper';
2
- import type { Hits, InsightsClientMethod, InsightsClientPayload, Connector } from '../../types';
2
+ import type { Hit, InsightsClientMethod, InsightsClientPayload, Connector } from '../../types';
3
3
  export declare const inferPayload: ({ method, results, hits, objectIDs, }: {
4
4
  method: InsightsClientMethod;
5
5
  results: SearchResults;
6
- hits: Hits;
6
+ hits: Hit[];
7
7
  objectIDs: string[];
8
8
  }) => Omit<InsightsClientPayload, 'eventName'>;
9
9
  /**
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @jest-environment jsdom
3
3
  */
4
- import type { InstantSearch, Hit, Hits } from '../../types';
5
- declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => void;
4
+ import type { InstantSearch, Hit } from '../../types';
5
+ declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => void;
6
6
  declare type CustomSendEventForHits = (customPayload: any) => void;
7
7
  export declare type SendEventForHits = BuiltInSendEventForHits & CustomSendEventForHits;
8
- declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => string;
8
+ declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => string;
9
9
  declare type CustomBindEventForHits = (customPayload: any) => string;
10
10
  export declare type BindEventForHits = BuiltInBindEventForHits & CustomBindEventForHits;
11
11
  export declare function createSendEventForHits({ instantSearchInstance, index, widgetType, }: {
@@ -1,2 +1,2 @@
1
- declare const _default: "4.45.0";
1
+ declare const _default: "4.45.1";
2
2
  export default _default;
package/es/lib/version.js CHANGED
@@ -1 +1 @@
1
- export default '4.45.0';
1
+ export default '4.45.1';
@@ -1,7 +1,7 @@
1
1
  import type { SearchResults } from 'algoliasearch-helper';
2
2
  import type { InstantSearch } from './instantsearch';
3
3
  import type { InsightsClient } from './insights';
4
- import type { Hits } from './results';
4
+ import type { Hit } from './results';
5
5
  import type { UnknownWidgetParams, Widget, WidgetDescription } from './widget';
6
6
  /**
7
7
  * The base renderer options. All render functions receive
@@ -25,7 +25,7 @@ export declare type RendererOptions<TWidgetParams> = {
25
25
  * The mutable list of hits. The may change depending
26
26
  * of the given transform items function.
27
27
  */
28
- hits?: Hits;
28
+ hits?: Hit[];
29
29
  /**
30
30
  * The current insights client, if any.
31
31
  */
@@ -24,7 +24,7 @@ var renderer = function renderer(_ref) {
24
24
  templates = _ref.templates;
25
25
  return function (_ref2, isFirstRendering) {
26
26
  var refine = _ref2.refine,
27
- hasRefinements = _ref2.hasRefinements,
27
+ canRefine = _ref2.canRefine,
28
28
  instantSearchInstance = _ref2.instantSearchInstance;
29
29
 
30
30
  if (isFirstRendering) {
@@ -39,7 +39,7 @@ var renderer = function renderer(_ref) {
39
39
  render(h(ClearRefinements, {
40
40
  refine: refine,
41
41
  cssClasses: cssClasses,
42
- hasRefinements: hasRefinements,
42
+ hasRefinements: canRefine,
43
43
  templateProps: renderState.templateProps
44
44
  }), containerNode);
45
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instantsearch.js",
3
- "version": "4.45.0",
3
+ "version": "4.45.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",
@@ -123,6 +123,7 @@
123
123
  "eslint-plugin-prettier": "3.4.0",
124
124
  "eslint-plugin-react": "7.18.0",
125
125
  "eslint-plugin-react-hooks": "2.3.0",
126
+ "eslint-plugin-deprecation": "1.3.2",
126
127
  "instantsearch-e2e-tests": "algolia/instantsearch-e2e-tests#2.0.2",
127
128
  "jest": "27.1.0",
128
129
  "jest-diff": "27.1.0",