instantsearch.js 4.77.3 → 4.78.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/cjs/connectors/autocomplete/connectAutocomplete.js +4 -7
- package/cjs/connectors/frequently-bought-together/connectFrequentlyBoughtTogether.js +1 -3
- package/cjs/connectors/geo-search/connectGeoSearch.js +1 -3
- package/cjs/connectors/hits/connectHits.js +2 -6
- package/cjs/connectors/infinite-hits/connectInfiniteHits.js +2 -6
- package/cjs/connectors/looking-similar/connectLookingSimilar.js +1 -3
- package/cjs/connectors/rating-menu/connectRatingMenu.js +2 -1
- package/cjs/connectors/related-products/connectRelatedProducts.js +1 -3
- package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +2 -1
- package/cjs/connectors/trending-items/connectTrendingItems.js +1 -3
- package/cjs/lib/utils/createSendEventForFacet.js +2 -1
- package/cjs/lib/utils/createSendEventForHits.js +11 -8
- package/cjs/lib/version.js +1 -1
- package/dist/instantsearch.development.js +43 -49
- 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/autocomplete/connectAutocomplete.js +4 -7
- package/es/connectors/frequently-bought-together/connectFrequentlyBoughtTogether.js +1 -3
- package/es/connectors/geo-search/connectGeoSearch.js +1 -3
- package/es/connectors/hits/connectHits.js +2 -6
- package/es/connectors/infinite-hits/connectInfiniteHits.js +2 -6
- package/es/connectors/looking-similar/connectLookingSimilar.js +1 -3
- package/es/connectors/rating-menu/connectRatingMenu.js +2 -1
- package/es/connectors/related-products/connectRelatedProducts.js +1 -3
- package/es/connectors/toggle-refinement/connectToggleRefinement.js +2 -1
- package/es/connectors/trending-items/connectTrendingItems.js +1 -3
- package/es/lib/utils/createSendEventForFacet.js +2 -1
- package/es/lib/utils/createSendEventForHits.d.ts +7 -6
- package/es/lib/utils/createSendEventForHits.js +11 -8
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/package.json +6 -6
|
@@ -58,7 +58,7 @@ var connectAutocomplete = function connectAutocomplete(renderFn) {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
var indices = scopedResults.map(function (scopedResult) {
|
|
61
|
-
var _scopedResult$
|
|
61
|
+
var _scopedResult$results, _scopedResult$results2;
|
|
62
62
|
// We need to escape the hits because highlighting
|
|
63
63
|
// exposes HTML tags to the end-user.
|
|
64
64
|
if (scopedResult.results) {
|
|
@@ -66,16 +66,13 @@ var connectAutocomplete = function connectAutocomplete(renderFn) {
|
|
|
66
66
|
}
|
|
67
67
|
var sendEvent = createSendEventForHits({
|
|
68
68
|
instantSearchInstance: instantSearchInstance,
|
|
69
|
-
|
|
70
|
-
var _scopedResult$results;
|
|
71
|
-
return ((_scopedResult$results = scopedResult.results) === null || _scopedResult$results === void 0 ? void 0 : _scopedResult$results.index) || '';
|
|
72
|
-
},
|
|
69
|
+
helper: scopedResult.helper,
|
|
73
70
|
widgetType: _this.$$type
|
|
74
71
|
});
|
|
75
72
|
return {
|
|
76
73
|
indexId: scopedResult.indexId,
|
|
77
|
-
indexName: ((_scopedResult$
|
|
78
|
-
hits: ((_scopedResult$
|
|
74
|
+
indexName: ((_scopedResult$results = scopedResult.results) === null || _scopedResult$results === void 0 ? void 0 : _scopedResult$results.index) || '',
|
|
75
|
+
hits: ((_scopedResult$results2 = scopedResult.results) === null || _scopedResult$results2 === void 0 ? void 0 : _scopedResult$results2.hits) || [],
|
|
79
76
|
results: scopedResult.results || {},
|
|
80
77
|
sendEvent: sendEvent
|
|
81
78
|
};
|
|
@@ -52,9 +52,7 @@ export default (function connectFrequentlyBoughtTogether(renderFn) {
|
|
|
52
52
|
if (!sendEvent) {
|
|
53
53
|
sendEvent = createSendEventForHits({
|
|
54
54
|
instantSearchInstance: instantSearchInstance,
|
|
55
|
-
|
|
56
|
-
return helper.getIndex();
|
|
57
|
-
},
|
|
55
|
+
helper: helper,
|
|
58
56
|
widgetType: this.$$type
|
|
59
57
|
});
|
|
60
58
|
}
|
|
@@ -149,9 +149,7 @@ export default (function connectGeoSearch(renderFn) {
|
|
|
149
149
|
if (!sendEvent) {
|
|
150
150
|
sendEvent = createSendEventForHits({
|
|
151
151
|
instantSearchInstance: instantSearchInstance,
|
|
152
|
-
|
|
153
|
-
return helper.getIndex();
|
|
154
|
-
},
|
|
152
|
+
helper: helper,
|
|
155
153
|
widgetType: $$type
|
|
156
154
|
});
|
|
157
155
|
}
|
|
@@ -51,17 +51,13 @@ export default (function connectHits(renderFn) {
|
|
|
51
51
|
if (!sendEvent) {
|
|
52
52
|
sendEvent = createSendEventForHits({
|
|
53
53
|
instantSearchInstance: instantSearchInstance,
|
|
54
|
-
|
|
55
|
-
return helper.getIndex();
|
|
56
|
-
},
|
|
54
|
+
helper: helper,
|
|
57
55
|
widgetType: this.$$type
|
|
58
56
|
});
|
|
59
57
|
}
|
|
60
58
|
if (!bindEvent) {
|
|
61
59
|
bindEvent = createBindEventForHits({
|
|
62
|
-
|
|
63
|
-
return helper.getIndex();
|
|
64
|
-
},
|
|
60
|
+
helper: helper,
|
|
65
61
|
widgetType: this.$$type,
|
|
66
62
|
instantSearchInstance: instantSearchInstance
|
|
67
63
|
});
|
|
@@ -156,15 +156,11 @@ export default (function connectInfiniteHits(renderFn) {
|
|
|
156
156
|
showMore = getShowMore(helper);
|
|
157
157
|
sendEvent = createSendEventForHits({
|
|
158
158
|
instantSearchInstance: instantSearchInstance,
|
|
159
|
-
|
|
160
|
-
return helper.getIndex();
|
|
161
|
-
},
|
|
159
|
+
helper: helper,
|
|
162
160
|
widgetType: this.$$type
|
|
163
161
|
});
|
|
164
162
|
bindEvent = createBindEventForHits({
|
|
165
|
-
|
|
166
|
-
return helper.getIndex();
|
|
167
|
-
},
|
|
163
|
+
helper: helper,
|
|
168
164
|
widgetType: this.$$type,
|
|
169
165
|
instantSearchInstance: instantSearchInstance
|
|
170
166
|
});
|
|
@@ -53,9 +53,7 @@ export default (function connectLookingSimilar(renderFn) {
|
|
|
53
53
|
if (!sendEvent) {
|
|
54
54
|
sendEvent = createSendEventForHits({
|
|
55
55
|
instantSearchInstance: instantSearchInstance,
|
|
56
|
-
|
|
57
|
-
return helper.getIndex();
|
|
58
|
-
},
|
|
56
|
+
helper: helper,
|
|
59
57
|
widgetType: this.$$type
|
|
60
58
|
});
|
|
61
59
|
}
|
|
@@ -47,6 +47,7 @@ var createSendEvent = function createSendEvent(_ref) {
|
|
|
47
47
|
}
|
|
48
48
|
var isRefined = getRefinedStar() === Number(facetValue);
|
|
49
49
|
if (!isRefined) {
|
|
50
|
+
var _helper$lastResults;
|
|
50
51
|
instantSearchInstance.sendEventToInsights({
|
|
51
52
|
insightsMethod: 'clickedFilters',
|
|
52
53
|
widgetType: $$type,
|
|
@@ -54,7 +55,7 @@ var createSendEvent = function createSendEvent(_ref) {
|
|
|
54
55
|
eventModifier: eventModifier,
|
|
55
56
|
payload: {
|
|
56
57
|
eventName: eventName,
|
|
57
|
-
index: helper.
|
|
58
|
+
index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
|
|
58
59
|
filters: ["".concat(attribute, ">=").concat(facetValue)]
|
|
59
60
|
},
|
|
60
61
|
attribute: attribute
|
|
@@ -53,9 +53,7 @@ export default (function connectRelatedProducts(renderFn) {
|
|
|
53
53
|
if (!sendEvent) {
|
|
54
54
|
sendEvent = createSendEventForHits({
|
|
55
55
|
instantSearchInstance: instantSearchInstance,
|
|
56
|
-
|
|
57
|
-
return helper.getIndex();
|
|
58
|
-
},
|
|
56
|
+
helper: helper,
|
|
59
57
|
widgetType: this.$$type
|
|
60
58
|
});
|
|
61
59
|
}
|
|
@@ -43,6 +43,7 @@ var createSendEvent = function createSendEvent(_ref) {
|
|
|
43
43
|
// only send an event when the refinement gets applied,
|
|
44
44
|
// not when it gets removed
|
|
45
45
|
if (!isRefined) {
|
|
46
|
+
var _helper$lastResults;
|
|
46
47
|
instantSearchInstance.sendEventToInsights({
|
|
47
48
|
insightsMethod: 'clickedFilters',
|
|
48
49
|
widgetType: $$type,
|
|
@@ -50,7 +51,7 @@ var createSendEvent = function createSendEvent(_ref) {
|
|
|
50
51
|
eventModifier: eventModifier,
|
|
51
52
|
payload: {
|
|
52
53
|
eventName: eventName,
|
|
53
|
-
index: helper.
|
|
54
|
+
index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
|
|
54
55
|
filters: on.map(function (value) {
|
|
55
56
|
return "".concat(attribute, ":").concat(value);
|
|
56
57
|
})
|
|
@@ -54,9 +54,7 @@ export default (function connectTrendingItems(renderFn) {
|
|
|
54
54
|
if (!sendEvent) {
|
|
55
55
|
sendEvent = createSendEventForHits({
|
|
56
56
|
instantSearchInstance: instantSearchInstance,
|
|
57
|
-
|
|
58
|
-
return helper.getIndex();
|
|
59
|
-
},
|
|
57
|
+
helper: helper,
|
|
60
58
|
widgetType: this.$$type
|
|
61
59
|
});
|
|
62
60
|
}
|
|
@@ -34,6 +34,7 @@ export function createSendEventForFacet(_ref) {
|
|
|
34
34
|
instantSearchInstance.sendEventToInsights(args[0]);
|
|
35
35
|
} else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
|
|
36
36
|
if (!isFacetRefined(helper, attribute, facetValue)) {
|
|
37
|
+
var _helper$lastResults;
|
|
37
38
|
// send event only when the facet is being checked "ON"
|
|
38
39
|
instantSearchInstance.sendEventToInsights({
|
|
39
40
|
insightsMethod: 'clickedFilters',
|
|
@@ -42,7 +43,7 @@ export function createSendEventForFacet(_ref) {
|
|
|
42
43
|
eventModifier: eventModifier,
|
|
43
44
|
payload: _objectSpread({
|
|
44
45
|
eventName: eventName,
|
|
45
|
-
index: helper.
|
|
46
|
+
index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
|
|
46
47
|
filters: ["".concat(attribute, ":").concat(facetValue)]
|
|
47
48
|
}, additionalData),
|
|
48
49
|
attribute: attribute
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import type { InsightsEvent } from '../../middlewares/createInsightsMiddleware';
|
|
2
2
|
import type { InstantSearch, Hit } from '../../types';
|
|
3
|
+
import type { AlgoliaSearchHelper } from 'algoliasearch-helper';
|
|
3
4
|
type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string, additionalData?: Record<string, any>) => void;
|
|
4
5
|
type CustomSendEventForHits = (customPayload: any) => void;
|
|
5
6
|
export type SendEventForHits = BuiltInSendEventForHits & CustomSendEventForHits;
|
|
6
7
|
export type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string, additionalData?: Record<string, any>) => string;
|
|
7
8
|
export type CustomBindEventForHits = (customPayload: any) => string;
|
|
8
9
|
export type BindEventForHits = BuiltInBindEventForHits & CustomBindEventForHits;
|
|
9
|
-
export declare function _buildEventPayloadsForHits({
|
|
10
|
+
export declare function _buildEventPayloadsForHits({ helper, widgetType, methodName, args, instantSearchInstance, }: {
|
|
10
11
|
widgetType: string;
|
|
11
|
-
|
|
12
|
+
helper: AlgoliaSearchHelper;
|
|
12
13
|
methodName: 'sendEvent' | 'bindEvent';
|
|
13
14
|
args: any[];
|
|
14
15
|
instantSearchInstance: InstantSearch;
|
|
15
16
|
}): InsightsEvent[];
|
|
16
|
-
export declare function createSendEventForHits({ instantSearchInstance,
|
|
17
|
+
export declare function createSendEventForHits({ instantSearchInstance, helper, widgetType, }: {
|
|
17
18
|
instantSearchInstance: InstantSearch;
|
|
18
|
-
|
|
19
|
+
helper: AlgoliaSearchHelper;
|
|
19
20
|
widgetType: string;
|
|
20
21
|
}): SendEventForHits;
|
|
21
|
-
export declare function createBindEventForHits({
|
|
22
|
-
|
|
22
|
+
export declare function createBindEventForHits({ helper, widgetType, instantSearchInstance, }: {
|
|
23
|
+
helper: AlgoliaSearchHelper;
|
|
23
24
|
widgetType: string;
|
|
24
25
|
instantSearchInstance: InstantSearch;
|
|
25
26
|
}): BindEventForHits;
|
|
@@ -20,7 +20,7 @@ function chunk(arr) {
|
|
|
20
20
|
return chunks;
|
|
21
21
|
}
|
|
22
22
|
export function _buildEventPayloadsForHits(_ref) {
|
|
23
|
-
var
|
|
23
|
+
var helper = _ref.helper,
|
|
24
24
|
widgetType = _ref.widgetType,
|
|
25
25
|
methodName = _ref.methodName,
|
|
26
26
|
args = _ref.args,
|
|
@@ -71,13 +71,14 @@ export function _buildEventPayloadsForHits(_ref) {
|
|
|
71
71
|
return [];
|
|
72
72
|
}
|
|
73
73
|
return hitsChunks.map(function (batch, i) {
|
|
74
|
+
var _helper$lastResults;
|
|
74
75
|
return {
|
|
75
76
|
insightsMethod: 'viewedObjectIDs',
|
|
76
77
|
widgetType: widgetType,
|
|
77
78
|
eventType: eventType,
|
|
78
79
|
payload: _objectSpread({
|
|
79
80
|
eventName: eventName || 'Hits Viewed',
|
|
80
|
-
index:
|
|
81
|
+
index: ((_helper$lastResults = helper.lastResults) === null || _helper$lastResults === void 0 ? void 0 : _helper$lastResults.index) || helper.state.index,
|
|
81
82
|
objectIDs: objectIDsByChunk[i]
|
|
82
83
|
}, additionalData),
|
|
83
84
|
hits: batch,
|
|
@@ -86,13 +87,14 @@ export function _buildEventPayloadsForHits(_ref) {
|
|
|
86
87
|
});
|
|
87
88
|
} else if (eventType === 'click') {
|
|
88
89
|
return hitsChunks.map(function (batch, i) {
|
|
90
|
+
var _helper$lastResults2;
|
|
89
91
|
return {
|
|
90
92
|
insightsMethod: 'clickedObjectIDsAfterSearch',
|
|
91
93
|
widgetType: widgetType,
|
|
92
94
|
eventType: eventType,
|
|
93
95
|
payload: _objectSpread({
|
|
94
96
|
eventName: eventName || 'Hit Clicked',
|
|
95
|
-
index:
|
|
97
|
+
index: ((_helper$lastResults2 = helper.lastResults) === null || _helper$lastResults2 === void 0 ? void 0 : _helper$lastResults2.index) || helper.state.index,
|
|
96
98
|
queryID: queryID,
|
|
97
99
|
objectIDs: objectIDsByChunk[i],
|
|
98
100
|
positions: positionsByChunk[i]
|
|
@@ -103,13 +105,14 @@ export function _buildEventPayloadsForHits(_ref) {
|
|
|
103
105
|
});
|
|
104
106
|
} else if (eventType === 'conversion') {
|
|
105
107
|
return hitsChunks.map(function (batch, i) {
|
|
108
|
+
var _helper$lastResults3;
|
|
106
109
|
return {
|
|
107
110
|
insightsMethod: 'convertedObjectIDsAfterSearch',
|
|
108
111
|
widgetType: widgetType,
|
|
109
112
|
eventType: eventType,
|
|
110
113
|
payload: _objectSpread({
|
|
111
114
|
eventName: eventName || 'Hit Converted',
|
|
112
|
-
index:
|
|
115
|
+
index: ((_helper$lastResults3 = helper.lastResults) === null || _helper$lastResults3 === void 0 ? void 0 : _helper$lastResults3.index) || helper.state.index,
|
|
113
116
|
queryID: queryID,
|
|
114
117
|
objectIDs: objectIDsByChunk[i]
|
|
115
118
|
}, additionalData),
|
|
@@ -125,7 +128,7 @@ export function _buildEventPayloadsForHits(_ref) {
|
|
|
125
128
|
}
|
|
126
129
|
export function createSendEventForHits(_ref2) {
|
|
127
130
|
var instantSearchInstance = _ref2.instantSearchInstance,
|
|
128
|
-
|
|
131
|
+
helper = _ref2.helper,
|
|
129
132
|
widgetType = _ref2.widgetType;
|
|
130
133
|
var sentEvents = {};
|
|
131
134
|
var timer = undefined;
|
|
@@ -135,7 +138,7 @@ export function createSendEventForHits(_ref2) {
|
|
|
135
138
|
}
|
|
136
139
|
var payloads = _buildEventPayloadsForHits({
|
|
137
140
|
widgetType: widgetType,
|
|
138
|
-
|
|
141
|
+
helper: helper,
|
|
139
142
|
methodName: 'sendEvent',
|
|
140
143
|
args: args,
|
|
141
144
|
instantSearchInstance: instantSearchInstance
|
|
@@ -155,7 +158,7 @@ export function createSendEventForHits(_ref2) {
|
|
|
155
158
|
return sendEventForHits;
|
|
156
159
|
}
|
|
157
160
|
export function createBindEventForHits(_ref3) {
|
|
158
|
-
var
|
|
161
|
+
var helper = _ref3.helper,
|
|
159
162
|
widgetType = _ref3.widgetType,
|
|
160
163
|
instantSearchInstance = _ref3.instantSearchInstance;
|
|
161
164
|
var bindEventForHits = function bindEventForHits() {
|
|
@@ -164,7 +167,7 @@ export function createBindEventForHits(_ref3) {
|
|
|
164
167
|
}
|
|
165
168
|
var payloads = _buildEventPayloadsForHits({
|
|
166
169
|
widgetType: widgetType,
|
|
167
|
-
|
|
170
|
+
helper: helper,
|
|
168
171
|
methodName: 'bindEvent',
|
|
169
172
|
args: args,
|
|
170
173
|
instantSearchInstance: instantSearchInstance
|
package/es/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.
|
|
1
|
+
declare const _default: "4.78.1";
|
|
2
2
|
export default _default;
|
package/es/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.
|
|
1
|
+
export default '4.78.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch.js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.78.1",
|
|
4
4
|
"description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
|
|
5
5
|
"homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/google.maps": "^3.55.12",
|
|
32
32
|
"@types/hogan.js": "^3.0.0",
|
|
33
33
|
"@types/qs": "^6.5.3",
|
|
34
|
-
"algoliasearch-helper": "3.24.
|
|
34
|
+
"algoliasearch-helper": "3.24.3",
|
|
35
35
|
"hogan.js": "^3.0.2",
|
|
36
36
|
"htm": "^3.0.0",
|
|
37
37
|
"instantsearch-ui-components": "0.11.1",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"watch:es": "yarn --silent build:es:base --watch"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@instantsearch/mocks": "1.
|
|
60
|
-
"@instantsearch/tests": "1.
|
|
61
|
-
"@instantsearch/testutils": "1.
|
|
59
|
+
"@instantsearch/mocks": "1.72.0",
|
|
60
|
+
"@instantsearch/tests": "1.72.0",
|
|
61
|
+
"@instantsearch/testutils": "1.61.0",
|
|
62
62
|
"@storybook/html": "5.3.9",
|
|
63
63
|
"@types/scriptjs": "0.0.2",
|
|
64
64
|
"algoliasearch": "5.1.1",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"scriptjs": "2.5.9",
|
|
67
67
|
"webpack": "4.47.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "f34d5f231fedb011b8cdd9d70ee9644b5e56fbe3"
|
|
70
70
|
}
|