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

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 +8107 -7501
  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 +72 -58
  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 +187 -104
  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 +72 -58
  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 +188 -105
  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,46 @@
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 = ["aggs", "size"];
18
+ var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
15
19
  var componentsWithoutFilters = [componentTypes.numberBox, componentTypes.ratingsFilter];
16
20
  var resultComponents = [componentTypes.reactiveList, componentTypes.reactiveMap];
17
21
 
18
22
  function getValue(state, id, defaultValue) {
19
- if (!state) return defaultValue;
20
-
21
- if (state[id]) {
23
+ if (state && state[id]) {
22
24
  try {
23
25
  // parsing for next.js - since it uses extra set of quotes to wrap params
24
26
  var parsedValue = JSON.parse(state[id]);
25
- return parsedValue;
27
+ return {
28
+ value: parsedValue,
29
+ reference: 'URL'
30
+ };
26
31
  } catch (error) {
27
32
  // using react-dom-server for ssr
28
- return state[id] || defaultValue;
33
+ return {
34
+ value: state[id],
35
+ reference: 'URL'
36
+ };
29
37
  }
30
38
  }
31
39
 
32
- return defaultValue;
40
+ return {
41
+ value: defaultValue,
42
+ reference: 'DEFAULT'
43
+ };
33
44
  }
34
45
 
35
46
  function parseValue(value, component) {
@@ -38,28 +49,48 @@ function parseValue(value, component) {
38
49
  }
39
50
 
40
51
  return value;
41
- }
52
+ } // Returns query DSL with query property and other options
53
+
54
+
55
+ function getDefaultQuery(component, value) {
56
+ // get custom or default query of sensor components
57
+ var currentValue = parseValue(value, component); // get default query of result components
58
+
59
+ if (component.defaultQuery) {
60
+ var defaultQuery = component.defaultQuery(currentValue, component);
61
+ return _extends({
62
+ query: extractQueryFromCustomQuery(defaultQuery)
63
+ }, getOptionsForCustomQuery(defaultQuery));
64
+ }
42
65
 
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
66
+ return component.source.defaultQuery ? {
67
+ query: component.source.defaultQuery(currentValue, component)
68
+ } : {};
69
+ } // Only results the query part
48
70
 
49
71
 
72
+ function getCustomQuery(component, value) {
73
+ // get custom or default query of sensor components
50
74
  var currentValue = parseValue(value, component);
51
75
 
52
76
  if (component.customQuery) {
53
- var customQuery = component.customQuery(currentValue, component);
54
- return customQuery && customQuery.query;
77
+ return extractQueryFromCustomQuery(component.customQuery(currentValue, component));
55
78
  }
56
79
 
57
- return component.source.defaultQuery ? component.source.defaultQuery(currentValue, component) : {};
80
+ return component.source.defaultQuery ? component.source.defaultQuery(currentValue, component) : null;
58
81
  }
59
82
 
60
83
  function initReactivesearch(componentCollection, searchState, settings) {
61
84
  return new Promise(function (resolve, reject) {
62
85
  var credentials = settings.url && settings.url.trim() !== '' && !settings.credentials ? null : settings.credentials;
86
+ var enableTelemetry = settings.appbaseConfig && settings.appbaseConfig.enableTelemetry !== undefined ? settings.appbaseConfig.enableTelemetry : true;
87
+
88
+ var headers = _extends({}, settings.enableAppbase && _extends({
89
+ 'X-Search-Client': X_SEARCH_CLIENT
90
+ }, enableTelemetry === false && {
91
+ 'X-Enable-Telemetry': false
92
+ }), settings.headers);
93
+
63
94
  var config = {
64
95
  url: settings.url && settings.url.trim() !== '' ? settings.url : 'https://scalr.api.appbase.io',
65
96
  app: settings.app,
@@ -68,7 +99,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
68
99
  type: settings.type ? settings.type : '*',
69
100
  transformResponse: settings.transformResponse || null,
70
101
  graphQLUrl: settings.graphQLUrl || '',
71
- headers: settings.headers || {},
102
+ headers: headers,
72
103
  analyticsConfig: settings.appbaseConfig || null
73
104
  };
74
105
  var appbaseRef = Appbase(config);
@@ -85,6 +116,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
85
116
  var orderOfQueries = [];
86
117
  var hits = {};
87
118
  var aggregations = {};
119
+ var compositeAggregations = {};
88
120
  var state = {};
89
121
  var customQueries = {};
90
122
  var defaultQueries = {};
@@ -99,20 +131,20 @@ function initReactivesearch(componentCollection, searchState, settings) {
99
131
  compProps[key] = component[key];
100
132
  }
101
133
  });
102
- var isInternalComponentPresent = false; // Set custom and default queries
134
+ var isInternalComponentPresent = false;
103
135
 
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);
136
+ if (component.source.hasInternalComponent) {
137
+ isInternalComponentPresent = component.source.hasInternalComponent(component);
110
138
  }
111
139
 
112
140
  var isResultComponent = resultComponents.includes(componentType);
113
141
  var internalComponent = component.componentId + "__internal";
114
142
  var label = component.filterLabel || component.componentId;
115
- var value = getValue(searchState, component.componentId, component.value || component.defaultValue); // [1] set selected values
143
+
144
+ var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue),
145
+ value = _getValue.value,
146
+ reference = _getValue.reference; // [1] set selected values
147
+
116
148
 
117
149
  var showFilter = component.showFilter !== undefined ? component.showFilter : true;
118
150
 
@@ -125,75 +157,78 @@ function initReactivesearch(componentCollection, searchState, settings) {
125
157
  component: component.componentId,
126
158
  label: label,
127
159
  value: value,
160
+ reference: reference,
128
161
  showFilter: showFilter,
129
162
  URLParams: component.URLParams || false
130
- }); // [2] set query options - main component query (valid for result components)
163
+ }); // Set custom and default queries
131
164
 
132
- if (componentsWithOptions.includes(componentType)) {
133
- var options = component.source.generateQueryOptions ? component.source.generateQueryOptions(component) : null;
134
- var highlightQuery = {};
165
+ if (component.customQuery && typeof component.customQuery === 'function') {
166
+ customQueries[component.componentId] = component.customQuery(value, compProps);
167
+ }
135
168
 
136
- if (componentsWithHighlightQuery.includes(componentType) && component.highlight) {
137
- highlightQuery = component.source.highlightQuery(component);
138
- }
169
+ if (component.defaultQuery && typeof component.defaultQuery === 'function') {
170
+ defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
171
+ }
139
172
 
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
173
+ var componentQueryOptions = {}; // [2] set query options - main component query (valid for result components)
160
174
 
175
+ if (component && component.source.generateQueryOptions) {
176
+ componentQueryOptions = _extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
177
+ }
161
178
 
162
- if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
163
- if (!otherQueryOptions) otherQueryOptions = {};
164
- if (!highlightQuery) highlightQuery = {};
179
+ console.log('QUERY LOG componentQueryOptions', component.componentId, componentQueryOptions);
180
+ var highlightQuery = {};
165
181
 
166
- var mainQueryOptions = _extends(_extends(_extends({}, otherQueryOptions), highlightQuery), {}, {
167
- size: size
168
- });
182
+ if (component.source.highlightQuery) {
183
+ highlightQuery = component.source.highlightQuery(component);
184
+ }
169
185
 
170
- if (isInternalComponentPresent) {
171
- mainQueryOptions = _extends(_extends({}, otherQueryOptions), highlightQuery);
172
- }
186
+ if (componentQueryOptions && Object.keys(componentQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
187
+ // eslint-disable-next-line
188
+ var _ref = componentQueryOptions || {},
189
+ aggs = _ref.aggs,
190
+ size = _ref.size,
191
+ otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
192
+
193
+ if (aggs && Object.keys(aggs).length) {
194
+ isInternalComponentPresent = true;
195
+ componentQueryOptions = _extends({}, componentQueryOptions, {
196
+ aggs: aggs,
197
+ size: typeof size === 'undefined' ? 100 : size
198
+ });
199
+ } // sort, highlight, size, from - query should be applied on the main component
173
200
 
174
- if (isResultComponent) {
175
- var currentPage = component.currentPage ? component.currentPage - 1 : 0;
176
201
 
177
- if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
178
- currentPage = selectedValues[component.componentId].value - 1 || 0;
179
- }
202
+ if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
203
+ if (!otherQueryOptions) otherQueryOptions = {};
204
+ if (!highlightQuery) highlightQuery = {};
180
205
 
181
- var resultSize = component.size || 10;
182
- var from = currentPage * resultSize; // Update props for RS API
206
+ var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
207
+ size: size
208
+ });
183
209
 
184
- compProps.from = from;
185
- mainQueryOptions = _extends(_extends(_extends({}, mainQueryOptions), highlightQuery), {}, {
186
- size: resultSize,
187
- from: from
188
- });
210
+ if (isInternalComponentPresent) {
211
+ mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
212
+ }
213
+
214
+ if (isResultComponent) {
215
+ var currentPage = component.currentPage ? component.currentPage - 1 : 0;
216
+
217
+ if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
218
+ currentPage = selectedValues[component.componentId].value - 1 || 0;
189
219
  }
190
220
 
191
- queryOptions = queryOptionsReducer(queryOptions, {
192
- type: 'SET_QUERY_OPTIONS',
193
- component: component.componentId,
194
- options: _extends({}, mainQueryOptions)
221
+ var resultSize = component.size || 10;
222
+ var from = currentPage * resultSize; // Update props for RS API
223
+
224
+ compProps.from = from;
225
+ mainQueryOptions = _extends({}, mainQueryOptions, highlightQuery, {
226
+ size: resultSize,
227
+ from: from
195
228
  });
196
229
  }
230
+
231
+ componentQueryOptions = _extends({}, componentQueryOptions, mainQueryOptions);
197
232
  }
198
233
  } // [3] set dependency tree
199
234
 
@@ -211,25 +246,38 @@ function initReactivesearch(componentCollection, searchState, settings) {
211
246
  react: react
212
247
  });
213
248
  } // [4] set query list
249
+ // Do not set default query for suggestions
214
250
 
215
251
 
216
- if (isResultComponent) {
217
- var _getQuery = getQuery(component, null, componentType),
218
- query = _getQuery.query;
252
+ if (isInternalComponentPresent && !isSearchComponent(component.componentType)) {
253
+ var _ref2 = getDefaultQuery(component, value) || {},
254
+ defaultQuery = _ref2.query,
255
+ defaultQueryOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
219
256
 
220
257
  queryList = queryReducer(queryList, {
221
258
  type: 'SET_QUERY',
222
259
  component: internalComponent,
223
- query: query
260
+ query: defaultQuery
224
261
  });
225
- } else {
226
- queryList = queryReducer(queryList, {
227
- type: 'SET_QUERY',
228
- component: component.componentId,
229
- query: getQuery(component, value, componentType)
262
+ queryOptions = queryOptionsReducer(queryOptions, {
263
+ type: 'SET_QUERY_OPTIONS',
264
+ component: internalComponent,
265
+ options: _extends({}, componentQueryOptions, defaultQueryOptions)
230
266
  });
231
- } // Set component type in component props
267
+ }
232
268
 
269
+ var customQuery = getCustomQuery(component, value); // set custom query for main component
270
+
271
+ queryList = queryReducer(queryList, {
272
+ type: 'SET_QUERY',
273
+ component: component.componentId,
274
+ query: customQuery
275
+ });
276
+ queryOptions = queryOptionsReducer(queryOptions, {
277
+ type: 'SET_QUERY_OPTIONS',
278
+ component: component.componentId,
279
+ options: _extends({}, componentQueryOptions)
280
+ }); // Set component type in component props
233
281
 
234
282
  compProps.componentType = componentType;
235
283
  componentProps[component.componentId] = compProps;
@@ -252,9 +300,23 @@ function initReactivesearch(componentCollection, searchState, settings) {
252
300
  queryObj = _buildQuery.queryObj,
253
301
  options = _buildQuery.options;
254
302
 
255
- var validOptions = ['aggs', 'from', 'sort']; // check if query or options are valid - non-empty
303
+ var componentQueryOptions = options;
304
+ var componentType = component.source.componentType;
305
+ console.log('COMPONENT TYPE', componentType);
306
+
307
+ if (componentType !== componentTypes.reactiveComponent) {
308
+ // don't merge aggs, size
309
+ var _ref3 = options || {},
310
+ aggs = _ref3.aggs,
311
+ size = _ref3.size,
312
+ rest = _objectWithoutPropertiesLoose(_ref3, _excluded3);
256
313
 
257
- if (queryObj && !!Object.keys(queryObj).length || options && Object.keys(options).some(function (item) {
314
+ componentQueryOptions = rest;
315
+ }
316
+
317
+ var validOptions = ['aggs', 'from', 'sort']; // check if query or componentQueryOptions are valid - non-empty
318
+
319
+ if (queryObj && !!Object.keys(queryObj).length || componentQueryOptions && Object.keys(componentQueryOptions).some(function (item) {
258
320
  return validOptions.includes(item);
259
321
  })) {
260
322
  var _extends2;
@@ -267,11 +329,15 @@ function initReactivesearch(componentCollection, searchState, settings) {
267
329
 
268
330
  orderOfQueries = [].concat(orderOfQueries, [component.componentId]);
269
331
 
270
- var currentQuery = _extends(_extends({
332
+ var currentQuery = _extends({
271
333
  query: _extends({}, queryObj)
272
- }, options), queryOptions[component.componentId]);
334
+ }, componentQueryOptions, queryOptions[component.componentId]);
273
335
 
274
- queryLog = _extends(_extends({}, queryLog), {}, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
336
+ console.log('QUERY LOG build QUERY', component.componentId, queryObj);
337
+ console.log('QUERY LOG build OPTIONS', component.componentId, componentQueryOptions);
338
+ console.log('QUERY LOG OPTIONS (component)', component.componentId, queryOptions[component.componentId]);
339
+ console.log('QUERY LOG', component.componentId, currentQuery);
340
+ queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
275
341
 
276
342
  if (settings.enableAppbase) {
277
343
  var query = getRSQuery(component.componentId, extractPropsFromState(state, component.componentId, queryOptions && queryOptions[component.componentId] ? {
@@ -282,11 +348,12 @@ function initReactivesearch(componentCollection, searchState, settings) {
282
348
  var _extends3;
283
349
 
284
350
  // Apply dependent queries
285
- appbaseQuery = _extends(_extends(_extends({}, appbaseQuery), (_extends3 = {}, _extends3[component.componentId] = query, _extends3)), getDependentQueries(state, component.componentId, orderOfQueries));
351
+ appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), getDependentQueries(state, component.componentId, orderOfQueries));
286
352
  }
287
353
  } else {
354
+ var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
288
355
  finalQuery = [].concat(finalQuery, [{
289
- preference: component.componentId
356
+ preference: preference
290
357
  }, currentQuery]);
291
358
  }
292
359
  }
@@ -312,10 +379,15 @@ function initReactivesearch(componentCollection, searchState, settings) {
312
379
  if (response.aggregations) {
313
380
  var _extends4;
314
381
 
315
- aggregations = _extends(_extends({}, aggregations), {}, (_extends4 = {}, _extends4[component] = response.aggregations, _extends4));
382
+ aggregations = _extends({}, aggregations, (_extends4 = {}, _extends4[component] = response.aggregations, _extends4));
383
+ compositeAggregations = compositeAggsReducer(compositeAggregations, {
384
+ type: UPDATE_COMPOSITE_AGGS,
385
+ aggregations: response.aggregations,
386
+ append: false
387
+ });
316
388
  }
317
389
 
318
- hits = _extends(_extends({}, hits), {}, (_extends5 = {}, _extends5[component] = {
390
+ hits = _extends({}, hits, (_extends5 = {}, _extends5[component] = {
319
391
  hits: response.hits.hits,
320
392
  total: typeof response.hits.total === 'object' ? response.hits.total.value : response.hits.total,
321
393
  time: response.took
@@ -327,7 +399,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
327
399
  });
328
400
  });
329
401
  Promise.all(allPromises).then(function () {
330
- state = _extends(_extends({}, state), {}, {
402
+ state = _extends({}, state, {
331
403
  hits: hits,
332
404
  aggregations: aggregations
333
405
  });
@@ -339,6 +411,8 @@ function initReactivesearch(componentCollection, searchState, settings) {
339
411
  var promotedResults = {};
340
412
  var rawData = {};
341
413
  var customData = {};
414
+ var settingsResponse = {};
415
+ var timestamp = {};
342
416
  var allPromises = orderOfQueries.map(function (component) {
343
417
  return new Promise(function (responseResolve, responseReject) {
344
418
  handleTransformResponse(res[component], component).then(function (response) {
@@ -347,7 +421,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
347
421
 
348
422
  if (response.promoted) {
349
423
  promotedResults[component] = response.promoted.map(function (promoted) {
350
- return _extends(_extends({}, promoted.doc), {}, {
424
+ return _extends({}, promoted.doc, {
351
425
  _position: promoted.position
352
426
  });
353
427
  });
@@ -357,15 +431,21 @@ function initReactivesearch(componentCollection, searchState, settings) {
357
431
 
358
432
  if (response.customData) {
359
433
  customData[component] = response.customData;
434
+ } // Update settings
435
+
436
+
437
+ if (response.settings) {
438
+ settingsResponse[component] = response.settings;
360
439
  }
361
440
 
362
441
  if (response.aggregations) {
363
442
  var _extends6;
364
443
 
365
- aggregations = _extends(_extends({}, aggregations), {}, (_extends6 = {}, _extends6[component] = response.aggregations, _extends6));
444
+ aggregations = _extends({}, aggregations, (_extends6 = {}, _extends6[component] = response.aggregations, _extends6));
366
445
  }
367
446
 
368
- hits = _extends(_extends({}, hits), {}, (_extends7 = {}, _extends7[component] = {
447
+ timestamp[component] = res._timestamp;
448
+ hits = _extends({}, hits, (_extends7 = {}, _extends7[component] = {
369
449
  hits: response.hits.hits,
370
450
  total: typeof response.hits.total === 'object' ? response.hits.total.value : response.hits.total,
371
451
  time: response.took
@@ -378,10 +458,13 @@ function initReactivesearch(componentCollection, searchState, settings) {
378
458
  });
379
459
  });
380
460
  Promise.all(allPromises).then(function () {
381
- state = _extends(_extends({}, state), {}, {
461
+ state = _extends({}, state, {
382
462
  hits: hits,
463
+ timestamp: timestamp,
383
464
  aggregations: aggregations,
465
+ compositeAggregations: compositeAggregations,
384
466
  promotedResults: promotedResults,
467
+ settings: settingsResponse,
385
468
  customData: customData,
386
469
  rawData: rawData
387
470
  });
@@ -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';