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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [4.45.1](https://github.com/algolia/instantsearch.js/compare/v4.45.0...v4.45.1) (2022-09-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **ratingMenu:** fix `undefined` facet values error when `disjunctiveFacets` is empty ([#5096](https://github.com/algolia/instantsearch.js/issues/5096)) ([dd870d5](https://github.com/algolia/instantsearch.js/commit/dd870d5a658ce42b068eadf34f9b69772291aa20))
7
+
8
+
9
+
1
10
  # [4.45.0](https://github.com/algolia/instantsearch.js/compare/v4.44.1...v4.45.0) (2022-08-29)
2
11
 
3
12
 
@@ -220,9 +220,9 @@ var connectRatingMenu = function connectRatingMenu(renderFn) {
220
220
 
221
221
  var refinementIsApplied = false;
222
222
  var totalCount = 0;
223
+ var facetResults = results === null || results === void 0 ? void 0 : results.getFacetValues(attribute, {});
223
224
 
224
- if (results) {
225
- var facetResults = results.getFacetValues(attribute, {});
225
+ if (results && facetResults) {
226
226
  var maxValuesPerFacet = facetResults.length;
227
227
  var maxDecimalPlaces = getFacetsMaxDecimalPlaces(facetResults);
228
228
  var maxFacets = Math.pow(10, maxDecimalPlaces) * max;
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.45.0';
7
+ var _default = '4.45.1';
8
8
  exports.default = _default;
@@ -39,7 +39,7 @@ var renderer = function renderer(_ref) {
39
39
  templates = _ref.templates;
40
40
  return function (_ref2, isFirstRendering) {
41
41
  var refine = _ref2.refine,
42
- hasRefinements = _ref2.hasRefinements,
42
+ canRefine = _ref2.canRefine,
43
43
  instantSearchInstance = _ref2.instantSearchInstance;
44
44
 
45
45
  if (isFirstRendering) {
@@ -54,7 +54,7 @@ var renderer = function renderer(_ref) {
54
54
  (0, _preact.render)((0, _preact.h)(_ClearRefinements.default, {
55
55
  refine: refine,
56
56
  cssClasses: cssClasses,
57
- hasRefinements: hasRefinements,
57
+ hasRefinements: canRefine,
58
58
  templateProps: renderState.templateProps
59
59
  }), containerNode);
60
60
  };
@@ -173,7 +173,7 @@ declare type AnswersRenderState = {
173
173
  /**
174
174
  * The matched hits from Algolia API.
175
175
  */
176
- hits: Hits;
176
+ hits: Hit[];
177
177
  /**
178
178
  * Whether it's still loading the results from the Answers API.
179
179
  */
@@ -264,7 +264,7 @@ declare type AutocompleteRenderState = {
264
264
  /**
265
265
  * The resolved hits from the index matching the query.
266
266
  */
267
- hits: Hits;
267
+ hits: Hit[];
268
268
  /**
269
269
  * The full results object from the Algolia API.
270
270
  */
@@ -518,11 +518,11 @@ declare type BrowserHistoryArgs<TRouteState> = {
518
518
  getLocation(): Location;
519
519
  };
520
520
 
521
- declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => string;
521
+ declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => string;
522
522
 
523
523
  declare type BuiltInSendEventForFacet = (eventType: string, facetValue: string, eventName?: string) => void;
524
524
 
525
- declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hits, eventName?: string) => void;
525
+ declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => void;
526
526
 
527
527
  declare type BuiltInSendEventForToggle = (eventType: string, isRefined: boolean, eventName?: string) => void;
528
528
 
@@ -1769,11 +1769,6 @@ declare type HitHighlightResult = {
1769
1769
  [attribute: string]: HitAttributeHighlightResult | HitAttributeHighlightResult[] | HitHighlightResult[] | HitHighlightResult;
1770
1770
  };
1771
1771
 
1772
- /**
1773
- * @deprecated use Hit[] directly instead
1774
- */
1775
- declare type Hits = Hit[];
1776
-
1777
1772
  declare const hits: HitsWidget;
1778
1773
 
1779
1774
  declare type HitsConnector<THit extends BaseHit = BaseHit> = Connector<HitsWidgetDescription<THit>, HitsConnectorParams<THit>>;
@@ -2406,6 +2401,10 @@ declare type InstantSearchModule = {
2406
2401
  reverseHighlight: typeof helpers.reverseHighlight;
2407
2402
  snippet: typeof helpers.snippet;
2408
2403
  reverseSnippet: typeof helpers.reverseSnippet;
2404
+ /**
2405
+ * @deprecated use createInsightsMiddleware
2406
+ * @link https://www.algolia.com/doc/api-reference/widgets/insights/js/
2407
+ */
2409
2408
  insights: typeof helpers.insights;
2410
2409
  };
2411
2410
 
@@ -4255,7 +4254,7 @@ declare type RendererOptions<TWidgetParams> = {
4255
4254
  * The mutable list of hits. The may change depending
4256
4255
  * of the given transform items function.
4257
4256
  */
4258
- hits?: Hits;
4257
+ hits?: Hit[];
4259
4258
  /**
4260
4259
  * The current insights client, if any.
4261
4260
  */
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.45.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
1
+ /*! InstantSearch.js 4.45.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) :
@@ -8635,7 +8635,7 @@
8635
8635
  instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
8636
8636
  }
8637
8637
 
8638
- var version$1 = '4.45.0';
8638
+ var version$1 = '4.45.1';
8639
8639
 
8640
8640
  var NAMESPACE = 'ais';
8641
8641
  var component = function component(componentName) {
@@ -13602,9 +13602,9 @@
13602
13602
 
13603
13603
  var refinementIsApplied = false;
13604
13604
  var totalCount = 0;
13605
+ var facetResults = results === null || results === void 0 ? void 0 : results.getFacetValues(attribute, {});
13605
13606
 
13606
- if (results) {
13607
- var facetResults = results.getFacetValues(attribute, {});
13607
+ if (results && facetResults) {
13608
13608
  var maxValuesPerFacet = facetResults.length;
13609
13609
  var maxDecimalPlaces = getFacetsMaxDecimalPlaces(facetResults);
13610
13610
  var maxFacets = Math.pow(10, maxDecimalPlaces) * max;
@@ -16092,7 +16092,7 @@
16092
16092
  templates = _ref.templates;
16093
16093
  return function (_ref2, isFirstRendering) {
16094
16094
  var refine = _ref2.refine,
16095
- hasRefinements = _ref2.hasRefinements,
16095
+ canRefine = _ref2.canRefine,
16096
16096
  instantSearchInstance = _ref2.instantSearchInstance;
16097
16097
 
16098
16098
  if (isFirstRendering) {
@@ -16107,7 +16107,7 @@
16107
16107
  S(v(ClearRefinements, {
16108
16108
  refine: refine,
16109
16109
  cssClasses: cssClasses,
16110
- hasRefinements: hasRefinements,
16110
+ hasRefinements: canRefine,
16111
16111
  templateProps: renderState.templateProps
16112
16112
  }), containerNode);
16113
16113
  };