coveo.analytics 2.19.3 → 2.19.6

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,13 +1,17 @@
1
1
  import { AnalyticsClient, ClientOptions } from '../client/analytics';
2
2
  import { CaseCancelledMetadata, CaseCreatedMetadata, CaseSolvedMetadata, EnterInterfaceMetadata, MoveToNextCaseStepMetadata, RateDocumentSuggestionMetadata, SelectDocumentSuggestionMetadata, SelectFieldSuggestionMetadata, UpdateCaseFieldMetadata } from './caseAssistActions';
3
+ export interface CaseAssistClientProvider {
4
+ getOriginLevel1: () => string;
5
+ }
3
6
  export interface CaseAssistClientOptions extends ClientOptions {
4
7
  enableAnalytics?: boolean;
5
8
  }
6
9
  export declare class CaseAssistClient {
7
10
  private options;
11
+ private provider?;
8
12
  coveoAnalyticsClient: AnalyticsClient;
9
13
  private svc;
10
- constructor(options: Partial<CaseAssistClientOptions>);
14
+ constructor(options: Partial<CaseAssistClientOptions>, provider?: CaseAssistClientProvider | undefined);
11
15
  disable(): void;
12
16
  enable(): void;
13
17
  logEnterInterface(meta: EnterInterfaceMetadata): Promise<void | import("../events").SearchEventResponse | import("../events").ClickEventResponse | import("../events").CustomEventResponse | import("../events").ViewEventResponse>;
@@ -1,8 +1,8 @@
1
- import { ImpressionList } from '../../plugins/ec';
1
+ import { Product, ImpressionList } from '../../plugins/ec';
2
2
  export declare const commerceActionKeysMappingPerAction: Record<string, {
3
3
  [name: string]: string;
4
4
  }>;
5
- export declare const convertProductToMeasurementProtocol: (product: (Pick<import("../../plugins/ec").ProductProperties, "brand" | "category" | "variant" | "price" | "quantity" | "coupon" | "position" | "custom" | "group"> & Required<Pick<import("../../plugins/ec").ProductProperties, "id">> & Partial<Pick<import("../../plugins/ec").ProductProperties, "name">>) | (Pick<import("../../plugins/ec").ProductProperties, "brand" | "category" | "variant" | "price" | "quantity" | "coupon" | "position" | "custom" | "group"> & Required<Pick<import("../../plugins/ec").ProductProperties, "name">> & Partial<Pick<import("../../plugins/ec").ProductProperties, "id">>), index: number) => {};
5
+ export declare const convertProductToMeasurementProtocol: (product: Product, index: number) => {};
6
6
  export declare const convertImpressionListToMeasurementProtocol: (impressionList: ImpressionList, listIndex: number, prefix: string) => {
7
7
  [name: string]: any;
8
8
  };
@@ -1,5 +1,6 @@
1
+ import { Ticket } from '../../plugins/svc';
1
2
  export declare const serviceActionsKeysMapping: {
2
3
  [name: string]: string;
3
4
  };
4
- export declare const convertTicketToMeasurementProtocol: (ticket: import("../../plugins/svc").TicketProperties) => {};
5
+ export declare const convertTicketToMeasurementProtocol: (ticket: Ticket) => {};
5
6
  export declare const isServiceKey: ((key: string) => boolean)[];
@@ -1,5 +1,5 @@
1
1
  export { CoveoSearchPageClient, SearchPageClientProvider } from '../searchPage/searchPageClient';
2
- export { CaseAssistClient } from '../caseAssist/caseAssistClient';
2
+ export { CaseAssistClient, CaseAssistClientProvider } from '../caseAssist/caseAssistClient';
3
3
  export { CoveoAnalyticsClient, AnalyticsClientSendEventHook } from '../client/analytics';
4
4
  export { PreprocessAnalyticsRequest } from '../client/analyticsRequestClient';
5
5
  export * as history from '../history';
@@ -8,5 +8,5 @@ export { PreprocessAnalyticsRequest } from '../client/analyticsRequestClient';
8
8
  export { IRuntimeEnvironment } from '../client/runtimeEnvironment';
9
9
  export { CoveoUA, getCurrentClient, handleOneAnalyticsEvent } from './simpleanalytics';
10
10
  export { CoveoSearchPageClient, SearchPageClientProvider } from '../searchPage/searchPageClient';
11
- export { CaseAssistClient } from '../caseAssist/caseAssistClient';
11
+ export { CaseAssistClient, CaseAssistClientProvider } from '../caseAssist/caseAssistClient';
12
12
  export { analytics, donottrack, history, SimpleAnalytics, storage };
@@ -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",
@@ -1,5 +1,5 @@
1
1
  export { CoveoSearchPageClient, SearchPageClientProvider } from '../searchPage/searchPageClient';
2
- export { CaseAssistClient } from '../caseAssist/caseAssistClient';
2
+ export { CaseAssistClient, CaseAssistClientProvider } from '../caseAssist/caseAssistClient';
3
3
  export { CoveoAnalyticsClient, AnalyticsClientSendEventHook } from '../client/analytics';
4
4
  export { PreprocessAnalyticsRequest } from '../client/analyticsRequestClient';
5
5
  export * as history from '../history';
@@ -8,5 +8,5 @@ export { PreprocessAnalyticsRequest } from '../client/analyticsRequestClient';
8
8
  export { IRuntimeEnvironment } from '../client/runtimeEnvironment';
9
9
  export { CoveoUA, getCurrentClient, handleOneAnalyticsEvent } from './simpleanalytics';
10
10
  export { CoveoSearchPageClient, SearchPageClientProvider } from '../searchPage/searchPageClient';
11
- export { CaseAssistClient } from '../caseAssist/caseAssistClient';
11
+ export { CaseAssistClient, CaseAssistClientProvider } from '../caseAssist/caseAssistClient';
12
12
  export { analytics, donottrack, history, SimpleAnalytics, storage };
@@ -1,16 +1,16 @@
1
1
  /*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation. All rights reserved.
3
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
- this file except in compliance with the License. You may obtain a copy of the
5
- License at http://www.apache.org/licenses/LICENSE-2.0
2
+ Copyright (c) Microsoft Corporation.
6
3
 
7
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
- MERCHANTABLITY OR NON-INFRINGEMENT.
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
11
6
 
12
- See the Apache Version 2.0 License for specific language governing permissions
13
- and limitations under the License.
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
14
  ***************************************************************************** */
15
15
 
16
16
  function __rest(s, e) {
@@ -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";
@@ -1411,6 +1412,9 @@ class CoveoSearchPageClient {
1411
1412
  logCollapseSmartSnippetSuggestion(documentId) {
1412
1413
  return this.logCustomEvent(SearchPageEvents.collapseSmartSnippetSuggestion, { documentId });
1413
1414
  }
1415
+ logOpenSmartSnippetSource(info, identifier) {
1416
+ return this.logClickEvent(SearchPageEvents.openSmartSnippetSource, info, identifier);
1417
+ }
1414
1418
  logRecentQueryClick() {
1415
1419
  return this.logSearchEvent(SearchPageEvents.recentQueryClick);
1416
1420
  }
@@ -1650,9 +1654,10 @@ var CaseCancelledReasons;
1650
1654
  })(CaseCancelledReasons || (CaseCancelledReasons = {}));
1651
1655
 
1652
1656
  class CaseAssistClient {
1653
- constructor(options) {
1657
+ constructor(options, provider) {
1654
1658
  var _a;
1655
1659
  this.options = options;
1660
+ this.provider = provider;
1656
1661
  const analyticsEnabled = (_a = options.enableAnalytics) !== null && _a !== void 0 ? _a : true;
1657
1662
  this.coveoAnalyticsClient = analyticsEnabled ? new CoveoAnalyticsClient(options) : new NoopAnalytics();
1658
1663
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
@@ -1720,10 +1725,18 @@ class CaseAssistClient {
1720
1725
  return this.sendClickEvent();
1721
1726
  }
1722
1727
  sendFlowStartEvent() {
1723
- return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.flowStart);
1728
+ return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.flowStart, this.provider
1729
+ ? {
1730
+ searchHub: this.provider.getOriginLevel1(),
1731
+ }
1732
+ : null);
1724
1733
  }
1725
1734
  sendClickEvent() {
1726
- return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.click);
1735
+ return this.coveoAnalyticsClient.sendEvent('event', 'svc', CaseAssistEvents.click, this.provider
1736
+ ? {
1737
+ searchHub: this.provider.getOriginLevel1(),
1738
+ }
1739
+ : null);
1727
1740
  }
1728
1741
  }
1729
1742