@appbaseio/reactivesearch-vue 1.33.2 → 1.33.3

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.
@@ -731,6 +731,7 @@
731
731
  var ADD_CONFIG = exports.ADD_CONFIG = 'ADD_CONFIG';
732
732
  var UPDATE_CONFIG = exports.UPDATE_CONFIG = 'UPDATE_CONFIG';
733
733
  var ADD_APPBASE_REF = exports.ADD_APPBASE_REF = 'ADD_APPBASE_REF';
734
+ var ADD_ANALYTICS_REF = exports.ADD_ANALYTICS_REF = 'ADD_ANALYTICS_REF';
734
735
  var LOG_QUERY = exports.LOG_QUERY = 'LOG_QUERY';
735
736
  var LOG_COMBINED_QUERY = exports.LOG_COMBINED_QUERY = 'LOG_COMBINED_QUERY';
736
737
  var SET_INTERNAL_VALUE = exports.SET_INTERNAL_VALUE = 'SET_INTERNAL_VALUE';
@@ -785,45 +786,46 @@
785
786
  var constants_11 = constants.ADD_CONFIG;
786
787
  var constants_12 = constants.UPDATE_CONFIG;
787
788
  var constants_13 = constants.ADD_APPBASE_REF;
788
- var constants_14 = constants.LOG_QUERY;
789
- var constants_15 = constants.LOG_COMBINED_QUERY;
790
- var constants_16 = constants.SET_INTERNAL_VALUE;
791
- var constants_17 = constants.PATCH_VALUE;
792
- var constants_18 = constants.CLEAR_VALUES;
793
- var constants_19 = constants.SET_LOADING;
794
- var constants_20 = constants.SET_ERROR;
795
- var constants_21 = constants.SET_TIMESTAMP;
796
- var constants_22 = constants.SET_HEADERS;
797
- var constants_23 = constants.SET_MAP_DATA;
798
- var constants_24 = constants.SET_MAP_RESULTS;
799
- var constants_25 = constants.SET_QUERY_LISTENER;
800
- var constants_26 = constants.STORE_KEY;
801
- var constants_27 = constants.SET_SEARCH_ID;
802
- var constants_28 = constants.SET_PROMOTED_RESULTS;
803
- var constants_29 = constants.SET_DEFAULT_QUERY;
804
- var constants_30 = constants.SET_CUSTOM_QUERY;
805
- var constants_31 = constants.SET_CUSTOM_HIGHLIGHT_OPTIONS;
806
- var constants_32 = constants.SET_CUSTOM_DATA;
807
- var constants_33 = constants.SET_APPLIED_SETTINGS;
808
- var constants_34 = constants.SET_PROPS;
809
- var constants_35 = constants.UPDATE_PROPS;
810
- var constants_36 = constants.REMOVE_PROPS;
811
- var constants_37 = constants.SET_SUGGESTIONS_SEARCH_VALUE;
812
- var constants_38 = constants.CLEAR_SUGGESTIONS_SEARCH_VALUE;
813
- var constants_39 = constants.SET_SUGGESTIONS_SEARCH_ID;
814
- var constants_40 = constants.UPDATE_ANALYTICS_CONFIG;
815
- var constants_41 = constants.SET_RAW_DATA;
816
- var constants_42 = constants.SET_POPULAR_SUGGESTIONS;
817
- var constants_43 = constants.SET_DEFAULT_POPULAR_SUGGESTIONS;
818
- var constants_44 = constants.SET_QUERY_TO_HITS;
819
- var constants_45 = constants.RECENT_SEARCHES_SUCCESS;
820
- var constants_46 = constants.RECENT_SEARCHES_ERROR;
821
- var constants_47 = constants.SET_VALUE;
822
- var constants_48 = constants.SET_VALUES;
823
- var constants_49 = constants.RESET_TO_DEFAULT;
824
- var constants_50 = constants.SET_GOOGLE_MAP_SCRIPT_LOADING;
825
- var constants_51 = constants.SET_GOOGLE_MAP_SCRIPT_LOADED;
826
- var constants_52 = constants.SET_GOOGLE_MAP_SCRIPT_ERROR;
789
+ var constants_14 = constants.ADD_ANALYTICS_REF;
790
+ var constants_15 = constants.LOG_QUERY;
791
+ var constants_16 = constants.LOG_COMBINED_QUERY;
792
+ var constants_17 = constants.SET_INTERNAL_VALUE;
793
+ var constants_18 = constants.PATCH_VALUE;
794
+ var constants_19 = constants.CLEAR_VALUES;
795
+ var constants_20 = constants.SET_LOADING;
796
+ var constants_21 = constants.SET_ERROR;
797
+ var constants_22 = constants.SET_TIMESTAMP;
798
+ var constants_23 = constants.SET_HEADERS;
799
+ var constants_24 = constants.SET_MAP_DATA;
800
+ var constants_25 = constants.SET_MAP_RESULTS;
801
+ var constants_26 = constants.SET_QUERY_LISTENER;
802
+ var constants_27 = constants.STORE_KEY;
803
+ var constants_28 = constants.SET_SEARCH_ID;
804
+ var constants_29 = constants.SET_PROMOTED_RESULTS;
805
+ var constants_30 = constants.SET_DEFAULT_QUERY;
806
+ var constants_31 = constants.SET_CUSTOM_QUERY;
807
+ var constants_32 = constants.SET_CUSTOM_HIGHLIGHT_OPTIONS;
808
+ var constants_33 = constants.SET_CUSTOM_DATA;
809
+ var constants_34 = constants.SET_APPLIED_SETTINGS;
810
+ var constants_35 = constants.SET_PROPS;
811
+ var constants_36 = constants.UPDATE_PROPS;
812
+ var constants_37 = constants.REMOVE_PROPS;
813
+ var constants_38 = constants.SET_SUGGESTIONS_SEARCH_VALUE;
814
+ var constants_39 = constants.CLEAR_SUGGESTIONS_SEARCH_VALUE;
815
+ var constants_40 = constants.SET_SUGGESTIONS_SEARCH_ID;
816
+ var constants_41 = constants.UPDATE_ANALYTICS_CONFIG;
817
+ var constants_42 = constants.SET_RAW_DATA;
818
+ var constants_43 = constants.SET_POPULAR_SUGGESTIONS;
819
+ var constants_44 = constants.SET_DEFAULT_POPULAR_SUGGESTIONS;
820
+ var constants_45 = constants.SET_QUERY_TO_HITS;
821
+ var constants_46 = constants.RECENT_SEARCHES_SUCCESS;
822
+ var constants_47 = constants.RECENT_SEARCHES_ERROR;
823
+ var constants_48 = constants.SET_VALUE;
824
+ var constants_49 = constants.SET_VALUES;
825
+ var constants_50 = constants.RESET_TO_DEFAULT;
826
+ var constants_51 = constants.SET_GOOGLE_MAP_SCRIPT_LOADING;
827
+ var constants_52 = constants.SET_GOOGLE_MAP_SCRIPT_LOADED;
828
+ var constants_53 = constants.SET_GOOGLE_MAP_SCRIPT_ERROR;
827
829
 
828
830
  var componentsReducer_1 = createCommonjsModule(function (module, exports) {
829
831
  Object.defineProperty(exports, "__esModule", {
@@ -1167,6 +1169,7 @@
1167
1169
  SELECT: 'select',
1168
1170
  TAG: 'tag'
1169
1171
  };
1172
+ var TREELIST_VALUES_PATH_SEPARATOR = exports.TREELIST_VALUES_PATH_SEPARATOR = '◐◑◒◓';
1170
1173
  });
1171
1174
  unwrapExports(constants$1);
1172
1175
  var constants_1$1 = constants$1.componentTypes;
@@ -1174,6 +1177,7 @@
1174
1177
  var constants_3$1 = constants$1.validProps;
1175
1178
  var constants_4$1 = constants$1.CLEAR_ALL;
1176
1179
  var constants_5$1 = constants$1.SEARCH_COMPONENTS_MODES;
1180
+ var constants_6$1 = constants$1.TREELIST_VALUES_PATH_SEPARATOR;
1177
1181
 
1178
1182
  var analytics = createCommonjsModule(function (module, exports) {
1179
1183
  Object.defineProperty(exports, "__esModule", {
@@ -1595,9 +1599,12 @@
1595
1599
  if (componentKeys.length) {
1596
1600
  var _newState = {};
1597
1601
  componentKeys.forEach(function (component) {
1602
+ var _action$componentsVal = action.componentsValues[component],
1603
+ value = _action$componentsVal.value,
1604
+ rest = _objectWithoutProperties(_action$componentsVal, ['value']);
1598
1605
  _newState[component] = _extends({}, state[component], {
1599
- value: action.componentsValues[component]
1600
- });
1606
+ value: value
1607
+ }, rest);
1601
1608
  });
1602
1609
  return _extends({}, state, _newState);
1603
1610
  }
@@ -2858,6 +2865,22 @@
2858
2865
  });
2859
2866
  unwrapExports(googleMapScriptReducer_1);
2860
2867
 
2868
+ var analyticsRefReducer_1 = createCommonjsModule(function (module, exports) {
2869
+ Object.defineProperty(exports, "__esModule", {
2870
+ value: true
2871
+ });
2872
+ exports["default"] = analyticsRefReducer;
2873
+ function analyticsRefReducer() {
2874
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2875
+ var action = arguments[1];
2876
+ if (action.type === constants.ADD_ANALYTICS_REF) {
2877
+ return action.analyticsRef;
2878
+ }
2879
+ return state;
2880
+ }
2881
+ });
2882
+ unwrapExports(analyticsRefReducer_1);
2883
+
2861
2884
  var reducers = createCommonjsModule(function (module, exports) {
2862
2885
  Object.defineProperty(exports, "__esModule", {
2863
2886
  value: true
@@ -2897,6 +2920,7 @@
2897
2920
  var _queryToHitsReducer2 = _interopRequireDefault(queryToHitsReducer_1);
2898
2921
  var _recentSearches2 = _interopRequireDefault(recentSearches);
2899
2922
  var _googleMapScriptReducer2 = _interopRequireDefault(googleMapScriptReducer_1);
2923
+ var _analyticsRefReducer2 = _interopRequireDefault(analyticsRefReducer_1);
2900
2924
  function _interopRequireDefault(obj) {
2901
2925
  return obj && obj.__esModule ? obj : {
2902
2926
  "default": obj
@@ -2913,6 +2937,7 @@
2913
2937
  queryOptions: _queryOptionsReducer2["default"],
2914
2938
  dependencyTree: _dependencyTreeReducer2["default"],
2915
2939
  appbaseRef: _appbaseRefReducer2["default"],
2940
+ analyticsRef: _analyticsRefReducer2["default"],
2916
2941
  config: _configReducer2["default"],
2917
2942
  hits: _hitsReducer2["default"],
2918
2943
  promotedResults: _promotedResultsReducer2["default"],
@@ -5274,12 +5299,13 @@
5274
5299
  return isFunction(children) || isFunction(render);
5275
5300
  };
5276
5301
  var recLookup = exports.recLookup = function recLookup(obj, path) {
5302
+ var separator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
5277
5303
  try {
5278
- var parts = path.split('.');
5304
+ var parts = path.split(separator);
5279
5305
  if (parts.length === 1) {
5280
5306
  return obj[parts[0]];
5281
5307
  }
5282
- return recLookup(obj[parts[0]], parts.slice(1).join('.'));
5308
+ return recLookup(obj[parts[0]], parts.slice(1).join(separator), separator);
5283
5309
  } catch (e) {
5284
5310
  return false;
5285
5311
  }
@@ -5450,319 +5476,6 @@
5450
5476
  var helper_46 = helper.isValidDateRangeQueryFormat;
5451
5477
  var helper_47 = helper.setDeep;
5452
5478
 
5453
- var hits = createCommonjsModule(function (module, exports) {
5454
- Object.defineProperty(exports, "__esModule", {
5455
- value: true
5456
- });
5457
- exports.updateAggs = updateAggs;
5458
- exports.updateCompositeAggs = updateCompositeAggs;
5459
- exports.updateHits = updateHits;
5460
- exports.saveQueryToHits = saveQueryToHits;
5461
- exports.mockDataForTesting = mockDataForTesting;
5462
- function updateAggs(component, aggregations) {
5463
- var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
5464
- return {
5465
- type: constants.UPDATE_AGGS,
5466
- component: component,
5467
- aggregations: aggregations,
5468
- append: append
5469
- };
5470
- }
5471
- function updateCompositeAggs(component, aggregations) {
5472
- var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
5473
- return {
5474
- type: constants.UPDATE_COMPOSITE_AGGS,
5475
- component: component,
5476
- aggregations: aggregations,
5477
- append: append
5478
- };
5479
- }
5480
- function updateHits(component, hits, time, hidden) {
5481
- var append = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
5482
- return {
5483
- type: constants.UPDATE_HITS,
5484
- component: component,
5485
- hits: hits.hits,
5486
- total: typeof hits.total === 'object' ? hits.total.value : hits.total,
5487
- hidden: hidden,
5488
- time: time,
5489
- append: append
5490
- };
5491
- }
5492
- function saveQueryToHits(component, query) {
5493
- return {
5494
- type: constants.SET_QUERY_TO_HITS,
5495
- component: component,
5496
- query: query
5497
- };
5498
- }
5499
- function mockDataForTesting(component, data) {
5500
- return function (dispatch) {
5501
- if (data.hasOwnProperty('error')) {
5502
- dispatch((0, misc.setError)(component, data.error));
5503
- }
5504
- if (data.hasOwnProperty('aggregations')) {
5505
- dispatch(updateAggs(component, data.aggregations));
5506
- }
5507
- if (data.hasOwnProperty('hits')) {
5508
- dispatch(updateHits(component, data, data.time || undefined));
5509
- }
5510
- };
5511
- }
5512
- });
5513
- unwrapExports(hits);
5514
- var hits_1 = hits.updateAggs;
5515
- var hits_2 = hits.updateCompositeAggs;
5516
- var hits_3 = hits.updateHits;
5517
- var hits_4 = hits.saveQueryToHits;
5518
- var hits_5 = hits.mockDataForTesting;
5519
-
5520
- var misc = createCommonjsModule(function (module, exports) {
5521
- Object.defineProperty(exports, "__esModule", {
5522
- value: true
5523
- });
5524
- exports.setRawData = setRawData;
5525
- exports.setLoading = setLoading;
5526
- exports.setError = setError;
5527
- exports.setTimestamp = setTimestamp;
5528
- exports.setSearchId = setSearchId;
5529
- exports.setSuggestionsSearchId = setSuggestionsSearchId;
5530
- exports.setQuery = setQuery;
5531
- exports.setCustomQuery = setCustomQuery;
5532
- exports.setDefaultQuery = setDefaultQuery;
5533
- exports.setCustomHighlightOptions = setCustomHighlightOptions;
5534
- exports.updateQueryOptions = updateQueryOptions;
5535
- exports.logQuery = logQuery;
5536
- exports.logCombinedQuery = logCombinedQuery;
5537
- exports.setHeaders = setHeaders;
5538
- exports.setPromotedResults = setPromotedResults;
5539
- exports.setPopularSuggestions = setPopularSuggestions;
5540
- exports.setDefaultPopularSuggestions = setDefaultPopularSuggestions;
5541
- exports.setCustomData = setCustomData;
5542
- exports.setAppliedSettings = setAppliedSettings;
5543
- exports.setQueryListener = setQueryListener;
5544
- exports.setGoogleMapScriptLoading = setGoogleMapScriptLoading;
5545
- exports.setGoogleMapScriptLoaded = setGoogleMapScriptLoaded;
5546
- exports.setGoogleMapScriptError = setGoogleMapScriptError;
5547
- exports.resetStoreForComponent = resetStoreForComponent;
5548
- exports.setLastUsedAppbaseQuery = setLastUsedAppbaseQuery;
5549
- function setRawData(component, response) {
5550
- return {
5551
- type: constants.SET_RAW_DATA,
5552
- component: component,
5553
- response: response
5554
- };
5555
- }
5556
- function setLoading(component, isLoading) {
5557
- return {
5558
- type: constants.SET_LOADING,
5559
- component: component,
5560
- isLoading: isLoading
5561
- };
5562
- }
5563
- function setError(component, error) {
5564
- return {
5565
- type: constants.SET_ERROR,
5566
- component: component,
5567
- error: error
5568
- };
5569
- }
5570
- function setTimestamp(component, timestamp) {
5571
- return {
5572
- type: constants.SET_TIMESTAMP,
5573
- component: component,
5574
- timestamp: timestamp
5575
- };
5576
- }
5577
- function setSearchId() {
5578
- var searchId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
5579
- return {
5580
- type: constants.SET_SEARCH_ID,
5581
- searchId: searchId
5582
- };
5583
- }
5584
- function setSuggestionsSearchId() {
5585
- var searchId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
5586
- return {
5587
- type: constants.SET_SUGGESTIONS_SEARCH_ID,
5588
- searchId: searchId
5589
- };
5590
- }
5591
- function setQuery(component, query) {
5592
- return {
5593
- type: constants.SET_QUERY,
5594
- component: component,
5595
- query: query
5596
- };
5597
- }
5598
- function setCustomQuery(component, query) {
5599
- return {
5600
- type: constants.SET_CUSTOM_QUERY,
5601
- component: component,
5602
- query: query
5603
- };
5604
- }
5605
- function setDefaultQuery(component, query) {
5606
- return {
5607
- type: constants.SET_DEFAULT_QUERY,
5608
- component: component,
5609
- query: query
5610
- };
5611
- }
5612
- function setCustomHighlightOptions(component, data) {
5613
- return {
5614
- type: constants.SET_CUSTOM_HIGHLIGHT_OPTIONS,
5615
- component: component,
5616
- data: data
5617
- };
5618
- }
5619
- function updateQueryOptions(component, options) {
5620
- return {
5621
- type: constants.SET_QUERY_OPTIONS,
5622
- component: component,
5623
- options: options
5624
- };
5625
- }
5626
- function logQuery(component, query) {
5627
- return {
5628
- type: constants.LOG_QUERY,
5629
- component: component,
5630
- query: query
5631
- };
5632
- }
5633
- function logCombinedQuery(component, query) {
5634
- return {
5635
- type: constants.LOG_COMBINED_QUERY,
5636
- component: component,
5637
- query: query
5638
- };
5639
- }
5640
- function setHeaders(headers) {
5641
- return {
5642
- type: constants.SET_HEADERS,
5643
- headers: headers
5644
- };
5645
- }
5646
- function setPromotedResults() {
5647
- var results = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5648
- var component = arguments[1];
5649
- return {
5650
- type: constants.SET_PROMOTED_RESULTS,
5651
- results: results,
5652
- component: component
5653
- };
5654
- }
5655
- function setPopularSuggestions() {
5656
- var suggestions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5657
- var component = arguments[1];
5658
- return {
5659
- type: constants.SET_POPULAR_SUGGESTIONS,
5660
- suggestions: suggestions,
5661
- component: component
5662
- };
5663
- }
5664
- function setDefaultPopularSuggestions() {
5665
- var suggestions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5666
- var component = arguments[1];
5667
- return {
5668
- type: constants.SET_DEFAULT_POPULAR_SUGGESTIONS,
5669
- suggestions: suggestions,
5670
- component: component
5671
- };
5672
- }
5673
- function setCustomData() {
5674
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
5675
- var component = arguments[1];
5676
- return {
5677
- type: constants.SET_CUSTOM_DATA,
5678
- data: data,
5679
- component: component
5680
- };
5681
- }
5682
- function setAppliedSettings() {
5683
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
5684
- var component = arguments[1];
5685
- return {
5686
- type: constants.SET_APPLIED_SETTINGS,
5687
- data: data,
5688
- component: component
5689
- };
5690
- }
5691
- function setQueryListener(component, onQueryChange, onError) {
5692
- return {
5693
- type: constants.SET_QUERY_LISTENER,
5694
- component: component,
5695
- onQueryChange: onQueryChange,
5696
- onError: onError
5697
- };
5698
- }
5699
- function setGoogleMapScriptLoading(bool) {
5700
- return {
5701
- type: constants.SET_GOOGLE_MAP_SCRIPT_LOADING,
5702
- loading: bool
5703
- };
5704
- }
5705
- function setGoogleMapScriptLoaded(bool) {
5706
- return {
5707
- type: constants.SET_GOOGLE_MAP_SCRIPT_LOADED,
5708
- loaded: bool
5709
- };
5710
- }
5711
- function setGoogleMapScriptError(error) {
5712
- return {
5713
- type: constants.SET_GOOGLE_MAP_SCRIPT_ERROR,
5714
- error: error
5715
- };
5716
- }
5717
- function resetStoreForComponent(componentId) {
5718
- return function (dispatch) {
5719
- dispatch(setRawData(componentId, null));
5720
- dispatch(setCustomData(null, componentId));
5721
- dispatch(setPromotedResults([], componentId));
5722
- dispatch(setPopularSuggestions([], componentId));
5723
- dispatch(setDefaultPopularSuggestions([], componentId));
5724
- dispatch((0, hits.updateAggs)(componentId, null));
5725
- dispatch((0, hits.updateCompositeAggs)(componentId, {}));
5726
- dispatch((0, hits.updateHits)(componentId, {
5727
- hits: [],
5728
- total: 0
5729
- }, 0));
5730
- };
5731
- }
5732
- function setLastUsedAppbaseQuery(query) {
5733
- return {
5734
- type: constants.SET_APPBASE_QUERY,
5735
- query: query
5736
- };
5737
- }
5738
- });
5739
- unwrapExports(misc);
5740
- var misc_1 = misc.setRawData;
5741
- var misc_2 = misc.setLoading;
5742
- var misc_3 = misc.setError;
5743
- var misc_4 = misc.setTimestamp;
5744
- var misc_5 = misc.setSearchId;
5745
- var misc_6 = misc.setSuggestionsSearchId;
5746
- var misc_7 = misc.setQuery;
5747
- var misc_8 = misc.setCustomQuery;
5748
- var misc_9 = misc.setDefaultQuery;
5749
- var misc_10 = misc.setCustomHighlightOptions;
5750
- var misc_11 = misc.updateQueryOptions;
5751
- var misc_12 = misc.logQuery;
5752
- var misc_13 = misc.logCombinedQuery;
5753
- var misc_14 = misc.setHeaders;
5754
- var misc_15 = misc.setPromotedResults;
5755
- var misc_16 = misc.setPopularSuggestions;
5756
- var misc_17 = misc.setDefaultPopularSuggestions;
5757
- var misc_18 = misc.setCustomData;
5758
- var misc_19 = misc.setAppliedSettings;
5759
- var misc_20 = misc.setQueryListener;
5760
- var misc_21 = misc.setGoogleMapScriptLoading;
5761
- var misc_22 = misc.setGoogleMapScriptLoaded;
5762
- var misc_23 = misc.setGoogleMapScriptError;
5763
- var misc_24 = misc.resetStoreForComponent;
5764
- var misc_25 = misc.setLastUsedAppbaseQuery;
5765
-
5766
5479
  var xdate = createCommonjsModule(function (module) {
5767
5480
  /**
5768
5481
  * @preserve XDate v@VERSION
@@ -6464,7 +6177,7 @@
6464
6177
  Object.defineProperty(exports, "__esModule", {
6465
6178
  value: true
6466
6179
  });
6467
- exports.getDependentQueries = exports.extractPropsFromState = exports.getValidInterval = exports.getRSQuery = exports.hasPaginationSupport = exports.isComponentUsesLabelAsValue = exports.isSearchComponent = exports.isDRSRangeComponent = exports.getHistogramComponentID = exports.getInternalComponentID = exports.isInternalComponent = exports.getNormalizedField = exports.componentToTypeMap = undefined;
6180
+ exports.transformValueToComponentStateFormat = exports.getDependentQueries = exports.extractPropsFromState = exports.getValidInterval = exports.getRSQuery = exports.hasPaginationSupport = exports.isComponentUsesLabelAsValue = exports.isSearchComponent = exports.isDRSRangeComponent = exports.getHistogramComponentID = exports.getInternalComponentID = exports.isInternalComponent = exports.getNormalizedField = exports.componentToTypeMap = undefined;
6468
6181
  var _extends = Object.assign || function (target) {
6469
6182
  for (var i = 1; i < arguments.length; i++) {
6470
6183
  var source = arguments[i];
@@ -6717,20 +6430,26 @@
6717
6430
  }
6718
6431
  }
6719
6432
  if (dateRangeComponents.includes(componentProps.componentType)) {
6720
- queryFormat = 'or';
6721
6433
  if (value) {
6722
- if (typeof value === 'string') {
6723
- value = {
6724
- start: (0, helper.formatDate)(new _xdate2["default"](value).addHours(-24), componentProps),
6725
- end: (0, helper.formatDate)(new _xdate2["default"](value), componentProps)
6726
- };
6727
- } else if (Array.isArray(value)) {
6728
- value = value.map(function (val) {
6729
- return {
6730
- start: (0, helper.formatDate)(new _xdate2["default"](val).addHours(-24), componentProps),
6731
- end: (0, helper.formatDate)(new _xdate2["default"](val), componentProps)
6434
+ if ((0, helper.isValidDateRangeQueryFormat)(componentProps.queryFormat)) {
6435
+ if (typeof value === 'string') {
6436
+ value = {
6437
+ start: (0, helper.formatDate)(new _xdate2["default"](value).addHours(-24), componentProps),
6438
+ end: (0, helper.formatDate)(new _xdate2["default"](value), componentProps)
6732
6439
  };
6733
- });
6440
+ } else if (Array.isArray(value)) {
6441
+ value = value.map(function (val) {
6442
+ return {
6443
+ start: (0, helper.formatDate)(new _xdate2["default"](val).addHours(-24), componentProps),
6444
+ end: (0, helper.formatDate)(new _xdate2["default"](val), componentProps)
6445
+ };
6446
+ });
6447
+ } else {
6448
+ value = {
6449
+ start: (0, helper.formatDate)(new _xdate2["default"](value.start).addHours(-24), componentProps),
6450
+ end: (0, helper.formatDate)(new _xdate2["default"](value.end), componentProps)
6451
+ };
6452
+ }
6734
6453
  }
6735
6454
  }
6736
6455
  }
@@ -6888,13 +6607,19 @@
6888
6607
  execute = true;
6889
6608
  }
6890
6609
  var componentProps = store.props[component];
6891
- var dependentQuery = getRSQuery(component, extractPropsFromState(store, component, _extends({}, componentProps && componentProps.componentType === constants$1.componentTypes.searchBox ? _extends({}, execute === false ? {
6610
+ var dependentQuery = getRSQuery(component, extractPropsFromState(store, component, _extends({}, componentProps && _extends({}, componentProps.componentType === constants$1.componentTypes.searchBox ? _extends({}, execute === false ? {
6892
6611
  type: constants$1.queryTypes.search
6893
6612
  } : {}, calcValues.category ? {
6894
6613
  categoryValue: calcValues.category
6895
- } : {}, calcValues.value ? {
6614
+ } : {
6615
+ categoryValue: undefined
6616
+ }, calcValues.value ? {
6896
6617
  value: calcValues.value
6897
- } : {}) : {})), execute);
6618
+ } : {}) : {}, componentProps.componentType === constants$1.componentTypes.categorySearch ? _extends({}, calcValues.category ? {
6619
+ categoryValue: calcValues.category
6620
+ } : {
6621
+ categoryValue: undefined
6622
+ }) : {}))), execute);
6898
6623
  if (dependentQuery) {
6899
6624
  finalQuery[component] = dependentQuery;
6900
6625
  }
@@ -6903,22 +6628,527 @@
6903
6628
  });
6904
6629
  return finalQuery;
6905
6630
  };
6631
+ var transformValueToComponentStateFormat = exports.transformValueToComponentStateFormat = function transformValueToComponentStateFormat(value, componentProps) {
6632
+ var componentType = componentProps.componentType,
6633
+ data = componentProps.data,
6634
+ queryFormat = componentProps.queryFormat;
6635
+ var transformedValue = value;
6636
+ var meta = {};
6637
+ if (value) {
6638
+ switch (componentType) {
6639
+ case constants$1.componentTypes.singleDataList:
6640
+ case constants$1.componentTypes.tabDataList:
6641
+ transformedValue = '';
6642
+ if (Array.isArray(value) && typeof value[0] === 'string') {
6643
+ transformedValue = value[0];
6644
+ } else if (typeof value === 'object' && value.label) {
6645
+ transformedValue = value.label;
6646
+ } else {
6647
+ transformedValue = value;
6648
+ }
6649
+ break;
6650
+ case constants$1.componentTypes.multiDataList:
6651
+ transformedValue = [];
6652
+ if (Array.isArray(value)) {
6653
+ value.forEach(function (valObj) {
6654
+ if (typeof valObj === 'object' && (valObj.label || valObj.value)) {
6655
+ transformedValue.push(valObj.label || valObj.value);
6656
+ } else if (typeof valObj === 'string') {
6657
+ transformedValue.push(valObj);
6658
+ }
6659
+ });
6660
+ }
6661
+ break;
6662
+ case constants$1.componentTypes.toggleButton:
6663
+ transformedValue = [];
6664
+ if (Array.isArray(value)) {
6665
+ value.forEach(function (valObj) {
6666
+ if (typeof valObj === 'object' && valObj.label && valObj.value) {
6667
+ transformedValue.push(valObj);
6668
+ } else if (typeof valObj === 'string') {
6669
+ var findDataObj = data.find(function (item) {
6670
+ return item.label.trim() === valObj.trim() || item.value.trim() === valObj.trim();
6671
+ });
6672
+ transformedValue.push(findDataObj);
6673
+ }
6674
+ });
6675
+ } else if (typeof value === 'object' && value.label && value.value) {
6676
+ transformedValue = value.value;
6677
+ } else if (typeof value === 'string') {
6678
+ var findDataObj = data.find(function (item) {
6679
+ return item.label.trim() === value.trim() || item.value.trim() === value.trim();
6680
+ });
6681
+ transformedValue = findDataObj.value;
6682
+ }
6683
+ break;
6684
+ case constants$1.componentTypes.singleRange:
6685
+ case constants$1.componentTypes.singleDropdownRange:
6686
+ transformedValue = {};
6687
+ if (!Array.isArray(value) && typeof value === 'object') {
6688
+ transformedValue = _extends({}, value);
6689
+ } else if (typeof value === 'string') {
6690
+ var _findDataObj = data.find(function (item) {
6691
+ return item.label.trim() === value.trim();
6692
+ });
6693
+ transformedValue = _extends({}, _findDataObj);
6694
+ }
6695
+ break;
6696
+ case constants$1.componentTypes.multiDropdownRange:
6697
+ case constants$1.componentTypes.multiRange:
6698
+ transformedValue = [];
6699
+ if (Array.isArray(value)) {
6700
+ value.forEach(function (valObj) {
6701
+ if (typeof valObj === 'object' && typeof valObj.start === 'number' && typeof valObj.end === 'number') {
6702
+ var _findDataObj2 = _extends({}, valObj);
6703
+ if (!_findDataObj2.label) {
6704
+ _findDataObj2 = data.find(function (item) {
6705
+ return item.start === valObj.start && item.end === valObj.end;
6706
+ });
6707
+ }
6708
+ transformedValue.push(_findDataObj2);
6709
+ } else if (typeof valObj === 'string') {
6710
+ var _findDataObj3 = data.find(function (item) {
6711
+ return item.label.trim() === valObj.trim();
6712
+ });
6713
+ transformedValue.push(_findDataObj3);
6714
+ }
6715
+ });
6716
+ } else if (typeof value === 'string') {
6717
+ var _findDataObj4 = data.find(function (item) {
6718
+ return item.label.trim() === value.trim();
6719
+ });
6720
+ transformedValue.push(_findDataObj4);
6721
+ }
6722
+ break;
6723
+ case constants$1.componentTypes.rangeSlider:
6724
+ case constants$1.componentTypes.ratingsFilter:
6725
+ case constants$1.componentTypes.dynamicRangeSlider:
6726
+ case constants$1.componentTypes.reactiveChart:
6727
+ transformedValue = [];
6728
+ if (queryFormat) {
6729
+ if (Array.isArray(value)) {
6730
+ transformedValue = value.map(function (item) {
6731
+ return (0, helper.formatDate)(new _xdate2["default"](item), componentProps);
6732
+ });
6733
+ } else if (typeof value === 'object') {
6734
+ transformedValue = [(0, helper.formatDate)(new _xdate2["default"](value.start), componentProps), (0, helper.formatDate)(new _xdate2["default"](value.end), componentProps)];
6735
+ }
6736
+ } else if (Array.isArray(value)) {
6737
+ transformedValue = [].concat(_toConsumableArray(value));
6738
+ } else if (typeof value === 'object') {
6739
+ transformedValue = [value.start, value.end];
6740
+ } else {
6741
+ transformedValue = value;
6742
+ }
6743
+ break;
6744
+ case constants$1.componentTypes.numberBox:
6745
+ transformedValue = [];
6746
+ if (!Array.isArray(value) && typeof value === 'object') {
6747
+ transformedValue = value.start;
6748
+ } else if (typeof value === 'number') {
6749
+ transformedValue = value;
6750
+ }
6751
+ break;
6752
+ case constants$1.componentTypes.datePicker:
6753
+ transformedValue = '';
6754
+ if (typeof value !== 'object') {
6755
+ transformedValue = new _xdate2["default"](value).toString('yyyy-MM-dd');
6756
+ } else if (value.end) {
6757
+ transformedValue = new _xdate2["default"](value.end).toString('yyyy-MM-dd');
6758
+ } else if (value.start) {
6759
+ transformedValue = new _xdate2["default"](value.start).addHours(24).toString('yyyy-MM-dd');
6760
+ }
6761
+ break;
6762
+ case constants$1.componentTypes.dateRange:
6763
+ transformedValue = [];
6764
+ if (Array.isArray(value)) {
6765
+ transformedValue = value.map(function (t) {
6766
+ return new _xdate2["default"](t).toString('yyyy-MM-dd');
6767
+ });
6768
+ } else if (typeof value === 'object') {
6769
+ transformedValue = [new _xdate2["default"](value.start).toString('yyyy-MM-dd'), new _xdate2["default"](value.end).toString('yyyy-MM-dd')];
6770
+ }
6771
+ break;
6772
+ case constants$1.componentTypes.categorySearch:
6773
+ transformedValue = '';
6774
+ if (typeof value === 'object') {
6775
+ transformedValue = value.value;
6776
+ if (value.category !== undefined) {
6777
+ meta.category = value.category;
6778
+ }
6779
+ } else if (typeof value === 'string') {
6780
+ transformedValue = value;
6781
+ }
6782
+ break;
6783
+ }
6784
+ }
6785
+ return {
6786
+ value: transformedValue,
6787
+ meta: meta
6788
+ };
6789
+ };
6906
6790
  });
6907
6791
  unwrapExports(transform);
6908
- var transform_1 = transform.getDependentQueries;
6909
- var transform_2 = transform.extractPropsFromState;
6910
- var transform_3 = transform.getValidInterval;
6911
- var transform_4 = transform.getRSQuery;
6912
- var transform_5 = transform.hasPaginationSupport;
6913
- var transform_6 = transform.isComponentUsesLabelAsValue;
6914
- var transform_7 = transform.isSearchComponent;
6915
- var transform_8 = transform.isDRSRangeComponent;
6916
- var transform_9 = transform.getHistogramComponentID;
6917
- var transform_10 = transform.getInternalComponentID;
6918
- var transform_11 = transform.isInternalComponent;
6919
- var transform_12 = transform.getNormalizedField;
6920
- var transform_13 = transform.componentToTypeMap;
6921
- var transform_14 = transform.flatReactProp;
6792
+ var transform_1 = transform.transformValueToComponentStateFormat;
6793
+ var transform_2 = transform.getDependentQueries;
6794
+ var transform_3 = transform.extractPropsFromState;
6795
+ var transform_4 = transform.getValidInterval;
6796
+ var transform_5 = transform.getRSQuery;
6797
+ var transform_6 = transform.hasPaginationSupport;
6798
+ var transform_7 = transform.isComponentUsesLabelAsValue;
6799
+ var transform_8 = transform.isSearchComponent;
6800
+ var transform_9 = transform.isDRSRangeComponent;
6801
+ var transform_10 = transform.getHistogramComponentID;
6802
+ var transform_11 = transform.getInternalComponentID;
6803
+ var transform_12 = transform.isInternalComponent;
6804
+ var transform_13 = transform.getNormalizedField;
6805
+ var transform_14 = transform.componentToTypeMap;
6806
+ var transform_15 = transform.flatReactProp;
6807
+
6808
+ var hits = createCommonjsModule(function (module, exports) {
6809
+ Object.defineProperty(exports, "__esModule", {
6810
+ value: true
6811
+ });
6812
+ exports.updateAggs = updateAggs;
6813
+ exports.updateCompositeAggs = updateCompositeAggs;
6814
+ exports.updateHits = updateHits;
6815
+ exports.saveQueryToHits = saveQueryToHits;
6816
+ exports.mockDataForTesting = mockDataForTesting;
6817
+ function updateAggs(component, aggregations) {
6818
+ var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6819
+ return {
6820
+ type: constants.UPDATE_AGGS,
6821
+ component: component,
6822
+ aggregations: aggregations,
6823
+ append: append
6824
+ };
6825
+ }
6826
+ function updateCompositeAggs(component, aggregations) {
6827
+ var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6828
+ return {
6829
+ type: constants.UPDATE_COMPOSITE_AGGS,
6830
+ component: component,
6831
+ aggregations: aggregations,
6832
+ append: append
6833
+ };
6834
+ }
6835
+ function updateHits(component, hits, time, hidden) {
6836
+ var append = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6837
+ return {
6838
+ type: constants.UPDATE_HITS,
6839
+ component: component,
6840
+ hits: hits.hits,
6841
+ total: typeof hits.total === 'object' ? hits.total.value : hits.total,
6842
+ hidden: hidden,
6843
+ time: time,
6844
+ append: append
6845
+ };
6846
+ }
6847
+ function saveQueryToHits(component, query) {
6848
+ return {
6849
+ type: constants.SET_QUERY_TO_HITS,
6850
+ component: component,
6851
+ query: query
6852
+ };
6853
+ }
6854
+ function mockDataForTesting(component, data) {
6855
+ return function (dispatch) {
6856
+ if (data.hasOwnProperty('error')) {
6857
+ dispatch((0, misc.setError)(component, data.error));
6858
+ }
6859
+ if (data.hasOwnProperty('aggregations')) {
6860
+ dispatch(updateAggs(component, data.aggregations));
6861
+ }
6862
+ if (data.hasOwnProperty('hits')) {
6863
+ dispatch(updateHits(component, data, data.time || undefined));
6864
+ }
6865
+ };
6866
+ }
6867
+ });
6868
+ unwrapExports(hits);
6869
+ var hits_1 = hits.updateAggs;
6870
+ var hits_2 = hits.updateCompositeAggs;
6871
+ var hits_3 = hits.updateHits;
6872
+ var hits_4 = hits.saveQueryToHits;
6873
+ var hits_5 = hits.mockDataForTesting;
6874
+
6875
+ var misc = createCommonjsModule(function (module, exports) {
6876
+ Object.defineProperty(exports, "__esModule", {
6877
+ value: true
6878
+ });
6879
+ var _extends = Object.assign || function (target) {
6880
+ for (var i = 1; i < arguments.length; i++) {
6881
+ var source = arguments[i];
6882
+ for (var key in source) {
6883
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
6884
+ target[key] = source[key];
6885
+ }
6886
+ }
6887
+ }
6888
+ return target;
6889
+ };
6890
+ exports.setRawData = setRawData;
6891
+ exports.setLoading = setLoading;
6892
+ exports.setError = setError;
6893
+ exports.setTimestamp = setTimestamp;
6894
+ exports.setSearchId = setSearchId;
6895
+ exports.setSuggestionsSearchId = setSuggestionsSearchId;
6896
+ exports.setQuery = setQuery;
6897
+ exports.setCustomQuery = setCustomQuery;
6898
+ exports.setDefaultQuery = setDefaultQuery;
6899
+ exports.setCustomHighlightOptions = setCustomHighlightOptions;
6900
+ exports.updateQueryOptions = updateQueryOptions;
6901
+ exports.logQuery = logQuery;
6902
+ exports.logCombinedQuery = logCombinedQuery;
6903
+ exports.setHeaders = setHeaders;
6904
+ exports.setPromotedResults = setPromotedResults;
6905
+ exports.setPopularSuggestions = setPopularSuggestions;
6906
+ exports.setDefaultPopularSuggestions = setDefaultPopularSuggestions;
6907
+ exports.setCustomData = setCustomData;
6908
+ exports.setAppliedSettings = setAppliedSettings;
6909
+ exports.setQueryListener = setQueryListener;
6910
+ exports.setGoogleMapScriptLoading = setGoogleMapScriptLoading;
6911
+ exports.setGoogleMapScriptLoaded = setGoogleMapScriptLoaded;
6912
+ exports.setGoogleMapScriptError = setGoogleMapScriptError;
6913
+ exports.resetStoreForComponent = resetStoreForComponent;
6914
+ exports.setLastUsedAppbaseQuery = setLastUsedAppbaseQuery;
6915
+ exports.setSearchState = setSearchState;
6916
+ function setRawData(component, response) {
6917
+ return {
6918
+ type: constants.SET_RAW_DATA,
6919
+ component: component,
6920
+ response: response
6921
+ };
6922
+ }
6923
+ function setLoading(component, isLoading) {
6924
+ return {
6925
+ type: constants.SET_LOADING,
6926
+ component: component,
6927
+ isLoading: isLoading
6928
+ };
6929
+ }
6930
+ function setError(component, error) {
6931
+ return {
6932
+ type: constants.SET_ERROR,
6933
+ component: component,
6934
+ error: error
6935
+ };
6936
+ }
6937
+ function setTimestamp(component, timestamp) {
6938
+ return {
6939
+ type: constants.SET_TIMESTAMP,
6940
+ component: component,
6941
+ timestamp: timestamp
6942
+ };
6943
+ }
6944
+ function setSearchId() {
6945
+ var searchId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
6946
+ return {
6947
+ type: constants.SET_SEARCH_ID,
6948
+ searchId: searchId
6949
+ };
6950
+ }
6951
+ function setSuggestionsSearchId() {
6952
+ var searchId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
6953
+ return {
6954
+ type: constants.SET_SUGGESTIONS_SEARCH_ID,
6955
+ searchId: searchId
6956
+ };
6957
+ }
6958
+ function setQuery(component, query) {
6959
+ return {
6960
+ type: constants.SET_QUERY,
6961
+ component: component,
6962
+ query: query
6963
+ };
6964
+ }
6965
+ function setCustomQuery(component, query) {
6966
+ return {
6967
+ type: constants.SET_CUSTOM_QUERY,
6968
+ component: component,
6969
+ query: query
6970
+ };
6971
+ }
6972
+ function setDefaultQuery(component, query) {
6973
+ return {
6974
+ type: constants.SET_DEFAULT_QUERY,
6975
+ component: component,
6976
+ query: query
6977
+ };
6978
+ }
6979
+ function setCustomHighlightOptions(component, data) {
6980
+ return {
6981
+ type: constants.SET_CUSTOM_HIGHLIGHT_OPTIONS,
6982
+ component: component,
6983
+ data: data
6984
+ };
6985
+ }
6986
+ function updateQueryOptions(component, options) {
6987
+ return {
6988
+ type: constants.SET_QUERY_OPTIONS,
6989
+ component: component,
6990
+ options: options
6991
+ };
6992
+ }
6993
+ function logQuery(component, query) {
6994
+ return {
6995
+ type: constants.LOG_QUERY,
6996
+ component: component,
6997
+ query: query
6998
+ };
6999
+ }
7000
+ function logCombinedQuery(component, query) {
7001
+ return {
7002
+ type: constants.LOG_COMBINED_QUERY,
7003
+ component: component,
7004
+ query: query
7005
+ };
7006
+ }
7007
+ function setHeaders(headers) {
7008
+ return {
7009
+ type: constants.SET_HEADERS,
7010
+ headers: headers
7011
+ };
7012
+ }
7013
+ function setPromotedResults() {
7014
+ var results = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7015
+ var component = arguments[1];
7016
+ return {
7017
+ type: constants.SET_PROMOTED_RESULTS,
7018
+ results: results,
7019
+ component: component
7020
+ };
7021
+ }
7022
+ function setPopularSuggestions() {
7023
+ var suggestions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7024
+ var component = arguments[1];
7025
+ return {
7026
+ type: constants.SET_POPULAR_SUGGESTIONS,
7027
+ suggestions: suggestions,
7028
+ component: component
7029
+ };
7030
+ }
7031
+ function setDefaultPopularSuggestions() {
7032
+ var suggestions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7033
+ var component = arguments[1];
7034
+ return {
7035
+ type: constants.SET_DEFAULT_POPULAR_SUGGESTIONS,
7036
+ suggestions: suggestions,
7037
+ component: component
7038
+ };
7039
+ }
7040
+ function setCustomData() {
7041
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
7042
+ var component = arguments[1];
7043
+ return {
7044
+ type: constants.SET_CUSTOM_DATA,
7045
+ data: data,
7046
+ component: component
7047
+ };
7048
+ }
7049
+ function setAppliedSettings() {
7050
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
7051
+ var component = arguments[1];
7052
+ return {
7053
+ type: constants.SET_APPLIED_SETTINGS,
7054
+ data: data,
7055
+ component: component
7056
+ };
7057
+ }
7058
+ function setQueryListener(component, onQueryChange, onError) {
7059
+ return {
7060
+ type: constants.SET_QUERY_LISTENER,
7061
+ component: component,
7062
+ onQueryChange: onQueryChange,
7063
+ onError: onError
7064
+ };
7065
+ }
7066
+ function setGoogleMapScriptLoading(bool) {
7067
+ return {
7068
+ type: constants.SET_GOOGLE_MAP_SCRIPT_LOADING,
7069
+ loading: bool
7070
+ };
7071
+ }
7072
+ function setGoogleMapScriptLoaded(bool) {
7073
+ return {
7074
+ type: constants.SET_GOOGLE_MAP_SCRIPT_LOADED,
7075
+ loaded: bool
7076
+ };
7077
+ }
7078
+ function setGoogleMapScriptError(error) {
7079
+ return {
7080
+ type: constants.SET_GOOGLE_MAP_SCRIPT_ERROR,
7081
+ error: error
7082
+ };
7083
+ }
7084
+ function resetStoreForComponent(componentId) {
7085
+ return function (dispatch) {
7086
+ dispatch(setRawData(componentId, null));
7087
+ dispatch(setCustomData(null, componentId));
7088
+ dispatch(setPromotedResults([], componentId));
7089
+ dispatch(setPopularSuggestions([], componentId));
7090
+ dispatch(setDefaultPopularSuggestions([], componentId));
7091
+ dispatch((0, hits.updateAggs)(componentId, null));
7092
+ dispatch((0, hits.updateCompositeAggs)(componentId, {}));
7093
+ dispatch((0, hits.updateHits)(componentId, {
7094
+ hits: [],
7095
+ total: 0
7096
+ }, 0));
7097
+ };
7098
+ }
7099
+ function setLastUsedAppbaseQuery(query) {
7100
+ return {
7101
+ type: constants.SET_APPBASE_QUERY,
7102
+ query: query
7103
+ };
7104
+ }
7105
+ function setSearchState() {
7106
+ var componentsValueAndTypeMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7107
+ return function (dispatch) {
7108
+ var componentValues = {};
7109
+ Object.keys(componentsValueAndTypeMap).forEach(function (componentId) {
7110
+ var _componentsValueAndTy = componentsValueAndTypeMap[componentId],
7111
+ value = _componentsValueAndTy.value,
7112
+ componentProps = _componentsValueAndTy.componentProps;
7113
+ var _transformValueToComp = (0, transform.transformValueToComponentStateFormat)(value, componentProps),
7114
+ transformedValue = _transformValueToComp.value,
7115
+ _transformValueToComp2 = _transformValueToComp.meta,
7116
+ meta = _transformValueToComp2 === undefined ? {} : _transformValueToComp2;
7117
+ componentValues[componentId] = _extends({
7118
+ value: transformedValue
7119
+ }, meta);
7120
+ });
7121
+ dispatch((0, value.setValues)(componentValues));
7122
+ };
7123
+ }
7124
+ });
7125
+ unwrapExports(misc);
7126
+ var misc_1 = misc.setRawData;
7127
+ var misc_2 = misc.setLoading;
7128
+ var misc_3 = misc.setError;
7129
+ var misc_4 = misc.setTimestamp;
7130
+ var misc_5 = misc.setSearchId;
7131
+ var misc_6 = misc.setSuggestionsSearchId;
7132
+ var misc_7 = misc.setQuery;
7133
+ var misc_8 = misc.setCustomQuery;
7134
+ var misc_9 = misc.setDefaultQuery;
7135
+ var misc_10 = misc.setCustomHighlightOptions;
7136
+ var misc_11 = misc.updateQueryOptions;
7137
+ var misc_12 = misc.logQuery;
7138
+ var misc_13 = misc.logCombinedQuery;
7139
+ var misc_14 = misc.setHeaders;
7140
+ var misc_15 = misc.setPromotedResults;
7141
+ var misc_16 = misc.setPopularSuggestions;
7142
+ var misc_17 = misc.setDefaultPopularSuggestions;
7143
+ var misc_18 = misc.setCustomData;
7144
+ var misc_19 = misc.setAppliedSettings;
7145
+ var misc_20 = misc.setQueryListener;
7146
+ var misc_21 = misc.setGoogleMapScriptLoading;
7147
+ var misc_22 = misc.setGoogleMapScriptLoaded;
7148
+ var misc_23 = misc.setGoogleMapScriptError;
7149
+ var misc_24 = misc.resetStoreForComponent;
7150
+ var misc_25 = misc.setLastUsedAppbaseQuery;
7151
+ var misc_26 = misc.setSearchState;
6922
7152
 
6923
7153
  var utils = createCommonjsModule(function (module, exports) {
6924
7154
  Object.defineProperty(exports, "__esModule", {
@@ -7019,13 +7249,15 @@
7019
7249
  var _getState3 = getState(),
7020
7250
  config = _getState3.config,
7021
7251
  internalValues = _getState3.internalValues,
7022
- lastUsedAppbaseQuery = _getState3.lastUsedAppbaseQuery;
7252
+ lastUsedAppbaseQuery = _getState3.lastUsedAppbaseQuery,
7253
+ analyticsRef = _getState3.analyticsRef;
7023
7254
  var searchId = res._headers ? res._headers.get('X-Search-Id') : null;
7024
7255
  if (searchId) {
7025
7256
  if (isSuggestionsQuery) {
7026
7257
  dispatch((0, misc.setSuggestionsSearchId)(searchId));
7027
7258
  } else {
7028
7259
  dispatch((0, misc.setSearchId)(searchId));
7260
+ analyticsRef.queryID = searchId;
7029
7261
  }
7030
7262
  }
7031
7263
  orderOfQueries.forEach(function (component) {
@@ -7097,6 +7329,8 @@
7097
7329
  appendToAggs = _ref3$appendToAggs === undefined ? false : _ref3$appendToAggs;
7098
7330
  var getState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
7099
7331
  var dispatch = arguments[2];
7332
+ var _getState5 = getState(),
7333
+ analyticsRef = _getState5.analyticsRef;
7100
7334
  orderOfQueries.forEach(function (component, index) {
7101
7335
  if (isComponentActive(getState, component)) {
7102
7336
  var searchId = res._headers ? res._headers.get('X-Search-Id') : null;
@@ -7105,18 +7339,19 @@
7105
7339
  dispatch((0, misc.setSuggestionsSearchId)(searchId));
7106
7340
  } else {
7107
7341
  dispatch((0, misc.setSearchId)(searchId));
7342
+ analyticsRef.queryID = searchId;
7108
7343
  }
7109
7344
  }
7110
7345
  var transformResponse = res;
7111
7346
  if (res && Array.isArray(res.responses) && res.responses[index]) {
7112
7347
  transformResponse = res.responses[index];
7113
7348
  }
7114
- var _getState5 = getState(),
7115
- config = _getState5.config,
7116
- internalValues = _getState5.internalValues;
7349
+ var _getState6 = getState(),
7350
+ config = _getState6.config,
7351
+ internalValues = _getState6.internalValues;
7117
7352
  handleTransformResponse(transformResponse, config, component).then(function (response) {
7118
- var _getState6 = getState(),
7119
- timestamp = _getState6.timestamp;
7353
+ var _getState7 = getState(),
7354
+ timestamp = _getState7.timestamp;
7120
7355
  if (timestamp[component] === undefined || timestamp[component] < res._timestamp) {
7121
7356
  dispatch((0, misc.setRawData)(component, response));
7122
7357
  var promotedResults = response.promoted || res.promoted;
@@ -7154,8 +7389,8 @@
7154
7389
  var getSuggestionQuery = exports.getSuggestionQuery = function getSuggestionQuery() {
7155
7390
  var getState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
7156
7391
  var componentId = arguments[1];
7157
- var _getState7 = getState(),
7158
- internalValues = _getState7.internalValues;
7392
+ var _getState8 = getState(),
7393
+ internalValues = _getState8.internalValues;
7159
7394
  var internalValue = internalValues[componentId];
7160
7395
  var value = internalValue && internalValue.value || '';
7161
7396
  return [{
@@ -8842,28 +9077,17 @@
8842
9077
  };
8843
9078
  }
8844
9079
  function recordClick(_ref) {
8845
- var url = _ref.url,
8846
- app = _ref.app,
8847
- credentials = _ref.credentials,
8848
- headers = _ref.headers,
8849
- documentId = _ref.documentId,
9080
+ var documentId = _ref.documentId,
8850
9081
  clickPosition = _ref.clickPosition,
8851
- queryId = _ref.queryId,
8852
- clickType = _ref.clickType;
9082
+ analyticsInstance = _ref.analyticsInstance,
9083
+ isSuggestionClick = _ref.isSuggestionClick;
8853
9084
  if (!documentId) {
8854
9085
  console.warn('ReactiveSearch: document id is required to record the click analytics');
8855
9086
  } else {
8856
- fetch(url + '/' + app + '/_analytics/click', {
8857
- method: 'PUT',
8858
- body: JSON.stringify({
8859
- query_id: queryId,
8860
- click_type: clickType || 'result',
8861
- click_on: _defineProperty({}, documentId, clickPosition + 1)
8862
- }),
8863
- headers: _extends({}, headers, {
8864
- 'Content-Type': 'application/json',
8865
- Authorization: 'Basic ' + btoa(credentials)
8866
- })
9087
+ analyticsInstance.click({
9088
+ queryID: analyticsInstance.getQueryID(),
9089
+ objects: _defineProperty({}, documentId, clickPosition + 1),
9090
+ isSuggestionClick: isSuggestionClick
8867
9091
  });
8868
9092
  }
8869
9093
  }
@@ -8876,7 +9100,8 @@
8876
9100
  _getState2$appbaseRef = _getState2.appbaseRef,
8877
9101
  url = _getState2$appbaseRef.url,
8878
9102
  protocol = _getState2$appbaseRef.protocol,
8879
- credentials = _getState2$appbaseRef.credentials;
9103
+ credentials = _getState2$appbaseRef.credentials,
9104
+ analyticsInstance = _getState2.analyticsRef;
8880
9105
  var app = config.app;
8881
9106
  var esURL = protocol + '://' + url;
8882
9107
  if (config.analytics && searchId) {
@@ -8896,13 +9121,9 @@
8896
9121
  });
8897
9122
  } else {
8898
9123
  recordClick({
8899
- url: parsedURL,
8900
- app: app,
8901
- credentials: credentials,
8902
- parsedHeaders: parsedHeaders,
8903
9124
  documentId: documentId,
8904
9125
  clickPosition: searchPosition,
8905
- queryId: searchId
9126
+ analyticsInstance: analyticsInstance
8906
9127
  });
8907
9128
  }
8908
9129
  }
@@ -8917,10 +9138,11 @@
8917
9138
  _getState3$appbaseRef = _getState3.appbaseRef,
8918
9139
  url = _getState3$appbaseRef.url,
8919
9140
  protocol = _getState3$appbaseRef.protocol,
8920
- credentials = _getState3$appbaseRef.credentials;
9141
+ credentials = _getState3$appbaseRef.credentials,
9142
+ analyticsInstance = _getState3.analyticsRef;
8921
9143
  var app = config.app;
8922
9144
  var esURL = protocol + '://' + url;
8923
- if (config.analytics && (config.analyticsConfig === undefined || config.analyticsConfig.suggestionAnalytics === undefined || config.analyticsConfig.suggestionAnalytics) && suggestionsSearchId && searchPosition !== undefined) {
9145
+ if (config.analytics && (config.analyticsConfig === undefined || config.analyticsConfig.suggestionAnalytics === undefined || config.analyticsConfig.suggestionAnalytics) && searchPosition !== undefined && suggestionsSearchId) {
8924
9146
  var parsedHeaders = headers;
8925
9147
  delete parsedHeaders['X-Search-Query'];
8926
9148
  var parsedURL = (esURL || '').replace(/\/+$/, '');
@@ -8935,18 +9157,14 @@
8935
9157
  'X-Search-Suggestions-ClickPosition': searchPosition + 1
8936
9158
  })
8937
9159
  });
8938
- } else {
8939
- recordClick({
8940
- url: parsedURL,
8941
- app: app,
8942
- credentials: credentials,
8943
- parsedHeaders: parsedHeaders,
8944
- documentId: documentId,
8945
- clickPosition: searchPosition,
8946
- clickType: 'suggestion',
8947
- queryId: suggestionsSearchId
8948
- });
8949
9160
  }
9161
+ } else if (searchPosition !== undefined) {
9162
+ recordClick({
9163
+ documentId: documentId,
9164
+ clickPosition: searchPosition,
9165
+ analyticsInstance: analyticsInstance,
9166
+ isSuggestionClick: true
9167
+ });
8950
9168
  }
8951
9169
  };
8952
9170
  }
@@ -8954,26 +9172,16 @@
8954
9172
  var impressions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
8955
9173
  return function (dispatch, getState) {
8956
9174
  var _getState4 = getState(),
8957
- app = _getState4.config.app,
8958
- headers = _getState4.headers,
8959
9175
  _getState4$appbaseRef = _getState4.appbaseRef,
8960
9176
  url = _getState4$appbaseRef.url,
8961
9177
  protocol = _getState4$appbaseRef.protocol,
8962
- credentials = _getState4$appbaseRef.credentials;
9178
+ analyticsInstance = _getState4.analyticsRef;
8963
9179
  var esURL = protocol + '://' + url;
8964
9180
  var parsedURL = esURL.replace(/\/+$/, '');
8965
9181
  if (!parsedURL.includes('scalr.api.appbase.io') && queryId && impressions.length) {
8966
- fetch(parsedURL + '/' + app + '/_analytics/search', {
8967
- method: 'PUT',
8968
- body: JSON.stringify({
8969
- query_id: queryId,
8970
- impressions: impressions
8971
- }),
8972
- keepalive: true,
8973
- headers: _extends({}, headers, {
8974
- 'Content-Type': 'application/json',
8975
- Authorization: 'Basic ' + btoa(credentials)
8976
- })
9182
+ analyticsInstance.search({
9183
+ queryID: analyticsInstance.getQueryID(),
9184
+ impressions: impressions
8977
9185
  });
8978
9186
  }
8979
9187
  };
@@ -12970,7 +13178,7 @@
12970
13178
 
12971
13179
  // if default query prop is defined and component is reactive component then register the internal component
12972
13180
  if (options.internalComponent || this.componentProps.defaultQuery && options.componentType === constants_1$1.reactiveComponent) {
12973
- this.internalComponent = transform_10(this.componentId);
13181
+ this.internalComponent = transform_11(this.componentId);
12974
13182
  }
12975
13183
  // Register internal component
12976
13184
  if (this.internalComponent && (this.destroyOnUnmount || components.indexOf(this.internalComponent) === -1)) {
@@ -15156,6 +15364,260 @@
15156
15364
  return client;
15157
15365
  }
15158
15366
 
15367
+ function _extends$3() {
15368
+ _extends$3 = Object.assign || function (target) {
15369
+ for (var i = 1; i < arguments.length; i++) {
15370
+ var source = arguments[i];
15371
+ for (var key in source) {
15372
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
15373
+ target[key] = source[key];
15374
+ }
15375
+ }
15376
+ }
15377
+ return target;
15378
+ };
15379
+ return _extends$3.apply(this, arguments);
15380
+ }
15381
+
15382
+ // Function to parse the URL
15383
+ function btoa$2(input) {
15384
+ if (input === void 0) {
15385
+ input = '';
15386
+ }
15387
+ var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
15388
+ var str = input;
15389
+ var output = ''; // eslint-disable-next-line
15390
+
15391
+ for (var block = 0, charCode, i = 0, map = chars; str.charAt(i | 0) || (map = '=', i % 1);
15392
+ // eslint-disable-line no-bitwise
15393
+ output += map.charAt(63 & block >> 8 - i % 1 * 8) // eslint-disable-line no-bitwise
15394
+ ) {
15395
+ charCode = str.charCodeAt(i += 3 / 4);
15396
+ if (charCode > 0xff) {
15397
+ throw new Error('"btoa" failed: The string to be encoded contains characters outside of the Latin1 range.');
15398
+ }
15399
+ block = block << 8 | charCode; // eslint-disable-line no-bitwise
15400
+ }
15401
+
15402
+ return output;
15403
+ }
15404
+ function validateIndex(index) {
15405
+ if (!index) {
15406
+ throw new Error('appbase-analytics: A valid index must be present to record analytics events.');
15407
+ }
15408
+ }
15409
+ function validateCredentials(credentials) {
15410
+ if (!credentials) {
15411
+ throw new Error('appbase-analytics: Auth credentials is missing.');
15412
+ }
15413
+ }
15414
+ function validateURL(url) {
15415
+ if (!url) {
15416
+ throw new Error('appbase-analytics: URL is missing.');
15417
+ }
15418
+ }
15419
+ function validateQuery(query, queryID) {
15420
+ if ((query === undefined || query === null) && !queryID) {
15421
+ throw new Error('appbase-analytics: query or queryID must be present to register a click/conversion event');
15422
+ }
15423
+ }
15424
+ function validateQueryID(queryID) {
15425
+ if (!queryID) {
15426
+ throw new Error('appbase-analytics: queryID must be present to save search/favorite');
15427
+ }
15428
+ }
15429
+ function validateClickObjects(objects) {
15430
+ if (!objects || Object.keys(objects).length < 1) {
15431
+ throw new Error('appbase-analytics: at least one click object must be present to register a click event');
15432
+ }
15433
+ }
15434
+ function validateConversionObjects(objects) {
15435
+ if (!objects || Object.keys(objects).length < 1) {
15436
+ throw new Error('appbase-analytics: at least one click object must be present to register a click event');
15437
+ }
15438
+ }
15439
+ function initClient(config) {
15440
+ if (config === void 0) {
15441
+ config = {};
15442
+ }
15443
+ var metrics = {
15444
+ credentials: config.credentials,
15445
+ index: config.index,
15446
+ url: config.url,
15447
+ userID: config.userID,
15448
+ globalCustomEvents: config.globalCustomEvents,
15449
+ queryID: '',
15450
+ headers: null,
15451
+ _request: function _request(method, url, body, queryParams, callback) {
15452
+ var finalBody = _extends$3({
15453
+ user_id: metrics.userID
15454
+ }, body, {
15455
+ custom_events: _extends$3({}, body && body.custom_events, {}, metrics.globalCustomEvents)
15456
+ });
15457
+ var queryParamsString = '';
15458
+ if (queryParams) {
15459
+ queryParamsString = Object.keys(queryParams).map(function (param) {
15460
+ return param + "=" + queryParams[param];
15461
+ }).join('&');
15462
+ }
15463
+ return fetch$1(metrics.url + "/" + url + "?" + queryParamsString, {
15464
+ method: method,
15465
+ headers: _extends$3({}, metrics.headers, {
15466
+ 'Content-Type': 'application/json',
15467
+ Authorization: "Basic " + btoa$2(metrics.credentials)
15468
+ }),
15469
+ body: method === 'GET' ? null : JSON.stringify(finalBody)
15470
+ }).then(function (response) {
15471
+ if (callback) {
15472
+ callback(null, response);
15473
+ }
15474
+ })["catch"](function (err) {
15475
+ if (callback) {
15476
+ callback(err, null);
15477
+ }
15478
+ });
15479
+ }
15480
+ };
15481
+ validateIndex(metrics.index);
15482
+ validateCredentials(metrics.credentials);
15483
+ validateURL(metrics.url); // To register a search
15484
+
15485
+ metrics.search = function (searchConfig, callback) {
15486
+ validateQuery(searchConfig.query, searchConfig.queryID);
15487
+ var captureQueryID = function captureQueryID(err, res) {
15488
+ if (res) {
15489
+ res.json().then(function (response) {
15490
+ if (response && response.query_id) {
15491
+ metrics.queryID = response.query_id;
15492
+ }
15493
+ if (callback) {
15494
+ callback(err, res);
15495
+ }
15496
+ })["catch"](function (err2) {
15497
+ if (callback) {
15498
+ callback(err2, res);
15499
+ }
15500
+ });
15501
+ } else if (callback) {
15502
+ callback(err, res);
15503
+ }
15504
+ }; // just to avoid the flow type error
15505
+
15506
+ if (metrics._request) {
15507
+ var requestBody = {
15508
+ query: searchConfig.query,
15509
+ query_id: searchConfig.queryID,
15510
+ custom_events: searchConfig.customEvents,
15511
+ filters: searchConfig.filters,
15512
+ hits: searchConfig.hits,
15513
+ impressions: searchConfig.impressions
15514
+ };
15515
+ metrics._request('PUT', metrics.index + "/_analytics/search", requestBody, null, captureQueryID);
15516
+ }
15517
+ }; // To register a click
15518
+
15519
+ metrics.click = function (clickConfig, callback) {
15520
+ validateQuery(clickConfig.query, clickConfig.queryID);
15521
+ validateClickObjects(clickConfig.objects); // just to avoid the flow type error
15522
+
15523
+ if (metrics._request) {
15524
+ var requestBody = {
15525
+ click_on: clickConfig.objects,
15526
+ click_type: clickConfig.isSuggestionClick ? 'suggestion' : 'result',
15527
+ query: clickConfig.query,
15528
+ query_id: clickConfig.queryID,
15529
+ custom_events: clickConfig.customEvents,
15530
+ meta: clickConfig.meta
15531
+ };
15532
+ metrics._request('PUT', metrics.index + "/_analytics/click", requestBody, null, callback);
15533
+ }
15534
+ }; // To register a conversion
15535
+
15536
+ metrics.conversion = function (conversionConfig, callback) {
15537
+ validateQuery(null, conversionConfig.queryID);
15538
+ validateConversionObjects(conversionConfig.objects); // just to avoid the flow type error
15539
+
15540
+ if (metrics._request) {
15541
+ var requestBody = {
15542
+ conversion_on: conversionConfig.objects,
15543
+ query_id: conversionConfig.queryID,
15544
+ meta: conversionConfig.meta
15545
+ };
15546
+ metrics._request('PUT', metrics.index + "/_analytics/conversion", requestBody, null, callback);
15547
+ }
15548
+ }; // To save search
15549
+
15550
+ metrics.saveSearch = function (saveSearchConfig, callback) {
15551
+ validateQueryID(saveSearchConfig.queryID);
15552
+ var requestBody = {
15553
+ query_id: saveSearchConfig.queryID,
15554
+ save_search_id: saveSearchConfig.saveSearchID,
15555
+ save_search_meta: saveSearchConfig.saveSearchMeta,
15556
+ user_id: saveSearchConfig.userID,
15557
+ custom_events: saveSearchConfig.customEvents
15558
+ };
15559
+ metrics._request('PUT', '_analytics/save-search', requestBody, null, callback);
15560
+ }; // To delete save search
15561
+
15562
+ metrics.deleteSavedSearch = function (saveSearchId, callback) {
15563
+ metrics._request('DELETE', '_analytics/save-search/' + saveSearchId, null, null, callback);
15564
+ }; // To retrieve saved searches
15565
+
15566
+ metrics.getSavedSearches = function (filters, callback) {
15567
+ // just to avoid the flow type error
15568
+ if (metrics._request) {
15569
+ metrics._request('GET', '_analytics/saved-searches', null, filters, callback);
15570
+ }
15571
+ }; // To record a favorite document
15572
+
15573
+ metrics.favorite = function (favoriteConfig, callback) {
15574
+ validateQueryID(favoriteConfig.queryID);
15575
+ if (!favoriteConfig.favoriteOn || favoriteConfig.favoriteOn === '') {
15576
+ throw new Error('appbase-analytics: favoriteOn property is required');
15577
+ }
15578
+ if (!favoriteConfig.source) {
15579
+ throw new Error('appbase-analytics: source property is required');
15580
+ }
15581
+ var requestBody = {
15582
+ query_id: favoriteConfig.queryID,
15583
+ favorite_on: favoriteConfig.favoriteOn,
15584
+ source: favoriteConfig.source,
15585
+ id: favoriteConfig.id,
15586
+ meta: favoriteConfig.meta,
15587
+ user_id: favoriteConfig.userID,
15588
+ custom_events: favoriteConfig.customEvents
15589
+ };
15590
+ metrics._request('PUT', '_analytics/favorite', requestBody, null, callback);
15591
+ }; // To retrieve favorites
15592
+
15593
+ metrics.getFavorites = function (filters, callback) {
15594
+ // just to avoid the flow type error
15595
+ if (metrics._request) {
15596
+ metrics._request('GET', '_analytics/favorites', null, filters, callback);
15597
+ }
15598
+ }; // Sets the userID
15599
+
15600
+ metrics.setUserID = function (userID) {
15601
+ metrics.userID = userID;
15602
+ }; // Sets the global events
15603
+
15604
+ metrics.setGlobalCustomEvents = function (globalEvents) {
15605
+ metrics.globalCustomEvents = globalEvents;
15606
+ }; // Sets the headers
15607
+
15608
+ metrics.setHeaders = function (headers) {
15609
+ metrics.headers = headers;
15610
+ }; // get queryID
15611
+
15612
+ metrics.getQueryID = function () {
15613
+ return metrics.queryID;
15614
+ };
15615
+ return metrics;
15616
+ }
15617
+ var index$2 = {
15618
+ init: initClient
15619
+ };
15620
+
15159
15621
  /**
15160
15622
  *
15161
15623
  *
@@ -15488,11 +15950,16 @@
15488
15950
  }
15489
15951
  return true;
15490
15952
  }
15953
+ },
15954
+ analyticsRef: {
15955
+ type: Object,
15956
+ required: true
15491
15957
  }
15492
15958
  },
15493
15959
  provide: function provide() {
15494
15960
  return {
15495
- $$store: this.store
15961
+ $$store: this.store,
15962
+ $analytics: this.analyticsRef
15496
15963
  };
15497
15964
  },
15498
15965
  render: function render(h) {
@@ -15941,6 +16408,27 @@
15941
16408
  if (this.$props.transformResponse) {
15942
16409
  appbaseRef.transformResponse = this.$props.transformResponse;
15943
16410
  }
16411
+ var analyticsInitConfig = {
16412
+ url: url && url.replace(/\/\/.*@/, '//'),
16413
+ credentials: appbaseRef.credentials,
16414
+ // When endpoint prop is used index is not defined, so we use _default
16415
+ index: appbaseRef.app || '_default',
16416
+ globalCustomEvents: this.$props.appbaseConfig && this.$props.appbaseConfig.customEvents
16417
+ };
16418
+ try {
16419
+ if (this.$props.endpoint && this.$props.endpoint.url) {
16420
+ // Remove parts between '//' and first '/' in the url
16421
+ analyticsInitConfig.url = this.$props.endpoint.url.replace(/\/\/(.*?)\/.*/, '//$1');
16422
+ var headerCredentials = this.$props.endpoint.headers && this.$props.endpoint.headers.Authorization;
16423
+ analyticsInitConfig.credentials = headerCredentials && headerCredentials.replace('Basic ', '');
16424
+ // Decode the credentials
16425
+ analyticsInitConfig.credentials = analyticsInitConfig.credentials && atob(analyticsInitConfig.credentials);
16426
+ }
16427
+ } catch (e) {
16428
+ console.error('Endpoint not set correctly for analytics');
16429
+ console.error(e);
16430
+ }
16431
+ var analyticsRef = index$2.init(analyticsInitConfig);
15944
16432
  var initialState = _extends({
15945
16433
  config: _extends({}, config, {
15946
16434
  initialQueriesSyncTime: props.initialQueriesSyncTime,
@@ -15949,11 +16437,13 @@
15949
16437
  themePreset: themePreset
15950
16438
  }),
15951
16439
  appbaseRef: appbaseRef,
16440
+ analyticsRef: analyticsRef,
15952
16441
  selectedValues: selectedValues,
15953
16442
  urlValues: urlValues,
15954
16443
  headers: this.getHeaders
15955
16444
  }, this.$props.initialState);
15956
16445
  this.store = configureStore(initialState);
16446
+ this.analyticsRef = analyticsRef;
15957
16447
  }
15958
16448
  },
15959
16449
  render: function render() {
@@ -15964,7 +16454,8 @@
15964
16454
  className = _this$$props2.className;
15965
16455
  return h(Provider, {
15966
16456
  "attrs": {
15967
- "store": this.store
16457
+ "store": this.store,
16458
+ "analyticsRef": this.analyticsRef
15968
16459
  }
15969
16460
  }, [h(URLParamsProvider$1, {
15970
16461
  "attrs": {
@@ -15983,7 +16474,7 @@
15983
16474
  };
15984
16475
 
15985
16476
  /**!
15986
- * hotkeys-js v3.10.0
16477
+ * hotkeys-js v3.10.1
15987
16478
  * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
15988
16479
  *
15989
16480
  * Copyright (c) 2022 kenny wong <wowohoo@qq.com>
@@ -16499,12 +16990,14 @@
16499
16990
  function trigger(shortcut) {
16500
16991
  var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all';
16501
16992
  Object.keys(_handlers).forEach(function (key) {
16502
- var data = _handlers[key].find(function (item) {
16993
+ var dataList = _handlers[key].filter(function (item) {
16503
16994
  return item.scope === scope && item.shortcut === shortcut;
16504
16995
  });
16505
- if (data && data.method) {
16506
- data.method();
16507
- }
16996
+ dataList.forEach(function (data) {
16997
+ if (data && data.method) {
16998
+ data.method();
16999
+ }
17000
+ });
16508
17001
  });
16509
17002
  }
16510
17003
  var _api = {
@@ -18413,10 +18906,11 @@
18413
18906
  }
18414
18907
  }
18415
18908
  this.handleTextChange = debounce$1(this.handleText, this.$props.debounce);
18909
+ this.updateDefaultQueryHandlerDebounced = debounce$1(this.updateDefaultQueryHandler, this.$props.debounce);
18416
18910
  // Set custom and default queries in store
18417
18911
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
18418
18912
  updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
18419
- this.updateDefaultQueryHandler(this.currentValue, this.$props, false);
18913
+ this.updateDefaultQueryHandlerDebounced(this.currentValue, this.$props, false);
18420
18914
  },
18421
18915
  computed: {
18422
18916
  suggestionsList: function suggestionsList() {
@@ -18601,7 +19095,7 @@
18601
19095
  },
18602
19096
  defaultQuery: function defaultQuery(newVal, oldVal) {
18603
19097
  if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
18604
- this.updateDefaultQueryHandler(this.$data.currentValue, this.$props);
19098
+ this.updateDefaultQueryHandlerDebounced(this.$data.currentValue, this.$props);
18605
19099
  }
18606
19100
  },
18607
19101
  customQuery: function customQuery(newVal, oldVal) {
@@ -18637,9 +19131,9 @@
18637
19131
  methods: {
18638
19132
  handleText: function handleText(value) {
18639
19133
  if (this.$props.autosuggest) {
18640
- this.updateDefaultQueryHandler(value, this.$props);
19134
+ this.updateDefaultQueryHandlerDebounced(value, this.$props);
18641
19135
  } else {
18642
- this.updateQueryHandler(this.$props.componentId, value, this.$props);
19136
+ this.updateDefaultQueryHandlerDebounced(this.$props.componentId, value, this.$props);
18643
19137
  }
18644
19138
  },
18645
19139
  validateDataField: function validateDataField() {
@@ -18780,7 +19274,7 @@
18780
19274
  if (toggleIsOpen) {
18781
19275
  _this.isOpen = false;
18782
19276
  }
18783
- if (typeof value === 'string') _this.updateDefaultQueryHandler(value, _this.$props);
19277
+ if (typeof value === 'string') _this.updateDefaultQueryHandlerDebounced(value, _this.$props);
18784
19278
  } // in case of strict selection only SUGGESTION_SELECT should be able
18785
19279
  // to set the query otherwise the value should reset
18786
19280
 
@@ -18814,6 +19308,9 @@
18814
19308
  checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
18815
19309
  },
18816
19310
  updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props, execute) {
19311
+ if (props === void 0) {
19312
+ props = this.$props;
19313
+ }
18817
19314
  if (!value && props.enableDefaultSuggestions === false) {
18818
19315
  // clear Component data from store
18819
19316
  this.resetStoreForComponent(props.componentId);
@@ -18946,7 +19443,7 @@
18946
19443
  if (_this2.$options.isTagsMode && autosuggest) {
18947
19444
  _this2.currentValue = value;
18948
19445
  _this2.isOpen = isOpen;
18949
- _this2.updateDefaultQueryHandler(_this2.currentValue, _this2.$props);
19446
+ _this2.updateDefaultQueryHandlerDebounced(_this2.currentValue, _this2.$props);
18950
19447
  return;
18951
19448
  }
18952
19449
  _this2.triggerQuery({
@@ -23414,7 +23911,7 @@
23414
23911
  * Released under the MIT License.
23415
23912
  */
23416
23913
 
23417
- var index$2 = {
23914
+ var index$3 = {
23418
23915
  name: 'NoSsr',
23419
23916
  functional: true,
23420
23917
  props: {
@@ -23451,7 +23948,7 @@
23451
23948
  }) : h(false);
23452
23949
  }
23453
23950
  };
23454
- var vueNoSsr_common = index$2;
23951
+ var vueNoSsr_common = index$3;
23455
23952
 
23456
23953
  var _templateObject$o;
23457
23954
  var Slider = index$1('div')(_templateObject$o || (_templateObject$o = _taggedTemplateLiteralLoose(["\n\tmargin-top: 30px;\n\tpadding: 10px;\n\n\t/* component style */\n\t.vue-slider-disabled {\n\t\topacity: 0.5;\n\t\tcursor: not-allowed;\n\t}\n\n\t/* rail style */\n\t.vue-slider-rail {\n\t\tbackground-color: #ccc;\n\t\tborder-radius: 15px;\n\t\theight: 4px;\n\t}\n\n\t/* process style */\n\t.vue-slider-process {\n\t\tbackground-color: #0b6aff;\n\t\tborder-radius: 15px;\n\t}\n\n\t/* mark style */\n\t.vue-slider-mark {\n\t\tz-index: 4;\n\t}\n\n\t.vue-slider-mark:first-child .vue-slider-mark-step,\n\t.vue-slider-mark:last-child .vue-slider-mark-step {\n\t\tdisplay: none;\n\t}\n\n\t.vue-slider-mark-step {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 50%;\n\t\tbackground-color: rgba(0, 0, 0, 0.16);\n\t}\n\n\t.vue-slider-mark-label {\n\t\tfont-size: 14px;\n\t\twhite-space: nowrap;\n\t}\n\n\t/* dot style */\n\t.vue-slider-dot {\n\t\tz-index: 2;\n\t}\n\n\t.vue-slider-dot-handle {\n\t\tcursor: pointer;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 50%;\n\t\tbackground-color: #fff;\n\t\tbox-sizing: border-box;\n\t\tborder: 1px solid #9a9a9a;\n\t\tz-index: 2;\n\t\tbox-shadow: 0.5px 0.5px 2px 1px rgb(0 0 0 / 32%);\n\t}\n\n\t.vue-slider-dot-handle-disabled {\n\t\tcursor: not-allowed;\n\t\tbackground-color: #ccc;\n\t}\n\n\t.vue-slider-dot-tooltip-inner {\n\t\tfont-size: 14px;\n\t\twhite-space: nowrap;\n\t\tpadding: 2px 5px;\n\t\tmin-width: 20px;\n\t\ttext-align: center;\n\t\tcolor: #fff;\n\t\tborder-radius: 5px;\n\t\tborder: 1px solid #3498db;\n\t\tbackground-color: #3498db;\n\t\tbox-sizing: content-box;\n\t}\n\n\t.vue-slider-dot-tooltip-inner::after {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-top::after {\n\t\ttop: 100%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, 0);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-top-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-bottom::after {\n\t\tbottom: 100%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, 0);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-bottom-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-left::after {\n\t\tleft: 100%;\n\t\ttop: 50%;\n\t\ttransform: translate(0, -50%);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-left-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-inner-right::after {\n\t\tright: 100%;\n\t\ttop: 50%;\n\t\ttransform: translate(0, -50%);\n\t\theight: 0;\n\t\twidth: 0;\n\t\tborder-color: transparent;\n\t\tborder-style: solid;\n\t\tborder-width: 5px;\n\t\tborder-right-color: inherit;\n\t}\n\n\t.vue-slider-dot-tooltip-wrapper {\n\t\topacity: 0;\n\t\ttransition: all 0.3s;\n\t}\n\t.vue-slider-dot-tooltip-wrapper-show {\n\t\topacity: 1;\n\t}\n\n\t.label-container {\n\t\tmargin: 10px 0;\n\t\twidth: 100%;\n\t}\n\n\t.range-label-right {\n\t\tfloat: right;\n\t}\n"])));
@@ -24233,7 +24730,13 @@
24233
24730
  },
24234
24731
  selectedValue: function selectedValue(newVal) {
24235
24732
  if (!isEqual$d(this.$data.currentValue, newVal)) {
24236
- this.selectItem(newVal, true, undefined, true);
24733
+ var processSelectedValues = newVal ? newVal.map(function (item) {
24734
+ if (typeof item === 'object' && 'label' in item) {
24735
+ return item.label;
24736
+ }
24737
+ return item;
24738
+ }) : null;
24739
+ this.selectItem(processSelectedValues, true, undefined, true);
24237
24740
  }
24238
24741
  },
24239
24742
  customQuery: function customQuery(newVal, oldVal) {
@@ -25638,6 +26141,7 @@
25638
26141
  Vue.component(ResultListTitle.name, ResultListTitle);
25639
26142
  };
25640
26143
 
26144
+ var setSearchState = lib_5.setSearchState;
25641
26145
  var getSearchState = lib_8.getSearchState;
25642
26146
  var defaultKeys = ['hits', 'value', 'aggregations', 'error'];
25643
26147
  var filterProps = function filterProps(props) {
@@ -25648,6 +26152,15 @@
25648
26152
  props: props.componentProps
25649
26153
  });
25650
26154
  };
26155
+ var convertArrayLike = function convertArrayLike(arrayLike) {
26156
+ var arr = [];
26157
+ var i = 0;
26158
+ while (arrayLike[i]) {
26159
+ arr[i] = arrayLike[i];
26160
+ i += 1;
26161
+ }
26162
+ return arr;
26163
+ };
25651
26164
  var filterByComponentIds = function filterByComponentIds(state, props) {
25652
26165
  if (props === void 0) {
25653
26166
  props = {};
@@ -25809,21 +26322,28 @@
25809
26322
  }
25810
26323
  },
25811
26324
  setSearchState: function setSearchState(valuesMap) {
26325
+ var _this = this;
25812
26326
  if (valuesMap === void 0) {
25813
26327
  valuesMap = {};
25814
26328
  }
25815
26329
  var components = this.components;
25816
26330
  var computedValuesMap = {};
25817
- components.filter(function (component) {
25818
- return !transform_11(component);
26331
+ convertArrayLike(components).filter(function (component) {
26332
+ return !transform_12(component);
25819
26333
  }).forEach(function (component) {
25820
26334
  if (component in valuesMap) {
25821
- computedValuesMap[component] = valuesMap[component];
26335
+ computedValuesMap[component] = {
26336
+ value: valuesMap[component],
26337
+ componentProps: _this.componentProps[component]
26338
+ };
25822
26339
  } else {
25823
- computedValuesMap[component] = null;
26340
+ computedValuesMap[component] = {
26341
+ value: null,
26342
+ componentProps: _this.componentProps[component]
26343
+ };
25824
26344
  }
25825
26345
  });
25826
- this.setValues(computedValuesMap);
26346
+ this.setSearchStateFn(computedValuesMap);
25827
26347
  }
25828
26348
  },
25829
26349
  render: function render() {
@@ -25853,7 +26373,7 @@
25853
26373
  };
25854
26374
  };
25855
26375
  var mapDispatchtoProps$d = {
25856
- setValues: value_6
26376
+ setSearchStateFn: setSearchState
25857
26377
  };
25858
26378
  var StateProviderConnected = connect(mapStateToProps$h, mapDispatchtoProps$d)(StateProvider);
25859
26379
  StateProvider.install = function (Vue) {
@@ -34205,7 +34725,7 @@
34205
34725
  }
34206
34726
  // [4] set query list
34207
34727
  // Do not set default query for suggestions
34208
- if (isInternalComponentPresent && !transform_7(component.componentType)) {
34728
+ if (isInternalComponentPresent && !transform_8(component.componentType)) {
34209
34729
  var _ref2 = getDefaultQuery(component, value) || {},
34210
34730
  defaultQuery = _ref2.query,
34211
34731
  defaultQueryOptions = _objectWithoutPropertiesLoose(_ref2, _excluded2);
@@ -34274,13 +34794,13 @@
34274
34794
  }, componentQueryOptions, queryOptions[component.componentId]);
34275
34795
  queryLog = _extends({}, queryLog, (_extends2 = {}, _extends2[component.componentId] = currentQuery, _extends2));
34276
34796
  if (settings.enableAppbase) {
34277
- var query = transform_4(component.componentId, transform_2(state, component.componentId, queryOptions && Object.keys(queryOptions[component.componentId]).length ? {
34797
+ var query = transform_5(component.componentId, transform_3(state, component.componentId, queryOptions && Object.keys(queryOptions[component.componentId]).length ? {
34278
34798
  from: queryOptions[component.componentId].from
34279
34799
  } : null));
34280
34800
  if (query) {
34281
34801
  var _extends3;
34282
34802
  // Apply dependent queries
34283
- appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), transform_1(state, component.componentId, orderOfQueries));
34803
+ appbaseQuery = _extends({}, appbaseQuery, (_extends3 = {}, _extends3[component.componentId] = query, _extends3), transform_2(state, component.componentId, orderOfQueries));
34284
34804
  }
34285
34805
  } else {
34286
34806
  var preference = config && config.analyticsConfig && config.analyticsConfig.userId ? config.analyticsConfig.userId + "_" + component : component;
@@ -34439,7 +34959,7 @@
34439
34959
  });
34440
34960
  }
34441
34961
 
34442
- var version = "1.33.2";
34962
+ var version = "1.33.3";
34443
34963
 
34444
34964
  var components$1 = [ReactiveList, ResultCard, ResultList, ReactiveBase, DataSearch, SearchBox, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput];
34445
34965
  function install (Vue) {
@@ -34453,7 +34973,7 @@
34453
34973
  if (typeof window !== 'undefined' && window.Vue) {
34454
34974
  install(window.Vue);
34455
34975
  }
34456
- var index$3 = {
34976
+ var index$4 = {
34457
34977
  version: version,
34458
34978
  install: install
34459
34979
  };
@@ -34479,7 +34999,7 @@
34479
34999
  exports.StateProvider = StateProvider;
34480
35000
  exports.ToggleButton = ToggleButton;
34481
35001
  exports.componentTypes = constants_1$1;
34482
- exports.default = index$3;
35002
+ exports.default = index$4;
34483
35003
  exports.initReactivesearch = initReactivesearch;
34484
35004
  exports.install = install;
34485
35005
  exports.version = version;