@appbaseio/reactivesearch-vue 1.22.3 → 1.23.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.
Files changed (57) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +166 -1048
  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-1ed41dcf.js → ComponentWrapper-32481890.js} +1 -1
  6. package/dist/cjs/DataSearch.js +3 -3
  7. package/dist/cjs/{DropDown-bcc46b94.js → DropDown-59a7971b.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/RangeInput.js +3 -3
  13. package/dist/cjs/RangeSlider.js +3 -3
  14. package/dist/cjs/ReactiveBase.js +25 -11
  15. package/dist/cjs/ReactiveComponent.js +42 -8
  16. package/dist/cjs/ReactiveList.js +21 -20
  17. package/dist/cjs/ResultCard.js +1 -1
  18. package/dist/cjs/ResultList.js +1 -1
  19. package/dist/cjs/SelectedFilters.js +2 -2
  20. package/dist/cjs/SingleDropdownList.js +4 -4
  21. package/dist/cjs/SingleList.js +3 -3
  22. package/dist/cjs/SingleRange.js +3 -3
  23. package/dist/cjs/StateProvider.js +2 -2
  24. package/dist/cjs/ToggleButton.js +3 -3
  25. package/dist/cjs/{index-1eb968bc.js → index-89c39a9e.js} +2 -0
  26. package/dist/cjs/index.js +4 -4
  27. package/dist/cjs/initReactivesearch.js +12 -2
  28. package/dist/cjs/install.js +4 -4
  29. package/dist/cjs/version.js +1 -1
  30. package/dist/cjs/{vueTypes-6ab522d8.js → vueTypes-22b4fd3a.js} +3 -2
  31. package/dist/es/{ComponentWrapper-a2877896.js → ComponentWrapper-4f85a67e.js} +1 -1
  32. package/dist/es/DataSearch.js +3 -3
  33. package/dist/es/{DropDown-0463bae0.js → DropDown-db7fe433.js} +2 -2
  34. package/dist/es/DynamicRangeSlider.js +2 -2
  35. package/dist/es/MultiDropdownList.js +4 -4
  36. package/dist/es/MultiList.js +3 -3
  37. package/dist/es/MultiRange.js +3 -3
  38. package/dist/es/RangeInput.js +3 -3
  39. package/dist/es/RangeSlider.js +3 -3
  40. package/dist/es/ReactiveBase.js +25 -11
  41. package/dist/es/ReactiveComponent.js +42 -8
  42. package/dist/es/ReactiveList.js +21 -20
  43. package/dist/es/ResultCard.js +1 -1
  44. package/dist/es/ResultList.js +1 -1
  45. package/dist/es/SelectedFilters.js +2 -2
  46. package/dist/es/SingleDropdownList.js +4 -4
  47. package/dist/es/SingleList.js +3 -3
  48. package/dist/es/SingleRange.js +3 -3
  49. package/dist/es/StateProvider.js +2 -2
  50. package/dist/es/ToggleButton.js +3 -3
  51. package/dist/es/{index-7cb59e1a.js → index-cb1950b6.js} +2 -1
  52. package/dist/es/index.js +4 -4
  53. package/dist/es/initReactivesearch.js +13 -3
  54. package/dist/es/install.js +4 -4
  55. package/dist/es/version.js +1 -1
  56. package/dist/es/{vueTypes-f14e68c1.js → vueTypes-e89c8a3c.js} +3 -2
  57. package/package.json +80 -80
@@ -5517,7 +5517,7 @@
5517
5517
  }, size > 0 ? {
5518
5518
  numberOfPages: Math.ceil(total / size)
5519
5519
  } : null, {
5520
- time: time,
5520
+ time: time || 0,
5521
5521
  hidden: hidden,
5522
5522
  promoted: promotedResults && promotedResults.length
5523
5523
  });
@@ -8636,7 +8636,7 @@
8636
8636
  componentList.forEach(function (component) {
8637
8637
  var componentProps = props[component];
8638
8638
 
8639
- if (selectedValues[componentId] && selectedValues[componentId].reference !== 'URL' && [constants$1.componentTypes.reactiveList, constants$1.componentTypes.reactiveMap].includes(componentProps.componentType)) {
8639
+ if (selectedValues[componentId] && selectedValues[componentId].reference !== 'URL' && componentProps && [constants$1.componentTypes.reactiveList, constants$1.componentTypes.reactiveMap].includes(componentProps.componentType)) {
8640
8640
  dispatch((0, value.setValue)(component, null));
8641
8641
  }
8642
8642
 
@@ -8698,9 +8698,9 @@
8698
8698
  value$1 = internalValues[componentId] && internalValues[componentId].value;
8699
8699
  }
8700
8700
 
8701
- var query = (0, transform.getRSQuery)(component, (0, transform.extractPropsFromState)(getState(), component, _extends({
8701
+ var query = (0, transform.getRSQuery)(component, (0, transform.extractPropsFromState)(getState(), component, _extends({}, value$1 ? {
8702
8702
  value: value$1
8703
- }, metaOptions ? {
8703
+ } : null, metaOptions ? {
8704
8704
  from: metaOptions.from
8705
8705
  } : null)));
8706
8706
 
@@ -8721,8 +8721,9 @@
8721
8721
  }
8722
8722
  }
8723
8723
  } else {
8724
+ var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + '_' + component : component;
8724
8725
  finalQuery = [].concat(_toConsumableArray(finalQuery), [{
8725
- preference: component
8726
+ preference: preference
8726
8727
  }, currentQuery]);
8727
8728
  }
8728
8729
  }
@@ -8927,8 +8928,9 @@
8927
8928
  appendToAggs: appendToAggs
8928
8929
  }));
8929
8930
  } else {
8931
+ var preference = store.config && store.config.analyticsConfig && store.config.analyticsConfig.userId ? store.config.analyticsConfig.userId + '_' + component : component;
8930
8932
  var _finalQuery = [{
8931
- preference: component
8933
+ preference: preference
8932
8934
  }, currentQuery];
8933
8935
  dispatch(msearch(_finalQuery, [component], appendToHits, false, appendToAggs));
8934
8936
  }
@@ -12776,8 +12778,9 @@
12776
12778
  emptyQuery: VueTypes.bool,
12777
12779
  suggestionAnalytics: VueTypes.bool,
12778
12780
  userId: VueTypes.string,
12779
- customEvents: VueTypes.object
12780
- })
12781
+ customEvents: VueTypes.object,
12782
+ enableTelemetry: VueTypes.bool.def(true)
12783
+ }).def({})
12781
12784
  };
12782
12785
 
12783
12786
  var getClassName = lib_8.getClassName,
@@ -13092,6 +13095,7 @@
13092
13095
  // storeKey,
13093
13096
  // });
13094
13097
 
13098
+ var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
13095
13099
  var composeThemeObject = function composeThemeObject(ownTheme, userTheme) {
13096
13100
  if (ownTheme === void 0) {
13097
13101
  ownTheme = {};
@@ -13880,18 +13884,17 @@
13880
13884
  ResultCardsWrapper: ResultCardsWrapper
13881
13885
  },
13882
13886
  data: function data() {
13883
- var props = this.$props;
13884
13887
  var currentPageState = 0;
13888
+ var defaultPage = this.defaultPage || -1;
13885
13889
 
13886
- if (props.defaultPage >= 0) {
13887
- currentPageState = props.defaultPage;
13888
- } else if (props.currentPage) {
13889
- currentPageState = Math.max(props.currentPage - 1, 0);
13890
+ if (defaultPage >= 0) {
13891
+ currentPageState = defaultPage;
13892
+ } else if (this.currentPage) {
13893
+ currentPageState = Math.max(this.currentPage - 1, 0);
13890
13894
  }
13891
13895
 
13892
13896
  this.__state = {
13893
- from: currentPageState * props.size,
13894
- isLoading: true,
13897
+ from: currentPageState * this.size,
13895
13898
  currentPageState: currentPageState
13896
13899
  };
13897
13900
  return this.__state;
@@ -13920,8 +13923,10 @@
13920
13923
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
13921
13924
  }
13922
13925
 
13923
- if (this.defaultPage >= 0) {
13924
- this.currentPageState = this.defaultPage;
13926
+ var defaultPage = this.defaultPage || -1;
13927
+
13928
+ if (defaultPage >= 0) {
13929
+ this.currentPageState = defaultPage;
13925
13930
  this.from = this.currentPageState * this.$props.size;
13926
13931
  }
13927
13932
 
@@ -14389,7 +14394,7 @@
14389
14394
  if (this.stats.numberOfResults) {
14390
14395
  return h("p", {
14391
14396
  "class": resultStats + " " + getClassName$1(this.$props.innerClass, 'resultStats')
14392
- }, [this.stats.numberOfResults, " results found in ", this.stats.time, "ms"]);
14397
+ }, [this.stats.numberOfResults, " results found in ", this.stats.time || 0, "ms"]);
14393
14398
  }
14394
14399
 
14395
14400
  return null;
@@ -14522,7 +14527,7 @@
14522
14527
  return {
14523
14528
  data: this.withClickIds(filteredResults),
14524
14529
  aggregationData: this.withClickIds(aggregationData || []),
14525
- promotedData: this.withClickIds(promotedResults),
14530
+ promotedData: this.withClickIds(promotedResults || []),
14526
14531
  rawData: this.rawData,
14527
14532
  resultStats: this.stats,
14528
14533
  customData: customData
@@ -14534,7 +14539,7 @@
14534
14539
 
14535
14540
  var data = _extends({
14536
14541
  error: error,
14537
- loading: isLoading,
14542
+ loading: isLoading || false,
14538
14543
  loadMore: this.loadMore,
14539
14544
  // TODO: Remove in v2
14540
14545
  triggerAnalytics: this.triggerClickAnalytics,
@@ -14549,13 +14554,13 @@
14549
14554
 
14550
14555
  var mapStateToProps$1 = function mapStateToProps(state, props) {
14551
14556
  return {
14552
- defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
14557
+ defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1,
14553
14558
  hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
14554
14559
  rawData: state.rawData[props.componentId],
14555
- aggregationData: state.compositeAggregations[props.componentId] || [],
14556
- promotedResults: state.promotedResults[props.componentId] || [],
14560
+ aggregationData: state.compositeAggregations[props.componentId],
14561
+ promotedResults: state.promotedResults[props.componentId],
14557
14562
  customData: state.customData[props.componentId],
14558
- time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
14563
+ time: state.hits[props.componentId] && state.hits[props.componentId].time,
14559
14564
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
14560
14565
  hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
14561
14566
  analytics: state.config && state.config.analytics,
@@ -14564,7 +14569,7 @@
14564
14569
  error: state.error[props.componentId],
14565
14570
  afterKey: state.aggregations[props.componentId] && state.aggregations[props.componentId][props.aggregationField] && state.aggregations[props.componentId][props.aggregationField].after_key,
14566
14571
  componentProps: state.props[props.componentId],
14567
- isLoading: state.isLoading[props.componentId] || false
14572
+ isLoading: state.isLoading[props.componentId]
14568
14573
  };
14569
14574
  };
14570
14575
 
@@ -15288,562 +15293,6 @@
15288
15293
  }
15289
15294
  });
15290
15295
 
15291
- var at,
15292
- // The index of the current character
15293
- ch,
15294
- // The current character
15295
- escapee = {
15296
- '"': '"',
15297
- '\\': '\\',
15298
- '/': '/',
15299
- b: '\b',
15300
- f: '\f',
15301
- n: '\n',
15302
- r: '\r',
15303
- t: '\t'
15304
- },
15305
- text,
15306
- error = function error(m) {
15307
- // Call error when something is wrong.
15308
- throw {
15309
- name: 'SyntaxError',
15310
- message: m,
15311
- at: at,
15312
- text: text
15313
- };
15314
- },
15315
- next = function next(c) {
15316
- // If a c parameter is provided, verify that it matches the current character.
15317
- if (c && c !== ch) {
15318
- error("Expected '" + c + "' instead of '" + ch + "'");
15319
- } // Get the next character. When there are no more characters,
15320
- // return the empty string.
15321
-
15322
-
15323
- ch = text.charAt(at);
15324
- at += 1;
15325
- return ch;
15326
- },
15327
- number = function number() {
15328
- // Parse a number value.
15329
- var number,
15330
- string = '';
15331
-
15332
- if (ch === '-') {
15333
- string = '-';
15334
- next('-');
15335
- }
15336
-
15337
- while (ch >= '0' && ch <= '9') {
15338
- string += ch;
15339
- next();
15340
- }
15341
-
15342
- if (ch === '.') {
15343
- string += '.';
15344
-
15345
- while (next() && ch >= '0' && ch <= '9') {
15346
- string += ch;
15347
- }
15348
- }
15349
-
15350
- if (ch === 'e' || ch === 'E') {
15351
- string += ch;
15352
- next();
15353
-
15354
- if (ch === '-' || ch === '+') {
15355
- string += ch;
15356
- next();
15357
- }
15358
-
15359
- while (ch >= '0' && ch <= '9') {
15360
- string += ch;
15361
- next();
15362
- }
15363
- }
15364
-
15365
- number = +string;
15366
-
15367
- if (!isFinite(number)) {
15368
- error("Bad number");
15369
- } else {
15370
- return number;
15371
- }
15372
- },
15373
- string = function string() {
15374
- // Parse a string value.
15375
- var hex,
15376
- i,
15377
- string = '',
15378
- uffff; // When parsing for string values, we must look for " and \ characters.
15379
-
15380
- if (ch === '"') {
15381
- while (next()) {
15382
- if (ch === '"') {
15383
- next();
15384
- return string;
15385
- } else if (ch === '\\') {
15386
- next();
15387
-
15388
- if (ch === 'u') {
15389
- uffff = 0;
15390
-
15391
- for (i = 0; i < 4; i += 1) {
15392
- hex = parseInt(next(), 16);
15393
-
15394
- if (!isFinite(hex)) {
15395
- break;
15396
- }
15397
-
15398
- uffff = uffff * 16 + hex;
15399
- }
15400
-
15401
- string += String.fromCharCode(uffff);
15402
- } else if (typeof escapee[ch] === 'string') {
15403
- string += escapee[ch];
15404
- } else {
15405
- break;
15406
- }
15407
- } else {
15408
- string += ch;
15409
- }
15410
- }
15411
- }
15412
-
15413
- error("Bad string");
15414
- },
15415
- white = function white() {
15416
- // Skip whitespace.
15417
- while (ch && ch <= ' ') {
15418
- next();
15419
- }
15420
- },
15421
- word = function word() {
15422
- // true, false, or null.
15423
- switch (ch) {
15424
- case 't':
15425
- next('t');
15426
- next('r');
15427
- next('u');
15428
- next('e');
15429
- return true;
15430
-
15431
- case 'f':
15432
- next('f');
15433
- next('a');
15434
- next('l');
15435
- next('s');
15436
- next('e');
15437
- return false;
15438
-
15439
- case 'n':
15440
- next('n');
15441
- next('u');
15442
- next('l');
15443
- next('l');
15444
- return null;
15445
- }
15446
-
15447
- error("Unexpected '" + ch + "'");
15448
- },
15449
- value$1,
15450
- // Place holder for the value function.
15451
- array = function array() {
15452
- // Parse an array value.
15453
- var array = [];
15454
-
15455
- if (ch === '[') {
15456
- next('[');
15457
- white();
15458
-
15459
- if (ch === ']') {
15460
- next(']');
15461
- return array; // empty array
15462
- }
15463
-
15464
- while (ch) {
15465
- array.push(value$1());
15466
- white();
15467
-
15468
- if (ch === ']') {
15469
- next(']');
15470
- return array;
15471
- }
15472
-
15473
- next(',');
15474
- white();
15475
- }
15476
- }
15477
-
15478
- error("Bad array");
15479
- },
15480
- object = function object() {
15481
- // Parse an object value.
15482
- var key,
15483
- object = {};
15484
-
15485
- if (ch === '{') {
15486
- next('{');
15487
- white();
15488
-
15489
- if (ch === '}') {
15490
- next('}');
15491
- return object; // empty object
15492
- }
15493
-
15494
- while (ch) {
15495
- key = string();
15496
- white();
15497
- next(':');
15498
-
15499
- if (Object.hasOwnProperty.call(object, key)) {
15500
- error('Duplicate key "' + key + '"');
15501
- }
15502
-
15503
- object[key] = value$1();
15504
- white();
15505
-
15506
- if (ch === '}') {
15507
- next('}');
15508
- return object;
15509
- }
15510
-
15511
- next(',');
15512
- white();
15513
- }
15514
- }
15515
-
15516
- error("Bad object");
15517
- };
15518
-
15519
- value$1 = function value() {
15520
- // Parse a JSON value. It could be an object, an array, a string, a number,
15521
- // or a word.
15522
- white();
15523
-
15524
- switch (ch) {
15525
- case '{':
15526
- return object();
15527
-
15528
- case '[':
15529
- return array();
15530
-
15531
- case '"':
15532
- return string();
15533
-
15534
- case '-':
15535
- return number();
15536
-
15537
- default:
15538
- return ch >= '0' && ch <= '9' ? number() : word();
15539
- }
15540
- }; // Return the json_parse function. It will have access to all of the above
15541
- // functions and variables.
15542
-
15543
-
15544
- var parse = function parse(source, reviver) {
15545
- var result;
15546
- text = source;
15547
- at = 0;
15548
- ch = ' ';
15549
- result = value$1();
15550
- white();
15551
-
15552
- if (ch) {
15553
- error("Syntax error");
15554
- } // If there is a reviver function, we recursively walk the new structure,
15555
- // passing each name/value pair to the reviver function for possible
15556
- // transformation, starting with a temporary root object that holds the result
15557
- // in an empty key. If there is not a reviver function, we simply return the
15558
- // result.
15559
-
15560
-
15561
- return typeof reviver === 'function' ? function walk(holder, key) {
15562
- var k,
15563
- v,
15564
- value = holder[key];
15565
-
15566
- if (value && typeof value === 'object') {
15567
- for (k in value) {
15568
- if (Object.prototype.hasOwnProperty.call(value, k)) {
15569
- v = walk(value, k);
15570
-
15571
- if (v !== undefined) {
15572
- value[k] = v;
15573
- } else {
15574
- delete value[k];
15575
- }
15576
- }
15577
- }
15578
- }
15579
-
15580
- return reviver.call(holder, key, value);
15581
- }({
15582
- '': result
15583
- }, '') : result;
15584
- };
15585
-
15586
- var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
15587
- gap,
15588
- indent,
15589
- meta = {
15590
- // table of character substitutions
15591
- '\b': '\\b',
15592
- '\t': '\\t',
15593
- '\n': '\\n',
15594
- '\f': '\\f',
15595
- '\r': '\\r',
15596
- '"': '\\"',
15597
- '\\': '\\\\'
15598
- },
15599
- rep;
15600
-
15601
- function quote(string) {
15602
- // If the string contains no control characters, no quote characters, and no
15603
- // backslash characters, then we can safely slap some quotes around it.
15604
- // Otherwise we must also replace the offending characters with safe escape
15605
- // sequences.
15606
- escapable.lastIndex = 0;
15607
- return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
15608
- var c = meta[a];
15609
- return typeof c === 'string' ? c : "\\u" + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
15610
- }) + '"' : '"' + string + '"';
15611
- }
15612
-
15613
- function str(key, holder) {
15614
- // Produce a string from holder[key].
15615
- var i,
15616
- // The loop counter.
15617
- k,
15618
- // The member key.
15619
- v,
15620
- // The member value.
15621
- length,
15622
- mind = gap,
15623
- partial,
15624
- value = holder[key]; // If the value has a toJSON method, call it to obtain a replacement value.
15625
-
15626
- if (value && typeof value === 'object' && typeof value.toJSON === 'function') {
15627
- value = value.toJSON(key);
15628
- } // If we were called with a replacer function, then call the replacer to
15629
- // obtain a replacement value.
15630
-
15631
-
15632
- if (typeof rep === 'function') {
15633
- value = rep.call(holder, key, value);
15634
- } // What happens next depends on the value's type.
15635
-
15636
-
15637
- switch (typeof value) {
15638
- case 'string':
15639
- return quote(value);
15640
-
15641
- case 'number':
15642
- // JSON numbers must be finite. Encode non-finite numbers as null.
15643
- return isFinite(value) ? String(value) : 'null';
15644
-
15645
- case 'boolean':
15646
- case 'null':
15647
- // If the value is a boolean or null, convert it to a string. Note:
15648
- // typeof null does not produce 'null'. The case is included here in
15649
- // the remote chance that this gets fixed someday.
15650
- return String(value);
15651
-
15652
- case 'object':
15653
- if (!value) return 'null';
15654
- gap += indent;
15655
- partial = []; // Array.isArray
15656
-
15657
- if (Object.prototype.toString.apply(value) === '[object Array]') {
15658
- length = value.length;
15659
-
15660
- for (i = 0; i < length; i += 1) {
15661
- partial[i] = str(i, value) || 'null';
15662
- } // Join all of the elements together, separated with commas, and
15663
- // wrap them in brackets.
15664
-
15665
-
15666
- v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']';
15667
- gap = mind;
15668
- return v;
15669
- } // If the replacer is an array, use it to select the members to be
15670
- // stringified.
15671
-
15672
-
15673
- if (rep && typeof rep === 'object') {
15674
- length = rep.length;
15675
-
15676
- for (i = 0; i < length; i += 1) {
15677
- k = rep[i];
15678
-
15679
- if (typeof k === 'string') {
15680
- v = str(k, value);
15681
-
15682
- if (v) {
15683
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
15684
- }
15685
- }
15686
- }
15687
- } else {
15688
- // Otherwise, iterate through all of the keys in the object.
15689
- for (k in value) {
15690
- if (Object.prototype.hasOwnProperty.call(value, k)) {
15691
- v = str(k, value);
15692
-
15693
- if (v) {
15694
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
15695
- }
15696
- }
15697
- }
15698
- } // Join all of the member texts together, separated with commas,
15699
- // and wrap them in braces.
15700
-
15701
-
15702
- v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}';
15703
- gap = mind;
15704
- return v;
15705
- }
15706
- }
15707
-
15708
- var stringify = function stringify(value, replacer, space) {
15709
- var i;
15710
- gap = '';
15711
- indent = ''; // If the space parameter is a number, make an indent string containing that
15712
- // many spaces.
15713
-
15714
- if (typeof space === 'number') {
15715
- for (i = 0; i < space; i += 1) {
15716
- indent += ' ';
15717
- }
15718
- } // If the space parameter is a string, it will be used as the indent string.
15719
- else if (typeof space === 'string') {
15720
- indent = space;
15721
- } // If there is a replacer, it must be a function or an array.
15722
- // Otherwise, throw an error.
15723
-
15724
-
15725
- rep = replacer;
15726
-
15727
- if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) {
15728
- throw new Error('JSON.stringify');
15729
- } // Make a fake root object containing our value under the key of ''.
15730
- // Return the result of stringifying the value.
15731
-
15732
-
15733
- return str('', {
15734
- '': value
15735
- });
15736
- };
15737
-
15738
- var parse$1 = parse;
15739
- var stringify$1 = stringify;
15740
- var jsonify = {
15741
- parse: parse$1,
15742
- stringify: stringify$1
15743
- };
15744
-
15745
- var json = typeof JSON !== 'undefined' ? JSON : jsonify;
15746
-
15747
- var jsonStableStringify = function jsonStableStringify(obj, opts) {
15748
- if (!opts) opts = {};
15749
- if (typeof opts === 'function') opts = {
15750
- cmp: opts
15751
- };
15752
- var space = opts.space || '';
15753
- if (typeof space === 'number') space = Array(space + 1).join(' ');
15754
- var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false;
15755
-
15756
- var replacer = opts.replacer || function (key, value) {
15757
- return value;
15758
- };
15759
-
15760
- var cmp = opts.cmp && function (f) {
15761
- return function (node) {
15762
- return function (a, b) {
15763
- var aobj = {
15764
- key: a,
15765
- value: node[a]
15766
- };
15767
- var bobj = {
15768
- key: b,
15769
- value: node[b]
15770
- };
15771
- return f(aobj, bobj);
15772
- };
15773
- };
15774
- }(opts.cmp);
15775
-
15776
- var seen = [];
15777
- return function stringify(parent, key, node, level) {
15778
- var indent = space ? '\n' + new Array(level + 1).join(space) : '';
15779
- var colonSeparator = space ? ': ' : ':';
15780
-
15781
- if (node && node.toJSON && typeof node.toJSON === 'function') {
15782
- node = node.toJSON();
15783
- }
15784
-
15785
- node = replacer.call(parent, key, node);
15786
-
15787
- if (node === undefined) {
15788
- return;
15789
- }
15790
-
15791
- if (typeof node !== 'object' || node === null) {
15792
- return json.stringify(node);
15793
- }
15794
-
15795
- if (isArray$1(node)) {
15796
- var out = [];
15797
-
15798
- for (var i = 0; i < node.length; i++) {
15799
- var item = stringify(node, i, node[i], level + 1) || json.stringify(null);
15800
- out.push(indent + space + item);
15801
- }
15802
-
15803
- return '[' + out.join(',') + indent + ']';
15804
- } else {
15805
- if (seen.indexOf(node) !== -1) {
15806
- if (cycles) return json.stringify('__cycle__');
15807
- throw new TypeError('Converting circular structure to JSON');
15808
- } else seen.push(node);
15809
-
15810
- var keys = objectKeys(node).sort(cmp && cmp(node));
15811
- var out = [];
15812
-
15813
- for (var i = 0; i < keys.length; i++) {
15814
- var key = keys[i];
15815
- var value = stringify(node, key, node[key], level + 1);
15816
- if (!value) continue;
15817
- var keyValue = json.stringify(key) + colonSeparator + value;
15818
- out.push(indent + space + keyValue);
15819
- }
15820
-
15821
- seen.splice(seen.indexOf(node), 1);
15822
- return '{' + out.join(',') + indent + '}';
15823
- }
15824
- }({
15825
- '': obj
15826
- }, '', obj, 0);
15827
- };
15828
-
15829
- var isArray$1 = Array.isArray || function (x) {
15830
- return {}.toString.call(x) === '[object Array]';
15831
- };
15832
-
15833
- var objectKeys = Object.keys || function (obj) {
15834
- var has = Object.prototype.hasOwnProperty || function () {
15835
- return true;
15836
- };
15837
-
15838
- var keys = [];
15839
-
15840
- for (var key in obj) {
15841
- if (has.call(obj, key)) keys.push(key);
15842
- }
15843
-
15844
- return keys;
15845
- };
15846
-
15847
15296
  var _typeof$1 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
15848
15297
  return typeof obj;
15849
15298
  } : function (obj) {
@@ -15879,16 +15328,6 @@
15879
15328
  return output;
15880
15329
  }
15881
15330
 
15882
- function uuidv4() {
15883
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
15884
- var r = Math.random() * 16 | 0; // eslint-disable-line no-bitwise
15885
-
15886
- var v = c === 'x' ? r : r & 0x3 | 0x8; // eslint-disable-line no-bitwise
15887
-
15888
- return v.toString(16);
15889
- });
15890
- }
15891
-
15892
15331
  function validateRSQuery(query) {
15893
15332
  if (query && Object.prototype.toString.call(query) === '[object Array]') {
15894
15333
  for (var i = 0; i < query.length; i += 1) {
@@ -15951,24 +15390,6 @@
15951
15390
 
15952
15391
  return null;
15953
15392
  }
15954
- /**
15955
- * Send only when a connection is opened
15956
- * @param {Object} socket
15957
- * @param {Function} callback
15958
- */
15959
-
15960
-
15961
- function waitForSocketConnection(socket, callback) {
15962
- setTimeout(function () {
15963
- if (socket.readyState === 1) {
15964
- if (callback != null) {
15965
- callback();
15966
- }
15967
- } else {
15968
- waitForSocketConnection(socket, callback);
15969
- }
15970
- }, 5); // wait 5 ms for the connection...
15971
- }
15972
15393
 
15973
15394
  function encodeHeaders() {
15974
15395
  var headers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -15986,6 +15407,21 @@
15986
15407
 
15987
15408
  return encodedHeaders;
15988
15409
  }
15410
+
15411
+ function getTelemetryHeaders(enableTelemetry) {
15412
+ var headers = {};
15413
+ Object.assign(headers, {
15414
+ 'X-Search-Client': 'Appbase JS'
15415
+ });
15416
+
15417
+ if (enableTelemetry === false) {
15418
+ Object.assign(headers, {
15419
+ 'X-Enable-Telemetry': enableTelemetry
15420
+ });
15421
+ }
15422
+
15423
+ return headers;
15424
+ }
15989
15425
  /**
15990
15426
  * Returns an instance of Appbase client
15991
15427
  * @param {Object} config To configure properties
@@ -15994,6 +15430,7 @@
15994
15430
  * @param {String} config.credentials
15995
15431
  * @param {String} config.username
15996
15432
  * @param {String} config.password
15433
+ * @param {Boolean} config.enableTelemetry
15997
15434
  * A callback function which will be invoked before a fetch request made
15998
15435
  */
15999
15436
 
@@ -16020,7 +15457,7 @@
16020
15457
  }
16021
15458
 
16022
15459
  if (typeof protocol !== 'string' || protocol === '') {
16023
- throw new Error('Protocol is not present in url. URL should be of the form https://scalr.api.appbase.io');
15460
+ throw new Error('Protocol is not present in url. URL should be of the form https://appbase-demo-ansible-abxiydt-arc.searchbase.io');
16024
15461
  } // Parse url
16025
15462
 
16026
15463
 
@@ -16048,7 +15485,10 @@
16048
15485
  this.protocol = protocol;
16049
15486
  this.app = config.app;
16050
15487
  this.credentials = credentials;
16051
- this.headers = {};
15488
+
15489
+ if (typeof config.enableTelemetry === 'boolean') {
15490
+ this.enableTelemetry = config.enableTelemetry;
15491
+ }
16052
15492
  }
16053
15493
  /**
16054
15494
  * To perform fetch request
@@ -16057,6 +15497,7 @@
16057
15497
  * @param {String} args.path
16058
15498
  * @param {Object} args.params
16059
15499
  * @param {Object} args.body
15500
+ * @param {Object} args.headers
16060
15501
  * @param {boolean} args.isSuggestionsAPI
16061
15502
  */
16062
15503
 
@@ -16080,7 +15521,7 @@
16080
15521
  var headers = Object.assign({}, {
16081
15522
  Accept: 'application/json',
16082
15523
  'Content-Type': contentType
16083
- }, _this.headers);
15524
+ }, args.headers, _this.headers);
16084
15525
  var timestamp = Date.now();
16085
15526
 
16086
15527
  if (_this.credentials) {
@@ -16131,7 +15572,12 @@
16131
15572
  var transformedRequest = Object.assign({}, ts);
16132
15573
  var url = transformedRequest.url;
16133
15574
  delete transformedRequest.url;
16134
- return browserPonyfill$1(url || finalURL, transformedRequest).then(function (res) {
15575
+ return browserPonyfill$1(url || finalURL, Object.assign({}, transformedRequest, {
15576
+ // apply timestamp header for RS API
15577
+ headers: isRSAPI ? Object.assign({}, transformedRequest.headers, {
15578
+ 'x-timestamp': new Date().getTime()
15579
+ }) : transformedRequest.headers
15580
+ })).then(function (res) {
16135
15581
  if (res.status >= 500) {
16136
15582
  return reject(res);
16137
15583
  }
@@ -16200,180 +15646,6 @@
16200
15646
  }
16201
15647
  });
16202
15648
  }
16203
-
16204
- var WebSocket = typeof window !== 'undefined' ? window.WebSocket : require('ws');
16205
- /**
16206
- * To connect a web socket
16207
- * @param {Object} args
16208
- * @param {String} args.method
16209
- * @param {String} args.path
16210
- * @param {Object} args.params
16211
- * @param {Object} args.body
16212
- */
16213
-
16214
- function wsRequest(args, onData, onError, onClose) {
16215
- var _this = this;
16216
-
16217
- try {
16218
- var parsedArgs = removeUndefined(args);
16219
- var method = parsedArgs.method,
16220
- path = parsedArgs.path,
16221
- params = parsedArgs.params;
16222
- var bodyCopy = args.body;
16223
-
16224
- if (!bodyCopy || (typeof bodyCopy === 'undefined' ? 'undefined' : _typeof$1(bodyCopy)) !== 'object') {
16225
- bodyCopy = {};
16226
- }
16227
-
16228
- var init = function init() {
16229
- _this.ws = new WebSocket('wss://' + _this.url + '/' + _this.app);
16230
- _this.id = uuidv4();
16231
- _this.request = {
16232
- id: _this.id,
16233
- path: _this.app + '/' + path + '?' + querystring.stringify(params),
16234
- method: method,
16235
- body: bodyCopy
16236
- };
16237
-
16238
- if (_this.credentials) {
16239
- _this.request.authorization = 'Basic ' + btoa$1(_this.credentials);
16240
- }
16241
-
16242
- _this.result = {};
16243
-
16244
- _this.closeHandler = function () {
16245
- _this.wsClosed();
16246
- };
16247
-
16248
- _this.errorHandler = function (err) {
16249
- _this.processError.apply(_this, [err]);
16250
- };
16251
-
16252
- _this.messageHandler = function (message) {
16253
- var dataObj = JSON.parse(message.data);
16254
-
16255
- if (dataObj.body && dataObj.body.status >= 400) {
16256
- _this.processError.apply(_this, [dataObj]);
16257
- } else {
16258
- _this.processMessage.apply(_this, [dataObj]);
16259
- }
16260
- };
16261
-
16262
- _this.send = function (request) {
16263
- waitForSocketConnection(_this.ws, function () {
16264
- try {
16265
- _this.ws.send(JSON.stringify(request));
16266
- } catch (e) {
16267
- console.warn(e);
16268
- }
16269
- });
16270
- };
16271
-
16272
- _this.ws.onmessage = _this.messageHandler;
16273
- _this.ws.onerror = _this.errorHandler;
16274
- _this.ws.onclose = _this.closeHandler;
16275
-
16276
- _this.send(_this.request);
16277
-
16278
- _this.result.stop = _this.stop;
16279
- _this.result.reconnect = _this.reconnect;
16280
- return _this.result;
16281
- };
16282
-
16283
- this.wsClosed = function () {
16284
- if (onClose) {
16285
- onClose();
16286
- }
16287
- };
16288
-
16289
- this.stop = function () {
16290
- _this.ws.onmessage = undefined;
16291
- _this.ws.onclose = undefined;
16292
- _this.ws.onerror = undefined;
16293
-
16294
- _this.wsClosed();
16295
-
16296
- var unsubRequest = JSON.parse(JSON.stringify(_this.request));
16297
- unsubRequest.unsubscribe = true;
16298
-
16299
- if (_this.unsubscribed !== true) {
16300
- _this.send(unsubRequest);
16301
- }
16302
-
16303
- _this.unsubscribed = true;
16304
- };
16305
-
16306
- this.reconnect = function () {
16307
- _this.stop();
16308
-
16309
- return wsRequest(args, onData, onError, onClose);
16310
- };
16311
-
16312
- this.processError = function (err) {
16313
- if (onError) {
16314
- onError(err);
16315
- } else {
16316
- console.warn(err);
16317
- }
16318
- };
16319
-
16320
- this.processMessage = function (origDataObj) {
16321
- var dataObj = JSON.parse(JSON.stringify(origDataObj));
16322
-
16323
- if (!dataObj.id && dataObj.message) {
16324
- if (onError) {
16325
- onError(dataObj);
16326
- }
16327
-
16328
- return;
16329
- }
16330
-
16331
- if (dataObj.id === _this.id) {
16332
- if (dataObj.message) {
16333
- delete dataObj.id;
16334
-
16335
- if (onError) {
16336
- onError(dataObj);
16337
- }
16338
-
16339
- return;
16340
- }
16341
-
16342
- if (dataObj.query_id) {
16343
- _this.query_id = dataObj.query_id;
16344
- }
16345
-
16346
- if (dataObj.channel) {
16347
- _this.channel = dataObj.channel;
16348
- }
16349
-
16350
- if (dataObj.body && dataObj.body !== '') {
16351
- if (onData) {
16352
- onData(dataObj.body);
16353
- }
16354
- }
16355
-
16356
- return;
16357
- }
16358
-
16359
- if (!dataObj.id && dataObj.channel && dataObj.channel === _this.channel) {
16360
- if (onData) {
16361
- onData(dataObj.event);
16362
- }
16363
- }
16364
- };
16365
-
16366
- return init();
16367
- } catch (e) {
16368
- if (onError) {
16369
- onError(e);
16370
- } else {
16371
- console.warn(e);
16372
- }
16373
-
16374
- return null;
16375
- }
16376
- }
16377
15649
  /**
16378
15650
  * Index Service
16379
15651
  * @param {Object} args
@@ -16654,7 +15926,7 @@
16654
15926
  */
16655
15927
 
16656
15928
 
16657
- function reactiveSearchv3Api(query, settings) {
15929
+ function reactiveSearchApi(query, settings) {
16658
15930
  var parsedSettings = removeUndefined(settings); // Validate query
16659
15931
 
16660
15932
  var valid = validateRSQuery(query);
@@ -16669,251 +15941,42 @@
16669
15941
  };
16670
15942
  return this.performFetchRequest({
16671
15943
  method: 'POST',
16672
- path: '_reactivesearch.v3',
15944
+ path: '_reactivesearch',
16673
15945
  body: body,
15946
+ headers: getTelemetryHeaders(this.enableTelemetry),
16674
15947
  isRSAPI: true
16675
15948
  });
16676
15949
  }
16677
15950
  /**
16678
- * Stream Service
16679
- * @param {Object} args
16680
- * @param {String} args.type
16681
- * @param {Boolean} args.stream
16682
- * @param {String} args.id
16683
- * @param {Function} onData
16684
- * @param {Function} onError
16685
- * @param {Function} onClose
16686
- */
16687
-
16688
-
16689
- function getStream(args) {
16690
- var parsedArgs = removeUndefined(args); // Validate arguments
16691
-
16692
- var valid = validate(parsedArgs, {
16693
- type: 'string',
16694
- id: 'string|number'
16695
- });
16696
-
16697
- if (valid !== true) {
16698
- throw valid;
16699
- }
16700
-
16701
- var type = parsedArgs.type,
16702
- id = parsedArgs.id;
16703
- delete parsedArgs.type;
16704
- delete parsedArgs.id;
16705
- delete parsedArgs.stream;
16706
-
16707
- if (parsedArgs.stream === true) {
16708
- parsedArgs.stream = 'true';
16709
- } else {
16710
- delete parsedArgs.stream;
16711
- parsedArgs.streamonly = 'true';
16712
- }
16713
-
16714
- for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
16715
- rest[_key - 1] = arguments[_key];
16716
- }
16717
-
16718
- return this.performWsRequest.apply(this, [{
16719
- method: 'GET',
16720
- path: type + '/' + encodeURIComponent(id),
16721
- params: parsedArgs
16722
- }].concat(rest));
16723
- }
16724
- /**
16725
- * Search Stream
16726
- * @param {Object} args
16727
- * @param {String} args.type
16728
- * @param {Object} args.body
16729
- * @param {Boolean} args.stream
16730
- * @param {Function} onData
16731
- * @param {Function} onError
16732
- * @param {Function} onClose
16733
- */
16734
-
16735
-
16736
- function searchStreamApi(args) {
16737
- var parsedArgs = removeUndefined(args); // Validate arguments
16738
-
16739
- var valid = validate(parsedArgs, {
16740
- body: 'object'
16741
- });
16742
-
16743
- if (valid !== true) {
16744
- throw valid;
16745
- }
16746
-
16747
- if (parsedArgs.type === undefined || Array.isArray(parsedArgs.type) && parsedArgs.type.length === 0) {
16748
- throw new Error('Missing fields: type');
16749
- }
16750
-
16751
- var type = void 0;
16752
-
16753
- if (Array.isArray(parsedArgs.type)) {
16754
- type = parsedArgs.type.join();
16755
- } else {
16756
- type = parsedArgs.type;
16757
- }
16758
-
16759
- var body = parsedArgs.body;
16760
- delete parsedArgs.type;
16761
- delete parsedArgs.body;
16762
- delete parsedArgs.stream;
16763
- parsedArgs.streamonly = 'true';
16764
-
16765
- for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
16766
- rest[_key - 1] = arguments[_key];
16767
- }
16768
-
16769
- return this.performWsRequest.apply(this, [{
16770
- method: 'POST',
16771
- path: type + '/_search',
16772
- params: parsedArgs,
16773
- body: body
16774
- }].concat(rest));
16775
- }
16776
- /**
16777
- * Webhook Service
16778
- * @param {Object} args
16779
- * @param {String} args.type
16780
- * @param {Object} args.body
16781
- * @param {Object} webhook
16782
- * @param {Function} onData
16783
- * @param {Function} onError
16784
- * @param {Function} onClose
15951
+ * ReactiveSearch API Service for v3
15952
+ * @param {Array<Object>} query
15953
+ * @param {Object} settings
15954
+ * @param {boolean} settings.recordAnalytics
15955
+ * @param {boolean} settings.userId
15956
+ * @param {boolean} settings.enableQueryRules
15957
+ * @param {boolean} settings.customEvents
16785
15958
  */
16786
15959
 
16787
15960
 
16788
- function searchStreamToURLApi(args, webhook) {
16789
- for (var _len = arguments.length, rest = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
16790
- rest[_key - 2] = arguments[_key];
16791
- }
16792
-
16793
- var _this = this;
16794
-
16795
- var parsedArgs = removeUndefined(args);
16796
- var bodyCopy = parsedArgs.body;
16797
- var type = void 0;
16798
- var typeString = void 0; // Validate arguments
16799
-
16800
- var valid = validate(parsedArgs, {
16801
- body: 'object'
16802
- });
16803
-
16804
- if (valid !== true) {
16805
- throw valid;
16806
- }
16807
-
16808
- if (parsedArgs.type === undefined || !(typeof parsedArgs.type === 'string' || Array.isArray(parsedArgs.type)) || parsedArgs.type === '' || parsedArgs.type.length === 0) {
16809
- throw new Error('fields missing: type');
16810
- }
15961
+ function reactiveSearchv3Api(query, settings) {
15962
+ var parsedSettings = removeUndefined(settings); // Validate query
16811
15963
 
16812
- valid = validate(parsedArgs.body, {
16813
- query: 'object'
16814
- });
15964
+ var valid = validateRSQuery(query);
16815
15965
 
16816
15966
  if (valid !== true) {
16817
15967
  throw valid;
16818
15968
  }
16819
15969
 
16820
- if (Array.isArray(parsedArgs.type)) {
16821
- type = parsedArgs.type;
16822
- typeString = parsedArgs.type.join();
16823
- } else {
16824
- type = [parsedArgs.type];
16825
- typeString = parsedArgs.type;
16826
- }
16827
-
16828
- var webhooks = [];
16829
- var _bodyCopy = bodyCopy,
16830
- query = _bodyCopy.query;
16831
-
16832
- if (typeof webhook === 'string') {
16833
- var webHookObj = {};
16834
- webHookObj.url = webhook;
16835
- webHookObj.method = 'GET';
16836
- webhooks.push(webHookObj);
16837
- } else if (webhook.constructor === Array) {
16838
- webhooks = webhook;
16839
- } else if (webhook === Object(webhook)) {
16840
- webhooks.push(webhook);
16841
- } else {
16842
- throw new Error('fields missing: second argument(webhook) is necessary');
16843
- }
16844
-
16845
- var populateBody = function populateBody() {
16846
- bodyCopy = {};
16847
- bodyCopy.webhooks = webhooks;
16848
- bodyCopy.query = query;
16849
- bodyCopy.type = type;
16850
- };
16851
-
16852
- populateBody();
16853
- var encode64 = btoa$1(jsonStableStringify(query));
16854
- var path = '.percolator/webhooks-0-' + typeString + '-0-' + encode64;
16855
-
16856
- this.change = function () {
16857
- webhooks = [];
16858
-
16859
- if (typeof parsedArgs === 'string') {
16860
- var webhook2 = {};
16861
- webhook2.url = parsedArgs;
16862
- webhook2.method = 'POST';
16863
- webhooks.push(webhook2);
16864
- } else if (parsedArgs.constructor === Array) {
16865
- webhooks = parsedArgs;
16866
- } else if (parsedArgs === Object(parsedArgs)) {
16867
- webhooks.push(parsedArgs);
16868
- } else {
16869
- throw new Error('fields missing: one of webhook or url fields is required');
16870
- }
16871
-
16872
- populateBody();
16873
- return _this.performRequest('POST');
16874
- };
16875
-
16876
- this.stop = function () {
16877
- bodyCopy = undefined;
16878
- return _this.performRequest('DELETE');
16879
- };
16880
-
16881
- this.performRequest = function (method) {
16882
- var res = _this.performWsRequest.apply(_this, [{
16883
- method: method,
16884
- path: path,
16885
- body: bodyCopy
16886
- }].concat(rest));
16887
-
16888
- res.change = _this.change;
16889
- res.stop = _this.stop;
16890
- return res;
15970
+ var body = {
15971
+ settings: parsedSettings,
15972
+ query: query
16891
15973
  };
16892
-
16893
- return this.performRequest('POST');
16894
- }
16895
- /**
16896
- * To get types
16897
- */
16898
-
16899
-
16900
- function getTypesService() {
16901
- var _this = this;
16902
-
16903
- return new Promise(function (resolve, reject) {
16904
- try {
16905
- return _this.performFetchRequest({
16906
- method: 'GET',
16907
- path: '_mapping'
16908
- }).then(function (data) {
16909
- var types = Object.keys(data[_this.app].mappings).filter(function (type) {
16910
- return type !== '_default_';
16911
- });
16912
- return resolve(types);
16913
- });
16914
- } catch (e) {
16915
- return reject(e);
16916
- }
15974
+ return this.performFetchRequest({
15975
+ method: 'POST',
15976
+ path: '_reactivesearch.v3',
15977
+ body: body,
15978
+ headers: getTelemetryHeaders(this.enableTelemetry),
15979
+ isRSAPI: true
16917
15980
  });
16918
15981
  }
16919
15982
  /**
@@ -16955,15 +16018,15 @@
16955
16018
  method: 'POST',
16956
16019
  path: '_reactivesearch.v3',
16957
16020
  body: body,
16021
+ headers: getTelemetryHeaders(this.enableTelemetry),
16958
16022
  isRSAPI: true,
16959
16023
  isSuggestionsAPI: true
16960
16024
  });
16961
16025
  }
16962
16026
 
16963
- function index$2(config) {
16027
+ function appbasejs(config) {
16964
16028
  var client = new AppBase(config);
16965
16029
  AppBase.prototype.performFetchRequest = fetchRequest;
16966
- AppBase.prototype.performWsRequest = wsRequest;
16967
16030
  AppBase.prototype.index = indexApi;
16968
16031
  AppBase.prototype.get = getApi;
16969
16032
  AppBase.prototype.update = updateApi;
@@ -16971,12 +16034,9 @@
16971
16034
  AppBase.prototype.bulk = bulkApi;
16972
16035
  AppBase.prototype.search = searchApi;
16973
16036
  AppBase.prototype.msearch = msearchApi;
16037
+ AppBase.prototype.reactiveSearch = reactiveSearchApi;
16974
16038
  AppBase.prototype.reactiveSearchv3 = reactiveSearchv3Api;
16975
16039
  AppBase.prototype.getQuerySuggestions = getSuggestionsv3Api;
16976
- AppBase.prototype.getStream = getStream;
16977
- AppBase.prototype.searchStream = searchStreamApi;
16978
- AppBase.prototype.searchStreamToURL = searchStreamToURLApi;
16979
- AppBase.prototype.getTypes = getTypesService;
16980
16040
  AppBase.prototype.getMappings = getMappings;
16981
16041
 
16982
16042
  AppBase.prototype.setHeaders = function setHeaders() {
@@ -17754,6 +16814,23 @@
17754
16814
  }
17755
16815
  }
17756
16816
  },
16817
+ computed: {
16818
+ getHeaders: function getHeaders() {
16819
+ var _this$$props = this.$props,
16820
+ enableAppbase = _this$$props.enableAppbase,
16821
+ headers = _this$$props.headers,
16822
+ appbaseConfig = _this$$props.appbaseConfig;
16823
+
16824
+ var _ref = appbaseConfig || {},
16825
+ enableTelemetry = _ref.enableTelemetry;
16826
+
16827
+ return _extends({}, enableAppbase && _extends({
16828
+ 'X-Search-Client': X_SEARCH_CLIENT
16829
+ }, enableTelemetry === false && {
16830
+ 'X-Enable-Telemetry': false
16831
+ }), headers);
16832
+ }
16833
+ },
17757
16834
  methods: {
17758
16835
  updateState: function updateState(props) {
17759
16836
  this.setStore(props);
@@ -17806,10 +16883,8 @@
17806
16883
  } catch (e) {// Do not add to selectedValues if JSON parsing fails.
17807
16884
  }
17808
16885
  });
17809
- var _props$headers = props.headers,
17810
- headers = _props$headers === void 0 ? {} : _props$headers,
17811
- themePreset = props.themePreset;
17812
- var appbaseRef = index$2(config);
16886
+ var themePreset = props.themePreset;
16887
+ var appbaseRef = appbasejs(config);
17813
16888
 
17814
16889
  if (this.$props.transformRequest) {
17815
16890
  appbaseRef.transformRequest = this.$props.transformRequest;
@@ -17829,7 +16904,7 @@
17829
16904
  appbaseRef: appbaseRef,
17830
16905
  selectedValues: selectedValues,
17831
16906
  urlValues: urlValues,
17832
- headers: headers
16907
+ headers: this.getHeaders
17833
16908
  }, this.$props.initialState);
17834
16909
 
17835
16910
  this.store = configureStore(initialState);
@@ -17838,10 +16913,9 @@
17838
16913
  render: function render() {
17839
16914
  var h = arguments[0];
17840
16915
  var children = this.$slots["default"];
17841
- var _this$$props = this.$props,
17842
- headers = _this$$props.headers,
17843
- style = _this$$props.style,
17844
- className = _this$$props.className;
16916
+ var _this$$props2 = this.$props,
16917
+ style = _this$$props2.style,
16918
+ className = _this$$props2.className;
17845
16919
  return h(Provider, {
17846
16920
  "attrs": {
17847
16921
  "store": this.store
@@ -17849,7 +16923,7 @@
17849
16923
  }, [h(URLParamsProvider$1, {
17850
16924
  "attrs": {
17851
16925
  "as": this.$props.as,
17852
- "headers": headers,
16926
+ "headers": this.getHeaders,
17853
16927
  "className": className,
17854
16928
  "getSearchParams": this.getSearchParams,
17855
16929
  "setSearchParams": this.setSearchParams
@@ -24426,9 +23500,15 @@
24426
23500
  this.setQueryOptions(componentId, _extends({}, customQueryOptions, this.getAggsQuery()), false);
24427
23501
  } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
24428
23502
 
23503
+ var queryToSet = query || null;
23504
+
23505
+ if (calcCustomQuery && calcCustomQuery.id) {
23506
+ queryToSet = calcCustomQuery;
23507
+ }
23508
+
24429
23509
  this.updateQuery({
24430
23510
  componentId: componentId,
24431
- query: query,
23511
+ queryToSet: queryToSet,
24432
23512
  value: this.selectedValue || null,
24433
23513
  label: filterLabel,
24434
23514
  showFilter: showFilter,
@@ -24442,6 +23522,12 @@
24442
23522
 
24443
23523
  if (options) {
24444
23524
  _this.setQueryOptions(props.componentId, _extends({}, options, _this.getAggsQuery()), false);
23525
+ }
23526
+
23527
+ var queryToBeSet = obj.query; // when enableAppbase is true, Backend throws error because of repeated query in request body
23528
+
23529
+ if (obj && obj.query && obj.query.query) {
23530
+ queryToBeSet = obj.query.query;
24445
23531
  } // Update customQuery field for RS API
24446
23532
 
24447
23533
 
@@ -24449,7 +23535,11 @@
24449
23535
  var customQueryCalc = _extends({}, options);
24450
23536
 
24451
23537
  if (obj && obj.query) {
24452
- customQueryCalc.query = obj.query;
23538
+ if (obj.query.id) {
23539
+ customQueryCalc = queryToBeSet;
23540
+ } else {
23541
+ customQueryCalc.query = obj.query;
23542
+ }
24453
23543
  }
24454
23544
 
24455
23545
  _this.setCustomQuery(props.componentId, customQueryCalc);
@@ -24480,9 +23570,15 @@
24480
23570
  this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
24481
23571
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
24482
23572
 
23573
+ var queryToSet = query || null;
23574
+
23575
+ if (!queryToSet && this.$defaultQuery && this.$defaultQuery.id) {
23576
+ queryToSet = this.$defaultQuery;
23577
+ }
23578
+
24483
23579
  this.updateQuery({
24484
23580
  componentId: this.internalComponent,
24485
- query: query || null
23581
+ query: queryToSet
24486
23582
  });
24487
23583
  }
24488
23584
  },
@@ -24541,9 +23637,15 @@
24541
23637
 
24542
23638
 
24543
23639
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, undefined);
23640
+ var queryToSet = query || null;
23641
+
23642
+ if (!queryToSet && this.$defaultQuery && this.$defaultQuery.id) {
23643
+ queryToSet = this.$defaultQuery;
23644
+ }
23645
+
24544
23646
  this.updateQuery({
24545
23647
  componentId: this.internalComponent,
24546
- query: query || null
23648
+ query: queryToSet
24547
23649
  });
24548
23650
  }
24549
23651
  },
@@ -24562,9 +23664,15 @@
24562
23664
 
24563
23665
 
24564
23666
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, undefined);
23667
+ var queryToSet = query || null;
23668
+
23669
+ if (this.$customQuery && this.$customQuery.id) {
23670
+ queryToSet = this.$customQuery;
23671
+ }
23672
+
24565
23673
  this.updateQuery({
24566
23674
  componentId: componentId,
24567
- query: query || null
23675
+ query: queryToSet
24568
23676
  });
24569
23677
  }
24570
23678
  }
@@ -25597,7 +24705,7 @@
25597
24705
  * Released under the MIT License.
25598
24706
  */
25599
24707
 
25600
- var index$3 = {
24708
+ var index$2 = {
25601
24709
  name: 'NoSsr',
25602
24710
  functional: true,
25603
24711
  props: {
@@ -25637,7 +24745,7 @@
25637
24745
  }) : h(false);
25638
24746
  }
25639
24747
  };
25640
- var vueNoSsr_common = index$3;
24748
+ var vueNoSsr_common = index$2;
25641
24749
 
25642
24750
  var _templateObject$m;
25643
24751
  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"])));
@@ -26449,7 +25557,7 @@
26449
25557
  watch: {
26450
25558
  searchState: function searchState(newVal, oldVal) {
26451
25559
  if (this.isStateChanged(newVal, oldVal)) {
26452
- this.$emit('change', newVal, oldVal);
25560
+ this.$emit('change', oldVal, newVal);
26453
25561
  }
26454
25562
  },
26455
25563
  selectedValues: function selectedValues(newVal, oldVal) {
@@ -26538,6 +25646,7 @@
26538
25646
  };
26539
25647
 
26540
25648
  var _excluded$5 = ["aggs", "size"];
25649
+ var X_SEARCH_CLIENT$1 = 'ReactiveSearch Vue';
26541
25650
  var componentsWithHighlightQuery = [constants_1$1.dataSearch, constants_1$1.categorySearch];
26542
25651
  var componentsWithOptions = [constants_1$1.reactiveList, constants_1$1.reactiveMap, constants_1$1.singleList, constants_1$1.multiList, constants_1$1.tagCloud].concat(componentsWithHighlightQuery);
26543
25652
  var componentsWithoutFilters = [constants_1$1.numberBox, constants_1$1.ratingsFilter];
@@ -26595,6 +25704,14 @@
26595
25704
  function initReactivesearch(componentCollection, searchState, settings) {
26596
25705
  return new Promise(function (resolve, reject) {
26597
25706
  var credentials = settings.url && settings.url.trim() !== '' && !settings.credentials ? null : settings.credentials;
25707
+ var enableTelemetry = settings.appbaseConfig && settings.appbaseConfig.enableTelemetry !== undefined ? settings.appbaseConfig.enableTelemetry : true;
25708
+
25709
+ var headers = _extends({}, settings.enableAppbase && _extends({
25710
+ 'X-Search-Client': X_SEARCH_CLIENT$1
25711
+ }, enableTelemetry === false && {
25712
+ 'X-Enable-Telemetry': false
25713
+ }), settings.headers);
25714
+
26598
25715
  var config = {
26599
25716
  url: settings.url && settings.url.trim() !== '' ? settings.url : 'https://scalr.api.appbase.io',
26600
25717
  app: settings.app,
@@ -26603,10 +25720,10 @@
26603
25720
  type: settings.type ? settings.type : '*',
26604
25721
  transformResponse: settings.transformResponse || null,
26605
25722
  graphQLUrl: settings.graphQLUrl || '',
26606
- headers: settings.headers || {},
25723
+ headers: headers,
26607
25724
  analyticsConfig: settings.appbaseConfig || null
26608
25725
  };
26609
- var appbaseRef = index$2(config);
25726
+ var appbaseRef = appbasejs(config);
26610
25727
  var components = [];
26611
25728
  var selectedValues = {};
26612
25729
  var internalValues = {};
@@ -26825,8 +25942,9 @@
26825
25942
  appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), transform_1(state, component.componentId, orderOfQueries));
26826
25943
  }
26827
25944
  } else {
25945
+ var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
26828
25946
  finalQuery = [].concat(finalQuery, [{
26829
- preference: component.componentId
25947
+ preference: preference
26830
25948
  }, currentQuery]);
26831
25949
  }
26832
25950
  }
@@ -26980,7 +26098,7 @@
26980
26098
  });
26981
26099
  }
26982
26100
 
26983
- var version = "1.22.3";
26101
+ var version = "1.23.3";
26984
26102
 
26985
26103
  var _templateObject$n, _templateObject2$a;
26986
26104
 
@@ -27308,7 +26426,7 @@
27308
26426
  if (typeof window !== 'undefined' && window.Vue) {
27309
26427
  install(window.Vue);
27310
26428
  }
27311
- var index$4 = {
26429
+ var index$3 = {
27312
26430
  version: version,
27313
26431
  install: install
27314
26432
  };
@@ -27331,7 +26449,7 @@
27331
26449
  exports.SingleRange = SingleRange;
27332
26450
  exports.StateProvider = StateProvider;
27333
26451
  exports.ToggleButton = ToggleButton;
27334
- exports.default = index$4;
26452
+ exports.default = index$3;
27335
26453
  exports.initReactivesearch = initReactivesearch;
27336
26454
  exports.install = install;
27337
26455
  exports.version = version;