beem-component 2.0.13 → 2.0.15
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.
- package/dist/components/ChatComponents/ChatBody/chatBody.js +30 -6
- package/dist/components/ProfileIcon/ProfileIcon.js +14 -8
- package/package.json +1 -1
- package/src/App.js +577 -2
- package/src/lib/components/ChatComponents/ChatBody/chatBody.js +47 -6
- package/src/lib/components/ProfileIcon/ProfileIcon.js +6 -1
|
@@ -19,7 +19,7 @@ var _colors = require("../../colors");
|
|
|
19
19
|
var _FeedPostComments = require("./FeedPostComments");
|
|
20
20
|
var _excluded = ["state", "file", "src", "fileName", "onDownload", "link"],
|
|
21
21
|
_excluded2 = ["state", "src", "fileName"],
|
|
22
|
-
_excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName", "sessionDetails", "sessionTimeline", "feedPostComments", "agentName", "metadata", "type"];
|
|
22
|
+
_excluded3 = ["children", "state", "displayTime", "status", "session", "src", "file", "fileName", "sessionDetails", "sessionTimeline", "feedPostComments", "agentName", "metadata", "isInteractive", "type"];
|
|
23
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
24
|
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); }
|
|
25
25
|
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; }
|
|
@@ -50,8 +50,9 @@ var MessageDetails = _styledComponents.default.div.withConfig({
|
|
|
50
50
|
var Messages = _styledComponents.default.div.withConfig({
|
|
51
51
|
displayName: "chatBody__Messages"
|
|
52
52
|
})(["display:flex;flex-direction:", ";align-items:", ";padding:1rem 0.5rem;background:", ";color:", ";border-radius:", ";border-left:", ";border:", ";word-break:break-word;margin:0rem;"], function (_ref2) {
|
|
53
|
-
var type = _ref2.type
|
|
54
|
-
|
|
53
|
+
var type = _ref2.type,
|
|
54
|
+
isInteractive = _ref2.isInteractive;
|
|
55
|
+
if (type === 'interactive' || isInteractive) {
|
|
55
56
|
return 'column';
|
|
56
57
|
}
|
|
57
58
|
return 'row';
|
|
@@ -306,7 +307,7 @@ var RepliedTextWrapper = _styledComponents.default.div.withConfig({
|
|
|
306
307
|
});
|
|
307
308
|
exports.RepliedTextWrapper = RepliedTextWrapper;
|
|
308
309
|
BmChat.Details = function (_ref23) {
|
|
309
|
-
var _children$content, _children$content2, _children$content3, _children$content4, _children$content5, _children$options, _children$globalButto;
|
|
310
|
+
var _metadata$content, _metadata$content2, _metadata$content3, _metadata$content4, _metadata$content5, _metadata$options, _metadata$globalButto, _children$content, _children$content2, _children$content3, _children$content4, _children$content5, _children$options, _children$globalButto;
|
|
310
311
|
var children = _ref23.children,
|
|
311
312
|
state = _ref23.state,
|
|
312
313
|
displayTime = _ref23.displayTime,
|
|
@@ -320,6 +321,7 @@ BmChat.Details = function (_ref23) {
|
|
|
320
321
|
feedPostComments = _ref23.feedPostComments,
|
|
321
322
|
agentName = _ref23.agentName,
|
|
322
323
|
metadata = _ref23.metadata,
|
|
324
|
+
isInteractive = _ref23.isInteractive,
|
|
323
325
|
type = _ref23.type,
|
|
324
326
|
rest = _objectWithoutProperties(_ref23, _excluded3);
|
|
325
327
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Details, _extends({
|
|
@@ -336,14 +338,36 @@ BmChat.Details = function (_ref23) {
|
|
|
336
338
|
fileName: fileName
|
|
337
339
|
}, rest)), children && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, metadata ? /*#__PURE__*/_react.default.createElement(RepliedTextWrapper, {
|
|
338
340
|
state: state
|
|
339
|
-
}, /*#__PURE__*/_react.default.createElement(Messages, {
|
|
341
|
+
}, metadata.type === 'quick_reply' ? /*#__PURE__*/_react.default.createElement(Messages, {
|
|
342
|
+
isInteractive: isInteractive,
|
|
343
|
+
type: type,
|
|
344
|
+
state: state,
|
|
345
|
+
isImg: true
|
|
346
|
+
}, (metadata === null || metadata === void 0 ? void 0 : (_metadata$content = metadata.content) === null || _metadata$content === void 0 ? void 0 : _metadata$content.url) && /*#__PURE__*/_react.default.createElement(BmImageChat, _extends({
|
|
347
|
+
state: state,
|
|
348
|
+
src: metadata === null || metadata === void 0 ? void 0 : (_metadata$content2 = metadata.content) === null || _metadata$content2 === void 0 ? void 0 : _metadata$content2.url
|
|
349
|
+
}, rest)), /*#__PURE__*/_react.default.createElement("strong", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$content3 = metadata.content) === null || _metadata$content3 === void 0 ? void 0 : _metadata$content3.header), /*#__PURE__*/_react.default.createElement("p", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$content4 = metadata.content) === null || _metadata$content4 === void 0 ? void 0 : _metadata$content4.text), /*#__PURE__*/_react.default.createElement("small", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$content5 = metadata.content) === null || _metadata$content5 === void 0 ? void 0 : _metadata$content5.caption), metadata === null || metadata === void 0 ? void 0 : (_metadata$options = metadata.options) === null || _metadata$options === void 0 ? void 0 : _metadata$options.map(function (button) {
|
|
350
|
+
return (
|
|
351
|
+
/*#__PURE__*/
|
|
352
|
+
// eslint-disable-next-line react/jsx-key
|
|
353
|
+
_react.default.createElement(IntButton, {
|
|
354
|
+
state: state
|
|
355
|
+
}, button === null || button === void 0 ? void 0 : button.title)
|
|
356
|
+
);
|
|
357
|
+
})) : metadata.type === 'quick_reply' ? /*#__PURE__*/_react.default.createElement(Messages, {
|
|
358
|
+
isInteractive: isInteractive,
|
|
359
|
+
type: type,
|
|
360
|
+
state: state
|
|
361
|
+
}, /*#__PURE__*/_react.default.createElement("strong", null, metadata === null || metadata === void 0 ? void 0 : metadata.title), /*#__PURE__*/_react.default.createElement("p", null, metadata === null || metadata === void 0 ? void 0 : metadata.body), /*#__PURE__*/_react.default.createElement(IntButton, {
|
|
362
|
+
state: state
|
|
363
|
+
}, /*#__PURE__*/_react.default.createElement(_List.default, null), metadata === null || metadata === void 0 ? void 0 : (_metadata$globalButto = metadata.globalButtons[0]) === null || _metadata$globalButto === void 0 ? void 0 : _metadata$globalButto.title)) : /*#__PURE__*/_react.default.createElement(Messages, {
|
|
340
364
|
metadata: metadata,
|
|
341
365
|
state: state
|
|
342
366
|
}, metadata), children) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, type && type === 'interactive' ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children.type === 'quick_reply' ? /*#__PURE__*/_react.default.createElement(Messages, {
|
|
343
367
|
type: type,
|
|
344
368
|
state: state,
|
|
345
369
|
isImg: true
|
|
346
|
-
}, (children === null || children === void 0 ? void 0 : (_children$content = children.content) === null || _children$content === void 0 ? void 0 : _children$content.
|
|
370
|
+
}, (children === null || children === void 0 ? void 0 : (_children$content = children.content) === null || _children$content === void 0 ? void 0 : _children$content.url) && /*#__PURE__*/_react.default.createElement(BmImageChat, _extends({
|
|
347
371
|
state: state,
|
|
348
372
|
src: children === null || children === void 0 ? void 0 : (_children$content2 = children.content) === null || _children$content2 === void 0 ? void 0 : _children$content2.url
|
|
349
373
|
}, rest)), /*#__PURE__*/_react.default.createElement("strong", null, children === null || children === void 0 ? void 0 : (_children$content3 = children.content) === null || _children$content3 === void 0 ? void 0 : _children$content3.header), /*#__PURE__*/_react.default.createElement("p", null, children === null || children === void 0 ? void 0 : (_children$content4 = children.content) === null || _children$content4 === void 0 ? void 0 : _children$content4.text), /*#__PURE__*/_react.default.createElement("small", null, children === null || children === void 0 ? void 0 : (_children$content5 = children.content) === null || _children$content5 === void 0 ? void 0 : _children$content5.caption), children === null || children === void 0 ? void 0 : (_children$options = children.options) === null || _children$options === void 0 ? void 0 : _children$options.map(function (button) {
|
|
@@ -43,11 +43,17 @@ var ProfileImg = _styledComponents.default.img.withConfig({
|
|
|
43
43
|
});
|
|
44
44
|
var Profile = _styledComponents.default.div.withConfig({
|
|
45
45
|
displayName: "ProfileIcon__Profile"
|
|
46
|
-
})(["height:", ";width:", ";border-radius:50%;border:
|
|
46
|
+
})(["height:", ";width:", ";border-radius:50%;border:", ";display:flex;align-items:center;justify-content:center;position:relative;background:", ";"], function (props) {
|
|
47
47
|
return handleSize(props.size);
|
|
48
48
|
}, function (props) {
|
|
49
49
|
return handleSize(props.size);
|
|
50
|
-
},
|
|
50
|
+
}, function (_ref) {
|
|
51
|
+
var multiChannel = _ref.multiChannel;
|
|
52
|
+
if (multiChannel) {
|
|
53
|
+
return ".1429rem solid ".concat(multiChannel, " ");
|
|
54
|
+
}
|
|
55
|
+
return ".0714rem solid ".concat(_colors.BmBgLightBlue);
|
|
56
|
+
}, _colors.BmSecondaryBlue12);
|
|
51
57
|
var Content = _styledComponents.default.div.withConfig({
|
|
52
58
|
displayName: "ProfileIcon__Content"
|
|
53
59
|
})(["display:flex;align-items:center;justify-content:center;position:absolute;"]);
|
|
@@ -56,12 +62,12 @@ var Dot = _styledComponents.default.img.withConfig({
|
|
|
56
62
|
})(["position:absolute;left:", ";bottom:0rem;object-fit:contain;height:1rem;width:1rem;"], function (props) {
|
|
57
63
|
return position(props.size);
|
|
58
64
|
});
|
|
59
|
-
var BmProfileIcon = function BmProfileIcon(
|
|
60
|
-
var img =
|
|
61
|
-
content =
|
|
62
|
-
channel =
|
|
63
|
-
size =
|
|
64
|
-
rest = _objectWithoutProperties(
|
|
65
|
+
var BmProfileIcon = function BmProfileIcon(_ref2) {
|
|
66
|
+
var img = _ref2.img,
|
|
67
|
+
content = _ref2.content,
|
|
68
|
+
channel = _ref2.channel,
|
|
69
|
+
size = _ref2.size,
|
|
70
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
65
71
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Profile, _extends({
|
|
66
72
|
size: size
|
|
67
73
|
}, rest), content && !img && /*#__PURE__*/_react.default.createElement(Content, null, content), img && !content && /*#__PURE__*/_react.default.createElement(ProfileImg, {
|
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// * eslint-disable func-style *
|
|
2
2
|
/* eslint-disable jsx-a11y/media-has-caption */
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
4
|
import AbcIcon from '@mui/icons-material/Abc';
|
|
5
5
|
// import LocalOfferOutlinedIcon from '@mui/icons-material/LocalOfferOutlined';
|
|
6
6
|
|
|
@@ -14,6 +14,10 @@ import {
|
|
|
14
14
|
BmButton,
|
|
15
15
|
BmButtonDropDown,
|
|
16
16
|
BmBtnIcon,
|
|
17
|
+
BmContactCard,
|
|
18
|
+
BmContactCheckbox,
|
|
19
|
+
BmCounter,
|
|
20
|
+
BmProfileIcon,
|
|
17
21
|
} from './lib/components';
|
|
18
22
|
|
|
19
23
|
const Chat = () => {
|
|
@@ -39,6 +43,517 @@ const Chat = () => {
|
|
|
39
43
|
statusCode: 3,
|
|
40
44
|
},
|
|
41
45
|
};
|
|
46
|
+
const x = {
|
|
47
|
+
id: 64816,
|
|
48
|
+
message: 'Give Feedback',
|
|
49
|
+
time: '2025-02-13T11:19:42.000Z',
|
|
50
|
+
direction: 'inbound',
|
|
51
|
+
message_type: 'text',
|
|
52
|
+
messageId: null,
|
|
53
|
+
is_live_agent: 1,
|
|
54
|
+
is_deleted: 0,
|
|
55
|
+
is_comment: 0,
|
|
56
|
+
channel: 'whatsapp',
|
|
57
|
+
sent_to_vendor: 1,
|
|
58
|
+
replyMessageId: '035a7484-ee02-4829-8cb5-33c4623f1c8a',
|
|
59
|
+
agent_name: null,
|
|
60
|
+
df_agent_name: null,
|
|
61
|
+
resolve_time: null,
|
|
62
|
+
metadata: {
|
|
63
|
+
id: '6538d48e-1b17-45e8-8e44-be457d3695c0',
|
|
64
|
+
prev_message:
|
|
65
|
+
'{"dotgoV2":{"type":"quick_reply","content":{"type":"text","header":"","text":"We value your opinion! Would you be willing to take a short survey to help us improve?","caption":""},"options":[{"type":"text","title":"Give Feedback","postbackText":"bm-feedback|0|181661e8-9209-4665-ad19-680981136ae8"},{"type":"text","title":"No Thank you","postbackText":"dev-defined-postback2"}]}}',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
const msg = [
|
|
69
|
+
{
|
|
70
|
+
message: 'Me as user replying to the beem message',
|
|
71
|
+
id: 20278,
|
|
72
|
+
time: '2024-01-22T11:59:08.000Z',
|
|
73
|
+
direction: 'inbound',
|
|
74
|
+
message_type: 'text',
|
|
75
|
+
messageId: null,
|
|
76
|
+
is_live_agent: true,
|
|
77
|
+
is_deleted: false,
|
|
78
|
+
is_comment: false,
|
|
79
|
+
channel: 'whatsapp',
|
|
80
|
+
sent_to_vendor: true,
|
|
81
|
+
replyMessageId: 'b0a6b554-0cc3-4e45-83b2-3cada229a82c',
|
|
82
|
+
agent_name: null,
|
|
83
|
+
df_agent_name: null,
|
|
84
|
+
resolve_time: null,
|
|
85
|
+
metadata: {
|
|
86
|
+
id: 'b0a6b554-0cc3-4e45-83b2-3cada229a82c',
|
|
87
|
+
prev_message: 'this is message from beem',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
message: 'this is message from beem',
|
|
92
|
+
id: 20277,
|
|
93
|
+
time: '2024-01-22T11:56:41.000Z',
|
|
94
|
+
direction: 'outbound',
|
|
95
|
+
message_type: null,
|
|
96
|
+
messageId: 'b0a6b554-0cc3-4e45-83b2-3cada229a82c',
|
|
97
|
+
is_live_agent: true,
|
|
98
|
+
is_deleted: false,
|
|
99
|
+
is_comment: false,
|
|
100
|
+
channel: 'whatsapp',
|
|
101
|
+
sent_to_vendor: true,
|
|
102
|
+
replyMessageId: null,
|
|
103
|
+
agent_name: 'arl@beem.co.tz',
|
|
104
|
+
df_agent_name: 'Dev arl',
|
|
105
|
+
resolve_time: null,
|
|
106
|
+
metadata: null,
|
|
107
|
+
statusDetails: {
|
|
108
|
+
statusCode: 3,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
message: 'hi',
|
|
113
|
+
id: 20276,
|
|
114
|
+
time: '2024-01-22T11:20:21.000Z',
|
|
115
|
+
direction: 'outbound',
|
|
116
|
+
message_type: null,
|
|
117
|
+
messageId: '86ffe4bd-145e-4f50-83ef-83248b05c43a',
|
|
118
|
+
is_live_agent: true,
|
|
119
|
+
is_deleted: false,
|
|
120
|
+
is_comment: false,
|
|
121
|
+
channel: 'whatsapp',
|
|
122
|
+
sent_to_vendor: true,
|
|
123
|
+
replyMessageId: null,
|
|
124
|
+
agent_name: 'arl@beem.co.tz',
|
|
125
|
+
df_agent_name: 'Dev arl',
|
|
126
|
+
resolve_time: null,
|
|
127
|
+
metadata: null,
|
|
128
|
+
statusDetails: {
|
|
129
|
+
statusCode: 3,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
message: 'hi',
|
|
134
|
+
id: 20270,
|
|
135
|
+
time: '2024-01-22T10:19:57.000Z',
|
|
136
|
+
direction: 'outbound',
|
|
137
|
+
message_type: null,
|
|
138
|
+
messageId: '0e165d59-8300-4cd2-883d-dcb076c6f235',
|
|
139
|
+
is_live_agent: true,
|
|
140
|
+
is_deleted: false,
|
|
141
|
+
is_comment: false,
|
|
142
|
+
channel: 'whatsapp',
|
|
143
|
+
sent_to_vendor: true,
|
|
144
|
+
replyMessageId: null,
|
|
145
|
+
agent_name: 'arl@beem.co.tz',
|
|
146
|
+
df_agent_name: 'Dev arl',
|
|
147
|
+
resolve_time: null,
|
|
148
|
+
metadata: null,
|
|
149
|
+
statusDetails: {
|
|
150
|
+
statusCode: 3,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
message: 'oh i am good',
|
|
155
|
+
id: 20269,
|
|
156
|
+
time: '2024-01-22T10:04:05.000Z',
|
|
157
|
+
direction: 'inbound',
|
|
158
|
+
message_type: 'text',
|
|
159
|
+
messageId: null,
|
|
160
|
+
is_live_agent: true,
|
|
161
|
+
is_deleted: false,
|
|
162
|
+
is_comment: false,
|
|
163
|
+
channel: 'whatsapp',
|
|
164
|
+
sent_to_vendor: true,
|
|
165
|
+
replyMessageId: null,
|
|
166
|
+
agent_name: null,
|
|
167
|
+
df_agent_name: null,
|
|
168
|
+
resolve_time: null,
|
|
169
|
+
metadata: {
|
|
170
|
+
id: 'ABEGJVeCJwBSAhB3WfEzKswmhITnP0z8qo12',
|
|
171
|
+
prev_message: 'how are you????????',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
message: 'how are you????????',
|
|
176
|
+
id: 20268,
|
|
177
|
+
time: '2024-01-22T10:03:23.000Z',
|
|
178
|
+
direction: 'inbound',
|
|
179
|
+
message_type: 'text',
|
|
180
|
+
messageId: null,
|
|
181
|
+
is_live_agent: true,
|
|
182
|
+
is_deleted: false,
|
|
183
|
+
is_comment: false,
|
|
184
|
+
channel: 'whatsapp',
|
|
185
|
+
sent_to_vendor: true,
|
|
186
|
+
replyMessageId: null,
|
|
187
|
+
agent_name: null,
|
|
188
|
+
df_agent_name: null,
|
|
189
|
+
resolve_time: null,
|
|
190
|
+
metadata: null,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
message: 'hi\n',
|
|
194
|
+
id: 20267,
|
|
195
|
+
time: '2024-01-22T10:03:01.000Z',
|
|
196
|
+
direction: 'outbound',
|
|
197
|
+
message_type: null,
|
|
198
|
+
messageId: 'f38be83c-92b1-47a7-9e6a-0d209da0ad86',
|
|
199
|
+
is_live_agent: false,
|
|
200
|
+
is_deleted: false,
|
|
201
|
+
is_comment: false,
|
|
202
|
+
channel: 'whatsapp',
|
|
203
|
+
sent_to_vendor: true,
|
|
204
|
+
replyMessageId: null,
|
|
205
|
+
agent_name: 'arl@beem.co.tz',
|
|
206
|
+
df_agent_name: 'Dev arl',
|
|
207
|
+
resolve_time: null,
|
|
208
|
+
metadata: null,
|
|
209
|
+
statusDetails: {
|
|
210
|
+
statusCode: 3,
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
message: 'Sorry, what was that?',
|
|
215
|
+
id: 20266,
|
|
216
|
+
time: '2024-01-22T10:02:36.000Z',
|
|
217
|
+
direction: 'outbound',
|
|
218
|
+
message_type: 'text',
|
|
219
|
+
messageId: null,
|
|
220
|
+
is_live_agent: false,
|
|
221
|
+
is_deleted: false,
|
|
222
|
+
is_comment: false,
|
|
223
|
+
channel: 'whatsapp',
|
|
224
|
+
sent_to_vendor: true,
|
|
225
|
+
replyMessageId: null,
|
|
226
|
+
agent_name: null,
|
|
227
|
+
df_agent_name: null,
|
|
228
|
+
resolve_time: null,
|
|
229
|
+
metadata: null,
|
|
230
|
+
statusDetails: {
|
|
231
|
+
statusCode: 3,
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
message: 'how are you?',
|
|
236
|
+
id: 20265,
|
|
237
|
+
time: '2024-01-22T10:02:17.000Z',
|
|
238
|
+
direction: 'inbound',
|
|
239
|
+
message_type: 'text',
|
|
240
|
+
messageId: null,
|
|
241
|
+
is_live_agent: false,
|
|
242
|
+
is_deleted: false,
|
|
243
|
+
is_comment: false,
|
|
244
|
+
channel: 'whatsapp',
|
|
245
|
+
sent_to_vendor: true,
|
|
246
|
+
replyMessageId: null,
|
|
247
|
+
agent_name: null,
|
|
248
|
+
df_agent_name: null,
|
|
249
|
+
resolve_time: null,
|
|
250
|
+
metadata: null,
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
message: 'thank you for chatting with us!!! -Dev',
|
|
254
|
+
id: 20264,
|
|
255
|
+
time: '2024-01-22T09:55:00.000Z',
|
|
256
|
+
direction: 'outbound',
|
|
257
|
+
message_type: null,
|
|
258
|
+
messageId: null,
|
|
259
|
+
is_live_agent: true,
|
|
260
|
+
is_deleted: false,
|
|
261
|
+
is_comment: false,
|
|
262
|
+
channel: 'whatsapp',
|
|
263
|
+
sent_to_vendor: true,
|
|
264
|
+
replyMessageId: null,
|
|
265
|
+
agent_name: null,
|
|
266
|
+
df_agent_name: null,
|
|
267
|
+
resolve_time: null,
|
|
268
|
+
metadata: null,
|
|
269
|
+
statusDetails: {
|
|
270
|
+
statusCode: 3,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
message: 'One more time?',
|
|
275
|
+
id: 20223,
|
|
276
|
+
time: '2024-01-19T11:00:59.000Z',
|
|
277
|
+
direction: 'outbound',
|
|
278
|
+
message_type: 'text',
|
|
279
|
+
messageId: null,
|
|
280
|
+
is_live_agent: false,
|
|
281
|
+
is_deleted: false,
|
|
282
|
+
is_comment: false,
|
|
283
|
+
channel: 'whatsapp',
|
|
284
|
+
sent_to_vendor: true,
|
|
285
|
+
replyMessageId: null,
|
|
286
|
+
agent_name: null,
|
|
287
|
+
df_agent_name: null,
|
|
288
|
+
resolve_time: null,
|
|
289
|
+
metadata: null,
|
|
290
|
+
statusDetails: {
|
|
291
|
+
statusCode: 3,
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
message: 'i am good',
|
|
296
|
+
id: 20222,
|
|
297
|
+
time: '2024-01-19T11:00:55.000Z',
|
|
298
|
+
direction: 'inbound',
|
|
299
|
+
message_type: 'text',
|
|
300
|
+
messageId: null,
|
|
301
|
+
is_live_agent: false,
|
|
302
|
+
is_deleted: false,
|
|
303
|
+
is_comment: false,
|
|
304
|
+
channel: 'whatsapp',
|
|
305
|
+
sent_to_vendor: true,
|
|
306
|
+
replyMessageId: null,
|
|
307
|
+
agent_name: null,
|
|
308
|
+
df_agent_name: null,
|
|
309
|
+
resolve_time: null,
|
|
310
|
+
metadata: {
|
|
311
|
+
id: 'ABEGJVaCQwSAAhCt33VV1Zivq9-48AP8bs_t',
|
|
312
|
+
prev_message: 'if it doesnt exists then to fetch',
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
message: 'how are you?',
|
|
317
|
+
id: 20220,
|
|
318
|
+
time: '2024-01-19T10:59:48.000Z',
|
|
319
|
+
direction: 'inbound',
|
|
320
|
+
message_type: 'text',
|
|
321
|
+
messageId: null,
|
|
322
|
+
is_live_agent: false,
|
|
323
|
+
is_deleted: false,
|
|
324
|
+
is_comment: false,
|
|
325
|
+
channel: 'whatsapp',
|
|
326
|
+
sent_to_vendor: true,
|
|
327
|
+
replyMessageId: null,
|
|
328
|
+
agent_name: null,
|
|
329
|
+
df_agent_name: null,
|
|
330
|
+
resolve_time: null,
|
|
331
|
+
metadata: null,
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
message: 'thank you for chatting with us!!! -Dev',
|
|
335
|
+
id: 20217,
|
|
336
|
+
time: '2024-01-19T09:55:00.000Z',
|
|
337
|
+
direction: 'outbound',
|
|
338
|
+
message_type: null,
|
|
339
|
+
messageId: null,
|
|
340
|
+
is_live_agent: true,
|
|
341
|
+
is_deleted: false,
|
|
342
|
+
is_comment: false,
|
|
343
|
+
channel: 'whatsapp',
|
|
344
|
+
sent_to_vendor: true,
|
|
345
|
+
replyMessageId: null,
|
|
346
|
+
agent_name: null,
|
|
347
|
+
df_agent_name: null,
|
|
348
|
+
resolve_time: null,
|
|
349
|
+
metadata: null,
|
|
350
|
+
statusDetails: {
|
|
351
|
+
statusCode: 3,
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
message: 'if it doesnt exists then to fetch',
|
|
356
|
+
id: 20208,
|
|
357
|
+
time: '2024-01-19T08:54:12.000Z',
|
|
358
|
+
direction: 'inbound',
|
|
359
|
+
message_type: 'text',
|
|
360
|
+
messageId: null,
|
|
361
|
+
is_live_agent: true,
|
|
362
|
+
is_deleted: false,
|
|
363
|
+
is_comment: false,
|
|
364
|
+
channel: 'whatsapp',
|
|
365
|
+
sent_to_vendor: true,
|
|
366
|
+
replyMessageId: null,
|
|
367
|
+
agent_name: null,
|
|
368
|
+
df_agent_name: null,
|
|
369
|
+
resolve_time: null,
|
|
370
|
+
metadata: null,
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
message: 'hi',
|
|
374
|
+
id: 20207,
|
|
375
|
+
time: '2024-01-19T08:49:23.000Z',
|
|
376
|
+
direction: 'inbound',
|
|
377
|
+
message_type: 'text',
|
|
378
|
+
messageId: null,
|
|
379
|
+
is_live_agent: true,
|
|
380
|
+
is_deleted: false,
|
|
381
|
+
is_comment: false,
|
|
382
|
+
channel: 'whatsapp',
|
|
383
|
+
sent_to_vendor: true,
|
|
384
|
+
replyMessageId: null,
|
|
385
|
+
agent_name: null,
|
|
386
|
+
df_agent_name: null,
|
|
387
|
+
resolve_time: null,
|
|
388
|
+
metadata: null,
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
message: 'hi',
|
|
392
|
+
id: 20206,
|
|
393
|
+
time: '2024-01-19T08:46:09.000Z',
|
|
394
|
+
direction: 'inbound',
|
|
395
|
+
message_type: 'text',
|
|
396
|
+
messageId: null,
|
|
397
|
+
is_live_agent: true,
|
|
398
|
+
is_deleted: false,
|
|
399
|
+
is_comment: false,
|
|
400
|
+
channel: 'whatsapp',
|
|
401
|
+
sent_to_vendor: true,
|
|
402
|
+
replyMessageId: null,
|
|
403
|
+
agent_name: null,
|
|
404
|
+
df_agent_name: null,
|
|
405
|
+
resolve_time: null,
|
|
406
|
+
metadata: null,
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
message: 'hi',
|
|
410
|
+
id: 20205,
|
|
411
|
+
time: '2024-01-19T08:43:58.000Z',
|
|
412
|
+
direction: 'inbound',
|
|
413
|
+
message_type: 'text',
|
|
414
|
+
messageId: null,
|
|
415
|
+
is_live_agent: true,
|
|
416
|
+
is_deleted: false,
|
|
417
|
+
is_comment: false,
|
|
418
|
+
channel: 'whatsapp',
|
|
419
|
+
sent_to_vendor: true,
|
|
420
|
+
replyMessageId: null,
|
|
421
|
+
agent_name: null,
|
|
422
|
+
df_agent_name: null,
|
|
423
|
+
resolve_time: null,
|
|
424
|
+
metadata: null,
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
message: 'hi',
|
|
428
|
+
id: 20204,
|
|
429
|
+
time: '2024-01-19T08:41:43.000Z',
|
|
430
|
+
direction: 'inbound',
|
|
431
|
+
message_type: 'text',
|
|
432
|
+
messageId: null,
|
|
433
|
+
is_live_agent: true,
|
|
434
|
+
is_deleted: false,
|
|
435
|
+
is_comment: false,
|
|
436
|
+
channel: 'whatsapp',
|
|
437
|
+
sent_to_vendor: true,
|
|
438
|
+
replyMessageId: null,
|
|
439
|
+
agent_name: null,
|
|
440
|
+
df_agent_name: null,
|
|
441
|
+
resolve_time: null,
|
|
442
|
+
metadata: null,
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
message: 'hi',
|
|
446
|
+
id: 20201,
|
|
447
|
+
time: '2024-01-19T08:40:27.000Z',
|
|
448
|
+
direction: 'inbound',
|
|
449
|
+
message_type: 'text',
|
|
450
|
+
messageId: null,
|
|
451
|
+
is_live_agent: true,
|
|
452
|
+
is_deleted: false,
|
|
453
|
+
is_comment: false,
|
|
454
|
+
channel: 'whatsapp',
|
|
455
|
+
sent_to_vendor: true,
|
|
456
|
+
replyMessageId: null,
|
|
457
|
+
agent_name: null,
|
|
458
|
+
df_agent_name: null,
|
|
459
|
+
resolve_time: null,
|
|
460
|
+
metadata: null,
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
message: 'hi',
|
|
464
|
+
id: 20200,
|
|
465
|
+
time: '2024-01-19T08:39:19.000Z',
|
|
466
|
+
direction: 'inbound',
|
|
467
|
+
message_type: 'text',
|
|
468
|
+
messageId: null,
|
|
469
|
+
is_live_agent: true,
|
|
470
|
+
is_deleted: false,
|
|
471
|
+
is_comment: false,
|
|
472
|
+
channel: 'whatsapp',
|
|
473
|
+
sent_to_vendor: true,
|
|
474
|
+
replyMessageId: null,
|
|
475
|
+
agent_name: null,
|
|
476
|
+
df_agent_name: null,
|
|
477
|
+
resolve_time: null,
|
|
478
|
+
metadata: null,
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
message: 'hi',
|
|
482
|
+
id: 20199,
|
|
483
|
+
time: '2024-01-19T08:37:26.000Z',
|
|
484
|
+
direction: 'inbound',
|
|
485
|
+
message_type: 'text',
|
|
486
|
+
messageId: null,
|
|
487
|
+
is_live_agent: true,
|
|
488
|
+
is_deleted: false,
|
|
489
|
+
is_comment: false,
|
|
490
|
+
channel: 'whatsapp',
|
|
491
|
+
sent_to_vendor: true,
|
|
492
|
+
replyMessageId: null,
|
|
493
|
+
agent_name: null,
|
|
494
|
+
df_agent_name: null,
|
|
495
|
+
resolve_time: null,
|
|
496
|
+
metadata: null,
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
message: 'hi',
|
|
500
|
+
id: 20198,
|
|
501
|
+
time: '2024-01-19T08:36:57.000Z',
|
|
502
|
+
direction: 'inbound',
|
|
503
|
+
message_type: 'text',
|
|
504
|
+
messageId: null,
|
|
505
|
+
is_live_agent: true,
|
|
506
|
+
is_deleted: false,
|
|
507
|
+
is_comment: false,
|
|
508
|
+
channel: 'whatsapp',
|
|
509
|
+
sent_to_vendor: true,
|
|
510
|
+
replyMessageId: null,
|
|
511
|
+
agent_name: null,
|
|
512
|
+
df_agent_name: null,
|
|
513
|
+
resolve_time: null,
|
|
514
|
+
metadata: null,
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
message: 'hi',
|
|
518
|
+
id: 20150,
|
|
519
|
+
time: '2024-01-18T12:47:26.000Z',
|
|
520
|
+
direction: 'inbound',
|
|
521
|
+
message_type: 'text',
|
|
522
|
+
messageId: null,
|
|
523
|
+
is_live_agent: true,
|
|
524
|
+
is_deleted: false,
|
|
525
|
+
is_comment: false,
|
|
526
|
+
channel: 'whatsapp',
|
|
527
|
+
sent_to_vendor: true,
|
|
528
|
+
replyMessageId: null,
|
|
529
|
+
agent_name: null,
|
|
530
|
+
df_agent_name: null,
|
|
531
|
+
resolve_time: null,
|
|
532
|
+
metadata: null,
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
message: 'https://bm-chatbot-images.s3.eu-west-1.amazonaws.com/short.jpg',
|
|
536
|
+
id: 20147,
|
|
537
|
+
time: '2024-01-18T09:57:52.000Z',
|
|
538
|
+
direction: 'outbound',
|
|
539
|
+
message_type: 'image/png',
|
|
540
|
+
messageId: 'ea15131f-2c55-43a3-b166-c38a2c4314b1',
|
|
541
|
+
is_live_agent: true,
|
|
542
|
+
is_deleted: false,
|
|
543
|
+
is_comment: false,
|
|
544
|
+
channel: 'whatsapp',
|
|
545
|
+
sent_to_vendor: true,
|
|
546
|
+
replyMessageId: null,
|
|
547
|
+
agent_name: 'arl@beem.co.tz',
|
|
548
|
+
df_agent_name: 'Dev arl',
|
|
549
|
+
resolve_time: null,
|
|
550
|
+
metadata: null,
|
|
551
|
+
statusDetails: {
|
|
552
|
+
statusCode: 3,
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
];
|
|
556
|
+
|
|
42
557
|
// const parsed = JSON.stringify(message.message);
|
|
43
558
|
// const dotGoV2Content = parsed?.dotgoV2;
|
|
44
559
|
const data = {
|
|
@@ -101,7 +616,23 @@ const Chat = () => {
|
|
|
101
616
|
const parsedMessage = JSON.parse(message.message);
|
|
102
617
|
const dotGoV2Content = parsedMessage?.dotgoV2;
|
|
103
618
|
console.log({ parsedMessage });
|
|
104
|
-
console.log(dotGoV2Content);
|
|
619
|
+
console.log({ dotGoV2Content });
|
|
620
|
+
return dotGoV2Content;
|
|
621
|
+
};
|
|
622
|
+
const [checkboxVisibility, setCheckboxVisibility] = useState([]);
|
|
623
|
+
|
|
624
|
+
// Handler function for the checkbox change event
|
|
625
|
+
const handleCheckboxChange = (index, checked) => {
|
|
626
|
+
const updatedVisibility = [...checkboxVisibility]; // Create a copy of the visibility state array
|
|
627
|
+
updatedVisibility[index] = checked; // Update the visibility state for the corresponding checkbox
|
|
628
|
+
setCheckboxVisibility(updatedVisibility); // Update the state
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
const renderJsonMessagex = () => {
|
|
632
|
+
const parsedMessage = JSON.parse(x.metadata.prev_message);
|
|
633
|
+
const dotGoV2Content = parsedMessage?.dotgoV2;
|
|
634
|
+
console.log({ parsedMessage });
|
|
635
|
+
console.log({ dotGoV2Content });
|
|
105
636
|
return dotGoV2Content;
|
|
106
637
|
};
|
|
107
638
|
console.log(data);
|
|
@@ -451,6 +982,50 @@ const Chat = () => {
|
|
|
451
982
|
goes this wide mhhhhhh interesting
|
|
452
983
|
</p> */}
|
|
453
984
|
</BmChat.Details>
|
|
985
|
+
<BmChat.Details
|
|
986
|
+
state="inbound"
|
|
987
|
+
session="bot"
|
|
988
|
+
sessionTimeline={{ message: <p>12:00pm</p> }}
|
|
989
|
+
displayTime={<p>12:00pm</p>}
|
|
990
|
+
status="sent"
|
|
991
|
+
// type="interactive"
|
|
992
|
+
metadata={renderJsonMessagex()}
|
|
993
|
+
isInteractive="true"
|
|
994
|
+
>
|
|
995
|
+
<p>{x.message}</p>
|
|
996
|
+
</BmChat.Details>
|
|
997
|
+
<BmContactCard />
|
|
998
|
+
</BmChat>
|
|
999
|
+
<BmChat>
|
|
1000
|
+
<BmChat.Body>
|
|
1001
|
+
{msg.map((ms, index) => (
|
|
1002
|
+
<BmContactCard isVisible={checkboxVisibility[index]}>
|
|
1003
|
+
<BmContactCard.Profile>
|
|
1004
|
+
<BmProfileIcon size="medium" multiChannel="b6fc03" />
|
|
1005
|
+
</BmContactCard.Profile>
|
|
1006
|
+
<BmContactCard.Details>
|
|
1007
|
+
<BmContactCard.SubDetails>
|
|
1008
|
+
<h3>Contact Names</h3>
|
|
1009
|
+
<BmContactCheckbox
|
|
1010
|
+
isVisible={checkboxVisibility[index]}
|
|
1011
|
+
onChange={(event) =>
|
|
1012
|
+
handleCheckboxChange(index, event.target.checked)
|
|
1013
|
+
}
|
|
1014
|
+
checked={checkboxVisibility[index]}
|
|
1015
|
+
/>
|
|
1016
|
+
</BmContactCard.SubDetails>
|
|
1017
|
+
<BmContactCard.SubDetails>
|
|
1018
|
+
<p>Message text</p>
|
|
1019
|
+
<BmCounter>10</BmCounter>
|
|
1020
|
+
</BmContactCard.SubDetails>
|
|
1021
|
+
<BmContactCard.SubDetails>
|
|
1022
|
+
<BmTag variant="success">{ms.id}</BmTag>
|
|
1023
|
+
<p>10:00 am</p>
|
|
1024
|
+
</BmContactCard.SubDetails>
|
|
1025
|
+
</BmContactCard.Details>
|
|
1026
|
+
</BmContactCard>
|
|
1027
|
+
))}
|
|
1028
|
+
</BmChat.Body>
|
|
454
1029
|
</BmChat>
|
|
455
1030
|
</>
|
|
456
1031
|
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-nested-ternary */
|
|
1
2
|
/* eslint-disable react/display-name */
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { Done, DoneAll } from '@material-ui/icons';
|
|
@@ -72,8 +73,8 @@ const MessageDetails = styled.div`
|
|
|
72
73
|
|
|
73
74
|
const Messages = styled.div`
|
|
74
75
|
display: flex;
|
|
75
|
-
flex-direction: ${({ type }) => {
|
|
76
|
-
if (type === 'interactive') {
|
|
76
|
+
flex-direction: ${({ type, isInteractive }) => {
|
|
77
|
+
if (type === 'interactive' || isInteractive) {
|
|
77
78
|
return 'column';
|
|
78
79
|
}
|
|
79
80
|
return 'row';
|
|
@@ -376,6 +377,7 @@ BmChat.Details = ({
|
|
|
376
377
|
feedPostComments,
|
|
377
378
|
agentName,
|
|
378
379
|
metadata,
|
|
380
|
+
isInteractive,
|
|
379
381
|
type,
|
|
380
382
|
...rest
|
|
381
383
|
}) => {
|
|
@@ -403,9 +405,48 @@ BmChat.Details = ({
|
|
|
403
405
|
<>
|
|
404
406
|
{metadata ? (
|
|
405
407
|
<RepliedTextWrapper state={state}>
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
408
|
+
{metadata.type === 'quick_reply' ? (
|
|
409
|
+
<Messages
|
|
410
|
+
isInteractive={isInteractive}
|
|
411
|
+
type={type}
|
|
412
|
+
state={state}
|
|
413
|
+
isImg
|
|
414
|
+
>
|
|
415
|
+
{metadata?.content?.url && (
|
|
416
|
+
<BmImageChat
|
|
417
|
+
state={state}
|
|
418
|
+
src={metadata?.content?.url}
|
|
419
|
+
{...rest}
|
|
420
|
+
/>
|
|
421
|
+
)}
|
|
422
|
+
|
|
423
|
+
<strong>{metadata?.content?.header}</strong>
|
|
424
|
+
<p>{metadata?.content?.text}</p>
|
|
425
|
+
<small>{metadata?.content?.caption}</small>
|
|
426
|
+
{metadata?.options?.map((button) => (
|
|
427
|
+
// eslint-disable-next-line react/jsx-key
|
|
428
|
+
<IntButton state={state}>{button?.title}</IntButton>
|
|
429
|
+
))}
|
|
430
|
+
</Messages>
|
|
431
|
+
) : metadata.type === 'quick_reply' ? (
|
|
432
|
+
<Messages
|
|
433
|
+
isInteractive={isInteractive}
|
|
434
|
+
type={type}
|
|
435
|
+
state={state}
|
|
436
|
+
>
|
|
437
|
+
<strong>{metadata?.title}</strong>
|
|
438
|
+
<p>{metadata?.body}</p>
|
|
439
|
+
<IntButton state={state}>
|
|
440
|
+
<ListIcon />
|
|
441
|
+
{metadata?.globalButtons[0]?.title}
|
|
442
|
+
</IntButton>
|
|
443
|
+
</Messages>
|
|
444
|
+
) : (
|
|
445
|
+
<Messages metadata={metadata} state={state}>
|
|
446
|
+
{metadata}
|
|
447
|
+
</Messages>
|
|
448
|
+
)}
|
|
449
|
+
|
|
409
450
|
{children}
|
|
410
451
|
</RepliedTextWrapper>
|
|
411
452
|
) : (
|
|
@@ -414,7 +455,7 @@ BmChat.Details = ({
|
|
|
414
455
|
<>
|
|
415
456
|
{children.type === 'quick_reply' ? (
|
|
416
457
|
<Messages type={type} state={state} isImg>
|
|
417
|
-
{children?.content?.
|
|
458
|
+
{children?.content?.url && (
|
|
418
459
|
<BmImageChat
|
|
419
460
|
state={state}
|
|
420
461
|
src={children?.content?.url}
|
|
@@ -38,7 +38,12 @@ const Profile = styled.div`
|
|
|
38
38
|
height: ${(props) => handleSize(props.size)};
|
|
39
39
|
width: ${(props) => handleSize(props.size)};
|
|
40
40
|
border-radius: 50%;
|
|
41
|
-
border:
|
|
41
|
+
border: ${({ multiChannel }) => {
|
|
42
|
+
if (multiChannel) {
|
|
43
|
+
return `.1429rem solid ${multiChannel} `;
|
|
44
|
+
}
|
|
45
|
+
return `.0714rem solid ${BmBgLightBlue}`;
|
|
46
|
+
}};
|
|
42
47
|
display: flex;
|
|
43
48
|
align-items: center;
|
|
44
49
|
justify-content: center;
|