react-instantsearch-core 7.28.0 → 7.29.0
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/cjs/lib/dequal.js +2 -2
- package/dist/cjs/version.js +1 -1
- package/dist/es/components/Configure.js +1 -1
- package/dist/es/components/DynamicWidgets.js +2 -2
- package/dist/es/components/Index.js +1 -1
- package/dist/es/components/InstantSearch.js +1 -1
- package/dist/es/components/InstantSearchSSRProvider.js +3 -3
- package/dist/es/connectors/useDynamicWidgets.js +2 -2
- package/dist/es/hooks/useConnector.js +4 -4
- package/dist/es/hooks/useInstantSearch.js +1 -1
- package/dist/es/lib/dequal.js +3 -3
- package/dist/es/lib/getIndexSearchResults.js +2 -2
- package/dist/es/lib/useForceUpdate.js +1 -1
- package/dist/es/lib/useInstantSearchApi.js +2 -2
- package/dist/es/lib/useSearchResults.js +1 -1
- package/dist/es/lib/useSearchState.js +1 -1
- package/dist/es/lib/useStableValue.js +1 -1
- package/dist/es/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/dist/umd/ReactInstantSearchCore.js +679 -1172
- package/dist/umd/ReactInstantSearchCore.min.js +3 -3
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearch Core 7.
|
|
1
|
+
/*! React InstantSearch Core 7.29.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
26
26
|
|
|
27
|
-
var version$2 = '7.
|
|
27
|
+
var version$2 = '7.29.0';
|
|
28
28
|
|
|
29
|
-
function _define_property
|
|
29
|
+
function _define_property(obj, key, value) {
|
|
30
30
|
if (key in obj) {
|
|
31
31
|
Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
|
|
32
32
|
} else obj[key] = value;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
return obj;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
function _object_spread
|
|
37
|
+
function _object_spread(target) {
|
|
38
38
|
for (var i = 1; i < arguments.length; i++) {
|
|
39
39
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
40
40
|
var ownKeys = Object.keys(source);
|
|
@@ -48,110 +48,40 @@
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
ownKeys.forEach(function(key) {
|
|
51
|
-
_define_property
|
|
51
|
+
_define_property(target, key, source[key]);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
return target;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
var _define_property = {};
|
|
63
|
-
|
|
64
|
-
var hasRequired_define_property;
|
|
65
|
-
|
|
66
|
-
function require_define_property () {
|
|
67
|
-
if (hasRequired_define_property) return _define_property;
|
|
68
|
-
hasRequired_define_property = 1;
|
|
58
|
+
function ownKeys(object, enumerableOnly) {
|
|
59
|
+
var keys = Object.keys(object);
|
|
69
60
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
if (Object.getOwnPropertySymbols) {
|
|
62
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
63
|
+
keys.push.apply(keys, symbols);
|
|
64
|
+
}
|
|
74
65
|
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
_define_property._ = _define_property$1;
|
|
78
|
-
return _define_property;
|
|
66
|
+
return keys;
|
|
79
67
|
}
|
|
68
|
+
function _object_spread_props(target, source) {
|
|
69
|
+
source = source != null ? source : {};
|
|
80
70
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
function require_object_spread () {
|
|
88
|
-
if (hasRequired_object_spread) return _object_spread;
|
|
89
|
-
hasRequired_object_spread = 1;
|
|
90
|
-
|
|
91
|
-
var _define_property = /*@__PURE__*/ require_define_property();
|
|
92
|
-
|
|
93
|
-
function _object_spread$1(target) {
|
|
94
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
95
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
96
|
-
var ownKeys = Object.keys(source);
|
|
97
|
-
|
|
98
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
99
|
-
ownKeys = ownKeys.concat(
|
|
100
|
-
Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
101
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
102
|
-
})
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
ownKeys.forEach(function(key) {
|
|
107
|
-
_define_property._(target, key, source[key]);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
71
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
72
|
+
else {
|
|
73
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
74
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
75
|
+
});
|
|
76
|
+
}
|
|
110
77
|
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
_object_spread._ = _object_spread$1;
|
|
114
|
-
return _object_spread;
|
|
78
|
+
return target;
|
|
115
79
|
}
|
|
116
80
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var _object_spread_props$1 = {};
|
|
120
|
-
|
|
121
|
-
var hasRequired_object_spread_props;
|
|
122
|
-
|
|
123
|
-
function require_object_spread_props () {
|
|
124
|
-
if (hasRequired_object_spread_props) return _object_spread_props$1;
|
|
125
|
-
hasRequired_object_spread_props = 1;
|
|
126
|
-
|
|
127
|
-
function ownKeys(object, enumerableOnly) {
|
|
128
|
-
var keys = Object.keys(object);
|
|
129
|
-
|
|
130
|
-
if (Object.getOwnPropertySymbols) {
|
|
131
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
132
|
-
keys.push.apply(keys, symbols);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return keys;
|
|
136
|
-
}
|
|
137
|
-
function _object_spread_props(target, source) {
|
|
138
|
-
source = source != null ? source : {};
|
|
139
|
-
|
|
140
|
-
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
141
|
-
else {
|
|
142
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
143
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return target;
|
|
148
|
-
}
|
|
149
|
-
_object_spread_props$1._ = _object_spread_props;
|
|
150
|
-
return _object_spread_props$1;
|
|
81
|
+
function getDefaultExportFromCjs (x) {
|
|
82
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
151
83
|
}
|
|
152
84
|
|
|
153
|
-
var _object_spread_propsExports = /*@__PURE__*/ require_object_spread_props();
|
|
154
|
-
|
|
155
85
|
var events;
|
|
156
86
|
var hasRequiredEvents;
|
|
157
87
|
|
|
@@ -557,7 +487,7 @@
|
|
|
557
487
|
return escapeFacetValue_1;
|
|
558
488
|
}
|
|
559
489
|
|
|
560
|
-
function _type_of
|
|
490
|
+
function _type_of(obj) {
|
|
561
491
|
"@swc/helpers - typeof";
|
|
562
492
|
|
|
563
493
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -569,7 +499,7 @@
|
|
|
569
499
|
if (hasRequiredMerge) return merge_1;
|
|
570
500
|
hasRequiredMerge = 1;
|
|
571
501
|
function clone(value) {
|
|
572
|
-
if ((typeof value === "undefined" ? "undefined" : _type_of
|
|
502
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && value !== null) {
|
|
573
503
|
return _merge(Array.isArray(value) ? [] : {}, value);
|
|
574
504
|
}
|
|
575
505
|
return value;
|
|
@@ -581,7 +511,7 @@
|
|
|
581
511
|
if (target === source) {
|
|
582
512
|
return target;
|
|
583
513
|
}
|
|
584
|
-
// eslint-disable-next-line no-
|
|
514
|
+
// eslint-disable-next-line instantsearch/no-for-in
|
|
585
515
|
for(var key in source){
|
|
586
516
|
if (!Object.prototype.hasOwnProperty.call(source, key) || key === '__proto__' || key === 'constructor') {
|
|
587
517
|
continue;
|
|
@@ -1149,7 +1079,7 @@
|
|
|
1149
1079
|
return requestBuilder_1;
|
|
1150
1080
|
}
|
|
1151
1081
|
|
|
1152
|
-
function _instanceof
|
|
1082
|
+
function _instanceof(left, right) {
|
|
1153
1083
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
1154
1084
|
return !!right[Symbol.hasInstance](left);
|
|
1155
1085
|
} else return left instanceof right;
|
|
@@ -1583,7 +1513,7 @@
|
|
|
1583
1513
|
* @return {object} a new object with the number keys as number
|
|
1584
1514
|
*/ SearchParameters._parseNumbers = function(partialState) {
|
|
1585
1515
|
// Do not parse numbers again in SearchParameters, they ought to be parsed already
|
|
1586
|
-
if (_instanceof
|
|
1516
|
+
if (_instanceof(partialState, SearchParameters)) return partialState;
|
|
1587
1517
|
var numbers = {};
|
|
1588
1518
|
var numberKeys = [
|
|
1589
1519
|
'aroundPrecision',
|
|
@@ -3962,7 +3892,7 @@
|
|
|
3962
3892
|
function requireVersion() {
|
|
3963
3893
|
if (hasRequiredVersion) return version$1;
|
|
3964
3894
|
hasRequiredVersion = 1;
|
|
3965
|
-
version$1 = '3.28.
|
|
3895
|
+
version$1 = '3.28.1';
|
|
3966
3896
|
return version$1;
|
|
3967
3897
|
}
|
|
3968
3898
|
|
|
@@ -5769,25 +5699,6 @@
|
|
|
5769
5699
|
var algoliasearchHelperExports = requireAlgoliasearchHelper();
|
|
5770
5700
|
var algoliasearchHelper = /*@__PURE__*/getDefaultExportFromCjs(algoliasearchHelperExports);
|
|
5771
5701
|
|
|
5772
|
-
var _type_of = {};
|
|
5773
|
-
|
|
5774
|
-
var hasRequired_type_of;
|
|
5775
|
-
|
|
5776
|
-
function require_type_of () {
|
|
5777
|
-
if (hasRequired_type_of) return _type_of;
|
|
5778
|
-
hasRequired_type_of = 1;
|
|
5779
|
-
|
|
5780
|
-
function _type_of$1(obj) {
|
|
5781
|
-
"@swc/helpers - typeof";
|
|
5782
|
-
|
|
5783
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
5784
|
-
}
|
|
5785
|
-
_type_of._ = _type_of$1;
|
|
5786
|
-
return _type_of;
|
|
5787
|
-
}
|
|
5788
|
-
|
|
5789
|
-
var _type_ofExports = /*@__PURE__*/ require_type_of();
|
|
5790
|
-
|
|
5791
5702
|
/**
|
|
5792
5703
|
* This implementation is taken from Lodash implementation.
|
|
5793
5704
|
* See: https://github.com/lodash/lodash/blob/master/isPlainObject.js
|
|
@@ -5798,7 +5709,7 @@
|
|
|
5798
5709
|
return Object.prototype.toString.call(value);
|
|
5799
5710
|
}
|
|
5800
5711
|
function isObjectLike(value) {
|
|
5801
|
-
return (typeof value === "undefined" ? "undefined" :
|
|
5712
|
+
return (typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && value !== null;
|
|
5802
5713
|
}
|
|
5803
5714
|
/**
|
|
5804
5715
|
* Checks if `value` is a plain object.
|
|
@@ -5843,77 +5754,50 @@
|
|
|
5843
5754
|
};
|
|
5844
5755
|
}
|
|
5845
5756
|
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
var _object_without_properties_loose$1 = {};
|
|
5849
|
-
|
|
5850
|
-
var hasRequired_object_without_properties_loose;
|
|
5851
|
-
|
|
5852
|
-
function require_object_without_properties_loose () {
|
|
5853
|
-
if (hasRequired_object_without_properties_loose) return _object_without_properties_loose$1;
|
|
5854
|
-
hasRequired_object_without_properties_loose = 1;
|
|
5855
|
-
|
|
5856
|
-
function _object_without_properties_loose(source, excluded) {
|
|
5857
|
-
if (source == null) return {};
|
|
5757
|
+
function _object_without_properties_loose(source, excluded) {
|
|
5758
|
+
if (source == null) return {};
|
|
5858
5759
|
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5760
|
+
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
5761
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
5762
|
+
key = sourceKeys[i];
|
|
5763
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
5764
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
5765
|
+
target[key] = source[key];
|
|
5766
|
+
}
|
|
5866
5767
|
|
|
5867
|
-
|
|
5868
|
-
}
|
|
5869
|
-
_object_without_properties_loose$1._ = _object_without_properties_loose;
|
|
5870
|
-
return _object_without_properties_loose$1;
|
|
5768
|
+
return target;
|
|
5871
5769
|
}
|
|
5872
5770
|
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
function require_object_without_properties () {
|
|
5876
|
-
if (hasRequired_object_without_properties) return _object_without_properties$1;
|
|
5877
|
-
hasRequired_object_without_properties = 1;
|
|
5878
|
-
|
|
5879
|
-
var _object_without_properties_loose = /*@__PURE__*/ require_object_without_properties_loose();
|
|
5880
|
-
|
|
5881
|
-
function _object_without_properties(source, excluded) {
|
|
5882
|
-
if (source == null) return {};
|
|
5883
|
-
|
|
5884
|
-
var target = {}, sourceKeys, key, i;
|
|
5885
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
5886
|
-
sourceKeys = Reflect.ownKeys(source);
|
|
5887
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
5888
|
-
key = sourceKeys[i];
|
|
5889
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
5890
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
5891
|
-
target[key] = source[key];
|
|
5892
|
-
}
|
|
5771
|
+
function _object_without_properties(source, excluded) {
|
|
5772
|
+
if (source == null) return {};
|
|
5893
5773
|
|
|
5894
|
-
|
|
5895
|
-
|
|
5774
|
+
var target = {}, sourceKeys, key, i;
|
|
5775
|
+
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
5776
|
+
sourceKeys = Reflect.ownKeys(source);
|
|
5777
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
5778
|
+
key = sourceKeys[i];
|
|
5779
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
5780
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
5781
|
+
target[key] = source[key];
|
|
5782
|
+
}
|
|
5896
5783
|
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
5900
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
5901
|
-
key = sourceKeys[i];
|
|
5902
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
5903
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
5904
|
-
target[key] = source[key];
|
|
5905
|
-
}
|
|
5906
|
-
}
|
|
5784
|
+
return target;
|
|
5785
|
+
}
|
|
5907
5786
|
|
|
5908
|
-
|
|
5909
|
-
|
|
5787
|
+
target = _object_without_properties_loose(source, excluded);
|
|
5788
|
+
if (Object.getOwnPropertySymbols) {
|
|
5789
|
+
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
5790
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
5791
|
+
key = sourceKeys[i];
|
|
5792
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
5793
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
5794
|
+
target[key] = source[key];
|
|
5795
|
+
}
|
|
5796
|
+
}
|
|
5910
5797
|
|
|
5911
|
-
|
|
5912
|
-
return _object_without_properties$1;
|
|
5798
|
+
return target;
|
|
5913
5799
|
}
|
|
5914
5800
|
|
|
5915
|
-
var _object_without_propertiesExports = /*@__PURE__*/ require_object_without_properties();
|
|
5916
|
-
|
|
5917
5801
|
// We aren't using the native `Array.prototype.findIndex` because the refactor away from Lodash is not
|
|
5918
5802
|
// published as a major version.
|
|
5919
5803
|
// Relying on the `findIndex` polyfill on user-land, which before was only required for niche use-cases,
|
|
@@ -5949,7 +5833,7 @@
|
|
|
5949
5833
|
right.hierarchicalFacets;
|
|
5950
5834
|
right.hierarchicalFacetsRefinements;
|
|
5951
5835
|
right.ruleContexts;
|
|
5952
|
-
var rest =
|
|
5836
|
+
var rest = _object_without_properties(right, [
|
|
5953
5837
|
"facets",
|
|
5954
5838
|
"disjunctiveFacets",
|
|
5955
5839
|
"facetsRefinements",
|
|
@@ -5997,27 +5881,27 @@
|
|
|
5997
5881
|
};
|
|
5998
5882
|
var mergeFacetRefinements = function mergeFacetRefinements(left, right) {
|
|
5999
5883
|
return left.setQueryParameters({
|
|
6000
|
-
facetsRefinements:
|
|
5884
|
+
facetsRefinements: _object_spread({}, left.facetsRefinements, right.facetsRefinements)
|
|
6001
5885
|
});
|
|
6002
5886
|
};
|
|
6003
5887
|
var mergeFacetsExcludes = function mergeFacetsExcludes(left, right) {
|
|
6004
5888
|
return left.setQueryParameters({
|
|
6005
|
-
facetsExcludes:
|
|
5889
|
+
facetsExcludes: _object_spread({}, left.facetsExcludes, right.facetsExcludes)
|
|
6006
5890
|
});
|
|
6007
5891
|
};
|
|
6008
5892
|
var mergeDisjunctiveFacetsRefinements = function mergeDisjunctiveFacetsRefinements(left, right) {
|
|
6009
5893
|
return left.setQueryParameters({
|
|
6010
|
-
disjunctiveFacetsRefinements:
|
|
5894
|
+
disjunctiveFacetsRefinements: _object_spread({}, left.disjunctiveFacetsRefinements, right.disjunctiveFacetsRefinements)
|
|
6011
5895
|
});
|
|
6012
5896
|
};
|
|
6013
5897
|
var mergeNumericRefinements = function mergeNumericRefinements(left, right) {
|
|
6014
5898
|
return left.setQueryParameters({
|
|
6015
|
-
numericRefinements:
|
|
5899
|
+
numericRefinements: _object_spread({}, left.numericRefinements, right.numericRefinements)
|
|
6016
5900
|
});
|
|
6017
5901
|
};
|
|
6018
5902
|
var mergeHierarchicalFacetsRefinements = function mergeHierarchicalFacetsRefinements(left, right) {
|
|
6019
5903
|
return left.setQueryParameters({
|
|
6020
|
-
hierarchicalFacetsRefinements:
|
|
5904
|
+
hierarchicalFacetsRefinements: _object_spread({}, left.hierarchicalFacetsRefinements, right.hierarchicalFacetsRefinements)
|
|
6021
5905
|
});
|
|
6022
5906
|
};
|
|
6023
5907
|
var mergeRuleContexts = function mergeRuleContexts(left, right) {
|
|
@@ -6063,7 +5947,7 @@
|
|
|
6063
5947
|
// the state. The function `setQueryParameters` omits the values that
|
|
6064
5948
|
// are `undefined` on the next state.
|
|
6065
5949
|
return state.setQueryParameters(Object.keys(widgetParams.searchParameters).reduce(function(acc, key) {
|
|
6066
|
-
return
|
|
5950
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, undefined));
|
|
6067
5951
|
}, {}));
|
|
6068
5952
|
}
|
|
6069
5953
|
var connectConfigure = function connectConfigure() {
|
|
@@ -6088,13 +5972,13 @@
|
|
|
6088
5972
|
$$type: 'ais.configure',
|
|
6089
5973
|
init: function init(initOptions) {
|
|
6090
5974
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
6091
|
-
renderFn(
|
|
5975
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
6092
5976
|
instantSearchInstance: instantSearchInstance
|
|
6093
5977
|
}), true);
|
|
6094
5978
|
},
|
|
6095
5979
|
render: function render(renderOptions) {
|
|
6096
5980
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
6097
|
-
renderFn(
|
|
5981
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
6098
5982
|
instantSearchInstance: instantSearchInstance
|
|
6099
5983
|
}), false);
|
|
6100
5984
|
},
|
|
@@ -6106,9 +5990,9 @@
|
|
|
6106
5990
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
6107
5991
|
var _renderState_configure;
|
|
6108
5992
|
var widgetRenderState = this.getWidgetRenderState(renderOptions);
|
|
6109
|
-
return
|
|
6110
|
-
configure:
|
|
6111
|
-
widgetParams:
|
|
5993
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
5994
|
+
configure: _object_spread_props(_object_spread({}, widgetRenderState), {
|
|
5995
|
+
widgetParams: _object_spread_props(_object_spread({}, widgetRenderState.widgetParams), {
|
|
6112
5996
|
searchParameters: mergeSearchParameters(new algoliasearchHelper.SearchParameters((_renderState_configure = renderState.configure) === null || _renderState_configure === void 0 ? void 0 : _renderState_configure.widgetParams.searchParameters), new algoliasearchHelper.SearchParameters(widgetRenderState.widgetParams.searchParameters)).getQueryParams()
|
|
6113
5997
|
})
|
|
6114
5998
|
})
|
|
@@ -6126,66 +6010,22 @@
|
|
|
6126
6010
|
},
|
|
6127
6011
|
getWidgetSearchParameters: function getWidgetSearchParameters(state, param) {
|
|
6128
6012
|
var uiState = param.uiState;
|
|
6129
|
-
return mergeSearchParameters(state, new algoliasearchHelper.SearchParameters(
|
|
6013
|
+
return mergeSearchParameters(state, new algoliasearchHelper.SearchParameters(_object_spread({}, uiState.configure, widgetParams.searchParameters)));
|
|
6130
6014
|
},
|
|
6131
6015
|
getWidgetUiState: function getWidgetUiState(uiState) {
|
|
6132
|
-
return
|
|
6133
|
-
configure:
|
|
6016
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
6017
|
+
configure: _object_spread({}, uiState.configure, widgetParams.searchParameters)
|
|
6134
6018
|
});
|
|
6135
6019
|
}
|
|
6136
6020
|
};
|
|
6137
6021
|
};
|
|
6138
6022
|
};
|
|
6139
6023
|
|
|
6140
|
-
function
|
|
6141
|
-
if (source == null) return {};
|
|
6142
|
-
|
|
6143
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
6144
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
6145
|
-
key = sourceKeys[i];
|
|
6146
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
6147
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
6148
|
-
target[key] = source[key];
|
|
6149
|
-
}
|
|
6150
|
-
|
|
6151
|
-
return target;
|
|
6152
|
-
}
|
|
6153
|
-
|
|
6154
|
-
function _object_without_properties(source, excluded) {
|
|
6155
|
-
if (source == null) return {};
|
|
6156
|
-
|
|
6157
|
-
var target = {}, sourceKeys, key, i;
|
|
6158
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
6159
|
-
sourceKeys = Reflect.ownKeys(source);
|
|
6160
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
6161
|
-
key = sourceKeys[i];
|
|
6162
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
6163
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
6164
|
-
target[key] = source[key];
|
|
6165
|
-
}
|
|
6166
|
-
|
|
6167
|
-
return target;
|
|
6168
|
-
}
|
|
6169
|
-
|
|
6170
|
-
target = _object_without_properties_loose(source, excluded);
|
|
6171
|
-
if (Object.getOwnPropertySymbols) {
|
|
6172
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
6173
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
6174
|
-
key = sourceKeys[i];
|
|
6175
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
6176
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
6177
|
-
target[key] = source[key];
|
|
6178
|
-
}
|
|
6179
|
-
}
|
|
6180
|
-
|
|
6181
|
-
return target;
|
|
6182
|
-
}
|
|
6183
|
-
|
|
6184
|
-
function _array_with_holes$1(arr) {
|
|
6024
|
+
function _array_with_holes(arr) {
|
|
6185
6025
|
if (Array.isArray(arr)) return arr;
|
|
6186
6026
|
}
|
|
6187
6027
|
|
|
6188
|
-
function _iterable_to_array_limit
|
|
6028
|
+
function _iterable_to_array_limit(arr, i) {
|
|
6189
6029
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
6190
6030
|
|
|
6191
6031
|
if (_i == null) return;
|
|
@@ -6214,11 +6054,11 @@
|
|
|
6214
6054
|
return _arr;
|
|
6215
6055
|
}
|
|
6216
6056
|
|
|
6217
|
-
function _non_iterable_rest
|
|
6057
|
+
function _non_iterable_rest() {
|
|
6218
6058
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6219
6059
|
}
|
|
6220
6060
|
|
|
6221
|
-
function _array_like_to_array
|
|
6061
|
+
function _array_like_to_array(arr, len) {
|
|
6222
6062
|
if (len == null || len > arr.length) len = arr.length;
|
|
6223
6063
|
|
|
6224
6064
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
@@ -6226,29 +6066,29 @@
|
|
|
6226
6066
|
return arr2;
|
|
6227
6067
|
}
|
|
6228
6068
|
|
|
6229
|
-
function _unsupported_iterable_to_array
|
|
6069
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
6230
6070
|
if (!o) return;
|
|
6231
|
-
if (typeof o === "string") return _array_like_to_array
|
|
6071
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
6232
6072
|
|
|
6233
6073
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6234
6074
|
|
|
6235
6075
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6236
6076
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
6237
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array
|
|
6077
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
6238
6078
|
}
|
|
6239
6079
|
|
|
6240
|
-
function _sliced_to_array
|
|
6241
|
-
return _array_with_holes
|
|
6080
|
+
function _sliced_to_array(arr, i) {
|
|
6081
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
6242
6082
|
}
|
|
6243
6083
|
|
|
6244
|
-
function _iterable_to_array
|
|
6084
|
+
function _iterable_to_array(iter) {
|
|
6245
6085
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
|
|
6246
6086
|
return Array.from(iter);
|
|
6247
6087
|
}
|
|
6248
6088
|
}
|
|
6249
6089
|
|
|
6250
6090
|
function _to_array(arr) {
|
|
6251
|
-
return _array_with_holes
|
|
6091
|
+
return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
|
|
6252
6092
|
}
|
|
6253
6093
|
|
|
6254
6094
|
/* eslint-disable complexity */ /*
|
|
@@ -6258,7 +6098,7 @@
|
|
|
6258
6098
|
* It adds a 3rd argument `compare(a, b)` that lets execute custom logic to
|
|
6259
6099
|
* compare values.
|
|
6260
6100
|
* We use it to skip comparing function references.
|
|
6261
|
-
*/ // eslint-disable-next-line
|
|
6101
|
+
*/ // eslint-disable-next-line typescript/unbound-method
|
|
6262
6102
|
var has = Object.prototype.hasOwnProperty;
|
|
6263
6103
|
function dequal(foo, bar, compare) {
|
|
6264
6104
|
// start of custom implementation
|
|
@@ -6278,9 +6118,9 @@
|
|
|
6278
6118
|
}
|
|
6279
6119
|
return len === -1;
|
|
6280
6120
|
}
|
|
6281
|
-
if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of
|
|
6121
|
+
if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of(foo)) === 'object') {
|
|
6282
6122
|
len = 0;
|
|
6283
|
-
// eslint-disable-next-line guard-for-in, no-
|
|
6123
|
+
// eslint-disable-next-line guard-for-in, instantsearch/no-for-in
|
|
6284
6124
|
for(ctor in foo){
|
|
6285
6125
|
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
|
|
6286
6126
|
if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor], compare)) return false;
|
|
@@ -6292,29 +6132,6 @@
|
|
|
6292
6132
|
return foo !== foo && bar !== bar;
|
|
6293
6133
|
}
|
|
6294
6134
|
|
|
6295
|
-
function ownKeys(object, enumerableOnly) {
|
|
6296
|
-
var keys = Object.keys(object);
|
|
6297
|
-
|
|
6298
|
-
if (Object.getOwnPropertySymbols) {
|
|
6299
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
6300
|
-
keys.push.apply(keys, symbols);
|
|
6301
|
-
}
|
|
6302
|
-
|
|
6303
|
-
return keys;
|
|
6304
|
-
}
|
|
6305
|
-
function _object_spread_props(target, source) {
|
|
6306
|
-
source = source != null ? source : {};
|
|
6307
|
-
|
|
6308
|
-
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
6309
|
-
else {
|
|
6310
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
6311
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
6312
|
-
});
|
|
6313
|
-
}
|
|
6314
|
-
|
|
6315
|
-
return target;
|
|
6316
|
-
}
|
|
6317
|
-
|
|
6318
6135
|
function createSearchResults(state) {
|
|
6319
6136
|
var _state_query, _state_page, _state_hitsPerPage;
|
|
6320
6137
|
return new algoliasearchHelper.SearchResults(state, [
|
|
@@ -6343,7 +6160,7 @@
|
|
|
6343
6160
|
createSearchResults(helper.state);
|
|
6344
6161
|
var scopedResults = indexWidget.getScopedResults().map(function(scopedResult) {
|
|
6345
6162
|
var fallbackResults = scopedResult.indexId === indexWidget.getIndexId() ? results : createSearchResults(scopedResult.helper.state);
|
|
6346
|
-
return _object_spread_props(_object_spread
|
|
6163
|
+
return _object_spread_props(_object_spread({}, scopedResult), {
|
|
6347
6164
|
// We keep `results` from being `null`.
|
|
6348
6165
|
results: scopedResult.results || fallbackResults
|
|
6349
6166
|
});
|
|
@@ -6412,7 +6229,7 @@
|
|
|
6412
6229
|
}
|
|
6413
6230
|
|
|
6414
6231
|
function useStableValue(value) {
|
|
6415
|
-
var _useState = _sliced_to_array
|
|
6232
|
+
var _useState = _sliced_to_array(React.useState(function() {
|
|
6416
6233
|
return value;
|
|
6417
6234
|
}), 2), stableValue = _useState[0], setStableValue = _useState[1];
|
|
6418
6235
|
if (!dequal(stableValue, value)) {
|
|
@@ -6570,7 +6387,7 @@
|
|
|
6570
6387
|
var _ref = [
|
|
6571
6388
|
_1,
|
|
6572
6389
|
_2
|
|
6573
|
-
], _ref1 = _to_array(_ref), tmp = _ref1[0], props = tmp === void 0 ? {} : tmp, _rest = _ref1.slice(1), _rest1 = _sliced_to_array
|
|
6390
|
+
], _ref1 = _to_array(_ref), tmp = _ref1[0], props = tmp === void 0 ? {} : tmp, _rest = _ref1.slice(1), _rest1 = _sliced_to_array(_rest, 1), tmp1 = _rest1[0], _ref2 = tmp1 === void 0 ? {} : tmp1, _ref_skipSuspense = _ref2.skipSuspense, skipSuspense = _ref_skipSuspense === void 0 ? false : _ref_skipSuspense, additionalWidgetProperties = _object_without_properties(_ref2, [
|
|
6574
6391
|
"skipSuspense"
|
|
6575
6392
|
]);
|
|
6576
6393
|
var serverContext = useInstantSearchServerContext();
|
|
@@ -6625,13 +6442,13 @@
|
|
|
6625
6442
|
// InstantSearch.js re-inits the component.
|
|
6626
6443
|
shouldSetStateRef.current = false;
|
|
6627
6444
|
});
|
|
6628
|
-
return _object_spread
|
|
6445
|
+
return _object_spread({}, createWidget(stableProps), stableAdditionalWidgetProperties);
|
|
6629
6446
|
}, [
|
|
6630
6447
|
connector,
|
|
6631
6448
|
stableProps,
|
|
6632
6449
|
stableAdditionalWidgetProperties
|
|
6633
6450
|
]);
|
|
6634
|
-
var _useState = _sliced_to_array
|
|
6451
|
+
var _useState = _sliced_to_array(React.useState(function() {
|
|
6635
6452
|
if (widget.getWidgetRenderState) {
|
|
6636
6453
|
var _widget_getWidgetSearchParameters;
|
|
6637
6454
|
// The helper exists because we've started InstantSearch.
|
|
@@ -6683,7 +6500,7 @@
|
|
|
6683
6500
|
}
|
|
6684
6501
|
|
|
6685
6502
|
function Configure(props) {
|
|
6686
|
-
useConfigure(_object_spread
|
|
6503
|
+
useConfigure(_object_spread({}, props), {
|
|
6687
6504
|
$$widgetType: 'ais.configure'
|
|
6688
6505
|
});
|
|
6689
6506
|
return null;
|
|
@@ -6732,7 +6549,7 @@
|
|
|
6732
6549
|
return items;
|
|
6733
6550
|
} : _widgetParams_transformItems, fallbackWidget = widgetParams.fallbackWidget;
|
|
6734
6551
|
if (!(widgets && Array.isArray(widgets) && widgets.every(function(widget) {
|
|
6735
|
-
return (typeof widget === "undefined" ? "undefined" :
|
|
6552
|
+
return (typeof widget === "undefined" ? "undefined" : _type_of(widget)) === 'object';
|
|
6736
6553
|
}))) {
|
|
6737
6554
|
throw new Error(withUsage$r('The `widgets` option expects an array of widgets.'));
|
|
6738
6555
|
}
|
|
@@ -6750,7 +6567,7 @@
|
|
|
6750
6567
|
isMounted: false
|
|
6751
6568
|
});
|
|
6752
6569
|
});
|
|
6753
|
-
renderFn(
|
|
6570
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
6754
6571
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
6755
6572
|
}), true);
|
|
6756
6573
|
},
|
|
@@ -6796,7 +6613,7 @@
|
|
|
6796
6613
|
setTimeout(function() {
|
|
6797
6614
|
return parent.removeWidgets(widgetsToUnmount);
|
|
6798
6615
|
}, 0);
|
|
6799
|
-
renderFn(
|
|
6616
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
6800
6617
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
6801
6618
|
}), false);
|
|
6802
6619
|
},
|
|
@@ -6820,7 +6637,7 @@
|
|
|
6820
6637
|
}));
|
|
6821
6638
|
},
|
|
6822
6639
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
6823
|
-
return
|
|
6640
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
6824
6641
|
dynamicWidgets: this.getWidgetRenderState(renderOptions)
|
|
6825
6642
|
});
|
|
6826
6643
|
},
|
|
@@ -6851,7 +6668,7 @@
|
|
|
6851
6668
|
};
|
|
6852
6669
|
|
|
6853
6670
|
function useDynamicWidgets(props, additionalWidgetProperties) {
|
|
6854
|
-
return useConnector(connectDynamicWidgets, _object_spread_props(_object_spread
|
|
6671
|
+
return useConnector(connectDynamicWidgets, _object_spread_props(_object_spread({}, props), {
|
|
6855
6672
|
// We don't rely on InstantSearch.js for rendering widgets because React
|
|
6856
6673
|
// directly manipulates the children.
|
|
6857
6674
|
widgets: []
|
|
@@ -6886,7 +6703,7 @@
|
|
|
6886
6703
|
}));
|
|
6887
6704
|
}
|
|
6888
6705
|
function isReactElement(element) {
|
|
6889
|
-
return (typeof element === "undefined" ? "undefined" : _type_of
|
|
6706
|
+
return (typeof element === "undefined" ? "undefined" : _type_of(element)) === 'object' && element.props;
|
|
6890
6707
|
}
|
|
6891
6708
|
function getWidgetAttribute(element) {
|
|
6892
6709
|
if (!isReactElement(element)) {
|
|
@@ -6905,139 +6722,18 @@
|
|
|
6905
6722
|
return undefined;
|
|
6906
6723
|
}
|
|
6907
6724
|
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
var hasRequired_instanceof;
|
|
6911
|
-
|
|
6912
|
-
function require_instanceof () {
|
|
6913
|
-
if (hasRequired_instanceof) return _instanceof;
|
|
6914
|
-
hasRequired_instanceof = 1;
|
|
6915
|
-
|
|
6916
|
-
function _instanceof$1(left, right) {
|
|
6917
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
6918
|
-
return !!right[Symbol.hasInstance](left);
|
|
6919
|
-
} else return left instanceof right;
|
|
6920
|
-
}
|
|
6921
|
-
_instanceof._ = _instanceof$1;
|
|
6922
|
-
return _instanceof;
|
|
6923
|
-
}
|
|
6924
|
-
|
|
6925
|
-
var _instanceofExports = /*@__PURE__*/ require_instanceof();
|
|
6926
|
-
|
|
6927
|
-
var _to_consumable_array$1 = {};
|
|
6928
|
-
|
|
6929
|
-
var _array_without_holes$1 = {};
|
|
6930
|
-
|
|
6931
|
-
var _array_like_to_array = {};
|
|
6932
|
-
|
|
6933
|
-
var hasRequired_array_like_to_array;
|
|
6934
|
-
|
|
6935
|
-
function require_array_like_to_array () {
|
|
6936
|
-
if (hasRequired_array_like_to_array) return _array_like_to_array;
|
|
6937
|
-
hasRequired_array_like_to_array = 1;
|
|
6938
|
-
|
|
6939
|
-
function _array_like_to_array$1(arr, len) {
|
|
6940
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
6941
|
-
|
|
6942
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
6943
|
-
|
|
6944
|
-
return arr2;
|
|
6945
|
-
}
|
|
6946
|
-
_array_like_to_array._ = _array_like_to_array$1;
|
|
6947
|
-
return _array_like_to_array;
|
|
6948
|
-
}
|
|
6949
|
-
|
|
6950
|
-
var hasRequired_array_without_holes;
|
|
6951
|
-
|
|
6952
|
-
function require_array_without_holes () {
|
|
6953
|
-
if (hasRequired_array_without_holes) return _array_without_holes$1;
|
|
6954
|
-
hasRequired_array_without_holes = 1;
|
|
6955
|
-
|
|
6956
|
-
var _array_like_to_array = /*@__PURE__*/ require_array_like_to_array();
|
|
6957
|
-
|
|
6958
|
-
function _array_without_holes(arr) {
|
|
6959
|
-
if (Array.isArray(arr)) return _array_like_to_array._(arr);
|
|
6960
|
-
}
|
|
6961
|
-
_array_without_holes$1._ = _array_without_holes;
|
|
6962
|
-
return _array_without_holes$1;
|
|
6963
|
-
}
|
|
6964
|
-
|
|
6965
|
-
var _iterable_to_array = {};
|
|
6966
|
-
|
|
6967
|
-
var hasRequired_iterable_to_array;
|
|
6968
|
-
|
|
6969
|
-
function require_iterable_to_array () {
|
|
6970
|
-
if (hasRequired_iterable_to_array) return _iterable_to_array;
|
|
6971
|
-
hasRequired_iterable_to_array = 1;
|
|
6972
|
-
|
|
6973
|
-
function _iterable_to_array$1(iter) {
|
|
6974
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
|
|
6975
|
-
return Array.from(iter);
|
|
6976
|
-
}
|
|
6977
|
-
}
|
|
6978
|
-
_iterable_to_array._ = _iterable_to_array$1;
|
|
6979
|
-
return _iterable_to_array;
|
|
6980
|
-
}
|
|
6981
|
-
|
|
6982
|
-
var _non_iterable_spread$1 = {};
|
|
6983
|
-
|
|
6984
|
-
var hasRequired_non_iterable_spread;
|
|
6985
|
-
|
|
6986
|
-
function require_non_iterable_spread () {
|
|
6987
|
-
if (hasRequired_non_iterable_spread) return _non_iterable_spread$1;
|
|
6988
|
-
hasRequired_non_iterable_spread = 1;
|
|
6989
|
-
|
|
6990
|
-
function _non_iterable_spread() {
|
|
6991
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6992
|
-
}
|
|
6993
|
-
_non_iterable_spread$1._ = _non_iterable_spread;
|
|
6994
|
-
return _non_iterable_spread$1;
|
|
6725
|
+
function _array_without_holes(arr) {
|
|
6726
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
6995
6727
|
}
|
|
6996
6728
|
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
var hasRequired_unsupported_iterable_to_array;
|
|
7000
|
-
|
|
7001
|
-
function require_unsupported_iterable_to_array () {
|
|
7002
|
-
if (hasRequired_unsupported_iterable_to_array) return _unsupported_iterable_to_array;
|
|
7003
|
-
hasRequired_unsupported_iterable_to_array = 1;
|
|
7004
|
-
|
|
7005
|
-
var _array_like_to_array = /*@__PURE__*/ require_array_like_to_array();
|
|
7006
|
-
|
|
7007
|
-
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
7008
|
-
if (!o) return;
|
|
7009
|
-
if (typeof o === "string") return _array_like_to_array._(o, minLen);
|
|
7010
|
-
|
|
7011
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
7012
|
-
|
|
7013
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
7014
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
7015
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array._(o, minLen);
|
|
7016
|
-
}
|
|
7017
|
-
_unsupported_iterable_to_array._ = _unsupported_iterable_to_array$1;
|
|
7018
|
-
return _unsupported_iterable_to_array;
|
|
6729
|
+
function _non_iterable_spread() {
|
|
6730
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7019
6731
|
}
|
|
7020
6732
|
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
function require_to_consumable_array () {
|
|
7024
|
-
if (hasRequired_to_consumable_array) return _to_consumable_array$1;
|
|
7025
|
-
hasRequired_to_consumable_array = 1;
|
|
7026
|
-
|
|
7027
|
-
var _array_without_holes = /*@__PURE__*/ require_array_without_holes();
|
|
7028
|
-
var _iterable_to_array = /*@__PURE__*/ require_iterable_to_array();
|
|
7029
|
-
var _non_iterable_spread = /*@__PURE__*/ require_non_iterable_spread();
|
|
7030
|
-
var _unsupported_iterable_to_array = /*@__PURE__*/ require_unsupported_iterable_to_array();
|
|
7031
|
-
|
|
7032
|
-
function _to_consumable_array(arr) {
|
|
7033
|
-
return _array_without_holes._(arr) || _iterable_to_array._(arr) || _unsupported_iterable_to_array._(arr) || _non_iterable_spread._();
|
|
7034
|
-
}
|
|
7035
|
-
_to_consumable_array$1._ = _to_consumable_array;
|
|
7036
|
-
return _to_consumable_array$1;
|
|
6733
|
+
function _to_consumable_array(arr) {
|
|
6734
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
7037
6735
|
}
|
|
7038
6736
|
|
|
7039
|
-
var _to_consumable_arrayExports = /*@__PURE__*/ require_to_consumable_array();
|
|
7040
|
-
|
|
7041
6737
|
var id = 0;
|
|
7042
6738
|
function addWidgetId(widget) {
|
|
7043
6739
|
if (widget.dependsOn !== 'recommend') {
|
|
@@ -7070,7 +6766,7 @@
|
|
|
7070
6766
|
cancelled = false;
|
|
7071
6767
|
return;
|
|
7072
6768
|
}
|
|
7073
|
-
callback.apply(void 0,
|
|
6769
|
+
callback.apply(void 0, _to_consumable_array(args));
|
|
7074
6770
|
});
|
|
7075
6771
|
};
|
|
7076
6772
|
fn.wait = function() {
|
|
@@ -7182,7 +6878,7 @@
|
|
|
7182
6878
|
}, initialUiState);
|
|
7183
6879
|
}
|
|
7184
6880
|
function getLocalWidgetsSearchParameters(widgets, widgetSearchParametersOptions) {
|
|
7185
|
-
var initialSearchParameters = widgetSearchParametersOptions.initialSearchParameters, rest =
|
|
6881
|
+
var initialSearchParameters = widgetSearchParametersOptions.initialSearchParameters, rest = _object_without_properties(widgetSearchParametersOptions, [
|
|
7186
6882
|
"initialSearchParameters"
|
|
7187
6883
|
]);
|
|
7188
6884
|
return widgets.reduce(function(state, widget) {
|
|
@@ -7196,7 +6892,7 @@
|
|
|
7196
6892
|
}, initialSearchParameters);
|
|
7197
6893
|
}
|
|
7198
6894
|
function getLocalWidgetsRecommendParameters(widgets, widgetRecommendParametersOptions) {
|
|
7199
|
-
var initialRecommendParameters = widgetRecommendParametersOptions.initialRecommendParameters, rest =
|
|
6895
|
+
var initialRecommendParameters = widgetRecommendParametersOptions.initialRecommendParameters, rest = _object_without_properties(widgetRecommendParametersOptions, [
|
|
7200
6896
|
"initialRecommendParameters"
|
|
7201
6897
|
]);
|
|
7202
6898
|
return widgets.reduce(function(state, widget) {
|
|
@@ -7231,7 +6927,7 @@
|
|
|
7231
6927
|
results: current.getResults(),
|
|
7232
6928
|
helper: current.getHelper()
|
|
7233
6929
|
}
|
|
7234
|
-
].concat(
|
|
6930
|
+
].concat(_to_consumable_array(resolveScopedResultsFromWidgets(current.getWidgets()))));
|
|
7235
6931
|
}, []);
|
|
7236
6932
|
}
|
|
7237
6933
|
var index = function index(widgetParams) {
|
|
@@ -7308,9 +7004,9 @@
|
|
|
7308
7004
|
},
|
|
7309
7005
|
createURL: function createURL(nextState) {
|
|
7310
7006
|
if (typeof nextState === 'function') {
|
|
7311
|
-
return localInstantSearchInstance._createURL(
|
|
7007
|
+
return localInstantSearchInstance._createURL(_define_property({}, indexId, nextState(localUiState)));
|
|
7312
7008
|
}
|
|
7313
|
-
return localInstantSearchInstance._createURL(
|
|
7009
|
+
return localInstantSearchInstance._createURL(_define_property({}, indexId, getLocalWidgetsUiState(localWidgets, {
|
|
7314
7010
|
searchParameters: nextState,
|
|
7315
7011
|
helper: helper
|
|
7316
7012
|
})));
|
|
@@ -7435,7 +7131,7 @@
|
|
|
7435
7131
|
recommendState: states.cleanedRecommendState,
|
|
7436
7132
|
parent: _this
|
|
7437
7133
|
});
|
|
7438
|
-
if (
|
|
7134
|
+
if (_instanceof(next, algoliasearchHelper.RecommendParameters)) {
|
|
7439
7135
|
states.cleanedRecommendState = next;
|
|
7440
7136
|
} else if (next) {
|
|
7441
7137
|
states.cleanedSearchState = next;
|
|
@@ -7535,7 +7231,7 @@
|
|
|
7535
7231
|
helper.searchForFacetValues = function(facetName, facetValue, maxFacetHits, userState) {
|
|
7536
7232
|
var state = mergeSearchParameters.apply(void 0, [
|
|
7537
7233
|
mainHelper.state
|
|
7538
|
-
].concat(
|
|
7234
|
+
].concat(_to_consumable_array(resolveSearchParameters(_this)))).setQueryParameters(userState);
|
|
7539
7235
|
return mainHelper.searchForFacetValues(facetName, facetValue, maxFacetHits, state);
|
|
7540
7236
|
};
|
|
7541
7237
|
var isolatedHelper = indexName ? helper : algoliasearchHelper({}, '__empty_index__', {});
|
|
@@ -7543,7 +7239,7 @@
|
|
|
7543
7239
|
derivedHelper = derivingHelper.derive(function() {
|
|
7544
7240
|
return mergeSearchParameters.apply(void 0, [
|
|
7545
7241
|
mainHelper.state
|
|
7546
|
-
].concat(
|
|
7242
|
+
].concat(_to_consumable_array(resolveSearchParameters(_this))));
|
|
7547
7243
|
}, function() {
|
|
7548
7244
|
return _this.getHelper().recommendState;
|
|
7549
7245
|
});
|
|
@@ -7730,7 +7426,7 @@
|
|
|
7730
7426
|
return !w._isolated;
|
|
7731
7427
|
}).reduce(function(previousUiState, innerIndex) {
|
|
7732
7428
|
return innerIndex.getWidgetUiState(previousUiState);
|
|
7733
|
-
},
|
|
7429
|
+
}, _object_spread_props(_object_spread({}, uiState), _define_property({}, indexId, _object_spread({}, uiState[indexId], localUiState))));
|
|
7734
7430
|
},
|
|
7735
7431
|
getWidgetState: function getWidgetState(uiState) {
|
|
7736
7432
|
return this.getWidgetUiState(uiState);
|
|
@@ -7754,7 +7450,7 @@
|
|
|
7754
7450
|
setIndexUiState: function setIndexUiState(indexUiState) {
|
|
7755
7451
|
var nextIndexUiState = typeof indexUiState === 'function' ? indexUiState(localUiState) : indexUiState;
|
|
7756
7452
|
localInstantSearchInstance.setUiState(function(state) {
|
|
7757
|
-
return
|
|
7453
|
+
return _object_spread_props(_object_spread({}, state), _define_property({}, indexId, nextIndexUiState));
|
|
7758
7454
|
});
|
|
7759
7455
|
}
|
|
7760
7456
|
};
|
|
@@ -7762,7 +7458,7 @@
|
|
|
7762
7458
|
function storeRenderState(param) {
|
|
7763
7459
|
var renderState = param.renderState, instantSearchInstance = param.instantSearchInstance, parent = param.parent;
|
|
7764
7460
|
var parentIndexName = parent ? parent.getIndexId() : instantSearchInstance.mainIndex.getIndexId();
|
|
7765
|
-
instantSearchInstance.renderState =
|
|
7461
|
+
instantSearchInstance.renderState = _object_spread_props(_object_spread({}, instantSearchInstance.renderState), _define_property({}, parentIndexName, _object_spread({}, instantSearchInstance.renderState[parentIndexName], renderState)));
|
|
7766
7462
|
}
|
|
7767
7463
|
/**
|
|
7768
7464
|
* Walk up the parent chain to find the closest isolated index, or fall back to mainHelper
|
|
@@ -7780,7 +7476,7 @@
|
|
|
7780
7476
|
* Forces a React update that triggers a rerender.
|
|
7781
7477
|
* @link https://reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate
|
|
7782
7478
|
*/ function useForceUpdate() {
|
|
7783
|
-
var _useReducer = _sliced_to_array
|
|
7479
|
+
var _useReducer = _sliced_to_array(React.useReducer(function(x) {
|
|
7784
7480
|
return x + 1;
|
|
7785
7481
|
}, 0), 2), forceUpdate = _useReducer[1];
|
|
7786
7482
|
return forceUpdate;
|
|
@@ -7828,320 +7524,97 @@
|
|
|
7828
7524
|
}, children);
|
|
7829
7525
|
}
|
|
7830
7526
|
|
|
7831
|
-
function
|
|
7832
|
-
|
|
7833
|
-
|
|
7527
|
+
function _get_prototype_of(o) {
|
|
7528
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
7529
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
7530
|
+
};
|
|
7834
7531
|
|
|
7835
|
-
|
|
7836
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7532
|
+
return _get_prototype_of(o);
|
|
7837
7533
|
}
|
|
7838
7534
|
|
|
7839
|
-
function
|
|
7840
|
-
|
|
7535
|
+
function _is_native_reflect_construct() {
|
|
7536
|
+
// Since Reflect.construct can't be properly polyfilled, some
|
|
7537
|
+
// implementations (e.g. core-js@2) don't set the correct internal slots.
|
|
7538
|
+
// Those polyfills don't allow us to subclass built-ins, so we need to
|
|
7539
|
+
// use our fallback implementation.
|
|
7540
|
+
try {
|
|
7541
|
+
// If the internal slots aren't set, this throws an error similar to
|
|
7542
|
+
// TypeError: this is not a Boolean object.
|
|
7543
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
7544
|
+
} catch (_) {}
|
|
7545
|
+
return (_is_native_reflect_construct = function() {
|
|
7546
|
+
return !!result;
|
|
7547
|
+
})();
|
|
7841
7548
|
}
|
|
7842
7549
|
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
var _get_prototype_of = {};
|
|
7550
|
+
function _assert_this_initialized(self) {
|
|
7551
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7846
7552
|
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
function require_get_prototype_of () {
|
|
7850
|
-
if (hasRequired_get_prototype_of) return _get_prototype_of;
|
|
7851
|
-
hasRequired_get_prototype_of = 1;
|
|
7852
|
-
|
|
7853
|
-
function _get_prototype_of$1(o) {
|
|
7854
|
-
_get_prototype_of._ = _get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
7855
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
7856
|
-
};
|
|
7857
|
-
|
|
7858
|
-
return _get_prototype_of$1(o);
|
|
7859
|
-
}
|
|
7860
|
-
_get_prototype_of._ = _get_prototype_of$1;
|
|
7861
|
-
return _get_prototype_of;
|
|
7553
|
+
return self;
|
|
7862
7554
|
}
|
|
7863
7555
|
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
var hasRequired_is_native_reflect_construct;
|
|
7867
|
-
|
|
7868
|
-
function require_is_native_reflect_construct () {
|
|
7869
|
-
if (hasRequired_is_native_reflect_construct) return _is_native_reflect_construct;
|
|
7870
|
-
hasRequired_is_native_reflect_construct = 1;
|
|
7871
|
-
|
|
7872
|
-
function _is_native_reflect_construct$1() {
|
|
7873
|
-
// Since Reflect.construct can't be properly polyfilled, some
|
|
7874
|
-
// implementations (e.g. core-js@2) don't set the correct internal slots.
|
|
7875
|
-
// Those polyfills don't allow us to subclass built-ins, so we need to
|
|
7876
|
-
// use our fallback implementation.
|
|
7877
|
-
try {
|
|
7878
|
-
// If the internal slots aren't set, this throws an error similar to
|
|
7879
|
-
// TypeError: this is not a Boolean object.
|
|
7880
|
-
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
7881
|
-
} catch (_) {}
|
|
7882
|
-
return (_is_native_reflect_construct._ = _is_native_reflect_construct$1 = function() {
|
|
7883
|
-
return !!result;
|
|
7884
|
-
})();
|
|
7885
|
-
}
|
|
7556
|
+
function _possible_constructor_return(self, call) {
|
|
7557
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
|
|
7886
7558
|
|
|
7887
|
-
|
|
7888
|
-
return _is_native_reflect_construct;
|
|
7559
|
+
return _assert_this_initialized(self);
|
|
7889
7560
|
}
|
|
7890
7561
|
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
function _assert_this_initialized$1(self) {
|
|
7902
|
-
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7903
|
-
|
|
7904
|
-
return self;
|
|
7905
|
-
}
|
|
7906
|
-
_assert_this_initialized._ = _assert_this_initialized$1;
|
|
7907
|
-
return _assert_this_initialized;
|
|
7562
|
+
function _call_super(_this, derived, args) {
|
|
7563
|
+
// Super
|
|
7564
|
+
derived = _get_prototype_of(derived);
|
|
7565
|
+
return _possible_constructor_return(
|
|
7566
|
+
_this,
|
|
7567
|
+
_is_native_reflect_construct()
|
|
7568
|
+
// NOTE: This doesn't work if this.__proto__.constructor has been modified.
|
|
7569
|
+
? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor)
|
|
7570
|
+
: derived.apply(_this, args)
|
|
7571
|
+
);
|
|
7908
7572
|
}
|
|
7909
7573
|
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
function require_possible_constructor_return () {
|
|
7913
|
-
if (hasRequired_possible_constructor_return) return _possible_constructor_return;
|
|
7914
|
-
hasRequired_possible_constructor_return = 1;
|
|
7915
|
-
|
|
7916
|
-
var _assert_this_initialized = /*@__PURE__*/ require_assert_this_initialized();
|
|
7917
|
-
var _type_of = /*@__PURE__*/ require_type_of();
|
|
7918
|
-
|
|
7919
|
-
function _possible_constructor_return$1(self, call) {
|
|
7920
|
-
if (call && (_type_of._(call) === "object" || typeof call === "function")) return call;
|
|
7921
|
-
|
|
7922
|
-
return _assert_this_initialized._(self);
|
|
7923
|
-
}
|
|
7924
|
-
_possible_constructor_return._ = _possible_constructor_return$1;
|
|
7925
|
-
return _possible_constructor_return;
|
|
7926
|
-
}
|
|
7927
|
-
|
|
7928
|
-
var hasRequired_call_super;
|
|
7929
|
-
|
|
7930
|
-
function require_call_super () {
|
|
7931
|
-
if (hasRequired_call_super) return _call_super;
|
|
7932
|
-
hasRequired_call_super = 1;
|
|
7933
|
-
|
|
7934
|
-
var _get_prototype_of = /*@__PURE__*/ require_get_prototype_of();
|
|
7935
|
-
var _is_native_reflect_construct = /*@__PURE__*/ require_is_native_reflect_construct();
|
|
7936
|
-
var _possible_constructor_return = /*@__PURE__*/ require_possible_constructor_return();
|
|
7937
|
-
|
|
7938
|
-
function _call_super$1(_this, derived, args) {
|
|
7939
|
-
// Super
|
|
7940
|
-
derived = _get_prototype_of._(derived);
|
|
7941
|
-
return _possible_constructor_return._(
|
|
7942
|
-
_this,
|
|
7943
|
-
_is_native_reflect_construct._()
|
|
7944
|
-
// NOTE: This doesn't work if this.__proto__.constructor has been modified.
|
|
7945
|
-
? Reflect.construct(derived, args || [], _get_prototype_of._(_this).constructor)
|
|
7946
|
-
: derived.apply(_this, args)
|
|
7947
|
-
);
|
|
7948
|
-
}
|
|
7949
|
-
|
|
7950
|
-
_call_super._ = _call_super$1;
|
|
7951
|
-
return _call_super;
|
|
7574
|
+
function _class_call_check(instance, Constructor) {
|
|
7575
|
+
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
|
7952
7576
|
}
|
|
7953
7577
|
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7578
|
+
function _defineProperties(target, props) {
|
|
7579
|
+
for (var i = 0; i < props.length; i++) {
|
|
7580
|
+
var descriptor = props[i];
|
|
7581
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
7582
|
+
descriptor.configurable = true;
|
|
7959
7583
|
|
|
7960
|
-
|
|
7961
|
-
if (hasRequired_class_call_check) return _class_call_check;
|
|
7962
|
-
hasRequired_class_call_check = 1;
|
|
7584
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
7963
7585
|
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
}
|
|
7967
|
-
_class_call_check._ = _class_call_check$1;
|
|
7968
|
-
return _class_call_check;
|
|
7586
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
7587
|
+
}
|
|
7969
7588
|
}
|
|
7589
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
7590
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
7970
7591
|
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
var _create_class = {};
|
|
7974
|
-
|
|
7975
|
-
var hasRequired_create_class;
|
|
7976
|
-
|
|
7977
|
-
function require_create_class () {
|
|
7978
|
-
if (hasRequired_create_class) return _create_class;
|
|
7979
|
-
hasRequired_create_class = 1;
|
|
7980
|
-
|
|
7981
|
-
function _defineProperties(target, props) {
|
|
7982
|
-
for (var i = 0; i < props.length; i++) {
|
|
7983
|
-
var descriptor = props[i];
|
|
7984
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
7985
|
-
descriptor.configurable = true;
|
|
7986
|
-
|
|
7987
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
7988
|
-
|
|
7989
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
7990
|
-
}
|
|
7991
|
-
}
|
|
7992
|
-
function _create_class$1(Constructor, protoProps, staticProps) {
|
|
7993
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
7994
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
7995
|
-
|
|
7996
|
-
return Constructor;
|
|
7997
|
-
}
|
|
7998
|
-
_create_class._ = _create_class$1;
|
|
7999
|
-
return _create_class;
|
|
7592
|
+
return Constructor;
|
|
8000
7593
|
}
|
|
8001
7594
|
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
var _set_prototype_of = {};
|
|
8007
|
-
|
|
8008
|
-
var hasRequired_set_prototype_of;
|
|
8009
|
-
|
|
8010
|
-
function require_set_prototype_of () {
|
|
8011
|
-
if (hasRequired_set_prototype_of) return _set_prototype_of;
|
|
8012
|
-
hasRequired_set_prototype_of = 1;
|
|
7595
|
+
function _set_prototype_of(o, p) {
|
|
7596
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
7597
|
+
o.__proto__ = p;
|
|
8013
7598
|
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
o.__proto__ = p;
|
|
8017
|
-
|
|
8018
|
-
return o;
|
|
8019
|
-
};
|
|
7599
|
+
return o;
|
|
7600
|
+
};
|
|
8020
7601
|
|
|
8021
|
-
|
|
8022
|
-
}
|
|
8023
|
-
_set_prototype_of._ = _set_prototype_of$1;
|
|
8024
|
-
return _set_prototype_of;
|
|
7602
|
+
return _set_prototype_of(o, p);
|
|
8025
7603
|
}
|
|
8026
7604
|
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
hasRequired_inherits = 1;
|
|
8032
|
-
|
|
8033
|
-
var _set_prototype_of = /*@__PURE__*/ require_set_prototype_of();
|
|
8034
|
-
|
|
8035
|
-
function _inherits$1(subClass, superClass) {
|
|
8036
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
8037
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
8038
|
-
}
|
|
7605
|
+
function _inherits(subClass, superClass) {
|
|
7606
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
7607
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
7608
|
+
}
|
|
8039
7609
|
|
|
8040
|
-
|
|
7610
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
8041
7611
|
|
|
8042
|
-
|
|
8043
|
-
}
|
|
8044
|
-
_inherits._ = _inherits$1;
|
|
8045
|
-
return _inherits;
|
|
7612
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
8046
7613
|
}
|
|
8047
7614
|
|
|
8048
|
-
var _inheritsExports = /*@__PURE__*/ require_inherits();
|
|
8049
|
-
|
|
8050
7615
|
var eventsExports = requireEvents();
|
|
8051
7616
|
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventsExports);
|
|
8052
7617
|
|
|
8053
|
-
var _sliced_to_array = {};
|
|
8054
|
-
|
|
8055
|
-
var _array_with_holes = {};
|
|
8056
|
-
|
|
8057
|
-
var hasRequired_array_with_holes;
|
|
8058
|
-
|
|
8059
|
-
function require_array_with_holes () {
|
|
8060
|
-
if (hasRequired_array_with_holes) return _array_with_holes;
|
|
8061
|
-
hasRequired_array_with_holes = 1;
|
|
8062
|
-
|
|
8063
|
-
function _array_with_holes$1(arr) {
|
|
8064
|
-
if (Array.isArray(arr)) return arr;
|
|
8065
|
-
}
|
|
8066
|
-
_array_with_holes._ = _array_with_holes$1;
|
|
8067
|
-
return _array_with_holes;
|
|
8068
|
-
}
|
|
8069
|
-
|
|
8070
|
-
var _iterable_to_array_limit = {};
|
|
8071
|
-
|
|
8072
|
-
var hasRequired_iterable_to_array_limit;
|
|
8073
|
-
|
|
8074
|
-
function require_iterable_to_array_limit () {
|
|
8075
|
-
if (hasRequired_iterable_to_array_limit) return _iterable_to_array_limit;
|
|
8076
|
-
hasRequired_iterable_to_array_limit = 1;
|
|
8077
|
-
|
|
8078
|
-
function _iterable_to_array_limit$1(arr, i) {
|
|
8079
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
8080
|
-
|
|
8081
|
-
if (_i == null) return;
|
|
8082
|
-
|
|
8083
|
-
var _arr = [];
|
|
8084
|
-
var _n = true;
|
|
8085
|
-
var _d = false;
|
|
8086
|
-
var _s, _e;
|
|
8087
|
-
|
|
8088
|
-
try {
|
|
8089
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
8090
|
-
_arr.push(_s.value);
|
|
8091
|
-
if (i && _arr.length === i) break;
|
|
8092
|
-
}
|
|
8093
|
-
} catch (err) {
|
|
8094
|
-
_d = true;
|
|
8095
|
-
_e = err;
|
|
8096
|
-
} finally {
|
|
8097
|
-
try {
|
|
8098
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
8099
|
-
} finally {
|
|
8100
|
-
if (_d) throw _e;
|
|
8101
|
-
}
|
|
8102
|
-
}
|
|
8103
|
-
|
|
8104
|
-
return _arr;
|
|
8105
|
-
}
|
|
8106
|
-
_iterable_to_array_limit._ = _iterable_to_array_limit$1;
|
|
8107
|
-
return _iterable_to_array_limit;
|
|
8108
|
-
}
|
|
8109
|
-
|
|
8110
|
-
var _non_iterable_rest = {};
|
|
8111
|
-
|
|
8112
|
-
var hasRequired_non_iterable_rest;
|
|
8113
|
-
|
|
8114
|
-
function require_non_iterable_rest () {
|
|
8115
|
-
if (hasRequired_non_iterable_rest) return _non_iterable_rest;
|
|
8116
|
-
hasRequired_non_iterable_rest = 1;
|
|
8117
|
-
|
|
8118
|
-
function _non_iterable_rest$1() {
|
|
8119
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
8120
|
-
}
|
|
8121
|
-
_non_iterable_rest._ = _non_iterable_rest$1;
|
|
8122
|
-
return _non_iterable_rest;
|
|
8123
|
-
}
|
|
8124
|
-
|
|
8125
|
-
var hasRequired_sliced_to_array;
|
|
8126
|
-
|
|
8127
|
-
function require_sliced_to_array () {
|
|
8128
|
-
if (hasRequired_sliced_to_array) return _sliced_to_array;
|
|
8129
|
-
hasRequired_sliced_to_array = 1;
|
|
8130
|
-
|
|
8131
|
-
var _array_with_holes = /*@__PURE__*/ require_array_with_holes();
|
|
8132
|
-
var _iterable_to_array_limit = /*@__PURE__*/ require_iterable_to_array_limit();
|
|
8133
|
-
var _non_iterable_rest = /*@__PURE__*/ require_non_iterable_rest();
|
|
8134
|
-
var _unsupported_iterable_to_array = /*@__PURE__*/ require_unsupported_iterable_to_array();
|
|
8135
|
-
|
|
8136
|
-
function _sliced_to_array$1(arr, i) {
|
|
8137
|
-
return _array_with_holes._(arr) || _iterable_to_array_limit._(arr, i) || _unsupported_iterable_to_array._(arr, i) || _non_iterable_rest._();
|
|
8138
|
-
}
|
|
8139
|
-
_sliced_to_array._ = _sliced_to_array$1;
|
|
8140
|
-
return _sliced_to_array;
|
|
8141
|
-
}
|
|
8142
|
-
|
|
8143
|
-
var _sliced_to_arrayExports = /*@__PURE__*/ require_sliced_to_array();
|
|
8144
|
-
|
|
8145
7618
|
/**
|
|
8146
7619
|
* Create UUID according to
|
|
8147
7620
|
* https://www.ietf.org/rfc/rfc4122.txt.
|
|
@@ -8157,7 +7630,7 @@
|
|
|
8157
7630
|
|
|
8158
7631
|
var ANONYMOUS_TOKEN_COOKIE_KEY = '_ALGOLIA';
|
|
8159
7632
|
function getCookie(name) {
|
|
8160
|
-
if ((typeof document === "undefined" ? "undefined" :
|
|
7633
|
+
if ((typeof document === "undefined" ? "undefined" : _type_of(document)) !== 'object' || typeof document.cookie !== 'string') {
|
|
8161
7634
|
return undefined;
|
|
8162
7635
|
}
|
|
8163
7636
|
var prefix = "".concat(name, "=");
|
|
@@ -8288,8 +7761,8 @@
|
|
|
8288
7761
|
}).map(function(m) {
|
|
8289
7762
|
return m.creator;
|
|
8290
7763
|
});
|
|
8291
|
-
(_instantSearchInstance = instantSearchInstance).unuse.apply(_instantSearchInstance,
|
|
8292
|
-
var _getAppIdAndApiKey =
|
|
7764
|
+
(_instantSearchInstance = instantSearchInstance).unuse.apply(_instantSearchInstance, _to_consumable_array(existingInsightsMiddlewares));
|
|
7765
|
+
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(instantSearchInstance.client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
|
|
8293
7766
|
var queuedInitParams = undefined;
|
|
8294
7767
|
var queuedUserToken = undefined;
|
|
8295
7768
|
var userTokenBeforeInit = undefined;
|
|
@@ -8306,12 +7779,12 @@
|
|
|
8306
7779
|
// At this point, even though `search-insights` is not loaded yet,
|
|
8307
7780
|
// we still want to read the token from the queue.
|
|
8308
7781
|
// Otherwise, the first search call will be fired without the token.
|
|
8309
|
-
ref =
|
|
7782
|
+
ref = _sliced_to_array([
|
|
8310
7783
|
'setUserToken',
|
|
8311
7784
|
'init'
|
|
8312
7785
|
].map(function(key) {
|
|
8313
|
-
var _ref =
|
|
8314
|
-
var _param =
|
|
7786
|
+
var _ref = _sliced_to_array(find(queue.slice().reverse(), function(param) {
|
|
7787
|
+
var _param = _sliced_to_array(param, 1), method = _param[0];
|
|
8315
7788
|
return method === key;
|
|
8316
7789
|
}) || [], 2), value = _ref[1];
|
|
8317
7790
|
return value;
|
|
@@ -8327,7 +7800,7 @@
|
|
|
8327
7800
|
// Only `init` if the `insightsInitParams` option is passed or
|
|
8328
7801
|
// if the `insightsClient` version doesn't supports optional `init` calling.
|
|
8329
7802
|
if (insightsInitParams || !isModernInsightsClient(insightsClient)) {
|
|
8330
|
-
insightsClient('init',
|
|
7803
|
+
insightsClient('init', _object_spread({
|
|
8331
7804
|
appId: appId,
|
|
8332
7805
|
apiKey: apiKey,
|
|
8333
7806
|
partial: true
|
|
@@ -8363,12 +7836,12 @@
|
|
|
8363
7836
|
var queueAtStart = insightsClient.queue;
|
|
8364
7837
|
if (Array.isArray(queueAtStart)) {
|
|
8365
7838
|
var ref;
|
|
8366
|
-
ref =
|
|
7839
|
+
ref = _sliced_to_array([
|
|
8367
7840
|
'setUserToken',
|
|
8368
7841
|
'init'
|
|
8369
7842
|
].map(function(key) {
|
|
8370
|
-
var _ref =
|
|
8371
|
-
var _param =
|
|
7843
|
+
var _ref = _sliced_to_array(find(queueAtStart.slice().reverse(), function(param) {
|
|
7844
|
+
var _param = _sliced_to_array(param, 1), method = _param[0];
|
|
8372
7845
|
return method === key;
|
|
8373
7846
|
}) || [], 2), value = _ref[1];
|
|
8374
7847
|
return value;
|
|
@@ -8378,7 +7851,7 @@
|
|
|
8378
7851
|
// We don't want to force clickAnalytics when the insights is enabled from the search response.
|
|
8379
7852
|
// This means we don't enable insights for indices that don't opt in
|
|
8380
7853
|
if (!$$automatic) {
|
|
8381
|
-
helper.overrideStateWithoutTriggeringChangeEvent(
|
|
7854
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_object_spread_props(_object_spread({}, helper.state), {
|
|
8382
7855
|
clickAnalytics: true
|
|
8383
7856
|
}));
|
|
8384
7857
|
}
|
|
@@ -8393,7 +7866,7 @@
|
|
|
8393
7866
|
}
|
|
8394
7867
|
var existingToken = helper.state.userToken;
|
|
8395
7868
|
function applyToken() {
|
|
8396
|
-
helper.overrideStateWithoutTriggeringChangeEvent(
|
|
7869
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_object_spread_props(_object_spread({}, helper.state), {
|
|
8397
7870
|
userToken: normalizedUserToken
|
|
8398
7871
|
}));
|
|
8399
7872
|
if (existingToken && existingToken !== userToken) {
|
|
@@ -8459,7 +7932,7 @@
|
|
|
8459
7932
|
var insightsClientWithLocalCredentials = insightsClient;
|
|
8460
7933
|
if (isModernInsightsClient(insightsClient)) {
|
|
8461
7934
|
insightsClientWithLocalCredentials = function insightsClientWithLocalCredentials(method, payload) {
|
|
8462
|
-
var _getAppIdAndApiKey =
|
|
7935
|
+
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(instantSearchInstance.client), 2), latestAppId = _getAppIdAndApiKey[0], latestApiKey = _getAppIdAndApiKey[1];
|
|
8463
7936
|
var extraParams = {
|
|
8464
7937
|
headers: {
|
|
8465
7938
|
'X-Algolia-Application-Id': latestAppId,
|
|
@@ -8514,7 +7987,7 @@
|
|
|
8514
7987
|
insightsClient('onUserTokenChange', undefined);
|
|
8515
7988
|
instantSearchInstance.sendEventToInsights = noop;
|
|
8516
7989
|
if (helper && initialParameters) {
|
|
8517
|
-
helper.overrideStateWithoutTriggeringChangeEvent(
|
|
7990
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_object_spread({}, helper.state, initialParameters));
|
|
8518
7991
|
instantSearchInstance.scheduleSearch();
|
|
8519
7992
|
}
|
|
8520
7993
|
}
|
|
@@ -8542,11 +8015,11 @@
|
|
|
8542
8015
|
* Determines if a given insights `client` supports the optional call to `init`
|
|
8543
8016
|
* and the ability to set credentials via extra parameters when sending events.
|
|
8544
8017
|
*/ function isModernInsightsClient(client) {
|
|
8545
|
-
var _split_map =
|
|
8546
|
-
/* eslint-disable
|
|
8018
|
+
var _split_map = _sliced_to_array((client.version || '').split('.').map(Number), 2), major = _split_map[0], minor = _split_map[1];
|
|
8019
|
+
/* eslint-disable instantsearch/naming-convention */ var v3 = major >= 3;
|
|
8547
8020
|
var v2_6 = major === 2 && minor >= 6;
|
|
8548
8021
|
var v1_10 = major === 1 && minor >= 10;
|
|
8549
|
-
/* eslint-enable
|
|
8022
|
+
/* eslint-enable instantsearch/naming-convention */ return v3 || v2_6 || v1_10;
|
|
8550
8023
|
}
|
|
8551
8024
|
/**
|
|
8552
8025
|
* While `search-insights` supports both string and number user tokens,
|
|
@@ -9527,48 +9000,48 @@
|
|
|
9527
9000
|
function BrowserHistory(param) {
|
|
9528
9001
|
var _this = this;
|
|
9529
9002
|
var windowTitle = param.windowTitle, _param_writeDelay = param.writeDelay, writeDelay = _param_writeDelay === void 0 ? 400 : _param_writeDelay, createURL = param.createURL, parseURL = param.parseURL, getLocation = param.getLocation, start = param.start, dispose = param.dispose, push = param.push, cleanUrlOnDispose = param.cleanUrlOnDispose;
|
|
9530
|
-
|
|
9531
|
-
|
|
9003
|
+
_class_call_check(this, BrowserHistory);
|
|
9004
|
+
_define_property(this, "$$type", 'ais.browser');
|
|
9532
9005
|
/**
|
|
9533
9006
|
* Transforms a UI state into a title for the page.
|
|
9534
|
-
*/
|
|
9007
|
+
*/ _define_property(this, "windowTitle", void 0);
|
|
9535
9008
|
/**
|
|
9536
9009
|
* Time in milliseconds before performing a write in the history.
|
|
9537
9010
|
* It prevents from adding too many entries in the history and
|
|
9538
9011
|
* makes the back button more usable.
|
|
9539
9012
|
*
|
|
9540
9013
|
* @default 400
|
|
9541
|
-
*/
|
|
9014
|
+
*/ _define_property(this, "writeDelay", void 0);
|
|
9542
9015
|
/**
|
|
9543
9016
|
* Creates a full URL based on the route state.
|
|
9544
9017
|
* The storage adaptor maps all syncable keys to the query string of the URL.
|
|
9545
|
-
*/
|
|
9018
|
+
*/ _define_property(this, "_createURL", void 0);
|
|
9546
9019
|
/**
|
|
9547
9020
|
* Parses the URL into a route state.
|
|
9548
9021
|
* It should be symmetrical to `createURL`.
|
|
9549
|
-
*/
|
|
9022
|
+
*/ _define_property(this, "parseURL", void 0);
|
|
9550
9023
|
/**
|
|
9551
9024
|
* Returns the location to store in the history.
|
|
9552
9025
|
* @default () => window.location
|
|
9553
|
-
*/
|
|
9554
|
-
|
|
9555
|
-
|
|
9026
|
+
*/ _define_property(this, "getLocation", void 0);
|
|
9027
|
+
_define_property(this, "writeTimer", void 0);
|
|
9028
|
+
_define_property(this, "_onPopState", void 0);
|
|
9556
9029
|
/**
|
|
9557
9030
|
* Indicates if last action was back/forward in the browser.
|
|
9558
|
-
*/
|
|
9031
|
+
*/ _define_property(this, "inPopState", false);
|
|
9559
9032
|
/**
|
|
9560
9033
|
* Indicates whether the history router is disposed or not.
|
|
9561
|
-
*/
|
|
9034
|
+
*/ _define_property(this, "isDisposed", false);
|
|
9562
9035
|
/**
|
|
9563
9036
|
* Indicates the window.history.length before the last call to
|
|
9564
9037
|
* window.history.pushState (called in `write`).
|
|
9565
9038
|
* It allows to determine if a `pushState` has been triggered elsewhere,
|
|
9566
9039
|
* and thus to prevent the `write` method from calling `pushState`.
|
|
9567
|
-
*/
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9040
|
+
*/ _define_property(this, "latestAcknowledgedHistory", 0);
|
|
9041
|
+
_define_property(this, "_start", void 0);
|
|
9042
|
+
_define_property(this, "_dispose", void 0);
|
|
9043
|
+
_define_property(this, "_push", void 0);
|
|
9044
|
+
_define_property(this, "_cleanUrlOnDispose", void 0);
|
|
9572
9045
|
this.windowTitle = windowTitle;
|
|
9573
9046
|
this.writeTimer = undefined;
|
|
9574
9047
|
this.writeDelay = writeDelay;
|
|
@@ -9580,13 +9053,13 @@
|
|
|
9580
9053
|
this._push = push;
|
|
9581
9054
|
this._cleanUrlOnDispose = typeof cleanUrlOnDispose === 'undefined' ? true : cleanUrlOnDispose;
|
|
9582
9055
|
safelyRunOnBrowser(function(param) {
|
|
9583
|
-
var
|
|
9056
|
+
var browserWindow = param.window;
|
|
9584
9057
|
var title = _this.windowTitle && _this.windowTitle(_this.read());
|
|
9585
9058
|
setWindowTitle(title);
|
|
9586
|
-
_this.latestAcknowledgedHistory =
|
|
9059
|
+
_this.latestAcknowledgedHistory = browserWindow.history.length;
|
|
9587
9060
|
});
|
|
9588
9061
|
}
|
|
9589
|
-
|
|
9062
|
+
_create_class(BrowserHistory, [
|
|
9590
9063
|
{
|
|
9591
9064
|
key: "read",
|
|
9592
9065
|
value: /**
|
|
@@ -9605,7 +9078,7 @@
|
|
|
9605
9078
|
*/ function write(routeState) {
|
|
9606
9079
|
var _this = this;
|
|
9607
9080
|
safelyRunOnBrowser(function(param) {
|
|
9608
|
-
var
|
|
9081
|
+
var browserWindow = param.window;
|
|
9609
9082
|
var url = _this.createURL(routeState);
|
|
9610
9083
|
var title = _this.windowTitle && _this.windowTitle(routeState);
|
|
9611
9084
|
if (_this.writeTimer) {
|
|
@@ -9617,9 +9090,9 @@
|
|
|
9617
9090
|
if (_this._push) {
|
|
9618
9091
|
_this._push(url);
|
|
9619
9092
|
} else {
|
|
9620
|
-
|
|
9093
|
+
browserWindow.history.pushState(routeState, title || '', url);
|
|
9621
9094
|
}
|
|
9622
|
-
_this.latestAcknowledgedHistory =
|
|
9095
|
+
_this.latestAcknowledgedHistory = browserWindow.history.length;
|
|
9623
9096
|
}
|
|
9624
9097
|
_this.inPopState = false;
|
|
9625
9098
|
_this.writeTimer = undefined;
|
|
@@ -9650,8 +9123,8 @@
|
|
|
9650
9123
|
callback(_this.read());
|
|
9651
9124
|
};
|
|
9652
9125
|
safelyRunOnBrowser(function(param) {
|
|
9653
|
-
var
|
|
9654
|
-
|
|
9126
|
+
var browserWindow = param.window;
|
|
9127
|
+
browserWindow.addEventListener('popstate', _this._onPopState);
|
|
9655
9128
|
});
|
|
9656
9129
|
}
|
|
9657
9130
|
},
|
|
@@ -9683,9 +9156,9 @@
|
|
|
9683
9156
|
}
|
|
9684
9157
|
this.isDisposed = true;
|
|
9685
9158
|
safelyRunOnBrowser(function(param) {
|
|
9686
|
-
var
|
|
9159
|
+
var browserWindow = param.window;
|
|
9687
9160
|
if (_this._onPopState) {
|
|
9688
|
-
|
|
9161
|
+
browserWindow.removeEventListener('popstate', _this._onPopState);
|
|
9689
9162
|
}
|
|
9690
9163
|
});
|
|
9691
9164
|
if (this.writeTimer) {
|
|
@@ -9707,7 +9180,7 @@
|
|
|
9707
9180
|
value: function shouldWrite(url) {
|
|
9708
9181
|
var _this = this;
|
|
9709
9182
|
return safelyRunOnBrowser(function(param) {
|
|
9710
|
-
var
|
|
9183
|
+
var browserWindow = param.window;
|
|
9711
9184
|
// When disposed and the cleanUrlOnDispose is set to false, we do not want to write the URL.
|
|
9712
9185
|
if (_this.isDisposed && !_this._cleanUrlOnDispose) {
|
|
9713
9186
|
return false;
|
|
@@ -9717,11 +9190,11 @@
|
|
|
9717
9190
|
// OR
|
|
9718
9191
|
// - the last write was from InstantSearch.js
|
|
9719
9192
|
// (unlike a SPA, where it would have last written)
|
|
9720
|
-
var lastPushWasByISAfterDispose = !(_this.isDisposed && _this.latestAcknowledgedHistory !==
|
|
9193
|
+
var lastPushWasByISAfterDispose = !(_this.isDisposed && _this.latestAcknowledgedHistory !== browserWindow.history.length);
|
|
9721
9194
|
return(// but that should not write the URL.
|
|
9722
9195
|
!_this.inPopState && // When the previous pushState after dispose was by IS.js, we want to write the URL.
|
|
9723
9196
|
lastPushWasByISAfterDispose && // When the URL is the same as the current one, we do not want to write it.
|
|
9724
|
-
url !==
|
|
9197
|
+
url !== browserWindow.location.href);
|
|
9725
9198
|
});
|
|
9726
9199
|
}
|
|
9727
9200
|
}
|
|
@@ -9756,8 +9229,8 @@
|
|
|
9756
9229
|
});
|
|
9757
9230
|
} : _ref_parseURL, _ref_writeDelay = _ref.writeDelay, writeDelay = _ref_writeDelay === void 0 ? 400 : _ref_writeDelay, windowTitle = _ref.windowTitle, _ref_getLocation = _ref.getLocation, getLocation = _ref_getLocation === void 0 ? function() {
|
|
9758
9231
|
return safelyRunOnBrowser(function(param) {
|
|
9759
|
-
var
|
|
9760
|
-
return
|
|
9232
|
+
var browserWindow = param.window;
|
|
9233
|
+
return browserWindow.location;
|
|
9761
9234
|
}, {
|
|
9762
9235
|
fallback: function fallback() {
|
|
9763
9236
|
throw new Error('You need to provide `getLocation` to the `history` router in environments where `window` does not exist.');
|
|
@@ -9779,7 +9252,7 @@
|
|
|
9779
9252
|
|
|
9780
9253
|
function getIndexStateWithoutConfigure(uiState) {
|
|
9781
9254
|
uiState.configure;
|
|
9782
|
-
var trackedUiState =
|
|
9255
|
+
var trackedUiState = _object_without_properties(uiState, [
|
|
9783
9256
|
"configure"
|
|
9784
9257
|
]);
|
|
9785
9258
|
return trackedUiState;
|
|
@@ -9792,13 +9265,13 @@
|
|
|
9792
9265
|
$$type: 'ais.simple',
|
|
9793
9266
|
stateToRoute: function stateToRoute(uiState) {
|
|
9794
9267
|
return Object.keys(uiState).reduce(function(state, indexId) {
|
|
9795
|
-
return
|
|
9268
|
+
return _object_spread_props(_object_spread({}, state), _define_property({}, indexId, getIndexStateWithoutConfigure(uiState[indexId])));
|
|
9796
9269
|
}, {});
|
|
9797
9270
|
},
|
|
9798
9271
|
routeToState: function routeToState() {
|
|
9799
9272
|
var routeState = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
9800
9273
|
return Object.keys(routeState).reduce(function(state, indexId) {
|
|
9801
|
-
return
|
|
9274
|
+
return _object_spread_props(_object_spread({}, state), _define_property({}, indexId, getIndexStateWithoutConfigure(routeState[indexId])));
|
|
9802
9275
|
}, {});
|
|
9803
9276
|
}
|
|
9804
9277
|
};
|
|
@@ -9820,7 +9293,7 @@
|
|
|
9820
9293
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
9821
9294
|
try {
|
|
9822
9295
|
// @TODO avoid for..of because of the large polyfill
|
|
9823
|
-
// eslint-disable-next-line no-
|
|
9296
|
+
// eslint-disable-next-line instantsearch/no-for-of
|
|
9824
9297
|
for(var _iterator = Object.keys(first)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
9825
9298
|
var key = _step.value;
|
|
9826
9299
|
if (!(key in second)) {
|
|
@@ -9863,7 +9336,7 @@
|
|
|
9863
9336
|
// any changes.
|
|
9864
9337
|
instantSearchInstance.mainIndex.getWidgets().length === 0 ? instantSearchInstance._initialUiState : instantSearchInstance.mainIndex.getWidgetUiState({});
|
|
9865
9338
|
var uiState = Object.keys(nextState).reduce(function(acc, indexId) {
|
|
9866
|
-
return
|
|
9339
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, indexId, nextState[indexId]));
|
|
9867
9340
|
}, previousUiState);
|
|
9868
9341
|
var route = stateMapping.stateToRoute(uiState);
|
|
9869
9342
|
return router.createURL(route);
|
|
@@ -9885,7 +9358,7 @@
|
|
|
9885
9358
|
}
|
|
9886
9359
|
},
|
|
9887
9360
|
subscribe: function subscribe() {
|
|
9888
|
-
instantSearchInstance._initialUiState =
|
|
9361
|
+
instantSearchInstance._initialUiState = _object_spread({}, initialUiState, stateMapping.routeToState(router.read()));
|
|
9889
9362
|
router.onUpdate(function(route) {
|
|
9890
9363
|
if (instantSearchInstance.mainIndex.getWidgets().length > 0) {
|
|
9891
9364
|
instantSearchInstance.setUiState(stateMapping.routeToState(route));
|
|
@@ -9924,51 +9397,25 @@
|
|
|
9924
9397
|
}, object);
|
|
9925
9398
|
}
|
|
9926
9399
|
|
|
9927
|
-
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
hasRequired_extends = 1;
|
|
9934
|
-
|
|
9935
|
-
function _extends$1() {
|
|
9936
|
-
_extends._ = _extends$1 = Object.assign || function assign(target) {
|
|
9937
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
9938
|
-
var source = arguments[i];
|
|
9939
|
-
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
9940
|
-
}
|
|
9400
|
+
function _extends() {
|
|
9401
|
+
_extends = Object.assign || function assign(target) {
|
|
9402
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
9403
|
+
var source = arguments[i];
|
|
9404
|
+
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
9405
|
+
}
|
|
9941
9406
|
|
|
9942
|
-
|
|
9943
|
-
|
|
9407
|
+
return target;
|
|
9408
|
+
};
|
|
9944
9409
|
|
|
9945
|
-
|
|
9946
|
-
}
|
|
9947
|
-
_extends._ = _extends$1;
|
|
9948
|
-
return _extends;
|
|
9410
|
+
return _extends.apply(this, arguments);
|
|
9949
9411
|
}
|
|
9950
9412
|
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
var _object_destructuring_empty = {};
|
|
9954
|
-
|
|
9955
|
-
var hasRequired_object_destructuring_empty;
|
|
9413
|
+
function _object_destructuring_empty(o) {
|
|
9414
|
+
if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
|
|
9956
9415
|
|
|
9957
|
-
|
|
9958
|
-
if (hasRequired_object_destructuring_empty) return _object_destructuring_empty;
|
|
9959
|
-
hasRequired_object_destructuring_empty = 1;
|
|
9960
|
-
|
|
9961
|
-
function _object_destructuring_empty$1(o) {
|
|
9962
|
-
if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
|
|
9963
|
-
|
|
9964
|
-
return o;
|
|
9965
|
-
}
|
|
9966
|
-
_object_destructuring_empty._ = _object_destructuring_empty$1;
|
|
9967
|
-
return _object_destructuring_empty;
|
|
9416
|
+
return o;
|
|
9968
9417
|
}
|
|
9969
9418
|
|
|
9970
|
-
var _object_destructuring_emptyExports = /*@__PURE__*/ require_object_destructuring_empty();
|
|
9971
|
-
|
|
9972
9419
|
/**
|
|
9973
9420
|
* This implementation is taken from Lodash implementation.
|
|
9974
9421
|
* See: https://github.com/lodash/lodash/blob/4.17.11-npm/escape.js
|
|
@@ -10029,13 +9476,13 @@
|
|
|
10029
9476
|
function recursiveEscape(input) {
|
|
10030
9477
|
if (isPlainObject(input) && typeof input.value !== 'string') {
|
|
10031
9478
|
return Object.keys(input).reduce(function(acc, key) {
|
|
10032
|
-
return
|
|
9479
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, recursiveEscape(input[key])));
|
|
10033
9480
|
}, {});
|
|
10034
9481
|
}
|
|
10035
9482
|
if (Array.isArray(input)) {
|
|
10036
9483
|
return input.map(recursiveEscape);
|
|
10037
9484
|
}
|
|
10038
|
-
return
|
|
9485
|
+
return _object_spread_props(_object_spread({}, input), {
|
|
10039
9486
|
value: replaceTagsAndEscape(input.value)
|
|
10040
9487
|
});
|
|
10041
9488
|
}
|
|
@@ -10044,8 +9491,8 @@
|
|
|
10044
9491
|
// We don't override the value on hit because it will mutate the raw results
|
|
10045
9492
|
// instead we make a shallow copy and we assign the escaped values on it.
|
|
10046
9493
|
hits = hits.map(function(_0) {
|
|
10047
|
-
|
|
10048
|
-
var hit =
|
|
9494
|
+
_object_destructuring_empty(_0);
|
|
9495
|
+
var hit = _extends({}, _0);
|
|
10049
9496
|
if (hit._highlightResult) {
|
|
10050
9497
|
hit._highlightResult = recursiveEscape(hit._highlightResult);
|
|
10051
9498
|
}
|
|
@@ -10060,7 +9507,7 @@
|
|
|
10060
9507
|
}
|
|
10061
9508
|
function escapeFacets(facetHits) {
|
|
10062
9509
|
return facetHits.map(function(h) {
|
|
10063
|
-
return
|
|
9510
|
+
return _object_spread_props(_object_spread({}, h), {
|
|
10064
9511
|
highlighted: replaceTagsAndEscape(h.highlighted)
|
|
10065
9512
|
});
|
|
10066
9513
|
});
|
|
@@ -10104,13 +9551,13 @@
|
|
|
10104
9551
|
return part.isHighlighted;
|
|
10105
9552
|
})) {
|
|
10106
9553
|
return parts.map(function(part) {
|
|
10107
|
-
return
|
|
9554
|
+
return _object_spread_props(_object_spread({}, part), {
|
|
10108
9555
|
isHighlighted: false
|
|
10109
9556
|
});
|
|
10110
9557
|
});
|
|
10111
9558
|
}
|
|
10112
9559
|
return parts.map(function(part, i) {
|
|
10113
|
-
return
|
|
9560
|
+
return _object_spread_props(_object_spread({}, part), {
|
|
10114
9561
|
isHighlighted: !getHighlightFromSiblings(parts, i)
|
|
10115
9562
|
});
|
|
10116
9563
|
});
|
|
@@ -10193,7 +9640,7 @@
|
|
|
10193
9640
|
|
|
10194
9641
|
/** @deprecated use bindEvent instead */ function writeDataAttributes(param) {
|
|
10195
9642
|
var method = param.method, payload = param.payload;
|
|
10196
|
-
if ((typeof payload === "undefined" ? "undefined" :
|
|
9643
|
+
if ((typeof payload === "undefined" ? "undefined" : _type_of(payload)) !== 'object') {
|
|
10197
9644
|
throw new Error("The insights helper expects the payload to be an object.");
|
|
10198
9645
|
}
|
|
10199
9646
|
var serializedPayload;
|
|
@@ -10222,7 +9669,7 @@
|
|
|
10222
9669
|
highlight: function highlight1(options, render) {
|
|
10223
9670
|
try {
|
|
10224
9671
|
var highlightOptions = JSON.parse(options);
|
|
10225
|
-
return render(highlight(
|
|
9672
|
+
return render(highlight(_object_spread_props(_object_spread({}, highlightOptions), {
|
|
10226
9673
|
hit: this
|
|
10227
9674
|
})));
|
|
10228
9675
|
} catch (error) {
|
|
@@ -10232,7 +9679,7 @@
|
|
|
10232
9679
|
reverseHighlight: function reverseHighlight1(options, render) {
|
|
10233
9680
|
try {
|
|
10234
9681
|
var reverseHighlightOptions = JSON.parse(options);
|
|
10235
|
-
return render(reverseHighlight(
|
|
9682
|
+
return render(reverseHighlight(_object_spread_props(_object_spread({}, reverseHighlightOptions), {
|
|
10236
9683
|
hit: this
|
|
10237
9684
|
})));
|
|
10238
9685
|
} catch (error) {
|
|
@@ -10242,7 +9689,7 @@
|
|
|
10242
9689
|
snippet: function snippet1(options, render) {
|
|
10243
9690
|
try {
|
|
10244
9691
|
var snippetOptions = JSON.parse(options);
|
|
10245
|
-
return render(snippet(
|
|
9692
|
+
return render(snippet(_object_spread_props(_object_spread({}, snippetOptions), {
|
|
10246
9693
|
hit: this
|
|
10247
9694
|
})));
|
|
10248
9695
|
} catch (error) {
|
|
@@ -10252,7 +9699,7 @@
|
|
|
10252
9699
|
reverseSnippet: function reverseSnippet1(options, render) {
|
|
10253
9700
|
try {
|
|
10254
9701
|
var reverseSnippetOptions = JSON.parse(options);
|
|
10255
|
-
return render(reverseSnippet(
|
|
9702
|
+
return render(reverseSnippet(_object_spread_props(_object_spread({}, reverseSnippetOptions), {
|
|
10256
9703
|
hit: this
|
|
10257
9704
|
})));
|
|
10258
9705
|
} catch (error) {
|
|
@@ -10262,7 +9709,7 @@
|
|
|
10262
9709
|
insights: function insights1(options, render) {
|
|
10263
9710
|
try {
|
|
10264
9711
|
var _JSON_parse = JSON.parse(options), method = _JSON_parse.method, payload = _JSON_parse.payload;
|
|
10265
|
-
return render(insights(method,
|
|
9712
|
+
return render(insights(method, _object_spread({
|
|
10266
9713
|
objectIDs: [
|
|
10267
9714
|
this.objectID
|
|
10268
9715
|
]
|
|
@@ -10274,7 +9721,7 @@
|
|
|
10274
9721
|
};
|
|
10275
9722
|
}
|
|
10276
9723
|
|
|
10277
|
-
var version = '4.
|
|
9724
|
+
var version = '4.93.0';
|
|
10278
9725
|
|
|
10279
9726
|
function hydrateSearchClient(client, results) {
|
|
10280
9727
|
if (!results) {
|
|
@@ -10290,7 +9737,7 @@
|
|
|
10290
9737
|
Object.keys(results).reduce(function(acc, key) {
|
|
10291
9738
|
var _results_key = results[key], state = _results_key.state, requestParams = _results_key.requestParams, serverResults = _results_key.results;
|
|
10292
9739
|
var mappedResults = serverResults && state ? serverResults.map(function(result, idx) {
|
|
10293
|
-
return
|
|
9740
|
+
return _object_spread({
|
|
10294
9741
|
indexName: state.index || result.index
|
|
10295
9742
|
}, (requestParams === null || requestParams === void 0 ? void 0 : requestParams[idx]) || result.params ? {
|
|
10296
9743
|
params: serializeQueryParameters((requestParams === null || requestParams === void 0 ? void 0 : requestParams[idx]) || deserializeQueryParameters(result.params))
|
|
@@ -10321,7 +9768,7 @@
|
|
|
10321
9768
|
methodArgs[_key - 1] = arguments[_key];
|
|
10322
9769
|
}
|
|
10323
9770
|
var requestsWithSerializedParams = Array.isArray(requests) ? requests.map(function(request) {
|
|
10324
|
-
return
|
|
9771
|
+
return _object_spread_props(_object_spread({}, request), {
|
|
10325
9772
|
params: serializeQueryParameters(request.params)
|
|
10326
9773
|
});
|
|
10327
9774
|
}) : serializeQueryParameters(requests.requestBody.params);
|
|
@@ -10329,11 +9776,11 @@
|
|
|
10329
9776
|
method: 'search',
|
|
10330
9777
|
args: [
|
|
10331
9778
|
requestsWithSerializedParams
|
|
10332
|
-
].concat(
|
|
9779
|
+
].concat(_to_consumable_array(methodArgs))
|
|
10333
9780
|
}, function() {
|
|
10334
9781
|
return baseMethod.apply(void 0, [
|
|
10335
9782
|
requests
|
|
10336
|
-
].concat(
|
|
9783
|
+
].concat(_to_consumable_array(methodArgs)));
|
|
10337
9784
|
});
|
|
10338
9785
|
};
|
|
10339
9786
|
client.transporter.responsesCache.set({
|
|
@@ -10353,7 +9800,7 @@
|
|
|
10353
9800
|
var cacheKey = "/1/indexes/*/queries_body_".concat(JSON.stringify({
|
|
10354
9801
|
requests: cachedRequest
|
|
10355
9802
|
}));
|
|
10356
|
-
client.cache =
|
|
9803
|
+
client.cache = _object_spread_props(_object_spread({}, client.cache), _define_property({}, cacheKey, JSON.stringify({
|
|
10357
9804
|
results: Object.keys(results).map(function(key) {
|
|
10358
9805
|
return results[key].results;
|
|
10359
9806
|
})
|
|
@@ -10362,7 +9809,7 @@
|
|
|
10362
9809
|
}
|
|
10363
9810
|
function deserializeQueryParameters(parameters) {
|
|
10364
9811
|
return parameters.split('&').reduce(function(acc, parameter) {
|
|
10365
|
-
var _parameter_split =
|
|
9812
|
+
var _parameter_split = _sliced_to_array(parameter.split('='), 2), key = _parameter_split[0], value = _parameter_split[1];
|
|
10366
9813
|
acc[key] = value ? decodeURIComponent(value) : '';
|
|
10367
9814
|
return acc;
|
|
10368
9815
|
}, {});
|
|
@@ -10392,7 +9839,7 @@
|
|
|
10392
9839
|
var initialResult = initialResults[indexName];
|
|
10393
9840
|
if (initialResult.recommendResults) {
|
|
10394
9841
|
// @MAJOR: Use `Object.assign` instead of spread operator
|
|
10395
|
-
return
|
|
9842
|
+
return _object_spread({}, acc, initialResult.recommendResults.results);
|
|
10396
9843
|
}
|
|
10397
9844
|
return acc;
|
|
10398
9845
|
}, {});
|
|
@@ -10424,20 +9871,20 @@
|
|
|
10424
9871
|
* created using the `instantsearch` factory function.
|
|
10425
9872
|
* It emits the 'render' event every time a search is done
|
|
10426
9873
|
*/ var InstantSearch$1 = /*#__PURE__*/ function(EventEmitter) {
|
|
10427
|
-
|
|
9874
|
+
_inherits(InstantSearch, EventEmitter);
|
|
10428
9875
|
function InstantSearch(options) {
|
|
10429
|
-
|
|
9876
|
+
_class_call_check(this, InstantSearch);
|
|
10430
9877
|
var _this;
|
|
10431
|
-
_this =
|
|
9878
|
+
_this = _call_super(this, InstantSearch), _define_property(_this, "client", void 0), _define_property(_this, "indexName", void 0), _define_property(_this, "compositionID", void 0), _define_property(_this, "insightsClient", void 0), _define_property(_this, "onStateChange", null), _define_property(_this, "future", void 0), _define_property(_this, "helper", void 0), _define_property(_this, "mainHelper", void 0), _define_property(_this, "mainIndex", void 0), _define_property(_this, "started", void 0), _define_property(_this, "templatesConfig", void 0), _define_property(_this, "renderState", {}), _define_property(_this, "_stalledSearchDelay", void 0), _define_property(_this, "_searchStalledTimer", void 0), _define_property(_this, "_initialUiState", void 0), _define_property(_this, "_initialResults", void 0), _define_property(_this, "_manuallyResetScheduleSearch", false), _define_property(_this, "_resetScheduleSearch", void 0), _define_property(_this, "_createURL", void 0), _define_property(_this, "_searchFunction", void 0), _define_property(_this, "_mainHelperSearch", void 0), _define_property(_this, "_hasSearchWidget", false), _define_property(_this, "_hasRecommendWidget", false), _define_property(_this, "_insights", void 0), _define_property(_this, "middleware", []), _define_property(_this, "sendEventToInsights", void 0), /**
|
|
10432
9879
|
* The status of the search. Can be "idle", "loading", "stalled", or "error".
|
|
10433
|
-
*/
|
|
9880
|
+
*/ _define_property(_this, "status", 'idle'), /**
|
|
10434
9881
|
* The last returned error from the Search API.
|
|
10435
9882
|
* The error gets cleared when the next valid search response is rendered.
|
|
10436
|
-
*/
|
|
9883
|
+
*/ _define_property(_this, "error", undefined), _define_property(_this, "scheduleSearch", defer(function() {
|
|
10437
9884
|
if (_this.started) {
|
|
10438
9885
|
_this.mainHelper.search();
|
|
10439
9886
|
}
|
|
10440
|
-
})),
|
|
9887
|
+
})), _define_property(_this, "scheduleRender", defer(function() {
|
|
10441
9888
|
var shouldResetStatus = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
10442
9889
|
var _this_mainHelper;
|
|
10443
9890
|
if (!((_this_mainHelper = _this.mainHelper) === null || _this_mainHelper === void 0 ? void 0 : _this_mainHelper.hasPendingRequests())) {
|
|
@@ -10452,7 +9899,7 @@
|
|
|
10452
9899
|
instantSearchInstance: _this
|
|
10453
9900
|
});
|
|
10454
9901
|
_this.emit('render');
|
|
10455
|
-
})),
|
|
9902
|
+
})), _define_property(_this, "onInternalStateChange", defer(function() {
|
|
10456
9903
|
var nextUiState = _this.mainIndex.getWidgetUiState({});
|
|
10457
9904
|
_this.middleware.forEach(function(param) {
|
|
10458
9905
|
var instance = param.instance;
|
|
@@ -10463,7 +9910,7 @@
|
|
|
10463
9910
|
}));
|
|
10464
9911
|
// prevent `render` event listening from causing a warning
|
|
10465
9912
|
_this.setMaxListeners(100);
|
|
10466
|
-
var _options_indexName = options.indexName, indexName = _options_indexName === void 0 ? '' : _options_indexName, compositionID = options.compositionID, numberLocale = options.numberLocale, _options_initialUiState = options.initialUiState, initialUiState = _options_initialUiState === void 0 ? {} : _options_initialUiState, _options_routing = options.routing, routing = _options_routing === void 0 ? null : _options_routing, _options_insights = options.insights, insights = _options_insights === void 0 ? undefined : _options_insights, searchFunction = options.searchFunction, _options_stalledSearchDelay = options.stalledSearchDelay, stalledSearchDelay = _options_stalledSearchDelay === void 0 ? 200 : _options_stalledSearchDelay, _options_searchClient = options.searchClient, searchClient = _options_searchClient === void 0 ? null : _options_searchClient, _options_insightsClient = options.insightsClient, insightsClient = _options_insightsClient === void 0 ? null : _options_insightsClient, _options_onStateChange = options.onStateChange, onStateChange = _options_onStateChange === void 0 ? null : _options_onStateChange, _options_future1 = options.future, future = _options_future1 === void 0 ?
|
|
9913
|
+
var _options_indexName = options.indexName, indexName = _options_indexName === void 0 ? '' : _options_indexName, compositionID = options.compositionID, numberLocale = options.numberLocale, _options_initialUiState = options.initialUiState, initialUiState = _options_initialUiState === void 0 ? {} : _options_initialUiState, _options_routing = options.routing, routing = _options_routing === void 0 ? null : _options_routing, _options_insights = options.insights, insights = _options_insights === void 0 ? undefined : _options_insights, searchFunction = options.searchFunction, _options_stalledSearchDelay = options.stalledSearchDelay, stalledSearchDelay = _options_stalledSearchDelay === void 0 ? 200 : _options_stalledSearchDelay, _options_searchClient = options.searchClient, searchClient = _options_searchClient === void 0 ? null : _options_searchClient, _options_insightsClient = options.insightsClient, insightsClient = _options_insightsClient === void 0 ? null : _options_insightsClient, _options_onStateChange = options.onStateChange, onStateChange = _options_onStateChange === void 0 ? null : _options_onStateChange, _options_future1 = options.future, future = _options_future1 === void 0 ? _object_spread({}, INSTANTSEARCH_FUTURE_DEFAULTS, options.future || {}) : _options_future1;
|
|
10467
9914
|
if (searchClient === null) {
|
|
10468
9915
|
throw new Error(withUsage$p('The `searchClient` option is required.'));
|
|
10469
9916
|
}
|
|
@@ -10526,7 +9973,7 @@
|
|
|
10526
9973
|
}
|
|
10527
9974
|
return _this;
|
|
10528
9975
|
}
|
|
10529
|
-
|
|
9976
|
+
_create_class(InstantSearch, [
|
|
10530
9977
|
{
|
|
10531
9978
|
key: "_isSearchStalled",
|
|
10532
9979
|
get: /**
|
|
@@ -10545,7 +9992,7 @@
|
|
|
10545
9992
|
middleware[_key] = arguments[_key];
|
|
10546
9993
|
}
|
|
10547
9994
|
var newMiddlewareList = middleware.map(function(fn) {
|
|
10548
|
-
var newMiddleware =
|
|
9995
|
+
var newMiddleware = _object_spread({
|
|
10549
9996
|
$$type: '__unknown__',
|
|
10550
9997
|
$$internal: false,
|
|
10551
9998
|
subscribe: noop,
|
|
@@ -10597,7 +10044,7 @@
|
|
|
10597
10044
|
for(var _len = arguments.length, middleware = new Array(_len), _key = 0; _key < _len; _key++){
|
|
10598
10045
|
middleware[_key] = arguments[_key];
|
|
10599
10046
|
}
|
|
10600
|
-
return this.use.apply(this,
|
|
10047
|
+
return this.use.apply(this, _to_consumable_array(middleware));
|
|
10601
10048
|
}
|
|
10602
10049
|
},
|
|
10603
10050
|
{
|
|
@@ -10732,7 +10179,7 @@
|
|
|
10732
10179
|
// and `results` that are also emitted on the derived one.
|
|
10733
10180
|
mainHelper.on('error', function(param) {
|
|
10734
10181
|
var error = param.error;
|
|
10735
|
-
if (!
|
|
10182
|
+
if (!_instanceof(error, Error)) {
|
|
10736
10183
|
// typescript lies here, error is in some cases { name: string, message: string }
|
|
10737
10184
|
var err = error;
|
|
10738
10185
|
error = Object.keys(err).reduce(function(acc, key) {
|
|
@@ -11297,7 +10744,7 @@
|
|
|
11297
10744
|
prevPropsRef.current = props;
|
|
11298
10745
|
}
|
|
11299
10746
|
if (!dequal(prevProps.future, props.future)) {
|
|
11300
|
-
search1.future = _object_spread
|
|
10747
|
+
search1.future = _object_spread({}, INSTANTSEARCH_FUTURE_DEFAULTS, props.future);
|
|
11301
10748
|
prevPropsRef.current = props;
|
|
11302
10749
|
}
|
|
11303
10750
|
// Updating the `routing` prop is not supported because InstantSearch.js
|
|
@@ -11437,7 +10884,7 @@
|
|
|
11437
10884
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, children);
|
|
11438
10885
|
}
|
|
11439
10886
|
return /*#__PURE__*/ React.createElement(InstantSearchSSRContext.Provider, {
|
|
11440
|
-
value: _object_spread_props(_object_spread
|
|
10887
|
+
value: _object_spread_props(_object_spread({}, props), {
|
|
11441
10888
|
ssrSearchRef: ssrSearchRef,
|
|
11442
10889
|
recommendIdx: recommendIdx
|
|
11443
10890
|
})
|
|
@@ -11457,12 +10904,12 @@
|
|
|
11457
10904
|
param.methodName;
|
|
11458
10905
|
var args = param.args, instantSearchInstance = param.instantSearchInstance;
|
|
11459
10906
|
// when there's only one argument, that means it's custom
|
|
11460
|
-
if (args.length === 1 &&
|
|
10907
|
+
if (args.length === 1 && _type_of(args[0]) === 'object') {
|
|
11461
10908
|
return [
|
|
11462
10909
|
args[0]
|
|
11463
10910
|
];
|
|
11464
10911
|
}
|
|
11465
|
-
var _args__split =
|
|
10912
|
+
var _args__split = _sliced_to_array(args[0].split(':'), 2), eventType = _args__split[0], eventModifier = _args__split[1];
|
|
11466
10913
|
var hits = args[1];
|
|
11467
10914
|
var eventName = args[2];
|
|
11468
10915
|
var additionalData = args[3] || {};
|
|
@@ -11504,7 +10951,7 @@
|
|
|
11504
10951
|
insightsMethod: 'viewedObjectIDs',
|
|
11505
10952
|
widgetType: widgetType,
|
|
11506
10953
|
eventType: eventType,
|
|
11507
|
-
payload:
|
|
10954
|
+
payload: _object_spread({
|
|
11508
10955
|
eventName: eventName || 'Hits Viewed',
|
|
11509
10956
|
index: ((_helper_lastResults = helper.lastResults) === null || _helper_lastResults === void 0 ? void 0 : _helper_lastResults.index) || helper.state.index,
|
|
11510
10957
|
objectIDs: objectIDsByChunk[i]
|
|
@@ -11520,7 +10967,7 @@
|
|
|
11520
10967
|
insightsMethod: 'clickedObjectIDsAfterSearch',
|
|
11521
10968
|
widgetType: widgetType,
|
|
11522
10969
|
eventType: eventType,
|
|
11523
|
-
payload:
|
|
10970
|
+
payload: _object_spread({
|
|
11524
10971
|
eventName: eventName || 'Hit Clicked',
|
|
11525
10972
|
index: ((_helper_lastResults = helper.lastResults) === null || _helper_lastResults === void 0 ? void 0 : _helper_lastResults.index) || helper.state.index,
|
|
11526
10973
|
queryID: queryID,
|
|
@@ -11538,7 +10985,7 @@
|
|
|
11538
10985
|
insightsMethod: 'convertedObjectIDsAfterSearch',
|
|
11539
10986
|
widgetType: widgetType,
|
|
11540
10987
|
eventType: eventType,
|
|
11541
|
-
payload:
|
|
10988
|
+
payload: _object_spread({
|
|
11542
10989
|
eventName: eventName || 'Hit Converted',
|
|
11543
10990
|
index: ((_helper_lastResults = helper.lastResults) === null || _helper_lastResults === void 0 ? void 0 : _helper_lastResults.index) || helper.state.index,
|
|
11544
10991
|
queryID: queryID,
|
|
@@ -11615,7 +11062,7 @@
|
|
|
11615
11062
|
$$type: 'ais.autocomplete',
|
|
11616
11063
|
init: function init(initOptions) {
|
|
11617
11064
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
11618
|
-
renderFn(
|
|
11065
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
11619
11066
|
instantSearchInstance: instantSearchInstance
|
|
11620
11067
|
}), true);
|
|
11621
11068
|
},
|
|
@@ -11626,12 +11073,12 @@
|
|
|
11626
11073
|
var sendEvent = param.sendEvent, hits = param.hits;
|
|
11627
11074
|
sendEvent('view:internal', hits);
|
|
11628
11075
|
});
|
|
11629
|
-
renderFn(
|
|
11076
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
11630
11077
|
instantSearchInstance: instantSearchInstance
|
|
11631
11078
|
}), false);
|
|
11632
11079
|
},
|
|
11633
11080
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
11634
|
-
return
|
|
11081
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
11635
11082
|
autocomplete: this.getWidgetRenderState(renderOptions)
|
|
11636
11083
|
});
|
|
11637
11084
|
},
|
|
@@ -11666,7 +11113,7 @@
|
|
|
11666
11113
|
return {
|
|
11667
11114
|
currentRefinement: state.query || '',
|
|
11668
11115
|
indices: transformItems(indices).map(function(transformedIndex) {
|
|
11669
|
-
return
|
|
11116
|
+
return _object_spread_props(_object_spread({}, transformedIndex), {
|
|
11670
11117
|
sendEvent: sendEventMap[transformedIndex.indexId]
|
|
11671
11118
|
});
|
|
11672
11119
|
}),
|
|
@@ -11680,7 +11127,7 @@
|
|
|
11680
11127
|
if (query === '' || uiState && uiState.query === query) {
|
|
11681
11128
|
return uiState;
|
|
11682
11129
|
}
|
|
11683
|
-
return
|
|
11130
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
11684
11131
|
query: query
|
|
11685
11132
|
});
|
|
11686
11133
|
},
|
|
@@ -11692,7 +11139,7 @@
|
|
|
11692
11139
|
if (!escapeHTML) {
|
|
11693
11140
|
return searchParameters.setQueryParameters(parameters);
|
|
11694
11141
|
}
|
|
11695
|
-
return searchParameters.setQueryParameters(
|
|
11142
|
+
return searchParameters.setQueryParameters(_object_spread({}, parameters, TAG_PLACEHOLDER));
|
|
11696
11143
|
},
|
|
11697
11144
|
dispose: function dispose(param) {
|
|
11698
11145
|
var state = param.state;
|
|
@@ -11702,7 +11149,7 @@
|
|
|
11702
11149
|
return stateWithoutQuery;
|
|
11703
11150
|
}
|
|
11704
11151
|
return stateWithoutQuery.setQueryParameters(Object.keys(TAG_PLACEHOLDER).reduce(function(acc, key) {
|
|
11705
|
-
return
|
|
11152
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, undefined));
|
|
11706
11153
|
}, {}));
|
|
11707
11154
|
}
|
|
11708
11155
|
};
|
|
@@ -11728,7 +11175,7 @@
|
|
|
11728
11175
|
if (!attributes || !Array.isArray(attributes) || attributes.length === 0) {
|
|
11729
11176
|
throw new Error(withUsage$n('The `attributes` option expects an array of strings.'));
|
|
11730
11177
|
}
|
|
11731
|
-
var _attributes =
|
|
11178
|
+
var _attributes = _sliced_to_array(attributes, 1), hierarchicalFacetName = _attributes[0];
|
|
11732
11179
|
function getRefinedState(state, facetValue) {
|
|
11733
11180
|
if (!facetValue) {
|
|
11734
11181
|
var breadcrumb = state.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
@@ -11743,12 +11190,12 @@
|
|
|
11743
11190
|
return {
|
|
11744
11191
|
$$type: 'ais.breadcrumb',
|
|
11745
11192
|
init: function init(initOptions) {
|
|
11746
|
-
renderFn(
|
|
11193
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
11747
11194
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
11748
11195
|
}), true);
|
|
11749
11196
|
},
|
|
11750
11197
|
render: function render(renderOptions) {
|
|
11751
|
-
renderFn(
|
|
11198
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
11752
11199
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
11753
11200
|
}), false);
|
|
11754
11201
|
},
|
|
@@ -11756,8 +11203,8 @@
|
|
|
11756
11203
|
unmountFn();
|
|
11757
11204
|
},
|
|
11758
11205
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
11759
|
-
return
|
|
11760
|
-
breadcrumb:
|
|
11206
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
11207
|
+
breadcrumb: _object_spread_props(_object_spread({}, renderState.breadcrumb), _define_property({}, hierarchicalFacetName, this.getWidgetRenderState(renderOptions)))
|
|
11761
11208
|
});
|
|
11762
11209
|
},
|
|
11763
11210
|
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
@@ -11804,8 +11251,8 @@
|
|
|
11804
11251
|
getWidgetUiState: function getWidgetUiState(uiState, param) {
|
|
11805
11252
|
var searchParameters = param.searchParameters;
|
|
11806
11253
|
var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
11807
|
-
return removeEmptyRefinementsFromUiState$4(
|
|
11808
|
-
hierarchicalMenu:
|
|
11254
|
+
return removeEmptyRefinementsFromUiState$4(_object_spread_props(_object_spread({}, uiState), {
|
|
11255
|
+
hierarchicalMenu: _object_spread_props(_object_spread({}, uiState.hierarchicalMenu), _define_property({}, hierarchicalFacetName, path))
|
|
11809
11256
|
}), hierarchicalFacetName);
|
|
11810
11257
|
},
|
|
11811
11258
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
@@ -11825,7 +11272,7 @@
|
|
|
11825
11272
|
});
|
|
11826
11273
|
if (!values) {
|
|
11827
11274
|
return withFacetConfiguration.setQueryParameters({
|
|
11828
|
-
hierarchicalFacetsRefinements:
|
|
11275
|
+
hierarchicalFacetsRefinements: _object_spread_props(_object_spread({}, withFacetConfiguration.hierarchicalFacetsRefinements), _define_property({}, hierarchicalFacetName, []))
|
|
11829
11276
|
});
|
|
11830
11277
|
}
|
|
11831
11278
|
return withFacetConfiguration.addHierarchicalFacetRefinement(hierarchicalFacetName, values.join(separator));
|
|
@@ -11993,7 +11440,7 @@
|
|
|
11993
11440
|
return Math.random().toString(36).substring(2, 9);
|
|
11994
11441
|
}
|
|
11995
11442
|
function isToolOrDynamicToolUIPart(part) {
|
|
11996
|
-
if ((typeof part === "undefined" ? "undefined" :
|
|
11443
|
+
if ((typeof part === "undefined" ? "undefined" : _type_of(part)) !== 'object' || part === null) return false;
|
|
11997
11444
|
var p = part;
|
|
11998
11445
|
return typeof p.type === 'string' && (p.type.startsWith('tool-') || p.type === 'dynamic-tool');
|
|
11999
11446
|
}
|
|
@@ -12011,11 +11458,11 @@
|
|
|
12011
11458
|
}
|
|
12012
11459
|
var SerialJobExecutor = /*#__PURE__*/ function() {
|
|
12013
11460
|
function SerialJobExecutor() {
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
11461
|
+
_class_call_check(this, SerialJobExecutor);
|
|
11462
|
+
_define_property(this, "queue", []);
|
|
11463
|
+
_define_property(this, "isRunning", false);
|
|
12017
11464
|
}
|
|
12018
|
-
|
|
11465
|
+
_create_class(SerialJobExecutor, [
|
|
12019
11466
|
{
|
|
12020
11467
|
key: "run",
|
|
12021
11468
|
value: function run(job) {
|
|
@@ -12069,22 +11516,22 @@
|
|
|
12069
11516
|
var _this = this;
|
|
12070
11517
|
var _param_generateId = param.generateId, generateId$1 = _param_generateId === void 0 ? generateId : _param_generateId, _param_id = param.id, id = _param_id === void 0 ? generateId$1() : _param_id, transport = param.transport, state = param.state, onError = param.onError, onToolCall = param.onToolCall, onFinish = param.onFinish, onData = param.onData, sendAutomaticallyWhen = param.sendAutomaticallyWhen;
|
|
12071
11518
|
var _this1 = this;
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12082
|
-
|
|
12083
|
-
|
|
11519
|
+
_class_call_check(this, AbstractChat);
|
|
11520
|
+
_define_property(this, "id", void 0);
|
|
11521
|
+
_define_property(this, "generateId", void 0);
|
|
11522
|
+
_define_property(this, "state", void 0);
|
|
11523
|
+
_define_property(this, "transport", void 0);
|
|
11524
|
+
_define_property(this, "onError", void 0);
|
|
11525
|
+
_define_property(this, "onToolCall", void 0);
|
|
11526
|
+
_define_property(this, "onFinish", void 0);
|
|
11527
|
+
_define_property(this, "onData", void 0);
|
|
11528
|
+
_define_property(this, "sendAutomaticallyWhen", void 0);
|
|
11529
|
+
_define_property(this, "activeResponse", null);
|
|
11530
|
+
_define_property(this, "jobExecutor", new SerialJobExecutor());
|
|
12084
11531
|
/**
|
|
12085
11532
|
* Appends or replaces a user message to the chat list. This triggers the API call to fetch
|
|
12086
11533
|
* the assistant's response.
|
|
12087
|
-
*/
|
|
11534
|
+
*/ _define_property(this, "sendMessage", function(message, options) {
|
|
12088
11535
|
return _this.jobExecutor.run(function() {
|
|
12089
11536
|
// Build the user message
|
|
12090
11537
|
var userMessagePromise;
|
|
@@ -12092,7 +11539,7 @@
|
|
|
12092
11539
|
var messageId = message.messageId || _this.generateId();
|
|
12093
11540
|
if ('parts' in message && message.parts) {
|
|
12094
11541
|
// Full message with parts provided
|
|
12095
|
-
userMessagePromise = Promise.resolve(
|
|
11542
|
+
userMessagePromise = Promise.resolve(_object_spread({
|
|
12096
11543
|
id: messageId,
|
|
12097
11544
|
role: 'user'
|
|
12098
11545
|
}, message));
|
|
@@ -12108,7 +11555,7 @@
|
|
|
12108
11555
|
if (message.files) {
|
|
12109
11556
|
userMessagePromise = _this.convertFilesToParts(message.files).then(function(fileParts) {
|
|
12110
11557
|
var _parts;
|
|
12111
|
-
(_parts = parts).push.apply(_parts,
|
|
11558
|
+
(_parts = parts).push.apply(_parts, _to_consumable_array(fileParts));
|
|
12112
11559
|
return {
|
|
12113
11560
|
id: messageId,
|
|
12114
11561
|
role: 'user',
|
|
@@ -12144,7 +11591,7 @@
|
|
|
12144
11591
|
if (userMessage) {
|
|
12145
11592
|
_this.state.pushMessage(userMessage);
|
|
12146
11593
|
}
|
|
12147
|
-
return _this.makeRequest(
|
|
11594
|
+
return _this.makeRequest(_object_spread({
|
|
12148
11595
|
trigger: 'submit-message',
|
|
12149
11596
|
messageId: userMessage === null || userMessage === void 0 ? void 0 : userMessage.id
|
|
12150
11597
|
}, options));
|
|
@@ -12154,11 +11601,11 @@
|
|
|
12154
11601
|
/**
|
|
12155
11602
|
* Regenerate the assistant message with the provided message id.
|
|
12156
11603
|
* If no message id is provided, the last assistant message will be regenerated.
|
|
12157
|
-
*/
|
|
11604
|
+
*/ _define_property(this, "regenerate", function() {
|
|
12158
11605
|
var _0 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
|
|
12159
11606
|
var _ref = [
|
|
12160
11607
|
_0
|
|
12161
|
-
], _ref1 =
|
|
11608
|
+
], _ref1 = _sliced_to_array(_ref, 1), tmp = _ref1[0], _ref2 = tmp === void 0 ? {} : tmp, messageId = _ref2.messageId, options = _object_without_properties(_ref2, [
|
|
12162
11609
|
"messageId"
|
|
12163
11610
|
]);
|
|
12164
11611
|
return _this1.jobExecutor.run(function() {
|
|
@@ -12181,7 +11628,7 @@
|
|
|
12181
11628
|
// Remove the assistant message and all messages after it
|
|
12182
11629
|
_this1.state.messages = _this1.state.messages.slice(0, targetIndex);
|
|
12183
11630
|
}
|
|
12184
|
-
return _this1.makeRequest(
|
|
11631
|
+
return _this1.makeRequest(_object_spread({
|
|
12185
11632
|
trigger: 'regenerate-message',
|
|
12186
11633
|
messageId: messageId
|
|
12187
11634
|
}, options));
|
|
@@ -12189,7 +11636,7 @@
|
|
|
12189
11636
|
});
|
|
12190
11637
|
/**
|
|
12191
11638
|
* Attempt to resume an ongoing streaming response.
|
|
12192
|
-
*/
|
|
11639
|
+
*/ _define_property(this, "resumeStream", function(options) {
|
|
12193
11640
|
return _this.jobExecutor.run(function() {
|
|
12194
11641
|
if (!_this.transport) {
|
|
12195
11642
|
return Promise.reject(new Error('Transport is required for resuming stream. Please provide a transport when initializing the chat.'));
|
|
@@ -12197,7 +11644,7 @@
|
|
|
12197
11644
|
_this.setStatus({
|
|
12198
11645
|
status: 'submitted'
|
|
12199
11646
|
});
|
|
12200
|
-
return _this.transport.reconnectToStream(
|
|
11647
|
+
return _this.transport.reconnectToStream(_object_spread({
|
|
12201
11648
|
chatId: _this.id
|
|
12202
11649
|
}, options)).then(function(stream) {
|
|
12203
11650
|
if (stream) {
|
|
@@ -12216,7 +11663,7 @@
|
|
|
12216
11663
|
});
|
|
12217
11664
|
/**
|
|
12218
11665
|
* Clear the error state and set the status to ready if the chat is in an error state.
|
|
12219
|
-
*/
|
|
11666
|
+
*/ _define_property(this, "clearError", function() {
|
|
12220
11667
|
if (_this.state.status === 'error') {
|
|
12221
11668
|
_this.setStatus({
|
|
12222
11669
|
status: 'ready',
|
|
@@ -12226,7 +11673,7 @@
|
|
|
12226
11673
|
});
|
|
12227
11674
|
/**
|
|
12228
11675
|
* Add a tool result for a tool call.
|
|
12229
|
-
*/
|
|
11676
|
+
*/ _define_property(this, "addToolResult", function(param) {
|
|
12230
11677
|
var tool = param.tool, toolCallId = param.toolCallId, output = param.output;
|
|
12231
11678
|
return _this.jobExecutor.run(function() {
|
|
12232
11679
|
// Find the message with this tool call
|
|
@@ -12241,14 +11688,14 @@
|
|
|
12241
11688
|
var message = _this.state.messages[messageIndex];
|
|
12242
11689
|
var updatedParts = message.parts.map(function(part) {
|
|
12243
11690
|
if ('toolCallId' in part && part.toolCallId === toolCallId && 'state' in part) {
|
|
12244
|
-
return
|
|
11691
|
+
return _object_spread_props(_object_spread({}, part), {
|
|
12245
11692
|
state: 'output-available',
|
|
12246
11693
|
output: output
|
|
12247
11694
|
});
|
|
12248
11695
|
}
|
|
12249
11696
|
return part;
|
|
12250
11697
|
});
|
|
12251
|
-
_this.state.replaceMessage(messageIndex,
|
|
11698
|
+
_this.state.replaceMessage(messageIndex, _object_spread_props(_object_spread({}, message), {
|
|
12252
11699
|
parts: updatedParts
|
|
12253
11700
|
}));
|
|
12254
11701
|
// Check if we should auto-send based on sendAutomaticallyWhen
|
|
@@ -12269,7 +11716,7 @@
|
|
|
12269
11716
|
});
|
|
12270
11717
|
/**
|
|
12271
11718
|
* Abort the current request immediately, keep the generated tokens if any.
|
|
12272
|
-
*/
|
|
11719
|
+
*/ _define_property(this, "stop", function() {
|
|
12273
11720
|
if (_this.activeResponse) {
|
|
12274
11721
|
_this.activeResponse.abortController.abort();
|
|
12275
11722
|
_this.activeResponse = null;
|
|
@@ -12289,7 +11736,7 @@
|
|
|
12289
11736
|
this.onData = onData;
|
|
12290
11737
|
this.sendAutomaticallyWhen = sendAutomaticallyWhen;
|
|
12291
11738
|
}
|
|
12292
|
-
|
|
11739
|
+
_create_class(AbstractChat, [
|
|
12293
11740
|
{
|
|
12294
11741
|
key: "status",
|
|
12295
11742
|
get: /**
|
|
@@ -12425,8 +11872,8 @@
|
|
|
12425
11872
|
state: 'streaming',
|
|
12426
11873
|
providerMetadata: chunk.providerMetadata
|
|
12427
11874
|
};
|
|
12428
|
-
currentMessage =
|
|
12429
|
-
parts:
|
|
11875
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
11876
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12430
11877
|
textPart
|
|
12431
11878
|
])
|
|
12432
11879
|
});
|
|
@@ -12440,12 +11887,12 @@
|
|
|
12440
11887
|
return p.type === 'text' && p.state === 'streaming';
|
|
12441
11888
|
});
|
|
12442
11889
|
if (partIndex === -1) break;
|
|
12443
|
-
var updatedParts =
|
|
11890
|
+
var updatedParts = _to_consumable_array(currentMessage.parts);
|
|
12444
11891
|
var textPart1 = updatedParts[partIndex];
|
|
12445
|
-
updatedParts[partIndex] =
|
|
11892
|
+
updatedParts[partIndex] = _object_spread_props(_object_spread({}, textPart1), {
|
|
12446
11893
|
text: textPart1.text + chunk.delta
|
|
12447
11894
|
});
|
|
12448
|
-
currentMessage =
|
|
11895
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12449
11896
|
parts: updatedParts
|
|
12450
11897
|
});
|
|
12451
11898
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
@@ -12458,12 +11905,12 @@
|
|
|
12458
11905
|
return p.type === 'text' && p.state === 'streaming';
|
|
12459
11906
|
});
|
|
12460
11907
|
if (partIndex1 === -1) break;
|
|
12461
|
-
var updatedParts1 =
|
|
11908
|
+
var updatedParts1 = _to_consumable_array(currentMessage.parts);
|
|
12462
11909
|
var textPart2 = updatedParts1[partIndex1];
|
|
12463
|
-
updatedParts1[partIndex1] =
|
|
11910
|
+
updatedParts1[partIndex1] = _object_spread_props(_object_spread({}, textPart2), {
|
|
12464
11911
|
state: 'done'
|
|
12465
11912
|
});
|
|
12466
|
-
currentMessage =
|
|
11913
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12467
11914
|
parts: updatedParts1
|
|
12468
11915
|
});
|
|
12469
11916
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
@@ -12480,8 +11927,8 @@
|
|
|
12480
11927
|
state: 'streaming',
|
|
12481
11928
|
providerMetadata: chunk.providerMetadata
|
|
12482
11929
|
};
|
|
12483
|
-
currentMessage =
|
|
12484
|
-
parts:
|
|
11930
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
11931
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12485
11932
|
reasoningPart
|
|
12486
11933
|
])
|
|
12487
11934
|
});
|
|
@@ -12495,12 +11942,12 @@
|
|
|
12495
11942
|
return p.type === 'reasoning' && p.state === 'streaming';
|
|
12496
11943
|
});
|
|
12497
11944
|
if (partIndex2 === -1) break;
|
|
12498
|
-
var updatedParts2 =
|
|
11945
|
+
var updatedParts2 = _to_consumable_array(currentMessage.parts);
|
|
12499
11946
|
var reasoningPart1 = updatedParts2[partIndex2];
|
|
12500
|
-
updatedParts2[partIndex2] =
|
|
11947
|
+
updatedParts2[partIndex2] = _object_spread_props(_object_spread({}, reasoningPart1), {
|
|
12501
11948
|
text: reasoningPart1.text + chunk.delta
|
|
12502
11949
|
});
|
|
12503
|
-
currentMessage =
|
|
11950
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12504
11951
|
parts: updatedParts2
|
|
12505
11952
|
});
|
|
12506
11953
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
@@ -12513,12 +11960,12 @@
|
|
|
12513
11960
|
return p.type === 'reasoning' && p.state === 'streaming';
|
|
12514
11961
|
});
|
|
12515
11962
|
if (partIndex3 === -1) break;
|
|
12516
|
-
var updatedParts3 =
|
|
11963
|
+
var updatedParts3 = _to_consumable_array(currentMessage.parts);
|
|
12517
11964
|
var reasoningPart2 = updatedParts3[partIndex3];
|
|
12518
|
-
updatedParts3[partIndex3] =
|
|
11965
|
+
updatedParts3[partIndex3] = _object_spread_props(_object_spread({}, reasoningPart2), {
|
|
12519
11966
|
state: 'done'
|
|
12520
11967
|
});
|
|
12521
|
-
currentMessage =
|
|
11968
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12522
11969
|
parts: updatedParts3
|
|
12523
11970
|
});
|
|
12524
11971
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
@@ -12535,8 +11982,8 @@
|
|
|
12535
11982
|
input: chunk.input,
|
|
12536
11983
|
providerExecuted: chunk.providerExecuted
|
|
12537
11984
|
};
|
|
12538
|
-
currentMessage =
|
|
12539
|
-
parts:
|
|
11985
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
11986
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12540
11987
|
toolPart
|
|
12541
11988
|
])
|
|
12542
11989
|
});
|
|
@@ -12563,14 +12010,14 @@
|
|
|
12563
12010
|
providerExecuted: chunk.providerExecuted
|
|
12564
12011
|
};
|
|
12565
12012
|
if (existingIndex >= 0) {
|
|
12566
|
-
var updatedParts4 =
|
|
12013
|
+
var updatedParts4 = _to_consumable_array(currentMessage.parts);
|
|
12567
12014
|
updatedParts4[existingIndex] = toolPart1;
|
|
12568
|
-
currentMessage =
|
|
12015
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12569
12016
|
parts: updatedParts4
|
|
12570
12017
|
});
|
|
12571
12018
|
} else {
|
|
12572
|
-
currentMessage =
|
|
12573
|
-
parts:
|
|
12019
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12020
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12574
12021
|
toolPart1
|
|
12575
12022
|
])
|
|
12576
12023
|
});
|
|
@@ -12601,15 +12048,15 @@
|
|
|
12601
12048
|
return 'toolCallId' in p && p.toolCallId === chunk.toolCallId;
|
|
12602
12049
|
});
|
|
12603
12050
|
if (toolIndex >= 0) {
|
|
12604
|
-
var updatedParts5 =
|
|
12051
|
+
var updatedParts5 = _to_consumable_array(currentMessage.parts);
|
|
12605
12052
|
var existingPart = updatedParts5[toolIndex];
|
|
12606
|
-
updatedParts5[toolIndex] =
|
|
12053
|
+
updatedParts5[toolIndex] = _object_spread_props(_object_spread({}, existingPart), {
|
|
12607
12054
|
state: 'output-available',
|
|
12608
12055
|
output: chunk.output,
|
|
12609
12056
|
callProviderMetadata: chunk.callProviderMetadata,
|
|
12610
12057
|
preliminary: chunk.preliminary
|
|
12611
12058
|
});
|
|
12612
|
-
currentMessage =
|
|
12059
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12613
12060
|
parts: updatedParts5
|
|
12614
12061
|
});
|
|
12615
12062
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
@@ -12624,15 +12071,15 @@
|
|
|
12624
12071
|
});
|
|
12625
12072
|
if (toolIndex1 >= 0) {
|
|
12626
12073
|
var _chunk_input;
|
|
12627
|
-
var updatedParts6 =
|
|
12074
|
+
var updatedParts6 = _to_consumable_array(currentMessage.parts);
|
|
12628
12075
|
var existingPart1 = updatedParts6[toolIndex1];
|
|
12629
|
-
updatedParts6[toolIndex1] =
|
|
12076
|
+
updatedParts6[toolIndex1] = _object_spread_props(_object_spread({}, existingPart1), {
|
|
12630
12077
|
state: 'output-error',
|
|
12631
12078
|
errorText: chunk.errorText,
|
|
12632
12079
|
input: (_chunk_input = chunk.input) !== null && _chunk_input !== void 0 ? _chunk_input : existingPart1.input,
|
|
12633
12080
|
callProviderMetadata: chunk.callProviderMetadata
|
|
12634
12081
|
});
|
|
12635
|
-
currentMessage =
|
|
12082
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12636
12083
|
parts: updatedParts6
|
|
12637
12084
|
});
|
|
12638
12085
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
@@ -12648,8 +12095,8 @@
|
|
|
12648
12095
|
url: chunk.url,
|
|
12649
12096
|
title: chunk.title
|
|
12650
12097
|
};
|
|
12651
|
-
currentMessage =
|
|
12652
|
-
parts:
|
|
12098
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12099
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12653
12100
|
sourcePart
|
|
12654
12101
|
])
|
|
12655
12102
|
});
|
|
@@ -12667,8 +12114,8 @@
|
|
|
12667
12114
|
filename: chunk.filename,
|
|
12668
12115
|
providerMetadata: chunk.providerMetadata
|
|
12669
12116
|
};
|
|
12670
|
-
currentMessage =
|
|
12671
|
-
parts:
|
|
12117
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12118
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12672
12119
|
docPart
|
|
12673
12120
|
])
|
|
12674
12121
|
});
|
|
@@ -12683,8 +12130,8 @@
|
|
|
12683
12130
|
url: chunk.url,
|
|
12684
12131
|
mediaType: chunk.mediaType
|
|
12685
12132
|
};
|
|
12686
|
-
currentMessage =
|
|
12687
|
-
parts:
|
|
12133
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12134
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12688
12135
|
filePart
|
|
12689
12136
|
])
|
|
12690
12137
|
});
|
|
@@ -12697,8 +12144,8 @@
|
|
|
12697
12144
|
var stepPart = {
|
|
12698
12145
|
type: 'step-start'
|
|
12699
12146
|
};
|
|
12700
|
-
currentMessage =
|
|
12701
|
-
parts:
|
|
12147
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12148
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12702
12149
|
stepPart
|
|
12703
12150
|
])
|
|
12704
12151
|
});
|
|
@@ -12708,7 +12155,7 @@
|
|
|
12708
12155
|
case 'message-metadata':
|
|
12709
12156
|
{
|
|
12710
12157
|
if (!currentMessage) break;
|
|
12711
|
-
currentMessage =
|
|
12158
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12712
12159
|
metadata: chunk.messageMetadata
|
|
12713
12160
|
});
|
|
12714
12161
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
@@ -12727,7 +12174,7 @@
|
|
|
12727
12174
|
case 'finish':
|
|
12728
12175
|
{
|
|
12729
12176
|
if (currentMessage && chunk.messageMetadata !== undefined) {
|
|
12730
|
-
currentMessage =
|
|
12177
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12731
12178
|
metadata: chunk.messageMetadata
|
|
12732
12179
|
});
|
|
12733
12180
|
_this.state.replaceMessage(currentMessageIndex, currentMessage);
|
|
@@ -12744,8 +12191,8 @@
|
|
|
12744
12191
|
id: chunk.id,
|
|
12745
12192
|
data: chunk.data
|
|
12746
12193
|
};
|
|
12747
|
-
currentMessage =
|
|
12748
|
-
parts:
|
|
12194
|
+
currentMessage = _object_spread_props(_object_spread({}, currentMessage), {
|
|
12195
|
+
parts: _to_consumable_array(currentMessage.parts).concat([
|
|
12749
12196
|
dataPart
|
|
12750
12197
|
])
|
|
12751
12198
|
});
|
|
@@ -12868,61 +12315,61 @@
|
|
|
12868
12315
|
function ChatState() {
|
|
12869
12316
|
var _this = this;
|
|
12870
12317
|
var id = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : undefined, initialMessages = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : getDefaultInitialMessages(id);
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
|
|
12878
|
-
|
|
12318
|
+
_class_call_check(this, ChatState);
|
|
12319
|
+
_define_property(this, "_messages", void 0);
|
|
12320
|
+
_define_property(this, "_status", 'ready');
|
|
12321
|
+
_define_property(this, "_error", undefined);
|
|
12322
|
+
_define_property(this, "_messagesCallbacks", new Set());
|
|
12323
|
+
_define_property(this, "_statusCallbacks", new Set());
|
|
12324
|
+
_define_property(this, "_errorCallbacks", new Set());
|
|
12325
|
+
_define_property(this, "pushMessage", function(message) {
|
|
12879
12326
|
_this._messages = _this._messages.concat(message);
|
|
12880
12327
|
_this._callMessagesCallbacks();
|
|
12881
12328
|
});
|
|
12882
|
-
|
|
12329
|
+
_define_property(this, "popMessage", function() {
|
|
12883
12330
|
_this._messages = _this._messages.slice(0, -1);
|
|
12884
12331
|
_this._callMessagesCallbacks();
|
|
12885
12332
|
});
|
|
12886
|
-
|
|
12887
|
-
_this._messages =
|
|
12333
|
+
_define_property(this, "replaceMessage", function(index, message) {
|
|
12334
|
+
_this._messages = _to_consumable_array(_this._messages.slice(0, index)).concat([
|
|
12888
12335
|
// We deep clone the message here to ensure the new React Compiler (currently in RC) detects deeply nested parts/metadata changes:
|
|
12889
12336
|
_this.snapshot(message)
|
|
12890
|
-
],
|
|
12337
|
+
], _to_consumable_array(_this._messages.slice(index + 1)));
|
|
12891
12338
|
_this._callMessagesCallbacks();
|
|
12892
12339
|
});
|
|
12893
|
-
|
|
12340
|
+
_define_property(this, "snapshot", function(thing) {
|
|
12894
12341
|
return JSON.parse(JSON.stringify(thing));
|
|
12895
12342
|
});
|
|
12896
|
-
|
|
12343
|
+
_define_property(this, _computedKey6, function(onChange) {
|
|
12897
12344
|
var callback = onChange;
|
|
12898
12345
|
_this._messagesCallbacks.add(callback);
|
|
12899
12346
|
return function() {
|
|
12900
12347
|
_this._messagesCallbacks.delete(callback);
|
|
12901
12348
|
};
|
|
12902
12349
|
});
|
|
12903
|
-
|
|
12350
|
+
_define_property(this, _computedKey7, function(onChange) {
|
|
12904
12351
|
_this._statusCallbacks.add(onChange);
|
|
12905
12352
|
return function() {
|
|
12906
12353
|
_this._statusCallbacks.delete(onChange);
|
|
12907
12354
|
};
|
|
12908
12355
|
});
|
|
12909
|
-
|
|
12356
|
+
_define_property(this, _computedKey8, function(onChange) {
|
|
12910
12357
|
_this._errorCallbacks.add(onChange);
|
|
12911
12358
|
return function() {
|
|
12912
12359
|
_this._errorCallbacks.delete(onChange);
|
|
12913
12360
|
};
|
|
12914
12361
|
});
|
|
12915
|
-
|
|
12362
|
+
_define_property(this, "_callMessagesCallbacks", function() {
|
|
12916
12363
|
_this._messagesCallbacks.forEach(function(callback) {
|
|
12917
12364
|
return callback();
|
|
12918
12365
|
});
|
|
12919
12366
|
});
|
|
12920
|
-
|
|
12367
|
+
_define_property(this, "_callStatusCallbacks", function() {
|
|
12921
12368
|
_this._statusCallbacks.forEach(function(callback) {
|
|
12922
12369
|
return callback();
|
|
12923
12370
|
});
|
|
12924
12371
|
});
|
|
12925
|
-
|
|
12372
|
+
_define_property(this, "_callErrorCallbacks", function() {
|
|
12926
12373
|
_this._errorCallbacks.forEach(function(callback) {
|
|
12927
12374
|
return callback();
|
|
12928
12375
|
});
|
|
@@ -12940,7 +12387,7 @@
|
|
|
12940
12387
|
this['~registerMessagesCallback'](saveMessagesInLocalStorage);
|
|
12941
12388
|
this['~registerStatusCallback'](saveMessagesInLocalStorage);
|
|
12942
12389
|
}
|
|
12943
|
-
|
|
12390
|
+
_create_class(ChatState, [
|
|
12944
12391
|
{
|
|
12945
12392
|
key: "status",
|
|
12946
12393
|
get: function get() {
|
|
@@ -12967,7 +12414,7 @@
|
|
|
12967
12414
|
return this._messages;
|
|
12968
12415
|
},
|
|
12969
12416
|
set: function set(newMessages) {
|
|
12970
|
-
this._messages =
|
|
12417
|
+
this._messages = _to_consumable_array(newMessages);
|
|
12971
12418
|
this._callMessagesCallbacks();
|
|
12972
12419
|
}
|
|
12973
12420
|
}
|
|
@@ -12977,24 +12424,24 @@
|
|
|
12977
12424
|
_computedKey3 = '~registerMessagesCallback', _computedKey4 = '~registerStatusCallback', _computedKey5 = '~registerErrorCallback';
|
|
12978
12425
|
var _computedKey9 = _computedKey3, _computedKey10 = _computedKey4, _computedKey11 = _computedKey5;
|
|
12979
12426
|
var Chat = /*#__PURE__*/ function(AbstractChat) {
|
|
12980
|
-
|
|
12427
|
+
_inherits(Chat, AbstractChat);
|
|
12981
12428
|
function Chat(_0) {
|
|
12982
|
-
|
|
12429
|
+
_class_call_check(this, Chat);
|
|
12983
12430
|
var _this;
|
|
12984
|
-
var messages = _0.messages, agentId = _0.agentId, init =
|
|
12431
|
+
var messages = _0.messages, agentId = _0.agentId, init = _object_without_properties(_0, [
|
|
12985
12432
|
"messages",
|
|
12986
12433
|
"agentId"
|
|
12987
12434
|
]);
|
|
12988
12435
|
var state = new ChatState(agentId, messages);
|
|
12989
|
-
_this =
|
|
12990
|
-
|
|
12436
|
+
_this = _call_super(this, Chat, [
|
|
12437
|
+
_object_spread_props(_object_spread({}, init), {
|
|
12991
12438
|
state: state
|
|
12992
12439
|
})
|
|
12993
|
-
]),
|
|
12440
|
+
]), _define_property(_this, "_state", void 0), _define_property(_this, _computedKey9, function(onChange) {
|
|
12994
12441
|
return _this._state['~registerMessagesCallback'](onChange);
|
|
12995
|
-
}),
|
|
12442
|
+
}), _define_property(_this, _computedKey10, function(onChange) {
|
|
12996
12443
|
return _this._state['~registerStatusCallback'](onChange);
|
|
12997
|
-
}),
|
|
12444
|
+
}), _define_property(_this, _computedKey11, function(onChange) {
|
|
12998
12445
|
return _this._state['~registerErrorCallback'](onChange);
|
|
12999
12446
|
});
|
|
13000
12447
|
_this._state = state;
|
|
@@ -13016,14 +12463,14 @@
|
|
|
13016
12463
|
*/ var HttpChatTransport = /*#__PURE__*/ function() {
|
|
13017
12464
|
function HttpChatTransport(param) {
|
|
13018
12465
|
var _param_api = param.api, api = _param_api === void 0 ? '/api/chat' : _param_api, credentials = param.credentials, headers = param.headers, body = param.body, customFetch = param.fetch, prepareSendMessagesRequest = param.prepareSendMessagesRequest, prepareReconnectToStreamRequest = param.prepareReconnectToStreamRequest;
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
|
|
13024
|
-
|
|
13025
|
-
|
|
13026
|
-
|
|
12466
|
+
_class_call_check(this, HttpChatTransport);
|
|
12467
|
+
_define_property(this, "api", void 0);
|
|
12468
|
+
_define_property(this, "credentials", void 0);
|
|
12469
|
+
_define_property(this, "headers", void 0);
|
|
12470
|
+
_define_property(this, "body", void 0);
|
|
12471
|
+
_define_property(this, "fetch", void 0);
|
|
12472
|
+
_define_property(this, "prepareSendMessagesRequest", void 0);
|
|
12473
|
+
_define_property(this, "prepareReconnectToStreamRequest", void 0);
|
|
13027
12474
|
this.api = api;
|
|
13028
12475
|
this.credentials = credentials;
|
|
13029
12476
|
this.headers = headers;
|
|
@@ -13032,7 +12479,7 @@
|
|
|
13032
12479
|
this.prepareSendMessagesRequest = prepareSendMessagesRequest;
|
|
13033
12480
|
this.prepareReconnectToStreamRequest = prepareReconnectToStreamRequest;
|
|
13034
12481
|
}
|
|
13035
|
-
|
|
12482
|
+
_create_class(HttpChatTransport, [
|
|
13036
12483
|
{
|
|
13037
12484
|
key: "sendMessages",
|
|
13038
12485
|
value: function sendMessages(param) {
|
|
@@ -13046,19 +12493,19 @@
|
|
|
13046
12493
|
resolveValue(this.headers),
|
|
13047
12494
|
resolveValue(this.body)
|
|
13048
12495
|
]).then(function(param) {
|
|
13049
|
-
var _param =
|
|
12496
|
+
var _param = _sliced_to_array(param, 3), resolvedCredentials = _param[0], resolvedHeaders = _param[1], resolvedBody = _param[2];
|
|
13050
12497
|
// Build default request options
|
|
13051
12498
|
var api = _this.api;
|
|
13052
|
-
var body =
|
|
12499
|
+
var body = _object_spread({
|
|
13053
12500
|
id: chatId,
|
|
13054
12501
|
messages: messages
|
|
13055
12502
|
}, resolvedBody, requestBody);
|
|
13056
|
-
var headers =
|
|
12503
|
+
var headers = _object_spread({
|
|
13057
12504
|
'Content-Type': 'application/json'
|
|
13058
|
-
},
|
|
12505
|
+
}, _instanceof(resolvedHeaders, Headers) ? Object.fromEntries(resolvedHeaders.entries()) : resolvedHeaders, _instanceof(requestHeaders, Headers) ? Object.fromEntries(requestHeaders.entries()) : requestHeaders);
|
|
13059
12506
|
var credentials = resolvedCredentials;
|
|
13060
12507
|
// Apply custom preparation if provided
|
|
13061
|
-
var prepareRequestBody =
|
|
12508
|
+
var prepareRequestBody = _object_spread({}, resolvedBody, requestBody);
|
|
13062
12509
|
var preparePromise = _this.prepareSendMessagesRequest ? Promise.resolve(_this.prepareSendMessagesRequest({
|
|
13063
12510
|
id: chatId,
|
|
13064
12511
|
messages: messages,
|
|
@@ -13075,9 +12522,9 @@
|
|
|
13075
12522
|
body = prepared.body;
|
|
13076
12523
|
if (prepared.api) api = prepared.api;
|
|
13077
12524
|
if (prepared.headers) {
|
|
13078
|
-
headers =
|
|
12525
|
+
headers = _object_spread({
|
|
13079
12526
|
'Content-Type': 'application/json'
|
|
13080
|
-
},
|
|
12527
|
+
}, _instanceof(prepared.headers, Headers) ? Object.fromEntries(prepared.headers.entries()) : prepared.headers);
|
|
13081
12528
|
}
|
|
13082
12529
|
if (prepared.credentials) credentials = prepared.credentials;
|
|
13083
12530
|
}
|
|
@@ -13113,13 +12560,13 @@
|
|
|
13113
12560
|
resolveValue(this.headers),
|
|
13114
12561
|
resolveValue(this.body)
|
|
13115
12562
|
]).then(function(param) {
|
|
13116
|
-
var _param =
|
|
12563
|
+
var _param = _sliced_to_array(param, 3), resolvedCredentials = _param[0], resolvedHeaders = _param[1], resolvedBody = _param[2];
|
|
13117
12564
|
// Build default request options
|
|
13118
12565
|
var api = _this.api;
|
|
13119
|
-
var headers =
|
|
12566
|
+
var headers = _object_spread({}, _instanceof(resolvedHeaders, Headers) ? Object.fromEntries(resolvedHeaders.entries()) : resolvedHeaders, _instanceof(requestHeaders, Headers) ? Object.fromEntries(requestHeaders.entries()) : requestHeaders);
|
|
13120
12567
|
var credentials = resolvedCredentials;
|
|
13121
12568
|
// Apply custom preparation if provided
|
|
13122
|
-
var prepareRequestBody =
|
|
12569
|
+
var prepareRequestBody = _object_spread({}, resolvedBody, requestBody);
|
|
13123
12570
|
var preparePromise = _this.prepareReconnectToStreamRequest ? Promise.resolve(_this.prepareReconnectToStreamRequest({
|
|
13124
12571
|
id: chatId,
|
|
13125
12572
|
requestMetadata: undefined,
|
|
@@ -13132,7 +12579,7 @@
|
|
|
13132
12579
|
if (prepared) {
|
|
13133
12580
|
if (prepared.api) api = prepared.api;
|
|
13134
12581
|
if (prepared.headers) {
|
|
13135
|
-
headers =
|
|
12582
|
+
headers = _instanceof(prepared.headers, Headers) ? Object.fromEntries(prepared.headers.entries()) : prepared.headers;
|
|
13136
12583
|
}
|
|
13137
12584
|
if (prepared.credentials) credentials = prepared.credentials;
|
|
13138
12585
|
}
|
|
@@ -13164,15 +12611,15 @@
|
|
|
13164
12611
|
/**
|
|
13165
12612
|
* Default chat transport implementation using NDJSON streaming.
|
|
13166
12613
|
*/ var DefaultChatTransport = /*#__PURE__*/ function(HttpChatTransport) {
|
|
13167
|
-
|
|
12614
|
+
_inherits(DefaultChatTransport, HttpChatTransport);
|
|
13168
12615
|
function DefaultChatTransport() {
|
|
13169
12616
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
13170
|
-
|
|
13171
|
-
return
|
|
12617
|
+
_class_call_check(this, DefaultChatTransport);
|
|
12618
|
+
return _call_super(this, DefaultChatTransport, [
|
|
13172
12619
|
options
|
|
13173
12620
|
]);
|
|
13174
12621
|
}
|
|
13175
|
-
|
|
12622
|
+
_create_class(DefaultChatTransport, [
|
|
13176
12623
|
{
|
|
13177
12624
|
key: "processResponseStream",
|
|
13178
12625
|
value: function processResponseStream(stream) {
|
|
@@ -13183,6 +12630,30 @@
|
|
|
13183
12630
|
return DefaultChatTransport;
|
|
13184
12631
|
}(HttpChatTransport);
|
|
13185
12632
|
|
|
12633
|
+
function sendChatMessageFeedback(param) {
|
|
12634
|
+
var agentId = param.agentId, vote = param.vote, messageId = param.messageId, appId = param.appId, apiKey = param.apiKey;
|
|
12635
|
+
return fetch("https://".concat(appId, ".algolia.net/agent-studio/1/feedback"), {
|
|
12636
|
+
method: 'POST',
|
|
12637
|
+
body: JSON.stringify({
|
|
12638
|
+
messageId: messageId,
|
|
12639
|
+
agentId: agentId,
|
|
12640
|
+
vote: vote
|
|
12641
|
+
}),
|
|
12642
|
+
headers: {
|
|
12643
|
+
'x-algolia-application-id': appId,
|
|
12644
|
+
'x-algolia-api-key': apiKey,
|
|
12645
|
+
'content-type': 'application/json'
|
|
12646
|
+
}
|
|
12647
|
+
}).then(function(response) {
|
|
12648
|
+
if (response.status >= 300) {
|
|
12649
|
+
return response.json().then(function(data) {
|
|
12650
|
+
throw new Error("Feedback request failed with status ".concat(response.status, ": ").concat(data.message));
|
|
12651
|
+
});
|
|
12652
|
+
}
|
|
12653
|
+
return response.json();
|
|
12654
|
+
});
|
|
12655
|
+
}
|
|
12656
|
+
|
|
13186
12657
|
/**
|
|
13187
12658
|
* Clears the refinements of a SearchParameters object based on rules provided.
|
|
13188
12659
|
* The included attributes list is applied before the excluded attributes list. If the list
|
|
@@ -13357,7 +12828,7 @@
|
|
|
13357
12828
|
}));
|
|
13358
12829
|
if (params.facetFilters) {
|
|
13359
12830
|
var attributes = flat(params.facetFilters).map(function(filter) {
|
|
13360
|
-
var _filter_split =
|
|
12831
|
+
var _filter_split = _sliced_to_array(filter.split(':'), 2), attribute = _filter_split[0], value = _filter_split[1];
|
|
13361
12832
|
return {
|
|
13362
12833
|
attribute: attribute,
|
|
13363
12834
|
value: value
|
|
@@ -13388,7 +12859,7 @@
|
|
|
13388
12859
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
13389
12860
|
checkRendering(renderFn, withUsage$m());
|
|
13390
12861
|
return function(widgetParams) {
|
|
13391
|
-
var _ref = widgetParams || {}, _ref_resume = _ref.resume, resume = _ref_resume === void 0 ? false : _ref_resume, _ref_tools = _ref.tools, tools = _ref_tools === void 0 ? {} : _ref_tools, _ref_type = _ref.type, type = _ref_type === void 0 ? 'chat' : _ref_type, options =
|
|
12862
|
+
var _ref = widgetParams || {}, _ref_resume = _ref.resume, resume = _ref_resume === void 0 ? false : _ref_resume, _ref_tools = _ref.tools, tools = _ref_tools === void 0 ? {} : _ref_tools, _ref_type = _ref.type, type = _ref_type === void 0 ? 'chat' : _ref_type, options = _object_without_properties(_ref, [
|
|
13392
12863
|
"resume",
|
|
13393
12864
|
"tools",
|
|
13394
12865
|
"type"
|
|
@@ -13402,11 +12873,15 @@
|
|
|
13402
12873
|
var setOpen;
|
|
13403
12874
|
var focusInput;
|
|
13404
12875
|
var setIsClearing;
|
|
12876
|
+
var setFeedbackState;
|
|
13405
12877
|
var agentId = 'agentId' in options ? options.agentId : undefined;
|
|
12878
|
+
var feedbackState = {};
|
|
12879
|
+
var _sendChatMessageFeedback;
|
|
12880
|
+
var feedbackAbortController;
|
|
13406
12881
|
// Extract suggestions from the last assistant message's data-suggestions part
|
|
13407
12882
|
var getSuggestionsFromMessages = function getSuggestionsFromMessages(messages) {
|
|
13408
12883
|
// Find the last assistant message (iterate from end)
|
|
13409
|
-
var lastAssistantMessage =
|
|
12884
|
+
var lastAssistantMessage = _to_consumable_array(messages).reverse().find(function(message) {
|
|
13410
12885
|
return message.role === 'assistant' && message.parts;
|
|
13411
12886
|
});
|
|
13412
12887
|
if (!(lastAssistantMessage === null || lastAssistantMessage === void 0 ? void 0 : lastAssistantMessage.parts)) {
|
|
@@ -13434,16 +12909,17 @@
|
|
|
13434
12909
|
var onClearTransitionEnd = function onClearTransitionEnd() {
|
|
13435
12910
|
setMessages([]);
|
|
13436
12911
|
_chatInstance.clearError();
|
|
12912
|
+
feedbackState = {};
|
|
13437
12913
|
setIsClearing(false);
|
|
13438
12914
|
};
|
|
13439
12915
|
var makeChatInstance = function makeChatInstance(instantSearchInstance) {
|
|
13440
12916
|
var transport;
|
|
13441
|
-
var _getAppIdAndApiKey =
|
|
12917
|
+
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(instantSearchInstance.client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
|
|
13442
12918
|
// Filter out custom data parts (like data-suggestions) that the backend doesn't accept
|
|
13443
12919
|
var filterDataParts = function filterDataParts(messages) {
|
|
13444
12920
|
return messages.map(function(message) {
|
|
13445
12921
|
var _message_parts;
|
|
13446
|
-
return
|
|
12922
|
+
return _object_spread_props(_object_spread({}, message), {
|
|
13447
12923
|
parts: (_message_parts = message.parts) === null || _message_parts === void 0 ? void 0 : _message_parts.filter(function(part) {
|
|
13448
12924
|
return !('type' in part && part.type.startsWith('data-'));
|
|
13449
12925
|
})
|
|
@@ -13452,17 +12928,17 @@
|
|
|
13452
12928
|
};
|
|
13453
12929
|
if ('transport' in options && options.transport) {
|
|
13454
12930
|
var originalPrepare = options.transport.prepareSendMessagesRequest;
|
|
13455
|
-
transport = new DefaultChatTransport(
|
|
12931
|
+
transport = new DefaultChatTransport(_object_spread_props(_object_spread({}, options.transport), {
|
|
13456
12932
|
prepareSendMessagesRequest: function prepareSendMessagesRequest(params) {
|
|
13457
12933
|
// Call the original prepareSendMessagesRequest if it exists,
|
|
13458
12934
|
// otherwise construct the default body
|
|
13459
12935
|
var preparedOrPromise = originalPrepare ? originalPrepare(params) : {
|
|
13460
|
-
body:
|
|
12936
|
+
body: _object_spread({}, params)
|
|
13461
12937
|
};
|
|
13462
12938
|
// Then filter out data-* parts
|
|
13463
12939
|
var applyFilter = function applyFilter(prepared) {
|
|
13464
|
-
return
|
|
13465
|
-
body:
|
|
12940
|
+
return _object_spread_props(_object_spread({}, prepared), {
|
|
12941
|
+
body: _object_spread_props(_object_spread({}, prepared.body), {
|
|
13466
12942
|
messages: filterDataParts(prepared.body.messages)
|
|
13467
12943
|
})
|
|
13468
12944
|
});
|
|
@@ -13488,14 +12964,14 @@
|
|
|
13488
12964
|
'x-algolia-agent': getAlgoliaAgent(instantSearchInstance.client)
|
|
13489
12965
|
},
|
|
13490
12966
|
prepareSendMessagesRequest: function prepareSendMessagesRequest(_0) {
|
|
13491
|
-
var messages = _0.messages, trigger = _0.trigger, rest =
|
|
12967
|
+
var messages = _0.messages, trigger = _0.trigger, rest = _object_without_properties(_0, [
|
|
13492
12968
|
"messages",
|
|
13493
12969
|
"trigger"
|
|
13494
12970
|
]);
|
|
13495
12971
|
return {
|
|
13496
12972
|
// Bypass cache when regenerating to ensure fresh responses
|
|
13497
12973
|
api: trigger === 'regenerate-message' ? "".concat(baseApi, "&cache=false") : baseApi,
|
|
13498
|
-
body:
|
|
12974
|
+
body: _object_spread_props(_object_spread({}, rest), {
|
|
13499
12975
|
messages: filterDataParts(messages)
|
|
13500
12976
|
})
|
|
13501
12977
|
};
|
|
@@ -13508,7 +12984,7 @@
|
|
|
13508
12984
|
if ('chat' in options) {
|
|
13509
12985
|
return options.chat;
|
|
13510
12986
|
}
|
|
13511
|
-
return new Chat(
|
|
12987
|
+
return new Chat(_object_spread_props(_object_spread({}, options), {
|
|
13512
12988
|
transport: transport,
|
|
13513
12989
|
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
|
|
13514
12990
|
onToolCall: function onToolCall(param) {
|
|
@@ -13534,7 +13010,7 @@
|
|
|
13534
13010
|
toolCallId: toolCall.toolCallId
|
|
13535
13011
|
});
|
|
13536
13012
|
};
|
|
13537
|
-
return tool.onToolCall(
|
|
13013
|
+
return tool.onToolCall(_object_spread_props(_object_spread({}, toolCall), {
|
|
13538
13014
|
addToolResult: addToolResult
|
|
13539
13015
|
}));
|
|
13540
13016
|
}
|
|
@@ -13549,7 +13025,7 @@
|
|
|
13549
13025
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
13550
13026
|
_chatInstance = makeChatInstance(instantSearchInstance);
|
|
13551
13027
|
var render = function render() {
|
|
13552
|
-
renderFn(
|
|
13028
|
+
renderFn(_object_spread_props(_object_spread({}, _this.getWidgetRenderState(initOptions)), {
|
|
13553
13029
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
13554
13030
|
}), false);
|
|
13555
13031
|
};
|
|
@@ -13568,28 +13044,55 @@
|
|
|
13568
13044
|
isClearing = value;
|
|
13569
13045
|
render();
|
|
13570
13046
|
};
|
|
13047
|
+
setFeedbackState = function setFeedbackState(messageId, state) {
|
|
13048
|
+
feedbackState = _object_spread_props(_object_spread({}, feedbackState), _define_property({}, messageId, state));
|
|
13049
|
+
render();
|
|
13050
|
+
};
|
|
13051
|
+
var feedback = 'feedback' in options ? options.feedback : undefined;
|
|
13052
|
+
if (agentId && feedback) {
|
|
13053
|
+
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(initOptions.instantSearchInstance.client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
|
|
13054
|
+
if (!appId || !apiKey) {
|
|
13055
|
+
throw new Error(withUsage$m('Could not extract Algolia credentials from the search client.'));
|
|
13056
|
+
}
|
|
13057
|
+
feedbackAbortController = new AbortController();
|
|
13058
|
+
_sendChatMessageFeedback = function _sendChatMessageFeedback(messageId, vote) {
|
|
13059
|
+
if (feedbackState[messageId] !== undefined) {
|
|
13060
|
+
return;
|
|
13061
|
+
}
|
|
13062
|
+
setFeedbackState(messageId, 'sending');
|
|
13063
|
+
sendChatMessageFeedback({
|
|
13064
|
+
agentId: agentId,
|
|
13065
|
+
vote: vote,
|
|
13066
|
+
messageId: messageId,
|
|
13067
|
+
appId: appId,
|
|
13068
|
+
apiKey: apiKey
|
|
13069
|
+
}).finally(function() {
|
|
13070
|
+
setFeedbackState(messageId, vote);
|
|
13071
|
+
});
|
|
13072
|
+
};
|
|
13073
|
+
}
|
|
13571
13074
|
_chatInstance['~registerErrorCallback'](render);
|
|
13572
13075
|
_chatInstance['~registerMessagesCallback'](render);
|
|
13573
13076
|
_chatInstance['~registerStatusCallback'](render);
|
|
13574
13077
|
if (resume) {
|
|
13575
13078
|
_chatInstance.resumeStream();
|
|
13576
13079
|
}
|
|
13577
|
-
renderFn(
|
|
13080
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
13578
13081
|
instantSearchInstance: instantSearchInstance
|
|
13579
13082
|
}), true);
|
|
13580
13083
|
},
|
|
13581
13084
|
render: function render(renderOptions) {
|
|
13582
|
-
renderFn(
|
|
13085
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
13583
13086
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
13584
13087
|
}), false);
|
|
13585
13088
|
},
|
|
13586
13089
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
13587
|
-
return
|
|
13090
|
+
return _object_spread_props(_object_spread({}, renderState), _define_property({}, type, this.getWidgetRenderState(renderOptions)));
|
|
13588
13091
|
},
|
|
13589
13092
|
getWidgetRenderState: function getWidgetRenderState(renderOptions) {
|
|
13590
13093
|
var instantSearchInstance = renderOptions.instantSearchInstance, parent = renderOptions.parent, helper = renderOptions.helper;
|
|
13591
13094
|
if (!_chatInstance) {
|
|
13592
|
-
this.init(
|
|
13095
|
+
this.init(_object_spread_props(_object_spread({}, renderOptions), {
|
|
13593
13096
|
uiState: {},
|
|
13594
13097
|
results: undefined
|
|
13595
13098
|
}));
|
|
@@ -13606,8 +13109,8 @@
|
|
|
13606
13109
|
}
|
|
13607
13110
|
var toolsWithAddToolResult = {};
|
|
13608
13111
|
Object.entries(tools).forEach(function(param) {
|
|
13609
|
-
var _param =
|
|
13610
|
-
var toolWithAddToolResult =
|
|
13112
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], tool = _param[1];
|
|
13113
|
+
var toolWithAddToolResult = _object_spread_props(_object_spread({}, tool), {
|
|
13611
13114
|
addToolResult: _chatInstance.addToolResult,
|
|
13612
13115
|
applyFilters: applyFilters
|
|
13613
13116
|
});
|
|
@@ -13628,6 +13131,8 @@
|
|
|
13628
13131
|
clearMessages: clearMessages,
|
|
13629
13132
|
onClearTransitionEnd: onClearTransitionEnd,
|
|
13630
13133
|
tools: toolsWithAddToolResult,
|
|
13134
|
+
sendChatMessageFeedback: _sendChatMessageFeedback,
|
|
13135
|
+
feedbackState: feedbackState,
|
|
13631
13136
|
widgetParams: widgetParams,
|
|
13632
13137
|
// Chat instance render state
|
|
13633
13138
|
addToolResult: _chatInstance.addToolResult,
|
|
@@ -13643,6 +13148,7 @@
|
|
|
13643
13148
|
};
|
|
13644
13149
|
},
|
|
13645
13150
|
dispose: function dispose() {
|
|
13151
|
+
feedbackAbortController === null || feedbackAbortController === void 0 ? void 0 : feedbackAbortController.abort();
|
|
13646
13152
|
unmountFn();
|
|
13647
13153
|
},
|
|
13648
13154
|
shouldRender: function shouldRender() {
|
|
@@ -13692,13 +13198,13 @@
|
|
|
13692
13198
|
$$type: 'ais.clearRefinements',
|
|
13693
13199
|
init: function init(initOptions) {
|
|
13694
13200
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
13695
|
-
renderFn(
|
|
13201
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
13696
13202
|
instantSearchInstance: instantSearchInstance
|
|
13697
13203
|
}), true);
|
|
13698
13204
|
},
|
|
13699
13205
|
render: function render(renderOptions) {
|
|
13700
13206
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
13701
|
-
renderFn(
|
|
13207
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
13702
13208
|
instantSearchInstance: instantSearchInstance
|
|
13703
13209
|
}), false);
|
|
13704
13210
|
},
|
|
@@ -13706,7 +13212,7 @@
|
|
|
13706
13212
|
unmountFn();
|
|
13707
13213
|
},
|
|
13708
13214
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
13709
|
-
return
|
|
13215
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
13710
13216
|
clearRefinements: this.getWidgetRenderState(renderOptions)
|
|
13711
13217
|
});
|
|
13712
13218
|
},
|
|
@@ -13731,7 +13237,7 @@
|
|
|
13731
13237
|
});
|
|
13732
13238
|
};
|
|
13733
13239
|
connectorState.createURL = function() {
|
|
13734
|
-
return createURL(mergeSearchParameters.apply(void 0,
|
|
13240
|
+
return createURL(mergeSearchParameters.apply(void 0, _to_consumable_array(connectorState.attributesToClear.map(function(param) {
|
|
13735
13241
|
var indexHelper = param.helper, items = param.items;
|
|
13736
13242
|
return clearRefinements({
|
|
13737
13243
|
helper: indexHelper,
|
|
@@ -13796,13 +13302,13 @@
|
|
|
13796
13302
|
$$type: 'ais.currentRefinements',
|
|
13797
13303
|
init: function init(initOptions) {
|
|
13798
13304
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
13799
|
-
renderFn(
|
|
13305
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
13800
13306
|
instantSearchInstance: instantSearchInstance
|
|
13801
13307
|
}), true);
|
|
13802
13308
|
},
|
|
13803
13309
|
render: function render(renderOptions) {
|
|
13804
13310
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
13805
|
-
renderFn(
|
|
13311
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
13806
13312
|
instantSearchInstance: instantSearchInstance
|
|
13807
13313
|
}), false);
|
|
13808
13314
|
},
|
|
@@ -13810,7 +13316,7 @@
|
|
|
13810
13316
|
unmountFn();
|
|
13811
13317
|
},
|
|
13812
13318
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
13813
|
-
return
|
|
13319
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
13814
13320
|
currentRefinements: this.getWidgetRenderState(renderOptions)
|
|
13815
13321
|
});
|
|
13816
13322
|
},
|
|
@@ -13866,7 +13372,7 @@
|
|
|
13866
13372
|
};
|
|
13867
13373
|
var items = getRefinements(results, helper.state, includesQuery).map(normalizeRefinement).filter(filterFunction);
|
|
13868
13374
|
return items.reduce(function(allItems, currentItem) {
|
|
13869
|
-
return
|
|
13375
|
+
return _to_consumable_array(allItems.filter(function(item) {
|
|
13870
13376
|
return item.attribute !== currentItem.attribute;
|
|
13871
13377
|
})).concat([
|
|
13872
13378
|
{
|
|
@@ -13957,7 +13463,7 @@
|
|
|
13957
13463
|
|
|
13958
13464
|
function addAbsolutePosition(hits, page, hitsPerPage) {
|
|
13959
13465
|
return hits.map(function(hit, idx) {
|
|
13960
|
-
return
|
|
13466
|
+
return _object_spread_props(_object_spread({}, hit), {
|
|
13961
13467
|
__position: hitsPerPage * page + idx + 1
|
|
13962
13468
|
});
|
|
13963
13469
|
});
|
|
@@ -13968,7 +13474,7 @@
|
|
|
13968
13474
|
return hits;
|
|
13969
13475
|
}
|
|
13970
13476
|
return hits.map(function(hit) {
|
|
13971
|
-
return
|
|
13477
|
+
return _object_spread_props(_object_spread({}, hit), {
|
|
13972
13478
|
__queryID: queryID
|
|
13973
13479
|
});
|
|
13974
13480
|
});
|
|
@@ -13993,13 +13499,13 @@
|
|
|
13993
13499
|
dependsOn: 'recommend',
|
|
13994
13500
|
$$type: 'ais.frequentlyBoughtTogether',
|
|
13995
13501
|
init: function init(initOptions) {
|
|
13996
|
-
renderFn(
|
|
13502
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
13997
13503
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
13998
13504
|
}), true);
|
|
13999
13505
|
},
|
|
14000
13506
|
render: function render(renderOptions) {
|
|
14001
13507
|
var renderState = this.getWidgetRenderState(renderOptions);
|
|
14002
|
-
renderFn(
|
|
13508
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
14003
13509
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
14004
13510
|
}), false);
|
|
14005
13511
|
},
|
|
@@ -14049,8 +13555,8 @@
|
|
|
14049
13555
|
maxRecommendations: limit,
|
|
14050
13556
|
threshold: threshold,
|
|
14051
13557
|
// @ts-expect-error until @algolia/recommend types are updated
|
|
14052
|
-
fallbackParameters: fallbackParameters ?
|
|
14053
|
-
queryParameters:
|
|
13558
|
+
fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
|
|
13559
|
+
queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
14054
13560
|
$$id: _this.$$id
|
|
14055
13561
|
});
|
|
14056
13562
|
}, state.removeParams(this.$$id));
|
|
@@ -14077,7 +13583,7 @@
|
|
|
14077
13583
|
};
|
|
14078
13584
|
}
|
|
14079
13585
|
function insideBoundingBoxArrayToBoundingBox(value) {
|
|
14080
|
-
var _value =
|
|
13586
|
+
var _value = _sliced_to_array(value, 1), tmp = _value[0], _ref = _sliced_to_array(tmp === void 0 ? [
|
|
14081
13587
|
undefined,
|
|
14082
13588
|
undefined,
|
|
14083
13589
|
undefined,
|
|
@@ -14100,7 +13606,7 @@
|
|
|
14100
13606
|
};
|
|
14101
13607
|
}
|
|
14102
13608
|
function insideBoundingBoxStringToBoundingBox(value) {
|
|
14103
|
-
var _value_split_map =
|
|
13609
|
+
var _value_split_map = _sliced_to_array(value.split(',').map(parseFloat), 4), neLat = _value_split_map[0], neLng = _value_split_map[1], swLat = _value_split_map[2], swLng = _value_split_map[3];
|
|
14104
13610
|
// Since the value provided is the one send with the request, the API should
|
|
14105
13611
|
// throw an error due to the wrong format. So throw an error should be safe.
|
|
14106
13612
|
if (!neLat || !neLng || !swLat || !swLng) {
|
|
@@ -14229,7 +13735,7 @@
|
|
|
14229
13735
|
var isFirstRendering = true;
|
|
14230
13736
|
widgetState.internalToggleRefineOnMapMove = createInternalToggleRefinementOnMapMove(initArgs, noop);
|
|
14231
13737
|
widgetState.internalSetMapMoveSinceLastRefine = createInternalSetMapMoveSinceLastRefine(initArgs, noop);
|
|
14232
|
-
renderFn(
|
|
13738
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initArgs)), {
|
|
14233
13739
|
instantSearchInstance: instantSearchInstance
|
|
14234
13740
|
}), isFirstRendering);
|
|
14235
13741
|
},
|
|
@@ -14250,7 +13756,7 @@
|
|
|
14250
13756
|
widgetState.internalSetMapMoveSinceLastRefine = createInternalSetMapMoveSinceLastRefine(renderArgs, this.render.bind(this));
|
|
14251
13757
|
var widgetRenderState = this.getWidgetRenderState(renderArgs);
|
|
14252
13758
|
sendEvent('view:internal', widgetRenderState.items);
|
|
14253
|
-
renderFn(
|
|
13759
|
+
renderFn(_object_spread_props(_object_spread({}, widgetRenderState), {
|
|
14254
13760
|
instantSearchInstance: instantSearchInstance
|
|
14255
13761
|
}), isFirstRendering);
|
|
14256
13762
|
},
|
|
@@ -14285,7 +13791,7 @@
|
|
|
14285
13791
|
};
|
|
14286
13792
|
},
|
|
14287
13793
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
14288
|
-
return
|
|
13794
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14289
13795
|
geoSearch: this.getWidgetRenderState(renderOptions)
|
|
14290
13796
|
});
|
|
14291
13797
|
},
|
|
@@ -14300,7 +13806,7 @@
|
|
|
14300
13806
|
if (!boundingBox || uiState && uiState.geoSearch && uiState.geoSearch.boundingBox === boundingBox) {
|
|
14301
13807
|
return uiState;
|
|
14302
13808
|
}
|
|
14303
|
-
return
|
|
13809
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
14304
13810
|
geoSearch: {
|
|
14305
13811
|
boundingBox: boundingBox
|
|
14306
13812
|
}
|
|
@@ -14337,10 +13843,10 @@
|
|
|
14337
13843
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
14338
13844
|
args[_key] = arguments[_key];
|
|
14339
13845
|
}
|
|
14340
|
-
var _args =
|
|
14341
|
-
var _args__split =
|
|
13846
|
+
var _args = _sliced_to_array(args, 4), facetValue = _args[1], tmp = _args[2], eventName = tmp === void 0 ? 'Filter Applied' : tmp, tmp1 = _args[3], additionalData = tmp1 === void 0 ? {} : tmp1;
|
|
13847
|
+
var _args__split = _sliced_to_array(args[0].split(':'), 2), eventType = _args__split[0], eventModifier = _args__split[1];
|
|
14342
13848
|
var attribute = typeof attr === 'string' ? attr : attr(facetValue);
|
|
14343
|
-
if (args.length === 1 &&
|
|
13849
|
+
if (args.length === 1 && _type_of(args[0]) === 'object') {
|
|
14344
13850
|
instantSearchInstance.sendEventToInsights(args[0]);
|
|
14345
13851
|
} else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
|
|
14346
13852
|
if (!isFacetRefined(helper, attribute, facetValue)) {
|
|
@@ -14351,7 +13857,7 @@
|
|
|
14351
13857
|
widgetType: widgetType,
|
|
14352
13858
|
eventType: eventType,
|
|
14353
13859
|
eventModifier: eventModifier,
|
|
14354
|
-
payload:
|
|
13860
|
+
payload: _object_spread({
|
|
14355
13861
|
eventName: eventName,
|
|
14356
13862
|
index: ((_helper_lastResults = helper.lastResults) === null || _helper_lastResults === void 0 ? void 0 : _helper_lastResults.index) || helper.state.index,
|
|
14357
13863
|
filters: [
|
|
@@ -14401,7 +13907,7 @@
|
|
|
14401
13907
|
// we need to provide a hierarchicalFacet name for the search state
|
|
14402
13908
|
// so that we can always map $hierarchicalFacetName => real attributes
|
|
14403
13909
|
// we use the first attribute name
|
|
14404
|
-
var _attributes =
|
|
13910
|
+
var _attributes = _sliced_to_array(attributes, 1), hierarchicalFacetName = _attributes[0];
|
|
14405
13911
|
var sendEvent;
|
|
14406
13912
|
// Provide the same function to the `renderFn` so that way the user
|
|
14407
13913
|
// has to only bind it once when `isFirstRendering` for instance
|
|
@@ -14424,13 +13930,13 @@
|
|
|
14424
13930
|
return facetValues.slice(0, getLimit()).map(function(_0) {
|
|
14425
13931
|
var label = _0.name, value = _0.escapedValue, data = _0.data;
|
|
14426
13932
|
_0.path;
|
|
14427
|
-
var subValue =
|
|
13933
|
+
var subValue = _object_without_properties(_0, [
|
|
14428
13934
|
"name",
|
|
14429
13935
|
"escapedValue",
|
|
14430
13936
|
"data",
|
|
14431
13937
|
"path"
|
|
14432
13938
|
]);
|
|
14433
|
-
var item =
|
|
13939
|
+
var item = _object_spread_props(_object_spread({}, subValue), {
|
|
14434
13940
|
value: value,
|
|
14435
13941
|
label: label,
|
|
14436
13942
|
data: null
|
|
@@ -14456,14 +13962,14 @@
|
|
|
14456
13962
|
$$type: 'ais.hierarchicalMenu',
|
|
14457
13963
|
init: function init(initOptions) {
|
|
14458
13964
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
14459
|
-
renderFn(
|
|
13965
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
14460
13966
|
instantSearchInstance: instantSearchInstance
|
|
14461
13967
|
}), true);
|
|
14462
13968
|
},
|
|
14463
13969
|
render: function render(renderOptions) {
|
|
14464
13970
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
14465
13971
|
toggleShowMore = createToggleShowMore(renderOptions, this);
|
|
14466
|
-
renderFn(
|
|
13972
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
14467
13973
|
instantSearchInstance: instantSearchInstance
|
|
14468
13974
|
}), false);
|
|
14469
13975
|
},
|
|
@@ -14473,8 +13979,8 @@
|
|
|
14473
13979
|
return state.removeHierarchicalFacet(hierarchicalFacetName).setQueryParameter('maxValuesPerFacet', undefined);
|
|
14474
13980
|
},
|
|
14475
13981
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
14476
|
-
return
|
|
14477
|
-
hierarchicalMenu:
|
|
13982
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
13983
|
+
hierarchicalMenu: _object_spread_props(_object_spread({}, renderState.hierarchicalMenu), _define_property({}, hierarchicalFacetName, this.getWidgetRenderState(renderOptions)))
|
|
14478
13984
|
});
|
|
14479
13985
|
},
|
|
14480
13986
|
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
@@ -14538,8 +14044,8 @@
|
|
|
14538
14044
|
getWidgetUiState: function getWidgetUiState(uiState, param) {
|
|
14539
14045
|
var searchParameters = param.searchParameters;
|
|
14540
14046
|
var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
14541
|
-
return removeEmptyRefinementsFromUiState$3(
|
|
14542
|
-
hierarchicalMenu:
|
|
14047
|
+
return removeEmptyRefinementsFromUiState$3(_object_spread_props(_object_spread({}, uiState), {
|
|
14048
|
+
hierarchicalMenu: _object_spread_props(_object_spread({}, uiState.hierarchicalMenu), _define_property({}, hierarchicalFacetName, path))
|
|
14543
14049
|
}), hierarchicalFacetName);
|
|
14544
14050
|
},
|
|
14545
14051
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
@@ -14563,7 +14069,7 @@
|
|
|
14563
14069
|
var withMaxValuesPerFacet = withFacetConfiguration.setQueryParameter('maxValuesPerFacet', nextMaxValuesPerFacet);
|
|
14564
14070
|
if (!values) {
|
|
14565
14071
|
return withMaxValuesPerFacet.setQueryParameters({
|
|
14566
|
-
hierarchicalFacetsRefinements:
|
|
14072
|
+
hierarchicalFacetsRefinements: _object_spread_props(_object_spread({}, withMaxValuesPerFacet.hierarchicalFacetsRefinements), _define_property({}, hierarchicalFacetName, []))
|
|
14567
14073
|
});
|
|
14568
14074
|
}
|
|
14569
14075
|
return withMaxValuesPerFacet.addHierarchicalFacetRefinement(hierarchicalFacetName, values.join(separator));
|
|
@@ -14604,19 +14110,19 @@
|
|
|
14604
14110
|
return {
|
|
14605
14111
|
$$type: 'ais.hits',
|
|
14606
14112
|
init: function init(initOptions) {
|
|
14607
|
-
renderFn(
|
|
14113
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
14608
14114
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
14609
14115
|
}), true);
|
|
14610
14116
|
},
|
|
14611
14117
|
render: function render(renderOptions) {
|
|
14612
14118
|
var renderState = this.getWidgetRenderState(renderOptions);
|
|
14613
|
-
renderFn(
|
|
14119
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
14614
14120
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
14615
14121
|
}), false);
|
|
14616
14122
|
renderState.sendEvent('view:internal', renderState.items);
|
|
14617
14123
|
},
|
|
14618
14124
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
14619
|
-
return
|
|
14125
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14620
14126
|
hits: this.getWidgetRenderState(renderOptions)
|
|
14621
14127
|
});
|
|
14622
14128
|
},
|
|
@@ -14674,7 +14180,7 @@
|
|
|
14674
14180
|
return state;
|
|
14675
14181
|
}
|
|
14676
14182
|
return state.setQueryParameters(Object.keys(TAG_PLACEHOLDER).reduce(function(acc, key) {
|
|
14677
|
-
return
|
|
14183
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, undefined));
|
|
14678
14184
|
}, {}));
|
|
14679
14185
|
},
|
|
14680
14186
|
getWidgetSearchParameters: function getWidgetSearchParameters(state, _uiState) {
|
|
@@ -14720,7 +14226,7 @@
|
|
|
14720
14226
|
var normalizeItems = function normalizeItems(param) {
|
|
14721
14227
|
var hitsPerPage = param.hitsPerPage;
|
|
14722
14228
|
return items.map(function(item) {
|
|
14723
|
-
return
|
|
14229
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
14724
14230
|
isRefined: Number(item.value) === Number(hitsPerPage)
|
|
14725
14231
|
});
|
|
14726
14232
|
});
|
|
@@ -14757,15 +14263,15 @@
|
|
|
14757
14263
|
value: '',
|
|
14758
14264
|
label: ''
|
|
14759
14265
|
}
|
|
14760
|
-
].concat(
|
|
14266
|
+
].concat(_to_consumable_array(items));
|
|
14761
14267
|
}
|
|
14762
|
-
renderFn(
|
|
14268
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
14763
14269
|
instantSearchInstance: instantSearchInstance
|
|
14764
14270
|
}), true);
|
|
14765
14271
|
},
|
|
14766
14272
|
render: function render(initOptions) {
|
|
14767
14273
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
14768
|
-
renderFn(
|
|
14274
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
14769
14275
|
instantSearchInstance: instantSearchInstance
|
|
14770
14276
|
}), false);
|
|
14771
14277
|
},
|
|
@@ -14775,7 +14281,7 @@
|
|
|
14775
14281
|
return state.setQueryParameter('hitsPerPage', undefined);
|
|
14776
14282
|
},
|
|
14777
14283
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
14778
|
-
return
|
|
14284
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14779
14285
|
hitsPerPage: this.getWidgetRenderState(renderOptions)
|
|
14780
14286
|
});
|
|
14781
14287
|
},
|
|
@@ -14804,7 +14310,7 @@
|
|
|
14804
14310
|
if (hitsPerPage === undefined || hitsPerPage === defaultItem.value) {
|
|
14805
14311
|
return uiState;
|
|
14806
14312
|
}
|
|
14807
|
-
return
|
|
14313
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
14808
14314
|
hitsPerPage: hitsPerPage
|
|
14809
14315
|
});
|
|
14810
14316
|
},
|
|
@@ -14840,7 +14346,7 @@
|
|
|
14840
14346
|
function getStateWithoutPage(state) {
|
|
14841
14347
|
var _ref = state || {};
|
|
14842
14348
|
_ref.page;
|
|
14843
|
-
var rest =
|
|
14349
|
+
var rest = _object_without_properties(_ref, [
|
|
14844
14350
|
"page"
|
|
14845
14351
|
]);
|
|
14846
14352
|
return rest;
|
|
@@ -14849,7 +14355,7 @@
|
|
|
14849
14355
|
var _ref = state || {};
|
|
14850
14356
|
_ref.clickAnalytics;
|
|
14851
14357
|
_ref.userToken;
|
|
14852
|
-
var rest =
|
|
14358
|
+
var rest = _object_without_properties(_ref, [
|
|
14853
14359
|
"clickAnalytics",
|
|
14854
14360
|
"userToken"
|
|
14855
14361
|
]);
|
|
@@ -14897,7 +14403,7 @@
|
|
|
14897
14403
|
var _Math;
|
|
14898
14404
|
return (_Math = Math).min.apply(_Math, [
|
|
14899
14405
|
page
|
|
14900
|
-
].concat(
|
|
14406
|
+
].concat(_to_consumable_array(pages)));
|
|
14901
14407
|
}
|
|
14902
14408
|
};
|
|
14903
14409
|
var getLastReceivedPage = function getLastReceivedPage(state, cachedHits) {
|
|
@@ -14909,7 +14415,7 @@
|
|
|
14909
14415
|
var _Math;
|
|
14910
14416
|
return (_Math = Math).max.apply(_Math, [
|
|
14911
14417
|
page
|
|
14912
|
-
].concat(
|
|
14418
|
+
].concat(_to_consumable_array(pages)));
|
|
14913
14419
|
}
|
|
14914
14420
|
};
|
|
14915
14421
|
var getShowPrevious = function getShowPrevious(helper, getCachedHits) {
|
|
@@ -14917,7 +14423,7 @@
|
|
|
14917
14423
|
var cachedHits = getCachedHits();
|
|
14918
14424
|
// Using the helper's `overrideStateWithoutTriggeringChangeEvent` method
|
|
14919
14425
|
// avoid updating the browser URL when the user displays the previous page.
|
|
14920
|
-
helper.overrideStateWithoutTriggeringChangeEvent(
|
|
14426
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_object_spread_props(_object_spread({}, helper.state), {
|
|
14921
14427
|
page: getFirstReceivedPage(helper.state, cachedHits) - 1
|
|
14922
14428
|
})).searchWithoutTriggeringOnStateChange();
|
|
14923
14429
|
};
|
|
@@ -14931,20 +14437,20 @@
|
|
|
14931
14437
|
return {
|
|
14932
14438
|
$$type: 'ais.infiniteHits',
|
|
14933
14439
|
init: function init(initOptions) {
|
|
14934
|
-
renderFn(
|
|
14440
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
14935
14441
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
14936
14442
|
}), true);
|
|
14937
14443
|
},
|
|
14938
14444
|
render: function render(renderOptions) {
|
|
14939
14445
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
14940
14446
|
var widgetRenderState = this.getWidgetRenderState(renderOptions);
|
|
14941
|
-
renderFn(
|
|
14447
|
+
renderFn(_object_spread_props(_object_spread({}, widgetRenderState), {
|
|
14942
14448
|
instantSearchInstance: instantSearchInstance
|
|
14943
14449
|
}), false);
|
|
14944
14450
|
sendEvent('view:internal', widgetRenderState.currentPageHits);
|
|
14945
14451
|
},
|
|
14946
14452
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
14947
|
-
return
|
|
14453
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14948
14454
|
infiniteHits: this.getWidgetRenderState(renderOptions)
|
|
14949
14455
|
});
|
|
14950
14456
|
},
|
|
@@ -15048,7 +14554,7 @@
|
|
|
15048
14554
|
return stateWithoutPage;
|
|
15049
14555
|
}
|
|
15050
14556
|
return stateWithoutPage.setQueryParameters(Object.keys(TAG_PLACEHOLDER).reduce(function(acc, key) {
|
|
15051
|
-
return
|
|
14557
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, undefined));
|
|
15052
14558
|
}, {}));
|
|
15053
14559
|
},
|
|
15054
14560
|
getWidgetUiState: function getWidgetUiState(uiState, param) {
|
|
@@ -15059,7 +14565,7 @@
|
|
|
15059
14565
|
// because we don't want `page=1` in the URL
|
|
15060
14566
|
return uiState;
|
|
15061
14567
|
}
|
|
15062
|
-
return
|
|
14568
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
15063
14569
|
// The page in the UI state is incremented by one
|
|
15064
14570
|
// to expose the user value (not `0`).
|
|
15065
14571
|
page: page + 1
|
|
@@ -15137,13 +14643,13 @@
|
|
|
15137
14643
|
$$type: 'ais.menu',
|
|
15138
14644
|
init: function init(initOptions) {
|
|
15139
14645
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
15140
|
-
renderFn(
|
|
14646
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
15141
14647
|
instantSearchInstance: instantSearchInstance
|
|
15142
14648
|
}), true);
|
|
15143
14649
|
},
|
|
15144
14650
|
render: function render(renderOptions) {
|
|
15145
14651
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
15146
|
-
renderFn(
|
|
14652
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
15147
14653
|
instantSearchInstance: instantSearchInstance
|
|
15148
14654
|
}), false);
|
|
15149
14655
|
},
|
|
@@ -15153,8 +14659,8 @@
|
|
|
15153
14659
|
return state.removeHierarchicalFacet(attribute).setQueryParameter('maxValuesPerFacet', undefined);
|
|
15154
14660
|
},
|
|
15155
14661
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
15156
|
-
return
|
|
15157
|
-
menu:
|
|
14662
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14663
|
+
menu: _object_spread_props(_object_spread({}, renderState.menu), _define_property({}, attribute, this.getWidgetRenderState(renderOptions)))
|
|
15158
14664
|
});
|
|
15159
14665
|
},
|
|
15160
14666
|
getWidgetRenderState: function getWidgetRenderState(renderOptions) {
|
|
@@ -15182,7 +14688,7 @@
|
|
|
15182
14688
|
}
|
|
15183
14689
|
if (!_refine) {
|
|
15184
14690
|
_refine = function _refine(facetValue) {
|
|
15185
|
-
var _helper_getHierarchicalFacetBreadcrumb =
|
|
14691
|
+
var _helper_getHierarchicalFacetBreadcrumb = _sliced_to_array(helper.getHierarchicalFacetBreadcrumb(attribute), 1), refinedItem = _helper_getHierarchicalFacetBreadcrumb[0];
|
|
15186
14692
|
sendEvent('click:internal', facetValue ? facetValue : refinedItem);
|
|
15187
14693
|
helper.toggleFacetRefinement(attribute, facetValue ? facetValue : refinedItem).search();
|
|
15188
14694
|
};
|
|
@@ -15200,12 +14706,12 @@
|
|
|
15200
14706
|
items = transformItems(facetItems.slice(0, getLimit()).map(function(_0) {
|
|
15201
14707
|
var label = _0.name, value = _0.escapedValue;
|
|
15202
14708
|
_0.path;
|
|
15203
|
-
var item =
|
|
14709
|
+
var item = _object_without_properties(_0, [
|
|
15204
14710
|
"name",
|
|
15205
14711
|
"escapedValue",
|
|
15206
14712
|
"path"
|
|
15207
14713
|
]);
|
|
15208
|
-
return
|
|
14714
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
15209
14715
|
label: label,
|
|
15210
14716
|
value: value
|
|
15211
14717
|
});
|
|
@@ -15227,9 +14733,9 @@
|
|
|
15227
14733
|
},
|
|
15228
14734
|
getWidgetUiState: function getWidgetUiState(uiState, param) {
|
|
15229
14735
|
var searchParameters = param.searchParameters;
|
|
15230
|
-
var _searchParameters_getHierarchicalFacetBreadcrumb =
|
|
15231
|
-
return removeEmptyRefinementsFromUiState$2(
|
|
15232
|
-
menu:
|
|
14736
|
+
var _searchParameters_getHierarchicalFacetBreadcrumb = _sliced_to_array(searchParameters.getHierarchicalFacetBreadcrumb(attribute), 1), value = _searchParameters_getHierarchicalFacetBreadcrumb[0];
|
|
14737
|
+
return removeEmptyRefinementsFromUiState$2(_object_spread_props(_object_spread({}, uiState), {
|
|
14738
|
+
menu: _object_spread_props(_object_spread({}, uiState.menu), _define_property({}, attribute, value))
|
|
15233
14739
|
}), attribute);
|
|
15234
14740
|
},
|
|
15235
14741
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
@@ -15249,7 +14755,7 @@
|
|
|
15249
14755
|
var withMaxValuesPerFacet = withFacetConfiguration.setQueryParameter('maxValuesPerFacet', nextMaxValuesPerFacet);
|
|
15250
14756
|
if (!value) {
|
|
15251
14757
|
return withMaxValuesPerFacet.setQueryParameters({
|
|
15252
|
-
hierarchicalFacetsRefinements:
|
|
14758
|
+
hierarchicalFacetsRefinements: _object_spread_props(_object_spread({}, withMaxValuesPerFacet.hierarchicalFacetsRefinements), _define_property({}, attribute, []))
|
|
15253
14759
|
});
|
|
15254
14760
|
}
|
|
15255
14761
|
return withMaxValuesPerFacet.addHierarchicalFacetRefinement(attribute, value);
|
|
@@ -15334,13 +14840,13 @@
|
|
|
15334
14840
|
$$type: $$type$2,
|
|
15335
14841
|
init: function init(initOptions) {
|
|
15336
14842
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
15337
|
-
renderFn(
|
|
14843
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
15338
14844
|
instantSearchInstance: instantSearchInstance
|
|
15339
14845
|
}), true);
|
|
15340
14846
|
},
|
|
15341
14847
|
render: function render(renderOptions) {
|
|
15342
14848
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
15343
|
-
renderFn(
|
|
14849
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
15344
14850
|
instantSearchInstance: instantSearchInstance
|
|
15345
14851
|
}), false);
|
|
15346
14852
|
},
|
|
@@ -15354,21 +14860,21 @@
|
|
|
15354
14860
|
var values = searchParameters.getNumericRefinements(attribute);
|
|
15355
14861
|
var equal = values['='] && values['='][0];
|
|
15356
14862
|
if (equal || equal === 0) {
|
|
15357
|
-
return
|
|
15358
|
-
numericMenu:
|
|
14863
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
14864
|
+
numericMenu: _object_spread_props(_object_spread({}, uiState.numericMenu), _define_property({}, attribute, "".concat(values['='])))
|
|
15359
14865
|
});
|
|
15360
14866
|
}
|
|
15361
14867
|
var min = values['>='] && values['>='][0] || '';
|
|
15362
14868
|
var max = values['<='] && values['<='][0] || '';
|
|
15363
|
-
return removeEmptyRefinementsFromUiState$1(
|
|
15364
|
-
numericMenu:
|
|
14869
|
+
return removeEmptyRefinementsFromUiState$1(_object_spread_props(_object_spread({}, uiState), {
|
|
14870
|
+
numericMenu: _object_spread_props(_object_spread({}, uiState.numericMenu), _define_property({}, attribute, "".concat(min, ":").concat(max)))
|
|
15365
14871
|
}), attribute);
|
|
15366
14872
|
},
|
|
15367
14873
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
15368
14874
|
var uiState = param.uiState;
|
|
15369
14875
|
var value = uiState.numericMenu && uiState.numericMenu[attribute];
|
|
15370
14876
|
var withoutRefinements = searchParameters.setQueryParameters({
|
|
15371
|
-
numericRefinements:
|
|
14877
|
+
numericRefinements: _object_spread_props(_object_spread({}, searchParameters.numericRefinements), _define_property({}, attribute, {}))
|
|
15372
14878
|
});
|
|
15373
14879
|
if (!value) {
|
|
15374
14880
|
return withoutRefinements;
|
|
@@ -15377,14 +14883,14 @@
|
|
|
15377
14883
|
if (isExact) {
|
|
15378
14884
|
return withoutRefinements.addNumericRefinement(attribute, '=', Number(value));
|
|
15379
14885
|
}
|
|
15380
|
-
var _value_split_map =
|
|
14886
|
+
var _value_split_map = _sliced_to_array(value.split(':').map(parseFloat), 2), min = _value_split_map[0], max = _value_split_map[1];
|
|
15381
14887
|
var withMinRefinement = isFiniteNumber(min) ? withoutRefinements.addNumericRefinement(attribute, '>=', min) : withoutRefinements;
|
|
15382
14888
|
var withMaxRefinement = isFiniteNumber(max) ? withMinRefinement.addNumericRefinement(attribute, '<=', max) : withMinRefinement;
|
|
15383
14889
|
return withMaxRefinement;
|
|
15384
14890
|
},
|
|
15385
14891
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
15386
|
-
return
|
|
15387
|
-
numericMenu:
|
|
14892
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14893
|
+
numericMenu: _object_spread_props(_object_spread({}, renderState.numericMenu), _define_property({}, attribute, this.getWidgetRenderState(renderOptions)))
|
|
15388
14894
|
});
|
|
15389
14895
|
},
|
|
15390
14896
|
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
@@ -15420,7 +14926,7 @@
|
|
|
15420
14926
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
15421
14927
|
try {
|
|
15422
14928
|
// @TODO avoid for..of for polyfill reasons
|
|
15423
|
-
// eslint-disable-next-line no-
|
|
14929
|
+
// eslint-disable-next-line instantsearch/no-for-of
|
|
15424
14930
|
for(var _iterator = preparedItems[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
15425
14931
|
var item = _step.value;
|
|
15426
14932
|
if (item.isRefined && decodeURI(item.value) !== '{}') {
|
|
@@ -15522,7 +15028,8 @@
|
|
|
15522
15028
|
return resolvedState;
|
|
15523
15029
|
}
|
|
15524
15030
|
function hasNumericRefinement(currentRefinements, operator, value) {
|
|
15525
|
-
|
|
15031
|
+
var refinements = currentRefinements[operator];
|
|
15032
|
+
return refinements !== undefined && refinements.includes(value);
|
|
15526
15033
|
}
|
|
15527
15034
|
function removeEmptyRefinementsFromUiState$1(indexUiState, attribute) {
|
|
15528
15035
|
if (!indexUiState.numericMenu) {
|
|
@@ -15551,22 +15058,22 @@
|
|
|
15551
15058
|
// { start: 1, end: 5000, step: 500 }
|
|
15552
15059
|
// => Array length = (5000 - 1) / 500 = 9.998
|
|
15553
15060
|
var arrayLength = Math.round((end - start) / limitStep);
|
|
15554
|
-
return
|
|
15061
|
+
return _to_consumable_array(Array(arrayLength)).map(function(_, current) {
|
|
15555
15062
|
return start + current * limitStep;
|
|
15556
15063
|
});
|
|
15557
15064
|
}
|
|
15558
15065
|
|
|
15559
15066
|
var Paginator = /*#__PURE__*/ function() {
|
|
15560
15067
|
function Paginator(params) {
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15068
|
+
_class_call_check(this, Paginator);
|
|
15069
|
+
_define_property(this, "currentPage", void 0);
|
|
15070
|
+
_define_property(this, "total", void 0);
|
|
15071
|
+
_define_property(this, "padding", void 0);
|
|
15565
15072
|
this.currentPage = params.currentPage;
|
|
15566
15073
|
this.total = params.total;
|
|
15567
15074
|
this.padding = params.padding;
|
|
15568
15075
|
}
|
|
15569
|
-
|
|
15076
|
+
_create_class(Paginator, [
|
|
15570
15077
|
{
|
|
15571
15078
|
key: "pages",
|
|
15572
15079
|
value: function pages() {
|
|
@@ -15653,13 +15160,13 @@
|
|
|
15653
15160
|
$$type: 'ais.pagination',
|
|
15654
15161
|
init: function init(initOptions) {
|
|
15655
15162
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
15656
|
-
renderFn(
|
|
15163
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
15657
15164
|
instantSearchInstance: instantSearchInstance
|
|
15658
15165
|
}), true);
|
|
15659
15166
|
},
|
|
15660
15167
|
render: function render(renderOptions) {
|
|
15661
15168
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
15662
|
-
renderFn(
|
|
15169
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
15663
15170
|
instantSearchInstance: instantSearchInstance
|
|
15664
15171
|
}), false);
|
|
15665
15172
|
},
|
|
@@ -15674,7 +15181,7 @@
|
|
|
15674
15181
|
if (!page) {
|
|
15675
15182
|
return uiState;
|
|
15676
15183
|
}
|
|
15677
|
-
return
|
|
15184
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
15678
15185
|
page: page + 1
|
|
15679
15186
|
});
|
|
15680
15187
|
},
|
|
@@ -15694,7 +15201,7 @@
|
|
|
15694
15201
|
if (!connectorState.createURL) {
|
|
15695
15202
|
connectorState.createURL = function(page) {
|
|
15696
15203
|
return createURL(function(uiState) {
|
|
15697
|
-
return
|
|
15204
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
15698
15205
|
page: page + 1
|
|
15699
15206
|
});
|
|
15700
15207
|
});
|
|
@@ -15720,7 +15227,7 @@
|
|
|
15720
15227
|
};
|
|
15721
15228
|
},
|
|
15722
15229
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
15723
|
-
return
|
|
15230
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
15724
15231
|
pagination: this.getWidgetRenderState(renderOptions)
|
|
15725
15232
|
});
|
|
15726
15233
|
}
|
|
@@ -15782,7 +15289,7 @@
|
|
|
15782
15289
|
});
|
|
15783
15290
|
var getTrackedFacetValues = trackedFilters[facetName];
|
|
15784
15291
|
var trackedFacetValues = getTrackedFacetValues(facetRefinements);
|
|
15785
|
-
return
|
|
15292
|
+
return _to_consumable_array(facets).concat(_to_consumable_array(facetRefinements.filter(function(facetRefinement) {
|
|
15786
15293
|
return trackedFacetValues.includes(facetRefinement);
|
|
15787
15294
|
}).map(function(facetValue) {
|
|
15788
15295
|
return escapeRuleContext("ais-".concat(facetName, "-").concat(facetValue));
|
|
@@ -15799,10 +15306,10 @@
|
|
|
15799
15306
|
sharedHelperState: sharedHelperState,
|
|
15800
15307
|
trackedFilters: trackedFilters
|
|
15801
15308
|
});
|
|
15802
|
-
var nextRuleContexts =
|
|
15309
|
+
var nextRuleContexts = _to_consumable_array(initialRuleContexts).concat(_to_consumable_array(newRuleContexts));
|
|
15803
15310
|
var ruleContexts = transformRuleContexts(nextRuleContexts).slice(0, 10);
|
|
15804
15311
|
if (!isEqual(previousRuleContexts, ruleContexts)) {
|
|
15805
|
-
helper.overrideStateWithoutTriggeringChangeEvent(
|
|
15312
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_object_spread_props(_object_spread({}, sharedHelperState), {
|
|
15806
15313
|
ruleContexts: ruleContexts
|
|
15807
15314
|
}));
|
|
15808
15315
|
}
|
|
@@ -15851,13 +15358,13 @@
|
|
|
15851
15358
|
// any `ruleContexts` needed based on the `trackedFilters`.
|
|
15852
15359
|
helper.on('change', onHelperChange);
|
|
15853
15360
|
}
|
|
15854
|
-
render(
|
|
15361
|
+
render(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
15855
15362
|
instantSearchInstance: instantSearchInstance
|
|
15856
15363
|
}), true);
|
|
15857
15364
|
},
|
|
15858
15365
|
render: function render1(renderOptions) {
|
|
15859
15366
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
15860
|
-
render(
|
|
15367
|
+
render(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
15861
15368
|
instantSearchInstance: instantSearchInstance
|
|
15862
15369
|
}), false);
|
|
15863
15370
|
},
|
|
@@ -15873,7 +15380,7 @@
|
|
|
15873
15380
|
};
|
|
15874
15381
|
},
|
|
15875
15382
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
15876
|
-
return
|
|
15383
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
15877
15384
|
queryRules: this.getWidgetRenderState(renderOptions)
|
|
15878
15385
|
});
|
|
15879
15386
|
},
|
|
@@ -15942,8 +15449,8 @@
|
|
|
15942
15449
|
var getRefinedState = function getRefinedState(helper, currentRange, nextMin, nextMax) {
|
|
15943
15450
|
var resolvedState = helper.state;
|
|
15944
15451
|
var currentRangeMin = currentRange.min, currentRangeMax = currentRange.max;
|
|
15945
|
-
var _ref =
|
|
15946
|
-
var _ref1 =
|
|
15452
|
+
var _ref = _sliced_to_array(resolvedState.getNumericRefinement(attribute, '>=') || [], 1), min = _ref[0];
|
|
15453
|
+
var _ref1 = _sliced_to_array(resolvedState.getNumericRefinement(attribute, '<=') || [], 1), max = _ref1[0];
|
|
15947
15454
|
var isResetMin = nextMin === undefined || nextMin === '';
|
|
15948
15455
|
var isResetMax = nextMax === undefined || nextMax === '';
|
|
15949
15456
|
var _toPrecision = toPrecision({
|
|
@@ -16022,8 +15529,8 @@
|
|
|
16022
15529
|
});
|
|
16023
15530
|
}
|
|
16024
15531
|
function _getCurrentRefinement(helper) {
|
|
16025
|
-
var _ref =
|
|
16026
|
-
var _ref1 =
|
|
15532
|
+
var _ref = _sliced_to_array(helper.getNumericRefinement(attribute, '>=') || [], 1), minValue = _ref[0];
|
|
15533
|
+
var _ref1 = _sliced_to_array(helper.getNumericRefinement(attribute, '<=') || [], 1), maxValue = _ref1[0];
|
|
16027
15534
|
var min = isFiniteNumber(minValue) ? minValue : -Infinity;
|
|
16028
15535
|
var max = isFiniteNumber(maxValue) ? maxValue : Infinity;
|
|
16029
15536
|
return [
|
|
@@ -16033,7 +15540,7 @@
|
|
|
16033
15540
|
}
|
|
16034
15541
|
function _refine(helper, currentRange) {
|
|
16035
15542
|
return function() {
|
|
16036
|
-
var _ref =
|
|
15543
|
+
var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [
|
|
16037
15544
|
undefined,
|
|
16038
15545
|
undefined
|
|
16039
15546
|
], 2), nextMin = _ref[0], nextMax = _ref[1];
|
|
@@ -16046,18 +15553,18 @@
|
|
|
16046
15553
|
return {
|
|
16047
15554
|
$$type: $$type$1,
|
|
16048
15555
|
init: function init(initOptions) {
|
|
16049
|
-
renderFn(
|
|
15556
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16050
15557
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
16051
15558
|
}), true);
|
|
16052
15559
|
},
|
|
16053
15560
|
render: function render(renderOptions) {
|
|
16054
|
-
renderFn(
|
|
15561
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16055
15562
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
16056
15563
|
}), false);
|
|
16057
15564
|
},
|
|
16058
15565
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16059
|
-
return
|
|
16060
|
-
range:
|
|
15566
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
15567
|
+
range: _object_spread_props(_object_spread({}, renderState.range), _define_property({}, attribute, this.getWidgetRenderState(renderOptions)))
|
|
16061
15568
|
});
|
|
16062
15569
|
},
|
|
16063
15570
|
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
@@ -16090,7 +15597,7 @@
|
|
|
16090
15597
|
format: rangeFormatter,
|
|
16091
15598
|
range: currentRange,
|
|
16092
15599
|
sendEvent: createSendEvent(instantSearchInstance),
|
|
16093
|
-
widgetParams:
|
|
15600
|
+
widgetParams: _object_spread_props(_object_spread({}, widgetParams), {
|
|
16094
15601
|
precision: precision
|
|
16095
15602
|
}),
|
|
16096
15603
|
start: start
|
|
@@ -16107,14 +15614,14 @@
|
|
|
16107
15614
|
if (min.length === 0 && max.length === 0) {
|
|
16108
15615
|
return uiState;
|
|
16109
15616
|
}
|
|
16110
|
-
return
|
|
16111
|
-
range:
|
|
15617
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
15618
|
+
range: _object_spread_props(_object_spread({}, uiState.range), _define_property({}, attribute, "".concat(min, ":").concat(max)))
|
|
16112
15619
|
});
|
|
16113
15620
|
},
|
|
16114
15621
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
16115
15622
|
var uiState = param.uiState;
|
|
16116
15623
|
var widgetSearchParameters = searchParameters.addDisjunctiveFacet(attribute).setQueryParameters({
|
|
16117
|
-
numericRefinements:
|
|
15624
|
+
numericRefinements: _object_spread_props(_object_spread({}, searchParameters.numericRefinements), _define_property({}, attribute, {}))
|
|
16118
15625
|
});
|
|
16119
15626
|
if (isFiniteNumber(minBound)) {
|
|
16120
15627
|
widgetSearchParameters = widgetSearchParameters.addNumericRefinement(attribute, '>=', minBound);
|
|
@@ -16126,7 +15633,7 @@
|
|
|
16126
15633
|
if (!value || value.indexOf(':') === -1) {
|
|
16127
15634
|
return widgetSearchParameters;
|
|
16128
15635
|
}
|
|
16129
|
-
var _value_split_map =
|
|
15636
|
+
var _value_split_map = _sliced_to_array(value.split(':').map(parseFloat), 2), lowerBound = _value_split_map[0], upperBound = _value_split_map[1];
|
|
16130
15637
|
if (isFiniteNumber(lowerBound) && (!isFiniteNumber(minBound) || minBound < lowerBound)) {
|
|
16131
15638
|
widgetSearchParameters = widgetSearchParameters.removeNumericRefinement(attribute, '>=');
|
|
16132
15639
|
widgetSearchParameters = widgetSearchParameters.addNumericRefinement(attribute, '>=', lowerBound);
|
|
@@ -16182,11 +15689,11 @@
|
|
|
16182
15689
|
throw new Error(withUsage$8('`showMoreLimit` should be greater than `limit`.'));
|
|
16183
15690
|
}
|
|
16184
15691
|
var formatItems = function formatItems(_0) {
|
|
16185
|
-
var label = _0.name, value = _0.escapedValue, item =
|
|
15692
|
+
var label = _0.name, value = _0.escapedValue, item = _object_without_properties(_0, [
|
|
16186
15693
|
"name",
|
|
16187
15694
|
"escapedValue"
|
|
16188
15695
|
]);
|
|
16189
|
-
return
|
|
15696
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
16190
15697
|
value: value,
|
|
16191
15698
|
label: label,
|
|
16192
15699
|
highlighted: label
|
|
@@ -16222,7 +15729,7 @@
|
|
|
16222
15729
|
var instantSearchInstance = renderOptions.instantSearchInstance, searchResults = renderOptions.results;
|
|
16223
15730
|
if (query === '' && lastItemsFromMainSearch) {
|
|
16224
15731
|
// render with previous data from the helper.
|
|
16225
|
-
renderFn(
|
|
15732
|
+
renderFn(_object_spread_props(_object_spread({}, widget.getWidgetRenderState(_object_spread_props(_object_spread({}, renderOptions), {
|
|
16226
15733
|
results: lastResultsFromMainSearch
|
|
16227
15734
|
}))), {
|
|
16228
15735
|
instantSearchInstance: instantSearchInstance
|
|
@@ -16237,18 +15744,18 @@
|
|
|
16237
15744
|
Math.min(getLimit(), 100), tags).then(function(results) {
|
|
16238
15745
|
var facetValues = escapeFacetValues ? escapeFacets(results.facetHits) : results.facetHits;
|
|
16239
15746
|
var normalizedFacetValues = transformItems(facetValues.map(function(_0) {
|
|
16240
|
-
var escapedValue = _0.escapedValue, value = _0.value, item =
|
|
15747
|
+
var escapedValue = _0.escapedValue, value = _0.value, item = _object_without_properties(_0, [
|
|
16241
15748
|
"escapedValue",
|
|
16242
15749
|
"value"
|
|
16243
15750
|
]);
|
|
16244
|
-
return
|
|
15751
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
16245
15752
|
value: escapedValue,
|
|
16246
15753
|
label: value
|
|
16247
15754
|
});
|
|
16248
15755
|
}), {
|
|
16249
15756
|
results: searchResults
|
|
16250
15757
|
});
|
|
16251
|
-
renderFn(
|
|
15758
|
+
renderFn(_object_spread_props(_object_spread({}, widget.getWidgetRenderState(_object_spread_props(_object_spread({}, renderOptions), {
|
|
16252
15759
|
results: lastResultsFromMainSearch
|
|
16253
15760
|
}))), {
|
|
16254
15761
|
items: normalizedFacetValues,
|
|
@@ -16265,18 +15772,18 @@
|
|
|
16265
15772
|
return {
|
|
16266
15773
|
$$type: 'ais.refinementList',
|
|
16267
15774
|
init: function init(initOptions) {
|
|
16268
|
-
renderFn(
|
|
15775
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16269
15776
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
16270
15777
|
}), true);
|
|
16271
15778
|
},
|
|
16272
15779
|
render: function render(renderOptions) {
|
|
16273
|
-
renderFn(
|
|
15780
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16274
15781
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
16275
15782
|
}), false);
|
|
16276
15783
|
},
|
|
16277
15784
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16278
|
-
return
|
|
16279
|
-
refinementList:
|
|
15785
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
15786
|
+
refinementList: _object_spread_props(_object_spread({}, renderState.refinementList), _define_property({}, attribute, this.getWidgetRenderState(renderOptions)))
|
|
16280
15787
|
});
|
|
16281
15788
|
},
|
|
16282
15789
|
getWidgetRenderState: function getWidgetRenderState(renderOptions) {
|
|
@@ -16361,8 +15868,8 @@
|
|
|
16361
15868
|
getWidgetUiState: function getWidgetUiState(uiState, param) {
|
|
16362
15869
|
var searchParameters = param.searchParameters;
|
|
16363
15870
|
var values = operator === 'or' ? searchParameters.getDisjunctiveRefinements(attribute) : searchParameters.getConjunctiveRefinements(attribute);
|
|
16364
|
-
return removeEmptyRefinementsFromUiState(
|
|
16365
|
-
refinementList:
|
|
15871
|
+
return removeEmptyRefinementsFromUiState(_object_spread_props(_object_spread({}, uiState), {
|
|
15872
|
+
refinementList: _object_spread_props(_object_spread({}, uiState.refinementList), _define_property({}, attribute, values))
|
|
16366
15873
|
}), attribute);
|
|
16367
15874
|
},
|
|
16368
15875
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
@@ -16381,7 +15888,7 @@
|
|
|
16381
15888
|
var withMaxValuesPerFacet = withFacetConfiguration.setQueryParameter('maxValuesPerFacet', nextMaxValuesPerFacet);
|
|
16382
15889
|
if (!values) {
|
|
16383
15890
|
var key = isDisjunctive ? 'disjunctiveFacetsRefinements' : 'facetsRefinements';
|
|
16384
|
-
return withMaxValuesPerFacet.setQueryParameters(
|
|
15891
|
+
return withMaxValuesPerFacet.setQueryParameters(_define_property({}, key, _object_spread_props(_object_spread({}, withMaxValuesPerFacet[key]), _define_property({}, attribute, []))));
|
|
16385
15892
|
}
|
|
16386
15893
|
return values.reduce(function(parameters, value) {
|
|
16387
15894
|
return isDisjunctive ? parameters.addDisjunctiveFacetRefinement(attribute, value) : parameters.addFacetRefinement(attribute, value);
|
|
@@ -16426,13 +15933,13 @@
|
|
|
16426
15933
|
dependsOn: 'recommend',
|
|
16427
15934
|
$$type: 'ais.relatedProducts',
|
|
16428
15935
|
init: function init(initOptions) {
|
|
16429
|
-
renderFn(
|
|
15936
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16430
15937
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
16431
15938
|
}), true);
|
|
16432
15939
|
},
|
|
16433
15940
|
render: function render(renderOptions) {
|
|
16434
15941
|
var renderState = this.getWidgetRenderState(renderOptions);
|
|
16435
|
-
renderFn(
|
|
15942
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
16436
15943
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
16437
15944
|
}), false);
|
|
16438
15945
|
},
|
|
@@ -16481,8 +15988,8 @@
|
|
|
16481
15988
|
objectID: objectID,
|
|
16482
15989
|
maxRecommendations: limit,
|
|
16483
15990
|
threshold: threshold,
|
|
16484
|
-
fallbackParameters: fallbackParameters ?
|
|
16485
|
-
queryParameters:
|
|
15991
|
+
fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
|
|
15992
|
+
queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
16486
15993
|
$$id: _this.$$id
|
|
16487
15994
|
});
|
|
16488
15995
|
}, state.removeParams(this.$$id));
|
|
@@ -16518,13 +16025,13 @@
|
|
|
16518
16025
|
$$type: 'ais.searchBox',
|
|
16519
16026
|
init: function init(initOptions) {
|
|
16520
16027
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
16521
|
-
renderFn(
|
|
16028
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16522
16029
|
instantSearchInstance: instantSearchInstance
|
|
16523
16030
|
}), true);
|
|
16524
16031
|
},
|
|
16525
16032
|
render: function render(renderOptions) {
|
|
16526
16033
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
16527
|
-
renderFn(
|
|
16034
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16528
16035
|
instantSearchInstance: instantSearchInstance
|
|
16529
16036
|
}), false);
|
|
16530
16037
|
},
|
|
@@ -16534,7 +16041,7 @@
|
|
|
16534
16041
|
return state.setQueryParameter('query', undefined);
|
|
16535
16042
|
},
|
|
16536
16043
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16537
|
-
return
|
|
16044
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
16538
16045
|
searchBox: this.getWidgetRenderState(renderOptions)
|
|
16539
16046
|
});
|
|
16540
16047
|
},
|
|
@@ -16564,7 +16071,7 @@
|
|
|
16564
16071
|
if (query === '' || uiState && uiState.query === query) {
|
|
16565
16072
|
return uiState;
|
|
16566
16073
|
}
|
|
16567
|
-
return
|
|
16074
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
16568
16075
|
query: query
|
|
16569
16076
|
});
|
|
16570
16077
|
},
|
|
@@ -16640,13 +16147,13 @@
|
|
|
16640
16147
|
find(items, function(item) {
|
|
16641
16148
|
return getItemValue(item) === currentIndex;
|
|
16642
16149
|
});
|
|
16643
|
-
renderFn(
|
|
16150
|
+
renderFn(_object_spread_props(_object_spread({}, widgetRenderState), {
|
|
16644
16151
|
instantSearchInstance: instantSearchInstance
|
|
16645
16152
|
}), true);
|
|
16646
16153
|
},
|
|
16647
16154
|
render: function render(renderOptions) {
|
|
16648
16155
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
16649
|
-
renderFn(
|
|
16156
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16650
16157
|
instantSearchInstance: instantSearchInstance
|
|
16651
16158
|
}), false);
|
|
16652
16159
|
},
|
|
@@ -16664,7 +16171,7 @@
|
|
|
16664
16171
|
return state;
|
|
16665
16172
|
},
|
|
16666
16173
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16667
|
-
return
|
|
16174
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
16668
16175
|
sortBy: this.getWidgetRenderState(renderOptions)
|
|
16669
16176
|
});
|
|
16670
16177
|
},
|
|
@@ -16722,7 +16229,7 @@
|
|
|
16722
16229
|
// In composition mode with an active strategy, use sortBy parameter
|
|
16723
16230
|
// Otherwise use index-based behavior (traditional mode)
|
|
16724
16231
|
var currentValue = connectorState.isUsingComposition && isValidStrategy(connectorState.itemsLookup, searchParameters.sortBy) ? searchParameters.sortBy : searchParameters.index;
|
|
16725
|
-
return
|
|
16232
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
16726
16233
|
sortBy: currentValue !== connectorState.initialValue ? currentValue : undefined
|
|
16727
16234
|
});
|
|
16728
16235
|
},
|
|
@@ -16758,13 +16265,13 @@
|
|
|
16758
16265
|
$$type: 'ais.stats',
|
|
16759
16266
|
init: function init(initOptions) {
|
|
16760
16267
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
16761
|
-
renderFn(
|
|
16268
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16762
16269
|
instantSearchInstance: instantSearchInstance
|
|
16763
16270
|
}), true);
|
|
16764
16271
|
},
|
|
16765
16272
|
render: function render(renderOptions) {
|
|
16766
16273
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
16767
|
-
renderFn(
|
|
16274
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16768
16275
|
instantSearchInstance: instantSearchInstance
|
|
16769
16276
|
}), false);
|
|
16770
16277
|
},
|
|
@@ -16772,7 +16279,7 @@
|
|
|
16772
16279
|
unmountFn();
|
|
16773
16280
|
},
|
|
16774
16281
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16775
|
-
return
|
|
16282
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
16776
16283
|
stats: this.getWidgetRenderState(renderOptions)
|
|
16777
16284
|
});
|
|
16778
16285
|
},
|
|
@@ -16826,8 +16333,8 @@
|
|
|
16826
16333
|
instantSearchInstance.sendEventToInsights(args[0]);
|
|
16827
16334
|
return;
|
|
16828
16335
|
}
|
|
16829
|
-
var _args =
|
|
16830
|
-
var _args__split =
|
|
16336
|
+
var _args = _sliced_to_array(args, 3), isRefined = _args[1], tmp = _args[2], eventName = tmp === void 0 ? 'Filter Applied' : tmp;
|
|
16337
|
+
var _args__split = _sliced_to_array(args[0].split(':'), 2), eventType = _args__split[0], eventModifier = _args__split[1];
|
|
16831
16338
|
if (eventType !== 'click' || on === undefined) {
|
|
16832
16339
|
return;
|
|
16833
16340
|
}
|
|
@@ -16932,13 +16439,13 @@
|
|
|
16932
16439
|
$$type: $$type,
|
|
16933
16440
|
init: function init(initOptions) {
|
|
16934
16441
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
16935
|
-
renderFn(
|
|
16442
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16936
16443
|
instantSearchInstance: instantSearchInstance
|
|
16937
16444
|
}), true);
|
|
16938
16445
|
},
|
|
16939
16446
|
render: function render(renderOptions) {
|
|
16940
16447
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
16941
|
-
renderFn(
|
|
16448
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16942
16449
|
instantSearchInstance: instantSearchInstance
|
|
16943
16450
|
}), false);
|
|
16944
16451
|
},
|
|
@@ -16948,8 +16455,8 @@
|
|
|
16948
16455
|
return state.removeDisjunctiveFacet(attribute);
|
|
16949
16456
|
},
|
|
16950
16457
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16951
|
-
return
|
|
16952
|
-
toggleRefinement:
|
|
16458
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
16459
|
+
toggleRefinement: _object_spread_props(_object_spread({}, renderState.toggleRefinement), _define_property({}, attribute, this.getWidgetRenderState(renderOptions)))
|
|
16953
16460
|
});
|
|
16954
16461
|
},
|
|
16955
16462
|
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
@@ -17046,8 +16553,8 @@
|
|
|
17046
16553
|
(_uiState_toggle = uiState.toggle) === null || _uiState_toggle === void 0 ? true : delete _uiState_toggle[attribute];
|
|
17047
16554
|
return uiState;
|
|
17048
16555
|
}
|
|
17049
|
-
return
|
|
17050
|
-
toggle:
|
|
16556
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
16557
|
+
toggle: _object_spread_props(_object_spread({}, uiState.toggle), _define_property({}, attribute, isRefined))
|
|
17051
16558
|
});
|
|
17052
16559
|
},
|
|
17053
16560
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
@@ -17076,7 +16583,7 @@
|
|
|
17076
16583
|
}
|
|
17077
16584
|
// It's not refined without an `off` value
|
|
17078
16585
|
return withFacetConfiguration.setQueryParameters({
|
|
17079
|
-
disjunctiveFacetsRefinements:
|
|
16586
|
+
disjunctiveFacetsRefinements: _object_spread_props(_object_spread({}, searchParameters.disjunctiveFacetsRefinements), _define_property({}, attribute, []))
|
|
17080
16587
|
});
|
|
17081
16588
|
}
|
|
17082
16589
|
};
|
|
@@ -17106,13 +16613,13 @@
|
|
|
17106
16613
|
dependsOn: 'recommend',
|
|
17107
16614
|
$$type: 'ais.trendingItems',
|
|
17108
16615
|
init: function init(initOptions) {
|
|
17109
|
-
renderFn(
|
|
16616
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
17110
16617
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
17111
16618
|
}), true);
|
|
17112
16619
|
},
|
|
17113
16620
|
render: function render(renderOptions) {
|
|
17114
16621
|
var renderState = this.getWidgetRenderState(renderOptions);
|
|
17115
|
-
renderFn(
|
|
16622
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
17116
16623
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
17117
16624
|
}), false);
|
|
17118
16625
|
},
|
|
@@ -17160,8 +16667,8 @@
|
|
|
17160
16667
|
facetValue: facetValue,
|
|
17161
16668
|
maxRecommendations: limit,
|
|
17162
16669
|
threshold: threshold,
|
|
17163
|
-
fallbackParameters: fallbackParameters ?
|
|
17164
|
-
queryParameters:
|
|
16670
|
+
fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
|
|
16671
|
+
queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
17165
16672
|
$$id: this.$$id
|
|
17166
16673
|
});
|
|
17167
16674
|
}
|
|
@@ -17192,13 +16699,13 @@
|
|
|
17192
16699
|
dependsOn: 'recommend',
|
|
17193
16700
|
$$type: 'ais.lookingSimilar',
|
|
17194
16701
|
init: function init(initOptions) {
|
|
17195
|
-
renderFn(
|
|
16702
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
17196
16703
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
17197
16704
|
}), true);
|
|
17198
16705
|
},
|
|
17199
16706
|
render: function render(renderOptions) {
|
|
17200
16707
|
var renderState = this.getWidgetRenderState(renderOptions);
|
|
17201
|
-
renderFn(
|
|
16708
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
17202
16709
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
17203
16710
|
}), false);
|
|
17204
16711
|
},
|
|
@@ -17247,8 +16754,8 @@
|
|
|
17247
16754
|
objectID: objectID,
|
|
17248
16755
|
maxRecommendations: limit,
|
|
17249
16756
|
threshold: threshold,
|
|
17250
|
-
fallbackParameters: fallbackParameters ?
|
|
17251
|
-
queryParameters:
|
|
16757
|
+
fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
|
|
16758
|
+
queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
17252
16759
|
$$id: _this.$$id
|
|
17253
16760
|
});
|
|
17254
16761
|
}, state.removeParams(this.$$id));
|
|
@@ -17309,21 +16816,21 @@
|
|
|
17309
16816
|
if (!(results === null || results === void 0 ? void 0 : (_results_hits = results.hits) === null || _results_hits === void 0 ? void 0 : _results_hits.length)) {
|
|
17310
16817
|
suggestions = [];
|
|
17311
16818
|
isLoading = false;
|
|
17312
|
-
renderFn(
|
|
16819
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(renderOptions)), {
|
|
17313
16820
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
17314
16821
|
}), false);
|
|
17315
16822
|
return;
|
|
17316
16823
|
}
|
|
17317
16824
|
var loadingStartTime = Date.now();
|
|
17318
16825
|
isLoading = true;
|
|
17319
|
-
renderFn(
|
|
16826
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(renderOptions)), {
|
|
17320
16827
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
17321
16828
|
}), false);
|
|
17322
16829
|
// Get facets from raw results (results.facets is processed differently)
|
|
17323
16830
|
var rawResults = results._rawResults;
|
|
17324
16831
|
var rawFacets = (rawResults === null || rawResults === void 0 ? void 0 : (_rawResults_ = rawResults[0]) === null || _rawResults_ === void 0 ? void 0 : _rawResults_.facets) || {};
|
|
17325
16832
|
var facetsToSend = attributes ? Object.fromEntries(Object.entries(rawFacets).filter(function(param) {
|
|
17326
|
-
var _param =
|
|
16833
|
+
var _param = _sliced_to_array(param, 1), key = _param[0];
|
|
17327
16834
|
return attributes.includes(key);
|
|
17328
16835
|
})) : rawFacets;
|
|
17329
16836
|
// Collect current refinements to exclude from suggestions
|
|
@@ -17359,7 +16866,7 @@
|
|
|
17359
16866
|
var finalPayload = (transport === null || transport === void 0 ? void 0 : transport.prepareSendMessagesRequest) ? transport.prepareSendMessagesRequest(payload).body : payload;
|
|
17360
16867
|
fetch(endpoint, {
|
|
17361
16868
|
method: 'POST',
|
|
17362
|
-
headers:
|
|
16869
|
+
headers: _object_spread_props(_object_spread({}, headers), {
|
|
17363
16870
|
'Content-Type': 'application/json'
|
|
17364
16871
|
}),
|
|
17365
16872
|
body: JSON.stringify(finalPayload)
|
|
@@ -17388,7 +16895,7 @@
|
|
|
17388
16895
|
var remainingDelay = Math.max(0, MIN_SKELETON_DURATION_MS - elapsed);
|
|
17389
16896
|
var finishLoading = function finishLoading() {
|
|
17390
16897
|
isLoading = false;
|
|
17391
|
-
renderFn(
|
|
16898
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(renderOptions)), {
|
|
17392
16899
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
17393
16900
|
}), false);
|
|
17394
16901
|
};
|
|
@@ -17410,7 +16917,7 @@
|
|
|
17410
16917
|
headers = transport.headers || {};
|
|
17411
16918
|
} else {
|
|
17412
16919
|
// Use default Algolia agent endpoint
|
|
17413
|
-
var _getAppIdAndApiKey =
|
|
16920
|
+
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(instantSearchInstance.client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
|
|
17414
16921
|
if (!appId || !apiKey) {
|
|
17415
16922
|
throw new Error(withUsage('Could not extract Algolia credentials from the search client.'));
|
|
17416
16923
|
}
|
|
@@ -17431,7 +16938,7 @@
|
|
|
17431
16938
|
helper.toggleFacetRefinement(attr, value);
|
|
17432
16939
|
helper.search();
|
|
17433
16940
|
};
|
|
17434
|
-
renderFn(
|
|
16941
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(initOptions)), {
|
|
17435
16942
|
instantSearchInstance: instantSearchInstance
|
|
17436
16943
|
}), true);
|
|
17437
16944
|
},
|
|
@@ -17440,7 +16947,7 @@
|
|
|
17440
16947
|
// Always store the latest render options
|
|
17441
16948
|
latestRenderOptions = renderOptions;
|
|
17442
16949
|
if (!results) {
|
|
17443
|
-
renderFn(
|
|
16950
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(renderOptions)), {
|
|
17444
16951
|
instantSearchInstance: instantSearchInstance
|
|
17445
16952
|
}), false);
|
|
17446
16953
|
return;
|
|
@@ -17457,7 +16964,7 @@
|
|
|
17457
16964
|
}
|
|
17458
16965
|
}, debounceMs);
|
|
17459
16966
|
}
|
|
17460
|
-
renderFn(
|
|
16967
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(renderOptions)), {
|
|
17461
16968
|
instantSearchInstance: instantSearchInstance
|
|
17462
16969
|
}), false);
|
|
17463
16970
|
},
|
|
@@ -17466,7 +16973,7 @@
|
|
|
17466
16973
|
unmountFn();
|
|
17467
16974
|
},
|
|
17468
16975
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
17469
|
-
return
|
|
16976
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
17470
16977
|
filterSuggestions: this.getWidgetRenderState(renderOptions)
|
|
17471
16978
|
});
|
|
17472
16979
|
},
|
|
@@ -17484,7 +16991,7 @@
|
|
|
17484
16991
|
function useSearchResults() {
|
|
17485
16992
|
var search = useInstantSearchContext();
|
|
17486
16993
|
var searchIndex = useIndexContext();
|
|
17487
|
-
var _useState = _sliced_to_array
|
|
16994
|
+
var _useState = _sliced_to_array(React.useState(function() {
|
|
17488
16995
|
var indexSearchResults = getIndexSearchResults(searchIndex);
|
|
17489
16996
|
// We do this not to leak `recommendResults` in the API.
|
|
17490
16997
|
return {
|
|
@@ -17532,11 +17039,11 @@
|
|
|
17532
17039
|
var search = useInstantSearchContext();
|
|
17533
17040
|
var searchIndex = useIndexContext();
|
|
17534
17041
|
var indexId = searchIndex.getIndexId();
|
|
17535
|
-
var _useState = _sliced_to_array
|
|
17042
|
+
var _useState = _sliced_to_array(React.useState(function() {
|
|
17536
17043
|
return search.getUiState();
|
|
17537
17044
|
}), 2), uiState = _useState[0], setLocalUiState = _useState[1];
|
|
17538
17045
|
var indexUiState = uiState[indexId];
|
|
17539
|
-
var _useState1 = _sliced_to_array
|
|
17046
|
+
var _useState1 = _sliced_to_array(React.useState(function() {
|
|
17540
17047
|
return search.renderState;
|
|
17541
17048
|
}), 2), renderState = _useState1[0], setRenderState = _useState1[1];
|
|
17542
17049
|
var indexRenderState = renderState[indexId] || {};
|
|
@@ -17665,7 +17172,7 @@
|
|
|
17665
17172
|
var requestParamsList;
|
|
17666
17173
|
var client = helper.getClient();
|
|
17667
17174
|
if (search.compositionID) {
|
|
17668
|
-
helper.setClient(
|
|
17175
|
+
helper.setClient(_object_spread_props(_object_spread({}, client), {
|
|
17669
17176
|
search: function search(query) {
|
|
17670
17177
|
requestParamsList = [
|
|
17671
17178
|
query.requestBody.params
|
|
@@ -17674,7 +17181,7 @@
|
|
|
17674
17181
|
}
|
|
17675
17182
|
}));
|
|
17676
17183
|
} else {
|
|
17677
|
-
helper.setClient(
|
|
17184
|
+
helper.setClient(_object_spread_props(_object_spread({}, client), {
|
|
17678
17185
|
search: function search(queries) {
|
|
17679
17186
|
requestParamsList = queries.map(function(param) {
|
|
17680
17187
|
var params = param.params;
|
|
@@ -17741,8 +17248,8 @@
|
|
|
17741
17248
|
var resultsCount = (searchResults === null || searchResults === void 0 ? void 0 : (_searchResults__rawResults = searchResults._rawResults) === null || _searchResults__rawResults === void 0 ? void 0 : _searchResults__rawResults.length) || 0;
|
|
17742
17249
|
var requestParams = resultsCount ? requestParamsList === null || requestParamsList === void 0 ? void 0 : requestParamsList.slice(requestParamsIndex, requestParamsIndex + resultsCount) : [];
|
|
17743
17250
|
requestParamsIndex += resultsCount;
|
|
17744
|
-
initialResults[widget.getIndexId()] =
|
|
17745
|
-
state:
|
|
17251
|
+
initialResults[widget.getIndexId()] = _object_spread({}, searchResults && {
|
|
17252
|
+
state: _object_spread_props(_object_spread({}, searchResults._state), {
|
|
17746
17253
|
clickAnalytics: requestParams === null || requestParams === void 0 ? void 0 : (_requestParams_ = requestParams[0]) === null || _requestParams_ === void 0 ? void 0 : _requestParams_.clickAnalytics,
|
|
17747
17254
|
userToken: requestParams === null || requestParams === void 0 ? void 0 : (_requestParams_1 = requestParams[0]) === null || _requestParams_1 === void 0 ? void 0 : _requestParams_1.userToken
|
|
17748
17255
|
}),
|