coveo.analytics 2.23.4 → 2.23.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.
@@ -48,6 +48,8 @@ export declare class CoveoInsightClient {
48
48
  logContextChanged(metadata: CaseMetadata): Promise<void | import("../events").SearchEventResponse>;
49
49
  logExpandToFullUI(metadata: ExpandToFullUIMetadata): Promise<void | import("../events").CustomEventResponse>;
50
50
  logDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>;
51
+ logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>;
52
+ logDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier, caseMetadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>;
51
53
  logCustomEvent(event: SearchPageEvents | InsightEvents, metadata?: Record<string, any>): Promise<void | import("../events").CustomEventResponse>;
52
54
  logSearchEvent(event: SearchPageEvents | InsightEvents, metadata?: Record<string, any>): Promise<void | import("../events").SearchEventResponse>;
53
55
  logClickEvent(event: SearchPageEvents, info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: Record<string, any>): Promise<void | import("../events").ClickEventResponse>;
@@ -148,6 +148,8 @@ export declare class CoveoSearchPageClient {
148
148
  makeOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier): EventBuilder<ClickEventResponse>;
149
149
  logOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | ClickEventResponse>;
150
150
  makeOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta): EventBuilder<ClickEventResponse>;
151
+ makeCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier): EventBuilder<ClickEventResponse>;
152
+ logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | ClickEventResponse>;
151
153
  logOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta): Promise<void | ClickEventResponse>;
152
154
  makeOpenSmartSnippetInlineLink(info: PartialDocumentInformation, identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta): EventBuilder<ClickEventResponse>;
153
155
  logOpenSmartSnippetInlineLink(info: PartialDocumentInformation, identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta): Promise<void | ClickEventResponse>;
@@ -67,7 +67,8 @@ export declare enum SearchPageEvents {
67
67
  clearRecentResults = "clearRecentResults",
68
68
  noResultsBack = "noResultsBack",
69
69
  showMoreFoldedResults = "showMoreFoldedResults",
70
- showLessFoldedResults = "showLessFoldedResults"
70
+ showLessFoldedResults = "showLessFoldedResults",
71
+ copyToClipboard = "copyToClipboard"
71
72
  }
72
73
  export declare const CustomEventsTypes: Partial<Record<SearchPageEvents | InsightEvents, string>>;
73
74
  export interface StaticFilterMetadata {
@@ -1151,6 +1151,7 @@ var SearchPageEvents;
1151
1151
  SearchPageEvents["noResultsBack"] = "noResultsBack";
1152
1152
  SearchPageEvents["showMoreFoldedResults"] = "showMoreFoldedResults";
1153
1153
  SearchPageEvents["showLessFoldedResults"] = "showLessFoldedResults";
1154
+ SearchPageEvents["copyToClipboard"] = "copyToClipboard";
1154
1155
  })(SearchPageEvents || (SearchPageEvents = {}));
1155
1156
  const CustomEventsTypes = {
1156
1157
  [SearchPageEvents.triggerNotify]: 'queryPipelineTriggers',
@@ -1646,6 +1647,12 @@ class CoveoSearchPageClient {
1646
1647
  makeOpenSmartSnippetSuggestionSource(info, snippet) {
1647
1648
  return this.makeClickEvent(SearchPageEvents.openSmartSnippetSuggestionSource, info, { contentIDKey: snippet.documentId.contentIdKey, contentIDValue: snippet.documentId.contentIdValue }, snippet);
1648
1649
  }
1650
+ makeCopyToClipboard(info, identifier) {
1651
+ return this.makeClickEvent(SearchPageEvents.copyToClipboard, info, identifier);
1652
+ }
1653
+ logCopyToClipboard(info, identifier) {
1654
+ return this.makeCopyToClipboard(info, identifier).log();
1655
+ }
1649
1656
  logOpenSmartSnippetSuggestionSource(info, snippet) {
1650
1657
  return this.makeOpenSmartSnippetSuggestionSource(info, snippet).log();
1651
1658
  }
@@ -2194,6 +2201,16 @@ class CoveoInsightClient {
2194
2201
  logDocumentOpen(info, identifier, metadata) {
2195
2202
  return this.logClickEvent(SearchPageEvents.documentOpen, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
2196
2203
  }
2204
+ logCopyToClipboard(info, identifier, metadata) {
2205
+ return this.logClickEvent(SearchPageEvents.copyToClipboard, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
2206
+ }
2207
+ logDocumentQuickview(info, identifier, caseMetadata) {
2208
+ const metadata = {
2209
+ documentTitle: info.documentTitle,
2210
+ documentURL: info.documentUrl,
2211
+ };
2212
+ return this.logClickEvent(SearchPageEvents.documentQuickview, info, identifier, caseMetadata ? Object.assign(Object.assign({}, generateMetadataToSend(caseMetadata, false)), metadata) : metadata);
2213
+ }
2197
2214
  logCustomEvent(event, metadata) {
2198
2215
  return __awaiter(this, void 0, void 0, function* () {
2199
2216
  const customData = Object.assign(Object.assign({}, this.provider.getBaseMetadata()), metadata);
package/dist/library.js CHANGED
@@ -83624,6 +83624,7 @@ var SearchPageEvents;
83624
83624
  SearchPageEvents["noResultsBack"] = "noResultsBack";
83625
83625
  SearchPageEvents["showMoreFoldedResults"] = "showMoreFoldedResults";
83626
83626
  SearchPageEvents["showLessFoldedResults"] = "showLessFoldedResults";
83627
+ SearchPageEvents["copyToClipboard"] = "copyToClipboard";
83627
83628
  })(SearchPageEvents || (SearchPageEvents = {}));
83628
83629
  var CustomEventsTypes = (_a = {},
83629
83630
  _a[SearchPageEvents.triggerNotify] = 'queryPipelineTriggers',
@@ -84141,6 +84142,12 @@ var CoveoSearchPageClient = (function () {
84141
84142
  CoveoSearchPageClient.prototype.makeOpenSmartSnippetSuggestionSource = function (info, snippet) {
84142
84143
  return this.makeClickEvent(SearchPageEvents.openSmartSnippetSuggestionSource, info, { contentIDKey: snippet.documentId.contentIdKey, contentIDValue: snippet.documentId.contentIdValue }, snippet);
84143
84144
  };
84145
+ CoveoSearchPageClient.prototype.makeCopyToClipboard = function (info, identifier) {
84146
+ return this.makeClickEvent(SearchPageEvents.copyToClipboard, info, identifier);
84147
+ };
84148
+ CoveoSearchPageClient.prototype.logCopyToClipboard = function (info, identifier) {
84149
+ return this.makeCopyToClipboard(info, identifier).log();
84150
+ };
84144
84151
  CoveoSearchPageClient.prototype.logOpenSmartSnippetSuggestionSource = function (info, snippet) {
84145
84152
  return this.makeOpenSmartSnippetSuggestionSource(info, snippet).log();
84146
84153
  };
@@ -84616,6 +84623,16 @@ var CoveoInsightClient = (function () {
84616
84623
  CoveoInsightClient.prototype.logDocumentOpen = function (info, identifier, metadata) {
84617
84624
  return this.logClickEvent(SearchPageEvents.documentOpen, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
84618
84625
  };
84626
+ CoveoInsightClient.prototype.logCopyToClipboard = function (info, identifier, metadata) {
84627
+ return this.logClickEvent(SearchPageEvents.copyToClipboard, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
84628
+ };
84629
+ CoveoInsightClient.prototype.logDocumentQuickview = function (info, identifier, caseMetadata) {
84630
+ var metadata = {
84631
+ documentTitle: info.documentTitle,
84632
+ documentURL: info.documentUrl,
84633
+ };
84634
+ return this.logClickEvent(SearchPageEvents.documentQuickview, info, identifier, caseMetadata ? __assign(__assign({}, generateMetadataToSend(caseMetadata, false)), metadata) : metadata);
84635
+ };
84619
84636
  CoveoInsightClient.prototype.logCustomEvent = function (event, metadata) {
84620
84637
  return __awaiter(this, void 0, void 0, function () {
84621
84638
  var customData, payload, _a;
@@ -1168,6 +1168,7 @@ var SearchPageEvents;
1168
1168
  SearchPageEvents["noResultsBack"] = "noResultsBack";
1169
1169
  SearchPageEvents["showMoreFoldedResults"] = "showMoreFoldedResults";
1170
1170
  SearchPageEvents["showLessFoldedResults"] = "showLessFoldedResults";
1171
+ SearchPageEvents["copyToClipboard"] = "copyToClipboard";
1171
1172
  })(SearchPageEvents || (SearchPageEvents = {}));
1172
1173
  const CustomEventsTypes = {
1173
1174
  [SearchPageEvents.triggerNotify]: 'queryPipelineTriggers',
@@ -1663,6 +1664,12 @@ class CoveoSearchPageClient {
1663
1664
  makeOpenSmartSnippetSuggestionSource(info, snippet) {
1664
1665
  return this.makeClickEvent(SearchPageEvents.openSmartSnippetSuggestionSource, info, { contentIDKey: snippet.documentId.contentIdKey, contentIDValue: snippet.documentId.contentIdValue }, snippet);
1665
1666
  }
1667
+ makeCopyToClipboard(info, identifier) {
1668
+ return this.makeClickEvent(SearchPageEvents.copyToClipboard, info, identifier);
1669
+ }
1670
+ logCopyToClipboard(info, identifier) {
1671
+ return this.makeCopyToClipboard(info, identifier).log();
1672
+ }
1666
1673
  logOpenSmartSnippetSuggestionSource(info, snippet) {
1667
1674
  return this.makeOpenSmartSnippetSuggestionSource(info, snippet).log();
1668
1675
  }
@@ -2211,6 +2218,16 @@ class CoveoInsightClient {
2211
2218
  logDocumentOpen(info, identifier, metadata) {
2212
2219
  return this.logClickEvent(SearchPageEvents.documentOpen, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
2213
2220
  }
2221
+ logCopyToClipboard(info, identifier, metadata) {
2222
+ return this.logClickEvent(SearchPageEvents.copyToClipboard, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
2223
+ }
2224
+ logDocumentQuickview(info, identifier, caseMetadata) {
2225
+ const metadata = {
2226
+ documentTitle: info.documentTitle,
2227
+ documentURL: info.documentUrl,
2228
+ };
2229
+ return this.logClickEvent(SearchPageEvents.documentQuickview, info, identifier, caseMetadata ? Object.assign(Object.assign({}, generateMetadataToSend(caseMetadata, false)), metadata) : metadata);
2230
+ }
2214
2231
  logCustomEvent(event, metadata) {
2215
2232
  return __awaiter(this, void 0, void 0, function* () {
2216
2233
  const customData = Object.assign(Object.assign({}, this.provider.getBaseMetadata()), metadata);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coveo.analytics",
3
- "version": "2.23.4",
3
+ "version": "2.23.5",
4
4
  "description": "📈 Coveo analytics client (node and browser compatible) ",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.es.js",
@@ -318,6 +318,21 @@ describe('InsightClient', () => {
318
318
  await client.logDocumentOpen(fakeDocInfo, fakeDocID);
319
319
  expectMatchDocumentPayload(SearchPageEvents.documentOpen, fakeDocInfo, fakeDocID);
320
320
  });
321
+
322
+ it('should send proper payload for #copyToClipboard', async () => {
323
+ await client.logCopyToClipboard(fakeDocInfo, fakeDocID);
324
+ expectMatchDocumentPayload(SearchPageEvents.copyToClipboard, fakeDocInfo, fakeDocID);
325
+ });
326
+
327
+ it('should send proper payload for #documentQuickview', async () => {
328
+ const expectedMetadata = {
329
+ ...fakeDocID,
330
+ documentTitle: fakeDocInfo.documentTitle,
331
+ documentURL: fakeDocInfo.documentUrl,
332
+ };
333
+ await client.logDocumentQuickview(fakeDocInfo, fakeDocID);
334
+ expectMatchDocumentPayload(SearchPageEvents.documentQuickview, fakeDocInfo, expectedMetadata);
335
+ });
321
336
  });
322
337
 
323
338
  describe('when the case metadata is included', () => {
@@ -675,6 +690,30 @@ describe('InsightClient', () => {
675
690
  await client.logDocumentOpen(fakeDocInfo, fakeDocID, metadata);
676
691
  expectMatchDocumentPayload(SearchPageEvents.documentOpen, fakeDocInfo, expectedMetadata);
677
692
  });
693
+
694
+ it('should send proper payload for #copyToClipboard', async () => {
695
+ const metadata = baseCaseMetadata;
696
+
697
+ const expectedMetadata = {
698
+ ...fakeDocID,
699
+ ...expectedBaseCaseMetadata,
700
+ };
701
+ await client.logCopyToClipboard(fakeDocInfo, fakeDocID, metadata);
702
+ expectMatchDocumentPayload(SearchPageEvents.copyToClipboard, fakeDocInfo, expectedMetadata);
703
+ });
704
+
705
+ it('should send proper payload for #documentQuickview', async () => {
706
+ const metadata = baseCaseMetadata;
707
+
708
+ const expectedMetadata = {
709
+ ...fakeDocID,
710
+ ...expectedBaseCaseMetadata,
711
+ documentTitle: fakeDocInfo.documentTitle,
712
+ documentURL: fakeDocInfo.documentUrl,
713
+ };
714
+ await client.logDocumentQuickview(fakeDocInfo, fakeDocID, metadata);
715
+ expectMatchDocumentPayload(SearchPageEvents.documentQuickview, fakeDocInfo, expectedMetadata);
716
+ });
678
717
  });
679
718
 
680
719
  it('should enable analytics tracking by default', () => {
@@ -221,10 +221,41 @@ export class CoveoInsightClient {
221
221
 
222
222
  public logDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: CaseMetadata) {
223
223
  return this.logClickEvent(
224
- SearchPageEvents.documentOpen,
225
- info,
226
- identifier,
227
- metadata ? generateMetadataToSend(metadata, false) : undefined);
224
+ SearchPageEvents.documentOpen,
225
+ info,
226
+ identifier,
227
+ metadata ? generateMetadataToSend(metadata, false) : undefined
228
+ );
229
+ }
230
+
231
+ public logCopyToClipboard(
232
+ info: PartialDocumentInformation,
233
+ identifier: DocumentIdentifier,
234
+ metadata?: CaseMetadata
235
+ ) {
236
+ return this.logClickEvent(
237
+ SearchPageEvents.copyToClipboard,
238
+ info,
239
+ identifier,
240
+ metadata ? generateMetadataToSend(metadata, false) : undefined
241
+ );
242
+ }
243
+
244
+ public logDocumentQuickview(
245
+ info: PartialDocumentInformation,
246
+ identifier: DocumentIdentifier,
247
+ caseMetadata?: CaseMetadata
248
+ ) {
249
+ const metadata = {
250
+ documentTitle: info.documentTitle,
251
+ documentURL: info.documentUrl,
252
+ };
253
+ return this.logClickEvent(
254
+ SearchPageEvents.documentQuickview,
255
+ info,
256
+ identifier,
257
+ caseMetadata ? {...generateMetadataToSend(caseMetadata, false), ...metadata} : metadata
258
+ );
228
259
  }
229
260
 
230
261
  public async logCustomEvent(event: SearchPageEvents | InsightEvents, metadata?: Record<string, any>) {
@@ -1174,6 +1174,11 @@ describe('SearchPageClient', () => {
1174
1174
  expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSource, fakeDocInfo, fakeDocID);
1175
1175
  });
1176
1176
 
1177
+ it('should send proper payload for #logCopyToClipboard', async () => {
1178
+ await client.logCopyToClipboard(fakeDocInfo, fakeDocID);
1179
+ expectMatchDocumentPayload(SearchPageEvents.copyToClipboard, fakeDocInfo, fakeDocID);
1180
+ });
1181
+
1177
1182
  it('should send proper payload for #makeOpenSmartSnippetSource', async () => {
1178
1183
  const built = client.makeOpenSmartSnippetSource(fakeDocInfo, fakeDocID);
1179
1184
  await built.log();
@@ -603,6 +603,14 @@ export class CoveoSearchPageClient {
603
603
  );
604
604
  }
605
605
 
606
+ public makeCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
607
+ return this.makeClickEvent(SearchPageEvents.copyToClipboard, info, identifier);
608
+ }
609
+
610
+ public logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
611
+ return this.makeCopyToClipboard(info, identifier).log();
612
+ }
613
+
606
614
  public logOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta) {
607
615
  return this.makeOpenSmartSnippetSuggestionSource(info, snippet).log();
608
616
  }
@@ -274,6 +274,10 @@ export enum SearchPageEvents {
274
274
  * Identifies the custom event that gets logged when a user clicks the Show Less link under a search result that support the folding component.
275
275
  */
276
276
  showLessFoldedResults = 'showLessFoldedResults',
277
+ /**
278
+ * Identifies the click event that gets logged when a user clicks the Copy To Clipboard result action.
279
+ */
280
+ copyToClipboard = 'copyToClipboard',
277
281
  }
278
282
 
279
283
  export const CustomEventsTypes: Partial<Record<SearchPageEvents | InsightEvents, string>> = {