@algolia/autocomplete-js 1.9.1 → 1.9.3

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.9.1 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-js 1.9.3 | 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) :
@@ -32,7 +32,7 @@
32
32
  return _arr;
33
33
  }
34
34
  }
35
- function ownKeys$i(object, enumerableOnly) {
35
+ function ownKeys$h(object, enumerableOnly) {
36
36
  var keys = Object.keys(object);
37
37
  if (Object.getOwnPropertySymbols) {
38
38
  var symbols = Object.getOwnPropertySymbols(object);
@@ -45,25 +45,25 @@
45
45
  function _objectSpread2(target) {
46
46
  for (var i = 1; i < arguments.length; i++) {
47
47
  var source = null != arguments[i] ? arguments[i] : {};
48
- i % 2 ? ownKeys$i(Object(source), !0).forEach(function (key) {
49
- _defineProperty$i(target, key, source[key]);
50
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$i(Object(source)).forEach(function (key) {
48
+ i % 2 ? ownKeys$h(Object(source), !0).forEach(function (key) {
49
+ _defineProperty$h(target, key, source[key]);
50
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$h(Object(source)).forEach(function (key) {
51
51
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
52
52
  });
53
53
  }
54
54
  return target;
55
55
  }
56
- function _typeof$j(obj) {
56
+ function _typeof$i(obj) {
57
57
  "@babel/helpers - typeof";
58
58
 
59
- return _typeof$j = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
59
+ return _typeof$i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
60
60
  return typeof obj;
61
61
  } : function (obj) {
62
62
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
63
- }, _typeof$j(obj);
63
+ }, _typeof$i(obj);
64
64
  }
65
- function _defineProperty$i(obj, key, value) {
66
- key = _toPropertyKey$i(key);
65
+ function _defineProperty$h(obj, key, value) {
66
+ key = _toPropertyKey$h(key);
67
67
  if (key in obj) {
68
68
  Object.defineProperty(obj, key, {
69
69
  value: value,
@@ -151,7 +151,7 @@
151
151
  function _nonIterableRest$2() {
152
152
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
153
153
  }
154
- function _toPrimitive$i(input, hint) {
154
+ function _toPrimitive$h(input, hint) {
155
155
  if (typeof input !== "object" || input === null) return input;
156
156
  var prim = input[Symbol.toPrimitive];
157
157
  if (prim !== undefined) {
@@ -161,8 +161,8 @@
161
161
  }
162
162
  return (hint === "string" ? String : Number)(input);
163
163
  }
164
- function _toPropertyKey$i(arg) {
165
- var key = _toPrimitive$i(arg, "string");
164
+ function _toPropertyKey$h(arg) {
165
+ var key = _toPrimitive$h(arg, "string");
166
166
  return typeof key === "symbol" ? key : String(key);
167
167
  }
168
168
 
@@ -236,14 +236,14 @@
236
236
  function _arrayWithHoles$1(arr) {
237
237
  if (Array.isArray(arr)) return arr;
238
238
  }
239
- function _typeof$i(obj) {
239
+ function _typeof$h(obj) {
240
240
  "@babel/helpers - typeof";
241
241
 
242
- return _typeof$i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
242
+ return _typeof$h = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
243
243
  return typeof obj;
244
244
  } : function (obj) {
245
245
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
246
- }, _typeof$i(obj);
246
+ }, _typeof$h(obj);
247
247
  }
248
248
  /**
249
249
  * Decycles objects with circular references.
@@ -251,7 +251,7 @@
251
251
  */
252
252
  function decycle(obj) {
253
253
  var seen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
254
- if (!obj || _typeof$i(obj) !== 'object') {
254
+ if (!obj || _typeof$h(obj) !== 'object') {
255
255
  return obj;
256
256
  }
257
257
  if (seen.has(obj)) {
@@ -347,7 +347,7 @@
347
347
  return undefined;
348
348
  }
349
349
 
350
- var version = '1.9.1';
350
+ var version = '1.9.3';
351
351
 
352
352
  var userAgents$1 = [{
353
353
  segment: 'autocomplete-core',
@@ -459,14 +459,14 @@
459
459
 
460
460
  var _excluded$8 = ["items"],
461
461
  _excluded2$1 = ["items"];
462
- function _typeof$h(obj) {
462
+ function _typeof$g(obj) {
463
463
  "@babel/helpers - typeof";
464
464
 
465
- return _typeof$h = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
465
+ return _typeof$g = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
466
466
  return typeof obj;
467
467
  } : function (obj) {
468
468
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
469
- }, _typeof$h(obj);
469
+ }, _typeof$g(obj);
470
470
  }
471
471
  function _toConsumableArray$6(arr) {
472
472
  return _arrayWithoutHoles$6(arr) || _iterableToArray$6(arr) || _unsupportedIterableToArray$6(arr) || _nonIterableSpread$6();
@@ -520,7 +520,7 @@
520
520
  }
521
521
  return target;
522
522
  }
523
- function ownKeys$h(object, enumerableOnly) {
523
+ function ownKeys$g(object, enumerableOnly) {
524
524
  var keys = Object.keys(object);
525
525
  if (Object.getOwnPropertySymbols) {
526
526
  var symbols = Object.getOwnPropertySymbols(object);
@@ -530,19 +530,19 @@
530
530
  }
531
531
  return keys;
532
532
  }
533
- function _objectSpread$h(target) {
533
+ function _objectSpread$g(target) {
534
534
  for (var i = 1; i < arguments.length; i++) {
535
535
  var source = null != arguments[i] ? arguments[i] : {};
536
- i % 2 ? ownKeys$h(Object(source), !0).forEach(function (key) {
537
- _defineProperty$h(target, key, source[key]);
538
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$h(Object(source)).forEach(function (key) {
536
+ i % 2 ? ownKeys$g(Object(source), !0).forEach(function (key) {
537
+ _defineProperty$g(target, key, source[key]);
538
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$g(Object(source)).forEach(function (key) {
539
539
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
540
540
  });
541
541
  }
542
542
  return target;
543
543
  }
544
- function _defineProperty$h(obj, key, value) {
545
- key = _toPropertyKey$h(key);
544
+ function _defineProperty$g(obj, key, value) {
545
+ key = _toPropertyKey$g(key);
546
546
  if (key in obj) {
547
547
  Object.defineProperty(obj, key, {
548
548
  value: value,
@@ -555,16 +555,16 @@
555
555
  }
556
556
  return obj;
557
557
  }
558
- function _toPropertyKey$h(arg) {
559
- var key = _toPrimitive$h(arg, "string");
560
- return _typeof$h(key) === "symbol" ? key : String(key);
558
+ function _toPropertyKey$g(arg) {
559
+ var key = _toPrimitive$g(arg, "string");
560
+ return _typeof$g(key) === "symbol" ? key : String(key);
561
561
  }
562
- function _toPrimitive$h(input, hint) {
563
- if (_typeof$h(input) !== "object" || input === null) return input;
562
+ function _toPrimitive$g(input, hint) {
563
+ if (_typeof$g(input) !== "object" || input === null) return input;
564
564
  var prim = input[Symbol.toPrimitive];
565
565
  if (prim !== undefined) {
566
566
  var res = prim.call(input, hint || "default");
567
- if (_typeof$h(res) !== "object") return res;
567
+ if (_typeof$g(res) !== "object") return res;
568
568
  throw new TypeError("@@toPrimitive must return a primitive value.");
569
569
  }
570
570
  return (hint === "string" ? String : Number)(input);
@@ -573,7 +573,7 @@
573
573
  var chunkSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
574
574
  var chunks = [];
575
575
  for (var i = 0; i < item.objectIDs.length; i += chunkSize) {
576
- chunks.push(_objectSpread$h(_objectSpread$h({}, item), {}, {
576
+ chunks.push(_objectSpread$g(_objectSpread$g({}, item), {}, {
577
577
  objectIDs: item.objectIDs.slice(i, i + chunkSize)
578
578
  }));
579
579
  }
@@ -583,7 +583,7 @@
583
583
  return params.map(function (_ref) {
584
584
  var items = _ref.items,
585
585
  param = _objectWithoutProperties$4(_ref, _excluded$8);
586
- return _objectSpread$h(_objectSpread$h({}, param), {}, {
586
+ return _objectSpread$g(_objectSpread$g({}, param), {}, {
587
587
  objectIDs: (items === null || items === void 0 ? void 0 : items.map(function (_ref2) {
588
588
  var objectID = _ref2.objectID;
589
589
  return objectID;
@@ -716,7 +716,7 @@
716
716
  params.reduce(function (acc, _ref3) {
717
717
  var items = _ref3.items,
718
718
  param = _objectWithoutProperties$4(_ref3, _excluded2$1);
719
- return [].concat(_toConsumableArray$6(acc), _toConsumableArray$6(chunk(_objectSpread$h(_objectSpread$h({}, param), {}, {
719
+ return [].concat(_toConsumableArray$6(acc), _toConsumableArray$6(chunk(_objectSpread$g(_objectSpread$g({}, param), {}, {
720
720
  objectIDs: (items === null || items === void 0 ? void 0 : items.map(function (_ref4) {
721
721
  var objectID = _ref4.objectID;
722
722
  return objectID;
@@ -771,14 +771,14 @@
771
771
  return hit.objectID && hit.__autocomplete_indexName && hit.__autocomplete_queryID;
772
772
  }
773
773
 
774
- function _typeof$g(obj) {
774
+ function _typeof$f(obj) {
775
775
  "@babel/helpers - typeof";
776
776
 
777
- return _typeof$g = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
777
+ return _typeof$f = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
778
778
  return typeof obj;
779
779
  } : function (obj) {
780
780
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
781
- }, _typeof$g(obj);
781
+ }, _typeof$f(obj);
782
782
  }
783
783
  function _toConsumableArray$5(arr) {
784
784
  return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$5(arr) || _nonIterableSpread$5();
@@ -805,7 +805,7 @@
805
805
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
806
806
  return arr2;
807
807
  }
808
- function ownKeys$g(object, enumerableOnly) {
808
+ function ownKeys$f(object, enumerableOnly) {
809
809
  var keys = Object.keys(object);
810
810
  if (Object.getOwnPropertySymbols) {
811
811
  var symbols = Object.getOwnPropertySymbols(object);
@@ -815,19 +815,19 @@
815
815
  }
816
816
  return keys;
817
817
  }
818
- function _objectSpread$g(target) {
818
+ function _objectSpread$f(target) {
819
819
  for (var i = 1; i < arguments.length; i++) {
820
820
  var source = null != arguments[i] ? arguments[i] : {};
821
- i % 2 ? ownKeys$g(Object(source), !0).forEach(function (key) {
822
- _defineProperty$g(target, key, source[key]);
823
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$g(Object(source)).forEach(function (key) {
821
+ i % 2 ? ownKeys$f(Object(source), !0).forEach(function (key) {
822
+ _defineProperty$f(target, key, source[key]);
823
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$f(Object(source)).forEach(function (key) {
824
824
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
825
825
  });
826
826
  }
827
827
  return target;
828
828
  }
829
- function _defineProperty$g(obj, key, value) {
830
- key = _toPropertyKey$g(key);
829
+ function _defineProperty$f(obj, key, value) {
830
+ key = _toPropertyKey$f(key);
831
831
  if (key in obj) {
832
832
  Object.defineProperty(obj, key, {
833
833
  value: value,
@@ -840,16 +840,16 @@
840
840
  }
841
841
  return obj;
842
842
  }
843
- function _toPropertyKey$g(arg) {
844
- var key = _toPrimitive$g(arg, "string");
845
- return _typeof$g(key) === "symbol" ? key : String(key);
843
+ function _toPropertyKey$f(arg) {
844
+ var key = _toPrimitive$f(arg, "string");
845
+ return _typeof$f(key) === "symbol" ? key : String(key);
846
846
  }
847
- function _toPrimitive$g(input, hint) {
848
- if (_typeof$g(input) !== "object" || input === null) return input;
847
+ function _toPrimitive$f(input, hint) {
848
+ if (_typeof$f(input) !== "object" || input === null) return input;
849
849
  var prim = input[Symbol.toPrimitive];
850
850
  if (prim !== undefined) {
851
851
  var res = prim.call(input, hint || "default");
852
- if (_typeof$g(res) !== "object") return res;
852
+ if (_typeof$f(res) !== "object") return res;
853
853
  throw new TypeError("@@toPrimitive must return a primitive value.");
854
854
  }
855
855
  return (hint === "string" ? String : Number)(input);
@@ -867,7 +867,7 @@
867
867
  insightsEvents: createViewedEvents({
868
868
  items: items
869
869
  }).map(function (event) {
870
- return _objectSpread$g({
870
+ return _objectSpread$f({
871
871
  eventName: 'Items Viewed'
872
872
  }, event);
873
873
  }),
@@ -960,7 +960,7 @@
960
960
  event: event,
961
961
  insights: insights,
962
962
  item: item,
963
- insightsEvents: [_objectSpread$g({
963
+ insightsEvents: [_objectSpread$f({
964
964
  eventName: 'Item Selected'
965
965
  }, createClickedEvent({
966
966
  item: item,
@@ -980,7 +980,7 @@
980
980
  event: event,
981
981
  insights: insights,
982
982
  item: item,
983
- insightsEvents: [_objectSpread$g({
983
+ insightsEvents: [_objectSpread$f({
984
984
  eventName: 'Item Active'
985
985
  }, createClickedEvent({
986
986
  item: item,
@@ -999,12 +999,12 @@
999
999
  };
1000
1000
  }
1001
1001
  function getOptions(options) {
1002
- return _objectSpread$g({
1002
+ return _objectSpread$f({
1003
1003
  onItemsChange: function onItemsChange(_ref8) {
1004
1004
  var insights = _ref8.insights,
1005
1005
  insightsEvents = _ref8.insightsEvents;
1006
1006
  insights.viewedObjectIDs.apply(insights, _toConsumableArray$5(insightsEvents.map(function (event) {
1007
- return _objectSpread$g(_objectSpread$g({}, event), {}, {
1007
+ return _objectSpread$f(_objectSpread$f({}, event), {}, {
1008
1008
  algoliaSource: [].concat(_toConsumableArray$5(event.algoliaSource || []), ['autocomplete-internal'])
1009
1009
  });
1010
1010
  })));
@@ -1013,7 +1013,7 @@
1013
1013
  var insights = _ref9.insights,
1014
1014
  insightsEvents = _ref9.insightsEvents;
1015
1015
  insights.clickedObjectIDsAfterSearch.apply(insights, _toConsumableArray$5(insightsEvents.map(function (event) {
1016
- return _objectSpread$g(_objectSpread$g({}, event), {}, {
1016
+ return _objectSpread$f(_objectSpread$f({}, event), {}, {
1017
1017
  algoliaSource: [].concat(_toConsumableArray$5(event.algoliaSource || []), ['autocomplete-internal'])
1018
1018
  });
1019
1019
  })));
@@ -1180,7 +1180,7 @@
1180
1180
  return numericIndex;
1181
1181
  }
1182
1182
 
1183
- function ownKeys$f(object, enumerableOnly) {
1183
+ function ownKeys$e(object, enumerableOnly) {
1184
1184
  var keys = Object.keys(object);
1185
1185
  if (Object.getOwnPropertySymbols) {
1186
1186
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1190,19 +1190,19 @@
1190
1190
  }
1191
1191
  return keys;
1192
1192
  }
1193
- function _objectSpread$f(target) {
1193
+ function _objectSpread$e(target) {
1194
1194
  for (var i = 1; i < arguments.length; i++) {
1195
1195
  var source = null != arguments[i] ? arguments[i] : {};
1196
- i % 2 ? ownKeys$f(Object(source), !0).forEach(function (key) {
1197
- _defineProperty$f(target, key, source[key]);
1198
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$f(Object(source)).forEach(function (key) {
1196
+ i % 2 ? ownKeys$e(Object(source), !0).forEach(function (key) {
1197
+ _defineProperty$e(target, key, source[key]);
1198
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$e(Object(source)).forEach(function (key) {
1199
1199
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1200
1200
  });
1201
1201
  }
1202
1202
  return target;
1203
1203
  }
1204
- function _defineProperty$f(obj, key, value) {
1205
- key = _toPropertyKey$f(key);
1204
+ function _defineProperty$e(obj, key, value) {
1205
+ key = _toPropertyKey$e(key);
1206
1206
  if (key in obj) {
1207
1207
  Object.defineProperty(obj, key, {
1208
1208
  value: value,
@@ -1215,34 +1215,34 @@
1215
1215
  }
1216
1216
  return obj;
1217
1217
  }
1218
- function _toPropertyKey$f(arg) {
1219
- var key = _toPrimitive$f(arg, "string");
1220
- return _typeof$f(key) === "symbol" ? key : String(key);
1218
+ function _toPropertyKey$e(arg) {
1219
+ var key = _toPrimitive$e(arg, "string");
1220
+ return _typeof$e(key) === "symbol" ? key : String(key);
1221
1221
  }
1222
- function _toPrimitive$f(input, hint) {
1223
- if (_typeof$f(input) !== "object" || input === null) return input;
1222
+ function _toPrimitive$e(input, hint) {
1223
+ if (_typeof$e(input) !== "object" || input === null) return input;
1224
1224
  var prim = input[Symbol.toPrimitive];
1225
1225
  if (prim !== undefined) {
1226
1226
  var res = prim.call(input, hint || "default");
1227
- if (_typeof$f(res) !== "object") return res;
1227
+ if (_typeof$e(res) !== "object") return res;
1228
1228
  throw new TypeError("@@toPrimitive must return a primitive value.");
1229
1229
  }
1230
1230
  return (hint === "string" ? String : Number)(input);
1231
1231
  }
1232
- function _typeof$f(obj) {
1232
+ function _typeof$e(obj) {
1233
1233
  "@babel/helpers - typeof";
1234
1234
 
1235
- return _typeof$f = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1235
+ return _typeof$e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1236
1236
  return typeof obj;
1237
1237
  } : function (obj) {
1238
1238
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1239
- }, _typeof$f(obj);
1239
+ }, _typeof$e(obj);
1240
1240
  }
1241
1241
  function getNormalizedSources(getSources, params) {
1242
1242
  var seenSourceIds = [];
1243
1243
  return Promise.resolve(getSources(params)).then(function (sources) {
1244
1244
  invariant(Array.isArray(sources), function () {
1245
- return "The `getSources` function must return an array of sources but returned type ".concat(JSON.stringify(_typeof$f(sources)), ":\n\n").concat(JSON.stringify(decycle(sources), null, 2));
1245
+ return "The `getSources` function must return an array of sources but returned type ".concat(JSON.stringify(_typeof$e(sources)), ":\n\n").concat(JSON.stringify(decycle(sources), null, 2));
1246
1246
  });
1247
1247
  return Promise.all(sources
1248
1248
  // We allow `undefined` and `false` sources to allow users to use
@@ -1274,7 +1274,7 @@
1274
1274
  Object.keys(defaultSource).forEach(function (key) {
1275
1275
  defaultSource[key].__default = true;
1276
1276
  });
1277
- var normalizedSource = _objectSpread$f(_objectSpread$f({}, defaultSource), source);
1277
+ var normalizedSource = _objectSpread$e(_objectSpread$e({}, defaultSource), source);
1278
1278
  return Promise.resolve(normalizedSource);
1279
1279
  }));
1280
1280
  });
@@ -1362,88 +1362,18 @@
1362
1362
  return parent === child || parent.contains(child);
1363
1363
  }
1364
1364
 
1365
- var regex = /((gt|sm)-|galaxy nexus)|samsung[- ]/i;
1365
+ var regex = /((gt|sm)-|galaxy nexus)|samsung[- ]|samsungbrowser/i;
1366
1366
  function isSamsung(userAgent) {
1367
1367
  return Boolean(userAgent && userAgent.match(regex));
1368
1368
  }
1369
1369
 
1370
- function _typeof$e(obj) {
1371
- "@babel/helpers - typeof";
1372
-
1373
- return _typeof$e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
1374
- return typeof obj;
1375
- } : function (obj) {
1376
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1377
- }, _typeof$e(obj);
1378
- }
1379
- function ownKeys$e(object, enumerableOnly) {
1380
- var keys = Object.keys(object);
1381
- if (Object.getOwnPropertySymbols) {
1382
- var symbols = Object.getOwnPropertySymbols(object);
1383
- enumerableOnly && (symbols = symbols.filter(function (sym) {
1384
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1385
- })), keys.push.apply(keys, symbols);
1386
- }
1387
- return keys;
1388
- }
1389
- function _objectSpread$e(target) {
1390
- for (var i = 1; i < arguments.length; i++) {
1391
- var source = null != arguments[i] ? arguments[i] : {};
1392
- i % 2 ? ownKeys$e(Object(source), !0).forEach(function (key) {
1393
- _defineProperty$e(target, key, source[key]);
1394
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$e(Object(source)).forEach(function (key) {
1395
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1396
- });
1397
- }
1398
- return target;
1399
- }
1400
- function _defineProperty$e(obj, key, value) {
1401
- key = _toPropertyKey$e(key);
1402
- if (key in obj) {
1403
- Object.defineProperty(obj, key, {
1404
- value: value,
1405
- enumerable: true,
1406
- configurable: true,
1407
- writable: true
1408
- });
1409
- } else {
1410
- obj[key] = value;
1411
- }
1412
- return obj;
1413
- }
1414
- function _toPropertyKey$e(arg) {
1415
- var key = _toPrimitive$e(arg, "string");
1416
- return _typeof$e(key) === "symbol" ? key : String(key);
1417
- }
1418
- function _toPrimitive$e(input, hint) {
1419
- if (_typeof$e(input) !== "object" || input === null) return input;
1420
- var prim = input[Symbol.toPrimitive];
1421
- if (prim !== undefined) {
1422
- var res = prim.call(input, hint || "default");
1423
- if (_typeof$e(res) !== "object") return res;
1424
- throw new TypeError("@@toPrimitive must return a primitive value.");
1425
- }
1426
- return (hint === "string" ? String : Number)(input);
1427
- }
1428
1370
  function mapToAlgoliaResponse(rawResults) {
1429
- var results = rawResults.map(function (result) {
1430
- var _hits;
1431
- return _objectSpread$e(_objectSpread$e({}, result), {}, {
1432
- hits: (_hits = result.hits) === null || _hits === void 0 ? void 0 : _hits.map(function (hit) {
1433
- // Bring support for the Insights plugin.
1434
- return _objectSpread$e(_objectSpread$e({}, hit), {}, {
1435
- __autocomplete_indexName: result.index,
1436
- __autocomplete_queryID: result.queryID
1437
- });
1438
- })
1439
- });
1440
- });
1441
1371
  return {
1442
- results: results,
1443
- hits: results.map(function (result) {
1372
+ results: rawResults,
1373
+ hits: rawResults.map(function (result) {
1444
1374
  return result.hits;
1445
1375
  }).filter(Boolean),
1446
- facetHits: results.map(function (result) {
1376
+ facetHits: rawResults.map(function (result) {
1447
1377
  var _facetHits;
1448
1378
  return (_facetHits = result.facetHits) === null || _facetHits === void 0 ? void 0 : _facetHits.map(function (facetHit) {
1449
1379
  // Bring support for the highlighting components.
@@ -3457,7 +3387,7 @@
3457
3387
  }
3458
3388
 
3459
3389
  var isPlainObject = function isPlainObject(value) {
3460
- return value && _typeof$j(value) === 'object' && Object.prototype.toString.call(value) === '[object Object]';
3390
+ return value && _typeof$i(value) === 'object' && Object.prototype.toString.call(value) === '[object Object]';
3461
3391
  };
3462
3392
  function mergeDeep() {
3463
3393
  for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -3488,7 +3418,7 @@
3488
3418
  key: key,
3489
3419
  value: value
3490
3420
  })) {
3491
- return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty$i({}, key, value));
3421
+ return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty$h({}, key, value));
3492
3422
  }
3493
3423
  return acc;
3494
3424
  }, {});
@@ -4227,9 +4157,11 @@
4227
4157
  }
4228
4158
 
4229
4159
  function getAppIdAndApiKey(searchClient) {
4230
- var _searchClient$transpo = searchClient.transporter,
4231
- headers = _searchClient$transpo.headers,
4232
- queryParameters = _searchClient$transpo.queryParameters;
4160
+ var _ref = searchClient.transporter || {},
4161
+ _ref$headers = _ref.headers,
4162
+ headers = _ref$headers === void 0 ? {} : _ref$headers,
4163
+ _ref$queryParameters = _ref.queryParameters,
4164
+ queryParameters = _ref$queryParameters === void 0 ? {} : _ref$queryParameters;
4233
4165
  var APP_ID = 'x-algolia-application-id';
4234
4166
  var API_KEY = 'x-algolia-api-key';
4235
4167
  var appId = headers[APP_ID] || queryParameters[APP_ID];
@@ -4367,6 +4299,8 @@
4367
4299
  var _getAppIdAndApiKey = getAppIdAndApiKey(searchClient),
4368
4300
  appId = _getAppIdAndApiKey.appId,
4369
4301
  apiKey = _getAppIdAndApiKey.apiKey;
4302
+ invariant(Boolean(appId), 'The Algolia `appId` was not accessible from the searchClient passed.');
4303
+ invariant(Boolean(apiKey), 'The Algolia `apiKey` was not accessible from the searchClient passed.');
4370
4304
  return searchClient.search(queries.map(function (searchParameters) {
4371
4305
  var params = searchParameters.params,
4372
4306
  headers = _objectWithoutProperties(searchParameters, _excluded$2);
@@ -4378,11 +4312,14 @@
4378
4312
  }, params)
4379
4313
  });
4380
4314
  })).then(function (response) {
4381
- return response.results.map(function (result) {
4315
+ return response.results.map(function (result, resultIndex) {
4382
4316
  var _result$hits;
4383
4317
  return _objectSpread(_objectSpread({}, result), {}, {
4384
4318
  hits: (_result$hits = result.hits) === null || _result$hits === void 0 ? void 0 : _result$hits.map(function (hit) {
4385
4319
  return _objectSpread(_objectSpread({}, hit), {}, {
4320
+ // Bring support for the Insights plugin.
4321
+ __autocomplete_indexName: result.index || queries[resultIndex].indexName,
4322
+ __autocomplete_queryID: result.queryID,
4386
4323
  __autocomplete_algoliaCredentials: {
4387
4324
  appId: appId,
4388
4325
  apiKey: apiKey
@@ -4945,7 +4882,7 @@
4945
4882
  setProperties(props.value.core.environment, environmentProps);
4946
4883
  return function () {
4947
4884
  setProperties(props.value.core.environment, Object.keys(environmentProps).reduce(function (acc, key) {
4948
- return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty$i({}, key, undefined));
4885
+ return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty$h({}, key, undefined));
4949
4886
  }, {}));
4950
4887
  };
4951
4888
  });