@algolia/autocomplete-core 1.12.2 → 1.14.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.
|
|
1
|
+
/*! @algolia/autocomplete-core 1.14.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.
|
|
294
|
+
var version = '1.14.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.
|
|
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,
|
|
@@ -822,6 +822,7 @@
|
|
|
822
822
|
function createAlgoliaInsightsPlugin(options) {
|
|
823
823
|
var _getOptions = getOptions(options),
|
|
824
824
|
providedInsightsClient = _getOptions.insightsClient,
|
|
825
|
+
insightsInitParams = _getOptions.insightsInitParams,
|
|
825
826
|
onItemsChange = _getOptions.onItemsChange,
|
|
826
827
|
onSelectEvent = _getOptions.onSelect,
|
|
827
828
|
onActiveEvent = _getOptions.onActive,
|
|
@@ -859,6 +860,11 @@
|
|
|
859
860
|
if (!insightsClient) {
|
|
860
861
|
return {};
|
|
861
862
|
}
|
|
863
|
+
if (insightsInitParams) {
|
|
864
|
+
insightsClient('init', _objectSpread({
|
|
865
|
+
partial: true
|
|
866
|
+
}, insightsInitParams));
|
|
867
|
+
}
|
|
862
868
|
var insights = createSearchInsightsApi(insightsClient);
|
|
863
869
|
var previousItems = createRef([]);
|
|
864
870
|
var debouncedOnStateChange = debounce(function (_ref3) {
|
|
@@ -897,7 +903,7 @@
|
|
|
897
903
|
__algoliaSearchParameters: _objectSpread(_objectSpread({}, __autocomplete_clickAnalytics ? {
|
|
898
904
|
clickAnalytics: true
|
|
899
905
|
} : {}), userToken ? {
|
|
900
|
-
userToken: userToken
|
|
906
|
+
userToken: normalizeUserToken(userToken)
|
|
901
907
|
} : {}),
|
|
902
908
|
insights: insights
|
|
903
909
|
}
|
|
@@ -1010,6 +1016,14 @@
|
|
|
1010
1016
|
}
|
|
1011
1017
|
}
|
|
1012
1018
|
|
|
1019
|
+
/**
|
|
1020
|
+
* While `search-insights` supports both string and number user tokens,
|
|
1021
|
+
* the Search API only accepts strings. This function normalizes the user token.
|
|
1022
|
+
*/
|
|
1023
|
+
function normalizeUserToken(userToken) {
|
|
1024
|
+
return typeof userToken === 'number' ? userToken.toString() : userToken;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1013
1027
|
function checkOptions(options) {
|
|
1014
1028
|
"development" !== 'production' ? warn(!options.debug, 'The `debug` option is meant for development debugging and should not be used in production.') : void 0;
|
|
1015
1029
|
}
|