coveo.analytics 2.27.4 → 2.27.6
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/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.debug.js +9 -6
- package/dist/coveoua.debug.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/version.d.ts +1 -1
- package/dist/library.es.js +9 -6
- package/dist/library.js +9 -6
- package/dist/react-native.es.js +9 -6
- package/package.json +1 -1
- package/src/history.spec.ts +14 -0
- package/src/history.ts +8 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const libVersion = "2.27.
|
|
1
|
+
export declare const libVersion = "2.27.6";
|
package/dist/library.es.js
CHANGED
|
@@ -262,7 +262,7 @@ class HistoryStore {
|
|
|
262
262
|
}
|
|
263
263
|
getMostRecentElement() {
|
|
264
264
|
let currentHistory = this.getHistoryWithInternalTime();
|
|
265
|
-
if (currentHistory
|
|
265
|
+
if (Array.isArray(currentHistory)) {
|
|
266
266
|
const sorted = currentHistory.sort((first, second) => {
|
|
267
267
|
return (second.internalTime || 0) - (first.internalTime || 0);
|
|
268
268
|
});
|
|
@@ -284,10 +284,13 @@ class HistoryStore {
|
|
|
284
284
|
return true;
|
|
285
285
|
}
|
|
286
286
|
stripInternalTime(history) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
if (Array.isArray(history)) {
|
|
288
|
+
return history.map((part) => {
|
|
289
|
+
const { name, time, value } = part;
|
|
290
|
+
return { name, time, value };
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
return [];
|
|
291
294
|
}
|
|
292
295
|
stripEmptyQuery(part) {
|
|
293
296
|
const { name, time, value } = part;
|
|
@@ -593,7 +596,7 @@ function sha1(bytes) {
|
|
|
593
596
|
const v5 = v35('v5', 0x50, sha1);
|
|
594
597
|
var uuidv5 = v5;
|
|
595
598
|
|
|
596
|
-
const libVersion = "2.27.
|
|
599
|
+
const libVersion = "2.27.6" ;
|
|
597
600
|
|
|
598
601
|
const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
|
|
599
602
|
|
package/dist/library.js
CHANGED
|
@@ -380,7 +380,7 @@ var HistoryStore = (function () {
|
|
|
380
380
|
};
|
|
381
381
|
HistoryStore.prototype.getMostRecentElement = function () {
|
|
382
382
|
var currentHistory = this.getHistoryWithInternalTime();
|
|
383
|
-
if (currentHistory
|
|
383
|
+
if (Array.isArray(currentHistory)) {
|
|
384
384
|
var sorted = currentHistory.sort(function (first, second) {
|
|
385
385
|
return (second.internalTime || 0) - (first.internalTime || 0);
|
|
386
386
|
});
|
|
@@ -402,10 +402,13 @@ var HistoryStore = (function () {
|
|
|
402
402
|
return true;
|
|
403
403
|
};
|
|
404
404
|
HistoryStore.prototype.stripInternalTime = function (history) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
405
|
+
if (Array.isArray(history)) {
|
|
406
|
+
return history.map(function (part) {
|
|
407
|
+
var name = part.name, time = part.time, value = part.value;
|
|
408
|
+
return { name: name, time: time, value: value };
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
return [];
|
|
409
412
|
};
|
|
410
413
|
HistoryStore.prototype.stripEmptyQuery = function (part) {
|
|
411
414
|
var name = part.name, time = part.time, value = part.value;
|
|
@@ -728,7 +731,7 @@ function sha1(bytes) {
|
|
|
728
731
|
const v5 = v35('v5', 0x50, sha1);
|
|
729
732
|
var uuidv5 = v5;
|
|
730
733
|
|
|
731
|
-
var libVersion = "2.27.
|
|
734
|
+
var libVersion = "2.27.6" ;
|
|
732
735
|
|
|
733
736
|
var getFormattedLocation = function (location) {
|
|
734
737
|
return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
|
package/dist/react-native.es.js
CHANGED
|
@@ -589,7 +589,7 @@ class HistoryStore {
|
|
|
589
589
|
}
|
|
590
590
|
getMostRecentElement() {
|
|
591
591
|
let currentHistory = this.getHistoryWithInternalTime();
|
|
592
|
-
if (currentHistory
|
|
592
|
+
if (Array.isArray(currentHistory)) {
|
|
593
593
|
const sorted = currentHistory.sort((first, second) => {
|
|
594
594
|
return (second.internalTime || 0) - (first.internalTime || 0);
|
|
595
595
|
});
|
|
@@ -611,10 +611,13 @@ class HistoryStore {
|
|
|
611
611
|
return true;
|
|
612
612
|
}
|
|
613
613
|
stripInternalTime(history) {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
614
|
+
if (Array.isArray(history)) {
|
|
615
|
+
return history.map((part) => {
|
|
616
|
+
const { name, time, value } = part;
|
|
617
|
+
return { name, time, value };
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
return [];
|
|
618
621
|
}
|
|
619
622
|
stripEmptyQuery(part) {
|
|
620
623
|
const { name, time, value } = part;
|
|
@@ -655,7 +658,7 @@ const addPageViewToHistory = (pageViewValue) => __awaiter(void 0, void 0, void 0
|
|
|
655
658
|
yield store.addElementAsync(historyElement);
|
|
656
659
|
});
|
|
657
660
|
|
|
658
|
-
const libVersion = "2.27.
|
|
661
|
+
const libVersion = "2.27.6" ;
|
|
659
662
|
|
|
660
663
|
const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
|
|
661
664
|
|
package/package.json
CHANGED
package/src/history.spec.ts
CHANGED
|
@@ -184,4 +184,18 @@ describe('history', () => {
|
|
|
184
184
|
|
|
185
185
|
expect(storageMock.setItem).toHaveBeenCalledTimes(2);
|
|
186
186
|
});
|
|
187
|
+
|
|
188
|
+
it('should not throw when the content of localStorage is not an array', async () => {
|
|
189
|
+
storageMock.setItem(history.STORE_KEY, '{"foo":"bar"}');
|
|
190
|
+
let ex: any;
|
|
191
|
+
try {
|
|
192
|
+
const mostRecentElement = await historyStore.getMostRecentElement();
|
|
193
|
+
expect(mostRecentElement).toBeNull();
|
|
194
|
+
const localHistory = await historyStore.getHistoryAsync();
|
|
195
|
+
expect(localHistory).toStrictEqual([]);
|
|
196
|
+
} catch (err) {
|
|
197
|
+
ex = err;
|
|
198
|
+
}
|
|
199
|
+
expect(ex).toBeUndefined();
|
|
200
|
+
});
|
|
187
201
|
});
|
package/src/history.ts
CHANGED
|
@@ -103,7 +103,7 @@ export class HistoryStore {
|
|
|
103
103
|
|
|
104
104
|
getMostRecentElement(): HistoryElement | null {
|
|
105
105
|
let currentHistory = this.getHistoryWithInternalTime();
|
|
106
|
-
if (currentHistory
|
|
106
|
+
if (Array.isArray(currentHistory)) {
|
|
107
107
|
const sorted = currentHistory.sort((first: HistoryElement, second: HistoryElement) => {
|
|
108
108
|
// Internal time might not be set for all history element (on upgrade).
|
|
109
109
|
// Ensure to return the most recent element for which we have a value for internalTime.
|
|
@@ -132,10 +132,13 @@ export class HistoryStore {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
private stripInternalTime(history: HistoryElement[]): HistoryElement[] {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
if (Array.isArray(history)) {
|
|
136
|
+
return history.map((part) => {
|
|
137
|
+
const {name, time, value} = part;
|
|
138
|
+
return {name, time, value};
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return [];
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
private stripEmptyQuery(part: HistoryElement) {
|