instantsearch.js 4.44.0 → 4.44.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/CHANGELOG.md +9 -0
- package/cjs/connectors/numeric-menu/connectNumericMenu.js +4 -41
- package/cjs/connectors/range/connectRange.js +7 -46
- package/cjs/lib/version.js +1 -1
- package/dist/instantsearch.development.js +13 -114
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/numeric-menu/connectNumericMenu.js +5 -42
- package/es/connectors/range/connectRange.js +8 -47
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [4.44.1](https://github.com/algolia/instantsearch.js/compare/v4.44.0...v4.44.1) (2022-08-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **connectNumericMenu + connectRange:** stop sending invalid clickedFilters event ([#5085](https://github.com/algolia/instantsearch.js/issues/5085)) ([20996c7](https://github.com/algolia/instantsearch.js/commit/20996c7a159988c58e00ff24d2d2dc98af8b980f))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
# [4.44.0](https://github.com/algolia/instantsearch.js/compare/v4.43.1...v4.44.0) (2022-08-08)
|
|
2
11
|
|
|
3
12
|
|
|
@@ -32,47 +32,12 @@ var withUsage = (0, _index.createDocumentationMessageGenerator)({
|
|
|
32
32
|
var $$type = 'ais.numericMenu';
|
|
33
33
|
|
|
34
34
|
var createSendEvent = function createSendEvent(_ref) {
|
|
35
|
-
var instantSearchInstance = _ref.instantSearchInstance
|
|
36
|
-
helper = _ref.helper,
|
|
37
|
-
attribute = _ref.attribute;
|
|
35
|
+
var instantSearchInstance = _ref.instantSearchInstance;
|
|
38
36
|
return function () {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (args.length === 1) {
|
|
44
|
-
instantSearchInstance.sendEventToInsights(args[0]);
|
|
37
|
+
if (arguments.length === 1) {
|
|
38
|
+
instantSearchInstance.sendEventToInsights(arguments.length <= 0 ? undefined : arguments[0]);
|
|
45
39
|
return;
|
|
46
40
|
}
|
|
47
|
-
|
|
48
|
-
var eventType = args[0],
|
|
49
|
-
facetValue = args[1],
|
|
50
|
-
_args$ = args[2],
|
|
51
|
-
eventName = _args$ === void 0 ? 'Filter Applied' : _args$;
|
|
52
|
-
|
|
53
|
-
if (eventType !== 'click') {
|
|
54
|
-
return;
|
|
55
|
-
} // facetValue === "%7B%22start%22:5,%22end%22:10%7D"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var filters = (0, _index.convertNumericRefinementsToFilters)(getRefinedState(helper.state, attribute, facetValue), attribute);
|
|
59
|
-
|
|
60
|
-
if (filters && filters.length > 0) {
|
|
61
|
-
/*
|
|
62
|
-
filters === ["price<=10", "price>=5"]
|
|
63
|
-
*/
|
|
64
|
-
instantSearchInstance.sendEventToInsights({
|
|
65
|
-
insightsMethod: 'clickedFilters',
|
|
66
|
-
widgetType: $$type,
|
|
67
|
-
eventType: eventType,
|
|
68
|
-
payload: {
|
|
69
|
-
eventName: eventName,
|
|
70
|
-
index: helper.getIndex(),
|
|
71
|
-
filters: filters
|
|
72
|
-
},
|
|
73
|
-
attribute: attribute
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
41
|
};
|
|
77
42
|
};
|
|
78
43
|
|
|
@@ -216,9 +181,7 @@ var connectNumericMenu = function connectNumericMenu(renderFn) {
|
|
|
216
181
|
|
|
217
182
|
if (!connectorState.sendEvent) {
|
|
218
183
|
connectorState.sendEvent = createSendEvent({
|
|
219
|
-
instantSearchInstance: instantSearchInstance
|
|
220
|
-
helper: helper,
|
|
221
|
-
attribute: attribute
|
|
184
|
+
instantSearchInstance: instantSearchInstance
|
|
222
185
|
});
|
|
223
186
|
}
|
|
224
187
|
|
|
@@ -156,50 +156,12 @@ var connectRange = function connectRange(renderFn) {
|
|
|
156
156
|
return null;
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
-
var
|
|
160
|
-
var eventName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'Filter Applied';
|
|
161
|
-
var filters = (0, _index.convertNumericRefinementsToFilters)(refinedState, attribute);
|
|
162
|
-
|
|
163
|
-
if (filters && filters.length > 0) {
|
|
164
|
-
instantSearchInstance.sendEventToInsights({
|
|
165
|
-
insightsMethod: 'clickedFilters',
|
|
166
|
-
widgetType: $$type,
|
|
167
|
-
eventType: 'click',
|
|
168
|
-
payload: {
|
|
169
|
-
eventName: eventName,
|
|
170
|
-
index: helper.getIndex(),
|
|
171
|
-
filters: filters
|
|
172
|
-
},
|
|
173
|
-
attribute: attribute
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
var createSendEvent = function createSendEvent(instantSearchInstance, helper, currentRange) {
|
|
159
|
+
var createSendEvent = function createSendEvent(instantSearchInstance) {
|
|
179
160
|
return function () {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (args.length === 1) {
|
|
185
|
-
instantSearchInstance.sendEventToInsights(args[0]);
|
|
161
|
+
if (arguments.length === 1) {
|
|
162
|
+
instantSearchInstance.sendEventToInsights(arguments.length <= 0 ? undefined : arguments[0]);
|
|
186
163
|
return;
|
|
187
164
|
}
|
|
188
|
-
|
|
189
|
-
var eventType = args[0],
|
|
190
|
-
facetValue = args[1],
|
|
191
|
-
eventName = args[2];
|
|
192
|
-
|
|
193
|
-
if (eventType !== 'click') {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
var _facetValue = _slicedToArray(facetValue, 2),
|
|
198
|
-
nextMin = _facetValue[0],
|
|
199
|
-
nextMax = _facetValue[1];
|
|
200
|
-
|
|
201
|
-
var refinedState = getRefinedState(helper, currentRange, nextMin, nextMax);
|
|
202
|
-
sendEventWithRefinedState(refinedState, instantSearchInstance, helper, eventName);
|
|
203
165
|
};
|
|
204
166
|
};
|
|
205
167
|
|
|
@@ -245,7 +207,7 @@ var connectRange = function connectRange(renderFn) {
|
|
|
245
207
|
return [min, max];
|
|
246
208
|
}
|
|
247
209
|
|
|
248
|
-
function _refine(
|
|
210
|
+
function _refine(helper, currentRange) {
|
|
249
211
|
return function () {
|
|
250
212
|
var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [undefined, undefined],
|
|
251
213
|
_ref12 = _slicedToArray(_ref11, 2),
|
|
@@ -255,7 +217,6 @@ var connectRange = function connectRange(renderFn) {
|
|
|
255
217
|
var refinedState = getRefinedState(helper, currentRange, nextMin, nextMax);
|
|
256
218
|
|
|
257
219
|
if (refinedState) {
|
|
258
|
-
sendEventWithRefinedState(refinedState, instantSearchInstance, helper);
|
|
259
220
|
helper.setState(refinedState).search();
|
|
260
221
|
}
|
|
261
222
|
};
|
|
@@ -301,12 +262,12 @@ var connectRange = function connectRange(renderFn) {
|
|
|
301
262
|
// On first render pass an empty range
|
|
302
263
|
// to be able to bypass the validation
|
|
303
264
|
// related to it
|
|
304
|
-
refine = _refine(
|
|
265
|
+
refine = _refine(helper, {
|
|
305
266
|
min: undefined,
|
|
306
267
|
max: undefined
|
|
307
268
|
});
|
|
308
269
|
} else {
|
|
309
|
-
refine = _refine(
|
|
270
|
+
refine = _refine(helper, currentRange);
|
|
310
271
|
}
|
|
311
272
|
|
|
312
273
|
return {
|
|
@@ -314,7 +275,7 @@ var connectRange = function connectRange(renderFn) {
|
|
|
314
275
|
canRefine: currentRange.min !== currentRange.max,
|
|
315
276
|
format: rangeFormatter,
|
|
316
277
|
range: currentRange,
|
|
317
|
-
sendEvent: createSendEvent(instantSearchInstance
|
|
278
|
+
sendEvent: createSendEvent(instantSearchInstance),
|
|
318
279
|
widgetParams: _objectSpread(_objectSpread({}, widgetParams), {}, {
|
|
319
280
|
precision: precision
|
|
320
281
|
}),
|
package/cjs/lib/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.44.
|
|
1
|
+
/*! InstantSearch.js 4.44.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -7918,31 +7918,6 @@
|
|
|
7918
7918
|
}
|
|
7919
7919
|
}
|
|
7920
7920
|
|
|
7921
|
-
function convertNumericRefinementsToFilters(state, attribute) {
|
|
7922
|
-
if (!state) {
|
|
7923
|
-
return null;
|
|
7924
|
-
}
|
|
7925
|
-
|
|
7926
|
-
var filtersObj = state.numericRefinements[attribute];
|
|
7927
|
-
/*
|
|
7928
|
-
filtersObj === {
|
|
7929
|
-
"<=": [10],
|
|
7930
|
-
"=": [],
|
|
7931
|
-
">=": [5]
|
|
7932
|
-
}
|
|
7933
|
-
*/
|
|
7934
|
-
|
|
7935
|
-
var filters = [];
|
|
7936
|
-
Object.keys(filtersObj).filter(function (operator) {
|
|
7937
|
-
return Array.isArray(filtersObj[operator]) && filtersObj[operator].length > 0;
|
|
7938
|
-
}).forEach(function (operator) {
|
|
7939
|
-
filtersObj[operator].forEach(function (value) {
|
|
7940
|
-
filters.push("".concat(attribute).concat(operator).concat(value));
|
|
7941
|
-
});
|
|
7942
|
-
});
|
|
7943
|
-
return filters;
|
|
7944
|
-
}
|
|
7945
|
-
|
|
7946
7921
|
// copied from
|
|
7947
7922
|
// https://github.com/algolia/autocomplete.js/blob/307a7acc4283e10a19cb7d067f04f1bea79dc56f/packages/autocomplete-core/src/utils/createConcurrentSafePromise.ts#L1:L1
|
|
7948
7923
|
|
|
@@ -8603,7 +8578,7 @@
|
|
|
8603
8578
|
instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
|
|
8604
8579
|
}
|
|
8605
8580
|
|
|
8606
|
-
var version$1 = '4.44.
|
|
8581
|
+
var version$1 = '4.44.1';
|
|
8607
8582
|
|
|
8608
8583
|
var NAMESPACE = 'ais';
|
|
8609
8584
|
var component = function component(componentName) {
|
|
@@ -12117,47 +12092,12 @@
|
|
|
12117
12092
|
var $$type = 'ais.numericMenu';
|
|
12118
12093
|
|
|
12119
12094
|
var createSendEvent = function createSendEvent(_ref) {
|
|
12120
|
-
var instantSearchInstance = _ref.instantSearchInstance
|
|
12121
|
-
helper = _ref.helper,
|
|
12122
|
-
attribute = _ref.attribute;
|
|
12095
|
+
var instantSearchInstance = _ref.instantSearchInstance;
|
|
12123
12096
|
return function () {
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
}
|
|
12127
|
-
|
|
12128
|
-
if (args.length === 1) {
|
|
12129
|
-
instantSearchInstance.sendEventToInsights(args[0]);
|
|
12097
|
+
if (arguments.length === 1) {
|
|
12098
|
+
instantSearchInstance.sendEventToInsights(arguments.length <= 0 ? undefined : arguments[0]);
|
|
12130
12099
|
return;
|
|
12131
12100
|
}
|
|
12132
|
-
|
|
12133
|
-
var eventType = args[0],
|
|
12134
|
-
facetValue = args[1],
|
|
12135
|
-
_args$ = args[2],
|
|
12136
|
-
eventName = _args$ === void 0 ? 'Filter Applied' : _args$;
|
|
12137
|
-
|
|
12138
|
-
if (eventType !== 'click') {
|
|
12139
|
-
return;
|
|
12140
|
-
} // facetValue === "%7B%22start%22:5,%22end%22:10%7D"
|
|
12141
|
-
|
|
12142
|
-
|
|
12143
|
-
var filters = convertNumericRefinementsToFilters(getRefinedState(helper.state, attribute, facetValue), attribute);
|
|
12144
|
-
|
|
12145
|
-
if (filters && filters.length > 0) {
|
|
12146
|
-
/*
|
|
12147
|
-
filters === ["price<=10", "price>=5"]
|
|
12148
|
-
*/
|
|
12149
|
-
instantSearchInstance.sendEventToInsights({
|
|
12150
|
-
insightsMethod: 'clickedFilters',
|
|
12151
|
-
widgetType: $$type,
|
|
12152
|
-
eventType: eventType,
|
|
12153
|
-
payload: {
|
|
12154
|
-
eventName: eventName,
|
|
12155
|
-
index: helper.getIndex(),
|
|
12156
|
-
filters: filters
|
|
12157
|
-
},
|
|
12158
|
-
attribute: attribute
|
|
12159
|
-
});
|
|
12160
|
-
}
|
|
12161
12101
|
};
|
|
12162
12102
|
};
|
|
12163
12103
|
|
|
@@ -12301,9 +12241,7 @@
|
|
|
12301
12241
|
|
|
12302
12242
|
if (!connectorState.sendEvent) {
|
|
12303
12243
|
connectorState.sendEvent = createSendEvent({
|
|
12304
|
-
instantSearchInstance: instantSearchInstance
|
|
12305
|
-
helper: helper,
|
|
12306
|
-
attribute: attribute
|
|
12244
|
+
instantSearchInstance: instantSearchInstance
|
|
12307
12245
|
});
|
|
12308
12246
|
}
|
|
12309
12247
|
|
|
@@ -12729,50 +12667,12 @@
|
|
|
12729
12667
|
return null;
|
|
12730
12668
|
};
|
|
12731
12669
|
|
|
12732
|
-
var
|
|
12733
|
-
var eventName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'Filter Applied';
|
|
12734
|
-
var filters = convertNumericRefinementsToFilters(refinedState, attribute);
|
|
12735
|
-
|
|
12736
|
-
if (filters && filters.length > 0) {
|
|
12737
|
-
instantSearchInstance.sendEventToInsights({
|
|
12738
|
-
insightsMethod: 'clickedFilters',
|
|
12739
|
-
widgetType: $$type$1,
|
|
12740
|
-
eventType: 'click',
|
|
12741
|
-
payload: {
|
|
12742
|
-
eventName: eventName,
|
|
12743
|
-
index: helper.getIndex(),
|
|
12744
|
-
filters: filters
|
|
12745
|
-
},
|
|
12746
|
-
attribute: attribute
|
|
12747
|
-
});
|
|
12748
|
-
}
|
|
12749
|
-
};
|
|
12750
|
-
|
|
12751
|
-
var createSendEvent = function createSendEvent(instantSearchInstance, helper, currentRange) {
|
|
12670
|
+
var createSendEvent = function createSendEvent(instantSearchInstance) {
|
|
12752
12671
|
return function () {
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
}
|
|
12756
|
-
|
|
12757
|
-
if (args.length === 1) {
|
|
12758
|
-
instantSearchInstance.sendEventToInsights(args[0]);
|
|
12672
|
+
if (arguments.length === 1) {
|
|
12673
|
+
instantSearchInstance.sendEventToInsights(arguments.length <= 0 ? undefined : arguments[0]);
|
|
12759
12674
|
return;
|
|
12760
12675
|
}
|
|
12761
|
-
|
|
12762
|
-
var eventType = args[0],
|
|
12763
|
-
facetValue = args[1],
|
|
12764
|
-
eventName = args[2];
|
|
12765
|
-
|
|
12766
|
-
if (eventType !== 'click') {
|
|
12767
|
-
return;
|
|
12768
|
-
}
|
|
12769
|
-
|
|
12770
|
-
var _facetValue = _slicedToArray(facetValue, 2),
|
|
12771
|
-
nextMin = _facetValue[0],
|
|
12772
|
-
nextMax = _facetValue[1];
|
|
12773
|
-
|
|
12774
|
-
var refinedState = getRefinedState(helper, currentRange, nextMin, nextMax);
|
|
12775
|
-
sendEventWithRefinedState(refinedState, instantSearchInstance, helper, eventName);
|
|
12776
12676
|
};
|
|
12777
12677
|
};
|
|
12778
12678
|
|
|
@@ -12818,7 +12718,7 @@
|
|
|
12818
12718
|
return [min, max];
|
|
12819
12719
|
}
|
|
12820
12720
|
|
|
12821
|
-
function _refine(
|
|
12721
|
+
function _refine(helper, currentRange) {
|
|
12822
12722
|
return function () {
|
|
12823
12723
|
var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [undefined, undefined],
|
|
12824
12724
|
_ref12 = _slicedToArray(_ref11, 2),
|
|
@@ -12828,7 +12728,6 @@
|
|
|
12828
12728
|
var refinedState = getRefinedState(helper, currentRange, nextMin, nextMax);
|
|
12829
12729
|
|
|
12830
12730
|
if (refinedState) {
|
|
12831
|
-
sendEventWithRefinedState(refinedState, instantSearchInstance, helper);
|
|
12832
12731
|
helper.setState(refinedState).search();
|
|
12833
12732
|
}
|
|
12834
12733
|
};
|
|
@@ -12874,12 +12773,12 @@
|
|
|
12874
12773
|
// On first render pass an empty range
|
|
12875
12774
|
// to be able to bypass the validation
|
|
12876
12775
|
// related to it
|
|
12877
|
-
refine = _refine(
|
|
12776
|
+
refine = _refine(helper, {
|
|
12878
12777
|
min: undefined,
|
|
12879
12778
|
max: undefined
|
|
12880
12779
|
});
|
|
12881
12780
|
} else {
|
|
12882
|
-
refine = _refine(
|
|
12781
|
+
refine = _refine(helper, currentRange);
|
|
12883
12782
|
}
|
|
12884
12783
|
|
|
12885
12784
|
return {
|
|
@@ -12887,7 +12786,7 @@
|
|
|
12887
12786
|
canRefine: currentRange.min !== currentRange.max,
|
|
12888
12787
|
format: rangeFormatter,
|
|
12889
12788
|
range: currentRange,
|
|
12890
|
-
sendEvent: createSendEvent(instantSearchInstance
|
|
12789
|
+
sendEvent: createSendEvent(instantSearchInstance),
|
|
12891
12790
|
widgetParams: _objectSpread2(_objectSpread2({}, widgetParams), {}, {
|
|
12892
12791
|
precision: precision
|
|
12893
12792
|
}),
|