UNPKG

@glance-networks/agent-plugin

Version:

Glance Networks Agent Plugin

103 lines (102 loc) 4.75 kB
import { Dispatch, SetStateAction } from 'react'; export declare enum AuthMethod { Loginkey = "LOGINKEY", Saml = "SAML", SamlWithLoginkey = "SAMLLOGINKEY", SamlPopup = "SAMLPOPUP" } export interface AuthParams { url: string; puid: string; groupId: string | number; method?: AuthMethod | string; headers?: Object; body?: URLSearchParams; debug?: boolean; errorHandler?: (message: string, hideError?: boolean) => void; } export interface LoginKey { key: string; expiration: number; } interface JoinParams { cobrowseKey: string; openLocation?: string; debug?: boolean; sessionStateHandler?: (activeSession: boolean) => void; } export interface PresenceParams { presenceCallback: Dispatch<SetStateAction<boolean>>; permissionsCallback: () => void; visitorId: string; debug?: boolean; endSessionCallback?: (data: any) => void; startSessionCallback?: (data: any) => void; } interface EventListenerParams { endSessionCallback?: (data: any) => void; debug?: boolean; } export declare enum ErrorUserMessages { LoginKeyError = "There are issues with authentication, please refresh the page.", ConnectPresenceError = "There are issues with connecting to the presence service, please try again or refresh the page.", PresenceAuthorizationError = "Partner User Id \"{0}\" not found or invalid, contact your administrator.", PresenceDeclinedError = "The website visitor declined cobrowse session.", LookupSessionNotFoundError = "Session not found. Check that the key is correct.", LookupSessionError = "There are issues connecting cobrowse session, please try again or refresh the page.", JoinSessionError = "There are issues with the visitor joining the cobrowse session, please try again or refresh the page.", InviteSessionError = "There are issues with inviting the visitor to the mobile camera share session, please try again or refresh the page.", InviteSessionBusinessError = "{0}, please try again or refresh the page.", EndPresenceError = "There are issues with ending the cobrowse session, please try again or refresh the page.", EndCobrowseError = "There are issues with ending the cobrowse session, please try again or refresh the page.", PopupError = "There was a problem opening the login window. Please make sure that pop-ups are enabled and refresh the page." } export declare class AgentService { protected Agent: any; protected loginKeyParams: LoginKey; protected auth: AuthParams; protected sessionInfo: any; protected scheduleLoginKeyRenewRef: number; protected scheduleEndSessionCheck: number; private openedWindow; constructor(auth: AuthParams); authWithLoginkey: (auth: AuthParams, regenerate?: boolean) => Promise<void>; private defaultLogger; defaultErrorHandler(error: Error, context?: string, userMessage?: string, hideError?: boolean): void; getLoginkey: (auth: AuthParams) => Promise<LoginKey>; get loginKey(): string; get puid(): string; get groupId(): string | number; protected scheduleLoginKeyRenew: (regenerate?: boolean) => number; handleEvents: () => void; presenceFailedAuthorizationHandler: (payload: any) => Promise<boolean>; getExpiration: (loginKey: string) => number; authWithSaml: (idpid: string) => void; authWithSamlLoginKey: (idpid: string) => void; authWithSamlPopup: (groupId: string, puid: string) => void; setAgentListeners: (eventParams: EventListenerParams) => void; connectPresence: (presence: PresenceParams) => Promise<void>; disconnectPresence: () => Promise<void>; cobrowseService: (join: JoinParams) => void; cancelEndSessionCheck: () => void; lookupService: (join: JoinParams) => Promise<string>; lookupServiceCancel: () => void; presenceStartSession: (sessionKey: string, acceptHandler: () => void, declineHandler: () => void) => Promise<void>; presenceDisconnect: () => Promise<void>; setPresenceVisitorId: (visitorId: string) => void; registerEventsHandler: (handler: (eventName: string, eventData: any) => void) => void; getBackendUrl: (path: any) => string; checkSession: (sessionCode: string) => Promise<any>; presenceEndSession: (visitorId: string) => Promise<void>; cobrowseEndSession: (sessionCode: string) => Promise<void>; hasAgentWindow: () => boolean; closeAgentWindow: () => boolean; openWindow: (url: string, params: string, closeHandler: (reason: any) => void) => void; checkPermissions: (permissions: { name: string; expectedValue: any; handler: (hasPermission: boolean) => void; }[]) => void; getPresenceJwtTokenClaims(): {}; } export {};