@appbaseio/reactivesearch-vue 1.16.0-alpha.4 → 1.16.0-alpha.42

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 (101) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +8110 -7499
  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/Button-d2f1aeda.js +68 -0
  6. package/dist/cjs/{DownShift-b09da079.js → CancelSvg-82021d23.js} +60 -16
  7. package/dist/cjs/Card-4b915733.js +30 -0
  8. package/dist/cjs/{ComponentWrapper-5a0a8849.js → ComponentWrapper-7302fe1a.js} +40 -21
  9. package/dist/cjs/{Container-f84e72fc.js → Container-8a08d663.js} +3 -11
  10. package/dist/cjs/DataSearch.js +354 -398
  11. package/dist/cjs/{DropDown-c66be1a8.js → DropDown-c46d8b0c.js} +80 -95
  12. package/dist/cjs/DynamicRangeSlider.js +107 -42
  13. package/dist/cjs/Flex-699639d2.js +52 -0
  14. package/dist/cjs/FormControlList-73497794.js +47 -0
  15. package/dist/cjs/Input-c6f181d5.js +79 -0
  16. package/dist/cjs/ListItem-933c27e4.js +46 -0
  17. package/dist/cjs/MultiDropdownList.js +101 -65
  18. package/dist/cjs/MultiList.js +79 -47
  19. package/dist/cjs/MultiRange.js +20 -14
  20. package/dist/cjs/{Pagination-91df3b77.js → Pagination-1b2320a7.js} +4 -3
  21. package/dist/cjs/RangeInput.js +29 -45
  22. package/dist/cjs/RangeSlider.js +31 -28
  23. package/dist/cjs/ReactiveBase.js +55 -34
  24. package/dist/cjs/ReactiveComponent.js +69 -62
  25. package/dist/cjs/ReactiveGoogleMap.js +326 -235
  26. package/dist/cjs/ReactiveList.js +188 -241
  27. package/dist/cjs/ResultCard.js +8 -6
  28. package/dist/cjs/ResultList.js +8 -6
  29. package/dist/cjs/SelectedFilters.js +25 -12
  30. package/dist/cjs/SingleDropdownList.js +87 -57
  31. package/dist/cjs/SingleList.js +60 -37
  32. package/dist/cjs/SingleRange.js +17 -11
  33. package/dist/cjs/StateProvider.js +11 -7
  34. package/dist/cjs/{Title-e9beb554.js → Title-39765ee6.js} +3 -11
  35. package/dist/cjs/ToggleButton.js +35 -16
  36. package/dist/cjs/{_rollupPluginBabelHelpers-280a574c.js → _rollupPluginBabelHelpers-4abdbfff.js} +11 -1
  37. package/dist/cjs/{index-e0583d76.js → index-d44a0a21.js} +87 -13
  38. package/dist/cjs/index.js +23 -19
  39. package/dist/cjs/initReactivesearch.js +190 -103
  40. package/dist/cjs/install.js +20 -18
  41. package/dist/cjs/ssr-c333c82c.js +39 -0
  42. package/dist/cjs/{utils-d1ea9f95.js → utils-23afb20b.js} +2 -2
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-6de9d2a9.js} +9 -4
  45. package/dist/es/Button-799185e2.js +59 -0
  46. package/dist/es/{DownShift-d8f2500f.js → CancelSvg-4d9e0857.js} +56 -17
  47. package/dist/es/Card-04b3c33e.js +23 -0
  48. package/dist/es/{ComponentWrapper-d0b21b95.js → ComponentWrapper-bbb717bc.js} +40 -21
  49. package/dist/es/Container-4383c6f0.js +10 -0
  50. package/dist/es/DataSearch.js +352 -396
  51. package/dist/es/{DropDown-5dbd69c2.js → DropDown-4edaa621.js} +79 -94
  52. package/dist/es/DynamicRangeSlider.js +107 -42
  53. package/dist/es/Flex-aac91505.js +47 -0
  54. package/dist/es/FormControlList-fe389a2e.js +40 -0
  55. package/dist/es/Input-d8519224.js +71 -0
  56. package/dist/es/ListItem-bdb6d53d.js +39 -0
  57. package/dist/es/MultiDropdownList.js +101 -65
  58. package/dist/es/MultiList.js +79 -47
  59. package/dist/es/MultiRange.js +20 -14
  60. package/dist/es/{Pagination-800af44f.js → Pagination-b3e4054a.js} +4 -3
  61. package/dist/es/RangeInput.js +29 -45
  62. package/dist/es/RangeSlider.js +31 -28
  63. package/dist/es/ReactiveBase.js +55 -34
  64. package/dist/es/ReactiveComponent.js +69 -62
  65. package/dist/es/ReactiveGoogleMap.js +326 -235
  66. package/dist/es/ReactiveList.js +188 -241
  67. package/dist/es/ResultCard.js +8 -6
  68. package/dist/es/ResultList.js +8 -6
  69. package/dist/es/SelectedFilters.js +25 -12
  70. package/dist/es/SingleDropdownList.js +87 -57
  71. package/dist/es/SingleList.js +60 -37
  72. package/dist/es/SingleRange.js +17 -11
  73. package/dist/es/StateProvider.js +11 -7
  74. package/dist/es/Title-579f8d6c.js +10 -0
  75. package/dist/es/ToggleButton.js +35 -16
  76. package/dist/es/{_rollupPluginBabelHelpers-c9fbe19f.js → _rollupPluginBabelHelpers-ecf6c03c.js} +11 -1
  77. package/dist/es/{index-1fe91a0a.js → index-5daa8276.js} +84 -14
  78. package/dist/es/index.js +23 -19
  79. package/dist/es/initReactivesearch.js +191 -104
  80. package/dist/es/install.js +20 -18
  81. package/dist/es/ssr-e3196de1.js +33 -0
  82. package/dist/es/{utils-ce3d86fd.js → utils-3a32e13f.js} +2 -2
  83. package/dist/es/version.js +1 -1
  84. package/dist/es/{vueTypes-98d938a9.js → vueTypes-9326e0be.js} +9 -4
  85. package/package.json +7 -5
  86. package/dist/cjs/Button-78d8bc26.js +0 -146
  87. package/dist/cjs/Card-b4af314f.js +0 -58
  88. package/dist/cjs/Flex-737c55be.js +0 -160
  89. package/dist/cjs/FormControlList-08dfb28e.js +0 -105
  90. package/dist/cjs/Input-643d02a7.js +0 -178
  91. package/dist/cjs/ListItem-0c58c5d2.js +0 -84
  92. package/dist/cjs/ssr-b7a729f9.js +0 -47
  93. package/dist/es/Button-6c71c66e.js +0 -137
  94. package/dist/es/Card-ecf70ba1.js +0 -51
  95. package/dist/es/Container-f5efec9e.js +0 -18
  96. package/dist/es/Flex-40a74d8a.js +0 -155
  97. package/dist/es/FormControlList-b96aebef.js +0 -98
  98. package/dist/es/Input-dfd9dd40.js +0 -170
  99. package/dist/es/ListItem-da73bc7d.js +0 -77
  100. package/dist/es/Title-22c2f3bf.js +0 -18
  101. package/dist/es/ssr-2f57791d.js +0 -41
package/dist/es/index.js CHANGED
@@ -1,39 +1,41 @@
1
1
  import '@appbaseio/reactivecore';
2
- import './_rollupPluginBabelHelpers-c9fbe19f.js';
2
+ import './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import 'vue-types';
4
4
  import '@appbaseio/reactivecore/lib/utils/constants';
5
+ import '@appbaseio/reactivecore/lib/utils/helper';
5
6
  import 'emotion';
6
7
  import '@appbaseio/vue-emotion';
7
8
  import 'polished';
8
- import './Button-6c71c66e.js';
9
- import './vueTypes-98d938a9.js';
10
- import './Pagination-800af44f.js';
9
+ import './Button-799185e2.js';
10
+ import './vueTypes-9326e0be.js';
11
+ import './Pagination-b3e4054a.js';
11
12
  export { default as ReactiveList } from './ReactiveList.js';
12
13
  import '@appbaseio/reactivecore/lib/utils/transform';
13
14
  import 'redux';
14
- import './index-1fe91a0a.js';
15
- import './ComponentWrapper-d0b21b95.js';
15
+ import './index-5daa8276.js';
16
+ import './ComponentWrapper-bbb717bc.js';
16
17
  import '@vue/babel-helper-vue-jsx-merge-props';
17
- import './Title-22c2f3bf.js';
18
- import './ListItem-da73bc7d.js';
19
- import './Card-ecf70ba1.js';
20
- import './Flex-40a74d8a.js';
21
- import '@appbaseio/reactivecore/lib/utils/helper';
18
+ import './Title-579f8d6c.js';
19
+ import './ListItem-bdb6d53d.js';
20
+ import './Card-04b3c33e.js';
21
+ import './Flex-aac91505.js';
22
22
  import '@appbaseio/reactivecore/lib/actions/analytics';
23
23
  import 'appbase-js';
24
24
  import 'url-search-params-polyfill';
25
25
  export { default as ReactiveBase } from './ReactiveBase.js';
26
- import './Input-dfd9dd40.js';
26
+ import 'hotkeys-js';
27
27
  export { default as DataSearch } from './DataSearch.js';
28
+ import './CancelSvg-4d9e0857.js';
29
+ import './Input-d8519224.js';
28
30
  import 'compute-scroll-into-view';
29
- import './DownShift-d8f2500f.js';
30
- import './Container-f5efec9e.js';
31
+ import './Container-4383c6f0.js';
31
32
  import 'vue-highlight-words';
32
- import './FormControlList-b96aebef.js';
33
- import './utils-ce3d86fd.js';
33
+ import '@appbaseio/reactivecore/lib/utils/suggestions';
34
+ import './FormControlList-fe389a2e.js';
35
+ import './utils-3a32e13f.js';
34
36
  export { default as SingleList } from './SingleList.js';
35
37
  export { default as MultiList } from './MultiList.js';
36
- import './DropDown-5dbd69c2.js';
38
+ import './DropDown-4edaa621.js';
37
39
  export { default as SingleDropdownList } from './SingleDropdownList.js';
38
40
  export { default as MultiDropdownList } from './MultiDropdownList.js';
39
41
  export { default as ToggleButton } from './ToggleButton.js';
@@ -44,7 +46,7 @@ export { default as MultiRange } from './MultiRange.js';
44
46
  export { default as ResultCard } from './ResultCard.js';
45
47
  export { default as ResultList } from './ResultList.js';
46
48
  import 'vue-no-ssr';
47
- import './ssr-2f57791d.js';
49
+ import './ssr-e3196de1.js';
48
50
  export { default as RangeSlider } from './RangeSlider.js';
49
51
  export { default as DynamicRangeSlider } from './DynamicRangeSlider.js';
50
52
  export { default as StateProvider } from './StateProvider.js';
@@ -53,12 +55,14 @@ import 'gmap-vue/dist/components-implementation/map';
53
55
  import 'ngeohash';
54
56
  export { default as ReactiveGoogleMap } from './ReactiveGoogleMap.js';
55
57
  import 'gmap-vue/dist/components/cluster';
56
- import 'gmap-vue/dist/components/marker';
57
58
  import 'gmap-vue/dist/components-implementation/info-window';
59
+ import 'gmap-vue/dist/components/marker';
58
60
  import 'gmap-vue/dist/mixins/map-element';
59
61
  import '@appbaseio/reactivecore/lib/reducers/valueReducer';
60
62
  import '@appbaseio/reactivecore/lib/reducers/queryReducer';
61
63
  import '@appbaseio/reactivecore/lib/reducers/queryOptionsReducer';
64
+ import '@appbaseio/reactivecore/lib/reducers/compositeAggsReducer';
65
+ import '@appbaseio/reactivecore/lib/constants';
62
66
  import '@appbaseio/reactivecore/lib/reducers/dependencyTreeReducer';
63
67
  import '@appbaseio/reactivecore/lib/utils/graphQL';
64
68
  import '@appbaseio/reactivecore/lib/actions/utils';
@@ -1,35 +1,47 @@
1
- import { b as _objectWithoutPropertiesLoose, a as _extends } from './_rollupPluginBabelHelpers-c9fbe19f.js';
1
+ import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
2
2
  import { validProps, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
3
- import { getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
4
- import { pushToAndClause, buildQuery } from '@appbaseio/reactivecore/lib/utils/helper';
3
+ import { pushToAndClause, buildQuery, extractQueryFromCustomQuery, getOptionsForCustomQuery } from '@appbaseio/reactivecore/lib/utils/helper';
4
+ import { isSearchComponent, getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
5
5
  import Appbase from 'appbase-js';
6
6
  import valueReducer from '@appbaseio/reactivecore/lib/reducers/valueReducer';
7
7
  import queryReducer from '@appbaseio/reactivecore/lib/reducers/queryReducer';
8
8
  import queryOptionsReducer from '@appbaseio/reactivecore/lib/reducers/queryOptionsReducer';
9
+ import compositeAggsReducer from '@appbaseio/reactivecore/lib/reducers/compositeAggsReducer';
10
+ import { UPDATE_COMPOSITE_AGGS } from '@appbaseio/reactivecore/lib/constants';
9
11
  import dependencyTreeReducer from '@appbaseio/reactivecore/lib/reducers/dependencyTreeReducer';
10
12
  import fetchGraphQL from '@appbaseio/reactivecore/lib/utils/graphQL';
11
13
  import { isPropertyDefined } from '@appbaseio/reactivecore/lib/actions/utils';
12
14
 
13
- var componentsWithHighlightQuery = [componentTypes.dataSearch, componentTypes.categorySearch];
14
- var componentsWithOptions = [componentTypes.reactiveList, componentTypes.reactiveMap, componentTypes.singleList, componentTypes.multiList, componentTypes.tagCloud].concat(componentsWithHighlightQuery);
15
+ var _excluded = ["aggs", "size"],
16
+ _excluded2 = ["query"],
17
+ _excluded3 = ["query"],
18
+ _excluded4 = ["aggs", "size"];
19
+ var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
15
20
  var componentsWithoutFilters = [componentTypes.numberBox, componentTypes.ratingsFilter];
16
21
  var resultComponents = [componentTypes.reactiveList, componentTypes.reactiveMap];
17
22
 
18
23
  function getValue(state, id, defaultValue) {
19
- if (!state) return defaultValue;
20
-
21
- if (state[id]) {
24
+ if (state && state[id]) {
22
25
  try {
23
26
  // parsing for next.js - since it uses extra set of quotes to wrap params
24
27
  var parsedValue = JSON.parse(state[id]);
25
- return parsedValue;
28
+ return {
29
+ value: parsedValue,
30
+ reference: 'URL'
31
+ };
26
32
  } catch (error) {
27
33
  // using react-dom-server for ssr
28
- return state[id] || defaultValue;
34
+ return {
35
+ value: state[id],
36
+ reference: 'URL'
37
+ };
29
38
  }
30
39
  }
31
40
 
32
- return defaultValue;
41
+ return {
42
+ value: defaultValue,
43
+ reference: 'DEFAULT'
44
+ };
33
45
  }
34
46
 
35
47
  function parseValue(value, component) {
@@ -38,28 +50,53 @@ function parseValue(value, component) {
38
50
  }
39
51
 
40
52
  return value;
41
- }
53
+ } // Returns query DSL with query property and other options
54
+
55
+
56
+ function getDefaultQuery(component, value) {
57
+ // get custom or default query of sensor components
58
+ var currentValue = parseValue(value, component); // get default query of result components
59
+
60
+ if (component.defaultQuery) {
61
+ var defaultQuery = component.defaultQuery(currentValue, component);
62
+ return _extends({
63
+ query: extractQueryFromCustomQuery(defaultQuery)
64
+ }, getOptionsForCustomQuery(defaultQuery));
65
+ }
42
66
 
43
- function getQuery(component, value, componentType) {
44
- // get default query of result components
45
- if (resultComponents.includes(componentType)) {
46
- return component.defaultQuery ? component.defaultQuery() : {};
47
- } // get custom or default query of sensor components
67
+ return component.source.defaultQuery ? {
68
+ query: component.source.defaultQuery(currentValue, component)
69
+ } : {};
70
+ } // Only results the query part
48
71
 
49
72
 
73
+ function getCustomQuery(component, value) {
74
+ // get custom or default query of sensor components
50
75
  var currentValue = parseValue(value, component);
51
76
 
52
77
  if (component.customQuery) {
53
78
  var customQuery = component.customQuery(currentValue, component);
54
- return customQuery && customQuery.query;
79
+ return _extends({
80
+ query: extractQueryFromCustomQuery(customQuery)
81
+ }, getOptionsForCustomQuery(customQuery));
55
82
  }
56
83
 
57
- return component.source.defaultQuery ? component.source.defaultQuery(currentValue, component) : {};
84
+ return component.source.defaultQuery ? {
85
+ query: component.source.defaultQuery(currentValue, component)
86
+ } : null;
58
87
  }
59
88
 
60
89
  function initReactivesearch(componentCollection, searchState, settings) {
61
90
  return new Promise(function (resolve, reject) {
62
91
  var credentials = settings.url && settings.url.trim() !== '' && !settings.credentials ? null : settings.credentials;
92
+ var enableTelemetry = settings.appbaseConfig && settings.appbaseConfig.enableTelemetry !== undefined ? settings.appbaseConfig.enableTelemetry : true;
93
+
94
+ var headers = _extends({}, settings.enableAppbase && _extends({
95
+ 'X-Search-Client': X_SEARCH_CLIENT
96
+ }, enableTelemetry === false && {
97
+ 'X-Enable-Telemetry': false
98
+ }), settings.headers);
99
+
63
100
  var config = {
64
101
  url: settings.url && settings.url.trim() !== '' ? settings.url : 'https://scalr.api.appbase.io',
65
102
  app: settings.app,
@@ -68,7 +105,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
68
105
  type: settings.type ? settings.type : '*',
69
106
  transformResponse: settings.transformResponse || null,
70
107
  graphQLUrl: settings.graphQLUrl || '',
71
- headers: settings.headers || {},
108
+ headers: headers,
72
109
  analyticsConfig: settings.appbaseConfig || null
73
110
  };
74
111
  var appbaseRef = Appbase(config);
@@ -85,6 +122,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
85
122
  var orderOfQueries = [];
86
123
  var hits = {};
87
124
  var aggregations = {};
125
+ var compositeAggregations = {};
88
126
  var state = {};
89
127
  var customQueries = {};
90
128
  var defaultQueries = {};
@@ -99,20 +137,20 @@ function initReactivesearch(componentCollection, searchState, settings) {
99
137
  compProps[key] = component[key];
100
138
  }
101
139
  });
102
- var isInternalComponentPresent = false; // Set custom and default queries
140
+ var isInternalComponentPresent = false;
103
141
 
104
- if (component.customQuery && typeof component.customQuery === 'function') {
105
- customQueries[component.componentId] = component.customQuery(component.value, compProps);
106
- }
107
-
108
- if (component.defaultQuery && typeof component.defaultQuery === 'function') {
109
- defaultQueries[component.componentId] = component.defaultQuery(component.value, compProps);
142
+ if (component.source.hasInternalComponent) {
143
+ isInternalComponentPresent = component.source.hasInternalComponent(component);
110
144
  }
111
145
 
112
146
  var isResultComponent = resultComponents.includes(componentType);
113
147
  var internalComponent = component.componentId + "__internal";
114
148
  var label = component.filterLabel || component.componentId;
115
- var value = getValue(searchState, component.componentId, component.value || component.defaultValue); // [1] set selected values
149
+
150
+ var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue),
151
+ value = _getValue.value,
152
+ reference = _getValue.reference; // [1] set selected values
153
+
116
154
 
117
155
  var showFilter = component.showFilter !== undefined ? component.showFilter : true;
118
156
 
@@ -125,75 +163,77 @@ function initReactivesearch(componentCollection, searchState, settings) {
125
163
  component: component.componentId,
126
164
  label: label,
127
165
  value: value,
166
+ reference: reference,
128
167
  showFilter: showFilter,
129
168
  URLParams: component.URLParams || false
130
- }); // [2] set query options - main component query (valid for result components)
169
+ }); // Set custom and default queries
131
170
 
132
- if (componentsWithOptions.includes(componentType)) {
133
- var options = component.source.generateQueryOptions ? component.source.generateQueryOptions(component) : null;
134
- var highlightQuery = {};
171
+ if (component.customQuery && typeof component.customQuery === 'function') {
172
+ customQueries[component.componentId] = component.customQuery(value, compProps);
173
+ }
135
174
 
136
- if (componentsWithHighlightQuery.includes(componentType) && component.highlight) {
137
- highlightQuery = component.source.highlightQuery(component);
138
- }
175
+ if (component.defaultQuery && typeof component.defaultQuery === 'function') {
176
+ defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
177
+ }
139
178
 
140
- if (options && Object.keys(options).length || highlightQuery && Object.keys(highlightQuery).length) {
141
- // eslint-disable-next-line
142
- var _ref = options || {},
143
- aggs = _ref.aggs,
144
- size = _ref.size,
145
- otherQueryOptions = _objectWithoutPropertiesLoose(_ref, ["aggs", "size"]);
146
-
147
- if (aggs && Object.keys(aggs).length) {
148
- isInternalComponentPresent = true; // query should be applied on the internal component
149
- // to enable feeding the data to parent component
150
-
151
- queryOptions = queryOptionsReducer(queryOptions, {
152
- type: 'SET_QUERY_OPTIONS',
153
- component: internalComponent,
154
- options: {
155
- aggs: aggs,
156
- size: typeof size === 'undefined' ? 100 : size
157
- }
158
- });
159
- } // sort, highlight, size, from - query should be applied on the main component
179
+ var componentQueryOptions = {}; // [2] set query options - main component query (valid for result components)
160
180
 
181
+ if (component && component.source.generateQueryOptions) {
182
+ componentQueryOptions = _extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
183
+ }
161
184
 
162
- if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
163
- if (!otherQueryOptions) otherQueryOptions = {};
164
- if (!highlightQuery) highlightQuery = {};
185
+ var highlightQuery = {};
165
186
 
166
- var mainQueryOptions = _extends(_extends(_extends({}, otherQueryOptions), highlightQuery), {}, {
167
- size: size
168
- });
187
+ if (component.source.highlightQuery) {
188
+ highlightQuery = component.source.highlightQuery(component);
189
+ }
169
190
 
170
- if (isInternalComponentPresent) {
171
- mainQueryOptions = _extends(_extends({}, otherQueryOptions), highlightQuery);
172
- }
191
+ if (componentQueryOptions && Object.keys(componentQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
192
+ // eslint-disable-next-line
193
+ var _ref = componentQueryOptions || {},
194
+ aggs = _ref.aggs,
195
+ size = _ref.size,
196
+ otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
197
+
198
+ if (aggs && Object.keys(aggs).length) {
199
+ isInternalComponentPresent = true;
200
+ componentQueryOptions = _extends({}, componentQueryOptions, {
201
+ aggs: aggs,
202
+ size: typeof size === 'undefined' ? 100 : size
203
+ });
204
+ } // sort, highlight, size, from - query should be applied on the main component
173
205
 
174
- if (isResultComponent) {
175
- var currentPage = component.currentPage ? component.currentPage - 1 : 0;
176
206
 
177
- if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
178
- currentPage = selectedValues[component.componentId].value - 1 || 0;
179
- }
207
+ if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
208
+ if (!otherQueryOptions) otherQueryOptions = {};
209
+ if (!highlightQuery) highlightQuery = {};
180
210
 
181
- var resultSize = component.size || 10;
182
- var from = currentPage * resultSize; // Update props for RS API
211
+ var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
212
+ size: size
213
+ });
183
214
 
184
- compProps.from = from;
185
- mainQueryOptions = _extends(_extends(_extends({}, mainQueryOptions), highlightQuery), {}, {
186
- size: resultSize,
187
- from: from
188
- });
215
+ if (isInternalComponentPresent) {
216
+ mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
217
+ }
218
+
219
+ if (isResultComponent) {
220
+ var currentPage = component.currentPage ? component.currentPage - 1 : 0;
221
+
222
+ if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
223
+ currentPage = selectedValues[component.componentId].value - 1 || 0;
189
224
  }
190
225
 
191
- queryOptions = queryOptionsReducer(queryOptions, {
192
- type: 'SET_QUERY_OPTIONS',
193
- component: component.componentId,
194
- options: _extends({}, mainQueryOptions)
226
+ var resultSize = component.size || 10;
227
+ var from = currentPage * resultSize; // Update props for RS API
228
+
229
+ compProps.from = from;
230
+ mainQueryOptions = _extends({}, mainQueryOptions, highlightQuery, {
231
+ size: resultSize,
232
+ from: from
195
233
  });
196
234
  }
235
+
236
+ componentQueryOptions = _extends({}, componentQueryOptions, mainQueryOptions);
197
237
  }
198
238
  } // [3] set dependency tree
199
239
 
@@ -211,25 +251,42 @@ function initReactivesearch(componentCollection, searchState, settings) {
211
251
  react: react
212
252
  });
213
253
  } // [4] set query list
254
+ // Do not set default query for suggestions
214
255
 
215
256
 
216
- if (isResultComponent) {
217
- var _getQuery = getQuery(component, null, componentType),
218
- query = _getQuery.query;
257
+ if (isInternalComponentPresent && !isSearchComponent(component.componentType)) {
258
+ var _ref2 = getDefaultQuery(component, value) || {},
259
+ defaultQuery = _ref2.query,
260
+ defaultQueryOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
219
261
 
220
262
  queryList = queryReducer(queryList, {
221
263
  type: 'SET_QUERY',
222
264
  component: internalComponent,
223
- query: query
265
+ query: defaultQuery
224
266
  });
225
- } else {
226
- queryList = queryReducer(queryList, {
227
- type: 'SET_QUERY',
228
- component: component.componentId,
229
- query: getQuery(component, value, componentType)
267
+ queryOptions = queryOptionsReducer(queryOptions, {
268
+ type: 'SET_QUERY_OPTIONS',
269
+ component: internalComponent,
270
+ options: _extends({}, componentQueryOptions, defaultQueryOptions)
230
271
  });
231
- } // Set component type in component props
272
+ }
232
273
 
274
+ var _ref3 = getCustomQuery(component, value) || {},
275
+ query = _ref3.query,
276
+ options = _objectWithoutPropertiesLoose(_ref3, _excluded3);
277
+
278
+ var customQuery = query; // set custom query for main component
279
+
280
+ queryList = queryReducer(queryList, {
281
+ type: 'SET_QUERY',
282
+ component: component.componentId,
283
+ query: customQuery
284
+ });
285
+ queryOptions = queryOptionsReducer(queryOptions, {
286
+ type: 'SET_QUERY_OPTIONS',
287
+ component: component.componentId,
288
+ options: _extends({}, componentQueryOptions, options)
289
+ }); // Set component type in component props
233
290
 
234
291
  compProps.componentType = componentType;
235
292
  componentProps[component.componentId] = compProps;
@@ -252,9 +309,22 @@ function initReactivesearch(componentCollection, searchState, settings) {
252
309
  queryObj = _buildQuery.queryObj,
253
310
  options = _buildQuery.options;
254
311
 
255
- var validOptions = ['aggs', 'from', 'sort']; // check if query or options are valid - non-empty
312
+ var componentQueryOptions = options;
313
+ var componentType = component.source.componentType;
314
+
315
+ if (componentType !== componentTypes.reactiveComponent) {
316
+ // don't merge aggs, size
317
+ var _ref4 = options || {},
318
+ aggs = _ref4.aggs,
319
+ size = _ref4.size,
320
+ rest = _objectWithoutPropertiesLoose(_ref4, _excluded4);
256
321
 
257
- if (queryObj && !!Object.keys(queryObj).length || options && Object.keys(options).some(function (item) {
322
+ componentQueryOptions = rest;
323
+ }
324
+
325
+ var validOptions = ['aggs', 'from', 'sort']; // check if query or componentQueryOptions are valid - non-empty
326
+
327
+ if (queryObj && !!Object.keys(queryObj).length || componentQueryOptions && Object.keys(componentQueryOptions).some(function (item) {
258
328
  return validOptions.includes(item);
259
329
  })) {
260
330
  var _extends2;
@@ -267,11 +337,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
267
337
 
268
338
  orderOfQueries = [].concat(orderOfQueries, [component.componentId]);
269
339
 
270
- var currentQuery = _extends(_extends({
340
+ var currentQuery = _extends({
271
341
  query: _extends({}, queryObj)
272
- }, options), queryOptions[component.componentId]);
342
+ }, componentQueryOptions, queryOptions[component.componentId]);
273
343
 
274
- queryLog = _extends(_extends({}, queryLog), {}, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
344
+ queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
275
345
 
276
346
  if (settings.enableAppbase) {
277
347
  var query = getRSQuery(component.componentId, extractPropsFromState(state, component.componentId, queryOptions && queryOptions[component.componentId] ? {
@@ -282,11 +352,12 @@ function initReactivesearch(componentCollection, searchState, settings) {
282
352
  var _extends3;
283
353
 
284
354
  // Apply dependent queries
285
- appbaseQuery = _extends(_extends(_extends({}, appbaseQuery), (_extends3 = {}, _extends3[component.componentId] = query, _extends3)), getDependentQueries(state, component.componentId, orderOfQueries));
355
+ appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), getDependentQueries(state, component.componentId, orderOfQueries));
286
356
  }
287
357
  } else {
358
+ var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
288
359
  finalQuery = [].concat(finalQuery, [{
289
- preference: component.componentId
360
+ preference: preference
290
361
  }, currentQuery]);
291
362
  }
292
363
  }
@@ -312,10 +383,15 @@ function initReactivesearch(componentCollection, searchState, settings) {
312
383
  if (response.aggregations) {
313
384
  var _extends4;
314
385
 
315
- aggregations = _extends(_extends({}, aggregations), {}, (_extends4 = {}, _extends4[component] = response.aggregations, _extends4));
386
+ aggregations = _extends({}, aggregations, (_extends4 = {}, _extends4[component] = response.aggregations, _extends4));
387
+ compositeAggregations = compositeAggsReducer(compositeAggregations, {
388
+ type: UPDATE_COMPOSITE_AGGS,
389
+ aggregations: response.aggregations,
390
+ append: false
391
+ });
316
392
  }
317
393
 
318
- hits = _extends(_extends({}, hits), {}, (_extends5 = {}, _extends5[component] = {
394
+ hits = _extends({}, hits, (_extends5 = {}, _extends5[component] = {
319
395
  hits: response.hits.hits,
320
396
  total: typeof response.hits.total === 'object' ? response.hits.total.value : response.hits.total,
321
397
  time: response.took
@@ -327,7 +403,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
327
403
  });
328
404
  });
329
405
  Promise.all(allPromises).then(function () {
330
- state = _extends(_extends({}, state), {}, {
406
+ state = _extends({}, state, {
331
407
  hits: hits,
332
408
  aggregations: aggregations
333
409
  });
@@ -339,6 +415,8 @@ function initReactivesearch(componentCollection, searchState, settings) {
339
415
  var promotedResults = {};
340
416
  var rawData = {};
341
417
  var customData = {};
418
+ var settingsResponse = {};
419
+ var timestamp = {};
342
420
  var allPromises = orderOfQueries.map(function (component) {
343
421
  return new Promise(function (responseResolve, responseReject) {
344
422
  handleTransformResponse(res[component], component).then(function (response) {
@@ -347,7 +425,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
347
425
 
348
426
  if (response.promoted) {
349
427
  promotedResults[component] = response.promoted.map(function (promoted) {
350
- return _extends(_extends({}, promoted.doc), {}, {
428
+ return _extends({}, promoted.doc, {
351
429
  _position: promoted.position
352
430
  });
353
431
  });
@@ -357,15 +435,21 @@ function initReactivesearch(componentCollection, searchState, settings) {
357
435
 
358
436
  if (response.customData) {
359
437
  customData[component] = response.customData;
438
+ } // Update settings
439
+
440
+
441
+ if (response.settings) {
442
+ settingsResponse[component] = response.settings;
360
443
  }
361
444
 
362
445
  if (response.aggregations) {
363
446
  var _extends6;
364
447
 
365
- aggregations = _extends(_extends({}, aggregations), {}, (_extends6 = {}, _extends6[component] = response.aggregations, _extends6));
448
+ aggregations = _extends({}, aggregations, (_extends6 = {}, _extends6[component] = response.aggregations, _extends6));
366
449
  }
367
450
 
368
- hits = _extends(_extends({}, hits), {}, (_extends7 = {}, _extends7[component] = {
451
+ timestamp[component] = res._timestamp;
452
+ hits = _extends({}, hits, (_extends7 = {}, _extends7[component] = {
369
453
  hits: response.hits.hits,
370
454
  total: typeof response.hits.total === 'object' ? response.hits.total.value : response.hits.total,
371
455
  time: response.took
@@ -378,10 +462,13 @@ function initReactivesearch(componentCollection, searchState, settings) {
378
462
  });
379
463
  });
380
464
  Promise.all(allPromises).then(function () {
381
- state = _extends(_extends({}, state), {}, {
465
+ state = _extends({}, state, {
382
466
  hits: hits,
467
+ timestamp: timestamp,
383
468
  aggregations: aggregations,
469
+ compositeAggregations: compositeAggregations,
384
470
  promotedResults: promotedResults,
471
+ settings: settingsResponse,
385
472
  customData: customData,
386
473
  rawData: rawData
387
474
  });
@@ -1,39 +1,41 @@
1
1
  import '@appbaseio/reactivecore';
2
- import './_rollupPluginBabelHelpers-c9fbe19f.js';
2
+ import './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import 'vue-types';
4
4
  import '@appbaseio/reactivecore/lib/utils/constants';
5
+ import '@appbaseio/reactivecore/lib/utils/helper';
5
6
  import 'emotion';
6
7
  import '@appbaseio/vue-emotion';
7
8
  import 'polished';
8
- import './Button-6c71c66e.js';
9
- import './vueTypes-98d938a9.js';
10
- import './Pagination-800af44f.js';
9
+ import './Button-799185e2.js';
10
+ import './vueTypes-9326e0be.js';
11
+ import './Pagination-b3e4054a.js';
11
12
  import ReactiveList from './ReactiveList.js';
12
13
  import '@appbaseio/reactivecore/lib/utils/transform';
13
14
  import 'redux';
14
- import './index-1fe91a0a.js';
15
- import './ComponentWrapper-d0b21b95.js';
15
+ import './index-5daa8276.js';
16
+ import './ComponentWrapper-bbb717bc.js';
16
17
  import '@vue/babel-helper-vue-jsx-merge-props';
17
- import './Title-22c2f3bf.js';
18
- import './ListItem-da73bc7d.js';
19
- import './Card-ecf70ba1.js';
20
- import './Flex-40a74d8a.js';
21
- import '@appbaseio/reactivecore/lib/utils/helper';
18
+ import './Title-579f8d6c.js';
19
+ import './ListItem-bdb6d53d.js';
20
+ import './Card-04b3c33e.js';
21
+ import './Flex-aac91505.js';
22
22
  import '@appbaseio/reactivecore/lib/actions/analytics';
23
23
  import 'appbase-js';
24
24
  import 'url-search-params-polyfill';
25
25
  import ReactiveBase from './ReactiveBase.js';
26
- import './Input-dfd9dd40.js';
26
+ import 'hotkeys-js';
27
27
  import DataSearch from './DataSearch.js';
28
+ import './CancelSvg-4d9e0857.js';
29
+ import './Input-d8519224.js';
28
30
  import 'compute-scroll-into-view';
29
- import './DownShift-d8f2500f.js';
30
- import './Container-f5efec9e.js';
31
+ import './Container-4383c6f0.js';
31
32
  import 'vue-highlight-words';
32
- import './FormControlList-b96aebef.js';
33
- import './utils-ce3d86fd.js';
33
+ import '@appbaseio/reactivecore/lib/utils/suggestions';
34
+ import './FormControlList-fe389a2e.js';
35
+ import './utils-3a32e13f.js';
34
36
  import SingleList from './SingleList.js';
35
37
  import MultiList from './MultiList.js';
36
- import './DropDown-5dbd69c2.js';
38
+ import './DropDown-4edaa621.js';
37
39
  import SingleDropdownList from './SingleDropdownList.js';
38
40
  import MultiDropdownList from './MultiDropdownList.js';
39
41
  import ToggleButton from './ToggleButton.js';
@@ -44,7 +46,7 @@ import MultiRange from './MultiRange.js';
44
46
  import ResultCard from './ResultCard.js';
45
47
  import ResultList from './ResultList.js';
46
48
  import 'vue-no-ssr';
47
- import './ssr-2f57791d.js';
49
+ import './ssr-e3196de1.js';
48
50
  import RangeSlider from './RangeSlider.js';
49
51
  import DynamicRangeSlider from './DynamicRangeSlider.js';
50
52
  import StateProvider from './StateProvider.js';