@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,365 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const merge_1 = __importDefault(require("lodash/merge"));
13
- const mobx_1 = require("mobx");
14
- const constants_1 = __importDefault(require("../core/constants"));
15
- const webchatEvents_1 = require("../utils/webchatEvents");
16
- class ViewStore {
17
- constructor(rootStore, fullscreen) {
18
- /** If false, probably embedded on a website or on the studio */
19
- this.isFullscreen = true;
20
- this.unreadCount = 0;
21
- this.isConversationsDisplayed = false;
22
- this._isLoading = true;
23
- this._showBotInfo = false;
24
- this.isPoweredByDisplayed = true;
25
- this.focusedArea = mobx_1.observable.box('input');
26
- /** These buttons are displayed in the header, and can point to actions on your custom components */
27
- this.customButtons = [];
28
- this.customActions = [];
29
- this.disableAnimations = false;
30
- this.rootStore = rootStore;
31
- this.isFullscreen = fullscreen;
32
- this.activeView = fullscreen ? 'side' : 'widget';
33
- this.dimensions = {
34
- container: fullscreen ? '100%' : constants_1.default.DEFAULT_CONTAINER_WIDTH,
35
- layout: fullscreen ? '100%' : constants_1.default.DEFAULT_LAYOUT_WIDTH
36
- };
37
- }
38
- get showConversationsButton() {
39
- var _a;
40
- return (_a = this.rootStore.config) === null || _a === void 0 ? void 0 : _a.showConversationsButton;
41
- }
42
- get showBotInfoButton() {
43
- var _a;
44
- return (!this.isConversationsDisplayed &&
45
- (((_a = this.rootStore.botInfo) === null || _a === void 0 ? void 0 : _a.showBotInfoPage) || !!this.rootStore.config.showBotInfoPage));
46
- }
47
- get showDownloadButton() {
48
- return !this.isConversationsDisplayed && !this.isBotInfoDisplayed && this.rootStore.config.enableTranscriptDownload;
49
- }
50
- get showDeleteConversationButton() {
51
- return (!this.isConversationsDisplayed && !this.isBotInfoDisplayed && this.rootStore.config.enableConversationDeletion);
52
- }
53
- get showCloseButton() {
54
- var _a, _b;
55
- return (_b = (!this.isFullscreen && ((_a = this.rootStore.config) === null || _a === void 0 ? void 0 : _a.showCloseButton))) !== null && _b !== void 0 ? _b : true;
56
- }
57
- get showWidgetButton() {
58
- var _a;
59
- return !((_a = this.rootStore.config) === null || _a === void 0 ? void 0 : _a.hideWidget);
60
- }
61
- get hasUnreadMessages() {
62
- return this.unreadCount > 0;
63
- }
64
- get isWebchatReady() {
65
- return !this._isLoading && this.activeView;
66
- }
67
- get isBotInfoDisplayed() {
68
- var _a;
69
- return this._showBotInfo && (((_a = this.rootStore.botInfo) === null || _a === void 0 ? void 0 : _a.showBotInfoPage) || !!this.rootStore.config.showBotInfoPage);
70
- }
71
- /** Returns the active transition for the side panel, like fade in or out */
72
- get sideTransition() {
73
- var _a;
74
- return !this.isFullscreen && ((_a = this.transitions) === null || _a === void 0 ? void 0 : _a.sideTransition);
75
- }
76
- get widgetTransition() {
77
- var _a;
78
- return (_a = this.transitions) === null || _a === void 0 ? void 0 : _a.widgetTransition;
79
- }
80
- get displayWidgetView() {
81
- return this.activeView !== 'side' && !this.isFullscreen;
82
- }
83
- /** Sets the current focus to that element */
84
- setFocus(element) {
85
- this.focusedArea.set(element);
86
- }
87
- focusPrevious() {
88
- const current = this._getFocusOrder(this.focusedArea.get());
89
- if (current) {
90
- this.setFocus(current.prev);
91
- }
92
- }
93
- focusNext() {
94
- const current = this._getFocusOrder(this.focusedArea.get());
95
- if (current) {
96
- this.setFocus(current.next);
97
- }
98
- }
99
- incrementUnread() {
100
- this.unreadCount++;
101
- }
102
- resetUnread() {
103
- this.unreadCount = 0;
104
- }
105
- toggleBotInfo() {
106
- this._showBotInfo = !this._showBotInfo;
107
- }
108
- showBotInfo() {
109
- this._showBotInfo = true;
110
- }
111
- toggleConversations() {
112
- this.isConversationsDisplayed = !this.isConversationsDisplayed;
113
- }
114
- hideConversations() {
115
- this.isConversationsDisplayed = false;
116
- }
117
- setLoadingCompleted() {
118
- this._isLoading = false;
119
- (0, webchatEvents_1.postMessageToParent)('LIFECYCLE.LOADED', undefined, this.rootStore.config.chatId);
120
- }
121
- showPoweredBy() {
122
- this.isPoweredByDisplayed = true;
123
- }
124
- hidePoweredBy() {
125
- this.isPoweredByDisplayed = false;
126
- }
127
- setLayoutWidth(width) {
128
- if (width) {
129
- this.dimensions.layout = typeof width === 'number' ? `${width}px` : width;
130
- }
131
- }
132
- setContainerWidth(width) {
133
- if (width) {
134
- this.dimensions.container = width = typeof width === 'number' ? `${width}px` : width;
135
- }
136
- }
137
- addCustomAction(newAction) {
138
- if (this.customActions.find((act) => act.id === newAction.id)) {
139
- console.error("Can't add another action with the same ID.");
140
- return;
141
- }
142
- this.customActions.push(newAction);
143
- }
144
- removeCustomAction(actionId) {
145
- this.customActions = this.customActions.filter((btn) => btn.id !== actionId);
146
- }
147
- addHeaderButton(newButton) {
148
- if (this.customButtons.find((btn) => btn.id === newButton.id)) {
149
- console.error("Can't add another button with the same ID.");
150
- return;
151
- }
152
- this.customButtons.push(newButton);
153
- }
154
- /** Updates one or multiple properties of a specific button */
155
- updateHeaderButton(buttonId, newProps) {
156
- const button = this.customButtons.find((btn) => btn.id === buttonId);
157
- button && (0, merge_1.default)(button, newProps);
158
- }
159
- removeHeaderButton(buttonId) {
160
- this.customButtons = this.customButtons.filter((btn) => btn.id !== buttonId);
161
- }
162
- showChat() {
163
- if (this.disableAnimations) {
164
- this.activeView = 'side';
165
- (0, webchatEvents_1.postMessageToParent)('UI.OPENED', undefined, this.rootStore.config.chatId);
166
- return this._updateTransitions({ widgetTransition: undefined, sideTransition: 'none' });
167
- }
168
- this._updateTransitions({ widgetTransition: 'fadeOut' });
169
- setTimeout(() => {
170
- this._updateTransitions({ sideTransition: 'fadeIn' });
171
- }, constants_1.default.ANIMATION_DURATION + 10);
172
- this._endAnimation('side');
173
- (0, webchatEvents_1.postMessageToParent)('UI.OPENED', undefined, this.rootStore.config.chatId);
174
- }
175
- hideChat() {
176
- if (this.isFullscreen) {
177
- return;
178
- }
179
- if (this.disableAnimations) {
180
- this.activeView = 'widget';
181
- (0, webchatEvents_1.postMessageToParent)('UI.CLOSED', undefined, this.rootStore.config.chatId);
182
- return this._updateTransitions({ widgetTransition: undefined, sideTransition: undefined });
183
- }
184
- this._updateTransitions({ sideTransition: 'fadeOut' });
185
- if (!this.activeView || this.activeView === 'side') {
186
- setTimeout(() => {
187
- this._updateTransitions({ widgetTransition: 'fadeIn' });
188
- }, constants_1.default.ANIMATION_DURATION + 10);
189
- }
190
- this._endAnimation('widget');
191
- (0, webchatEvents_1.postMessageToParent)('UI.CLOSED', undefined, this.rootStore.config.chatId);
192
- }
193
- _endAnimation(finalView) {
194
- setTimeout(() => {
195
- (0, mobx_1.runInAction)(() => {
196
- this.activeView = finalView;
197
- });
198
- }, constants_1.default.ANIMATION_DURATION);
199
- setTimeout(() => {
200
- this._updateTransitions({
201
- widgetTransition: undefined,
202
- sideTransition: this.transitions.sideTransition === 'fadeIn' ? 'fadeIn' : undefined
203
- });
204
- }, constants_1.default.ANIMATION_DURATION * 2.1);
205
- }
206
- _updateTransitions({ widgetTransition, sideTransition }) {
207
- this.transitions = { widgetTransition, sideTransition };
208
- }
209
- _getFocusOrder(current) {
210
- if (current === 'header') {
211
- return { prev: 'input', next: 'convo' };
212
- }
213
- else if (current === 'input' && !this.isConversationsDisplayed && !this.isBotInfoDisplayed) {
214
- return { prev: 'convo', next: 'header' };
215
- }
216
- else if (current === 'convo') {
217
- return { prev: 'header', next: 'input' };
218
- }
219
- }
220
- }
221
- __decorate([
222
- mobx_1.observable
223
- ], ViewStore.prototype, "isFullscreen", void 0);
224
- __decorate([
225
- mobx_1.observable
226
- ], ViewStore.prototype, "unreadCount", void 0);
227
- __decorate([
228
- mobx_1.observable
229
- ], ViewStore.prototype, "dimensions", void 0);
230
- __decorate([
231
- mobx_1.observable
232
- ], ViewStore.prototype, "isConversationsDisplayed", void 0);
233
- __decorate([
234
- mobx_1.observable
235
- ], ViewStore.prototype, "activeView", void 0);
236
- __decorate([
237
- mobx_1.observable
238
- ], ViewStore.prototype, "transitions", void 0);
239
- __decorate([
240
- mobx_1.observable
241
- ], ViewStore.prototype, "_isLoading", void 0);
242
- __decorate([
243
- mobx_1.observable
244
- ], ViewStore.prototype, "_showBotInfo", void 0);
245
- __decorate([
246
- mobx_1.observable
247
- ], ViewStore.prototype, "isPoweredByDisplayed", void 0);
248
- __decorate([
249
- mobx_1.observable
250
- ], ViewStore.prototype, "focusedArea", void 0);
251
- __decorate([
252
- mobx_1.observable
253
- ], ViewStore.prototype, "customButtons", void 0);
254
- __decorate([
255
- mobx_1.observable
256
- ], ViewStore.prototype, "customActions", void 0);
257
- __decorate([
258
- mobx_1.observable
259
- ], ViewStore.prototype, "disableAnimations", void 0);
260
- __decorate([
261
- mobx_1.computed
262
- ], ViewStore.prototype, "showConversationsButton", null);
263
- __decorate([
264
- mobx_1.computed
265
- ], ViewStore.prototype, "showBotInfoButton", null);
266
- __decorate([
267
- mobx_1.computed
268
- ], ViewStore.prototype, "showDownloadButton", null);
269
- __decorate([
270
- mobx_1.computed
271
- ], ViewStore.prototype, "showDeleteConversationButton", null);
272
- __decorate([
273
- mobx_1.computed
274
- ], ViewStore.prototype, "showCloseButton", null);
275
- __decorate([
276
- mobx_1.computed
277
- ], ViewStore.prototype, "showWidgetButton", null);
278
- __decorate([
279
- mobx_1.computed
280
- ], ViewStore.prototype, "hasUnreadMessages", null);
281
- __decorate([
282
- mobx_1.computed
283
- ], ViewStore.prototype, "isWebchatReady", null);
284
- __decorate([
285
- mobx_1.computed
286
- ], ViewStore.prototype, "isBotInfoDisplayed", null);
287
- __decorate([
288
- mobx_1.computed
289
- ], ViewStore.prototype, "sideTransition", null);
290
- __decorate([
291
- mobx_1.computed
292
- ], ViewStore.prototype, "widgetTransition", null);
293
- __decorate([
294
- mobx_1.computed
295
- ], ViewStore.prototype, "displayWidgetView", null);
296
- __decorate([
297
- mobx_1.action.bound
298
- ], ViewStore.prototype, "setFocus", null);
299
- __decorate([
300
- mobx_1.action.bound
301
- ], ViewStore.prototype, "focusPrevious", null);
302
- __decorate([
303
- mobx_1.action.bound
304
- ], ViewStore.prototype, "focusNext", null);
305
- __decorate([
306
- mobx_1.action.bound
307
- ], ViewStore.prototype, "incrementUnread", null);
308
- __decorate([
309
- mobx_1.action.bound
310
- ], ViewStore.prototype, "resetUnread", null);
311
- __decorate([
312
- mobx_1.action.bound
313
- ], ViewStore.prototype, "toggleBotInfo", null);
314
- __decorate([
315
- mobx_1.action.bound
316
- ], ViewStore.prototype, "showBotInfo", null);
317
- __decorate([
318
- mobx_1.action.bound
319
- ], ViewStore.prototype, "toggleConversations", null);
320
- __decorate([
321
- mobx_1.action.bound
322
- ], ViewStore.prototype, "hideConversations", null);
323
- __decorate([
324
- mobx_1.action.bound
325
- ], ViewStore.prototype, "setLoadingCompleted", null);
326
- __decorate([
327
- mobx_1.action.bound
328
- ], ViewStore.prototype, "showPoweredBy", null);
329
- __decorate([
330
- mobx_1.action.bound
331
- ], ViewStore.prototype, "hidePoweredBy", null);
332
- __decorate([
333
- mobx_1.action.bound
334
- ], ViewStore.prototype, "setLayoutWidth", null);
335
- __decorate([
336
- mobx_1.action.bound
337
- ], ViewStore.prototype, "setContainerWidth", null);
338
- __decorate([
339
- mobx_1.action.bound
340
- ], ViewStore.prototype, "addCustomAction", null);
341
- __decorate([
342
- mobx_1.action.bound
343
- ], ViewStore.prototype, "removeCustomAction", null);
344
- __decorate([
345
- mobx_1.action.bound
346
- ], ViewStore.prototype, "addHeaderButton", null);
347
- __decorate([
348
- mobx_1.action.bound
349
- ], ViewStore.prototype, "updateHeaderButton", null);
350
- __decorate([
351
- mobx_1.action.bound
352
- ], ViewStore.prototype, "removeHeaderButton", null);
353
- __decorate([
354
- mobx_1.action.bound
355
- ], ViewStore.prototype, "showChat", null);
356
- __decorate([
357
- mobx_1.action.bound
358
- ], ViewStore.prototype, "hideChat", null);
359
- __decorate([
360
- mobx_1.action.bound
361
- ], ViewStore.prototype, "_endAnimation", null);
362
- __decorate([
363
- mobx_1.action.bound
364
- ], ViewStore.prototype, "_updateTransitions", null);
365
- exports.default = ViewStore;
@@ -1,30 +0,0 @@
1
- {
2
- "composer.placeholder": "الرد على {name}",
3
- "composer.placeholderInit": "قل شيئا ل {name}",
4
- "composer.message": "رسالة لإرسالها",
5
- "composer.send": "إرسال",
6
- "composer.sendMessage": "أرسل رسالة",
7
- "composer.interact": "تفاعل مع الشات بوت الخاص بك",
8
- "header.conversations": "محادثات",
9
- "header.deleteConversation": "هل أنت متأكد أنك تريد حذف هذه المحادثة بأكملها؟",
10
- "header.deleteConversationYes": "حذف",
11
- "header.deleteConversationNo": "إلغاء",
12
- "footer.poweredBy": "{link} نحن مدعومون من",
13
- "conversationList.untitledConversation": "محادثة بلا عنوان",
14
- "conversationList.title": "محادثة {id}",
15
- "botInfo.backToConversation": "العودة الى المحادثة",
16
- "botInfo.startConversation": "بداية محادثة",
17
- "botInfo.privacyPolicy": "عرض سياسة الخصوصية",
18
- "botInfo.termsAndConditions": "عرض شروط الخدمة",
19
- "botInfo.preferredLanguage": "اللغة المفضلة",
20
- "store.resetSessionMessage": "إعادة بدء المحادثة",
21
- "loginForm.userName": "اسم المستخدم",
22
- "loginForm.password": "كلمة المرور",
23
- "loginForm.submit": "تقديم",
24
- "loginForm.formTitle": "نموذج تسجيل الدخول",
25
- "loginForm.providedCredentials": "تم إدخال تفاصيل الدخول",
26
- "messages.newMessage": "رسالة جديدة",
27
- "messages.newMessages": "رسائل جديدة",
28
- "widget.title": "نافذة الدردشة",
29
- "widget.toggle": "تبديل نافذة الدردشة"
30
- }
@@ -1,32 +0,0 @@
1
- {
2
- "composer.placeholder": "Schreibe {name}",
3
- "composer.placeholderInit": "Sag etwas zu {name}",
4
- "composer.message": "Nachricht zum Versenden",
5
- "composer.send": "Senden",
6
- "header.conversations": "Unterhaltungen",
7
- "header.hideChatWindow": "Das Chatfenster verstecken",
8
- "header.deleteConversation": "Möchten Sie das gesamte Gespräch wirklich löschen?",
9
- "header.deleteConversationYes": "Löschen",
10
- "header.deleteConversationNo": "Stornieren",
11
- "conversationList.untitledConversation": "Unbenannte Unterhaltung",
12
- "conversationList.title": "Konversation {id}",
13
- "botInfo.backToConversation": "Zurück zur Unterhaltung",
14
- "botInfo.startConversation": "Unterhaltung beginnen",
15
- "botInfo.privacyPolicy": "Datenschutzerklärung anzeigen",
16
- "botInfo.termsAndConditions": "Geschäftsbedingungen anzeigen",
17
- "botInfo.preferredLanguage": "Bevorzugte Sprache",
18
- "store.resetSessionMessage": "Unterhaltung zurücksetzen",
19
- "loginForm.userName": "Benutzername",
20
- "loginForm.password": "Passwort",
21
- "loginForm.submit": "Absenden",
22
- "loginForm.formTitle": "Anmeldeformular",
23
- "loginForm.providedCredentials": "Bereitgestellte Anmeldedaten",
24
- "message.botSaid": "Virtuelle Assistent sagte : ",
25
- "message.fromBotLabel": "Virtueller Assistent",
26
- "message.fromMeLabel": "Ich",
27
- "message.iSaid": "Ich sagte : ",
28
- "messages.newMessage": "Neue Nachricht",
29
- "messages.newMessages": "Neue Nachrichten",
30
- "widget.title": "Chatfenster",
31
- "widget.toggle": "Chatfenster ein- oder ausblenden"
32
- }
@@ -1,40 +0,0 @@
1
- {
2
- "composer.dropdownPlaceholder": "Select a choice",
3
- "composer.placeholder": "Reply to {name}",
4
- "composer.placeholderInit": "Say something to {name}",
5
- "composer.message": "Message to send",
6
- "composer.send": "Send",
7
- "composer.sendMessage": "Send Message",
8
- "composer.interact": "Interact with your chatbot",
9
- "footer.poweredBy": "We're {icon} by {link}",
10
- "header.conversations": "Conversations",
11
- "header.hideChatWindow": "Hide the chat window",
12
- "header.deleteConversation": "Are you sure you want to delete this entire conversation?",
13
- "header.deleteConversationYes": "Delete",
14
- "header.deleteConversationNo": "Cancel",
15
- "conversationList.untitledConversation": "Untitled Conversation",
16
- "conversationList.title": "Conversation {id}",
17
- "botInfo.backToConversation": "Back to Conversation",
18
- "botInfo.startConversation": "Start Conversation",
19
- "botInfo.privacyPolicy": "View Privacy Policy",
20
- "botInfo.termsAndConditions": "View Terms of Service",
21
- "botInfo.preferredLanguage": "Preferred Language",
22
- "store.resetSessionMessage": "Reset the conversation",
23
- "loginForm.userName": "Username",
24
- "loginForm.password": "Password",
25
- "loginForm.submit": "Submit",
26
- "loginForm.formTitle": "Login form",
27
- "loginForm.providedCredentials": "Provided credentials",
28
- "message.botSaid": "Virtual assistant said : ",
29
- "message.fromBotLabel": "Virtual Assistant",
30
- "message.fromMeLabel": "Me",
31
- "message.iSaid": "I said : ",
32
- "messages.newMessage": "New message",
33
- "messages.newMessages": "New messages",
34
- "messages.readMore": "Read More",
35
- "messages.showLess": "Show Less",
36
- "message.thumbsUp": "Thumbs Up",
37
- "message.thumbsDown": "Thumbs Down",
38
- "widget.title": "Chat window",
39
- "widget.toggle": "Toggle chatbot window"
40
- }
@@ -1,19 +0,0 @@
1
- {
2
- "composer.placeholder": "Responder a {name}",
3
- "composer.placeholderInit": "Decir algo a {name}",
4
- "composer.send": "Enviar",
5
- "header.conversations": "Conversaciones",
6
- "header.deleteConversation": "¿Estás seguro de que deseas eliminar toda esta conversación?",
7
- "header.deleteConversationYes": "Eliminar",
8
- "header.deleteConversationNo": "Cancelar",
9
- "conversationList.untitledConversation": "Conversación sin título",
10
- "conversationList.title": "Conversacion {id}",
11
- "botInfo.backToConversation": "Volver a conversar",
12
- "botInfo.startConversation": "Iniciar conversación",
13
- "botInfo.privacyPolicy": "Ver política de privacidad",
14
- "botInfo.termsAndConditions": "Ver términos de servicio",
15
- "botInfo.preferredLanguage": "Preferred Language",
16
- "store.resetSessionMessage": "Restablecer la conversación",
17
- "messages.newMessage": "Nuevo mensaje",
18
- "messages.newMessages": "Nuevos mensajes"
19
- }
@@ -1,40 +0,0 @@
1
- {
2
- "composer.dropdownPlaceholder": "Sélectionnez un choix",
3
- "composer.placeholder": "Répondre à {name}",
4
- "composer.placeholderInit": "Dites quelque chose à {name}",
5
- "composer.message": "Message à envoyer",
6
- "composer.send": "Envoyer",
7
- "composer.sendMessage": "Envoyer le message",
8
- "composer.interact": "Interagir avec votre assistant virtuel",
9
- "footer.poweredBy": "Propulsé par {link}",
10
- "header.conversations": "Conversations",
11
- "header.hideChatWindow": "Cacher la fenêtre de clavardage",
12
- "header.deleteConversation": "Êtes-vous certain de vouloir supprimer cette conversation?",
13
- "header.deleteConversationYes": "Supprimer",
14
- "header.deleteConversationNo": "Annuler",
15
- "conversationList.untitledConversation": "Conversation sans titre",
16
- "conversationList.title": "Conversation {id}",
17
- "botInfo.backToConversation": "Retour à la conversation",
18
- "botInfo.startConversation": "Démarrer la conversation",
19
- "botInfo.privacyPolicy": "Politique de confidentialité",
20
- "botInfo.termsAndConditions": "Termes et conditions",
21
- "botInfo.preferredLanguage": "Langue préférée",
22
- "store.resetSessionMessage": "Réinitialisation de la conversation",
23
- "loginForm.userName": "Identifiant",
24
- "loginForm.password": "Mot de passe",
25
- "loginForm.submit": "Envoyer",
26
- "loginForm.formTitle": "Formulaire de connexion",
27
- "loginForm.providedCredentials": "Identifiants renseignés",
28
- "message.botSaid": "L'assistant virtuel a dit : ",
29
- "message.fromBotLabel": "Assistant virtuel",
30
- "message.fromMeLabel": "Moi",
31
- "message.iSaid": "J'ai dit : ",
32
- "messages.newMessage": "Nouveau message",
33
- "messages.newMessages": "Nouveaux messages",
34
- "messages.readMore": "Afficher la suite",
35
- "messages.showLess": "Afficher moins",
36
- "message.thumbsUp": "Très bien",
37
- "message.thumbsDown": "Mauvais",
38
- "widget.title": "Fenêtre de clavardage",
39
- "widget.toggle": "Ouvrir ou fermer la conversation"
40
- }
@@ -1,9 +0,0 @@
1
- declare type Locale = 'browser' | string;
2
- declare const DEFAULT_LOCALE = "en";
3
- declare const translations: {
4
- [lang: string]: any;
5
- };
6
- declare const getUserLocale: (manualLocale?: Locale) => string;
7
- declare const setUserLocale: (locale: Locale) => void;
8
- declare const isRTLLocale: (locale?: string | undefined) => boolean;
9
- export { translations, DEFAULT_LOCALE as defaultLocale, getUserLocale, setUserLocale, isRTLLocale };
@@ -1,95 +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.isRTLLocale = exports.setUserLocale = exports.getUserLocale = exports.defaultLocale = exports.translations = void 0;
7
- require('@formatjs/intl-pluralrules/polyfill');
8
- require('@formatjs/intl-pluralrules/locale-data/ar');
9
- require('@formatjs/intl-pluralrules/locale-data/de');
10
- require('@formatjs/intl-pluralrules/locale-data/en');
11
- require('@formatjs/intl-pluralrules/locale-data/es');
12
- require('@formatjs/intl-pluralrules/locale-data/fr');
13
- require('@formatjs/intl-pluralrules/locale-data/it');
14
- require('@formatjs/intl-pluralrules/locale-data/pt');
15
- require('@formatjs/intl-pluralrules/locale-data/ru');
16
- require('@formatjs/intl-pluralrules/locale-data/uk');
17
- const ar_json_1 = __importDefault(require("./ar.json"));
18
- const de_json_1 = __importDefault(require("./de.json"));
19
- const en_json_1 = __importDefault(require("./en.json"));
20
- const es_json_1 = __importDefault(require("./es.json"));
21
- const fr_json_1 = __importDefault(require("./fr.json"));
22
- const it_json_1 = __importDefault(require("./it.json"));
23
- const pt_json_1 = __importDefault(require("./pt.json"));
24
- const ru_json_1 = __importDefault(require("./ru.json"));
25
- const uk_json_1 = __importDefault(require("./uk.json"));
26
- const DEFAULT_LOCALE = 'en';
27
- exports.defaultLocale = DEFAULT_LOCALE;
28
- const USER_LANG_STORAGE_KEY = 'user-lang';
29
- const translations = { en: en_json_1.default, fr: fr_json_1.default, pt: pt_json_1.default, es: es_json_1.default, ar: ar_json_1.default, ru: ru_json_1.default, uk: uk_json_1.default, de: de_json_1.default, it: it_json_1.default };
30
- exports.translations = translations;
31
- const rtlLocales = [
32
- 'ae' /* Avestan */,
33
- 'ar' /* 'العربية', Arabic */,
34
- 'arc' /* Aramaic */,
35
- 'bcc' /* 'بلوچی مکرانی', Southern Balochi */,
36
- 'bqi' /* 'بختياري', Bakthiari */,
37
- 'ckb' /* 'Soranî / کوردی', Sorani */,
38
- 'dv' /* Dhivehi */,
39
- 'fa' /* 'فارسی', Persian */,
40
- 'glk' /* 'گیلکی', Gilaki */,
41
- 'he' /* 'עברית', Hebrew */,
42
- 'ku' /* 'Kurdî / كوردی', Kurdish */,
43
- 'mzn' /* 'مازِرونی', Mazanderani */,
44
- 'nqo' /* N'Ko */,
45
- 'pnb' /* 'پنجابی', Western Punjabi */,
46
- 'ps' /* 'پښتو', Pashto, */,
47
- 'sd' /* 'سنڌي', Sindhi */,
48
- 'ug' /* 'Uyghurche / ئۇيغۇرچە', Uyghur */,
49
- 'ur' /* 'اردو', Urdu */,
50
- 'yi' /* 'ייִדיש', Yiddish */
51
- ];
52
- // 'en-US' becomes ['en', '-us'] 'en' becomes ['en']
53
- const localeRegex = /^([a-zA-Z]{2,3})([_\-a-zA-Z]{3,5})$/;
54
- const cleanLanguageCode = (str) => str.split('-')[0];
55
- const getNavigatorLanguage = () => cleanLanguageCode(navigator.language || navigator['userLanguage'] || '');
56
- const getStorageLanguage = () => cleanLanguageCode(window.BP_STORAGE.get(USER_LANG_STORAGE_KEY) || '');
57
- const setStorageLanguage = (locale) => window.BP_STORAGE.set(USER_LANG_STORAGE_KEY, locale);
58
- // Desired precedence
59
- // 1- manual locale = 'browser' : browser lang
60
- // 2- manual locale is supported : manual lang
61
- // 3- storage lang is supported : storage lang
62
- // 4- browser lang is supported : browser lang
63
- // 5- default lang
64
- const getUserLocale = (manualLocale = '') => {
65
- const browserLocale = getNavigatorLanguage();
66
- if (manualLocale === 'browser' && translations[browserLocale]) {
67
- return browserLocale;
68
- }
69
- manualLocale = cleanLanguageCode(manualLocale);
70
- if (translations[manualLocale]) {
71
- return manualLocale;
72
- }
73
- const storageLocale = getStorageLanguage();
74
- if (translations[storageLocale]) {
75
- return storageLocale;
76
- }
77
- return translations[browserLocale] ? browserLocale : DEFAULT_LOCALE;
78
- };
79
- exports.getUserLocale = getUserLocale;
80
- const setUserLocale = (locale) => {
81
- setStorageLanguage(locale);
82
- };
83
- exports.setUserLocale = setUserLocale;
84
- const isRTLLocale = (locale) => {
85
- if (!locale) {
86
- return false;
87
- }
88
- locale = locale.toLowerCase();
89
- const matches = localeRegex.exec(locale);
90
- if (!matches || matches.length < 2) {
91
- return false;
92
- }
93
- return rtlLocales.includes(matches[1]);
94
- };
95
- exports.isRTLLocale = isRTLLocale;