coveo.analytics 2.30.51 → 2.30.53

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.
@@ -69,6 +69,7 @@ export interface DocumentInformation {
69
69
  documentAuthor?: string;
70
70
  queryPipeline?: string;
71
71
  rankingModifier?: string;
72
+ documentCategory?: string;
72
73
  }
73
74
  export interface ClickEventRequest extends EventBaseRequest, DocumentInformation {
74
75
  }
@@ -63,7 +63,7 @@ export declare class CoveoInsightClient {
63
63
  logFeedItemTextPost(info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>;
64
64
  logDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier, caseMetadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>;
65
65
  logCaseAttach(info: PartialDocumentInformation, identifier: DocumentIdentifier, caseMetadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>;
66
- logCaseDetach(resultUriHash: string, metadata?: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
66
+ logCaseDetach(resultUriHash: string, metadata?: CaseMetadata, permanentId?: string): Promise<void | import("../events").CustomEventResponse>;
67
67
  logLikeSmartSnippet(metadata?: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
68
68
  logDislikeSmartSnippet(metadata?: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
69
69
  logExpandSmartSnippet(metadata?: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
@@ -1 +1 @@
1
- export declare const libVersion = "2.30.51";
1
+ export declare const libVersion = "2.30.53";
package/dist/library.cjs CHANGED
@@ -736,7 +736,7 @@ function sha1(bytes) {
736
736
  const v5 = v35('v5', 0x50, sha1);
737
737
  var uuidv5 = v5;
738
738
 
739
- var libVersion = "2.30.51";
739
+ var libVersion = "2.30.53";
740
740
 
741
741
  var getFormattedLocation = function (location) {
742
742
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -86357,8 +86357,9 @@ var CoveoInsightClient = (function () {
86357
86357
  };
86358
86358
  return this.logClickEvent(exports.SearchPageEvents.caseAttach, info, identifier, caseMetadata ? __assign(__assign({}, generateMetadataToSend(caseMetadata, false)), metadata) : metadata);
86359
86359
  };
86360
- CoveoInsightClient.prototype.logCaseDetach = function (resultUriHash, metadata) {
86361
- return this.logCustomEvent(exports.SearchPageEvents.caseDetach, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), { resultUriHash: resultUriHash }) : { resultUriHash: resultUriHash });
86360
+ CoveoInsightClient.prototype.logCaseDetach = function (resultUriHash, metadata, permanentId) {
86361
+ var generatedMetadata = __assign(__assign(__assign({}, (metadata && generateMetadataToSend(metadata, false))), (permanentId && { permanentId: permanentId })), { resultUriHash: resultUriHash });
86362
+ return this.logCustomEvent(exports.SearchPageEvents.caseDetach, generatedMetadata);
86362
86363
  };
86363
86364
  CoveoInsightClient.prototype.logLikeSmartSnippet = function (metadata) {
86364
86365
  return this.logCustomEvent(exports.SearchPageEvents.likeSmartSnippet, metadata ? generateMetadataToSend(metadata, false) : undefined);
@@ -603,7 +603,7 @@ function sha1(bytes) {
603
603
  const v5 = v35('v5', 0x50, sha1);
604
604
  var uuidv5 = v5;
605
605
 
606
- const libVersion = "2.30.51";
606
+ const libVersion = "2.30.53";
607
607
 
608
608
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
609
609
 
@@ -3242,8 +3242,9 @@ class CoveoInsightClient {
3242
3242
  };
3243
3243
  return this.logClickEvent(SearchPageEvents.caseAttach, info, identifier, caseMetadata ? Object.assign(Object.assign({}, generateMetadataToSend(caseMetadata, false)), metadata) : metadata);
3244
3244
  }
3245
- logCaseDetach(resultUriHash, metadata) {
3246
- return this.logCustomEvent(SearchPageEvents.caseDetach, metadata ? Object.assign(Object.assign({}, generateMetadataToSend(metadata, false)), { resultUriHash }) : { resultUriHash });
3245
+ logCaseDetach(resultUriHash, metadata, permanentId) {
3246
+ const generatedMetadata = Object.assign(Object.assign(Object.assign({}, (metadata && generateMetadataToSend(metadata, false))), (permanentId && { permanentId })), { resultUriHash });
3247
+ return this.logCustomEvent(SearchPageEvents.caseDetach, generatedMetadata);
3247
3248
  }
3248
3249
  logLikeSmartSnippet(metadata) {
3249
3250
  return this.logCustomEvent(SearchPageEvents.likeSmartSnippet, metadata ? generateMetadataToSend(metadata, false) : undefined);
package/dist/library.js CHANGED
@@ -736,7 +736,7 @@ function sha1(bytes) {
736
736
  const v5 = v35('v5', 0x50, sha1);
737
737
  var uuidv5 = v5;
738
738
 
739
- var libVersion = "2.30.51";
739
+ var libVersion = "2.30.53";
740
740
 
741
741
  var getFormattedLocation = function (location) {
742
742
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -86357,8 +86357,9 @@ var CoveoInsightClient = (function () {
86357
86357
  };
86358
86358
  return this.logClickEvent(exports.SearchPageEvents.caseAttach, info, identifier, caseMetadata ? __assign(__assign({}, generateMetadataToSend(caseMetadata, false)), metadata) : metadata);
86359
86359
  };
86360
- CoveoInsightClient.prototype.logCaseDetach = function (resultUriHash, metadata) {
86361
- return this.logCustomEvent(exports.SearchPageEvents.caseDetach, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), { resultUriHash: resultUriHash }) : { resultUriHash: resultUriHash });
86360
+ CoveoInsightClient.prototype.logCaseDetach = function (resultUriHash, metadata, permanentId) {
86361
+ var generatedMetadata = __assign(__assign(__assign({}, (metadata && generateMetadataToSend(metadata, false))), (permanentId && { permanentId: permanentId })), { resultUriHash: resultUriHash });
86362
+ return this.logCustomEvent(exports.SearchPageEvents.caseDetach, generatedMetadata);
86362
86363
  };
86363
86364
  CoveoInsightClient.prototype.logLikeSmartSnippet = function (metadata) {
86364
86365
  return this.logCustomEvent(exports.SearchPageEvents.likeSmartSnippet, metadata ? generateMetadataToSend(metadata, false) : undefined);
package/dist/library.mjs CHANGED
@@ -734,7 +734,7 @@ function sha1(bytes) {
734
734
  const v5 = v35('v5', 0x50, sha1);
735
735
  var uuidv5 = v5;
736
736
 
737
- var libVersion = "2.30.51";
737
+ var libVersion = "2.30.53";
738
738
 
739
739
  var getFormattedLocation = function (location) {
740
740
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -86355,8 +86355,9 @@ var CoveoInsightClient = (function () {
86355
86355
  };
86356
86356
  return this.logClickEvent(SearchPageEvents.caseAttach, info, identifier, caseMetadata ? __assign(__assign({}, generateMetadataToSend(caseMetadata, false)), metadata) : metadata);
86357
86357
  };
86358
- CoveoInsightClient.prototype.logCaseDetach = function (resultUriHash, metadata) {
86359
- return this.logCustomEvent(SearchPageEvents.caseDetach, metadata ? __assign(__assign({}, generateMetadataToSend(metadata, false)), { resultUriHash: resultUriHash }) : { resultUriHash: resultUriHash });
86358
+ CoveoInsightClient.prototype.logCaseDetach = function (resultUriHash, metadata, permanentId) {
86359
+ var generatedMetadata = __assign(__assign(__assign({}, (metadata && generateMetadataToSend(metadata, false))), (permanentId && { permanentId: permanentId })), { resultUriHash: resultUriHash });
86360
+ return this.logCustomEvent(SearchPageEvents.caseDetach, generatedMetadata);
86360
86361
  };
86361
86362
  CoveoInsightClient.prototype.logLikeSmartSnippet = function (metadata) {
86362
86363
  return this.logCustomEvent(SearchPageEvents.likeSmartSnippet, metadata ? generateMetadataToSend(metadata, false) : undefined);
@@ -672,7 +672,7 @@ const addPageViewToHistory = (pageViewValue) => __awaiter(void 0, void 0, void 0
672
672
  yield store.addElementAsync(historyElement);
673
673
  });
674
674
 
675
- const libVersion = "2.30.51";
675
+ const libVersion = "2.30.53";
676
676
 
677
677
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
678
678
 
@@ -3263,8 +3263,9 @@ class CoveoInsightClient {
3263
3263
  };
3264
3264
  return this.logClickEvent(SearchPageEvents.caseAttach, info, identifier, caseMetadata ? Object.assign(Object.assign({}, generateMetadataToSend(caseMetadata, false)), metadata) : metadata);
3265
3265
  }
3266
- logCaseDetach(resultUriHash, metadata) {
3267
- return this.logCustomEvent(SearchPageEvents.caseDetach, metadata ? Object.assign(Object.assign({}, generateMetadataToSend(metadata, false)), { resultUriHash }) : { resultUriHash });
3266
+ logCaseDetach(resultUriHash, metadata, permanentId) {
3267
+ const generatedMetadata = Object.assign(Object.assign(Object.assign({}, (metadata && generateMetadataToSend(metadata, false))), (permanentId && { permanentId })), { resultUriHash });
3268
+ return this.logCustomEvent(SearchPageEvents.caseDetach, generatedMetadata);
3268
3269
  }
3269
3270
  logLikeSmartSnippet(metadata) {
3270
3271
  return this.logCustomEvent(SearchPageEvents.likeSmartSnippet, metadata ? generateMetadataToSend(metadata, false) : undefined);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coveo.analytics",
3
- "version": "2.30.51",
3
+ "version": "2.30.53",
4
4
  "description": "📈 Coveo analytics client (node and browser compatible) ",
5
5
  "main": "dist/library.cjs",
6
6
  "module": "dist/browser.mjs",
package/src/events.ts CHANGED
@@ -84,6 +84,7 @@ export interface DocumentInformation {
84
84
  documentAuthor?: string;
85
85
  queryPipeline?: string;
86
86
  rankingModifier?: string;
87
+ documentCategory?: string;
87
88
  }
88
89
 
89
90
  export interface ClickEventRequest extends EventBaseRequest, DocumentInformation {}
@@ -126,6 +126,7 @@ describe('InsightClient', () => {
126
126
 
127
127
  const fakeDocInfo = {
128
128
  collectionName: 'collection',
129
+ documentCategory: 'category',
129
130
  documentAuthor: 'author',
130
131
  documentPosition: 1,
131
132
  documentTitle: 'title',
@@ -383,10 +384,13 @@ describe('InsightClient', () => {
383
384
  });
384
385
 
385
386
  it('should send proper payload for #caseDetach', async () => {
387
+ const mockResultUriHash = fakeDocInfo.documentUriHash;
388
+ const mockPermanentId = fakeDocID.contentIDValue;
386
389
  const expectedMetadata = {
387
- resultUriHash: fakeDocInfo.documentUriHash,
390
+ resultUriHash: mockResultUriHash,
391
+ permanentId: mockPermanentId,
388
392
  };
389
- await client.logCaseDetach(fakeDocInfo.documentUriHash);
393
+ await client.logCaseDetach(mockResultUriHash, undefined, mockPermanentId);
390
394
  expectMatchCustomEventPayload(SearchPageEvents.caseDetach, expectedMetadata);
391
395
  });
392
396
 
@@ -1194,12 +1198,15 @@ describe('InsightClient', () => {
1194
1198
 
1195
1199
  it('should send proper payload for #caseDetach', async () => {
1196
1200
  const metadata = baseCaseMetadata;
1201
+ const mockResultUriHash = fakeDocInfo.documentUriHash;
1202
+ const mockPermanentId = fakeDocID.contentIDValue;
1197
1203
 
1198
1204
  const expectedMetadata = {
1199
1205
  ...expectedBaseCaseMetadata,
1200
- resultUriHash: fakeDocInfo.documentUriHash,
1206
+ resultUriHash: mockResultUriHash,
1207
+ permanentId: mockPermanentId,
1201
1208
  };
1202
- await client.logCaseDetach(fakeDocInfo.documentUriHash, metadata);
1209
+ await client.logCaseDetach(mockResultUriHash, metadata, mockPermanentId);
1203
1210
  expectMatchCustomEventPayload(SearchPageEvents.caseDetach, expectedMetadata);
1204
1211
  });
1205
1212
 
@@ -373,11 +373,13 @@ export class CoveoInsightClient {
373
373
  );
374
374
  }
375
375
 
376
- public logCaseDetach(resultUriHash: string, metadata?: CaseMetadata) {
377
- return this.logCustomEvent(
378
- SearchPageEvents.caseDetach,
379
- metadata ? {...generateMetadataToSend(metadata, false), resultUriHash} : {resultUriHash},
380
- );
376
+ public logCaseDetach(resultUriHash: string, metadata?: CaseMetadata, permanentId?: string) {
377
+ const generatedMetadata = {
378
+ ...(metadata && generateMetadataToSend(metadata, false)),
379
+ ...(permanentId && {permanentId}),
380
+ resultUriHash,
381
+ };
382
+ return this.logCustomEvent(SearchPageEvents.caseDetach, generatedMetadata);
381
383
  }
382
384
 
383
385
  public logLikeSmartSnippet(metadata?: CaseMetadata) {
@@ -26,6 +26,7 @@ const {fetchMock, fetchMockBeforeEach} = mockFetch();
26
26
  describe('SearchPageClient', () => {
27
27
  const fakeDocInfo = {
28
28
  collectionName: 'collection',
29
+ documentCategory: 'category',
29
30
  documentAuthor: 'author',
30
31
  documentPosition: 1,
31
32
  documentTitle: 'title',