react-instantsearch-core 7.28.0 → 7.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +620 -1172
- package/dist/umd/ReactInstantSearchCore.min.js +3 -3
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearch Core 7.28.
|
|
1
|
+
/*! React InstantSearch Core 7.28.1 | © 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.28.
|
|
27
|
+
var version$2 = '7.28.1';
|
|
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 = {};
|
|
7846
|
-
|
|
7847
|
-
var hasRequired_get_prototype_of;
|
|
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
|
-
};
|
|
7550
|
+
function _assert_this_initialized(self) {
|
|
7551
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
7857
7552
|
|
|
7858
|
-
|
|
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;
|
|
7556
|
+
function _possible_constructor_return(self, call) {
|
|
7557
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
|
|
7871
7558
|
|
|
7872
|
-
|
|
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
|
-
}
|
|
7886
|
-
|
|
7887
|
-
_is_native_reflect_construct._ = _is_native_reflect_construct$1;
|
|
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;
|
|
7595
|
+
function _set_prototype_of(o, p) {
|
|
7596
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
7597
|
+
o.__proto__ = p;
|
|
8009
7598
|
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
hasRequired_set_prototype_of = 1;
|
|
8013
|
-
|
|
8014
|
-
function _set_prototype_of$1(o, p) {
|
|
8015
|
-
_set_prototype_of._ = _set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
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 = {};
|
|
9413
|
+
function _object_destructuring_empty(o) {
|
|
9414
|
+
if (o === null || o === void 0) throw new TypeError("Cannot destructure " + o);
|
|
9954
9415
|
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
function require_object_destructuring_empty () {
|
|
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.92.
|
|
9724
|
+
var version = '4.92.1';
|
|
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) {
|
|
@@ -13357,7 +12804,7 @@
|
|
|
13357
12804
|
}));
|
|
13358
12805
|
if (params.facetFilters) {
|
|
13359
12806
|
var attributes = flat(params.facetFilters).map(function(filter) {
|
|
13360
|
-
var _filter_split =
|
|
12807
|
+
var _filter_split = _sliced_to_array(filter.split(':'), 2), attribute = _filter_split[0], value = _filter_split[1];
|
|
13361
12808
|
return {
|
|
13362
12809
|
attribute: attribute,
|
|
13363
12810
|
value: value
|
|
@@ -13388,7 +12835,7 @@
|
|
|
13388
12835
|
var unmountFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
13389
12836
|
checkRendering(renderFn, withUsage$m());
|
|
13390
12837
|
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 =
|
|
12838
|
+
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
12839
|
"resume",
|
|
13393
12840
|
"tools",
|
|
13394
12841
|
"type"
|
|
@@ -13406,7 +12853,7 @@
|
|
|
13406
12853
|
// Extract suggestions from the last assistant message's data-suggestions part
|
|
13407
12854
|
var getSuggestionsFromMessages = function getSuggestionsFromMessages(messages) {
|
|
13408
12855
|
// Find the last assistant message (iterate from end)
|
|
13409
|
-
var lastAssistantMessage =
|
|
12856
|
+
var lastAssistantMessage = _to_consumable_array(messages).reverse().find(function(message) {
|
|
13410
12857
|
return message.role === 'assistant' && message.parts;
|
|
13411
12858
|
});
|
|
13412
12859
|
if (!(lastAssistantMessage === null || lastAssistantMessage === void 0 ? void 0 : lastAssistantMessage.parts)) {
|
|
@@ -13438,12 +12885,12 @@
|
|
|
13438
12885
|
};
|
|
13439
12886
|
var makeChatInstance = function makeChatInstance(instantSearchInstance) {
|
|
13440
12887
|
var transport;
|
|
13441
|
-
var _getAppIdAndApiKey =
|
|
12888
|
+
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(instantSearchInstance.client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
|
|
13442
12889
|
// Filter out custom data parts (like data-suggestions) that the backend doesn't accept
|
|
13443
12890
|
var filterDataParts = function filterDataParts(messages) {
|
|
13444
12891
|
return messages.map(function(message) {
|
|
13445
12892
|
var _message_parts;
|
|
13446
|
-
return
|
|
12893
|
+
return _object_spread_props(_object_spread({}, message), {
|
|
13447
12894
|
parts: (_message_parts = message.parts) === null || _message_parts === void 0 ? void 0 : _message_parts.filter(function(part) {
|
|
13448
12895
|
return !('type' in part && part.type.startsWith('data-'));
|
|
13449
12896
|
})
|
|
@@ -13452,17 +12899,17 @@
|
|
|
13452
12899
|
};
|
|
13453
12900
|
if ('transport' in options && options.transport) {
|
|
13454
12901
|
var originalPrepare = options.transport.prepareSendMessagesRequest;
|
|
13455
|
-
transport = new DefaultChatTransport(
|
|
12902
|
+
transport = new DefaultChatTransport(_object_spread_props(_object_spread({}, options.transport), {
|
|
13456
12903
|
prepareSendMessagesRequest: function prepareSendMessagesRequest(params) {
|
|
13457
12904
|
// Call the original prepareSendMessagesRequest if it exists,
|
|
13458
12905
|
// otherwise construct the default body
|
|
13459
12906
|
var preparedOrPromise = originalPrepare ? originalPrepare(params) : {
|
|
13460
|
-
body:
|
|
12907
|
+
body: _object_spread({}, params)
|
|
13461
12908
|
};
|
|
13462
12909
|
// Then filter out data-* parts
|
|
13463
12910
|
var applyFilter = function applyFilter(prepared) {
|
|
13464
|
-
return
|
|
13465
|
-
body:
|
|
12911
|
+
return _object_spread_props(_object_spread({}, prepared), {
|
|
12912
|
+
body: _object_spread_props(_object_spread({}, prepared.body), {
|
|
13466
12913
|
messages: filterDataParts(prepared.body.messages)
|
|
13467
12914
|
})
|
|
13468
12915
|
});
|
|
@@ -13488,14 +12935,14 @@
|
|
|
13488
12935
|
'x-algolia-agent': getAlgoliaAgent(instantSearchInstance.client)
|
|
13489
12936
|
},
|
|
13490
12937
|
prepareSendMessagesRequest: function prepareSendMessagesRequest(_0) {
|
|
13491
|
-
var messages = _0.messages, trigger = _0.trigger, rest =
|
|
12938
|
+
var messages = _0.messages, trigger = _0.trigger, rest = _object_without_properties(_0, [
|
|
13492
12939
|
"messages",
|
|
13493
12940
|
"trigger"
|
|
13494
12941
|
]);
|
|
13495
12942
|
return {
|
|
13496
12943
|
// Bypass cache when regenerating to ensure fresh responses
|
|
13497
12944
|
api: trigger === 'regenerate-message' ? "".concat(baseApi, "&cache=false") : baseApi,
|
|
13498
|
-
body:
|
|
12945
|
+
body: _object_spread_props(_object_spread({}, rest), {
|
|
13499
12946
|
messages: filterDataParts(messages)
|
|
13500
12947
|
})
|
|
13501
12948
|
};
|
|
@@ -13508,7 +12955,7 @@
|
|
|
13508
12955
|
if ('chat' in options) {
|
|
13509
12956
|
return options.chat;
|
|
13510
12957
|
}
|
|
13511
|
-
return new Chat(
|
|
12958
|
+
return new Chat(_object_spread_props(_object_spread({}, options), {
|
|
13512
12959
|
transport: transport,
|
|
13513
12960
|
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
|
|
13514
12961
|
onToolCall: function onToolCall(param) {
|
|
@@ -13534,7 +12981,7 @@
|
|
|
13534
12981
|
toolCallId: toolCall.toolCallId
|
|
13535
12982
|
});
|
|
13536
12983
|
};
|
|
13537
|
-
return tool.onToolCall(
|
|
12984
|
+
return tool.onToolCall(_object_spread_props(_object_spread({}, toolCall), {
|
|
13538
12985
|
addToolResult: addToolResult
|
|
13539
12986
|
}));
|
|
13540
12987
|
}
|
|
@@ -13549,7 +12996,7 @@
|
|
|
13549
12996
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
13550
12997
|
_chatInstance = makeChatInstance(instantSearchInstance);
|
|
13551
12998
|
var render = function render() {
|
|
13552
|
-
renderFn(
|
|
12999
|
+
renderFn(_object_spread_props(_object_spread({}, _this.getWidgetRenderState(initOptions)), {
|
|
13553
13000
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
13554
13001
|
}), false);
|
|
13555
13002
|
};
|
|
@@ -13574,22 +13021,22 @@
|
|
|
13574
13021
|
if (resume) {
|
|
13575
13022
|
_chatInstance.resumeStream();
|
|
13576
13023
|
}
|
|
13577
|
-
renderFn(
|
|
13024
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
13578
13025
|
instantSearchInstance: instantSearchInstance
|
|
13579
13026
|
}), true);
|
|
13580
13027
|
},
|
|
13581
13028
|
render: function render(renderOptions) {
|
|
13582
|
-
renderFn(
|
|
13029
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
13583
13030
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
13584
13031
|
}), false);
|
|
13585
13032
|
},
|
|
13586
13033
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
13587
|
-
return
|
|
13034
|
+
return _object_spread_props(_object_spread({}, renderState), _define_property({}, type, this.getWidgetRenderState(renderOptions)));
|
|
13588
13035
|
},
|
|
13589
13036
|
getWidgetRenderState: function getWidgetRenderState(renderOptions) {
|
|
13590
13037
|
var instantSearchInstance = renderOptions.instantSearchInstance, parent = renderOptions.parent, helper = renderOptions.helper;
|
|
13591
13038
|
if (!_chatInstance) {
|
|
13592
|
-
this.init(
|
|
13039
|
+
this.init(_object_spread_props(_object_spread({}, renderOptions), {
|
|
13593
13040
|
uiState: {},
|
|
13594
13041
|
results: undefined
|
|
13595
13042
|
}));
|
|
@@ -13606,8 +13053,8 @@
|
|
|
13606
13053
|
}
|
|
13607
13054
|
var toolsWithAddToolResult = {};
|
|
13608
13055
|
Object.entries(tools).forEach(function(param) {
|
|
13609
|
-
var _param =
|
|
13610
|
-
var toolWithAddToolResult =
|
|
13056
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], tool = _param[1];
|
|
13057
|
+
var toolWithAddToolResult = _object_spread_props(_object_spread({}, tool), {
|
|
13611
13058
|
addToolResult: _chatInstance.addToolResult,
|
|
13612
13059
|
applyFilters: applyFilters
|
|
13613
13060
|
});
|
|
@@ -13692,13 +13139,13 @@
|
|
|
13692
13139
|
$$type: 'ais.clearRefinements',
|
|
13693
13140
|
init: function init(initOptions) {
|
|
13694
13141
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
13695
|
-
renderFn(
|
|
13142
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
13696
13143
|
instantSearchInstance: instantSearchInstance
|
|
13697
13144
|
}), true);
|
|
13698
13145
|
},
|
|
13699
13146
|
render: function render(renderOptions) {
|
|
13700
13147
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
13701
|
-
renderFn(
|
|
13148
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
13702
13149
|
instantSearchInstance: instantSearchInstance
|
|
13703
13150
|
}), false);
|
|
13704
13151
|
},
|
|
@@ -13706,7 +13153,7 @@
|
|
|
13706
13153
|
unmountFn();
|
|
13707
13154
|
},
|
|
13708
13155
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
13709
|
-
return
|
|
13156
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
13710
13157
|
clearRefinements: this.getWidgetRenderState(renderOptions)
|
|
13711
13158
|
});
|
|
13712
13159
|
},
|
|
@@ -13731,7 +13178,7 @@
|
|
|
13731
13178
|
});
|
|
13732
13179
|
};
|
|
13733
13180
|
connectorState.createURL = function() {
|
|
13734
|
-
return createURL(mergeSearchParameters.apply(void 0,
|
|
13181
|
+
return createURL(mergeSearchParameters.apply(void 0, _to_consumable_array(connectorState.attributesToClear.map(function(param) {
|
|
13735
13182
|
var indexHelper = param.helper, items = param.items;
|
|
13736
13183
|
return clearRefinements({
|
|
13737
13184
|
helper: indexHelper,
|
|
@@ -13796,13 +13243,13 @@
|
|
|
13796
13243
|
$$type: 'ais.currentRefinements',
|
|
13797
13244
|
init: function init(initOptions) {
|
|
13798
13245
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
13799
|
-
renderFn(
|
|
13246
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
13800
13247
|
instantSearchInstance: instantSearchInstance
|
|
13801
13248
|
}), true);
|
|
13802
13249
|
},
|
|
13803
13250
|
render: function render(renderOptions) {
|
|
13804
13251
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
13805
|
-
renderFn(
|
|
13252
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
13806
13253
|
instantSearchInstance: instantSearchInstance
|
|
13807
13254
|
}), false);
|
|
13808
13255
|
},
|
|
@@ -13810,7 +13257,7 @@
|
|
|
13810
13257
|
unmountFn();
|
|
13811
13258
|
},
|
|
13812
13259
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
13813
|
-
return
|
|
13260
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
13814
13261
|
currentRefinements: this.getWidgetRenderState(renderOptions)
|
|
13815
13262
|
});
|
|
13816
13263
|
},
|
|
@@ -13866,7 +13313,7 @@
|
|
|
13866
13313
|
};
|
|
13867
13314
|
var items = getRefinements(results, helper.state, includesQuery).map(normalizeRefinement).filter(filterFunction);
|
|
13868
13315
|
return items.reduce(function(allItems, currentItem) {
|
|
13869
|
-
return
|
|
13316
|
+
return _to_consumable_array(allItems.filter(function(item) {
|
|
13870
13317
|
return item.attribute !== currentItem.attribute;
|
|
13871
13318
|
})).concat([
|
|
13872
13319
|
{
|
|
@@ -13957,7 +13404,7 @@
|
|
|
13957
13404
|
|
|
13958
13405
|
function addAbsolutePosition(hits, page, hitsPerPage) {
|
|
13959
13406
|
return hits.map(function(hit, idx) {
|
|
13960
|
-
return
|
|
13407
|
+
return _object_spread_props(_object_spread({}, hit), {
|
|
13961
13408
|
__position: hitsPerPage * page + idx + 1
|
|
13962
13409
|
});
|
|
13963
13410
|
});
|
|
@@ -13968,7 +13415,7 @@
|
|
|
13968
13415
|
return hits;
|
|
13969
13416
|
}
|
|
13970
13417
|
return hits.map(function(hit) {
|
|
13971
|
-
return
|
|
13418
|
+
return _object_spread_props(_object_spread({}, hit), {
|
|
13972
13419
|
__queryID: queryID
|
|
13973
13420
|
});
|
|
13974
13421
|
});
|
|
@@ -13993,13 +13440,13 @@
|
|
|
13993
13440
|
dependsOn: 'recommend',
|
|
13994
13441
|
$$type: 'ais.frequentlyBoughtTogether',
|
|
13995
13442
|
init: function init(initOptions) {
|
|
13996
|
-
renderFn(
|
|
13443
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
13997
13444
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
13998
13445
|
}), true);
|
|
13999
13446
|
},
|
|
14000
13447
|
render: function render(renderOptions) {
|
|
14001
13448
|
var renderState = this.getWidgetRenderState(renderOptions);
|
|
14002
|
-
renderFn(
|
|
13449
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
14003
13450
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
14004
13451
|
}), false);
|
|
14005
13452
|
},
|
|
@@ -14049,8 +13496,8 @@
|
|
|
14049
13496
|
maxRecommendations: limit,
|
|
14050
13497
|
threshold: threshold,
|
|
14051
13498
|
// @ts-expect-error until @algolia/recommend types are updated
|
|
14052
|
-
fallbackParameters: fallbackParameters ?
|
|
14053
|
-
queryParameters:
|
|
13499
|
+
fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
|
|
13500
|
+
queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
14054
13501
|
$$id: _this.$$id
|
|
14055
13502
|
});
|
|
14056
13503
|
}, state.removeParams(this.$$id));
|
|
@@ -14077,7 +13524,7 @@
|
|
|
14077
13524
|
};
|
|
14078
13525
|
}
|
|
14079
13526
|
function insideBoundingBoxArrayToBoundingBox(value) {
|
|
14080
|
-
var _value =
|
|
13527
|
+
var _value = _sliced_to_array(value, 1), tmp = _value[0], _ref = _sliced_to_array(tmp === void 0 ? [
|
|
14081
13528
|
undefined,
|
|
14082
13529
|
undefined,
|
|
14083
13530
|
undefined,
|
|
@@ -14100,7 +13547,7 @@
|
|
|
14100
13547
|
};
|
|
14101
13548
|
}
|
|
14102
13549
|
function insideBoundingBoxStringToBoundingBox(value) {
|
|
14103
|
-
var _value_split_map =
|
|
13550
|
+
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
13551
|
// Since the value provided is the one send with the request, the API should
|
|
14105
13552
|
// throw an error due to the wrong format. So throw an error should be safe.
|
|
14106
13553
|
if (!neLat || !neLng || !swLat || !swLng) {
|
|
@@ -14229,7 +13676,7 @@
|
|
|
14229
13676
|
var isFirstRendering = true;
|
|
14230
13677
|
widgetState.internalToggleRefineOnMapMove = createInternalToggleRefinementOnMapMove(initArgs, noop);
|
|
14231
13678
|
widgetState.internalSetMapMoveSinceLastRefine = createInternalSetMapMoveSinceLastRefine(initArgs, noop);
|
|
14232
|
-
renderFn(
|
|
13679
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initArgs)), {
|
|
14233
13680
|
instantSearchInstance: instantSearchInstance
|
|
14234
13681
|
}), isFirstRendering);
|
|
14235
13682
|
},
|
|
@@ -14250,7 +13697,7 @@
|
|
|
14250
13697
|
widgetState.internalSetMapMoveSinceLastRefine = createInternalSetMapMoveSinceLastRefine(renderArgs, this.render.bind(this));
|
|
14251
13698
|
var widgetRenderState = this.getWidgetRenderState(renderArgs);
|
|
14252
13699
|
sendEvent('view:internal', widgetRenderState.items);
|
|
14253
|
-
renderFn(
|
|
13700
|
+
renderFn(_object_spread_props(_object_spread({}, widgetRenderState), {
|
|
14254
13701
|
instantSearchInstance: instantSearchInstance
|
|
14255
13702
|
}), isFirstRendering);
|
|
14256
13703
|
},
|
|
@@ -14285,7 +13732,7 @@
|
|
|
14285
13732
|
};
|
|
14286
13733
|
},
|
|
14287
13734
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
14288
|
-
return
|
|
13735
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14289
13736
|
geoSearch: this.getWidgetRenderState(renderOptions)
|
|
14290
13737
|
});
|
|
14291
13738
|
},
|
|
@@ -14300,7 +13747,7 @@
|
|
|
14300
13747
|
if (!boundingBox || uiState && uiState.geoSearch && uiState.geoSearch.boundingBox === boundingBox) {
|
|
14301
13748
|
return uiState;
|
|
14302
13749
|
}
|
|
14303
|
-
return
|
|
13750
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
14304
13751
|
geoSearch: {
|
|
14305
13752
|
boundingBox: boundingBox
|
|
14306
13753
|
}
|
|
@@ -14337,10 +13784,10 @@
|
|
|
14337
13784
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
14338
13785
|
args[_key] = arguments[_key];
|
|
14339
13786
|
}
|
|
14340
|
-
var _args =
|
|
14341
|
-
var _args__split =
|
|
13787
|
+
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;
|
|
13788
|
+
var _args__split = _sliced_to_array(args[0].split(':'), 2), eventType = _args__split[0], eventModifier = _args__split[1];
|
|
14342
13789
|
var attribute = typeof attr === 'string' ? attr : attr(facetValue);
|
|
14343
|
-
if (args.length === 1 &&
|
|
13790
|
+
if (args.length === 1 && _type_of(args[0]) === 'object') {
|
|
14344
13791
|
instantSearchInstance.sendEventToInsights(args[0]);
|
|
14345
13792
|
} else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
|
|
14346
13793
|
if (!isFacetRefined(helper, attribute, facetValue)) {
|
|
@@ -14351,7 +13798,7 @@
|
|
|
14351
13798
|
widgetType: widgetType,
|
|
14352
13799
|
eventType: eventType,
|
|
14353
13800
|
eventModifier: eventModifier,
|
|
14354
|
-
payload:
|
|
13801
|
+
payload: _object_spread({
|
|
14355
13802
|
eventName: eventName,
|
|
14356
13803
|
index: ((_helper_lastResults = helper.lastResults) === null || _helper_lastResults === void 0 ? void 0 : _helper_lastResults.index) || helper.state.index,
|
|
14357
13804
|
filters: [
|
|
@@ -14401,7 +13848,7 @@
|
|
|
14401
13848
|
// we need to provide a hierarchicalFacet name for the search state
|
|
14402
13849
|
// so that we can always map $hierarchicalFacetName => real attributes
|
|
14403
13850
|
// we use the first attribute name
|
|
14404
|
-
var _attributes =
|
|
13851
|
+
var _attributes = _sliced_to_array(attributes, 1), hierarchicalFacetName = _attributes[0];
|
|
14405
13852
|
var sendEvent;
|
|
14406
13853
|
// Provide the same function to the `renderFn` so that way the user
|
|
14407
13854
|
// has to only bind it once when `isFirstRendering` for instance
|
|
@@ -14424,13 +13871,13 @@
|
|
|
14424
13871
|
return facetValues.slice(0, getLimit()).map(function(_0) {
|
|
14425
13872
|
var label = _0.name, value = _0.escapedValue, data = _0.data;
|
|
14426
13873
|
_0.path;
|
|
14427
|
-
var subValue =
|
|
13874
|
+
var subValue = _object_without_properties(_0, [
|
|
14428
13875
|
"name",
|
|
14429
13876
|
"escapedValue",
|
|
14430
13877
|
"data",
|
|
14431
13878
|
"path"
|
|
14432
13879
|
]);
|
|
14433
|
-
var item =
|
|
13880
|
+
var item = _object_spread_props(_object_spread({}, subValue), {
|
|
14434
13881
|
value: value,
|
|
14435
13882
|
label: label,
|
|
14436
13883
|
data: null
|
|
@@ -14456,14 +13903,14 @@
|
|
|
14456
13903
|
$$type: 'ais.hierarchicalMenu',
|
|
14457
13904
|
init: function init(initOptions) {
|
|
14458
13905
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
14459
|
-
renderFn(
|
|
13906
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
14460
13907
|
instantSearchInstance: instantSearchInstance
|
|
14461
13908
|
}), true);
|
|
14462
13909
|
},
|
|
14463
13910
|
render: function render(renderOptions) {
|
|
14464
13911
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
14465
13912
|
toggleShowMore = createToggleShowMore(renderOptions, this);
|
|
14466
|
-
renderFn(
|
|
13913
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
14467
13914
|
instantSearchInstance: instantSearchInstance
|
|
14468
13915
|
}), false);
|
|
14469
13916
|
},
|
|
@@ -14473,8 +13920,8 @@
|
|
|
14473
13920
|
return state.removeHierarchicalFacet(hierarchicalFacetName).setQueryParameter('maxValuesPerFacet', undefined);
|
|
14474
13921
|
},
|
|
14475
13922
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
14476
|
-
return
|
|
14477
|
-
hierarchicalMenu:
|
|
13923
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
13924
|
+
hierarchicalMenu: _object_spread_props(_object_spread({}, renderState.hierarchicalMenu), _define_property({}, hierarchicalFacetName, this.getWidgetRenderState(renderOptions)))
|
|
14478
13925
|
});
|
|
14479
13926
|
},
|
|
14480
13927
|
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
@@ -14538,8 +13985,8 @@
|
|
|
14538
13985
|
getWidgetUiState: function getWidgetUiState(uiState, param) {
|
|
14539
13986
|
var searchParameters = param.searchParameters;
|
|
14540
13987
|
var path = searchParameters.getHierarchicalFacetBreadcrumb(hierarchicalFacetName);
|
|
14541
|
-
return removeEmptyRefinementsFromUiState$3(
|
|
14542
|
-
hierarchicalMenu:
|
|
13988
|
+
return removeEmptyRefinementsFromUiState$3(_object_spread_props(_object_spread({}, uiState), {
|
|
13989
|
+
hierarchicalMenu: _object_spread_props(_object_spread({}, uiState.hierarchicalMenu), _define_property({}, hierarchicalFacetName, path))
|
|
14543
13990
|
}), hierarchicalFacetName);
|
|
14544
13991
|
},
|
|
14545
13992
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
@@ -14563,7 +14010,7 @@
|
|
|
14563
14010
|
var withMaxValuesPerFacet = withFacetConfiguration.setQueryParameter('maxValuesPerFacet', nextMaxValuesPerFacet);
|
|
14564
14011
|
if (!values) {
|
|
14565
14012
|
return withMaxValuesPerFacet.setQueryParameters({
|
|
14566
|
-
hierarchicalFacetsRefinements:
|
|
14013
|
+
hierarchicalFacetsRefinements: _object_spread_props(_object_spread({}, withMaxValuesPerFacet.hierarchicalFacetsRefinements), _define_property({}, hierarchicalFacetName, []))
|
|
14567
14014
|
});
|
|
14568
14015
|
}
|
|
14569
14016
|
return withMaxValuesPerFacet.addHierarchicalFacetRefinement(hierarchicalFacetName, values.join(separator));
|
|
@@ -14604,19 +14051,19 @@
|
|
|
14604
14051
|
return {
|
|
14605
14052
|
$$type: 'ais.hits',
|
|
14606
14053
|
init: function init(initOptions) {
|
|
14607
|
-
renderFn(
|
|
14054
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
14608
14055
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
14609
14056
|
}), true);
|
|
14610
14057
|
},
|
|
14611
14058
|
render: function render(renderOptions) {
|
|
14612
14059
|
var renderState = this.getWidgetRenderState(renderOptions);
|
|
14613
|
-
renderFn(
|
|
14060
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
14614
14061
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
14615
14062
|
}), false);
|
|
14616
14063
|
renderState.sendEvent('view:internal', renderState.items);
|
|
14617
14064
|
},
|
|
14618
14065
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
14619
|
-
return
|
|
14066
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14620
14067
|
hits: this.getWidgetRenderState(renderOptions)
|
|
14621
14068
|
});
|
|
14622
14069
|
},
|
|
@@ -14674,7 +14121,7 @@
|
|
|
14674
14121
|
return state;
|
|
14675
14122
|
}
|
|
14676
14123
|
return state.setQueryParameters(Object.keys(TAG_PLACEHOLDER).reduce(function(acc, key) {
|
|
14677
|
-
return
|
|
14124
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, undefined));
|
|
14678
14125
|
}, {}));
|
|
14679
14126
|
},
|
|
14680
14127
|
getWidgetSearchParameters: function getWidgetSearchParameters(state, _uiState) {
|
|
@@ -14720,7 +14167,7 @@
|
|
|
14720
14167
|
var normalizeItems = function normalizeItems(param) {
|
|
14721
14168
|
var hitsPerPage = param.hitsPerPage;
|
|
14722
14169
|
return items.map(function(item) {
|
|
14723
|
-
return
|
|
14170
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
14724
14171
|
isRefined: Number(item.value) === Number(hitsPerPage)
|
|
14725
14172
|
});
|
|
14726
14173
|
});
|
|
@@ -14757,15 +14204,15 @@
|
|
|
14757
14204
|
value: '',
|
|
14758
14205
|
label: ''
|
|
14759
14206
|
}
|
|
14760
|
-
].concat(
|
|
14207
|
+
].concat(_to_consumable_array(items));
|
|
14761
14208
|
}
|
|
14762
|
-
renderFn(
|
|
14209
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
14763
14210
|
instantSearchInstance: instantSearchInstance
|
|
14764
14211
|
}), true);
|
|
14765
14212
|
},
|
|
14766
14213
|
render: function render(initOptions) {
|
|
14767
14214
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
14768
|
-
renderFn(
|
|
14215
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
14769
14216
|
instantSearchInstance: instantSearchInstance
|
|
14770
14217
|
}), false);
|
|
14771
14218
|
},
|
|
@@ -14775,7 +14222,7 @@
|
|
|
14775
14222
|
return state.setQueryParameter('hitsPerPage', undefined);
|
|
14776
14223
|
},
|
|
14777
14224
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
14778
|
-
return
|
|
14225
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14779
14226
|
hitsPerPage: this.getWidgetRenderState(renderOptions)
|
|
14780
14227
|
});
|
|
14781
14228
|
},
|
|
@@ -14804,7 +14251,7 @@
|
|
|
14804
14251
|
if (hitsPerPage === undefined || hitsPerPage === defaultItem.value) {
|
|
14805
14252
|
return uiState;
|
|
14806
14253
|
}
|
|
14807
|
-
return
|
|
14254
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
14808
14255
|
hitsPerPage: hitsPerPage
|
|
14809
14256
|
});
|
|
14810
14257
|
},
|
|
@@ -14840,7 +14287,7 @@
|
|
|
14840
14287
|
function getStateWithoutPage(state) {
|
|
14841
14288
|
var _ref = state || {};
|
|
14842
14289
|
_ref.page;
|
|
14843
|
-
var rest =
|
|
14290
|
+
var rest = _object_without_properties(_ref, [
|
|
14844
14291
|
"page"
|
|
14845
14292
|
]);
|
|
14846
14293
|
return rest;
|
|
@@ -14849,7 +14296,7 @@
|
|
|
14849
14296
|
var _ref = state || {};
|
|
14850
14297
|
_ref.clickAnalytics;
|
|
14851
14298
|
_ref.userToken;
|
|
14852
|
-
var rest =
|
|
14299
|
+
var rest = _object_without_properties(_ref, [
|
|
14853
14300
|
"clickAnalytics",
|
|
14854
14301
|
"userToken"
|
|
14855
14302
|
]);
|
|
@@ -14897,7 +14344,7 @@
|
|
|
14897
14344
|
var _Math;
|
|
14898
14345
|
return (_Math = Math).min.apply(_Math, [
|
|
14899
14346
|
page
|
|
14900
|
-
].concat(
|
|
14347
|
+
].concat(_to_consumable_array(pages)));
|
|
14901
14348
|
}
|
|
14902
14349
|
};
|
|
14903
14350
|
var getLastReceivedPage = function getLastReceivedPage(state, cachedHits) {
|
|
@@ -14909,7 +14356,7 @@
|
|
|
14909
14356
|
var _Math;
|
|
14910
14357
|
return (_Math = Math).max.apply(_Math, [
|
|
14911
14358
|
page
|
|
14912
|
-
].concat(
|
|
14359
|
+
].concat(_to_consumable_array(pages)));
|
|
14913
14360
|
}
|
|
14914
14361
|
};
|
|
14915
14362
|
var getShowPrevious = function getShowPrevious(helper, getCachedHits) {
|
|
@@ -14917,7 +14364,7 @@
|
|
|
14917
14364
|
var cachedHits = getCachedHits();
|
|
14918
14365
|
// Using the helper's `overrideStateWithoutTriggeringChangeEvent` method
|
|
14919
14366
|
// avoid updating the browser URL when the user displays the previous page.
|
|
14920
|
-
helper.overrideStateWithoutTriggeringChangeEvent(
|
|
14367
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_object_spread_props(_object_spread({}, helper.state), {
|
|
14921
14368
|
page: getFirstReceivedPage(helper.state, cachedHits) - 1
|
|
14922
14369
|
})).searchWithoutTriggeringOnStateChange();
|
|
14923
14370
|
};
|
|
@@ -14931,20 +14378,20 @@
|
|
|
14931
14378
|
return {
|
|
14932
14379
|
$$type: 'ais.infiniteHits',
|
|
14933
14380
|
init: function init(initOptions) {
|
|
14934
|
-
renderFn(
|
|
14381
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
14935
14382
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
14936
14383
|
}), true);
|
|
14937
14384
|
},
|
|
14938
14385
|
render: function render(renderOptions) {
|
|
14939
14386
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
14940
14387
|
var widgetRenderState = this.getWidgetRenderState(renderOptions);
|
|
14941
|
-
renderFn(
|
|
14388
|
+
renderFn(_object_spread_props(_object_spread({}, widgetRenderState), {
|
|
14942
14389
|
instantSearchInstance: instantSearchInstance
|
|
14943
14390
|
}), false);
|
|
14944
14391
|
sendEvent('view:internal', widgetRenderState.currentPageHits);
|
|
14945
14392
|
},
|
|
14946
14393
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
14947
|
-
return
|
|
14394
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14948
14395
|
infiniteHits: this.getWidgetRenderState(renderOptions)
|
|
14949
14396
|
});
|
|
14950
14397
|
},
|
|
@@ -15048,7 +14495,7 @@
|
|
|
15048
14495
|
return stateWithoutPage;
|
|
15049
14496
|
}
|
|
15050
14497
|
return stateWithoutPage.setQueryParameters(Object.keys(TAG_PLACEHOLDER).reduce(function(acc, key) {
|
|
15051
|
-
return
|
|
14498
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, undefined));
|
|
15052
14499
|
}, {}));
|
|
15053
14500
|
},
|
|
15054
14501
|
getWidgetUiState: function getWidgetUiState(uiState, param) {
|
|
@@ -15059,7 +14506,7 @@
|
|
|
15059
14506
|
// because we don't want `page=1` in the URL
|
|
15060
14507
|
return uiState;
|
|
15061
14508
|
}
|
|
15062
|
-
return
|
|
14509
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
15063
14510
|
// The page in the UI state is incremented by one
|
|
15064
14511
|
// to expose the user value (not `0`).
|
|
15065
14512
|
page: page + 1
|
|
@@ -15137,13 +14584,13 @@
|
|
|
15137
14584
|
$$type: 'ais.menu',
|
|
15138
14585
|
init: function init(initOptions) {
|
|
15139
14586
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
15140
|
-
renderFn(
|
|
14587
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
15141
14588
|
instantSearchInstance: instantSearchInstance
|
|
15142
14589
|
}), true);
|
|
15143
14590
|
},
|
|
15144
14591
|
render: function render(renderOptions) {
|
|
15145
14592
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
15146
|
-
renderFn(
|
|
14593
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
15147
14594
|
instantSearchInstance: instantSearchInstance
|
|
15148
14595
|
}), false);
|
|
15149
14596
|
},
|
|
@@ -15153,8 +14600,8 @@
|
|
|
15153
14600
|
return state.removeHierarchicalFacet(attribute).setQueryParameter('maxValuesPerFacet', undefined);
|
|
15154
14601
|
},
|
|
15155
14602
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
15156
|
-
return
|
|
15157
|
-
menu:
|
|
14603
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14604
|
+
menu: _object_spread_props(_object_spread({}, renderState.menu), _define_property({}, attribute, this.getWidgetRenderState(renderOptions)))
|
|
15158
14605
|
});
|
|
15159
14606
|
},
|
|
15160
14607
|
getWidgetRenderState: function getWidgetRenderState(renderOptions) {
|
|
@@ -15182,7 +14629,7 @@
|
|
|
15182
14629
|
}
|
|
15183
14630
|
if (!_refine) {
|
|
15184
14631
|
_refine = function _refine(facetValue) {
|
|
15185
|
-
var _helper_getHierarchicalFacetBreadcrumb =
|
|
14632
|
+
var _helper_getHierarchicalFacetBreadcrumb = _sliced_to_array(helper.getHierarchicalFacetBreadcrumb(attribute), 1), refinedItem = _helper_getHierarchicalFacetBreadcrumb[0];
|
|
15186
14633
|
sendEvent('click:internal', facetValue ? facetValue : refinedItem);
|
|
15187
14634
|
helper.toggleFacetRefinement(attribute, facetValue ? facetValue : refinedItem).search();
|
|
15188
14635
|
};
|
|
@@ -15200,12 +14647,12 @@
|
|
|
15200
14647
|
items = transformItems(facetItems.slice(0, getLimit()).map(function(_0) {
|
|
15201
14648
|
var label = _0.name, value = _0.escapedValue;
|
|
15202
14649
|
_0.path;
|
|
15203
|
-
var item =
|
|
14650
|
+
var item = _object_without_properties(_0, [
|
|
15204
14651
|
"name",
|
|
15205
14652
|
"escapedValue",
|
|
15206
14653
|
"path"
|
|
15207
14654
|
]);
|
|
15208
|
-
return
|
|
14655
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
15209
14656
|
label: label,
|
|
15210
14657
|
value: value
|
|
15211
14658
|
});
|
|
@@ -15227,9 +14674,9 @@
|
|
|
15227
14674
|
},
|
|
15228
14675
|
getWidgetUiState: function getWidgetUiState(uiState, param) {
|
|
15229
14676
|
var searchParameters = param.searchParameters;
|
|
15230
|
-
var _searchParameters_getHierarchicalFacetBreadcrumb =
|
|
15231
|
-
return removeEmptyRefinementsFromUiState$2(
|
|
15232
|
-
menu:
|
|
14677
|
+
var _searchParameters_getHierarchicalFacetBreadcrumb = _sliced_to_array(searchParameters.getHierarchicalFacetBreadcrumb(attribute), 1), value = _searchParameters_getHierarchicalFacetBreadcrumb[0];
|
|
14678
|
+
return removeEmptyRefinementsFromUiState$2(_object_spread_props(_object_spread({}, uiState), {
|
|
14679
|
+
menu: _object_spread_props(_object_spread({}, uiState.menu), _define_property({}, attribute, value))
|
|
15233
14680
|
}), attribute);
|
|
15234
14681
|
},
|
|
15235
14682
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
@@ -15249,7 +14696,7 @@
|
|
|
15249
14696
|
var withMaxValuesPerFacet = withFacetConfiguration.setQueryParameter('maxValuesPerFacet', nextMaxValuesPerFacet);
|
|
15250
14697
|
if (!value) {
|
|
15251
14698
|
return withMaxValuesPerFacet.setQueryParameters({
|
|
15252
|
-
hierarchicalFacetsRefinements:
|
|
14699
|
+
hierarchicalFacetsRefinements: _object_spread_props(_object_spread({}, withMaxValuesPerFacet.hierarchicalFacetsRefinements), _define_property({}, attribute, []))
|
|
15253
14700
|
});
|
|
15254
14701
|
}
|
|
15255
14702
|
return withMaxValuesPerFacet.addHierarchicalFacetRefinement(attribute, value);
|
|
@@ -15334,13 +14781,13 @@
|
|
|
15334
14781
|
$$type: $$type$2,
|
|
15335
14782
|
init: function init(initOptions) {
|
|
15336
14783
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
15337
|
-
renderFn(
|
|
14784
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
15338
14785
|
instantSearchInstance: instantSearchInstance
|
|
15339
14786
|
}), true);
|
|
15340
14787
|
},
|
|
15341
14788
|
render: function render(renderOptions) {
|
|
15342
14789
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
15343
|
-
renderFn(
|
|
14790
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
15344
14791
|
instantSearchInstance: instantSearchInstance
|
|
15345
14792
|
}), false);
|
|
15346
14793
|
},
|
|
@@ -15354,21 +14801,21 @@
|
|
|
15354
14801
|
var values = searchParameters.getNumericRefinements(attribute);
|
|
15355
14802
|
var equal = values['='] && values['='][0];
|
|
15356
14803
|
if (equal || equal === 0) {
|
|
15357
|
-
return
|
|
15358
|
-
numericMenu:
|
|
14804
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
14805
|
+
numericMenu: _object_spread_props(_object_spread({}, uiState.numericMenu), _define_property({}, attribute, "".concat(values['='])))
|
|
15359
14806
|
});
|
|
15360
14807
|
}
|
|
15361
14808
|
var min = values['>='] && values['>='][0] || '';
|
|
15362
14809
|
var max = values['<='] && values['<='][0] || '';
|
|
15363
|
-
return removeEmptyRefinementsFromUiState$1(
|
|
15364
|
-
numericMenu:
|
|
14810
|
+
return removeEmptyRefinementsFromUiState$1(_object_spread_props(_object_spread({}, uiState), {
|
|
14811
|
+
numericMenu: _object_spread_props(_object_spread({}, uiState.numericMenu), _define_property({}, attribute, "".concat(min, ":").concat(max)))
|
|
15365
14812
|
}), attribute);
|
|
15366
14813
|
},
|
|
15367
14814
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
15368
14815
|
var uiState = param.uiState;
|
|
15369
14816
|
var value = uiState.numericMenu && uiState.numericMenu[attribute];
|
|
15370
14817
|
var withoutRefinements = searchParameters.setQueryParameters({
|
|
15371
|
-
numericRefinements:
|
|
14818
|
+
numericRefinements: _object_spread_props(_object_spread({}, searchParameters.numericRefinements), _define_property({}, attribute, {}))
|
|
15372
14819
|
});
|
|
15373
14820
|
if (!value) {
|
|
15374
14821
|
return withoutRefinements;
|
|
@@ -15377,14 +14824,14 @@
|
|
|
15377
14824
|
if (isExact) {
|
|
15378
14825
|
return withoutRefinements.addNumericRefinement(attribute, '=', Number(value));
|
|
15379
14826
|
}
|
|
15380
|
-
var _value_split_map =
|
|
14827
|
+
var _value_split_map = _sliced_to_array(value.split(':').map(parseFloat), 2), min = _value_split_map[0], max = _value_split_map[1];
|
|
15381
14828
|
var withMinRefinement = isFiniteNumber(min) ? withoutRefinements.addNumericRefinement(attribute, '>=', min) : withoutRefinements;
|
|
15382
14829
|
var withMaxRefinement = isFiniteNumber(max) ? withMinRefinement.addNumericRefinement(attribute, '<=', max) : withMinRefinement;
|
|
15383
14830
|
return withMaxRefinement;
|
|
15384
14831
|
},
|
|
15385
14832
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
15386
|
-
return
|
|
15387
|
-
numericMenu:
|
|
14833
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
14834
|
+
numericMenu: _object_spread_props(_object_spread({}, renderState.numericMenu), _define_property({}, attribute, this.getWidgetRenderState(renderOptions)))
|
|
15388
14835
|
});
|
|
15389
14836
|
},
|
|
15390
14837
|
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
@@ -15420,7 +14867,7 @@
|
|
|
15420
14867
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
15421
14868
|
try {
|
|
15422
14869
|
// @TODO avoid for..of for polyfill reasons
|
|
15423
|
-
// eslint-disable-next-line no-
|
|
14870
|
+
// eslint-disable-next-line instantsearch/no-for-of
|
|
15424
14871
|
for(var _iterator = preparedItems[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
15425
14872
|
var item = _step.value;
|
|
15426
14873
|
if (item.isRefined && decodeURI(item.value) !== '{}') {
|
|
@@ -15522,7 +14969,8 @@
|
|
|
15522
14969
|
return resolvedState;
|
|
15523
14970
|
}
|
|
15524
14971
|
function hasNumericRefinement(currentRefinements, operator, value) {
|
|
15525
|
-
|
|
14972
|
+
var refinements = currentRefinements[operator];
|
|
14973
|
+
return refinements !== undefined && refinements.includes(value);
|
|
15526
14974
|
}
|
|
15527
14975
|
function removeEmptyRefinementsFromUiState$1(indexUiState, attribute) {
|
|
15528
14976
|
if (!indexUiState.numericMenu) {
|
|
@@ -15551,22 +14999,22 @@
|
|
|
15551
14999
|
// { start: 1, end: 5000, step: 500 }
|
|
15552
15000
|
// => Array length = (5000 - 1) / 500 = 9.998
|
|
15553
15001
|
var arrayLength = Math.round((end - start) / limitStep);
|
|
15554
|
-
return
|
|
15002
|
+
return _to_consumable_array(Array(arrayLength)).map(function(_, current) {
|
|
15555
15003
|
return start + current * limitStep;
|
|
15556
15004
|
});
|
|
15557
15005
|
}
|
|
15558
15006
|
|
|
15559
15007
|
var Paginator = /*#__PURE__*/ function() {
|
|
15560
15008
|
function Paginator(params) {
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15009
|
+
_class_call_check(this, Paginator);
|
|
15010
|
+
_define_property(this, "currentPage", void 0);
|
|
15011
|
+
_define_property(this, "total", void 0);
|
|
15012
|
+
_define_property(this, "padding", void 0);
|
|
15565
15013
|
this.currentPage = params.currentPage;
|
|
15566
15014
|
this.total = params.total;
|
|
15567
15015
|
this.padding = params.padding;
|
|
15568
15016
|
}
|
|
15569
|
-
|
|
15017
|
+
_create_class(Paginator, [
|
|
15570
15018
|
{
|
|
15571
15019
|
key: "pages",
|
|
15572
15020
|
value: function pages() {
|
|
@@ -15653,13 +15101,13 @@
|
|
|
15653
15101
|
$$type: 'ais.pagination',
|
|
15654
15102
|
init: function init(initOptions) {
|
|
15655
15103
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
15656
|
-
renderFn(
|
|
15104
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
15657
15105
|
instantSearchInstance: instantSearchInstance
|
|
15658
15106
|
}), true);
|
|
15659
15107
|
},
|
|
15660
15108
|
render: function render(renderOptions) {
|
|
15661
15109
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
15662
|
-
renderFn(
|
|
15110
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
15663
15111
|
instantSearchInstance: instantSearchInstance
|
|
15664
15112
|
}), false);
|
|
15665
15113
|
},
|
|
@@ -15674,7 +15122,7 @@
|
|
|
15674
15122
|
if (!page) {
|
|
15675
15123
|
return uiState;
|
|
15676
15124
|
}
|
|
15677
|
-
return
|
|
15125
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
15678
15126
|
page: page + 1
|
|
15679
15127
|
});
|
|
15680
15128
|
},
|
|
@@ -15694,7 +15142,7 @@
|
|
|
15694
15142
|
if (!connectorState.createURL) {
|
|
15695
15143
|
connectorState.createURL = function(page) {
|
|
15696
15144
|
return createURL(function(uiState) {
|
|
15697
|
-
return
|
|
15145
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
15698
15146
|
page: page + 1
|
|
15699
15147
|
});
|
|
15700
15148
|
});
|
|
@@ -15720,7 +15168,7 @@
|
|
|
15720
15168
|
};
|
|
15721
15169
|
},
|
|
15722
15170
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
15723
|
-
return
|
|
15171
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
15724
15172
|
pagination: this.getWidgetRenderState(renderOptions)
|
|
15725
15173
|
});
|
|
15726
15174
|
}
|
|
@@ -15782,7 +15230,7 @@
|
|
|
15782
15230
|
});
|
|
15783
15231
|
var getTrackedFacetValues = trackedFilters[facetName];
|
|
15784
15232
|
var trackedFacetValues = getTrackedFacetValues(facetRefinements);
|
|
15785
|
-
return
|
|
15233
|
+
return _to_consumable_array(facets).concat(_to_consumable_array(facetRefinements.filter(function(facetRefinement) {
|
|
15786
15234
|
return trackedFacetValues.includes(facetRefinement);
|
|
15787
15235
|
}).map(function(facetValue) {
|
|
15788
15236
|
return escapeRuleContext("ais-".concat(facetName, "-").concat(facetValue));
|
|
@@ -15799,10 +15247,10 @@
|
|
|
15799
15247
|
sharedHelperState: sharedHelperState,
|
|
15800
15248
|
trackedFilters: trackedFilters
|
|
15801
15249
|
});
|
|
15802
|
-
var nextRuleContexts =
|
|
15250
|
+
var nextRuleContexts = _to_consumable_array(initialRuleContexts).concat(_to_consumable_array(newRuleContexts));
|
|
15803
15251
|
var ruleContexts = transformRuleContexts(nextRuleContexts).slice(0, 10);
|
|
15804
15252
|
if (!isEqual(previousRuleContexts, ruleContexts)) {
|
|
15805
|
-
helper.overrideStateWithoutTriggeringChangeEvent(
|
|
15253
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_object_spread_props(_object_spread({}, sharedHelperState), {
|
|
15806
15254
|
ruleContexts: ruleContexts
|
|
15807
15255
|
}));
|
|
15808
15256
|
}
|
|
@@ -15851,13 +15299,13 @@
|
|
|
15851
15299
|
// any `ruleContexts` needed based on the `trackedFilters`.
|
|
15852
15300
|
helper.on('change', onHelperChange);
|
|
15853
15301
|
}
|
|
15854
|
-
render(
|
|
15302
|
+
render(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
15855
15303
|
instantSearchInstance: instantSearchInstance
|
|
15856
15304
|
}), true);
|
|
15857
15305
|
},
|
|
15858
15306
|
render: function render1(renderOptions) {
|
|
15859
15307
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
15860
|
-
render(
|
|
15308
|
+
render(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
15861
15309
|
instantSearchInstance: instantSearchInstance
|
|
15862
15310
|
}), false);
|
|
15863
15311
|
},
|
|
@@ -15873,7 +15321,7 @@
|
|
|
15873
15321
|
};
|
|
15874
15322
|
},
|
|
15875
15323
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
15876
|
-
return
|
|
15324
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
15877
15325
|
queryRules: this.getWidgetRenderState(renderOptions)
|
|
15878
15326
|
});
|
|
15879
15327
|
},
|
|
@@ -15942,8 +15390,8 @@
|
|
|
15942
15390
|
var getRefinedState = function getRefinedState(helper, currentRange, nextMin, nextMax) {
|
|
15943
15391
|
var resolvedState = helper.state;
|
|
15944
15392
|
var currentRangeMin = currentRange.min, currentRangeMax = currentRange.max;
|
|
15945
|
-
var _ref =
|
|
15946
|
-
var _ref1 =
|
|
15393
|
+
var _ref = _sliced_to_array(resolvedState.getNumericRefinement(attribute, '>=') || [], 1), min = _ref[0];
|
|
15394
|
+
var _ref1 = _sliced_to_array(resolvedState.getNumericRefinement(attribute, '<=') || [], 1), max = _ref1[0];
|
|
15947
15395
|
var isResetMin = nextMin === undefined || nextMin === '';
|
|
15948
15396
|
var isResetMax = nextMax === undefined || nextMax === '';
|
|
15949
15397
|
var _toPrecision = toPrecision({
|
|
@@ -16022,8 +15470,8 @@
|
|
|
16022
15470
|
});
|
|
16023
15471
|
}
|
|
16024
15472
|
function _getCurrentRefinement(helper) {
|
|
16025
|
-
var _ref =
|
|
16026
|
-
var _ref1 =
|
|
15473
|
+
var _ref = _sliced_to_array(helper.getNumericRefinement(attribute, '>=') || [], 1), minValue = _ref[0];
|
|
15474
|
+
var _ref1 = _sliced_to_array(helper.getNumericRefinement(attribute, '<=') || [], 1), maxValue = _ref1[0];
|
|
16027
15475
|
var min = isFiniteNumber(minValue) ? minValue : -Infinity;
|
|
16028
15476
|
var max = isFiniteNumber(maxValue) ? maxValue : Infinity;
|
|
16029
15477
|
return [
|
|
@@ -16033,7 +15481,7 @@
|
|
|
16033
15481
|
}
|
|
16034
15482
|
function _refine(helper, currentRange) {
|
|
16035
15483
|
return function() {
|
|
16036
|
-
var _ref =
|
|
15484
|
+
var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [
|
|
16037
15485
|
undefined,
|
|
16038
15486
|
undefined
|
|
16039
15487
|
], 2), nextMin = _ref[0], nextMax = _ref[1];
|
|
@@ -16046,18 +15494,18 @@
|
|
|
16046
15494
|
return {
|
|
16047
15495
|
$$type: $$type$1,
|
|
16048
15496
|
init: function init(initOptions) {
|
|
16049
|
-
renderFn(
|
|
15497
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16050
15498
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
16051
15499
|
}), true);
|
|
16052
15500
|
},
|
|
16053
15501
|
render: function render(renderOptions) {
|
|
16054
|
-
renderFn(
|
|
15502
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16055
15503
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
16056
15504
|
}), false);
|
|
16057
15505
|
},
|
|
16058
15506
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16059
|
-
return
|
|
16060
|
-
range:
|
|
15507
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
15508
|
+
range: _object_spread_props(_object_spread({}, renderState.range), _define_property({}, attribute, this.getWidgetRenderState(renderOptions)))
|
|
16061
15509
|
});
|
|
16062
15510
|
},
|
|
16063
15511
|
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
@@ -16090,7 +15538,7 @@
|
|
|
16090
15538
|
format: rangeFormatter,
|
|
16091
15539
|
range: currentRange,
|
|
16092
15540
|
sendEvent: createSendEvent(instantSearchInstance),
|
|
16093
|
-
widgetParams:
|
|
15541
|
+
widgetParams: _object_spread_props(_object_spread({}, widgetParams), {
|
|
16094
15542
|
precision: precision
|
|
16095
15543
|
}),
|
|
16096
15544
|
start: start
|
|
@@ -16107,14 +15555,14 @@
|
|
|
16107
15555
|
if (min.length === 0 && max.length === 0) {
|
|
16108
15556
|
return uiState;
|
|
16109
15557
|
}
|
|
16110
|
-
return
|
|
16111
|
-
range:
|
|
15558
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
15559
|
+
range: _object_spread_props(_object_spread({}, uiState.range), _define_property({}, attribute, "".concat(min, ":").concat(max)))
|
|
16112
15560
|
});
|
|
16113
15561
|
},
|
|
16114
15562
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
16115
15563
|
var uiState = param.uiState;
|
|
16116
15564
|
var widgetSearchParameters = searchParameters.addDisjunctiveFacet(attribute).setQueryParameters({
|
|
16117
|
-
numericRefinements:
|
|
15565
|
+
numericRefinements: _object_spread_props(_object_spread({}, searchParameters.numericRefinements), _define_property({}, attribute, {}))
|
|
16118
15566
|
});
|
|
16119
15567
|
if (isFiniteNumber(minBound)) {
|
|
16120
15568
|
widgetSearchParameters = widgetSearchParameters.addNumericRefinement(attribute, '>=', minBound);
|
|
@@ -16126,7 +15574,7 @@
|
|
|
16126
15574
|
if (!value || value.indexOf(':') === -1) {
|
|
16127
15575
|
return widgetSearchParameters;
|
|
16128
15576
|
}
|
|
16129
|
-
var _value_split_map =
|
|
15577
|
+
var _value_split_map = _sliced_to_array(value.split(':').map(parseFloat), 2), lowerBound = _value_split_map[0], upperBound = _value_split_map[1];
|
|
16130
15578
|
if (isFiniteNumber(lowerBound) && (!isFiniteNumber(minBound) || minBound < lowerBound)) {
|
|
16131
15579
|
widgetSearchParameters = widgetSearchParameters.removeNumericRefinement(attribute, '>=');
|
|
16132
15580
|
widgetSearchParameters = widgetSearchParameters.addNumericRefinement(attribute, '>=', lowerBound);
|
|
@@ -16182,11 +15630,11 @@
|
|
|
16182
15630
|
throw new Error(withUsage$8('`showMoreLimit` should be greater than `limit`.'));
|
|
16183
15631
|
}
|
|
16184
15632
|
var formatItems = function formatItems(_0) {
|
|
16185
|
-
var label = _0.name, value = _0.escapedValue, item =
|
|
15633
|
+
var label = _0.name, value = _0.escapedValue, item = _object_without_properties(_0, [
|
|
16186
15634
|
"name",
|
|
16187
15635
|
"escapedValue"
|
|
16188
15636
|
]);
|
|
16189
|
-
return
|
|
15637
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
16190
15638
|
value: value,
|
|
16191
15639
|
label: label,
|
|
16192
15640
|
highlighted: label
|
|
@@ -16222,7 +15670,7 @@
|
|
|
16222
15670
|
var instantSearchInstance = renderOptions.instantSearchInstance, searchResults = renderOptions.results;
|
|
16223
15671
|
if (query === '' && lastItemsFromMainSearch) {
|
|
16224
15672
|
// render with previous data from the helper.
|
|
16225
|
-
renderFn(
|
|
15673
|
+
renderFn(_object_spread_props(_object_spread({}, widget.getWidgetRenderState(_object_spread_props(_object_spread({}, renderOptions), {
|
|
16226
15674
|
results: lastResultsFromMainSearch
|
|
16227
15675
|
}))), {
|
|
16228
15676
|
instantSearchInstance: instantSearchInstance
|
|
@@ -16237,18 +15685,18 @@
|
|
|
16237
15685
|
Math.min(getLimit(), 100), tags).then(function(results) {
|
|
16238
15686
|
var facetValues = escapeFacetValues ? escapeFacets(results.facetHits) : results.facetHits;
|
|
16239
15687
|
var normalizedFacetValues = transformItems(facetValues.map(function(_0) {
|
|
16240
|
-
var escapedValue = _0.escapedValue, value = _0.value, item =
|
|
15688
|
+
var escapedValue = _0.escapedValue, value = _0.value, item = _object_without_properties(_0, [
|
|
16241
15689
|
"escapedValue",
|
|
16242
15690
|
"value"
|
|
16243
15691
|
]);
|
|
16244
|
-
return
|
|
15692
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
16245
15693
|
value: escapedValue,
|
|
16246
15694
|
label: value
|
|
16247
15695
|
});
|
|
16248
15696
|
}), {
|
|
16249
15697
|
results: searchResults
|
|
16250
15698
|
});
|
|
16251
|
-
renderFn(
|
|
15699
|
+
renderFn(_object_spread_props(_object_spread({}, widget.getWidgetRenderState(_object_spread_props(_object_spread({}, renderOptions), {
|
|
16252
15700
|
results: lastResultsFromMainSearch
|
|
16253
15701
|
}))), {
|
|
16254
15702
|
items: normalizedFacetValues,
|
|
@@ -16265,18 +15713,18 @@
|
|
|
16265
15713
|
return {
|
|
16266
15714
|
$$type: 'ais.refinementList',
|
|
16267
15715
|
init: function init(initOptions) {
|
|
16268
|
-
renderFn(
|
|
15716
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16269
15717
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
16270
15718
|
}), true);
|
|
16271
15719
|
},
|
|
16272
15720
|
render: function render(renderOptions) {
|
|
16273
|
-
renderFn(
|
|
15721
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16274
15722
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
16275
15723
|
}), false);
|
|
16276
15724
|
},
|
|
16277
15725
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16278
|
-
return
|
|
16279
|
-
refinementList:
|
|
15726
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
15727
|
+
refinementList: _object_spread_props(_object_spread({}, renderState.refinementList), _define_property({}, attribute, this.getWidgetRenderState(renderOptions)))
|
|
16280
15728
|
});
|
|
16281
15729
|
},
|
|
16282
15730
|
getWidgetRenderState: function getWidgetRenderState(renderOptions) {
|
|
@@ -16361,8 +15809,8 @@
|
|
|
16361
15809
|
getWidgetUiState: function getWidgetUiState(uiState, param) {
|
|
16362
15810
|
var searchParameters = param.searchParameters;
|
|
16363
15811
|
var values = operator === 'or' ? searchParameters.getDisjunctiveRefinements(attribute) : searchParameters.getConjunctiveRefinements(attribute);
|
|
16364
|
-
return removeEmptyRefinementsFromUiState(
|
|
16365
|
-
refinementList:
|
|
15812
|
+
return removeEmptyRefinementsFromUiState(_object_spread_props(_object_spread({}, uiState), {
|
|
15813
|
+
refinementList: _object_spread_props(_object_spread({}, uiState.refinementList), _define_property({}, attribute, values))
|
|
16366
15814
|
}), attribute);
|
|
16367
15815
|
},
|
|
16368
15816
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
@@ -16381,7 +15829,7 @@
|
|
|
16381
15829
|
var withMaxValuesPerFacet = withFacetConfiguration.setQueryParameter('maxValuesPerFacet', nextMaxValuesPerFacet);
|
|
16382
15830
|
if (!values) {
|
|
16383
15831
|
var key = isDisjunctive ? 'disjunctiveFacetsRefinements' : 'facetsRefinements';
|
|
16384
|
-
return withMaxValuesPerFacet.setQueryParameters(
|
|
15832
|
+
return withMaxValuesPerFacet.setQueryParameters(_define_property({}, key, _object_spread_props(_object_spread({}, withMaxValuesPerFacet[key]), _define_property({}, attribute, []))));
|
|
16385
15833
|
}
|
|
16386
15834
|
return values.reduce(function(parameters, value) {
|
|
16387
15835
|
return isDisjunctive ? parameters.addDisjunctiveFacetRefinement(attribute, value) : parameters.addFacetRefinement(attribute, value);
|
|
@@ -16426,13 +15874,13 @@
|
|
|
16426
15874
|
dependsOn: 'recommend',
|
|
16427
15875
|
$$type: 'ais.relatedProducts',
|
|
16428
15876
|
init: function init(initOptions) {
|
|
16429
|
-
renderFn(
|
|
15877
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16430
15878
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
16431
15879
|
}), true);
|
|
16432
15880
|
},
|
|
16433
15881
|
render: function render(renderOptions) {
|
|
16434
15882
|
var renderState = this.getWidgetRenderState(renderOptions);
|
|
16435
|
-
renderFn(
|
|
15883
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
16436
15884
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
16437
15885
|
}), false);
|
|
16438
15886
|
},
|
|
@@ -16481,8 +15929,8 @@
|
|
|
16481
15929
|
objectID: objectID,
|
|
16482
15930
|
maxRecommendations: limit,
|
|
16483
15931
|
threshold: threshold,
|
|
16484
|
-
fallbackParameters: fallbackParameters ?
|
|
16485
|
-
queryParameters:
|
|
15932
|
+
fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
|
|
15933
|
+
queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
16486
15934
|
$$id: _this.$$id
|
|
16487
15935
|
});
|
|
16488
15936
|
}, state.removeParams(this.$$id));
|
|
@@ -16518,13 +15966,13 @@
|
|
|
16518
15966
|
$$type: 'ais.searchBox',
|
|
16519
15967
|
init: function init(initOptions) {
|
|
16520
15968
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
16521
|
-
renderFn(
|
|
15969
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16522
15970
|
instantSearchInstance: instantSearchInstance
|
|
16523
15971
|
}), true);
|
|
16524
15972
|
},
|
|
16525
15973
|
render: function render(renderOptions) {
|
|
16526
15974
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
16527
|
-
renderFn(
|
|
15975
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16528
15976
|
instantSearchInstance: instantSearchInstance
|
|
16529
15977
|
}), false);
|
|
16530
15978
|
},
|
|
@@ -16534,7 +15982,7 @@
|
|
|
16534
15982
|
return state.setQueryParameter('query', undefined);
|
|
16535
15983
|
},
|
|
16536
15984
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16537
|
-
return
|
|
15985
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
16538
15986
|
searchBox: this.getWidgetRenderState(renderOptions)
|
|
16539
15987
|
});
|
|
16540
15988
|
},
|
|
@@ -16564,7 +16012,7 @@
|
|
|
16564
16012
|
if (query === '' || uiState && uiState.query === query) {
|
|
16565
16013
|
return uiState;
|
|
16566
16014
|
}
|
|
16567
|
-
return
|
|
16015
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
16568
16016
|
query: query
|
|
16569
16017
|
});
|
|
16570
16018
|
},
|
|
@@ -16640,13 +16088,13 @@
|
|
|
16640
16088
|
find(items, function(item) {
|
|
16641
16089
|
return getItemValue(item) === currentIndex;
|
|
16642
16090
|
});
|
|
16643
|
-
renderFn(
|
|
16091
|
+
renderFn(_object_spread_props(_object_spread({}, widgetRenderState), {
|
|
16644
16092
|
instantSearchInstance: instantSearchInstance
|
|
16645
16093
|
}), true);
|
|
16646
16094
|
},
|
|
16647
16095
|
render: function render(renderOptions) {
|
|
16648
16096
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
16649
|
-
renderFn(
|
|
16097
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16650
16098
|
instantSearchInstance: instantSearchInstance
|
|
16651
16099
|
}), false);
|
|
16652
16100
|
},
|
|
@@ -16664,7 +16112,7 @@
|
|
|
16664
16112
|
return state;
|
|
16665
16113
|
},
|
|
16666
16114
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16667
|
-
return
|
|
16115
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
16668
16116
|
sortBy: this.getWidgetRenderState(renderOptions)
|
|
16669
16117
|
});
|
|
16670
16118
|
},
|
|
@@ -16722,7 +16170,7 @@
|
|
|
16722
16170
|
// In composition mode with an active strategy, use sortBy parameter
|
|
16723
16171
|
// Otherwise use index-based behavior (traditional mode)
|
|
16724
16172
|
var currentValue = connectorState.isUsingComposition && isValidStrategy(connectorState.itemsLookup, searchParameters.sortBy) ? searchParameters.sortBy : searchParameters.index;
|
|
16725
|
-
return
|
|
16173
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
16726
16174
|
sortBy: currentValue !== connectorState.initialValue ? currentValue : undefined
|
|
16727
16175
|
});
|
|
16728
16176
|
},
|
|
@@ -16758,13 +16206,13 @@
|
|
|
16758
16206
|
$$type: 'ais.stats',
|
|
16759
16207
|
init: function init(initOptions) {
|
|
16760
16208
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
16761
|
-
renderFn(
|
|
16209
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16762
16210
|
instantSearchInstance: instantSearchInstance
|
|
16763
16211
|
}), true);
|
|
16764
16212
|
},
|
|
16765
16213
|
render: function render(renderOptions) {
|
|
16766
16214
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
16767
|
-
renderFn(
|
|
16215
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16768
16216
|
instantSearchInstance: instantSearchInstance
|
|
16769
16217
|
}), false);
|
|
16770
16218
|
},
|
|
@@ -16772,7 +16220,7 @@
|
|
|
16772
16220
|
unmountFn();
|
|
16773
16221
|
},
|
|
16774
16222
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16775
|
-
return
|
|
16223
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
16776
16224
|
stats: this.getWidgetRenderState(renderOptions)
|
|
16777
16225
|
});
|
|
16778
16226
|
},
|
|
@@ -16826,8 +16274,8 @@
|
|
|
16826
16274
|
instantSearchInstance.sendEventToInsights(args[0]);
|
|
16827
16275
|
return;
|
|
16828
16276
|
}
|
|
16829
|
-
var _args =
|
|
16830
|
-
var _args__split =
|
|
16277
|
+
var _args = _sliced_to_array(args, 3), isRefined = _args[1], tmp = _args[2], eventName = tmp === void 0 ? 'Filter Applied' : tmp;
|
|
16278
|
+
var _args__split = _sliced_to_array(args[0].split(':'), 2), eventType = _args__split[0], eventModifier = _args__split[1];
|
|
16831
16279
|
if (eventType !== 'click' || on === undefined) {
|
|
16832
16280
|
return;
|
|
16833
16281
|
}
|
|
@@ -16932,13 +16380,13 @@
|
|
|
16932
16380
|
$$type: $$type,
|
|
16933
16381
|
init: function init(initOptions) {
|
|
16934
16382
|
var instantSearchInstance = initOptions.instantSearchInstance;
|
|
16935
|
-
renderFn(
|
|
16383
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
16936
16384
|
instantSearchInstance: instantSearchInstance
|
|
16937
16385
|
}), true);
|
|
16938
16386
|
},
|
|
16939
16387
|
render: function render(renderOptions) {
|
|
16940
16388
|
var instantSearchInstance = renderOptions.instantSearchInstance;
|
|
16941
|
-
renderFn(
|
|
16389
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(renderOptions)), {
|
|
16942
16390
|
instantSearchInstance: instantSearchInstance
|
|
16943
16391
|
}), false);
|
|
16944
16392
|
},
|
|
@@ -16948,8 +16396,8 @@
|
|
|
16948
16396
|
return state.removeDisjunctiveFacet(attribute);
|
|
16949
16397
|
},
|
|
16950
16398
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
16951
|
-
return
|
|
16952
|
-
toggleRefinement:
|
|
16399
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
16400
|
+
toggleRefinement: _object_spread_props(_object_spread({}, renderState.toggleRefinement), _define_property({}, attribute, this.getWidgetRenderState(renderOptions)))
|
|
16953
16401
|
});
|
|
16954
16402
|
},
|
|
16955
16403
|
getWidgetRenderState: function getWidgetRenderState(param) {
|
|
@@ -17046,8 +16494,8 @@
|
|
|
17046
16494
|
(_uiState_toggle = uiState.toggle) === null || _uiState_toggle === void 0 ? true : delete _uiState_toggle[attribute];
|
|
17047
16495
|
return uiState;
|
|
17048
16496
|
}
|
|
17049
|
-
return
|
|
17050
|
-
toggle:
|
|
16497
|
+
return _object_spread_props(_object_spread({}, uiState), {
|
|
16498
|
+
toggle: _object_spread_props(_object_spread({}, uiState.toggle), _define_property({}, attribute, isRefined))
|
|
17051
16499
|
});
|
|
17052
16500
|
},
|
|
17053
16501
|
getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, param) {
|
|
@@ -17076,7 +16524,7 @@
|
|
|
17076
16524
|
}
|
|
17077
16525
|
// It's not refined without an `off` value
|
|
17078
16526
|
return withFacetConfiguration.setQueryParameters({
|
|
17079
|
-
disjunctiveFacetsRefinements:
|
|
16527
|
+
disjunctiveFacetsRefinements: _object_spread_props(_object_spread({}, searchParameters.disjunctiveFacetsRefinements), _define_property({}, attribute, []))
|
|
17080
16528
|
});
|
|
17081
16529
|
}
|
|
17082
16530
|
};
|
|
@@ -17106,13 +16554,13 @@
|
|
|
17106
16554
|
dependsOn: 'recommend',
|
|
17107
16555
|
$$type: 'ais.trendingItems',
|
|
17108
16556
|
init: function init(initOptions) {
|
|
17109
|
-
renderFn(
|
|
16557
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
17110
16558
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
17111
16559
|
}), true);
|
|
17112
16560
|
},
|
|
17113
16561
|
render: function render(renderOptions) {
|
|
17114
16562
|
var renderState = this.getWidgetRenderState(renderOptions);
|
|
17115
|
-
renderFn(
|
|
16563
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
17116
16564
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
17117
16565
|
}), false);
|
|
17118
16566
|
},
|
|
@@ -17160,8 +16608,8 @@
|
|
|
17160
16608
|
facetValue: facetValue,
|
|
17161
16609
|
maxRecommendations: limit,
|
|
17162
16610
|
threshold: threshold,
|
|
17163
|
-
fallbackParameters: fallbackParameters ?
|
|
17164
|
-
queryParameters:
|
|
16611
|
+
fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
|
|
16612
|
+
queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
17165
16613
|
$$id: this.$$id
|
|
17166
16614
|
});
|
|
17167
16615
|
}
|
|
@@ -17192,13 +16640,13 @@
|
|
|
17192
16640
|
dependsOn: 'recommend',
|
|
17193
16641
|
$$type: 'ais.lookingSimilar',
|
|
17194
16642
|
init: function init(initOptions) {
|
|
17195
|
-
renderFn(
|
|
16643
|
+
renderFn(_object_spread_props(_object_spread({}, this.getWidgetRenderState(initOptions)), {
|
|
17196
16644
|
instantSearchInstance: initOptions.instantSearchInstance
|
|
17197
16645
|
}), true);
|
|
17198
16646
|
},
|
|
17199
16647
|
render: function render(renderOptions) {
|
|
17200
16648
|
var renderState = this.getWidgetRenderState(renderOptions);
|
|
17201
|
-
renderFn(
|
|
16649
|
+
renderFn(_object_spread_props(_object_spread({}, renderState), {
|
|
17202
16650
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
17203
16651
|
}), false);
|
|
17204
16652
|
},
|
|
@@ -17247,8 +16695,8 @@
|
|
|
17247
16695
|
objectID: objectID,
|
|
17248
16696
|
maxRecommendations: limit,
|
|
17249
16697
|
threshold: threshold,
|
|
17250
|
-
fallbackParameters: fallbackParameters ?
|
|
17251
|
-
queryParameters:
|
|
16698
|
+
fallbackParameters: fallbackParameters ? _object_spread({}, fallbackParameters, escapeHTML ? TAG_PLACEHOLDER : {}) : undefined,
|
|
16699
|
+
queryParameters: _object_spread({}, queryParameters, escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
17252
16700
|
$$id: _this.$$id
|
|
17253
16701
|
});
|
|
17254
16702
|
}, state.removeParams(this.$$id));
|
|
@@ -17309,21 +16757,21 @@
|
|
|
17309
16757
|
if (!(results === null || results === void 0 ? void 0 : (_results_hits = results.hits) === null || _results_hits === void 0 ? void 0 : _results_hits.length)) {
|
|
17310
16758
|
suggestions = [];
|
|
17311
16759
|
isLoading = false;
|
|
17312
|
-
renderFn(
|
|
16760
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(renderOptions)), {
|
|
17313
16761
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
17314
16762
|
}), false);
|
|
17315
16763
|
return;
|
|
17316
16764
|
}
|
|
17317
16765
|
var loadingStartTime = Date.now();
|
|
17318
16766
|
isLoading = true;
|
|
17319
|
-
renderFn(
|
|
16767
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(renderOptions)), {
|
|
17320
16768
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
17321
16769
|
}), false);
|
|
17322
16770
|
// Get facets from raw results (results.facets is processed differently)
|
|
17323
16771
|
var rawResults = results._rawResults;
|
|
17324
16772
|
var rawFacets = (rawResults === null || rawResults === void 0 ? void 0 : (_rawResults_ = rawResults[0]) === null || _rawResults_ === void 0 ? void 0 : _rawResults_.facets) || {};
|
|
17325
16773
|
var facetsToSend = attributes ? Object.fromEntries(Object.entries(rawFacets).filter(function(param) {
|
|
17326
|
-
var _param =
|
|
16774
|
+
var _param = _sliced_to_array(param, 1), key = _param[0];
|
|
17327
16775
|
return attributes.includes(key);
|
|
17328
16776
|
})) : rawFacets;
|
|
17329
16777
|
// Collect current refinements to exclude from suggestions
|
|
@@ -17359,7 +16807,7 @@
|
|
|
17359
16807
|
var finalPayload = (transport === null || transport === void 0 ? void 0 : transport.prepareSendMessagesRequest) ? transport.prepareSendMessagesRequest(payload).body : payload;
|
|
17360
16808
|
fetch(endpoint, {
|
|
17361
16809
|
method: 'POST',
|
|
17362
|
-
headers:
|
|
16810
|
+
headers: _object_spread_props(_object_spread({}, headers), {
|
|
17363
16811
|
'Content-Type': 'application/json'
|
|
17364
16812
|
}),
|
|
17365
16813
|
body: JSON.stringify(finalPayload)
|
|
@@ -17388,7 +16836,7 @@
|
|
|
17388
16836
|
var remainingDelay = Math.max(0, MIN_SKELETON_DURATION_MS - elapsed);
|
|
17389
16837
|
var finishLoading = function finishLoading() {
|
|
17390
16838
|
isLoading = false;
|
|
17391
|
-
renderFn(
|
|
16839
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(renderOptions)), {
|
|
17392
16840
|
instantSearchInstance: renderOptions.instantSearchInstance
|
|
17393
16841
|
}), false);
|
|
17394
16842
|
};
|
|
@@ -17410,7 +16858,7 @@
|
|
|
17410
16858
|
headers = transport.headers || {};
|
|
17411
16859
|
} else {
|
|
17412
16860
|
// Use default Algolia agent endpoint
|
|
17413
|
-
var _getAppIdAndApiKey =
|
|
16861
|
+
var _getAppIdAndApiKey = _sliced_to_array(getAppIdAndApiKey(instantSearchInstance.client), 2), appId = _getAppIdAndApiKey[0], apiKey = _getAppIdAndApiKey[1];
|
|
17414
16862
|
if (!appId || !apiKey) {
|
|
17415
16863
|
throw new Error(withUsage('Could not extract Algolia credentials from the search client.'));
|
|
17416
16864
|
}
|
|
@@ -17431,7 +16879,7 @@
|
|
|
17431
16879
|
helper.toggleFacetRefinement(attr, value);
|
|
17432
16880
|
helper.search();
|
|
17433
16881
|
};
|
|
17434
|
-
renderFn(
|
|
16882
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(initOptions)), {
|
|
17435
16883
|
instantSearchInstance: instantSearchInstance
|
|
17436
16884
|
}), true);
|
|
17437
16885
|
},
|
|
@@ -17440,7 +16888,7 @@
|
|
|
17440
16888
|
// Always store the latest render options
|
|
17441
16889
|
latestRenderOptions = renderOptions;
|
|
17442
16890
|
if (!results) {
|
|
17443
|
-
renderFn(
|
|
16891
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(renderOptions)), {
|
|
17444
16892
|
instantSearchInstance: instantSearchInstance
|
|
17445
16893
|
}), false);
|
|
17446
16894
|
return;
|
|
@@ -17457,7 +16905,7 @@
|
|
|
17457
16905
|
}
|
|
17458
16906
|
}, debounceMs);
|
|
17459
16907
|
}
|
|
17460
|
-
renderFn(
|
|
16908
|
+
renderFn(_object_spread_props(_object_spread({}, getWidgetRenderState(renderOptions)), {
|
|
17461
16909
|
instantSearchInstance: instantSearchInstance
|
|
17462
16910
|
}), false);
|
|
17463
16911
|
},
|
|
@@ -17466,7 +16914,7 @@
|
|
|
17466
16914
|
unmountFn();
|
|
17467
16915
|
},
|
|
17468
16916
|
getRenderState: function getRenderState(renderState, renderOptions) {
|
|
17469
|
-
return
|
|
16917
|
+
return _object_spread_props(_object_spread({}, renderState), {
|
|
17470
16918
|
filterSuggestions: this.getWidgetRenderState(renderOptions)
|
|
17471
16919
|
});
|
|
17472
16920
|
},
|
|
@@ -17484,7 +16932,7 @@
|
|
|
17484
16932
|
function useSearchResults() {
|
|
17485
16933
|
var search = useInstantSearchContext();
|
|
17486
16934
|
var searchIndex = useIndexContext();
|
|
17487
|
-
var _useState = _sliced_to_array
|
|
16935
|
+
var _useState = _sliced_to_array(React.useState(function() {
|
|
17488
16936
|
var indexSearchResults = getIndexSearchResults(searchIndex);
|
|
17489
16937
|
// We do this not to leak `recommendResults` in the API.
|
|
17490
16938
|
return {
|
|
@@ -17532,11 +16980,11 @@
|
|
|
17532
16980
|
var search = useInstantSearchContext();
|
|
17533
16981
|
var searchIndex = useIndexContext();
|
|
17534
16982
|
var indexId = searchIndex.getIndexId();
|
|
17535
|
-
var _useState = _sliced_to_array
|
|
16983
|
+
var _useState = _sliced_to_array(React.useState(function() {
|
|
17536
16984
|
return search.getUiState();
|
|
17537
16985
|
}), 2), uiState = _useState[0], setLocalUiState = _useState[1];
|
|
17538
16986
|
var indexUiState = uiState[indexId];
|
|
17539
|
-
var _useState1 = _sliced_to_array
|
|
16987
|
+
var _useState1 = _sliced_to_array(React.useState(function() {
|
|
17540
16988
|
return search.renderState;
|
|
17541
16989
|
}), 2), renderState = _useState1[0], setRenderState = _useState1[1];
|
|
17542
16990
|
var indexRenderState = renderState[indexId] || {};
|
|
@@ -17665,7 +17113,7 @@
|
|
|
17665
17113
|
var requestParamsList;
|
|
17666
17114
|
var client = helper.getClient();
|
|
17667
17115
|
if (search.compositionID) {
|
|
17668
|
-
helper.setClient(
|
|
17116
|
+
helper.setClient(_object_spread_props(_object_spread({}, client), {
|
|
17669
17117
|
search: function search(query) {
|
|
17670
17118
|
requestParamsList = [
|
|
17671
17119
|
query.requestBody.params
|
|
@@ -17674,7 +17122,7 @@
|
|
|
17674
17122
|
}
|
|
17675
17123
|
}));
|
|
17676
17124
|
} else {
|
|
17677
|
-
helper.setClient(
|
|
17125
|
+
helper.setClient(_object_spread_props(_object_spread({}, client), {
|
|
17678
17126
|
search: function search(queries) {
|
|
17679
17127
|
requestParamsList = queries.map(function(param) {
|
|
17680
17128
|
var params = param.params;
|
|
@@ -17741,8 +17189,8 @@
|
|
|
17741
17189
|
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
17190
|
var requestParams = resultsCount ? requestParamsList === null || requestParamsList === void 0 ? void 0 : requestParamsList.slice(requestParamsIndex, requestParamsIndex + resultsCount) : [];
|
|
17743
17191
|
requestParamsIndex += resultsCount;
|
|
17744
|
-
initialResults[widget.getIndexId()] =
|
|
17745
|
-
state:
|
|
17192
|
+
initialResults[widget.getIndexId()] = _object_spread({}, searchResults && {
|
|
17193
|
+
state: _object_spread_props(_object_spread({}, searchResults._state), {
|
|
17746
17194
|
clickAnalytics: requestParams === null || requestParams === void 0 ? void 0 : (_requestParams_ = requestParams[0]) === null || _requestParams_ === void 0 ? void 0 : _requestParams_.clickAnalytics,
|
|
17747
17195
|
userToken: requestParams === null || requestParams === void 0 ? void 0 : (_requestParams_1 = requestParams[0]) === null || _requestParams_1 === void 0 ? void 0 : _requestParams_1.userToken
|
|
17748
17196
|
}),
|