-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
90 lines (87 loc) · 2.6 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import React from 'react';
import ReactDOM from 'react-dom';
import {
Widget,
toggleChat,
openChat,
closeChat,
showChat,
hideChat,
isOpen,
isVisible,
send,
reload,
clear,
setSessionId
} from './index_for_react_app';
import './src/utils/i18n';
const plugin = {
init: (args) => {
ReactDOM.render(
<Widget
protocol={args.protocol}
socketUrl={args.socketUrl}
protocolOptions={args.protocolOptions}
channelUuid={args.channelUuid}
host={args.host}
initPayload={args.initPayload}
title={args.title}
subtitle={args.subtitle}
customData={args.customData}
inputTextFieldHint={args.inputTextFieldHint}
connectingText={args.connectingText}
profileAvatar={args.profileAvatar}
showCloseButton={args.showCloseButton}
showFullScreenButton={args.showFullScreenButton}
hideWhenNotConnected={args.hideWhenNotConnected}
autoClearCache={args.autoClearCache}
connectOn={args.connectOn}
onSocketEvent={args.onSocketEvent}
fullScreenMode={args.fullScreenMode}
badge={args.badge}
params={args.params}
embedded={args.embedded}
openLauncherImage={args.openLauncherImage}
closeImage={args.closeImage}
docViewer={args.docViewer}
displayUnreadCount={args.displayUnreadCount}
showMessageDate={args.showMessageDate}
customMessageDelay={args.customMessageDelay}
customAutoComplete={args.customAutoComplete}
tooltipMessage={args.tooltipMessage}
tooltipDelay={args.tooltipDelay}
onWidgetEvent={args.onWidgetEvent}
disableTooltips={args.disableTooltips}
defaultHighlightCss={args.defaultHighlightCss}
defaultHighlightAnimation={args.defaultHighlightAnimation}
defaultHighlightClassname={args.defaultHighlightClassname}
customizeWidget={args.customizeWidget}
showHeaderAvatar={args.showHeaderAvatar}
sessionId={args.sessionId}
sessionToken={args.sessionToken}
headerImage={args.headerImage}
startFullScreen={args.startFullScreen}
suggestionsConfig={args.suggestionsConfig}
disableSoundNotification={args.disableSoundNotification}
customSoundNotification={args.customSoundNotification}
clientId={args.clientId}
/>,
document.querySelector(args.selector)
);
}
};
export {
plugin as default,
Widget,
toggleChat as toggle,
openChat as open,
closeChat as close,
showChat as show,
hideChat as hide,
isOpen,
isVisible,
send,
reload,
clear,
setSessionId
};