@botpress/webchat 0.2.5 → 0.3.2

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 (59) hide show
  1. package/README.md +31 -0
  2. package/assets/fonts/roboto/roboto.woff2 +0 -0
  3. package/assets/fonts/roboto/roboto500.woff2 +0 -0
  4. package/assets/fonts/roboto.css +128 -0
  5. package/assets/notification.mp3 +0 -0
  6. package/dist/components/Composer.d.ts +4 -5
  7. package/dist/components/Composer.js +16 -25
  8. package/dist/components/Container.js +1 -4
  9. package/dist/components/ConversationList.d.ts +1 -1
  10. package/dist/components/ConversationList.js +5 -46
  11. package/dist/components/Header.d.ts +1 -3
  12. package/dist/components/Header.js +7 -37
  13. package/dist/components/common/BotInfo/index.d.ts +1 -1
  14. package/dist/components/common/BotInfo/index.js +4 -14
  15. package/dist/components/messages/InlineFeedback.d.ts +2 -1
  16. package/dist/components/messages/Message.js +3 -6
  17. package/dist/components/messages/MessageGroup.d.ts +1 -5
  18. package/dist/components/messages/MessageGroup.js +4 -7
  19. package/dist/components/messages/MessageList.d.ts +1 -1
  20. package/dist/components/messages/MessageList.js +7 -29
  21. package/dist/core/api.d.ts +2 -6
  22. package/dist/core/api.js +4 -32
  23. package/dist/core/constants.d.ts +4 -32
  24. package/dist/core/constants.js +18 -32
  25. package/dist/core/socket.d.ts +1 -7
  26. package/dist/core/socket.js +8 -30
  27. package/dist/index.d.ts +2 -8
  28. package/dist/index.js +6 -27
  29. package/dist/main.d.ts +2 -2
  30. package/dist/main.js +84 -135
  31. package/dist/store/composer.js +1 -1
  32. package/dist/store/index.d.ts +4 -8
  33. package/dist/store/index.js +25 -62
  34. package/dist/store/view.d.ts +3 -4
  35. package/dist/store/view.js +6 -13
  36. package/dist/translations/index.d.ts +2 -1
  37. package/dist/translations/index.js +36 -1
  38. package/dist/typings.d.ts +123 -55
  39. package/dist/utils/analytics.d.ts +5 -0
  40. package/dist/utils/analytics.js +37 -0
  41. package/dist/utils/index.d.ts +3 -0
  42. package/dist/utils/index.js +27 -0
  43. package/package.json +6 -5
  44. package/dist/components/ContextMenu.d.ts +0 -2
  45. package/dist/components/ContextMenu.js +0 -24
  46. package/dist/components/OverridableComponent.d.ts +0 -24
  47. package/dist/components/OverridableComponent.js +0 -50
  48. package/dist/components/Stylesheet.d.ts +0 -5
  49. package/dist/components/Stylesheet.js +0 -7
  50. package/dist/components/common/MoreOptions/index.d.ts +0 -21
  51. package/dist/components/common/MoreOptions/index.js +0 -60
  52. package/dist/components/common/Overlay/index.d.ts +0 -7
  53. package/dist/components/common/Overlay/index.js +0 -36
  54. package/dist/icons/CloseChat.d.ts +0 -6
  55. package/dist/icons/CloseChat.js +0 -9
  56. package/dist/icons/Send.d.ts +0 -6
  57. package/dist/icons/Send.js +0 -8
  58. package/dist/utils.d.ts +0 -8
  59. package/dist/utils.js +0 -111
@@ -7,4 +7,4 @@ declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omi
7
7
  WrappedComponent: React.ComponentType<MessageListProps>;
8
8
  } & import("mobx-react").IWrappedComponent<unknown>;
9
9
  export default _default;
10
- declare type MessageListProps = WrappedComponentProps & Pick<StoreDef, 'intl' | 'isBotTyping' | 'focusedArea' | 'focusPrevious' | 'focusNext' | 'botAvatarUrl' | 'botName' | 'enableArrowNavigation' | 'showUserAvatar' | 'currentMessages' | 'preferredLanguage'>;
10
+ declare type MessageListProps = WrappedComponentProps & Pick<StoreDef, 'intl' | 'isBotTyping' | 'focusedArea' | 'focusPrevious' | 'focusNext' | 'botAvatarUrl' | 'botName' | 'currentMessages' | 'preferredLanguage'>;
@@ -17,22 +17,6 @@ class MessageList extends react_1.default.Component {
17
17
  constructor() {
18
18
  super(...arguments);
19
19
  this.state = { showNewMessageIndicator: false, manualScroll: false };
20
- this.handleKeyDown = (e) => {
21
- if (!this.props.enableArrowNavigation) {
22
- return;
23
- }
24
- const maxScroll = this.messagesDiv.scrollHeight - this.messagesDiv.clientHeight;
25
- const shouldFocusNext = e.key === 'ArrowRight' || (e.key === 'ArrowDown' && this.messagesDiv.scrollTop === maxScroll);
26
- const shouldFocusPrevious = e.key === 'ArrowLeft' || (e.key === 'ArrowUp' && this.messagesDiv.scrollTop === 0);
27
- if (shouldFocusNext) {
28
- this.messagesDiv.blur();
29
- this.props.focusNext();
30
- }
31
- if (shouldFocusPrevious) {
32
- this.messagesDiv.blur();
33
- this.props.focusPrevious();
34
- }
35
- };
36
20
  this.shouldDisplayMessage = (m) => {
37
21
  return m.payload.type !== 'postback';
38
22
  };
@@ -60,7 +44,7 @@ class MessageList extends react_1.default.Component {
60
44
  });
61
45
  }
62
46
  // this should account for keyboard rendering as it triggers a resize of the messagesDiv
63
- this.divSizeObserver = new resize_observer_1.ResizeObserver((0, debounce_1.default)(([divResizeEntry]) => {
47
+ this.divSizeObserver = new resize_observer_1.ResizeObserver((0, debounce_1.default)((_divResizeEntry) => {
64
48
  // we don't need to do anything with the resize entry
65
49
  this.tryScrollToBottom();
66
50
  }, 200, { trailing: true }));
@@ -106,8 +90,7 @@ class MessageList extends react_1.default.Component {
106
90
  let lastDate = undefined;
107
91
  let currentGroup = undefined;
108
92
  messages.forEach((m) => {
109
- var _a, _b;
110
- const speaker = ((_b = (_a = m.payload.channel) === null || _a === void 0 ? void 0 : _a.web) === null || _b === void 0 ? void 0 : _b.userName) || m.authorId;
93
+ const speaker = m.authorId;
111
94
  const date = m.sentOn;
112
95
  // Create a new group if messages are separated by more than X minutes or if different speaker
113
96
  if (speaker !== lastSpeaker ||
@@ -134,24 +117,21 @@ class MessageList extends react_1.default.Component {
134
117
  });
135
118
  }
136
119
  return (react_1.default.createElement("div", null, groups.map((group, i) => {
137
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
120
+ var _a;
138
121
  const lastGroup = groups[i - 1];
139
122
  const lastDate = (_a = lastGroup === null || lastGroup === void 0 ? void 0 : lastGroup[lastGroup.length - 1]) === null || _a === void 0 ? void 0 : _a.sentOn;
140
123
  const groupDate = group === null || group === void 0 ? void 0 : group[0].sentOn;
141
124
  const isDateNeeded = !groups[i - 1] ||
142
125
  (0, difference_in_minutes_1.default)(new Date(groupDate), new Date(lastDate)) > constants_1.default.TIME_BETWEEN_DATES;
143
- const [{ authorId, payload }] = group;
144
- const avatar = authorId
145
- ? this.props.showUserAvatar &&
146
- this.renderAvatar((_c = (_b = payload.channel) === null || _b === void 0 ? void 0 : _b.web) === null || _c === void 0 ? void 0 : _c.userName, (_e = (_d = payload.channel) === null || _d === void 0 ? void 0 : _d.web) === null || _e === void 0 ? void 0 : _e.avatarUrl)
147
- : this.renderAvatar(this.props.botName, ((_g = (_f = payload.channel) === null || _f === void 0 ? void 0 : _f.web) === null || _g === void 0 ? void 0 : _g.avatarUrl) || this.props.botAvatarUrl);
126
+ const [{ authorId }] = group;
127
+ const avatar = !authorId && this.renderAvatar(this.props.botName, this.props.botAvatarUrl);
148
128
  return (react_1.default.createElement("div", { key: i },
149
129
  isDateNeeded && this.renderDate(group[0].sentOn),
150
- react_1.default.createElement(MessageGroup_1.default, { isBot: !authorId, avatar: avatar, userName: (_j = (_h = payload.channel) === null || _h === void 0 ? void 0 : _h.web) === null || _j === void 0 ? void 0 : _j.userName, key: `msg-group-${i}`, isLastGroup: i >= groups.length - 1, messages: group })));
130
+ react_1.default.createElement(MessageGroup_1.default, { isBot: !authorId, avatar: avatar, key: `msg-group-${i}`, isLastGroup: i >= groups.length - 1, messages: group })));
151
131
  })));
152
132
  }
153
133
  render() {
154
- return (react_1.default.createElement("div", { tabIndex: 0, onKeyDown: this.handleKeyDown, className: 'bpw-msg-list', ref: (m) => {
134
+ return (react_1.default.createElement("div", { tabIndex: 0, className: 'bpw-msg-list', ref: (m) => {
155
135
  this.messagesDiv = m;
156
136
  }, onScroll: this.handleScroll },
157
137
  this.state.showNewMessageIndicator && (react_1.default.createElement("div", { className: "bpw-new-messages-indicator", onClick: (e) => this.tryScrollToBottom() },
@@ -170,7 +150,5 @@ exports.default = (0, mobx_react_1.inject)(({ store }) => ({
170
150
  focusPrevious: store.view.focusPrevious,
171
151
  focusNext: store.view.focusNext,
172
152
  focusedArea: store.view.focusedArea,
173
- showUserAvatar: store.config.showUserAvatar,
174
- enableArrowNavigation: store.config.enableArrowNavigation,
175
153
  preferredLanguage: store.preferredLanguage
176
154
  }))((0, react_intl_1.injectIntl)((0, mobx_react_1.observer)(MessageList)));
@@ -1,13 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { Message } from '@botpress/messaging-socket';
3
- import { RecentConversation } from '..';
4
- import { BotInfo, uuid } from '../typings';
3
+ import { uuid, RecentConversation } from '../typings';
5
4
  import BpSocket from './socket';
6
5
  export default class WebchatApi {
7
6
  private socket;
8
7
  constructor(socket: BpSocket);
9
- fetchBotInfo(mediaFileServiceUrl: string): Promise<BotInfo | undefined>;
10
- listCurrentConversationMessages(limit?: number): Promise<Message[]>;
8
+ listCurrentConversationMessages(limit?: number): Promise<Message[] | undefined>;
11
9
  fetchConversations(): Promise<RecentConversation[]>;
12
10
  fetchConversation(conversationId: uuid): Promise<{
13
11
  messages: Message[];
@@ -16,12 +14,10 @@ export default class WebchatApi {
16
14
  userId?: string | undefined;
17
15
  createdOn?: Date | undefined;
18
16
  } | undefined>;
19
- resetSession(conversationId: uuid): Promise<void>;
20
17
  createConversation(): Promise<uuid | undefined>;
21
18
  startConversation(): Promise<void>;
22
19
  sendMessage(payload: any, conversationId: uuid): Promise<Message | undefined>;
23
20
  deleteConversation(conversationId: uuid): Promise<void>;
24
21
  sendFeedback(feedback: number, messageId: uuid): Promise<void>;
25
- uploadFile(file: File, payload: string, conversationId: uuid): Promise<void>;
26
22
  sendVoiceMessage(voice: Buffer, ext: string, conversationId: uuid): Promise<void>;
27
23
  }
package/dist/core/api.js CHANGED
@@ -8,32 +8,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const axios_1 = __importDefault(require("axios"));
16
12
  const uuid_1 = require("uuid");
17
13
  class WebchatApi {
18
14
  constructor(socket) {
19
15
  this.socket = socket;
20
16
  }
21
- fetchBotInfo(mediaFileServiceUrl) {
17
+ listCurrentConversationMessages(limit) {
22
18
  return __awaiter(this, void 0, void 0, function* () {
23
19
  try {
24
- const { data } = yield axios_1.default.get(mediaFileServiceUrl);
25
- return data;
20
+ return this.socket.socket.listMessages(limit);
26
21
  }
27
22
  catch (err) {
28
- console.error('Error while loading bot info', err);
23
+ console.error('An error occurred while listing the messages of the current conversation', err);
29
24
  }
30
25
  });
31
26
  }
32
- listCurrentConversationMessages(limit) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- return this.socket.socket.listMessages(limit);
35
- });
36
- }
37
27
  fetchConversations() {
38
28
  return __awaiter(this, void 0, void 0, function* () {
39
29
  try {
@@ -43,7 +33,7 @@ class WebchatApi {
43
33
  const limit = 1;
44
34
  yield this.socket.socket.switchConversation(conversation.id);
45
35
  const lastMessages = yield this.listCurrentConversationMessages(limit);
46
- if (lastMessages.length >= limit) {
36
+ if (lastMessages && lastMessages.length >= limit) {
47
37
  conversation.lastMessage = lastMessages[0];
48
38
  }
49
39
  }
@@ -68,16 +58,6 @@ class WebchatApi {
68
58
  }
69
59
  });
70
60
  }
71
- // TODO: Fis this
72
- resetSession(conversationId) {
73
- return __awaiter(this, void 0, void 0, function* () {
74
- try {
75
- }
76
- catch (err) {
77
- console.error('Error while resetting conversation', err);
78
- }
79
- });
80
- }
81
61
  createConversation() {
82
62
  return __awaiter(this, void 0, void 0, function* () {
83
63
  try {
@@ -124,14 +104,6 @@ class WebchatApi {
124
104
  return this.socket.socket.sendFeedback(messageId, feedback);
125
105
  });
126
106
  }
127
- uploadFile(file, payload, conversationId) {
128
- return __awaiter(this, void 0, void 0, function* () {
129
- const data = new FormData();
130
- data.append('file', file);
131
- data.append('conversationId', conversationId);
132
- data.append('payload', payload);
133
- });
134
- }
135
107
  // TODO: Fix this
136
108
  sendVoiceMessage(voice, ext, conversationId) {
137
109
  return __awaiter(this, void 0, void 0, function* () {
@@ -1,42 +1,14 @@
1
+ import { Config } from '../typings';
1
2
  declare const _default: {
2
- /** These types are sent using the /message/ endpoint */
3
- MESSAGE_TYPES: string[];
4
3
  /** The duration of the hide / show chat */
5
- ANIM_DURATION: number;
4
+ ANIMATION_DURATION: number;
6
5
  MIN_TIME_BETWEEN_SOUNDS: number;
7
- HISTORY_STARTING_POINT: number;
8
- HISTORY_MAX_MESSAGES: number;
6
+ SENT_HISTORY_SIZE: number;
9
7
  /** The number of minutes before a new timestamp is displayed */
10
8
  TIME_BETWEEN_DATES: number;
11
9
  DEFAULT_LAYOUT_WIDTH: number;
12
10
  DEFAULT_CONTAINER_WIDTH: number;
13
- SENT_HISTORY_SIZE: number;
14
11
  /** The default configuration when starting the chat */
15
- DEFAULT_CONFIG: {
16
- userId: undefined;
17
- extraStylesheet: string;
18
- botName: undefined;
19
- botConvoDescription: undefined;
20
- overrides: undefined;
21
- enableReset: boolean;
22
- enableTranscriptDownload: boolean;
23
- enableArrowNavigation: boolean;
24
- showConversationsButton: boolean;
25
- useSessionStorage: boolean;
26
- showUserName: boolean;
27
- showUserAvatar: boolean;
28
- showTimestamp: boolean;
29
- disableAnimations: boolean;
30
- hideWidget: boolean;
31
- externalAuthToken: undefined;
32
- showPoweredBy: boolean;
33
- enablePersistHistory: boolean;
34
- enableResetSessionShortcut: boolean;
35
- enableVoiceComposer: boolean;
36
- enableConversationDeletion: boolean;
37
- closeOnEscape: boolean;
38
- recentConversationLifetime: string;
39
- startNewConvoOnTimeout: boolean;
40
- };
12
+ DEFAULT_CONFIG: Partial<Config>;
41
13
  };
42
14
  export default _default;
@@ -1,43 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const DEFAULT_CONFIG = {
4
+ botName: undefined,
5
+ botConversationDescription: undefined,
6
+ enableTranscriptDownload: true,
7
+ showConversationsButton: true,
8
+ useSessionStorage: false,
9
+ showTimestamp: false,
10
+ disableAnimations: false,
11
+ hideWidget: false,
12
+ showPoweredBy: false,
13
+ enablePersistHistory: true,
14
+ enableVoiceComposer: false,
15
+ enableConversationDeletion: false,
16
+ closeOnEscape: true
17
+ };
3
18
  exports.default = {
4
- /** These types are sent using the /message/ endpoint */
5
- MESSAGE_TYPES: ['text', 'quick_reply', 'form', 'login_prompt', 'visit', 'postback'],
6
19
  /** The duration of the hide / show chat */
7
- ANIM_DURATION: 300,
20
+ ANIMATION_DURATION: 300,
8
21
  MIN_TIME_BETWEEN_SOUNDS: 1000,
9
- HISTORY_STARTING_POINT: -1,
10
- HISTORY_MAX_MESSAGES: 10,
22
+ SENT_HISTORY_SIZE: 20,
11
23
  /** The number of minutes before a new timestamp is displayed */
12
24
  TIME_BETWEEN_DATES: 10,
13
25
  DEFAULT_LAYOUT_WIDTH: 360,
14
26
  DEFAULT_CONTAINER_WIDTH: 360,
15
- SENT_HISTORY_SIZE: 20,
16
27
  /** The default configuration when starting the chat */
17
- DEFAULT_CONFIG: {
18
- userId: undefined,
19
- extraStylesheet: '',
20
- botName: undefined,
21
- botConvoDescription: undefined,
22
- overrides: undefined,
23
- enableReset: true,
24
- enableTranscriptDownload: true,
25
- enableArrowNavigation: false,
26
- showConversationsButton: true,
27
- useSessionStorage: false,
28
- showUserName: false,
29
- showUserAvatar: false,
30
- showTimestamp: false,
31
- disableAnimations: false,
32
- hideWidget: false,
33
- externalAuthToken: undefined,
34
- showPoweredBy: window.SHOW_POWERED_BY,
35
- enablePersistHistory: true,
36
- enableResetSessionShortcut: false,
37
- enableVoiceComposer: false,
38
- enableConversationDeletion: false,
39
- closeOnEscape: true,
40
- recentConversationLifetime: '5h',
41
- startNewConvoOnTimeout: false
42
- }
28
+ DEFAULT_CONFIG
43
29
  };
@@ -3,16 +3,10 @@ import { Config } from '../typings';
3
3
  export default class BpSocket {
4
4
  socket: MessagingSocket;
5
5
  private chatId;
6
- private waitingForUser?;
7
- onClear: (event: any) => void;
8
6
  onMessage: (event: any) => void;
9
- onTyping: (event: any) => void;
10
- onData: (event: any) => void;
11
- onUserIdChanged: (userId: string) => void;
12
7
  constructor(config: Config);
13
8
  setup(): void;
14
9
  sendPayload(payload: any): Promise<Message>;
15
10
  postToParent: (_type: string, payload: any) => void;
16
- /** Waits until the VISITOR ID and VISITOR SOCKET ID is set */
17
- waitForUserId(): Promise<void>;
11
+ connect(): Promise<void>;
18
12
  }
@@ -14,23 +14,14 @@ class BpSocket {
14
14
  constructor(config) {
15
15
  this.postToParent = (_type, payload) => {
16
16
  var _a;
17
- // we could filter on event type if necessary
18
17
  (_a = window.parent) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign(Object.assign({}, payload), { chatId: this.chatId }), '*');
19
18
  };
20
19
  this.chatId = config.chatId;
21
20
  this.socket = new messaging_socket_1.MessagingSocket({ url: config.messagingUrl, clientId: config.clientId });
21
+ window.websocket = this.socket;
22
22
  }
23
23
  setup() {
24
24
  this.socket.on('message', this.onMessage);
25
- /*
26
- this.events.on('guest.webchat.clear', this.onClear)
27
- this.events.on('guest.webchat.message', this.onMessage)
28
- this.events.on('guest.webchat.typing', this.onTyping)
29
- this.events.on('guest.webchat.data', this.onData)
30
- */
31
- // firehose events to parent page
32
- // TODO: why do we need this
33
- // this.events.onAny(this.postToParent)
34
25
  }
35
26
  sendPayload(payload) {
36
27
  return __awaiter(this, void 0, void 0, function* () {
@@ -39,28 +30,15 @@ class BpSocket {
39
30
  return message;
40
31
  });
41
32
  }
42
- /** Waits until the VISITOR ID and VISITOR SOCKET ID is set */
43
- waitForUserId() {
33
+ connect() {
44
34
  return __awaiter(this, void 0, void 0, function* () {
45
- if (this.waitingForUser) {
46
- return this.waitingForUser;
35
+ const creds = window.BP_STORAGE.get('creds');
36
+ yield this.socket.connect(creds);
37
+ if (this.socket.userId) {
38
+ const userId = this.socket.userId;
39
+ window.BP_STORAGE.set('creds', this.socket.creds);
40
+ this.postToParent('', { userId });
47
41
  }
48
- this.waitingForUser = new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
49
- const creds = window.BP_STORAGE.get('creds');
50
- yield this.socket.connect(creds);
51
- if (this.socket.userId) {
52
- const userId = this.socket.userId;
53
- window.BP_STORAGE.set('creds', this.socket.creds);
54
- this.onUserIdChanged(userId);
55
- this.postToParent('', { userId });
56
- resolve();
57
- }
58
- else {
59
- this.waitingForUser = undefined;
60
- reject();
61
- }
62
- }));
63
- return this.waitingForUser;
64
42
  });
65
43
  }
66
44
  }
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
  import { RootStore } from './store';
3
3
  import { Config } from './typings';
4
- export declare const Embedded: (props: any) => ExposedWebChat;
5
- export declare const Fullscreen: (props: any) => ExposedWebChat;
6
4
  interface State {
7
5
  store: RootStore;
8
6
  }
@@ -14,10 +12,6 @@ export declare class ExposedWebChat extends React.Component<Props, State> {
14
12
  constructor(props: Props);
15
13
  render(): JSX.Element;
16
14
  }
17
- /**
18
- * @deprecated Since the way views are handled has changed, we're also exporting views in lowercase.
19
- * https://botpress.com/docs/developers/migrate/
20
- */
21
- export { Embedded as embedded } from '.';
22
- export { Fullscreen as fullscreen } from '.';
15
+ export declare const Embedded: (props: Props) => ExposedWebChat;
16
+ export declare const Fullscreen: (props: Props) => ExposedWebChat;
23
17
  export * from './typings';
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  return (mod && mod.__esModule) ? mod : { "default": mod };
14
14
  };
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.fullscreen = exports.embedded = exports.ExposedWebChat = exports.Fullscreen = exports.Embedded = void 0;
16
+ exports.Fullscreen = exports.Embedded = exports.ExposedWebChat = void 0;
17
17
  const mobx_1 = require("mobx");
18
18
  const mobx_react_1 = require("mobx-react");
19
19
  const react_1 = __importDefault(require("react"));
@@ -23,10 +23,6 @@ const store_1 = require("./store");
23
23
  const translations_1 = require("./translations");
24
24
  const storage_1 = __importDefault(require("./utils/storage"));
25
25
  (0, mobx_1.configure)({ enforceActions: 'observed' });
26
- const Embedded = (props) => new Wrapper(Object.assign(Object.assign({}, props), { fullscreen: false }));
27
- exports.Embedded = Embedded;
28
- const Fullscreen = (props) => new Wrapper(Object.assign(Object.assign({}, props), { fullscreen: true }));
29
- exports.Fullscreen = Fullscreen;
30
26
  class ExposedWebChat extends react_1.default.Component {
31
27
  constructor(props) {
32
28
  super(props);
@@ -40,30 +36,13 @@ class ExposedWebChat extends react_1.default.Component {
40
36
  const { botUILanguage: locale } = store;
41
37
  return (react_1.default.createElement(mobx_react_1.Provider, { store: store },
42
38
  react_1.default.createElement(react_intl_1.IntlProvider, { locale: locale, messages: translations_1.translations[locale || translations_1.defaultLocale], defaultLocale: translations_1.defaultLocale },
43
- react_1.default.createElement(main_1.default, Object.assign({ store: store }, this.props)))));
39
+ react_1.default.createElement(main_1.default, Object.assign({}, this.props)))));
44
40
  }
45
41
  }
46
42
  exports.ExposedWebChat = ExposedWebChat;
47
- // TODO: what does this observer do?
48
43
  const Wrapper = (0, mobx_react_1.observer)(ExposedWebChat);
49
- /**
50
- * @deprecated Since the way views are handled has changed, we're also exporting views in lowercase.
51
- * https://botpress.com/docs/developers/migrate/
52
- */
53
- var _1 = require(".");
54
- Object.defineProperty(exports, "embedded", { enumerable: true, get: function () { return _1.Embedded; } });
55
- var _2 = require(".");
56
- Object.defineProperty(exports, "fullscreen", { enumerable: true, get: function () { return _2.Fullscreen; } });
44
+ const Embedded = (props) => new Wrapper(Object.assign(Object.assign({}, props), { fullscreen: false }));
45
+ exports.Embedded = Embedded;
46
+ const Fullscreen = (props) => new Wrapper(Object.assign(Object.assign({}, props), { fullscreen: true }));
47
+ exports.Fullscreen = Fullscreen;
57
48
  __exportStar(require("./typings"), exports);
58
- // TODO: export this
59
- /*
60
- export {
61
- Carousel,
62
- QuickReplies,
63
- LoginPrompt,
64
- Text,
65
- FileMessage,
66
- FileInput,
67
- Button
68
- } from './components/messages/renderer'
69
- */
package/dist/main.d.ts CHANGED
@@ -9,5 +9,5 @@ declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omi
9
9
  } & import("mobx-react").IWrappedComponent<unknown>;
10
10
  export default _default;
11
11
  declare type MainProps = {
12
- store: RootStore;
13
- } & WrappedComponentProps & Pick<StoreDef, 'config' | 'initializeChat' | 'botInfo' | 'fetchBotInfo' | 'sendMessage' | 'setUserId' | 'sendData' | 'intl' | 'updateTyping' | 'updateBotUILanguage' | 'hideChat' | 'showChat' | 'toggleBotInfo' | 'widgetTransition' | 'activeView' | 'isFullscreen' | 'unreadCount' | 'hasUnreadMessages' | 'showWidgetButton' | 'addEventToConversation' | 'clearMessages' | 'updateConfig' | 'mergeConfig' | 'isWebchatReady' | 'incrementUnread' | 'displayWidgetView' | 'resetUnread' | 'setLoadingCompleted' | 'dimensions' | 'updateLastMessage'>;
12
+ store?: RootStore;
13
+ } & WrappedComponentProps & Pick<StoreDef, 'config' | 'initializeChat' | 'botInfo' | 'fetchBotInfo' | 'sendMessage' | 'sendData' | 'intl' | 'updateTyping' | 'updateBotUILanguage' | 'hideChat' | 'showChat' | 'toggleBotInfo' | 'widgetTransition' | 'activeView' | 'isFullscreen' | 'unreadCount' | 'hasUnreadMessages' | 'showWidgetButton' | 'addEventToConversation' | 'clearMessages' | 'updateConfig' | 'mergeConfig' | 'isWebchatReady' | 'incrementUnread' | 'displayWidgetView' | 'resetUnread' | 'setLoadingCompleted' | 'dimensions' | 'updateLastMessage' | 'fetchConversation' | 'setIntlProvider' | 'setSocket' | 'currentConversationId'>;