algolia-experiences 1.8.0 → 1.8.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,4 +1,4 @@
1
- /*! algolia-experiences 1.8.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
1
+ /*! algolia-experiences 1.8.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
2
2
  (function (factory) {
3
3
  typeof define === 'function' && define.amd ? define(factory) :
4
4
  factory();
@@ -2575,6 +2575,12 @@
2575
2575
  * This doesn't contain any beta/hidden features.
2576
2576
  * @private
2577
2577
  */ SearchParameters.PARAMETERS = Object.keys(new SearchParameters());
2578
+ // Returns a finite number or null. Used to reject Infinity/-Infinity from parseFloat.
2579
+ function parseFiniteFloat(value) {
2580
+ var n = parseFloat(value);
2581
+ // global isFinite is safe here: n is always a number type (no string coercion risk)
2582
+ return isFinite(n) ? n : null;
2583
+ }
2578
2584
  /**
2579
2585
  * @private
2580
2586
  * @param {object} partialState full or part of a state
@@ -2600,8 +2606,18 @@
2600
2606
  var value = partialState[k];
2601
2607
  if (typeof value === 'string') {
2602
2608
  var parsedValue = parseFloat(value);
2603
- // global isNaN is ok to use here, value is only number or NaN
2604
- numbers[k] = isNaN(parsedValue) ? value : parsedValue;
2609
+ if (isNaN(parsedValue)) {
2610
+ // originally an unparseable string like "all", keep NaN
2611
+ numbers[k] = value;
2612
+ } else if (!isFinite(parsedValue)) {
2613
+ // Infinity/-Infinity — convert to null
2614
+ numbers[k] = null;
2615
+ } else {
2616
+ numbers[k] = parsedValue;
2617
+ }
2618
+ } else if (typeof value === 'number' && !isFinite(value)) {
2619
+ // Already-numeric Infinity — convert to null
2620
+ numbers[k] = null;
2605
2621
  }
2606
2622
  });
2607
2623
  // there's two formats of insideBoundingBox, we need to parse
@@ -2610,7 +2626,13 @@
2610
2626
  numbers.insideBoundingBox = partialState.insideBoundingBox.map(function(geoRect) {
2611
2627
  if (Array.isArray(geoRect)) {
2612
2628
  return geoRect.map(function(value) {
2613
- return parseFloat(value);
2629
+ if (typeof value === 'string') {
2630
+ return parseFiniteFloat(value);
2631
+ }
2632
+ if (typeof value === 'number' && !isFinite(value)) {
2633
+ return null;
2634
+ }
2635
+ return value;
2614
2636
  });
2615
2637
  }
2616
2638
  return geoRect;
@@ -2627,12 +2649,17 @@
2627
2649
  if (Array.isArray(v)) {
2628
2650
  return v.map(function(vPrime) {
2629
2651
  if (typeof vPrime === 'string') {
2630
- return parseFloat(vPrime);
2652
+ return parseFiniteFloat(vPrime);
2653
+ }
2654
+ if (typeof vPrime === 'number' && !isFinite(vPrime)) {
2655
+ return null;
2631
2656
  }
2632
2657
  return vPrime;
2633
2658
  });
2634
2659
  } else if (typeof v === 'string') {
2635
- return parseFloat(v);
2660
+ return parseFiniteFloat(v);
2661
+ } else if (typeof v === 'number' && !isFinite(v)) {
2662
+ return null;
2636
2663
  }
2637
2664
  return v;
2638
2665
  });
@@ -4960,7 +4987,7 @@
4960
4987
  function requireVersion() {
4961
4988
  if (hasRequiredVersion) return version$1;
4962
4989
  hasRequiredVersion = 1;
4963
- version$1 = '3.28.1';
4990
+ version$1 = '3.28.2';
4964
4991
  return version$1;
4965
4992
  }
4966
4993
 
@@ -9930,7 +9957,7 @@
9930
9957
  };
9931
9958
  }
9932
9959
 
9933
- var version = '4.94.0';
9960
+ var version = '4.95.0';
9934
9961
 
9935
9962
  function hydrateSearchClient(client, results) {
9936
9963
  if (!results) {