@appbaseio/reactivesearch-vue 1.16.0-alpha.23 → 1.16.0-alpha.27

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 (55) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +560 -259
  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/DataSearch.js +2 -2
  6. package/dist/cjs/{DropDown-d3c78c41.js → DropDown-3c343026.js} +5 -3
  7. package/dist/cjs/DynamicRangeSlider.js +1 -1
  8. package/dist/cjs/MultiDropdownList.js +3 -2
  9. package/dist/cjs/MultiList.js +3 -2
  10. package/dist/cjs/MultiRange.js +1 -1
  11. package/dist/cjs/{Pagination-d4dbfd5a.js → Pagination-0b9ec0fc.js} +1 -1
  12. package/dist/cjs/RangeInput.js +1 -1
  13. package/dist/cjs/RangeSlider.js +1 -1
  14. package/dist/cjs/ReactiveBase.js +14 -8
  15. package/dist/cjs/ReactiveComponent.js +12 -12
  16. package/dist/cjs/ReactiveGoogleMap.js +2 -2
  17. package/dist/cjs/ReactiveList.js +102 -87
  18. package/dist/cjs/ResultCard.js +1 -1
  19. package/dist/cjs/ResultList.js +1 -1
  20. package/dist/cjs/SelectedFilters.js +1 -1
  21. package/dist/cjs/SingleDropdownList.js +3 -2
  22. package/dist/cjs/SingleList.js +3 -2
  23. package/dist/cjs/SingleRange.js +1 -1
  24. package/dist/cjs/ToggleButton.js +2 -2
  25. package/dist/cjs/index.js +5 -4
  26. package/dist/cjs/initReactivesearch.js +15 -14
  27. package/dist/cjs/install.js +5 -4
  28. package/dist/cjs/version.js +1 -1
  29. package/dist/cjs/{vueTypes-409348b0.js → vueTypes-829a5f2c.js} +5 -1
  30. package/dist/es/DataSearch.js +2 -2
  31. package/dist/es/{DropDown-8894cc22.js → DropDown-c5ab660f.js} +5 -3
  32. package/dist/es/DynamicRangeSlider.js +1 -1
  33. package/dist/es/MultiDropdownList.js +3 -2
  34. package/dist/es/MultiList.js +3 -2
  35. package/dist/es/MultiRange.js +1 -1
  36. package/dist/es/{Pagination-a2ab7fcb.js → Pagination-e8216949.js} +1 -1
  37. package/dist/es/RangeInput.js +1 -1
  38. package/dist/es/RangeSlider.js +1 -1
  39. package/dist/es/ReactiveBase.js +14 -8
  40. package/dist/es/ReactiveComponent.js +12 -12
  41. package/dist/es/ReactiveGoogleMap.js +2 -2
  42. package/dist/es/ReactiveList.js +102 -87
  43. package/dist/es/ResultCard.js +1 -1
  44. package/dist/es/ResultList.js +1 -1
  45. package/dist/es/SelectedFilters.js +1 -1
  46. package/dist/es/SingleDropdownList.js +3 -2
  47. package/dist/es/SingleList.js +3 -2
  48. package/dist/es/SingleRange.js +1 -1
  49. package/dist/es/ToggleButton.js +2 -2
  50. package/dist/es/index.js +5 -4
  51. package/dist/es/initReactivesearch.js +15 -14
  52. package/dist/es/install.js +5 -4
  53. package/dist/es/version.js +1 -1
  54. package/dist/es/{vueTypes-a9b9d5c9.js → vueTypes-98819a12.js} +5 -1
  55. package/package.json +3 -3
@@ -40,14 +40,9 @@
40
40
 
41
41
  if (Object.getOwnPropertySymbols) {
42
42
  var symbols = Object.getOwnPropertySymbols(object);
43
-
44
- if (enumerableOnly) {
45
- symbols = symbols.filter(function (sym) {
46
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
47
- });
48
- }
49
-
50
- keys.push.apply(keys, symbols);
43
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
44
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
45
+ })), keys.push.apply(keys, symbols);
51
46
  }
52
47
 
53
48
  return keys;
@@ -55,19 +50,12 @@
55
50
 
56
51
  function _objectSpread2(target) {
57
52
  for (var i = 1; i < arguments.length; i++) {
58
- var source = arguments[i] != null ? arguments[i] : {};
59
-
60
- if (i % 2) {
61
- ownKeys(Object(source), true).forEach(function (key) {
62
- _defineProperty(target, key, source[key]);
63
- });
64
- } else if (Object.getOwnPropertyDescriptors) {
65
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
66
- } else {
67
- ownKeys(Object(source)).forEach(function (key) {
68
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
69
- });
70
- }
53
+ var source = null != arguments[i] ? arguments[i] : {};
54
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
55
+ _defineProperty(target, key, source[key]);
56
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
57
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
58
+ });
71
59
  }
72
60
 
73
61
  return target;
@@ -755,23 +743,36 @@
755
743
  createStore: createStore
756
744
  });
757
745
 
746
+ /** A function that accepts a potential "extra argument" value to be injected later,
747
+ * and returns an instance of the thunk middleware that uses that value
748
+ */
758
749
  function createThunkMiddleware(extraArgument) {
759
- return function (_ref) {
750
+ // Standard Redux middleware definition pattern:
751
+ // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware
752
+ var middleware = function middleware(_ref) {
760
753
  var dispatch = _ref.dispatch,
761
754
  getState = _ref.getState;
762
755
  return function (next) {
763
756
  return function (action) {
757
+ // The thunk middleware looks for any functions that were passed to `store.dispatch`.
758
+ // If this "action" is really a function, call it and return the result.
764
759
  if (typeof action === 'function') {
760
+ // Inject the store's `dispatch` and `getState` methods, as well as any "extra arg"
765
761
  return action(dispatch, getState, extraArgument);
766
- }
762
+ } // Otherwise, pass the action down the middleware chain as usual
763
+
767
764
 
768
765
  return next(action);
769
766
  };
770
767
  };
771
768
  };
769
+
770
+ return middleware;
772
771
  }
773
772
 
774
- var thunk = createThunkMiddleware();
773
+ var thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version
774
+ // with whatever "extra arg" they want to inject into their thunks
775
+
775
776
  thunk.withExtraArgument = createThunkMiddleware;
776
777
 
777
778
  var constants = createCommonjsModule(function (module, exports) {
@@ -1197,6 +1198,7 @@
1197
1198
  reactiveList: 'REACTIVELIST',
1198
1199
  dataSearch: 'DATASEARCH',
1199
1200
  categorySearch: 'CATEGORYSEARCH',
1201
+ searchBox: 'SUGGESTION',
1200
1202
  singleList: 'SINGLELIST',
1201
1203
  multiList: 'MULTILIST',
1202
1204
  singleDataList: 'SINGLEDATALIST',
@@ -1225,9 +1227,10 @@
1225
1227
  search: 'search',
1226
1228
  term: 'term',
1227
1229
  range: 'range',
1228
- geo: 'geo'
1230
+ geo: 'geo',
1231
+ suggestion: 'suggestion'
1229
1232
  };
1230
- var validProps = exports.validProps = ['componentType', 'aggregationField', 'aggregationSize', 'distinctField', 'distinctFieldConfig', 'index', 'dataField', 'includeFields', 'excludeFields', 'size', 'from', 'sortBy', 'sortOptions', 'pagination', 'autoFocus', 'autosuggest', 'debounce', 'defaultValue', 'defaultSuggestions', 'fieldWeights', 'filterLabel', 'fuzziness', 'highlight', 'highlightField', 'nestedField', 'placeholder', 'queryFormat', 'searchOperators', 'enableSynonyms', 'enableQuerySuggestions', 'enablePopularSuggestions', 'queryString', 'categoryField', 'strictSelection', 'selectAllLabel', 'showCheckbox', 'showFilter', 'showSearch', 'showCount', 'showLoadMore', 'loadMoreLabel', 'showMissing', 'missingLabel', 'data', 'showRadio', 'multiSelect', 'includeNullValues', 'interval', 'showHistogram', 'snap', 'stepValue', 'range', 'showSlider', 'parseDate', 'unit'];
1233
+ var validProps = exports.validProps = ['componentType', 'aggregationField', 'aggregationSize', 'distinctField', 'distinctFieldConfig', 'index', 'dataField', 'includeFields', 'excludeFields', 'size', 'from', 'sortBy', 'sortOptions', 'pagination', 'autoFocus', 'autosuggest', 'debounce', 'defaultValue', 'defaultSuggestions', 'fieldWeights', 'filterLabel', 'fuzziness', 'highlight', 'highlightField', 'nestedField', 'placeholder', 'queryFormat', 'searchOperators', 'enableSynonyms', 'enableQuerySuggestions', 'enablePopularSuggestions', 'queryString', 'categoryField', 'strictSelection', 'selectAllLabel', 'showCheckbox', 'showFilter', 'showSearch', 'showCount', 'showLoadMore', 'loadMoreLabel', 'showMissing', 'missingLabel', 'data', 'showRadio', 'multiSelect', 'includeNullValues', 'interval', 'showHistogram', 'snap', 'stepValue', 'range', 'showSlider', 'parseDate', 'calendarInterval', 'unit', 'enablePopularSuggestions', 'popularSuggestionsConfig', 'enableRecentSuggestions', 'recentSuggestionsConfig', 'enablePredictiveSuggestions', 'applyStopwords', 'customStopwords'];
1231
1234
  var CLEAR_ALL = exports.CLEAR_ALL = {
1232
1235
  NEVER: 'never',
1233
1236
  ALWAYS: 'always',
@@ -2769,7 +2772,7 @@
2769
2772
 
2770
2773
  return _extends({
2771
2774
  _doc_count: doc_count,
2772
- _key: key[fieldName],
2775
+ _key: typeof key === 'string' ? key : key[fieldName],
2773
2776
  top_hits: hitsData
2774
2777
  }, flatData, _source);
2775
2778
  });
@@ -4561,6 +4564,8 @@
4561
4564
  return target;
4562
4565
  };
4563
4566
 
4567
+ exports.replaceDiacritics = replaceDiacritics;
4568
+
4564
4569
  var _diacritics2 = _interopRequireDefault(diacritics_1);
4565
4570
 
4566
4571
  function _interopRequireDefault(obj) {
@@ -4838,6 +4843,7 @@
4838
4843
  exports["default"] = getSuggestions;
4839
4844
  });
4840
4845
  unwrapExports(suggestions);
4846
+ var suggestions_1 = suggestions.replaceDiacritics;
4841
4847
 
4842
4848
  var helper = createCommonjsModule(function (module, exports) {
4843
4849
  Object.defineProperty(exports, "__esModule", {
@@ -4871,6 +4877,7 @@
4871
4877
  exports.extractFieldsFromSource = extractFieldsFromSource;
4872
4878
  exports.normalizeDataField = normalizeDataField;
4873
4879
  exports.handleOnSuggestions = handleOnSuggestions;
4880
+ exports.isValidDateRangeQueryFormat = isValidDateRangeQueryFormat;
4874
4881
 
4875
4882
  var _dateFormats2 = _interopRequireDefault(dateFormats_1);
4876
4883
 
@@ -5259,7 +5266,7 @@
5259
5266
  case 'epoch_millis':
5260
5267
  return date.getTime();
5261
5268
 
5262
- case 'epoch_seconds':
5269
+ case 'epoch_second':
5263
5270
  return Math.floor(date.getTime() / 1000);
5264
5271
 
5265
5272
  default:
@@ -5521,7 +5528,7 @@
5521
5528
  }, size > 0 ? {
5522
5529
  numberOfPages: Math.ceil(total / size)
5523
5530
  } : null, {
5524
- time: time,
5531
+ time: time || 0,
5525
5532
  hidden: hidden,
5526
5533
  promoted: promotedResults && promotedResults.length
5527
5534
  });
@@ -5652,6 +5659,10 @@
5652
5659
  });
5653
5660
  return withClickIds(finalSuggestions);
5654
5661
  };
5662
+
5663
+ function isValidDateRangeQueryFormat(queryFormat) {
5664
+ return Object.keys(_dateFormats2["default"]).includes(queryFormat);
5665
+ }
5655
5666
  });
5656
5667
  unwrapExports(helper);
5657
5668
  var helper_1 = helper.getTopSuggestions;
@@ -5682,6 +5693,7 @@
5682
5693
  var helper_26 = helper.extractFieldsFromSource;
5683
5694
  var helper_27 = helper.normalizeDataField;
5684
5695
  var helper_28 = helper.handleOnSuggestions;
5696
+ var helper_29 = helper.isValidDateRangeQueryFormat;
5685
5697
 
5686
5698
  var value = createCommonjsModule(function (module, exports) {
5687
5699
  Object.defineProperty(exports, "__esModule", {
@@ -6032,62 +6044,6 @@
6032
6044
  var misc_19 = misc.setAppliedSettings;
6033
6045
  var misc_20 = misc.setQueryListener;
6034
6046
 
6035
- var hits = createCommonjsModule(function (module, exports) {
6036
- Object.defineProperty(exports, "__esModule", {
6037
- value: true
6038
- });
6039
- exports.updateAggs = updateAggs;
6040
- exports.updateCompositeAggs = updateCompositeAggs;
6041
- exports.updateHits = updateHits;
6042
- exports.saveQueryToHits = saveQueryToHits;
6043
-
6044
- function updateAggs(component, aggregations) {
6045
- var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6046
- return {
6047
- type: constants.UPDATE_AGGS,
6048
- component: component,
6049
- aggregations: aggregations,
6050
- append: append
6051
- };
6052
- }
6053
-
6054
- function updateCompositeAggs(component, aggregations) {
6055
- var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6056
- return {
6057
- type: constants.UPDATE_COMPOSITE_AGGS,
6058
- component: component,
6059
- aggregations: aggregations,
6060
- append: append
6061
- };
6062
- }
6063
-
6064
- function updateHits(component, hits, time, hidden) {
6065
- var append = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6066
- return {
6067
- type: constants.UPDATE_HITS,
6068
- component: component,
6069
- hits: hits.hits,
6070
- total: typeof hits.total === 'object' ? hits.total.value : hits.total,
6071
- hidden: hidden,
6072
- time: time,
6073
- append: append
6074
- };
6075
- }
6076
-
6077
- function saveQueryToHits(component, query) {
6078
- return {
6079
- type: constants.SET_QUERY_TO_HITS,
6080
- component: component,
6081
- query: query
6082
- };
6083
- }
6084
- });
6085
- unwrapExports(hits);
6086
- var hits_1 = hits.updateAggs;
6087
- var hits_2 = hits.updateCompositeAggs;
6088
- var hits_3 = hits.updateHits;
6089
- var hits_4 = hits.saveQueryToHits;
6090
-
6091
6047
  var xdate = createCommonjsModule(function (module) {
6092
6048
  /**
6093
6049
  * @preserve XDate v@VERSION
@@ -6914,6 +6870,8 @@
6914
6870
 
6915
6871
  var _xdate2 = _interopRequireDefault(xdate);
6916
6872
 
6873
+ var _dateFormats2 = _interopRequireDefault(dateFormats_1);
6874
+
6917
6875
  function _interopRequireDefault(obj) {
6918
6876
  return obj && obj.__esModule ? obj : {
6919
6877
  "default": obj
@@ -6947,10 +6905,10 @@
6947
6905
  return obj;
6948
6906
  }
6949
6907
 
6950
- var componentToTypeMap = exports.componentToTypeMap = (_componentToTypeMap = {}, _defineProperty(_componentToTypeMap, constants$1.componentTypes.reactiveList, constants$1.queryTypes.search), _defineProperty(_componentToTypeMap, constants$1.componentTypes.dataSearch, constants$1.queryTypes.search), _defineProperty(_componentToTypeMap, constants$1.componentTypes.categorySearch, constants$1.queryTypes.search), _defineProperty(_componentToTypeMap, constants$1.componentTypes.singleList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.multiList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.singleDataList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.singleDropdownList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.multiDataList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.multiDropdownList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.tagCloud, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.toggleButton, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.numberBox, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.datePicker, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.dateRange, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.dynamicRangeSlider, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.singleDropdownRange, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.multiDropdownRange, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.singleRange, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.multiRange, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.rangeSlider, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.ratingsFilter, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.rangeInput, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.geoDistanceDropdown, constants$1.queryTypes.geo), _defineProperty(_componentToTypeMap, constants$1.componentTypes.geoDistanceSlider, constants$1.queryTypes.geo), _defineProperty(_componentToTypeMap, constants$1.componentTypes.reactiveMap, constants$1.queryTypes.geo), _componentToTypeMap);
6908
+ var componentToTypeMap = exports.componentToTypeMap = (_componentToTypeMap = {}, _defineProperty(_componentToTypeMap, constants$1.componentTypes.reactiveList, constants$1.queryTypes.search), _defineProperty(_componentToTypeMap, constants$1.componentTypes.dataSearch, constants$1.queryTypes.search), _defineProperty(_componentToTypeMap, constants$1.componentTypes.categorySearch, constants$1.queryTypes.search), _defineProperty(_componentToTypeMap, constants$1.componentTypes.searchBox, constants$1.queryTypes.suggestion), _defineProperty(_componentToTypeMap, constants$1.componentTypes.singleList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.multiList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.singleDataList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.singleDropdownList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.multiDataList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.multiDropdownList, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.tagCloud, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.toggleButton, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.numberBox, constants$1.queryTypes.term), _defineProperty(_componentToTypeMap, constants$1.componentTypes.datePicker, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.dateRange, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.dynamicRangeSlider, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.singleDropdownRange, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.multiDropdownRange, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.singleRange, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.multiRange, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.rangeSlider, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.ratingsFilter, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.rangeInput, constants$1.queryTypes.range), _defineProperty(_componentToTypeMap, constants$1.componentTypes.geoDistanceDropdown, constants$1.queryTypes.geo), _defineProperty(_componentToTypeMap, constants$1.componentTypes.geoDistanceSlider, constants$1.queryTypes.geo), _defineProperty(_componentToTypeMap, constants$1.componentTypes.reactiveMap, constants$1.queryTypes.geo), _componentToTypeMap);
6951
6909
  var multiRangeComponents = [constants$1.componentTypes.multiRange, constants$1.componentTypes.multiDropdownRange];
6952
6910
  var dateRangeComponents = [constants$1.componentTypes.dateRange, constants$1.componentTypes.datePicker];
6953
- var searchComponents = [constants$1.componentTypes.categorySearch, constants$1.componentTypes.dataSearch];
6911
+ var searchComponents = [constants$1.componentTypes.categorySearch, constants$1.componentTypes.dataSearch, constants$1.componentTypes.searchBox];
6954
6912
  var listComponentsWithPagination = [constants$1.componentTypes.singleList, constants$1.componentTypes.multiList, constants$1.componentTypes.singleDropdownList, constants$1.componentTypes.multiDropdownList];
6955
6913
 
6956
6914
  var getNormalizedField = exports.getNormalizedField = function getNormalizedField(field) {
@@ -7006,7 +6964,7 @@
7006
6964
  return null;
7007
6965
  }
7008
6966
 
7009
- return {
6967
+ return _extends({
7010
6968
  id: componentId,
7011
6969
  type: queryType,
7012
6970
  dataField: getNormalizedField(props.dataField),
@@ -7045,7 +7003,17 @@
7045
7003
  distinctField: props.distinctField,
7046
7004
  distinctFieldConfig: props.distinctFieldConfig,
7047
7005
  index: props.index
7048
- };
7006
+ }, queryType === constants$1.queryTypes.suggestion ? {
7007
+ enablePopularSuggestions: props.enablePopularSuggestions,
7008
+ enableRecentSuggestions: props.enableRecentSuggestions,
7009
+ popularSuggestionsConfig: props.popularSuggestionsConfig,
7010
+ recentSuggestionsConfig: props.recentSuggestionsConfig,
7011
+ applyStopwords: props.applyStopwords,
7012
+ customStopwords: props.customStopwords,
7013
+ enablePredictiveSuggestions: props.enablePredictiveSuggestions
7014
+ } : {}, {
7015
+ calendarInterval: props.calendarInterval
7016
+ });
7049
7017
  }
7050
7018
 
7051
7019
  return null;
@@ -7075,6 +7043,7 @@
7075
7043
  var calcValues = store.selectedValues[component] || store.internalValues[component];
7076
7044
  var value = calcValues !== undefined && calcValues !== null ? calcValues.value : undefined;
7077
7045
  var queryFormat = componentProps.queryFormat;
7046
+ var calendarInterval = void 0;
7078
7047
  var interval = componentProps.interval;
7079
7048
  var type = componentToTypeMap[componentProps.componentType];
7080
7049
  var dataField = componentProps.dataField;
@@ -7143,6 +7112,24 @@
7143
7112
  aggregations = ['histogram'];
7144
7113
  }
7145
7114
 
7115
+ if (componentProps.componentType === constants$1.componentTypes.dynamicRangeSlider || componentProps.componentType === constants$1.componentTypes.rangeSlider) {
7116
+ calendarInterval = Object.keys(_dateFormats2["default"]).includes(queryFormat) ? componentProps.calendarInterval || 'month' : undefined;
7117
+
7118
+ if (value) {
7119
+ if ((0, helper.isValidDateRangeQueryFormat)(componentProps.queryFormat)) {
7120
+ value = {
7121
+ start: (0, helper.formatDate)(new _xdate2["default"](value.start), componentProps),
7122
+ end: (0, helper.formatDate)(new _xdate2["default"](value.end), componentProps)
7123
+ };
7124
+ } else {
7125
+ value = {
7126
+ start: parseFloat(value.start),
7127
+ end: parseFloat(value.end)
7128
+ };
7129
+ }
7130
+ }
7131
+ }
7132
+
7146
7133
  if (dateRangeComponents.includes(componentProps.componentType)) {
7147
7134
  queryFormat = 'or';
7148
7135
 
@@ -7265,6 +7252,7 @@
7265
7252
  }
7266
7253
 
7267
7254
  return _extends({}, componentProps, {
7255
+ calendarInterval: calendarInterval,
7268
7256
  dataField: dataField,
7269
7257
  queryFormat: queryFormat,
7270
7258
  type: type,
@@ -7275,7 +7263,7 @@
7275
7263
  defaultQuery: store.defaultQueries ? store.defaultQueries[component] : undefined,
7276
7264
  customHighlight: store.customHighlightOptions ? store.customHighlightOptions[component] : undefined,
7277
7265
  categoryValue: store.internalValues[component] ? store.internalValues[component].category : undefined,
7278
- value: value,
7266
+ value: componentProps.componentType === constants$1.componentTypes.searchBox ? value || undefined : value,
7279
7267
  pagination: pagination,
7280
7268
  from: from
7281
7269
  }, customOptions);
@@ -7311,7 +7299,8 @@
7311
7299
  var orderOfQueries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
7312
7300
  var finalQuery = {};
7313
7301
  var react = flatReactProp(store.dependencyTree[componentID], componentID);
7314
- react.forEach(function (component) {
7302
+ react.forEach(function (componentObject) {
7303
+ var component = componentObject;
7315
7304
  var customQuery = store.customQueries[component];
7316
7305
 
7317
7306
  if (!isInternalComponent(component)) {
@@ -7324,7 +7313,11 @@
7324
7313
  execute = true;
7325
7314
  }
7326
7315
 
7327
- var dependentQuery = getRSQuery(component, extractPropsFromState(store, component), execute);
7316
+ var dependentQuery = getRSQuery(component, extractPropsFromState(store, component, _extends({}, store.props[component].componentType === constants$1.componentTypes.searchBox ? _extends({}, execute === false ? {
7317
+ type: constants$1.queryTypes.search
7318
+ } : {}, calcValues.category ? {
7319
+ categoryValue: calcValues.category
7320
+ } : {}) : {})), execute);
7328
7321
 
7329
7322
  if (dependentQuery) {
7330
7323
  finalQuery[component] = dependentQuery;
@@ -7351,6 +7344,79 @@
7351
7344
  var transform_13 = transform.componentToTypeMap;
7352
7345
  var transform_14 = transform.flatReactProp;
7353
7346
 
7347
+ var hits = createCommonjsModule(function (module, exports) {
7348
+ Object.defineProperty(exports, "__esModule", {
7349
+ value: true
7350
+ });
7351
+ exports.updateAggs = updateAggs;
7352
+ exports.updateCompositeAggs = updateCompositeAggs;
7353
+ exports.updateHits = updateHits;
7354
+ exports.saveQueryToHits = saveQueryToHits;
7355
+ exports.mockDataForTesting = mockDataForTesting;
7356
+
7357
+ function updateAggs(component, aggregations) {
7358
+ var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7359
+ return {
7360
+ type: constants.UPDATE_AGGS,
7361
+ component: component,
7362
+ aggregations: aggregations,
7363
+ append: append
7364
+ };
7365
+ }
7366
+
7367
+ function updateCompositeAggs(component, aggregations) {
7368
+ var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7369
+ return {
7370
+ type: constants.UPDATE_COMPOSITE_AGGS,
7371
+ component: component,
7372
+ aggregations: aggregations,
7373
+ append: append
7374
+ };
7375
+ }
7376
+
7377
+ function updateHits(component, hits, time, hidden) {
7378
+ var append = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
7379
+ return {
7380
+ type: constants.UPDATE_HITS,
7381
+ component: component,
7382
+ hits: hits.hits,
7383
+ total: typeof hits.total === 'object' ? hits.total.value : hits.total,
7384
+ hidden: hidden,
7385
+ time: time,
7386
+ append: append
7387
+ };
7388
+ }
7389
+
7390
+ function saveQueryToHits(component, query) {
7391
+ return {
7392
+ type: constants.SET_QUERY_TO_HITS,
7393
+ component: component,
7394
+ query: query
7395
+ };
7396
+ }
7397
+
7398
+ function mockDataForTesting(component, data) {
7399
+ return function (dispatch, getState) {
7400
+ var _getState = getState(),
7401
+ props = _getState.props;
7402
+
7403
+ var componentProps = props[component];
7404
+
7405
+ if (transform.componentToTypeMap[componentProps.componentType] === 'term') {
7406
+ dispatch(updateAggs(component, data));
7407
+ } else {
7408
+ dispatch(updateHits(component, data));
7409
+ }
7410
+ };
7411
+ }
7412
+ });
7413
+ unwrapExports(hits);
7414
+ var hits_1 = hits.updateAggs;
7415
+ var hits_2 = hits.updateCompositeAggs;
7416
+ var hits_3 = hits.updateHits;
7417
+ var hits_4 = hits.saveQueryToHits;
7418
+ var hits_5 = hits.mockDataForTesting;
7419
+
7354
7420
  var utils = createCommonjsModule(function (module, exports) {
7355
7421
  Object.defineProperty(exports, "__esModule", {
7356
7422
  value: true
@@ -8402,6 +8468,11 @@
8402
8468
  var value = internalValue && internalValue.value || '';
8403
8469
 
8404
8470
  if (isAppbaseEnabled && (componentProps.enablePopularSuggestions || componentProps.enableQuerySuggestions)) {
8471
+ if (config.mongodb) {
8472
+ dispatch((0, misc.setDefaultPopularSuggestions)([], componentId.split('__internal')[0]));
8473
+ return;
8474
+ }
8475
+
8405
8476
  var suggQuery = (0, utils.getSuggestionQuery)(getState, componentId);
8406
8477
  appbaseRef.getQuerySuggestions(suggQuery).then(function (suggestions) {
8407
8478
  var querySuggestion = suggestions[(0, utils.getQuerySuggestionsId)(componentId)];
@@ -8725,8 +8796,9 @@
8725
8796
  }
8726
8797
  }
8727
8798
  } else {
8799
+ var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + '_' + component : component;
8728
8800
  finalQuery = [].concat(_toConsumableArray(finalQuery), [{
8729
- preference: component
8801
+ preference: preference
8730
8802
  }, currentQuery]);
8731
8803
  }
8732
8804
  }
@@ -8931,8 +9003,9 @@
8931
9003
  appendToAggs: appendToAggs
8932
9004
  }));
8933
9005
  } else {
9006
+ var preference = store.config && store.config.analyticsConfig && store.config.analyticsConfig.userId ? store.config.analyticsConfig.userId + '_' + component : component;
8934
9007
  var _finalQuery = [{
8935
- preference: component
9008
+ preference: preference
8936
9009
  }, currentQuery];
8937
9010
  dispatch(msearch(_finalQuery, [component], appendToHits, false, appendToAggs));
8938
9011
  }
@@ -9130,7 +9203,8 @@
9130
9203
  protocol = _getState$appbaseRef.protocol,
9131
9204
  credentials = _getState$appbaseRef.credentials;
9132
9205
 
9133
- var app = config.app;
9206
+ var app = config.app,
9207
+ mongodb = config.mongodb;
9134
9208
  var esURL = protocol + '://' + url;
9135
9209
  var parsedURL = (esURL || '').replace(/\/+$/, '');
9136
9210
  var requestOptions = {
@@ -9177,7 +9251,14 @@
9177
9251
  }
9178
9252
  }
9179
9253
 
9180
- fetch(parsedURL + '/_analytics/' + app + '/recent-searches?' + queryString, requestOptions).then(function (res) {
9254
+ if (mongodb) {
9255
+ return dispatch({
9256
+ type: constants.RECENT_SEARCHES_SUCCESS,
9257
+ data: []
9258
+ });
9259
+ }
9260
+
9261
+ return fetch(parsedURL + '/_analytics/' + app + '/recent-searches?' + queryString, requestOptions).then(function (res) {
9181
9262
  if (res.status >= 500 || res.status >= 400) {
9182
9263
  return dispatch({
9183
9264
  type: constants.RECENT_SEARCHES_ERROR,
@@ -12809,7 +12890,11 @@
12809
12890
  userId: VueTypes.string,
12810
12891
  customEvents: VueTypes.object,
12811
12892
  enableTelemetry: VueTypes.bool.def(true)
12812
- }).def({})
12893
+ }).def({}),
12894
+ mongodb: VueTypes.shape({
12895
+ db: VueTypes.string,
12896
+ collection: VueTypes.string
12897
+ })
12813
12898
  };
12814
12899
 
12815
12900
  var getClassName = lib_8.getClassName,
@@ -13913,18 +13998,17 @@
13913
13998
  ResultCardsWrapper: ResultCardsWrapper
13914
13999
  },
13915
14000
  data: function data() {
13916
- var props = this.$props;
13917
14001
  var currentPageState = 0;
14002
+ var defaultPage = this.defaultPage || -1;
13918
14003
 
13919
- if (props.defaultPage >= 0) {
13920
- currentPageState = props.defaultPage;
13921
- } else if (props.currentPage) {
13922
- currentPageState = Math.max(props.currentPage - 1, 0);
14004
+ if (defaultPage >= 0) {
14005
+ currentPageState = defaultPage;
14006
+ } else if (this.currentPage) {
14007
+ currentPageState = Math.max(this.currentPage - 1, 0);
13923
14008
  }
13924
14009
 
13925
14010
  this.__state = {
13926
- from: currentPageState * props.size,
13927
- isLoading: true,
14011
+ from: currentPageState * this.size,
13928
14012
  currentPageState: currentPageState
13929
14013
  };
13930
14014
  return this.__state;
@@ -13953,15 +14037,22 @@
13953
14037
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
13954
14038
  }
13955
14039
 
13956
- if (this.defaultPage >= 0) {
13957
- this.currentPageState = this.defaultPage;
14040
+ var defaultPage = this.defaultPage || -1;
14041
+
14042
+ if (defaultPage >= 0) {
14043
+ this.currentPageState = defaultPage;
13958
14044
  this.from = this.currentPageState * this.$props.size;
13959
14045
  }
13960
14046
 
13961
14047
  this.internalComponent = this.$props.componentId + "__internal";
13962
- this.sortOptionIndex = this.defaultSortOption ? this.sortOptions.findIndex(function (s) {
13963
- return s.label === _this.defaultSortOption;
13964
- }) : 0;
14048
+ this.sortOptionIndex = 0;
14049
+
14050
+ if (this.defaultSortOption && this.sortOptions && Array.isArray(this.sortOptions)) {
14051
+ this.sortOptionIndex = this.sortOptions.findIndex(function (s) {
14052
+ return s.label === _this.defaultSortOption;
14053
+ });
14054
+ }
14055
+
13965
14056
  this.updateComponentProps(this.componentId, {
13966
14057
  from: this.from
13967
14058
  }, constants_1$1.reactiveList);
@@ -14021,12 +14112,9 @@
14021
14112
  return this.$listeners && this.$listeners.resultStats;
14022
14113
  },
14023
14114
  stats: function stats() {
14024
- var _this$getAllData = this.getAllData(),
14025
- filteredResults = _this$getAllData.filteredResults;
14026
-
14027
14115
  return _extends({}, getResultStats(this), {
14028
14116
  currentPage: this.currentPageState,
14029
- displayedResults: filteredResults.length
14117
+ displayedResults: this.data.length
14030
14118
  });
14031
14119
  },
14032
14120
  hasCustomRender: function hasCustomRender() {
@@ -14035,6 +14123,27 @@
14035
14123
  showInfiniteScroll: function showInfiniteScroll() {
14036
14124
  // Pagination has higher priority then infinite scroll
14037
14125
  return this.infiniteScroll && !this.shouldRenderPagination;
14126
+ },
14127
+ data: function data() {
14128
+ var results = parseHits(this.hits) || [];
14129
+ var parsedPromotedResults = parseHits(this.promotedResults) || [];
14130
+ var filteredResults = results;
14131
+
14132
+ if (parsedPromotedResults.length) {
14133
+ var ids = parsedPromotedResults.map(function (item) {
14134
+ return item._id;
14135
+ }).filter(Boolean);
14136
+
14137
+ if (ids) {
14138
+ filteredResults = filteredResults.filter(function (item) {
14139
+ return !ids.includes(item._id);
14140
+ });
14141
+ }
14142
+
14143
+ filteredResults = [].concat(parsedPromotedResults, filteredResults);
14144
+ }
14145
+
14146
+ return helper_2(filteredResults);
14038
14147
  }
14039
14148
  },
14040
14149
  watch: {
@@ -14116,7 +14225,7 @@
14116
14225
  }
14117
14226
  },
14118
14227
  hits: function hits(newVal, oldVal) {
14119
- this.$emit('data', this.getAllData());
14228
+ this.$emit('data', this.getData());
14120
14229
 
14121
14230
  if (this.shouldRenderPagination) {
14122
14231
  // called when page is changed
@@ -14175,11 +14284,11 @@
14175
14284
  var options = getQueryOptions(this.$props);
14176
14285
  options.from = this.$data.from;
14177
14286
 
14178
- if (this.$props.sortOptions) {
14287
+ if (this.sortOptions && this.sortOptions[this.sortOptionIndex]) {
14179
14288
  var _ref2;
14180
14289
 
14181
- var sortField = this.$props.sortOptions[this.sortOptionIndex].dataField;
14182
- var sortBy = this.$props.sortOptions[this.sortOptionIndex].sortBy;
14290
+ var sortField = this.sortOptions[this.sortOptionIndex].dataField;
14291
+ var sortBy = this.sortOptions[this.sortOptionIndex].sortBy;
14183
14292
  options.sort = [(_ref2 = {}, _ref2[sortField] = {
14184
14293
  order: sortBy
14185
14294
  }, _ref2)]; // To handle sort options for RS API
@@ -14249,10 +14358,10 @@
14249
14358
  "class": this.$props.className
14250
14359
  }, [this.isLoading && this.shouldRenderPagination && this.showInfiniteScroll && (this.$scopedSlots.loader || this.$props.loader), this.renderErrorComponent(), h(Flex, {
14251
14360
  "attrs": {
14252
- "labelPosition": this.$props.sortOptions ? 'right' : 'left'
14361
+ "labelPosition": this.sortOptions ? 'right' : 'left'
14253
14362
  },
14254
14363
  "class": getClassName$1(this.$props.innerClass, 'resultsInfo')
14255
- }, [this.$props.sortOptions ? this.renderSortOptions() : null, this.$props.showResultStats && results.length ? this.renderStats() : null]), !this.isLoading && results.length === 0 ? this.renderNoResult() : null, this.shouldRenderPagination && (this.$props.paginationAt === 'top' || this.$props.paginationAt === 'both') ? h(Pagination, {
14364
+ }, [this.sortOptions ? this.renderSortOptions() : null, this.$props.showResultStats && results.length ? this.renderStats() : null]), !this.isLoading && results.length === 0 ? this.renderNoResult() : null, this.shouldRenderPagination && (this.$props.paginationAt === 'top' || this.$props.paginationAt === 'both') ? h(Pagination, {
14256
14365
  "attrs": {
14257
14366
  "pages": this.$props.pages,
14258
14367
  "totalPages": this.totalPages,
@@ -14301,13 +14410,10 @@
14301
14410
 
14302
14411
  var h = this.$createElement;
14303
14412
  var size = this.$props.size;
14304
- var hits = this.$data.hits;
14305
- var results = parseHits(hits) || [];
14306
- var filteredResults = results;
14307
14413
  var renderItem = this.$scopedSlots.renderItem || this.$props.renderItem;
14308
14414
  var element = this.hasCustomRender ? this.getComponent() : h("div", {
14309
14415
  "class": this.$props.listClass + " " + getClassName$1(this.$props.innerClass, 'list')
14310
- }, [[].concat(filteredResults).map(function (item, index) {
14416
+ }, [this.data.map(function (item, index) {
14311
14417
  return renderItem({
14312
14418
  item: item,
14313
14419
  triggerClickAnalytics: function triggerClickAnalytics() {
@@ -14318,7 +14424,7 @@
14318
14424
 
14319
14425
  return this.analytics ? h(ImpressionTracker$1, {
14320
14426
  "attrs": {
14321
- "hits": filteredResults
14427
+ "hits": this.data
14322
14428
  }
14323
14429
  }, [element]) : element;
14324
14430
  },
@@ -14326,15 +14432,18 @@
14326
14432
  var options = getQueryOptions(props);
14327
14433
  options.from = this.$data.from;
14328
14434
 
14329
- if (props.sortOptions) {
14330
- var _ref5;
14331
-
14435
+ if (props.sortOptions && Array.isArray(props.sortOptions)) {
14332
14436
  var sortOptionIndex = props.defaultSortOption ? props.sortOptions.findIndex(function (s) {
14333
14437
  return s.label === props.defaultSortOption;
14334
14438
  }) : 0;
14335
- options.sort = [(_ref5 = {}, _ref5[props.sortOptions[sortOptionIndex].dataField] = {
14336
- order: props.sortOptions[sortOptionIndex].sortBy
14337
- }, _ref5)];
14439
+
14440
+ if (props.sortOptions[sortOptionIndex]) {
14441
+ var _ref5;
14442
+
14443
+ options.sort = [(_ref5 = {}, _ref5[props.sortOptions[sortOptionIndex].dataField] = {
14444
+ order: props.sortOptions[sortOptionIndex].sortBy
14445
+ }, _ref5)];
14446
+ }
14338
14447
  } else if (props.sortBy) {
14339
14448
  var _ref6;
14340
14449
 
@@ -14422,7 +14531,7 @@
14422
14531
  if (this.stats.numberOfResults) {
14423
14532
  return h("p", {
14424
14533
  "class": resultStats + " " + getClassName$1(this.$props.innerClass, 'resultStats')
14425
- }, [this.stats.numberOfResults, " results found in ", this.stats.time, "ms"]);
14534
+ }, [this.stats.numberOfResults, " results found in ", this.stats.time || 0, "ms"]);
14426
14535
  }
14427
14536
 
14428
14537
  return null;
@@ -14430,31 +14539,39 @@
14430
14539
  renderNoResult: function renderNoResult() {
14431
14540
  var h = this.$createElement;
14432
14541
  var renderNoResults = this.$scopedSlots.renderNoResults || this.$props.renderNoResults;
14542
+
14543
+ if (this.$scopedSlots.renderNoResults) {
14544
+ return isFunction$1(renderNoResults) ? renderNoResults() : renderNoResults;
14545
+ }
14546
+
14433
14547
  return h("p", {
14434
14548
  "class": getClassName$1(this.$props.innerClass, 'noResults') || null
14435
14549
  }, [isFunction$1(renderNoResults) ? renderNoResults() : renderNoResults]);
14436
14550
  },
14437
14551
  handleSortChange: function handleSortChange(e) {
14438
- var _ref7;
14552
+ var index = e.target.value;
14439
14553
 
14440
- var index = e.target.value; // This fixes issue #371 (where sorting a multi-result page with infinite loader breaks)
14554
+ if (this.sortOptions && this.sortOptions[index]) {
14555
+ var _ref7;
14441
14556
 
14442
- var options = getQueryOptions(this.$props);
14443
- options.from = 0;
14444
- var sortField = this.$props.sortOptions[index].dataField;
14445
- var sortBy = this.$props.sortOptions[index].sortBy;
14446
- options.sort = [(_ref7 = {}, _ref7[sortField] = {
14447
- order: sortBy
14448
- }, _ref7)];
14449
- this.sortOptionIndex = index; // To handle sort options for RS API
14450
-
14451
- this.updateComponentProps(this.componentId, {
14452
- dataField: sortField,
14453
- sortBy: sortBy
14454
- }, constants_1$1.reactiveList);
14455
- this.setQueryOptions(this.$props.componentId, options, true);
14456
- this.currentPageState = 0;
14457
- this.from = 0;
14557
+ // This fixes issue #371 (where sorting a multi-result page with infinite loader breaks)
14558
+ var options = getQueryOptions(this.$props);
14559
+ options.from = 0;
14560
+ var sortField = this.sortOptions[index].dataField;
14561
+ var sortBy = this.sortOptions[index].sortBy;
14562
+ options.sort = [(_ref7 = {}, _ref7[sortField] = {
14563
+ order: sortBy
14564
+ }, _ref7)];
14565
+ this.sortOptionIndex = index; // To handle sort options for RS API
14566
+
14567
+ this.updateComponentProps(this.componentId, {
14568
+ dataField: sortField,
14569
+ sortBy: sortBy
14570
+ }, constants_1$1.reactiveList);
14571
+ this.setQueryOptions(this.$props.componentId, options, true);
14572
+ this.currentPageState = 0;
14573
+ this.from = 0;
14574
+ }
14458
14575
  },
14459
14576
  triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
14460
14577
  var docId = documentId;
@@ -14488,7 +14605,7 @@
14488
14605
  "domProps": {
14489
14606
  "value": this.sortOptionIndex
14490
14607
  }
14491
- }, [this.$props.sortOptions.map(function (sort, index) {
14608
+ }, [this.sortOptions.map(function (sort, index) {
14492
14609
  return h("option", {
14493
14610
  "key": sort.label,
14494
14611
  "domProps": {
@@ -14498,8 +14615,8 @@
14498
14615
  })]);
14499
14616
  },
14500
14617
  withClickIds: function withClickIds(results) {
14501
- var _this$getAllData2 = this.getAllData(),
14502
- base = _this$getAllData2.base;
14618
+ var _this$getAllData = this.getAllData(),
14619
+ base = _this$getAllData.base;
14503
14620
 
14504
14621
  return results.map(function (result, index) {
14505
14622
  return _extends({}, result, {
@@ -14517,26 +14634,9 @@
14517
14634
  hits = this.hits;
14518
14635
  var results = parseHits(hits) || [];
14519
14636
  var parsedPromotedResults = parseHits(promotedResults) || [];
14520
- var filteredResults = results;
14521
14637
  var base = currentPage * size;
14522
-
14523
- if (parsedPromotedResults.length) {
14524
- var ids = parsedPromotedResults.map(function (item) {
14525
- return item._id;
14526
- }).filter(Boolean);
14527
-
14528
- if (ids) {
14529
- filteredResults = filteredResults.filter(function (item) {
14530
- return !ids.includes(item._id);
14531
- });
14532
- }
14533
-
14534
- filteredResults = [].concat(parsedPromotedResults, filteredResults);
14535
- }
14536
-
14537
14638
  return {
14538
14639
  results: results,
14539
- filteredResults: filteredResults,
14540
14640
  customData: customData || {},
14541
14641
  promotedResults: parsedPromotedResults,
14542
14642
  aggregationData: aggregationData,
@@ -14546,16 +14646,15 @@
14546
14646
  };
14547
14647
  },
14548
14648
  getData: function getData() {
14549
- var _this$getAllData3 = this.getAllData(),
14550
- filteredResults = _this$getAllData3.filteredResults,
14551
- promotedResults = _this$getAllData3.promotedResults,
14552
- aggregationData = _this$getAllData3.aggregationData,
14553
- customData = _this$getAllData3.customData;
14649
+ var _this$getAllData2 = this.getAllData(),
14650
+ promotedResults = _this$getAllData2.promotedResults,
14651
+ aggregationData = _this$getAllData2.aggregationData,
14652
+ customData = _this$getAllData2.customData;
14554
14653
 
14555
14654
  return {
14556
- data: this.withClickIds(filteredResults),
14655
+ data: this.data,
14557
14656
  aggregationData: this.withClickIds(aggregationData || []),
14558
- promotedData: this.withClickIds(promotedResults),
14657
+ promotedData: this.withClickIds(promotedResults || []),
14559
14658
  rawData: this.rawData,
14560
14659
  resultStats: this.stats,
14561
14660
  customData: customData
@@ -14567,7 +14666,7 @@
14567
14666
 
14568
14667
  var data = _extends({
14569
14668
  error: error,
14570
- loading: isLoading,
14669
+ loading: isLoading || false,
14571
14670
  loadMore: this.loadMore,
14572
14671
  // TODO: Remove in v2
14573
14672
  triggerAnalytics: this.triggerClickAnalytics,
@@ -14582,13 +14681,13 @@
14582
14681
 
14583
14682
  var mapStateToProps$1 = function mapStateToProps(state, props) {
14584
14683
  return {
14585
- defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
14684
+ defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1,
14586
14685
  hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
14587
14686
  rawData: state.rawData[props.componentId],
14588
- aggregationData: state.compositeAggregations[props.componentId] || [],
14589
- promotedResults: state.promotedResults[props.componentId] || [],
14687
+ aggregationData: state.compositeAggregations[props.componentId],
14688
+ promotedResults: state.promotedResults[props.componentId],
14590
14689
  customData: state.customData[props.componentId],
14591
- time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
14690
+ time: state.hits[props.componentId] && state.hits[props.componentId].time,
14592
14691
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
14593
14692
  hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
14594
14693
  analytics: state.config && state.config.analytics,
@@ -14597,7 +14696,7 @@
14597
14696
  error: state.error[props.componentId],
14598
14697
  afterKey: state.aggregations[props.componentId] && state.aggregations[props.componentId][props.aggregationField] && state.aggregations[props.componentId][props.aggregationField].after_key,
14599
14698
  componentProps: state.props[props.componentId],
14600
- isLoading: state.isLoading[props.componentId] || false
14699
+ isLoading: state.isLoading[props.componentId]
14601
14700
  };
14602
14701
  };
14603
14702
 
@@ -15436,8 +15535,33 @@
15436
15535
  return encodedHeaders;
15437
15536
  }
15438
15537
 
15439
- function getTelemetryHeaders(enableTelemetry) {
15538
+ function getMongoRequest(app, mongo) {
15539
+ var mongodb = {};
15540
+
15541
+ if (app) {
15542
+ mongodb.index = app;
15543
+ }
15544
+
15545
+ if (mongo) {
15546
+ if (mongo.db) {
15547
+ mongodb.db = mongo.db;
15548
+ }
15549
+
15550
+ if (mongo.collection) {
15551
+ mongodb.collection = mongo.collection;
15552
+ }
15553
+ }
15554
+
15555
+ return mongodb;
15556
+ }
15557
+
15558
+ function getTelemetryHeaders(enableTelemetry, shouldSetHeaders) {
15440
15559
  var headers = {};
15560
+
15561
+ if (!shouldSetHeaders) {
15562
+ return headers;
15563
+ }
15564
+
15441
15565
  Object.assign(headers, {
15442
15566
  'X-Search-Client': 'Appbase JS'
15443
15567
  });
@@ -15450,6 +15574,133 @@
15450
15574
 
15451
15575
  return headers;
15452
15576
  }
15577
+
15578
+ var backendAlias = {
15579
+ MONGODB: 'mongodb',
15580
+ // mongodb
15581
+ ELASTICSEARCH: 'elasticsearch' // elasticsearch
15582
+
15583
+ };
15584
+ var dataTypes = {
15585
+ ARRAY: 'array',
15586
+ FUNCTION: 'function',
15587
+ OBJECT: 'object',
15588
+ NUMBER: 'number',
15589
+ BOOLEAN: 'boolean',
15590
+ STRING: 'string'
15591
+ };
15592
+
15593
+ var checkDataType = function checkDataType(temp) {
15594
+ // eslint-disable-next-line
15595
+ if ((typeof temp === 'undefined' ? 'undefined' : _typeof$1(temp)) === dataTypes.OBJECT) {
15596
+ if (Array.isArray(temp)) {
15597
+ return dataTypes.ARRAY;
15598
+ }
15599
+
15600
+ return dataTypes.OBJECT;
15601
+ }
15602
+
15603
+ return typeof temp === 'undefined' ? 'undefined' : _typeof$1(temp);
15604
+ };
15605
+
15606
+ function validateSchema() {
15607
+ var passedProperties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15608
+ var schema = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
15609
+ var backendName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
15610
+ var passedPropertiesKeys = Object.keys(passedProperties).filter(function (propertyKey) {
15611
+ return !!passedProperties[propertyKey];
15612
+ });
15613
+ var acceptedProperties = Object.keys(schema);
15614
+ var requiredProperties = []; // fetch required properties
15615
+
15616
+ acceptedProperties.forEach(function (propName) {
15617
+ var currentProperty = schema[propName];
15618
+
15619
+ if (currentProperty.required) {
15620
+ requiredProperties.push(propName);
15621
+ }
15622
+ }); // check for required properties
15623
+
15624
+ requiredProperties.forEach(function (requiredProperty) {
15625
+ if (!passedPropertiesKeys.includes(requiredProperty)) {
15626
+ throw new Error(requiredProperty + ' is required when using the ' + backendName + ' Search backend.');
15627
+ }
15628
+ }); // check for accepted properties
15629
+
15630
+ passedPropertiesKeys.forEach(function (passedPropertyKey) {
15631
+ if (!acceptedProperties.includes(passedPropertyKey)) {
15632
+ throw new Error(passedPropertyKey + ' property isn\'t accepted property by ' + backendName + ' backend.');
15633
+ }
15634
+
15635
+ var acceptedTypes = Array.isArray(schema[passedPropertyKey].type) ? schema[passedPropertyKey].type : [].concat(schema[passedPropertyKey].type);
15636
+ var receivedPropertyType = checkDataType(passedProperties[passedPropertyKey]);
15637
+
15638
+ if (!acceptedTypes.includes(receivedPropertyType)) {
15639
+ throw new Error('The property ' + passedPropertyKey + ' is expected with type(s) [' + acceptedTypes.join(', ') + '], but type was set as ' + receivedPropertyType + '.');
15640
+ }
15641
+ });
15642
+ }
15643
+
15644
+ var mongodb = {
15645
+ url: {
15646
+ type: dataTypes.STRING,
15647
+ required: true
15648
+ },
15649
+ app: {
15650
+ type: dataTypes.STRING,
15651
+ required: false
15652
+ },
15653
+ credentials: {
15654
+ type: dataTypes.STRING,
15655
+ required: false
15656
+ },
15657
+ enableTelemetry: {
15658
+ type: dataTypes.BOOLEAN,
15659
+ required: false
15660
+ },
15661
+ mongodb: {
15662
+ type: dataTypes.OBJECT,
15663
+ required: true
15664
+ },
15665
+ username: {
15666
+ type: dataTypes.STRING,
15667
+ required: false
15668
+ },
15669
+ password: {
15670
+ type: dataTypes.STRING,
15671
+ required: false
15672
+ }
15673
+ };
15674
+ var elasticsearch = {
15675
+ url: {
15676
+ type: dataTypes.STRING,
15677
+ required: true
15678
+ },
15679
+ app: {
15680
+ type: dataTypes.STRING,
15681
+ required: true
15682
+ },
15683
+ credentials: {
15684
+ type: dataTypes.STRING,
15685
+ required: false
15686
+ },
15687
+ enableTelemetry: {
15688
+ type: dataTypes.BOOLEAN,
15689
+ required: false
15690
+ },
15691
+ username: {
15692
+ type: dataTypes.STRING,
15693
+ required: false
15694
+ },
15695
+ password: {
15696
+ type: dataTypes.STRING,
15697
+ required: false
15698
+ }
15699
+ };
15700
+ var SCHEMA = {
15701
+ mongodb: mongodb,
15702
+ elasticsearch: elasticsearch
15703
+ };
15453
15704
  /**
15454
15705
  * Returns an instance of Appbase client
15455
15706
  * @param {Object} config To configure properties
@@ -15459,10 +15710,10 @@
15459
15710
  * @param {String} config.username
15460
15711
  * @param {String} config.password
15461
15712
  * @param {Boolean} config.enableTelemetry
15713
+ * @param {Object} config.mongodb
15462
15714
  * A callback function which will be invoked before a fetch request made
15463
15715
  */
15464
15716
 
15465
-
15466
15717
  function AppBase(config) {
15467
15718
  var _URL = urlParserLite(config.url || ''),
15468
15719
  _URL$auth = _URL.auth,
@@ -15474,30 +15725,42 @@
15474
15725
  _URL$protocol = _URL.protocol,
15475
15726
  protocol = _URL$protocol === undefined ? '' : _URL$protocol;
15476
15727
 
15477
- var url = host + path; // Validate config and throw appropriate error
15728
+ var url = config.url;
15729
+ url = host + path; // Parse url
15478
15730
 
15479
- if (typeof url !== 'string' || url === '') {
15480
- throw new Error('URL not present in options.');
15731
+ if (url.slice(-1) === '/') {
15732
+ url = url.slice(0, -1);
15481
15733
  }
15482
15734
 
15483
- if (typeof config.app !== 'string' || config.app === '') {
15484
- throw new Error('App name is not present in options.');
15485
- }
15735
+ var backendName = backendAlias[config.mongodb ? 'MONGODB' : 'ELASTICSEARCH']; // eslint-disable-next-line
15736
+
15737
+ var schema = SCHEMA[backendName];
15738
+ validateSchema({
15739
+ url: config.url,
15740
+ app: config.app,
15741
+ credentials: config.credentials,
15742
+ username: config.username,
15743
+ password: config.password,
15744
+ enableTelemetry: config.enableTelemetry,
15745
+ mongodb: config.mongodb
15746
+ }, schema, backendName);
15486
15747
 
15487
15748
  if (typeof protocol !== 'string' || protocol === '') {
15488
15749
  throw new Error('Protocol is not present in url. URL should be of the form https://appbase-demo-ansible-abxiydt-arc.searchbase.io');
15489
- } // Parse url
15490
-
15491
-
15492
- if (url.slice(-1) === '/') {
15493
- url = url.slice(0, -1);
15494
15750
  }
15495
15751
 
15496
15752
  var credentials = auth || null;
15753
+
15754
+ if (!config.mongodb) {
15755
+ if (isAppbase(url) && credentials === null) {
15756
+ throw new Error('Authentication information is not present. Did you add credentials?');
15757
+ }
15758
+ }
15497
15759
  /**
15498
15760
  * Credentials can be provided as a part of the URL,
15499
15761
  * as username, password args or as a credentials argument directly */
15500
15762
 
15763
+
15501
15764
  if (typeof config.credentials === 'string' && config.credentials !== '') {
15502
15765
  // eslint-disable-next-line
15503
15766
  credentials = config.credentials;
@@ -15505,15 +15768,15 @@
15505
15768
  credentials = config.username + ':' + config.password;
15506
15769
  }
15507
15770
 
15508
- if (isAppbase(url) && credentials === null) {
15509
- throw new Error('Authentication information is not present. Did you add credentials?');
15510
- }
15511
-
15512
15771
  this.url = url;
15513
15772
  this.protocol = protocol;
15514
15773
  this.app = config.app;
15515
15774
  this.credentials = credentials;
15516
15775
 
15776
+ if (config.mongodb) {
15777
+ this.mongodb = config.mongodb;
15778
+ }
15779
+
15517
15780
  if (typeof config.enableTelemetry === 'boolean') {
15518
15781
  this.enableTelemetry = config.enableTelemetry;
15519
15782
  }
@@ -15542,7 +15805,9 @@
15542
15805
  params = parsedArgs.params,
15543
15806
  body = parsedArgs.body,
15544
15807
  isRSAPI = parsedArgs.isRSAPI,
15545
- isSuggestionsAPI = parsedArgs.isSuggestionsAPI;
15808
+ isSuggestionsAPI = parsedArgs.isSuggestionsAPI,
15809
+ _parsedArgs$isMongoRe = parsedArgs.isMongoRequest,
15810
+ isMongoRequest = _parsedArgs$isMongoRe === undefined ? false : _parsedArgs$isMongoRe;
15546
15811
  var app = isSuggestionsAPI ? '.suggestions' : _this.app;
15547
15812
  var bodyCopy = body;
15548
15813
  var contentType = path.endsWith('msearch') || path.endsWith('bulk') ? 'application/x-ndjson' : 'application/json';
@@ -15593,7 +15858,7 @@
15593
15858
  paramsString = '?' + querystring.stringify(params);
15594
15859
  }
15595
15860
 
15596
- var finalURL = _this.protocol + '://' + _this.url + '/' + app + '/' + path + paramsString;
15861
+ var finalURL = isMongoRequest ? _this.protocol + '://' + _this.url : _this.protocol + '://' + _this.url + '/' + app + '/' + path + paramsString;
15597
15862
  return handleTransformRequest(Object.assign({}, {
15598
15863
  url: finalURL
15599
15864
  }, requestOptions)).then(function (ts) {
@@ -15602,7 +15867,7 @@
15602
15867
  delete transformedRequest.url;
15603
15868
  return browserPonyfill$1(url || finalURL, Object.assign({}, transformedRequest, {
15604
15869
  // apply timestamp header for RS API
15605
- headers: isRSAPI ? Object.assign({}, transformedRequest.headers, {
15870
+ headers: isRSAPI && !isMongoRequest ? Object.assign({}, transformedRequest.headers, {
15606
15871
  'x-timestamp': new Date().getTime()
15607
15872
  }) : transformedRequest.headers
15608
15873
  })).then(function (res) {
@@ -15630,7 +15895,7 @@
15630
15895
 
15631
15896
  if (data) {
15632
15897
  Object.keys(data).forEach(function (key) {
15633
- if (data[key] && Object.prototype.hasOwnProperty.call(data[key], 'error')) {
15898
+ if (data[key] && Object.prototype.hasOwnProperty.call(data[key], 'error') && !!data[key].error) {
15634
15899
  errorResponses += 1;
15635
15900
  }
15636
15901
  });
@@ -15967,12 +16232,20 @@
15967
16232
  settings: parsedSettings,
15968
16233
  query: query
15969
16234
  };
16235
+
16236
+ if (this.mongodb) {
16237
+ Object.assign(body, {
16238
+ mongodb: getMongoRequest(this.app, this.mongodb)
16239
+ });
16240
+ }
16241
+
15970
16242
  return this.performFetchRequest({
15971
16243
  method: 'POST',
15972
16244
  path: '_reactivesearch',
15973
16245
  body: body,
15974
- headers: getTelemetryHeaders(this.enableTelemetry),
15975
- isRSAPI: true
16246
+ headers: getTelemetryHeaders(this.enableTelemetry, !this.mongodb),
16247
+ isRSAPI: true,
16248
+ isMongoRequest: !!this.mongodb
15976
16249
  });
15977
16250
  }
15978
16251
  /**
@@ -15999,12 +16272,20 @@
15999
16272
  settings: parsedSettings,
16000
16273
  query: query
16001
16274
  };
16275
+
16276
+ if (this.mongodb) {
16277
+ Object.assign(body, {
16278
+ mongodb: getMongoRequest(this.app, this.mongodb)
16279
+ });
16280
+ }
16281
+
16002
16282
  return this.performFetchRequest({
16003
16283
  method: 'POST',
16004
16284
  path: '_reactivesearch.v3',
16005
16285
  body: body,
16006
- headers: getTelemetryHeaders(this.enableTelemetry),
16007
- isRSAPI: true
16286
+ headers: getTelemetryHeaders(this.enableTelemetry, !this.mongodb),
16287
+ isRSAPI: true,
16288
+ isMongoRequest: !!this.mongodb
16008
16289
  });
16009
16290
  }
16010
16291
  /**
@@ -16042,13 +16323,21 @@
16042
16323
  settings: parsedSettings,
16043
16324
  query: query
16044
16325
  };
16326
+
16327
+ if (this.mongodb) {
16328
+ Object.assign(body, {
16329
+ mongodb: getMongoRequest(this.app, this.mongodb)
16330
+ });
16331
+ }
16332
+
16045
16333
  return this.performFetchRequest({
16046
16334
  method: 'POST',
16047
16335
  path: '_reactivesearch.v3',
16048
16336
  body: body,
16049
16337
  headers: getTelemetryHeaders(this.enableTelemetry),
16050
16338
  isRSAPI: true,
16051
- isSuggestionsAPI: true
16339
+ isSuggestionsAPI: true,
16340
+ isMongoRequest: !!this.mongodb
16052
16341
  });
16053
16342
  }
16054
16343
 
@@ -16781,7 +17070,7 @@
16781
17070
  }
16782
17071
  },
16783
17072
  props: {
16784
- app: types.stringRequired,
17073
+ app: types.string,
16785
17074
  analytics: VueTypes.bool,
16786
17075
  analyticsConfig: types.analyticsConfig,
16787
17076
  appbaseConfig: types.appbaseConfig,
@@ -16801,7 +17090,8 @@
16801
17090
  transformResponse: types.func,
16802
17091
  as: VueTypes.string.def('div'),
16803
17092
  getSearchParams: types.func,
16804
- setSearchParams: types.func
17093
+ setSearchParams: types.func,
17094
+ mongodb: types.mongodb
16805
17095
  },
16806
17096
  provide: function provide() {
16807
17097
  return {
@@ -16841,6 +17131,9 @@
16841
17131
  this.store.dispatch(analytics_3$1(newVal));
16842
17132
  }
16843
17133
  }
17134
+ },
17135
+ mongodb: function mongodb() {
17136
+ this.updateState(this.$props);
16844
17137
  }
16845
17138
  },
16846
17139
  computed: {
@@ -16848,12 +17141,13 @@
16848
17141
  var _this$$props = this.$props,
16849
17142
  enableAppbase = _this$$props.enableAppbase,
16850
17143
  headers = _this$$props.headers,
16851
- appbaseConfig = _this$$props.appbaseConfig;
17144
+ appbaseConfig = _this$$props.appbaseConfig,
17145
+ mongodb = _this$$props.mongodb;
16852
17146
 
16853
17147
  var _ref = appbaseConfig || {},
16854
17148
  enableTelemetry = _ref.enableTelemetry;
16855
17149
 
16856
- return _extends({}, enableAppbase && _extends({
17150
+ return _extends({}, enableAppbase && !mongodb && _extends({
16857
17151
  'X-Search-Client': X_SEARCH_CLIENT
16858
17152
  }, enableTelemetry === false && {
16859
17153
  'X-Enable-Telemetry': false
@@ -16871,7 +17165,7 @@
16871
17165
  var appbaseConfig = _extends({}, props.analyticsConfig, props.appbaseConfig);
16872
17166
 
16873
17167
  var config = {
16874
- url: props.url && props.url.trim() !== '' ? props.url : 'https://scalr.api.appbase.io',
17168
+ url: props.url && props.url.trim() !== '' ? props.url : '',
16875
17169
  app: props.app,
16876
17170
  credentials: credentials,
16877
17171
  type: props.type ? props.type : '*',
@@ -16879,7 +17173,8 @@
16879
17173
  transformResponse: props.transformResponse,
16880
17174
  enableAppbase: props.enableAppbase,
16881
17175
  analytics: props.appbaseConfig ? props.appbaseConfig.recordAnalytics : props.analytics,
16882
- analyticsConfig: appbaseConfig
17176
+ analyticsConfig: appbaseConfig,
17177
+ mongodb: props.mongodb
16883
17178
  };
16884
17179
  var queryParams = '';
16885
17180
 
@@ -18261,24 +18556,22 @@
18261
18556
 
18262
18557
  return __webpack_require__(0);
18263
18558
  /******/
18264
- }([
18265
- /* 0 */
18266
-
18267
- /***/
18268
-
18269
- /* 1 */
18270
-
18271
- /***/
18272
-
18273
- /* 2 */
18559
+ }
18560
+ /************************************************************************/
18274
18561
 
18275
- /***/
18562
+ /******/
18563
+ ([
18564
+ /* 0 */
18276
18565
 
18277
- /******/
18566
+ /***/
18278
18567
  function (module, exports, __webpack_require__) {
18279
18568
  module.exports = __webpack_require__(1);
18280
18569
  /***/
18281
- }, function (module, exports, __webpack_require__) {
18570
+ },
18571
+ /* 1 */
18572
+
18573
+ /***/
18574
+ function (module, exports, __webpack_require__) {
18282
18575
 
18283
18576
  Object.defineProperty(exports, "__esModule", {
18284
18577
  value: true
@@ -18311,7 +18604,11 @@
18311
18604
  }
18312
18605
  });
18313
18606
  /***/
18314
- }, function (module, exports) {
18607
+ },
18608
+ /* 2 */
18609
+
18610
+ /***/
18611
+ function (module, exports) {
18315
18612
 
18316
18613
  Object.defineProperty(exports, "__esModule", {
18317
18614
  value: true
@@ -18480,7 +18777,9 @@
18480
18777
  }
18481
18778
  /***/
18482
18779
 
18483
- }]);
18780
+ }
18781
+ /******/
18782
+ ]);
18484
18783
  });
18485
18784
  unwrapExports(dist);
18486
18785
  var dist_1 = dist.findAll;
@@ -20948,7 +21247,7 @@
20948
21247
  var filteredItemsToRender = itemsToRender.filter(function (item) {
20949
21248
  if (String(item.key).length) {
20950
21249
  if (_this.$props.showSearch && _this.$data.searchTerm) {
20951
- return String(item.key).toLowerCase().includes(_this.$data.searchTerm.toLowerCase());
21250
+ return suggestions_1(String(item.key)).toLowerCase().includes(suggestions_1(_this.$data.searchTerm.toLowerCase()));
20952
21251
  }
20953
21252
 
20954
21253
  return true;
@@ -21442,7 +21741,7 @@
21442
21741
  var filteredItemsToRender = itemsToRender.filter(function (item) {
21443
21742
  if (String(item.key).length) {
21444
21743
  if (_this2.$props.showSearch && _this2.$data.searchTerm) {
21445
- return String(item.key).toLowerCase().includes(_this2.$data.searchTerm.toLowerCase());
21744
+ return suggestions_1(String(item.key)).toLowerCase().includes(suggestions_1(_this2.$data.searchTerm).toLowerCase());
21446
21745
  }
21447
21746
 
21448
21747
  return true;
@@ -21944,7 +22243,7 @@
21944
22243
  var filteredItemsToRender = itemsToRender.filter(function (item) {
21945
22244
  if (String(item[labelField]).length) {
21946
22245
  if (_this.$props.showSearch && _this.$data.searchTerm) {
21947
- return String(item[labelField]).toLowerCase().includes(_this.$data.searchTerm.toLowerCase());
22246
+ return suggestions_1(String(item[labelField])).toLowerCase().includes(suggestions_1(_this.$data.searchTerm.toLowerCase()));
21948
22247
  }
21949
22248
 
21950
22249
  return true;
@@ -22008,7 +22307,8 @@
22008
22307
  }
22009
22308
  }) : null, !hasCustomRenderer && filteredItemsToRender.length === 0 ? _this.renderNoResult() : filteredItemsToRender.map(function (item, index) {
22010
22309
  var selected = _this.$props.multi // MultiDropdownList
22011
- && (selectedItem && !!selectedItem[item[keyField]] || Array.isArray(selectedItem) && selectedItem.find(function (value) {
22310
+ && (selectedItem && !!selectedItem[item[keyField]] // MultiDropdownRange
22311
+ || Array.isArray(selectedItem) && selectedItem.find(function (value) {
22012
22312
  return value[labelField] === item[labelField];
22013
22313
  }));
22014
22314
  if (!_this.$props.multi) selected = item.key === selectedItem;
@@ -23142,7 +23442,7 @@
23142
23442
  componentId: types.stringRequired,
23143
23443
  data: types.data,
23144
23444
  dataField: types.stringRequired,
23145
- defaultValue: types.stringOrArray,
23445
+ defaultValue: types.any,
23146
23446
  value: types.stringOrArray,
23147
23447
  filterLabel: types.string,
23148
23448
  nestedField: types.string,
@@ -23495,7 +23795,7 @@
23495
23795
  this.internalComponent = null;
23496
23796
  this.$defaultQuery = null; // Set custom query in store
23497
23797
 
23498
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, undefined);
23798
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
23499
23799
  var customQuery = props.customQuery,
23500
23800
  componentId = props.componentId,
23501
23801
  filterLabel = props.filterLabel,
@@ -23518,7 +23818,7 @@
23518
23818
  }
23519
23819
 
23520
23820
  if (customQuery) {
23521
- var calcCustomQuery = customQuery(props);
23821
+ var calcCustomQuery = customQuery(this.selectedValue, props);
23522
23822
 
23523
23823
  var _ref = calcCustomQuery || {},
23524
23824
  query = _ref.query;
@@ -23537,7 +23837,7 @@
23537
23837
 
23538
23838
  this.updateQuery({
23539
23839
  componentId: componentId,
23540
- queryToSet: queryToSet,
23840
+ query: queryToSet,
23541
23841
  value: this.selectedValue || null,
23542
23842
  label: filterLabel,
23543
23843
  showFilter: showFilter,
@@ -23588,8 +23888,8 @@
23588
23888
  },
23589
23889
  beforeMount: function beforeMount() {
23590
23890
  if (this.internalComponent && this.$props.defaultQuery) {
23591
- updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, undefined);
23592
- this.$defaultQuery = this.$props.defaultQuery();
23891
+ updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
23892
+ this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
23593
23893
 
23594
23894
  var _ref3 = this.$defaultQuery || {},
23595
23895
  query = _ref3.query,
@@ -23653,8 +23953,8 @@
23653
23953
  }
23654
23954
  },
23655
23955
  defaultQuery: function defaultQuery(newVal, oldVal) {
23656
- if (newVal && !isQueryIdentical(newVal, oldVal, undefined, this.$props)) {
23657
- this.$defaultQuery = newVal();
23956
+ if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
23957
+ this.$defaultQuery = newVal(this.selectedValue, this.$props);
23658
23958
 
23659
23959
  var _ref4 = this.$defaultQuery || {},
23660
23960
  query = _ref4.query,
@@ -23665,7 +23965,7 @@
23665
23965
  } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false); // Update default query for RS API
23666
23966
 
23667
23967
 
23668
- updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, undefined);
23968
+ updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
23669
23969
  var queryToSet = query || null;
23670
23970
 
23671
23971
  if (!queryToSet && this.$defaultQuery && this.$defaultQuery.id) {
@@ -23679,9 +23979,9 @@
23679
23979
  }
23680
23980
  },
23681
23981
  customQuery: function customQuery(newVal, oldVal) {
23682
- if (newVal && !isQueryIdentical(newVal, oldVal, undefined, this.$props)) {
23982
+ if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
23683
23983
  var componentId = this.$props.componentId;
23684
- this.$customQuery = newVal(this.$props);
23984
+ this.$customQuery = newVal(this.selectedValue, this.$props);
23685
23985
 
23686
23986
  var _ref5 = this.$customQuery || {},
23687
23987
  query = _ref5.query,
@@ -23692,7 +23992,7 @@
23692
23992
  } else this.setQueryOptions(componentId, this.getAggsQuery(), false); // Update custom query for RS API
23693
23993
 
23694
23994
 
23695
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, undefined);
23995
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
23696
23996
  var queryToSet = query || null;
23697
23997
 
23698
23998
  if (this.$customQuery && this.$customQuery.id) {
@@ -32566,16 +32866,7 @@
32566
32866
  compProps[key] = component[key];
32567
32867
  }
32568
32868
  });
32569
- var isInternalComponentPresent = false; // Set custom and default queries
32570
-
32571
- if (component.customQuery && typeof component.customQuery === 'function') {
32572
- customQueries[component.componentId] = component.customQuery(component.value, compProps);
32573
- }
32574
-
32575
- if (component.defaultQuery && typeof component.defaultQuery === 'function') {
32576
- defaultQueries[component.componentId] = component.defaultQuery(component.value, compProps);
32577
- }
32578
-
32869
+ var isInternalComponentPresent = false;
32579
32870
  var isResultComponent = resultComponents.includes(componentType);
32580
32871
  var internalComponent = component.componentId + "__internal";
32581
32872
  var label = component.filterLabel || component.componentId;
@@ -32599,7 +32890,16 @@
32599
32890
  reference: reference,
32600
32891
  showFilter: showFilter,
32601
32892
  URLParams: component.URLParams || false
32602
- }); // [2] set query options - main component query (valid for result components)
32893
+ }); // Set custom and default queries
32894
+
32895
+ if (component.customQuery && typeof component.customQuery === 'function') {
32896
+ customQueries[component.componentId] = component.customQuery(value, compProps);
32897
+ }
32898
+
32899
+ if (component.defaultQuery && typeof component.defaultQuery === 'function') {
32900
+ defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
32901
+ } // [2] set query options - main component query (valid for result components)
32902
+
32603
32903
 
32604
32904
  if (componentsWithOptions.includes(componentType)) {
32605
32905
  var options = component.source.generateQueryOptions ? component.source.generateQueryOptions(component) : null;
@@ -32686,7 +32986,7 @@
32686
32986
 
32687
32987
 
32688
32988
  if (isResultComponent) {
32689
- var _getQuery = getQuery(component, null, componentType),
32989
+ var _getQuery = getQuery(component, value, componentType),
32690
32990
  query = _getQuery.query;
32691
32991
 
32692
32992
  queryList = queryReducer(queryList, {
@@ -32757,8 +33057,9 @@
32757
33057
  appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), transform_1(state, component.componentId, orderOfQueries));
32758
33058
  }
32759
33059
  } else {
33060
+ var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
32760
33061
  finalQuery = [].concat(finalQuery, [{
32761
- preference: component.componentId
33062
+ preference: preference
32762
33063
  }, currentQuery]);
32763
33064
  }
32764
33065
  }
@@ -32912,7 +33213,7 @@
32912
33213
  });
32913
33214
  }
32914
33215
 
32915
- var version = "1.16.0-alpha.23";
33216
+ var version = "1.16.0-alpha.27";
32916
33217
 
32917
33218
  var _templateObject$o, _templateObject2$b;
32918
33219