beem-component 1.1.6 → 1.2.0

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 (42) hide show
  1. package/.storybook/preview.js +2 -1
  2. package/dist/assets/css/{sidebar.css → sidebar.scss} +31 -5
  3. package/dist/components/Avatars/avatars.js +4 -6
  4. package/dist/components/ChatComponents/ChatBody/chatBody.js +265 -0
  5. package/dist/components/{ChatBody → ChatComponents/ChatBody}/chatBody.stories.js +42 -11
  6. package/dist/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.js +0 -0
  7. package/dist/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.stories.js +8 -4
  8. package/dist/components/ChatComponents/ColorPicker/colorPicker.stories.js +26 -0
  9. package/dist/components/{ContactCards → ChatComponents/ContactCards}/contactCards.js +3 -3
  10. package/dist/components/{ContactCards → ChatComponents/ContactCards}/contactCards.stories.js +4 -4
  11. package/dist/components/ChatComponents/FormAccordion/FormAccordion.stories.js +29 -0
  12. package/dist/components/{InfoTab → ChatComponents/InfoTab}/infoTab.js +0 -1
  13. package/dist/components/{InfoTab → ChatComponents/InfoTab}/infoTab.stories.js +3 -5
  14. package/dist/components/ChatComponents/LabelAccordion/LabelAccordion.stories.js +31 -0
  15. package/dist/components/ChatComponents/NoteAccordion/NoteAccordion.stories.js +43 -0
  16. package/dist/components/Modals/modal.js +8 -1
  17. package/dist/components/colors.js +5 -2
  18. package/dist/components/index.js +4 -4
  19. package/package.json +2 -1
  20. package/src/App.js +15 -37
  21. package/src/Chat.js +18 -6
  22. package/src/ChatHeader.js +1 -1
  23. package/src/lib/assets/css/{sidebar.css → sidebar.scss} +31 -5
  24. package/src/lib/components/Avatars/avatars.js +4 -6
  25. package/src/lib/components/ChatComponents/ChatBody/chatBody.js +279 -0
  26. package/src/lib/components/ChatComponents/ChatBody/chatBody.stories.js +81 -0
  27. package/src/lib/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.js +0 -0
  28. package/src/lib/components/{ChatHeader → ChatComponents/ChatHeader}/chatHeader.stories.js +6 -3
  29. package/src/lib/components/ChatComponents/ColorPicker/colorPicker.stories.js +17 -0
  30. package/src/lib/components/{ContactCards → ChatComponents/ContactCards}/contactCards.js +3 -3
  31. package/src/lib/components/{ContactCards → ChatComponents/ContactCards}/contactCards.stories.js +4 -4
  32. package/src/lib/components/ChatComponents/FormAccordion/FormAccordion.stories.js +37 -0
  33. package/src/lib/components/{InfoTab → ChatComponents/InfoTab}/infoTab.js +0 -1
  34. package/src/lib/components/{InfoTab → ChatComponents/InfoTab}/infoTab.stories.js +3 -4
  35. package/src/lib/components/ChatComponents/LabelAccordion/LabelAccordion.stories.js +38 -0
  36. package/src/lib/components/ChatComponents/NoteAccordion/NoteAccordion.stories.js +47 -0
  37. package/src/lib/components/Modals/modal.js +2 -2
  38. package/src/lib/components/colors.js +3 -0
  39. package/src/lib/components/index.js +4 -4
  40. package/dist/components/ChatBody/chatBody.js +0 -144
  41. package/src/lib/components/ChatBody/chatBody.js +0 -147
  42. package/src/lib/components/ChatBody/chatBody.stories.js +0 -48
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.LabelAccordion = void 0;
7
+
8
+ var _ = require("../..");
9
+
10
+ // eslint-disable-next-line import/no-anonymous-default-export
11
+ var _default = {
12
+ component: _.BmChatLabels,
13
+ title: "components/Chat/Components/LabelAccordion"
14
+ };
15
+ exports.default = _default;
16
+
17
+ var LabelAccordion = function LabelAccordion() {
18
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
19
+ style: {
20
+ width: "30%"
21
+ }
22
+ }, /*#__PURE__*/React.createElement(_.BmAccordion, null, /*#__PURE__*/React.createElement(_.BmAccordion.Title, null, /*#__PURE__*/React.createElement("h3", null, "Labels"), /*#__PURE__*/React.createElement("a", null, "Manage Labels")), /*#__PURE__*/React.createElement(_.BmAccordion.Body, null, /*#__PURE__*/React.createElement(_.BmChatLabels, null, /*#__PURE__*/React.createElement("h4", null, "Added labels"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_.BmTag, {
23
+ variant: "success"
24
+ }, /*#__PURE__*/React.createElement("p", null, "label")), /*#__PURE__*/React.createElement(_.BmTag, {
25
+ variant: "warning"
26
+ }, /*#__PURE__*/React.createElement("p", null, "label")), /*#__PURE__*/React.createElement(_.BmTag, {
27
+ variant: "error"
28
+ }, /*#__PURE__*/React.createElement("p", null, "label"))))))));
29
+ };
30
+
31
+ exports.LabelAccordion = LabelAccordion;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.NoteAccordion = void 0;
7
+
8
+ var _ = require("../..");
9
+
10
+ var _ContentCopy = _interopRequireDefault(require("@mui/icons-material/ContentCopy"));
11
+
12
+ var _icons = require("@material-ui/icons");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ // eslint-disable-next-line import/no-anonymous-default-export
17
+ var _default = {
18
+ component: _.BmChatLabels,
19
+ title: "components/Chat/Components/NoteAccordion"
20
+ };
21
+ exports.default = _default;
22
+
23
+ var NoteAccordion = function NoteAccordion() {
24
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
25
+ style: {
26
+ width: "30%"
27
+ }
28
+ }, /*#__PURE__*/React.createElement(_.BmAccordion, null, /*#__PURE__*/React.createElement(_.BmAccordion.Title, null, /*#__PURE__*/React.createElement("h3", null, "Notes")), /*#__PURE__*/React.createElement(_.BmAccordion.Body, null, /*#__PURE__*/React.createElement(_.BmChatNotes, null, /*#__PURE__*/React.createElement(_.BmChatNotes.Input, {
29
+ type: "text",
30
+ placeholder: "Add Note"
31
+ }), /*#__PURE__*/React.createElement(_.BmChatNotes.Details, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, "Description")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_.BmIcons, {
32
+ icon: /*#__PURE__*/React.createElement(_icons.Edit, null),
33
+ size: "xsmall"
34
+ }), /*#__PURE__*/React.createElement(_.BmIcons, {
35
+ icon: /*#__PURE__*/React.createElement(_ContentCopy.default, null),
36
+ size: "xsmall"
37
+ }), /*#__PURE__*/React.createElement(_.BmIcons, {
38
+ icon: /*#__PURE__*/React.createElement(_icons.Delete, null),
39
+ size: "xsmall"
40
+ })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("i", null, "By User")), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("i", null, "12:00pm")))))))));
41
+ };
42
+
43
+ exports.NoteAccordion = NoteAccordion;
@@ -153,7 +153,14 @@ BmModal.Header = function (_ref4) {
153
153
  });
154
154
  };
155
155
 
156
- BmModal.Body = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n > *:not(:last-child) {\n margin-bottom: 0.5rem;\n }\n > * {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n width: 100%;\n }\n"])));
156
+ BmModal.Body = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n > *:not(:last-child) {\n margin-bottom: 0.5rem;\n }\n ", "\n"])), ''
157
+ /* > * {
158
+ display: flex;
159
+ flex-direction: row;
160
+ justify-content: space-between;
161
+ width: 100%;
162
+ } */
163
+ );
157
164
  BmModal.Footer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n"])));
158
165
  BmModal.propTypes = {
159
166
  size: _propTypes.default.string,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.BmSecondaryYellow = exports.BmSecondaryRed8 = exports.BmSecondaryRed15 = exports.BmSecondaryRed = exports.BmSecondaryPurple = exports.BmSecondaryGrey = exports.BmSecondaryGreen8 = exports.BmSecondaryGreen15 = exports.BmSecondaryGreen = exports.BmSecondaryGold15 = exports.BmSecondaryDarkGreen = exports.BmSecondaryCyan = exports.BmPrimaryWhite = exports.BmPrimaryGold = exports.BmPrimaryBlue = exports.BmPrimaryBlack = exports.BmPictogramGold = exports.BmPictogramBlue = exports.BmGrey600 = exports.BmGrey500 = exports.BmGrey50 = exports.BmGrey400 = exports.BmGrey200 = exports.BmGrey100 = exports.BmBgLightBlue = exports.BmBgGreyBlue = exports.BmBgGrey45 = void 0;
6
+ exports.BmSecondaryYellow = exports.BmSecondaryRed8 = exports.BmSecondaryRed15 = exports.BmSecondaryRed = exports.BmSecondaryPurple = exports.BmSecondaryGrey = exports.BmSecondaryGreen8 = exports.BmSecondaryGreen15 = exports.BmSecondaryGreen = exports.BmSecondaryGold15 = exports.BmSecondaryDarkGreen = exports.BmSecondaryCyan = exports.BmSecondaryBlue12 = exports.BmPrimaryWhite = exports.BmPrimaryGold = exports.BmPrimaryBlue = exports.BmPrimaryBlack = exports.BmPictogramGold = exports.BmPictogramBlue = exports.BmGrey600 = exports.BmGrey500 = exports.BmGrey50 = exports.BmGrey400 = exports.BmGrey200 = exports.BmGrey100 = exports.BmBgLightBlue = exports.BmBgGreyBlue = exports.BmBgGrey45 = void 0;
7
7
  // Primary Colors
8
8
  var BmPrimaryBlue = "#33B1BA";
9
9
  exports.BmPrimaryBlue = BmPrimaryBlue;
@@ -36,9 +36,12 @@ var BmSecondaryRed15 = "rgba(246, 46, 72, 0.15)";
36
36
  exports.BmSecondaryRed15 = BmSecondaryRed15;
37
37
  var BmSecondaryGreen15 = "rgba(4, 132, 75, 0.15)";
38
38
  exports.BmSecondaryGreen15 = BmSecondaryGreen15;
39
- var BmSecondaryGold15 = "rgba(243, 169, 41, 0.15)"; // Background Colors
39
+ var BmSecondaryGold15 = "rgba(243, 169, 41, 0.15)"; // #33B1BA 12%
40
40
 
41
41
  exports.BmSecondaryGold15 = BmSecondaryGold15;
42
+ var BmSecondaryBlue12 = "rgba(51, 177, 186, 0.12)"; // Background Colors
43
+
44
+ exports.BmSecondaryBlue12 = BmSecondaryBlue12;
42
45
  var BmBgLightBlue = "#E1EAFC";
43
46
  exports.BmBgLightBlue = BmBgLightBlue;
44
47
  var BmBgGreyBlue = "#F5F6FA";
@@ -355,13 +355,13 @@ var _noteBar = require("./NoteBar/noteBar");
355
355
 
356
356
  var _MainWrapper = require("../components/MainWrapper");
357
357
 
358
- var _chatBody = _interopRequireDefault(require("../components/ChatBody/chatBody"));
358
+ var _chatBody = _interopRequireDefault(require("./ChatComponents/ChatBody/chatBody"));
359
359
 
360
- var _chatHeader = require("./ChatHeader/chatHeader");
360
+ var _chatHeader = require("./ChatComponents/ChatHeader/chatHeader");
361
361
 
362
- var _contactCards = _interopRequireDefault(require("./ContactCards/contactCards"));
362
+ var _contactCards = _interopRequireDefault(require("./ChatComponents/ContactCards/contactCards"));
363
363
 
364
- var _infoTab = _interopRequireDefault(require("./InfoTab/infoTab"));
364
+ var _infoTab = _interopRequireDefault(require("./ChatComponents/InfoTab/infoTab"));
365
365
 
366
366
  var _messageCounter = _interopRequireDefault(require("./MessageCounter/messageCounter"));
367
367
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beem-component",
3
- "version": "1.1.6",
3
+ "version": "1.2.0",
4
4
  "private": false,
5
5
  "main": "dist/components/index.js",
6
6
  "scripts": {
@@ -26,6 +26,7 @@
26
26
  "@material-ui/icons": "^4.11.2",
27
27
  "@mui/icons-material": "^5.2.1",
28
28
  "@mui/material": "^5.2.3",
29
+ "js-file-download": "^0.4.12",
29
30
  "node-sass": "^6.0.1",
30
31
  "polished": "^4.1.3",
31
32
  "react": "^17.0.2",
package/src/App.js CHANGED
@@ -2,55 +2,33 @@ import React from "react";
2
2
  import "../src/main.scss";
3
3
  import { MainWrapper } from "./lib/components";
4
4
  import { GlobalStyle } from "./lib/components/globalStyles";
5
- import "./lib/assets/css/sidebar.css";
5
+ import "./lib/assets/css/sidebar.scss";
6
6
  import SideBar from "./SideBar";
7
7
  import ChatHeader from "./ChatHeader";
8
8
  import Chat from "./Chat";
9
9
  import CustomerInfo from "./CustomerInfo";
10
- import { BmTag } from "./lib/components/Tags/tags";
11
- import { Home } from "@material-ui/icons";
12
10
  import InfoAccordion from "./InfoAccordion";
13
- import BmForm from "./lib/components/ChatComponents/FormAccordion/FormAccordion";
14
- import { BmColorPicker } from "./lib/components/ChatComponents/ColorPicker/colorPicker";
15
11
 
16
12
  export const App = () => {
17
13
  return (
18
14
  <>
19
15
  <GlobalStyle />
20
16
  <MainWrapper>
21
- {["#33b1ba", "#000000", "#F62E48", "#8CC63F"].map((color) => (
22
- <BmColorPicker key={color} color={color} />
23
- ))}
24
- <BmTag leadingIcon={<Home />} trailingIcon={<Home />}>
25
- <p>Hello</p>
26
- </BmTag>
27
- <BmForm>
28
- <BmForm.Group>
29
- <BmForm.Label>
30
- <h4>Hello</h4>
31
- </BmForm.Label>
32
- <BmForm.Input placeholder="Hello" />
33
- </BmForm.Group>
34
- <BmForm.Group>
35
- <BmForm.Label>
36
- <h4>Hello</h4>
37
- </BmForm.Label>
38
- <BmForm.Input placeholder="Hello" />
39
- </BmForm.Group>
40
- </BmForm>
41
17
  <div className="main-chat-container">
42
- <div className="sidebar">
43
- <SideBar />
44
- </div>
45
- <div className="chat">
46
- <ChatHeader />
47
- <div className="chat-menu">
48
- <div className="chat-messages">
49
- <Chat />
50
- </div>
51
- <div className="chat-contact-info">
52
- <CustomerInfo />
53
- <InfoAccordion />
18
+ <div className="chat-container">
19
+ <div className="sidebar">
20
+ <SideBar />
21
+ </div>
22
+ <div className="chat">
23
+ <ChatHeader />
24
+ <div className="chat-menu">
25
+ <div className="chat-messages">
26
+ <Chat />
27
+ </div>
28
+ <div className="chat-contact-info">
29
+ <CustomerInfo />
30
+ <InfoAccordion />
31
+ </div>
54
32
  </div>
55
33
  </div>
56
34
  </div>
package/src/Chat.js CHANGED
@@ -4,7 +4,9 @@ import EmojiEmotionsIcon from "@material-ui/icons/EmojiEmotions";
4
4
  import QuickreplyIcon from "@mui/icons-material/Quickreply";
5
5
  import SendIcon from "@mui/icons-material/Send";
6
6
  import { BmChat, BmIcons, BmInput } from "./lib/components";
7
- import "../src/lib/assets/css/sidebar.css";
7
+ import "../src/lib/assets/css/sidebar.scss";
8
+ import image from "../src/lib/assets/chart-img.png";
9
+ import azam from "../src/lib/images/azam1.png";
8
10
 
9
11
  const Chat = () => {
10
12
  return (
@@ -15,16 +17,18 @@ const Chat = () => {
15
17
  session="bot"
16
18
  displayTime={<p>12:00pm</p>}
17
19
  status="sent"
18
- >
19
- <p>Inbound</p>
20
- </BmChat.Details>
20
+ src={image}
21
+ fileName={<p>attachment.jpg</p>}
22
+ />
21
23
  <BmChat.Details
22
24
  state="outbound"
23
25
  session="live"
24
26
  displayTime={<p>10:00am</p>}
25
27
  status="failed"
28
+ src={azam}
29
+ file={<p>fildjfdlkfjlkfdjfldjfldsjfldsje.jpg</p>}
26
30
  >
27
- <p>Outbound</p>
31
+ <p>Hekkoi</p>
28
32
  </BmChat.Details>
29
33
  <BmChat.Details
30
34
  state="outbound"
@@ -56,7 +60,15 @@ const Chat = () => {
56
60
  displayTime={<p>10:00am</p>}
57
61
  status="failed"
58
62
  >
59
- <p>Outbound</p>
63
+ <p>
64
+ Habari! Mimi ni msaidizi wako binafsi Azam TV. Ningependa
65
+ nikusaidie, lakini tafadhali anza kwa kuchagua kati ya haya
66
+ nikuhudumie (Mfano chagua namba 2 kubadili kifurushi au 5 kwa msaada
67
+ zaidi). 1. Angalia Salio 2. Badilisha Kifurishi 3. Tuma Ujumbe
68
+ Kuwasha Kisimbuzi 4. Huduma za mteja mpya 5. Nahitaji msaada (Huduma
69
+ kwa mteja) 6. Change language 0. Au ungependa kutuuliza swali
70
+ lingine?
71
+ </p>
60
72
  </BmChat.Details>{" "}
61
73
  <BmChat.Details
62
74
  state="outbound"
package/src/ChatHeader.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { BmChatHeader, BmButton } from "../src/lib/components/";
3
- import "../src/lib/assets/css/sidebar.css";
3
+ import "../src/lib/assets/css/sidebar.scss";
4
4
 
5
5
  export const ChatHeader = () => {
6
6
  return (
@@ -1,3 +1,9 @@
1
+ .main-chat-container {
2
+ display: flex;
3
+ flex-direction: row;
4
+ width: 100%;
5
+ }
6
+
1
7
  .sidebar {
2
8
  display: flex;
3
9
  flex-direction: column;
@@ -5,7 +11,7 @@
5
11
  height: 100%;
6
12
  overflow: auto;
7
13
  max-width: 20%;
8
- width: 20%;
14
+ width: 100%;
9
15
  border: 1px solid #E2E2E2;
10
16
  }
11
17
 
@@ -33,7 +39,7 @@
33
39
  overflow: auto;
34
40
  }
35
41
 
36
- .main-chat-container {
42
+ .chat-container {
37
43
  display: flex;
38
44
  flex-direction: row;
39
45
  align-items: center;
@@ -47,9 +53,7 @@
47
53
  display: flex;
48
54
  flex-direction: column;
49
55
  max-height: 100%;
50
- height: 100%;
51
56
  flex-grow: 1;
52
- max-height: 100%;
53
57
  height: 100%;
54
58
  }
55
59
 
@@ -59,6 +63,7 @@
59
63
  height: 0%;
60
64
  flex-grow: 1;
61
65
  width: 100%;
66
+ max-width: 100%;
62
67
  }
63
68
 
64
69
  .chat-messages {
@@ -66,7 +71,8 @@
66
71
  flex-direction: column;
67
72
  height: 100%;
68
73
  overflow: auto;
69
- width: 80%;
74
+ width: 75%;
75
+ max-width: 75%;
70
76
  border: 1px solid #E2E2E2;
71
77
  }
72
78
 
@@ -76,6 +82,7 @@
76
82
  height: 100%;
77
83
  overflow: auto;
78
84
  width: 25%;
85
+ max-width: 25%;
79
86
  border: 1px solid #E2E2E2;
80
87
  }
81
88
 
@@ -97,4 +104,23 @@
97
104
 
98
105
  .chat-footer>*:not(:last-child) {
99
106
  margin-right: 0.5rem;
107
+ }
108
+
109
+ .quick-reply {
110
+ display: flex;
111
+ justify-content: center;
112
+ }
113
+
114
+ .label-color-picker {
115
+ display: flex;
116
+ flex-direction: row;
117
+ justify-content: flex-start !important;
118
+ }
119
+
120
+ .label-color-picker>* {
121
+ margin-right: 0.5rem;
122
+ }
123
+
124
+ .label-select {
125
+ width: 100%;
100
126
  }
@@ -28,9 +28,8 @@ export const BmAvatarWrapper = styled.div`
28
28
  }};
29
29
  background: ${({ user }) => {
30
30
  if (user === "chatbot") return `${BmPrimaryBlue}`;
31
- if (user === "employee") return `${BmGrey100}`;
32
- if (user === "default") return `${BmPrimaryBlue}`;
33
- return `${BmPrimaryBlue}`;
31
+ if (user === "employee") return `${BmPrimaryBlue}`;
32
+ return `${BmGrey100}`;
34
33
  }};
35
34
  border-radius: ${({ type }) => {
36
35
  if (type === "circle") return "7.143rem";
@@ -40,9 +39,8 @@ export const BmAvatarWrapper = styled.div`
40
39
  border: 0.071rem solid
41
40
  ${({ user }) => {
42
41
  if (user === "chatbot") return `${BmPrimaryBlue}`;
43
- if (user === "employee") return `${BmGrey400}`;
44
- if (user === "default") return `${BmPrimaryBlue}`;
45
- return `${BmPrimaryBlue}`;
42
+ if (user === "employee") return `${BmPrimaryBlue}`;
43
+ return `${BmGrey100}`;
46
44
  }};
47
45
  `;
48
46
 
@@ -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: 0.5rem;
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: 100%;
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;