coveo.analytics 2.19.1 → 2.19.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.
@@ -78,6 +78,7 @@ export declare class CoveoSearchPageClient {
78
78
  logSmartSnippetFeedbackReason(reason: SmartSnippetFeedbackReason, details?: string): Promise<void | import("../events").CustomEventResponse>;
79
79
  logExpandSmartSnippetSuggestion(documentId: SmartSnippetSuggestionMeta): Promise<void | import("../events").CustomEventResponse>;
80
80
  logCollapseSmartSnippetSuggestion(documentId: SmartSnippetSuggestionMeta): Promise<void | import("../events").CustomEventResponse>;
81
+ logOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | import("../events").ClickEventResponse>;
81
82
  logRecentQueryClick(): Promise<void | import("../events").SearchEventResponse>;
82
83
  logClearRecentQueries(): Promise<void | import("../events").CustomEventResponse>;
83
84
  logRecentResultClick(info: PartialDocumentInformation, identifier: DocumentIdentifier): Promise<void | import("../events").CustomEventResponse>;
@@ -53,6 +53,7 @@ export declare enum SearchPageEvents {
53
53
  sendSmartSnippetReason = "sendSmartSnippetReason",
54
54
  expandSmartSnippetSuggestion = "expandSmartSnippetSuggestion",
55
55
  collapseSmartSnippetSuggestion = "collapseSmartSnippetSuggestion",
56
+ openSmartSnippetSource = "openSmartSnippetSource",
56
57
  recentQueryClick = "recentQueriesClick",
57
58
  clearRecentQueries = "clearRecentQueries",
58
59
  recentResultClick = "recentResultClick",
@@ -143,12 +144,7 @@ export interface QueryErrorMeta {
143
144
  errorType: string;
144
145
  errorMessage: string;
145
146
  }
146
- export declare enum SmartSnippetFeedbackReason {
147
- DoesNotAnswer = "does_not_answer",
148
- PartiallyAnswers = "partially_answers",
149
- WasNotAQuestion = "was_not_a_question",
150
- Other = "other"
151
- }
147
+ export declare type SmartSnippetFeedbackReason = 'does_not_answer' | 'partially_answers' | 'was_not_a_question' | 'other';
152
148
  export interface SmartSnippetSuggestionMeta {
153
149
  contentIdKey: string;
154
150
  contentIdValue: string;
@@ -1111,6 +1111,7 @@ var SearchPageEvents;
1111
1111
  SearchPageEvents["sendSmartSnippetReason"] = "sendSmartSnippetReason";
1112
1112
  SearchPageEvents["expandSmartSnippetSuggestion"] = "expandSmartSnippetSuggestion";
1113
1113
  SearchPageEvents["collapseSmartSnippetSuggestion"] = "collapseSmartSnippetSuggestion";
1114
+ SearchPageEvents["openSmartSnippetSource"] = "openSmartSnippetSource";
1114
1115
  SearchPageEvents["recentQueryClick"] = "recentQueriesClick";
1115
1116
  SearchPageEvents["clearRecentQueries"] = "clearRecentQueries";
1116
1117
  SearchPageEvents["recentResultClick"] = "recentResultClick";
@@ -1147,14 +1148,7 @@ const CustomEventsTypes = {
1147
1148
  [SearchPageEvents.clearRecentQueries]: 'recentQueries',
1148
1149
  [SearchPageEvents.recentResultClick]: 'recentlyClickedDocuments',
1149
1150
  [SearchPageEvents.clearRecentResults]: 'recentlyClickedDocuments',
1150
- };
1151
- var SmartSnippetFeedbackReason;
1152
- (function (SmartSnippetFeedbackReason) {
1153
- SmartSnippetFeedbackReason["DoesNotAnswer"] = "does_not_answer";
1154
- SmartSnippetFeedbackReason["PartiallyAnswers"] = "partially_answers";
1155
- SmartSnippetFeedbackReason["WasNotAQuestion"] = "was_not_a_question";
1156
- SmartSnippetFeedbackReason["Other"] = "other";
1157
- })(SmartSnippetFeedbackReason || (SmartSnippetFeedbackReason = {}));
1151
+ };
1158
1152
 
1159
1153
  class NoopAnalytics {
1160
1154
  constructor() {
@@ -1418,6 +1412,9 @@ class CoveoSearchPageClient {
1418
1412
  logCollapseSmartSnippetSuggestion(documentId) {
1419
1413
  return this.logCustomEvent(SearchPageEvents.collapseSmartSnippetSuggestion, { documentId });
1420
1414
  }
1415
+ logOpenSmartSnippetSource(info, identifier) {
1416
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetSource, info, identifier);
1417
+ }
1421
1418
  logRecentQueryClick() {
1422
1419
  return this.logSearchEvent(SearchPageEvents.recentQueryClick);
1423
1420
  }
package/dist/library.js CHANGED
@@ -83728,6 +83728,7 @@ var SearchPageEvents;
83728
83728
  SearchPageEvents["sendSmartSnippetReason"] = "sendSmartSnippetReason";
83729
83729
  SearchPageEvents["expandSmartSnippetSuggestion"] = "expandSmartSnippetSuggestion";
83730
83730
  SearchPageEvents["collapseSmartSnippetSuggestion"] = "collapseSmartSnippetSuggestion";
83731
+ SearchPageEvents["openSmartSnippetSource"] = "openSmartSnippetSource";
83731
83732
  SearchPageEvents["recentQueryClick"] = "recentQueriesClick";
83732
83733
  SearchPageEvents["clearRecentQueries"] = "clearRecentQueries";
83733
83734
  SearchPageEvents["recentResultClick"] = "recentResultClick";
@@ -83764,14 +83765,7 @@ var CustomEventsTypes = (_a = {},
83764
83765
  _a[SearchPageEvents.clearRecentQueries] = 'recentQueries',
83765
83766
  _a[SearchPageEvents.recentResultClick] = 'recentlyClickedDocuments',
83766
83767
  _a[SearchPageEvents.clearRecentResults] = 'recentlyClickedDocuments',
83767
- _a);
83768
- var SmartSnippetFeedbackReason;
83769
- (function (SmartSnippetFeedbackReason) {
83770
- SmartSnippetFeedbackReason["DoesNotAnswer"] = "does_not_answer";
83771
- SmartSnippetFeedbackReason["PartiallyAnswers"] = "partially_answers";
83772
- SmartSnippetFeedbackReason["WasNotAQuestion"] = "was_not_a_question";
83773
- SmartSnippetFeedbackReason["Other"] = "other";
83774
- })(SmartSnippetFeedbackReason || (SmartSnippetFeedbackReason = {}));
83768
+ _a);
83775
83769
 
83776
83770
  var NoopAnalytics = (function () {
83777
83771
  function NoopAnalytics() {
@@ -84054,6 +84048,9 @@ var CoveoSearchPageClient = (function () {
84054
84048
  CoveoSearchPageClient.prototype.logCollapseSmartSnippetSuggestion = function (documentId) {
84055
84049
  return this.logCustomEvent(SearchPageEvents.collapseSmartSnippetSuggestion, { documentId: documentId });
84056
84050
  };
84051
+ CoveoSearchPageClient.prototype.logOpenSmartSnippetSource = function (info, identifier) {
84052
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetSource, info, identifier);
84053
+ };
84057
84054
  CoveoSearchPageClient.prototype.logRecentQueryClick = function () {
84058
84055
  return this.logSearchEvent(SearchPageEvents.recentQueryClick);
84059
84056
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coveo.analytics",
3
- "version": "2.19.1",
3
+ "version": "2.19.4",
4
4
  "description": "📈 Coveo analytics client (node and browser compatible) ",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.es.js",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "@react-native-async-storage/async-storage": "^1.15.16",
26
+ "@react-native-async-storage/async-storage": "^1.15.17",
27
27
  "cross-fetch": "^3.1.5"
28
28
  },
29
29
  "devDependencies": {
@@ -506,10 +506,10 @@ describe('SearchPageClient', () => {
506
506
  });
507
507
 
508
508
  it('should send proper payload for #logSmartSnippetFeedbackReason', async () => {
509
- await client.logSmartSnippetFeedbackReason(SmartSnippetFeedbackReason.DoesNotAnswer, 'this is irrelevant');
509
+ await client.logSmartSnippetFeedbackReason('does_not_answer', 'this is irrelevant');
510
510
  expectMatchCustomEventPayload(SearchPageEvents.sendSmartSnippetReason, {
511
511
  details: 'this is irrelevant',
512
- reason: SmartSnippetFeedbackReason.DoesNotAnswer,
512
+ reason: 'does_not_answer',
513
513
  });
514
514
  });
515
515
 
@@ -527,6 +527,11 @@ describe('SearchPageClient', () => {
527
527
  });
528
528
  });
529
529
 
530
+ it('should send proper payload for #logOpenSmartSnippetSource', async () => {
531
+ await client.logOpenSmartSnippetSource(fakeDocInfo, fakeDocID);
532
+ expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSource, fakeDocInfo, fakeDocID);
533
+ });
534
+
530
535
  it('should send proper payload for #logRecentQueryClick', async () => {
531
536
  await client.logRecentQueryClick();
532
537
  expectMatchPayload(SearchPageEvents.recentQueryClick);
@@ -286,6 +286,10 @@ export class CoveoSearchPageClient {
286
286
  return this.logCustomEvent(SearchPageEvents.collapseSmartSnippetSuggestion, {documentId});
287
287
  }
288
288
 
289
+ public logOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
290
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetSource, info, identifier);
291
+ }
292
+
289
293
  public logRecentQueryClick() {
290
294
  return this.logSearchEvent(SearchPageEvents.recentQueryClick);
291
295
  }
@@ -213,6 +213,10 @@ export enum SearchPageEvents {
213
213
  * Identifies the custom event that gets logged when a snippet suggestion for a related question is collapsed.
214
214
  */
215
215
  collapseSmartSnippetSuggestion = 'collapseSmartSnippetSuggestion',
216
+ /**
217
+ * Identifies the custom event that gets logged when a user clicks on the source of an answer in a smart snippet.
218
+ */
219
+ openSmartSnippetSource = 'openSmartSnippetSource',
216
220
  /**
217
221
  * Identifies the search event that gets logged when a recent queries list item gets clicked.
218
222
  */
@@ -370,12 +374,7 @@ export interface QueryErrorMeta {
370
374
  errorMessage: string;
371
375
  }
372
376
 
373
- export enum SmartSnippetFeedbackReason {
374
- DoesNotAnswer = 'does_not_answer',
375
- PartiallyAnswers = 'partially_answers',
376
- WasNotAQuestion = 'was_not_a_question',
377
- Other = 'other',
378
- }
377
+ export type SmartSnippetFeedbackReason = 'does_not_answer' | 'partially_answers' | 'was_not_a_question' | 'other';
379
378
 
380
379
  export interface SmartSnippetSuggestionMeta {
381
380
  contentIdKey: string;