@algolia/autocomplete-core 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-core 1.12.2 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-core 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) :
@@ -291,7 +291,7 @@
291
291
  return undefined;
292
292
  }
293
293
 
294
- var version = '1.12.2';
294
+ var version = '1.13.0';
295
295
 
296
296
  var userAgents = [{
297
297
  segment: 'autocomplete-core',
@@ -800,7 +800,7 @@
800
800
  return (hint === "string" ? String : Number)(input);
801
801
  }
802
802
  var VIEW_EVENT_DELAY = 400;
803
- var ALGOLIA_INSIGHTS_VERSION = '2.6.0';
803
+ var ALGOLIA_INSIGHTS_VERSION = '2.13.0';
804
804
  var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js");
805
805
  var sendViewedObjectIDs = debounce(function (_ref) {
806
806
  var onItemsChange = _ref.onItemsChange,
@@ -897,7 +897,7 @@
897
897
  __algoliaSearchParameters: _objectSpread(_objectSpread({}, __autocomplete_clickAnalytics ? {
898
898
  clickAnalytics: true
899
899
  } : {}), userToken ? {
900
- userToken: userToken
900
+ userToken: normalizeUserToken(userToken)
901
901
  } : {}),
902
902
  insights: insights
903
903
  }
@@ -1010,6 +1010,14 @@
1010
1010
  }
1011
1011
  }
1012
1012
 
1013
+ /**
1014
+ * While `search-insights` supports both string and number user tokens,
1015
+ * the Search API only accepts strings. This function normalizes the user token.
1016
+ */
1017
+ function normalizeUserToken(userToken) {
1018
+ return typeof userToken === 'number' ? userToken.toString() : userToken;
1019
+ }
1020
+
1013
1021
  function checkOptions(options) {
1014
1022
  "development" !== 'production' ? warn(!options.debug, 'The `debug` option is meant for development debugging and should not be used in production.') : void 0;
1015
1023
  }