instantsearch.js 4.75.3 → 4.75.5
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 +24 -1
- package/dist/instantsearch.development.d.ts +3 -3
- package/dist/instantsearch.development.js +26 -3
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +3 -3
- package/dist/instantsearch.production.min.d.ts +3 -3
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/middlewares/createInsightsMiddleware.d.ts +1 -1
- package/es/middlewares/createInsightsMiddleware.js +24 -1
- package/es/types/insights.d.ts +2 -2
- package/package.json +6 -6
package/cjs/lib/version.js
CHANGED
|
@@ -23,7 +23,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
23
23
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
24
24
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
25
25
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
26
|
-
var ALGOLIA_INSIGHTS_VERSION = '2.
|
|
26
|
+
var ALGOLIA_INSIGHTS_VERSION = '2.17.2';
|
|
27
27
|
var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js");
|
|
28
28
|
function createInsightsMiddleware() {
|
|
29
29
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -323,10 +323,33 @@ function createInsightsMiddleware() {
|
|
|
323
323
|
return insightsClient(method, payload, extraParams);
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
+
var viewedObjectIDs = new Set();
|
|
327
|
+
var lastQueryId;
|
|
328
|
+
instantSearchInstance.mainHelper.derivedHelpers[0].on('result', function (_ref11) {
|
|
329
|
+
var results = _ref11.results;
|
|
330
|
+
if (!results.queryID || results.queryID !== lastQueryId) {
|
|
331
|
+
lastQueryId = results.queryID;
|
|
332
|
+
viewedObjectIDs.clear();
|
|
333
|
+
}
|
|
334
|
+
});
|
|
326
335
|
instantSearchInstance.sendEventToInsights = function (event) {
|
|
327
336
|
if (onEvent) {
|
|
328
337
|
onEvent(event, insightsClientWithLocalCredentials);
|
|
329
338
|
} else if (event.insightsMethod) {
|
|
339
|
+
if (event.insightsMethod === 'viewedObjectIDs') {
|
|
340
|
+
var _payload = event.payload;
|
|
341
|
+
var difference = _payload.objectIDs.filter(function (objectID) {
|
|
342
|
+
return !viewedObjectIDs.has(objectID);
|
|
343
|
+
});
|
|
344
|
+
if (difference.length === 0) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
difference.forEach(function (objectID) {
|
|
348
|
+
return viewedObjectIDs.add(objectID);
|
|
349
|
+
});
|
|
350
|
+
_payload.objectIDs = difference;
|
|
351
|
+
}
|
|
352
|
+
|
|
330
353
|
// Source is used to differentiate events sent by instantsearch from those sent manually.
|
|
331
354
|
event.payload.algoliaSource = ['instantsearch'];
|
|
332
355
|
if ($$automatic) {
|
|
@@ -5018,7 +5018,7 @@ declare type InsightsEvent<TMethod extends InsightsMethod = InsightsMethod> = In
|
|
|
5018
5018
|
*/
|
|
5019
5019
|
declare type InsightsEvent_2<TMethod extends InsightsMethod = InsightsMethod> = {
|
|
5020
5020
|
insightsMethod?: TMethod;
|
|
5021
|
-
payload: InsightsMethodMap[TMethod][0];
|
|
5021
|
+
payload: InsightsMethodMap[TMethod][0][0];
|
|
5022
5022
|
widgetType: string;
|
|
5023
5023
|
eventType: string;
|
|
5024
5024
|
eventModifier?: string;
|
|
@@ -5035,7 +5035,7 @@ declare type InsightsMethodMap = InsightsMethodMap_2;
|
|
|
5035
5035
|
|
|
5036
5036
|
declare type InsightsProps<TInsightsClient extends ProvidedInsightsClient = ProvidedInsightsClient> = {
|
|
5037
5037
|
insightsClient?: TInsightsClient;
|
|
5038
|
-
insightsInitParams?: Partial<InsightsMethodMap['init'][0]>;
|
|
5038
|
+
insightsInitParams?: Partial<InsightsMethodMap['init'][0][0]>;
|
|
5039
5039
|
onEvent?: (event: InsightsEvent, insightsClient: TInsightsClient) => void;
|
|
5040
5040
|
};
|
|
5041
5041
|
|
|
@@ -6334,7 +6334,7 @@ declare type QueueItem = QueueItemMap[keyof QueueItemMap];
|
|
|
6334
6334
|
declare type QueueItemMap = {
|
|
6335
6335
|
[MethodName in keyof InsightsMethodMap]: [
|
|
6336
6336
|
methodName: MethodName,
|
|
6337
|
-
...args: InsightsMethodMap[MethodName]
|
|
6337
|
+
...args: InsightsMethodMap[MethodName][0][0]
|
|
6338
6338
|
];
|
|
6339
6339
|
};
|
|
6340
6340
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.75.
|
|
1
|
+
/*! InstantSearch.js 4.75.5 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
|
|
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) :
|
|
@@ -13743,7 +13743,7 @@
|
|
|
13743
13743
|
});
|
|
13744
13744
|
}
|
|
13745
13745
|
|
|
13746
|
-
var ALGOLIA_INSIGHTS_VERSION = '2.
|
|
13746
|
+
var ALGOLIA_INSIGHTS_VERSION = '2.17.2';
|
|
13747
13747
|
var ALGOLIA_INSIGHTS_SRC = "https://cdn.jsdelivr.net/npm/search-insights@".concat(ALGOLIA_INSIGHTS_VERSION, "/dist/search-insights.min.js");
|
|
13748
13748
|
function createInsightsMiddleware() {
|
|
13749
13749
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -14043,10 +14043,33 @@
|
|
|
14043
14043
|
return insightsClient(method, payload, extraParams);
|
|
14044
14044
|
};
|
|
14045
14045
|
}
|
|
14046
|
+
var viewedObjectIDs = new Set();
|
|
14047
|
+
var lastQueryId;
|
|
14048
|
+
instantSearchInstance.mainHelper.derivedHelpers[0].on('result', function (_ref11) {
|
|
14049
|
+
var results = _ref11.results;
|
|
14050
|
+
if (!results.queryID || results.queryID !== lastQueryId) {
|
|
14051
|
+
lastQueryId = results.queryID;
|
|
14052
|
+
viewedObjectIDs.clear();
|
|
14053
|
+
}
|
|
14054
|
+
});
|
|
14046
14055
|
instantSearchInstance.sendEventToInsights = function (event) {
|
|
14047
14056
|
if (onEvent) {
|
|
14048
14057
|
onEvent(event, insightsClientWithLocalCredentials);
|
|
14049
14058
|
} else if (event.insightsMethod) {
|
|
14059
|
+
if (event.insightsMethod === 'viewedObjectIDs') {
|
|
14060
|
+
var _payload = event.payload;
|
|
14061
|
+
var difference = _payload.objectIDs.filter(function (objectID) {
|
|
14062
|
+
return !viewedObjectIDs.has(objectID);
|
|
14063
|
+
});
|
|
14064
|
+
if (difference.length === 0) {
|
|
14065
|
+
return;
|
|
14066
|
+
}
|
|
14067
|
+
difference.forEach(function (objectID) {
|
|
14068
|
+
return viewedObjectIDs.add(objectID);
|
|
14069
|
+
});
|
|
14070
|
+
_payload.objectIDs = difference;
|
|
14071
|
+
}
|
|
14072
|
+
|
|
14050
14073
|
// Source is used to differentiate events sent by instantsearch from those sent manually.
|
|
14051
14074
|
event.payload.algoliaSource = ['instantsearch'];
|
|
14052
14075
|
if ($$automatic) {
|
|
@@ -16109,7 +16132,7 @@
|
|
|
16109
16132
|
};
|
|
16110
16133
|
}
|
|
16111
16134
|
|
|
16112
|
-
var version$1 = '4.75.
|
|
16135
|
+
var version$1 = '4.75.5';
|
|
16113
16136
|
|
|
16114
16137
|
var withUsage$v = createDocumentationMessageGenerator({
|
|
16115
16138
|
name: 'instantsearch'
|