@appbaseio/reactivesearch-vue 3.0.0-alpha.3 → 3.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +261 -1037
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/initReactivesearch.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/initReactivesearch.js +1 -1
- package/dist/es/version.js +1 -1
- package/package.json +1 -1
|
@@ -30777,1076 +30777,300 @@
|
|
|
30777
30777
|
var ErrorTypeStrings = (_ErrorTypeStrings = {}, _ErrorTypeStrings["sp" /* LifecycleHooks.SERVER_PREFETCH */] = 'serverPrefetch hook', _ErrorTypeStrings["bc" /* LifecycleHooks.BEFORE_CREATE */] = 'beforeCreate hook', _ErrorTypeStrings["c" /* LifecycleHooks.CREATED */] = 'created hook', _ErrorTypeStrings["bm" /* LifecycleHooks.BEFORE_MOUNT */] = 'beforeMount hook', _ErrorTypeStrings["m" /* LifecycleHooks.MOUNTED */] = 'mounted hook', _ErrorTypeStrings["bu" /* LifecycleHooks.BEFORE_UPDATE */] = 'beforeUpdate hook', _ErrorTypeStrings["u" /* LifecycleHooks.UPDATED */] = 'updated', _ErrorTypeStrings["bum" /* LifecycleHooks.BEFORE_UNMOUNT */] = 'beforeUnmount hook', _ErrorTypeStrings["um" /* LifecycleHooks.UNMOUNTED */] = 'unmounted hook', _ErrorTypeStrings["a" /* LifecycleHooks.ACTIVATED */] = 'activated hook', _ErrorTypeStrings["da" /* LifecycleHooks.DEACTIVATED */] = 'deactivated hook', _ErrorTypeStrings["ec" /* LifecycleHooks.ERROR_CAPTURED */] = 'errorCaptured hook', _ErrorTypeStrings["rtc" /* LifecycleHooks.RENDER_TRACKED */] = 'renderTracked hook', _ErrorTypeStrings["rtg" /* LifecycleHooks.RENDER_TRIGGERED */] = 'renderTriggered hook', _ErrorTypeStrings[0 /* ErrorCodes.SETUP_FUNCTION */] = 'setup function', _ErrorTypeStrings[1 /* ErrorCodes.RENDER_FUNCTION */] = 'render function', _ErrorTypeStrings[2 /* ErrorCodes.WATCH_GETTER */] = 'watcher getter', _ErrorTypeStrings[3 /* ErrorCodes.WATCH_CALLBACK */] = 'watcher callback', _ErrorTypeStrings[4 /* ErrorCodes.WATCH_CLEANUP */] = 'watcher cleanup function', _ErrorTypeStrings[5 /* ErrorCodes.NATIVE_EVENT_HANDLER */] = 'native event handler', _ErrorTypeStrings[6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */] = 'component event handler', _ErrorTypeStrings[7 /* ErrorCodes.VNODE_HOOK */] = 'vnode hook', _ErrorTypeStrings[8 /* ErrorCodes.DIRECTIVE_HOOK */] = 'directive hook', _ErrorTypeStrings[9 /* ErrorCodes.TRANSITION_HOOK */] = 'transition hook', _ErrorTypeStrings[10 /* ErrorCodes.APP_ERROR_HANDLER */] = 'app errorHandler', _ErrorTypeStrings[11 /* ErrorCodes.APP_WARN_HANDLER */] = 'app warnHandler', _ErrorTypeStrings[12 /* ErrorCodes.FUNCTION_REF */] = 'ref function', _ErrorTypeStrings[13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */] = 'async component loader', _ErrorTypeStrings[14 /* ErrorCodes.SCHEDULER */] = 'scheduler flush. This is likely a Vue internals bug. ' + 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core', _ErrorTypeStrings);
|
|
30778
30778
|
vue.initDirectivesForSSR();
|
|
30779
30779
|
|
|
30780
|
-
var
|
|
30781
|
-
|
|
30782
|
-
|
|
30783
|
-
dataSearch: 'DATASEARCH',
|
|
30784
|
-
categorySearch: 'CATEGORYSEARCH',
|
|
30785
|
-
searchBox: 'SEARCHBOX',
|
|
30786
|
-
// list components
|
|
30787
|
-
singleList: 'SINGLELIST',
|
|
30788
|
-
multiList: 'MULTILIST',
|
|
30789
|
-
singleDataList: 'SINGLEDATALIST',
|
|
30790
|
-
tabDataList: 'TABDATALIST',
|
|
30791
|
-
singleDropdownList: 'SINGLEDROPDOWNLIST',
|
|
30792
|
-
multiDataList: 'MULTIDATALIST',
|
|
30793
|
-
multiDropdownList: 'MULTIDROPDOWNLIST',
|
|
30794
|
-
singleDropdownRange: 'SINGLEDROPDOWNRANGE',
|
|
30795
|
-
treeList: 'TREELIST',
|
|
30796
|
-
// basic components
|
|
30797
|
-
numberBox: 'NUMBERBOX',
|
|
30798
|
-
tagCloud: 'TAGCLOUD',
|
|
30799
|
-
toggleButton: 'TOGGLEBUTTON',
|
|
30800
|
-
reactiveComponent: 'REACTIVECOMPONENT',
|
|
30801
|
-
// range components
|
|
30802
|
-
datePicker: 'DATEPICKER',
|
|
30803
|
-
dateRange: 'DATERANGE',
|
|
30804
|
-
dynamicRangeSlider: 'DYNAMICRANGESLIDER',
|
|
30805
|
-
multiDropdownRange: 'MULTIDROPDOWNRANGE',
|
|
30806
|
-
singleRange: 'SINGLERANGE',
|
|
30807
|
-
multiRange: 'MULTIRANGE',
|
|
30808
|
-
rangeSlider: 'RANGESLIDER',
|
|
30809
|
-
ratingsFilter: 'RATINGSFILTER',
|
|
30810
|
-
rangeInput: 'RANGEINPUT',
|
|
30811
|
-
// map components
|
|
30812
|
-
geoDistanceDropdown: 'GEO_DISTANCE_DROPDOWN',
|
|
30813
|
-
geoDistanceSlider: 'GEO_DISTANCE_SLIDER',
|
|
30814
|
-
reactiveMap: 'REACTIVE_MAP',
|
|
30815
|
-
// chart components
|
|
30816
|
-
reactiveChart: 'REACTIVE_CHART'
|
|
30817
|
-
};
|
|
30818
|
-
var queryTypes = {
|
|
30819
|
-
search: 'search',
|
|
30820
|
-
term: 'term',
|
|
30821
|
-
range: 'range',
|
|
30822
|
-
geo: 'geo',
|
|
30823
|
-
suggestion: 'suggestion'
|
|
30824
|
-
};
|
|
30825
|
-
|
|
30826
|
-
var REMOVE_COMPONENT = 'REMOVE_COMPONENT';
|
|
30827
|
-
var PATCH_VALUE = 'PATCH_VALUE';
|
|
30828
|
-
var CLEAR_VALUES = 'CLEAR_VALUES';
|
|
30829
|
-
var SET_VALUE = 'SET_VALUE';
|
|
30830
|
-
var SET_VALUES = 'SET_VALUES';
|
|
30831
|
-
var RESET_TO_DEFAULT = 'RESET_TO_DEFAULT';
|
|
30832
|
-
|
|
30833
|
-
var dateFormats = {
|
|
30834
|
-
date: 'YYYY-MM-DD',
|
|
30835
|
-
basic_date: 'YYYYMMDD',
|
|
30836
|
-
basic_date_time: 'YYYYMMDD[T]HHmmss.SSSZ',
|
|
30837
|
-
basic_date_time_no_millis: 'YYYYMMDD[T]HHmmssZ',
|
|
30838
|
-
date_time_no_millis: 'YYYY-MM-DD[T]HH:mm:ssZ',
|
|
30839
|
-
basic_time: 'HHmmss.SSSZ',
|
|
30840
|
-
basic_time_no_millis: 'HHmmssZ',
|
|
30841
|
-
epoch_millis: 'epoch_millis',
|
|
30842
|
-
epoch_second: 'epoch_second'
|
|
30843
|
-
};
|
|
30844
|
-
|
|
30845
|
-
var _componentTypeToDefau;
|
|
30846
|
-
function getOperation(conjunction) {
|
|
30847
|
-
if (conjunction === 'and') {
|
|
30848
|
-
return 'must';
|
|
30849
|
-
}
|
|
30850
|
-
if (conjunction === 'or') {
|
|
30851
|
-
return 'should';
|
|
30852
|
-
}
|
|
30853
|
-
return 'must_not';
|
|
30854
|
-
}
|
|
30855
|
-
function createBoolQuery(operation, query) {
|
|
30856
|
-
var resultQuery = null;
|
|
30857
|
-
if (Array.isArray(query) && query.length || !Array.isArray(query) && query) {
|
|
30858
|
-
var _bool;
|
|
30859
|
-
resultQuery = {
|
|
30860
|
-
bool: (_bool = {}, _bool[operation] = query, _bool)
|
|
30861
|
-
};
|
|
30862
|
-
}
|
|
30863
|
-
if (operation === 'should' && resultQuery) {
|
|
30864
|
-
resultQuery = {
|
|
30865
|
-
bool: _extends({}, resultQuery.bool, {
|
|
30866
|
-
minimum_should_match: 1
|
|
30867
|
-
})
|
|
30868
|
-
};
|
|
30869
|
-
}
|
|
30870
|
-
return resultQuery;
|
|
30871
|
-
}
|
|
30872
|
-
function getQuery(react, queryList) {
|
|
30873
|
-
var query = [];
|
|
30874
|
-
Object.keys(react).forEach(function (conjunction) {
|
|
30875
|
-
if (Array.isArray(react[conjunction])) {
|
|
30876
|
-
var operation = getOperation(conjunction);
|
|
30877
|
-
var queryArr = react[conjunction].map(function (comp) {
|
|
30878
|
-
if (typeof comp !== 'string') {
|
|
30879
|
-
// in this case, we have { <conjunction>: <> } objects inside the array
|
|
30880
|
-
return getQuery(comp, queryList);
|
|
30881
|
-
} else if (comp in queryList) {
|
|
30882
|
-
if (queryList[comp] && Object.keys(queryList[comp]).length) {
|
|
30883
|
-
return queryList[comp];
|
|
30884
|
-
}
|
|
30885
|
-
}
|
|
30886
|
-
return null;
|
|
30887
|
-
}).filter(function (item) {
|
|
30888
|
-
return !!item;
|
|
30889
|
-
});
|
|
30890
|
-
var boolQuery = createBoolQuery(operation, queryArr);
|
|
30891
|
-
if (boolQuery && Object.keys(boolQuery).length) {
|
|
30892
|
-
query = [].concat(query, [boolQuery]);
|
|
30893
|
-
}
|
|
30894
|
-
} else if (typeof react[conjunction] === 'string') {
|
|
30895
|
-
var _operation = getOperation(conjunction);
|
|
30896
|
-
var _boolQuery = createBoolQuery(_operation, queryList[react[conjunction]]);
|
|
30897
|
-
if (_boolQuery && Object.keys(_boolQuery).length) {
|
|
30898
|
-
query = [].concat(query, [_boolQuery]);
|
|
30899
|
-
}
|
|
30900
|
-
} else if (typeof react[conjunction] === 'object' && react[conjunction] !== null) {
|
|
30901
|
-
var _boolQuery2 = getQuery(react[conjunction], queryList);
|
|
30902
|
-
if (_boolQuery2 && Object.keys(_boolQuery2).length) {
|
|
30903
|
-
query = [].concat(query, [_boolQuery2]);
|
|
30904
|
-
}
|
|
30905
|
-
}
|
|
30780
|
+
var server = createCommonjsModule(function (module, exports) {
|
|
30781
|
+
Object.defineProperty(exports, "__esModule", {
|
|
30782
|
+
value: true
|
|
30906
30783
|
});
|
|
30907
|
-
|
|
30908
|
-
|
|
30909
|
-
|
|
30910
|
-
|
|
30911
|
-
|
|
30912
|
-
|
|
30913
|
-
}
|
|
30914
|
-
if (query && Object.keys(query).length) {
|
|
30915
|
-
return query;
|
|
30916
|
-
}
|
|
30917
|
-
return null;
|
|
30918
|
-
}
|
|
30919
|
-
function getExternalQueryOptions(react, options, component) {
|
|
30920
|
-
var queryOptions = {};
|
|
30921
|
-
Object.keys(react).forEach(function (conjunction) {
|
|
30922
|
-
if (Array.isArray(react[conjunction])) {
|
|
30923
|
-
react[conjunction].forEach(function (comp) {
|
|
30924
|
-
if (options[comp]) {
|
|
30925
|
-
queryOptions = _extends({}, queryOptions, options[comp]);
|
|
30784
|
+
var _extends = Object.assign || function (target) {
|
|
30785
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
30786
|
+
var source = arguments[i];
|
|
30787
|
+
for (var key in source) {
|
|
30788
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
30789
|
+
target[key] = source[key];
|
|
30926
30790
|
}
|
|
30927
|
-
});
|
|
30928
|
-
} else if (typeof react[conjunction] === 'string') {
|
|
30929
|
-
if (options[react[conjunction]]) {
|
|
30930
|
-
queryOptions = _extends({}, queryOptions, options[react[conjunction]]);
|
|
30931
30791
|
}
|
|
30932
|
-
} else if (typeof react[conjunction] === 'object' && react[conjunction] !== null && !Array.isArray(react[conjunction])) {
|
|
30933
|
-
queryOptions = _extends({}, queryOptions, getExternalQueryOptions(react[conjunction], options));
|
|
30934
30792
|
}
|
|
30935
|
-
|
|
30936
|
-
if (options[component]) {
|
|
30937
|
-
queryOptions = _extends({}, queryOptions, options[component]);
|
|
30938
|
-
}
|
|
30939
|
-
return queryOptions;
|
|
30940
|
-
}
|
|
30941
|
-
function buildQuery(component, dependencyTree, queryList, queryOptions) {
|
|
30942
|
-
var queryObj = null;
|
|
30943
|
-
var options = null;
|
|
30944
|
-
if (component in dependencyTree) {
|
|
30945
|
-
queryObj = getQuery(dependencyTree[component], queryList);
|
|
30946
|
-
options = getExternalQueryOptions(dependencyTree[component], queryOptions, component);
|
|
30947
|
-
}
|
|
30948
|
-
return {
|
|
30949
|
-
queryObj: queryObj,
|
|
30950
|
-
options: options
|
|
30793
|
+
return target;
|
|
30951
30794
|
};
|
|
30952
|
-
|
|
30953
|
-
|
|
30954
|
-
|
|
30955
|
-
|
|
30956
|
-
|
|
30795
|
+
var _valueReducer2 = _interopRequireDefault(valueReducer_1);
|
|
30796
|
+
function _interopRequireDefault(obj) {
|
|
30797
|
+
return obj && obj.__esModule ? obj : {
|
|
30798
|
+
"default": obj
|
|
30799
|
+
};
|
|
30957
30800
|
}
|
|
30958
|
-
|
|
30959
|
-
|
|
30960
|
-
|
|
30961
|
-
|
|
30962
|
-
return Math.floor(date.valueOf() / 1000);
|
|
30963
|
-
default:
|
|
30964
|
-
{
|
|
30965
|
-
if (dateFormats[props.queryFormat]) {
|
|
30966
|
-
return date.format(dateFormats[props.queryFormat]);
|
|
30967
|
-
}
|
|
30968
|
-
return date.valueOf();
|
|
30801
|
+
function _toConsumableArray(arr) {
|
|
30802
|
+
if (Array.isArray(arr)) {
|
|
30803
|
+
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
|
|
30804
|
+
arr2[i] = arr[i];
|
|
30969
30805
|
}
|
|
30970
|
-
|
|
30971
|
-
|
|
30972
|
-
|
|
30973
|
-
|
|
30974
|
-
/* isValidDateRangeQueryFormat() checks if the queryFormat is one of the dateFormats
|
|
30975
|
-
accepted by the elasticsearch or not. */
|
|
30976
|
-
function isValidDateRangeQueryFormat(queryFormat) {
|
|
30977
|
-
return Object.keys(dateFormats).includes(queryFormat);
|
|
30978
|
-
}
|
|
30979
|
-
|
|
30980
|
-
var _componentToTypeMap;
|
|
30981
|
-
var componentToTypeMap = (_componentToTypeMap = {}, _componentToTypeMap[componentTypes.reactiveList] = queryTypes.search, _componentToTypeMap[componentTypes.dataSearch] = queryTypes.search, _componentToTypeMap[componentTypes.categorySearch] = queryTypes.search, _componentToTypeMap[componentTypes.searchBox] = queryTypes.suggestion, _componentToTypeMap[componentTypes.singleList] = queryTypes.term, _componentToTypeMap[componentTypes.multiList] = queryTypes.term, _componentToTypeMap[componentTypes.singleDataList] = queryTypes.term, _componentToTypeMap[componentTypes.singleDropdownList] = queryTypes.term, _componentToTypeMap[componentTypes.multiDataList] = queryTypes.term, _componentToTypeMap[componentTypes.multiDropdownList] = queryTypes.term, _componentToTypeMap[componentTypes.tagCloud] = queryTypes.term, _componentToTypeMap[componentTypes.toggleButton] = queryTypes.term, _componentToTypeMap[componentTypes.reactiveChart] = queryTypes.term, _componentToTypeMap[componentTypes.treeList] = queryTypes.term, _componentToTypeMap[componentTypes.numberBox] = queryTypes.term, _componentToTypeMap[componentTypes.datePicker] = queryTypes.range, _componentToTypeMap[componentTypes.dateRange] = queryTypes.range, _componentToTypeMap[componentTypes.dynamicRangeSlider] = queryTypes.range, _componentToTypeMap[componentTypes.singleDropdownRange] = queryTypes.range, _componentToTypeMap[componentTypes.multiDropdownRange] = queryTypes.range, _componentToTypeMap[componentTypes.singleRange] = queryTypes.range, _componentToTypeMap[componentTypes.multiRange] = queryTypes.range, _componentToTypeMap[componentTypes.rangeSlider] = queryTypes.range, _componentToTypeMap[componentTypes.ratingsFilter] = queryTypes.range, _componentToTypeMap[componentTypes.rangeInput] = queryTypes.range, _componentToTypeMap[componentTypes.geoDistanceDropdown] = queryTypes.geo, _componentToTypeMap[componentTypes.geoDistanceSlider] = queryTypes.geo, _componentToTypeMap[componentTypes.reactiveMap] = queryTypes.geo, _componentToTypeMap);
|
|
30982
|
-
var multiRangeComponents = [componentTypes.multiRange, componentTypes.multiDropdownRange];
|
|
30983
|
-
var dateRangeComponents = [componentTypes.dateRange, componentTypes.datePicker];
|
|
30984
|
-
var searchComponents = [componentTypes.categorySearch, componentTypes.dataSearch, componentTypes.searchBox];
|
|
30985
|
-
var listComponentsWithPagination = [componentTypes.singleList, componentTypes.multiList, componentTypes.singleDropdownList, componentTypes.multiDropdownList];
|
|
30986
|
-
var getNormalizedField = function getNormalizedField(field) {
|
|
30987
|
-
if (field && !Array.isArray(field)) {
|
|
30988
|
-
return [field];
|
|
30989
|
-
}
|
|
30990
|
-
return field;
|
|
30991
|
-
};
|
|
30992
|
-
var isInternalComponent = function isInternalComponent(componentID) {
|
|
30993
|
-
if (componentID === void 0) {
|
|
30994
|
-
componentID = '';
|
|
30995
|
-
}
|
|
30996
|
-
return componentID.endsWith('__internal');
|
|
30997
|
-
};
|
|
30998
|
-
var getInternalComponentID = function getInternalComponentID(componentID) {
|
|
30999
|
-
if (componentID === void 0) {
|
|
31000
|
-
componentID = '';
|
|
31001
|
-
}
|
|
31002
|
-
return componentID + "__internal";
|
|
31003
|
-
};
|
|
31004
|
-
var getHistogramComponentID = function getHistogramComponentID(componentID) {
|
|
31005
|
-
if (componentID === void 0) {
|
|
31006
|
-
componentID = '';
|
|
31007
|
-
}
|
|
31008
|
-
return componentID + "__histogram__internal";
|
|
31009
|
-
};
|
|
31010
|
-
var isDRSRangeComponent = function isDRSRangeComponent(componentID) {
|
|
31011
|
-
if (componentID === void 0) {
|
|
31012
|
-
componentID = '';
|
|
31013
|
-
}
|
|
31014
|
-
return componentID.endsWith('__range__internal');
|
|
31015
|
-
};
|
|
31016
|
-
var isSearchComponent = function isSearchComponent(componentType) {
|
|
31017
|
-
if (componentType === void 0) {
|
|
31018
|
-
componentType = '';
|
|
31019
|
-
}
|
|
31020
|
-
return searchComponents.includes(componentType);
|
|
31021
|
-
};
|
|
31022
|
-
var isComponentUsesLabelAsValue = function isComponentUsesLabelAsValue(componentType) {
|
|
31023
|
-
if (componentType === void 0) {
|
|
31024
|
-
componentType = '';
|
|
31025
|
-
}
|
|
31026
|
-
return componentType === componentTypes.multiDataList || componentType === componentTypes.singleDataList || componentType === componentTypes.tabDataList;
|
|
31027
|
-
};
|
|
31028
|
-
var hasPaginationSupport = function hasPaginationSupport(componentType) {
|
|
31029
|
-
if (componentType === void 0) {
|
|
31030
|
-
componentType = '';
|
|
31031
|
-
}
|
|
31032
|
-
return listComponentsWithPagination.includes(componentType);
|
|
31033
|
-
};
|
|
31034
|
-
var getRSQuery = function getRSQuery(componentId, props, execute) {
|
|
31035
|
-
if (execute === void 0) {
|
|
31036
|
-
execute = true;
|
|
31037
|
-
}
|
|
31038
|
-
if (props && componentId) {
|
|
31039
|
-
var queryType = props.type ? props.type : componentToTypeMap[props.componentType];
|
|
31040
|
-
// dataField is a required field for components other than search
|
|
31041
|
-
// TODO: Revisit this logic based on the Appbase version
|
|
31042
|
-
// dataField is no longer a required field in RS API
|
|
31043
|
-
if (!isSearchComponent(props.componentType) && !props.dataField) {
|
|
31044
|
-
return null;
|
|
31045
|
-
}
|
|
31046
|
-
var endpoint;
|
|
31047
|
-
if (props.endpoint instanceof Object) {
|
|
31048
|
-
endpoint = props.endpoint;
|
|
30806
|
+
return arr2;
|
|
30807
|
+
} else {
|
|
30808
|
+
return Array.from(arr);
|
|
31049
30809
|
}
|
|
31050
|
-
return _extends({
|
|
31051
|
-
id: componentId,
|
|
31052
|
-
type: queryType || queryTypes.search,
|
|
31053
|
-
dataField: getNormalizedField(props.dataField),
|
|
31054
|
-
execute: execute,
|
|
31055
|
-
react: props.react,
|
|
31056
|
-
highlight: props.highlight,
|
|
31057
|
-
highlightField: getNormalizedField(props.highlightField),
|
|
31058
|
-
fuzziness: props.fuzziness,
|
|
31059
|
-
searchOperators: props.searchOperators,
|
|
31060
|
-
includeFields: props.includeFields,
|
|
31061
|
-
excludeFields: props.excludeFields,
|
|
31062
|
-
size: props.size,
|
|
31063
|
-
aggregationSize: props.aggregationSize,
|
|
31064
|
-
from: props.from || undefined,
|
|
31065
|
-
// Need to maintain for RL
|
|
31066
|
-
queryFormat: props.queryFormat,
|
|
31067
|
-
sortBy: props.sortBy,
|
|
31068
|
-
fieldWeights: getNormalizedField(props.fieldWeights),
|
|
31069
|
-
includeNullValues: props.includeNullValues,
|
|
31070
|
-
aggregationField: props.aggregationField || undefined,
|
|
31071
|
-
categoryField: props.categoryField || undefined,
|
|
31072
|
-
missingLabel: props.missingLabel || undefined,
|
|
31073
|
-
showMissing: props.showMissing,
|
|
31074
|
-
nestedField: props.nestedField || undefined,
|
|
31075
|
-
interval: props.interval,
|
|
31076
|
-
highlightConfig: props.customHighlight || props.highlightConfig,
|
|
31077
|
-
customQuery: props.customQuery,
|
|
31078
|
-
defaultQuery: props.defaultQuery,
|
|
31079
|
-
value: props.value,
|
|
31080
|
-
categoryValue: props.categoryValue || undefined,
|
|
31081
|
-
after: props.after || undefined,
|
|
31082
|
-
aggregations: props.aggregations || undefined,
|
|
31083
|
-
enableSynonyms: props.enableSynonyms,
|
|
31084
|
-
selectAllLabel: props.selectAllLabel,
|
|
31085
|
-
pagination: props.pagination,
|
|
31086
|
-
queryString: props.queryString,
|
|
31087
|
-
distinctField: props.distinctField,
|
|
31088
|
-
distinctFieldConfig: props.distinctFieldConfig,
|
|
31089
|
-
index: props.index
|
|
31090
|
-
}, queryType === queryTypes.suggestion ? _extends({
|
|
31091
|
-
enablePopularSuggestions: props.enablePopularSuggestions,
|
|
31092
|
-
enableEndpointSuggestions: props.enableEndpointSuggestions,
|
|
31093
|
-
enableRecentSuggestions: props.enableRecentSuggestions,
|
|
31094
|
-
popularSuggestionsConfig: props.popularSuggestionsConfig,
|
|
31095
|
-
recentSuggestionsConfig: props.recentSuggestionsConfig,
|
|
31096
|
-
applyStopwords: props.applyStopwords,
|
|
31097
|
-
customStopwords: props.customStopwords,
|
|
31098
|
-
enablePredictiveSuggestions: props.enablePredictiveSuggestions,
|
|
31099
|
-
featuredSuggestionsConfig: props.featuredSuggestionsConfig,
|
|
31100
|
-
indexSuggestionsConfig: props.indexSuggestionsConfig,
|
|
31101
|
-
enableFeaturedSuggestions: props.enableFeaturedSuggestions,
|
|
31102
|
-
enableIndexSuggestions: props.enableIndexSuggestions
|
|
31103
|
-
}, props.searchboxId ? {
|
|
31104
|
-
searchboxId: props.searchboxId
|
|
31105
|
-
} : {}) : {}, {
|
|
31106
|
-
calendarInterval: props.calendarInterval,
|
|
31107
|
-
endpoint: endpoint,
|
|
31108
|
-
range: props.range
|
|
31109
|
-
});
|
|
31110
30810
|
}
|
|
31111
|
-
|
|
31112
|
-
|
|
31113
|
-
|
|
31114
|
-
|
|
31115
|
-
|
|
31116
|
-
|
|
30811
|
+
function _objectWithoutProperties(obj, keys) {
|
|
30812
|
+
var target = {};
|
|
30813
|
+
for (var i in obj) {
|
|
30814
|
+
if (keys.indexOf(i) >= 0) continue;
|
|
30815
|
+
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
|
|
30816
|
+
target[i] = obj[i];
|
|
30817
|
+
}
|
|
30818
|
+
return target;
|
|
31117
30819
|
}
|
|
31118
|
-
|
|
31119
|
-
|
|
31120
|
-
|
|
31121
|
-
|
|
31122
|
-
|
|
31123
|
-
|
|
31124
|
-
|
|
31125
|
-
var type = queryType;
|
|
31126
|
-
var dataField = componentProps.dataField;
|
|
31127
|
-
var aggregations = componentProps.aggregations;
|
|
31128
|
-
var pagination; // pagination for `term` type of queries
|
|
31129
|
-
var from = componentProps.from; // offset for RL
|
|
31130
|
-
var range; // applicable for range components supporting histogram
|
|
31131
|
-
|
|
31132
|
-
// For term queries i.e list component `dataField` will be treated as aggregationField
|
|
31133
|
-
if (queryType === queryTypes.term) {
|
|
31134
|
-
// Only apply pagination prop for the components which supports it otherwise it can break the UI
|
|
31135
|
-
if (componentProps.showLoadMore && hasPaginationSupport(componentProps.componentType)) {
|
|
31136
|
-
pagination = true;
|
|
31137
|
-
}
|
|
31138
|
-
// Extract values from components that are type of objects
|
|
31139
|
-
// This code handles the controlled behavior in list components for e.g ToggleButton
|
|
31140
|
-
if (value != null && typeof value === 'object' && value.value) {
|
|
31141
|
-
value = value.value;
|
|
31142
|
-
} else if (Array.isArray(value)) {
|
|
31143
|
-
var parsedValue = [];
|
|
31144
|
-
value.forEach(function (val) {
|
|
31145
|
-
if (val != null && typeof val === 'object' && val.value) {
|
|
31146
|
-
parsedValue.push(val.value);
|
|
31147
|
-
} else {
|
|
31148
|
-
parsedValue.push(val);
|
|
31149
|
-
}
|
|
30820
|
+
function _defineProperty(obj, key, value) {
|
|
30821
|
+
if (key in obj) {
|
|
30822
|
+
Object.defineProperty(obj, key, {
|
|
30823
|
+
value: value,
|
|
30824
|
+
enumerable: true,
|
|
30825
|
+
configurable: true,
|
|
30826
|
+
writable: true
|
|
31150
30827
|
});
|
|
31151
|
-
|
|
30828
|
+
} else {
|
|
30829
|
+
obj[key] = value;
|
|
31152
30830
|
}
|
|
30831
|
+
return obj;
|
|
31153
30832
|
}
|
|
31154
|
-
|
|
31155
|
-
if (
|
|
31156
|
-
|
|
31157
|
-
|
|
31158
|
-
|
|
31159
|
-
|
|
31160
|
-
|
|
31161
|
-
|
|
31162
|
-
|
|
31163
|
-
|
|
30833
|
+
function getValue(state, id, defaultValue) {
|
|
30834
|
+
if (state && state[id]) {
|
|
30835
|
+
try {
|
|
30836
|
+
var parsedValue = JSON.parse(state[id]);
|
|
30837
|
+
return _extends({}, typeof parsedValue === 'object' && parsedValue.value ? _extends({
|
|
30838
|
+
value: parsedValue.value
|
|
30839
|
+
}, parsedValue.category ? {
|
|
30840
|
+
category: parsedValue.category
|
|
30841
|
+
} : {}) : {
|
|
30842
|
+
value: parsedValue
|
|
30843
|
+
}, {
|
|
30844
|
+
reference: 'URL'
|
|
31164
30845
|
});
|
|
31165
|
-
}
|
|
31166
|
-
|
|
31167
|
-
|
|
31168
|
-
|
|
31169
|
-
};
|
|
31170
|
-
}
|
|
31171
|
-
} else if (componentProps.showHistogram) {
|
|
31172
|
-
var internalComponentID = getInternalComponentID(component);
|
|
31173
|
-
var internalComponentValue = store.internalValues[internalComponentID];
|
|
31174
|
-
if (!internalComponentValue) {
|
|
31175
|
-
// Handle dynamic range slider
|
|
31176
|
-
var histogramComponentID = getHistogramComponentID(component);
|
|
31177
|
-
internalComponentValue = store.internalValues[histogramComponentID];
|
|
31178
|
-
}
|
|
31179
|
-
if (internalComponentValue && Array.isArray(internalComponentValue.value)) {
|
|
31180
|
-
value = {
|
|
31181
|
-
start: internalComponentValue.value[0],
|
|
31182
|
-
end: internalComponentValue.value[1]
|
|
31183
|
-
};
|
|
31184
|
-
}
|
|
31185
|
-
}
|
|
31186
|
-
if (isDRSRangeComponent(component)) {
|
|
31187
|
-
aggregations = ['min', 'max'];
|
|
31188
|
-
} else if (componentProps.showHistogram) {
|
|
31189
|
-
aggregations = ['histogram'];
|
|
31190
|
-
}
|
|
31191
|
-
|
|
31192
|
-
// handle number box, number box query changes based on the `queryFormat` value
|
|
31193
|
-
if (componentProps.componentType === componentTypes.dynamicRangeSlider || componentProps.componentType === componentTypes.rangeSlider) {
|
|
31194
|
-
calendarInterval = Object.keys(dateFormats).includes(queryFormat) ? componentProps.calendarInterval : undefined;
|
|
31195
|
-
|
|
31196
|
-
// Set value
|
|
31197
|
-
if (value) {
|
|
31198
|
-
if (isValidDateRangeQueryFormat(componentProps.queryFormat)) {
|
|
31199
|
-
// check if date types are dealt with
|
|
31200
|
-
value = {
|
|
31201
|
-
start: formatDate(dayjs_min(new Date(value.start)), componentProps),
|
|
31202
|
-
end: formatDate(dayjs_min(new Date(value.end)), componentProps)
|
|
31203
|
-
};
|
|
31204
|
-
} else {
|
|
31205
|
-
value = {
|
|
31206
|
-
start: parseFloat(value.start),
|
|
31207
|
-
end: parseFloat(value.end)
|
|
31208
|
-
};
|
|
31209
|
-
}
|
|
31210
|
-
}
|
|
31211
|
-
var rangeValue;
|
|
31212
|
-
if (componentProps.componentType === componentTypes.dynamicRangeSlider) {
|
|
31213
|
-
rangeValue = store.aggregations[component + "__range__internal"];
|
|
31214
|
-
if (componentProps.nestedField) {
|
|
31215
|
-
rangeValue = rangeValue && store.aggregations[component + "__range__internal"][componentProps.nestedField].min ? {
|
|
31216
|
-
start: store.aggregations[component + "__range__internal"][componentProps.nestedField].min.value,
|
|
31217
|
-
end: store.aggregations[component + "__range__internal"][componentProps.nestedField].max.value
|
|
31218
|
-
} // prettier-ignore
|
|
31219
|
-
: null;
|
|
31220
|
-
} else {
|
|
31221
|
-
rangeValue = rangeValue && store.aggregations[component + "__range__internal"].min ? {
|
|
31222
|
-
start: store.aggregations[component + "__range__internal"].min.value,
|
|
31223
|
-
end: store.aggregations[component + "__range__internal"].max.value
|
|
31224
|
-
} // prettier-ignore
|
|
31225
|
-
: null;
|
|
31226
|
-
}
|
|
31227
|
-
} else {
|
|
31228
|
-
rangeValue = componentProps.range;
|
|
31229
|
-
}
|
|
31230
|
-
if (rangeValue) {
|
|
31231
|
-
if (isValidDateRangeQueryFormat(componentProps.queryFormat)) {
|
|
31232
|
-
// check if date types are dealt with
|
|
31233
|
-
range = {
|
|
31234
|
-
start: formatDate(dayjs_min(rangeValue.start), componentProps),
|
|
31235
|
-
end: formatDate(dayjs_min(rangeValue.end), componentProps)
|
|
31236
|
-
};
|
|
31237
|
-
} else {
|
|
31238
|
-
range = {
|
|
31239
|
-
start: parseFloat(rangeValue.start),
|
|
31240
|
-
end: parseFloat(rangeValue.end)
|
|
31241
|
-
};
|
|
31242
|
-
}
|
|
31243
|
-
}
|
|
31244
|
-
}
|
|
31245
|
-
|
|
31246
|
-
// handle date components
|
|
31247
|
-
if (dateRangeComponents.includes(componentProps.componentType)) {
|
|
31248
|
-
// Set value
|
|
31249
|
-
if (value) {
|
|
31250
|
-
if (isValidDateRangeQueryFormat(componentProps.queryFormat)) {
|
|
31251
|
-
if (typeof value === 'string') {
|
|
31252
|
-
value = {
|
|
31253
|
-
// value would be an ISO Date string
|
|
31254
|
-
start: formatDate(dayjs_min(value).subtract(24, 'hour'), componentProps),
|
|
31255
|
-
end: formatDate(dayjs_min(value), componentProps)
|
|
31256
|
-
};
|
|
31257
|
-
} else if (Array.isArray(value)) {
|
|
31258
|
-
value = value.map(function (val) {
|
|
31259
|
-
return {
|
|
31260
|
-
// value would be one of ISO Date string, number, native date
|
|
31261
|
-
start: formatDate(dayjs_min(val).subtract(24, 'hour'), componentProps),
|
|
31262
|
-
end: formatDate(dayjs_min(val), componentProps)
|
|
31263
|
-
};
|
|
31264
|
-
});
|
|
31265
|
-
} else {
|
|
31266
|
-
value = {
|
|
31267
|
-
start: formatDate(dayjs_min(value.start).subtract(24, 'hour'), componentProps),
|
|
31268
|
-
end: formatDate(dayjs_min(value.end), componentProps)
|
|
31269
|
-
};
|
|
31270
|
-
}
|
|
31271
|
-
}
|
|
31272
|
-
}
|
|
31273
|
-
}
|
|
31274
|
-
}
|
|
31275
|
-
if (queryType === queryTypes.geo) {
|
|
31276
|
-
// override the value extracted from selectedValues reducer
|
|
31277
|
-
value = undefined;
|
|
31278
|
-
var geoCalcValues = store.selectedValues[component] || store.internalValues[component] || store.internalValues[getInternalComponentID(component)];
|
|
31279
|
-
if (geoCalcValues && geoCalcValues.meta) {
|
|
31280
|
-
if (geoCalcValues.meta.distance && geoCalcValues.meta.coordinates) {
|
|
31281
|
-
value = {
|
|
31282
|
-
distance: geoCalcValues.meta.distance,
|
|
31283
|
-
location: geoCalcValues.meta.coordinates
|
|
31284
|
-
};
|
|
31285
|
-
if (componentProps.unit) {
|
|
31286
|
-
value.unit = componentProps.unit;
|
|
31287
|
-
}
|
|
31288
|
-
}
|
|
31289
|
-
if (geoCalcValues.meta.mapBoxBounds && geoCalcValues.meta.mapBoxBounds.top_left && geoCalcValues.meta.mapBoxBounds.bottom_right) {
|
|
31290
|
-
value = {
|
|
31291
|
-
// Note: format will be reverse of what we're using now
|
|
31292
|
-
geoBoundingBox: {
|
|
31293
|
-
topLeft: geoCalcValues.meta.mapBoxBounds.top_left[1] + ", " + geoCalcValues.meta.mapBoxBounds.top_left[0],
|
|
31294
|
-
bottomRight: geoCalcValues.meta.mapBoxBounds.bottom_right[1] + ", " + geoCalcValues.meta.mapBoxBounds.bottom_right[0]
|
|
31295
|
-
}
|
|
31296
|
-
};
|
|
31297
|
-
}
|
|
31298
|
-
}
|
|
31299
|
-
}
|
|
31300
|
-
// handle number box, number box query changes based on the `queryFormat` value
|
|
31301
|
-
if (componentProps.componentType === componentTypes.numberBox) {
|
|
31302
|
-
if (queryFormat === 'exact') {
|
|
31303
|
-
type = 'term';
|
|
31304
|
-
} else {
|
|
31305
|
-
type = 'range';
|
|
31306
|
-
if (queryFormat === 'lte') {
|
|
31307
|
-
value = {
|
|
31308
|
-
end: value,
|
|
31309
|
-
boost: 2.0
|
|
31310
|
-
};
|
|
31311
|
-
} else {
|
|
31312
|
-
value = {
|
|
31313
|
-
start: value,
|
|
31314
|
-
boost: 2.0
|
|
30846
|
+
} catch (error) {
|
|
30847
|
+
return {
|
|
30848
|
+
value: state[id],
|
|
30849
|
+
reference: 'URL'
|
|
31315
30850
|
};
|
|
31316
30851
|
}
|
|
31317
30852
|
}
|
|
31318
|
-
|
|
31319
|
-
|
|
31320
|
-
|
|
31321
|
-
|
|
31322
|
-
// TODO: Remove it after some time. The `dataField` is no longer required
|
|
31323
|
-
if (componentProps.componentType === componentTypes.reactiveComponent) {
|
|
31324
|
-
// Set the type to `term`
|
|
31325
|
-
type = 'term';
|
|
31326
|
-
dataField = 'reactive_component_field';
|
|
31327
|
-
// Don't set value property for ReactiveComponent
|
|
31328
|
-
// since it is driven by `defaultQuery` and `customQuery`
|
|
31329
|
-
value = undefined;
|
|
31330
|
-
}
|
|
31331
|
-
// Assign default value as an empty string for search components so search relevancy can work
|
|
31332
|
-
if (isSearchComponent(componentProps.componentType) && !value) {
|
|
31333
|
-
value = '';
|
|
31334
|
-
}
|
|
31335
|
-
|
|
31336
|
-
// Handle components which uses label instead of value as the selected value
|
|
31337
|
-
if (isComponentUsesLabelAsValue(componentProps.componentType)) {
|
|
31338
|
-
var data = componentProps.data,
|
|
31339
|
-
selectAllLabel = componentProps.selectAllLabel;
|
|
31340
|
-
var absValue = [];
|
|
31341
|
-
if (value && Array.isArray(value)) {
|
|
31342
|
-
absValue = value;
|
|
31343
|
-
} else if (value && typeof value === 'string') {
|
|
31344
|
-
absValue = [value];
|
|
31345
|
-
}
|
|
31346
|
-
var normalizedValue = [];
|
|
31347
|
-
if (absValue.length) {
|
|
31348
|
-
if (data && Array.isArray(data)) {
|
|
31349
|
-
absValue.forEach(function (val) {
|
|
31350
|
-
var dataItem = data.find(function (o) {
|
|
31351
|
-
return o.label === val;
|
|
31352
|
-
});
|
|
31353
|
-
if (dataItem && dataItem.value) {
|
|
31354
|
-
normalizedValue.push(dataItem.value);
|
|
31355
|
-
}
|
|
31356
|
-
});
|
|
31357
|
-
}
|
|
31358
|
-
}
|
|
31359
|
-
if (selectAllLabel && absValue.length && absValue.includes(selectAllLabel)) {
|
|
31360
|
-
normalizedValue = absValue;
|
|
31361
|
-
}
|
|
31362
|
-
if (normalizedValue.length) {
|
|
31363
|
-
value = normalizedValue;
|
|
31364
|
-
} else {
|
|
31365
|
-
value = undefined;
|
|
31366
|
-
}
|
|
30853
|
+
return {
|
|
30854
|
+
value: defaultValue,
|
|
30855
|
+
reference: 'DEFAULT'
|
|
30856
|
+
};
|
|
31367
30857
|
}
|
|
31368
|
-
|
|
31369
|
-
|
|
31370
|
-
|
|
31371
|
-
|
|
31372
|
-
|
|
31373
|
-
|
|
31374
|
-
|
|
31375
|
-
|
|
31376
|
-
|
|
31377
|
-
|
|
31378
|
-
|
|
31379
|
-
|
|
31380
|
-
}
|
|
31381
|
-
|
|
31382
|
-
|
|
31383
|
-
|
|
31384
|
-
|
|
31385
|
-
|
|
31386
|
-
|
|
31387
|
-
|
|
31388
|
-
|
|
31389
|
-
|
|
31390
|
-
|
|
31391
|
-
|
|
31392
|
-
aggregations: aggregations,
|
|
31393
|
-
interval: interval,
|
|
31394
|
-
react: store.dependencyTree ? store.dependencyTree[component] : undefined,
|
|
31395
|
-
customQuery: store.customQueries ? store.customQueries[component] : undefined,
|
|
31396
|
-
defaultQuery: store.defaultQueries ? store.defaultQueries[component] : undefined,
|
|
31397
|
-
customHighlight: store.customHighlightOptions ? store.customHighlightOptions[component] : undefined,
|
|
31398
|
-
categoryValue: store.internalValues[component] ? store.internalValues[component].category : undefined,
|
|
31399
|
-
value: queryValue,
|
|
31400
|
-
pagination: pagination,
|
|
31401
|
-
from: from,
|
|
31402
|
-
range: range
|
|
31403
|
-
}, customOptions);
|
|
31404
|
-
};
|
|
31405
|
-
function flatReactProp(reactProp, componentID) {
|
|
31406
|
-
var flattenReact = [];
|
|
31407
|
-
var flatReact = function flatReact(react) {
|
|
31408
|
-
if (react && Object.keys(react)) {
|
|
31409
|
-
Object.keys(react).forEach(function (r) {
|
|
31410
|
-
if (react[r]) {
|
|
31411
|
-
if (typeof react[r] === 'string') {
|
|
31412
|
-
flattenReact = [].concat(flattenReact, [react[r]]);
|
|
31413
|
-
} else if (Array.isArray(react[r])) {
|
|
31414
|
-
flattenReact = [].concat(flattenReact, react[r]);
|
|
31415
|
-
} else if (typeof react[r] === 'object') {
|
|
31416
|
-
flatReact(react[r]);
|
|
31417
|
-
}
|
|
31418
|
-
}
|
|
31419
|
-
});
|
|
30858
|
+
function parseQuery(str) {
|
|
30859
|
+
if (str instanceof Object) {
|
|
30860
|
+
return str;
|
|
30861
|
+
}
|
|
30862
|
+
if (typeof str !== 'string' || str.length === 0) return {};
|
|
30863
|
+
var s = void 0;
|
|
30864
|
+
if (str.split('/?')[1]) {
|
|
30865
|
+
s = str.split('/?')[1].split('&');
|
|
30866
|
+
}
|
|
30867
|
+
if (str.split('?')[1]) {
|
|
30868
|
+
s = str.split('?')[1].split('&');
|
|
30869
|
+
}
|
|
30870
|
+
if (!s) return {};
|
|
30871
|
+
var sLength = s.length;
|
|
30872
|
+
var bit = void 0;
|
|
30873
|
+
var query = {};
|
|
30874
|
+
var first = void 0;
|
|
30875
|
+
var second = void 0;
|
|
30876
|
+
for (var i = 0; i < sLength; i += 1) {
|
|
30877
|
+
bit = s[i].split('=');
|
|
30878
|
+
first = decodeURIComponent(bit[0]);
|
|
30879
|
+
if (first.length === 0) continue;
|
|
30880
|
+
second = decodeURIComponent(bit[1]);
|
|
30881
|
+
if (typeof query[first] === 'undefined') query[first] = second;else if (query[first] instanceof Array) query[first].push(second);else query[first] = [query[first], second];
|
|
31420
30882
|
}
|
|
31421
|
-
|
|
31422
|
-
flatReact(reactProp);
|
|
31423
|
-
// Remove cyclic dependencies
|
|
31424
|
-
flattenReact = flattenReact.filter(function (react) {
|
|
31425
|
-
return react !== componentID;
|
|
31426
|
-
});
|
|
31427
|
-
return flattenReact;
|
|
31428
|
-
}
|
|
31429
|
-
var getDependentQueries = function getDependentQueries(store, componentID, orderOfQueries) {
|
|
31430
|
-
if (orderOfQueries === void 0) {
|
|
31431
|
-
orderOfQueries = [];
|
|
31432
|
-
}
|
|
31433
|
-
var finalQuery = {};
|
|
31434
|
-
var react = flatReactProp(store.dependencyTree[componentID], componentID);
|
|
31435
|
-
react.forEach(function (componentObject) {
|
|
31436
|
-
var component = componentObject;
|
|
31437
|
-
var customQuery = store.customQueries[component];
|
|
31438
|
-
if (!isInternalComponent(component)) {
|
|
31439
|
-
var calcValues = store.selectedValues[component] || store.internalValues[component];
|
|
31440
|
-
// Only include queries for that component that has `customQuery` or `value` defined
|
|
31441
|
-
if ((calcValues && calcValues.value || customQuery) && !finalQuery[component]) {
|
|
31442
|
-
var execute = false;
|
|
31443
|
-
if (Array.isArray(orderOfQueries) && orderOfQueries.includes(component)) {
|
|
31444
|
-
execute = true;
|
|
31445
|
-
}
|
|
31446
|
-
var componentProps = store.props[component];
|
|
31447
|
-
// build query
|
|
31448
|
-
var dependentQuery = getRSQuery(component, extractPropsFromState(store, component, _extends({}, componentProps && _extends({}, componentProps.componentType === componentTypes.searchBox ? _extends({}, execute === false ? {
|
|
31449
|
-
type: queryTypes.search
|
|
31450
|
-
} : {}, calcValues.category ? {
|
|
31451
|
-
categoryValue: calcValues.category
|
|
31452
|
-
} : {
|
|
31453
|
-
categoryValue: undefined
|
|
31454
|
-
}, calcValues.value ? {
|
|
31455
|
-
value: calcValues.value
|
|
31456
|
-
} : {}) : {}, componentProps.componentType === componentTypes.categorySearch ? _extends({}, calcValues.category ? {
|
|
31457
|
-
categoryValue: calcValues.category
|
|
31458
|
-
} : {
|
|
31459
|
-
categoryValue: undefined
|
|
31460
|
-
}) : {}))), execute);
|
|
31461
|
-
if (dependentQuery) {
|
|
31462
|
-
finalQuery[component] = dependentQuery;
|
|
31463
|
-
}
|
|
31464
|
-
}
|
|
31465
|
-
}
|
|
31466
|
-
});
|
|
31467
|
-
return finalQuery;
|
|
31468
|
-
};
|
|
31469
|
-
|
|
31470
|
-
var handleTransformResponse = function handleTransformResponse(res, config, component) {
|
|
31471
|
-
if (res === void 0) {
|
|
31472
|
-
res = null;
|
|
31473
|
-
}
|
|
31474
|
-
if (config === void 0) {
|
|
31475
|
-
config = {};
|
|
31476
|
-
}
|
|
31477
|
-
if (component === void 0) {
|
|
31478
|
-
component = '';
|
|
31479
|
-
}
|
|
31480
|
-
if (config.transformResponse && typeof config.transformResponse === 'function') {
|
|
31481
|
-
return config.transformResponse(res, component);
|
|
31482
|
-
}
|
|
31483
|
-
return new Promise(function (resolve) {
|
|
31484
|
-
return resolve(res);
|
|
31485
|
-
});
|
|
31486
|
-
};
|
|
31487
|
-
|
|
31488
|
-
var isPropertyDefined = function isPropertyDefined(property) {
|
|
31489
|
-
return property !== undefined && property !== null;
|
|
31490
|
-
};
|
|
31491
|
-
|
|
31492
|
-
var _excluded$a = ["value"];
|
|
31493
|
-
function valueReducer(state, action) {
|
|
31494
|
-
var _extends3;
|
|
31495
|
-
if (state === void 0) {
|
|
31496
|
-
state = {};
|
|
30883
|
+
return query;
|
|
31497
30884
|
}
|
|
31498
|
-
|
|
31499
|
-
|
|
31500
|
-
|
|
31501
|
-
|
|
31502
|
-
|
|
31503
|
-
|
|
31504
|
-
|
|
31505
|
-
|
|
31506
|
-
}
|
|
31507
|
-
|
|
31508
|
-
|
|
31509
|
-
|
|
31510
|
-
|
|
31511
|
-
|
|
31512
|
-
|
|
31513
|
-
|
|
31514
|
-
|
|
31515
|
-
|
|
31516
|
-
|
|
31517
|
-
|
|
31518
|
-
|
|
31519
|
-
|
|
31520
|
-
|
|
31521
|
-
|
|
31522
|
-
|
|
31523
|
-
|
|
31524
|
-
|
|
31525
|
-
var _action$componentsVal = action.componentsValues[component],
|
|
31526
|
-
value = _action$componentsVal.value,
|
|
31527
|
-
rest = _objectWithoutPropertiesLoose(_action$componentsVal, _excluded$a);
|
|
31528
|
-
_newState[component] = _extends({}, state[component], {
|
|
31529
|
-
value: value
|
|
31530
|
-
}, rest);
|
|
31531
|
-
});
|
|
31532
|
-
return _extends({}, state, _newState);
|
|
31533
|
-
}
|
|
31534
|
-
return state;
|
|
31535
|
-
}
|
|
31536
|
-
case PATCH_VALUE:
|
|
31537
|
-
return _extends({}, state, (_extends3 = {}, _extends3[action.component] = _extends({}, state[action.component], action.payload), _extends3));
|
|
31538
|
-
case CLEAR_VALUES:
|
|
31539
|
-
{
|
|
31540
|
-
var nextState = {};
|
|
31541
|
-
if (action.resetValues) {
|
|
31542
|
-
Object.keys(action.resetValues).forEach(function (componentId) {
|
|
31543
|
-
nextState[componentId] = _extends({}, state[componentId], {
|
|
31544
|
-
value: action.resetValues[componentId]
|
|
31545
|
-
});
|
|
31546
|
-
});
|
|
31547
|
-
}
|
|
31548
|
-
// clearAllBlacklistComponents has more priority over reset values
|
|
31549
|
-
if (Array.isArray(action.clearAllBlacklistComponents)) {
|
|
31550
|
-
Object.keys(state).forEach(function (componentId) {
|
|
31551
|
-
if (action.clearAllBlacklistComponents.includes(componentId)) {
|
|
31552
|
-
nextState[componentId] = state[componentId];
|
|
30885
|
+
var getServerResults = function getServerResults() {
|
|
30886
|
+
var storeReference = null;
|
|
30887
|
+
return function (App) {
|
|
30888
|
+
var queryString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
30889
|
+
var ssrRenderFunc = arguments[2];
|
|
30890
|
+
try {
|
|
30891
|
+
var parsedQueryString = parseQuery(queryString);
|
|
30892
|
+
if (!storeReference) {
|
|
30893
|
+
var newSelectedValues = {};
|
|
30894
|
+
var contextCollector = function contextCollector(params) {
|
|
30895
|
+
if (params.ctx) {
|
|
30896
|
+
storeReference = params.ctx;
|
|
30897
|
+
Object.keys(parsedQueryString).forEach(function (componentId) {
|
|
30898
|
+
var _getValue = getValue(parsedQueryString, componentId, null),
|
|
30899
|
+
value = _getValue.value,
|
|
30900
|
+
reference = _getValue.reference;
|
|
30901
|
+
if (value) {
|
|
30902
|
+
newSelectedValues = (0, _valueReducer2["default"])(newSelectedValues, {
|
|
30903
|
+
type: 'PATCH_VALUE',
|
|
30904
|
+
component: componentId,
|
|
30905
|
+
payload: {
|
|
30906
|
+
value: value,
|
|
30907
|
+
reference: reference
|
|
30908
|
+
}
|
|
30909
|
+
});
|
|
30910
|
+
}
|
|
30911
|
+
});
|
|
31553
30912
|
}
|
|
31554
|
-
|
|
31555
|
-
|
|
31556
|
-
|
|
31557
|
-
}
|
|
31558
|
-
case REMOVE_COMPONENT:
|
|
31559
|
-
{
|
|
31560
|
-
var _state2 = state,
|
|
31561
|
-
_action$component2 = action.component,
|
|
31562
|
-
del = _state2[_action$component2],
|
|
31563
|
-
obj = _objectWithoutPropertiesLoose(_state2, [_action$component2].map(_toPropertyKey$1));
|
|
31564
|
-
return obj;
|
|
31565
|
-
}
|
|
31566
|
-
case RESET_TO_DEFAULT:
|
|
31567
|
-
return _extends({}, state, action.defaultValues);
|
|
31568
|
-
default:
|
|
31569
|
-
return state;
|
|
31570
|
-
}
|
|
31571
|
-
}
|
|
31572
|
-
|
|
31573
|
-
var _excluded$b = ["value"];
|
|
31574
|
-
function getValue(state, id, defaultValue) {
|
|
31575
|
-
if (state && state[id]) {
|
|
31576
|
-
try {
|
|
31577
|
-
// parsing for next.js - since it uses extra set of quotes to wrap params
|
|
31578
|
-
var parsedValue = JSON.parse(state[id]);
|
|
31579
|
-
return _extends({}, typeof parsedValue === 'object' && parsedValue.value ? _extends({
|
|
31580
|
-
value: parsedValue.value
|
|
31581
|
-
}, parsedValue.category ? {
|
|
31582
|
-
category: parsedValue.category
|
|
31583
|
-
} : {}) : {
|
|
31584
|
-
value: parsedValue
|
|
31585
|
-
}, {
|
|
31586
|
-
reference: 'URL'
|
|
31587
|
-
});
|
|
31588
|
-
} catch (error) {
|
|
31589
|
-
// using react-dom-server for ssr
|
|
31590
|
-
return {
|
|
31591
|
-
value: state[id],
|
|
31592
|
-
reference: 'URL'
|
|
31593
|
-
};
|
|
31594
|
-
}
|
|
31595
|
-
}
|
|
31596
|
-
return {
|
|
31597
|
-
value: defaultValue,
|
|
31598
|
-
reference: 'DEFAULT'
|
|
31599
|
-
};
|
|
31600
|
-
}
|
|
31601
|
-
|
|
31602
|
-
// parse query string
|
|
31603
|
-
// ref: https://stackoverflow.com/a/13896633/10822996
|
|
31604
|
-
function parseQuery(str) {
|
|
31605
|
-
if (str instanceof Object) {
|
|
31606
|
-
return str;
|
|
31607
|
-
}
|
|
31608
|
-
if (typeof str !== 'string' || str.length === 0) return {};
|
|
31609
|
-
var s;
|
|
31610
|
-
if (str.split('/?')[1]) {
|
|
31611
|
-
s = str.split('/?')[1].split('&');
|
|
31612
|
-
}
|
|
31613
|
-
if (str.split('?')[1]) {
|
|
31614
|
-
s = str.split('?')[1].split('&');
|
|
31615
|
-
}
|
|
31616
|
-
if (!s) return {};
|
|
31617
|
-
var sLength = s.length;
|
|
31618
|
-
var bit;
|
|
31619
|
-
var query = {};
|
|
31620
|
-
var first;
|
|
31621
|
-
var second;
|
|
31622
|
-
for (var i = 0; i < sLength; i += 1) {
|
|
31623
|
-
bit = s[i].split('=');
|
|
31624
|
-
first = decodeURIComponent(bit[0]);
|
|
31625
|
-
// eslint-disable-next-line no-continue
|
|
31626
|
-
if (first.length === 0) continue;
|
|
31627
|
-
second = decodeURIComponent(bit[1]);
|
|
31628
|
-
if (typeof query[first] === 'undefined') query[first] = second;else if (query[first] instanceof Array) query[first].push(second);else query[first] = [query[first], second];
|
|
31629
|
-
}
|
|
31630
|
-
return query;
|
|
31631
|
-
}
|
|
31632
|
-
var getServerResults = function getServerResults() {
|
|
31633
|
-
var storeReference = null;
|
|
31634
|
-
return function (App, queryString, ssrRenderFunc) {
|
|
31635
|
-
if (queryString === void 0) {
|
|
31636
|
-
queryString = '';
|
|
31637
|
-
}
|
|
31638
|
-
try {
|
|
31639
|
-
// parse the query String to respect url params in SSR
|
|
31640
|
-
var parsedQueryString = parseQuery(queryString);
|
|
31641
|
-
if (!storeReference) {
|
|
31642
|
-
var newSelectedValues = {};
|
|
31643
|
-
// callback function to collect SearchBase context
|
|
31644
|
-
var contextCollector = function contextCollector(params) {
|
|
31645
|
-
if (params.ctx) {
|
|
31646
|
-
// store collected
|
|
31647
|
-
storeReference = params.ctx;
|
|
31648
|
-
|
|
31649
|
-
// collect selected values from the URL query string
|
|
31650
|
-
Object.keys(parsedQueryString).forEach(function (componentId) {
|
|
31651
|
-
var _getValue = getValue(parsedQueryString, componentId, null),
|
|
31652
|
-
value = _getValue.value,
|
|
31653
|
-
reference = _getValue.reference;
|
|
31654
|
-
if (value) {
|
|
31655
|
-
newSelectedValues = valueReducer(newSelectedValues, {
|
|
31656
|
-
type: 'PATCH_VALUE',
|
|
31657
|
-
component: componentId,
|
|
31658
|
-
payload: {
|
|
31659
|
-
value: value,
|
|
31660
|
-
reference: reference
|
|
31661
|
-
}
|
|
31662
|
-
});
|
|
31663
|
-
}
|
|
31664
|
-
});
|
|
31665
|
-
}
|
|
31666
|
-
return {
|
|
31667
|
-
// send back to ReactiveBase to hydrate the store with values from queryParams(if present)
|
|
31668
|
-
selectedValues: newSelectedValues
|
|
30913
|
+
return {
|
|
30914
|
+
selectedValues: newSelectedValues
|
|
30915
|
+
};
|
|
31669
30916
|
};
|
|
31670
|
-
|
|
31671
|
-
|
|
31672
|
-
|
|
31673
|
-
|
|
31674
|
-
|
|
31675
|
-
|
|
31676
|
-
|
|
31677
|
-
|
|
31678
|
-
|
|
31679
|
-
|
|
31680
|
-
|
|
31681
|
-
|
|
31682
|
-
|
|
31683
|
-
|
|
31684
|
-
|
|
31685
|
-
|
|
31686
|
-
|
|
31687
|
-
|
|
31688
|
-
|
|
31689
|
-
|
|
31690
|
-
|
|
31691
|
-
|
|
31692
|
-
|
|
31693
|
-
|
|
31694
|
-
|
|
31695
|
-
|
|
31696
|
-
|
|
31697
|
-
|
|
31698
|
-
|
|
31699
|
-
|
|
31700
|
-
|
|
31701
|
-
|
|
31702
|
-
|
|
31703
|
-
|
|
31704
|
-
|
|
31705
|
-
|
|
31706
|
-
|
|
31707
|
-
|
|
31708
|
-
|
|
31709
|
-
|
|
31710
|
-
|
|
31711
|
-
|
|
31712
|
-
|
|
31713
|
-
|
|
31714
|
-
}
|
|
31715
|
-
var query = getRSQuery(componentId, extractPropsFromState(state, componentId, queryOptions && queryOptions[componentId] ? {
|
|
31716
|
-
from: queryOptions[componentId].from
|
|
31717
|
-
} : null));
|
|
31718
|
-
|
|
31719
|
-
// check if query or options are valid - non-empty
|
|
31720
|
-
if (query && !!Object.keys(query).length) {
|
|
31721
|
-
var _extends2, _extends6;
|
|
31722
|
-
var currentQuery = query;
|
|
31723
|
-
var dependentQueries = getDependentQueries(state, componentId, orderOfQueries);
|
|
31724
|
-
var queryToLog = _extends({}, (_extends2 = {}, _extends2[componentId] = currentQuery, _extends2), Object.keys(dependentQueries).reduce(function (acc, q) {
|
|
31725
|
-
var _extends3;
|
|
31726
|
-
return _extends({}, acc, (_extends3 = {}, _extends3[q] = _extends({}, dependentQueries[q], {
|
|
31727
|
-
execute: false
|
|
31728
|
-
}, dependentQueries[q].type === queryTypes.suggestion ? {
|
|
31729
|
-
type: 'search'
|
|
31730
|
-
} : {}), _extends3));
|
|
31731
|
-
}, {}));
|
|
31732
|
-
if ([queryTypes.range, queryTypes.term].includes(componentToTypeMap[props[componentId].componentType])) {
|
|
31733
|
-
var _extends4;
|
|
31734
|
-
// Avoid logging `value` for term type of components
|
|
31735
|
-
// eslint-disable-next-line
|
|
31736
|
-
var value = currentQuery.value,
|
|
31737
|
-
rest = _objectWithoutPropertiesLoose(currentQuery, _excluded$b);
|
|
31738
|
-
queryToLog = _extends({}, (_extends4 = {}, _extends4[componentId] = rest, _extends4), Object.keys(dependentQueries).reduce(function (acc, q) {
|
|
31739
|
-
var _extends5;
|
|
31740
|
-
return _extends({}, acc, (_extends5 = {}, _extends5[q] = _extends({}, dependentQueries[q], {
|
|
30917
|
+
var output = ssrRenderFunc(App({
|
|
30918
|
+
contextCollector: contextCollector
|
|
30919
|
+
}));
|
|
30920
|
+
var promiseFunc = void 0;
|
|
30921
|
+
if (!output.then) {
|
|
30922
|
+
promiseFunc = Promise.resolve(promiseFunc);
|
|
30923
|
+
} else {
|
|
30924
|
+
promiseFunc = output;
|
|
30925
|
+
}
|
|
30926
|
+
return promiseFunc.then(function () {
|
|
30927
|
+
if (storeReference) {
|
|
30928
|
+
var extractedState = storeReference.getState();
|
|
30929
|
+
var components = extractedState.components,
|
|
30930
|
+
config = extractedState.config,
|
|
30931
|
+
appbaseRef = extractedState.appbaseRef,
|
|
30932
|
+
queryOptions = extractedState.queryOptions,
|
|
30933
|
+
internalValues = extractedState.internalValues,
|
|
30934
|
+
props = extractedState.props,
|
|
30935
|
+
queryList = extractedState.queryList,
|
|
30936
|
+
dependencyTree = extractedState.dependencyTree;
|
|
30937
|
+
var queryLog = extractedState.queryLog;
|
|
30938
|
+
var finalQuery = [];
|
|
30939
|
+
var appbaseQuery = {};
|
|
30940
|
+
var orderOfQueries = [];
|
|
30941
|
+
var hits = {};
|
|
30942
|
+
var aggregations = {};
|
|
30943
|
+
var state = _extends({}, extractedState);
|
|
30944
|
+
components.filter(function (t) {
|
|
30945
|
+
return !t.endsWith('__internal');
|
|
30946
|
+
}).forEach(function (componentId) {
|
|
30947
|
+
var _buildQuery = (0, helper.buildQuery)(componentId, dependencyTree, queryList, queryOptions),
|
|
30948
|
+
queryObj = _buildQuery.queryObj,
|
|
30949
|
+
options = _buildQuery.options;
|
|
30950
|
+
if (!queryObj && !options) {
|
|
30951
|
+
return;
|
|
30952
|
+
}
|
|
30953
|
+
var query = (0, transform.getRSQuery)(componentId, (0, transform.extractPropsFromState)(state, componentId, queryOptions && queryOptions[componentId] ? {
|
|
30954
|
+
from: queryOptions[componentId].from
|
|
30955
|
+
} : null));
|
|
30956
|
+
if (query && !!Object.keys(query).length) {
|
|
30957
|
+
var currentQuery = query;
|
|
30958
|
+
var dependentQueries = (0, transform.getDependentQueries)(state, componentId, orderOfQueries);
|
|
30959
|
+
var queryToLog = _extends(_defineProperty({}, componentId, currentQuery), Object.keys(dependentQueries).reduce(function (acc, q) {
|
|
30960
|
+
return _extends({}, acc, _defineProperty({}, q, _extends({}, dependentQueries[q], {
|
|
31741
30961
|
execute: false
|
|
31742
|
-
}, dependentQueries[q].type === queryTypes.suggestion ? {
|
|
30962
|
+
}, dependentQueries[q].type === constants$1.queryTypes.suggestion ? {
|
|
31743
30963
|
type: 'search'
|
|
31744
|
-
} : {})
|
|
30964
|
+
} : {})));
|
|
31745
30965
|
}, {}));
|
|
30966
|
+
if ([constants$1.queryTypes.range, constants$1.queryTypes.term].includes(transform.componentToTypeMap[props[componentId].componentType])) {
|
|
30967
|
+
var value = currentQuery.value,
|
|
30968
|
+
rest = _objectWithoutProperties(currentQuery, ['value']);
|
|
30969
|
+
queryToLog = _extends(_defineProperty({}, componentId, rest), Object.keys(dependentQueries).reduce(function (acc, q) {
|
|
30970
|
+
return _extends({}, acc, _defineProperty({}, q, _extends({}, dependentQueries[q], {
|
|
30971
|
+
execute: false
|
|
30972
|
+
}, dependentQueries[q].type === constants$1.queryTypes.suggestion ? {
|
|
30973
|
+
type: 'search'
|
|
30974
|
+
} : {})));
|
|
30975
|
+
}, {}));
|
|
30976
|
+
}
|
|
30977
|
+
orderOfQueries = [].concat(_toConsumableArray(orderOfQueries), [componentId]);
|
|
30978
|
+
queryLog = _extends({}, queryLog, _defineProperty({}, componentId, queryToLog));
|
|
30979
|
+
if (query) {
|
|
30980
|
+
var dependentQueriesToAppend = (0, transform.getDependentQueries)(state, componentId, orderOfQueries);
|
|
30981
|
+
appbaseQuery = _extends({}, appbaseQuery, _defineProperty({}, componentId, query));
|
|
30982
|
+
Object.keys(dependentQueriesToAppend).forEach(function (cId) {
|
|
30983
|
+
if (appbaseQuery[cId]) {
|
|
30984
|
+
appbaseQuery[cId + Math.random()] = dependentQueriesToAppend[cId];
|
|
30985
|
+
} else {
|
|
30986
|
+
appbaseQuery[cId] = dependentQueriesToAppend[cId];
|
|
30987
|
+
}
|
|
30988
|
+
});
|
|
30989
|
+
}
|
|
31746
30990
|
}
|
|
31747
|
-
|
|
31748
|
-
|
|
31749
|
-
|
|
31750
|
-
|
|
31751
|
-
|
|
31752
|
-
|
|
31753
|
-
|
|
31754
|
-
|
|
31755
|
-
|
|
31756
|
-
|
|
31757
|
-
|
|
31758
|
-
|
|
31759
|
-
|
|
31760
|
-
|
|
31761
|
-
appbaseQuery[cId] = dependentQueriesToAppend[cId];
|
|
31762
|
-
}
|
|
31763
|
-
});
|
|
31764
|
-
}
|
|
31765
|
-
}
|
|
31766
|
-
});
|
|
31767
|
-
var handleRSResponse = function handleRSResponse(res) {
|
|
31768
|
-
var promotedResults = {};
|
|
31769
|
-
var rawData = {};
|
|
31770
|
-
var customData = {};
|
|
31771
|
-
var allPromises = orderOfQueries.map(function (component) {
|
|
31772
|
-
return new Promise(function (responseResolve, responseReject) {
|
|
31773
|
-
handleTransformResponse(res[component], config, component).then(function (response) {
|
|
31774
|
-
if (response) {
|
|
31775
|
-
var _extends9;
|
|
31776
|
-
if (response.promoted) {
|
|
31777
|
-
promotedResults[component] = response.promoted.map(function (promoted) {
|
|
31778
|
-
return _extends({}, promoted.doc, {
|
|
31779
|
-
_position: promoted.position
|
|
30991
|
+
});
|
|
30992
|
+
var handleRSResponse = function handleRSResponse(res) {
|
|
30993
|
+
var promotedResults = {};
|
|
30994
|
+
var rawData = {};
|
|
30995
|
+
var customData = {};
|
|
30996
|
+
var allPromises = orderOfQueries.map(function (component) {
|
|
30997
|
+
return new Promise(function (responseResolve, responseReject) {
|
|
30998
|
+
(0, utils.handleTransformResponse)(res[component], config, component).then(function (response) {
|
|
30999
|
+
if (response) {
|
|
31000
|
+
if (response.promoted) {
|
|
31001
|
+
promotedResults[component] = response.promoted.map(function (promoted) {
|
|
31002
|
+
return _extends({}, promoted.doc, {
|
|
31003
|
+
_position: promoted.position
|
|
31004
|
+
});
|
|
31780
31005
|
});
|
|
31781
|
-
}
|
|
31782
|
-
|
|
31783
|
-
|
|
31784
|
-
|
|
31785
|
-
|
|
31786
|
-
|
|
31787
|
-
|
|
31788
|
-
|
|
31789
|
-
var
|
|
31790
|
-
|
|
31006
|
+
}
|
|
31007
|
+
rawData[component] = response;
|
|
31008
|
+
if (response.customData) {
|
|
31009
|
+
customData[component] = response.customData;
|
|
31010
|
+
}
|
|
31011
|
+
if (response.aggregations) {
|
|
31012
|
+
aggregations = _extends({}, aggregations, _defineProperty({}, component, response.aggregations));
|
|
31013
|
+
}
|
|
31014
|
+
var hitsObj = response.hits || {};
|
|
31015
|
+
hits = _extends({}, hits, _defineProperty({}, component, {
|
|
31016
|
+
hits: hitsObj.hits,
|
|
31017
|
+
total: typeof hitsObj.total === 'object' ? hitsObj.total.value : hitsObj.total,
|
|
31018
|
+
time: response.took
|
|
31019
|
+
}));
|
|
31020
|
+
responseResolve();
|
|
31791
31021
|
}
|
|
31792
|
-
|
|
31793
|
-
|
|
31794
|
-
|
|
31795
|
-
total: typeof hitsObj.total === 'object' ? hitsObj.total.value : hitsObj.total,
|
|
31796
|
-
time: response.took
|
|
31797
|
-
}, _extends9));
|
|
31798
|
-
responseResolve();
|
|
31799
|
-
}
|
|
31800
|
-
})["catch"](function (err) {
|
|
31801
|
-
responseReject(err);
|
|
31022
|
+
})["catch"](function (err) {
|
|
31023
|
+
responseReject(err);
|
|
31024
|
+
});
|
|
31802
31025
|
});
|
|
31803
31026
|
});
|
|
31804
|
-
|
|
31805
|
-
|
|
31806
|
-
|
|
31807
|
-
|
|
31808
|
-
|
|
31809
|
-
|
|
31810
|
-
|
|
31811
|
-
|
|
31812
|
-
|
|
31813
|
-
|
|
31814
|
-
|
|
31815
|
-
|
|
31816
|
-
|
|
31817
|
-
|
|
31818
|
-
|
|
31819
|
-
|
|
31820
|
-
}
|
|
31821
|
-
|
|
31822
|
-
|
|
31823
|
-
|
|
31824
|
-
|
|
31825
|
-
|
|
31826
|
-
|
|
31827
|
-
|
|
31828
|
-
|
|
31829
|
-
|
|
31830
|
-
rsAPISettings.
|
|
31027
|
+
return Promise.all(allPromises).then(function () {
|
|
31028
|
+
state = {
|
|
31029
|
+
queryList: queryList,
|
|
31030
|
+
queryOptions: queryOptions,
|
|
31031
|
+
selectedValues: newSelectedValues,
|
|
31032
|
+
internalValues: internalValues,
|
|
31033
|
+
queryLog: queryLog,
|
|
31034
|
+
hits: hits,
|
|
31035
|
+
aggregations: aggregations,
|
|
31036
|
+
promotedResults: promotedResults,
|
|
31037
|
+
customData: customData,
|
|
31038
|
+
rawData: rawData,
|
|
31039
|
+
dependencyTree: dependencyTree
|
|
31040
|
+
};
|
|
31041
|
+
return Promise.resolve(JSON.parse(JSON.stringify(state)));
|
|
31042
|
+
});
|
|
31043
|
+
};
|
|
31044
|
+
if (Object.keys(appbaseQuery).length) {
|
|
31045
|
+
finalQuery = Object.values(appbaseQuery);
|
|
31046
|
+
var rsAPISettings = {};
|
|
31047
|
+
if (config.analyticsConfig) {
|
|
31048
|
+
rsAPISettings.recordAnalytics = (0, utils.isPropertyDefined)(config.analyticsConfig.recordAnalytics) ? config.analyticsConfig.recordAnalytics : undefined;
|
|
31049
|
+
rsAPISettings.userId = (0, utils.isPropertyDefined)(config.analyticsConfig.userId) ? config.analyticsConfig.userId : undefined;
|
|
31050
|
+
rsAPISettings.enableQueryRules = (0, utils.isPropertyDefined)(config.analyticsConfig.enableQueryRules) ? config.analyticsConfig.enableQueryRules : undefined;
|
|
31051
|
+
rsAPISettings.customEvents = (0, utils.isPropertyDefined)(config.analyticsConfig.customEvents) ? config.analyticsConfig.customEvents : undefined;
|
|
31052
|
+
}
|
|
31053
|
+
return appbaseRef.reactiveSearchv3(finalQuery, rsAPISettings).then(function (res) {
|
|
31054
|
+
return handleRSResponse(res);
|
|
31055
|
+
})["catch"](function (err) {
|
|
31056
|
+
return Promise.reject(err);
|
|
31057
|
+
});
|
|
31831
31058
|
}
|
|
31832
|
-
|
|
31833
|
-
|
|
31834
|
-
|
|
31835
|
-
return Promise.reject(err);
|
|
31836
|
-
});
|
|
31059
|
+
throw new Error('Could not compute server-side initial state of the app!');
|
|
31060
|
+
} else {
|
|
31061
|
+
return null;
|
|
31837
31062
|
}
|
|
31838
|
-
|
|
31839
|
-
|
|
31840
|
-
|
|
31841
|
-
|
|
31842
|
-
|
|
31063
|
+
});
|
|
31064
|
+
}
|
|
31065
|
+
return null;
|
|
31066
|
+
} catch (error) {
|
|
31067
|
+
return Promise.reject(error);
|
|
31843
31068
|
}
|
|
31844
|
-
|
|
31845
|
-
} catch (error) {
|
|
31846
|
-
return Promise.reject(error);
|
|
31847
|
-
}
|
|
31069
|
+
};
|
|
31848
31070
|
};
|
|
31849
|
-
|
|
31071
|
+
exports["default"] = getServerResults;
|
|
31072
|
+
});
|
|
31073
|
+
var getServerResults = unwrapExports(server);
|
|
31850
31074
|
|
|
31851
31075
|
function getServerState(App, queryString) {
|
|
31852
31076
|
var renderFunction = renderToString;
|
|
@@ -31855,7 +31079,7 @@
|
|
|
31855
31079
|
}, queryString, renderFunction);
|
|
31856
31080
|
}
|
|
31857
31081
|
|
|
31858
|
-
var version = "3.0.0-alpha.
|
|
31082
|
+
var version = "3.0.0-alpha.4";
|
|
31859
31083
|
|
|
31860
31084
|
var components = [RLConnected, ResultCard, ResultList, ReactiveBase, SBConnected, ListConnected, ListConnected$1, RangeConnected$1, RangeConnected$2, RangeConnected$3, RangeConnected, RcConnected, RcConnected$1, TBConnected, ListConnected$2, ListConnected$3, StateProviderConnected, RangeConnected$4];
|
|
31861
31085
|
function install$1 (Vue) {
|