coveo.analytics 2.20.22 → 2.20.23

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.
@@ -1,6 +1,6 @@
1
1
  import { ClientOptions, AnalyticsClient } from '../client/analytics';
2
2
  import { SearchEventRequest } from '../events';
3
- import { SearchPageEvents, OmniboxSuggestionsMetadata, FacetMetadata, FacetRangeMetadata, CategoryFacetMetadata, DocumentIdentifier, InterfaceChangeMetadata, ResultsSortMetadata, PartialDocumentInformation, TriggerNotifyMetadata, TriggerExecuteMetadata, TriggerRedirectMetadata, PagerResizeMetadata, PagerMetadata, FacetBaseMeta, FacetSortMeta, QueryErrorMeta, FacetStateMetadata, SmartSnippetFeedbackReason, SmartSnippetSuggestionMeta, SmartSnippetDocumentIdentifier, StaticFilterMetadata, StaticFilterToggleValueMetadata, UndoTriggerRedirectMetadata } from './searchPageEvents';
3
+ import { SearchPageEvents, OmniboxSuggestionsMetadata, FacetMetadata, FacetRangeMetadata, CategoryFacetMetadata, DocumentIdentifier, InterfaceChangeMetadata, ResultsSortMetadata, PartialDocumentInformation, TriggerNotifyMetadata, TriggerExecuteMetadata, TriggerRedirectMetadata, PagerResizeMetadata, PagerMetadata, FacetBaseMeta, FacetSortMeta, QueryErrorMeta, FacetStateMetadata, SmartSnippetFeedbackReason, SmartSnippetSuggestionMeta, SmartSnippetDocumentIdentifier, StaticFilterMetadata, StaticFilterToggleValueMetadata, UndoTriggerRedirectMetadata, SmartSnippetLinkMeta } from './searchPageEvents';
4
4
  export interface SearchPageClientProvider {
5
5
  getBaseMetadata: () => Record<string, any>;
6
6
  getSearchEventRequestPayload: () => Omit<SearchEventRequest, 'actionCause' | 'searchQueryUid'>;
@@ -85,6 +85,8 @@ export declare class CoveoSearchPageClient {
85
85
  logShowLessSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta): Promise<void | import("../events").CustomEventResponse>;
86
86
  logOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | import("../events").ClickEventResponse>;
87
87
  logOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta): Promise<void | import("../events").ClickEventResponse>;
88
+ logOpenSmartSnippetInlineLink(info: PartialDocumentInformation, identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta): Promise<void | import("../events").ClickEventResponse>;
89
+ logOpenSmartSnippetSuggestionInlineLink(info: PartialDocumentInformation, snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta): Promise<void | import("../events").ClickEventResponse>;
88
90
  logRecentQueryClick(): Promise<void | import("../events").SearchEventResponse>;
89
91
  logClearRecentQueries(): Promise<void | import("../events").CustomEventResponse>;
90
92
  logRecentResultClick(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | import("../events").CustomEventResponse>;
@@ -59,6 +59,8 @@ export declare enum SearchPageEvents {
59
59
  showLessSmartSnippetSuggestion = "showLessSmartSnippetSuggestion",
60
60
  openSmartSnippetSource = "openSmartSnippetSource",
61
61
  openSmartSnippetSuggestionSource = "openSmartSnippetSuggestionSource",
62
+ openSmartSnippetInlineLink = "openSmartSnippetInlineLink",
63
+ openSmartSnippetSuggestionInlineLink = "openSmartSnippetSuggestionInlineLink",
62
64
  recentQueryClick = "recentQueriesClick",
63
65
  clearRecentQueries = "clearRecentQueries",
64
66
  recentResultClick = "recentResultClick",
@@ -160,6 +162,10 @@ export interface SmartSnippetSuggestionMeta {
160
162
  answerSnippet: string;
161
163
  documentId: SmartSnippetDocumentIdentifier;
162
164
  }
165
+ export interface SmartSnippetLinkMeta {
166
+ linkText: string;
167
+ linkURL: string;
168
+ }
163
169
  export interface SmartSnippetDocumentIdentifier {
164
170
  contentIdKey: string;
165
171
  contentIdValue: string;
@@ -1149,6 +1149,8 @@ var SearchPageEvents;
1149
1149
  SearchPageEvents["showLessSmartSnippetSuggestion"] = "showLessSmartSnippetSuggestion";
1150
1150
  SearchPageEvents["openSmartSnippetSource"] = "openSmartSnippetSource";
1151
1151
  SearchPageEvents["openSmartSnippetSuggestionSource"] = "openSmartSnippetSuggestionSource";
1152
+ SearchPageEvents["openSmartSnippetInlineLink"] = "openSmartSnippetInlineLink";
1153
+ SearchPageEvents["openSmartSnippetSuggestionInlineLink"] = "openSmartSnippetSuggestionInlineLink";
1152
1154
  SearchPageEvents["recentQueryClick"] = "recentQueriesClick";
1153
1155
  SearchPageEvents["clearRecentQueries"] = "clearRecentQueries";
1154
1156
  SearchPageEvents["recentResultClick"] = "recentResultClick";
@@ -1470,6 +1472,15 @@ class CoveoSearchPageClient {
1470
1472
  logOpenSmartSnippetSuggestionSource(info, snippet) {
1471
1473
  return this.logClickEvent(SearchPageEvents.openSmartSnippetSuggestionSource, info, { contentIDKey: snippet.documentId.contentIdKey, contentIDValue: snippet.documentId.contentIdValue }, snippet);
1472
1474
  }
1475
+ logOpenSmartSnippetInlineLink(info, identifierAndLink) {
1476
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetInlineLink, info, { contentIDKey: identifierAndLink.contentIDKey, contentIDValue: identifierAndLink.contentIDValue }, identifierAndLink);
1477
+ }
1478
+ logOpenSmartSnippetSuggestionInlineLink(info, snippetAndLink) {
1479
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetSuggestionInlineLink, info, {
1480
+ contentIDKey: snippetAndLink.documentId.contentIdKey,
1481
+ contentIDValue: snippetAndLink.documentId.contentIdValue,
1482
+ }, snippetAndLink);
1483
+ }
1473
1484
  logRecentQueryClick() {
1474
1485
  return this.logSearchEvent(SearchPageEvents.recentQueryClick);
1475
1486
  }
package/dist/library.js CHANGED
@@ -83609,6 +83609,8 @@ var SearchPageEvents;
83609
83609
  SearchPageEvents["showLessSmartSnippetSuggestion"] = "showLessSmartSnippetSuggestion";
83610
83610
  SearchPageEvents["openSmartSnippetSource"] = "openSmartSnippetSource";
83611
83611
  SearchPageEvents["openSmartSnippetSuggestionSource"] = "openSmartSnippetSuggestionSource";
83612
+ SearchPageEvents["openSmartSnippetInlineLink"] = "openSmartSnippetInlineLink";
83613
+ SearchPageEvents["openSmartSnippetSuggestionInlineLink"] = "openSmartSnippetSuggestionInlineLink";
83612
83614
  SearchPageEvents["recentQueryClick"] = "recentQueriesClick";
83613
83615
  SearchPageEvents["clearRecentQueries"] = "clearRecentQueries";
83614
83616
  SearchPageEvents["recentResultClick"] = "recentResultClick";
@@ -83949,6 +83951,15 @@ var CoveoSearchPageClient = (function () {
83949
83951
  CoveoSearchPageClient.prototype.logOpenSmartSnippetSuggestionSource = function (info, snippet) {
83950
83952
  return this.logClickEvent(SearchPageEvents.openSmartSnippetSuggestionSource, info, { contentIDKey: snippet.documentId.contentIdKey, contentIDValue: snippet.documentId.contentIdValue }, snippet);
83951
83953
  };
83954
+ CoveoSearchPageClient.prototype.logOpenSmartSnippetInlineLink = function (info, identifierAndLink) {
83955
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetInlineLink, info, { contentIDKey: identifierAndLink.contentIDKey, contentIDValue: identifierAndLink.contentIDValue }, identifierAndLink);
83956
+ };
83957
+ CoveoSearchPageClient.prototype.logOpenSmartSnippetSuggestionInlineLink = function (info, snippetAndLink) {
83958
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetSuggestionInlineLink, info, {
83959
+ contentIDKey: snippetAndLink.documentId.contentIdKey,
83960
+ contentIDValue: snippetAndLink.documentId.contentIdValue,
83961
+ }, snippetAndLink);
83962
+ };
83952
83963
  CoveoSearchPageClient.prototype.logRecentQueryClick = function () {
83953
83964
  return this.logSearchEvent(SearchPageEvents.recentQueryClick);
83954
83965
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coveo.analytics",
3
- "version": "2.20.22",
3
+ "version": "2.20.23",
4
4
  "description": "📈 Coveo analytics client (node and browser compatible) ",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.es.js",
@@ -637,6 +637,32 @@ describe('SearchPageClient', () => {
637
637
  });
638
638
  });
639
639
 
640
+ it('should send proper payload for #logOpenSmartSnippetInlineLink', async () => {
641
+ const meta = {
642
+ ...fakeDocID,
643
+ linkText: 'Some text',
644
+ linkURL: 'https://invalid.com',
645
+ };
646
+ await client.logOpenSmartSnippetInlineLink(fakeDocInfo, meta);
647
+ expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetInlineLink, fakeDocInfo, meta);
648
+ });
649
+
650
+ it('should send proper payload for #logOpenSmartSnippetSuggestionInlineLink', async () => {
651
+ const meta = {
652
+ question: 'Abc',
653
+ answerSnippet: 'Def',
654
+ documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
655
+ linkText: 'Some text',
656
+ linkURL: 'https://invalid.com',
657
+ };
658
+ await client.logOpenSmartSnippetSuggestionInlineLink(fakeDocInfo, meta);
659
+ expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionInlineLink, fakeDocInfo, {
660
+ ...meta,
661
+ contentIDKey: meta.documentId.contentIdKey,
662
+ contentIDValue: meta.documentId.contentIdValue,
663
+ });
664
+ });
665
+
640
666
  it('should send proper payload for #logRecentQueryClick', async () => {
641
667
  await client.logRecentQueryClick();
642
668
  expectMatchPayload(SearchPageEvents.recentQueryClick);
@@ -26,6 +26,7 @@ import {
26
26
  StaticFilterMetadata,
27
27
  StaticFilterToggleValueMetadata,
28
28
  UndoTriggerRedirectMetadata,
29
+ SmartSnippetLinkMeta,
29
30
  } from './searchPageEvents';
30
31
  import {NoopAnalytics} from '../client/noopAnalytics';
31
32
  import {formatOmniboxMetadata} from '../formatting/format-omnibox-metadata';
@@ -328,6 +329,33 @@ export class CoveoSearchPageClient {
328
329
  );
329
330
  }
330
331
 
332
+ public logOpenSmartSnippetInlineLink(
333
+ info: PartialDocumentInformation,
334
+ identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta
335
+ ) {
336
+ return this.logClickEvent(
337
+ SearchPageEvents.openSmartSnippetInlineLink,
338
+ info,
339
+ {contentIDKey: identifierAndLink.contentIDKey, contentIDValue: identifierAndLink.contentIDValue},
340
+ identifierAndLink
341
+ );
342
+ }
343
+
344
+ public logOpenSmartSnippetSuggestionInlineLink(
345
+ info: PartialDocumentInformation,
346
+ snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta
347
+ ) {
348
+ return this.logClickEvent(
349
+ SearchPageEvents.openSmartSnippetSuggestionInlineLink,
350
+ info,
351
+ {
352
+ contentIDKey: snippetAndLink.documentId.contentIdKey,
353
+ contentIDValue: snippetAndLink.documentId.contentIdValue,
354
+ },
355
+ snippetAndLink
356
+ );
357
+ }
358
+
331
359
  public logRecentQueryClick() {
332
360
  return this.logSearchEvent(SearchPageEvents.recentQueryClick);
333
361
  }
@@ -238,6 +238,14 @@ export enum SearchPageEvents {
238
238
  * Identifies the custom event that gets logged when a user clicks on the source of a snippet suggestion for a related question.
239
239
  */
240
240
  openSmartSnippetSuggestionSource = 'openSmartSnippetSuggestionSource',
241
+ /**
242
+ * Identifies the custom event that gets logged when a user clicks on a link in the answer of a smart snippet.
243
+ */
244
+ openSmartSnippetInlineLink = 'openSmartSnippetInlineLink',
245
+ /**
246
+ * Identifies the custom event that gets logged when a user clicks on a link in the snippet suggestion for a related question.
247
+ */
248
+ openSmartSnippetSuggestionInlineLink = 'openSmartSnippetSuggestionInlineLink',
241
249
  /**
242
250
  * Identifies the search event that gets logged when a recent queries list item gets clicked.
243
251
  */
@@ -419,6 +427,11 @@ export interface SmartSnippetSuggestionMeta {
419
427
  documentId: SmartSnippetDocumentIdentifier;
420
428
  }
421
429
 
430
+ export interface SmartSnippetLinkMeta {
431
+ linkText: string;
432
+ linkURL: string;
433
+ }
434
+
422
435
  export interface SmartSnippetDocumentIdentifier {
423
436
  contentIdKey: string;
424
437
  contentIdValue: string;