instantsearch.js 4.33.1 → 4.33.2

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.33.2](https://github.com/algolia/instantsearch.js/compare/v4.33.1...v4.33.2) (2021-11-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **connectNumericMenu:** allow option for same start/end values ([#4951](https://github.com/algolia/instantsearch.js/issues/4951)) ([18da714](https://github.com/algolia/instantsearch.js/commit/18da714574fa98957d29014add3123e9c377551f))
7
+
8
+
9
+
1
10
  ## [4.33.1](https://github.com/algolia/instantsearch.js/compare/v4.33.0...v4.33.1) (2021-11-02)
2
11
 
3
12
 
package/README.md CHANGED
@@ -102,6 +102,28 @@ npm install instantsearch.js algoliasearch
102
102
  yarn add instantsearch.js algoliasearch
103
103
  ```
104
104
 
105
+ ### TypeScript users
106
+
107
+ To use InstantSearch.js in a TypeScript environment, depending on your [`algoliasearch`](https://github.com/algolia/algoliasearch-client-javascript) version, you need to import different types.
108
+
109
+ >You still need to import these types even if you don't use InstantSearch.js with [`algoliasearch`](https://github.com/algolia/algoliasearch-client-javascript).
110
+
111
+ #### `algoliasearch` v4.x
112
+
113
+ This version uses types provided by both `algoliasearch` and `@algolia/client-search`.
114
+
115
+ ```bash
116
+ yarn add algoliasearch@4 @algolia/client-search
117
+ ```
118
+
119
+ #### `algoliasearch` v3.x
120
+
121
+ ```bash
122
+ yarn add @types/algoliasearch@3
123
+ ```
124
+
125
+ >v3.x is deprecated and will soon no longer be supported.
126
+
105
127
  ## Documentation
106
128
 
107
129
  The documentation is available on the [Algolia website](https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/).
@@ -242,6 +242,8 @@ function isRefined(state, attribute, option) {
242
242
  if (option.start !== undefined && option.end !== undefined) {
243
243
  if (option.start === option.end) {
244
244
  return hasNumericRefinement(currentRefinements, '=', option.start);
245
+ } else {
246
+ return hasNumericRefinement(currentRefinements, '>=', option.start) && hasNumericRefinement(currentRefinements, '<=', option.end);
245
247
  }
246
248
  }
247
249
 
@@ -295,17 +297,17 @@ function getRefinedState(state, attribute, facetValue) {
295
297
  if (refinedOption.start !== undefined) {
296
298
  if (hasNumericRefinement(currentRefinements, '>=', refinedOption.start)) {
297
299
  resolvedState = resolvedState.removeNumericRefinement(attribute, '>=', refinedOption.start);
298
- } else {
299
- resolvedState = resolvedState.addNumericRefinement(attribute, '>=', refinedOption.start);
300
300
  }
301
+
302
+ resolvedState = resolvedState.addNumericRefinement(attribute, '>=', refinedOption.start);
301
303
  }
302
304
 
303
305
  if (refinedOption.end !== undefined) {
304
306
  if (hasNumericRefinement(currentRefinements, '<=', refinedOption.end)) {
305
307
  resolvedState = resolvedState.removeNumericRefinement(attribute, '<=', refinedOption.end);
306
- } else {
307
- resolvedState = resolvedState.addNumericRefinement(attribute, '<=', refinedOption.end);
308
308
  }
309
+
310
+ resolvedState = resolvedState.addNumericRefinement(attribute, '<=', refinedOption.end);
309
311
  }
310
312
 
311
313
  if (typeof resolvedState.page === 'number') {
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.33.1';
7
+ var _default = '4.33.2';
8
8
  exports.default = _default;
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.33.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
1
+ /*! InstantSearch.js 4.33.2 | © 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) :
@@ -8465,7 +8465,7 @@
8465
8465
  instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
8466
8466
  }
8467
8467
 
8468
- var version$1 = '4.33.1';
8468
+ var version$1 = '4.33.2';
8469
8469
 
8470
8470
  var NAMESPACE = 'ais';
8471
8471
  var component = function component(componentName) {
@@ -12068,6 +12068,8 @@
12068
12068
  if (option.start !== undefined && option.end !== undefined) {
12069
12069
  if (option.start === option.end) {
12070
12070
  return hasNumericRefinement(currentRefinements, '=', option.start);
12071
+ } else {
12072
+ return hasNumericRefinement(currentRefinements, '>=', option.start) && hasNumericRefinement(currentRefinements, '<=', option.end);
12071
12073
  }
12072
12074
  }
12073
12075
 
@@ -12121,17 +12123,17 @@
12121
12123
  if (refinedOption.start !== undefined) {
12122
12124
  if (hasNumericRefinement(currentRefinements, '>=', refinedOption.start)) {
12123
12125
  resolvedState = resolvedState.removeNumericRefinement(attribute, '>=', refinedOption.start);
12124
- } else {
12125
- resolvedState = resolvedState.addNumericRefinement(attribute, '>=', refinedOption.start);
12126
12126
  }
12127
+
12128
+ resolvedState = resolvedState.addNumericRefinement(attribute, '>=', refinedOption.start);
12127
12129
  }
12128
12130
 
12129
12131
  if (refinedOption.end !== undefined) {
12130
12132
  if (hasNumericRefinement(currentRefinements, '<=', refinedOption.end)) {
12131
12133
  resolvedState = resolvedState.removeNumericRefinement(attribute, '<=', refinedOption.end);
12132
- } else {
12133
- resolvedState = resolvedState.addNumericRefinement(attribute, '<=', refinedOption.end);
12134
12134
  }
12135
+
12136
+ resolvedState = resolvedState.addNumericRefinement(attribute, '<=', refinedOption.end);
12135
12137
  }
12136
12138
 
12137
12139
  if (typeof resolvedState.page === 'number') {