beem-component 1.4.6 → 1.4.9

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.
@@ -19,11 +19,13 @@ var _avatars = _interopRequireDefault(require("../../Avatars/avatars"));
19
19
 
20
20
  var _iconStyles = require("../../iconStyles");
21
21
 
22
+ var _sessionDetails = require("./sessionDetails");
23
+
22
24
  var _colors = require("../../colors");
23
25
 
24
26
  var _excluded = ["state", "file", "src", "fileName", "onDownload"],
25
27
  _excluded2 = ["state", "src", "fileName"],
26
- _excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName"];
28
+ _excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName", "sessionDetails"];
27
29
 
28
30
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
29
31
 
@@ -37,25 +39,27 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
37
39
 
38
40
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
39
41
 
40
- var BmChat = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n ", "\n"])), ''
42
+ var BmChat = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n height: 100%;\n ", "\n"])), ""
41
43
  /* border: 0.071rem solid ${BmGrey400}; */
42
44
  );
43
45
 
44
- BmChat.Body = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column-reverse;\n padding: 0rem 1rem;\n flex-grow: 1;\n overflow: auto;\n height: 100%;\n"])));
46
+ BmChat.Body = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column-reverse;\n padding: 0rem 1rem;\n flex-grow: 1;\n overflow: auto;\n height: 100%;\n border: 10px solid green;\n"])));
45
47
 
46
- var Details = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: ", ";\n > *:not(:last-child) {\n margin-right: 1rem;\n margin-bottom: 0.5rem;\n }\n overflow-wrap: break-word !important;\n word-wrap: break-word !important;\n margin: 0rem;\n flex-grow: 1;\n"])), function (_ref) {
48
+ var Details = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: ", ";\n > *:not(:last-child) {\n margin-right: 1rem;\n margin-bottom: 0.5rem;\n }\n overflow-wrap: break-word !important;\n word-wrap: break-word !important;\n margin: 0rem;\n flex-grow: 1;\n ", "\n"])), function (_ref) {
47
49
  var state = _ref.state;
48
50
 
49
- if (state === 'inbound') {
50
- return 'flex-start';
51
+ if (state === "inbound") {
52
+ return "flex-start";
51
53
  }
52
54
 
53
- if (state === 'outbound') {
54
- return 'flex-end';
55
+ if (state === "outbound") {
56
+ return "flex-end";
55
57
  }
56
58
 
57
- return 'row';
58
- });
59
+ return "row";
60
+ }, ""
61
+ /* border: 1px solid red; */
62
+ );
59
63
 
60
64
  var MessageDetails = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n max-width: 70%;\n > * {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n }\n"])));
61
65
 
@@ -63,8 +67,8 @@ var Messages = _styledComponents.default.div(_templateObject5 || (_templateObjec
63
67
  var state = _ref2.state;
64
68
 
65
69
  if (state) {
66
- if (state === 'inbound') return "".concat(_colors.BmPrimaryWhite);
67
- if (state === 'outbound') return "".concat(_colors.BmPrimaryBlue);
70
+ if (state === "inbound") return "".concat(_colors.BmPrimaryWhite);
71
+ if (state === "outbound") return "".concat(_colors.BmPrimaryBlue);
68
72
  }
69
73
 
70
74
  return "".concat(_colors.BmPrimaryWhite);
@@ -72,8 +76,8 @@ var Messages = _styledComponents.default.div(_templateObject5 || (_templateObjec
72
76
  var state = _ref3.state;
73
77
 
74
78
  if (state) {
75
- if (state === 'inbound') return "".concat(_colors.BmPrimaryBlack);
76
- if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
79
+ if (state === "inbound") return "".concat(_colors.BmPrimaryBlack);
80
+ if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
77
81
  }
78
82
 
79
83
  return "".concat(_colors.BmPrimaryWhite);
@@ -81,8 +85,8 @@ var Messages = _styledComponents.default.div(_templateObject5 || (_templateObjec
81
85
  var state = _ref4.state;
82
86
 
83
87
  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';
88
+ if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
89
+ if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
86
90
  }
87
91
 
88
92
  return "".concat(_colors.BmPrimaryWhite);
@@ -93,14 +97,14 @@ var MessagesSubDetails = _styledComponents.default.div(_templateObject6 || (_tem
93
97
  var handleState = function handleState(_ref5) {
94
98
  var session = _ref5.session;
95
99
 
96
- if (session === 'bot') {
100
+ if (session === "bot") {
97
101
  return /*#__PURE__*/_react.default.createElement(_avatars.default, {
98
102
  size: "small",
99
103
  user: "chatbot"
100
104
  });
101
105
  }
102
106
 
103
- if (session === 'live') {
107
+ if (session === "live") {
104
108
  return /*#__PURE__*/_react.default.createElement(_avatars.default, {
105
109
  size: "small",
106
110
  user: "employee"
@@ -113,8 +117,8 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
113
117
  var state = _ref6.state;
114
118
 
115
119
  if (state) {
116
- if (state === 'inbound') return "".concat(_colors.BmPrimaryWhite);
117
- if (state === 'outbound') return "".concat(_colors.BmPrimaryBlue);
120
+ if (state === "inbound") return "".concat(_colors.BmPrimaryWhite);
121
+ if (state === "outbound") return "".concat(_colors.BmPrimaryBlue);
118
122
  }
119
123
 
120
124
  return "".concat(_colors.BmPrimaryWhite);
@@ -122,8 +126,8 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
122
126
  var state = _ref7.state;
123
127
 
124
128
  if (state) {
125
- if (state === 'inbound') return "".concat(_colors.BmPrimaryBlack);
126
- if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
129
+ if (state === "inbound") return "".concat(_colors.BmPrimaryBlack);
130
+ if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
127
131
  }
128
132
 
129
133
  return "".concat(_colors.BmPrimaryWhite);
@@ -131,8 +135,8 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
131
135
  var state = _ref8.state;
132
136
 
133
137
  if (state) {
134
- if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
135
- if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
138
+ if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
139
+ if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
136
140
  }
137
141
 
138
142
  return "".concat(_colors.BmPrimaryWhite);
@@ -140,14 +144,14 @@ var FileAttachmentWrapper = _styledComponents.default.div(_templateObject7 || (_
140
144
  var state = _ref9.state;
141
145
 
142
146
  if (state) {
143
- if (state === 'inbound') return "".concat(_colors.BmPrimaryBlue);
144
- if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
147
+ if (state === "inbound") return "".concat(_colors.BmPrimaryBlue);
148
+ if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
145
149
  }
146
150
 
147
151
  return "".concat(_colors.BmPrimaryWhite);
148
- }, ''
152
+ }, ""
149
153
  /* max-width: 100%; */
150
- , ''
154
+ , ""
151
155
  /* max-height: 100%; */
152
156
  );
153
157
 
@@ -174,8 +178,8 @@ var BmImageWrapper = _styledComponents.default.div(_templateObject8 || (_templat
174
178
  var state = _ref11.state;
175
179
 
176
180
  if (state) {
177
- if (state === 'inbound') return "".concat(_colors.BmPrimaryBlack);
178
- if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
181
+ if (state === "inbound") return "".concat(_colors.BmPrimaryBlack);
182
+ if (state === "outbound") return "".concat(_colors.BmPrimaryWhite);
179
183
  }
180
184
 
181
185
  return "".concat(_colors.BmPrimaryWhite);
@@ -183,8 +187,8 @@ var BmImageWrapper = _styledComponents.default.div(_templateObject8 || (_templat
183
187
  var state = _ref12.state;
184
188
 
185
189
  if (state) {
186
- if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
187
- if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
190
+ if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
191
+ if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
188
192
  }
189
193
 
190
194
  return "".concat(_colors.BmPrimaryWhite);
@@ -192,7 +196,7 @@ var BmImageWrapper = _styledComponents.default.div(_templateObject8 || (_templat
192
196
 
193
197
  exports.BmImageWrapper = BmImageWrapper;
194
198
 
195
- var BmImage = _styledComponents.default.img(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", "\n width: 100%;\n object-fit: cover;\n flex-grow: 1;\n"])), ''
199
+ var BmImage = _styledComponents.default.img(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n ", "\n width: 100%;\n object-fit: cover;\n flex-grow: 1;\n"])), ""
196
200
  /* Fix width */
197
201
  );
198
202
 
@@ -232,11 +236,15 @@ BmChat.Details = function (_ref14) {
232
236
  src = _ref14.src,
233
237
  file = _ref14.file,
234
238
  fileName = _ref14.fileName,
239
+ sessionDetails = _ref14.sessionDetails,
235
240
  rest = _objectWithoutProperties(_ref14, _excluded3);
236
241
 
237
- return /*#__PURE__*/_react.default.createElement(Details, _extends({
242
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, sessionDetails && /*#__PURE__*/_react.default.createElement(_sessionDetails.SessionDetails, _extends({
243
+ time: sessionDetails.time,
244
+ message: sessionDetails.message
245
+ }, rest)), /*#__PURE__*/_react.default.createElement(Details, _extends({
238
246
  state: state
239
- }, rest), /*#__PURE__*/_react.default.createElement(MessageState, null, state === 'inbound' && session && handleState({
247
+ }, rest), /*#__PURE__*/_react.default.createElement(MessageState, null, state === "inbound" && session && handleState({
240
248
  state: state,
241
249
  session: session
242
250
  })), /*#__PURE__*/_react.default.createElement(MessageDetails, null, src && /*#__PURE__*/_react.default.createElement(BmImageChat, _extends({
@@ -249,18 +257,18 @@ BmChat.Details = function (_ref14) {
249
257
  file: file,
250
258
  fileName: fileName,
251
259
  state: state
252
- }, rest)), /*#__PURE__*/_react.default.createElement(MessagesSubDetails, null, displayTime && displayTime, status === 'sent' && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
260
+ }, rest)), /*#__PURE__*/_react.default.createElement(MessagesSubDetails, null, displayTime && displayTime, status === "sent" && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
253
261
  icon: /*#__PURE__*/_react.default.createElement(_icons.DoneAll, null),
254
262
  color: "".concat(_colors.BmSecondaryDarkGreen),
255
263
  size: "small"
256
- }), status === 'failed' && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
264
+ }), status === "failed" && /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
257
265
  icon: /*#__PURE__*/_react.default.createElement(_icons.Done, null),
258
266
  color: "".concat(_colors.BmPrimaryBlack),
259
267
  size: "small"
260
- }))), /*#__PURE__*/_react.default.createElement(MessageState, null, state === 'outbound' && session && handleState({
268
+ }))), /*#__PURE__*/_react.default.createElement(MessageState, null, state === "outbound" && session && handleState({
261
269
  state: state,
262
270
  session: session
263
- })));
271
+ }))));
264
272
  };
265
273
 
266
274
  BmChat.Footer = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n padding: 0.5rem 0.5rem;\n > *:not(:last-child) {\n margin-bottom: 0.5rem;\n }\n"])));
@@ -38,7 +38,11 @@ var ChatBody = function ChatBody() {
38
38
  state: "inbound",
39
39
  session: "bot",
40
40
  displayTime: /*#__PURE__*/_react.default.createElement("p", null, "12:00pm"),
41
- status: "sent"
41
+ status: "sent",
42
+ sessionDetails: {
43
+ message: /*#__PURE__*/_react.default.createElement("h3", null, "Session Message"),
44
+ time: /*#__PURE__*/_react.default.createElement("p", null, "12:00pm")
45
+ }
42
46
  }, /*#__PURE__*/_react.default.createElement("p", null, "Inbound Text Message")), /*#__PURE__*/_react.default.createElement(_chatBody.default.Details, {
43
47
  state: "inbound",
44
48
  session: "live",
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SessionDetails = void 0;
7
+
8
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
+
10
+ var _colors = require("../../colors");
11
+
12
+ var _excluded = ["message", "time"];
13
+
14
+ var _templateObject;
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ 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); }
19
+
20
+ 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; }
21
+
22
+ 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; }
23
+
24
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
25
+
26
+ var SessionDetailsWrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n text-align: center;\n border-bottom: 0.071rem solid ", ";\n margin: 0.5rem;\n"])), _colors.BmGrey200);
27
+
28
+ var SessionDetails = function SessionDetails(_ref) {
29
+ var message = _ref.message,
30
+ time = _ref.time,
31
+ rest = _objectWithoutProperties(_ref, _excluded);
32
+
33
+ return /*#__PURE__*/React.createElement(SessionDetailsWrapper, _extends({
34
+ time: time,
35
+ message: message
36
+ }, rest), /*#__PURE__*/React.createElement("p", null, "\xA0"), message || /*#__PURE__*/React.createElement("p", null, "\xA0"), time || /*#__PURE__*/React.createElement("p", null, "\xA0"));
37
+ };
38
+
39
+ exports.SessionDetails = SessionDetails;
@@ -133,7 +133,7 @@ BmModal.Header = function (_ref2) {
133
133
  });
134
134
  };
135
135
 
136
- 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 max-height: ", ";\n ", "\n"])), function (_ref3) {
136
+ 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 max-height: ", ";\n overflow: auto;\n"])), function (_ref3) {
137
137
  var size = _ref3.size;
138
138
 
139
139
  if (size) {
@@ -145,9 +145,7 @@ BmModal.Body = _styledComponents.default.div(_templateObject5 || (_templateObjec
145
145
  }
146
146
 
147
147
  return "35.714rem";
148
- }, ''
149
- /* overflow: auto; */
150
- );
148
+ });
151
149
  BmModal.Footer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n"])));
152
150
  BmModal.propTypes = {
153
151
  size: _propTypes.default.string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beem-component",
3
- "version": "1.4.6",
3
+ "version": "1.4.9",
4
4
  "private": false,
5
5
  "main": "dist/components/index.js",
6
6
  "scripts": {
package/src/App.js CHANGED
@@ -1,13 +1,67 @@
1
1
  import React from "react";
2
- import { BmTag, GlobalStyle } from "./lib/components";
2
+ import { GlobalStyle, BmChat } from "./lib/components";
3
+ import image from "../src/lib/assets/chart-img.png";
3
4
 
4
5
  const App = () => {
5
6
  return (
6
7
  <>
7
8
  <GlobalStyle />
8
- <BmTag variant="success" closeButton onHide={() => console.log("aaaaa")}>
9
- <p>hello</p>
10
- </BmTag>
9
+ <BmChat>
10
+ <BmChat.Body>
11
+ <BmChat.Details
12
+ state="inbound"
13
+ session="bot"
14
+ displayTime={<p>12:00pm</p>}
15
+ status="sent"
16
+ >
17
+ <p>Inbound Text Message</p>
18
+ </BmChat.Details>
19
+ <BmChat.Details
20
+ state="inbound"
21
+ session="live"
22
+ displayTime={<p>12:00pm</p>}
23
+ status="sent"
24
+ fileName={<p>chat.png</p>}
25
+ src={image}
26
+ sessionDetails={{ message: <h3>tejal</h3>, time: <p>today</p> }}
27
+ />
28
+ <BmChat.Details
29
+ state="inbound"
30
+ session="live"
31
+ displayTime={<p>10:00am</p>}
32
+ status="failed"
33
+ fileName={<p>file.csv</p>}
34
+ file={image}
35
+ />
36
+ <BmChat.Details
37
+ state="outbound"
38
+ session="bot"
39
+ displayTime={<p>12:00pm</p>}
40
+ status="sent"
41
+ >
42
+ <p>Outbound Text Message</p>
43
+ </BmChat.Details>
44
+ <BmChat.Details
45
+ state="outbound"
46
+ session="live"
47
+ displayTime={<p>12:00pm</p>}
48
+ status="sent"
49
+ fileName={<p>chat.png</p>}
50
+ src={image}
51
+ />
52
+ <BmChat.Details
53
+ state="outbound"
54
+ session="live"
55
+ displayTime={<p>10:00am</p>}
56
+ status="failed"
57
+ fileName={<p>file.csv</p>}
58
+ file={image}
59
+ onDownload={() => {
60
+ alert("hello");
61
+ }}
62
+ />
63
+ </BmChat.Body>
64
+ </BmChat>
11
65
  </>
12
66
  );
13
67
  };
@@ -1,24 +1,24 @@
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
-
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
+ import { SessionDetails } from "./sessionDetails";
9
9
  import {
10
10
  BmPrimaryWhite,
11
11
  BmPrimaryBlue,
12
12
  BmPrimaryBlack,
13
13
  BmSecondaryDarkGreen,
14
14
  BmGrey200,
15
- } from '../../colors';
15
+ } from "../../colors";
16
16
 
17
17
  const BmChat = styled.div`
18
18
  display: flex;
19
19
  flex-direction: column;
20
20
  height: 100%;
21
- ${'' /* border: 0.071rem solid ${BmGrey400}; */}
21
+ ${"" /* border: 0.071rem solid ${BmGrey400}; */}
22
22
  `;
23
23
 
24
24
  BmChat.Body = styled.div`
@@ -28,18 +28,19 @@ BmChat.Body = styled.div`
28
28
  flex-grow: 1;
29
29
  overflow: auto;
30
30
  height: 100%;
31
+ border: 10px solid green;
31
32
  `;
32
33
 
33
34
  const Details = styled.div`
34
35
  display: flex;
35
36
  justify-content: ${({ state }) => {
36
- if (state === 'inbound') {
37
- return 'flex-start';
37
+ if (state === "inbound") {
38
+ return "flex-start";
38
39
  }
39
- if (state === 'outbound') {
40
- return 'flex-end';
40
+ if (state === "outbound") {
41
+ return "flex-end";
41
42
  }
42
- return 'row';
43
+ return "row";
43
44
  }};
44
45
  > *:not(:last-child) {
45
46
  margin-right: 1rem;
@@ -49,6 +50,7 @@ const Details = styled.div`
49
50
  word-wrap: break-word !important;
50
51
  margin: 0rem;
51
52
  flex-grow: 1;
53
+ ${"" /* border: 1px solid red; */}
52
54
  `;
53
55
 
54
56
  const MessageDetails = styled.div`
@@ -68,22 +70,22 @@ const Messages = styled.div`
68
70
  padding: 0.5rem;
69
71
  background: ${({ state }) => {
70
72
  if (state) {
71
- if (state === 'inbound') return `${BmPrimaryWhite}`;
72
- if (state === 'outbound') return `${BmPrimaryBlue}`;
73
+ if (state === "inbound") return `${BmPrimaryWhite}`;
74
+ if (state === "outbound") return `${BmPrimaryBlue}`;
73
75
  }
74
76
  return `${BmPrimaryWhite}`;
75
77
  }};
76
78
  color: ${({ state }) => {
77
79
  if (state) {
78
- if (state === 'inbound') return `${BmPrimaryBlack}`;
79
- if (state === 'outbound') return `${BmPrimaryWhite}`;
80
+ if (state === "inbound") return `${BmPrimaryBlack}`;
81
+ if (state === "outbound") return `${BmPrimaryWhite}`;
80
82
  }
81
83
  return `${BmPrimaryWhite}`;
82
84
  }};
83
85
  border-radius: ${({ state }) => {
84
86
  if (state) {
85
- if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
86
- if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
87
+ if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
88
+ if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
87
89
  }
88
90
  return `${BmPrimaryWhite}`;
89
91
  }};
@@ -103,11 +105,11 @@ const MessagesSubDetails = styled.div`
103
105
  `;
104
106
 
105
107
  const handleState = ({ session }) => {
106
- if (session === 'bot') {
107
- return <BmAvatar size='small' user='chatbot' />;
108
+ if (session === "bot") {
109
+ return <BmAvatar size="small" user="chatbot" />;
108
110
  }
109
- if (session === 'live') {
110
- return <BmAvatar size='small' user='employee' />;
111
+ if (session === "live") {
112
+ return <BmAvatar size="small" user="employee" />;
111
113
  }
112
114
  };
113
115
 
@@ -119,22 +121,22 @@ const FileAttachmentWrapper = styled.div`
119
121
  padding: 1rem;
120
122
  background: ${({ state }) => {
121
123
  if (state) {
122
- if (state === 'inbound') return `${BmPrimaryWhite}`;
123
- if (state === 'outbound') return `${BmPrimaryBlue}`;
124
+ if (state === "inbound") return `${BmPrimaryWhite}`;
125
+ if (state === "outbound") return `${BmPrimaryBlue}`;
124
126
  }
125
127
  return `${BmPrimaryWhite}`;
126
128
  }};
127
129
  color: ${({ state }) => {
128
130
  if (state) {
129
- if (state === 'inbound') return `${BmPrimaryBlack}`;
130
- if (state === 'outbound') return `${BmPrimaryWhite}`;
131
+ if (state === "inbound") return `${BmPrimaryBlack}`;
132
+ if (state === "outbound") return `${BmPrimaryWhite}`;
131
133
  }
132
134
  return `${BmPrimaryWhite}`;
133
135
  }};
134
136
  border-radius: ${({ state }) => {
135
137
  if (state) {
136
- if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
137
- if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
138
+ if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
139
+ if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
138
140
  }
139
141
  return `${BmPrimaryWhite}`;
140
142
  }};
@@ -151,14 +153,14 @@ const FileAttachmentWrapper = styled.div`
151
153
  align-items: center;
152
154
  color: ${({ state }) => {
153
155
  if (state) {
154
- if (state === 'inbound') return `${BmPrimaryBlue}`;
155
- if (state === 'outbound') return `${BmPrimaryWhite}`;
156
+ if (state === "inbound") return `${BmPrimaryBlue}`;
157
+ if (state === "outbound") return `${BmPrimaryWhite}`;
156
158
  }
157
159
  return `${BmPrimaryWhite}`;
158
160
  }};
159
161
  }
160
- ${'' /* max-width: 100%; */}
161
- ${'' /* max-height: 100%; */}
162
+ ${"" /* max-width: 100%; */}
163
+ ${"" /* max-height: 100%; */}
162
164
  `;
163
165
 
164
166
  const BmFileAttachment = ({
@@ -183,15 +185,15 @@ export const BmImageWrapper = styled.div`
183
185
  flex-direction: column;
184
186
  color: ${({ state }) => {
185
187
  if (state) {
186
- if (state === 'inbound') return `${BmPrimaryBlack}`;
187
- if (state === 'outbound') return `${BmPrimaryWhite}`;
188
+ if (state === "inbound") return `${BmPrimaryBlack}`;
189
+ if (state === "outbound") return `${BmPrimaryWhite}`;
188
190
  }
189
191
  return `${BmPrimaryWhite}`;
190
192
  }};
191
193
  border-radius: ${({ state }) => {
192
194
  if (state) {
193
- if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
194
- if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
195
+ if (state === "inbound") return "0.21875rem 0.21875rem 0.21875rem 0rem";
196
+ if (state === "outbound") return "0.21875rem 0.21875rem 0rem 0.21875rem";
195
197
  }
196
198
  return `${BmPrimaryWhite}`;
197
199
  }};
@@ -199,7 +201,7 @@ export const BmImageWrapper = styled.div`
199
201
  `;
200
202
 
201
203
  export const BmImage = styled.img`
202
- ${'' /* Fix width */}
204
+ ${"" /* Fix width */}
203
205
  width: 100%;
204
206
  object-fit: cover;
205
207
  flex-grow: 1;
@@ -209,7 +211,7 @@ export const BmImageChat = ({ state, src, fileName, ...rest }) => {
209
211
  return (
210
212
  <>
211
213
  <BmImageWrapper state={state} {...rest}>
212
- <BmImage src={src} alt='src' />
214
+ <BmImage src={src} alt="src" />
213
215
  {fileName && (
214
216
  <BmFileAttachment
215
217
  state={state}
@@ -240,48 +242,67 @@ BmChat.Details = ({
240
242
  src,
241
243
  file,
242
244
  fileName,
245
+ sessionDetails,
243
246
  ...rest
244
247
  }) => {
245
248
  return (
246
- <Details state={state} {...rest}>
247
- {/* Adding for mobile */}
248
- <MessageState>
249
- {state === 'inbound' && session && handleState({ state, session })}
250
- </MessageState>
251
- <MessageDetails>
252
- {/* For Images */}
253
- {src && (
254
- <BmImageChat state={state} src={src} fileName={fileName} {...rest} />
255
- )}
256
- {/* For Messages */}
257
- {children && <Messages state={state}>{children}</Messages>}
258
- {/* For files */}
259
- {file && (
260
- <BmFileAttachment
261
- file={file}
262
- fileName={fileName}
263
- state={state}
264
- {...rest}
265
- />
266
- )}
267
- <MessagesSubDetails>
268
- {displayTime && displayTime}
269
- {status === 'sent' && (
270
- <BmIcons
271
- icon={<DoneAll />}
272
- color={`${BmSecondaryDarkGreen}`}
273
- size='small'
249
+ <>
250
+ {sessionDetails && (
251
+ <SessionDetails
252
+ time={sessionDetails.time}
253
+ message={sessionDetails.message}
254
+ {...rest}
255
+ />
256
+ )}
257
+ <Details state={state} {...rest}>
258
+ {/* Adding for mobile */}
259
+ <MessageState>
260
+ {state === "inbound" && session && handleState({ state, session })}
261
+ </MessageState>
262
+ <MessageDetails>
263
+ {/* For Images */}
264
+ {src && (
265
+ <BmImageChat
266
+ state={state}
267
+ src={src}
268
+ fileName={fileName}
269
+ {...rest}
274
270
  />
275
271
  )}
276
- {status === 'failed' && (
277
- <BmIcons icon={<Done />} color={`${BmPrimaryBlack}`} size='small' />
272
+ {/* For Messages */}
273
+ {children && <Messages state={state}>{children}</Messages>}
274
+ {/* For files */}
275
+ {file && (
276
+ <BmFileAttachment
277
+ file={file}
278
+ fileName={fileName}
279
+ state={state}
280
+ {...rest}
281
+ />
278
282
  )}
279
- </MessagesSubDetails>
280
- </MessageDetails>
281
- <MessageState>
282
- {state === 'outbound' && session && handleState({ state, session })}
283
- </MessageState>
284
- </Details>
283
+ <MessagesSubDetails>
284
+ {displayTime && displayTime}
285
+ {status === "sent" && (
286
+ <BmIcons
287
+ icon={<DoneAll />}
288
+ color={`${BmSecondaryDarkGreen}`}
289
+ size="small"
290
+ />
291
+ )}
292
+ {status === "failed" && (
293
+ <BmIcons
294
+ icon={<Done />}
295
+ color={`${BmPrimaryBlack}`}
296
+ size="small"
297
+ />
298
+ )}
299
+ </MessagesSubDetails>
300
+ </MessageDetails>
301
+ <MessageState>
302
+ {state === "outbound" && session && handleState({ state, session })}
303
+ </MessageState>
304
+ </Details>
305
+ </>
285
306
  );
286
307
  };
287
308
 
@@ -23,6 +23,7 @@ export const ChatBody = () => {
23
23
  session='bot'
24
24
  displayTime={<p>12:00pm</p>}
25
25
  status='sent'
26
+ sessionDetails={{ message: <h3>Session Message</h3>, time: <p>12:00pm</p> }}
26
27
  >
27
28
  <p>Inbound Text Message</p>
28
29
  </BmChat.Details>
@@ -0,0 +1,22 @@
1
+ import styled from "styled-components";
2
+ import { BmGrey200 } from "../../colors";
3
+
4
+ const SessionDetailsWrapper = styled.div`
5
+ display: flex;
6
+ flex-direction: row;
7
+ justify-content: space-between;
8
+ align-items: center;
9
+ text-align: center;
10
+ border-bottom: 0.071rem solid ${BmGrey200};
11
+ margin: 0.5rem;
12
+ `;
13
+
14
+ export const SessionDetails = ({ message, time, ...rest }) => {
15
+ return (
16
+ <SessionDetailsWrapper time={time} message={message} {...rest}>
17
+ <p>&nbsp;</p>
18
+ {message || <p>&nbsp;</p>}
19
+ {time || <p>&nbsp;</p>}
20
+ </SessionDetailsWrapper>
21
+ );
22
+ };
@@ -144,7 +144,7 @@ BmModal.Body = styled.div`
144
144
  }
145
145
  return "35.714rem";
146
146
  }};
147
- ${'' /* overflow: auto; */}
147
+ overflow: auto;
148
148
  `;
149
149
 
150
150
  BmModal.Footer = styled.div`