@algolia/autocomplete-js 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.
package/dist/esm/autocomplete.js
CHANGED
|
@@ -280,20 +280,18 @@ export function autocomplete(options) {
|
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
282
|
function setIsModalOpen(value) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
});
|
|
283
|
+
var prevValue = props.value.core.environment.document.body.contains(dom.value.detachedOverlay);
|
|
284
|
+
if (value === prevValue) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (value) {
|
|
288
|
+
props.value.core.environment.document.body.appendChild(dom.value.detachedOverlay);
|
|
289
|
+
props.value.core.environment.document.body.classList.add('aa-Detached');
|
|
290
|
+
dom.value.input.focus();
|
|
291
|
+
} else {
|
|
292
|
+
props.value.core.environment.document.body.removeChild(dom.value.detachedOverlay);
|
|
293
|
+
props.value.core.environment.document.body.classList.remove('aa-Detached');
|
|
294
|
+
}
|
|
297
295
|
}
|
|
298
296
|
process.env.NODE_ENV !== 'production' ? warn(instancesCount === 0, "Autocomplete doesn't support multiple instances running at the same time. Make sure to destroy the previous instance before creating a new one.\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-destroy") : void 0;
|
|
299
297
|
instancesCount++;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @algolia/autocomplete-js 1.
|
|
1
|
+
/*! @algolia/autocomplete-js 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) :
|
|
@@ -347,7 +347,7 @@
|
|
|
347
347
|
return undefined;
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
var version = '1.
|
|
350
|
+
var version = '1.14.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.
|
|
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,
|
|
@@ -878,6 +878,7 @@
|
|
|
878
878
|
function createAlgoliaInsightsPlugin(options) {
|
|
879
879
|
var _getOptions = getOptions(options),
|
|
880
880
|
providedInsightsClient = _getOptions.insightsClient,
|
|
881
|
+
insightsInitParams = _getOptions.insightsInitParams,
|
|
881
882
|
onItemsChange = _getOptions.onItemsChange,
|
|
882
883
|
onSelectEvent = _getOptions.onSelect,
|
|
883
884
|
onActiveEvent = _getOptions.onActive,
|
|
@@ -915,6 +916,11 @@
|
|
|
915
916
|
if (!insightsClient) {
|
|
916
917
|
return {};
|
|
917
918
|
}
|
|
919
|
+
if (insightsInitParams) {
|
|
920
|
+
insightsClient('init', _objectSpread$f({
|
|
921
|
+
partial: true
|
|
922
|
+
}, insightsInitParams));
|
|
923
|
+
}
|
|
918
924
|
var insights = createSearchInsightsApi(insightsClient);
|
|
919
925
|
var previousItems = createRef([]);
|
|
920
926
|
var debouncedOnStateChange = debounce(function (_ref3) {
|
|
@@ -953,7 +959,7 @@
|
|
|
953
959
|
__algoliaSearchParameters: _objectSpread$f(_objectSpread$f({}, __autocomplete_clickAnalytics ? {
|
|
954
960
|
clickAnalytics: true
|
|
955
961
|
} : {}), userToken ? {
|
|
956
|
-
userToken: userToken
|
|
962
|
+
userToken: normalizeUserToken(userToken)
|
|
957
963
|
} : {}),
|
|
958
964
|
insights: insights
|
|
959
965
|
}
|
|
@@ -1066,6 +1072,14 @@
|
|
|
1066
1072
|
}
|
|
1067
1073
|
}
|
|
1068
1074
|
|
|
1075
|
+
/**
|
|
1076
|
+
* While `search-insights` supports both string and number user tokens,
|
|
1077
|
+
* the Search API only accepts strings. This function normalizes the user token.
|
|
1078
|
+
*/
|
|
1079
|
+
function normalizeUserToken(userToken) {
|
|
1080
|
+
return typeof userToken === 'number' ? userToken.toString() : userToken;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1069
1083
|
function checkOptions(options) {
|
|
1070
1084
|
"development" !== 'production' ? warn(!options.debug, 'The `debug` option is meant for development debugging and should not be used in production.') : void 0 ;
|
|
1071
1085
|
}
|
|
@@ -5085,20 +5099,18 @@
|
|
|
5085
5099
|
});
|
|
5086
5100
|
}
|
|
5087
5101
|
function setIsModalOpen(value) {
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
}
|
|
5101
|
-
});
|
|
5102
|
+
var prevValue = props.value.core.environment.document.body.contains(dom.value.detachedOverlay);
|
|
5103
|
+
if (value === prevValue) {
|
|
5104
|
+
return;
|
|
5105
|
+
}
|
|
5106
|
+
if (value) {
|
|
5107
|
+
props.value.core.environment.document.body.appendChild(dom.value.detachedOverlay);
|
|
5108
|
+
props.value.core.environment.document.body.classList.add('aa-Detached');
|
|
5109
|
+
dom.value.input.focus();
|
|
5110
|
+
} else {
|
|
5111
|
+
props.value.core.environment.document.body.removeChild(dom.value.detachedOverlay);
|
|
5112
|
+
props.value.core.environment.document.body.classList.remove('aa-Detached');
|
|
5113
|
+
}
|
|
5102
5114
|
}
|
|
5103
5115
|
"development" !== 'production' ? warn(instancesCount === 0, "Autocomplete doesn't support multiple instances running at the same time. Make sure to destroy the previous instance before creating a new one.\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-js/autocomplete/#param-destroy") : void 0;
|
|
5104
5116
|
instancesCount++;
|