@appbaseio/reactivesearch-vue 1.16.0-alpha.6 → 1.16.0-alpha.62
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.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +16030 -13113
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/Button-446f819e.js +68 -0
- package/dist/cjs/{DownShift-966a58cb.js → CancelSvg-9f258f4f.js} +60 -16
- package/dist/cjs/Card-642547a8.js +30 -0
- package/dist/cjs/{ComponentWrapper-603848ed.js → ComponentWrapper-ad3dad02.js} +40 -21
- package/dist/cjs/{Container-6cdd3864.js → Container-daf30918.js} +3 -11
- package/dist/cjs/DataSearch-86914b10.js +2322 -0
- package/dist/cjs/DataSearch.js +18 -2151
- package/dist/cjs/{DropDown-f6224ac8.js → DropDown-5513ea77.js} +80 -95
- package/dist/cjs/DynamicRangeSlider.js +107 -43
- package/dist/cjs/Flex-aa517a13.js +52 -0
- package/dist/cjs/FormControlList-c195a592.js +47 -0
- package/dist/cjs/Input-e6603a7e.js +79 -0
- package/dist/cjs/ListItem-8c9e0d68.js +46 -0
- package/dist/cjs/MultiDropdownList.js +102 -68
- package/dist/cjs/MultiList.js +80 -50
- package/dist/cjs/MultiRange.js +21 -16
- package/dist/cjs/{Pagination-af399262.js → Pagination-fe5452fc.js} +14 -8
- package/dist/cjs/RangeInput.js +29 -45
- package/dist/cjs/RangeSlider.js +32 -30
- package/dist/cjs/ReactiveBase.js +87 -56
- package/dist/cjs/ReactiveComponent.js +75 -62
- package/dist/cjs/ReactiveGoogleMap.js +262 -191
- package/dist/cjs/ReactiveList.js +189 -241
- package/dist/cjs/ResultCard.js +8 -6
- package/dist/cjs/ResultList.js +8 -6
- package/dist/cjs/SelectedFilters.js +66 -34
- package/dist/cjs/SingleDropdownList.js +88 -60
- package/dist/cjs/SingleList.js +53 -35
- package/dist/cjs/SingleRange.js +19 -14
- package/dist/cjs/StateProvider.js +39 -10
- package/dist/cjs/{Title-65d39104.js → Title-1de7d0f4.js} +3 -11
- package/dist/cjs/ToggleButton.js +36 -16
- package/dist/cjs/{_rollupPluginBabelHelpers-4abdbfff.js → _rollupPluginBabelHelpers-c705cbe6.js} +2 -4
- package/dist/cjs/{index-baca18c4.js → index-6a167fe0.js} +99 -13
- package/dist/cjs/index.js +31 -25
- package/dist/cjs/initReactivesearch.js +178 -104
- package/dist/cjs/install-004c6aa4.js +1408 -0
- package/dist/cjs/install.js +42 -44
- package/dist/cjs/ssr-3027b848.js +39 -0
- package/dist/cjs/{utils-ea846a20.js → utils-d6a52588.js} +2 -2
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-6de9d2a9.js} +9 -4
- package/dist/es/Button-d8bc15ea.js +59 -0
- package/dist/es/{DownShift-92347b5e.js → CancelSvg-4cfae5fd.js} +56 -17
- package/dist/es/Card-450683f1.js +23 -0
- package/dist/es/{ComponentWrapper-c4c91949.js → ComponentWrapper-424e86fd.js} +40 -21
- package/dist/es/Container-ba826e96.js +10 -0
- package/dist/es/DataSearch-e71a1014.js +2307 -0
- package/dist/es/DataSearch.js +17 -2150
- package/dist/es/{DropDown-3d4291f1.js → DropDown-7d9a15c1.js} +79 -94
- package/dist/es/DynamicRangeSlider.js +107 -43
- package/dist/es/Flex-1f0795c3.js +47 -0
- package/dist/es/FormControlList-c22d64f6.js +40 -0
- package/dist/es/Input-7a2a9fac.js +71 -0
- package/dist/es/ListItem-cad14c5e.js +39 -0
- package/dist/es/MultiDropdownList.js +102 -68
- package/dist/es/MultiList.js +80 -50
- package/dist/es/MultiRange.js +21 -16
- package/dist/es/{Pagination-c2a00175.js → Pagination-3f350098.js} +14 -8
- package/dist/es/RangeInput.js +29 -45
- package/dist/es/RangeSlider.js +32 -30
- package/dist/es/ReactiveBase.js +87 -56
- package/dist/es/ReactiveComponent.js +75 -62
- package/dist/es/ReactiveGoogleMap.js +262 -191
- package/dist/es/ReactiveList.js +189 -241
- package/dist/es/ResultCard.js +8 -6
- package/dist/es/ResultList.js +8 -6
- package/dist/es/SelectedFilters.js +66 -34
- package/dist/es/SingleDropdownList.js +88 -60
- package/dist/es/SingleList.js +53 -35
- package/dist/es/SingleRange.js +19 -14
- package/dist/es/StateProvider.js +39 -10
- package/dist/es/Title-3342664a.js +10 -0
- package/dist/es/ToggleButton.js +36 -16
- package/dist/es/{_rollupPluginBabelHelpers-ecf6c03c.js → _rollupPluginBabelHelpers-76660dab.js} +2 -4
- package/dist/es/{index-185b6266.js → index-7788a843.js} +95 -14
- package/dist/es/index.js +27 -22
- package/dist/es/initReactivesearch.js +179 -105
- package/dist/es/install-b7b604cc.js +1401 -0
- package/dist/es/install.js +40 -46
- package/dist/es/ssr-b2c0b401.js +33 -0
- package/dist/es/{utils-57cc8789.js → utils-9e68acee.js} +2 -2
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-98d938a9.js → vueTypes-9326e0be.js} +9 -4
- package/package.json +6 -4
- package/dist/cjs/Button-d48d4365.js +0 -146
- package/dist/cjs/Card-9748fbb2.js +0 -58
- package/dist/cjs/Flex-befd65fc.js +0 -160
- package/dist/cjs/FormControlList-f3857d4b.js +0 -105
- package/dist/cjs/Input-95cb19f8.js +0 -178
- package/dist/cjs/ListItem-84d185cf.js +0 -84
- package/dist/cjs/ssr-3ca8a14f.js +0 -47
- package/dist/es/Button-27cc8574.js +0 -137
- package/dist/es/Card-1f93780d.js +0 -51
- package/dist/es/Container-88c805ef.js +0 -18
- package/dist/es/Flex-16d1103a.js +0 -155
- package/dist/es/FormControlList-96d44e7b.js +0 -98
- package/dist/es/Input-1159c4b5.js +0 -170
- package/dist/es/ListItem-d22510c9.js +0 -77
- package/dist/es/Title-f0217338.js +0 -18
- package/dist/es/ssr-a710392b.js +0 -41
|
@@ -4,38 +4,49 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
|
-
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-
|
|
7
|
+
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
|
|
8
8
|
var constants = require('@appbaseio/reactivecore/lib/utils/constants');
|
|
9
|
-
var transform = require('@appbaseio/reactivecore/lib/utils/transform');
|
|
10
9
|
var helper = require('@appbaseio/reactivecore/lib/utils/helper');
|
|
10
|
+
var transform = require('@appbaseio/reactivecore/lib/utils/transform');
|
|
11
11
|
var Appbase = _interopDefault(require('appbase-js'));
|
|
12
12
|
var valueReducer = _interopDefault(require('@appbaseio/reactivecore/lib/reducers/valueReducer'));
|
|
13
13
|
var queryReducer = _interopDefault(require('@appbaseio/reactivecore/lib/reducers/queryReducer'));
|
|
14
14
|
var queryOptionsReducer = _interopDefault(require('@appbaseio/reactivecore/lib/reducers/queryOptionsReducer'));
|
|
15
|
+
var compositeAggsReducer = _interopDefault(require('@appbaseio/reactivecore/lib/reducers/compositeAggsReducer'));
|
|
16
|
+
var constants$1 = require('@appbaseio/reactivecore/lib/constants');
|
|
15
17
|
var dependencyTreeReducer = _interopDefault(require('@appbaseio/reactivecore/lib/reducers/dependencyTreeReducer'));
|
|
16
18
|
var fetchGraphQL = _interopDefault(require('@appbaseio/reactivecore/lib/utils/graphQL'));
|
|
17
19
|
var utils = require('@appbaseio/reactivecore/lib/actions/utils');
|
|
18
20
|
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
+
var _excluded = ["aggs", "size"],
|
|
22
|
+
_excluded2 = ["query"],
|
|
23
|
+
_excluded3 = ["query"];
|
|
24
|
+
var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
|
|
21
25
|
var componentsWithoutFilters = [constants.componentTypes.numberBox, constants.componentTypes.ratingsFilter];
|
|
22
26
|
var resultComponents = [constants.componentTypes.reactiveList, constants.componentTypes.reactiveMap];
|
|
23
27
|
|
|
24
28
|
function getValue(state, id, defaultValue) {
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
if (state[id]) {
|
|
29
|
+
if (state && state[id]) {
|
|
28
30
|
try {
|
|
29
31
|
// parsing for next.js - since it uses extra set of quotes to wrap params
|
|
30
32
|
var parsedValue = JSON.parse(state[id]);
|
|
31
|
-
return
|
|
33
|
+
return {
|
|
34
|
+
value: parsedValue,
|
|
35
|
+
reference: 'URL'
|
|
36
|
+
};
|
|
32
37
|
} catch (error) {
|
|
33
38
|
// using react-dom-server for ssr
|
|
34
|
-
return
|
|
39
|
+
return {
|
|
40
|
+
value: state[id],
|
|
41
|
+
reference: 'URL'
|
|
42
|
+
};
|
|
35
43
|
}
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
return
|
|
46
|
+
return {
|
|
47
|
+
value: defaultValue,
|
|
48
|
+
reference: 'DEFAULT'
|
|
49
|
+
};
|
|
39
50
|
}
|
|
40
51
|
|
|
41
52
|
function parseValue(value, component) {
|
|
@@ -44,28 +55,53 @@ function parseValue(value, component) {
|
|
|
44
55
|
}
|
|
45
56
|
|
|
46
57
|
return value;
|
|
47
|
-
}
|
|
58
|
+
} // Returns query DSL with query property and other options
|
|
48
59
|
|
|
49
|
-
function getQuery(component, value, componentType) {
|
|
50
|
-
// get default query of result components
|
|
51
|
-
if (resultComponents.includes(componentType)) {
|
|
52
|
-
return component.defaultQuery ? component.defaultQuery() : {};
|
|
53
|
-
} // get custom or default query of sensor components
|
|
54
60
|
|
|
61
|
+
function getDefaultQuery(component, value) {
|
|
62
|
+
// get custom or default query of sensor components
|
|
63
|
+
var currentValue = parseValue(value, component); // get default query of result components
|
|
55
64
|
|
|
65
|
+
if (component.defaultQuery) {
|
|
66
|
+
var defaultQuery = component.defaultQuery(currentValue, component);
|
|
67
|
+
return _rollupPluginBabelHelpers._extends({
|
|
68
|
+
query: helper.extractQueryFromCustomQuery(defaultQuery)
|
|
69
|
+
}, helper.getOptionsForCustomQuery(defaultQuery));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return component.source.defaultQuery ? {
|
|
73
|
+
query: component.source.defaultQuery(currentValue, component)
|
|
74
|
+
} : {};
|
|
75
|
+
} // Only results the query part
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
function getCustomQuery(component, value) {
|
|
79
|
+
// get custom or default query of sensor components
|
|
56
80
|
var currentValue = parseValue(value, component);
|
|
57
81
|
|
|
58
82
|
if (component.customQuery) {
|
|
59
83
|
var customQuery = component.customQuery(currentValue, component);
|
|
60
|
-
return
|
|
84
|
+
return _rollupPluginBabelHelpers._extends({
|
|
85
|
+
query: helper.extractQueryFromCustomQuery(customQuery)
|
|
86
|
+
}, helper.getOptionsForCustomQuery(customQuery));
|
|
61
87
|
}
|
|
62
88
|
|
|
63
|
-
return component.source.defaultQuery ?
|
|
89
|
+
return component.source.defaultQuery ? {
|
|
90
|
+
query: component.source.defaultQuery(currentValue, component)
|
|
91
|
+
} : null;
|
|
64
92
|
}
|
|
65
93
|
|
|
66
94
|
function initReactivesearch(componentCollection, searchState, settings) {
|
|
67
95
|
return new Promise(function (resolve, reject) {
|
|
68
96
|
var credentials = settings.url && settings.url.trim() !== '' && !settings.credentials ? null : settings.credentials;
|
|
97
|
+
var enableTelemetry = settings.appbaseConfig && settings.appbaseConfig.enableTelemetry !== undefined ? settings.appbaseConfig.enableTelemetry : true;
|
|
98
|
+
|
|
99
|
+
var headers = _rollupPluginBabelHelpers._extends({}, settings.enableAppbase && _rollupPluginBabelHelpers._extends({
|
|
100
|
+
'X-Search-Client': X_SEARCH_CLIENT
|
|
101
|
+
}, enableTelemetry === false && {
|
|
102
|
+
'X-Enable-Telemetry': false
|
|
103
|
+
}), settings.headers);
|
|
104
|
+
|
|
69
105
|
var config = {
|
|
70
106
|
url: settings.url && settings.url.trim() !== '' ? settings.url : 'https://scalr.api.appbase.io',
|
|
71
107
|
app: settings.app,
|
|
@@ -74,7 +110,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
74
110
|
type: settings.type ? settings.type : '*',
|
|
75
111
|
transformResponse: settings.transformResponse || null,
|
|
76
112
|
graphQLUrl: settings.graphQLUrl || '',
|
|
77
|
-
headers:
|
|
113
|
+
headers: headers,
|
|
78
114
|
analyticsConfig: settings.appbaseConfig || null
|
|
79
115
|
};
|
|
80
116
|
var appbaseRef = Appbase(config);
|
|
@@ -91,6 +127,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
91
127
|
var orderOfQueries = [];
|
|
92
128
|
var hits = {};
|
|
93
129
|
var aggregations = {};
|
|
130
|
+
var compositeAggregations = {};
|
|
94
131
|
var state = {};
|
|
95
132
|
var customQueries = {};
|
|
96
133
|
var defaultQueries = {};
|
|
@@ -105,20 +142,20 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
105
142
|
compProps[key] = component[key];
|
|
106
143
|
}
|
|
107
144
|
});
|
|
108
|
-
var isInternalComponentPresent = false;
|
|
109
|
-
|
|
110
|
-
if (component.customQuery && typeof component.customQuery === 'function') {
|
|
111
|
-
customQueries[component.componentId] = component.customQuery(component.value, compProps);
|
|
112
|
-
}
|
|
145
|
+
var isInternalComponentPresent = false;
|
|
113
146
|
|
|
114
|
-
if (component.
|
|
115
|
-
|
|
147
|
+
if (component.source.hasInternalComponent) {
|
|
148
|
+
isInternalComponentPresent = component.source.hasInternalComponent(component);
|
|
116
149
|
}
|
|
117
150
|
|
|
118
151
|
var isResultComponent = resultComponents.includes(componentType);
|
|
119
152
|
var internalComponent = component.componentId + "__internal";
|
|
120
153
|
var label = component.filterLabel || component.componentId;
|
|
121
|
-
|
|
154
|
+
|
|
155
|
+
var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue),
|
|
156
|
+
value = _getValue.value,
|
|
157
|
+
reference = _getValue.reference; // [1] set selected values
|
|
158
|
+
|
|
122
159
|
|
|
123
160
|
var showFilter = component.showFilter !== undefined ? component.showFilter : true;
|
|
124
161
|
|
|
@@ -131,75 +168,77 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
131
168
|
component: component.componentId,
|
|
132
169
|
label: label,
|
|
133
170
|
value: value,
|
|
171
|
+
reference: reference,
|
|
134
172
|
showFilter: showFilter,
|
|
135
173
|
URLParams: component.URLParams || false
|
|
136
|
-
}); //
|
|
174
|
+
}); // Set custom and default queries
|
|
137
175
|
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
176
|
+
if (component.customQuery && typeof component.customQuery === 'function') {
|
|
177
|
+
customQueries[component.componentId] = component.customQuery(value, compProps);
|
|
178
|
+
}
|
|
141
179
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
180
|
+
if (component.defaultQuery && typeof component.defaultQuery === 'function') {
|
|
181
|
+
defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
|
|
182
|
+
}
|
|
145
183
|
|
|
146
|
-
|
|
147
|
-
// eslint-disable-next-line
|
|
148
|
-
var _ref = options || {},
|
|
149
|
-
aggs = _ref.aggs,
|
|
150
|
-
size = _ref.size,
|
|
151
|
-
otherQueryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, ["aggs", "size"]);
|
|
152
|
-
|
|
153
|
-
if (aggs && Object.keys(aggs).length) {
|
|
154
|
-
isInternalComponentPresent = true; // query should be applied on the internal component
|
|
155
|
-
// to enable feeding the data to parent component
|
|
156
|
-
|
|
157
|
-
queryOptions = queryOptionsReducer(queryOptions, {
|
|
158
|
-
type: 'SET_QUERY_OPTIONS',
|
|
159
|
-
component: internalComponent,
|
|
160
|
-
options: {
|
|
161
|
-
aggs: aggs,
|
|
162
|
-
size: typeof size === 'undefined' ? 100 : size
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
} // sort, highlight, size, from - query should be applied on the main component
|
|
184
|
+
var componentQueryOptions = {}; // [2] set query options - main component query (valid for result components)
|
|
166
185
|
|
|
186
|
+
if (component && component.source.generateQueryOptions) {
|
|
187
|
+
componentQueryOptions = _rollupPluginBabelHelpers._extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
|
|
188
|
+
}
|
|
167
189
|
|
|
168
|
-
|
|
169
|
-
if (!otherQueryOptions) otherQueryOptions = {};
|
|
170
|
-
if (!highlightQuery) highlightQuery = {};
|
|
190
|
+
var highlightQuery = {};
|
|
171
191
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
192
|
+
if (component.source.highlightQuery) {
|
|
193
|
+
highlightQuery = component.source.highlightQuery(component);
|
|
194
|
+
}
|
|
175
195
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
196
|
+
if (componentQueryOptions && Object.keys(componentQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
|
|
197
|
+
// eslint-disable-next-line
|
|
198
|
+
var _ref = componentQueryOptions || {},
|
|
199
|
+
aggs = _ref.aggs,
|
|
200
|
+
size = _ref.size,
|
|
201
|
+
otherQueryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref, _excluded);
|
|
202
|
+
|
|
203
|
+
if (aggs && Object.keys(aggs).length) {
|
|
204
|
+
isInternalComponentPresent = true;
|
|
205
|
+
componentQueryOptions = _rollupPluginBabelHelpers._extends({}, componentQueryOptions, {
|
|
206
|
+
aggs: aggs,
|
|
207
|
+
size: typeof size === 'undefined' ? 100 : size
|
|
208
|
+
});
|
|
209
|
+
} // sort, highlight, size, from - query should be applied on the main component
|
|
179
210
|
|
|
180
|
-
if (isResultComponent) {
|
|
181
|
-
var currentPage = component.currentPage ? component.currentPage - 1 : 0;
|
|
182
211
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
212
|
+
if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
|
|
213
|
+
if (!otherQueryOptions) otherQueryOptions = {};
|
|
214
|
+
if (!highlightQuery) highlightQuery = {};
|
|
186
215
|
|
|
187
|
-
|
|
188
|
-
|
|
216
|
+
var mainQueryOptions = _rollupPluginBabelHelpers._extends({}, otherQueryOptions, highlightQuery, {
|
|
217
|
+
size: size
|
|
218
|
+
});
|
|
189
219
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
220
|
+
if (isInternalComponentPresent) {
|
|
221
|
+
mainQueryOptions = _rollupPluginBabelHelpers._extends({}, otherQueryOptions, highlightQuery);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (isResultComponent) {
|
|
225
|
+
var currentPage = component.currentPage ? component.currentPage - 1 : 0;
|
|
226
|
+
|
|
227
|
+
if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
|
|
228
|
+
currentPage = selectedValues[component.componentId].value - 1 || 0;
|
|
195
229
|
}
|
|
196
230
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
231
|
+
var resultSize = component.size || 10;
|
|
232
|
+
var from = currentPage * resultSize; // Update props for RS API
|
|
233
|
+
|
|
234
|
+
compProps.from = from;
|
|
235
|
+
mainQueryOptions = _rollupPluginBabelHelpers._extends({}, mainQueryOptions, highlightQuery, {
|
|
236
|
+
size: resultSize,
|
|
237
|
+
from: from
|
|
201
238
|
});
|
|
202
239
|
}
|
|
240
|
+
|
|
241
|
+
componentQueryOptions = _rollupPluginBabelHelpers._extends({}, componentQueryOptions, mainQueryOptions);
|
|
203
242
|
}
|
|
204
243
|
} // [3] set dependency tree
|
|
205
244
|
|
|
@@ -217,25 +256,42 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
217
256
|
react: react
|
|
218
257
|
});
|
|
219
258
|
} // [4] set query list
|
|
259
|
+
// Do not set default query for suggestions
|
|
220
260
|
|
|
221
261
|
|
|
222
|
-
if (
|
|
223
|
-
var
|
|
224
|
-
|
|
262
|
+
if (isInternalComponentPresent && !transform.isSearchComponent(component.componentType)) {
|
|
263
|
+
var _ref2 = getDefaultQuery(component, value) || {},
|
|
264
|
+
defaultQuery = _ref2.query,
|
|
265
|
+
defaultQueryOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
225
266
|
|
|
226
267
|
queryList = queryReducer(queryList, {
|
|
227
268
|
type: 'SET_QUERY',
|
|
228
269
|
component: internalComponent,
|
|
229
|
-
query:
|
|
270
|
+
query: defaultQuery
|
|
230
271
|
});
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
query: getQuery(component, value, componentType)
|
|
272
|
+
queryOptions = queryOptionsReducer(queryOptions, {
|
|
273
|
+
type: 'SET_QUERY_OPTIONS',
|
|
274
|
+
component: internalComponent,
|
|
275
|
+
options: _rollupPluginBabelHelpers._extends({}, componentQueryOptions, defaultQueryOptions)
|
|
236
276
|
});
|
|
237
|
-
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
var _ref3 = getCustomQuery(component, value) || {},
|
|
280
|
+
query = _ref3.query,
|
|
281
|
+
options = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
282
|
+
|
|
283
|
+
var customQuery = query; // set custom query for main component
|
|
238
284
|
|
|
285
|
+
queryList = queryReducer(queryList, {
|
|
286
|
+
type: 'SET_QUERY',
|
|
287
|
+
component: component.componentId,
|
|
288
|
+
query: customQuery
|
|
289
|
+
});
|
|
290
|
+
queryOptions = queryOptionsReducer(queryOptions, {
|
|
291
|
+
type: 'SET_QUERY_OPTIONS',
|
|
292
|
+
component: component.componentId,
|
|
293
|
+
options: _rollupPluginBabelHelpers._extends({}, options)
|
|
294
|
+
}); // Set component type in component props
|
|
239
295
|
|
|
240
296
|
compProps.componentType = componentType;
|
|
241
297
|
componentProps[component.componentId] = compProps;
|
|
@@ -258,9 +314,10 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
258
314
|
queryObj = _buildQuery.queryObj,
|
|
259
315
|
options = _buildQuery.options;
|
|
260
316
|
|
|
261
|
-
var
|
|
317
|
+
var componentQueryOptions = options;
|
|
318
|
+
var validOptions = ['aggs', 'from', 'sort']; // check if query or componentQueryOptions are valid - non-empty
|
|
262
319
|
|
|
263
|
-
if (queryObj && !!Object.keys(queryObj).length ||
|
|
320
|
+
if (queryObj && !!Object.keys(queryObj).length || componentQueryOptions && Object.keys(componentQueryOptions).some(function (item) {
|
|
264
321
|
return validOptions.includes(item);
|
|
265
322
|
})) {
|
|
266
323
|
var _extends2;
|
|
@@ -273,14 +330,14 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
273
330
|
|
|
274
331
|
orderOfQueries = [].concat(orderOfQueries, [component.componentId]);
|
|
275
332
|
|
|
276
|
-
var currentQuery = _rollupPluginBabelHelpers._extends(
|
|
333
|
+
var currentQuery = _rollupPluginBabelHelpers._extends({
|
|
277
334
|
query: _rollupPluginBabelHelpers._extends({}, queryObj)
|
|
278
|
-
},
|
|
335
|
+
}, componentQueryOptions, queryOptions[component.componentId]);
|
|
279
336
|
|
|
280
|
-
queryLog = _rollupPluginBabelHelpers._extends(
|
|
337
|
+
queryLog = _rollupPluginBabelHelpers._extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
|
|
281
338
|
|
|
282
339
|
if (settings.enableAppbase) {
|
|
283
|
-
var query = transform.getRSQuery(component.componentId, transform.extractPropsFromState(state, component.componentId, queryOptions && queryOptions[component.componentId] ? {
|
|
340
|
+
var query = transform.getRSQuery(component.componentId, transform.extractPropsFromState(state, component.componentId, queryOptions && Object.keys(queryOptions[component.componentId]).length ? {
|
|
284
341
|
from: queryOptions[component.componentId].from
|
|
285
342
|
} : null));
|
|
286
343
|
|
|
@@ -288,11 +345,12 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
288
345
|
var _extends3;
|
|
289
346
|
|
|
290
347
|
// Apply dependent queries
|
|
291
|
-
appbaseQuery = _rollupPluginBabelHelpers._extends(
|
|
348
|
+
appbaseQuery = _rollupPluginBabelHelpers._extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), transform.getDependentQueries(state, component.componentId, orderOfQueries));
|
|
292
349
|
}
|
|
293
350
|
} else {
|
|
351
|
+
var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
|
|
294
352
|
finalQuery = [].concat(finalQuery, [{
|
|
295
|
-
preference:
|
|
353
|
+
preference: preference
|
|
296
354
|
}, currentQuery]);
|
|
297
355
|
}
|
|
298
356
|
}
|
|
@@ -318,10 +376,15 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
318
376
|
if (response.aggregations) {
|
|
319
377
|
var _extends4;
|
|
320
378
|
|
|
321
|
-
aggregations = _rollupPluginBabelHelpers._extends(
|
|
379
|
+
aggregations = _rollupPluginBabelHelpers._extends({}, aggregations, (_extends4 = {}, _extends4[component] = response.aggregations, _extends4));
|
|
380
|
+
compositeAggregations = compositeAggsReducer(compositeAggregations, {
|
|
381
|
+
type: constants$1.UPDATE_COMPOSITE_AGGS,
|
|
382
|
+
aggregations: response.aggregations,
|
|
383
|
+
append: false
|
|
384
|
+
});
|
|
322
385
|
}
|
|
323
386
|
|
|
324
|
-
hits = _rollupPluginBabelHelpers._extends(
|
|
387
|
+
hits = _rollupPluginBabelHelpers._extends({}, hits, (_extends5 = {}, _extends5[component] = {
|
|
325
388
|
hits: response.hits.hits,
|
|
326
389
|
total: typeof response.hits.total === 'object' ? response.hits.total.value : response.hits.total,
|
|
327
390
|
time: response.took
|
|
@@ -333,7 +396,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
333
396
|
});
|
|
334
397
|
});
|
|
335
398
|
Promise.all(allPromises).then(function () {
|
|
336
|
-
state = _rollupPluginBabelHelpers._extends(
|
|
399
|
+
state = _rollupPluginBabelHelpers._extends({}, state, {
|
|
337
400
|
hits: hits,
|
|
338
401
|
aggregations: aggregations
|
|
339
402
|
});
|
|
@@ -345,6 +408,8 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
345
408
|
var promotedResults = {};
|
|
346
409
|
var rawData = {};
|
|
347
410
|
var customData = {};
|
|
411
|
+
var settingsResponse = {};
|
|
412
|
+
var timestamp = {};
|
|
348
413
|
var allPromises = orderOfQueries.map(function (component) {
|
|
349
414
|
return new Promise(function (responseResolve, responseReject) {
|
|
350
415
|
handleTransformResponse(res[component], component).then(function (response) {
|
|
@@ -353,7 +418,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
353
418
|
|
|
354
419
|
if (response.promoted) {
|
|
355
420
|
promotedResults[component] = response.promoted.map(function (promoted) {
|
|
356
|
-
return _rollupPluginBabelHelpers._extends(
|
|
421
|
+
return _rollupPluginBabelHelpers._extends({}, promoted.doc, {
|
|
357
422
|
_position: promoted.position
|
|
358
423
|
});
|
|
359
424
|
});
|
|
@@ -363,15 +428,21 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
363
428
|
|
|
364
429
|
if (response.customData) {
|
|
365
430
|
customData[component] = response.customData;
|
|
431
|
+
} // Update settings
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
if (response.settings) {
|
|
435
|
+
settingsResponse[component] = response.settings;
|
|
366
436
|
}
|
|
367
437
|
|
|
368
438
|
if (response.aggregations) {
|
|
369
439
|
var _extends6;
|
|
370
440
|
|
|
371
|
-
aggregations = _rollupPluginBabelHelpers._extends(
|
|
441
|
+
aggregations = _rollupPluginBabelHelpers._extends({}, aggregations, (_extends6 = {}, _extends6[component] = response.aggregations, _extends6));
|
|
372
442
|
}
|
|
373
443
|
|
|
374
|
-
|
|
444
|
+
timestamp[component] = res._timestamp;
|
|
445
|
+
hits = _rollupPluginBabelHelpers._extends({}, hits, (_extends7 = {}, _extends7[component] = {
|
|
375
446
|
hits: response.hits.hits,
|
|
376
447
|
total: typeof response.hits.total === 'object' ? response.hits.total.value : response.hits.total,
|
|
377
448
|
time: response.took
|
|
@@ -384,10 +455,13 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
384
455
|
});
|
|
385
456
|
});
|
|
386
457
|
Promise.all(allPromises).then(function () {
|
|
387
|
-
state = _rollupPluginBabelHelpers._extends(
|
|
458
|
+
state = _rollupPluginBabelHelpers._extends({}, state, {
|
|
388
459
|
hits: hits,
|
|
460
|
+
timestamp: timestamp,
|
|
389
461
|
aggregations: aggregations,
|
|
462
|
+
compositeAggregations: compositeAggregations,
|
|
390
463
|
promotedResults: promotedResults,
|
|
464
|
+
settings: settingsResponse,
|
|
391
465
|
customData: customData,
|
|
392
466
|
rawData: rawData
|
|
393
467
|
});
|