Skip to content

Files

Latest commit

166a946 · Dec 12, 2024

History

History
280 lines (169 loc) · 7.63 KB

README.md

File metadata and controls

280 lines (169 loc) · 7.63 KB

glia-widgets-ionic

GliaWidgets SDK is a simple and customisable framework built on top of GliaSDK. It provides all the necessary UI components to quickly integrate GliaSDK into your project.

Installation

To install version 1.0.0 of this package use:

npm install github:salemove/widgets_sdk_ionic#1.0.0

How to use GliaSDK in Ionic environment

// Import `glia-widgets-ionic` plugin
import { GliaSdk } from 'glia-widgets-ionic';

// Configure SDK
GliaSdk.configure({
  siteId: 'site-id',
  apiKey: { id: 'api-key-id', secret: 'api-key-secret' },
  region: 'us',
  companyName: 'Ionic Company',
});

// Start engagement
GliaSdk.startAudio();

API

configure(...)

configure(options: { siteId: string; apiKey: ApiKey; region: Region; companyName: string; overrideLocale?: string; }) => Promise<void>

configures GliaWidgets SDK with credentials.

NB! To make plugin work properly, use create-visitor credentials for Site APIKey only.

Param Type
options { siteId: string; apiKey: ApiKey; region: Region; companyName: string; overrideLocale?: string; }

startChat(...)

startChat(options: { queueIds?: string[]; }) => Promise<void>

Starts a new chat/text engagement with queue identifiers. If queueIds is null or empty, creates engagement for default queue.

Param Type
options { queueIds?: string[]; }

startAudio(...)

startAudio(options: { queueIds?: string[]; }) => Promise<void>

Starts a new audio engagement with queue identifiers. If queueIds is null or empty, creates engagement for default queue.

Param Type
options { queueIds?: string[]; }

startVideo(...)

startVideo(options: { queueIds?: string[]; }) => Promise<void>

Starts a new video engagement for queue identifiers. If queueIds is null or empty, creates engagement for default queue.

Param Type
options { queueIds?: string[]; }

startSecureConversation(...)

startSecureConversation(options: { startScreen: SecureConversationStartScreen; }) => Promise<void>

Starts Secure Conversation flow with passed start screen. Secure Conversation requires authentication/IdToken.

Param Type
options { startScreen: SecureConversationStartScreen; }

clearVisitorSession()

clearVisitorSession() => Promise<void>

Recreates currently used visitor in SDK.


listQueues()

listQueues() => Promise<any>

Fetches all queues with its info for current site.

Returns: Promise<any>


showVisitorCodeViewController()

showVisitorCodeViewController() => Promise<void>

Presents GliaWidgets UI with visitor code for sharing with operator to start an engagement.


authenticate(...)

authenticate(options: { behavior: AuthenticationBehavior; idToken: string; accessToken?: string; }) => Promise<void>

Authenticates visitor.

Param Type Description
options { behavior: AuthenticationBehavior; idToken: string; accessToken?: string; } - Provides options for authentication such as behavior, idToken, and accessToken.

deauthenticate()

deauthenticate() => Promise<void>

Deauthenticates visitor. Be aware that deauthentication process relies on AuthenticationBehavior


isAuthenticated()

isAuthenticated() => Promise<void>

Provides current authentication state


refreshAuthentication(...)

refreshAuthentication(options: { idToken: string; accessToken?: string; }) => Promise<void>

Refreshes authentication access properties.

Param Type
options { idToken: string; accessToken?: string; }

pauseLiveObservation()

pauseLiveObservation() => Promise<void>

Makes a pause for ongoing LiveObservation session.


resumeLiveObservation()

resumeLiveObservation() => Promise<void>

Resumes ongoing LiveObservation session.


Interfaces

ApiKey

Prop Type
id string
secret string

Type Aliases

Region

Site's region.

'us' | 'eu' | 'beta'

SecureConversationStartScreen

Start screen for Secure Conversation flow.

'welcome' | 'chatTranscript'

AuthenticationBehavior

Authentication (IdToken) behavior. forbiddenDuringEngagement - Prevent creation a new engagement if ongoing engagement exists. Default behavior. allowedDuringEngagement - Allows creation a new engagement if ongoing engagement exists. During this behavior original engagement will be ended and a new engagement engagement will be restarted with the same operator after authentication is succeded.

'forbiddenDuringEngagement' | 'allowedDuringEngagement'