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

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.
@@ -281,18 +281,17 @@ var ReactiveList = {
281
281
  ResultCardsWrapper: ResultCardsWrapper
282
282
  },
283
283
  data: function data() {
284
- var props = this.$props;
285
284
  var currentPageState = 0;
285
+ var defaultPage = this.defaultPage || -1;
286
286
 
287
- if (props.defaultPage >= 0) {
288
- currentPageState = props.defaultPage;
289
- } else if (props.currentPage) {
290
- currentPageState = Math.max(props.currentPage - 1, 0);
287
+ if (defaultPage >= 0) {
288
+ currentPageState = defaultPage;
289
+ } else if (this.currentPage) {
290
+ currentPageState = Math.max(this.currentPage - 1, 0);
291
291
  }
292
292
 
293
293
  this.__state = {
294
- from: currentPageState * props.size,
295
- isLoading: true,
294
+ from: currentPageState * this.size,
296
295
  currentPageState: currentPageState
297
296
  };
298
297
  return this.__state;
@@ -321,8 +320,10 @@ var ReactiveList = {
321
320
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
322
321
  }
323
322
 
324
- if (this.defaultPage >= 0) {
325
- this.currentPageState = this.defaultPage;
323
+ var defaultPage = this.defaultPage || -1;
324
+
325
+ if (defaultPage >= 0) {
326
+ this.currentPageState = defaultPage;
326
327
  this.from = this.currentPageState * this.$props.size;
327
328
  }
328
329
 
@@ -790,7 +791,7 @@ var ReactiveList = {
790
791
  if (this.stats.numberOfResults) {
791
792
  return h("p", {
792
793
  "class": resultStats + " " + getClassName(this.$props.innerClass, 'resultStats')
793
- }, [this.stats.numberOfResults, " results found in ", this.stats.time, "ms"]);
794
+ }, [this.stats.numberOfResults, " results found in ", this.stats.time || 0, "ms"]);
794
795
  }
795
796
 
796
797
  return null;
@@ -923,7 +924,7 @@ var ReactiveList = {
923
924
  return {
924
925
  data: this.withClickIds(filteredResults),
925
926
  aggregationData: this.withClickIds(aggregationData || []),
926
- promotedData: this.withClickIds(promotedResults),
927
+ promotedData: this.withClickIds(promotedResults || []),
927
928
  rawData: this.rawData,
928
929
  resultStats: this.stats,
929
930
  customData: customData
@@ -935,7 +936,7 @@ var ReactiveList = {
935
936
 
936
937
  var data = _rollupPluginBabelHelpers._extends({
937
938
  error: error,
938
- loading: isLoading,
939
+ loading: isLoading || false,
939
940
  loadMore: this.loadMore,
940
941
  // TODO: Remove in v2
941
942
  triggerAnalytics: this.triggerClickAnalytics,
@@ -950,13 +951,13 @@ var ReactiveList = {
950
951
 
951
952
  var mapStateToProps = function mapStateToProps(state, props) {
952
953
  return {
953
- defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
954
+ defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1,
954
955
  hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
955
956
  rawData: state.rawData[props.componentId],
956
- aggregationData: state.compositeAggregations[props.componentId] || [],
957
- promotedResults: state.promotedResults[props.componentId] || [],
957
+ aggregationData: state.compositeAggregations[props.componentId],
958
+ promotedResults: state.promotedResults[props.componentId],
958
959
  customData: state.customData[props.componentId],
959
- time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
960
+ time: state.hits[props.componentId] && state.hits[props.componentId].time,
960
961
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
961
962
  hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
962
963
  analytics: state.config && state.config.analytics,
@@ -965,7 +966,7 @@ var mapStateToProps = function mapStateToProps(state, props) {
965
966
  error: state.error[props.componentId],
966
967
  afterKey: state.aggregations[props.componentId] && state.aggregations[props.componentId][props.aggregationField] && state.aggregations[props.componentId][props.aggregationField].after_key,
967
968
  componentProps: state.props[props.componentId],
968
- isLoading: state.isLoading[props.componentId] || false
969
+ isLoading: state.isLoading[props.componentId]
969
970
  };
970
971
  };
971
972
 
@@ -313,8 +313,9 @@ function initReactivesearch(componentCollection, searchState, settings) {
313
313
  appbaseQuery = _rollupPluginBabelHelpers._extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), transform.getDependentQueries(state, component.componentId, orderOfQueries));
314
314
  }
315
315
  } else {
316
+ var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
316
317
  finalQuery = [].concat(finalQuery, [{
317
- preference: component.componentId
318
+ preference: preference
318
319
  }, currentQuery]);
319
320
  }
320
321
  }
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "1.16.0-alpha.23";
5
+ var version = "1.16.0-alpha.24";
6
6
 
7
7
  exports.default = version;
@@ -273,18 +273,17 @@ var ReactiveList = {
273
273
  ResultCardsWrapper: ResultCardsWrapper
274
274
  },
275
275
  data: function data() {
276
- var props = this.$props;
277
276
  var currentPageState = 0;
277
+ var defaultPage = this.defaultPage || -1;
278
278
 
279
- if (props.defaultPage >= 0) {
280
- currentPageState = props.defaultPage;
281
- } else if (props.currentPage) {
282
- currentPageState = Math.max(props.currentPage - 1, 0);
279
+ if (defaultPage >= 0) {
280
+ currentPageState = defaultPage;
281
+ } else if (this.currentPage) {
282
+ currentPageState = Math.max(this.currentPage - 1, 0);
283
283
  }
284
284
 
285
285
  this.__state = {
286
- from: currentPageState * props.size,
287
- isLoading: true,
286
+ from: currentPageState * this.size,
288
287
  currentPageState: currentPageState
289
288
  };
290
289
  return this.__state;
@@ -313,8 +312,10 @@ var ReactiveList = {
313
312
  console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
314
313
  }
315
314
 
316
- if (this.defaultPage >= 0) {
317
- this.currentPageState = this.defaultPage;
315
+ var defaultPage = this.defaultPage || -1;
316
+
317
+ if (defaultPage >= 0) {
318
+ this.currentPageState = defaultPage;
318
319
  this.from = this.currentPageState * this.$props.size;
319
320
  }
320
321
 
@@ -782,7 +783,7 @@ var ReactiveList = {
782
783
  if (this.stats.numberOfResults) {
783
784
  return h("p", {
784
785
  "class": resultStats + " " + getClassName(this.$props.innerClass, 'resultStats')
785
- }, [this.stats.numberOfResults, " results found in ", this.stats.time, "ms"]);
786
+ }, [this.stats.numberOfResults, " results found in ", this.stats.time || 0, "ms"]);
786
787
  }
787
788
 
788
789
  return null;
@@ -915,7 +916,7 @@ var ReactiveList = {
915
916
  return {
916
917
  data: this.withClickIds(filteredResults),
917
918
  aggregationData: this.withClickIds(aggregationData || []),
918
- promotedData: this.withClickIds(promotedResults),
919
+ promotedData: this.withClickIds(promotedResults || []),
919
920
  rawData: this.rawData,
920
921
  resultStats: this.stats,
921
922
  customData: customData
@@ -927,7 +928,7 @@ var ReactiveList = {
927
928
 
928
929
  var data = _extends({
929
930
  error: error,
930
- loading: isLoading,
931
+ loading: isLoading || false,
931
932
  loadMore: this.loadMore,
932
933
  // TODO: Remove in v2
933
934
  triggerAnalytics: this.triggerClickAnalytics,
@@ -942,13 +943,13 @@ var ReactiveList = {
942
943
 
943
944
  var mapStateToProps = function mapStateToProps(state, props) {
944
945
  return {
945
- defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
946
+ defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1,
946
947
  hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
947
948
  rawData: state.rawData[props.componentId],
948
- aggregationData: state.compositeAggregations[props.componentId] || [],
949
- promotedResults: state.promotedResults[props.componentId] || [],
949
+ aggregationData: state.compositeAggregations[props.componentId],
950
+ promotedResults: state.promotedResults[props.componentId],
950
951
  customData: state.customData[props.componentId],
951
- time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
952
+ time: state.hits[props.componentId] && state.hits[props.componentId].time,
952
953
  total: state.hits[props.componentId] && state.hits[props.componentId].total,
953
954
  hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
954
955
  analytics: state.config && state.config.analytics,
@@ -957,7 +958,7 @@ var mapStateToProps = function mapStateToProps(state, props) {
957
958
  error: state.error[props.componentId],
958
959
  afterKey: state.aggregations[props.componentId] && state.aggregations[props.componentId][props.aggregationField] && state.aggregations[props.componentId][props.aggregationField].after_key,
959
960
  componentProps: state.props[props.componentId],
960
- isLoading: state.isLoading[props.componentId] || false
961
+ isLoading: state.isLoading[props.componentId]
961
962
  };
962
963
  };
963
964
 
@@ -307,8 +307,9 @@ function initReactivesearch(componentCollection, searchState, settings) {
307
307
  appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), getDependentQueries(state, component.componentId, orderOfQueries));
308
308
  }
309
309
  } else {
310
+ var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
310
311
  finalQuery = [].concat(finalQuery, [{
311
- preference: component.componentId
312
+ preference: preference
312
313
  }, currentQuery]);
313
314
  }
314
315
  }
@@ -1,3 +1,3 @@
1
- var version = "1.16.0-alpha.23";
1
+ var version = "1.16.0-alpha.24";
2
2
 
3
3
  export default version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appbaseio/reactivesearch-vue",
3
- "version": "1.16.0-alpha.23",
3
+ "version": "1.16.0-alpha.24",
4
4
  "private": false,
5
5
  "main": "dist/cjs/index.js",
6
6
  "jsnext:main": "dist/es/index.js",
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "sideEffects": false,
36
36
  "dependencies": {
37
- "@appbaseio/reactivecore": "9.12.7",
37
+ "@appbaseio/reactivecore": "9.12.8",
38
38
  "@appbaseio/vue-emotion": "0.4.4",
39
39
  "@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
40
40
  "appbase-js": "^4.4.1",