coveo.analytics 2.27.2 → 2.27.4

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.
@@ -73,6 +73,8 @@ export declare class CoveoInsightClient {
73
73
  logCustomEvent(event: SearchPageEvents | InsightEvents, metadata?: Record<string, any>): Promise<void | import("../events").CustomEventResponse>;
74
74
  logSearchEvent(event: SearchPageEvents | InsightEvents, metadata?: Record<string, any>): Promise<void | import("../events").SearchEventResponse>;
75
75
  logClickEvent(event: SearchPageEvents, info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: Record<string, any>): Promise<void | import("../events").ClickEventResponse>;
76
+ logShowMoreFoldedResults(info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>;
77
+ logShowLessFoldedResults(metadata?: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
76
78
  private getBaseCustomEventRequest;
77
79
  private getBaseSearchEventRequest;
78
80
  private getBaseEventRequest;
@@ -1 +1 @@
1
- export declare const libVersion = "2.27.2";
1
+ export declare const libVersion = "2.27.4";
@@ -593,7 +593,7 @@ function sha1(bytes) {
593
593
  const v5 = v35('v5', 0x50, sha1);
594
594
  var uuidv5 = v5;
595
595
 
596
- const libVersion = "2.27.2" ;
596
+ const libVersion = "2.27.4" ;
597
597
 
598
598
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
599
599
 
@@ -2976,6 +2976,16 @@ class CoveoInsightClient {
2976
2976
  return this.coveoAnalyticsClient.sendClickEvent(payload);
2977
2977
  });
2978
2978
  }
2979
+ logShowMoreFoldedResults(info, identifier, metadata) {
2980
+ return __awaiter(this, void 0, void 0, function* () {
2981
+ return this.logClickEvent(SearchPageEvents.showMoreFoldedResults, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
2982
+ });
2983
+ }
2984
+ logShowLessFoldedResults(metadata) {
2985
+ return __awaiter(this, void 0, void 0, function* () {
2986
+ return this.logCustomEvent(SearchPageEvents.showLessFoldedResults, metadata ? generateMetadataToSend(metadata, false) : undefined);
2987
+ });
2988
+ }
2979
2989
  getBaseCustomEventRequest(metadata) {
2980
2990
  return __awaiter(this, void 0, void 0, function* () {
2981
2991
  return Object.assign(Object.assign({}, (yield this.getBaseEventRequest(metadata))), { lastSearchQueryUid: this.provider.getSearchUID() });
package/dist/library.js CHANGED
@@ -728,7 +728,7 @@ function sha1(bytes) {
728
728
  const v5 = v35('v5', 0x50, sha1);
729
729
  var uuidv5 = v5;
730
730
 
731
- var libVersion = "2.27.2" ;
731
+ var libVersion = "2.27.4" ;
732
732
 
733
733
  var getFormattedLocation = function (location) {
734
734
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -85920,6 +85920,20 @@ var CoveoInsightClient = (function () {
85920
85920
  });
85921
85921
  });
85922
85922
  };
85923
+ CoveoInsightClient.prototype.logShowMoreFoldedResults = function (info, identifier, metadata) {
85924
+ return __awaiter(this, void 0, void 0, function () {
85925
+ return __generator(this, function (_a) {
85926
+ return [2, this.logClickEvent(exports.SearchPageEvents.showMoreFoldedResults, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined)];
85927
+ });
85928
+ });
85929
+ };
85930
+ CoveoInsightClient.prototype.logShowLessFoldedResults = function (metadata) {
85931
+ return __awaiter(this, void 0, void 0, function () {
85932
+ return __generator(this, function (_a) {
85933
+ return [2, this.logCustomEvent(exports.SearchPageEvents.showLessFoldedResults, metadata ? generateMetadataToSend(metadata, false) : undefined)];
85934
+ });
85935
+ });
85936
+ };
85923
85937
  CoveoInsightClient.prototype.getBaseCustomEventRequest = function (metadata) {
85924
85938
  return __awaiter(this, void 0, void 0, function () {
85925
85939
  var _a;
@@ -655,7 +655,7 @@ const addPageViewToHistory = (pageViewValue) => __awaiter(void 0, void 0, void 0
655
655
  yield store.addElementAsync(historyElement);
656
656
  });
657
657
 
658
- const libVersion = "2.27.2" ;
658
+ const libVersion = "2.27.4" ;
659
659
 
660
660
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
661
661
 
@@ -2994,6 +2994,16 @@ class CoveoInsightClient {
2994
2994
  return this.coveoAnalyticsClient.sendClickEvent(payload);
2995
2995
  });
2996
2996
  }
2997
+ logShowMoreFoldedResults(info, identifier, metadata) {
2998
+ return __awaiter(this, void 0, void 0, function* () {
2999
+ return this.logClickEvent(SearchPageEvents.showMoreFoldedResults, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
3000
+ });
3001
+ }
3002
+ logShowLessFoldedResults(metadata) {
3003
+ return __awaiter(this, void 0, void 0, function* () {
3004
+ return this.logCustomEvent(SearchPageEvents.showLessFoldedResults, metadata ? generateMetadataToSend(metadata, false) : undefined);
3005
+ });
3006
+ }
2997
3007
  getBaseCustomEventRequest(metadata) {
2998
3008
  return __awaiter(this, void 0, void 0, function* () {
2999
3009
  return Object.assign(Object.assign({}, (yield this.getBaseEventRequest(metadata))), { lastSearchQueryUid: this.provider.getSearchUID() });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coveo.analytics",
3
- "version": "2.27.2",
3
+ "version": "2.27.4",
4
4
  "description": "📈 Coveo analytics client (node and browser compatible) ",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.es.js",
@@ -478,6 +478,15 @@ describe('InsightClient', () => {
478
478
  expectedMetadata
479
479
  );
480
480
  });
481
+ it('should send proper payload for #showMoreFoldedResults', async () => {
482
+ await client.logShowMoreFoldedResults(fakeDocInfo, fakeDocID);
483
+ expectMatchDocumentPayload(SearchPageEvents.showMoreFoldedResults, fakeDocInfo, fakeDocID);
484
+ });
485
+
486
+ it('should send proper payload for #showLessFoldedResults', async () => {
487
+ await client.logShowLessFoldedResults();
488
+ expectMatchCustomEventPayload(SearchPageEvents.showLessFoldedResults);
489
+ });
481
490
  });
482
491
 
483
492
  describe('when the case metadata is included', () => {
@@ -1026,6 +1035,23 @@ describe('InsightClient', () => {
1026
1035
  expectedMetadata
1027
1036
  );
1028
1037
  });
1038
+
1039
+ it('should send proper payload for #showMoreFoldedResults', async () => {
1040
+ const expectedMetadata = {
1041
+ ...fakeDocID,
1042
+ ...expectedBaseCaseMetadata,
1043
+ };
1044
+ await client.logShowMoreFoldedResults(fakeDocInfo, fakeDocID, baseCaseMetadata);
1045
+ expectMatchDocumentPayload(SearchPageEvents.showMoreFoldedResults, fakeDocInfo, expectedMetadata);
1046
+ });
1047
+
1048
+ it('should send proper payload for #showLessFoldedResults', async () => {
1049
+ const expectedMetadata = {
1050
+ ...expectedBaseCaseMetadata,
1051
+ };
1052
+ await client.logShowLessFoldedResults(baseCaseMetadata);
1053
+ expectMatchCustomEventPayload(SearchPageEvents.showLessFoldedResults, expectedMetadata);
1054
+ });
1029
1055
  });
1030
1056
 
1031
1057
  it('should enable analytics tracking by default', () => {
@@ -482,6 +482,26 @@ export class CoveoInsightClient {
482
482
  return this.coveoAnalyticsClient.sendClickEvent(payload);
483
483
  }
484
484
 
485
+ public async logShowMoreFoldedResults(
486
+ info: PartialDocumentInformation,
487
+ identifier: DocumentIdentifier,
488
+ metadata?: CaseMetadata
489
+ ) {
490
+ return this.logClickEvent(
491
+ SearchPageEvents.showMoreFoldedResults,
492
+ info,
493
+ identifier,
494
+ metadata ? generateMetadataToSend(metadata, false) : undefined
495
+ );
496
+ }
497
+
498
+ public async logShowLessFoldedResults(metadata?: CaseMetadata) {
499
+ return this.logCustomEvent(
500
+ SearchPageEvents.showLessFoldedResults,
501
+ metadata ? generateMetadataToSend(metadata, false) : undefined
502
+ );
503
+ }
504
+
485
505
  private async getBaseCustomEventRequest(metadata?: Record<string, any>) {
486
506
  return {
487
507
  ...(await this.getBaseEventRequest(metadata)),