instantsearch.js 4.56.2 → 4.56.3
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/lib/version.js +1 -1
- package/cjs/middlewares/createInsightsMiddleware.js +18 -8
- package/dist/instantsearch.development.js +25 -12
- 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/lib/utils/render-args.d.ts +2 -2
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/middlewares/createInsightsMiddleware.js +18 -8
- package/package.json +6 -6
package/cjs/lib/version.js
CHANGED
|
@@ -153,31 +153,41 @@ function createInsightsMiddleware() {
|
|
|
153
153
|
instantSearchInstance.scheduleSearch();
|
|
154
154
|
}
|
|
155
155
|
var setUserTokenToSearch = function setUserTokenToSearch(userToken) {
|
|
156
|
+
var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
156
157
|
if (!userToken) {
|
|
157
158
|
return;
|
|
158
159
|
}
|
|
159
160
|
var existingToken = helper.state.userToken;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
function applyToken() {
|
|
162
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {
|
|
163
|
+
userToken: userToken
|
|
164
|
+
}));
|
|
165
|
+
if (existingToken && existingToken !== userToken) {
|
|
166
|
+
instantSearchInstance.scheduleSearch();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Delay the token application to the next render cycle
|
|
171
|
+
if (!immediate) {
|
|
172
|
+
setTimeout(applyToken, 0);
|
|
173
|
+
} else {
|
|
174
|
+
applyToken();
|
|
165
175
|
}
|
|
166
176
|
};
|
|
167
177
|
var anonymousUserToken = (0, _helpers.getInsightsAnonymousUserTokenInternal)();
|
|
168
178
|
if (anonymousUserToken) {
|
|
169
179
|
// When `aa('init', { ... })` is called, it creates an anonymous user token in cookie.
|
|
170
180
|
// We can set it as userToken.
|
|
171
|
-
setUserTokenToSearch(anonymousUserToken);
|
|
181
|
+
setUserTokenToSearch(anonymousUserToken, true);
|
|
172
182
|
}
|
|
173
183
|
|
|
174
184
|
// We consider the `userToken` coming from a `init` call to have a higher
|
|
175
185
|
// importance than the one coming from the queue.
|
|
176
186
|
if (userTokenBeforeInit) {
|
|
177
|
-
setUserTokenToSearch(userTokenBeforeInit);
|
|
187
|
+
setUserTokenToSearch(userTokenBeforeInit, true);
|
|
178
188
|
insightsClient('setUserToken', userTokenBeforeInit);
|
|
179
189
|
} else if (queuedUserToken) {
|
|
180
|
-
setUserTokenToSearch(queuedUserToken);
|
|
190
|
+
setUserTokenToSearch(queuedUserToken, true);
|
|
181
191
|
insightsClient('setUserToken', queuedUserToken);
|
|
182
192
|
}
|
|
183
193
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.56.
|
|
1
|
+
/*! InstantSearch.js 4.56.3 | © 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) :
|
|
@@ -8038,7 +8038,10 @@
|
|
|
8038
8038
|
|
|
8039
8039
|
/**
|
|
8040
8040
|
* sum of the processing time of all the queries
|
|
8041
|
+
* @name processingTimeMS
|
|
8041
8042
|
* @member {number}
|
|
8043
|
+
* @memberof SearchResults
|
|
8044
|
+
* @instance
|
|
8042
8045
|
*/
|
|
8043
8046
|
this.processingTimeMS = results.reduce(function(sum, result) {
|
|
8044
8047
|
return result.processingTimeMS === undefined
|
|
@@ -8244,7 +8247,7 @@
|
|
|
8244
8247
|
|
|
8245
8248
|
self.facets[position] = {
|
|
8246
8249
|
name: facetName,
|
|
8247
|
-
data:
|
|
8250
|
+
data: mainFacets[facetName],
|
|
8248
8251
|
exhaustive: mainSubResponse.exhaustiveFacetsCount
|
|
8249
8252
|
};
|
|
8250
8253
|
excludes.forEach(function(facetValue) {
|
|
@@ -9442,7 +9445,7 @@
|
|
|
9442
9445
|
|
|
9443
9446
|
var requestBuilder_1 = requestBuilder;
|
|
9444
9447
|
|
|
9445
|
-
var version = '3.13.
|
|
9448
|
+
var version = '3.13.2';
|
|
9446
9449
|
|
|
9447
9450
|
var escapeFacetValue$4 = escapeFacetValue_1.escapeFacetValue;
|
|
9448
9451
|
|
|
@@ -12109,31 +12112,41 @@
|
|
|
12109
12112
|
instantSearchInstance.scheduleSearch();
|
|
12110
12113
|
}
|
|
12111
12114
|
var setUserTokenToSearch = function setUserTokenToSearch(userToken) {
|
|
12115
|
+
var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
12112
12116
|
if (!userToken) {
|
|
12113
12117
|
return;
|
|
12114
12118
|
}
|
|
12115
12119
|
var existingToken = helper.state.userToken;
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
|
|
12120
|
+
function applyToken() {
|
|
12121
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread2(_objectSpread2({}, helper.state), {}, {
|
|
12122
|
+
userToken: userToken
|
|
12123
|
+
}));
|
|
12124
|
+
if (existingToken && existingToken !== userToken) {
|
|
12125
|
+
instantSearchInstance.scheduleSearch();
|
|
12126
|
+
}
|
|
12127
|
+
}
|
|
12128
|
+
|
|
12129
|
+
// Delay the token application to the next render cycle
|
|
12130
|
+
if (!immediate) {
|
|
12131
|
+
setTimeout(applyToken, 0);
|
|
12132
|
+
} else {
|
|
12133
|
+
applyToken();
|
|
12121
12134
|
}
|
|
12122
12135
|
};
|
|
12123
12136
|
var anonymousUserToken = getInsightsAnonymousUserTokenInternal();
|
|
12124
12137
|
if (anonymousUserToken) {
|
|
12125
12138
|
// When `aa('init', { ... })` is called, it creates an anonymous user token in cookie.
|
|
12126
12139
|
// We can set it as userToken.
|
|
12127
|
-
setUserTokenToSearch(anonymousUserToken);
|
|
12140
|
+
setUserTokenToSearch(anonymousUserToken, true);
|
|
12128
12141
|
}
|
|
12129
12142
|
|
|
12130
12143
|
// We consider the `userToken` coming from a `init` call to have a higher
|
|
12131
12144
|
// importance than the one coming from the queue.
|
|
12132
12145
|
if (userTokenBeforeInit) {
|
|
12133
|
-
setUserTokenToSearch(userTokenBeforeInit);
|
|
12146
|
+
setUserTokenToSearch(userTokenBeforeInit, true);
|
|
12134
12147
|
insightsClient('setUserToken', userTokenBeforeInit);
|
|
12135
12148
|
} else if (queuedUserToken) {
|
|
12136
|
-
setUserTokenToSearch(queuedUserToken);
|
|
12149
|
+
setUserTokenToSearch(queuedUserToken, true);
|
|
12137
12150
|
insightsClient('setUserToken', queuedUserToken);
|
|
12138
12151
|
}
|
|
12139
12152
|
|
|
@@ -14034,7 +14047,7 @@
|
|
|
14034
14047
|
};
|
|
14035
14048
|
}
|
|
14036
14049
|
|
|
14037
|
-
var version$1 = '4.56.
|
|
14050
|
+
var version$1 = '4.56.3';
|
|
14038
14051
|
|
|
14039
14052
|
var withUsage$r = createDocumentationMessageGenerator({
|
|
14040
14053
|
name: 'instantsearch'
|