/** * This file contains override value interfaces from 1DS - we redefine these locally because we cannot take the npm package due to * it being from a private feed. Instead, we load the CDN and use our redefined interfaces to help everything mesh together. * Disable tslint interface prefix rule b/c these are 1DS libraries, avoid renaming to keep consistent. */ import { RpcNotification } from '../rpc/notification/rpc-notification-model'; /************************************ * WAC models ************************************/ /** * Exposed class to hold sme performance data. */ export interface SmePerformanceData { label?: string; sme?: any; resources?: any; navigation?: any; totalLoadTime: number; } /** * Holds lighthouse metrics to send via telemetry. See more details at https://web.dev/vitals/ */ export interface LighthousePerformanceMetrics { CumulativeLayoutShift?: number; LargestContentfulPaint?: number; FirstContentfulPaint?: number; FirstInputDelay?: number; TimeToFirstByte?: number; TotalBlockingTime?: number; TimeToInteractive?: number; } /** * Class w/ all SME performance data to be sent via telemetry. Internal to SmeWebTelemetry. * Numbers are converted to strings because we use toFixed to truncate numbers to avoid triggering MSCOM scrubbed * stream personal data removal (eg with phone numbers) */ export interface CompleteSmePerformanceData { extension: string; entryPointName: string; url: string; moduleOpened: boolean; label?: string; sme?: any; resources?: any; navigation?: any; totalLoadTime: string; } /** * Class to hold any kind of telemetry event parameters needed to fire an event. */ export interface TelemetryEventBody { overrideValues?: IOverrideValues; element?: Element; performance?: SmePerformanceData; lighthouse?: LighthousePerformanceMetrics; notification?: RpcNotification; custom?: any; customProperties?: { [name: string]: any; }; } /** * Telemetry events supported. */ export declare enum TelemetryEvents { Action = 0, PageView = 1, ContentUpdate = 2, Performance = 3, Lighthouse = 4, ModuleOpenPerformance = 5, Notification = 6 } /** * Telemetry action types supported - corresponds to awa jsll action type dictionary. */ export declare enum TelemetryActionTypes { Automatic = "A", Click = "CL" } /** * Telemetry event types supported - labels type field in data dictionary within events. */ export declare enum TelemetryEventTypes { Informational = "info", Error = "error", Performance = "performance", Lighthouse = "lighthouse", Notification = "notification", Powershell = "powershell", StatusUpdate = "statusUpdate" } /** * Labels for WAC metadata tags */ export declare enum SmeMetaLabels { Language = "wac-lang", IsProduction = "wac-prod", ExtensionVersion = "wac-extension-version", SessionId = "wac-session-id", InstallationType = "wac-installation-type", Build = "wac-build", Market = "market", Environment = "env", GatewayMode = "wac-gateway-mode", GatewayOperationalMode = "wac-gateway-operational-mode" } /** * Standard telemetry tracking event states */ export declare enum TelemetryEventStates { Started = "started", Completed = "completed", Error = "error", Exited = "exited" } /** * Include powershell details that may be helpful in telemetry, including response and psSessionId. * Data is kept as an optional any-helpful field kind of thing. */ export interface PowershellDetails { /** * Response object - this should be the response within the error if result is an AjaxError */ response?: any; /** * Powershell session ID - used to map to PS command in telemetry */ id?: string; /** * Any other miscellaneous data that would like to be sent. */ otherData?: any; } /************************************ * Override values interfaces ************************************/ export interface IOverrideValues { /** * One of the awa.behavior values. */ behavior?: number; /** * Page name */ pageName?: string; /** * Page type */ pageType?: string; /** * KVP to be added to the page tags collected */ pageTags?: any; /** * Indicates if the event was fired automatically */ isAuto?: boolean; } /** * Overrides for Page View event */ export interface IPageViewOverrideValues extends IOverrideValues { /** * Uri of the referrer page */ referrerUri?: string; } /** * Overrides for Page Action event */ export interface IPageActionOverrideValues extends IOverrideValues { /** * Uri of the referrer page */ refUri?: string; /** * One of the awa.actionType values */ actionType?: string; /** * Target uri for PageAction events */ targetUri?: string; /** * Click coordinates relative to the top left of the fully rendered content area in the browser */ clickCoordinateX?: number; /** * Click coordinates relative to the top left of the fully rendered content area in the browser */ clickCoordinateY?: number; /** * KVP of the content */ content?: any; /** * KVPs to be added to the content tags collected on a Page Action event; extends the items in the Content blob in Page Action events */ contentTags?: any; } /** * Overrides for Content Update event */ export interface IContentUpdateOverrideValues extends IOverrideValues { /** * KVP of the content */ content?: any; /** * Indicates if the Contentupdate event is the first ContentUpdate event */ isDomComplete?: boolean; /** * One of the awa.actionType values */ actionType?: string; } /** * Overrides for Page Unload event */ export interface IPageUnloadOverrideValues extends IOverrideValues { /** * Scroll depth override */ scrollDepth?: string; /** * Vertical scroll position/offset when event was fired in pixels. */ vScrollOffset?: number; } /** * Overrides for Page View Performance event */ export interface IPageViewPerformanceOverrideValues extends IOverrideValues { /** * Viewport height */ vpHeight?: number; /** * Viewport width */ vpWidth?: number; /** * Represents UX Framework name and version used. */ framework?: string; /** * These are timings pulled from the browser/container. * They are standards which are captured by the browser, like the navigationStart/End, LoadEventStart/End */ systemTiming?: string; /** * These are user set timings */ customTiming?: string; }