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,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 ColorPicker = () => {
10
+ return (
11
+ <>
12
+ {["#33b1ba", "#000000", "#F62E48", "#8CC63F"].map((color) => (
13
+ <BmColorPicker key={color} color={color} />
14
+ ))}
15
+ </>
16
+ );
17
+ };
@@ -1,5 +1,5 @@
1
1
  import styled from "styled-components";
2
- import { BmGrey100 } from "../colors";
2
+ import { BmSecondaryBlue12 } from "../../colors";
3
3
 
4
4
  export const BmContactCard = styled.div`
5
5
  display: flex;
@@ -9,13 +9,13 @@ export const BmContactCard = styled.div`
9
9
  margin-right: 1rem;
10
10
  }
11
11
  &:hover {
12
- background: ${BmGrey100};
12
+ background: ${BmSecondaryBlue12};
13
13
  }
14
14
 
15
15
  ${({ active }) =>
16
16
  active &&
17
17
  `
18
- background: ${BmGrey100};
18
+ background: ${BmSecondaryBlue12};
19
19
  `}
20
20
  cursor: pointer;
21
21
  padding: 1rem 1.5rem;
@@ -1,13 +1,13 @@
1
1
  /* eslint-disable import/no-anonymous-default-export */
2
2
  import React from "react";
3
3
  import BmContactCard from "./contactCards";
4
- import BmAvatar from "../Avatars/avatars";
5
- import BmCounter from "../MessageCounter/messageCounter";
6
- import { BmTag } from "../tags";
4
+ import BmAvatar from "../../Avatars/avatars";
5
+ import BmCounter from "../../MessageCounter/messageCounter";
6
+ import { BmTag } from "../../tags";
7
7
 
8
8
  export default {
9
9
  component: { BmContactCard, BmAvatar, BmTag, BmCounter },
10
- title: "components/ContactCard",
10
+ title: "components/Chat/Components/ContactCard",
11
11
  };
12
12
 
13
13
  export const ContactCard = () => {
@@ -0,0 +1,37 @@
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
+ <div style={{ width: "30%" }}>
13
+ <BmAccordion>
14
+ <BmAccordion.Title>
15
+ <h3>Information</h3>
16
+ </BmAccordion.Title>
17
+ <BmAccordion.Body>
18
+ <BmChatForm>
19
+ <BmChatForm.Group>
20
+ <BmChatForm.Label>
21
+ <h4>Account No.</h4>
22
+ </BmChatForm.Label>
23
+ <BmChatForm.Input placeholder="Enter here" />
24
+ </BmChatForm.Group>
25
+ <BmChatForm.Group>
26
+ <BmChatForm.Label>
27
+ <h4>Preferred Language</h4>
28
+ </BmChatForm.Label>
29
+ <BmChatForm.Input placeholder="Enter here" />
30
+ </BmChatForm.Group>
31
+ </BmChatForm>
32
+ </BmAccordion.Body>
33
+ </BmAccordion>
34
+ </div>
35
+ </>
36
+ );
37
+ };
@@ -1,5 +1,4 @@
1
1
  import styled from "styled-components";
2
- // import { BmGrey400 } from "../colors";
3
2
 
4
3
  const BmInfoTab = styled.div`
5
4
  display: flex;
@@ -1,14 +1,13 @@
1
1
  /* eslint-disable import/no-anonymous-default-export */
2
2
  import React from "react";
3
3
  import BmInfoTab from "./infoTab";
4
- import { BmTag } from "../tags";
5
- import { BmBtnIcon } from "../Buttons/buttonIconsOnly";
4
+ import { BmBtnIcon } from "../../Buttons/buttonIconsOnly";
6
5
  import { MoreVert, Phone } from "@material-ui/icons";
7
- import { BmIcons } from "../iconStyles";
6
+ import { BmIcons } from "../../iconStyles";
8
7
 
9
8
  export default {
10
9
  component: BmInfoTab,
11
- title: "components/InfoTab",
10
+ title: "components/Chat/Components/InfoTab",
12
11
  };
13
12
 
14
13
  export const InfoTab = () => {
@@ -0,0 +1,38 @@
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
+ <div style={{ width: "30%" }}>
13
+ <BmAccordion>
14
+ <BmAccordion.Title>
15
+ <h3>Labels</h3>
16
+ <a>Manage Labels</a>
17
+ </BmAccordion.Title>
18
+ <BmAccordion.Body>
19
+ <BmChatLabels>
20
+ <h4>Added labels</h4>
21
+ <div>
22
+ <BmTag variant="success">
23
+ <p>label</p>
24
+ </BmTag>
25
+ <BmTag variant="warning">
26
+ <p>label</p>
27
+ </BmTag>
28
+ <BmTag variant="error">
29
+ <p>label</p>
30
+ </BmTag>
31
+ </div>
32
+ </BmChatLabels>
33
+ </BmAccordion.Body>
34
+ </BmAccordion>
35
+ </div>
36
+ </>
37
+ );
38
+ };
@@ -0,0 +1,47 @@
1
+ import { BmAccordion, BmChatLabels, BmChatNotes, BmIcons } from "../..";
2
+ import ContentCopyIcon from "@mui/icons-material/ContentCopy";
3
+ import { Delete, Edit } from "@material-ui/icons";
4
+
5
+ // eslint-disable-next-line import/no-anonymous-default-export
6
+ export default {
7
+ component: BmChatLabels,
8
+ title: "components/Chat/Components/NoteAccordion",
9
+ };
10
+
11
+ export const NoteAccordion = () => {
12
+ return (
13
+ <>
14
+ <div style={{ width: "30%" }}>
15
+ <BmAccordion>
16
+ <BmAccordion.Title>
17
+ <h3>Notes</h3>
18
+ </BmAccordion.Title>
19
+ <BmAccordion.Body>
20
+ <BmChatNotes>
21
+ <BmChatNotes.Input type="text" placeholder="Add Note" />
22
+ {/* Display Note */}
23
+ <BmChatNotes.Details>
24
+ <div>
25
+ <p>Description</p>
26
+ </div>
27
+ <div>
28
+ <BmIcons icon={<Edit />} size="xsmall" />
29
+ <BmIcons icon={<ContentCopyIcon />} size="xsmall" />
30
+ <BmIcons icon={<Delete />} size="xsmall" />
31
+ </div>
32
+ <div>
33
+ <p>
34
+ <i>By User</i>
35
+ </p>
36
+ <p>
37
+ <i>12:00pm</i>
38
+ </p>
39
+ </div>
40
+ </BmChatNotes.Details>
41
+ </BmChatNotes>
42
+ </BmAccordion.Body>
43
+ </BmAccordion>
44
+ </div>
45
+ </>
46
+ );
47
+ };
@@ -138,12 +138,12 @@ BmModal.Body = styled.div`
138
138
  > *:not(:last-child) {
139
139
  margin-bottom: 0.5rem;
140
140
  }
141
- > * {
141
+ ${'' /* > * {
142
142
  display: flex;
143
143
  flex-direction: row;
144
144
  justify-content: space-between;
145
145
  width: 100%;
146
- }
146
+ } */}
147
147
  `;
148
148
 
149
149
  BmModal.Footer = styled.div`
@@ -32,6 +32,9 @@ export const BmSecondaryGreen15 = "rgba(4, 132, 75, 0.15)";
32
32
 
33
33
  export const BmSecondaryGold15 = "rgba(243, 169, 41, 0.15)";
34
34
 
35
+ // #33B1BA 12%
36
+ export const BmSecondaryBlue12="rgba(51, 177, 186, 0.12)";
37
+
35
38
  // Background Colors
36
39
  export const BmBgLightBlue = "#E1EAFC";
37
40
 
@@ -32,10 +32,10 @@ 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";
37
- import BmContactCard from "./ContactCards/contactCards";
38
- import BmInfoTab from "./InfoTab/infoTab";
35
+ import BmChat from "./ChatComponents/ChatBody/chatBody";
36
+ import { BmChatHeader } from "./ChatComponents/ChatHeader/chatHeader";
37
+ import BmContactCard from "./ChatComponents/ContactCards/contactCards";
38
+ import BmInfoTab from "./ChatComponents/InfoTab/infoTab";
39
39
  import BmCounter from "./MessageCounter/messageCounter";
40
40
  //Chat Accordion components
41
41
  import BmChatForm from "./ChatComponents/FormAccordion/FormAccordion";
@@ -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;
@@ -1,147 +0,0 @@
1
- import { Done, DoneAll } from "@material-ui/icons";
2
- import React from "react";
3
- import styled from "styled-components";
4
- import BmAvatar from "../Avatars/avatars";
5
- import { BmIcons } from "../iconStyles";
6
- import {
7
- BmGrey400,
8
- BmPrimaryWhite,
9
- BmPrimaryBlue,
10
- BmPrimaryBlack,
11
- BmSecondaryDarkGreen,
12
- } from "../colors";
13
-
14
- const BmChat = styled.div`
15
- display: flex;
16
- flex-direction: column;
17
- height: 100%;
18
- ${"" /* border: 0.071rem solid ${BmGrey400}; */}
19
- `;
20
-
21
- BmChat.Body = styled.div`
22
- display: flex;
23
- flex-direction: column;
24
- padding: 0rem 1.5rem;
25
- flex-grow: 1;
26
- overflow: auto;
27
- `;
28
-
29
- const Details = styled.div`
30
- display: flex;
31
- ${"" /* align-items: center; */}
32
- justify-content: ${({ state }) => {
33
- if (state === "inbound") {
34
- return "flex-start";
35
- }
36
- if (state === "outbound") {
37
- return "flex-end";
38
- }
39
- return "row";
40
- }};
41
- > *:not(:last-child) {
42
- margin-right: 1rem;
43
- }
44
- overflow-wrap: break-word !important;
45
- word-wrap: break-word !important;
46
- margin: 0rem;
47
- flex-grow: 1;
48
- `;
49
-
50
- const MessageDetails = styled.div`
51
- display: flex;
52
- flex-direction: column;
53
- max-width: 50%;
54
- > * {
55
- margin-top: 0.5rem;
56
- }
57
- `;
58
-
59
- const Messages = styled.div`
60
- display: flex;
61
- flex-direction: row;
62
- align-items: center;
63
- padding: 1.143rem;
64
- background: ${({ state }) => {
65
- if (state) {
66
- if (state === "inbound") return `${BmPrimaryWhite}`;
67
- if (state === "outbound") return `${BmPrimaryBlue}`;
68
- }
69
- return `${BmPrimaryWhite}`;
70
- }};
71
- color: ${({ state }) => {
72
- if (state) {
73
- if (state === "inbound") return `${BmPrimaryBlack}`;
74
- if (state === "outbound") return `${BmPrimaryWhite}`;
75
- }
76
- return `${BmPrimaryWhite}`;
77
- }};
78
- border-radius: ${({ state }) => {
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
- return `${BmPrimaryWhite}`;
84
- }};
85
- border: 0.071rem solid ${BmGrey400};
86
- word-break: break-all;
87
- margin: 0rem;
88
- `;
89
-
90
- const MessagesSubDetails = styled.div`
91
- display: flex;
92
- flex-direction: row;
93
- align-items: center;
94
- > *:not(:last-child) {
95
- margin-right: 0.5rem;
96
- }
97
- margin-top: 0.5rem;
98
- `;
99
-
100
- const handleState = ({ session }) => {
101
- if (session === "bot") {
102
- return <BmAvatar size="small" user="chatbot" />;
103
- }
104
- if (session === "live") {
105
- return <BmAvatar size="small" user="employee" />;
106
- }
107
- };
108
-
109
- BmChat.Details = ({
110
- children,
111
- state,
112
- displayTime,
113
- status,
114
- session,
115
- ...rest
116
- }) => {
117
- return (
118
- <Details state={state} {...rest}>
119
- {state === "inbound" && session && handleState({ state, session })}
120
- <MessageDetails>
121
- <Messages state={state}>{children}</Messages>
122
- <MessagesSubDetails>
123
- {displayTime && displayTime}
124
- {status === "sent" && (
125
- <BmIcons icon={<DoneAll />} color={`${BmSecondaryDarkGreen}`} size="small" />
126
- )}
127
- {status === "failed" && <BmIcons icon={<Done />} color={`${BmPrimaryBlack}`} size="small" />}
128
- </MessagesSubDetails>
129
- </MessageDetails>
130
- {state === "outbound" && session && handleState({ state, session })}
131
- </Details>
132
- );
133
- };
134
-
135
- BmChat.Footer = styled.div`
136
- display: flex;
137
- flex-direction: column;
138
- ${'' /* border-top: 0.071rem solid ${BmGrey200}; */}
139
- padding: 0.5rem 0.5rem;
140
- ${'' /* align-items: center; */}
141
- ${'' /* justify-content: center; */}
142
- > *:not(:last-child) {
143
- margin-bottom: 0.5rem;
144
- }
145
- `;
146
-
147
- export default BmChat;