coveo.analytics 2.30.44 → 2.30.45

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.
@@ -7,7 +7,8 @@ export declare enum CaseAssistActions {
7
7
  enterInterface = "ticket_create_start",
8
8
  fieldUpdate = "ticket_field_update",
9
9
  fieldSuggestionClick = "ticket_classification_click",
10
- suggestionClick = "suggestion_click",
10
+ documentSuggestionClick = "documentSuggestionClick",
11
+ documentSuggestionQuickview = "documentSuggestionQuickview",
11
12
  suggestionRate = "suggestion_rate",
12
13
  nextCaseStep = "ticket_next_stage",
13
14
  caseCancelled = "ticket_cancel",
@@ -64,12 +65,14 @@ export interface FieldSuggestion {
64
65
  export interface DocumentSuggestion {
65
66
  suggestionId: string;
66
67
  responseId: string;
68
+ permanentId: string;
67
69
  suggestion: {
68
70
  documentUri: string;
69
71
  documentUriHash: string;
70
72
  documentTitle: string;
71
73
  documentUrl: string;
72
74
  documentPosition: number;
75
+ sourceName: string;
73
76
  };
74
77
  fromQuickview?: boolean;
75
78
  openDocument?: boolean;
@@ -2,6 +2,12 @@ import { AnalyticsClient, ClientOptions } from '../client/analytics';
2
2
  import { CaseCancelledMetadata, CaseCreatedMetadata, CaseSolvedMetadata, EnterInterfaceMetadata, MoveToNextCaseStepMetadata, RateDocumentSuggestionMetadata, SelectDocumentSuggestionMetadata, SelectFieldSuggestionMetadata, UpdateCaseFieldMetadata } from './caseAssistActions';
3
3
  export interface CaseAssistClientProvider {
4
4
  getOriginLevel1: () => string;
5
+ getOriginLevel2: () => string;
6
+ getOriginLevel3: () => string;
7
+ getOriginContext: () => string;
8
+ getIsAnonymous: () => boolean;
9
+ getSearchUID: () => string;
10
+ getLanguage: () => string;
5
11
  }
6
12
  export interface CaseAssistClientOptions extends ClientOptions {
7
13
  enableAnalytics?: boolean;
@@ -17,7 +23,8 @@ export declare class CaseAssistClient {
17
23
  logEnterInterface(meta: EnterInterfaceMetadata): Promise<void | import("../events").AnyEventResponse>;
18
24
  logUpdateCaseField(meta: UpdateCaseFieldMetadata): Promise<void | import("../events").AnyEventResponse>;
19
25
  logSelectFieldSuggestion(meta: SelectFieldSuggestionMetadata): Promise<void | import("../events").AnyEventResponse>;
20
- logSelectDocumentSuggestion(meta: SelectDocumentSuggestionMetadata): Promise<void | import("../events").AnyEventResponse>;
26
+ logSelectDocumentSuggestion(meta: SelectDocumentSuggestionMetadata): Promise<void | import("../events").ClickEventResponse>;
27
+ logQuickviewDocumentSuggestion(meta: SelectDocumentSuggestionMetadata): Promise<void | import("../events").ClickEventResponse>;
21
28
  logRateDocumentSuggestion(meta: RateDocumentSuggestionMetadata): Promise<void | import("../events").AnyEventResponse>;
22
29
  logMoveToNextCaseStep(meta: MoveToNextCaseStepMetadata): Promise<void | import("../events").AnyEventResponse>;
23
30
  logCaseCancelled(meta: CaseCancelledMetadata): Promise<void | import("../events").AnyEventResponse>;
@@ -25,4 +32,8 @@ export declare class CaseAssistClient {
25
32
  logCaseCreated(meta: CaseCreatedMetadata): Promise<void | import("../events").AnyEventResponse>;
26
33
  private sendFlowStartEvent;
27
34
  private sendClickEvent;
35
+ private getBaseEventRequest;
36
+ private getClientId;
37
+ private getOrigins;
38
+ private logClickEvent;
28
39
  }
@@ -1 +1 @@
1
- export declare const libVersion = "2.30.44";
1
+ export declare const libVersion = "2.30.45";
package/dist/library.cjs CHANGED
@@ -731,7 +731,7 @@ function sha1(bytes) {
731
731
  const v5 = v35('v5', 0x50, sha1);
732
732
  var uuidv5 = v5;
733
733
 
734
- var libVersion = "2.30.44" ;
734
+ var libVersion = "2.30.45" ;
735
735
 
736
736
  var getFormattedLocation = function (location) {
737
737
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -85902,7 +85902,8 @@ exports.CaseAssistActions = void 0;
85902
85902
  CaseAssistActions["enterInterface"] = "ticket_create_start";
85903
85903
  CaseAssistActions["fieldUpdate"] = "ticket_field_update";
85904
85904
  CaseAssistActions["fieldSuggestionClick"] = "ticket_classification_click";
85905
- CaseAssistActions["suggestionClick"] = "suggestion_click";
85905
+ CaseAssistActions["documentSuggestionClick"] = "documentSuggestionClick";
85906
+ CaseAssistActions["documentSuggestionQuickview"] = "documentSuggestionQuickview";
85906
85907
  CaseAssistActions["suggestionRate"] = "suggestion_rate";
85907
85908
  CaseAssistActions["nextCaseStep"] = "ticket_next_stage";
85908
85909
  CaseAssistActions["caseCancelled"] = "ticket_cancel";
@@ -85950,9 +85951,16 @@ var CaseAssistClient = (function () {
85950
85951
  return this.sendClickEvent();
85951
85952
  };
85952
85953
  CaseAssistClient.prototype.logSelectDocumentSuggestion = function (meta) {
85953
- this.svc.setAction(exports.CaseAssistActions.suggestionClick, meta.suggestion);
85954
- this.svc.setTicket(meta.ticket);
85955
- return this.sendClickEvent();
85954
+ return this.logClickEvent(exports.CaseAssistActions.documentSuggestionClick, meta.suggestion.suggestion, {
85955
+ contentIDKey: 'permanentId',
85956
+ contentIDValue: meta.suggestion.permanentId,
85957
+ });
85958
+ };
85959
+ CaseAssistClient.prototype.logQuickviewDocumentSuggestion = function (meta) {
85960
+ return this.logClickEvent(exports.CaseAssistActions.documentSuggestionQuickview, meta.suggestion.suggestion, {
85961
+ contentIDKey: 'permanentId',
85962
+ contentIDValue: meta.suggestion.permanentId,
85963
+ });
85956
85964
  };
85957
85965
  CaseAssistClient.prototype.logRateDocumentSuggestion = function (meta) {
85958
85966
  this.svc.setAction(exports.CaseAssistActions.suggestionRate, __assign({ rate: meta.rating }, meta.suggestion));
@@ -85999,6 +86007,53 @@ var CaseAssistClient = (function () {
85999
86007
  }
86000
86008
  : null);
86001
86009
  };
86010
+ CaseAssistClient.prototype.getBaseEventRequest = function (metadata) {
86011
+ var _a, _b;
86012
+ return __awaiter(this, void 0, void 0, function () {
86013
+ var customData, _c;
86014
+ var _d;
86015
+ return __generator(this, function (_e) {
86016
+ switch (_e.label) {
86017
+ case 0:
86018
+ customData = __assign({}, metadata);
86019
+ _c = [__assign({}, this.getOrigins())];
86020
+ _d = { customData: customData, language: (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getLanguage(), anonymous: (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getIsAnonymous() };
86021
+ return [4, this.getClientId()];
86022
+ case 1: return [2, __assign.apply(void 0, _c.concat([(_d.clientId = _e.sent(), _d)]))];
86023
+ }
86024
+ });
86025
+ });
86026
+ };
86027
+ CaseAssistClient.prototype.getClientId = function () {
86028
+ return this.coveoAnalyticsClient instanceof CoveoAnalyticsClient
86029
+ ? this.coveoAnalyticsClient.getCurrentVisitorId()
86030
+ : undefined;
86031
+ };
86032
+ CaseAssistClient.prototype.getOrigins = function () {
86033
+ var _a, _b, _c, _d, _e;
86034
+ return {
86035
+ originContext: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getOriginContext) === null || _b === void 0 ? void 0 : _b.call(_a),
86036
+ originLevel1: (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getOriginLevel1(),
86037
+ originLevel2: (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getOriginLevel2(),
86038
+ originLevel3: (_e = this.provider) === null || _e === void 0 ? void 0 : _e.getOriginLevel3(),
86039
+ };
86040
+ };
86041
+ CaseAssistClient.prototype.logClickEvent = function (event, info, identifier, metadata) {
86042
+ var _a, _b;
86043
+ return __awaiter(this, void 0, void 0, function () {
86044
+ var payload, _c;
86045
+ return __generator(this, function (_d) {
86046
+ switch (_d.label) {
86047
+ case 0:
86048
+ _c = [__assign({}, info)];
86049
+ return [4, this.getBaseEventRequest(__assign(__assign({}, identifier), metadata))];
86050
+ case 1:
86051
+ payload = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_d.sent())])), { searchQueryUid: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSearchUID()) !== null && _b !== void 0 ? _b : '', actionCause: event }]);
86052
+ return [2, this.coveoAnalyticsClient.sendClickEvent(payload)];
86053
+ }
86054
+ });
86055
+ });
86056
+ };
86002
86057
  return CaseAssistClient;
86003
86058
  }());
86004
86059
 
@@ -598,7 +598,7 @@ function sha1(bytes) {
598
598
  const v5 = v35('v5', 0x50, sha1);
599
599
  var uuidv5 = v5;
600
600
 
601
- const libVersion = "2.30.44" ;
601
+ const libVersion = "2.30.45" ;
602
602
 
603
603
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
604
604
 
@@ -2898,7 +2898,8 @@ var CaseAssistActions;
2898
2898
  CaseAssistActions["enterInterface"] = "ticket_create_start";
2899
2899
  CaseAssistActions["fieldUpdate"] = "ticket_field_update";
2900
2900
  CaseAssistActions["fieldSuggestionClick"] = "ticket_classification_click";
2901
- CaseAssistActions["suggestionClick"] = "suggestion_click";
2901
+ CaseAssistActions["documentSuggestionClick"] = "documentSuggestionClick";
2902
+ CaseAssistActions["documentSuggestionQuickview"] = "documentSuggestionQuickview";
2902
2903
  CaseAssistActions["suggestionRate"] = "suggestion_rate";
2903
2904
  CaseAssistActions["nextCaseStep"] = "ticket_next_stage";
2904
2905
  CaseAssistActions["caseCancelled"] = "ticket_cancel";
@@ -2946,9 +2947,16 @@ class CaseAssistClient {
2946
2947
  return this.sendClickEvent();
2947
2948
  }
2948
2949
  logSelectDocumentSuggestion(meta) {
2949
- this.svc.setAction(CaseAssistActions.suggestionClick, meta.suggestion);
2950
- this.svc.setTicket(meta.ticket);
2951
- return this.sendClickEvent();
2950
+ return this.logClickEvent(CaseAssistActions.documentSuggestionClick, meta.suggestion.suggestion, {
2951
+ contentIDKey: 'permanentId',
2952
+ contentIDValue: meta.suggestion.permanentId,
2953
+ });
2954
+ }
2955
+ logQuickviewDocumentSuggestion(meta) {
2956
+ return this.logClickEvent(CaseAssistActions.documentSuggestionQuickview, meta.suggestion.suggestion, {
2957
+ contentIDKey: 'permanentId',
2958
+ contentIDValue: meta.suggestion.permanentId,
2959
+ });
2952
2960
  }
2953
2961
  logRateDocumentSuggestion(meta) {
2954
2962
  this.svc.setAction(CaseAssistActions.suggestionRate, Object.assign({ rate: meta.rating }, meta.suggestion));
@@ -2995,6 +3003,34 @@ class CaseAssistClient {
2995
3003
  }
2996
3004
  : null);
2997
3005
  }
3006
+ getBaseEventRequest(metadata) {
3007
+ var _a, _b;
3008
+ return __awaiter(this, void 0, void 0, function* () {
3009
+ const customData = Object.assign({}, metadata);
3010
+ return Object.assign(Object.assign({}, this.getOrigins()), { customData, language: (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getLanguage(), anonymous: (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getIsAnonymous(), clientId: yield this.getClientId() });
3011
+ });
3012
+ }
3013
+ getClientId() {
3014
+ return this.coveoAnalyticsClient instanceof CoveoAnalyticsClient
3015
+ ? this.coveoAnalyticsClient.getCurrentVisitorId()
3016
+ : undefined;
3017
+ }
3018
+ getOrigins() {
3019
+ var _a, _b, _c, _d, _e;
3020
+ return {
3021
+ originContext: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getOriginContext) === null || _b === void 0 ? void 0 : _b.call(_a),
3022
+ originLevel1: (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getOriginLevel1(),
3023
+ originLevel2: (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getOriginLevel2(),
3024
+ originLevel3: (_e = this.provider) === null || _e === void 0 ? void 0 : _e.getOriginLevel3(),
3025
+ };
3026
+ }
3027
+ logClickEvent(event, info, identifier, metadata) {
3028
+ var _a, _b;
3029
+ return __awaiter(this, void 0, void 0, function* () {
3030
+ const payload = Object.assign(Object.assign(Object.assign({}, info), (yield this.getBaseEventRequest(Object.assign(Object.assign({}, identifier), metadata)))), { searchQueryUid: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSearchUID()) !== null && _b !== void 0 ? _b : '', actionCause: event });
3031
+ return this.coveoAnalyticsClient.sendClickEvent(payload);
3032
+ });
3033
+ }
2998
3034
  }
2999
3035
 
3000
3036
  const extractContextFromMetadata = (meta) => {
package/dist/library.js CHANGED
@@ -731,7 +731,7 @@ function sha1(bytes) {
731
731
  const v5 = v35('v5', 0x50, sha1);
732
732
  var uuidv5 = v5;
733
733
 
734
- var libVersion = "2.30.44" ;
734
+ var libVersion = "2.30.45" ;
735
735
 
736
736
  var getFormattedLocation = function (location) {
737
737
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -85902,7 +85902,8 @@ exports.CaseAssistActions = void 0;
85902
85902
  CaseAssistActions["enterInterface"] = "ticket_create_start";
85903
85903
  CaseAssistActions["fieldUpdate"] = "ticket_field_update";
85904
85904
  CaseAssistActions["fieldSuggestionClick"] = "ticket_classification_click";
85905
- CaseAssistActions["suggestionClick"] = "suggestion_click";
85905
+ CaseAssistActions["documentSuggestionClick"] = "documentSuggestionClick";
85906
+ CaseAssistActions["documentSuggestionQuickview"] = "documentSuggestionQuickview";
85906
85907
  CaseAssistActions["suggestionRate"] = "suggestion_rate";
85907
85908
  CaseAssistActions["nextCaseStep"] = "ticket_next_stage";
85908
85909
  CaseAssistActions["caseCancelled"] = "ticket_cancel";
@@ -85950,9 +85951,16 @@ var CaseAssistClient = (function () {
85950
85951
  return this.sendClickEvent();
85951
85952
  };
85952
85953
  CaseAssistClient.prototype.logSelectDocumentSuggestion = function (meta) {
85953
- this.svc.setAction(exports.CaseAssistActions.suggestionClick, meta.suggestion);
85954
- this.svc.setTicket(meta.ticket);
85955
- return this.sendClickEvent();
85954
+ return this.logClickEvent(exports.CaseAssistActions.documentSuggestionClick, meta.suggestion.suggestion, {
85955
+ contentIDKey: 'permanentId',
85956
+ contentIDValue: meta.suggestion.permanentId,
85957
+ });
85958
+ };
85959
+ CaseAssistClient.prototype.logQuickviewDocumentSuggestion = function (meta) {
85960
+ return this.logClickEvent(exports.CaseAssistActions.documentSuggestionQuickview, meta.suggestion.suggestion, {
85961
+ contentIDKey: 'permanentId',
85962
+ contentIDValue: meta.suggestion.permanentId,
85963
+ });
85956
85964
  };
85957
85965
  CaseAssistClient.prototype.logRateDocumentSuggestion = function (meta) {
85958
85966
  this.svc.setAction(exports.CaseAssistActions.suggestionRate, __assign({ rate: meta.rating }, meta.suggestion));
@@ -85999,6 +86007,53 @@ var CaseAssistClient = (function () {
85999
86007
  }
86000
86008
  : null);
86001
86009
  };
86010
+ CaseAssistClient.prototype.getBaseEventRequest = function (metadata) {
86011
+ var _a, _b;
86012
+ return __awaiter(this, void 0, void 0, function () {
86013
+ var customData, _c;
86014
+ var _d;
86015
+ return __generator(this, function (_e) {
86016
+ switch (_e.label) {
86017
+ case 0:
86018
+ customData = __assign({}, metadata);
86019
+ _c = [__assign({}, this.getOrigins())];
86020
+ _d = { customData: customData, language: (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getLanguage(), anonymous: (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getIsAnonymous() };
86021
+ return [4, this.getClientId()];
86022
+ case 1: return [2, __assign.apply(void 0, _c.concat([(_d.clientId = _e.sent(), _d)]))];
86023
+ }
86024
+ });
86025
+ });
86026
+ };
86027
+ CaseAssistClient.prototype.getClientId = function () {
86028
+ return this.coveoAnalyticsClient instanceof CoveoAnalyticsClient
86029
+ ? this.coveoAnalyticsClient.getCurrentVisitorId()
86030
+ : undefined;
86031
+ };
86032
+ CaseAssistClient.prototype.getOrigins = function () {
86033
+ var _a, _b, _c, _d, _e;
86034
+ return {
86035
+ originContext: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getOriginContext) === null || _b === void 0 ? void 0 : _b.call(_a),
86036
+ originLevel1: (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getOriginLevel1(),
86037
+ originLevel2: (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getOriginLevel2(),
86038
+ originLevel3: (_e = this.provider) === null || _e === void 0 ? void 0 : _e.getOriginLevel3(),
86039
+ };
86040
+ };
86041
+ CaseAssistClient.prototype.logClickEvent = function (event, info, identifier, metadata) {
86042
+ var _a, _b;
86043
+ return __awaiter(this, void 0, void 0, function () {
86044
+ var payload, _c;
86045
+ return __generator(this, function (_d) {
86046
+ switch (_d.label) {
86047
+ case 0:
86048
+ _c = [__assign({}, info)];
86049
+ return [4, this.getBaseEventRequest(__assign(__assign({}, identifier), metadata))];
86050
+ case 1:
86051
+ payload = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_d.sent())])), { searchQueryUid: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSearchUID()) !== null && _b !== void 0 ? _b : '', actionCause: event }]);
86052
+ return [2, this.coveoAnalyticsClient.sendClickEvent(payload)];
86053
+ }
86054
+ });
86055
+ });
86056
+ };
86002
86057
  return CaseAssistClient;
86003
86058
  }());
86004
86059
 
package/dist/library.mjs CHANGED
@@ -729,7 +729,7 @@ function sha1(bytes) {
729
729
  const v5 = v35('v5', 0x50, sha1);
730
730
  var uuidv5 = v5;
731
731
 
732
- var libVersion = "2.30.44" ;
732
+ var libVersion = "2.30.45" ;
733
733
 
734
734
  var getFormattedLocation = function (location) {
735
735
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -85900,7 +85900,8 @@ var CaseAssistActions;
85900
85900
  CaseAssistActions["enterInterface"] = "ticket_create_start";
85901
85901
  CaseAssistActions["fieldUpdate"] = "ticket_field_update";
85902
85902
  CaseAssistActions["fieldSuggestionClick"] = "ticket_classification_click";
85903
- CaseAssistActions["suggestionClick"] = "suggestion_click";
85903
+ CaseAssistActions["documentSuggestionClick"] = "documentSuggestionClick";
85904
+ CaseAssistActions["documentSuggestionQuickview"] = "documentSuggestionQuickview";
85904
85905
  CaseAssistActions["suggestionRate"] = "suggestion_rate";
85905
85906
  CaseAssistActions["nextCaseStep"] = "ticket_next_stage";
85906
85907
  CaseAssistActions["caseCancelled"] = "ticket_cancel";
@@ -85948,9 +85949,16 @@ var CaseAssistClient = (function () {
85948
85949
  return this.sendClickEvent();
85949
85950
  };
85950
85951
  CaseAssistClient.prototype.logSelectDocumentSuggestion = function (meta) {
85951
- this.svc.setAction(CaseAssistActions.suggestionClick, meta.suggestion);
85952
- this.svc.setTicket(meta.ticket);
85953
- return this.sendClickEvent();
85952
+ return this.logClickEvent(CaseAssistActions.documentSuggestionClick, meta.suggestion.suggestion, {
85953
+ contentIDKey: 'permanentId',
85954
+ contentIDValue: meta.suggestion.permanentId,
85955
+ });
85956
+ };
85957
+ CaseAssistClient.prototype.logQuickviewDocumentSuggestion = function (meta) {
85958
+ return this.logClickEvent(CaseAssistActions.documentSuggestionQuickview, meta.suggestion.suggestion, {
85959
+ contentIDKey: 'permanentId',
85960
+ contentIDValue: meta.suggestion.permanentId,
85961
+ });
85954
85962
  };
85955
85963
  CaseAssistClient.prototype.logRateDocumentSuggestion = function (meta) {
85956
85964
  this.svc.setAction(CaseAssistActions.suggestionRate, __assign({ rate: meta.rating }, meta.suggestion));
@@ -85997,6 +86005,53 @@ var CaseAssistClient = (function () {
85997
86005
  }
85998
86006
  : null);
85999
86007
  };
86008
+ CaseAssistClient.prototype.getBaseEventRequest = function (metadata) {
86009
+ var _a, _b;
86010
+ return __awaiter(this, void 0, void 0, function () {
86011
+ var customData, _c;
86012
+ var _d;
86013
+ return __generator(this, function (_e) {
86014
+ switch (_e.label) {
86015
+ case 0:
86016
+ customData = __assign({}, metadata);
86017
+ _c = [__assign({}, this.getOrigins())];
86018
+ _d = { customData: customData, language: (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getLanguage(), anonymous: (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getIsAnonymous() };
86019
+ return [4, this.getClientId()];
86020
+ case 1: return [2, __assign.apply(void 0, _c.concat([(_d.clientId = _e.sent(), _d)]))];
86021
+ }
86022
+ });
86023
+ });
86024
+ };
86025
+ CaseAssistClient.prototype.getClientId = function () {
86026
+ return this.coveoAnalyticsClient instanceof CoveoAnalyticsClient
86027
+ ? this.coveoAnalyticsClient.getCurrentVisitorId()
86028
+ : undefined;
86029
+ };
86030
+ CaseAssistClient.prototype.getOrigins = function () {
86031
+ var _a, _b, _c, _d, _e;
86032
+ return {
86033
+ originContext: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getOriginContext) === null || _b === void 0 ? void 0 : _b.call(_a),
86034
+ originLevel1: (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getOriginLevel1(),
86035
+ originLevel2: (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getOriginLevel2(),
86036
+ originLevel3: (_e = this.provider) === null || _e === void 0 ? void 0 : _e.getOriginLevel3(),
86037
+ };
86038
+ };
86039
+ CaseAssistClient.prototype.logClickEvent = function (event, info, identifier, metadata) {
86040
+ var _a, _b;
86041
+ return __awaiter(this, void 0, void 0, function () {
86042
+ var payload, _c;
86043
+ return __generator(this, function (_d) {
86044
+ switch (_d.label) {
86045
+ case 0:
86046
+ _c = [__assign({}, info)];
86047
+ return [4, this.getBaseEventRequest(__assign(__assign({}, identifier), metadata))];
86048
+ case 1:
86049
+ payload = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_d.sent())])), { searchQueryUid: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSearchUID()) !== null && _b !== void 0 ? _b : '', actionCause: event }]);
86050
+ return [2, this.coveoAnalyticsClient.sendClickEvent(payload)];
86051
+ }
86052
+ });
86053
+ });
86054
+ };
86000
86055
  return CaseAssistClient;
86001
86056
  }());
86002
86057
 
@@ -667,7 +667,7 @@ const addPageViewToHistory = (pageViewValue) => __awaiter(void 0, void 0, void 0
667
667
  yield store.addElementAsync(historyElement);
668
668
  });
669
669
 
670
- const libVersion = "2.30.44" ;
670
+ const libVersion = "2.30.45" ;
671
671
 
672
672
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
673
673
 
@@ -2919,7 +2919,8 @@ var CaseAssistActions;
2919
2919
  CaseAssistActions["enterInterface"] = "ticket_create_start";
2920
2920
  CaseAssistActions["fieldUpdate"] = "ticket_field_update";
2921
2921
  CaseAssistActions["fieldSuggestionClick"] = "ticket_classification_click";
2922
- CaseAssistActions["suggestionClick"] = "suggestion_click";
2922
+ CaseAssistActions["documentSuggestionClick"] = "documentSuggestionClick";
2923
+ CaseAssistActions["documentSuggestionQuickview"] = "documentSuggestionQuickview";
2923
2924
  CaseAssistActions["suggestionRate"] = "suggestion_rate";
2924
2925
  CaseAssistActions["nextCaseStep"] = "ticket_next_stage";
2925
2926
  CaseAssistActions["caseCancelled"] = "ticket_cancel";
@@ -2967,9 +2968,16 @@ class CaseAssistClient {
2967
2968
  return this.sendClickEvent();
2968
2969
  }
2969
2970
  logSelectDocumentSuggestion(meta) {
2970
- this.svc.setAction(CaseAssistActions.suggestionClick, meta.suggestion);
2971
- this.svc.setTicket(meta.ticket);
2972
- return this.sendClickEvent();
2971
+ return this.logClickEvent(CaseAssistActions.documentSuggestionClick, meta.suggestion.suggestion, {
2972
+ contentIDKey: 'permanentId',
2973
+ contentIDValue: meta.suggestion.permanentId,
2974
+ });
2975
+ }
2976
+ logQuickviewDocumentSuggestion(meta) {
2977
+ return this.logClickEvent(CaseAssistActions.documentSuggestionQuickview, meta.suggestion.suggestion, {
2978
+ contentIDKey: 'permanentId',
2979
+ contentIDValue: meta.suggestion.permanentId,
2980
+ });
2973
2981
  }
2974
2982
  logRateDocumentSuggestion(meta) {
2975
2983
  this.svc.setAction(CaseAssistActions.suggestionRate, Object.assign({ rate: meta.rating }, meta.suggestion));
@@ -3016,6 +3024,34 @@ class CaseAssistClient {
3016
3024
  }
3017
3025
  : null);
3018
3026
  }
3027
+ getBaseEventRequest(metadata) {
3028
+ var _a, _b;
3029
+ return __awaiter(this, void 0, void 0, function* () {
3030
+ const customData = Object.assign({}, metadata);
3031
+ return Object.assign(Object.assign({}, this.getOrigins()), { customData, language: (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getLanguage(), anonymous: (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getIsAnonymous(), clientId: yield this.getClientId() });
3032
+ });
3033
+ }
3034
+ getClientId() {
3035
+ return this.coveoAnalyticsClient instanceof CoveoAnalyticsClient
3036
+ ? this.coveoAnalyticsClient.getCurrentVisitorId()
3037
+ : undefined;
3038
+ }
3039
+ getOrigins() {
3040
+ var _a, _b, _c, _d, _e;
3041
+ return {
3042
+ originContext: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getOriginContext) === null || _b === void 0 ? void 0 : _b.call(_a),
3043
+ originLevel1: (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getOriginLevel1(),
3044
+ originLevel2: (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getOriginLevel2(),
3045
+ originLevel3: (_e = this.provider) === null || _e === void 0 ? void 0 : _e.getOriginLevel3(),
3046
+ };
3047
+ }
3048
+ logClickEvent(event, info, identifier, metadata) {
3049
+ var _a, _b;
3050
+ return __awaiter(this, void 0, void 0, function* () {
3051
+ const payload = Object.assign(Object.assign(Object.assign({}, info), (yield this.getBaseEventRequest(Object.assign(Object.assign({}, identifier), metadata)))), { searchQueryUid: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSearchUID()) !== null && _b !== void 0 ? _b : '', actionCause: event });
3052
+ return this.coveoAnalyticsClient.sendClickEvent(payload);
3053
+ });
3054
+ }
3019
3055
  }
3020
3056
 
3021
3057
  const extractContextFromMetadata = (meta) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coveo.analytics",
3
- "version": "2.30.44",
3
+ "version": "2.30.45",
4
4
  "description": "📈 Coveo analytics client (node and browser compatible) ",
5
5
  "main": "dist/library.cjs",
6
6
  "module": "dist/browser.mjs",
@@ -9,7 +9,8 @@ export enum CaseAssistActions {
9
9
  enterInterface = 'ticket_create_start',
10
10
  fieldUpdate = 'ticket_field_update',
11
11
  fieldSuggestionClick = 'ticket_classification_click',
12
- suggestionClick = 'suggestion_click',
12
+ documentSuggestionClick = 'documentSuggestionClick',
13
+ documentSuggestionQuickview = 'documentSuggestionQuickview',
13
14
  suggestionRate = 'suggestion_rate',
14
15
  nextCaseStep = 'ticket_next_stage',
15
16
  caseCancelled = 'ticket_cancel',
@@ -78,12 +79,14 @@ export interface FieldSuggestion {
78
79
  export interface DocumentSuggestion {
79
80
  suggestionId: string;
80
81
  responseId: string;
82
+ permanentId: string;
81
83
  suggestion: {
82
84
  documentUri: string;
83
85
  documentUriHash: string;
84
86
  documentTitle: string;
85
87
  documentUrl: string;
86
88
  documentPosition: number;
89
+ sourceName: string;
87
90
  };
88
91
  fromQuickview?: boolean;
89
92
  openDocument?: boolean;