@algolia/autocomplete-core 1.9.2 → 1.9.4
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/utils/isSamsung.js +1 -1
- package/dist/esm/utils/mapToAlgoliaResponse.js +3 -21
- package/dist/umd/index.development.js +13 -22
- package/dist/umd/index.development.js.map +1 -1
- package/dist/umd/index.production.js +2 -2
- package/dist/umd/index.production.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
1
|
export function mapToAlgoliaResponse(rawResults) {
|
|
8
|
-
var results = rawResults.map(function (result) {
|
|
9
|
-
var _hits;
|
|
10
|
-
return _objectSpread(_objectSpread({}, result), {}, {
|
|
11
|
-
hits: (_hits = result.hits) === null || _hits === void 0 ? void 0 : _hits.map(function (hit) {
|
|
12
|
-
// Bring support for the Insights plugin.
|
|
13
|
-
return _objectSpread(_objectSpread({}, hit), {}, {
|
|
14
|
-
__autocomplete_indexName: result.index,
|
|
15
|
-
__autocomplete_queryID: result.queryID
|
|
16
|
-
});
|
|
17
|
-
})
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
2
|
return {
|
|
21
|
-
results:
|
|
22
|
-
hits:
|
|
3
|
+
results: rawResults,
|
|
4
|
+
hits: rawResults.map(function (result) {
|
|
23
5
|
return result.hits;
|
|
24
6
|
}).filter(Boolean),
|
|
25
|
-
facetHits:
|
|
7
|
+
facetHits: rawResults.map(function (result) {
|
|
26
8
|
var _facetHits;
|
|
27
9
|
return (_facetHits = result.facetHits) === null || _facetHits === void 0 ? void 0 : _facetHits.map(function (facetHit) {
|
|
28
10
|
// Bring support for the highlighting components.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @algolia/autocomplete-core 1.9.
|
|
1
|
+
/*! @algolia/autocomplete-core 1.9.4 | 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.9.
|
|
294
|
+
var version = '1.9.4';
|
|
295
295
|
|
|
296
296
|
var userAgents = [{
|
|
297
297
|
segment: 'autocomplete-core',
|
|
@@ -322,7 +322,8 @@
|
|
|
322
322
|
|
|
323
323
|
function createClickedEvent(_ref) {
|
|
324
324
|
var item = _ref.item,
|
|
325
|
-
items = _ref.items
|
|
325
|
+
_ref$items = _ref.items,
|
|
326
|
+
items = _ref$items === void 0 ? [] : _ref$items;
|
|
326
327
|
return {
|
|
327
328
|
index: item.__autocomplete_indexName,
|
|
328
329
|
items: [item],
|
|
@@ -895,7 +896,8 @@
|
|
|
895
896
|
onSelect(function (_ref5) {
|
|
896
897
|
var item = _ref5.item,
|
|
897
898
|
state = _ref5.state,
|
|
898
|
-
event = _ref5.event
|
|
899
|
+
event = _ref5.event,
|
|
900
|
+
source = _ref5.source;
|
|
899
901
|
if (!isAlgoliaInsightsHit(item)) {
|
|
900
902
|
return;
|
|
901
903
|
}
|
|
@@ -908,12 +910,13 @@
|
|
|
908
910
|
eventName: 'Item Selected'
|
|
909
911
|
}, createClickedEvent({
|
|
910
912
|
item: item,
|
|
911
|
-
items:
|
|
913
|
+
items: source.getItems().filter(isAlgoliaInsightsHit)
|
|
912
914
|
}))]
|
|
913
915
|
});
|
|
914
916
|
});
|
|
915
917
|
onActive(function (_ref6) {
|
|
916
918
|
var item = _ref6.item,
|
|
919
|
+
source = _ref6.source,
|
|
917
920
|
state = _ref6.state,
|
|
918
921
|
event = _ref6.event;
|
|
919
922
|
if (!isAlgoliaInsightsHit(item)) {
|
|
@@ -928,7 +931,7 @@
|
|
|
928
931
|
eventName: 'Item Active'
|
|
929
932
|
}, createClickedEvent({
|
|
930
933
|
item: item,
|
|
931
|
-
items:
|
|
934
|
+
items: source.getItems().filter(isAlgoliaInsightsHit)
|
|
932
935
|
}))]
|
|
933
936
|
});
|
|
934
937
|
});
|
|
@@ -1248,30 +1251,18 @@
|
|
|
1248
1251
|
return parent === child || parent.contains(child);
|
|
1249
1252
|
}
|
|
1250
1253
|
|
|
1251
|
-
var regex = /((gt|sm)-|galaxy nexus)|samsung[- ]/i;
|
|
1254
|
+
var regex = /((gt|sm)-|galaxy nexus)|samsung[- ]|samsungbrowser/i;
|
|
1252
1255
|
function isSamsung(userAgent) {
|
|
1253
1256
|
return Boolean(userAgent && userAgent.match(regex));
|
|
1254
1257
|
}
|
|
1255
1258
|
|
|
1256
1259
|
function mapToAlgoliaResponse(rawResults) {
|
|
1257
|
-
var results = rawResults.map(function (result) {
|
|
1258
|
-
var _hits;
|
|
1259
|
-
return _objectSpread2(_objectSpread2({}, result), {}, {
|
|
1260
|
-
hits: (_hits = result.hits) === null || _hits === void 0 ? void 0 : _hits.map(function (hit) {
|
|
1261
|
-
// Bring support for the Insights plugin.
|
|
1262
|
-
return _objectSpread2(_objectSpread2({}, hit), {}, {
|
|
1263
|
-
__autocomplete_indexName: result.index,
|
|
1264
|
-
__autocomplete_queryID: result.queryID
|
|
1265
|
-
});
|
|
1266
|
-
})
|
|
1267
|
-
});
|
|
1268
|
-
});
|
|
1269
1260
|
return {
|
|
1270
|
-
results:
|
|
1271
|
-
hits:
|
|
1261
|
+
results: rawResults,
|
|
1262
|
+
hits: rawResults.map(function (result) {
|
|
1272
1263
|
return result.hits;
|
|
1273
1264
|
}).filter(Boolean),
|
|
1274
|
-
facetHits:
|
|
1265
|
+
facetHits: rawResults.map(function (result) {
|
|
1275
1266
|
var _facetHits;
|
|
1276
1267
|
return (_facetHits = result.facetHits) === null || _facetHits === void 0 ? void 0 : _facetHits.map(function (facetHit) {
|
|
1277
1268
|
// Bring support for the highlighting components.
|