@appbaseio/reactivesearch-vue 1.16.0-alpha.21 → 1.16.0-alpha.25

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.
Files changed (61) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +262 -1147
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{ComponentWrapper-d7d87585.js → ComponentWrapper-ab813390.js} +1 -1
  6. package/dist/cjs/DataSearch.js +4 -4
  7. package/dist/cjs/{DropDown-35d1472d.js → DropDown-d3c78c41.js} +2 -2
  8. package/dist/cjs/DynamicRangeSlider.js +2 -2
  9. package/dist/cjs/MultiDropdownList.js +4 -4
  10. package/dist/cjs/MultiList.js +3 -3
  11. package/dist/cjs/MultiRange.js +3 -3
  12. package/dist/cjs/{Pagination-96c06392.js → Pagination-d4dbfd5a.js} +1 -1
  13. package/dist/cjs/RangeInput.js +3 -3
  14. package/dist/cjs/RangeSlider.js +3 -3
  15. package/dist/cjs/ReactiveBase.js +26 -12
  16. package/dist/cjs/ReactiveComponent.js +42 -8
  17. package/dist/cjs/ReactiveGoogleMap.js +4 -4
  18. package/dist/cjs/ReactiveList.js +55 -56
  19. package/dist/cjs/ResultCard.js +1 -1
  20. package/dist/cjs/ResultList.js +1 -1
  21. package/dist/cjs/SelectedFilters.js +2 -2
  22. package/dist/cjs/SingleDropdownList.js +4 -4
  23. package/dist/cjs/SingleList.js +3 -3
  24. package/dist/cjs/SingleRange.js +3 -3
  25. package/dist/cjs/StateProvider.js +2 -2
  26. package/dist/cjs/ToggleButton.js +3 -3
  27. package/dist/cjs/{index-9e4adbb3.js → index-2a8358cd.js} +2 -0
  28. package/dist/cjs/index.js +6 -6
  29. package/dist/cjs/initReactivesearch.js +13 -3
  30. package/dist/cjs/install.js +6 -6
  31. package/dist/cjs/version.js +1 -1
  32. package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-409348b0.js} +3 -2
  33. package/dist/es/{ComponentWrapper-66d3e6b8.js → ComponentWrapper-459505fd.js} +1 -1
  34. package/dist/es/DataSearch.js +4 -4
  35. package/dist/es/{DropDown-ece64867.js → DropDown-8894cc22.js} +2 -2
  36. package/dist/es/DynamicRangeSlider.js +2 -2
  37. package/dist/es/MultiDropdownList.js +4 -4
  38. package/dist/es/MultiList.js +3 -3
  39. package/dist/es/MultiRange.js +3 -3
  40. package/dist/es/{Pagination-f8d7a011.js → Pagination-a2ab7fcb.js} +1 -1
  41. package/dist/es/RangeInput.js +3 -3
  42. package/dist/es/RangeSlider.js +3 -3
  43. package/dist/es/ReactiveBase.js +26 -12
  44. package/dist/es/ReactiveComponent.js +42 -8
  45. package/dist/es/ReactiveGoogleMap.js +4 -4
  46. package/dist/es/ReactiveList.js +55 -56
  47. package/dist/es/ResultCard.js +1 -1
  48. package/dist/es/ResultList.js +1 -1
  49. package/dist/es/SelectedFilters.js +2 -2
  50. package/dist/es/SingleDropdownList.js +4 -4
  51. package/dist/es/SingleList.js +3 -3
  52. package/dist/es/SingleRange.js +3 -3
  53. package/dist/es/StateProvider.js +2 -2
  54. package/dist/es/ToggleButton.js +3 -3
  55. package/dist/es/{index-f5d9c5c6.js → index-4755c9a0.js} +2 -1
  56. package/dist/es/index.js +6 -6
  57. package/dist/es/initReactivesearch.js +14 -4
  58. package/dist/es/install.js +6 -6
  59. package/dist/es/version.js +1 -1
  60. package/dist/es/{vueTypes-98d938a9.js → vueTypes-a9b9d5c9.js} +3 -2
  61. package/package.json +3 -3
@@ -5521,7 +5521,7 @@
5521
5521
  }, size > 0 ? {
5522
5522
  numberOfPages: Math.ceil(total / size)
5523
5523
  } : null, {
5524
- time: time,
5524
+ time: time || 0,
5525
5525
  hidden: hidden,
5526
5526
  promoted: promotedResults && promotedResults.length
5527
5527
  });
@@ -8640,7 +8640,7 @@
8640
8640
  componentList.forEach(function (component) {
8641
8641
  var componentProps = props[component];
8642
8642
 
8643
- if (selectedValues[componentId] && selectedValues[componentId].reference !== 'URL' && [constants$1.componentTypes.reactiveList, constants$1.componentTypes.reactiveMap].includes(componentProps.componentType)) {
8643
+ if (selectedValues[componentId] && selectedValues[componentId].reference !== 'URL' && componentProps && [constants$1.componentTypes.reactiveList, constants$1.componentTypes.reactiveMap].includes(componentProps.componentType)) {
8644
8644
  dispatch((0, value.setValue)(component, null));
8645
8645
  }
8646
8646
 
@@ -8702,9 +8702,9 @@
8702
8702
  value$1 = internalValues[componentId] && internalValues[componentId].value;
8703
8703
  }
8704
8704
 
8705
- var query = (0, transform.getRSQuery)(component, (0, transform.extractPropsFromState)(getState(), component, _extends({
8705
+ var query = (0, transform.getRSQuery)(component, (0, transform.extractPropsFromState)(getState(), component, _extends({}, value$1 ? {
8706
8706
  value: value$1
8707
- }, metaOptions ? {
8707
+ } : null, metaOptions ? {
8708
8708
  from: metaOptions.from
8709
8709
  } : null)));
8710
8710
 
@@ -8725,8 +8725,9 @@
8725
8725
  }
8726
8726
  }
8727
8727
  } else {
8728
+ var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + '_' + component : component;
8728
8729
  finalQuery = [].concat(_toConsumableArray(finalQuery), [{
8729
- preference: component
8730
+ preference: preference
8730
8731
  }, currentQuery]);
8731
8732
  }
8732
8733
  }
@@ -8931,8 +8932,9 @@
8931
8932
  appendToAggs: appendToAggs
8932
8933
  }));
8933
8934
  } else {
8935
+ var preference = store.config && store.config.analyticsConfig && store.config.analyticsConfig.userId ? store.config.analyticsConfig.userId + '_' + component : component;
8934
8936
  var _finalQuery = [{
8935
- preference: component
8937
+ preference: preference
8936
8938
  }, currentQuery];
8937
8939
  dispatch(msearch(_finalQuery, [component], appendToHits, false, appendToAggs));
8938
8940
  }
@@ -12807,8 +12809,9 @@
12807
12809
  emptyQuery: VueTypes.bool,
12808
12810
  suggestionAnalytics: VueTypes.bool,
12809
12811
  userId: VueTypes.string,
12810
- customEvents: VueTypes.object
12811
- })
12812
+ customEvents: VueTypes.object,
12813
+ enableTelemetry: VueTypes.bool.def(true)
12814
+ }).def({})
12812
12815
  };
12813
12816
 
12814
12817
  var getClassName = lib_8.getClassName,
@@ -13123,6 +13126,7 @@
13123
13126
  // storeKey,
13124
13127
  // });
13125
13128
 
13129
+ var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
13126
13130
  var composeThemeObject = function composeThemeObject(ownTheme, userTheme) {
13127
13131
  if (ownTheme === void 0) {
13128
13132
  ownTheme = {};
@@ -13911,18 +13915,17 @@
13911
13915
  ResultCardsWrapper: ResultCardsWrapper
13912
13916
  },
13913
13917
  data: function data() {
13914
- var props = this.$props;
13915
13918
  var currentPageState = 0;
13919
+ var defaultPage = this.defaultPage || -1;
13916
13920
 
13917
- if (props.defaultPage >= 0) {
13918
- currentPageState = props.defaultPage;
13919
- } else if (props.currentPage) {
13920
- currentPageState = Math.max(props.currentPage - 1, 0);
13921
+ if (defaultPage >= 0) {
13922
+ currentPageState = defaultPage;
13923
+ } else if (this.currentPage) {
13924
+ currentPageState = Math.max(this.currentPage - 1, 0);
13921
13925
  }
13922
13926
 
13923
13927
  this.__state = {
13924
- from: currentPageState * props.size,
13925
- isLoading: true,
13928
+ from: currentPageState * this.size,
13926
13929
  currentPageState: currentPageState
13927
13930
  };
13928
13931
  return this.__state;
@@ -13951,8 +13954,10 @@
13951
13954
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
13952
13955
  }
13953
13956
 
13954
- if (this.defaultPage >= 0) {
13955
- this.currentPageState = this.defaultPage;
13957
+ var defaultPage = this.defaultPage || -1;
13958
+
13959
+ if (defaultPage >= 0) {
13960
+ this.currentPageState = defaultPage;
13956
13961
  this.from = this.currentPageState * this.$props.size;
13957
13962
  }
13958
13963
 
@@ -14019,12 +14024,9 @@
14019
14024
  return this.$listeners && this.$listeners.resultStats;
14020
14025
  },
14021
14026
  stats: function stats() {
14022
- var _this$getAllData = this.getAllData(),
14023
- filteredResults = _this$getAllData.filteredResults;
14024
-
14025
14027
  return _extends({}, getResultStats(this), {
14026
14028
  currentPage: this.currentPageState,
14027
- displayedResults: filteredResults.length
14029
+ displayedResults: this.data.length
14028
14030
  });
14029
14031
  },
14030
14032
  hasCustomRender: function hasCustomRender() {
@@ -14033,6 +14035,27 @@
14033
14035
  showInfiniteScroll: function showInfiniteScroll() {
14034
14036
  // Pagination has higher priority then infinite scroll
14035
14037
  return this.infiniteScroll && !this.shouldRenderPagination;
14038
+ },
14039
+ data: function data() {
14040
+ var results = parseHits(this.hits) || [];
14041
+ var parsedPromotedResults = parseHits(this.promotedResults) || [];
14042
+ var filteredResults = results;
14043
+
14044
+ if (parsedPromotedResults.length) {
14045
+ var ids = parsedPromotedResults.map(function (item) {
14046
+ return item._id;
14047
+ }).filter(Boolean);
14048
+
14049
+ if (ids) {
14050
+ filteredResults = filteredResults.filter(function (item) {
14051
+ return !ids.includes(item._id);
14052
+ });
14053
+ }
14054
+
14055
+ filteredResults = [].concat(parsedPromotedResults, filteredResults);
14056
+ }
14057
+
14058
+ return helper_2(filteredResults);
14036
14059
  }
14037
14060
  },
14038
14061
  watch: {
@@ -14114,7 +14137,7 @@
14114
14137
  }
14115
14138
  },
14116
14139
  hits: function hits(newVal, oldVal) {
14117
- this.$emit('data', this.getAllData());
14140
+ this.$emit('data', this.getData());
14118
14141
 
14119
14142
  if (this.shouldRenderPagination) {
14120
14143
  // called when page is changed
@@ -14299,13 +14322,10 @@
14299
14322
 
14300
14323
  var h = this.$createElement;
14301
14324
  var size = this.$props.size;
14302
- var hits = this.$data.hits;
14303
- var results = parseHits(hits) || [];
14304
- var filteredResults = results;
14305
14325
  var renderItem = this.$scopedSlots.renderItem || this.$props.renderItem;
14306
14326
  var element = this.hasCustomRender ? this.getComponent() : h("div", {
14307
14327
  "class": this.$props.listClass + " " + getClassName$1(this.$props.innerClass, 'list')
14308
- }, [[].concat(filteredResults).map(function (item, index) {
14328
+ }, [this.data.map(function (item, index) {
14309
14329
  return renderItem({
14310
14330
  item: item,
14311
14331
  triggerClickAnalytics: function triggerClickAnalytics() {
@@ -14316,7 +14336,7 @@
14316
14336
 
14317
14337
  return this.analytics ? h(ImpressionTracker$1, {
14318
14338
  "attrs": {
14319
- "hits": filteredResults
14339
+ "hits": this.data
14320
14340
  }
14321
14341
  }, [element]) : element;
14322
14342
  },
@@ -14420,7 +14440,7 @@
14420
14440
  if (this.stats.numberOfResults) {
14421
14441
  return h("p", {
14422
14442
  "class": resultStats + " " + getClassName$1(this.$props.innerClass, 'resultStats')
14423
- }, [this.stats.numberOfResults, " results found in ", this.stats.time, "ms"]);
14443
+ }, [this.stats.numberOfResults, " results found in ", this.stats.time || 0, "ms"]);
14424
14444
  }
14425
14445
 
14426
14446
  return null;
@@ -14496,8 +14516,8 @@
14496
14516
  })]);
14497
14517
  },
14498
14518
  withClickIds: function withClickIds(results) {
14499
- var _this$getAllData2 = this.getAllData(),
14500
- base = _this$getAllData2.base;
14519
+ var _this$getAllData = this.getAllData(),
14520
+ base = _this$getAllData.base;
14501
14521
 
14502
14522
  return results.map(function (result, index) {
14503
14523
  return _extends({}, result, {
@@ -14515,26 +14535,9 @@
14515
14535
  hits = this.hits;
14516
14536
  var results = parseHits(hits) || [];
14517
14537
  var parsedPromotedResults = parseHits(promotedResults) || [];
14518
- var filteredResults = results;
14519
14538
  var base = currentPage * size;
14520
-
14521
- if (parsedPromotedResults.length) {
14522
- var ids = parsedPromotedResults.map(function (item) {
14523
- return item._id;
14524
- }).filter(Boolean);
14525
-
14526
- if (ids) {
14527
- filteredResults = filteredResults.filter(function (item) {
14528
- return !ids.includes(item._id);
14529
- });
14530
- }
14531
-
14532
- filteredResults = [].concat(parsedPromotedResults, filteredResults);
14533
- }
14534
-
14535
14539
  return {
14536
14540
  results: results,
14537
- filteredResults: filteredResults,
14538
14541
  customData: customData || {},
14539
14542
  promotedResults: parsedPromotedResults,
14540
14543
  aggregationData: aggregationData,
@@ -14544,16 +14547,15 @@
14544
14547
  };
14545
14548
  },
14546
14549
  getData: function getData() {
14547
- var _this$getAllData3 = this.getAllData(),
14548
- filteredResults = _this$getAllData3.filteredResults,
14549
- promotedResults = _this$getAllData3.promotedResults,
14550
- aggregationData = _this$getAllData3.aggregationData,
14551
- customData = _this$getAllData3.customData;
14550
+ var _this$getAllData2 = this.getAllData(),
14551
+ promotedResults = _this$getAllData2.promotedResults,
14552
+ aggregationData = _this$getAllData2.aggregationData,
14553
+ customData = _this$getAllData2.customData;
14552
14554
 
14553
14555
  return {
14554
- data: this.withClickIds(filteredResults),
14556
+ data: this.data,
14555
14557
  aggregationData: this.withClickIds(aggregationData || []),
14556
- promotedData: this.withClickIds(promotedResults),
14558
+ promotedData: this.withClickIds(promotedResults || []),
14557
14559
  rawData: this.rawData,
14558
14560
  resultStats: this.stats,
14559
14561
  customData: customData
@@ -14565,7 +14567,7 @@
14565
14567
 
14566
14568
  var data = _extends({
14567
14569
  error: error,
14568
- loading: isLoading,
14570
+ loading: isLoading || false,
14569
14571
  loadMore: this.loadMore,
14570
14572
  // TODO: Remove in v2
14571
14573
  triggerAnalytics: this.triggerClickAnalytics,
@@ -14580,13 +14582,13 @@
14580
14582
 
14581
14583
  var mapStateToProps$1 = function mapStateToProps(state, props) {
14582
14584
  return {
14583
- defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
14585
+ defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1,
14584
14586
  hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
14585
14587
  rawData: state.rawData[props.componentId],
14586
- aggregationData: state.compositeAggregations[props.componentId] || [],
14587
- promotedResults: state.promotedResults[props.componentId] || [],
14588
+ aggregationData: state.compositeAggregations[props.componentId],
14589
+ promotedResults: state.promotedResults[props.componentId],
14588
14590
  customData: state.customData[props.componentId],
14589
- time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
14591
+ time: state.hits[props.componentId] && state.hits[props.componentId].time,
14590
14592
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
14591
14593
  hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
14592
14594
  analytics: state.config && state.config.analytics,
@@ -14595,7 +14597,7 @@
14595
14597
  error: state.error[props.componentId],
14596
14598
  afterKey: state.aggregations[props.componentId] && state.aggregations[props.componentId][props.aggregationField] && state.aggregations[props.componentId][props.aggregationField].after_key,
14597
14599
  componentProps: state.props[props.componentId],
14598
- isLoading: state.isLoading[props.componentId] || false
14600
+ isLoading: state.isLoading[props.componentId]
14599
14601
  };
14600
14602
  };
14601
14603
 
@@ -15319,562 +15321,6 @@
15319
15321
  }
15320
15322
  });
15321
15323
 
15322
- var at,
15323
- // The index of the current character
15324
- ch,
15325
- // The current character
15326
- escapee = {
15327
- '"': '"',
15328
- '\\': '\\',
15329
- '/': '/',
15330
- b: '\b',
15331
- f: '\f',
15332
- n: '\n',
15333
- r: '\r',
15334
- t: '\t'
15335
- },
15336
- text,
15337
- error = function error(m) {
15338
- // Call error when something is wrong.
15339
- throw {
15340
- name: 'SyntaxError',
15341
- message: m,
15342
- at: at,
15343
- text: text
15344
- };
15345
- },
15346
- next = function next(c) {
15347
- // If a c parameter is provided, verify that it matches the current character.
15348
- if (c && c !== ch) {
15349
- error("Expected '" + c + "' instead of '" + ch + "'");
15350
- } // Get the next character. When there are no more characters,
15351
- // return the empty string.
15352
-
15353
-
15354
- ch = text.charAt(at);
15355
- at += 1;
15356
- return ch;
15357
- },
15358
- number = function number() {
15359
- // Parse a number value.
15360
- var number,
15361
- string = '';
15362
-
15363
- if (ch === '-') {
15364
- string = '-';
15365
- next('-');
15366
- }
15367
-
15368
- while (ch >= '0' && ch <= '9') {
15369
- string += ch;
15370
- next();
15371
- }
15372
-
15373
- if (ch === '.') {
15374
- string += '.';
15375
-
15376
- while (next() && ch >= '0' && ch <= '9') {
15377
- string += ch;
15378
- }
15379
- }
15380
-
15381
- if (ch === 'e' || ch === 'E') {
15382
- string += ch;
15383
- next();
15384
-
15385
- if (ch === '-' || ch === '+') {
15386
- string += ch;
15387
- next();
15388
- }
15389
-
15390
- while (ch >= '0' && ch <= '9') {
15391
- string += ch;
15392
- next();
15393
- }
15394
- }
15395
-
15396
- number = +string;
15397
-
15398
- if (!isFinite(number)) {
15399
- error("Bad number");
15400
- } else {
15401
- return number;
15402
- }
15403
- },
15404
- string = function string() {
15405
- // Parse a string value.
15406
- var hex,
15407
- i,
15408
- string = '',
15409
- uffff; // When parsing for string values, we must look for " and \ characters.
15410
-
15411
- if (ch === '"') {
15412
- while (next()) {
15413
- if (ch === '"') {
15414
- next();
15415
- return string;
15416
- } else if (ch === '\\') {
15417
- next();
15418
-
15419
- if (ch === 'u') {
15420
- uffff = 0;
15421
-
15422
- for (i = 0; i < 4; i += 1) {
15423
- hex = parseInt(next(), 16);
15424
-
15425
- if (!isFinite(hex)) {
15426
- break;
15427
- }
15428
-
15429
- uffff = uffff * 16 + hex;
15430
- }
15431
-
15432
- string += String.fromCharCode(uffff);
15433
- } else if (typeof escapee[ch] === 'string') {
15434
- string += escapee[ch];
15435
- } else {
15436
- break;
15437
- }
15438
- } else {
15439
- string += ch;
15440
- }
15441
- }
15442
- }
15443
-
15444
- error("Bad string");
15445
- },
15446
- white = function white() {
15447
- // Skip whitespace.
15448
- while (ch && ch <= ' ') {
15449
- next();
15450
- }
15451
- },
15452
- word = function word() {
15453
- // true, false, or null.
15454
- switch (ch) {
15455
- case 't':
15456
- next('t');
15457
- next('r');
15458
- next('u');
15459
- next('e');
15460
- return true;
15461
-
15462
- case 'f':
15463
- next('f');
15464
- next('a');
15465
- next('l');
15466
- next('s');
15467
- next('e');
15468
- return false;
15469
-
15470
- case 'n':
15471
- next('n');
15472
- next('u');
15473
- next('l');
15474
- next('l');
15475
- return null;
15476
- }
15477
-
15478
- error("Unexpected '" + ch + "'");
15479
- },
15480
- value$1,
15481
- // Place holder for the value function.
15482
- array = function array() {
15483
- // Parse an array value.
15484
- var array = [];
15485
-
15486
- if (ch === '[') {
15487
- next('[');
15488
- white();
15489
-
15490
- if (ch === ']') {
15491
- next(']');
15492
- return array; // empty array
15493
- }
15494
-
15495
- while (ch) {
15496
- array.push(value$1());
15497
- white();
15498
-
15499
- if (ch === ']') {
15500
- next(']');
15501
- return array;
15502
- }
15503
-
15504
- next(',');
15505
- white();
15506
- }
15507
- }
15508
-
15509
- error("Bad array");
15510
- },
15511
- object = function object() {
15512
- // Parse an object value.
15513
- var key,
15514
- object = {};
15515
-
15516
- if (ch === '{') {
15517
- next('{');
15518
- white();
15519
-
15520
- if (ch === '}') {
15521
- next('}');
15522
- return object; // empty object
15523
- }
15524
-
15525
- while (ch) {
15526
- key = string();
15527
- white();
15528
- next(':');
15529
-
15530
- if (Object.hasOwnProperty.call(object, key)) {
15531
- error('Duplicate key "' + key + '"');
15532
- }
15533
-
15534
- object[key] = value$1();
15535
- white();
15536
-
15537
- if (ch === '}') {
15538
- next('}');
15539
- return object;
15540
- }
15541
-
15542
- next(',');
15543
- white();
15544
- }
15545
- }
15546
-
15547
- error("Bad object");
15548
- };
15549
-
15550
- value$1 = function value() {
15551
- // Parse a JSON value. It could be an object, an array, a string, a number,
15552
- // or a word.
15553
- white();
15554
-
15555
- switch (ch) {
15556
- case '{':
15557
- return object();
15558
-
15559
- case '[':
15560
- return array();
15561
-
15562
- case '"':
15563
- return string();
15564
-
15565
- case '-':
15566
- return number();
15567
-
15568
- default:
15569
- return ch >= '0' && ch <= '9' ? number() : word();
15570
- }
15571
- }; // Return the json_parse function. It will have access to all of the above
15572
- // functions and variables.
15573
-
15574
-
15575
- var parse = function parse(source, reviver) {
15576
- var result;
15577
- text = source;
15578
- at = 0;
15579
- ch = ' ';
15580
- result = value$1();
15581
- white();
15582
-
15583
- if (ch) {
15584
- error("Syntax error");
15585
- } // If there is a reviver function, we recursively walk the new structure,
15586
- // passing each name/value pair to the reviver function for possible
15587
- // transformation, starting with a temporary root object that holds the result
15588
- // in an empty key. If there is not a reviver function, we simply return the
15589
- // result.
15590
-
15591
-
15592
- return typeof reviver === 'function' ? function walk(holder, key) {
15593
- var k,
15594
- v,
15595
- value = holder[key];
15596
-
15597
- if (value && typeof value === 'object') {
15598
- for (k in value) {
15599
- if (Object.prototype.hasOwnProperty.call(value, k)) {
15600
- v = walk(value, k);
15601
-
15602
- if (v !== undefined) {
15603
- value[k] = v;
15604
- } else {
15605
- delete value[k];
15606
- }
15607
- }
15608
- }
15609
- }
15610
-
15611
- return reviver.call(holder, key, value);
15612
- }({
15613
- '': result
15614
- }, '') : result;
15615
- };
15616
-
15617
- var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
15618
- gap,
15619
- indent,
15620
- meta = {
15621
- // table of character substitutions
15622
- '\b': '\\b',
15623
- '\t': '\\t',
15624
- '\n': '\\n',
15625
- '\f': '\\f',
15626
- '\r': '\\r',
15627
- '"': '\\"',
15628
- '\\': '\\\\'
15629
- },
15630
- rep;
15631
-
15632
- function quote(string) {
15633
- // If the string contains no control characters, no quote characters, and no
15634
- // backslash characters, then we can safely slap some quotes around it.
15635
- // Otherwise we must also replace the offending characters with safe escape
15636
- // sequences.
15637
- escapable.lastIndex = 0;
15638
- return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
15639
- var c = meta[a];
15640
- return typeof c === 'string' ? c : "\\u" + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
15641
- }) + '"' : '"' + string + '"';
15642
- }
15643
-
15644
- function str(key, holder) {
15645
- // Produce a string from holder[key].
15646
- var i,
15647
- // The loop counter.
15648
- k,
15649
- // The member key.
15650
- v,
15651
- // The member value.
15652
- length,
15653
- mind = gap,
15654
- partial,
15655
- value = holder[key]; // If the value has a toJSON method, call it to obtain a replacement value.
15656
-
15657
- if (value && typeof value === 'object' && typeof value.toJSON === 'function') {
15658
- value = value.toJSON(key);
15659
- } // If we were called with a replacer function, then call the replacer to
15660
- // obtain a replacement value.
15661
-
15662
-
15663
- if (typeof rep === 'function') {
15664
- value = rep.call(holder, key, value);
15665
- } // What happens next depends on the value's type.
15666
-
15667
-
15668
- switch (typeof value) {
15669
- case 'string':
15670
- return quote(value);
15671
-
15672
- case 'number':
15673
- // JSON numbers must be finite. Encode non-finite numbers as null.
15674
- return isFinite(value) ? String(value) : 'null';
15675
-
15676
- case 'boolean':
15677
- case 'null':
15678
- // If the value is a boolean or null, convert it to a string. Note:
15679
- // typeof null does not produce 'null'. The case is included here in
15680
- // the remote chance that this gets fixed someday.
15681
- return String(value);
15682
-
15683
- case 'object':
15684
- if (!value) return 'null';
15685
- gap += indent;
15686
- partial = []; // Array.isArray
15687
-
15688
- if (Object.prototype.toString.apply(value) === '[object Array]') {
15689
- length = value.length;
15690
-
15691
- for (i = 0; i < length; i += 1) {
15692
- partial[i] = str(i, value) || 'null';
15693
- } // Join all of the elements together, separated with commas, and
15694
- // wrap them in brackets.
15695
-
15696
-
15697
- v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']';
15698
- gap = mind;
15699
- return v;
15700
- } // If the replacer is an array, use it to select the members to be
15701
- // stringified.
15702
-
15703
-
15704
- if (rep && typeof rep === 'object') {
15705
- length = rep.length;
15706
-
15707
- for (i = 0; i < length; i += 1) {
15708
- k = rep[i];
15709
-
15710
- if (typeof k === 'string') {
15711
- v = str(k, value);
15712
-
15713
- if (v) {
15714
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
15715
- }
15716
- }
15717
- }
15718
- } else {
15719
- // Otherwise, iterate through all of the keys in the object.
15720
- for (k in value) {
15721
- if (Object.prototype.hasOwnProperty.call(value, k)) {
15722
- v = str(k, value);
15723
-
15724
- if (v) {
15725
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
15726
- }
15727
- }
15728
- }
15729
- } // Join all of the member texts together, separated with commas,
15730
- // and wrap them in braces.
15731
-
15732
-
15733
- v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}';
15734
- gap = mind;
15735
- return v;
15736
- }
15737
- }
15738
-
15739
- var stringify = function stringify(value, replacer, space) {
15740
- var i;
15741
- gap = '';
15742
- indent = ''; // If the space parameter is a number, make an indent string containing that
15743
- // many spaces.
15744
-
15745
- if (typeof space === 'number') {
15746
- for (i = 0; i < space; i += 1) {
15747
- indent += ' ';
15748
- }
15749
- } // If the space parameter is a string, it will be used as the indent string.
15750
- else if (typeof space === 'string') {
15751
- indent = space;
15752
- } // If there is a replacer, it must be a function or an array.
15753
- // Otherwise, throw an error.
15754
-
15755
-
15756
- rep = replacer;
15757
-
15758
- if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) {
15759
- throw new Error('JSON.stringify');
15760
- } // Make a fake root object containing our value under the key of ''.
15761
- // Return the result of stringifying the value.
15762
-
15763
-
15764
- return str('', {
15765
- '': value
15766
- });
15767
- };
15768
-
15769
- var parse$1 = parse;
15770
- var stringify$1 = stringify;
15771
- var jsonify = {
15772
- parse: parse$1,
15773
- stringify: stringify$1
15774
- };
15775
-
15776
- var json = typeof JSON !== 'undefined' ? JSON : jsonify;
15777
-
15778
- var jsonStableStringify = function jsonStableStringify(obj, opts) {
15779
- if (!opts) opts = {};
15780
- if (typeof opts === 'function') opts = {
15781
- cmp: opts
15782
- };
15783
- var space = opts.space || '';
15784
- if (typeof space === 'number') space = Array(space + 1).join(' ');
15785
- var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false;
15786
-
15787
- var replacer = opts.replacer || function (key, value) {
15788
- return value;
15789
- };
15790
-
15791
- var cmp = opts.cmp && function (f) {
15792
- return function (node) {
15793
- return function (a, b) {
15794
- var aobj = {
15795
- key: a,
15796
- value: node[a]
15797
- };
15798
- var bobj = {
15799
- key: b,
15800
- value: node[b]
15801
- };
15802
- return f(aobj, bobj);
15803
- };
15804
- };
15805
- }(opts.cmp);
15806
-
15807
- var seen = [];
15808
- return function stringify(parent, key, node, level) {
15809
- var indent = space ? '\n' + new Array(level + 1).join(space) : '';
15810
- var colonSeparator = space ? ': ' : ':';
15811
-
15812
- if (node && node.toJSON && typeof node.toJSON === 'function') {
15813
- node = node.toJSON();
15814
- }
15815
-
15816
- node = replacer.call(parent, key, node);
15817
-
15818
- if (node === undefined) {
15819
- return;
15820
- }
15821
-
15822
- if (typeof node !== 'object' || node === null) {
15823
- return json.stringify(node);
15824
- }
15825
-
15826
- if (isArray$1(node)) {
15827
- var out = [];
15828
-
15829
- for (var i = 0; i < node.length; i++) {
15830
- var item = stringify(node, i, node[i], level + 1) || json.stringify(null);
15831
- out.push(indent + space + item);
15832
- }
15833
-
15834
- return '[' + out.join(',') + indent + ']';
15835
- } else {
15836
- if (seen.indexOf(node) !== -1) {
15837
- if (cycles) return json.stringify('__cycle__');
15838
- throw new TypeError('Converting circular structure to JSON');
15839
- } else seen.push(node);
15840
-
15841
- var keys = objectKeys(node).sort(cmp && cmp(node));
15842
- var out = [];
15843
-
15844
- for (var i = 0; i < keys.length; i++) {
15845
- var key = keys[i];
15846
- var value = stringify(node, key, node[key], level + 1);
15847
- if (!value) continue;
15848
- var keyValue = json.stringify(key) + colonSeparator + value;
15849
- out.push(indent + space + keyValue);
15850
- }
15851
-
15852
- seen.splice(seen.indexOf(node), 1);
15853
- return '{' + out.join(',') + indent + '}';
15854
- }
15855
- }({
15856
- '': obj
15857
- }, '', obj, 0);
15858
- };
15859
-
15860
- var isArray$1 = Array.isArray || function (x) {
15861
- return {}.toString.call(x) === '[object Array]';
15862
- };
15863
-
15864
- var objectKeys = Object.keys || function (obj) {
15865
- var has = Object.prototype.hasOwnProperty || function () {
15866
- return true;
15867
- };
15868
-
15869
- var keys = [];
15870
-
15871
- for (var key in obj) {
15872
- if (has.call(obj, key)) keys.push(key);
15873
- }
15874
-
15875
- return keys;
15876
- };
15877
-
15878
15324
  var _typeof$1 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
15879
15325
  return typeof obj;
15880
15326
  } : function (obj) {
@@ -15910,16 +15356,6 @@
15910
15356
  return output;
15911
15357
  }
15912
15358
 
15913
- function uuidv4() {
15914
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
15915
- var r = Math.random() * 16 | 0; // eslint-disable-line no-bitwise
15916
-
15917
- var v = c === 'x' ? r : r & 0x3 | 0x8; // eslint-disable-line no-bitwise
15918
-
15919
- return v.toString(16);
15920
- });
15921
- }
15922
-
15923
15359
  function validateRSQuery(query) {
15924
15360
  if (query && Object.prototype.toString.call(query) === '[object Array]') {
15925
15361
  for (var i = 0; i < query.length; i += 1) {
@@ -15982,24 +15418,6 @@
15982
15418
 
15983
15419
  return null;
15984
15420
  }
15985
- /**
15986
- * Send only when a connection is opened
15987
- * @param {Object} socket
15988
- * @param {Function} callback
15989
- */
15990
-
15991
-
15992
- function waitForSocketConnection(socket, callback) {
15993
- setTimeout(function () {
15994
- if (socket.readyState === 1) {
15995
- if (callback != null) {
15996
- callback();
15997
- }
15998
- } else {
15999
- waitForSocketConnection(socket, callback);
16000
- }
16001
- }, 5); // wait 5 ms for the connection...
16002
- }
16003
15421
 
16004
15422
  function encodeHeaders() {
16005
15423
  var headers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -16017,6 +15435,21 @@
16017
15435
 
16018
15436
  return encodedHeaders;
16019
15437
  }
15438
+
15439
+ function getTelemetryHeaders(enableTelemetry) {
15440
+ var headers = {};
15441
+ Object.assign(headers, {
15442
+ 'X-Search-Client': 'Appbase JS'
15443
+ });
15444
+
15445
+ if (enableTelemetry === false) {
15446
+ Object.assign(headers, {
15447
+ 'X-Enable-Telemetry': enableTelemetry
15448
+ });
15449
+ }
15450
+
15451
+ return headers;
15452
+ }
16020
15453
  /**
16021
15454
  * Returns an instance of Appbase client
16022
15455
  * @param {Object} config To configure properties
@@ -16025,6 +15458,7 @@
16025
15458
  * @param {String} config.credentials
16026
15459
  * @param {String} config.username
16027
15460
  * @param {String} config.password
15461
+ * @param {Boolean} config.enableTelemetry
16028
15462
  * A callback function which will be invoked before a fetch request made
16029
15463
  */
16030
15464
 
@@ -16051,7 +15485,7 @@
16051
15485
  }
16052
15486
 
16053
15487
  if (typeof protocol !== 'string' || protocol === '') {
16054
- throw new Error('Protocol is not present in url. URL should be of the form https://scalr.api.appbase.io');
15488
+ throw new Error('Protocol is not present in url. URL should be of the form https://appbase-demo-ansible-abxiydt-arc.searchbase.io');
16055
15489
  } // Parse url
16056
15490
 
16057
15491
 
@@ -16079,7 +15513,10 @@
16079
15513
  this.protocol = protocol;
16080
15514
  this.app = config.app;
16081
15515
  this.credentials = credentials;
16082
- this.headers = {};
15516
+
15517
+ if (typeof config.enableTelemetry === 'boolean') {
15518
+ this.enableTelemetry = config.enableTelemetry;
15519
+ }
16083
15520
  }
16084
15521
  /**
16085
15522
  * To perform fetch request
@@ -16088,6 +15525,7 @@
16088
15525
  * @param {String} args.path
16089
15526
  * @param {Object} args.params
16090
15527
  * @param {Object} args.body
15528
+ * @param {Object} args.headers
16091
15529
  * @param {boolean} args.isSuggestionsAPI
16092
15530
  */
16093
15531
 
@@ -16111,7 +15549,7 @@
16111
15549
  var headers = Object.assign({}, {
16112
15550
  Accept: 'application/json',
16113
15551
  'Content-Type': contentType
16114
- }, _this.headers);
15552
+ }, args.headers, _this.headers);
16115
15553
  var timestamp = Date.now();
16116
15554
 
16117
15555
  if (_this.credentials) {
@@ -16151,259 +15589,90 @@
16151
15589
  var responseHeaders = {};
16152
15590
  var paramsString = '';
16153
15591
 
16154
- if (params) {
16155
- paramsString = '?' + querystring.stringify(params);
16156
- }
16157
-
16158
- var finalURL = _this.protocol + '://' + _this.url + '/' + app + '/' + path + paramsString;
16159
- return handleTransformRequest(Object.assign({}, {
16160
- url: finalURL
16161
- }, requestOptions)).then(function (ts) {
16162
- var transformedRequest = Object.assign({}, ts);
16163
- var url = transformedRequest.url;
16164
- delete transformedRequest.url;
16165
- return browserPonyfill$1(url || finalURL, transformedRequest).then(function (res) {
16166
- if (res.status >= 500) {
16167
- return reject(res);
16168
- }
16169
-
16170
- responseHeaders = res.headers;
16171
- return res.json().then(function (data) {
16172
- if (res.status >= 400) {
16173
- return reject(res);
16174
- }
16175
-
16176
- if (data && data.error) {
16177
- return reject(data);
16178
- } // Handle error from RS API RESPONSE
16179
-
16180
-
16181
- if (isRSAPI && data && Object.prototype.toString.call(data) === '[object Object]') {
16182
- if (body && body.query && body.query instanceof Array) {
16183
- var errorResponses = 0;
16184
- var allResponses = body.query.filter(function (q) {
16185
- return q.execute || q.execute === undefined;
16186
- }).length;
16187
-
16188
- if (data) {
16189
- Object.keys(data).forEach(function (key) {
16190
- if (data[key] && Object.prototype.hasOwnProperty.call(data[key], 'error')) {
16191
- errorResponses += 1;
16192
- }
16193
- });
16194
- } // reject only when all responses has error
16195
-
16196
-
16197
- if (errorResponses > 0 && allResponses === errorResponses) {
16198
- return reject(data);
16199
- }
16200
- }
16201
- } // Handle error from _msearch response
16202
-
16203
-
16204
- if (data && data.responses instanceof Array) {
16205
- var _allResponses = data.responses.length;
16206
- var _errorResponses = data.responses.filter(function (entry) {
16207
- return Object.prototype.hasOwnProperty.call(entry, 'error');
16208
- }).length; // reject only when all responses has error
16209
-
16210
- if (_allResponses === _errorResponses) {
16211
- return reject(data);
16212
- }
16213
- }
16214
-
16215
- var response = Object.assign({}, data, {
16216
- _timestamp: timestamp,
16217
- _headers: responseHeaders
16218
- });
16219
- return resolve(response);
16220
- })["catch"](function (e) {
16221
- return reject(e);
16222
- });
16223
- })["catch"](function (e) {
16224
- return reject(e);
16225
- });
16226
- })["catch"](function (err) {
16227
- return reject(err);
16228
- });
16229
- } catch (e) {
16230
- return reject(e);
16231
- }
16232
- });
16233
- }
16234
-
16235
- var WebSocket = typeof window !== 'undefined' ? window.WebSocket : require('ws');
16236
- /**
16237
- * To connect a web socket
16238
- * @param {Object} args
16239
- * @param {String} args.method
16240
- * @param {String} args.path
16241
- * @param {Object} args.params
16242
- * @param {Object} args.body
16243
- */
16244
-
16245
- function wsRequest(args, onData, onError, onClose) {
16246
- var _this = this;
16247
-
16248
- try {
16249
- var parsedArgs = removeUndefined(args);
16250
- var method = parsedArgs.method,
16251
- path = parsedArgs.path,
16252
- params = parsedArgs.params;
16253
- var bodyCopy = args.body;
16254
-
16255
- if (!bodyCopy || (typeof bodyCopy === 'undefined' ? 'undefined' : _typeof$1(bodyCopy)) !== 'object') {
16256
- bodyCopy = {};
16257
- }
16258
-
16259
- var init = function init() {
16260
- _this.ws = new WebSocket('wss://' + _this.url + '/' + _this.app);
16261
- _this.id = uuidv4();
16262
- _this.request = {
16263
- id: _this.id,
16264
- path: _this.app + '/' + path + '?' + querystring.stringify(params),
16265
- method: method,
16266
- body: bodyCopy
16267
- };
16268
-
16269
- if (_this.credentials) {
16270
- _this.request.authorization = 'Basic ' + btoa$1(_this.credentials);
16271
- }
16272
-
16273
- _this.result = {};
16274
-
16275
- _this.closeHandler = function () {
16276
- _this.wsClosed();
16277
- };
16278
-
16279
- _this.errorHandler = function (err) {
16280
- _this.processError.apply(_this, [err]);
16281
- };
16282
-
16283
- _this.messageHandler = function (message) {
16284
- var dataObj = JSON.parse(message.data);
16285
-
16286
- if (dataObj.body && dataObj.body.status >= 400) {
16287
- _this.processError.apply(_this, [dataObj]);
16288
- } else {
16289
- _this.processMessage.apply(_this, [dataObj]);
16290
- }
16291
- };
16292
-
16293
- _this.send = function (request) {
16294
- waitForSocketConnection(_this.ws, function () {
16295
- try {
16296
- _this.ws.send(JSON.stringify(request));
16297
- } catch (e) {
16298
- console.warn(e);
16299
- }
16300
- });
16301
- };
16302
-
16303
- _this.ws.onmessage = _this.messageHandler;
16304
- _this.ws.onerror = _this.errorHandler;
16305
- _this.ws.onclose = _this.closeHandler;
16306
-
16307
- _this.send(_this.request);
16308
-
16309
- _this.result.stop = _this.stop;
16310
- _this.result.reconnect = _this.reconnect;
16311
- return _this.result;
16312
- };
16313
-
16314
- this.wsClosed = function () {
16315
- if (onClose) {
16316
- onClose();
16317
- }
16318
- };
16319
-
16320
- this.stop = function () {
16321
- _this.ws.onmessage = undefined;
16322
- _this.ws.onclose = undefined;
16323
- _this.ws.onerror = undefined;
16324
-
16325
- _this.wsClosed();
16326
-
16327
- var unsubRequest = JSON.parse(JSON.stringify(_this.request));
16328
- unsubRequest.unsubscribe = true;
16329
-
16330
- if (_this.unsubscribed !== true) {
16331
- _this.send(unsubRequest);
16332
- }
16333
-
16334
- _this.unsubscribed = true;
16335
- };
16336
-
16337
- this.reconnect = function () {
16338
- _this.stop();
16339
-
16340
- return wsRequest(args, onData, onError, onClose);
16341
- };
16342
-
16343
- this.processError = function (err) {
16344
- if (onError) {
16345
- onError(err);
16346
- } else {
16347
- console.warn(err);
15592
+ if (params) {
15593
+ paramsString = '?' + querystring.stringify(params);
16348
15594
  }
16349
- };
16350
15595
 
16351
- this.processMessage = function (origDataObj) {
16352
- var dataObj = JSON.parse(JSON.stringify(origDataObj));
15596
+ var finalURL = _this.protocol + '://' + _this.url + '/' + app + '/' + path + paramsString;
15597
+ return handleTransformRequest(Object.assign({}, {
15598
+ url: finalURL
15599
+ }, requestOptions)).then(function (ts) {
15600
+ var transformedRequest = Object.assign({}, ts);
15601
+ var url = transformedRequest.url;
15602
+ delete transformedRequest.url;
15603
+ return browserPonyfill$1(url || finalURL, Object.assign({}, transformedRequest, {
15604
+ // apply timestamp header for RS API
15605
+ headers: isRSAPI ? Object.assign({}, transformedRequest.headers, {
15606
+ 'x-timestamp': new Date().getTime()
15607
+ }) : transformedRequest.headers
15608
+ })).then(function (res) {
15609
+ if (res.status >= 500) {
15610
+ return reject(res);
15611
+ }
16353
15612
 
16354
- if (!dataObj.id && dataObj.message) {
16355
- if (onError) {
16356
- onError(dataObj);
16357
- }
15613
+ responseHeaders = res.headers;
15614
+ return res.json().then(function (data) {
15615
+ if (res.status >= 400) {
15616
+ return reject(res);
15617
+ }
16358
15618
 
16359
- return;
16360
- }
15619
+ if (data && data.error) {
15620
+ return reject(data);
15621
+ } // Handle error from RS API RESPONSE
16361
15622
 
16362
- if (dataObj.id === _this.id) {
16363
- if (dataObj.message) {
16364
- delete dataObj.id;
16365
15623
 
16366
- if (onError) {
16367
- onError(dataObj);
16368
- }
15624
+ if (isRSAPI && data && Object.prototype.toString.call(data) === '[object Object]') {
15625
+ if (body && body.query && body.query instanceof Array) {
15626
+ var errorResponses = 0;
15627
+ var allResponses = body.query.filter(function (q) {
15628
+ return q.execute || q.execute === undefined;
15629
+ }).length;
16369
15630
 
16370
- return;
16371
- }
15631
+ if (data) {
15632
+ Object.keys(data).forEach(function (key) {
15633
+ if (data[key] && Object.prototype.hasOwnProperty.call(data[key], 'error')) {
15634
+ errorResponses += 1;
15635
+ }
15636
+ });
15637
+ } // reject only when all responses has error
16372
15638
 
16373
- if (dataObj.query_id) {
16374
- _this.query_id = dataObj.query_id;
16375
- }
16376
15639
 
16377
- if (dataObj.channel) {
16378
- _this.channel = dataObj.channel;
16379
- }
15640
+ if (errorResponses > 0 && allResponses === errorResponses) {
15641
+ return reject(data);
15642
+ }
15643
+ }
15644
+ } // Handle error from _msearch response
16380
15645
 
16381
- if (dataObj.body && dataObj.body !== '') {
16382
- if (onData) {
16383
- onData(dataObj.body);
16384
- }
16385
- }
16386
15646
 
16387
- return;
16388
- }
15647
+ if (data && data.responses instanceof Array) {
15648
+ var _allResponses = data.responses.length;
15649
+ var _errorResponses = data.responses.filter(function (entry) {
15650
+ return Object.prototype.hasOwnProperty.call(entry, 'error');
15651
+ }).length; // reject only when all responses has error
16389
15652
 
16390
- if (!dataObj.id && dataObj.channel && dataObj.channel === _this.channel) {
16391
- if (onData) {
16392
- onData(dataObj.event);
16393
- }
16394
- }
16395
- };
15653
+ if (_allResponses === _errorResponses) {
15654
+ return reject(data);
15655
+ }
15656
+ }
16396
15657
 
16397
- return init();
16398
- } catch (e) {
16399
- if (onError) {
16400
- onError(e);
16401
- } else {
16402
- console.warn(e);
15658
+ var response = Object.assign({}, data, {
15659
+ _timestamp: timestamp,
15660
+ _headers: responseHeaders
15661
+ });
15662
+ return resolve(response);
15663
+ })["catch"](function (e) {
15664
+ return reject(e);
15665
+ });
15666
+ })["catch"](function (e) {
15667
+ return reject(e);
15668
+ });
15669
+ })["catch"](function (err) {
15670
+ return reject(err);
15671
+ });
15672
+ } catch (e) {
15673
+ return reject(e);
16403
15674
  }
16404
-
16405
- return null;
16406
- }
15675
+ });
16407
15676
  }
16408
15677
  /**
16409
15678
  * Index Service
@@ -16685,7 +15954,7 @@
16685
15954
  */
16686
15955
 
16687
15956
 
16688
- function reactiveSearchv3Api(query, settings) {
15957
+ function reactiveSearchApi(query, settings) {
16689
15958
  var parsedSettings = removeUndefined(settings); // Validate query
16690
15959
 
16691
15960
  var valid = validateRSQuery(query);
@@ -16700,251 +15969,42 @@
16700
15969
  };
16701
15970
  return this.performFetchRequest({
16702
15971
  method: 'POST',
16703
- path: '_reactivesearch.v3',
15972
+ path: '_reactivesearch',
16704
15973
  body: body,
15974
+ headers: getTelemetryHeaders(this.enableTelemetry),
16705
15975
  isRSAPI: true
16706
15976
  });
16707
15977
  }
16708
15978
  /**
16709
- * Stream Service
16710
- * @param {Object} args
16711
- * @param {String} args.type
16712
- * @param {Boolean} args.stream
16713
- * @param {String} args.id
16714
- * @param {Function} onData
16715
- * @param {Function} onError
16716
- * @param {Function} onClose
16717
- */
16718
-
16719
-
16720
- function getStream(args) {
16721
- var parsedArgs = removeUndefined(args); // Validate arguments
16722
-
16723
- var valid = validate(parsedArgs, {
16724
- type: 'string',
16725
- id: 'string|number'
16726
- });
16727
-
16728
- if (valid !== true) {
16729
- throw valid;
16730
- }
16731
-
16732
- var type = parsedArgs.type,
16733
- id = parsedArgs.id;
16734
- delete parsedArgs.type;
16735
- delete parsedArgs.id;
16736
- delete parsedArgs.stream;
16737
-
16738
- if (parsedArgs.stream === true) {
16739
- parsedArgs.stream = 'true';
16740
- } else {
16741
- delete parsedArgs.stream;
16742
- parsedArgs.streamonly = 'true';
16743
- }
16744
-
16745
- for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
16746
- rest[_key - 1] = arguments[_key];
16747
- }
16748
-
16749
- return this.performWsRequest.apply(this, [{
16750
- method: 'GET',
16751
- path: type + '/' + encodeURIComponent(id),
16752
- params: parsedArgs
16753
- }].concat(rest));
16754
- }
16755
- /**
16756
- * Search Stream
16757
- * @param {Object} args
16758
- * @param {String} args.type
16759
- * @param {Object} args.body
16760
- * @param {Boolean} args.stream
16761
- * @param {Function} onData
16762
- * @param {Function} onError
16763
- * @param {Function} onClose
16764
- */
16765
-
16766
-
16767
- function searchStreamApi(args) {
16768
- var parsedArgs = removeUndefined(args); // Validate arguments
16769
-
16770
- var valid = validate(parsedArgs, {
16771
- body: 'object'
16772
- });
16773
-
16774
- if (valid !== true) {
16775
- throw valid;
16776
- }
16777
-
16778
- if (parsedArgs.type === undefined || Array.isArray(parsedArgs.type) && parsedArgs.type.length === 0) {
16779
- throw new Error('Missing fields: type');
16780
- }
16781
-
16782
- var type = void 0;
16783
-
16784
- if (Array.isArray(parsedArgs.type)) {
16785
- type = parsedArgs.type.join();
16786
- } else {
16787
- type = parsedArgs.type;
16788
- }
16789
-
16790
- var body = parsedArgs.body;
16791
- delete parsedArgs.type;
16792
- delete parsedArgs.body;
16793
- delete parsedArgs.stream;
16794
- parsedArgs.streamonly = 'true';
16795
-
16796
- for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
16797
- rest[_key - 1] = arguments[_key];
16798
- }
16799
-
16800
- return this.performWsRequest.apply(this, [{
16801
- method: 'POST',
16802
- path: type + '/_search',
16803
- params: parsedArgs,
16804
- body: body
16805
- }].concat(rest));
16806
- }
16807
- /**
16808
- * Webhook Service
16809
- * @param {Object} args
16810
- * @param {String} args.type
16811
- * @param {Object} args.body
16812
- * @param {Object} webhook
16813
- * @param {Function} onData
16814
- * @param {Function} onError
16815
- * @param {Function} onClose
15979
+ * ReactiveSearch API Service for v3
15980
+ * @param {Array<Object>} query
15981
+ * @param {Object} settings
15982
+ * @param {boolean} settings.recordAnalytics
15983
+ * @param {boolean} settings.userId
15984
+ * @param {boolean} settings.enableQueryRules
15985
+ * @param {boolean} settings.customEvents
16816
15986
  */
16817
15987
 
16818
15988
 
16819
- function searchStreamToURLApi(args, webhook) {
16820
- for (var _len = arguments.length, rest = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
16821
- rest[_key - 2] = arguments[_key];
16822
- }
16823
-
16824
- var _this = this;
16825
-
16826
- var parsedArgs = removeUndefined(args);
16827
- var bodyCopy = parsedArgs.body;
16828
- var type = void 0;
16829
- var typeString = void 0; // Validate arguments
16830
-
16831
- var valid = validate(parsedArgs, {
16832
- body: 'object'
16833
- });
16834
-
16835
- if (valid !== true) {
16836
- throw valid;
16837
- }
16838
-
16839
- if (parsedArgs.type === undefined || !(typeof parsedArgs.type === 'string' || Array.isArray(parsedArgs.type)) || parsedArgs.type === '' || parsedArgs.type.length === 0) {
16840
- throw new Error('fields missing: type');
16841
- }
15989
+ function reactiveSearchv3Api(query, settings) {
15990
+ var parsedSettings = removeUndefined(settings); // Validate query
16842
15991
 
16843
- valid = validate(parsedArgs.body, {
16844
- query: 'object'
16845
- });
15992
+ var valid = validateRSQuery(query);
16846
15993
 
16847
15994
  if (valid !== true) {
16848
15995
  throw valid;
16849
15996
  }
16850
15997
 
16851
- if (Array.isArray(parsedArgs.type)) {
16852
- type = parsedArgs.type;
16853
- typeString = parsedArgs.type.join();
16854
- } else {
16855
- type = [parsedArgs.type];
16856
- typeString = parsedArgs.type;
16857
- }
16858
-
16859
- var webhooks = [];
16860
- var _bodyCopy = bodyCopy,
16861
- query = _bodyCopy.query;
16862
-
16863
- if (typeof webhook === 'string') {
16864
- var webHookObj = {};
16865
- webHookObj.url = webhook;
16866
- webHookObj.method = 'GET';
16867
- webhooks.push(webHookObj);
16868
- } else if (webhook.constructor === Array) {
16869
- webhooks = webhook;
16870
- } else if (webhook === Object(webhook)) {
16871
- webhooks.push(webhook);
16872
- } else {
16873
- throw new Error('fields missing: second argument(webhook) is necessary');
16874
- }
16875
-
16876
- var populateBody = function populateBody() {
16877
- bodyCopy = {};
16878
- bodyCopy.webhooks = webhooks;
16879
- bodyCopy.query = query;
16880
- bodyCopy.type = type;
16881
- };
16882
-
16883
- populateBody();
16884
- var encode64 = btoa$1(jsonStableStringify(query));
16885
- var path = '.percolator/webhooks-0-' + typeString + '-0-' + encode64;
16886
-
16887
- this.change = function () {
16888
- webhooks = [];
16889
-
16890
- if (typeof parsedArgs === 'string') {
16891
- var webhook2 = {};
16892
- webhook2.url = parsedArgs;
16893
- webhook2.method = 'POST';
16894
- webhooks.push(webhook2);
16895
- } else if (parsedArgs.constructor === Array) {
16896
- webhooks = parsedArgs;
16897
- } else if (parsedArgs === Object(parsedArgs)) {
16898
- webhooks.push(parsedArgs);
16899
- } else {
16900
- throw new Error('fields missing: one of webhook or url fields is required');
16901
- }
16902
-
16903
- populateBody();
16904
- return _this.performRequest('POST');
16905
- };
16906
-
16907
- this.stop = function () {
16908
- bodyCopy = undefined;
16909
- return _this.performRequest('DELETE');
16910
- };
16911
-
16912
- this.performRequest = function (method) {
16913
- var res = _this.performWsRequest.apply(_this, [{
16914
- method: method,
16915
- path: path,
16916
- body: bodyCopy
16917
- }].concat(rest));
16918
-
16919
- res.change = _this.change;
16920
- res.stop = _this.stop;
16921
- return res;
15998
+ var body = {
15999
+ settings: parsedSettings,
16000
+ query: query
16922
16001
  };
16923
-
16924
- return this.performRequest('POST');
16925
- }
16926
- /**
16927
- * To get types
16928
- */
16929
-
16930
-
16931
- function getTypesService() {
16932
- var _this = this;
16933
-
16934
- return new Promise(function (resolve, reject) {
16935
- try {
16936
- return _this.performFetchRequest({
16937
- method: 'GET',
16938
- path: '_mapping'
16939
- }).then(function (data) {
16940
- var types = Object.keys(data[_this.app].mappings).filter(function (type) {
16941
- return type !== '_default_';
16942
- });
16943
- return resolve(types);
16944
- });
16945
- } catch (e) {
16946
- return reject(e);
16947
- }
16002
+ return this.performFetchRequest({
16003
+ method: 'POST',
16004
+ path: '_reactivesearch.v3',
16005
+ body: body,
16006
+ headers: getTelemetryHeaders(this.enableTelemetry),
16007
+ isRSAPI: true
16948
16008
  });
16949
16009
  }
16950
16010
  /**
@@ -16986,15 +16046,15 @@
16986
16046
  method: 'POST',
16987
16047
  path: '_reactivesearch.v3',
16988
16048
  body: body,
16049
+ headers: getTelemetryHeaders(this.enableTelemetry),
16989
16050
  isRSAPI: true,
16990
16051
  isSuggestionsAPI: true
16991
16052
  });
16992
16053
  }
16993
16054
 
16994
- function index$2(config) {
16055
+ function appbasejs(config) {
16995
16056
  var client = new AppBase(config);
16996
16057
  AppBase.prototype.performFetchRequest = fetchRequest;
16997
- AppBase.prototype.performWsRequest = wsRequest;
16998
16058
  AppBase.prototype.index = indexApi;
16999
16059
  AppBase.prototype.get = getApi;
17000
16060
  AppBase.prototype.update = updateApi;
@@ -17002,12 +16062,9 @@
17002
16062
  AppBase.prototype.bulk = bulkApi;
17003
16063
  AppBase.prototype.search = searchApi;
17004
16064
  AppBase.prototype.msearch = msearchApi;
16065
+ AppBase.prototype.reactiveSearch = reactiveSearchApi;
17005
16066
  AppBase.prototype.reactiveSearchv3 = reactiveSearchv3Api;
17006
16067
  AppBase.prototype.getQuerySuggestions = getSuggestionsv3Api;
17007
- AppBase.prototype.getStream = getStream;
17008
- AppBase.prototype.searchStream = searchStreamApi;
17009
- AppBase.prototype.searchStreamToURL = searchStreamToURLApi;
17010
- AppBase.prototype.getTypes = getTypesService;
17011
16068
  AppBase.prototype.getMappings = getMappings;
17012
16069
 
17013
16070
  AppBase.prototype.setHeaders = function setHeaders() {
@@ -17786,6 +16843,23 @@
17786
16843
  }
17787
16844
  }
17788
16845
  },
16846
+ computed: {
16847
+ getHeaders: function getHeaders() {
16848
+ var _this$$props = this.$props,
16849
+ enableAppbase = _this$$props.enableAppbase,
16850
+ headers = _this$$props.headers,
16851
+ appbaseConfig = _this$$props.appbaseConfig;
16852
+
16853
+ var _ref = appbaseConfig || {},
16854
+ enableTelemetry = _ref.enableTelemetry;
16855
+
16856
+ return _extends({}, enableAppbase && _extends({
16857
+ 'X-Search-Client': X_SEARCH_CLIENT
16858
+ }, enableTelemetry === false && {
16859
+ 'X-Enable-Telemetry': false
16860
+ }), headers);
16861
+ }
16862
+ },
17789
16863
  methods: {
17790
16864
  updateState: function updateState(props) {
17791
16865
  this.setStore(props);
@@ -17838,10 +16912,8 @@
17838
16912
  } catch (e) {// Do not add to selectedValues if JSON parsing fails.
17839
16913
  }
17840
16914
  });
17841
- var _props$headers = props.headers,
17842
- headers = _props$headers === void 0 ? {} : _props$headers,
17843
- themePreset = props.themePreset;
17844
- var appbaseRef = index$2(config);
16915
+ var themePreset = props.themePreset;
16916
+ var appbaseRef = appbasejs(config);
17845
16917
 
17846
16918
  if (this.$props.transformRequest) {
17847
16919
  appbaseRef.transformRequest = this.$props.transformRequest;
@@ -17861,7 +16933,7 @@
17861
16933
  appbaseRef: appbaseRef,
17862
16934
  selectedValues: selectedValues,
17863
16935
  urlValues: urlValues,
17864
- headers: headers
16936
+ headers: this.getHeaders
17865
16937
  }, this.$props.initialState);
17866
16938
 
17867
16939
  this.store = configureStore(initialState);
@@ -17870,10 +16942,9 @@
17870
16942
  render: function render() {
17871
16943
  var h = arguments[0];
17872
16944
  var children = this.$slots["default"];
17873
- var _this$$props = this.$props,
17874
- headers = _this$$props.headers,
17875
- style = _this$$props.style,
17876
- className = _this$$props.className;
16945
+ var _this$$props2 = this.$props,
16946
+ style = _this$$props2.style,
16947
+ className = _this$$props2.className;
17877
16948
  return h(Provider, {
17878
16949
  "attrs": {
17879
16950
  "store": this.store
@@ -17881,7 +16952,7 @@
17881
16952
  }, [h(URLParamsProvider$1, {
17882
16953
  "attrs": {
17883
16954
  "as": this.$props.as,
17884
- "headers": headers,
16955
+ "headers": this.getHeaders,
17885
16956
  "className": className,
17886
16957
  "getSearchParams": this.getSearchParams,
17887
16958
  "setSearchParams": this.setSearchParams
@@ -24458,9 +23529,15 @@
24458
23529
  this.setQueryOptions(componentId, _extends({}, customQueryOptions, this.getAggsQuery()), false);
24459
23530
  } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
24460
23531
 
23532
+ var queryToSet = query || null;
23533
+
23534
+ if (calcCustomQuery && calcCustomQuery.id) {
23535
+ queryToSet = calcCustomQuery;
23536
+ }
23537
+
24461
23538
  this.updateQuery({
24462
23539
  componentId: componentId,
24463
- query: query,
23540
+ queryToSet: queryToSet,
24464
23541
  value: this.selectedValue || null,
24465
23542
  label: filterLabel,
24466
23543
  showFilter: showFilter,
@@ -24474,6 +23551,12 @@
24474
23551
 
24475
23552
  if (options) {
24476
23553
  _this.setQueryOptions(props.componentId, _extends({}, options, _this.getAggsQuery()), false);
23554
+ }
23555
+
23556
+ var queryToBeSet = obj.query; // when enableAppbase is true, Backend throws error because of repeated query in request body
23557
+
23558
+ if (obj && obj.query && obj.query.query) {
23559
+ queryToBeSet = obj.query.query;
24477
23560
  } // Update customQuery field for RS API
24478
23561
 
24479
23562
 
@@ -24481,7 +23564,11 @@
24481
23564
  var customQueryCalc = _extends({}, options);
24482
23565
 
24483
23566
  if (obj && obj.query) {
24484
- customQueryCalc.query = obj.query;
23567
+ if (obj.query.id) {
23568
+ customQueryCalc = queryToBeSet;
23569
+ } else {
23570
+ customQueryCalc.query = obj.query;
23571
+ }
24485
23572
  }
24486
23573
 
24487
23574
  _this.setCustomQuery(props.componentId, customQueryCalc);
@@ -24512,9 +23599,15 @@
24512
23599
  this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
24513
23600
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
24514
23601
 
23602
+ var queryToSet = query || null;
23603
+
23604
+ if (!queryToSet && this.$defaultQuery && this.$defaultQuery.id) {
23605
+ queryToSet = this.$defaultQuery;
23606
+ }
23607
+
24515
23608
  this.updateQuery({
24516
23609
  componentId: this.internalComponent,
24517
- query: query || null
23610
+ query: queryToSet
24518
23611
  });
24519
23612
  }
24520
23613
  },
@@ -24573,9 +23666,15 @@
24573
23666
 
24574
23667
 
24575
23668
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, undefined);
23669
+ var queryToSet = query || null;
23670
+
23671
+ if (!queryToSet && this.$defaultQuery && this.$defaultQuery.id) {
23672
+ queryToSet = this.$defaultQuery;
23673
+ }
23674
+
24576
23675
  this.updateQuery({
24577
23676
  componentId: this.internalComponent,
24578
- query: query || null
23677
+ query: queryToSet
24579
23678
  });
24580
23679
  }
24581
23680
  },
@@ -24594,9 +23693,15 @@
24594
23693
 
24595
23694
 
24596
23695
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, undefined);
23696
+ var queryToSet = query || null;
23697
+
23698
+ if (this.$customQuery && this.$customQuery.id) {
23699
+ queryToSet = this.$customQuery;
23700
+ }
23701
+
24597
23702
  this.updateQuery({
24598
23703
  componentId: componentId,
24599
- query: query || null
23704
+ query: queryToSet
24600
23705
  });
24601
23706
  }
24602
23707
  }
@@ -25629,7 +24734,7 @@
25629
24734
  * Released under the MIT License.
25630
24735
  */
25631
24736
 
25632
- var index$3 = {
24737
+ var index$2 = {
25633
24738
  name: 'NoSsr',
25634
24739
  functional: true,
25635
24740
  props: {
@@ -25669,7 +24774,7 @@
25669
24774
  }) : h(false);
25670
24775
  }
25671
24776
  };
25672
- var vueNoSsr_common = index$3;
24777
+ var vueNoSsr_common = index$2;
25673
24778
 
25674
24779
  var _templateObject$m;
25675
24780
  var Slider = index$1('div')(_templateObject$m || (_templateObject$m = _taggedTemplateLiteralLoose(["\n\tmargin-top: 30px;\n\tpadding: 10px;\n\n\t/* component style */\n\t.vue-slider-disabled {\n\t\topacity: 0.5;\n\t\tcursor: not-allowed;\n\t}\n\n\t/* rail style */\n\t.vue-slider-rail {\n\t\tbackground-color: #ccc;\n\t\tborder-radius: 15px;\n\t\theight: 4px;\n\t}\n\n\t/* process style */\n\t.vue-slider-process {\n\t\tbackground-color: #0b6aff;\n\t\tborder-radius: 15px;\n\t}\n\n\t/* mark style */\n\t.vue-slider-mark {\n\t\tz-index: 4;\n\t}\n\n\t.vue-slider-mark:first-child .vue-slider-mark-step,\n\t.vue-slider-mark:last-child .vue-slider-mark-step {\n\t\tdisplay: none;\n\t}\n\n\t.vue-slider-mark-step {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 50%;\n\t\tbackground-color: rgba(0, 0, 0, 0.16);\n\t}\n\n\t.vue-slider-mark-label {\n\t\tfont-size: 14px;\n\t\twhite-space: nowrap;\n\t}\n\n\t/* dot style */\n\t.vue-slider-dot{\n\t\tz-index: 2;\n\t}\n\n\t.vue-slider-dot-handle {\n\t\tcursor: pointer;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 50%;\n\t\tbackground-color: #fff;\n\t\tbox-sizing: border-box;\n\t\tborder: 1px solid #9a9a9a;\n\t\tz-index: 2;\n\t}\n\n\t.vue-slider-dot-handle-disabled {\n\t\tcursor: not-allowed;\n\t\tbackground-color: #ccc;\n\t}\n\n\t.vue-slider-dot-tooltip-inner {\n\t\tfont-size: 14px;\n\t\twhite-space: nowrap;\n\t\tpadding: 2px 5px;\n\t\tmin-width: 20px;\n\t\ttext-align: center;\n\t\tcolor: #fff;\n\t\tborder-radius: 5px;\n\t\tborder-color: #000;\n\t\tbackground-color: #000;\n\t\tbox-sizing: content-box;\n\t}\n\n\t.vue-slider-dot-tooltip-inner::after {\n\t\tcontent: \"\";\n\t\tposition: absolute;\n\t}\n\n\t.vue-slider-dot -tooltip-inner-top::after {\n\t\ttop: 100%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, 0);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-top-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-bottom::after {\n\t\tbottom: 100%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, 0);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-bottom-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-left::after {\n\t\tleft: 100%;\n\t\ttop: 50%;\n\t\ttransform: translate(0, -50%);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-left-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-right::after {\n\t\tright: 100%;\n\t\ttop: 50%;\n\t\ttransform: translate(0, -50%);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-right-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-wrapper {\n\t\topacity: 0;\n\t\ttransition: all 0.3s;\n\t}\n\t.vue-slider-dot-tooltip-wrapper-show {\n\t\topacity: 1;\n\t}\n\n\t.label-container {\n\t\tmargin: 10px 0;\n\t\twidth: 100%;\n\t}\n\n\t.range-label-right {\n\t\tfloat: right;\n\t}\n"])));
@@ -26481,7 +25586,7 @@
26481
25586
  watch: {
26482
25587
  searchState: function searchState(newVal, oldVal) {
26483
25588
  if (this.isStateChanged(newVal, oldVal)) {
26484
- this.$emit('change', newVal, oldVal);
25589
+ this.$emit('change', oldVal, newVal);
26485
25590
  }
26486
25591
  },
26487
25592
  selectedValues: function selectedValues(newVal, oldVal) {
@@ -33356,6 +32461,7 @@
33356
32461
  ReactiveGoogleMap.componentType = constants_1$1.reactiveMap;
33357
32462
 
33358
32463
  var _excluded$5 = ["aggs", "size"];
32464
+ var X_SEARCH_CLIENT$1 = 'ReactiveSearch Vue';
33359
32465
  var componentsWithHighlightQuery = [constants_1$1.dataSearch, constants_1$1.categorySearch];
33360
32466
  var componentsWithOptions = [constants_1$1.reactiveList, constants_1$1.reactiveMap, constants_1$1.singleList, constants_1$1.multiList, constants_1$1.tagCloud].concat(componentsWithHighlightQuery);
33361
32467
  var componentsWithoutFilters = [constants_1$1.numberBox, constants_1$1.ratingsFilter];
@@ -33413,6 +32519,14 @@
33413
32519
  function initReactivesearch(componentCollection, searchState, settings) {
33414
32520
  return new Promise(function (resolve, reject) {
33415
32521
  var credentials = settings.url && settings.url.trim() !== '' && !settings.credentials ? null : settings.credentials;
32522
+ var enableTelemetry = settings.appbaseConfig && settings.appbaseConfig.enableTelemetry !== undefined ? settings.appbaseConfig.enableTelemetry : true;
32523
+
32524
+ var headers = _extends({}, settings.enableAppbase && _extends({
32525
+ 'X-Search-Client': X_SEARCH_CLIENT$1
32526
+ }, enableTelemetry === false && {
32527
+ 'X-Enable-Telemetry': false
32528
+ }), settings.headers);
32529
+
33416
32530
  var config = {
33417
32531
  url: settings.url && settings.url.trim() !== '' ? settings.url : 'https://scalr.api.appbase.io',
33418
32532
  app: settings.app,
@@ -33421,10 +32535,10 @@
33421
32535
  type: settings.type ? settings.type : '*',
33422
32536
  transformResponse: settings.transformResponse || null,
33423
32537
  graphQLUrl: settings.graphQLUrl || '',
33424
- headers: settings.headers || {},
32538
+ headers: headers,
33425
32539
  analyticsConfig: settings.appbaseConfig || null
33426
32540
  };
33427
- var appbaseRef = index$2(config);
32541
+ var appbaseRef = appbasejs(config);
33428
32542
  var components = [];
33429
32543
  var selectedValues = {};
33430
32544
  var internalValues = {};
@@ -33643,8 +32757,9 @@
33643
32757
  appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), transform_1(state, component.componentId, orderOfQueries));
33644
32758
  }
33645
32759
  } else {
32760
+ var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
33646
32761
  finalQuery = [].concat(finalQuery, [{
33647
- preference: component.componentId
32762
+ preference: preference
33648
32763
  }, currentQuery]);
33649
32764
  }
33650
32765
  }
@@ -33798,7 +32913,7 @@
33798
32913
  });
33799
32914
  }
33800
32915
 
33801
- var version = "1.16.0-alpha.21";
32916
+ var version = "1.16.0-alpha.25";
33802
32917
 
33803
32918
  var _templateObject$o, _templateObject2$b;
33804
32919
 
@@ -34126,7 +33241,7 @@
34126
33241
  if (typeof window !== 'undefined' && window.Vue) {
34127
33242
  install(window.Vue);
34128
33243
  }
34129
- var index$4 = {
33244
+ var index$3 = {
34130
33245
  version: version,
34131
33246
  install: install
34132
33247
  };
@@ -34150,7 +33265,7 @@
34150
33265
  exports.SingleRange = SingleRange;
34151
33266
  exports.StateProvider = StateProvider;
34152
33267
  exports.ToggleButton = ToggleButton;
34153
- exports.default = index$4;
33268
+ exports.default = index$3;
34154
33269
  exports.initReactivesearch = initReactivesearch;
34155
33270
  exports.install = install;
34156
33271
  exports.version = version;