beem-component 1.1.6 → 1.1.7

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 (26) hide show
  1. package/.storybook/preview.js +2 -1
  2. package/dist/assets/css/{sidebar.css → sidebar.scss} +0 -0
  3. package/dist/components/ChatComponents/ChatBody/chatBody.js +265 -0
  4. package/dist/components/{ChatBody → ChatComponents/ChatBody}/chatBody.stories.js +42 -11
  5. package/dist/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.js +0 -0
  6. package/dist/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.stories.js +8 -4
  7. package/dist/components/ChatComponents/ColorPicker/colorPicker.stories.js +26 -0
  8. package/dist/components/ChatComponents/FormAccordion/FormAccordion.stories.js +25 -0
  9. package/dist/components/ChatComponents/LabelAccordion/LabelAccordion.stories.js +27 -0
  10. package/dist/components/index.js +2 -2
  11. package/package.json +2 -1
  12. package/src/App.js +1 -25
  13. package/src/Chat.js +10 -5
  14. package/src/ChatHeader.js +1 -1
  15. package/src/lib/assets/css/{sidebar.css → sidebar.scss} +0 -0
  16. package/src/lib/components/ChatComponents/ChatBody/chatBody.js +279 -0
  17. package/src/lib/components/ChatComponents/ChatBody/chatBody.stories.js +81 -0
  18. package/src/lib/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.js +0 -0
  19. package/src/lib/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.stories.js +6 -3
  20. package/src/lib/components/ChatComponents/ColorPicker/colorPicker.stories.js +17 -0
  21. package/src/lib/components/ChatComponents/FormAccordion/FormAccordion.stories.js +33 -0
  22. package/src/lib/components/ChatComponents/LabelAccordion/LabelAccordion.stories.js +36 -0
  23. package/src/lib/components/index.js +2 -2
  24. package/dist/components/ChatBody/chatBody.js +0 -144
  25. package/src/lib/components/ChatBody/chatBody.js +0 -147
  26. package/src/lib/components/ChatBody/chatBody.stories.js +0 -48
@@ -0,0 +1,279 @@
1
+ import React from "react";
2
+ import { Done, DoneAll } from "@material-ui/icons";
3
+ import FilePresentIcon from "@mui/icons-material/FilePresent";
4
+ import DownloadIcon from "@mui/icons-material/Download";
5
+ import styled from "styled-components";
6
+ import BmAvatar from "../../Avatars/avatars";
7
+ import { BmIcons } from "../../iconStyles";
8
+
9
+ import {
10
+ BmPrimaryWhite,
11
+ BmPrimaryBlue,
12
+ BmPrimaryBlack,
13
+ BmSecondaryDarkGreen,
14
+ BmGrey200,
15
+ } from "../../colors";
16
+
17
+ const BmChat = styled.div`
18
+ display: flex;
19
+ flex-direction: column;
20
+ height: 100%;
21
+ ${"" /* border: 0.071rem solid ${BmGrey400}; */}
22
+ `;
23
+
24
+ BmChat.Body = styled.div`
25
+ display: flex;
26
+ flex-direction: column;
27
+ padding: 0rem 1.5rem;
28
+ flex-grow: 1;
29
+ overflow: auto;
30
+ `;
31
+
32
+ const Details = styled.div`
33
+ display: flex;
34
+ ${"" /* align-items: center; */}
35
+ justify-content: ${({ state }) => {
36
+ if (state === "inbound") {
37
+ return "flex-start";
38
+ }
39
+ if (state === "outbound") {
40
+ return "flex-end";
41
+ }
42
+ return "row";
43
+ }};
44
+ > *:not(:last-child) {
45
+ margin-right: 1rem;
46
+ margin-bottom: 0.5rem;
47
+ }
48
+ overflow-wrap: break-word !important;
49
+ word-wrap: break-word !important;
50
+ margin: 0rem;
51
+ flex-grow: 1;
52
+ `;
53
+
54
+ const MessageDetails = styled.div`
55
+ display: flex;
56
+ flex-direction: column;
57
+ max-width: 50%;
58
+ > * {
59
+ margin-top: 0.5rem;
60
+ }
61
+ `;
62
+
63
+ const Messages = styled.div`
64
+ display: flex;
65
+ flex-direction: row;
66
+ align-items: center;
67
+ padding: 1.143rem;
68
+ background: ${({ state }) => {
69
+ if (state) {
70
+ if (state === "inbound") return `${BmPrimaryWhite}`;
71
+ if (state === "outbound") return `${BmPrimaryBlue}`;
72
+ }
73
+ return `${BmPrimaryWhite}`;
74
+ }};
75
+ color: ${({ state }) => {
76
+ if (state) {
77
+ if (state === "inbound") return `${BmPrimaryBlack}`;
78
+ if (state === "outbound") return `${BmPrimaryWhite}`;
79
+ }
80
+ return `${BmPrimaryWhite}`;
81
+ }};
82
+ border-radius: ${({ state }) => {
83
+ if (state) {
84
+ if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
85
+ if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
86
+ }
87
+ return `${BmPrimaryWhite}`;
88
+ }};
89
+ border: 0.071rem solid ${BmGrey200};
90
+ word-break: break-all;
91
+ margin: 0rem;
92
+ `;
93
+
94
+ const MessagesSubDetails = styled.div`
95
+ display: flex;
96
+ flex-direction: row;
97
+ align-items: center;
98
+ > *:not(:last-child) {
99
+ margin-right: 0.5rem;
100
+ }
101
+ margin-top: 0.5rem;
102
+ `;
103
+
104
+ const handleState = ({ session }) => {
105
+ if (session === "bot") {
106
+ return <BmAvatar size="small" user="chatbot" />;
107
+ }
108
+ if (session === "live") {
109
+ return <BmAvatar size="small" user="employee" />;
110
+ }
111
+ };
112
+
113
+ // Start of File Attachment
114
+ const FileAttachmentWrapper = styled.div`
115
+ display: flex;
116
+ cursor: pointer;
117
+ flex-direction: row;
118
+ padding: 1rem;
119
+ background: ${({ state }) => {
120
+ if (state) {
121
+ if (state === "inbound") return `${BmPrimaryWhite}`;
122
+ if (state === "outbound") return `${BmPrimaryBlue}`;
123
+ }
124
+ return `${BmPrimaryWhite}`;
125
+ }};
126
+ color: ${({ state }) => {
127
+ if (state) {
128
+ if (state === "inbound") return `${BmPrimaryBlack}`;
129
+ if (state === "outbound") return `${BmPrimaryWhite}`;
130
+ }
131
+ return `${BmPrimaryWhite}`;
132
+ }};
133
+ border-radius: ${({ state }) => {
134
+ if (state) {
135
+ if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
136
+ if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
137
+ }
138
+ return `${BmPrimaryWhite}`;
139
+ }};
140
+ border: 0.071rem solid ${BmGrey200};
141
+ > * {
142
+ &:last-child {
143
+ margin-left: auto;
144
+ }
145
+ :not(:last-child) {
146
+ margin-right: 0.5rem;
147
+ }
148
+ }
149
+ &&& > * {
150
+ align-items: center;
151
+ color: ${({ state }) => {
152
+ if (state) {
153
+ if (state === "inbound") return `${BmPrimaryBlue}`;
154
+ if (state === "outbound") return `${BmPrimaryWhite}`;
155
+ }
156
+ return `${BmPrimaryWhite}`;
157
+ }};
158
+ }
159
+ ${"" /* max-width: 100%; */}
160
+ ${"" /* max-height: 100%; */}
161
+ `;
162
+
163
+ const BmFileAttachment = ({ state, file, src, fileName, ...rest }) => {
164
+ return (
165
+ <FileAttachmentWrapper state={state} {...rest}>
166
+ <BmIcons icon={<FilePresentIcon />} />
167
+ {fileName}
168
+ <BmIcons icon={<DownloadIcon />} />
169
+ </FileAttachmentWrapper>
170
+ );
171
+ };
172
+ //Start of Component for Images
173
+ export const BmImageWrapper = styled.div`
174
+ display: flex;
175
+ flex-direction: column;
176
+ color: ${({ state }) => {
177
+ if (state) {
178
+ if (state === "inbound") return `${BmPrimaryBlack}`;
179
+ if (state === "outbound") return `${BmPrimaryWhite}`;
180
+ }
181
+ return `${BmPrimaryWhite}`;
182
+ }};
183
+ border-radius: ${({ state }) => {
184
+ if (state) {
185
+ if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
186
+ if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
187
+ }
188
+ return `${BmPrimaryWhite}`;
189
+ }};
190
+ border: 0.071rem solid ${BmGrey200};
191
+ `;
192
+
193
+ export const BmImage = styled.img`
194
+ ${"" /* Fix width */}
195
+ width: 21.429rem;
196
+ object-fit: cover;
197
+ flex-grow: 1;
198
+ `;
199
+
200
+ export const BmImageChat = ({ state, src, fileName, ...rest }) => {
201
+ return (
202
+ <>
203
+ <BmImageWrapper state={state} {...rest}>
204
+ <BmImage src={src} alt="src" />
205
+ {fileName && (
206
+ <BmFileAttachment
207
+ state={state}
208
+ file={src}
209
+ fileName={fileName}
210
+ {...rest}
211
+ />
212
+ )}
213
+ </BmImageWrapper>
214
+ </>
215
+ );
216
+ };
217
+
218
+ //End of Component for Images
219
+
220
+ BmChat.Details = ({
221
+ children,
222
+ state,
223
+ displayTime,
224
+ status,
225
+ session,
226
+ src,
227
+ file,
228
+ fileName,
229
+ ...rest
230
+ }) => {
231
+ console.log("bbbb", fileName);
232
+ return (
233
+ <Details state={state} {...rest}>
234
+ {state === "inbound" && session && handleState({ state, session })}
235
+ <MessageDetails>
236
+ {/* For Images */}
237
+ {src && (
238
+ <BmImageChat state={state} src={src} fileName={fileName} {...rest} />
239
+ )}
240
+ {/* For Messages */}
241
+ {children && <Messages state={state}>{children}</Messages>}
242
+ {/* For files */}
243
+ {file && (
244
+ <BmFileAttachment
245
+ file={file}
246
+ fileName={fileName}
247
+ state={state}
248
+ {...rest}
249
+ />
250
+ )}
251
+ <MessagesSubDetails>
252
+ {displayTime && displayTime}
253
+ {status === "sent" && (
254
+ <BmIcons
255
+ icon={<DoneAll />}
256
+ color={`${BmSecondaryDarkGreen}`}
257
+ size="small"
258
+ />
259
+ )}
260
+ {status === "failed" && (
261
+ <BmIcons icon={<Done />} color={`${BmPrimaryBlack}`} size="small" />
262
+ )}
263
+ </MessagesSubDetails>
264
+ </MessageDetails>
265
+ {state === "outbound" && session && handleState({ state, session })}
266
+ </Details>
267
+ );
268
+ };
269
+
270
+ BmChat.Footer = styled.div`
271
+ display: flex;
272
+ flex-direction: column;
273
+ padding: 0.5rem 0.5rem;
274
+ > *:not(:last-child) {
275
+ margin-bottom: 0.5rem;
276
+ }
277
+ `;
278
+
279
+ export default BmChat;
@@ -0,0 +1,81 @@
1
+ /* eslint-disable import/no-anonymous-default-export */
2
+ import React from "react";
3
+ import BmChat from "./chatBody";
4
+ import { BmIcons } from "../../iconStyles";
5
+ import EmojiEmotionsIcon from "@mui/icons-material/EmojiEmotions";
6
+ import AttachFileIcon from "@mui/icons-material/AttachFile";
7
+ import QuickreplyIcon from "@mui/icons-material/Quickreply";
8
+ import SendIcon from "@mui/icons-material/Send";
9
+ import { BmInput } from "../../input";
10
+ import image from "../../../assets/chart-img.png";
11
+
12
+ export default {
13
+ component: BmChat,
14
+ title: "components/Chat/MainChat/ChatBody",
15
+ };
16
+
17
+ export const ChatBody = () => {
18
+ return (
19
+ <BmChat>
20
+ <BmChat.Body>
21
+ <BmChat.Details
22
+ state="inbound"
23
+ session="bot"
24
+ displayTime={<p>12:00pm</p>}
25
+ status="sent"
26
+ >
27
+ <p>Inbound Text Message</p>
28
+ </BmChat.Details>
29
+ <BmChat.Details
30
+ state="inbound"
31
+ session="live"
32
+ displayTime={<p>12:00pm</p>}
33
+ status="sent"
34
+ fileName={<p>chat.png</p>}
35
+ src={image}
36
+ />
37
+ <BmChat.Details
38
+ state="inbound"
39
+ session="live"
40
+ displayTime={<p>10:00am</p>}
41
+ status="failed"
42
+ fileName={<p>file.csv</p>}
43
+ file={image}
44
+ />
45
+ <BmChat.Details
46
+ state="outbound"
47
+ session="bot"
48
+ displayTime={<p>12:00pm</p>}
49
+ status="sent"
50
+ >
51
+ <p>Outbound Text Message</p>
52
+ </BmChat.Details>
53
+ <BmChat.Details
54
+ state="outbound"
55
+ session="live"
56
+ displayTime={<p>12:00pm</p>}
57
+ status="sent"
58
+ fileName={<p>chat.png</p>}
59
+ src={image}
60
+ />
61
+ <BmChat.Details
62
+ state="outbound"
63
+ session="live"
64
+ displayTime={<p>10:00am</p>}
65
+ status="failed"
66
+ fileName={<p>file.csv</p>}
67
+ file={image}
68
+ />
69
+ </BmChat.Body>
70
+ <BmChat.Footer>
71
+ <div className="chat-footer">
72
+ <BmIcons icon={<EmojiEmotionsIcon />} size="xlarge" />
73
+ <BmIcons icon={<AttachFileIcon />} size="xlarge" />
74
+ <BmIcons icon={<QuickreplyIcon />} size="xlarge" />
75
+ <BmInput placeholder="Enter Message" style={{ flex: "1" }} />
76
+ <BmIcons icon={<SendIcon />} size="xlarge" />
77
+ </div>
78
+ </BmChat.Footer>
79
+ </BmChat>
80
+ );
81
+ };
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable import/no-anonymous-default-export */
2
2
  import React from "react";
3
- import { BmButton } from "../Buttons/buttons";
3
+ import { BmButton } from "../../Buttons/buttons";
4
4
  import { BmChatHeader } from "./chatHeader";
5
5
 
6
6
  export default {
7
7
  component: BmChatHeader,
8
- title: "components/Chat/ChatHeader",
8
+ title: "components/Chat/MainChat/ChatHeader",
9
9
  };
10
10
 
11
11
  export const ChatHeader = () => {
@@ -13,7 +13,10 @@ export const ChatHeader = () => {
13
13
  <BmChatHeader>
14
14
  <h2>Contact Name</h2>
15
15
  <p>Last seen: 00:00</p>
16
- <BmButton size="medium">End Session</BmButton>
16
+ <div className="chat-header-buttons">
17
+ <BmButton size="medium">End Session</BmButton>
18
+ <BmButton size="medium">End Session</BmButton>
19
+ </div>
17
20
  </BmChatHeader>
18
21
  );
19
22
  };
@@ -0,0 +1,17 @@
1
+ import { BmColorPicker } from "./colorPicker";
2
+
3
+ // eslint-disable-next-line import/no-anonymous-default-export
4
+ export default {
5
+ component: BmColorPicker,
6
+ title: "components/Chat/Components/ColorPicker",
7
+ };
8
+
9
+ export const ChatBody = () => {
10
+ return (
11
+ <>
12
+ {["#33b1ba", "#000000", "#F62E48", "#8CC63F"].map((color) => (
13
+ <BmColorPicker key={color} color={color} />
14
+ ))}
15
+ </>
16
+ );
17
+ };
@@ -0,0 +1,33 @@
1
+ import { BmAccordion, BmChatForm } from "../..";
2
+
3
+ // eslint-disable-next-line import/no-anonymous-default-export
4
+ export default {
5
+ component: BmChatForm,
6
+ title: "components/Chat/Components/FormAccordion",
7
+ };
8
+
9
+ export const FormAccordion = () => {
10
+ return (
11
+ <>
12
+ <BmAccordion>
13
+ <BmAccordion.Title><h3>Information</h3></BmAccordion.Title>
14
+ <BmAccordion.Body>
15
+ <BmChatForm>
16
+ <BmChatForm.Group>
17
+ <BmChatForm.Label>
18
+ <h4>Account No.</h4>
19
+ </BmChatForm.Label>
20
+ <BmChatForm.Input placeholder="Enter here" />
21
+ </BmChatForm.Group>
22
+ <BmChatForm.Group>
23
+ <BmChatForm.Label>
24
+ <h4>Preferred Language</h4>
25
+ </BmChatForm.Label>
26
+ <BmChatForm.Input placeholder="Enter here" />
27
+ </BmChatForm.Group>
28
+ </BmChatForm>
29
+ </BmAccordion.Body>
30
+ </BmAccordion>
31
+ </>
32
+ );
33
+ };
@@ -0,0 +1,36 @@
1
+ import { BmAccordion, BmChatLabels, BmTag } from "../..";
2
+
3
+ // eslint-disable-next-line import/no-anonymous-default-export
4
+ export default {
5
+ component: BmChatLabels,
6
+ title: "components/Chat/Components/LabelAccordion",
7
+ };
8
+
9
+ export const LabelAccordion = () => {
10
+ return (
11
+ <>
12
+ <BmAccordion>
13
+ <BmAccordion.Title>
14
+ <h3>Labels</h3>
15
+ <a>Manage Labels</a>
16
+ </BmAccordion.Title>
17
+ <BmAccordion.Body>
18
+ <BmChatLabels>
19
+ <h4>Added labels</h4>
20
+ <div>
21
+ <BmTag variant="success">
22
+ <p>label</p>
23
+ </BmTag>
24
+ <BmTag variant="warning">
25
+ <p>label</p>
26
+ </BmTag>
27
+ <BmTag variant="error">
28
+ <p>label</p>
29
+ </BmTag>
30
+ </div>
31
+ </BmChatLabels>
32
+ </BmAccordion.Body>
33
+ </BmAccordion>
34
+ </>
35
+ );
36
+ };
@@ -32,8 +32,8 @@ import { BmNoteBar } from "./NoteBar/noteBar";
32
32
  import { MainWrapper } from "../components/MainWrapper";
33
33
 
34
34
  //Chat Components
35
- import BmChat from "../components/ChatBody/chatBody";
36
- import { BmChatHeader } from "./ChatHeader/chatHeader";
35
+ import BmChat from "./ChatComponents/ChatBody/chatBody";
36
+ import { BmChatHeader } from "./ChatComponents/ChatHeader/chatHeader";
37
37
  import BmContactCard from "./ContactCards/contactCards";
38
38
  import BmInfoTab from "./InfoTab/infoTab";
39
39
  import BmCounter from "./MessageCounter/messageCounter";
@@ -1,144 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _icons = require("@material-ui/icons");
9
-
10
- var _react = _interopRequireDefault(require("react"));
11
-
12
- var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
- var _avatars = _interopRequireDefault(require("../Avatars/avatars"));
15
-
16
- var _iconStyles = require("../iconStyles");
17
-
18
- var _colors = require("../colors");
19
-
20
- var _excluded = ["children", "state", "displayTime", "status", "session"];
21
-
22
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
27
-
28
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
29
-
30
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
31
-
32
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
33
-
34
- var BmChat = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n ", "\n"])), ""
35
- /* border: 0.071rem solid ${BmGrey400}; */
36
- );
37
-
38
- BmChat.Body = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n padding: 0rem 1.5rem;\n flex-grow: 1;\n overflow: auto;\n"])));
39
-
40
- var Details = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n ", "\n justify-content: ", ";\n > *:not(:last-child) {\n margin-right: 1rem;\n }\n overflow-wrap: break-word !important;\n word-wrap: break-word !important;\n margin: 0rem;\n flex-grow: 1;\n"])), ""
41
- /* align-items: center; */
42
- , function (_ref) {
43
- var state = _ref.state;
44
-
45
- if (state === "inbound") {
46
- return "flex-start";
47
- }
48
-
49
- if (state === "outbound") {
50
- return "flex-end";
51
- }
52
-
53
- return "row";
54
- });
55
-
56
- var MessageDetails = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n max-width: 50%;\n > * {\n margin-top: 0.5rem;\n }\n"])));
57
-
58
- var Messages = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 1.143rem;\n background: ", ";\n color: ", ";\n border-radius: ", ";\n border: 0.071rem solid ", ";\n word-break: break-all;\n margin: 0rem;\n"])), function (_ref2) {
59
- var state = _ref2.state;
60
-
61
- if (state) {
62
- if (state === "inbound") return "".concat(_colors.BmPrimaryWhite);
63
- if (state === "outbound") return "".concat(_colors.BmPrimaryBlue);
64
- }
65
-
66
- return "".concat(_colors.BmPrimaryWhite);
67
- }, function (_ref3) {
68
- var state = _ref3.state;
69
-
70
- if (state) {
71
- if (state === "inbound") return "".concat(_colors.BmPrimaryBlack);
72
- if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
73
- }
74
-
75
- return "".concat(_colors.BmPrimaryWhite);
76
- }, function (_ref4) {
77
- var state = _ref4.state;
78
-
79
- if (state) {
80
- if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
81
- if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
82
- }
83
-
84
- return "".concat(_colors.BmPrimaryWhite);
85
- }, _colors.BmGrey400);
86
-
87
- var MessagesSubDetails = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n > *:not(:last-child) {\n margin-right: 0.5rem;\n }\n margin-top: 0.5rem;\n"])));
88
-
89
- var handleState = function handleState(_ref5) {
90
- var session = _ref5.session;
91
-
92
- if (session === "bot") {
93
- return /*#__PURE__*/_react.default.createElement(_avatars.default, {
94
- size: "small",
95
- user: "chatbot"
96
- });
97
- }
98
-
99
- if (session === "live") {
100
- return /*#__PURE__*/_react.default.createElement(_avatars.default, {
101
- size: "small",
102
- user: "employee"
103
- });
104
- }
105
- };
106
-
107
- BmChat.Details = function (_ref6) {
108
- var children = _ref6.children,
109
- state = _ref6.state,
110
- displayTime = _ref6.displayTime,
111
- status = _ref6.status,
112
- session = _ref6.session,
113
- rest = _objectWithoutProperties(_ref6, _excluded);
114
-
115
- return /*#__PURE__*/_react.default.createElement(Details, _extends({
116
- state: state
117
- }, rest), state === "inbound" && session && handleState({
118
- state: state,
119
- session: session
120
- }), /*#__PURE__*/_react.default.createElement(MessageDetails, null, /*#__PURE__*/_react.default.createElement(Messages, {
121
- state: state
122
- }, children), /*#__PURE__*/_react.default.createElement(MessagesSubDetails, null, displayTime && displayTime, status === "sent" && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
123
- icon: /*#__PURE__*/_react.default.createElement(_icons.DoneAll, null),
124
- color: "".concat(_colors.BmSecondaryDarkGreen),
125
- size: "small"
126
- }), status === "failed" && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
127
- icon: /*#__PURE__*/_react.default.createElement(_icons.Done, null),
128
- color: "".concat(_colors.BmPrimaryBlack),
129
- size: "small"
130
- }))), state === "outbound" && session && handleState({
131
- state: state,
132
- session: session
133
- }));
134
- };
135
-
136
- BmChat.Footer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n ", "\n padding: 0.5rem 0.5rem;\n ", "\n ", "\n > *:not(:last-child) {\n margin-bottom: 0.5rem;\n }\n"])), ''
137
- /* border-top: 0.071rem solid ${BmGrey200}; */
138
- , ''
139
- /* align-items: center; */
140
- , ''
141
- /* justify-content: center; */
142
- );
143
- var _default = BmChat;
144
- exports.default = _default;