@botpress/webchat 0.5.1 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/dist/App.d.ts +10 -0
  2. package/dist/Utils/colors.d.ts +18 -0
  3. package/dist/Utils/eventEmitter.d.ts +12 -0
  4. package/dist/Utils/index.d.ts +2 -0
  5. package/dist/client/MessagingClient.d.ts +27 -0
  6. package/dist/client/adapters/Audio.d.ts +19 -0
  7. package/dist/client/adapters/Card.d.ts +188 -0
  8. package/dist/client/adapters/Carousel.d.ts +147 -0
  9. package/dist/client/adapters/Choice.d.ts +45 -0
  10. package/dist/client/adapters/Dropdown.d.ts +46 -0
  11. package/dist/client/adapters/File.d.ts +19 -0
  12. package/dist/client/adapters/Image.d.ts +19 -0
  13. package/dist/client/adapters/Location.d.ts +27 -0
  14. package/dist/client/adapters/Message.d.ts +433 -0
  15. package/dist/client/adapters/Text.d.ts +20 -0
  16. package/dist/client/adapters/Utils.d.ts +5 -0
  17. package/dist/client/adapters/Video.d.ts +19 -0
  18. package/dist/client/adapters/Voice.d.ts +15 -0
  19. package/dist/client/adapters/index.d.ts +12 -0
  20. package/dist/client/index.d.ts +2 -0
  21. package/dist/components/Avatar.d.ts +6 -0
  22. package/dist/components/Block.d.ts +4 -0
  23. package/dist/components/Composer.d.ts +12 -14
  24. package/dist/components/Container.d.ts +2 -12
  25. package/dist/components/Header.d.ts +36 -26
  26. package/dist/components/LoadingIndicator.d.ts +2 -0
  27. package/dist/components/Message.d.ts +7 -0
  28. package/dist/components/MessageList.d.ts +2 -0
  29. package/dist/components/Modal.d.ts +17 -0
  30. package/dist/components/RestartConversation.d.ts +5 -0
  31. package/dist/components/Webchat.d.ts +6 -0
  32. package/dist/components/dev-tools/DevTools.d.ts +1 -0
  33. package/dist/components/dev-tools/configuration.d.ts +2 -0
  34. package/dist/components/dev-tools/helpers.d.ts +5 -0
  35. package/dist/components/index.d.ts +12 -0
  36. package/dist/components/renderers/Audio.d.ts +3 -0
  37. package/dist/components/renderers/Bubble.d.ts +5 -0
  38. package/dist/components/renderers/Button.d.ts +4 -0
  39. package/dist/components/renderers/Carousel.d.ts +3 -0
  40. package/dist/components/renderers/Column.d.ts +5 -0
  41. package/dist/components/renderers/Dropdown.d.ts +5 -0
  42. package/dist/components/renderers/File.d.ts +3 -0
  43. package/dist/components/renderers/Image.d.ts +3 -0
  44. package/dist/components/renderers/Location.d.ts +3 -0
  45. package/dist/components/renderers/Row.d.ts +5 -0
  46. package/dist/components/renderers/Text.d.ts +4 -0
  47. package/dist/components/renderers/Video.d.ts +3 -0
  48. package/dist/components/renderers/index.d.ts +2 -0
  49. package/dist/contexts/ComposerContext.d.ts +8 -0
  50. package/dist/contexts/MessageContext.d.ts +8 -0
  51. package/dist/contexts/ModalContext.d.ts +14 -0
  52. package/dist/contexts/WebchatContext.d.ts +56 -0
  53. package/dist/contexts/index.d.ts +4 -0
  54. package/dist/hooks/index.d.ts +3 -0
  55. package/dist/hooks/useImageSize.d.ts +2 -0
  56. package/dist/hooks/useRefresh.d.ts +10 -0
  57. package/dist/hooks/useWebchatStore.d.ts +30 -0
  58. package/dist/index.d.ts +3 -17
  59. package/dist/index.js +43569 -48
  60. package/dist/index.umd.cjs +702 -0
  61. package/dist/main.d.ts +11 -13
  62. package/dist/providers/ModalProvider.d.ts +8 -0
  63. package/dist/providers/WebchatProvider.d.ts +13 -0
  64. package/dist/providers/index.d.ts +2 -0
  65. package/dist/schemas/index.d.ts +1 -0
  66. package/dist/schemas/theme.d.ts +3371 -0
  67. package/dist/services/clipboard.d.ts +1 -0
  68. package/dist/services/images.d.ts +2 -0
  69. package/dist/services/index.d.ts +3 -0
  70. package/dist/services/toast.d.ts +17 -0
  71. package/dist/themes/dawn.d.ts +2 -0
  72. package/dist/themes/duskTheme.d.ts +2 -0
  73. package/dist/themes/eggplant.d.ts +2 -0
  74. package/dist/themes/galaxy.d.ts +2 -0
  75. package/dist/themes/index.d.ts +6 -0
  76. package/dist/themes/midnight.d.ts +2 -0
  77. package/dist/themes/prism.d.ts +2 -0
  78. package/dist/twind.config.d.ts +9 -0
  79. package/dist/types/block-type.d.ts +93 -0
  80. package/dist/types/image.d.ts +11 -0
  81. package/dist/types/index.d.ts +2 -0
  82. package/package.json +61 -49
  83. package/README.md +0 -41
  84. package/assets/fonts/roboto/roboto.woff2 +0 -0
  85. package/assets/fonts/roboto/roboto500.woff2 +0 -0
  86. package/assets/fonts/roboto.css +0 -128
  87. package/assets/notification.mp3 +0 -0
  88. package/dist/components/Composer.js +0 -118
  89. package/dist/components/Container.js +0 -62
  90. package/dist/components/ConversationList.d.ts +0 -10
  91. package/dist/components/ConversationList.js +0 -41
  92. package/dist/components/Footer.d.ts +0 -3
  93. package/dist/components/Footer.js +0 -21
  94. package/dist/components/Header.js +0 -181
  95. package/dist/components/VoiceRecorder.d.ts +0 -10
  96. package/dist/components/VoiceRecorder.js +0 -137
  97. package/dist/components/common/Avatar/index.d.ts +0 -9
  98. package/dist/components/common/Avatar/index.js +0 -13
  99. package/dist/components/common/BotInfo/index.d.ts +0 -10
  100. package/dist/components/common/BotInfo/index.js +0 -107
  101. package/dist/components/common/BotInfo/style.scss +0 -88
  102. package/dist/components/common/ConfirmDialog/index.d.ts +0 -11
  103. package/dist/components/common/ConfirmDialog/index.js +0 -78
  104. package/dist/components/common/ConfirmDialog/style.module.scss +0 -48
  105. package/dist/components/common/Dialog/index.d.ts +0 -17
  106. package/dist/components/common/Dialog/index.js +0 -57
  107. package/dist/components/common/Dialog/style.module.scss +0 -29
  108. package/dist/components/common/ToolTip/index.d.ts +0 -10
  109. package/dist/components/common/ToolTip/index.js +0 -163
  110. package/dist/components/common/ToolTip/style.module.scss +0 -108
  111. package/dist/components/common/ToolTip/utils.d.ts +0 -15
  112. package/dist/components/common/ToolTip/utils.js +0 -78
  113. package/dist/components/common/variables.scss +0 -38
  114. package/dist/components/messages/InlineFeedback.d.ts +0 -11
  115. package/dist/components/messages/InlineFeedback.js +0 -56
  116. package/dist/components/messages/Message.d.ts +0 -11
  117. package/dist/components/messages/Message.js +0 -106
  118. package/dist/components/messages/MessageGroup.d.ts +0 -23
  119. package/dist/components/messages/MessageGroup.js +0 -63
  120. package/dist/components/messages/MessageList.d.ts +0 -10
  121. package/dist/components/messages/MessageList.js +0 -148
  122. package/dist/core/api.d.ts +0 -23
  123. package/dist/core/api.js +0 -117
  124. package/dist/core/constants.d.ts +0 -14
  125. package/dist/core/constants.js +0 -29
  126. package/dist/core/socket.d.ts +0 -14
  127. package/dist/core/socket.js +0 -57
  128. package/dist/declaration.d.ts +0 -2
  129. package/dist/declaration.js +0 -1
  130. package/dist/fonts/roboto.d.ts +0 -4
  131. package/dist/fonts/roboto.js +0 -9
  132. package/dist/globals.d.ts +0 -7
  133. package/dist/globals.js +0 -2
  134. package/dist/icons/Add.d.ts +0 -6
  135. package/dist/icons/Add.js +0 -10
  136. package/dist/icons/Cancel.d.ts +0 -5
  137. package/dist/icons/Cancel.js +0 -10
  138. package/dist/icons/Chat.d.ts +0 -6
  139. package/dist/icons/Chat.js +0 -9
  140. package/dist/icons/Close.d.ts +0 -3
  141. package/dist/icons/Close.js +0 -10
  142. package/dist/icons/Delete.d.ts +0 -3
  143. package/dist/icons/Delete.js +0 -11
  144. package/dist/icons/Download.d.ts +0 -3
  145. package/dist/icons/Download.js +0 -10
  146. package/dist/icons/Email.d.ts +0 -3
  147. package/dist/icons/Email.js +0 -8
  148. package/dist/icons/Information.d.ts +0 -3
  149. package/dist/icons/Information.js +0 -12
  150. package/dist/icons/List.d.ts +0 -3
  151. package/dist/icons/List.js +0 -15
  152. package/dist/icons/Microphone.d.ts +0 -5
  153. package/dist/icons/Microphone.js +0 -12
  154. package/dist/icons/Phone.d.ts +0 -3
  155. package/dist/icons/Phone.js +0 -8
  156. package/dist/icons/Reload.d.ts +0 -3
  157. package/dist/icons/Reload.js +0 -10
  158. package/dist/icons/ThumbsDown.d.ts +0 -3
  159. package/dist/icons/ThumbsDown.js +0 -11
  160. package/dist/icons/ThumbsUp.d.ts +0 -3
  161. package/dist/icons/ThumbsUp.js +0 -11
  162. package/dist/icons/Website.d.ts +0 -3
  163. package/dist/icons/Website.js +0 -8
  164. package/dist/main.js +0 -336
  165. package/dist/store/composer.d.ts +0 -17
  166. package/dist/store/composer.js +0 -98
  167. package/dist/store/index.d.ts +0 -89
  168. package/dist/store/index.js +0 -604
  169. package/dist/store/view.d.ts +0 -61
  170. package/dist/store/view.js +0 -365
  171. package/dist/translations/ar.json +0 -30
  172. package/dist/translations/de.json +0 -32
  173. package/dist/translations/en.json +0 -40
  174. package/dist/translations/es.json +0 -19
  175. package/dist/translations/fr.json +0 -40
  176. package/dist/translations/index.d.ts +0 -9
  177. package/dist/translations/index.js +0 -95
  178. package/dist/translations/it.json +0 -38
  179. package/dist/translations/pt.json +0 -19
  180. package/dist/translations/ru.json +0 -24
  181. package/dist/translations/uk.json +0 -24
  182. package/dist/typings.d.ts +0 -410
  183. package/dist/typings.js +0 -2
  184. package/dist/utils/analytics.d.ts +0 -5
  185. package/dist/utils/analytics.js +0 -37
  186. package/dist/utils/index.d.ts +0 -3
  187. package/dist/utils/index.js +0 -27
  188. package/dist/utils/storage.d.ts +0 -16
  189. package/dist/utils/storage.js +0 -129
  190. package/dist/utils/webchatEvents.d.ts +0 -2
  191. package/dist/utils/webchatEvents.js +0 -14
@@ -1,38 +0,0 @@
1
- {
2
- "composer.dropdownPlaceholder": "Seleziona una scelta",
3
- "composer.placeholder": "Rispondi a {name}",
4
- "composer.placeholderInit": "Scrivi qualcosa a {name}",
5
- "composer.message": "Messaggio da inviare",
6
- "composer.send": "Invia",
7
- "footer.poweredBy": "We're {icon} by {link}",
8
- "header.conversations": "Conversazioni",
9
- "header.hideChatWindow": "Nascondi la finestra chat",
10
- "header.deleteConversation": "Sei sicuro di voler eliminare l'intera conversazione?",
11
- "header.deleteConversationYes": "Elimina",
12
- "header.deleteConversationNo": "Annulla",
13
- "conversationList.untitledConversation": "Conversazione senza titolo",
14
- "conversationList.title": "Conversazione {id}",
15
- "botInfo.backToConversation": "Ritorna alla Conversazione",
16
- "botInfo.startConversation": "Avvia Conversazione",
17
- "botInfo.privacyPolicy": "Vedi Privacy Policy",
18
- "botInfo.termsAndConditions": "Vedi Terms of Service",
19
- "botInfo.preferredLanguage": "Lingua preferita",
20
- "store.resetSessionMessage": "Azzera conversazione",
21
- "loginForm.userName": "Username",
22
- "loginForm.password": "Password",
23
- "loginForm.submit": "Invia",
24
- "loginForm.formTitle": "Login form",
25
- "loginForm.providedCredentials": "Credenziali fornite",
26
- "message.botSaid": "Virtual assistant dice : ",
27
- "message.fromBotLabel": "Virtual Assistant",
28
- "message.fromMeLabel": "Io",
29
- "message.iSaid": "Io ho detto : ",
30
- "messages.newMessage": "Nuovo messaggio",
31
- "messages.newMessages": "Nuovi messaggi",
32
- "messages.readMore": "Leggi altro",
33
- "messages.showLess": "Mostra meno",
34
- "message.thumbsUp": "Pollice Su",
35
- "message.thumbsDown": "Pollice Giù",
36
- "widget.title": "Finestra Chat",
37
- "widget.toggle": "Togli finestra chat"
38
- }
@@ -1,19 +0,0 @@
1
- {
2
- "composer.placeholder": "Fale com {name}",
3
- "composer.placeholderInit": "Diga alguma coisa para {name}",
4
- "composer.send": "Mandar",
5
- "header.conversations": "Conversas",
6
- "header.deleteConversation": "Tem certeza de que deseja excluir toda esta conversa?",
7
- "header.deleteConversationYes": "Excluir",
8
- "header.deleteConversationNo": "Cancelar",
9
- "conversationList.untitledConversation": "Conversa sem título",
10
- "conversationList.title": "Conversa {id}",
11
- "botInfo.backToConversation": "De volta à conversa",
12
- "botInfo.startConversation": "Iniciar conversa",
13
- "botInfo.privacyPolicy": "Ver política de privacidade",
14
- "botInfo.termsAndConditions": "Ver termos de serviço",
15
- "botInfo.preferredLanguage": "Preferred Language",
16
- "store.resetSessionMessage": "Redefinir a conversa",
17
- "messages.newMessage": "Nova mensagem",
18
- "messages.newMessages": "Novas mensagens"
19
- }
@@ -1,24 +0,0 @@
1
- {
2
- "composer.placeholder": "Ответить {name}",
3
- "composer.placeholderInit": "Скажи что-нибудь {name}",
4
- "composer.send": "Отправить",
5
- "header.conversations": "Разговоры",
6
- "header.deleteConversation": "Вы уверены, что хотите удалить всю беседу?",
7
- "header.deleteConversationYes": "удалять",
8
- "header.deleteConversationNo": "отменить",
9
- "conversationList.untitledConversation": "Разговор без названия",
10
- "conversationList.title": "Разговор {id}",
11
- "botInfo.backToConversation": "Назад к разговору",
12
- "botInfo.startConversation": "Начать разговор",
13
- "botInfo.privacyPolicy": "Показать Политику конфиденцеальности",
14
- "botInfo.termsAndConditions": "Показать Условия использования",
15
- "botInfo.preferredLanguage": "Предпочитаемый язык",
16
- "store.resetSessionMessage": "Начать разговор заново",
17
- "loginForm.userName": "Логин",
18
- "loginForm.password": "Пароль",
19
- "loginForm.submit": "Отправить",
20
- "loginForm.formTitle": "Форма для входа",
21
- "loginForm.providedCredentials": "Введенные данные",
22
- "messages.newMessage": "Новое сообщение",
23
- "messages.newMessages": "новые сообщения"
24
- }
@@ -1,24 +0,0 @@
1
- {
2
- "composer.placeholder": "Відповісти {name}",
3
- "composer.placeholderInit": "Скажи щось {name}",
4
- "composer.send": "Надіслати",
5
- "header.conversations": "Розмови",
6
- "header.deleteConversation": "Ви впевнені, що хочете видалити всю цю розмову?",
7
- "header.deleteConversationYes": "Видалити",
8
- "header.deleteConversationNo": "Скасувати",
9
- "conversationList.untitledConversation": "Розмова без назви",
10
- "conversationList.title": "Розмова {id}",
11
- "botInfo.backToConversation": "Повернутись до розмови",
12
- "botInfo.startConversation": "Розпочати розмову",
13
- "botInfo.privacyPolicy": "Показати Політику конфіденційності",
14
- "botInfo.termsAndConditions": "Показати Умови користування",
15
- "botInfo.preferredLanguage": "Бажана мова",
16
- "store.resetSessionMessage": "Розпочати розмову заново",
17
- "loginForm.userName": "Логін",
18
- "loginForm.password": "Пароль",
19
- "loginForm.submit": "Надіслати",
20
- "loginForm.formTitle": "Форма для входу",
21
- "loginForm.providedCredentials": "Введені дані",
22
- "messages.newMessage": "Нове повідомлення",
23
- "messages.newMessages": "нові повідомлення"
24
- }
package/dist/typings.d.ts DELETED
@@ -1,410 +0,0 @@
1
- /// <reference types="react" />
2
- import { UserCredentials } from '@botpress/messaging-socket';
3
- import { RootStore } from './store';
4
- import { BPStorage } from './utils/storage';
5
- declare global {
6
- interface Window {
7
- __BP_VISITOR_SOCKET_ID: string;
8
- __BP_VISITOR_ID: string;
9
- botpressWebChat: any;
10
- store: RootStore;
11
- BOT_ID: string;
12
- SEND_USAGE_STATS: boolean;
13
- USE_SESSION_STORAGE: boolean;
14
- BP_STORAGE: BPStorage;
15
- botpress: {
16
- [moduleName: string]: any;
17
- };
18
- }
19
- }
20
- export declare namespace Renderer {
21
- interface Message {
22
- type?: string;
23
- className?: string;
24
- payload?: any;
25
- store?: RootStore;
26
- bp?: StudioConnector;
27
- fromLabel?: string;
28
- messageId?: uuid;
29
- /** When true, the message isn't wrapped by its bubble */
30
- noBubble?: boolean;
31
- keyboard?: any;
32
- eventId?: string;
33
- isLastGroup?: boolean;
34
- isLastOfGroup?: boolean;
35
- isBotMessage?: boolean;
36
- isLastMessage?: boolean;
37
- sentOn?: Date;
38
- inlineFeedback?: any;
39
- onSendData?: (data: any) => Promise<Message | void>;
40
- onFileUpload?: (label: string, payload: any, file: File) => Promise<void>;
41
- /** Allows to autoplay voice messages coming from the bot */
42
- onAudioEnded?: () => void;
43
- shouldPlay?: boolean;
44
- }
45
- type Button = {
46
- label: string;
47
- payload: any;
48
- preventDoubleClick: boolean;
49
- onButtonClick: (title: any, payload: any) => void;
50
- } & Pick<Message, 'onFileUpload'>;
51
- type Text = {
52
- text: string;
53
- markdown: boolean;
54
- escapeHTML: boolean;
55
- intl?: any;
56
- maxLength?: number;
57
- } & Message;
58
- interface Option {
59
- label: string;
60
- value: string;
61
- }
62
- type Dropdown = {
63
- options: Option[];
64
- buttonText?: string;
65
- escapeHTML: boolean;
66
- allowCreation?: boolean;
67
- placeholderText?: string;
68
- allowMultiple?: boolean;
69
- width?: number;
70
- markdown: boolean;
71
- message: string;
72
- displayInKeyboard?: boolean;
73
- } & Message;
74
- type QuickReply = {
75
- buttons: any;
76
- quick_replies: any;
77
- disableFreeText: boolean;
78
- } & Message;
79
- type QuickReplyButton = {
80
- allowMultipleClick: boolean;
81
- title: string;
82
- } & Button;
83
- interface FileMessage {
84
- file: {
85
- url: string;
86
- title: string;
87
- storage: string;
88
- text: string;
89
- };
90
- escapeTextHTML: boolean;
91
- }
92
- interface VoiceMessage {
93
- file: {
94
- type: string;
95
- audio: string;
96
- autoPlay?: boolean;
97
- };
98
- shouldPlay: boolean;
99
- onAudioEnded: () => void;
100
- }
101
- interface FileInput {
102
- onFileChanged: (event: HTMLInputEvent) => void;
103
- name: string;
104
- className: string;
105
- accept: string;
106
- placeholder: string;
107
- disabled?: boolean;
108
- }
109
- interface Carousel {
110
- elements: Card[];
111
- settings: any;
112
- }
113
- interface Card {
114
- picture: string;
115
- title: string;
116
- subtitle: string;
117
- buttons: CardButton[];
118
- }
119
- interface CardButton {
120
- url: string;
121
- title: string;
122
- type: string;
123
- payload: any;
124
- text: string;
125
- }
126
- }
127
- export declare namespace View {
128
- type MenuAnimations = 'fadeIn' | 'fadeOut' | undefined;
129
- }
130
- /** These are the functions exposed by the studio to the modules */
131
- export interface StudioConnector {
132
- /** Event emitter */
133
- events: any;
134
- /** An axios instance */
135
- axios: any;
136
- getModuleInjector: any;
137
- loadModuleView: any;
138
- }
139
- export declare type WebchatEventType = 'LIFECYCLE.LOADED' | 'LIFECYCLE.READY' | 'UI.OPENED' | 'UI.CLOSED' | 'UI.RESIZE' | 'UI.SET-CLASS' | 'CONFIG.SET' | 'MESSAGE.SENT' | 'MESSAGE.RECEIVED' | 'MESSAGE.SELECTED' | 'USER.CONNECTED';
140
- export interface WebchatEvent {
141
- type: WebchatEventType;
142
- value: any;
143
- chatId: string;
144
- }
145
- export interface Config {
146
- /** Url of the messaging server */
147
- messagingUrl: string;
148
- /** Id of your messaging client */
149
- clientId: string;
150
- /**
151
- * Refers to a specific webchat reference in parent window. Useful when using multiple chat window
152
- * @default 'bp-web-widget'
153
- */
154
- chatId: string;
155
- /**
156
- * Url where the webchat bundle is hosted
157
- * @default: '/'
158
- */
159
- hostUrl?: string;
160
- /**
161
- * Url of the Media File Service where we fetch the bot info
162
- * @default ''
163
- */
164
- mediaFileServiceUrl?: string;
165
- /**
166
- * Key used to encrypt data in the localStorage
167
- * @default '''
168
- */
169
- encryptionKey?: string;
170
- /**
171
- * Provide a path to a stylesheet to customize the webchat
172
- * @default '''
173
- */
174
- stylesheet?: string;
175
- /**
176
- * If false, will hide the conversation list pane
177
- * @default true
178
- */
179
- showConversationsButton?: boolean;
180
- /**
181
- * If true, will display a timestamp under each messages
182
- * @default false
183
- */
184
- showTimestamp?: boolean;
185
- /**
186
- * Allows the user to download the conversation history
187
- * @default true
188
- */
189
- enableTranscriptDownload?: boolean;
190
- /**
191
- * Allows the user to delete its conversation history
192
- * @default false
193
- */
194
- enableConversationDeletion?: boolean;
195
- /**
196
- * Close the webchat when pressing the Esc key
197
- * @default true
198
- */
199
- closeOnEscape?: boolean;
200
- /**
201
- * Displays the bot name to the right of its avatar
202
- * @default ''
203
- */
204
- botName?: string;
205
- /**
206
- * Allows to set a custom composer placeholder
207
- * @default 'Reply to {name}'
208
- */
209
- composerPlaceholder?: string;
210
- /**
211
- * Allow to specify a custom URL for the bot's avatar
212
- * @default '''
213
- */
214
- avatarUrl?: string;
215
- /** Force the display language of the webchat (en, fr, ar, ru, etc..)
216
- * Defaults to the user's browser language if not set
217
- * Set to 'browser' to force use the browser's language
218
- * @default 'browser'
219
- */
220
- locale?: 'browser' | string;
221
- /**
222
- * Small description written under the bot's name
223
- * @default ''
224
- */
225
- botConversationDescription?: string;
226
- /**
227
- * When true, the widget button to open the chat is hidden
228
- * @default false
229
- */
230
- hideWidget?: boolean;
231
- /**
232
- * Disable the slide in / out animations of the webchat
233
- * @default false
234
- */
235
- disableAnimations?: boolean;
236
- /**
237
- * When true, webchat displays a voice icon in the composer to send voice messages (must use Google Speech integration)
238
- * @default false
239
- */
240
- enableVoiceComposer?: boolean;
241
- /**
242
- * Use sessionStorage instead of localStorage, which means the session expires when tab is closed
243
- * @default false
244
- */
245
- useSessionStorage?: boolean;
246
- /**
247
- * Sends an event to the parent container with the width provided
248
- * @default 360
249
- */
250
- containerWidth?: string | number;
251
- /**
252
- * Sets the width of the webchat
253
- * @default 360
254
- */
255
- layoutWidth?: string | number;
256
- /**
257
- * Show Powered By Botpress in the footer
258
- * @default false
259
- */
260
- showPoweredBy?: boolean;
261
- /**
262
- * When enabled, sent messages are persisted to local storage (recall previous messages)
263
- * @default true
264
- */
265
- enablePersistHistory?: boolean;
266
- /**
267
- * Experimental: expose the store to the parent frame for more control on the webchat's behavior
268
- * @default false
269
- */
270
- lazySocket?: boolean;
271
- /**
272
- * If true, chat will no longer play the notification sound for new messages.
273
- * @default false
274
- */
275
- disableNotificationSound?: boolean;
276
- /**
277
- * CSS class to be applied to iframe
278
- * @default ''
279
- */
280
- className?: string;
281
- /**
282
- * Google Maps API Key required to display the map.
283
- * Will display a link to Google Maps otherwise
284
- * @default ''
285
- */
286
- googleMapsAPIKey?: string;
287
- /**
288
- * Allows setting a custom user id
289
- */
290
- customUser?: UserCredentials;
291
- /**
292
- * Displays the bot's website in the conversation page
293
- */
294
- website?: string;
295
- /**
296
- * Displays the bot's contact phone number in the conversation page
297
- */
298
- phoneNumber?: string;
299
- /**
300
- * Displays the bot's terms of service in the conversation page
301
- */
302
- termsConditions?: string;
303
- /**
304
- * Displays the bot's privacy policy in the conversation page
305
- */
306
- privacyPolicy?: string;
307
- /**
308
- * Displays the bot's email address in the conversation page
309
- */
310
- emailAddress?: string;
311
- /**
312
- * Displays the bot's cover picture in the conversation page
313
- */
314
- coverPictureUrl?: string;
315
- /**
316
- * Enables the bot's information page in the webchat
317
- */
318
- showBotInfoPage?: boolean;
319
- /**
320
- * Display's the webchat close button when the webchat is opened
321
- */
322
- showCloseButton?: boolean;
323
- }
324
- export interface BotDetails {
325
- website?: string;
326
- phoneNumber?: string;
327
- termsConditions?: string;
328
- privacyPolicy?: string;
329
- emailAddress?: string;
330
- avatarUrl?: string;
331
- coverPictureUrl?: string;
332
- }
333
- export interface BotInfo {
334
- name: string;
335
- description: string;
336
- details: BotDetails;
337
- showBotInfoPage: boolean;
338
- languages: string[];
339
- security: {
340
- escapeHTML: boolean;
341
- };
342
- lazySocket: boolean;
343
- extraStylesheet?: string;
344
- disableNotificationSound?: boolean;
345
- }
346
- export declare type uuid = string;
347
- export interface Conversation {
348
- id: uuid;
349
- clientId: uuid;
350
- userId: uuid;
351
- createdOn: Date;
352
- }
353
- export interface RecentConversation extends Conversation {
354
- lastMessage?: Message;
355
- }
356
- /** Represents the current conversation with all messages */
357
- export declare type CurrentConversation = {
358
- botId: string;
359
- messages: Message[];
360
- userId: string;
361
- user_last_seen_on: Date | undefined;
362
- /** Event ? */
363
- typingUntil: any;
364
- } & Conversation;
365
- export interface Message {
366
- id: uuid;
367
- conversationId: uuid;
368
- authorId: uuid | undefined;
369
- sentOn: Date;
370
- payload: any;
371
- timeInMs?: number;
372
- }
373
- export interface QueuedMessage {
374
- message: Message;
375
- showAt: Date;
376
- }
377
- export interface HTMLInputEvent extends Event {
378
- target: HTMLInputElement & EventTarget;
379
- }
380
- export interface ChatDimensions {
381
- /**
382
- * The container is the frame around the webchat.
383
- * Setting the container bigger than the layout makes it possible to add components
384
- */
385
- container: string | number;
386
- /** The layout is the zone where the user speaks with the bot */
387
- layout: string | number;
388
- }
389
- export interface CustomButton {
390
- /** An ID to identify your button. It is required to remove it */
391
- id: string;
392
- /** This text will be displayed when the mouse is over the button */
393
- label?: string;
394
- /** Supply either a function or an element which will render the button */
395
- icon: Function | JSX.Element;
396
- /** The event triggered when the button is clicked */
397
- onClick: (buttonId: string, headerComponent: JSX.Element, event: React.MouseEvent) => void;
398
- }
399
- export interface CustomAction {
400
- /** An ID to identify your action. It is required to remove it */
401
- id: string;
402
- /** This text will be displayed in the context menu */
403
- label: string;
404
- /** The event triggered when the action is clicked */
405
- onClick: (actionId: string, messageProps: any, event: React.MouseEvent) => void;
406
- }
407
- export interface EventFeedback {
408
- messageId: uuid;
409
- feedback?: number;
410
- }
package/dist/typings.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export declare const initializeAnalytics: () => void;
2
- export declare type MessageDirection = 'sent' | 'received';
3
- export declare const trackMessage: (direction: MessageDirection) => void;
4
- export declare type WebchatState = 'show' | 'hide' | 'toggle';
5
- export declare const trackWebchatState: (state: WebchatState) => void;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.trackWebchatState = exports.trackMessage = exports.initializeAnalytics = void 0;
7
- const react_ga_1 = __importDefault(require("react-ga"));
8
- const initializeAnalytics = () => {
9
- if (window.SEND_USAGE_STATS) {
10
- try {
11
- react_ga_1.default.initialize('UA-90044826-2');
12
- react_ga_1.default.pageview(`${window.location.pathname}${window.location.search}`);
13
- }
14
- catch (err) {
15
- console.error('Error initializing analytics', err);
16
- }
17
- }
18
- };
19
- exports.initializeAnalytics = initializeAnalytics;
20
- const trackMessage = (direction) => {
21
- if (window.SEND_USAGE_STATS) {
22
- try {
23
- react_ga_1.default.event({ category: 'Interactions', action: `message ${direction}` });
24
- }
25
- catch (_a) { }
26
- }
27
- };
28
- exports.trackMessage = trackMessage;
29
- const trackWebchatState = (state) => {
30
- if (window.SEND_USAGE_STATS) {
31
- try {
32
- react_ga_1.default.event({ category: 'Display', action: state });
33
- }
34
- catch (_a) { }
35
- }
36
- };
37
- exports.trackWebchatState = trackWebchatState;
@@ -1,3 +0,0 @@
1
- export declare const isIE: boolean;
2
- export declare const downloadFile: (name: string, blob: Blob) => void;
3
- export declare const renderUnsafeHTML: (message: string | undefined, escaped: boolean) => string;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.renderUnsafeHTML = exports.downloadFile = exports.isIE = void 0;
7
- const snarkdown_1 = __importDefault(require("snarkdown"));
8
- exports.isIE = window.navigator.userAgent.match(/MSIE|Trident/) !== null;
9
- const downloadFile = (name, blob) => {
10
- const url = window.URL.createObjectURL(blob);
11
- const link = document.createElement('a');
12
- link.href = url;
13
- link.setAttribute('download', name);
14
- document.body.appendChild(link);
15
- link.click();
16
- document.body.removeChild(link);
17
- window.URL.revokeObjectURL(url);
18
- };
19
- exports.downloadFile = downloadFile;
20
- const renderUnsafeHTML = (message = '', escaped) => {
21
- if (escaped) {
22
- message = message.replace(/</g, '&lt;').replace(/>/g, '&gt;');
23
- }
24
- const html = (0, snarkdown_1.default)(message);
25
- return html.replace(/<a href/gi, '<a target="_blank" href');
26
- };
27
- exports.renderUnsafeHTML = renderUnsafeHTML;
@@ -1,16 +0,0 @@
1
- import { Config } from '../typings';
2
- export declare class BPStorage {
3
- private _config?;
4
- private _storage;
5
- constructor(config?: Config);
6
- get config(): Config | undefined;
7
- set config(config: Config | undefined);
8
- private serialize;
9
- private deserialize;
10
- private getStorageKey;
11
- private getDriver;
12
- set<T>(key: string, value: T): void;
13
- get<T = string>(key: string): T | undefined;
14
- del(key: string): void;
15
- }
16
- export default BPStorage;