├── .eslintignore ├── .gitignore ├── .prettierrc ├── .env-template ├── src ├── index.ts ├── utils │ ├── announcements.ts │ ├── notifications.ts │ ├── resultControl.ts │ ├── regExp.ts │ └── helpers.ts ├── events │ ├── defaultUiEvents.ts │ └── moduleEvents.ts ├── @types │ ├── uiEvents.d.ts │ ├── module.d.ts │ ├── moduleEvents.d.ts │ └── dialogLanguage.d.ts └── module │ └── DialogLanguage.ts ├── jest.config.js ├── APImethods ├── reset.md ├── chatUpdate.md ├── geoLocationRequest.md ├── notificationRequest.md ├── liveChatOperatorsCheckRequest.md ├── chatRate.md ├── chatRequest.md ├── notificationDisplay.md ├── chatInit.md ├── setInfo.md ├── chatTimerAnnouncementsRequest.md ├── chatEvent.md └── chatTrack.md ├── .vscode └── settings.json ├── tsconfig.json ├── .editorconfig ├── .eslintrc.js ├── .github └── workflows │ └── npm-publish.yml ├── dist ├── index.d.ts ├── index.es.d.ts ├── index.es.js ├── index.js └── index.es.js.map ├── rollup.config.js ├── package.json ├── README.md └── LICENSE /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /node_modules 3 | 4 | /storybook-static 5 | 6 | .env -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "semi": false, 4 | "singleQuote": true, 5 | "printWidth": 120 6 | } 7 | -------------------------------------------------------------------------------- /.env-template: -------------------------------------------------------------------------------- 1 | INF_API_URL= 2 | GEO_LACATION_API_URL= 3 | LIVE_CHAT_OPERATORS_API_URL= 4 | NOTIFICATIONS_API_URL= 5 | CHAT_TIMER_ANNOUNCEMENTS_API_URL= 6 | CHAT_UPDATE_API_URL= -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { DialogLanguageModule } from './module/DialogLanguage' 2 | import { DialogLanguageConfig } from './@types/dialogLanguage' 3 | const ckModuleInit = (config: DialogLanguageConfig) => new DialogLanguageModule(config) 4 | export default ckModuleInit 5 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | roots: ['/src'], 3 | transform: { 4 | '^.+\\.ts?$': 'ts-jest', 5 | }, 6 | testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.ts?$', 7 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 8 | } 9 | -------------------------------------------------------------------------------- /APImethods/reset.md: -------------------------------------------------------------------------------- 1 | # reset 2 | Reset dialogue 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `reset` and transmits necessary next to that: 7 | 8 | ```javascript 9 | moduleDispatcher('reset') 10 | ``` 11 | -------------------------------------------------------------------------------- /APImethods/chatUpdate.md: -------------------------------------------------------------------------------- 1 | # chatUpdate 2 | Updating the widget 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `chatUpdate` and transmits necessary next to that: 7 | 8 | ```javascript 9 | moduleDispatcher('chatUpdate') 10 | ``` 11 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/.git": false 4 | }, 5 | "editor.formatOnSave": true, 6 | "cSpell.words": [ 7 | "Crosstab", 8 | "coverage", 9 | "crosstabs", 10 | "js", 11 | "lcov", 12 | "persistor", 13 | "remotedev", 14 | "report", 15 | "svgr", 16 | "wessberg" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /APImethods/geoLocationRequest.md: -------------------------------------------------------------------------------- 1 | # geoLocationRequest 2 | Geolocation request 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `geoLocationRequest` and transmits necessary data to that: 7 | 8 | ```javascript 9 | moduleDispatcher('geoLocationRequest') 10 | ``` 11 | -------------------------------------------------------------------------------- /APImethods/notificationRequest.md: -------------------------------------------------------------------------------- 1 | # notificationRequest 2 | Notification display request 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `notificationRequest` and transmits next data to that: 7 | 8 | ```javascript 9 | moduleDispatcher('notificationRequest') 10 | ``` 11 | -------------------------------------------------------------------------------- /src/utils/announcements.ts: -------------------------------------------------------------------------------- 1 | import { DialogLanguageModule } from '../@types/dialogLanguage' 2 | import { resultControl } from './resultControl' 3 | 4 | export const announcements = (module: DialogLanguageModule, announcements: any) => { 5 | if (announcements.length! > 0) return 6 | announcements.forEach(async (message: any) => await resultControl(module, message.result)) 7 | } 8 | -------------------------------------------------------------------------------- /APImethods/liveChatOperatorsCheckRequest.md: -------------------------------------------------------------------------------- 1 | # liveChatOperatorsCheckRequest 2 | Request to switch to operator 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `liveChatOperatorsCheckRequest` and transmits next data to that: 7 | 8 | ```javascript 9 | moduleDispatcher('liveChatOperatorsCheckRequest') 10 | ``` 11 | -------------------------------------------------------------------------------- /src/utils/notifications.ts: -------------------------------------------------------------------------------- 1 | import { DialogLanguageModule } from '../@types/dialogLanguage' 2 | 3 | export const notifications = (module: DialogLanguageModule, notificationsRequestResult: any) => { 4 | const { randomMsg, ...notificationsSettings } = notificationsRequestResult 5 | module.uiDispatcher('notifications', { notificationEvent: 'addMessages', data: randomMsg }) 6 | module.uiDispatcher('notifications', {notificationEvent: 'addSettings', data: notificationsSettings}) 7 | } 8 | -------------------------------------------------------------------------------- /APImethods/chatRate.md: -------------------------------------------------------------------------------- 1 | # chatRate 2 | Rating of the all dialogue 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` witches to the selected method `chatRate` and transmits necessary data to that. 7 | 8 | For example: 9 | ```javascript 10 | moduleDispatcher('chatRate',{rating: 5}) 11 | ``` 12 | 13 | ## Typical data 14 | ```javascript 15 | ChatRateData { 16 | rating: number 17 | } 18 | ``` 19 | 20 | ## Example of data 21 | ```javascript 22 | data = { 23 | rating: 5, 24 | } 25 | ``` 26 | -------------------------------------------------------------------------------- /src/events/defaultUiEvents.ts: -------------------------------------------------------------------------------- 1 | import { SendMessageData, UIManagmentEvents, NotificationsEvents, ModulesEvents, ModulesData } from '../@types/uiEvents' 2 | 3 | export const defaultSendMessage = (data: SendMessageData) => console.log('no SendMessage') 4 | export const defaultUIManagment = (uiManagmentEvent: UIManagmentEvents, data: any) => console.log('no UIManagment') 5 | export const defaultNotifications = (notificationsEvent: NotificationsEvents, data: any) => 6 | console.log('no Notifications') 7 | export const defaultModules = (notificationsEvent: ModulesEvents, data: any) => console.log('no modules') 8 | -------------------------------------------------------------------------------- /APImethods/chatRequest.md: -------------------------------------------------------------------------------- 1 | # chatRequest 2 | Sending user messages 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `chatRequest` and transmits necessary data to that. 7 | 8 | For example: 9 | ```javascript 10 | moduleDispatcher('chatRequest',{text:'Hello World!!'}) 11 | ``` 12 | 13 | ## Typical data 14 | ```javascript 15 | ChatRequestData { 16 | text: string 17 | context?: RandomContext 18 | } 19 | ``` 20 | 21 | ## Example of data 22 | ```javascript 23 | data = { 24 | text: 'Hello World!!' 25 | } 26 | ``` 27 | -------------------------------------------------------------------------------- /APImethods/notificationDisplay.md: -------------------------------------------------------------------------------- 1 | # notificationDisplay 2 | Displaying a specific notification 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `notificationDisplay` and transmits necessary data to that. 7 | 8 | For example: 9 | ```javascript 10 | moduleDispatcher('notificationDisplay',{ messageId: 12}) 11 | ``` 12 | 13 | ## Typical data 14 | ```javascript 15 | NotificationDisplayData { 16 | messageId: number 17 | } 18 | ``` 19 | 20 | ## Example of data 21 | ```javascript 22 | data = { 23 | messageId: 12, 24 | } 25 | ``` 26 | -------------------------------------------------------------------------------- /APImethods/chatInit.md: -------------------------------------------------------------------------------- 1 | # chatInit 2 | Dialog Initialization 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `chatInit` and transmits necessary data to that. 7 | 8 | For example: 9 | ```javascript 10 | moduleDispatcher('chatInit',{clientConfig:{env_site_lang: 'ru'}}) 11 | ``` 12 | 13 | ## Typical data 14 | ```javascript 15 | ChatInitData { 16 | clientConfig: RandomContext 17 | } 18 | ``` 19 | 20 | ## Example of data 21 | ```javascript 22 | data = { 23 | clientConfig: { 24 | env_site_lang: 'ru' 25 | } 26 | } 27 | ``` 28 | -------------------------------------------------------------------------------- /APImethods/setInfo.md: -------------------------------------------------------------------------------- 1 | # setInfo 2 | Get information about events 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `setInfo` and transmits necessary data to that. 7 | 8 | For example: 9 | 10 | ```javascript 11 | moduleDispatcher('setInfo',{cuid: '123446', events: ['1234', '1323']}) 12 | ``` 13 | 14 | ## Typical data 15 | ```javascript 16 | SetInfoData { 17 | cuid: string 18 | events: string[] 19 | } 20 | ``` 21 | 22 | ## Example of data 23 | ```javascript 24 | data = { 25 | cuid: '123446', 26 | events: ['1234', '1323'] 27 | } 28 | ``` 29 | -------------------------------------------------------------------------------- /APImethods/chatTimerAnnouncementsRequest.md: -------------------------------------------------------------------------------- 1 | # chatTimerAnnouncementsRequest 2 | Announcement activation by timer 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `chatTimerAnnouncementsRequest` and transmits necessary data to that. 7 | 8 | For example: 9 | ```javascript 10 | moduleDispatcher('chatTimerAnnouncementsRequest',{userActive: true}) 11 | ``` 12 | 13 | ## Typical data 14 | ```javascript 15 | ChatTimerAnnouncementsRequestData { 16 | userActive: boolean 17 | } 18 | ``` 19 | 20 | ## Example of data 21 | ```javascript 22 | data = { 23 | userActive: true, 24 | } 25 | ``` 26 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": false, 6 | "skipLibCheck": true, 7 | "esModuleInterop": true, 8 | "allowSyntheticDefaultImports": true, 9 | "strict": true, 10 | "forceConsistentCasingInFileNames": true, 11 | "module": "esnext", 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "noEmit": true, 16 | "jsx": "react", 17 | /* "composite": true, */ 18 | "declaration": true 19 | }, 20 | "plugins": [{ "name": "typescript-tslint-plugin" }], 21 | "include": ["src", "src/store/@types/modules.d.ts"], 22 | "exclude": ["node_modules"] 23 | } 24 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # Matches multiple files with brace expansion notation 12 | # Set default charset 13 | [*.{js,py, ts, tsx, jsx}] 14 | charset = utf-8 15 | indent_style = space 16 | indent_size = 2 17 | 18 | # 4 space indentation 19 | [*.py] 20 | indent_style = space 21 | indent_size = 4 22 | 23 | # Tab indentation (no size specified) 24 | [Makefile] 25 | indent_style = tab 26 | 27 | # Indentation override for all JS under lib directory 28 | [lib/**.js] 29 | indent_style = space 30 | indent_size = 2 31 | 32 | # Matches the exact files either package.json or .travis.yml 33 | [{package.json,.travis.yml}] 34 | indent_style = space 35 | indent_size = 2 36 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: [ 3 | "eslint:recommended", 4 | "plugin:react/recommended", 5 | "plugin:@typescript-eslint/recommended", 6 | "prettier/@typescript-eslint", 7 | "plugin:prettier/recommended" 8 | ], 9 | plugins: ["react", "@typescript-eslint", "prettier"], 10 | env: { 11 | browser: true, 12 | jest: true, 13 | es6: true, 14 | node: true 15 | }, 16 | rules: { 17 | "prettier/prettier": [ 18 | "error", 19 | { trailingComma: "es5", semi: false, singleQuote: true, printWidth: 120 } 20 | ], 21 | "@typescript-eslint/explicit-function-return-type": "off" 22 | }, 23 | settings: { 24 | react: { 25 | pragma: "React", 26 | version: "detect" 27 | } 28 | }, 29 | parser: "@typescript-eslint/parser", 30 | parserOptions: { 31 | ecmaFeatures: { 32 | jsx: false 33 | } 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /src/utils/resultControl.ts: -------------------------------------------------------------------------------- 1 | import { DialogLanguageModule } from '../@types/dialogLanguage' 2 | import { SendMessageData, UIManagmentData } from '../@types/uiEvents' 3 | import { msgPrepare } from './regExp' 4 | 5 | export const resultControl = async (module: DialogLanguageModule, result: any) => { 6 | if (result?.text?.value && result?.context) { 7 | const text = msgPrepare(result.text.value, result.context) 8 | const data: SendMessageData = { 9 | text: text, 10 | sender: 'request', 11 | showRate: result?.text?.showRate, 12 | module: module.name, 13 | } 14 | const wflagHideReply = result.context?.wflag_hide_reply !== '1' 15 | wflagHideReply && text && (await module.uiDispatcher('sendMessage', data)) 16 | } 17 | if (result?.text?.showRate) { 18 | const data: UIManagmentData = { 19 | uiManagmentEvent: 'showRate', 20 | data: true, 21 | } 22 | await module.uiDispatcher('uiManagment', data) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: Node.js Package 5 | 6 | on: 7 | release: 8 | types: [created] 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - uses: actions/setup-node@v1 16 | with: 17 | node-version: 12 18 | - run: npm ci 19 | - run: npm test 20 | 21 | publish-npm: 22 | needs: build 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v2 26 | - uses: actions/setup-node@v1 27 | with: 28 | node-version: 12 29 | registry-url: https://registry.npmjs.org/ 30 | - run: npm ci 31 | - run: npm publish 32 | env: 33 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} 34 | -------------------------------------------------------------------------------- /src/@types/uiEvents.d.ts: -------------------------------------------------------------------------------- 1 | export interface SendMessageData { 2 | text: string 3 | sender: 'user' | 'request' 4 | showRate: boolean 5 | module: string 6 | } 7 | export type UIManagmentEvents = 8 | | 'setUpSender' 9 | | 'setUpHeader' 10 | | 'setUpBadge' 11 | | 'setUpMessage' 12 | | 'setUpDialog' 13 | | 'blockSender' 14 | | 'dialogLoading' 15 | | 'showRate' 16 | | 'showNotification' 17 | export type NotificationsEvents = 'addMessages' | 'addSettings' | 'shown' | 'clicked' | 'enabled' 18 | export interface UIManagmentData { 19 | uiManagmentEvent: UIManagmentEvents 20 | data: any 21 | } 22 | export interface NotificationsData { 23 | notificationEvent: NotificationsEvents 24 | data: any 25 | } 26 | export type ModulesEvents = 'initModule' | 'switchModule' | 'updateModule' | 'getModuleConfig' 27 | export interface ModulesData { 28 | modulesEvent: ModulesEvents 29 | data: any 30 | } 31 | export type UiEventsNames = 'sendMessage' | 'uiManagment' | 'notifications' | 'modules' 32 | export type UiEventsData = SendMessageData | UIManagmentData | NotificationsData | ModulesData 33 | -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | import { DialogLanguageInfo, ModuleEvents, UiEvents, DialogLanguageConfig, DialogLanguageApi } from "../@types/dialogLanguage"; 2 | import { ChatInitData, ChatEventData, ChatRequestData, SetInfoData, ModuleEventsNames, ChatRateData, ChatTrackData, ChatTimerAnnouncementsRequestData, NotificationDisplayData } from "../@types/moduleEvents"; 3 | import { UiEventsNames, UiEventsData } from "../@types/uiEvents"; 4 | import { DialogLanguageConfig as DialogLanguageConfig$0 } from './@types/dialogLanguage'; 5 | declare class DialogLanguageModule { 6 | name: string; 7 | ckStore?: any; 8 | api: DialogLanguageApi; 9 | info: DialogLanguageInfo; 10 | moduleEvents: ModuleEvents; 11 | uiEvents: UiEvents; 12 | constructor(config: DialogLanguageConfig); 13 | moduleDispatcher: (event: ModuleEventsNames, data?: SetInfoData | ChatInitData | ChatRequestData | ChatEventData | ChatRateData | ChatTrackData | NotificationDisplayData | ChatTimerAnnouncementsRequestData | undefined) => Promise; 14 | uiDispatcher: (event: UiEventsNames, data: UiEventsData) => void; 15 | } 16 | declare const ckModuleInit: (config: DialogLanguageConfig$0) => DialogLanguageModule; 17 | export { ckModuleInit as default }; 18 | -------------------------------------------------------------------------------- /dist/index.es.d.ts: -------------------------------------------------------------------------------- 1 | import { DialogLanguageInfo, ModuleEvents, UiEvents, DialogLanguageConfig, DialogLanguageApi } from "../@types/dialogLanguage"; 2 | import { ChatInitData, ChatEventData, ChatRequestData, SetInfoData, ModuleEventsNames, ChatRateData, ChatTrackData, ChatTimerAnnouncementsRequestData, NotificationDisplayData } from "../@types/moduleEvents"; 3 | import { UiEventsNames, UiEventsData } from "../@types/uiEvents"; 4 | import { DialogLanguageConfig as DialogLanguageConfig$0 } from './@types/dialogLanguage'; 5 | declare class DialogLanguageModule { 6 | name: string; 7 | ckStore?: any; 8 | api: DialogLanguageApi; 9 | info: DialogLanguageInfo; 10 | moduleEvents: ModuleEvents; 11 | uiEvents: UiEvents; 12 | constructor(config: DialogLanguageConfig); 13 | moduleDispatcher: (event: ModuleEventsNames, data?: SetInfoData | ChatInitData | ChatRequestData | ChatEventData | ChatRateData | ChatTrackData | NotificationDisplayData | ChatTimerAnnouncementsRequestData | undefined) => Promise; 14 | uiDispatcher: (event: UiEventsNames, data: UiEventsData) => void; 15 | } 16 | declare const ckModuleInit: (config: DialogLanguageConfig$0) => DialogLanguageModule; 17 | export { ckModuleInit as default }; 18 | -------------------------------------------------------------------------------- /APImethods/chatEvent.md: -------------------------------------------------------------------------------- 1 | # chatEvent 2 | Chat events 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `chatEvent` and transmits necessary data to that. 7 | 8 | For example: 9 | ```javascript 10 | moduleDispatcher('chatEvent',{eventName: 'ready'}) 11 | ``` 12 | 13 | ## Typical data 14 | ```javascript 15 | ChatEventData { 16 | eventName: 17 | DialogLanguageEventsNames 18 | context?: RandomContext 19 | } 20 | ``` 21 | 22 | ## Example of data 23 | ```javascript 24 | data = { 25 | eventName: 'ready', 26 | } 27 | ``` 28 | 29 | ### options of events 30 | | event | | 31 | |--------------------------|----------------------| 32 | | 'ready' | chat is ready | 33 | | 'inactive' | user is active | 34 | | 'rate' | rate message | 35 | | 'notification' | send notification | 36 | | 'context' | change chat context | 37 | | 'click' | mouse click | 38 | | 'mouse' | move mouse | 39 | | 'operatorStatus' | operator status | 40 | | 'chatState' | chat state | 41 | | 'geolocationTimeout' | geolocation time out | 42 | | 'geolocationDenied' | geolocation denied | 43 | 44 | -------------------------------------------------------------------------------- /src/@types/module.d.ts: -------------------------------------------------------------------------------- 1 | import { 2 | SendMessageData, 3 | UiEventsData, 4 | UiEventsNames, 5 | UIManagmentEvents, 6 | UIManagmentData, 7 | ModulesEvents, 8 | ModulesData, 9 | NotificationsData, 10 | } from './uiEvents' 11 | import { ModuleEventData, SetInfoData, ChatInitData, ChatEventData, ChatRequestData } from './moduleEvents' 12 | 13 | export interface ModuleEvents { 14 | chatRequest: (module: CKModule, data: RandomData) => void 15 | } 16 | export interface UiEventsList { 17 | sendMessage?: (data: SendMessageData, ckStore?: any) => void 18 | uiManagment?: (uiManagmentEvent: UIManagmentEvents, data: UIManagmentData, ckStore?: any) => void 19 | notifications?: (notificationsEvent: NotificationsEvents, data: NotificationsData, ckStore?: any) => void 20 | modules?: (modulesEvent: ModulesEvents, data: ModulesData, ckStore?: any) => void 21 | } 22 | export interface CKModule { 23 | name: string 24 | info: RandomInfo 25 | api: RandomApi 26 | uiEvents: UiEvents 27 | moduleEvents: ModuleEvents 28 | moduleDispatcher: (event: 'chatRequest', data?: ModuleEventData) => void 29 | uiDispatcher: (event: UiEventsNames, data: UiEventsData) => void 30 | } 31 | export interface InitConfig { 32 | info: RandomInfo 33 | customization: RandomInfo 34 | connectToStore: { 35 | getConfig: (moduleName: string) => RandomInfo 36 | } 37 | uiEvents: UiEventsList 38 | } 39 | export interface RandomData { 40 | [key: string]: any 41 | } 42 | export interface RandomInfo { 43 | [key: string]: any 44 | } 45 | export interface RandomApi { 46 | [key: string]: any 47 | } 48 | -------------------------------------------------------------------------------- /src/@types/moduleEvents.d.ts: -------------------------------------------------------------------------------- 1 | import { DialogLanguageEventsNames, DialogLanguageInfo } from './dialogLanguage' 2 | 3 | export interface RandomContext { 4 | [key: string]: any 5 | } 6 | export interface ChatRequestData { 7 | text: string 8 | context?: RandomContext 9 | } 10 | export interface ChatInitData { 11 | moduleInfo?: DialogLanguageInfo 12 | clientConfig: RandomContext 13 | } 14 | export interface SetInfoData { 15 | cuid: string 16 | events: string[] 17 | } 18 | export interface ChatEventData { 19 | eventName: DialogLanguageEventsNames 20 | context?: RandomContext 21 | } 22 | export interface ChatRateData { 23 | rating: number 24 | } 25 | export interface ChatTimerAnnouncementsRequestData { 26 | userActive: boolean 27 | } 28 | export interface NotificationDisplayData { 29 | messageId: number 30 | } 31 | export interface ChatTrackData { 32 | action: string 33 | args: { 34 | id: string 35 | url: string 36 | text: string 37 | } 38 | } 39 | 40 | export type ModuleEventsNames = 41 | | 'chatInit' 42 | | 'chatRequest' 43 | | 'setInfo' 44 | | 'chatEvent' 45 | | 'chatRate' 46 | | 'chatTimerAnnouncementsRequest' 47 | | 'chatUpdate' 48 | | 'notificationDisplay' 49 | | 'notificationRequest' 50 | | 'liveChatOperatorsCheckRequest' 51 | | 'geoLocationRequest' 52 | | 'chatTrack' 53 | | 'reset' 54 | 55 | export type ModuleEventsData = 56 | | ChatRequestData 57 | | ChatEventData 58 | | ChatInitData 59 | | SetInfoData 60 | | ChatRateData 61 | | ChatTimerAnnouncementsRequestData 62 | | NotificationDisplayData 63 | | ChatTrackData 64 | 65 | -------------------------------------------------------------------------------- /APImethods/chatTrack.md: -------------------------------------------------------------------------------- 1 | # chatTrack 2 | Show specific text when you hover over a link 3 | 4 | ## Call of method 5 | `moduleDispatcher` - method of event management. 6 | `moduleDispatcher` switches to the selected method `chatTrack` and transmits necessary data to that. 7 | 8 | For example: 9 | ```javascript 10 | moduleDispatcher('chatTrack',{ 11 | action: 'click', 12 | args: { 13 | id: '1', 14 | url: 'nano.com', 15 | text: 'helloWorld' 16 | } 17 | }) 18 | ``` 19 | 20 | ## Typical data 21 | ```javascript 22 | ChatTrackData { 23 | action: string 24 | args: { 25 | id: string 26 | url: string 27 | text: string 28 | } 29 | } 30 | ``` 31 | 32 | ## Example of data 33 | ```javascript 34 | data = { 35 | action: 'click', 36 | args: { 37 | id: '1', 38 | url: 'nano.com', 39 | text: 'helloWorld' 40 | } 41 | } 42 | ``` 43 | 44 | ### options of actions 45 | | event | | 46 | |--------------------------|----------------------| 47 | | 'ready' | chat is ready | 48 | | 'inactive' | user is active | 49 | | 'rate' | rate message | 50 | | 'notification' | send notification | 51 | | 'context' | change chat context | 52 | | 'click' | mouse click | 53 | | 'mouse' | move mouse | 54 | | 'operatorStatus' | operator status | 55 | | 'chatState' | chat state | 56 | | 'geolocationTimeout' | geolocation time out | 57 | | 'geolocationDenied' | geolocation denied | 58 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import typescript from '@wessberg/rollup-plugin-ts' 2 | import commonjs from '@rollup/plugin-commonjs' 3 | import peerDepsExternal from 'rollup-plugin-peer-deps-external' 4 | import resolve from '@rollup/plugin-node-resolve' 5 | import replace from '@rollup/plugin-replace' 6 | import dotenv from 'dotenv' 7 | dotenv.config() 8 | import pkg from './package.json' 9 | const { 10 | INF_API_URL, 11 | GEO_LACATION_API_URL, 12 | LIVE_CHAT_OPERATORS_API_URL, 13 | NOTIFICATIONS_API_URL, 14 | CHAT_TIMER_ANNOUNCEMENTS_API_URL, 15 | CHAT_UPDATE_API_URL, 16 | } = process.env 17 | export default { 18 | input: 'src/index.ts', 19 | output: [ 20 | { 21 | file: pkg.main, 22 | format: 'cjs', 23 | exports: 'named', 24 | sourcemap: true, 25 | }, 26 | { 27 | file: pkg.module, 28 | format: 'es', 29 | exports: 'named', 30 | sourcemap: true, 31 | }, 32 | ], 33 | plugins: [ 34 | replace({ 35 | process: JSON.stringify({ 36 | env: { 37 | INF_API_URL: INF_API_URL? INF_API_URL: '', 38 | GEO_LACATION_API_URL: GEO_LACATION_API_URL? GEO_LACATION_API_URL: '', 39 | LIVE_CHAT_OPERATORS_API_URL: LIVE_CHAT_OPERATORS_API_URL? LIVE_CHAT_OPERATORS_API_URL: '', 40 | NOTIFICATIONS_API_URL: NOTIFICATIONS_API_URL? NOTIFICATIONS_API_URL: '', 41 | CHAT_TIMER_ANNOUNCEMENTS_API_URL: CHAT_TIMER_ANNOUNCEMENTS_API_URL? CHAT_TIMER_ANNOUNCEMENTS_API_URL: '', 42 | CHAT_UPDATE_API_URL: CHAT_UPDATE_API_URL? CHAT_UPDATE_API_URL: '', 43 | }, 44 | }), 45 | }), 46 | peerDepsExternal(), 47 | resolve(), 48 | typescript(), 49 | commonjs(), 50 | ], 51 | } 52 | -------------------------------------------------------------------------------- /src/utils/regExp.ts: -------------------------------------------------------------------------------- 1 | const msgRegExpReplace = { 2 | links: { 3 | regexp: /href="event:/gim, 4 | replace: 'data-type="outbound" rel="noopener noreferrer" href="', 5 | }, 6 | userLinks: { 7 | regexp: /]*(?!data-request))?(data-request="([^"]+)?")?>(.*?)<\/userlink>/gim, 8 | replace: "$4", 9 | }, 10 | newPara: { 11 | regexp: / \(NEW_PARA\)|\(NEW_PARA\)/gim, 12 | replace: '', 13 | }, 14 | newParaButtons: { 15 | regexp: / \(NEW_PARA\)(.*)|\(NEW_PARA\)(.*)/gim, 16 | replace: "$1$2", 17 | }, 18 | userLinksAsButtons: { 19 | regexp: /]*(?!data-request))?(data-request="([^"]+)?")?>(.*?)<\/userlink>/gim, 20 | replace: "$4", 21 | }, 22 | } 23 | 24 | const links = msgRegExpReplace.links 25 | const userLinks = msgRegExpReplace.userLinks 26 | const userLinksAsButtons = msgRegExpReplace.userLinksAsButtons 27 | const newPara = msgRegExpReplace.newPara 28 | const newParaButtons = msgRegExpReplace.newParaButtons 29 | 30 | const msgPrepare = (text: string, context: any) => { 31 | if (/UserLinkAsButton/gim.test(context?.wcmd_show_mode)) { 32 | if (/\(NEW_PARA\)/gim.test(context?.wcmd_show_mode)) { 33 | return text 34 | .replace(links?.regexp, links?.replace) 35 | .replace(newParaButtons?.regexp, newParaButtons?.replace) 36 | .replace(userLinks?.regexp, userLinks?.replace) 37 | } else { 38 | return text 39 | .replace(links?.regexp, links?.replace) 40 | .replace(newPara?.regexp, newPara?.replace) 41 | .replace(userLinksAsButtons?.regexp, userLinksAsButtons?.replace) 42 | } 43 | } 44 | return text 45 | .replace(links?.regexp, links?.replace) 46 | .replace(newPara?.regexp, newPara?.replace) 47 | .replace(userLinks?.regexp, userLinks?.replace) 48 | } 49 | 50 | export { msgPrepare } 51 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ck-dialog-language", 3 | "version": "0.2.0", 4 | "description": "SOVA dialog module", 5 | "homepage": "https://sova.ai", 6 | "authors": [ 7 | { 8 | "name": "sova.ai", 9 | "gitHub": "https://github.com/sovaai" 10 | } 11 | ], 12 | "files": [ 13 | "dist" 14 | ], 15 | "main": "dist/index.js", 16 | "module": "dist/index.es.js", 17 | "engines": { 18 | "node": ">=10", 19 | "npm": ">=5" 20 | }, 21 | "scripts": { 22 | "start": "rollup -c -w", 23 | "build": "rollup -c", 24 | "commit-all": "git add . && git-cz", 25 | "changelog": "./node_modules/.bin/conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md" 26 | }, 27 | "keywords": [ 28 | "SOVA", 29 | "chat-kit-module" 30 | ], 31 | "license": "Apache-2.0", 32 | "peerDependencies": {}, 33 | "devDependencies": { 34 | "@rollup/plugin-commonjs": "^11.0.2", 35 | "@rollup/plugin-node-resolve": "^7.1.1", 36 | "@rollup/plugin-replace": "^2.3.3", 37 | "@types/node": "^13.9.2", 38 | "@typescript-eslint/eslint-plugin": "^2.24.0", 39 | "@typescript-eslint/parser": "^2.24.0", 40 | "@wessberg/rollup-plugin-ts": "^1.2.23", 41 | "commitizen": "^4.0.3", 42 | "conventional-changelog-cli": "^2.0.31", 43 | "cz-conventional-changelog": "^3.1.0", 44 | "dotenv": "^8.2.0", 45 | "eslint": "^6.8.0", 46 | "eslint-config-prettier": "^6.10.1", 47 | "eslint-config-react": "^1.1.7", 48 | "eslint-plugin-prettier": "^3.1.2", 49 | "immutable": "^4.0.0-rc.12", 50 | "jest": "^25.1.0", 51 | "prettier": "^1.19.1", 52 | "rollup": "^2.1.0", 53 | "rollup-plugin-peer-deps-external": "^2.2.2", 54 | "ts-jest": "^25.2.1", 55 | "ts-loader": "^6.2.2", 56 | "typescript": "^3.8.3" 57 | }, 58 | "repository": { 59 | "type": "git", 60 | "url": "git@github.com:sovaai/chatKit-dl-module.git" 61 | }, 62 | "config": { 63 | "commitizen": { 64 | "path": "./node_modules/cz-conventional-changelog" 65 | } 66 | }, 67 | "dependencies": {} 68 | } 69 | -------------------------------------------------------------------------------- /src/utils/helpers.ts: -------------------------------------------------------------------------------- 1 | import { DialogLanguageEvents } from '../@types/dialogLanguage' 2 | export interface EventList { 3 | [key: string]: string 4 | } 5 | export const eventList: EventList = { 6 | '00b2fcbe-f27f-437b-a0d5-91072d840ed3': 'ready', 7 | '29e75851-6cae-44f4-8a9c-f6489c4dca88': 'inactive', 8 | '11d10788-4789-11e3-9b0b-080027ab4d7b': 'rate', 9 | 'bffaa961-9ad3-4ecd-9254-f9e2fc06f28c': 'notification', 10 | '7330d8fc-4c64-11e3-af49-080027ab4d7b': 'context', 11 | 'd825476d-bc08-4038-9ecf-e6b2b267c7b8': 'click', 12 | '6819087d-a7d0-4c67-acd4-47d40b233cc9': 'mouse', 13 | '2bbff8e2-3c75-4f4b-bd61-c29017257c00': 'cardReady', 14 | '4e729f9a-0aa2-4d37-87d2-bed2b2b39c00': 'operatorStatus', 15 | 'c189c2f1-43b6-424b-866b-03e562ba9d33': 'chatState', 16 | '409b58e1-595b-4c02-81be-3f31dfe4639d': 'geolocationTimeout', 17 | 'b92e3bcc-44b5-4019-9594-54b69afdaf77': 'geolocationDenied', 18 | } 19 | export const postFetch = async (body: any, url: string) => { 20 | try { 21 | const fetchResponse = await fetch(url, { 22 | method: 'POST', 23 | body: JSON.stringify(body), 24 | }) 25 | const fetchResult = await fetchResponse.json() 26 | return fetchResult.result 27 | } catch (error) { 28 | console.log(error) 29 | } 30 | } 31 | export const postFetchWithHeaders = async (body: any, url: string) => { 32 | try { 33 | const fetchResponse = await fetch(url, { 34 | headers: { 35 | Accept: 'application/json', 36 | 'Content-Type': 'application/json', 37 | }, 38 | method: 'POST', 39 | body: JSON.stringify(body), 40 | }) 41 | const fetchResult = await fetchResponse.json() 42 | return fetchResult 43 | } catch (error) { 44 | console.log(error) 45 | } 46 | } 47 | 48 | export const eventsParser = (activeEvents: string[]) => { 49 | const events: DialogLanguageEvents = {} 50 | activeEvents.forEach(activeEvent => { 51 | const eventName = eventList[activeEvent] 52 | events[eventName] = activeEvent 53 | }) 54 | 55 | return events 56 | } 57 | export const isDevice = () => window && window.innerWidth && window.innerWidth < 1025 58 | -------------------------------------------------------------------------------- /src/@types/dialogLanguage.d.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ModuleEventsData, 3 | ChatInitData, 4 | ChatRequestData, 5 | ChatEventData, 6 | SetInfoData, 7 | ChatRateData, 8 | ChatTrackData, 9 | NotificationDisplayData, 10 | ChatTimerAnnouncementsRequestData, 11 | ModuleEventsNames, 12 | } from './moduleEvents' 13 | import { 14 | SendMessageData, 15 | UiData, 16 | NotificationsEvents, 17 | NotificationsData, 18 | UIManagmentData, 19 | ModulesEvents, 20 | ModulesData, 21 | } from './uiEvents' 22 | import { CKModule, InitConfig, UiEventsList } from './module' 23 | export interface DialogLanguageInfo { 24 | uuid: string 25 | cuid: string 26 | events: DialogLanguageEvents 27 | } 28 | export interface DialogLanguageApi { 29 | infApiUrl: string 30 | geoLocationApiUrl: string 31 | liveChatOperatorsApiUrl: string 32 | notificationsApiUrl: string 33 | chatTimerAnnouncementsApiUrl: string 34 | chatUpdateApiUrl: string 35 | } 36 | export type DialogLanguageEventsNames = 37 | | 'ready' 38 | | 'inactive' 39 | | 'rate' 40 | | 'notification' 41 | | 'context' 42 | | 'click' 43 | | 'mouse' 44 | | 'cardReady' 45 | | 'operatorStatus' 46 | | 'chatState' 47 | | 'geolocationTimeout' 48 | | 'geolocationDenied' 49 | export interface DialogLanguageEvents { 50 | ready?: { 51 | euid: '00b2fcbe-f27f-437b-a0d5-91072d840ed3' 52 | sended: boolean 53 | } 54 | inactive?: { euid: '29e75851-6cae-44f4-8a9c-f6489c4dca88' } 55 | rate?: { euid: '11d10788-4789-11e3-9b0b-080027ab4d7b' } 56 | notification?: { euid: 'bffaa961-9ad3-4ecd-9254-f9e2fc06f28c' } 57 | context?: { euid: '7330d8fc-4c64-11e3-af49-080027ab4d7b' } 58 | click?: { euid: 'd825476d-bc08-4038-9ecf-e6b2b267c7b8' } 59 | mouse?: { euid: '6819087d-a7d0-4c67-acd4-47d40b233cc9' } 60 | cardReady?: { euid: '2bbff8e2-3c75-4f4b-bd61-c29017257c00' } 61 | operatorStatus?: { euid: '4e729f9a-0aa2-4d37-87d2-bed2b2b39c00' } 62 | chatState?: { euid: 'c189c2f1-43b6-424b-866b-03e562ba9d33' } 63 | geolocationTimeout?: { euid: '409b58e1-595b-4c02-81be-3f31dfe4639d' } 64 | geolocationDenied?: { euid: 'b92e3bcc-44b5-4019-9594-54b69afdaf77' } 65 | [key: string]: string 66 | } 67 | export interface ModuleEvents { 68 | chatInit: (module: DialogLanguageModule, data: ChatInitData) => void 69 | chatRequest: (module: DialogLanguageModule, data: ChatRequestData) => void 70 | chatEvent: (module: DialogLanguageModule, data: ChatEventData) => void 71 | setInfo: (module: DialogLanguageModule, data: SetInfoData) => void 72 | chatRate: (module: DialogLanguageModule, data: ChatRateData) => void 73 | chatTrack: (module: DialogLanguageModule, data: ChatTrackData) => void 74 | geoLocationRequest: (module: DialogLanguageModule) => void 75 | liveChatOperatorsCheckRequest: (module: DialogLanguageModule) => void 76 | notificationRequest: (module: DialogLanguageModule) => void 77 | notificationDisplay: (module: DialogLanguageModule, data: NotificationDisplayData) => void 78 | chatUpdate: (module: DialogLanguageModule) => void 79 | chatTimerAnnouncementsRequest: (module: DialogLanguageModule, data: ChatTimerAnnouncementsRequestData) => void 80 | reset: (module: DialogLanguageModule, data: ChatInitData) => void 81 | } 82 | export interface UiEvents { 83 | sendMessage: (data: SendMessageData, ckStore?: any) => void 84 | uiManagment: (uiManagmentEvent: uiManagmentEvents, data: UIManagmentData, ckStore?: any) => void 85 | notifications: (notificationsEvent: NotificationsEvents, data: NotificationsData, ckStore?: any) => void 86 | modules: (modulesEvent: ModulesEvents, data: ModulesData, ckStore?: any) => void 87 | } 88 | export interface DialogLanguageModule extends CKModule { 89 | info: DialogLanguageInfo 90 | ckStore?: any 91 | moduleEvents: ModuleEvents 92 | api: DialogLanguageApi 93 | uiEvents: UiEvents 94 | moduleDispatcher: (event: ModuleEventsNames, data?: ModuleEventsData) => void 95 | } 96 | export interface DialogLanguageConfig { 97 | info: { 98 | uuid: string 99 | } 100 | api?: { 101 | infApiUrl?: string 102 | geoLocationApiUrl?: string 103 | liveChatOperatorsApiUrl?: string 104 | notificationsApiUrl?: string 105 | chatTimerAnnouncementsApiUrl?: string 106 | chatUpdateApiUrl?: string 107 | } 108 | moduleEvents?: ModuleEvents 109 | uiEvents?: UiEventsList 110 | ckStore?: any 111 | } 112 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **Dialog Language** (DL) is separate module that connects to the widget. It is used to describe scripts and dialog rules. 2 | 3 | ## Install 4 | For install chatKit-dl-module enter next command: 5 | ```javascript 6 | npm i ck-dialog-language 7 | ``` 8 | 9 | ## Quick start 10 | For quick start chatKit-dl-module enter next command: 11 | ```javascript 12 | import ckModuleInit from 'ck-dialog-language' 13 | const dlModule = ckModuleInit(dlConfig) 14 | ``` 15 | 16 | # Description 17 | ## dlConfig 18 | Configuration file includes: 19 | ```javascript 20 | const dlConfig = { 21 | info: { 22 | uuid: string, 23 | }, 24 | api?: { 25 | infApiUrl?: string, 26 | geoLocationApiUrl?: string, 27 | liveChatOperatorsApiUrl?: string, 28 | notificationsApiUrl?: string, 29 | chatTimerAnnouncementsApiUrl?: string, 30 | chatUpdateApiUrl?: string, 31 | }, 32 | moduleEvents?: { 33 | chatInit: (module: DialogLanguageModule, data: ChatInitData) => void, 34 | chatRequest: (module: DialogLanguageModule, data: ChatRequestData) => void, 35 | chatEvent: (module: DialogLanguageModule, data: ChatEventData) => void, 36 | setInfo: (module: DialogLanguageModule, data: SetInfoData) => void, 37 | chatRate: (module: DialogLanguageModule, data: ChatRateData) => void, 38 | chatTrack: (module: DialogLanguageModule, data: ChatTrackData) => void, 39 | geoLocationRequest: (module: DialogLanguageModule) => void, 40 | liveChatOperatorsCheckRequest: (module: DialogLanguageModule) => void, 41 | notificationRequest: (module: DialogLanguageModule) => void, 42 | notificationDisplay: (module: DialogLanguageModule, data: NotificationDisplayData) => void, 43 | chatUpdate: (module: DialogLanguageModule) => void, 44 | chatTimerAnnouncementsRequest: (module: DialogLanguageModule, data: ChatTimerAnnouncementsRequestData) => void, 45 | reset: (module: DialogLanguageModule, data: ChatInitData) => void, 46 | }, 47 | uiEvents?: { 48 | sendMessage?: (data: SendMessageData) => void, 49 | uiManagment?: (uiManagmentEvent: UIManagmentEvents, data: UIManagmentData) => void, 50 | notifications?: (notificationsEvent: NotificationsEvents, data: NotificationsData) => void, 51 | modules?: (modulesEvent: ModulesEvents , data: ModulesData)=> void, 52 | } 53 | } 54 | ``` 55 | 56 | ## API methods 57 | `Dialog Language` has next API methods: 58 | 59 | | API method | | 60 | |-------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------| 61 | | [chatInit](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/chatInit.md "Read about this method") | Dialog Initialization | 62 | | [chatRequest](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/chatRequest.md "Read about this method") | Sending user messages | 63 | | [setInfo](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/setInfo.md "Read about this method") | Get information about events | 64 | | [chatEvent](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/chatEvent.md "Read about this method") | Chat events | 65 | | [chatRate](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/chatRate.md "Read about this method") | Rating of the all dialogue | 66 | | [chatTimerAnnouncementsRequest](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/chatTimerAnnouncementsRequest.md "Read about this method") | Announcement activation by timer | 67 | | [chatUpdate](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/chatUpdate.md "Read about this method") | Updating the widget | 68 | | [notificationDisplay](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/notificationDisplay.md "Read about this method") | Displaying a specific notification | 69 | | [notificationRequest](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/notificationRequest.md "Read about this method") | Notification display request | 70 | | [liveChatOperatorsCheckRequest](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/liveChatOperatorsCheckRequest.md "Read about this method") | Request to switch to operator | 71 | | [geoLocationRequest](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/geoLocationRequest.md "Read about this method") | Geolocation request | 72 | | [chatTrack](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/chatTrack.md "Read about this method") | Show specific text when you hover over a link | 73 | | [reset](https://github.com/sovaai/chatKit-dl-module/blob/master/APImethods/reset.md "Read about this method") | Reset dialogue | 74 | 75 | 76 | ## DL.ModuleDispatcher 77 | `moduleDispatcher` - method of event management. 78 | `moduleDispatcher` select method and transmits necessary data to it. 79 | 80 | For example: 81 | ```javascript 82 | import moduleInit from 'SOVA-dlModule' 83 | const dlModule = moduleInit(dlConfig) 84 | dlModule.moduleDispatcher('chatInit', { clientConfig: { siteLang: 'ru' } }) 85 | ``` 86 | -------------------------------------------------------------------------------- /src/module/DialogLanguage.ts: -------------------------------------------------------------------------------- 1 | import { 2 | DialogLanguageInfo, 3 | ModuleEvents, 4 | UiEvents, 5 | DialogLanguageConfig, 6 | DialogLanguageApi, 7 | } from '../@types/dialogLanguage' 8 | 9 | import { 10 | ModuleEventsData, 11 | ChatInitData, 12 | ChatEventData, 13 | ChatRequestData, 14 | SetInfoData, 15 | ModuleEventsNames, 16 | ChatRateData, 17 | ChatTrackData, 18 | ChatTimerAnnouncementsRequestData, 19 | NotificationDisplayData, 20 | } from '../@types/moduleEvents' 21 | import { 22 | UiEventsNames, 23 | UiEventsData, 24 | SendMessageData, 25 | UIManagmentData, 26 | NotificationsData, 27 | ModulesData, 28 | } from '../@types/uiEvents' 29 | import { defaultSendMessage, defaultUIManagment, defaultNotifications, defaultModules } from '../events/defaultUiEvents' 30 | import { 31 | setInfo, 32 | chatInit, 33 | chatEvent, 34 | chatRequest, 35 | chatRate, 36 | chatTrack, 37 | geoLocationRequest, 38 | liveChatOperatorsCheckRequest, 39 | notificationRequest, 40 | notificationDisplay, 41 | chatUpdate, 42 | chatTimerAnnouncementsRequest, 43 | reset, 44 | } from '../events/moduleEvents' 45 | const { 46 | INF_API_URL, 47 | GEO_LACATION_API_URL, 48 | LIVE_CHAT_OPERATORS_API_URL, 49 | NOTIFICATIONS_API_URL, 50 | CHAT_TIMER_ANNOUNCEMENTS_API_URL, 51 | CHAT_UPDATE_API_URL, 52 | } = process.env 53 | class DialogLanguageModule { 54 | name: string 55 | ckStore?: any 56 | api: DialogLanguageApi 57 | info: DialogLanguageInfo 58 | moduleEvents: ModuleEvents 59 | uiEvents: UiEvents 60 | constructor(config: DialogLanguageConfig) { 61 | const { info, api, moduleEvents, uiEvents, ckStore } = config 62 | this.name = 'dialogLanguage' 63 | this.ckStore = ckStore 64 | this.info = { 65 | cuid: '', 66 | uuid: info.uuid, 67 | events: {}, 68 | } 69 | this.api = { 70 | infApiUrl: api?.infApiUrl || INF_API_URL || '', 71 | geoLocationApiUrl: api?.geoLocationApiUrl || GEO_LACATION_API_URL || '', 72 | liveChatOperatorsApiUrl: api?.liveChatOperatorsApiUrl || `${LIVE_CHAT_OPERATORS_API_URL}=${document.URL}` || ``, 73 | notificationsApiUrl: api?.notificationsApiUrl || `${NOTIFICATIONS_API_URL}${this.info.uuid}.json` || ``, 74 | chatTimerAnnouncementsApiUrl: api?.chatTimerAnnouncementsApiUrl || CHAT_TIMER_ANNOUNCEMENTS_API_URL || '', 75 | chatUpdateApiUrl: api?.chatUpdateApiUrl || CHAT_UPDATE_API_URL || '', 76 | } 77 | this.uiEvents = { 78 | sendMessage: uiEvents?.sendMessage || defaultSendMessage, 79 | uiManagment: uiEvents?.uiManagment || defaultUIManagment, 80 | notifications: uiEvents?.notifications || defaultNotifications, 81 | modules: uiEvents?.modules || defaultModules, 82 | } 83 | this.moduleEvents = { 84 | setInfo: moduleEvents?.setInfo || setInfo, 85 | chatInit: moduleEvents?.chatInit || chatInit, 86 | chatEvent: moduleEvents?.chatEvent || chatEvent, 87 | chatRequest: moduleEvents?.chatRequest || chatRequest, 88 | chatRate: moduleEvents?.chatRate || chatRate, 89 | chatTrack: moduleEvents?.chatTrack || chatTrack, 90 | geoLocationRequest: moduleEvents?.geoLocationRequest || geoLocationRequest, 91 | liveChatOperatorsCheckRequest: moduleEvents?.liveChatOperatorsCheckRequest || liveChatOperatorsCheckRequest, 92 | notificationRequest: moduleEvents?.notificationRequest || notificationRequest, 93 | notificationDisplay: moduleEvents?.notificationDisplay || notificationDisplay, 94 | chatUpdate: moduleEvents?.chatUpdate || chatUpdate, 95 | chatTimerAnnouncementsRequest: moduleEvents?.chatTimerAnnouncementsRequest || chatTimerAnnouncementsRequest, 96 | reset: moduleEvents?.reset || reset, 97 | } 98 | } 99 | moduleDispatcher = async (event: ModuleEventsNames, data?: ModuleEventsData) => { 100 | event === 'chatInit' && data && (await this.moduleEvents[event](this, data as ChatInitData)) 101 | event === 'chatEvent' && data && (await this.moduleEvents[event](this, data as ChatEventData)) 102 | event === 'chatRequest' && data && (await this.moduleEvents[event](this, data as ChatRequestData)) 103 | event === 'setInfo' && data && (await this.moduleEvents[event](this, data as SetInfoData)) 104 | event === 'chatRate' && data && (await this.moduleEvents[event](this, data as ChatRateData)) 105 | event === 'chatTrack' && data && (await this.moduleEvents[event](this, data as ChatTrackData)) 106 | event === 'chatUpdate' && (await this.moduleEvents[event](this)) 107 | event === 'chatTimerAnnouncementsRequest' && 108 | data && 109 | (await this.moduleEvents[event](this, data as ChatTimerAnnouncementsRequestData)) 110 | event === 'notificationDisplay' && data && (await this.moduleEvents[event](this, data as NotificationDisplayData)) 111 | event === 'notificationRequest' && (await this.moduleEvents[event](this)) 112 | event === 'geoLocationRequest' && (await this.moduleEvents[event](this)) 113 | event === 'liveChatOperatorsCheckRequest' && (await this.moduleEvents[event](this)) 114 | event === 'reset' && (await this.moduleEvents[event](this, data as ChatInitData)) 115 | } 116 | uiDispatcher = (event: UiEventsNames, data: UiEventsData) => { 117 | event === 'sendMessage' && this.uiEvents[event](data as SendMessageData, this.ckStore) 118 | event === 'uiManagment' && 119 | this.uiEvents[event]((data as UIManagmentData).uiManagmentEvent, (data as UIManagmentData).data, this.ckStore) 120 | event === 'notifications' && 121 | this.uiEvents[event]((data as NotificationsData).notificationEvent, (data as NotificationsData).data, this.ckStore) 122 | event === 'modules' && this.uiEvents[event]((data as ModulesData).modulesEvent, (data as ModulesData).data, this.ckStore) 123 | } 124 | } 125 | export { DialogLanguageModule } 126 | -------------------------------------------------------------------------------- /src/events/moduleEvents.ts: -------------------------------------------------------------------------------- 1 | import { postFetch, isDevice, eventsParser, postFetchWithHeaders } from '../utils/helpers' 2 | 3 | import { 4 | SetInfoData, 5 | ChatInitData, 6 | ChatRequestData, 7 | ChatEventData, 8 | ChatRateData, 9 | ChatTrackData, 10 | NotificationDisplayData, 11 | ChatTimerAnnouncementsRequestData, 12 | } from '../@types/moduleEvents' 13 | import { DialogLanguageModule } from '../@types/dialogLanguage' 14 | import { resultControl } from '../utils/resultControl' 15 | import { announcements } from '../utils/announcements' 16 | import { notifications } from '../utils/notifications' 17 | 18 | export const setInfo = (module: DialogLanguageModule, data: SetInfoData) => { 19 | const { cuid, events } = data 20 | module.info.cuid = cuid 21 | if (!events) return 22 | module.info.events = eventsParser(Object.keys(events)) 23 | } 24 | export const reset = async (module: DialogLanguageModule, data: ChatInitData) => { 25 | await module.moduleDispatcher('chatInit', data) 26 | module.uiDispatcher('modules', { 27 | modulesEvent: 'updateModule', 28 | data: { moduleName: module.name, config: { info: module.info, api: module.api } }, 29 | }) 30 | } 31 | export const chatInit = async (module: DialogLanguageModule, data: ChatInitData) => { 32 | const { uuid } = module.info 33 | const cuid = data?.moduleInfo?.cuid 34 | const events = data?.moduleInfo?.events 35 | const { infApiUrl } = module.api 36 | const { clientConfig } = data 37 | const url = `${infApiUrl}/Chat.init` 38 | const body = { 39 | uuid: uuid, 40 | cuid: cuid || '', 41 | context: { 42 | ...clientConfig, 43 | isDevice: isDevice(), 44 | }, 45 | } 46 | const result = await postFetch(body, url) 47 | const info: SetInfoData = 48 | result?.cuid === cuid 49 | ? { 50 | cuid: cuid || '', 51 | events: events, 52 | } 53 | : { 54 | cuid: result.cuid, 55 | events: result.events, 56 | } 57 | module.moduleDispatcher('setInfo', info) 58 | !(result?.cuid === cuid) && module.moduleDispatcher('chatEvent', { eventName: 'ready', context: {} }) 59 | return resultControl(module, result) 60 | } 61 | 62 | export const chatRequest = async (module: DialogLanguageModule, data: ChatRequestData) => { 63 | const { cuid } = module.info 64 | const { infApiUrl } = module.api 65 | const { text, context } = data 66 | const url = `${infApiUrl}/Chat.request` 67 | const body = { 68 | cuid: cuid, 69 | text: text, 70 | context: { 71 | ...context, 72 | isDevice: isDevice(), 73 | }, 74 | } 75 | const result = await postFetch(body, url) 76 | resultControl(module, result) 77 | } 78 | export const chatEvent = async (module: DialogLanguageModule, data: ChatEventData) => { 79 | const { cuid, events } = module.info 80 | const { infApiUrl } = module.api 81 | let text = '' 82 | const { eventName, context } = data 83 | if (eventName === 'geolocationDenied') text = 'LOCATION DENIED' 84 | if (eventName === 'geolocationTimeout') text = 'REQUEST TIMEOUT ERROR' 85 | const url = `${infApiUrl}/Chat.event` 86 | const body = { 87 | cuid: cuid, 88 | euid: events[eventName] || '00b2fcbe-f27f-437b-a0d5-91072d840ed3', 89 | text, 90 | context: { 91 | ...context, 92 | isDevice: isDevice(), 93 | }, 94 | } 95 | const result = await postFetch(body, url) 96 | console.log(result) 97 | resultControl(module, result) 98 | } 99 | export const chatRate = async (module: DialogLanguageModule, data: ChatRateData) => { 100 | const { cuid } = module.info 101 | const { infApiUrl } = module.api 102 | const { rating } = data 103 | const url = `${infApiUrl}/Chat.rate` 104 | const body = { 105 | cuid: cuid, 106 | rating: rating, 107 | context: { 108 | isDevice: isDevice(), 109 | }, 110 | } 111 | const { result } = await postFetchWithHeaders(body, url) 112 | return resultControl(module, result) 113 | } 114 | 115 | export const chatTrack = async (module: DialogLanguageModule, data: ChatTrackData) => { 116 | const { cuid } = module.info 117 | const { infApiUrl } = module.api 118 | const url = `${infApiUrl}/Chat.track` 119 | const { args, action } = data 120 | const body = { 121 | cuid: cuid, 122 | arguments: args, 123 | action: action, 124 | } 125 | const result = await postFetch(body, url) 126 | return resultControl(module, result) 127 | } 128 | 129 | export const geoLocationRequest = async (module: DialogLanguageModule) => { 130 | try { 131 | const { geoLocationApiUrl } = module.api 132 | const request = await fetch(geoLocationApiUrl) 133 | const content = await request.json() 134 | return content 135 | } catch (error) { 136 | console.log(error) 137 | } 138 | } 139 | export const liveChatOperatorsCheckRequest = async (module: DialogLanguageModule) => { 140 | try { 141 | const { liveChatOperatorsApiUrl } = module.api 142 | const request = await fetch(liveChatOperatorsApiUrl) 143 | const content = await request.json() 144 | return content 145 | } catch (error) { 146 | console.log(error) 147 | } 148 | } 149 | export const notificationRequest = async (module: DialogLanguageModule) => { 150 | const { notificationsApiUrl } = module.api 151 | try { 152 | const request = await fetch(notificationsApiUrl) 153 | const content = await request.json() 154 | return notifications(module, content) 155 | } catch (error) { 156 | console.log(error) 157 | } 158 | } 159 | 160 | export const notificationDisplay = async (module: DialogLanguageModule, data: NotificationDisplayData) => { 161 | const { notificationsApiUrl } = module.api 162 | const { messageId } = data 163 | const url = `${notificationsApiUrl}?a=show&id=${messageId}` 164 | try { 165 | await fetch(url) 166 | } catch (error) { 167 | console.log(error) 168 | } 169 | } 170 | export const chatUpdate = async (module: DialogLanguageModule) => { 171 | const { cuid } = module.info 172 | const { chatUpdateApiUrl } = module.api 173 | const url = `${chatUpdateApiUrl}/Chat.update` 174 | const body = { 175 | cuid: cuid, 176 | } 177 | const { answers } = await postFetch(body, url) 178 | return answers 179 | } 180 | export const chatTimerAnnouncementsRequest = async ( 181 | module: DialogLanguageModule, 182 | data: ChatTimerAnnouncementsRequestData 183 | ) => { 184 | const { cuid } = module.info 185 | const { chatTimerAnnouncementsApiUrl } = module.api 186 | const { userActive } = data 187 | const body = { 188 | cuid: cuid, 189 | user_active: userActive, 190 | } 191 | const { answers } = await postFetch(body, chatTimerAnnouncementsApiUrl) 192 | return announcements(module, answers) 193 | } 194 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [2020] [Virtual Assistant, LLC] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /dist/index.es.js: -------------------------------------------------------------------------------- 1 | /*! ***************************************************************************** 2 | Copyright (c) Microsoft Corporation. 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 9 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 11 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 12 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 13 | PERFORMANCE OF THIS SOFTWARE. 14 | ***************************************************************************** */ 15 | 16 | var __assign = function() { 17 | __assign = Object.assign || function __assign(t) { 18 | for (var s, i = 1, n = arguments.length; i < n; i++) { 19 | s = arguments[i]; 20 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 21 | } 22 | return t; 23 | }; 24 | return __assign.apply(this, arguments); 25 | }; 26 | 27 | function __rest(s, e) { 28 | var t = {}; 29 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 30 | t[p] = s[p]; 31 | if (s != null && typeof Object.getOwnPropertySymbols === "function") 32 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 33 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 34 | t[p[i]] = s[p[i]]; 35 | } 36 | return t; 37 | } 38 | 39 | function __awaiter(thisArg, _arguments, P, generator) { 40 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 41 | return new (P || (P = Promise))(function (resolve, reject) { 42 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 43 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 44 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 45 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 46 | }); 47 | } 48 | 49 | function __generator(thisArg, body) { 50 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; 51 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 52 | function verb(n) { return function (v) { return step([n, v]); }; } 53 | function step(op) { 54 | if (f) throw new TypeError("Generator is already executing."); 55 | while (_) try { 56 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 57 | if (y = 0, t) op = [op[0] & 2, t.value]; 58 | switch (op[0]) { 59 | case 0: case 1: t = op; break; 60 | case 4: _.label++; return { value: op[1], done: false }; 61 | case 5: _.label++; y = op[1]; op = [0]; continue; 62 | case 7: op = _.ops.pop(); _.trys.pop(); continue; 63 | default: 64 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 65 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 66 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 67 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 68 | if (t[2]) _.ops.pop(); 69 | _.trys.pop(); continue; 70 | } 71 | op = body.call(thisArg, _); 72 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 73 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 74 | } 75 | } 76 | 77 | var defaultSendMessage = function (data) { return console.log('no SendMessage'); }; 78 | var defaultUIManagment = function (uiManagmentEvent, data) { return console.log('no UIManagment'); }; 79 | var defaultNotifications = function (notificationsEvent, data) { 80 | return console.log('no Notifications'); 81 | }; 82 | var defaultModules = function (notificationsEvent, data) { return console.log('no modules'); }; 83 | 84 | var eventList = { 85 | '00b2fcbe-f27f-437b-a0d5-91072d840ed3': 'ready', 86 | '29e75851-6cae-44f4-8a9c-f6489c4dca88': 'inactive', 87 | '11d10788-4789-11e3-9b0b-080027ab4d7b': 'rate', 88 | 'bffaa961-9ad3-4ecd-9254-f9e2fc06f28c': 'notification', 89 | '7330d8fc-4c64-11e3-af49-080027ab4d7b': 'context', 90 | 'd825476d-bc08-4038-9ecf-e6b2b267c7b8': 'click', 91 | '6819087d-a7d0-4c67-acd4-47d40b233cc9': 'mouse', 92 | '2bbff8e2-3c75-4f4b-bd61-c29017257c00': 'cardReady', 93 | '4e729f9a-0aa2-4d37-87d2-bed2b2b39c00': 'operatorStatus', 94 | 'c189c2f1-43b6-424b-866b-03e562ba9d33': 'chatState', 95 | '409b58e1-595b-4c02-81be-3f31dfe4639d': 'geolocationTimeout', 96 | 'b92e3bcc-44b5-4019-9594-54b69afdaf77': 'geolocationDenied', 97 | }; 98 | var postFetch = function (body, url) { return __awaiter(void 0, void 0, void 0, function () { 99 | var fetchResponse, fetchResult, error_1; 100 | return __generator(this, function (_a) { 101 | switch (_a.label) { 102 | case 0: 103 | _a.trys.push([0, 3, , 4]); 104 | return [4 /*yield*/, fetch(url, { 105 | method: 'POST', 106 | body: JSON.stringify(body), 107 | })]; 108 | case 1: 109 | fetchResponse = _a.sent(); 110 | return [4 /*yield*/, fetchResponse.json()]; 111 | case 2: 112 | fetchResult = _a.sent(); 113 | return [2 /*return*/, fetchResult.result]; 114 | case 3: 115 | error_1 = _a.sent(); 116 | console.log(error_1); 117 | return [3 /*break*/, 4]; 118 | case 4: return [2 /*return*/]; 119 | } 120 | }); 121 | }); }; 122 | var postFetchWithHeaders = function (body, url) { return __awaiter(void 0, void 0, void 0, function () { 123 | var fetchResponse, fetchResult, error_2; 124 | return __generator(this, function (_a) { 125 | switch (_a.label) { 126 | case 0: 127 | _a.trys.push([0, 3, , 4]); 128 | return [4 /*yield*/, fetch(url, { 129 | headers: { 130 | Accept: 'application/json', 131 | 'Content-Type': 'application/json', 132 | }, 133 | method: 'POST', 134 | body: JSON.stringify(body), 135 | })]; 136 | case 1: 137 | fetchResponse = _a.sent(); 138 | return [4 /*yield*/, fetchResponse.json()]; 139 | case 2: 140 | fetchResult = _a.sent(); 141 | return [2 /*return*/, fetchResult]; 142 | case 3: 143 | error_2 = _a.sent(); 144 | console.log(error_2); 145 | return [3 /*break*/, 4]; 146 | case 4: return [2 /*return*/]; 147 | } 148 | }); 149 | }); }; 150 | var eventsParser = function (activeEvents) { 151 | var events = {}; 152 | activeEvents.forEach(function (activeEvent) { 153 | var eventName = eventList[activeEvent]; 154 | events[eventName] = activeEvent; 155 | }); 156 | return events; 157 | }; 158 | var isDevice = function () { return window && window.innerWidth && window.innerWidth < 1025; }; 159 | 160 | var msgRegExpReplace = { 161 | links: { 162 | regexp: /href="event:/gim, 163 | replace: 'data-type="outbound" rel="noopener noreferrer" href="', 164 | }, 165 | userLinks: { 166 | regexp: /]*(?!data-request))?(data-request="([^"]+)?")?>(.*?)<\/userlink>/gim, 167 | replace: "$4", 168 | }, 169 | newPara: { 170 | regexp: / \(NEW_PARA\)|\(NEW_PARA\)/gim, 171 | replace: '', 172 | }, 173 | newParaButtons: { 174 | regexp: / \(NEW_PARA\)(.*)|\(NEW_PARA\)(.*)/gim, 175 | replace: "$1$2", 176 | }, 177 | userLinksAsButtons: { 178 | regexp: /]*(?!data-request))?(data-request="([^"]+)?")?>(.*?)<\/userlink>/gim, 179 | replace: "$4", 180 | }, 181 | }; 182 | var links = msgRegExpReplace.links; 183 | var userLinks = msgRegExpReplace.userLinks; 184 | var userLinksAsButtons = msgRegExpReplace.userLinksAsButtons; 185 | var newPara = msgRegExpReplace.newPara; 186 | var newParaButtons = msgRegExpReplace.newParaButtons; 187 | var msgPrepare = function (text, context) { 188 | if (/UserLinkAsButton/gim.test(context === null || context === void 0 ? void 0 : context.wcmd_show_mode)) { 189 | if (/\(NEW_PARA\)/gim.test(context === null || context === void 0 ? void 0 : context.wcmd_show_mode)) { 190 | return text 191 | .replace(links === null || links === void 0 ? void 0 : links.regexp, links === null || links === void 0 ? void 0 : links.replace) 192 | .replace(newParaButtons === null || newParaButtons === void 0 ? void 0 : newParaButtons.regexp, newParaButtons === null || newParaButtons === void 0 ? void 0 : newParaButtons.replace) 193 | .replace(userLinks === null || userLinks === void 0 ? void 0 : userLinks.regexp, userLinks === null || userLinks === void 0 ? void 0 : userLinks.replace); 194 | } 195 | else { 196 | return text 197 | .replace(links === null || links === void 0 ? void 0 : links.regexp, links === null || links === void 0 ? void 0 : links.replace) 198 | .replace(newPara === null || newPara === void 0 ? void 0 : newPara.regexp, newPara === null || newPara === void 0 ? void 0 : newPara.replace) 199 | .replace(userLinksAsButtons === null || userLinksAsButtons === void 0 ? void 0 : userLinksAsButtons.regexp, userLinksAsButtons === null || userLinksAsButtons === void 0 ? void 0 : userLinksAsButtons.replace); 200 | } 201 | } 202 | return text 203 | .replace(links === null || links === void 0 ? void 0 : links.regexp, links === null || links === void 0 ? void 0 : links.replace) 204 | .replace(newPara === null || newPara === void 0 ? void 0 : newPara.regexp, newPara === null || newPara === void 0 ? void 0 : newPara.replace) 205 | .replace(userLinks === null || userLinks === void 0 ? void 0 : userLinks.regexp, userLinks === null || userLinks === void 0 ? void 0 : userLinks.replace); 206 | }; 207 | 208 | var resultControl = function (module, result) { return __awaiter(void 0, void 0, void 0, function () { 209 | var text, data, wflagHideReply, _a, data; 210 | var _b, _c, _d, _e; 211 | return __generator(this, function (_f) { 212 | switch (_f.label) { 213 | case 0: 214 | if (!(((_b = result === null || result === void 0 ? void 0 : result.text) === null || _b === void 0 ? void 0 : _b.value) && (result === null || result === void 0 ? void 0 : result.context))) return [3 /*break*/, 3]; 215 | text = msgPrepare(result.text.value, result.context); 216 | data = { 217 | text: text, 218 | sender: 'request', 219 | showRate: (_c = result === null || result === void 0 ? void 0 : result.text) === null || _c === void 0 ? void 0 : _c.showRate, 220 | module: module.name, 221 | }; 222 | wflagHideReply = ((_d = result.context) === null || _d === void 0 ? void 0 : _d.wflag_hide_reply) !== '1'; 223 | _a = wflagHideReply && text; 224 | if (!_a) return [3 /*break*/, 2]; 225 | return [4 /*yield*/, module.uiDispatcher('sendMessage', data)]; 226 | case 1: 227 | _a = (_f.sent()); 228 | _f.label = 2; 229 | case 2: 230 | _f.label = 3; 231 | case 3: 232 | if (!((_e = result === null || result === void 0 ? void 0 : result.text) === null || _e === void 0 ? void 0 : _e.showRate)) return [3 /*break*/, 5]; 233 | data = { 234 | uiManagmentEvent: 'showRate', 235 | data: true, 236 | }; 237 | return [4 /*yield*/, module.uiDispatcher('uiManagment', data)]; 238 | case 4: 239 | _f.sent(); 240 | _f.label = 5; 241 | case 5: return [2 /*return*/]; 242 | } 243 | }); 244 | }); }; 245 | 246 | var announcements = function (module, announcements) { 247 | if (announcements.length > 0) 248 | return; 249 | announcements.forEach(function (message) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { 250 | switch (_a.label) { 251 | case 0: return [4 /*yield*/, resultControl(module, message.result)]; 252 | case 1: return [2 /*return*/, _a.sent()]; 253 | } 254 | }); }); }); 255 | }; 256 | 257 | var notifications = function (module, notificationsRequestResult) { 258 | var randomMsg = notificationsRequestResult.randomMsg, notificationsSettings = __rest(notificationsRequestResult, ["randomMsg"]); 259 | module.uiDispatcher('notifications', { notificationEvent: 'addMessages', data: randomMsg }); 260 | module.uiDispatcher('notifications', { notificationEvent: 'addSettings', data: notificationsSettings }); 261 | }; 262 | 263 | var setInfo = function (module, data) { 264 | var cuid = data.cuid, events = data.events; 265 | module.info.cuid = cuid; 266 | if (!events) 267 | return; 268 | module.info.events = eventsParser(Object.keys(events)); 269 | }; 270 | var reset = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 271 | return __generator(this, function (_a) { 272 | switch (_a.label) { 273 | case 0: return [4 /*yield*/, module.moduleDispatcher('chatInit', data)]; 274 | case 1: 275 | _a.sent(); 276 | module.uiDispatcher('modules', { 277 | modulesEvent: 'updateModule', 278 | data: { moduleName: module.name, config: { info: module.info, api: module.api } }, 279 | }); 280 | return [2 /*return*/]; 281 | } 282 | }); 283 | }); }; 284 | var chatInit = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 285 | var uuid, cuid, events, infApiUrl, clientConfig, url, body, result, info; 286 | var _a, _b; 287 | return __generator(this, function (_c) { 288 | switch (_c.label) { 289 | case 0: 290 | uuid = module.info.uuid; 291 | cuid = (_a = data === null || data === void 0 ? void 0 : data.moduleInfo) === null || _a === void 0 ? void 0 : _a.cuid; 292 | events = (_b = data === null || data === void 0 ? void 0 : data.moduleInfo) === null || _b === void 0 ? void 0 : _b.events; 293 | infApiUrl = module.api.infApiUrl; 294 | clientConfig = data.clientConfig; 295 | url = infApiUrl + "/Chat.init"; 296 | body = { 297 | uuid: uuid, 298 | cuid: cuid || '', 299 | context: __assign(__assign({}, clientConfig), { isDevice: isDevice() }), 300 | }; 301 | return [4 /*yield*/, postFetch(body, url)]; 302 | case 1: 303 | result = _c.sent(); 304 | info = (result === null || result === void 0 ? void 0 : result.cuid) === cuid 305 | ? { 306 | cuid: cuid || '', 307 | events: events, 308 | } 309 | : { 310 | cuid: result.cuid, 311 | events: result.events, 312 | }; 313 | module.moduleDispatcher('setInfo', info); 314 | !((result === null || result === void 0 ? void 0 : result.cuid) === cuid) && module.moduleDispatcher('chatEvent', { eventName: 'ready', context: {} }); 315 | return [2 /*return*/, resultControl(module, result)]; 316 | } 317 | }); 318 | }); }; 319 | var chatRequest = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 320 | var cuid, infApiUrl, text, context, url, body, result; 321 | return __generator(this, function (_a) { 322 | switch (_a.label) { 323 | case 0: 324 | cuid = module.info.cuid; 325 | infApiUrl = module.api.infApiUrl; 326 | text = data.text, context = data.context; 327 | url = infApiUrl + "/Chat.request"; 328 | body = { 329 | cuid: cuid, 330 | text: text, 331 | context: __assign(__assign({}, context), { isDevice: isDevice() }), 332 | }; 333 | return [4 /*yield*/, postFetch(body, url)]; 334 | case 1: 335 | result = _a.sent(); 336 | resultControl(module, result); 337 | return [2 /*return*/]; 338 | } 339 | }); 340 | }); }; 341 | var chatEvent = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 342 | var _a, cuid, events, infApiUrl, text, eventName, context, url, body, result; 343 | return __generator(this, function (_b) { 344 | switch (_b.label) { 345 | case 0: 346 | _a = module.info, cuid = _a.cuid, events = _a.events; 347 | infApiUrl = module.api.infApiUrl; 348 | text = ''; 349 | eventName = data.eventName, context = data.context; 350 | if (eventName === 'geolocationDenied') 351 | text = 'LOCATION DENIED'; 352 | if (eventName === 'geolocationTimeout') 353 | text = 'REQUEST TIMEOUT ERROR'; 354 | url = infApiUrl + "/Chat.event"; 355 | body = { 356 | cuid: cuid, 357 | euid: events[eventName] || '00b2fcbe-f27f-437b-a0d5-91072d840ed3', 358 | text: text, 359 | context: __assign(__assign({}, context), { isDevice: isDevice() }), 360 | }; 361 | return [4 /*yield*/, postFetch(body, url)]; 362 | case 1: 363 | result = _b.sent(); 364 | console.log(result); 365 | resultControl(module, result); 366 | return [2 /*return*/]; 367 | } 368 | }); 369 | }); }; 370 | var chatRate = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 371 | var cuid, infApiUrl, rating, url, body, result; 372 | return __generator(this, function (_a) { 373 | switch (_a.label) { 374 | case 0: 375 | cuid = module.info.cuid; 376 | infApiUrl = module.api.infApiUrl; 377 | rating = data.rating; 378 | url = infApiUrl + "/Chat.rate"; 379 | body = { 380 | cuid: cuid, 381 | rating: rating, 382 | context: { 383 | isDevice: isDevice(), 384 | }, 385 | }; 386 | return [4 /*yield*/, postFetchWithHeaders(body, url)]; 387 | case 1: 388 | result = (_a.sent()).result; 389 | return [2 /*return*/, resultControl(module, result)]; 390 | } 391 | }); 392 | }); }; 393 | var chatTrack = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 394 | var cuid, infApiUrl, url, args, action, body, result; 395 | return __generator(this, function (_a) { 396 | switch (_a.label) { 397 | case 0: 398 | cuid = module.info.cuid; 399 | infApiUrl = module.api.infApiUrl; 400 | url = infApiUrl + "/Chat.track"; 401 | args = data.args, action = data.action; 402 | body = { 403 | cuid: cuid, 404 | arguments: args, 405 | action: action, 406 | }; 407 | return [4 /*yield*/, postFetch(body, url)]; 408 | case 1: 409 | result = _a.sent(); 410 | return [2 /*return*/, resultControl(module, result)]; 411 | } 412 | }); 413 | }); }; 414 | var geoLocationRequest = function (module) { return __awaiter(void 0, void 0, void 0, function () { 415 | var geoLocationApiUrl, request, content, error_1; 416 | return __generator(this, function (_a) { 417 | switch (_a.label) { 418 | case 0: 419 | _a.trys.push([0, 3, , 4]); 420 | geoLocationApiUrl = module.api.geoLocationApiUrl; 421 | return [4 /*yield*/, fetch(geoLocationApiUrl)]; 422 | case 1: 423 | request = _a.sent(); 424 | return [4 /*yield*/, request.json()]; 425 | case 2: 426 | content = _a.sent(); 427 | return [2 /*return*/, content]; 428 | case 3: 429 | error_1 = _a.sent(); 430 | console.log(error_1); 431 | return [3 /*break*/, 4]; 432 | case 4: return [2 /*return*/]; 433 | } 434 | }); 435 | }); }; 436 | var liveChatOperatorsCheckRequest = function (module) { return __awaiter(void 0, void 0, void 0, function () { 437 | var liveChatOperatorsApiUrl, request, content, error_2; 438 | return __generator(this, function (_a) { 439 | switch (_a.label) { 440 | case 0: 441 | _a.trys.push([0, 3, , 4]); 442 | liveChatOperatorsApiUrl = module.api.liveChatOperatorsApiUrl; 443 | return [4 /*yield*/, fetch(liveChatOperatorsApiUrl)]; 444 | case 1: 445 | request = _a.sent(); 446 | return [4 /*yield*/, request.json()]; 447 | case 2: 448 | content = _a.sent(); 449 | return [2 /*return*/, content]; 450 | case 3: 451 | error_2 = _a.sent(); 452 | console.log(error_2); 453 | return [3 /*break*/, 4]; 454 | case 4: return [2 /*return*/]; 455 | } 456 | }); 457 | }); }; 458 | var notificationRequest = function (module) { return __awaiter(void 0, void 0, void 0, function () { 459 | var notificationsApiUrl, request, content, error_3; 460 | return __generator(this, function (_a) { 461 | switch (_a.label) { 462 | case 0: 463 | notificationsApiUrl = module.api.notificationsApiUrl; 464 | _a.label = 1; 465 | case 1: 466 | _a.trys.push([1, 4, , 5]); 467 | return [4 /*yield*/, fetch(notificationsApiUrl)]; 468 | case 2: 469 | request = _a.sent(); 470 | return [4 /*yield*/, request.json()]; 471 | case 3: 472 | content = _a.sent(); 473 | return [2 /*return*/, notifications(module, content)]; 474 | case 4: 475 | error_3 = _a.sent(); 476 | console.log(error_3); 477 | return [3 /*break*/, 5]; 478 | case 5: return [2 /*return*/]; 479 | } 480 | }); 481 | }); }; 482 | var notificationDisplay = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 483 | var notificationsApiUrl, messageId, url, error_4; 484 | return __generator(this, function (_a) { 485 | switch (_a.label) { 486 | case 0: 487 | notificationsApiUrl = module.api.notificationsApiUrl; 488 | messageId = data.messageId; 489 | url = notificationsApiUrl + "?a=show&id=" + messageId; 490 | _a.label = 1; 491 | case 1: 492 | _a.trys.push([1, 3, , 4]); 493 | return [4 /*yield*/, fetch(url)]; 494 | case 2: 495 | _a.sent(); 496 | return [3 /*break*/, 4]; 497 | case 3: 498 | error_4 = _a.sent(); 499 | console.log(error_4); 500 | return [3 /*break*/, 4]; 501 | case 4: return [2 /*return*/]; 502 | } 503 | }); 504 | }); }; 505 | var chatUpdate = function (module) { return __awaiter(void 0, void 0, void 0, function () { 506 | var cuid, chatUpdateApiUrl, url, body, answers; 507 | return __generator(this, function (_a) { 508 | switch (_a.label) { 509 | case 0: 510 | cuid = module.info.cuid; 511 | chatUpdateApiUrl = module.api.chatUpdateApiUrl; 512 | url = chatUpdateApiUrl + "/Chat.update"; 513 | body = { 514 | cuid: cuid, 515 | }; 516 | return [4 /*yield*/, postFetch(body, url)]; 517 | case 1: 518 | answers = (_a.sent()).answers; 519 | return [2 /*return*/, answers]; 520 | } 521 | }); 522 | }); }; 523 | var chatTimerAnnouncementsRequest = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 524 | var cuid, chatTimerAnnouncementsApiUrl, userActive, body, answers; 525 | return __generator(this, function (_a) { 526 | switch (_a.label) { 527 | case 0: 528 | cuid = module.info.cuid; 529 | chatTimerAnnouncementsApiUrl = module.api.chatTimerAnnouncementsApiUrl; 530 | userActive = data.userActive; 531 | body = { 532 | cuid: cuid, 533 | user_active: userActive, 534 | }; 535 | return [4 /*yield*/, postFetch(body, chatTimerAnnouncementsApiUrl)]; 536 | case 1: 537 | answers = (_a.sent()).answers; 538 | return [2 /*return*/, announcements(module, answers)]; 539 | } 540 | }); 541 | }); }; 542 | 543 | var _a = { "env": { "INF_API_URL": "", "GEO_LACATION_API_URL": "", "LIVE_CHAT_OPERATORS_API_URL": "", "NOTIFICATIONS_API_URL": "", "CHAT_TIMER_ANNOUNCEMENTS_API_URL": "", "CHAT_UPDATE_API_URL": "" } }.env, INF_API_URL = _a.INF_API_URL, GEO_LACATION_API_URL = _a.GEO_LACATION_API_URL, LIVE_CHAT_OPERATORS_API_URL = _a.LIVE_CHAT_OPERATORS_API_URL, NOTIFICATIONS_API_URL = _a.NOTIFICATIONS_API_URL, CHAT_TIMER_ANNOUNCEMENTS_API_URL = _a.CHAT_TIMER_ANNOUNCEMENTS_API_URL, CHAT_UPDATE_API_URL = _a.CHAT_UPDATE_API_URL; 544 | var DialogLanguageModule = /** @class */ (function () { 545 | function DialogLanguageModule(config) { 546 | var _this = this; 547 | this.moduleDispatcher = function (event, data) { return __awaiter(_this, void 0, void 0, function () { 548 | var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; 549 | return __generator(this, function (_p) { 550 | switch (_p.label) { 551 | case 0: 552 | _a = event === 'chatInit' && data; 553 | if (!_a) return [3 /*break*/, 2]; 554 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 555 | case 1: 556 | _a = (_p.sent()); 557 | _p.label = 2; 558 | case 2: 559 | _b = event === 'chatEvent' && data; 560 | if (!_b) return [3 /*break*/, 4]; 561 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 562 | case 3: 563 | _b = (_p.sent()); 564 | _p.label = 4; 565 | case 4: 566 | _c = event === 'chatRequest' && data; 567 | if (!_c) return [3 /*break*/, 6]; 568 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 569 | case 5: 570 | _c = (_p.sent()); 571 | _p.label = 6; 572 | case 6: 573 | _d = event === 'setInfo' && data; 574 | if (!_d) return [3 /*break*/, 8]; 575 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 576 | case 7: 577 | _d = (_p.sent()); 578 | _p.label = 8; 579 | case 8: 580 | _e = event === 'chatRate' && data; 581 | if (!_e) return [3 /*break*/, 10]; 582 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 583 | case 9: 584 | _e = (_p.sent()); 585 | _p.label = 10; 586 | case 10: 587 | _f = event === 'chatTrack' && data; 588 | if (!_f) return [3 /*break*/, 12]; 589 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 590 | case 11: 591 | _f = (_p.sent()); 592 | _p.label = 12; 593 | case 12: 594 | _g = event === 'chatUpdate'; 595 | if (!_g) return [3 /*break*/, 14]; 596 | return [4 /*yield*/, this.moduleEvents[event](this)]; 597 | case 13: 598 | _g = (_p.sent()); 599 | _p.label = 14; 600 | case 14: 601 | _h = event === 'chatTimerAnnouncementsRequest' && 602 | data; 603 | if (!_h) return [3 /*break*/, 16]; 604 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 605 | case 15: 606 | _h = (_p.sent()); 607 | _p.label = 16; 608 | case 16: 609 | _j = event === 'notificationDisplay' && data; 610 | if (!_j) return [3 /*break*/, 18]; 611 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 612 | case 17: 613 | _j = (_p.sent()); 614 | _p.label = 18; 615 | case 18: 616 | _k = event === 'notificationRequest'; 617 | if (!_k) return [3 /*break*/, 20]; 618 | return [4 /*yield*/, this.moduleEvents[event](this)]; 619 | case 19: 620 | _k = (_p.sent()); 621 | _p.label = 20; 622 | case 20: 623 | _l = event === 'geoLocationRequest'; 624 | if (!_l) return [3 /*break*/, 22]; 625 | return [4 /*yield*/, this.moduleEvents[event](this)]; 626 | case 21: 627 | _l = (_p.sent()); 628 | _p.label = 22; 629 | case 22: 630 | _m = event === 'liveChatOperatorsCheckRequest'; 631 | if (!_m) return [3 /*break*/, 24]; 632 | return [4 /*yield*/, this.moduleEvents[event](this)]; 633 | case 23: 634 | _m = (_p.sent()); 635 | _p.label = 24; 636 | case 24: 637 | _o = event === 'reset'; 638 | if (!_o) return [3 /*break*/, 26]; 639 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 640 | case 25: 641 | _o = (_p.sent()); 642 | _p.label = 26; 643 | case 26: 644 | return [2 /*return*/]; 645 | } 646 | }); 647 | }); }; 648 | this.uiDispatcher = function (event, data) { 649 | event === 'sendMessage' && _this.uiEvents[event](data, _this.ckStore); 650 | event === 'uiManagment' && 651 | _this.uiEvents[event](data.uiManagmentEvent, data.data, _this.ckStore); 652 | event === 'notifications' && 653 | _this.uiEvents[event](data.notificationEvent, data.data, _this.ckStore); 654 | event === 'modules' && _this.uiEvents[event](data.modulesEvent, data.data, _this.ckStore); 655 | }; 656 | var info = config.info, api = config.api, moduleEvents = config.moduleEvents, uiEvents = config.uiEvents, ckStore = config.ckStore; 657 | this.name = 'dialogLanguage'; 658 | this.ckStore = ckStore; 659 | this.info = { 660 | cuid: '', 661 | uuid: info.uuid, 662 | events: {}, 663 | }; 664 | this.api = { 665 | infApiUrl: (api === null || api === void 0 ? void 0 : api.infApiUrl) || INF_API_URL || '', 666 | geoLocationApiUrl: (api === null || api === void 0 ? void 0 : api.geoLocationApiUrl) || GEO_LACATION_API_URL || '', 667 | liveChatOperatorsApiUrl: (api === null || api === void 0 ? void 0 : api.liveChatOperatorsApiUrl) || LIVE_CHAT_OPERATORS_API_URL + "=" + document.URL || "", 668 | notificationsApiUrl: (api === null || api === void 0 ? void 0 : api.notificationsApiUrl) || "" + NOTIFICATIONS_API_URL + this.info.uuid + ".json" || "", 669 | chatTimerAnnouncementsApiUrl: (api === null || api === void 0 ? void 0 : api.chatTimerAnnouncementsApiUrl) || CHAT_TIMER_ANNOUNCEMENTS_API_URL || '', 670 | chatUpdateApiUrl: (api === null || api === void 0 ? void 0 : api.chatUpdateApiUrl) || CHAT_UPDATE_API_URL || '', 671 | }; 672 | this.uiEvents = { 673 | sendMessage: (uiEvents === null || uiEvents === void 0 ? void 0 : uiEvents.sendMessage) || defaultSendMessage, 674 | uiManagment: (uiEvents === null || uiEvents === void 0 ? void 0 : uiEvents.uiManagment) || defaultUIManagment, 675 | notifications: (uiEvents === null || uiEvents === void 0 ? void 0 : uiEvents.notifications) || defaultNotifications, 676 | modules: (uiEvents === null || uiEvents === void 0 ? void 0 : uiEvents.modules) || defaultModules, 677 | }; 678 | this.moduleEvents = { 679 | setInfo: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.setInfo) || setInfo, 680 | chatInit: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatInit) || chatInit, 681 | chatEvent: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatEvent) || chatEvent, 682 | chatRequest: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatRequest) || chatRequest, 683 | chatRate: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatRate) || chatRate, 684 | chatTrack: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatTrack) || chatTrack, 685 | geoLocationRequest: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.geoLocationRequest) || geoLocationRequest, 686 | liveChatOperatorsCheckRequest: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.liveChatOperatorsCheckRequest) || liveChatOperatorsCheckRequest, 687 | notificationRequest: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.notificationRequest) || notificationRequest, 688 | notificationDisplay: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.notificationDisplay) || notificationDisplay, 689 | chatUpdate: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatUpdate) || chatUpdate, 690 | chatTimerAnnouncementsRequest: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatTimerAnnouncementsRequest) || chatTimerAnnouncementsRequest, 691 | reset: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.reset) || reset, 692 | }; 693 | } 694 | return DialogLanguageModule; 695 | }()); 696 | 697 | var ckModuleInit = function (config) { return new DialogLanguageModule(config); }; 698 | 699 | export default ckModuleInit; 700 | //# sourceMappingURL=index.es.js.map 701 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, '__esModule', { value: true }); 4 | 5 | /*! ***************************************************************************** 6 | Copyright (c) Microsoft Corporation. 7 | 8 | Permission to use, copy, modify, and/or distribute this software for any 9 | purpose with or without fee is hereby granted. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 12 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 13 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 14 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 16 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 | PERFORMANCE OF THIS SOFTWARE. 18 | ***************************************************************************** */ 19 | 20 | var __assign = function() { 21 | __assign = Object.assign || function __assign(t) { 22 | for (var s, i = 1, n = arguments.length; i < n; i++) { 23 | s = arguments[i]; 24 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 25 | } 26 | return t; 27 | }; 28 | return __assign.apply(this, arguments); 29 | }; 30 | 31 | function __rest(s, e) { 32 | var t = {}; 33 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) 34 | t[p] = s[p]; 35 | if (s != null && typeof Object.getOwnPropertySymbols === "function") 36 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { 37 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) 38 | t[p[i]] = s[p[i]]; 39 | } 40 | return t; 41 | } 42 | 43 | function __awaiter(thisArg, _arguments, P, generator) { 44 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 45 | return new (P || (P = Promise))(function (resolve, reject) { 46 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 47 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 48 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 49 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 50 | }); 51 | } 52 | 53 | function __generator(thisArg, body) { 54 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; 55 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 56 | function verb(n) { return function (v) { return step([n, v]); }; } 57 | function step(op) { 58 | if (f) throw new TypeError("Generator is already executing."); 59 | while (_) try { 60 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 61 | if (y = 0, t) op = [op[0] & 2, t.value]; 62 | switch (op[0]) { 63 | case 0: case 1: t = op; break; 64 | case 4: _.label++; return { value: op[1], done: false }; 65 | case 5: _.label++; y = op[1]; op = [0]; continue; 66 | case 7: op = _.ops.pop(); _.trys.pop(); continue; 67 | default: 68 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 69 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 70 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 71 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 72 | if (t[2]) _.ops.pop(); 73 | _.trys.pop(); continue; 74 | } 75 | op = body.call(thisArg, _); 76 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 77 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 78 | } 79 | } 80 | 81 | var defaultSendMessage = function (data) { return console.log('no SendMessage'); }; 82 | var defaultUIManagment = function (uiManagmentEvent, data) { return console.log('no UIManagment'); }; 83 | var defaultNotifications = function (notificationsEvent, data) { 84 | return console.log('no Notifications'); 85 | }; 86 | var defaultModules = function (notificationsEvent, data) { return console.log('no modules'); }; 87 | 88 | var eventList = { 89 | '00b2fcbe-f27f-437b-a0d5-91072d840ed3': 'ready', 90 | '29e75851-6cae-44f4-8a9c-f6489c4dca88': 'inactive', 91 | '11d10788-4789-11e3-9b0b-080027ab4d7b': 'rate', 92 | 'bffaa961-9ad3-4ecd-9254-f9e2fc06f28c': 'notification', 93 | '7330d8fc-4c64-11e3-af49-080027ab4d7b': 'context', 94 | 'd825476d-bc08-4038-9ecf-e6b2b267c7b8': 'click', 95 | '6819087d-a7d0-4c67-acd4-47d40b233cc9': 'mouse', 96 | '2bbff8e2-3c75-4f4b-bd61-c29017257c00': 'cardReady', 97 | '4e729f9a-0aa2-4d37-87d2-bed2b2b39c00': 'operatorStatus', 98 | 'c189c2f1-43b6-424b-866b-03e562ba9d33': 'chatState', 99 | '409b58e1-595b-4c02-81be-3f31dfe4639d': 'geolocationTimeout', 100 | 'b92e3bcc-44b5-4019-9594-54b69afdaf77': 'geolocationDenied', 101 | }; 102 | var postFetch = function (body, url) { return __awaiter(void 0, void 0, void 0, function () { 103 | var fetchResponse, fetchResult, error_1; 104 | return __generator(this, function (_a) { 105 | switch (_a.label) { 106 | case 0: 107 | _a.trys.push([0, 3, , 4]); 108 | return [4 /*yield*/, fetch(url, { 109 | method: 'POST', 110 | body: JSON.stringify(body), 111 | })]; 112 | case 1: 113 | fetchResponse = _a.sent(); 114 | return [4 /*yield*/, fetchResponse.json()]; 115 | case 2: 116 | fetchResult = _a.sent(); 117 | return [2 /*return*/, fetchResult.result]; 118 | case 3: 119 | error_1 = _a.sent(); 120 | console.log(error_1); 121 | return [3 /*break*/, 4]; 122 | case 4: return [2 /*return*/]; 123 | } 124 | }); 125 | }); }; 126 | var postFetchWithHeaders = function (body, url) { return __awaiter(void 0, void 0, void 0, function () { 127 | var fetchResponse, fetchResult, error_2; 128 | return __generator(this, function (_a) { 129 | switch (_a.label) { 130 | case 0: 131 | _a.trys.push([0, 3, , 4]); 132 | return [4 /*yield*/, fetch(url, { 133 | headers: { 134 | Accept: 'application/json', 135 | 'Content-Type': 'application/json', 136 | }, 137 | method: 'POST', 138 | body: JSON.stringify(body), 139 | })]; 140 | case 1: 141 | fetchResponse = _a.sent(); 142 | return [4 /*yield*/, fetchResponse.json()]; 143 | case 2: 144 | fetchResult = _a.sent(); 145 | return [2 /*return*/, fetchResult]; 146 | case 3: 147 | error_2 = _a.sent(); 148 | console.log(error_2); 149 | return [3 /*break*/, 4]; 150 | case 4: return [2 /*return*/]; 151 | } 152 | }); 153 | }); }; 154 | var eventsParser = function (activeEvents) { 155 | var events = {}; 156 | activeEvents.forEach(function (activeEvent) { 157 | var eventName = eventList[activeEvent]; 158 | events[eventName] = activeEvent; 159 | }); 160 | return events; 161 | }; 162 | var isDevice = function () { return window && window.innerWidth && window.innerWidth < 1025; }; 163 | 164 | var msgRegExpReplace = { 165 | links: { 166 | regexp: /href="event:/gim, 167 | replace: 'data-type="outbound" rel="noopener noreferrer" href="', 168 | }, 169 | userLinks: { 170 | regexp: /]*(?!data-request))?(data-request="([^"]+)?")?>(.*?)<\/userlink>/gim, 171 | replace: "$4", 172 | }, 173 | newPara: { 174 | regexp: / \(NEW_PARA\)|\(NEW_PARA\)/gim, 175 | replace: '', 176 | }, 177 | newParaButtons: { 178 | regexp: / \(NEW_PARA\)(.*)|\(NEW_PARA\)(.*)/gim, 179 | replace: "$1$2", 180 | }, 181 | userLinksAsButtons: { 182 | regexp: /]*(?!data-request))?(data-request="([^"]+)?")?>(.*?)<\/userlink>/gim, 183 | replace: "$4", 184 | }, 185 | }; 186 | var links = msgRegExpReplace.links; 187 | var userLinks = msgRegExpReplace.userLinks; 188 | var userLinksAsButtons = msgRegExpReplace.userLinksAsButtons; 189 | var newPara = msgRegExpReplace.newPara; 190 | var newParaButtons = msgRegExpReplace.newParaButtons; 191 | var msgPrepare = function (text, context) { 192 | if (/UserLinkAsButton/gim.test(context === null || context === void 0 ? void 0 : context.wcmd_show_mode)) { 193 | if (/\(NEW_PARA\)/gim.test(context === null || context === void 0 ? void 0 : context.wcmd_show_mode)) { 194 | return text 195 | .replace(links === null || links === void 0 ? void 0 : links.regexp, links === null || links === void 0 ? void 0 : links.replace) 196 | .replace(newParaButtons === null || newParaButtons === void 0 ? void 0 : newParaButtons.regexp, newParaButtons === null || newParaButtons === void 0 ? void 0 : newParaButtons.replace) 197 | .replace(userLinks === null || userLinks === void 0 ? void 0 : userLinks.regexp, userLinks === null || userLinks === void 0 ? void 0 : userLinks.replace); 198 | } 199 | else { 200 | return text 201 | .replace(links === null || links === void 0 ? void 0 : links.regexp, links === null || links === void 0 ? void 0 : links.replace) 202 | .replace(newPara === null || newPara === void 0 ? void 0 : newPara.regexp, newPara === null || newPara === void 0 ? void 0 : newPara.replace) 203 | .replace(userLinksAsButtons === null || userLinksAsButtons === void 0 ? void 0 : userLinksAsButtons.regexp, userLinksAsButtons === null || userLinksAsButtons === void 0 ? void 0 : userLinksAsButtons.replace); 204 | } 205 | } 206 | return text 207 | .replace(links === null || links === void 0 ? void 0 : links.regexp, links === null || links === void 0 ? void 0 : links.replace) 208 | .replace(newPara === null || newPara === void 0 ? void 0 : newPara.regexp, newPara === null || newPara === void 0 ? void 0 : newPara.replace) 209 | .replace(userLinks === null || userLinks === void 0 ? void 0 : userLinks.regexp, userLinks === null || userLinks === void 0 ? void 0 : userLinks.replace); 210 | }; 211 | 212 | var resultControl = function (module, result) { return __awaiter(void 0, void 0, void 0, function () { 213 | var text, data, wflagHideReply, _a, data; 214 | var _b, _c, _d, _e; 215 | return __generator(this, function (_f) { 216 | switch (_f.label) { 217 | case 0: 218 | if (!(((_b = result === null || result === void 0 ? void 0 : result.text) === null || _b === void 0 ? void 0 : _b.value) && (result === null || result === void 0 ? void 0 : result.context))) return [3 /*break*/, 3]; 219 | text = msgPrepare(result.text.value, result.context); 220 | data = { 221 | text: text, 222 | sender: 'request', 223 | showRate: (_c = result === null || result === void 0 ? void 0 : result.text) === null || _c === void 0 ? void 0 : _c.showRate, 224 | module: module.name, 225 | }; 226 | wflagHideReply = ((_d = result.context) === null || _d === void 0 ? void 0 : _d.wflag_hide_reply) !== '1'; 227 | _a = wflagHideReply && text; 228 | if (!_a) return [3 /*break*/, 2]; 229 | return [4 /*yield*/, module.uiDispatcher('sendMessage', data)]; 230 | case 1: 231 | _a = (_f.sent()); 232 | _f.label = 2; 233 | case 2: 234 | _f.label = 3; 235 | case 3: 236 | if (!((_e = result === null || result === void 0 ? void 0 : result.text) === null || _e === void 0 ? void 0 : _e.showRate)) return [3 /*break*/, 5]; 237 | data = { 238 | uiManagmentEvent: 'showRate', 239 | data: true, 240 | }; 241 | return [4 /*yield*/, module.uiDispatcher('uiManagment', data)]; 242 | case 4: 243 | _f.sent(); 244 | _f.label = 5; 245 | case 5: return [2 /*return*/]; 246 | } 247 | }); 248 | }); }; 249 | 250 | var announcements = function (module, announcements) { 251 | if (announcements.length > 0) 252 | return; 253 | announcements.forEach(function (message) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { 254 | switch (_a.label) { 255 | case 0: return [4 /*yield*/, resultControl(module, message.result)]; 256 | case 1: return [2 /*return*/, _a.sent()]; 257 | } 258 | }); }); }); 259 | }; 260 | 261 | var notifications = function (module, notificationsRequestResult) { 262 | var randomMsg = notificationsRequestResult.randomMsg, notificationsSettings = __rest(notificationsRequestResult, ["randomMsg"]); 263 | module.uiDispatcher('notifications', { notificationEvent: 'addMessages', data: randomMsg }); 264 | module.uiDispatcher('notifications', { notificationEvent: 'addSettings', data: notificationsSettings }); 265 | }; 266 | 267 | var setInfo = function (module, data) { 268 | var cuid = data.cuid, events = data.events; 269 | module.info.cuid = cuid; 270 | if (!events) 271 | return; 272 | module.info.events = eventsParser(Object.keys(events)); 273 | }; 274 | var reset = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 275 | return __generator(this, function (_a) { 276 | switch (_a.label) { 277 | case 0: return [4 /*yield*/, module.moduleDispatcher('chatInit', data)]; 278 | case 1: 279 | _a.sent(); 280 | module.uiDispatcher('modules', { 281 | modulesEvent: 'updateModule', 282 | data: { moduleName: module.name, config: { info: module.info, api: module.api } }, 283 | }); 284 | return [2 /*return*/]; 285 | } 286 | }); 287 | }); }; 288 | var chatInit = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 289 | var uuid, cuid, events, infApiUrl, clientConfig, url, body, result, info; 290 | var _a, _b; 291 | return __generator(this, function (_c) { 292 | switch (_c.label) { 293 | case 0: 294 | uuid = module.info.uuid; 295 | cuid = (_a = data === null || data === void 0 ? void 0 : data.moduleInfo) === null || _a === void 0 ? void 0 : _a.cuid; 296 | events = (_b = data === null || data === void 0 ? void 0 : data.moduleInfo) === null || _b === void 0 ? void 0 : _b.events; 297 | infApiUrl = module.api.infApiUrl; 298 | clientConfig = data.clientConfig; 299 | url = infApiUrl + "/Chat.init"; 300 | body = { 301 | uuid: uuid, 302 | cuid: cuid || '', 303 | context: __assign(__assign({}, clientConfig), { isDevice: isDevice() }), 304 | }; 305 | return [4 /*yield*/, postFetch(body, url)]; 306 | case 1: 307 | result = _c.sent(); 308 | info = (result === null || result === void 0 ? void 0 : result.cuid) === cuid 309 | ? { 310 | cuid: cuid || '', 311 | events: events, 312 | } 313 | : { 314 | cuid: result.cuid, 315 | events: result.events, 316 | }; 317 | module.moduleDispatcher('setInfo', info); 318 | !((result === null || result === void 0 ? void 0 : result.cuid) === cuid) && module.moduleDispatcher('chatEvent', { eventName: 'ready', context: {} }); 319 | return [2 /*return*/, resultControl(module, result)]; 320 | } 321 | }); 322 | }); }; 323 | var chatRequest = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 324 | var cuid, infApiUrl, text, context, url, body, result; 325 | return __generator(this, function (_a) { 326 | switch (_a.label) { 327 | case 0: 328 | cuid = module.info.cuid; 329 | infApiUrl = module.api.infApiUrl; 330 | text = data.text, context = data.context; 331 | url = infApiUrl + "/Chat.request"; 332 | body = { 333 | cuid: cuid, 334 | text: text, 335 | context: __assign(__assign({}, context), { isDevice: isDevice() }), 336 | }; 337 | return [4 /*yield*/, postFetch(body, url)]; 338 | case 1: 339 | result = _a.sent(); 340 | resultControl(module, result); 341 | return [2 /*return*/]; 342 | } 343 | }); 344 | }); }; 345 | var chatEvent = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 346 | var _a, cuid, events, infApiUrl, text, eventName, context, url, body, result; 347 | return __generator(this, function (_b) { 348 | switch (_b.label) { 349 | case 0: 350 | _a = module.info, cuid = _a.cuid, events = _a.events; 351 | infApiUrl = module.api.infApiUrl; 352 | text = ''; 353 | eventName = data.eventName, context = data.context; 354 | if (eventName === 'geolocationDenied') 355 | text = 'LOCATION DENIED'; 356 | if (eventName === 'geolocationTimeout') 357 | text = 'REQUEST TIMEOUT ERROR'; 358 | url = infApiUrl + "/Chat.event"; 359 | body = { 360 | cuid: cuid, 361 | euid: events[eventName] || '00b2fcbe-f27f-437b-a0d5-91072d840ed3', 362 | text: text, 363 | context: __assign(__assign({}, context), { isDevice: isDevice() }), 364 | }; 365 | return [4 /*yield*/, postFetch(body, url)]; 366 | case 1: 367 | result = _b.sent(); 368 | console.log(result); 369 | resultControl(module, result); 370 | return [2 /*return*/]; 371 | } 372 | }); 373 | }); }; 374 | var chatRate = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 375 | var cuid, infApiUrl, rating, url, body, result; 376 | return __generator(this, function (_a) { 377 | switch (_a.label) { 378 | case 0: 379 | cuid = module.info.cuid; 380 | infApiUrl = module.api.infApiUrl; 381 | rating = data.rating; 382 | url = infApiUrl + "/Chat.rate"; 383 | body = { 384 | cuid: cuid, 385 | rating: rating, 386 | context: { 387 | isDevice: isDevice(), 388 | }, 389 | }; 390 | return [4 /*yield*/, postFetchWithHeaders(body, url)]; 391 | case 1: 392 | result = (_a.sent()).result; 393 | return [2 /*return*/, resultControl(module, result)]; 394 | } 395 | }); 396 | }); }; 397 | var chatTrack = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 398 | var cuid, infApiUrl, url, args, action, body, result; 399 | return __generator(this, function (_a) { 400 | switch (_a.label) { 401 | case 0: 402 | cuid = module.info.cuid; 403 | infApiUrl = module.api.infApiUrl; 404 | url = infApiUrl + "/Chat.track"; 405 | args = data.args, action = data.action; 406 | body = { 407 | cuid: cuid, 408 | arguments: args, 409 | action: action, 410 | }; 411 | return [4 /*yield*/, postFetch(body, url)]; 412 | case 1: 413 | result = _a.sent(); 414 | return [2 /*return*/, resultControl(module, result)]; 415 | } 416 | }); 417 | }); }; 418 | var geoLocationRequest = function (module) { return __awaiter(void 0, void 0, void 0, function () { 419 | var geoLocationApiUrl, request, content, error_1; 420 | return __generator(this, function (_a) { 421 | switch (_a.label) { 422 | case 0: 423 | _a.trys.push([0, 3, , 4]); 424 | geoLocationApiUrl = module.api.geoLocationApiUrl; 425 | return [4 /*yield*/, fetch(geoLocationApiUrl)]; 426 | case 1: 427 | request = _a.sent(); 428 | return [4 /*yield*/, request.json()]; 429 | case 2: 430 | content = _a.sent(); 431 | return [2 /*return*/, content]; 432 | case 3: 433 | error_1 = _a.sent(); 434 | console.log(error_1); 435 | return [3 /*break*/, 4]; 436 | case 4: return [2 /*return*/]; 437 | } 438 | }); 439 | }); }; 440 | var liveChatOperatorsCheckRequest = function (module) { return __awaiter(void 0, void 0, void 0, function () { 441 | var liveChatOperatorsApiUrl, request, content, error_2; 442 | return __generator(this, function (_a) { 443 | switch (_a.label) { 444 | case 0: 445 | _a.trys.push([0, 3, , 4]); 446 | liveChatOperatorsApiUrl = module.api.liveChatOperatorsApiUrl; 447 | return [4 /*yield*/, fetch(liveChatOperatorsApiUrl)]; 448 | case 1: 449 | request = _a.sent(); 450 | return [4 /*yield*/, request.json()]; 451 | case 2: 452 | content = _a.sent(); 453 | return [2 /*return*/, content]; 454 | case 3: 455 | error_2 = _a.sent(); 456 | console.log(error_2); 457 | return [3 /*break*/, 4]; 458 | case 4: return [2 /*return*/]; 459 | } 460 | }); 461 | }); }; 462 | var notificationRequest = function (module) { return __awaiter(void 0, void 0, void 0, function () { 463 | var notificationsApiUrl, request, content, error_3; 464 | return __generator(this, function (_a) { 465 | switch (_a.label) { 466 | case 0: 467 | notificationsApiUrl = module.api.notificationsApiUrl; 468 | _a.label = 1; 469 | case 1: 470 | _a.trys.push([1, 4, , 5]); 471 | return [4 /*yield*/, fetch(notificationsApiUrl)]; 472 | case 2: 473 | request = _a.sent(); 474 | return [4 /*yield*/, request.json()]; 475 | case 3: 476 | content = _a.sent(); 477 | return [2 /*return*/, notifications(module, content)]; 478 | case 4: 479 | error_3 = _a.sent(); 480 | console.log(error_3); 481 | return [3 /*break*/, 5]; 482 | case 5: return [2 /*return*/]; 483 | } 484 | }); 485 | }); }; 486 | var notificationDisplay = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 487 | var notificationsApiUrl, messageId, url, error_4; 488 | return __generator(this, function (_a) { 489 | switch (_a.label) { 490 | case 0: 491 | notificationsApiUrl = module.api.notificationsApiUrl; 492 | messageId = data.messageId; 493 | url = notificationsApiUrl + "?a=show&id=" + messageId; 494 | _a.label = 1; 495 | case 1: 496 | _a.trys.push([1, 3, , 4]); 497 | return [4 /*yield*/, fetch(url)]; 498 | case 2: 499 | _a.sent(); 500 | return [3 /*break*/, 4]; 501 | case 3: 502 | error_4 = _a.sent(); 503 | console.log(error_4); 504 | return [3 /*break*/, 4]; 505 | case 4: return [2 /*return*/]; 506 | } 507 | }); 508 | }); }; 509 | var chatUpdate = function (module) { return __awaiter(void 0, void 0, void 0, function () { 510 | var cuid, chatUpdateApiUrl, url, body, answers; 511 | return __generator(this, function (_a) { 512 | switch (_a.label) { 513 | case 0: 514 | cuid = module.info.cuid; 515 | chatUpdateApiUrl = module.api.chatUpdateApiUrl; 516 | url = chatUpdateApiUrl + "/Chat.update"; 517 | body = { 518 | cuid: cuid, 519 | }; 520 | return [4 /*yield*/, postFetch(body, url)]; 521 | case 1: 522 | answers = (_a.sent()).answers; 523 | return [2 /*return*/, answers]; 524 | } 525 | }); 526 | }); }; 527 | var chatTimerAnnouncementsRequest = function (module, data) { return __awaiter(void 0, void 0, void 0, function () { 528 | var cuid, chatTimerAnnouncementsApiUrl, userActive, body, answers; 529 | return __generator(this, function (_a) { 530 | switch (_a.label) { 531 | case 0: 532 | cuid = module.info.cuid; 533 | chatTimerAnnouncementsApiUrl = module.api.chatTimerAnnouncementsApiUrl; 534 | userActive = data.userActive; 535 | body = { 536 | cuid: cuid, 537 | user_active: userActive, 538 | }; 539 | return [4 /*yield*/, postFetch(body, chatTimerAnnouncementsApiUrl)]; 540 | case 1: 541 | answers = (_a.sent()).answers; 542 | return [2 /*return*/, announcements(module, answers)]; 543 | } 544 | }); 545 | }); }; 546 | 547 | var _a = { "env": { "INF_API_URL": "", "GEO_LACATION_API_URL": "", "LIVE_CHAT_OPERATORS_API_URL": "", "NOTIFICATIONS_API_URL": "", "CHAT_TIMER_ANNOUNCEMENTS_API_URL": "", "CHAT_UPDATE_API_URL": "" } }.env, INF_API_URL = _a.INF_API_URL, GEO_LACATION_API_URL = _a.GEO_LACATION_API_URL, LIVE_CHAT_OPERATORS_API_URL = _a.LIVE_CHAT_OPERATORS_API_URL, NOTIFICATIONS_API_URL = _a.NOTIFICATIONS_API_URL, CHAT_TIMER_ANNOUNCEMENTS_API_URL = _a.CHAT_TIMER_ANNOUNCEMENTS_API_URL, CHAT_UPDATE_API_URL = _a.CHAT_UPDATE_API_URL; 548 | var DialogLanguageModule = /** @class */ (function () { 549 | function DialogLanguageModule(config) { 550 | var _this = this; 551 | this.moduleDispatcher = function (event, data) { return __awaiter(_this, void 0, void 0, function () { 552 | var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; 553 | return __generator(this, function (_p) { 554 | switch (_p.label) { 555 | case 0: 556 | _a = event === 'chatInit' && data; 557 | if (!_a) return [3 /*break*/, 2]; 558 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 559 | case 1: 560 | _a = (_p.sent()); 561 | _p.label = 2; 562 | case 2: 563 | _b = event === 'chatEvent' && data; 564 | if (!_b) return [3 /*break*/, 4]; 565 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 566 | case 3: 567 | _b = (_p.sent()); 568 | _p.label = 4; 569 | case 4: 570 | _c = event === 'chatRequest' && data; 571 | if (!_c) return [3 /*break*/, 6]; 572 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 573 | case 5: 574 | _c = (_p.sent()); 575 | _p.label = 6; 576 | case 6: 577 | _d = event === 'setInfo' && data; 578 | if (!_d) return [3 /*break*/, 8]; 579 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 580 | case 7: 581 | _d = (_p.sent()); 582 | _p.label = 8; 583 | case 8: 584 | _e = event === 'chatRate' && data; 585 | if (!_e) return [3 /*break*/, 10]; 586 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 587 | case 9: 588 | _e = (_p.sent()); 589 | _p.label = 10; 590 | case 10: 591 | _f = event === 'chatTrack' && data; 592 | if (!_f) return [3 /*break*/, 12]; 593 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 594 | case 11: 595 | _f = (_p.sent()); 596 | _p.label = 12; 597 | case 12: 598 | _g = event === 'chatUpdate'; 599 | if (!_g) return [3 /*break*/, 14]; 600 | return [4 /*yield*/, this.moduleEvents[event](this)]; 601 | case 13: 602 | _g = (_p.sent()); 603 | _p.label = 14; 604 | case 14: 605 | _h = event === 'chatTimerAnnouncementsRequest' && 606 | data; 607 | if (!_h) return [3 /*break*/, 16]; 608 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 609 | case 15: 610 | _h = (_p.sent()); 611 | _p.label = 16; 612 | case 16: 613 | _j = event === 'notificationDisplay' && data; 614 | if (!_j) return [3 /*break*/, 18]; 615 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 616 | case 17: 617 | _j = (_p.sent()); 618 | _p.label = 18; 619 | case 18: 620 | _k = event === 'notificationRequest'; 621 | if (!_k) return [3 /*break*/, 20]; 622 | return [4 /*yield*/, this.moduleEvents[event](this)]; 623 | case 19: 624 | _k = (_p.sent()); 625 | _p.label = 20; 626 | case 20: 627 | _l = event === 'geoLocationRequest'; 628 | if (!_l) return [3 /*break*/, 22]; 629 | return [4 /*yield*/, this.moduleEvents[event](this)]; 630 | case 21: 631 | _l = (_p.sent()); 632 | _p.label = 22; 633 | case 22: 634 | _m = event === 'liveChatOperatorsCheckRequest'; 635 | if (!_m) return [3 /*break*/, 24]; 636 | return [4 /*yield*/, this.moduleEvents[event](this)]; 637 | case 23: 638 | _m = (_p.sent()); 639 | _p.label = 24; 640 | case 24: 641 | _o = event === 'reset'; 642 | if (!_o) return [3 /*break*/, 26]; 643 | return [4 /*yield*/, this.moduleEvents[event](this, data)]; 644 | case 25: 645 | _o = (_p.sent()); 646 | _p.label = 26; 647 | case 26: 648 | return [2 /*return*/]; 649 | } 650 | }); 651 | }); }; 652 | this.uiDispatcher = function (event, data) { 653 | event === 'sendMessage' && _this.uiEvents[event](data, _this.ckStore); 654 | event === 'uiManagment' && 655 | _this.uiEvents[event](data.uiManagmentEvent, data.data, _this.ckStore); 656 | event === 'notifications' && 657 | _this.uiEvents[event](data.notificationEvent, data.data, _this.ckStore); 658 | event === 'modules' && _this.uiEvents[event](data.modulesEvent, data.data, _this.ckStore); 659 | }; 660 | var info = config.info, api = config.api, moduleEvents = config.moduleEvents, uiEvents = config.uiEvents, ckStore = config.ckStore; 661 | this.name = 'dialogLanguage'; 662 | this.ckStore = ckStore; 663 | this.info = { 664 | cuid: '', 665 | uuid: info.uuid, 666 | events: {}, 667 | }; 668 | this.api = { 669 | infApiUrl: (api === null || api === void 0 ? void 0 : api.infApiUrl) || INF_API_URL || '', 670 | geoLocationApiUrl: (api === null || api === void 0 ? void 0 : api.geoLocationApiUrl) || GEO_LACATION_API_URL || '', 671 | liveChatOperatorsApiUrl: (api === null || api === void 0 ? void 0 : api.liveChatOperatorsApiUrl) || LIVE_CHAT_OPERATORS_API_URL + "=" + document.URL || "", 672 | notificationsApiUrl: (api === null || api === void 0 ? void 0 : api.notificationsApiUrl) || "" + NOTIFICATIONS_API_URL + this.info.uuid + ".json" || "", 673 | chatTimerAnnouncementsApiUrl: (api === null || api === void 0 ? void 0 : api.chatTimerAnnouncementsApiUrl) || CHAT_TIMER_ANNOUNCEMENTS_API_URL || '', 674 | chatUpdateApiUrl: (api === null || api === void 0 ? void 0 : api.chatUpdateApiUrl) || CHAT_UPDATE_API_URL || '', 675 | }; 676 | this.uiEvents = { 677 | sendMessage: (uiEvents === null || uiEvents === void 0 ? void 0 : uiEvents.sendMessage) || defaultSendMessage, 678 | uiManagment: (uiEvents === null || uiEvents === void 0 ? void 0 : uiEvents.uiManagment) || defaultUIManagment, 679 | notifications: (uiEvents === null || uiEvents === void 0 ? void 0 : uiEvents.notifications) || defaultNotifications, 680 | modules: (uiEvents === null || uiEvents === void 0 ? void 0 : uiEvents.modules) || defaultModules, 681 | }; 682 | this.moduleEvents = { 683 | setInfo: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.setInfo) || setInfo, 684 | chatInit: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatInit) || chatInit, 685 | chatEvent: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatEvent) || chatEvent, 686 | chatRequest: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatRequest) || chatRequest, 687 | chatRate: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatRate) || chatRate, 688 | chatTrack: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatTrack) || chatTrack, 689 | geoLocationRequest: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.geoLocationRequest) || geoLocationRequest, 690 | liveChatOperatorsCheckRequest: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.liveChatOperatorsCheckRequest) || liveChatOperatorsCheckRequest, 691 | notificationRequest: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.notificationRequest) || notificationRequest, 692 | notificationDisplay: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.notificationDisplay) || notificationDisplay, 693 | chatUpdate: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatUpdate) || chatUpdate, 694 | chatTimerAnnouncementsRequest: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.chatTimerAnnouncementsRequest) || chatTimerAnnouncementsRequest, 695 | reset: (moduleEvents === null || moduleEvents === void 0 ? void 0 : moduleEvents.reset) || reset, 696 | }; 697 | } 698 | return DialogLanguageModule; 699 | }()); 700 | 701 | var ckModuleInit = function (config) { return new DialogLanguageModule(config); }; 702 | 703 | exports.default = ckModuleInit; 704 | //# sourceMappingURL=index.js.map 705 | -------------------------------------------------------------------------------- /dist/index.es.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.es.js","sources":["../node_modules/tslib/tslib.es6.js","../src/events/defaultUiEvents.ts","../src/utils/helpers.ts","../src/utils/regExp.ts","../src/utils/resultControl.ts","../src/utils/announcements.ts","../src/utils/notifications.ts","../src/events/moduleEvents.ts","../src/module/DialogLanguage.ts","../src/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { SendMessageData, UIManagmentEvents, NotificationsEvents, ModulesEvents, ModulesData } from '../@types/uiEvents'\n\nexport const defaultSendMessage = (data: SendMessageData) => console.log('no SendMessage')\nexport const defaultUIManagment = (uiManagmentEvent: UIManagmentEvents, data: any) => console.log('no UIManagment')\nexport const defaultNotifications = (notificationsEvent: NotificationsEvents, data: any) =>\n console.log('no Notifications')\nexport const defaultModules = (notificationsEvent: ModulesEvents, data: any) => console.log('no modules')\n","import { DialogLanguageEvents } from '../@types/dialogLanguage'\nexport interface EventList {\n [key: string]: string\n}\nexport const eventList: EventList = {\n '00b2fcbe-f27f-437b-a0d5-91072d840ed3': 'ready',\n '29e75851-6cae-44f4-8a9c-f6489c4dca88': 'inactive',\n '11d10788-4789-11e3-9b0b-080027ab4d7b': 'rate',\n 'bffaa961-9ad3-4ecd-9254-f9e2fc06f28c': 'notification',\n '7330d8fc-4c64-11e3-af49-080027ab4d7b': 'context',\n 'd825476d-bc08-4038-9ecf-e6b2b267c7b8': 'click',\n '6819087d-a7d0-4c67-acd4-47d40b233cc9': 'mouse',\n '2bbff8e2-3c75-4f4b-bd61-c29017257c00': 'cardReady',\n '4e729f9a-0aa2-4d37-87d2-bed2b2b39c00': 'operatorStatus',\n 'c189c2f1-43b6-424b-866b-03e562ba9d33': 'chatState',\n '409b58e1-595b-4c02-81be-3f31dfe4639d': 'geolocationTimeout',\n 'b92e3bcc-44b5-4019-9594-54b69afdaf77': 'geolocationDenied',\n}\nexport const postFetch = async (body: any, url: string) => {\n try {\n const fetchResponse = await fetch(url, {\n method: 'POST',\n body: JSON.stringify(body),\n })\n const fetchResult = await fetchResponse.json()\n return fetchResult.result\n } catch (error) {\n console.log(error)\n }\n}\nexport const postFetchWithHeaders = async (body: any, url: string) => {\n try {\n const fetchResponse = await fetch(url, {\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n body: JSON.stringify(body),\n })\n const fetchResult = await fetchResponse.json()\n return fetchResult\n } catch (error) {\n console.log(error)\n }\n}\n\nexport const eventsParser = (activeEvents: string[]) => {\n const events: DialogLanguageEvents = {}\n activeEvents.forEach(activeEvent => {\n const eventName = eventList[activeEvent]\n events[eventName] = activeEvent\n })\n\n return events\n}\nexport const isDevice = () => window && window.innerWidth && window.innerWidth < 1025\n","const msgRegExpReplace = {\n links: {\n regexp: /href=\"event:/gim,\n replace: 'data-type=\"outbound\" rel=\"noopener noreferrer\" href=\"',\n },\n userLinks: {\n regexp: /]*(?!data-request))?(data-request=\"([^\"]+)?\")?>(.*?)<\\/userlink>/gim,\n replace: \"$4\",\n },\n newPara: {\n regexp: / \\(NEW_PARA\\)|\\(NEW_PARA\\)/gim,\n replace: '',\n },\n newParaButtons: {\n regexp: / \\(NEW_PARA\\)(.*)|\\(NEW_PARA\\)(.*)/gim,\n replace: \"$1$2\",\n },\n userLinksAsButtons: {\n regexp: /]*(?!data-request))?(data-request=\"([^\"]+)?\")?>(.*?)<\\/userlink>/gim,\n replace: \"$4\",\n },\n}\n\nconst links = msgRegExpReplace.links\nconst userLinks = msgRegExpReplace.userLinks\nconst userLinksAsButtons = msgRegExpReplace.userLinksAsButtons\nconst newPara = msgRegExpReplace.newPara\nconst newParaButtons = msgRegExpReplace.newParaButtons\n\nconst msgPrepare = (text: string, context: any) => {\n if (/UserLinkAsButton/gim.test(context?.wcmd_show_mode)) {\n if (/\\(NEW_PARA\\)/gim.test(context?.wcmd_show_mode)) {\n return text\n .replace(links?.regexp, links?.replace)\n .replace(newParaButtons?.regexp, newParaButtons?.replace)\n .replace(userLinks?.regexp, userLinks?.replace)\n } else {\n return text\n .replace(links?.regexp, links?.replace)\n .replace(newPara?.regexp, newPara?.replace)\n .replace(userLinksAsButtons?.regexp, userLinksAsButtons?.replace)\n }\n }\n return text\n .replace(links?.regexp, links?.replace)\n .replace(newPara?.regexp, newPara?.replace)\n .replace(userLinks?.regexp, userLinks?.replace)\n}\n\nexport { msgPrepare }\n","import { DialogLanguageModule } from '../@types/dialogLanguage'\nimport { SendMessageData, UIManagmentData } from '../@types/uiEvents'\nimport { msgPrepare } from './regExp'\n\nexport const resultControl = async (module: DialogLanguageModule, result: any) => {\n if (result?.text?.value && result?.context) {\n const text = msgPrepare(result.text.value, result.context)\n const data: SendMessageData = {\n text: text,\n sender: 'request',\n showRate: result?.text?.showRate,\n module: module.name,\n }\n const wflagHideReply = result.context?.wflag_hide_reply !== '1'\n wflagHideReply && text && (await module.uiDispatcher('sendMessage', data))\n }\n if (result?.text?.showRate) {\n const data: UIManagmentData = {\n uiManagmentEvent: 'showRate',\n data: true,\n }\n await module.uiDispatcher('uiManagment', data)\n }\n}\n","import { DialogLanguageModule } from '../@types/dialogLanguage'\nimport { resultControl } from './resultControl'\n\nexport const announcements = (module: DialogLanguageModule, announcements: any) => {\n if (announcements.length! > 0) return\n announcements.forEach(async (message: any) => await resultControl(module, message.result))\n}\n","import { DialogLanguageModule } from '../@types/dialogLanguage'\n\nexport const notifications = (module: DialogLanguageModule, notificationsRequestResult: any) => {\n const { randomMsg, ...notificationsSettings } = notificationsRequestResult\n module.uiDispatcher('notifications', { notificationEvent: 'addMessages', data: randomMsg })\n module.uiDispatcher('notifications', {notificationEvent: 'addSettings', data: notificationsSettings})\n}\n","import { postFetch, isDevice, eventsParser, postFetchWithHeaders } from '../utils/helpers'\n\nimport {\n SetInfoData,\n ChatInitData,\n ChatRequestData,\n ChatEventData,\n ChatRateData,\n ChatTrackData,\n NotificationDisplayData,\n ChatTimerAnnouncementsRequestData,\n} from '../@types/moduleEvents'\nimport { DialogLanguageModule } from '../@types/dialogLanguage'\nimport { resultControl } from '../utils/resultControl'\nimport { announcements } from '../utils/announcements'\nimport { notifications } from '../utils/notifications'\n\nexport const setInfo = (module: DialogLanguageModule, data: SetInfoData) => {\n const { cuid, events } = data\n module.info.cuid = cuid\n if (!events) return\n module.info.events = eventsParser(Object.keys(events))\n}\nexport const reset = async (module: DialogLanguageModule, data: ChatInitData) => {\n await module.moduleDispatcher('chatInit', data)\n module.uiDispatcher('modules', {\n modulesEvent: 'updateModule',\n data: { moduleName: module.name, config: { info: module.info, api: module.api } },\n })\n}\nexport const chatInit = async (module: DialogLanguageModule, data: ChatInitData) => {\n const { uuid } = module.info\n const cuid = data?.moduleInfo?.cuid\n const events = data?.moduleInfo?.events\n const { infApiUrl } = module.api\n const { clientConfig } = data\n const url = `${infApiUrl}/Chat.init`\n const body = {\n uuid: uuid,\n cuid: cuid || '',\n context: {\n ...clientConfig,\n isDevice: isDevice(),\n },\n }\n const result = await postFetch(body, url)\n const info: SetInfoData =\n result?.cuid === cuid\n ? {\n cuid: cuid || '',\n events: events,\n }\n : {\n cuid: result.cuid,\n events: result.events,\n }\n module.moduleDispatcher('setInfo', info)\n !(result?.cuid === cuid) && module.moduleDispatcher('chatEvent', { eventName: 'ready', context: {} })\n return resultControl(module, result)\n}\n\nexport const chatRequest = async (module: DialogLanguageModule, data: ChatRequestData) => {\n const { cuid } = module.info\n const { infApiUrl } = module.api\n const { text, context } = data\n const url = `${infApiUrl}/Chat.request`\n const body = {\n cuid: cuid,\n text: text,\n context: {\n ...context,\n isDevice: isDevice(),\n },\n }\n const result = await postFetch(body, url)\n resultControl(module, result)\n}\nexport const chatEvent = async (module: DialogLanguageModule, data: ChatEventData) => {\n const { cuid, events } = module.info\n const { infApiUrl } = module.api\n let text = ''\n const { eventName, context } = data\n if (eventName === 'geolocationDenied') text = 'LOCATION DENIED'\n if (eventName === 'geolocationTimeout') text = 'REQUEST TIMEOUT ERROR'\n const url = `${infApiUrl}/Chat.event`\n const body = {\n cuid: cuid,\n euid: events[eventName] || '00b2fcbe-f27f-437b-a0d5-91072d840ed3',\n text,\n context: {\n ...context,\n isDevice: isDevice(),\n },\n }\n const result = await postFetch(body, url)\n console.log(result)\n resultControl(module, result)\n}\nexport const chatRate = async (module: DialogLanguageModule, data: ChatRateData) => {\n const { cuid } = module.info\n const { infApiUrl } = module.api\n const { rating } = data\n const url = `${infApiUrl}/Chat.rate`\n const body = {\n cuid: cuid,\n rating: rating,\n context: {\n isDevice: isDevice(),\n },\n }\n const { result } = await postFetchWithHeaders(body, url)\n return resultControl(module, result)\n}\n\nexport const chatTrack = async (module: DialogLanguageModule, data: ChatTrackData) => {\n const { cuid } = module.info\n const { infApiUrl } = module.api\n const url = `${infApiUrl}/Chat.track`\n const { args, action } = data\n const body = {\n cuid: cuid,\n arguments: args,\n action: action,\n }\n const result = await postFetch(body, url)\n return resultControl(module, result)\n}\n\nexport const geoLocationRequest = async (module: DialogLanguageModule) => {\n try {\n const { geoLocationApiUrl } = module.api\n const request = await fetch(geoLocationApiUrl)\n const content = await request.json()\n return content\n } catch (error) {\n console.log(error)\n }\n}\nexport const liveChatOperatorsCheckRequest = async (module: DialogLanguageModule) => {\n try {\n const { liveChatOperatorsApiUrl } = module.api\n const request = await fetch(liveChatOperatorsApiUrl)\n const content = await request.json()\n return content\n } catch (error) {\n console.log(error)\n }\n}\nexport const notificationRequest = async (module: DialogLanguageModule) => {\n const { notificationsApiUrl } = module.api\n try {\n const request = await fetch(notificationsApiUrl)\n const content = await request.json()\n return notifications(module, content)\n } catch (error) {\n console.log(error)\n }\n}\n\nexport const notificationDisplay = async (module: DialogLanguageModule, data: NotificationDisplayData) => {\n const { notificationsApiUrl } = module.api\n const { messageId } = data\n const url = `${notificationsApiUrl}?a=show&id=${messageId}`\n try {\n await fetch(url)\n } catch (error) {\n console.log(error)\n }\n}\nexport const chatUpdate = async (module: DialogLanguageModule) => {\n const { cuid } = module.info\n const { chatUpdateApiUrl } = module.api\n const url = `${chatUpdateApiUrl}/Chat.update`\n const body = {\n cuid: cuid,\n }\n const { answers } = await postFetch(body, url)\n return answers\n}\nexport const chatTimerAnnouncementsRequest = async (\n module: DialogLanguageModule,\n data: ChatTimerAnnouncementsRequestData\n) => {\n const { cuid } = module.info\n const { chatTimerAnnouncementsApiUrl } = module.api\n const { userActive } = data\n const body = {\n cuid: cuid,\n user_active: userActive,\n }\n const { answers } = await postFetch(body, chatTimerAnnouncementsApiUrl)\n return announcements(module, answers)\n}\n","import {\n DialogLanguageInfo,\n ModuleEvents,\n UiEvents,\n DialogLanguageConfig,\n DialogLanguageApi,\n} from '../@types/dialogLanguage'\n\nimport {\n ModuleEventsData,\n ChatInitData,\n ChatEventData,\n ChatRequestData,\n SetInfoData,\n ModuleEventsNames,\n ChatRateData,\n ChatTrackData,\n ChatTimerAnnouncementsRequestData,\n NotificationDisplayData,\n} from '../@types/moduleEvents'\nimport {\n UiEventsNames,\n UiEventsData,\n SendMessageData,\n UIManagmentData,\n NotificationsData,\n ModulesData,\n} from '../@types/uiEvents'\nimport { defaultSendMessage, defaultUIManagment, defaultNotifications, defaultModules } from '../events/defaultUiEvents'\nimport {\n setInfo,\n chatInit,\n chatEvent,\n chatRequest,\n chatRate,\n chatTrack,\n geoLocationRequest,\n liveChatOperatorsCheckRequest,\n notificationRequest,\n notificationDisplay,\n chatUpdate,\n chatTimerAnnouncementsRequest,\n reset,\n} from '../events/moduleEvents'\nconst {\n INF_API_URL,\n GEO_LACATION_API_URL,\n LIVE_CHAT_OPERATORS_API_URL,\n NOTIFICATIONS_API_URL,\n CHAT_TIMER_ANNOUNCEMENTS_API_URL,\n CHAT_UPDATE_API_URL,\n} = process.env\nclass DialogLanguageModule {\n name: string\n ckStore?: any \n api: DialogLanguageApi\n info: DialogLanguageInfo\n moduleEvents: ModuleEvents\n uiEvents: UiEvents\n constructor(config: DialogLanguageConfig) {\n const { info, api, moduleEvents, uiEvents, ckStore } = config\n this.name = 'dialogLanguage'\n this.ckStore = ckStore\n this.info = {\n cuid: '',\n uuid: info.uuid,\n events: {},\n }\n this.api = {\n infApiUrl: api?.infApiUrl || INF_API_URL || '',\n geoLocationApiUrl: api?.geoLocationApiUrl || GEO_LACATION_API_URL || '',\n liveChatOperatorsApiUrl: api?.liveChatOperatorsApiUrl || `${LIVE_CHAT_OPERATORS_API_URL}=${document.URL}` || ``,\n notificationsApiUrl: api?.notificationsApiUrl || `${NOTIFICATIONS_API_URL}${this.info.uuid}.json` || ``,\n chatTimerAnnouncementsApiUrl: api?.chatTimerAnnouncementsApiUrl || CHAT_TIMER_ANNOUNCEMENTS_API_URL || '',\n chatUpdateApiUrl: api?.chatUpdateApiUrl || CHAT_UPDATE_API_URL || '',\n }\n this.uiEvents = {\n sendMessage: uiEvents?.sendMessage || defaultSendMessage,\n uiManagment: uiEvents?.uiManagment || defaultUIManagment,\n notifications: uiEvents?.notifications || defaultNotifications,\n modules: uiEvents?.modules || defaultModules,\n }\n this.moduleEvents = {\n setInfo: moduleEvents?.setInfo || setInfo,\n chatInit: moduleEvents?.chatInit || chatInit,\n chatEvent: moduleEvents?.chatEvent || chatEvent,\n chatRequest: moduleEvents?.chatRequest || chatRequest,\n chatRate: moduleEvents?.chatRate || chatRate,\n chatTrack: moduleEvents?.chatTrack || chatTrack,\n geoLocationRequest: moduleEvents?.geoLocationRequest || geoLocationRequest,\n liveChatOperatorsCheckRequest: moduleEvents?.liveChatOperatorsCheckRequest || liveChatOperatorsCheckRequest,\n notificationRequest: moduleEvents?.notificationRequest || notificationRequest,\n notificationDisplay: moduleEvents?.notificationDisplay || notificationDisplay,\n chatUpdate: moduleEvents?.chatUpdate || chatUpdate,\n chatTimerAnnouncementsRequest: moduleEvents?.chatTimerAnnouncementsRequest || chatTimerAnnouncementsRequest,\n reset: moduleEvents?.reset || reset,\n }\n }\n moduleDispatcher = async (event: ModuleEventsNames, data?: ModuleEventsData) => {\n event === 'chatInit' && data && (await this.moduleEvents[event](this, data as ChatInitData))\n event === 'chatEvent' && data && (await this.moduleEvents[event](this, data as ChatEventData))\n event === 'chatRequest' && data && (await this.moduleEvents[event](this, data as ChatRequestData))\n event === 'setInfo' && data && (await this.moduleEvents[event](this, data as SetInfoData))\n event === 'chatRate' && data && (await this.moduleEvents[event](this, data as ChatRateData))\n event === 'chatTrack' && data && (await this.moduleEvents[event](this, data as ChatTrackData))\n event === 'chatUpdate' && (await this.moduleEvents[event](this))\n event === 'chatTimerAnnouncementsRequest' &&\n data &&\n (await this.moduleEvents[event](this, data as ChatTimerAnnouncementsRequestData))\n event === 'notificationDisplay' && data && (await this.moduleEvents[event](this, data as NotificationDisplayData))\n event === 'notificationRequest' && (await this.moduleEvents[event](this))\n event === 'geoLocationRequest' && (await this.moduleEvents[event](this))\n event === 'liveChatOperatorsCheckRequest' && (await this.moduleEvents[event](this))\n event === 'reset' && (await this.moduleEvents[event](this, data as ChatInitData))\n }\n uiDispatcher = (event: UiEventsNames, data: UiEventsData) => {\n event === 'sendMessage' && this.uiEvents[event](data as SendMessageData, this.ckStore)\n event === 'uiManagment' &&\n this.uiEvents[event]((data as UIManagmentData).uiManagmentEvent, (data as UIManagmentData).data, this.ckStore)\n event === 'notifications' &&\n this.uiEvents[event]((data as NotificationsData).notificationEvent, (data as NotificationsData).data, this.ckStore)\n event === 'modules' && this.uiEvents[event]((data as ModulesData).modulesEvent, (data as ModulesData).data, this.ckStore)\n }\n}\nexport { DialogLanguageModule }\n","import { DialogLanguageModule } from './module/DialogLanguage'\nimport { DialogLanguageConfig } from './@types/dialogLanguage'\nconst ckModuleInit = (config: DialogLanguageConfig) => new DialogLanguageModule(config)\nexport default ckModuleInit\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,SAAS;AACT,QAAQ,OAAO,CAAC,CAAC;AACjB,MAAK;AACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC3C,EAAC;AACD;AACO,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE;AAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACf,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CA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