coveo.analytics 2.30.44 → 2.30.46

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.
Files changed (50) hide show
  1. package/README.md +41 -41
  2. package/dist/browser.mjs +72 -18
  3. package/dist/coveoua.browser.js +1 -1
  4. package/dist/coveoua.browser.js.map +1 -1
  5. package/dist/coveoua.debug.js +103 -30
  6. package/dist/coveoua.debug.js.map +1 -1
  7. package/dist/coveoua.js +1 -1
  8. package/dist/coveoua.js.map +1 -1
  9. package/dist/definitions/caseAssist/caseAssistActions.d.ts +4 -1
  10. package/dist/definitions/caseAssist/caseAssistClient.d.ts +12 -1
  11. package/dist/definitions/client/analytics.d.ts +2 -2
  12. package/dist/definitions/insight/insightClient.d.ts +2 -0
  13. package/dist/definitions/version.d.ts +1 -1
  14. package/dist/library.cjs +200 -37
  15. package/dist/library.es.js +72 -18
  16. package/dist/library.js +200 -37
  17. package/dist/library.mjs +200 -37
  18. package/dist/react-native.es.js +72 -18
  19. package/package.json +7 -7
  20. package/src/caseAssist/caseAssistActions.ts +4 -1
  21. package/src/caseAssist/caseAssistClient.spec.ts +64 -40
  22. package/src/caseAssist/caseAssistClient.ts +67 -6
  23. package/src/client/analytics.spec.ts +1 -1
  24. package/src/client/analytics.ts +11 -11
  25. package/src/client/analyticsBeaconClient.spec.ts +10 -10
  26. package/src/client/analyticsBeaconClient.ts +4 -4
  27. package/src/client/analyticsFetchClient.ts +1 -1
  28. package/src/client/analyticsRequestClient.ts +1 -1
  29. package/src/client/measurementProtocolMapper.ts +2 -2
  30. package/src/client/measurementProtocolMapping/baseMeasurementProtocolMapper.ts +1 -1
  31. package/src/client/measurementProtocolMapping/commerceMeasurementProtocolMapper.ts +5 -5
  32. package/src/client/noopAnalytics.ts +1 -1
  33. package/src/client/utils.spec.ts +6 -6
  34. package/src/coveoua/browser.ts +2 -2
  35. package/src/coveoua/plugins.ts +1 -1
  36. package/src/coveoua/simpleanalytics.spec.ts +5 -5
  37. package/src/coveoua/simpleanalytics.ts +1 -1
  38. package/src/donottrack.spec.ts +1 -1
  39. package/src/history.spec.ts +1 -1
  40. package/src/insight/insightClient.spec.ts +42 -8
  41. package/src/insight/insightClient.ts +82 -63
  42. package/src/plugins/ec.spec.ts +6 -6
  43. package/src/plugins/ec.ts +5 -5
  44. package/src/plugins/link.spec.ts +5 -5
  45. package/src/plugins/link.ts +1 -1
  46. package/src/plugins/svc.ts +1 -1
  47. package/src/searchPage/searchPageClient.spec.ts +3 -3
  48. package/src/searchPage/searchPageClient.ts +27 -24
  49. package/src/searchPage/searchPageEvents.ts +2 -1
  50. package/src/version.ts +1 -1
@@ -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
  }
@@ -75,12 +75,12 @@ export declare class CoveoAnalyticsClient implements AnalyticsClient, VisitorIdP
75
75
  getCurrentVisitorId(): Promise<string>;
76
76
  setCurrentVisitorId(visitorId: string): Promise<void>;
77
77
  setClientId(value: string, namespace?: string): Promise<void>;
78
- getParameters(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<VariableArgumentsPayload>;
78
+ getParameters(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<any>;
79
79
  getPayload(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<any>;
80
80
  get currentVisitorId(): string;
81
81
  set currentVisitorId(visitorId: string);
82
82
  private extractClientIdFromLink;
83
- resolveParameters(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<VariableArgumentsPayload>;
83
+ resolveParameters(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<any>;
84
84
  resolvePayloadForParameters(eventType: EventType | string, parameters: any): Promise<any>;
85
85
  makeEvent<TPreparedRequest, TCompleteRequest, TResponse extends AnyEventResponse>(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<PreparedEvent<TPreparedRequest, TCompleteRequest, TResponse>>;
86
86
  sendEvent(eventType: EventType | string, ...payload: VariableArgumentsPayload): Promise<void | AnyEventResponse>;
@@ -27,6 +27,8 @@ export declare class CoveoInsightClient {
27
27
  disable(): void;
28
28
  enable(): void;
29
29
  logInterfaceLoad(metadata?: CaseMetadata): Promise<void | import("../events").SearchEventResponse>;
30
+ logRecentQueryClick(metadata?: CaseMetadata): Promise<void | import("../events").SearchEventResponse>;
31
+ logClearRecentQueries(metadata?: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
30
32
  logInterfaceChange(metadata: InsightInterfaceChangeMetadata): Promise<void | import("../events").SearchEventResponse>;
31
33
  logStaticFilterDeselect(metadata: InsightStaticFilterToggleValueMetadata): Promise<void | import("../events").SearchEventResponse>;
32
34
  logFetchMoreResults(metadata?: CaseMetadata): Promise<void | import("../events").CustomEventResponse>;
@@ -1 +1 @@
1
- export declare const libVersion = "2.30.44";
1
+ export declare const libVersion = "2.30.46";
package/dist/library.cjs CHANGED
@@ -21,7 +21,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21
21
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
22
  PERFORMANCE OF THIS SOFTWARE.
23
23
  ***************************************************************************** */
24
- /* global Reflect, Promise */
24
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
25
25
 
26
26
  var extendStatics = function(d, b) {
27
27
  extendStatics = Object.setPrototypeOf ||
@@ -72,8 +72,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
72
72
  }
73
73
 
74
74
  function __generator(thisArg, body) {
75
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
76
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
75
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
76
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
77
77
  function verb(n) { return function (v) { return step([n, v]); }; }
78
78
  function step(op) {
79
79
  if (f) throw new TypeError("Generator is already executing.");
@@ -107,7 +107,12 @@ function __spreadArray(to, from, pack) {
107
107
  }
108
108
  }
109
109
  return to.concat(ar || Array.prototype.slice.call(from));
110
- }
110
+ }
111
+
112
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
113
+ var e = new Error(message);
114
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
115
+ };
111
116
 
112
117
  exports.EventType = void 0;
113
118
  (function (EventType) {
@@ -505,7 +510,7 @@ for (let i = 0; i < 256; ++i) {
505
510
  function unsafeStringify(arr, offset = 0) {
506
511
  // Note: Be careful editing this code! It's been tuned for performance
507
512
  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
508
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
513
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
509
514
  }
510
515
 
511
516
  function parse(uuid) {
@@ -731,7 +736,7 @@ function sha1(bytes) {
731
736
  const v5 = v35('v5', 0x50, sha1);
732
737
  var uuidv5 = v5;
733
738
 
734
- var libVersion = "2.30.44" ;
739
+ var libVersion = "2.30.46";
735
740
 
736
741
  var getFormattedLocation = function (location) {
737
742
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -82515,10 +82520,6 @@ publicApi.parseURL = urlStateMachineExports.parseURL;
82515
82520
  agent = agent(parsedURL);
82516
82521
  }
82517
82522
 
82518
- if (!headers.has('Connection') && !agent) {
82519
- headers.set('Connection', 'close');
82520
- }
82521
-
82522
82523
  // HTTP-network fetch step 4.2
82523
82524
  // chunked encoding is handled by Node.js
82524
82525
 
@@ -82567,6 +82568,20 @@ publicApi.parseURL = urlStateMachineExports.parseURL;
82567
82568
  return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
82568
82569
  };
82569
82570
 
82571
+ /**
82572
+ * isSameProtocol reports whether the two provided URLs use the same protocol.
82573
+ *
82574
+ * Both domains must already be in canonical form.
82575
+ * @param {string|URL} original
82576
+ * @param {string|URL} destination
82577
+ */
82578
+ const isSameProtocol = function isSameProtocol(destination, original) {
82579
+ const orig = new URL$1(original).protocol;
82580
+ const dest = new URL$1(destination).protocol;
82581
+
82582
+ return orig === dest;
82583
+ };
82584
+
82570
82585
  /**
82571
82586
  * Fetch function
82572
82587
  *
@@ -82598,7 +82613,7 @@ publicApi.parseURL = urlStateMachineExports.parseURL;
82598
82613
  let error = new AbortError('The user aborted a request.');
82599
82614
  reject(error);
82600
82615
  if (request.body && request.body instanceof Stream.Readable) {
82601
- request.body.destroy(error);
82616
+ destroyStream(request.body, error);
82602
82617
  }
82603
82618
  if (!response || !response.body) return;
82604
82619
  response.body.emit('error', error);
@@ -82639,9 +82654,43 @@ publicApi.parseURL = urlStateMachineExports.parseURL;
82639
82654
 
82640
82655
  req.on('error', function (err) {
82641
82656
  reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
82657
+
82658
+ if (response && response.body) {
82659
+ destroyStream(response.body, err);
82660
+ }
82661
+
82642
82662
  finalize();
82643
82663
  });
82644
82664
 
82665
+ fixResponseChunkedTransferBadEnding(req, function (err) {
82666
+ if (signal && signal.aborted) {
82667
+ return;
82668
+ }
82669
+
82670
+ if (response && response.body) {
82671
+ destroyStream(response.body, err);
82672
+ }
82673
+ });
82674
+
82675
+ /* c8 ignore next 18 */
82676
+ if (parseInt(process.version.substring(1)) < 14) {
82677
+ // Before Node.js 14, pipeline() does not fully support async iterators and does not always
82678
+ // properly handle when the socket close/end events are out of order.
82679
+ req.on('socket', function (s) {
82680
+ s.addListener('close', function (hadError) {
82681
+ // if a data listener is still present we didn't end cleanly
82682
+ const hasDataListener = s.listenerCount('data') > 0;
82683
+
82684
+ // if end happened before close but the socket didn't emit an error, do it now
82685
+ if (response && hasDataListener && !hadError && !(signal && signal.aborted)) {
82686
+ const err = new Error('Premature close');
82687
+ err.code = 'ERR_STREAM_PREMATURE_CLOSE';
82688
+ response.body.emit('error', err);
82689
+ }
82690
+ });
82691
+ });
82692
+ }
82693
+
82645
82694
  req.on('response', function (res) {
82646
82695
  clearTimeout(reqTimeout);
82647
82696
 
@@ -82713,7 +82762,7 @@ publicApi.parseURL = urlStateMachineExports.parseURL;
82713
82762
  size: request.size
82714
82763
  };
82715
82764
 
82716
- if (!isDomainOrSubdomain(request.url, locationURL)) {
82765
+ if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
82717
82766
  for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
82718
82767
  requestOpts.headers.delete(name);
82719
82768
  }
@@ -82806,6 +82855,13 @@ publicApi.parseURL = urlStateMachineExports.parseURL;
82806
82855
  response = new Response(body, response_options);
82807
82856
  resolve(response);
82808
82857
  });
82858
+ raw.on('end', function () {
82859
+ // some old IIS servers return zero-length OK deflate responses, so 'data' is never emitted.
82860
+ if (!response) {
82861
+ response = new Response(body, response_options);
82862
+ resolve(response);
82863
+ }
82864
+ });
82809
82865
  return;
82810
82866
  }
82811
82867
 
@@ -82825,6 +82881,44 @@ publicApi.parseURL = urlStateMachineExports.parseURL;
82825
82881
  writeToStream(req, request);
82826
82882
  });
82827
82883
  }
82884
+ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
82885
+ let socket;
82886
+
82887
+ request.on('socket', function (s) {
82888
+ socket = s;
82889
+ });
82890
+
82891
+ request.on('response', function (response) {
82892
+ const headers = response.headers;
82893
+
82894
+ if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) {
82895
+ response.once('close', function (hadError) {
82896
+ // tests for socket presence, as in some situations the
82897
+ // the 'socket' event is not triggered for the request
82898
+ // (happens in deno), avoids `TypeError`
82899
+ // if a data listener is still present we didn't end cleanly
82900
+ const hasDataListener = socket && socket.listenerCount('data') > 0;
82901
+
82902
+ if (hasDataListener && !hadError) {
82903
+ const err = new Error('Premature close');
82904
+ err.code = 'ERR_STREAM_PREMATURE_CLOSE';
82905
+ errorCallback(err);
82906
+ }
82907
+ });
82908
+ }
82909
+ });
82910
+ }
82911
+
82912
+ function destroyStream(stream, err) {
82913
+ if (stream.destroy) {
82914
+ stream.destroy(err);
82915
+ } else {
82916
+ // node < 8
82917
+ stream.emit('error', err);
82918
+ stream.end();
82919
+ }
82920
+ }
82921
+
82828
82922
  /**
82829
82923
  * Redirect code matching
82830
82924
  *
@@ -82844,7 +82938,8 @@ publicApi.parseURL = urlStateMachineExports.parseURL;
82844
82938
  exports.Headers = Headers;
82845
82939
  exports.Request = Request;
82846
82940
  exports.Response = Response;
82847
- exports.FetchError = FetchError;
82941
+ exports.FetchError = FetchError;
82942
+ exports.AbortError = AbortError;
82848
82943
  } (lib$1, lib$1.exports));
82849
82944
 
82850
82945
  var libExports = lib$1.exports;
@@ -83529,8 +83624,8 @@ var CoveoAnalyticsClient = (function () {
83529
83624
  });
83530
83625
  };
83531
83626
  CoveoAnalyticsClient.prototype.sendSearchEvent = function (_a) {
83532
- var searchQueryUid = _a.searchQueryUid, preparedRequest = __rest(_a, ["searchQueryUid"]);
83533
83627
  return __awaiter(this, void 0, void 0, function () {
83628
+ var searchQueryUid = _a.searchQueryUid, preparedRequest = __rest(_a, ["searchQueryUid"]);
83534
83629
  return __generator(this, function (_b) {
83535
83630
  switch (_b.label) {
83536
83631
  case 0: return [4, this.makeSearchEvent(preparedRequest)];
@@ -83547,8 +83642,8 @@ var CoveoAnalyticsClient = (function () {
83547
83642
  });
83548
83643
  };
83549
83644
  CoveoAnalyticsClient.prototype.sendClickEvent = function (_a) {
83550
- var searchQueryUid = _a.searchQueryUid, preparedRequest = __rest(_a, ["searchQueryUid"]);
83551
83645
  return __awaiter(this, void 0, void 0, function () {
83646
+ var searchQueryUid = _a.searchQueryUid, preparedRequest = __rest(_a, ["searchQueryUid"]);
83552
83647
  return __generator(this, function (_b) {
83553
83648
  switch (_b.label) {
83554
83649
  case 0: return [4, this.makeClickEvent(preparedRequest)];
@@ -83565,8 +83660,8 @@ var CoveoAnalyticsClient = (function () {
83565
83660
  });
83566
83661
  };
83567
83662
  CoveoAnalyticsClient.prototype.sendCustomEvent = function (_a) {
83568
- var lastSearchQueryUid = _a.lastSearchQueryUid, preparedRequest = __rest(_a, ["lastSearchQueryUid"]);
83569
83663
  return __awaiter(this, void 0, void 0, function () {
83664
+ var lastSearchQueryUid = _a.lastSearchQueryUid, preparedRequest = __rest(_a, ["lastSearchQueryUid"]);
83570
83665
  return __generator(this, function (_b) {
83571
83666
  switch (_b.label) {
83572
83667
  case 0: return [4, this.makeCustomEvent(preparedRequest)];
@@ -84347,7 +84442,6 @@ var CustomEventsTypes = (_a = {},
84347
84442
  _a[exports.SearchPageEvents.triggerExecute] = 'queryPipelineTriggers',
84348
84443
  _a[exports.SearchPageEvents.triggerQuery] = 'queryPipelineTriggers',
84349
84444
  _a[exports.SearchPageEvents.triggerRedirect] = 'queryPipelineTriggers',
84350
- _a[exports.SearchPageEvents.queryError] = 'errors',
84351
84445
  _a[exports.SearchPageEvents.queryErrorBack] = 'errors',
84352
84446
  _a[exports.SearchPageEvents.queryErrorClear] = 'errors',
84353
84447
  _a[exports.SearchPageEvents.queryErrorRetry] = 'errors',
@@ -85486,10 +85580,10 @@ var CoveoSearchPageClient = (function () {
85486
85580
  var _a;
85487
85581
  return { actionCause: actionCause, customData: (_a = preparedEvent.payload) === null || _a === void 0 ? void 0 : _a.customData };
85488
85582
  };
85489
- CoveoSearchPageClient.prototype.makeCustomEvent = function (event, metadata, eventType) {
85490
- if (eventType === void 0) { eventType = CustomEventsTypes[event]; }
85491
- return __awaiter(this, void 0, void 0, function () {
85583
+ CoveoSearchPageClient.prototype.makeCustomEvent = function (event_1, metadata_1) {
85584
+ return __awaiter(this, arguments, void 0, function (event, metadata, eventType) {
85492
85585
  var customData, request, _a, preparedEvent;
85586
+ if (eventType === void 0) { eventType = CustomEventsTypes[event]; }
85493
85587
  return __generator(this, function (_b) {
85494
85588
  switch (_b.label) {
85495
85589
  case 0:
@@ -85513,9 +85607,9 @@ var CoveoSearchPageClient = (function () {
85513
85607
  });
85514
85608
  });
85515
85609
  };
85516
- CoveoSearchPageClient.prototype.logCustomEvent = function (event, metadata, eventType) {
85517
- if (eventType === void 0) { eventType = CustomEventsTypes[event]; }
85518
- return __awaiter(this, void 0, void 0, function () {
85610
+ CoveoSearchPageClient.prototype.logCustomEvent = function (event_1, metadata_1) {
85611
+ return __awaiter(this, arguments, void 0, function (event, metadata, eventType) {
85612
+ if (eventType === void 0) { eventType = CustomEventsTypes[event]; }
85519
85613
  return __generator(this, function (_a) {
85520
85614
  switch (_a.label) {
85521
85615
  case 0: return [4, this.makeCustomEvent(event, metadata, eventType)];
@@ -85630,15 +85724,15 @@ var CoveoSearchPageClient = (function () {
85630
85724
  });
85631
85725
  };
85632
85726
  CoveoSearchPageClient.prototype.getBaseSearchEventRequest = function (event, metadata) {
85633
- var _a, _b;
85634
85727
  return __awaiter(this, void 0, void 0, function () {
85635
- var _c;
85728
+ var _a;
85729
+ var _b, _c;
85636
85730
  return __generator(this, function (_d) {
85637
85731
  switch (_d.label) {
85638
85732
  case 0:
85639
- _c = [{}];
85640
- return [4, this.getBaseEventRequest(__assign(__assign({}, metadata), (_b = (_a = this.provider).getGeneratedAnswerMetadata) === null || _b === void 0 ? void 0 : _b.call(_a)))];
85641
- case 1: return [2, __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_d.sent())])), this.provider.getSearchEventRequestPayload()]), { queryPipeline: this.provider.getPipeline(), actionCause: event }])];
85733
+ _a = [{}];
85734
+ return [4, this.getBaseEventRequest(__assign(__assign({}, metadata), (_c = (_b = this.provider).getGeneratedAnswerMetadata) === null || _c === void 0 ? void 0 : _c.call(_b)))];
85735
+ case 1: return [2, __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_d.sent())])), this.provider.getSearchEventRequestPayload()]), { queryPipeline: this.provider.getPipeline(), actionCause: event }])];
85642
85736
  }
85643
85737
  });
85644
85738
  });
@@ -85902,7 +85996,8 @@ exports.CaseAssistActions = void 0;
85902
85996
  CaseAssistActions["enterInterface"] = "ticket_create_start";
85903
85997
  CaseAssistActions["fieldUpdate"] = "ticket_field_update";
85904
85998
  CaseAssistActions["fieldSuggestionClick"] = "ticket_classification_click";
85905
- CaseAssistActions["suggestionClick"] = "suggestion_click";
85999
+ CaseAssistActions["documentSuggestionClick"] = "documentSuggestionClick";
86000
+ CaseAssistActions["documentSuggestionQuickview"] = "documentSuggestionQuickview";
85906
86001
  CaseAssistActions["suggestionRate"] = "suggestion_rate";
85907
86002
  CaseAssistActions["nextCaseStep"] = "ticket_next_stage";
85908
86003
  CaseAssistActions["caseCancelled"] = "ticket_cancel";
@@ -85950,9 +86045,16 @@ var CaseAssistClient = (function () {
85950
86045
  return this.sendClickEvent();
85951
86046
  };
85952
86047
  CaseAssistClient.prototype.logSelectDocumentSuggestion = function (meta) {
85953
- this.svc.setAction(exports.CaseAssistActions.suggestionClick, meta.suggestion);
85954
- this.svc.setTicket(meta.ticket);
85955
- return this.sendClickEvent();
86048
+ return this.logClickEvent(exports.CaseAssistActions.documentSuggestionClick, meta.suggestion.suggestion, {
86049
+ contentIDKey: 'permanentId',
86050
+ contentIDValue: meta.suggestion.permanentId,
86051
+ });
86052
+ };
86053
+ CaseAssistClient.prototype.logQuickviewDocumentSuggestion = function (meta) {
86054
+ return this.logClickEvent(exports.CaseAssistActions.documentSuggestionQuickview, meta.suggestion.suggestion, {
86055
+ contentIDKey: 'permanentId',
86056
+ contentIDValue: meta.suggestion.permanentId,
86057
+ });
85956
86058
  };
85957
86059
  CaseAssistClient.prototype.logRateDocumentSuggestion = function (meta) {
85958
86060
  this.svc.setAction(exports.CaseAssistActions.suggestionRate, __assign({ rate: meta.rating }, meta.suggestion));
@@ -85999,6 +86101,53 @@ var CaseAssistClient = (function () {
85999
86101
  }
86000
86102
  : null);
86001
86103
  };
86104
+ CaseAssistClient.prototype.getBaseEventRequest = function (metadata) {
86105
+ return __awaiter(this, void 0, void 0, function () {
86106
+ var customData, _a;
86107
+ var _b;
86108
+ var _c, _d;
86109
+ return __generator(this, function (_e) {
86110
+ switch (_e.label) {
86111
+ case 0:
86112
+ customData = __assign({}, metadata);
86113
+ _a = [__assign({}, this.getOrigins())];
86114
+ _b = { customData: customData, language: (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getLanguage(), anonymous: (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getIsAnonymous() };
86115
+ return [4, this.getClientId()];
86116
+ case 1: return [2, __assign.apply(void 0, _a.concat([(_b.clientId = _e.sent(), _b)]))];
86117
+ }
86118
+ });
86119
+ });
86120
+ };
86121
+ CaseAssistClient.prototype.getClientId = function () {
86122
+ return this.coveoAnalyticsClient instanceof CoveoAnalyticsClient
86123
+ ? this.coveoAnalyticsClient.getCurrentVisitorId()
86124
+ : undefined;
86125
+ };
86126
+ CaseAssistClient.prototype.getOrigins = function () {
86127
+ var _a, _b, _c, _d, _e;
86128
+ return {
86129
+ originContext: (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getOriginContext) === null || _b === void 0 ? void 0 : _b.call(_a),
86130
+ originLevel1: (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getOriginLevel1(),
86131
+ originLevel2: (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getOriginLevel2(),
86132
+ originLevel3: (_e = this.provider) === null || _e === void 0 ? void 0 : _e.getOriginLevel3(),
86133
+ };
86134
+ };
86135
+ CaseAssistClient.prototype.logClickEvent = function (event, info, identifier, metadata) {
86136
+ return __awaiter(this, void 0, void 0, function () {
86137
+ var payload, _a;
86138
+ var _b, _c;
86139
+ return __generator(this, function (_d) {
86140
+ switch (_d.label) {
86141
+ case 0:
86142
+ _a = [__assign({}, info)];
86143
+ return [4, this.getBaseEventRequest(__assign(__assign({}, identifier), metadata))];
86144
+ case 1:
86145
+ payload = __assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_d.sent())])), { searchQueryUid: (_c = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getSearchUID()) !== null && _c !== void 0 ? _c : '', actionCause: event }]);
86146
+ return [2, this.coveoAnalyticsClient.sendClickEvent(payload)];
86147
+ }
86148
+ });
86149
+ });
86150
+ };
86002
86151
  return CaseAssistClient;
86003
86152
  }());
86004
86153
 
@@ -86042,6 +86191,20 @@ var CoveoInsightClient = (function () {
86042
86191
  }
86043
86192
  return this.logSearchEvent(exports.SearchPageEvents.interfaceLoad);
86044
86193
  };
86194
+ CoveoInsightClient.prototype.logRecentQueryClick = function (metadata) {
86195
+ if (metadata) {
86196
+ var metadataToSend = generateMetadataToSend(metadata);
86197
+ return this.logSearchEvent(exports.SearchPageEvents.recentQueryClick, metadataToSend);
86198
+ }
86199
+ return this.logSearchEvent(exports.SearchPageEvents.recentQueryClick);
86200
+ };
86201
+ CoveoInsightClient.prototype.logClearRecentQueries = function (metadata) {
86202
+ if (metadata) {
86203
+ var metadataToSend = generateMetadataToSend(metadata);
86204
+ return this.logCustomEvent(exports.SearchPageEvents.clearRecentQueries, metadataToSend);
86205
+ }
86206
+ return this.logCustomEvent(exports.SearchPageEvents.clearRecentQueries);
86207
+ };
86045
86208
  CoveoInsightClient.prototype.logInterfaceChange = function (metadata) {
86046
86209
  var metadataToSend = generateMetadataToSend(metadata);
86047
86210
  return this.logSearchEvent(exports.SearchPageEvents.interfaceChange, metadataToSend);
@@ -86373,15 +86536,15 @@ var CoveoInsightClient = (function () {
86373
86536
  });
86374
86537
  };
86375
86538
  CoveoInsightClient.prototype.getBaseSearchEventRequest = function (event, metadata) {
86376
- var _a, _b;
86377
86539
  return __awaiter(this, void 0, void 0, function () {
86378
- var _c;
86540
+ var _a;
86541
+ var _b, _c;
86379
86542
  return __generator(this, function (_d) {
86380
86543
  switch (_d.label) {
86381
86544
  case 0:
86382
- _c = [{}];
86383
- return [4, this.getBaseEventRequest(__assign(__assign({}, metadata), (_b = (_a = this.provider).getGeneratedAnswerMetadata) === null || _b === void 0 ? void 0 : _b.call(_a)))];
86384
- case 1: return [2, __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_d.sent())])), this.provider.getSearchEventRequestPayload()]), { searchQueryUid: this.provider.getSearchUID(), queryPipeline: this.provider.getPipeline(), actionCause: event }])];
86545
+ _a = [{}];
86546
+ return [4, this.getBaseEventRequest(__assign(__assign({}, metadata), (_c = (_b = this.provider).getGeneratedAnswerMetadata) === null || _c === void 0 ? void 0 : _c.call(_b)))];
86547
+ case 1: return [2, __assign.apply(void 0, [__assign.apply(void 0, [__assign.apply(void 0, _a.concat([(_d.sent())])), this.provider.getSearchEventRequestPayload()]), { searchQueryUid: this.provider.getSearchUID(), queryPipeline: this.provider.getPipeline(), actionCause: event }])];
86385
86548
  }
86386
86549
  });
86387
86550
  });