beem-component 1.9.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.MessageState = exports.BmImageWrapper = exports.BmImageChat = exports.BmImage = void 0;
|
|
6
|
+
exports.default = exports.RepliedTextWrapper = exports.MessageState = exports.BmImageWrapper = exports.BmImageChat = exports.BmImage = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _icons = require("@material-ui/icons");
|
|
9
9
|
var _FilePresent = _interopRequireDefault(require("@mui/icons-material/FilePresent"));
|
|
@@ -18,7 +18,7 @@ var _colors = require("../../colors");
|
|
|
18
18
|
var _FeedPostComments = require("./FeedPostComments");
|
|
19
19
|
var _excluded = ["state", "file", "src", "fileName", "onDownload", "link"],
|
|
20
20
|
_excluded2 = ["state", "src", "fileName"],
|
|
21
|
-
_excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName", "sessionDetails", "sessionTimeline", "feedPostComments", "agentName"];
|
|
21
|
+
_excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName", "sessionDetails", "sessionTimeline", "feedPostComments", "agentName", "metadata"];
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
24
24
|
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; }
|
|
@@ -48,8 +48,16 @@ var MessageDetails = _styledComponents.default.div.withConfig({
|
|
|
48
48
|
})(["display:flex;flex-direction:column;max-width:70%;> *{margin-top:0.5rem;margin-bottom:0.5rem;}"]);
|
|
49
49
|
var Messages = _styledComponents.default.div.withConfig({
|
|
50
50
|
displayName: "chatBody__Messages"
|
|
51
|
-
})(["display:flex;flex-direction:row;align-items:center;padding:0.5rem;background:", ";color:", ";border-radius:", ";border:
|
|
52
|
-
var state = _ref2.state
|
|
51
|
+
})(["display:flex;flex-direction:row;align-items:center;padding:1rem 0.5rem;background:", ";color:", ";border-radius:", ";border-left:", ";border:", ";word-break:break-word;margin:0rem;"], function (_ref2) {
|
|
52
|
+
var state = _ref2.state,
|
|
53
|
+
metadata = _ref2.metadata;
|
|
54
|
+
if (metadata) {
|
|
55
|
+
if (state) {
|
|
56
|
+
if (state === 'inbound') return "".concat(_colors.BmTransparentBg30);
|
|
57
|
+
if (state === 'outbound') return "".concat(_colors.BmTransparentBg30);
|
|
58
|
+
}
|
|
59
|
+
return "".concat(_colors.BmPrimaryWhite);
|
|
60
|
+
}
|
|
53
61
|
if (state) {
|
|
54
62
|
if (state === 'inbound') return "".concat(_colors.BmPrimaryWhite);
|
|
55
63
|
if (state === 'outbound') return "".concat(_colors.BmPrimaryBlue);
|
|
@@ -63,26 +71,47 @@ var Messages = _styledComponents.default.div.withConfig({
|
|
|
63
71
|
}
|
|
64
72
|
return "".concat(_colors.BmPrimaryWhite);
|
|
65
73
|
}, function (_ref4) {
|
|
66
|
-
var state = _ref4.state
|
|
74
|
+
var state = _ref4.state,
|
|
75
|
+
metadata = _ref4.metadata;
|
|
76
|
+
if (metadata) {
|
|
77
|
+
return '0rem';
|
|
78
|
+
}
|
|
67
79
|
if (state) {
|
|
68
80
|
if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
|
|
69
81
|
if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
|
|
70
82
|
}
|
|
71
83
|
return "".concat(_colors.BmPrimaryWhite);
|
|
72
|
-
},
|
|
84
|
+
}, function (_ref5) {
|
|
85
|
+
var state = _ref5.state,
|
|
86
|
+
metadata = _ref5.metadata;
|
|
87
|
+
if (metadata) {
|
|
88
|
+
if (state) {
|
|
89
|
+
if (state === 'inbound') return "2px solid ".concat(_colors.BmPrimaryBlue);
|
|
90
|
+
if (state === 'outbound') return "2px solid ".concat(_colors.BmPrimaryGold);
|
|
91
|
+
}
|
|
92
|
+
return "".concat(_colors.BmPrimaryWhite);
|
|
93
|
+
}
|
|
94
|
+
return '';
|
|
95
|
+
}, function (_ref6) {
|
|
96
|
+
var metadata = _ref6.metadata;
|
|
97
|
+
if (metadata) {
|
|
98
|
+
return '';
|
|
99
|
+
}
|
|
100
|
+
return "0.071rem solid ".concat(_colors.BmGrey200, ";");
|
|
101
|
+
});
|
|
73
102
|
var MessagesSubDetails = _styledComponents.default.div.withConfig({
|
|
74
103
|
displayName: "chatBody__MessagesSubDetails"
|
|
75
|
-
})(["display:flex;flex-direction:row;align-items:center;> *:not(:last-child){margin-right:0.5rem;}margin-left:", ";margin-top:0.5rem;"], function (
|
|
76
|
-
var state =
|
|
104
|
+
})(["display:flex;flex-direction:row;align-items:center;> *:not(:last-child){margin-right:0.5rem;}margin-left:", ";margin-top:0.5rem;"], function (_ref7) {
|
|
105
|
+
var state = _ref7.state;
|
|
77
106
|
if (state) {
|
|
78
107
|
if (state === 'inbound') return '0px';
|
|
79
108
|
if (state === 'outbound') return 'auto';
|
|
80
109
|
}
|
|
81
110
|
return "".concat(_colors.BmPrimaryWhite);
|
|
82
111
|
});
|
|
83
|
-
var handleState = function handleState(
|
|
84
|
-
var session =
|
|
85
|
-
agentName =
|
|
112
|
+
var handleState = function handleState(_ref8) {
|
|
113
|
+
var session = _ref8.session,
|
|
114
|
+
agentName = _ref8.agentName;
|
|
86
115
|
if (session === 'bot') {
|
|
87
116
|
return /*#__PURE__*/_react.default.createElement(_avatars.default, {
|
|
88
117
|
size: "small",
|
|
@@ -113,29 +142,29 @@ var handleState = function handleState(_ref6) {
|
|
|
113
142
|
// Start of File Attachment
|
|
114
143
|
var FileAttachmentWrapper = _styledComponents.default.div.withConfig({
|
|
115
144
|
displayName: "chatBody__FileAttachmentWrapper"
|
|
116
|
-
})(["display:flex;cursor:pointer;flex-direction:row;padding:1rem;background:", ";color:", ";border-radius:", ";border:0.071rem solid ", ";> *{&:last-child{margin-left:auto;}:not(:last-child){margin-right:0.5rem;}}&&& > *{align-items:center;color:", ";}", " ", ""], function (
|
|
117
|
-
var state =
|
|
145
|
+
})(["display:flex;cursor:pointer;flex-direction:row;padding:1rem;background:", ";color:", ";border-radius:", ";border:0.071rem solid ", ";> *{&:last-child{margin-left:auto;}:not(:last-child){margin-right:0.5rem;}}&&& > *{align-items:center;color:", ";}", " ", ""], function (_ref9) {
|
|
146
|
+
var state = _ref9.state;
|
|
118
147
|
if (state) {
|
|
119
148
|
if (state === 'inbound') return "".concat(_colors.BmPrimaryWhite);
|
|
120
149
|
if (state === 'outbound') return "".concat(_colors.BmPrimaryBlue);
|
|
121
150
|
}
|
|
122
151
|
return "".concat(_colors.BmPrimaryWhite);
|
|
123
|
-
}, function (
|
|
124
|
-
var state =
|
|
152
|
+
}, function (_ref10) {
|
|
153
|
+
var state = _ref10.state;
|
|
125
154
|
if (state) {
|
|
126
155
|
if (state === 'inbound') return "".concat(_colors.BmPrimaryBlack);
|
|
127
156
|
if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
|
|
128
157
|
}
|
|
129
158
|
return "".concat(_colors.BmPrimaryWhite);
|
|
130
|
-
}, function (
|
|
131
|
-
var state =
|
|
159
|
+
}, function (_ref11) {
|
|
160
|
+
var state = _ref11.state;
|
|
132
161
|
if (state) {
|
|
133
162
|
if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
|
|
134
163
|
if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
|
|
135
164
|
}
|
|
136
165
|
return "".concat(_colors.BmPrimaryWhite);
|
|
137
|
-
}, _colors.BmGrey200, function (
|
|
138
|
-
var state =
|
|
166
|
+
}, _colors.BmGrey200, function (_ref12) {
|
|
167
|
+
var state = _ref12.state;
|
|
139
168
|
if (state) {
|
|
140
169
|
if (state === 'inbound') return "".concat(_colors.BmPrimaryBlue);
|
|
141
170
|
if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
|
|
@@ -143,14 +172,14 @@ var FileAttachmentWrapper = _styledComponents.default.div.withConfig({
|
|
|
143
172
|
return "".concat(_colors.BmPrimaryWhite);
|
|
144
173
|
}, '' /* max-width: 100%; */, '' /* max-height: 100%; */);
|
|
145
174
|
|
|
146
|
-
var BmFileAttachment = function BmFileAttachment(
|
|
147
|
-
var state =
|
|
148
|
-
file =
|
|
149
|
-
src =
|
|
150
|
-
fileName =
|
|
151
|
-
onDownload =
|
|
152
|
-
link =
|
|
153
|
-
rest = _objectWithoutProperties(
|
|
175
|
+
var BmFileAttachment = function BmFileAttachment(_ref13) {
|
|
176
|
+
var state = _ref13.state,
|
|
177
|
+
file = _ref13.file,
|
|
178
|
+
src = _ref13.src,
|
|
179
|
+
fileName = _ref13.fileName,
|
|
180
|
+
onDownload = _ref13.onDownload,
|
|
181
|
+
link = _ref13.link,
|
|
182
|
+
rest = _objectWithoutProperties(_ref13, _excluded);
|
|
154
183
|
return /*#__PURE__*/_react.default.createElement(FileAttachmentWrapper, _extends({
|
|
155
184
|
state: state
|
|
156
185
|
}, rest), /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
@@ -165,15 +194,15 @@ var BmFileAttachment = function BmFileAttachment(_ref11) {
|
|
|
165
194
|
// Start of Component for Images
|
|
166
195
|
var BmImageWrapper = _styledComponents.default.div.withConfig({
|
|
167
196
|
displayName: "chatBody__BmImageWrapper"
|
|
168
|
-
})(["display:flex;flex-direction:column;color:", ";border-radius:", ";border:0.071rem solid ", ";"], function (
|
|
169
|
-
var state =
|
|
197
|
+
})(["display:flex;flex-direction:column;color:", ";border-radius:", ";border:0.071rem solid ", ";"], function (_ref14) {
|
|
198
|
+
var state = _ref14.state;
|
|
170
199
|
if (state) {
|
|
171
200
|
if (state === 'inbound') return "".concat(_colors.BmPrimaryBlack);
|
|
172
201
|
if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
|
|
173
202
|
}
|
|
174
203
|
return "".concat(_colors.BmPrimaryWhite);
|
|
175
|
-
}, function (
|
|
176
|
-
var state =
|
|
204
|
+
}, function (_ref15) {
|
|
205
|
+
var state = _ref15.state;
|
|
177
206
|
if (state) {
|
|
178
207
|
if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
|
|
179
208
|
if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
|
|
@@ -185,11 +214,11 @@ var BmImage = _styledComponents.default.img.withConfig({
|
|
|
185
214
|
displayName: "chatBody__BmImage"
|
|
186
215
|
})(["", " width:100%;object-fit:cover;flex-grow:1;"], '' /* Fix width */);
|
|
187
216
|
exports.BmImage = BmImage;
|
|
188
|
-
var BmImageChat = function BmImageChat(
|
|
189
|
-
var state =
|
|
190
|
-
src =
|
|
191
|
-
fileName =
|
|
192
|
-
rest = _objectWithoutProperties(
|
|
217
|
+
var BmImageChat = function BmImageChat(_ref16) {
|
|
218
|
+
var state = _ref16.state,
|
|
219
|
+
src = _ref16.src,
|
|
220
|
+
fileName = _ref16.fileName,
|
|
221
|
+
rest = _objectWithoutProperties(_ref16, _excluded2);
|
|
193
222
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(BmImageWrapper, _extends({
|
|
194
223
|
state: state
|
|
195
224
|
}, rest), /*#__PURE__*/_react.default.createElement(BmImage, {
|
|
@@ -207,21 +236,46 @@ var MessageState = _styledComponents.default.div.withConfig({
|
|
|
207
236
|
})(["@media all and (max-width:960px){display:none;}"]);
|
|
208
237
|
|
|
209
238
|
// End of Component for Images
|
|
239
|
+
|
|
240
|
+
// export const ReplyWrapper = styled.div`
|
|
241
|
+
// display: flex;
|
|
242
|
+
// align-items: center;
|
|
243
|
+
// gap: 1rem;
|
|
244
|
+
// `;
|
|
210
245
|
exports.MessageState = MessageState;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
246
|
+
var RepliedTextWrapper = _styledComponents.default.div.withConfig({
|
|
247
|
+
displayName: "chatBody__RepliedTextWrapper"
|
|
248
|
+
})(["display:flex;flex-direction:column;justify-content:center;padding:1.14286rem 1.14286rem 1.14286rem 0.35714rem;gap:1rem;border-radius:0.25rem 0.25rem 0.25rem 0rem;border:1px solid ", ";background:", ";color:", ";"], _colors.BmGrey200, function (_ref17) {
|
|
249
|
+
var state = _ref17.state;
|
|
250
|
+
if (state) {
|
|
251
|
+
if (state === 'inbound') return "".concat(_colors.BmPrimaryWhite);
|
|
252
|
+
if (state === 'outbound') return "".concat(_colors.BmPrimaryBlue);
|
|
253
|
+
}
|
|
254
|
+
return "".concat(_colors.BmPrimaryWhite);
|
|
255
|
+
}, function (_ref18) {
|
|
256
|
+
var state = _ref18.state;
|
|
257
|
+
if (state) {
|
|
258
|
+
if (state === 'inbound') return "".concat(_colors.BmPrimaryBlack);
|
|
259
|
+
if (state === 'outbound') return "".concat(_colors.BmPrimaryWhite);
|
|
260
|
+
}
|
|
261
|
+
return "".concat(_colors.BmPrimaryWhite);
|
|
262
|
+
});
|
|
263
|
+
exports.RepliedTextWrapper = RepliedTextWrapper;
|
|
264
|
+
BmChat.Details = function (_ref19) {
|
|
265
|
+
var children = _ref19.children,
|
|
266
|
+
state = _ref19.state,
|
|
267
|
+
displayTime = _ref19.displayTime,
|
|
268
|
+
status = _ref19.status,
|
|
269
|
+
session = _ref19.session,
|
|
270
|
+
src = _ref19.src,
|
|
271
|
+
file = _ref19.file,
|
|
272
|
+
fileName = _ref19.fileName,
|
|
273
|
+
sessionDetails = _ref19.sessionDetails,
|
|
274
|
+
sessionTimeline = _ref19.sessionTimeline,
|
|
275
|
+
feedPostComments = _ref19.feedPostComments,
|
|
276
|
+
agentName = _ref19.agentName,
|
|
277
|
+
metadata = _ref19.metadata,
|
|
278
|
+
rest = _objectWithoutProperties(_ref19, _excluded3);
|
|
225
279
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Details, _extends({
|
|
226
280
|
state: state
|
|
227
281
|
}, rest), /*#__PURE__*/_react.default.createElement(MessageState, null, state === 'inbound' && session && handleState({
|
|
@@ -234,9 +288,14 @@ BmChat.Details = function (_ref15) {
|
|
|
234
288
|
state: state,
|
|
235
289
|
src: src,
|
|
236
290
|
fileName: fileName
|
|
237
|
-
}, rest)), children && /*#__PURE__*/_react.default.createElement(
|
|
291
|
+
}, rest)), children && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, metadata ? /*#__PURE__*/_react.default.createElement(RepliedTextWrapper, {
|
|
292
|
+
state: state
|
|
293
|
+
}, /*#__PURE__*/_react.default.createElement(Messages, {
|
|
294
|
+
metadata: metadata,
|
|
295
|
+
state: state
|
|
296
|
+
}, children), metadata) : /*#__PURE__*/_react.default.createElement(Messages, {
|
|
238
297
|
state: state
|
|
239
|
-
}, children), file && /*#__PURE__*/_react.default.createElement(BmFileAttachment, _extends({
|
|
298
|
+
}, children)), file && /*#__PURE__*/_react.default.createElement(BmFileAttachment, _extends({
|
|
240
299
|
file: file,
|
|
241
300
|
fileName: fileName,
|
|
242
301
|
state: state
|
|
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
var _icons = require("@material-ui/icons");
|
|
12
12
|
var _iconStyles = require("../iconStyles");
|
|
13
13
|
var _colors = require("../colors");
|
|
14
|
-
var _excluded = ["variant", "size", "disabled", "children", "leadingIcon", "trailingIcon", "color", "bgColor", "closeButton", "onHide"];
|
|
14
|
+
var _excluded = ["variant", "size", "disabled", "children", "leadingIcon", "trailingIcon", "color", "textColor", "bgColor", "closeButton", "onHide"];
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -26,7 +26,11 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
26
26
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
27
|
var Color = function Color(_ref) {
|
|
28
28
|
var variant = _ref.variant,
|
|
29
|
-
color = _ref.color
|
|
29
|
+
color = _ref.color,
|
|
30
|
+
textColor = _ref.textColor;
|
|
31
|
+
if (textColor) {
|
|
32
|
+
return textColor;
|
|
33
|
+
}
|
|
30
34
|
if (variant === 'success' || variant === 'warning' || variant === 'danger' || variant === 'primary') {
|
|
31
35
|
return "".concat(_colors.BmPrimaryWhite);
|
|
32
36
|
}
|
|
@@ -65,10 +69,12 @@ var BeemTag = _styledComponents.default.button.withConfig({
|
|
|
65
69
|
return "".concat(_colors.BmGrey100);
|
|
66
70
|
}, function (_ref5) {
|
|
67
71
|
var variant = _ref5.variant,
|
|
68
|
-
color = _ref5.color
|
|
72
|
+
color = _ref5.color,
|
|
73
|
+
textColor = _ref5.textColor;
|
|
69
74
|
return Color({
|
|
70
75
|
variant: variant,
|
|
71
|
-
color: color
|
|
76
|
+
color: color,
|
|
77
|
+
textColor: textColor
|
|
72
78
|
});
|
|
73
79
|
});
|
|
74
80
|
var BmTag = function BmTag(props) {
|
|
@@ -83,6 +89,7 @@ var BmTag = function BmTag(props) {
|
|
|
83
89
|
leadingIcon = props.leadingIcon,
|
|
84
90
|
trailingIcon = props.trailingIcon,
|
|
85
91
|
color = props.color,
|
|
92
|
+
textColor = props.textColor,
|
|
86
93
|
bgColor = props.bgColor,
|
|
87
94
|
closeButton = props.closeButton,
|
|
88
95
|
onHide = props.onHide,
|
|
@@ -93,6 +100,7 @@ var BmTag = function BmTag(props) {
|
|
|
93
100
|
disabled: disabled,
|
|
94
101
|
children: children,
|
|
95
102
|
color: color,
|
|
103
|
+
textColor: textColor,
|
|
96
104
|
closeButton: closeButton,
|
|
97
105
|
show: toggle,
|
|
98
106
|
bgColor: bgColor
|
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -1,99 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
// * eslint-disable func-style *
|
|
2
|
+
/* eslint-disable jsx-a11y/media-has-caption */
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import AttachFileIcon from '@mui/icons-material/AttachFile';
|
|
5
|
+
import EmojiEmotionsIcon from '@mui/icons-material/EmojiEmotions';
|
|
6
|
+
import SendIcon from '@mui/icons-material/Send';
|
|
7
|
+
import QuickreplyIcon from '@mui/icons-material/Quickreply';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
const [item, setItem] = useState();
|
|
10
|
-
const Occurance = ['Now', 'Later', 'Recurring'];
|
|
11
|
-
const [count, setCount] = useState();
|
|
12
|
-
const handleCountChange = (newCount) => {
|
|
13
|
-
setCount(newCount);
|
|
14
|
-
};
|
|
15
|
-
const [activeStep, setActiveStep] = useState(new Date().getDay());
|
|
16
|
-
const [selectedDates, setSelectedDates] = useState([]);
|
|
17
|
-
|
|
18
|
-
const handleSelectDates = (dates) => {
|
|
19
|
-
setSelectedDates(dates);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const Weekdays = [
|
|
23
|
-
{
|
|
24
|
-
dayNo: 1,
|
|
25
|
-
day: 'Monday',
|
|
26
|
-
dayInitial: 'M',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
dayNo: 2,
|
|
30
|
-
day: 'Tuesday',
|
|
31
|
-
dayInitial: 'T',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
dayNo: 3,
|
|
35
|
-
day: 'Wednesday',
|
|
36
|
-
dayInitial: 'W',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
dayNo: 4,
|
|
40
|
-
day: 'Thursday',
|
|
41
|
-
dayInitial: 'T',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
dayNo: 5,
|
|
45
|
-
day: 'Friday',
|
|
46
|
-
dayInitial: 'F',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
dayNo: 6,
|
|
50
|
-
day: 'Saturday',
|
|
51
|
-
dayInitial: 'S',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
dayNo: 0,
|
|
55
|
-
day: 'Sunday',
|
|
56
|
-
dayInitial: 'S',
|
|
57
|
-
},
|
|
58
|
-
];
|
|
9
|
+
import { BmChat, BmInput, BmIcons, GlobalStyle } from './lib/components';
|
|
59
10
|
|
|
11
|
+
const Chat = () => {
|
|
60
12
|
return (
|
|
61
13
|
<>
|
|
62
14
|
<GlobalStyle />
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
15
|
+
|
|
16
|
+
<BmChat>
|
|
17
|
+
<BmChat.Body>
|
|
18
|
+
<BmChat.Details
|
|
19
|
+
state="outbound"
|
|
20
|
+
session="sms"
|
|
21
|
+
displayTime={<p>12:00pm</p>}
|
|
22
|
+
status="sent"
|
|
23
|
+
sessionTimeline={{ message: <p>12:00pm</p> }}
|
|
24
|
+
type="pdf"
|
|
25
|
+
fileName={<p>test.pdf</p>}
|
|
26
|
+
src="https://images.pexels.com/photos/2280547/pexels-photo-2280547.jpeg?cs=srgb&dl=pexels-chokniti-khongchum-2280547.jpg&fm=jpg&_gl=1*12h6vf0*_ga*MjE0MTE2NjEyMC4xNzA1OTEyMDc4*_ga_8JE65Q40S6*MTcwNTkxMjA3OS4xLjAuMTcwNTkxMjA4MC4wLjAuMA.."
|
|
27
|
+
metadata="truedsf sjdlkfj ldksfj lskdfj l"
|
|
28
|
+
/>
|
|
29
|
+
<BmChat.Details
|
|
30
|
+
state="inbound"
|
|
31
|
+
session="sms"
|
|
32
|
+
displayTime={<p>12:00pm</p>}
|
|
33
|
+
status="sent"
|
|
34
|
+
sessionTimeline={{ message: <p>12:00pm</p> }}
|
|
35
|
+
type="audio"
|
|
36
|
+
fileName={<p>file.csv</p>}
|
|
37
|
+
src="https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3"
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
<BmChat.Details
|
|
41
|
+
state="outbound"
|
|
42
|
+
session="live"
|
|
43
|
+
displayTime={<p>10:00am</p>}
|
|
44
|
+
sessionTimeline={{ message: <p>12:00pm</p> }}
|
|
45
|
+
status="failed"
|
|
46
|
+
type="video"
|
|
47
|
+
src="https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4"
|
|
48
|
+
/>
|
|
49
|
+
|
|
50
|
+
<BmChat.Details
|
|
51
|
+
state="outbound"
|
|
52
|
+
session="bot"
|
|
53
|
+
sessionTimeline={{ message: <p>12:00pm</p> }}
|
|
54
|
+
displayTime={<p>12:00pm</p>}
|
|
55
|
+
status="sent"
|
|
56
|
+
>
|
|
57
|
+
<p>Outbound Text Message</p>
|
|
58
|
+
</BmChat.Details>
|
|
59
|
+
<BmChat.Details
|
|
60
|
+
state="inbound"
|
|
61
|
+
session="bot"
|
|
62
|
+
sessionTimeline={{ message: <p>12:00pm</p> }}
|
|
63
|
+
displayTime={<p>12:00pm</p>}
|
|
64
|
+
status="sent"
|
|
65
|
+
metadata="trsfdsd jlskdfj sldkfj lsdkfj ldkjf lsdkfj lsdkjf lsdkjf lsdkfj ldskfj lsdkfj lsdkue"
|
|
66
|
+
>
|
|
67
|
+
<p>inboundsfhksdjfhk ksdfjh dsjfh bound Text Message</p>
|
|
68
|
+
</BmChat.Details>
|
|
69
|
+
<BmChat.Details
|
|
70
|
+
state="inbound"
|
|
71
|
+
session="bot"
|
|
72
|
+
sessionTimeline={{ message: <p>12:00pm</p> }}
|
|
73
|
+
displayTime={<p>12:00pm</p>}
|
|
74
|
+
status="sent"
|
|
75
|
+
>
|
|
76
|
+
<p>
|
|
77
|
+
inboundsfhksdjfhk ksdfjh dsjfh bound Text fjksldfj sdlfkj sdfk
|
|
78
|
+
jsdlkfj sdflkj sdlkfj ldskfj ldsj Message
|
|
79
|
+
</p>
|
|
80
|
+
</BmChat.Details>
|
|
81
|
+
<BmChat.Details
|
|
82
|
+
state="outbound"
|
|
83
|
+
session="bot"
|
|
84
|
+
sessionTimeline={{ message: <p>12:00pm</p> }}
|
|
85
|
+
displayTime={<p>12:00pm</p>}
|
|
86
|
+
status="sent"
|
|
87
|
+
metadata="tru dskfjsd dklfj sdlfkj lsdkjf lsdkfj ldskfj lsdkfj ldskfj ldskfj lsdkjt roh df ksdjflkdsjf dslfj orepgj rojgp orej hietp rjere"
|
|
89
88
|
>
|
|
90
|
-
|
|
91
|
-
</
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
<p>outbound dfshkf ksdfjh dsjfh bound Text Message</p>
|
|
90
|
+
</BmChat.Details>
|
|
91
|
+
</BmChat.Body>
|
|
92
|
+
<BmChat.Footer>
|
|
93
|
+
<div className="chat-footer">
|
|
94
|
+
<BmIcons icon={<EmojiEmotionsIcon />} size="xlarge" />
|
|
95
|
+
<BmIcons icon={<AttachFileIcon />} size="xlarge" />
|
|
96
|
+
<BmIcons icon={<QuickreplyIcon />} size="xlarge" />
|
|
97
|
+
<BmInput placeholder="Enter Message" style={{ flex: '1' }} />
|
|
98
|
+
<BmIcons icon={<SendIcon />} size="xlarge" />
|
|
99
|
+
</div>
|
|
100
|
+
</BmChat.Footer>
|
|
101
|
+
</BmChat>
|
|
95
102
|
</>
|
|
96
103
|
);
|
|
97
104
|
};
|
|
98
105
|
|
|
99
|
-
export default
|
|
106
|
+
export default Chat;
|
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
BmPrimaryBlack,
|
|
17
17
|
BmSecondaryDarkGreen,
|
|
18
18
|
BmGrey200,
|
|
19
|
+
BmTransparentBg30,
|
|
20
|
+
BmPrimaryGold,
|
|
19
21
|
} from '../../colors';
|
|
20
22
|
import { BmFeedPostComments } from './FeedPostComments';
|
|
21
23
|
|
|
@@ -71,8 +73,15 @@ const Messages = styled.div`
|
|
|
71
73
|
display: flex;
|
|
72
74
|
flex-direction: row;
|
|
73
75
|
align-items: center;
|
|
74
|
-
padding: 0.5rem;
|
|
75
|
-
background: ${({ state }) => {
|
|
76
|
+
padding: 1rem 0.5rem;
|
|
77
|
+
background: ${({ state, metadata }) => {
|
|
78
|
+
if (metadata) {
|
|
79
|
+
if (state) {
|
|
80
|
+
if (state === 'inbound') return `${BmTransparentBg30}`;
|
|
81
|
+
if (state === 'outbound') return `${BmTransparentBg30}`;
|
|
82
|
+
}
|
|
83
|
+
return `${BmPrimaryWhite}`;
|
|
84
|
+
}
|
|
76
85
|
if (state) {
|
|
77
86
|
if (state === 'inbound') return `${BmPrimaryWhite}`;
|
|
78
87
|
if (state === 'outbound') return `${BmPrimaryBlue}`;
|
|
@@ -86,14 +95,33 @@ const Messages = styled.div`
|
|
|
86
95
|
}
|
|
87
96
|
return `${BmPrimaryWhite}`;
|
|
88
97
|
}};
|
|
89
|
-
border-radius: ${({ state }) => {
|
|
98
|
+
border-radius: ${({ state, metadata }) => {
|
|
99
|
+
if (metadata) {
|
|
100
|
+
return '0rem';
|
|
101
|
+
}
|
|
90
102
|
if (state) {
|
|
91
103
|
if (state === 'inbound') return '0.21875rem 0.21875rem 0.21875rem 0rem';
|
|
92
104
|
if (state === 'outbound') return '0.21875rem 0.21875rem 0rem 0.21875rem';
|
|
93
105
|
}
|
|
94
106
|
return `${BmPrimaryWhite}`;
|
|
95
107
|
}};
|
|
96
|
-
border:
|
|
108
|
+
border-left: ${({ state, metadata }) => {
|
|
109
|
+
if (metadata) {
|
|
110
|
+
if (state) {
|
|
111
|
+
if (state === 'inbound') return `2px solid ${BmPrimaryBlue}`;
|
|
112
|
+
if (state === 'outbound') return `2px solid ${BmPrimaryGold}`;
|
|
113
|
+
}
|
|
114
|
+
return `${BmPrimaryWhite}`;
|
|
115
|
+
}
|
|
116
|
+
return '';
|
|
117
|
+
}};
|
|
118
|
+
|
|
119
|
+
border: ${({ metadata }) => {
|
|
120
|
+
if (metadata) {
|
|
121
|
+
return '';
|
|
122
|
+
}
|
|
123
|
+
return `0.071rem solid ${BmGrey200};`;
|
|
124
|
+
}};
|
|
97
125
|
word-break: break-word;
|
|
98
126
|
margin: 0rem;
|
|
99
127
|
`;
|
|
@@ -254,6 +282,30 @@ export const MessageState = styled.div`
|
|
|
254
282
|
|
|
255
283
|
// End of Component for Images
|
|
256
284
|
|
|
285
|
+
export const RepliedTextWrapper = styled.div`
|
|
286
|
+
display: flex;
|
|
287
|
+
flex-direction: column;
|
|
288
|
+
justify-content: center;
|
|
289
|
+
padding: 1.14286rem 1.14286rem 1.14286rem 0.35714rem;
|
|
290
|
+
gap: 1rem;
|
|
291
|
+
border-radius: 0.25rem 0.25rem 0.25rem 0rem;
|
|
292
|
+
border: 1px solid ${BmGrey200};
|
|
293
|
+
background: ${({ state }) => {
|
|
294
|
+
if (state) {
|
|
295
|
+
if (state === 'inbound') return `${BmPrimaryWhite}`;
|
|
296
|
+
if (state === 'outbound') return `${BmPrimaryBlue}`;
|
|
297
|
+
}
|
|
298
|
+
return `${BmPrimaryWhite}`;
|
|
299
|
+
}};
|
|
300
|
+
color: ${({ state }) => {
|
|
301
|
+
if (state) {
|
|
302
|
+
if (state === 'inbound') return `${BmPrimaryBlack}`;
|
|
303
|
+
if (state === 'outbound') return `${BmPrimaryWhite}`;
|
|
304
|
+
}
|
|
305
|
+
return `${BmPrimaryWhite}`;
|
|
306
|
+
}};
|
|
307
|
+
`;
|
|
308
|
+
|
|
257
309
|
BmChat.Details = ({
|
|
258
310
|
children,
|
|
259
311
|
state,
|
|
@@ -267,6 +319,7 @@ BmChat.Details = ({
|
|
|
267
319
|
sessionTimeline,
|
|
268
320
|
feedPostComments,
|
|
269
321
|
agentName,
|
|
322
|
+
metadata,
|
|
270
323
|
...rest
|
|
271
324
|
}) => {
|
|
272
325
|
return (
|
|
@@ -289,7 +342,20 @@ BmChat.Details = ({
|
|
|
289
342
|
/>
|
|
290
343
|
)}
|
|
291
344
|
{/* For Messages */}
|
|
292
|
-
{children &&
|
|
345
|
+
{children && (
|
|
346
|
+
<>
|
|
347
|
+
{metadata ? (
|
|
348
|
+
<RepliedTextWrapper state={state}>
|
|
349
|
+
<Messages metadata={metadata} state={state}>
|
|
350
|
+
{children}
|
|
351
|
+
</Messages>
|
|
352
|
+
{metadata}
|
|
353
|
+
</RepliedTextWrapper>
|
|
354
|
+
) : (
|
|
355
|
+
<Messages state={state}>{children}</Messages>
|
|
356
|
+
)}
|
|
357
|
+
</>
|
|
358
|
+
)}
|
|
293
359
|
{/* For files */}
|
|
294
360
|
{file && (
|
|
295
361
|
<BmFileAttachment
|
|
@@ -16,7 +16,10 @@ import {
|
|
|
16
16
|
BmPrimaryBlue,
|
|
17
17
|
} from '../colors';
|
|
18
18
|
|
|
19
|
-
const Color = ({ variant, color }) => {
|
|
19
|
+
const Color = ({ variant, color, textColor }) => {
|
|
20
|
+
if (textColor) {
|
|
21
|
+
return textColor;
|
|
22
|
+
}
|
|
20
23
|
if (
|
|
21
24
|
variant === 'success' ||
|
|
22
25
|
variant === 'warning' ||
|
|
@@ -64,7 +67,8 @@ const BeemTag = styled.button`
|
|
|
64
67
|
return `${BmGrey100}`;
|
|
65
68
|
}};
|
|
66
69
|
> * {
|
|
67
|
-
color: ${({ variant, color }) =>
|
|
70
|
+
color: ${({ variant, color, textColor }) =>
|
|
71
|
+
Color({ variant, color, textColor })};
|
|
68
72
|
text-transform: uppercase;
|
|
69
73
|
}
|
|
70
74
|
|
|
@@ -84,6 +88,7 @@ export const BmTag = (props) => {
|
|
|
84
88
|
leadingIcon,
|
|
85
89
|
trailingIcon,
|
|
86
90
|
color,
|
|
91
|
+
textColor,
|
|
87
92
|
bgColor,
|
|
88
93
|
closeButton,
|
|
89
94
|
onHide,
|
|
@@ -97,6 +102,7 @@ export const BmTag = (props) => {
|
|
|
97
102
|
disabled={disabled}
|
|
98
103
|
children={children}
|
|
99
104
|
color={color}
|
|
105
|
+
textColor={textColor}
|
|
100
106
|
closeButton={closeButton}
|
|
101
107
|
show={toggle}
|
|
102
108
|
bgColor={bgColor}
|