Skip to content

sovaai/chatKit-dl-module

Repository files navigation

Dialog Language (DL) is separate module that connects to the widget. It is used to describe scripts and dialog rules.

Install

For install chatKit-dl-module enter next command:

npm i ck-dialog-language

Quick start

For quick start chatKit-dl-module enter next command:

import ckModuleInit from 'ck-dialog-language' 
const dlModule = ckModuleInit(dlConfig)   

Description

dlConfig

Configuration file includes:

const dlConfig = {
 info: {
   uuid: string,
 },
 api?: {
   infApiUrl?: string,
   geoLocationApiUrl?: string,
   liveChatOperatorsApiUrl?: string,
   notificationsApiUrl?: string,
   chatTimerAnnouncementsApiUrl?: string,
   chatUpdateApiUrl?: string,
 },
 moduleEvents?: {
 chatInit: (module: DialogLanguageModule, data: ChatInitData) => void,
 chatRequest: (module: DialogLanguageModule, data: ChatRequestData) => void,
 chatEvent: (module: DialogLanguageModule, data: ChatEventData) => void,
 setInfo: (module: DialogLanguageModule, data: SetInfoData) => void,
 chatRate: (module: DialogLanguageModule, data: ChatRateData) => void,
 chatTrack: (module: DialogLanguageModule, data: ChatTrackData) => void,
 geoLocationRequest: (module: DialogLanguageModule) => void,
 liveChatOperatorsCheckRequest: (module: DialogLanguageModule) => void,
 notificationRequest: (module: DialogLanguageModule) => void,
 notificationDisplay: (module: DialogLanguageModule, data: NotificationDisplayData) => void,
 chatUpdate: (module: DialogLanguageModule) => void,
 chatTimerAnnouncementsRequest: (module: DialogLanguageModule, data: ChatTimerAnnouncementsRequestData) => void,
 reset: (module: DialogLanguageModule, data: ChatInitData) => void,
 },
 uiEvents?: {
   sendMessage?: (data: SendMessageData) => void,
   uiManagment?: (uiManagmentEvent: UIManagmentEvents, data: UIManagmentData) => void,
   notifications?: (notificationsEvent: NotificationsEvents, data: NotificationsData) => void,
   modules?: (modulesEvent: ModulesEvents , data: ModulesData)=> void,
 }
}

API methods

Dialog Language has next API methods:

API method
chatInit Dialog Initialization
chatRequest Sending user messages
setInfo Get information about events
chatEvent Chat events
chatRate Rating of the all dialogue
chatTimerAnnouncementsRequest Announcement activation by timer
chatUpdate Updating the widget
notificationDisplay Displaying a specific notification
notificationRequest Notification display request
liveChatOperatorsCheckRequest Request to switch to operator
geoLocationRequest Geolocation request
chatTrack Show specific text when you hover over a link
reset Reset dialogue

DL.ModuleDispatcher

moduleDispatcher - method of event management.
moduleDispatcher select method and transmits necessary data to it.

For example:

import moduleInit from 'SOVA-dlModule'   
const dlModule = moduleInit(dlConfig)   
dlModule.moduleDispatcher('chatInit', { clientConfig: { siteLang: 'ru' } })