beem-component 2.0.19 → 2.0.20
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.
|
@@ -20,9 +20,9 @@ var _sessionDetails = require("./sessionDetails");
|
|
|
20
20
|
var _sessionTimeline = require("./sessionTimeline");
|
|
21
21
|
var _colors = require("../../colors");
|
|
22
22
|
var _FeedPostComments = require("./FeedPostComments");
|
|
23
|
-
var _excluded = ["state", "file", "src", "fileName", "onDownload", "link"],
|
|
24
|
-
_excluded2 = ["state", "src", "fileName"],
|
|
25
|
-
_excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName", "sessionDetails", "sessionTimeline", "feedPostComments", "agentName", "metadata", "isInteractive", "type"];
|
|
23
|
+
var _excluded = ["state", "file", "src", "fileName", "onDownload", "extension", "link"],
|
|
24
|
+
_excluded2 = ["state", "src", "extensions", "fileName"],
|
|
25
|
+
_excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName", "sessionDetails", "sessionTimeline", "feedPostComments", "agentName", "metadata", "isInteractive", "type", "extension"];
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
27
|
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); }
|
|
28
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; }
|
|
@@ -37,7 +37,7 @@ BmChat.Body = _styledComponents.default.div.withConfig({
|
|
|
37
37
|
})(["display:flex;flex-direction:column-reverse;padding:0rem 1rem;flex-grow:1;overflow:auto;height:100%;"]);
|
|
38
38
|
var Details = _styledComponents.default.div.withConfig({
|
|
39
39
|
displayName: "chatBody__Details"
|
|
40
|
-
})(["display:flex;justify-content:", ";> *:not(:last-child){margin-right:1rem;margin-bottom:0.5rem;}overflow-wrap:break-word !important;word-wrap:break-word !important;margin:0rem;flex-grow:1;", ""], function (_ref) {
|
|
40
|
+
})(["display:flex;justify-content:", ";> *:not(:last-child){margin-right:1rem;margin-bottom:0.5rem;}overflow-wrap:break-word !important;word-wrap:break-word !important;margin:0rem;import{extension}from 'mime-types';flex-grow:1;", ""], function (_ref) {
|
|
41
41
|
var state = _ref.state;
|
|
42
42
|
if (state === 'inbound') {
|
|
43
43
|
return 'flex-start';
|
|
@@ -198,6 +198,9 @@ var handleState = function handleState(_ref14) {
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
+
var FileNameContainer = _styledComponents.default.div.withConfig({
|
|
202
|
+
displayName: "chatBody__FileNameContainer"
|
|
203
|
+
})(["display:flex;flex-direction:row;"]);
|
|
201
204
|
|
|
202
205
|
// Start of File Attachment
|
|
203
206
|
var FileAttachmentWrapper = _styledComponents.default.div.withConfig({
|
|
@@ -255,6 +258,7 @@ var BmFileAttachment = function BmFileAttachment(_ref20) {
|
|
|
255
258
|
src = _ref20.src,
|
|
256
259
|
fileName = _ref20.fileName,
|
|
257
260
|
onDownload = _ref20.onDownload,
|
|
261
|
+
extension = _ref20.extension,
|
|
258
262
|
link = _ref20.link,
|
|
259
263
|
rest = _objectWithoutProperties(_ref20, _excluded);
|
|
260
264
|
return /*#__PURE__*/_react.default.createElement(FileAttachmentWrapper, _extends({
|
|
@@ -262,7 +266,7 @@ var BmFileAttachment = function BmFileAttachment(_ref20) {
|
|
|
262
266
|
src: src
|
|
263
267
|
}, rest), /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
264
268
|
icon: /*#__PURE__*/_react.default.createElement(_FilePresent.default, null)
|
|
265
|
-
}), fileName, /*#__PURE__*/_react.default.createElement("a", {
|
|
269
|
+
}), /*#__PURE__*/_react.default.createElement(FileNameContainer, null, /*#__PURE__*/_react.default.createElement("p", null, fileName), /*#__PURE__*/_react.default.createElement("p", null, extension ? ".".concat(extension) : '')), /*#__PURE__*/_react.default.createElement("a", {
|
|
266
270
|
href: link,
|
|
267
271
|
download: true
|
|
268
272
|
}, /*#__PURE__*/_react.default.createElement(_iconStyles.BmIcons, {
|
|
@@ -298,6 +302,7 @@ exports.BmImage = BmImage;
|
|
|
298
302
|
var BmImageChat = function BmImageChat(_ref23) {
|
|
299
303
|
var state = _ref23.state,
|
|
300
304
|
src = _ref23.src,
|
|
305
|
+
extensions = _ref23.extensions,
|
|
301
306
|
fileName = _ref23.fileName,
|
|
302
307
|
rest = _objectWithoutProperties(_ref23, _excluded2);
|
|
303
308
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(BmImageWrapper, _extends({
|
|
@@ -428,6 +433,7 @@ BmChat.Details = function (_ref30) {
|
|
|
428
433
|
metadata = _ref30.metadata,
|
|
429
434
|
isInteractive = _ref30.isInteractive,
|
|
430
435
|
type = _ref30.type,
|
|
436
|
+
extension = _ref30.extension,
|
|
431
437
|
rest = _objectWithoutProperties(_ref30, _excluded3);
|
|
432
438
|
console.log(src);
|
|
433
439
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Details, _extends({
|
|
@@ -491,6 +497,7 @@ BmChat.Details = function (_ref30) {
|
|
|
491
497
|
}))) : /*#__PURE__*/_react.default.createElement(Messages, {
|
|
492
498
|
state: state
|
|
493
499
|
}, children))), file && /*#__PURE__*/_react.default.createElement(BmFileAttachment, _extends({
|
|
500
|
+
extension: extension,
|
|
494
501
|
file: file,
|
|
495
502
|
fileName: fileName,
|
|
496
503
|
state: state
|
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -115,10 +115,11 @@ const Chat = () => {
|
|
|
115
115
|
{
|
|
116
116
|
id: 78741,
|
|
117
117
|
message:
|
|
118
|
-
'https://bm-chatbot-images.s3.eu-west-1.amazonaws.com/
|
|
118
|
+
'https://bm-chatbot-images.s3.eu-west-1.amazonaws.com/0c8f668d-f5e6-4325-aa76-4d9af8dd79a7.docx',
|
|
119
119
|
time: '2025-04-03T05:55:39.000Z',
|
|
120
120
|
direction: 'inbound',
|
|
121
|
-
message_type:
|
|
121
|
+
message_type:
|
|
122
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
122
123
|
messageId: null,
|
|
123
124
|
is_live_agent: 0,
|
|
124
125
|
is_deleted: 0,
|
|
@@ -1162,6 +1163,7 @@ const Chat = () => {
|
|
|
1162
1163
|
sessionTimeline={{ message: <p>12:00pm</p> }}
|
|
1163
1164
|
displayTime={<p>12:00pm</p>}
|
|
1164
1165
|
status="sent"
|
|
1166
|
+
extension="pdf"
|
|
1165
1167
|
file={ms.message}
|
|
1166
1168
|
link={ms.message}
|
|
1167
1169
|
fileName={<p>File</p>}
|
|
@@ -1192,24 +1194,14 @@ const Chat = () => {
|
|
|
1192
1194
|
link={ms.message}
|
|
1193
1195
|
fileName={<p>File</p>}
|
|
1194
1196
|
style={{ margin: '-0.6% 0 0 0' }}
|
|
1197
|
+
extension="docx"
|
|
1195
1198
|
// state="inbound"
|
|
1196
1199
|
// session="live"
|
|
1197
1200
|
// displayTime={<p>10:00am</p>}
|
|
1198
1201
|
// status="failed"
|
|
1199
1202
|
// fileName={<p>file.csv</p>}
|
|
1200
1203
|
// file={image}
|
|
1201
|
-
|
|
1202
|
-
{' '}
|
|
1203
|
-
<div>
|
|
1204
|
-
{/* <FileViewer
|
|
1205
|
-
fileType="docx"
|
|
1206
|
-
filePath={ms.message}
|
|
1207
|
-
onError={onError}
|
|
1208
|
-
// errorComponent={CustomErrorComponent}
|
|
1209
|
-
// onError={this.onError}
|
|
1210
|
-
/> */}
|
|
1211
|
-
</div>
|
|
1212
|
-
</BmChat.Details>
|
|
1204
|
+
/>
|
|
1213
1205
|
);
|
|
1214
1206
|
})}
|
|
1215
1207
|
</BmChat.Body>
|
|
@@ -61,7 +61,8 @@ const Details = styled.div`
|
|
|
61
61
|
}
|
|
62
62
|
overflow-wrap: break-word !important;
|
|
63
63
|
word-wrap: break-word !important;
|
|
64
|
-
margin: 0rem;
|
|
64
|
+
margin: 0rem;import { extension } from 'mime-types';
|
|
65
|
+
|
|
65
66
|
flex-grow: 1;
|
|
66
67
|
${'' /* border: 1px solid red; */}
|
|
67
68
|
`;
|
|
@@ -237,6 +238,10 @@ const handleState = ({ session, agentName }) => {
|
|
|
237
238
|
return <BmAvatar size="small" user="sms" />;
|
|
238
239
|
}
|
|
239
240
|
};
|
|
241
|
+
const FileNameContainer = styled.div`
|
|
242
|
+
display: flex;
|
|
243
|
+
flex-direction: row;
|
|
244
|
+
`;
|
|
240
245
|
|
|
241
246
|
// Start of File Attachment
|
|
242
247
|
const FileAttachmentWrapper = styled.div`
|
|
@@ -311,6 +316,7 @@ const BmFileAttachment = ({
|
|
|
311
316
|
src,
|
|
312
317
|
fileName,
|
|
313
318
|
onDownload,
|
|
319
|
+
extension,
|
|
314
320
|
link,
|
|
315
321
|
...rest
|
|
316
322
|
}) => {
|
|
@@ -318,7 +324,10 @@ const BmFileAttachment = ({
|
|
|
318
324
|
<FileAttachmentWrapper state={state} src={src} {...rest}>
|
|
319
325
|
<BmIcons icon={<FilePresentIcon />} />
|
|
320
326
|
{/* {fileName} */}
|
|
321
|
-
|
|
327
|
+
<FileNameContainer>
|
|
328
|
+
<p>{fileName}</p>
|
|
329
|
+
<p>{extension ? `.${extension}` : ''}</p>
|
|
330
|
+
</FileNameContainer>
|
|
322
331
|
<a href={link} download>
|
|
323
332
|
<BmIcons
|
|
324
333
|
style={{
|
|
@@ -359,7 +368,7 @@ export const BmImage = styled.img`
|
|
|
359
368
|
}};
|
|
360
369
|
`;
|
|
361
370
|
|
|
362
|
-
export const BmImageChat = ({ state, src, fileName, ...rest }) => {
|
|
371
|
+
export const BmImageChat = ({ state, src, extensions, fileName, ...rest }) => {
|
|
363
372
|
return (
|
|
364
373
|
<>
|
|
365
374
|
<BmImageWrapper state={state} {...rest}>
|
|
@@ -507,6 +516,7 @@ BmChat.Details = ({
|
|
|
507
516
|
metadata,
|
|
508
517
|
isInteractive,
|
|
509
518
|
type,
|
|
519
|
+
extension,
|
|
510
520
|
...rest
|
|
511
521
|
}) => {
|
|
512
522
|
console.log(src);
|
|
@@ -614,6 +624,7 @@ BmChat.Details = ({
|
|
|
614
624
|
{/* For files */}
|
|
615
625
|
{file && (
|
|
616
626
|
<BmFileAttachment
|
|
627
|
+
extension={extension}
|
|
617
628
|
file={file}
|
|
618
629
|
fileName={fileName}
|
|
619
630
|
state={state}
|