Skip to main content

@wildix/xbees-connect > ConnectClient

ConnectClient interface

Signature:

export interface ConnectClient 

Properties

Property

Modifiers

Type

Description

addEventListener

<T extends EventType = EventType>(eventName: T, callback: Callback<T>) => RemoveEventListener

Starts listen for one of the events of the x-bees and handle with the provided callback

deleteFromStorage

(key: string) => void

Removes data from localStorage

getAvailableContactData

() => Promise<ResponseMessage<ClientEventType.AVAILABLE_CONTACT_DATA>>

Retrieves available contact data from x-bees

getBackToAppUrl

() => string

Retrieves url to get back to x-bees app integration

getContext

() => Promise<ResponseMessage<ClientEventType.CONTEXT>>

Retrieves current x-bees context data

getCurrentContact

() => Promise<ResponseMessage<ClientEventType.CURRENT_CONTACT>>

Retrieves current opened in x-bees contact data

getCurrentConversation

() => Promise<ResponseMessage<ClientEventType.CURRENT_CONVERSATION>>

Retrieves current opened in x-bees conversation data or undefined if the conversation is temporary

getFromStorage

<Type>(key: string) => Type | null

Retrieves data from localStorage

getFromXbeesStorage

(key: string) => Promise<ResponseMessage<ClientEventType.GET_FROM_STORAGE>>

Request stored data from x-bees storage

getPbxDomain

() => string

Retrieves current pbx domain

getReferrer

() => string

Retrieves url for x-bees app which uses integration

getTechnicalSupport

() => TechnicalSupport

special object to provide x-bees technical support

getTheme

() => Promise<ResponseMessage<ClientEventType.THEME>>

Retrieves current theme with mode (light or dark) and theme options like typography settings and palette

getThemeMode

() => Promise<ResponseMessage<ClientEventType.THEME_MODE>>

Retrieves current theme mode (light or dark)

getUserEmail

() => string

Retrieves current user's email

getUserExtension

() => string | null

Retrieves current user's extension

getUserPbxToken

() => string

Retrieves current pbx token

getXBeesToken

() => Promise<ResponseMessage<ClientEventType.TOKEN>>

Retrieves current x-bees token

getXBeesUser

() => XBeesUser | null

Retrieves current user's data

isActivationOnly

() => boolean

Determines x-bees is using this connect for activation/authorization on UI and this call of integration UI should show dialog which leads to integration be activated

isAuthorized

() => Promise<ResponseMessage>

pushes to x-bees message that user is authorized and no more actions required

isDataOnly

() => boolean

Determines x-bees is using this connect for messages only and this integration will not be shown on UI

isNotAuthorized

() => Promise<ResponseMessage>

pushes to x-bees message that user actions required

isOpenedFromXBees

() => boolean

Determines application is opened as x-bees child in Browser iFrame or Native WebView

isPlatformNative

() => boolean

Determines x-bees is running on mobile native platform

isPlatformWeb

() => boolean

Determines x-bees is running on web browser platform

isSetupDialog

() => boolean

Determines x-bees is using this connect for show dialog of setup flow

isVisible

() => boolean

Indicates whether the UI iframe with the integration is currently active

off

(callback: Callback | StorageEventCallback) => void

Removes particular callback from handling events

onCallEnded

(callback: Callback<EventType.TERMINATE_CALL>) => RemoveEventListener

Starts listen for the events of ending the call and handle with the provided callback

onCallStarted

(callback: Callback<EventType.ADD_CALL>) => RemoveEventListener

Starts listen for the events of starting the call and handle with the provided callback

onLogout

(callback: Callback<EventType.LOGOUT>) => RemoveEventListener

starts listen on logout event and send event to the x-bees about logout able

onLookupAndMatchContact

(callback: (query: ContactQuery, resolve: LookupAndMatchContactsResolver, reject: Reject) => void) => RemoveEventListener

Starts listen for the events of searching contact info and handle match with the provided callback

onPbxTokenChange

(callback: Callback<EventType.PBX_TOKEN>) => RemoveEventListener

Starts listen for the events of changing pbx token and handle with the provided callback

onRedirectQuery

(callback: Callback<EventType.REDIRECT_QUERY>) => RemoveEventListener

Starts listen for redirect query message which fires when user opens app with deeplink to integration

onStorage

(listener: StorageEventCallback) => () => void

listens on localStorage

onSuggestContacts

(callback: (query: string, resolve: SuggestContactsResolver, reject: Reject) => void) => RemoveEventListener

Starts listen for the events of searching contacts and handle autosuggestion with the provided callback

onThemeChange

(callback: Callback<EventType.USE_THEME>) => RemoveEventListener

Starts listen for the events of changing theme and handle with the provided callback

onVisibilityChange

(callback: Callback<EventType.VISIBILITY>) => RemoveEventListener

Starts listen for the events of changing iframe activity and handle with the provided callback

ready

(props?: SupportedPlatformVariant | ReadyExtendedProps) => Promise<ResponseMessage>

Sends to x-bees signal that iFrame is ready to be shown. iFrame should send it when the application starts and ready

reboot

() => Promise<ResponseMessage>

Sends request to x-bees to restart the iFrame, reload with actual params and token

removeEventListener

<T extends EventType = EventType>(eventName: T, callback: Callback<T>) => void

Stops listen for one of the events of the x-bees with this particular callback

removeFromXbeesStorage

(key: string) => void

Remove data from x-bees storage

saveInXbeesStorage

<SavingType>(key: string, value: SavingType) => void

Send data to save in x-bees storage

saveToStorage

<SavingType>(key: string, value: SavingType) => void

saves data to localStorage

sendAnalytics

(eventName: string, params?: Record<string, string>) => void

send analytics data to x-bees for track into analytics data

setIntegrationStorageKey

(integrationKey: string) => void

Set parent integration key to switch to parent integration localStorage data

setViewport

(payload: IPayloadViewPort) => Promise<ResponseMessage>

Sends request to x-bees about current frame size change

showsUi

() => boolean

Determines x-bees is using this connect for representation on UI and this integration will be shown on UI this opposite to

showToast

(message: string, severity?: ToastSeverity) => Promise<ResponseMessage>

Sends message to x-bees to be shown as a toast with specified severity level

startCall

(phoneNumber: string) => Promise<ResponseMessage>

Sends request to x-bees to start a call with the number

toClipboard

(payload: string) => Promise<ResponseMessage>

Sends request to x-bees to put string to the users clipboard

version

() => string

Retrieves the version of xBeesConnect

Methods

Method

Description

contactMatchUpdated(query, contact)

Sends notification to x-bees about contact match was updated

contactUpdated(query, contact)

Sends notification to x-bees about contact data updated