@appbaseio/reactivesearch-vue 2.0.0-alpha.4 → 3.0.0-alpha.1

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 (109) hide show
  1. package/README.md +9 -9
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js +21316 -29369
  3. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -19
  5. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  6. package/dist/cjs/Button-ad042719.js +59 -0
  7. package/dist/cjs/Card-f5ab024a.js +27 -0
  8. package/dist/cjs/{ComponentWrapper-ad3dad02.js → ComponentWrapper-611cf7f9.js} +44 -58
  9. package/dist/cjs/Container-29f049b2.js +12 -0
  10. package/dist/cjs/DropDown-dc184468.js +700 -0
  11. package/dist/cjs/DynamicRangeSlider.js +106 -157
  12. package/dist/cjs/Flex-d5675ea6.js +48 -0
  13. package/dist/cjs/FormControlList-fadd792f.js +42 -0
  14. package/dist/cjs/Input-088dfcb4.js +74 -0
  15. package/dist/cjs/ListItem-d57d648d.js +42 -0
  16. package/dist/cjs/MultiDropdownList.js +124 -240
  17. package/dist/cjs/MultiList.js +124 -262
  18. package/dist/cjs/MultiRange.js +87 -133
  19. package/dist/cjs/{Pagination-71e85fa9.js → Pagination-b5ddc906.js} +70 -83
  20. package/dist/cjs/PreferencesConsumer-22d1b49f.js +73 -0
  21. package/dist/cjs/RangeInput.js +163 -171
  22. package/dist/cjs/RangeSlider.js +81 -109
  23. package/dist/cjs/ReactiveBase.js +139 -156
  24. package/dist/cjs/ReactiveComponent-a6108189.js +2184 -0
  25. package/dist/cjs/ReactiveComponent.js +46 -340
  26. package/dist/cjs/ReactiveGoogleMap.js +451 -660
  27. package/dist/cjs/ReactiveList.js +180 -305
  28. package/dist/cjs/ResultCard.js +36 -36
  29. package/dist/cjs/ResultList.js +48 -56
  30. package/dist/cjs/SelectedFilters.js +62 -69
  31. package/dist/cjs/SingleDropdownList.js +117 -177
  32. package/dist/cjs/SingleList.js +122 -206
  33. package/dist/cjs/SingleRange.js +78 -105
  34. package/dist/cjs/StateProvider.js +35 -38
  35. package/dist/cjs/Title-8802a218.js +12 -0
  36. package/dist/cjs/ToggleButton.js +72 -119
  37. package/dist/cjs/{_rollupPluginBabelHelpers-c705cbe6.js → _rollupPluginBabelHelpers-f8b843f8.js} +0 -15
  38. package/dist/cjs/{index-6a167fe0.js → index-d8d8f291.js} +38 -108
  39. package/dist/cjs/index.js +44 -41
  40. package/dist/cjs/initReactivesearch.js +63 -150
  41. package/dist/cjs/install.js +47 -43
  42. package/dist/cjs/ssr-6c8a72e1.js +66 -0
  43. package/dist/cjs/{utils-d6a52588.js → utils-83fd01e9.js} +7 -16
  44. package/dist/cjs/version.js +1 -1
  45. package/dist/cjs/{vueTypes-727b7c63.js → vueTypes-1bf00978.js} +8 -19
  46. package/dist/es/Button-474510e3.js +53 -0
  47. package/dist/es/{Card-450683f1.js → Card-38cbe652.js} +3 -3
  48. package/dist/es/{ComponentWrapper-424e86fd.js → ComponentWrapper-3dfe6931.js} +44 -58
  49. package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +2 -2
  50. package/dist/es/DropDown-029ffd42.js +690 -0
  51. package/dist/es/DynamicRangeSlider.js +106 -157
  52. package/dist/es/Flex-a08e22d7.js +46 -0
  53. package/dist/es/FormControlList-fe6eaee4.js +38 -0
  54. package/dist/es/Input-ad474a55.js +69 -0
  55. package/dist/es/{ListItem-cad14c5e.js → ListItem-16756c02.js} +7 -8
  56. package/dist/es/MultiDropdownList.js +124 -240
  57. package/dist/es/MultiList.js +124 -262
  58. package/dist/es/MultiRange.js +87 -133
  59. package/dist/es/{Pagination-784bf143.js → Pagination-72bd1d9e.js} +70 -83
  60. package/dist/es/PreferencesConsumer-24e88f3b.js +71 -0
  61. package/dist/es/RangeInput.js +163 -170
  62. package/dist/es/RangeSlider.js +81 -109
  63. package/dist/es/ReactiveBase.js +138 -154
  64. package/dist/es/ReactiveComponent-0a97eb1e.js +2178 -0
  65. package/dist/es/ReactiveComponent.js +42 -337
  66. package/dist/es/ReactiveGoogleMap.js +446 -654
  67. package/dist/es/ReactiveList.js +178 -302
  68. package/dist/es/ResultCard.js +36 -36
  69. package/dist/es/ResultList.js +48 -56
  70. package/dist/es/SelectedFilters.js +62 -69
  71. package/dist/es/SingleDropdownList.js +117 -177
  72. package/dist/es/SingleList.js +122 -206
  73. package/dist/es/SingleRange.js +78 -105
  74. package/dist/es/StateProvider.js +36 -39
  75. package/dist/es/{Title-3342664a.js → Title-863dfa42.js} +2 -2
  76. package/dist/es/ToggleButton.js +72 -119
  77. package/dist/es/{_rollupPluginBabelHelpers-76660dab.js → _rollupPluginBabelHelpers-ded08042.js} +0 -15
  78. package/dist/es/{index-7788a843.js → index-4520a598.js} +39 -107
  79. package/dist/es/index.js +30 -32
  80. package/dist/es/initReactivesearch.js +63 -150
  81. package/dist/es/install.js +49 -41
  82. package/dist/es/{ssr-b2c0b401.js → ssr-584c278d.js} +37 -8
  83. package/dist/es/{utils-9e68acee.js → utils-9e5a16a1.js} +7 -16
  84. package/dist/es/version.js +1 -1
  85. package/dist/es/{vueTypes-b8146772.js → vueTypes-f1923c72.js} +8 -19
  86. package/package.json +10 -9
  87. package/dist/cjs/Button-446f819e.js +0 -68
  88. package/dist/cjs/CancelSvg-9f258f4f.js +0 -449
  89. package/dist/cjs/Card-642547a8.js +0 -30
  90. package/dist/cjs/Container-daf30918.js +0 -15
  91. package/dist/cjs/DataSearch-aa04dc6e.js +0 -2352
  92. package/dist/cjs/DataSearch.js +0 -30
  93. package/dist/cjs/DropDown-c479bbb0.js +0 -328
  94. package/dist/cjs/Flex-aa517a13.js +0 -52
  95. package/dist/cjs/FormControlList-c195a592.js +0 -47
  96. package/dist/cjs/Input-e6603a7e.js +0 -79
  97. package/dist/cjs/ListItem-8c9e0d68.js +0 -46
  98. package/dist/cjs/Title-1de7d0f4.js +0 -15
  99. package/dist/cjs/install-b97dbac4.js +0 -1409
  100. package/dist/cjs/ssr-3027b848.js +0 -39
  101. package/dist/es/Button-d8bc15ea.js +0 -59
  102. package/dist/es/CancelSvg-4cfae5fd.js +0 -440
  103. package/dist/es/DataSearch-b86a6675.js +0 -2337
  104. package/dist/es/DataSearch.js +0 -22
  105. package/dist/es/DropDown-05a644a5.js +0 -322
  106. package/dist/es/Flex-1f0795c3.js +0 -47
  107. package/dist/es/FormControlList-c22d64f6.js +0 -40
  108. package/dist/es/Input-7a2a9fac.js +0 -71
  109. package/dist/es/install-ac8a1edb.js +0 -1402
@@ -1,5 +1,5 @@
1
- import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-76660dab.js';
2
1
  import { validProps, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
2
+ import { a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
3
3
  import { transformRequestUsingEndpoint, pushToAndClause, buildQuery, extractQueryFromCustomQuery, getOptionsForCustomQuery } from '@appbaseio/reactivecore/lib/utils/helper';
4
4
  import { isSearchComponent, getRSQuery, extractPropsFromState, getDependentQueries } from '@appbaseio/reactivecore/lib/utils/transform';
5
5
  import Appbase from 'appbase-js';
@@ -13,15 +13,13 @@ import fetchGraphQL from '@appbaseio/reactivecore/lib/utils/graphQL';
13
13
  import { isPropertyDefined } from '@appbaseio/reactivecore/lib/actions/utils';
14
14
 
15
15
  var _excluded = ["aggs", "size"],
16
- _excluded2 = ["query"],
17
- _excluded3 = ["query"];
18
-
16
+ _excluded2 = ["query"],
17
+ _excluded3 = ["query"];
19
18
  var _componentTypeToDefau;
20
19
  var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
21
20
  var componentsWithoutFilters = [componentTypes.numberBox, componentTypes.ratingsFilter];
22
21
  var resultComponents = [componentTypes.reactiveList, componentTypes.reactiveMap];
23
22
  var componentTypeToDefaultValue = (_componentTypeToDefau = {}, _componentTypeToDefau[componentTypes.singleList] = '', _componentTypeToDefau[componentTypes.multiList] = [], _componentTypeToDefau[componentTypes.singleDataList] = '', _componentTypeToDefau[componentTypes.singleDropdownList] = '', _componentTypeToDefau[componentTypes.multiDataList] = [], _componentTypeToDefau[componentTypes.multiDropdownList] = [], _componentTypeToDefau[componentTypes.tagCloud] = '', _componentTypeToDefau[componentTypes.toggleButton] = '', _componentTypeToDefau[componentTypes.singleDropdownRange] = '', _componentTypeToDefau[componentTypes.multiDropdownRange] = [], _componentTypeToDefau[componentTypes.singleRange] = '', _componentTypeToDefau[componentTypes.multiRange] = [], _componentTypeToDefau);
24
-
25
23
  function getValue(state, id, defaultValue, componentType) {
26
24
  if (state && state[id]) {
27
25
  try {
@@ -39,86 +37,71 @@ function getValue(state, id, defaultValue, componentType) {
39
37
  };
40
38
  }
41
39
  }
42
-
43
40
  return {
44
41
  value: defaultValue || componentTypeToDefaultValue[componentType] || null,
45
42
  reference: 'DEFAULT'
46
43
  };
47
44
  }
48
-
49
45
  function parseValue(value, component) {
50
46
  if (component.source && component.source.parseValue) {
51
47
  return component.source.parseValue(value, component);
52
48
  }
53
-
54
49
  return value;
55
- } // Returns query DSL with query property and other options
56
-
50
+ }
57
51
 
52
+ // Returns query DSL with query property and other options
58
53
  function getDefaultQuery(component, value) {
59
54
  // get custom or default query of sensor components
60
- var currentValue = parseValue(value, component); // get default query of result components
61
-
55
+ var currentValue = parseValue(value, component);
56
+ // get default query of result components
62
57
  if (component.defaultQuery) {
63
58
  var defaultQuery = component.defaultQuery(currentValue, component);
64
59
  return _extends({
65
60
  query: extractQueryFromCustomQuery(defaultQuery)
66
61
  }, getOptionsForCustomQuery(defaultQuery));
67
62
  }
68
-
69
63
  return component.source.defaultQuery ? {
70
64
  query: component.source.defaultQuery(currentValue, component)
71
65
  } : {};
72
- } // Only results the query part
73
-
74
-
66
+ }
67
+ // Only results the query part
75
68
  function getCustomQuery(component, value) {
76
69
  // get custom or default query of sensor components
77
70
  var currentValue = parseValue(value, component);
78
-
79
71
  if (component.customQuery) {
80
72
  var customQuery = component.customQuery(currentValue, component);
81
73
  return _extends({
82
74
  query: extractQueryFromCustomQuery(customQuery)
83
75
  }, getOptionsForCustomQuery(customQuery));
84
76
  }
85
-
86
77
  return component.source.defaultQuery ? {
87
78
  query: component.source.defaultQuery(currentValue, component)
88
79
  } : null;
89
80
  }
90
-
91
81
  function initReactivesearch(componentCollection, searchState, settings) {
92
82
  return new Promise(function (resolve, reject) {
93
83
  var credentials = settings.url && settings.url.trim() !== '' && !settings.credentials ? null : settings.credentials;
94
- var enableTelemetry = settings.appbaseConfig && settings.appbaseConfig.enableTelemetry !== undefined ? settings.appbaseConfig.enableTelemetry : true;
95
-
96
- var headers = _extends({}, settings.enableAppbase && _extends({
84
+ var enableTelemetry = settings.reactivesearchAPIConfig && settings.reactivesearchAPIConfig.enableTelemetry !== undefined ? settings.reactivesearchAPIConfig.enableTelemetry : true;
85
+ var headers = _extends({}, _extends({
97
86
  'X-Search-Client': X_SEARCH_CLIENT
98
87
  }, enableTelemetry === false && {
99
88
  'X-Enable-Telemetry': false
100
- }), settings.headers, settings.enableAppbase && settings.endpoint && settings.endpoint.headers ? settings.endpoint.headers : {});
101
-
89
+ }), settings.headers, settings.endpoint && settings.endpoint.headers ? settings.endpoint.headers : {});
102
90
  var url = settings.url && settings.url.trim() !== '' ? settings.url : 'https://scalr.api.appbase.io';
103
91
  var transformRequest = settings.transformRequest || null;
104
-
105
- if (settings.enableAppbase && settings.endpoint) {
92
+ if (settings.endpoint) {
106
93
  if (settings.endpoint.url) {
107
94
  // eslint-disable-next-line prefer-destructuring
108
95
  url = settings.endpoint.url;
109
96
  }
110
-
111
97
  transformRequest = function transformRequest(request) {
112
98
  var modifiedRequest = transformRequestUsingEndpoint(request, settings.endpoint);
113
-
114
99
  if (settings.transformRequest) {
115
100
  return settings.transformRequest(modifiedRequest);
116
101
  }
117
-
118
102
  return modifiedRequest;
119
103
  };
120
104
  }
121
-
122
105
  var config = {
123
106
  url: url,
124
107
  app: settings.app,
@@ -128,20 +111,17 @@ function initReactivesearch(componentCollection, searchState, settings) {
128
111
  transformResponse: settings.transformResponse || null,
129
112
  graphQLUrl: settings.graphQLUrl || '',
130
113
  headers: headers,
131
- analyticsConfig: settings.appbaseConfig || null,
132
- enableAppbase: settings.enableAppbase,
114
+ analyticsConfig: settings.reactivesearchAPIConfig || null,
115
+ enableAppbase: true,
133
116
  endpoint: settings.endpoint
134
117
  };
135
118
  var appbaseRef = Appbase(config);
136
-
137
119
  if (config.transformRequest) {
138
120
  appbaseRef.transformRequest = config.transformRequest;
139
121
  }
140
-
141
122
  if (config.transformResponse) {
142
123
  appbaseRef.transformResponse = config.transformResponse;
143
124
  }
144
-
145
125
  var components = [];
146
126
  var selectedValues = {};
147
127
  var internalValues = {};
@@ -151,7 +131,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
151
131
  var dependencyTree = {};
152
132
  var finalQuery = [];
153
133
  var appbaseQuery = {}; // Use object to prevent duplicate query added by react prop
154
-
155
134
  var orderOfQueries = [];
156
135
  var hits = {};
157
136
  var aggregations = {};
@@ -162,8 +141,8 @@ function initReactivesearch(componentCollection, searchState, settings) {
162
141
  var componentProps = {};
163
142
  componentCollection.forEach(function (component) {
164
143
  var componentType = component.source.componentType;
165
- components = [].concat(components, [component.componentId]); // Set component props
166
-
144
+ components = [].concat(components, [component.componentId]);
145
+ // Set component props
167
146
  var compProps = {};
168
147
  Object.keys(component).forEach(function (key) {
169
148
  if (validProps.includes(key)) {
@@ -171,26 +150,20 @@ function initReactivesearch(componentCollection, searchState, settings) {
171
150
  }
172
151
  });
173
152
  var isInternalComponentPresent = false;
174
-
175
153
  if (component.source.hasInternalComponent) {
176
154
  isInternalComponentPresent = component.source.hasInternalComponent(component);
177
155
  }
178
-
179
156
  var isResultComponent = resultComponents.includes(componentType);
180
157
  var internalComponent = component.componentId + "__internal";
181
158
  var label = component.filterLabel || component.componentId;
182
-
183
159
  var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue, componentType),
184
- value = _getValue.value,
185
- reference = _getValue.reference; // [1] set selected values
186
-
187
-
160
+ value = _getValue.value,
161
+ reference = _getValue.reference;
162
+ // [1] set selected values
188
163
  var showFilter = component.showFilter !== undefined ? component.showFilter : true;
189
-
190
164
  if (componentsWithoutFilters.includes(componentType)) {
191
165
  showFilter = false;
192
166
  }
193
-
194
167
  selectedValues = valueReducer(selectedValues, {
195
168
  type: 'SET_VALUE',
196
169
  component: component.componentId,
@@ -199,99 +172,82 @@ function initReactivesearch(componentCollection, searchState, settings) {
199
172
  reference: reference,
200
173
  showFilter: showFilter,
201
174
  URLParams: component.URLParams || false
202
- }); // Set custom and default queries
203
-
175
+ });
176
+ // Set custom and default queries
204
177
  if (component.customQuery && typeof component.customQuery === 'function') {
205
178
  customQueries[component.componentId] = component.customQuery(value, compProps);
206
179
  }
207
-
208
180
  if (component.defaultQuery && typeof component.defaultQuery === 'function') {
209
181
  defaultQueries[component.componentId] = component.defaultQuery(value, compProps);
210
182
  }
211
-
212
- var componentQueryOptions = {}; // [2] set query options - main component query (valid for result components)
213
-
183
+ var componentQueryOptions = {};
184
+ // [2] set query options - main component query (valid for result components)
214
185
  if (component && component.source.generateQueryOptions) {
215
186
  componentQueryOptions = _extends({}, componentQueryOptions, component.source.generateQueryOptions(component));
216
187
  }
217
-
218
188
  var highlightQuery = {};
219
-
220
189
  if (component.source.highlightQuery) {
221
190
  highlightQuery = component.source.highlightQuery(component);
222
191
  }
223
-
224
192
  if (componentQueryOptions && Object.keys(componentQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
225
193
  // eslint-disable-next-line
226
194
  var _ref = componentQueryOptions || {},
227
- aggs = _ref.aggs,
228
- size = _ref.size,
229
- otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
230
-
195
+ aggs = _ref.aggs,
196
+ size = _ref.size,
197
+ otherQueryOptions = _objectWithoutPropertiesLoose(_ref, _excluded);
231
198
  if (aggs && Object.keys(aggs).length) {
232
199
  isInternalComponentPresent = true;
233
200
  componentQueryOptions = _extends({}, componentQueryOptions, {
234
201
  aggs: aggs,
235
202
  size: typeof size === 'undefined' ? 100 : size
236
203
  });
237
- } // sort, highlight, size, from - query should be applied on the main component
238
-
204
+ }
239
205
 
206
+ // sort, highlight, size, from - query should be applied on the main component
240
207
  if (otherQueryOptions && Object.keys(otherQueryOptions).length || highlightQuery && Object.keys(highlightQuery).length) {
241
208
  if (!otherQueryOptions) otherQueryOptions = {};
242
209
  if (!highlightQuery) highlightQuery = {};
243
-
244
210
  var mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery, {
245
211
  size: size
246
212
  });
247
-
248
213
  if (isInternalComponentPresent) {
249
214
  mainQueryOptions = _extends({}, otherQueryOptions, highlightQuery);
250
215
  }
251
-
252
216
  if (isResultComponent) {
253
217
  var currentPage = component.currentPage ? component.currentPage - 1 : 0;
254
-
255
218
  if (selectedValues[component.componentId] && selectedValues[component.componentId].value) {
256
219
  currentPage = selectedValues[component.componentId].value - 1 || 0;
257
220
  }
258
-
259
221
  var resultSize = component.size || 10;
260
- var from = currentPage * resultSize; // Update props for RS API
261
-
222
+ var from = currentPage * resultSize;
223
+ // Update props for RS API
262
224
  compProps.from = from;
263
225
  mainQueryOptions = _extends({}, mainQueryOptions, highlightQuery, {
264
226
  size: resultSize,
265
227
  from: from
266
228
  });
267
229
  }
268
-
269
230
  componentQueryOptions = _extends({}, componentQueryOptions, mainQueryOptions);
270
231
  }
271
- } // [3] set dependency tree
272
-
273
-
232
+ }
233
+ // [3] set dependency tree
274
234
  if (component.react || isInternalComponentPresent || isResultComponent) {
275
235
  var react = component.react;
276
-
277
236
  if (isInternalComponentPresent || isResultComponent) {
278
237
  react = pushToAndClause(react, internalComponent);
279
238
  }
280
-
281
239
  dependencyTree = dependencyTreeReducer(dependencyTree, {
282
240
  type: 'WATCH_COMPONENT',
283
241
  component: component.componentId,
284
242
  react: react
285
243
  });
286
- } // [4] set query list
244
+ }
245
+ // [4] set query list
287
246
  // Do not set default query for suggestions
288
-
289
-
290
247
  if (isInternalComponentPresent && !isSearchComponent(component.componentType)) {
291
248
  var _ref2 = getDefaultQuery(component, value) || {},
292
- defaultQuery = _ref2.query,
293
- defaultQueryOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
294
-
249
+ defaultQuery = _ref2.query,
250
+ defaultQueryOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
295
251
  queryList = queryReducer(queryList, {
296
252
  type: 'SET_QUERY',
297
253
  component: internalComponent,
@@ -303,13 +259,11 @@ function initReactivesearch(componentCollection, searchState, settings) {
303
259
  options: _extends({}, componentQueryOptions, defaultQueryOptions)
304
260
  });
305
261
  }
306
-
307
262
  var _ref3 = getCustomQuery(component, value) || {},
308
- query = _ref3.query,
309
- options = _objectWithoutPropertiesLoose(_ref3, _excluded3);
310
-
311
- var customQuery = query; // set custom query for main component
312
-
263
+ query = _ref3.query,
264
+ options = _objectWithoutPropertiesLoose(_ref3, _excluded3);
265
+ var customQuery = query;
266
+ // set custom query for main component
313
267
  queryList = queryReducer(queryList, {
314
268
  type: 'SET_QUERY',
315
269
  component: component.componentId,
@@ -319,8 +273,8 @@ function initReactivesearch(componentCollection, searchState, settings) {
319
273
  type: 'SET_QUERY_OPTIONS',
320
274
  component: component.componentId,
321
275
  options: _extends({}, options)
322
- }); // Set component type in component props
323
-
276
+ });
277
+ // Set component type in component props
324
278
  compProps.componentType = componentType;
325
279
  componentProps[component.componentId] = compProps;
326
280
  });
@@ -334,76 +288,56 @@ function initReactivesearch(componentCollection, searchState, settings) {
334
288
  props: componentProps,
335
289
  customQueries: customQueries,
336
290
  defaultQueries: defaultQueries
337
- }; // [5] Generate finalQuery for search
338
-
291
+ };
292
+ // [5] Generate finalQuery for search
339
293
  componentCollection.forEach(function (component) {
340
294
  // eslint-disable-next-line
341
295
  var _buildQuery = buildQuery(component.componentId, dependencyTree, queryList, queryOptions),
342
- queryObj = _buildQuery.queryObj,
343
- options = _buildQuery.options;
344
-
296
+ queryObj = _buildQuery.queryObj,
297
+ options = _buildQuery.options;
345
298
  var componentQueryOptions = options;
346
- var validOptions = ['aggs', 'from', 'sort']; // check if query or componentQueryOptions are valid - non-empty
347
-
299
+ var validOptions = ['aggs', 'from', 'sort'];
300
+ // check if query or componentQueryOptions are valid - non-empty
348
301
  if (queryObj && !!Object.keys(queryObj).length || componentQueryOptions && Object.keys(componentQueryOptions).some(function (item) {
349
302
  return validOptions.includes(item);
350
303
  })) {
351
304
  var _extends2;
352
-
353
305
  if (!queryObj || queryObj && !Object.keys(queryObj).length) {
354
306
  queryObj = {
355
307
  match_all: {}
356
308
  };
357
309
  }
358
-
359
310
  orderOfQueries = [].concat(orderOfQueries, [component.componentId]);
360
-
361
311
  var currentQuery = _extends({
362
312
  query: _extends({}, queryObj)
363
313
  }, componentQueryOptions, queryOptions[component.componentId]);
364
-
365
314
  queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
366
-
367
- if (settings.enableAppbase) {
368
- var query = getRSQuery(component.componentId, extractPropsFromState(state, component.componentId, queryOptions && Object.keys(queryOptions[component.componentId]).length ? {
369
- from: queryOptions[component.componentId].from
370
- } : null));
371
-
372
- if (query) {
373
- var _extends3;
374
-
375
- // Apply dependent queries
376
- appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), getDependentQueries(state, component.componentId, orderOfQueries));
377
- }
378
- } else {
379
- var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
380
- finalQuery = [].concat(finalQuery, [{
381
- preference: preference
382
- }, currentQuery]);
315
+ var query = getRSQuery(component.componentId, extractPropsFromState(state, component.componentId, queryOptions && Object.keys(queryOptions[component.componentId]).length ? {
316
+ from: queryOptions[component.componentId].from
317
+ } : null));
318
+ if (query) {
319
+ var _extends3;
320
+ // Apply dependent queries
321
+ appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), getDependentQueries(state, component.componentId, orderOfQueries));
383
322
  }
384
323
  }
385
324
  });
386
325
  state.queryLog = queryLog;
387
-
388
326
  var handleTransformResponse = function handleTransformResponse(res, component) {
389
327
  if (config.transformResponse && typeof config.transformResponse === 'function') {
390
328
  return config.transformResponse(res, component);
391
329
  }
392
-
393
330
  return new Promise(function (resolveTransformResponse) {
394
331
  return resolveTransformResponse(res);
395
332
  });
396
333
  };
397
-
398
334
  var handleResponse = function handleResponse(res) {
399
335
  var allPromises = orderOfQueries.map(function (component, index) {
400
336
  return new Promise(function (responseResolve, responseReject) {
401
337
  handleTransformResponse(res.responses[index], component).then(function (response) {
402
338
  var _extends5;
403
-
404
339
  if (response.aggregations) {
405
340
  var _extends4;
406
-
407
341
  aggregations = _extends({}, aggregations, (_extends4 = {}, _extends4[component] = response.aggregations, _extends4));
408
342
  compositeAggregations = compositeAggsReducer(compositeAggregations, {
409
343
  type: UPDATE_COMPOSITE_AGGS,
@@ -411,7 +345,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
411
345
  append: false
412
346
  });
413
347
  }
414
-
415
348
  hits = _extends({}, hits, (_extends5 = {}, _extends5[component] = {
416
349
  hits: response.hits.hits,
417
350
  total: typeof response.hits.total === 'object' ? response.hits.total.value : response.hits.total,
@@ -431,7 +364,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
431
364
  resolve(state);
432
365
  });
433
366
  };
434
-
435
367
  var handleRSResponse = function handleRSResponse(res) {
436
368
  var promotedResults = {};
437
369
  var rawData = {};
@@ -443,7 +375,6 @@ function initReactivesearch(componentCollection, searchState, settings) {
443
375
  handleTransformResponse(res[component], component).then(function (response) {
444
376
  if (response) {
445
377
  var _extends7;
446
-
447
378
  if (response.promoted) {
448
379
  promotedResults[component] = response.promoted.map(function (promoted) {
449
380
  return _extends({}, promoted.doc, {
@@ -451,24 +382,20 @@ function initReactivesearch(componentCollection, searchState, settings) {
451
382
  });
452
383
  });
453
384
  }
454
-
455
- rawData[component] = response; // Update custom data
456
-
385
+ rawData[component] = response;
386
+ // Update custom data
457
387
  if (response.customData) {
458
388
  customData[component] = response.customData;
459
- } // Update settings
460
-
389
+ }
461
390
 
391
+ // Update settings
462
392
  if (response.settings) {
463
393
  settingsResponse[component] = response.settings;
464
394
  }
465
-
466
395
  if (response.aggregations) {
467
396
  var _extends6;
468
-
469
397
  aggregations = _extends({}, aggregations, (_extends6 = {}, _extends6[component] = response.aggregations, _extends6));
470
398
  }
471
-
472
399
  timestamp[component] = res._timestamp;
473
400
  var hitsObj = response.hits ? response.hits : response[component].hits;
474
401
  hits = _extends({}, hits, (_extends7 = {}, _extends7[component] = {
@@ -497,17 +424,14 @@ function initReactivesearch(componentCollection, searchState, settings) {
497
424
  resolve(state);
498
425
  });
499
426
  };
500
-
501
427
  if (config.graphQLUrl) {
502
428
  var handleTransformRequest = function handleTransformRequest(res) {
503
429
  if (config.transformRequest && typeof config.transformRequest === 'function') {
504
430
  var transformRequestPromise = config.transformRequest(res);
505
431
  return transformRequestPromise instanceof Promise ? transformRequestPromise : Promise.resolve(transformRequestPromise);
506
432
  }
507
-
508
433
  return Promise.resolve(res);
509
434
  };
510
-
511
435
  handleTransformRequest(finalQuery).then(function (requestQuery) {
512
436
  fetchGraphQL(config.graphQLUrl, config.url, config.credentials, config.app, requestQuery).then(function (res) {
513
437
  handleResponse(res);
@@ -517,34 +441,23 @@ function initReactivesearch(componentCollection, searchState, settings) {
517
441
  })["catch"](function (err) {
518
442
  return reject(err);
519
443
  });
520
- } else if (settings.enableAppbase && Object.keys(appbaseQuery).length) {
444
+ } else if (Object.keys(appbaseQuery).length) {
521
445
  finalQuery = Object.keys(appbaseQuery).map(function (c) {
522
446
  return appbaseQuery[c];
523
- }); // Call RS API
524
-
447
+ });
448
+ // Call RS API
525
449
  var rsAPISettings = {};
526
-
527
450
  if (config.analyticsConfig) {
528
451
  rsAPISettings.recordAnalytics = isPropertyDefined(config.analyticsConfig.recordAnalytics) ? config.analyticsConfig.recordAnalytics : undefined;
529
452
  rsAPISettings.userId = isPropertyDefined(config.analyticsConfig.userId) ? config.analyticsConfig.userId : undefined;
530
453
  rsAPISettings.enableQueryRules = isPropertyDefined(config.analyticsConfig.enableQueryRules) ? config.analyticsConfig.enableQueryRules : undefined;
531
454
  rsAPISettings.customEvents = isPropertyDefined(config.analyticsConfig.customEvents) ? config.analyticsConfig.customEvents : undefined;
532
455
  }
533
-
534
456
  appbaseRef.reactiveSearchv3(finalQuery, rsAPISettings).then(function (res) {
535
457
  handleRSResponse(res);
536
458
  })["catch"](function (err) {
537
459
  return reject(err);
538
460
  });
539
- } else {
540
- appbaseRef.msearch({
541
- type: config.type === '*' ? '' : config.type,
542
- body: finalQuery
543
- }).then(function (res) {
544
- handleResponse(res);
545
- })["catch"](function (err) {
546
- return reject(err);
547
- });
548
461
  }
549
462
  });
550
463
  }
@@ -1,55 +1,63 @@
1
1
  import '@appbaseio/reactivecore';
2
- import './_rollupPluginBabelHelpers-76660dab.js';
3
- import 'vue-types';
4
2
  import '@appbaseio/reactivecore/lib/utils/constants';
3
+ import '@vue/babel-helper-vue-transform-on';
4
+ import './_rollupPluginBabelHelpers-ded08042.js';
5
+ import 'vue';
6
+ import 'vue-types';
5
7
  import '@appbaseio/reactivecore/lib/utils/helper';
6
- import 'emotion';
7
8
  import '@appbaseio/vue-emotion';
9
+ import 'emotion';
8
10
  import 'polished';
9
- import './Button-d8bc15ea.js';
10
- import './vueTypes-b8146772.js';
11
- import './Pagination-784bf143.js';
12
- import './ReactiveList.js';
11
+ import './Button-474510e3.js';
12
+ import './vueTypes-f1923c72.js';
13
+ import './Pagination-72bd1d9e.js';
14
+ import ReactiveList from './ReactiveList.js';
13
15
  import '@appbaseio/reactivecore/lib/utils/transform';
14
16
  import 'redux';
15
- import './index-7788a843.js';
16
- import './ComponentWrapper-424e86fd.js';
17
- import '@vue/babel-helper-vue-jsx-merge-props';
18
- import './Title-3342664a.js';
19
- import './ListItem-cad14c5e.js';
20
- import './Card-450683f1.js';
21
- import './Flex-1f0795c3.js';
17
+ import './index-4520a598.js';
18
+ import './ComponentWrapper-3dfe6931.js';
19
+ import './PreferencesConsumer-24e88f3b.js';
20
+ import './Title-863dfa42.js';
21
+ import './ListItem-16756c02.js';
22
+ import './Card-38cbe652.js';
23
+ import './Flex-a08e22d7.js';
22
24
  import '@appbaseio/reactivecore/lib/actions/analytics';
23
25
  import 'appbase-js';
26
+ import '@appbaseio/analytics';
24
27
  import 'url-search-params-polyfill';
25
- import './ReactiveBase.js';
28
+ import ReactiveBase from './ReactiveBase.js';
26
29
  import 'hotkeys-js';
27
- import './DataSearch-b86a6675.js';
28
- import './CancelSvg-4cfae5fd.js';
29
- import './Input-7a2a9fac.js';
30
+ import { S as SearchBox, R as ReactiveComponent } from './ReactiveComponent-0a97eb1e.js';
31
+ import './DropDown-029ffd42.js';
32
+ import './Input-ad474a55.js';
30
33
  import 'compute-scroll-into-view';
31
- import './Container-ba826e96.js';
34
+ import './Container-d00219f7.js';
32
35
  import 'vue-highlight-words';
33
- export { i as default } from './install-ac8a1edb.js';
34
36
  import '@appbaseio/reactivecore/lib/utils/suggestions';
35
- import './FormControlList-c22d64f6.js';
36
- import './utils-9e68acee.js';
37
- import './SingleList.js';
38
- import './MultiList.js';
39
- import './DropDown-05a644a5.js';
40
- import './SingleDropdownList.js';
41
- import './MultiDropdownList.js';
42
- import './ToggleButton.js';
43
- import './ReactiveComponent.js';
44
- import './SelectedFilters.js';
45
- import './SingleRange.js';
46
- import './MultiRange.js';
47
- import './ResultCard.js';
48
- import './ResultList.js';
49
- import 'vue-no-ssr';
50
- import './ssr-b2c0b401.js';
51
- import './RangeSlider.js';
52
- import './DynamicRangeSlider.js';
53
- import '@appbaseio/reactivecore/lib/actions/value';
54
- import './StateProvider.js';
55
- import './RangeInput.js';
37
+ import './FormControlList-fe6eaee4.js';
38
+ import './utils-9e5a16a1.js';
39
+ import SingleList from './SingleList.js';
40
+ import MultiList from './MultiList.js';
41
+ import SingleDropdownList from './SingleDropdownList.js';
42
+ import MultiDropdownList from './MultiDropdownList.js';
43
+ import ToggleButton from './ToggleButton.js';
44
+ import './ssr-584c278d.js';
45
+ import DynamicRangeSlider from './DynamicRangeSlider.js';
46
+ import SingleRange from './SingleRange.js';
47
+ import MultiRange from './MultiRange.js';
48
+ import RangeSlider from './RangeSlider.js';
49
+ import RangeInput from './RangeInput.js';
50
+ import SelectedFilters from './SelectedFilters.js';
51
+ import ResultCard from './ResultCard.js';
52
+ import ResultList from './ResultList.js';
53
+ import StateProvider from './StateProvider.js';
54
+
55
+ var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SearchBox, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput];
56
+ function install (Vue) {
57
+ components.map(function (component) {
58
+ Vue.use(component);
59
+ return null;
60
+ });
61
+ }
62
+
63
+ export default install;