coveo.analytics 2.23.9 → 2.23.10

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,7 +1,7 @@
1
1
  import { AnalyticsClient, ClientOptions } from '../client/analytics';
2
2
  import { SearchEventRequest } from '../events';
3
3
  import { DocumentIdentifier, FacetStateMetadata, PartialDocumentInformation, SearchPageEvents } from '../searchPage/searchPageEvents';
4
- import { ExpandToFullUIMetadata, InsightEvents, InsightFacetMetadata, InsightInterfaceChangeMetadata, InsightStaticFilterToggleValueMetadata, InsightFacetRangeMetadata, InsightCategoryFacetMetadata, CaseMetadata, InsightFacetSortMeta, InsightFacetBaseMeta, InsightQueryErrorMeta, InsightPagerMetadata, InsightResultsSortMetadata } from './insightEvents';
4
+ import { ExpandToFullUIMetadata, InsightEvents, InsightFacetMetadata, InsightInterfaceChangeMetadata, InsightStaticFilterToggleValueMetadata, InsightFacetRangeMetadata, InsightCategoryFacetMetadata, CaseMetadata, InsightFacetSortMeta, InsightFacetBaseMeta, InsightQueryErrorMeta, InsightPagerMetadata, InsightResultsSortMetadata, UserActionsDocumentMetadata, UserActionsPageViewMetadata } from './insightEvents';
5
5
  export interface InsightClientProvider {
6
6
  getSearchEventRequestPayload: () => Omit<SearchEventRequest, 'actionCause' | 'searchQueryUid'>;
7
7
  getSearchUID: () => string;
@@ -47,6 +47,11 @@ export declare class CoveoInsightClient {
47
47
  logSearchboxSubmit(metadata?: CaseMetadata): Promise<void | import("../events").SearchEventResponse>;
48
48
  logContextChanged(metadata: CaseMetadata): Promise<void | import("../events").SearchEventResponse>;
49
49
  logExpandToFullUI(metadata: ExpandToFullUIMetadata): Promise<void | import("../events").CustomEventResponse>;
50
+ logOpenUserActions(metadata: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
51
+ logShowPrecedingSessions(metadata: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
52
+ logShowFollowingSessions(metadata: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
53
+ logViewedDocumentClick(document: UserActionsDocumentMetadata, metadata: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
54
+ logPageViewClick(pageView: UserActionsPageViewMetadata, metadata: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
50
55
  logDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>;
51
56
  logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>;
52
57
  logDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier, caseMetadata?: CaseMetadata): Promise<void | import("../events").ClickEventResponse>;
@@ -1,7 +1,12 @@
1
1
  import { CategoryFacetMetadata, FacetBaseMeta, FacetMetadata, FacetRangeMetadata, FacetSortMeta, InterfaceChangeMetadata, PagerMetadata, QueryErrorMeta, ResultsSortMetadata, StaticFilterToggleValueMetadata } from '../searchPage/searchPageEvents';
2
2
  export declare enum InsightEvents {
3
3
  contextChanged = "contextChanged",
4
- expandToFullUI = "expandToFullUI"
4
+ expandToFullUI = "expandToFullUI",
5
+ openUserActions = "openUserActions",
6
+ showPrecedingSessions = "showPrecedingSessions",
7
+ showFollowingSessions = "showFollowingSessions",
8
+ clickViewedDocument = "clickViewedDocument",
9
+ clickPageView = "clickPageView"
5
10
  }
6
11
  export interface CaseMetadata {
7
12
  caseId?: string;
@@ -12,6 +17,17 @@ export interface ExpandToFullUIMetadata extends CaseMetadata {
12
17
  fullSearchComponentName: string;
13
18
  triggeredBy: string;
14
19
  }
20
+ export interface UserActionsDocumentMetadata {
21
+ title: string;
22
+ uri: string;
23
+ uriHash?: string;
24
+ permanentId?: string;
25
+ }
26
+ export interface UserActionsPageViewMetadata {
27
+ title: string;
28
+ contentIdKey: string;
29
+ contentIdValue: string;
30
+ }
15
31
  export interface InsightInterfaceChangeMetadata extends InterfaceChangeMetadata, CaseMetadata {
16
32
  }
17
33
  export interface InsightFacetMetadata extends FacetMetadata, CaseMetadata {
@@ -1136,6 +1136,11 @@ var InsightEvents;
1136
1136
  (function (InsightEvents) {
1137
1137
  InsightEvents["contextChanged"] = "contextChanged";
1138
1138
  InsightEvents["expandToFullUI"] = "expandToFullUI";
1139
+ InsightEvents["openUserActions"] = "openUserActions";
1140
+ InsightEvents["showPrecedingSessions"] = "showPrecedingSessions";
1141
+ InsightEvents["showFollowingSessions"] = "showFollowingSessions";
1142
+ InsightEvents["clickViewedDocument"] = "clickViewedDocument";
1143
+ InsightEvents["clickPageView"] = "clickPageView";
1139
1144
  })(InsightEvents || (InsightEvents = {}));
1140
1145
 
1141
1146
  var SearchPageEvents;
@@ -1245,6 +1250,11 @@ const CustomEventsTypes = {
1245
1250
  [SearchPageEvents.clearRecentResults]: 'recentlyClickedDocuments',
1246
1251
  [SearchPageEvents.showLessFoldedResults]: 'folding',
1247
1252
  [InsightEvents.expandToFullUI]: 'interface',
1253
+ [InsightEvents.openUserActions]: 'User Actions',
1254
+ [InsightEvents.showPrecedingSessions]: 'User Actions',
1255
+ [InsightEvents.showFollowingSessions]: 'User Actions',
1256
+ [InsightEvents.clickViewedDocument]: 'User Actions',
1257
+ [InsightEvents.clickPageView]: 'User Actions',
1248
1258
  [SearchPageEvents.caseDetach]: 'case',
1249
1259
  };
1250
1260
 
@@ -2441,6 +2451,24 @@ class CoveoInsightClient {
2441
2451
  const metadataToSend = generateMetadataToSend(metadata);
2442
2452
  return this.logCustomEvent(InsightEvents.expandToFullUI, metadataToSend);
2443
2453
  }
2454
+ logOpenUserActions(metadata) {
2455
+ const metadataToSend = generateMetadataToSend(metadata, false);
2456
+ return this.logCustomEvent(InsightEvents.openUserActions, metadataToSend);
2457
+ }
2458
+ logShowPrecedingSessions(metadata) {
2459
+ const metadataToSend = generateMetadataToSend(metadata, false);
2460
+ return this.logCustomEvent(InsightEvents.showPrecedingSessions, metadataToSend);
2461
+ }
2462
+ logShowFollowingSessions(metadata) {
2463
+ const metadataToSend = generateMetadataToSend(metadata, false);
2464
+ return this.logCustomEvent(InsightEvents.showFollowingSessions, metadataToSend);
2465
+ }
2466
+ logViewedDocumentClick(document, metadata) {
2467
+ return this.logCustomEvent(InsightEvents.clickViewedDocument, Object.assign(Object.assign({}, generateMetadataToSend(metadata, false)), { document }));
2468
+ }
2469
+ logPageViewClick(pageView, metadata) {
2470
+ return this.logCustomEvent(InsightEvents.clickPageView, Object.assign(Object.assign({}, generateMetadataToSend(metadata, false)), { pageView }));
2471
+ }
2444
2472
  logDocumentOpen(info, identifier, metadata) {
2445
2473
  return this.logClickEvent(SearchPageEvents.documentOpen, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
2446
2474
  }
package/dist/library.js CHANGED
@@ -83640,6 +83640,11 @@ var InsightEvents;
83640
83640
  (function (InsightEvents) {
83641
83641
  InsightEvents["contextChanged"] = "contextChanged";
83642
83642
  InsightEvents["expandToFullUI"] = "expandToFullUI";
83643
+ InsightEvents["openUserActions"] = "openUserActions";
83644
+ InsightEvents["showPrecedingSessions"] = "showPrecedingSessions";
83645
+ InsightEvents["showFollowingSessions"] = "showFollowingSessions";
83646
+ InsightEvents["clickViewedDocument"] = "clickViewedDocument";
83647
+ InsightEvents["clickPageView"] = "clickPageView";
83643
83648
  })(InsightEvents || (InsightEvents = {}));
83644
83649
 
83645
83650
  var _a;
@@ -83750,6 +83755,11 @@ var CustomEventsTypes = (_a = {},
83750
83755
  _a[SearchPageEvents.clearRecentResults] = 'recentlyClickedDocuments',
83751
83756
  _a[SearchPageEvents.showLessFoldedResults] = 'folding',
83752
83757
  _a[InsightEvents.expandToFullUI] = 'interface',
83758
+ _a[InsightEvents.openUserActions] = 'User Actions',
83759
+ _a[InsightEvents.showPrecedingSessions] = 'User Actions',
83760
+ _a[InsightEvents.showFollowingSessions] = 'User Actions',
83761
+ _a[InsightEvents.clickViewedDocument] = 'User Actions',
83762
+ _a[InsightEvents.clickPageView] = 'User Actions',
83753
83763
  _a[SearchPageEvents.caseDetach] = 'case',
83754
83764
  _a);
83755
83765
 
@@ -85288,6 +85298,24 @@ var CoveoInsightClient = (function () {
85288
85298
  var metadataToSend = generateMetadataToSend(metadata);
85289
85299
  return this.logCustomEvent(InsightEvents.expandToFullUI, metadataToSend);
85290
85300
  };
85301
+ CoveoInsightClient.prototype.logOpenUserActions = function (metadata) {
85302
+ var metadataToSend = generateMetadataToSend(metadata, false);
85303
+ return this.logCustomEvent(InsightEvents.openUserActions, metadataToSend);
85304
+ };
85305
+ CoveoInsightClient.prototype.logShowPrecedingSessions = function (metadata) {
85306
+ var metadataToSend = generateMetadataToSend(metadata, false);
85307
+ return this.logCustomEvent(InsightEvents.showPrecedingSessions, metadataToSend);
85308
+ };
85309
+ CoveoInsightClient.prototype.logShowFollowingSessions = function (metadata) {
85310
+ var metadataToSend = generateMetadataToSend(metadata, false);
85311
+ return this.logCustomEvent(InsightEvents.showFollowingSessions, metadataToSend);
85312
+ };
85313
+ CoveoInsightClient.prototype.logViewedDocumentClick = function (document, metadata) {
85314
+ return this.logCustomEvent(InsightEvents.clickViewedDocument, __assign(__assign({}, generateMetadataToSend(metadata, false)), { document: document }));
85315
+ };
85316
+ CoveoInsightClient.prototype.logPageViewClick = function (pageView, metadata) {
85317
+ return this.logCustomEvent(InsightEvents.clickPageView, __assign(__assign({}, generateMetadataToSend(metadata, false)), { pageView: pageView }));
85318
+ };
85291
85319
  CoveoInsightClient.prototype.logDocumentOpen = function (info, identifier, metadata) {
85292
85320
  return this.logClickEvent(SearchPageEvents.documentOpen, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
85293
85321
  };
@@ -1153,6 +1153,11 @@ var InsightEvents;
1153
1153
  (function (InsightEvents) {
1154
1154
  InsightEvents["contextChanged"] = "contextChanged";
1155
1155
  InsightEvents["expandToFullUI"] = "expandToFullUI";
1156
+ InsightEvents["openUserActions"] = "openUserActions";
1157
+ InsightEvents["showPrecedingSessions"] = "showPrecedingSessions";
1158
+ InsightEvents["showFollowingSessions"] = "showFollowingSessions";
1159
+ InsightEvents["clickViewedDocument"] = "clickViewedDocument";
1160
+ InsightEvents["clickPageView"] = "clickPageView";
1156
1161
  })(InsightEvents || (InsightEvents = {}));
1157
1162
 
1158
1163
  var SearchPageEvents;
@@ -1262,6 +1267,11 @@ const CustomEventsTypes = {
1262
1267
  [SearchPageEvents.clearRecentResults]: 'recentlyClickedDocuments',
1263
1268
  [SearchPageEvents.showLessFoldedResults]: 'folding',
1264
1269
  [InsightEvents.expandToFullUI]: 'interface',
1270
+ [InsightEvents.openUserActions]: 'User Actions',
1271
+ [InsightEvents.showPrecedingSessions]: 'User Actions',
1272
+ [InsightEvents.showFollowingSessions]: 'User Actions',
1273
+ [InsightEvents.clickViewedDocument]: 'User Actions',
1274
+ [InsightEvents.clickPageView]: 'User Actions',
1265
1275
  [SearchPageEvents.caseDetach]: 'case',
1266
1276
  };
1267
1277
 
@@ -2458,6 +2468,24 @@ class CoveoInsightClient {
2458
2468
  const metadataToSend = generateMetadataToSend(metadata);
2459
2469
  return this.logCustomEvent(InsightEvents.expandToFullUI, metadataToSend);
2460
2470
  }
2471
+ logOpenUserActions(metadata) {
2472
+ const metadataToSend = generateMetadataToSend(metadata, false);
2473
+ return this.logCustomEvent(InsightEvents.openUserActions, metadataToSend);
2474
+ }
2475
+ logShowPrecedingSessions(metadata) {
2476
+ const metadataToSend = generateMetadataToSend(metadata, false);
2477
+ return this.logCustomEvent(InsightEvents.showPrecedingSessions, metadataToSend);
2478
+ }
2479
+ logShowFollowingSessions(metadata) {
2480
+ const metadataToSend = generateMetadataToSend(metadata, false);
2481
+ return this.logCustomEvent(InsightEvents.showFollowingSessions, metadataToSend);
2482
+ }
2483
+ logViewedDocumentClick(document, metadata) {
2484
+ return this.logCustomEvent(InsightEvents.clickViewedDocument, Object.assign(Object.assign({}, generateMetadataToSend(metadata, false)), { document }));
2485
+ }
2486
+ logPageViewClick(pageView, metadata) {
2487
+ return this.logCustomEvent(InsightEvents.clickPageView, Object.assign(Object.assign({}, generateMetadataToSend(metadata, false)), { pageView }));
2488
+ }
2461
2489
  logDocumentOpen(info, identifier, metadata) {
2462
2490
  return this.logClickEvent(SearchPageEvents.documentOpen, info, identifier, metadata ? generateMetadataToSend(metadata, false) : undefined);
2463
2491
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coveo.analytics",
3
- "version": "2.23.9",
3
+ "version": "2.23.10",
4
4
  "description": "📈 Coveo analytics client (node and browser compatible) ",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.es.js",
@@ -829,4 +829,46 @@ describe('InsightClient', () => {
829
829
  await client.logExpandToFullUI(meta);
830
830
  expectMatchCustomEventPayload(InsightEvents.expandToFullUI, expectedMeta);
831
831
  });
832
+
833
+ it('should send proper payload for #logOpenUserActions', async () => {
834
+ await client.logOpenUserActions(baseCaseMetadata);
835
+ expectMatchCustomEventPayload(InsightEvents.openUserActions, expectedBaseCaseMetadata);
836
+ });
837
+
838
+ it('should send proper payload for #logShowPrecedingSession', async () => {
839
+ await client.logShowPrecedingSessions(baseCaseMetadata);
840
+ expectMatchCustomEventPayload(InsightEvents.showPrecedingSessions, expectedBaseCaseMetadata);
841
+ });
842
+
843
+ it('should send proper payload for #logShowFollowingSession', async () => {
844
+ await client.logShowFollowingSessions(baseCaseMetadata);
845
+ expectMatchCustomEventPayload(InsightEvents.showFollowingSessions, expectedBaseCaseMetadata);
846
+ });
847
+
848
+ it('should send proper payload for #logViewedDocumentClick', async () => {
849
+ const document = {
850
+ title: 'Some Title',
851
+ uri: 'https://www.some-uri.com',
852
+ uriHash: 'Acp8NfEWi0DeðeZU',
853
+ permanentId: '8c88cd894t2767a96fa4f109041bb62bb54ca21ff31c1d760814b60cbcf2',
854
+ };
855
+ await client.logViewedDocumentClick(document, baseCaseMetadata);
856
+ expectMatchCustomEventPayload(InsightEvents.clickViewedDocument, {
857
+ ...expectedBaseCaseMetadata,
858
+ document,
859
+ });
860
+ });
861
+
862
+ it('should send proper payload for #logPageViewClick', async () => {
863
+ const pageView = {
864
+ title: 'Some Title',
865
+ contentIdKey: 'someKey',
866
+ contentIdValue: 'some-content-id-value',
867
+ };
868
+ await client.logPageViewClick(pageView, baseCaseMetadata);
869
+ expectMatchCustomEventPayload(InsightEvents.clickPageView, {
870
+ ...expectedBaseCaseMetadata,
871
+ pageView,
872
+ });
873
+ });
832
874
  });
@@ -23,6 +23,8 @@ import {
23
23
  InsightQueryErrorMeta,
24
24
  InsightPagerMetadata,
25
25
  InsightResultsSortMetadata,
26
+ UserActionsDocumentMetadata,
27
+ UserActionsPageViewMetadata,
26
28
  } from './insightEvents';
27
29
 
28
30
  export interface InsightClientProvider {
@@ -219,6 +221,35 @@ export class CoveoInsightClient {
219
221
  return this.logCustomEvent(InsightEvents.expandToFullUI, metadataToSend);
220
222
  }
221
223
 
224
+ public logOpenUserActions(metadata: CaseMetadata) {
225
+ const metadataToSend = generateMetadataToSend(metadata, false);
226
+ return this.logCustomEvent(InsightEvents.openUserActions, metadataToSend);
227
+ }
228
+
229
+ public logShowPrecedingSessions(metadata: CaseMetadata) {
230
+ const metadataToSend = generateMetadataToSend(metadata, false);
231
+ return this.logCustomEvent(InsightEvents.showPrecedingSessions, metadataToSend);
232
+ }
233
+
234
+ public logShowFollowingSessions(metadata: CaseMetadata) {
235
+ const metadataToSend = generateMetadataToSend(metadata, false);
236
+ return this.logCustomEvent(InsightEvents.showFollowingSessions, metadataToSend);
237
+ }
238
+
239
+ public logViewedDocumentClick(document: UserActionsDocumentMetadata, metadata: CaseMetadata) {
240
+ return this.logCustomEvent(InsightEvents.clickViewedDocument, {
241
+ ...generateMetadataToSend(metadata, false),
242
+ document,
243
+ });
244
+ }
245
+
246
+ public logPageViewClick(pageView: UserActionsPageViewMetadata, metadata: CaseMetadata) {
247
+ return this.logCustomEvent(InsightEvents.clickPageView, {
248
+ ...generateMetadataToSend(metadata, false),
249
+ pageView,
250
+ });
251
+ }
252
+
222
253
  public logDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier, metadata?: CaseMetadata) {
223
254
  return this.logClickEvent(
224
255
  SearchPageEvents.documentOpen,
@@ -20,6 +20,26 @@ export enum InsightEvents {
20
20
  * Identifies the event that gets logged when the user opens the full search page from the insight panel.
21
21
  */
22
22
  expandToFullUI = 'expandToFullUI',
23
+ /**
24
+ * Identifies the event that gets logged when the user opens the user actions section.
25
+ */
26
+ openUserActions = 'openUserActions',
27
+ /**
28
+ * Identifies the event that gets logged when the user clicks to view user action sessions preceding the ticket creation.
29
+ */
30
+ showPrecedingSessions = 'showPrecedingSessions',
31
+ /**
32
+ * Identifies the event that gets logged when the user clicks to view user action sessions following the ticket creation.
33
+ */
34
+ showFollowingSessions = 'showFollowingSessions',
35
+ /**
36
+ * Identifies the event that gets logged when the user clicks a viewed document link on the user actions timeline.
37
+ */
38
+ clickViewedDocument = 'clickViewedDocument',
39
+ /**
40
+ * Identifies the event that gets logged when the user clicks a viewed page link on the user actions timeline.
41
+ */
42
+ clickPageView = 'clickPageView',
23
43
  }
24
44
 
25
45
  export interface CaseMetadata {
@@ -33,6 +53,19 @@ export interface ExpandToFullUIMetadata extends CaseMetadata {
33
53
  triggeredBy: string;
34
54
  }
35
55
 
56
+ export interface UserActionsDocumentMetadata {
57
+ title: string;
58
+ uri: string;
59
+ uriHash?: string;
60
+ permanentId?: string;
61
+ }
62
+
63
+ export interface UserActionsPageViewMetadata {
64
+ title: string;
65
+ contentIdKey: string;
66
+ contentIdValue: string;
67
+ }
68
+
36
69
  export interface InsightInterfaceChangeMetadata extends InterfaceChangeMetadata, CaseMetadata {}
37
70
 
38
71
  export interface InsightFacetMetadata extends FacetMetadata, CaseMetadata {}
@@ -322,6 +322,11 @@ export const CustomEventsTypes: Partial<Record<SearchPageEvents | InsightEvents,
322
322
  [SearchPageEvents.clearRecentResults]: 'recentlyClickedDocuments',
323
323
  [SearchPageEvents.showLessFoldedResults]: 'folding',
324
324
  [InsightEvents.expandToFullUI]: 'interface',
325
+ [InsightEvents.openUserActions]: 'User Actions',
326
+ [InsightEvents.showPrecedingSessions]: 'User Actions',
327
+ [InsightEvents.showFollowingSessions]: 'User Actions',
328
+ [InsightEvents.clickViewedDocument]: 'User Actions',
329
+ [InsightEvents.clickPageView]: 'User Actions',
325
330
  [SearchPageEvents.caseDetach]: 'case',
326
331
  };
327
332