@algolia/autocomplete-js 1.12.2 → 1.13.0

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/autocomplete-js 1.12.2 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-js 1.13.0 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -347,7 +347,7 @@
347
347
  return undefined;
348
348
  }
349
349
 
350
- var version = '1.12.2';
350
+ var version = '1.13.0';
351
351
 
352
352
  var userAgents$1 = [{
353
353
  segment: 'autocomplete-core',
@@ -856,7 +856,7 @@
856
856
  return (hint === "string" ? String : Number)(input);
857
857
  }
858
858
  var VIEW_EVENT_DELAY = 400;
859
- var ALGOLIA_INSIGHTS_VERSION = '2.6.0';
859
+ var ALGOLIA_INSIGHTS_VERSION = '2.13.0';
860
860
  var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js");
861
861
  var sendViewedObjectIDs = debounce(function (_ref) {
862
862
  var onItemsChange = _ref.onItemsChange,
@@ -953,7 +953,7 @@
953
953
  __algoliaSearchParameters: _objectSpread$f(_objectSpread$f({}, __autocomplete_clickAnalytics ? {
954
954
  clickAnalytics: true
955
955
  } : {}), userToken ? {
956
- userToken: userToken
956
+ userToken: normalizeUserToken(userToken)
957
957
  } : {}),
958
958
  insights: insights
959
959
  }
@@ -1066,6 +1066,14 @@
1066
1066
  }
1067
1067
  }
1068
1068
 
1069
+ /**
1070
+ * While `search-insights` supports both string and number user tokens,
1071
+ * the Search API only accepts strings. This function normalizes the user token.
1072
+ */
1073
+ function normalizeUserToken(userToken) {
1074
+ return typeof userToken === 'number' ? userToken.toString() : userToken;
1075
+ }
1076
+
1069
1077
  function checkOptions(options) {
1070
1078
  "development" !== 'production' ? warn(!options.debug, 'The `debug` option is meant for development debugging and should not be used in production.') : void 0 ;
1071
1079
  }