@fle-ui/plus-im-record 0.0.8-beta.3 → 0.0.8-beta.5

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.
@@ -64,7 +64,7 @@
64
64
  white-space: break-spaces;
65
65
  overflow: hidden;
66
66
  max-width: 375px;
67
- min-width: 50px;
67
+ min-width: 24px;
68
68
  border-radius: 2px 6px 6px 6px;
69
69
  background: #fff;
70
70
  }
@@ -98,6 +98,9 @@
98
98
  border-radius: 6px 2px 6px 6px;
99
99
  background: #dbe6ff;
100
100
  }
101
+ .@{prefix}-ref-body {
102
+ border-left: 3px solid #c2d4ff;
103
+ }
101
104
  }
102
105
 
103
106
  // 对话-H5
@@ -2,6 +2,7 @@
2
2
 
3
3
  .@{prefix}-goods {
4
4
  max-width: 272px;
5
+ min-width: 200px;
5
6
  padding-bottom: 2px;
6
7
  &-info {
7
8
  display: flex;
@@ -2,6 +2,7 @@
2
2
 
3
3
  .@{prefix}-order {
4
4
  max-width: 272px;
5
+ min-width: 200px;
5
6
  padding-bottom: 2px;
6
7
 
7
8
  &-info {
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare const OrderGoodsCard: React.FC<{
4
+ prefix?: string;
5
+ orderSn?: any;
6
+ messageId?: string;
7
+ }>;
8
+ export default OrderGoodsCard;
@@ -0,0 +1,85 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useContext, useEffect, useState } from 'react';
8
+ import classNames from 'classnames';
9
+ import { fallbackImg } from '../common/const';
10
+ import './index.less';
11
+ import { ImContext } from '..';
12
+ var OrderGoodsCard = function OrderGoodsCard(props) {
13
+ var _props$prefix = props.prefix,
14
+ prefix = _props$prefix === void 0 ? 'fx-chart-messages-item' : _props$prefix,
15
+ _props$orderSn = props.orderSn,
16
+ orderSn = _props$orderSn === void 0 ? '' : _props$orderSn,
17
+ messageId = props.messageId;
18
+ var _useState = useState([]),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ data = _useState2[0],
21
+ setData = _useState2[1];
22
+ var _useState3 = useState(false),
23
+ _useState4 = _slicedToArray(_useState3, 2),
24
+ isExpand = _useState4[0],
25
+ setIsExpand = _useState4[1];
26
+ var _useContext = useContext(ImContext),
27
+ api = _useContext.api;
28
+ useEffect(function () {
29
+ if (orderSn && messageId) {
30
+ api.getOrderGoods({
31
+ orderSn: orderSn,
32
+ messageId: messageId
33
+ }).then(function (_ref) {
34
+ var data = _ref.data;
35
+ setData(data || []);
36
+ });
37
+ }
38
+ }, [orderSn, messageId]);
39
+ function formatOrderPrice(item) {
40
+ var currencyStr = item.currencyStr || '积分';
41
+ if (Number(item.price || 0) > 0 && Number(item.score || 0) > 0) {
42
+ return "".concat(item.score).concat(currencyStr, " + ").concat(item.price, "\u5143");
43
+ }
44
+ if (Number(item.price || 0) > 0) {
45
+ return "".concat(item.price, "\u5143");
46
+ }
47
+ if (Number(item.score || 0) > 0) {
48
+ return "".concat(item.score).concat(currencyStr);
49
+ }
50
+ return '';
51
+ }
52
+ return /*#__PURE__*/React.createElement("div", {
53
+ className: classNames("".concat(prefix, "-order-goods"))
54
+ }, /*#__PURE__*/React.createElement("div", {
55
+ className: "".concat(prefix, "-order-goods-summary")
56
+ }, "\u60A8\u597D\uFF0C\u8BF7\u9009\u62E9\u60A8\u8981\u54A8\u8BE2\u7684\u5546\u54C1\uFF1A"), data === null || data === void 0 ? void 0 : data.slice(0, isExpand ? data === null || data === void 0 ? void 0 : data.length : 5).map(function (item, index) {
57
+ return /*#__PURE__*/React.createElement("div", {
58
+ key: +index,
59
+ className: "".concat(prefix, "-order-goods-item")
60
+ }, /*#__PURE__*/React.createElement("div", {
61
+ className: "".concat(prefix, "-order-goods-item-img"),
62
+ style: {
63
+ background: "url(".concat(item.pic || fallbackImg, ") 0 0 / cover no-repeat")
64
+ }
65
+ }), /*#__PURE__*/React.createElement("div", {
66
+ className: "".concat(prefix, "-order-goods-item-right")
67
+ }, /*#__PURE__*/React.createElement("div", {
68
+ className: "".concat(prefix, "-order-goods-item-title two-line-text")
69
+ }, item.title), /*#__PURE__*/React.createElement("div", {
70
+ style: {
71
+ display: 'flex',
72
+ justifyContent: 'space-between',
73
+ gap: 8
74
+ }
75
+ }, /*#__PURE__*/React.createElement("div", {
76
+ className: "".concat(prefix, "-order-goods-item-price")
77
+ }, item.applicationId === 7 ? null : formatOrderPrice(item)))));
78
+ }), (data === null || data === void 0 ? void 0 : data.length) > 5 && /*#__PURE__*/React.createElement("div", {
79
+ className: "".concat(prefix, "-order-goods-expand"),
80
+ onClick: function onClick() {
81
+ return setIsExpand(!isExpand);
82
+ }
83
+ }, isExpand ? '收起' : '展开全部', " ", "(".concat(data === null || data === void 0 ? void 0 : data.length, ")")));
84
+ };
85
+ export default OrderGoodsCard;
@@ -0,0 +1,61 @@
1
+ @prefix: chart-messages-item;
2
+
3
+ .@{prefix}-order-goods {
4
+ max-width: 272px;
5
+ min-width: 200px;
6
+ padding: 12px;
7
+ padding-bottom: 6px;
8
+ &-summary {
9
+ margin-bottom: 8px;
10
+ }
11
+
12
+ &-item {
13
+ display: flex;
14
+ flex-flow: row;
15
+ padding: 8px 0;
16
+ &:not(:last-child) {
17
+ border-bottom: 1px solid #eee;
18
+ }
19
+ &-img {
20
+ flex-shrink: 0;
21
+ border-radius: 4px;
22
+ width: 60px;
23
+ height: 60px;
24
+ margin-right: 6px;
25
+ overflow: hidden;
26
+ object-fit: fill;
27
+ }
28
+ img {
29
+ width: 100%;
30
+ object-fit: contain;
31
+ }
32
+
33
+ &-right {
34
+ flex: 1;
35
+ overflow: hidden;
36
+ }
37
+ &-title {
38
+ line-height: 1.2;
39
+ margin-top: 2px;
40
+ margin-bottom: 4px;
41
+ }
42
+
43
+ &-price {
44
+ min-height: 14px;
45
+ font-size: 12px;
46
+ color: #6e7789;
47
+ }
48
+
49
+ &-btn {
50
+ font-size: 12px !important;
51
+ padding: 0 !important;
52
+ }
53
+ }
54
+
55
+ &-expand {
56
+ color: var(--prc);
57
+ text-align: center;
58
+ padding-top: 8px;
59
+ cursor: pointer;
60
+ }
61
+ }
@@ -26,6 +26,7 @@ import { downloadByUrl, getSimplifyMsg } from '../common/utils';
26
26
  import Icon from '../Icon';
27
27
  import GoodsCard from '../GoodsCard';
28
28
  import GoodsOrderCard from '../GoodsOrderCard';
29
+ import OrderGoodsCard from '../OrderGoodsCard';
29
30
  import { ImContext } from '..';
30
31
  import { pauseAllAudio, pauseOtherVideo } from '../audioAndVideoTool';
31
32
  import AudioPlayer from './AudioPlayer';
@@ -113,7 +114,7 @@ var ParseSession = function ParseSession(_ref) {
113
114
  className: "".concat(prefix, "-ref-audio-body")
114
115
  }, /*#__PURE__*/React.createElement(AudioPlayer, {
115
116
  style: {
116
- backgroundColor: '#fff',
117
+ backgroundColor: msg.flow === 'in' ? '#f7f7f7' : 'rgba(255, 255, 255, 0.5)',
117
118
  borderRadius: 4,
118
119
  width: 80
119
120
  },
@@ -331,7 +332,6 @@ var ParseSession = function ParseSession(_ref) {
331
332
  return null;
332
333
  };
333
334
  var renderAudio = function renderAudio() {
334
- var flow = msg.flow;
335
335
  var duration = Math.floor(attach.content.dur) || 0;
336
336
  return /*#__PURE__*/React.createElement(AudioPlayer, {
337
337
  prefix: prefix || '',
@@ -389,7 +389,11 @@ var ParseSession = function ParseSession(_ref) {
389
389
  href: addUrlSearch(attach.content.url, "download=".concat(attach.content.fileName)),
390
390
  target: "_blank",
391
391
  rel: "noreferrer"
392
- }, attach.content.fileName), /*#__PURE__*/React.createElement("span", null, parseFileSize(attach.content.size))));
392
+ }, attach.content.fileName), /*#__PURE__*/React.createElement("span", {
393
+ style: {
394
+ fontSize: 12
395
+ }
396
+ }, parseFileSize(attach.content.size))));
393
397
  };
394
398
  var renderOrderCard = function renderOrderCard() {
395
399
  var _attach$content8, _attach$content9;
@@ -406,11 +410,19 @@ var ParseSession = function ParseSession(_ref) {
406
410
  content: attach.content || {}
407
411
  });
408
412
  };
413
+ var renderOrderGoods = function renderOrderGoods() {
414
+ var _attach$content10;
415
+ return /*#__PURE__*/React.createElement(OrderGoodsCard, {
416
+ prefix: prefix,
417
+ orderSn: (_attach$content10 = attach.content) === null || _attach$content10 === void 0 ? void 0 : _attach$content10.orderSn,
418
+ messageId: msg.idClient
419
+ });
420
+ };
409
421
  var renderChartRecord = function renderChartRecord() {
410
- var _attach$content10, _attach$content11, _attach$content12;
411
- var records = ((_attach$content10 = attach.content) === null || _attach$content10 === void 0 ? void 0 : _attach$content10.items) || [];
412
- var msgIds = ((_attach$content11 = attach.content) === null || _attach$content11 === void 0 ? void 0 : _attach$content11.msgIds) || [];
413
- var title = (_attach$content12 = attach.content) === null || _attach$content12 === void 0 ? void 0 : _attach$content12.title;
422
+ var _attach$content11, _attach$content12, _attach$content13;
423
+ var records = ((_attach$content11 = attach.content) === null || _attach$content11 === void 0 ? void 0 : _attach$content11.items) || [];
424
+ var msgIds = ((_attach$content12 = attach.content) === null || _attach$content12 === void 0 ? void 0 : _attach$content12.msgIds) || [];
425
+ var title = (_attach$content13 = attach.content) === null || _attach$content13 === void 0 ? void 0 : _attach$content13.title;
414
426
  var list = records.filter(function (v) {
415
427
  var _v$attach;
416
428
  return ![imMsgTypes.event].includes((_v$attach = v.attach) === null || _v$attach === void 0 ? void 0 : _v$attach.type);
@@ -440,11 +452,45 @@ var ParseSession = function ParseSession(_ref) {
440
452
  }
441
453
  })), "\u7CFB\u7EDF\u8F6C\u53D1"));
442
454
  };
455
+ var renderLiveSupport = function renderLiveSupport() {
456
+ var liveSupportAttach = attach;
457
+ console.log(liveSupportAttach, 'liveSupportAttach');
458
+ return /*#__PURE__*/React.createElement("div", {
459
+ className: "".concat(prefix, "-live-support")
460
+ }, /*#__PURE__*/React.createElement("div", {
461
+ className: "".concat(prefix, "-live-support-title")
462
+ }, liveSupportAttach.content.title), /*#__PURE__*/React.createElement("div", {
463
+ className: "".concat(prefix, "-live-support-operate")
464
+ }, liveSupportAttach.content.liveSupportBtn));
465
+ };
466
+ var renderAfsFaq = function renderAfsFaq() {
467
+ var afsFaqAttach = attach;
468
+ return /*#__PURE__*/React.createElement("div", {
469
+ className: "".concat(prefix, "-afs-faq")
470
+ }, /*#__PURE__*/React.createElement("div", {
471
+ className: "".concat(prefix, "-afs-faq-title")
472
+ }, afsFaqAttach.content.title), /*#__PURE__*/React.createElement("div", {
473
+ className: "".concat(prefix, "-afs-faq-list")
474
+ }, afsFaqAttach.content.qaList.map(function (item) {
475
+ return /*#__PURE__*/React.createElement("div", {
476
+ className: "".concat(prefix, "-afs-faq-list-item"),
477
+ key: item.id
478
+ }, /*#__PURE__*/React.createElement("span", {
479
+ className: "title"
480
+ }, item.question));
481
+ })));
482
+ };
483
+ var renderFeedback = function renderFeedback() {
484
+ var feedbackAttach = attach;
485
+ return /*#__PURE__*/React.createElement("div", {
486
+ className: "".concat(prefix, "-text")
487
+ }, feedbackAttach.content.title);
488
+ };
443
489
  var renderOfflineSupport = function renderOfflineSupport() {
444
- var _attach$content13, _attach$content14;
490
+ var _attach$content14, _attach$content15;
445
491
  return /*#__PURE__*/React.createElement("div", {
446
492
  className: "".concat(prefix, "-text")
447
- }, (_attach$content13 = attach.content) === null || _attach$content13 === void 0 ? void 0 : _attach$content13.supportDesc, ((_attach$content14 = attach.content) === null || _attach$content14 === void 0 ? void 0 : _attach$content14.contact) && /*#__PURE__*/React.createElement("a", {
493
+ }, (_attach$content14 = attach.content) === null || _attach$content14 === void 0 ? void 0 : _attach$content14.supportDesc, ((_attach$content15 = attach.content) === null || _attach$content15 === void 0 ? void 0 : _attach$content15.contact) && /*#__PURE__*/React.createElement("a", {
448
494
  href: "tel:".concat(attach.content.contact),
449
495
  rel: "noreferrer"
450
496
  }, attach.content.contact));
@@ -468,6 +514,12 @@ var ParseSession = function ParseSession(_ref) {
468
514
  return renderFaq();
469
515
  case imMsgTypes.faqLink:
470
516
  return renderFaqLink();
517
+ case imMsgTypes.afsFaq:
518
+ return renderAfsFaq();
519
+ case imMsgTypes.feedback:
520
+ return renderFeedback();
521
+ case imMsgTypes.liveSupport:
522
+ return renderLiveSupport();
471
523
  case imMsgTypes.formCustomer:
472
524
  return renderFormCustomer();
473
525
  case imMsgTypes.tip:
@@ -480,6 +532,8 @@ var ParseSession = function ParseSession(_ref) {
480
532
  return renderChartRecord();
481
533
  case imMsgTypes.offlineSupport:
482
534
  return renderOfflineSupport();
535
+ case imMsgTypes.orderGoods:
536
+ return renderOrderGoods();
483
537
  default:
484
538
  return '';
485
539
  }
@@ -7,9 +7,9 @@
7
7
 
8
8
  &-ref {
9
9
  padding: 12px;
10
- padding-bottom: 16px;
10
+ padding-bottom: 4px;
11
11
  &-body {
12
- border-left: 2px solid #c2d4ff;
12
+ border-left: 3px solid #eee;
13
13
  padding-left: 8px;
14
14
  }
15
15
  &-text-body {
@@ -211,6 +211,75 @@
211
211
  }
212
212
  }
213
213
  }
214
+
215
+ &-afs-faq {
216
+ padding: 16px;
217
+ width: 272px;
218
+ &-title {
219
+ font-size: 14px;
220
+ color: #333;
221
+ font-weight: 500;
222
+ }
223
+ &-list {
224
+ margin-top: 16px;
225
+ border-top: 1px solid #eee;
226
+ color: #2c6bff;
227
+ &-item {
228
+ cursor: default;
229
+ padding: 16px 0 0 0;
230
+ display: flex;
231
+ align-items: center;
232
+ transition: color 0.3s, transform 0.3s;
233
+ // &:active {
234
+ // color: #1a4d99;
235
+ // transform: scale(1.05);
236
+ // }
237
+ &::before {
238
+ content: '';
239
+ display: inline-block;
240
+ width: 6px;
241
+ height: 6px;
242
+ border-radius: 50%;
243
+ background-color: #2c6bff;
244
+ margin-right: 8px;
245
+ }
246
+ }
247
+ }
248
+ }
249
+ &-feedback {
250
+ padding: 16px;
251
+ width: 272px;
252
+ }
253
+ &-live-support {
254
+ padding: 16px;
255
+ width: 272px;
256
+ &-title {
257
+ font-size: 14px;
258
+ color: #333;
259
+ font-weight: 400;
260
+ }
261
+ &-operate {
262
+ cursor: default;
263
+ font-size: 14px;
264
+ color: #2c6bff;
265
+ font-weight: 400;
266
+ margin-top: 16px;
267
+ transition: color 0.3s, transform 0.3s;
268
+ // &:active {
269
+ // color: #1a4d99;
270
+ // transform: scale(1.05);
271
+ // }
272
+ &::before {
273
+ content: '';
274
+ display: inline-block;
275
+ width: 6px;
276
+ height: 6px;
277
+ border-radius: 50%;
278
+ background-color: #2c6bff;
279
+ margin-right: 8px;
280
+ }
281
+ }
282
+ }
214
283
  }
215
284
 
216
285
  .fx-preview-toolbar-wrapper {
package/es/api/index.d.ts CHANGED
@@ -25,6 +25,10 @@ interface ApiMethods {
25
25
  getContact: (params: {
26
26
  msgId?: string;
27
27
  }) => Promise<any>;
28
+ getOrderGoods: (data: {
29
+ orderSn?: any;
30
+ messageId?: string;
31
+ }) => Promise<any>;
28
32
  }
29
33
  export declare const apiCreate: (_env?: Env, token?: string) => ApiMethods;
30
34
  export {};
package/es/api/index.js CHANGED
@@ -38,6 +38,10 @@ export var apiCreate = function apiCreate(_env, token) {
38
38
  getCSOrder: function getCSOrder(data) {
39
39
  return service.post('/ll/provider/message/order/get', data);
40
40
  },
41
+ // 获取订单商品信息
42
+ getOrderGoods: function getOrderGoods(data) {
43
+ return service.post('/ll/provider/message/after-sales-agent/goods/list', data);
44
+ },
41
45
  // 获取联系人信息(表单)
42
46
  getContact: function getContact(params) {
43
47
  return service.get('/ll/provider/message/contact/get', {
@@ -8,6 +8,9 @@ export declare const imMsgTypes: {
8
8
  link: string;
9
9
  file: string;
10
10
  faq: string;
11
+ afsFaq: string;
12
+ feedback: string;
13
+ liveSupport: string;
11
14
  faqLink: string;
12
15
  formCustomer: string;
13
16
  tip: string;
@@ -8,6 +8,12 @@ export var imMsgTypes = {
8
8
  link: 'link',
9
9
  file: 'file',
10
10
  faq: 'faq',
11
+ // 机器人自动回复问题
12
+ afsFaq: 'afs-faq',
13
+ // 请用户给快速反馈
14
+ feedback: 'feedback',
15
+ // 询问是否需要转
16
+ liveSupport: 'live-support',
11
17
  faqLink: 'faqLink',
12
18
  formCustomer: 'formCustomer',
13
19
  tip: 'tip',
package/es/index.d.ts CHANGED
@@ -8,7 +8,10 @@ import './styles/index.less';
8
8
  * @description 代码由小鲤客服平台搬运简来.
9
9
  */
10
10
  export interface IMRecordProps {
11
- env?: Env;
11
+ /**
12
+ * 数据对应的环境
13
+ */
14
+ env: Env;
12
15
  token?: string;
13
16
  h5?: boolean;
14
17
  msgs: IMMessage[];
@@ -64,7 +64,7 @@
64
64
  white-space: break-spaces;
65
65
  overflow: hidden;
66
66
  max-width: 375px;
67
- min-width: 50px;
67
+ min-width: 24px;
68
68
  border-radius: 2px 6px 6px 6px;
69
69
  background: #fff;
70
70
  }
@@ -98,6 +98,9 @@
98
98
  border-radius: 6px 2px 6px 6px;
99
99
  background: #dbe6ff;
100
100
  }
101
+ .@{prefix}-ref-body {
102
+ border-left: 3px solid #c2d4ff;
103
+ }
101
104
  }
102
105
 
103
106
  // 对话-H5
@@ -2,6 +2,7 @@
2
2
 
3
3
  .@{prefix}-goods {
4
4
  max-width: 272px;
5
+ min-width: 200px;
5
6
  padding-bottom: 2px;
6
7
  &-info {
7
8
  display: flex;
@@ -2,6 +2,7 @@
2
2
 
3
3
  .@{prefix}-order {
4
4
  max-width: 272px;
5
+ min-width: 200px;
5
6
  padding-bottom: 2px;
6
7
 
7
8
  &-info {
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare const OrderGoodsCard: React.FC<{
4
+ prefix?: string;
5
+ orderSn?: any;
6
+ messageId?: string;
7
+ }>;
8
+ export default OrderGoodsCard;
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _const = require("../common/const");
11
+ require("./index.less");
12
+ var _ = require("..");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
17
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
18
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
19
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
20
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
21
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
+ var OrderGoodsCard = function OrderGoodsCard(props) {
23
+ var _props$prefix = props.prefix,
24
+ prefix = _props$prefix === void 0 ? 'fx-chart-messages-item' : _props$prefix,
25
+ _props$orderSn = props.orderSn,
26
+ orderSn = _props$orderSn === void 0 ? '' : _props$orderSn,
27
+ messageId = props.messageId;
28
+ var _useState = (0, _react.useState)([]),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ data = _useState2[0],
31
+ setData = _useState2[1];
32
+ var _useState3 = (0, _react.useState)(false),
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ isExpand = _useState4[0],
35
+ setIsExpand = _useState4[1];
36
+ var _useContext = (0, _react.useContext)(_.ImContext),
37
+ api = _useContext.api;
38
+ (0, _react.useEffect)(function () {
39
+ if (orderSn && messageId) {
40
+ api.getOrderGoods({
41
+ orderSn: orderSn,
42
+ messageId: messageId
43
+ }).then(function (_ref) {
44
+ var data = _ref.data;
45
+ setData(data || []);
46
+ });
47
+ }
48
+ }, [orderSn, messageId]);
49
+ function formatOrderPrice(item) {
50
+ var currencyStr = item.currencyStr || '积分';
51
+ if (Number(item.price || 0) > 0 && Number(item.score || 0) > 0) {
52
+ return "".concat(item.score).concat(currencyStr, " + ").concat(item.price, "\u5143");
53
+ }
54
+ if (Number(item.price || 0) > 0) {
55
+ return "".concat(item.price, "\u5143");
56
+ }
57
+ if (Number(item.score || 0) > 0) {
58
+ return "".concat(item.score).concat(currencyStr);
59
+ }
60
+ return '';
61
+ }
62
+ return /*#__PURE__*/_react.default.createElement("div", {
63
+ className: (0, _classnames.default)("".concat(prefix, "-order-goods"))
64
+ }, /*#__PURE__*/_react.default.createElement("div", {
65
+ className: "".concat(prefix, "-order-goods-summary")
66
+ }, "\u60A8\u597D\uFF0C\u8BF7\u9009\u62E9\u60A8\u8981\u54A8\u8BE2\u7684\u5546\u54C1\uFF1A"), data === null || data === void 0 ? void 0 : data.slice(0, isExpand ? data === null || data === void 0 ? void 0 : data.length : 5).map(function (item, index) {
67
+ return /*#__PURE__*/_react.default.createElement("div", {
68
+ key: +index,
69
+ className: "".concat(prefix, "-order-goods-item")
70
+ }, /*#__PURE__*/_react.default.createElement("div", {
71
+ className: "".concat(prefix, "-order-goods-item-img"),
72
+ style: {
73
+ background: "url(".concat(item.pic || _const.fallbackImg, ") 0 0 / cover no-repeat")
74
+ }
75
+ }), /*#__PURE__*/_react.default.createElement("div", {
76
+ className: "".concat(prefix, "-order-goods-item-right")
77
+ }, /*#__PURE__*/_react.default.createElement("div", {
78
+ className: "".concat(prefix, "-order-goods-item-title two-line-text")
79
+ }, item.title), /*#__PURE__*/_react.default.createElement("div", {
80
+ style: {
81
+ display: 'flex',
82
+ justifyContent: 'space-between',
83
+ gap: 8
84
+ }
85
+ }, /*#__PURE__*/_react.default.createElement("div", {
86
+ className: "".concat(prefix, "-order-goods-item-price")
87
+ }, item.applicationId === 7 ? null : formatOrderPrice(item)))));
88
+ }), (data === null || data === void 0 ? void 0 : data.length) > 5 && /*#__PURE__*/_react.default.createElement("div", {
89
+ className: "".concat(prefix, "-order-goods-expand"),
90
+ onClick: function onClick() {
91
+ return setIsExpand(!isExpand);
92
+ }
93
+ }, isExpand ? '收起' : '展开全部', " ", "(".concat(data === null || data === void 0 ? void 0 : data.length, ")")));
94
+ };
95
+ var _default = exports.default = OrderGoodsCard;
@@ -0,0 +1,61 @@
1
+ @prefix: chart-messages-item;
2
+
3
+ .@{prefix}-order-goods {
4
+ max-width: 272px;
5
+ min-width: 200px;
6
+ padding: 12px;
7
+ padding-bottom: 6px;
8
+ &-summary {
9
+ margin-bottom: 8px;
10
+ }
11
+
12
+ &-item {
13
+ display: flex;
14
+ flex-flow: row;
15
+ padding: 8px 0;
16
+ &:not(:last-child) {
17
+ border-bottom: 1px solid #eee;
18
+ }
19
+ &-img {
20
+ flex-shrink: 0;
21
+ border-radius: 4px;
22
+ width: 60px;
23
+ height: 60px;
24
+ margin-right: 6px;
25
+ overflow: hidden;
26
+ object-fit: fill;
27
+ }
28
+ img {
29
+ width: 100%;
30
+ object-fit: contain;
31
+ }
32
+
33
+ &-right {
34
+ flex: 1;
35
+ overflow: hidden;
36
+ }
37
+ &-title {
38
+ line-height: 1.2;
39
+ margin-top: 2px;
40
+ margin-bottom: 4px;
41
+ }
42
+
43
+ &-price {
44
+ min-height: 14px;
45
+ font-size: 12px;
46
+ color: #6e7789;
47
+ }
48
+
49
+ &-btn {
50
+ font-size: 12px !important;
51
+ padding: 0 !important;
52
+ }
53
+ }
54
+
55
+ &-expand {
56
+ color: var(--prc);
57
+ text-align: center;
58
+ padding-top: 8px;
59
+ cursor: pointer;
60
+ }
61
+ }
@@ -16,6 +16,7 @@ var _utils2 = require("../common/utils");
16
16
  var _Icon = _interopRequireDefault(require("../Icon"));
17
17
  var _GoodsCard = _interopRequireDefault(require("../GoodsCard"));
18
18
  var _GoodsOrderCard = _interopRequireDefault(require("../GoodsOrderCard"));
19
+ var _OrderGoodsCard = _interopRequireDefault(require("../OrderGoodsCard"));
19
20
  var _2 = require("..");
20
21
  var _audioAndVideoTool = require("../audioAndVideoTool");
21
22
  var _AudioPlayer = _interopRequireDefault(require("./AudioPlayer"));
@@ -115,7 +116,7 @@ var ParseSession = function ParseSession(_ref) {
115
116
  className: "".concat(prefix, "-ref-audio-body")
116
117
  }, /*#__PURE__*/_react.default.createElement(_AudioPlayer.default, {
117
118
  style: {
118
- backgroundColor: '#fff',
119
+ backgroundColor: msg.flow === 'in' ? '#f7f7f7' : 'rgba(255, 255, 255, 0.5)',
119
120
  borderRadius: 4,
120
121
  width: 80
121
122
  },
@@ -333,7 +334,6 @@ var ParseSession = function ParseSession(_ref) {
333
334
  return null;
334
335
  };
335
336
  var renderAudio = function renderAudio() {
336
- var flow = msg.flow;
337
337
  var duration = Math.floor(attach.content.dur) || 0;
338
338
  return /*#__PURE__*/_react.default.createElement(_AudioPlayer.default, {
339
339
  prefix: prefix || '',
@@ -391,7 +391,11 @@ var ParseSession = function ParseSession(_ref) {
391
391
  href: (0, _utils.addUrlSearch)(attach.content.url, "download=".concat(attach.content.fileName)),
392
392
  target: "_blank",
393
393
  rel: "noreferrer"
394
- }, attach.content.fileName), /*#__PURE__*/_react.default.createElement("span", null, (0, _utils.parseFileSize)(attach.content.size))));
394
+ }, attach.content.fileName), /*#__PURE__*/_react.default.createElement("span", {
395
+ style: {
396
+ fontSize: 12
397
+ }
398
+ }, (0, _utils.parseFileSize)(attach.content.size))));
395
399
  };
396
400
  var renderOrderCard = function renderOrderCard() {
397
401
  var _attach$content8, _attach$content9;
@@ -408,11 +412,19 @@ var ParseSession = function ParseSession(_ref) {
408
412
  content: attach.content || {}
409
413
  });
410
414
  };
415
+ var renderOrderGoods = function renderOrderGoods() {
416
+ var _attach$content10;
417
+ return /*#__PURE__*/_react.default.createElement(_OrderGoodsCard.default, {
418
+ prefix: prefix,
419
+ orderSn: (_attach$content10 = attach.content) === null || _attach$content10 === void 0 ? void 0 : _attach$content10.orderSn,
420
+ messageId: msg.idClient
421
+ });
422
+ };
411
423
  var renderChartRecord = function renderChartRecord() {
412
- var _attach$content10, _attach$content11, _attach$content12;
413
- var records = ((_attach$content10 = attach.content) === null || _attach$content10 === void 0 ? void 0 : _attach$content10.items) || [];
414
- var msgIds = ((_attach$content11 = attach.content) === null || _attach$content11 === void 0 ? void 0 : _attach$content11.msgIds) || [];
415
- var title = (_attach$content12 = attach.content) === null || _attach$content12 === void 0 ? void 0 : _attach$content12.title;
424
+ var _attach$content11, _attach$content12, _attach$content13;
425
+ var records = ((_attach$content11 = attach.content) === null || _attach$content11 === void 0 ? void 0 : _attach$content11.items) || [];
426
+ var msgIds = ((_attach$content12 = attach.content) === null || _attach$content12 === void 0 ? void 0 : _attach$content12.msgIds) || [];
427
+ var title = (_attach$content13 = attach.content) === null || _attach$content13 === void 0 ? void 0 : _attach$content13.title;
416
428
  var list = records.filter(function (v) {
417
429
  var _v$attach;
418
430
  return ![_const.imMsgTypes.event].includes((_v$attach = v.attach) === null || _v$attach === void 0 ? void 0 : _v$attach.type);
@@ -442,11 +454,45 @@ var ParseSession = function ParseSession(_ref) {
442
454
  }
443
455
  })), "\u7CFB\u7EDF\u8F6C\u53D1"));
444
456
  };
457
+ var renderLiveSupport = function renderLiveSupport() {
458
+ var liveSupportAttach = attach;
459
+ console.log(liveSupportAttach, 'liveSupportAttach');
460
+ return /*#__PURE__*/_react.default.createElement("div", {
461
+ className: "".concat(prefix, "-live-support")
462
+ }, /*#__PURE__*/_react.default.createElement("div", {
463
+ className: "".concat(prefix, "-live-support-title")
464
+ }, liveSupportAttach.content.title), /*#__PURE__*/_react.default.createElement("div", {
465
+ className: "".concat(prefix, "-live-support-operate")
466
+ }, liveSupportAttach.content.liveSupportBtn));
467
+ };
468
+ var renderAfsFaq = function renderAfsFaq() {
469
+ var afsFaqAttach = attach;
470
+ return /*#__PURE__*/_react.default.createElement("div", {
471
+ className: "".concat(prefix, "-afs-faq")
472
+ }, /*#__PURE__*/_react.default.createElement("div", {
473
+ className: "".concat(prefix, "-afs-faq-title")
474
+ }, afsFaqAttach.content.title), /*#__PURE__*/_react.default.createElement("div", {
475
+ className: "".concat(prefix, "-afs-faq-list")
476
+ }, afsFaqAttach.content.qaList.map(function (item) {
477
+ return /*#__PURE__*/_react.default.createElement("div", {
478
+ className: "".concat(prefix, "-afs-faq-list-item"),
479
+ key: item.id
480
+ }, /*#__PURE__*/_react.default.createElement("span", {
481
+ className: "title"
482
+ }, item.question));
483
+ })));
484
+ };
485
+ var renderFeedback = function renderFeedback() {
486
+ var feedbackAttach = attach;
487
+ return /*#__PURE__*/_react.default.createElement("div", {
488
+ className: "".concat(prefix, "-text")
489
+ }, feedbackAttach.content.title);
490
+ };
445
491
  var renderOfflineSupport = function renderOfflineSupport() {
446
- var _attach$content13, _attach$content14;
492
+ var _attach$content14, _attach$content15;
447
493
  return /*#__PURE__*/_react.default.createElement("div", {
448
494
  className: "".concat(prefix, "-text")
449
- }, (_attach$content13 = attach.content) === null || _attach$content13 === void 0 ? void 0 : _attach$content13.supportDesc, ((_attach$content14 = attach.content) === null || _attach$content14 === void 0 ? void 0 : _attach$content14.contact) && /*#__PURE__*/_react.default.createElement("a", {
495
+ }, (_attach$content14 = attach.content) === null || _attach$content14 === void 0 ? void 0 : _attach$content14.supportDesc, ((_attach$content15 = attach.content) === null || _attach$content15 === void 0 ? void 0 : _attach$content15.contact) && /*#__PURE__*/_react.default.createElement("a", {
450
496
  href: "tel:".concat(attach.content.contact),
451
497
  rel: "noreferrer"
452
498
  }, attach.content.contact));
@@ -470,6 +516,12 @@ var ParseSession = function ParseSession(_ref) {
470
516
  return renderFaq();
471
517
  case _const.imMsgTypes.faqLink:
472
518
  return renderFaqLink();
519
+ case _const.imMsgTypes.afsFaq:
520
+ return renderAfsFaq();
521
+ case _const.imMsgTypes.feedback:
522
+ return renderFeedback();
523
+ case _const.imMsgTypes.liveSupport:
524
+ return renderLiveSupport();
473
525
  case _const.imMsgTypes.formCustomer:
474
526
  return renderFormCustomer();
475
527
  case _const.imMsgTypes.tip:
@@ -482,6 +534,8 @@ var ParseSession = function ParseSession(_ref) {
482
534
  return renderChartRecord();
483
535
  case _const.imMsgTypes.offlineSupport:
484
536
  return renderOfflineSupport();
537
+ case _const.imMsgTypes.orderGoods:
538
+ return renderOrderGoods();
485
539
  default:
486
540
  return '';
487
541
  }
@@ -7,9 +7,9 @@
7
7
 
8
8
  &-ref {
9
9
  padding: 12px;
10
- padding-bottom: 16px;
10
+ padding-bottom: 4px;
11
11
  &-body {
12
- border-left: 2px solid #c2d4ff;
12
+ border-left: 3px solid #eee;
13
13
  padding-left: 8px;
14
14
  }
15
15
  &-text-body {
@@ -211,6 +211,75 @@
211
211
  }
212
212
  }
213
213
  }
214
+
215
+ &-afs-faq {
216
+ padding: 16px;
217
+ width: 272px;
218
+ &-title {
219
+ font-size: 14px;
220
+ color: #333;
221
+ font-weight: 500;
222
+ }
223
+ &-list {
224
+ margin-top: 16px;
225
+ border-top: 1px solid #eee;
226
+ color: #2c6bff;
227
+ &-item {
228
+ cursor: default;
229
+ padding: 16px 0 0 0;
230
+ display: flex;
231
+ align-items: center;
232
+ transition: color 0.3s, transform 0.3s;
233
+ // &:active {
234
+ // color: #1a4d99;
235
+ // transform: scale(1.05);
236
+ // }
237
+ &::before {
238
+ content: '';
239
+ display: inline-block;
240
+ width: 6px;
241
+ height: 6px;
242
+ border-radius: 50%;
243
+ background-color: #2c6bff;
244
+ margin-right: 8px;
245
+ }
246
+ }
247
+ }
248
+ }
249
+ &-feedback {
250
+ padding: 16px;
251
+ width: 272px;
252
+ }
253
+ &-live-support {
254
+ padding: 16px;
255
+ width: 272px;
256
+ &-title {
257
+ font-size: 14px;
258
+ color: #333;
259
+ font-weight: 400;
260
+ }
261
+ &-operate {
262
+ cursor: default;
263
+ font-size: 14px;
264
+ color: #2c6bff;
265
+ font-weight: 400;
266
+ margin-top: 16px;
267
+ transition: color 0.3s, transform 0.3s;
268
+ // &:active {
269
+ // color: #1a4d99;
270
+ // transform: scale(1.05);
271
+ // }
272
+ &::before {
273
+ content: '';
274
+ display: inline-block;
275
+ width: 6px;
276
+ height: 6px;
277
+ border-radius: 50%;
278
+ background-color: #2c6bff;
279
+ margin-right: 8px;
280
+ }
281
+ }
282
+ }
214
283
  }
215
284
 
216
285
  .fx-preview-toolbar-wrapper {
@@ -25,6 +25,10 @@ interface ApiMethods {
25
25
  getContact: (params: {
26
26
  msgId?: string;
27
27
  }) => Promise<any>;
28
+ getOrderGoods: (data: {
29
+ orderSn?: any;
30
+ messageId?: string;
31
+ }) => Promise<any>;
28
32
  }
29
33
  export declare const apiCreate: (_env?: Env, token?: string) => ApiMethods;
30
34
  export {};
package/lib/api/index.js CHANGED
@@ -45,6 +45,10 @@ var apiCreate = exports.apiCreate = function apiCreate(_env, token) {
45
45
  getCSOrder: function getCSOrder(data) {
46
46
  return service.post('/ll/provider/message/order/get', data);
47
47
  },
48
+ // 获取订单商品信息
49
+ getOrderGoods: function getOrderGoods(data) {
50
+ return service.post('/ll/provider/message/after-sales-agent/goods/list', data);
51
+ },
48
52
  // 获取联系人信息(表单)
49
53
  getContact: function getContact(params) {
50
54
  return service.get('/ll/provider/message/contact/get', {
@@ -8,6 +8,9 @@ export declare const imMsgTypes: {
8
8
  link: string;
9
9
  file: string;
10
10
  faq: string;
11
+ afsFaq: string;
12
+ feedback: string;
13
+ liveSupport: string;
11
14
  faqLink: string;
12
15
  formCustomer: string;
13
16
  tip: string;
@@ -14,6 +14,12 @@ var imMsgTypes = exports.imMsgTypes = {
14
14
  link: 'link',
15
15
  file: 'file',
16
16
  faq: 'faq',
17
+ // 机器人自动回复问题
18
+ afsFaq: 'afs-faq',
19
+ // 请用户给快速反馈
20
+ feedback: 'feedback',
21
+ // 询问是否需要转
22
+ liveSupport: 'live-support',
17
23
  faqLink: 'faqLink',
18
24
  formCustomer: 'formCustomer',
19
25
  tip: 'tip',
package/lib/index.d.ts CHANGED
@@ -8,7 +8,10 @@ import './styles/index.less';
8
8
  * @description 代码由小鲤客服平台搬运简来.
9
9
  */
10
10
  export interface IMRecordProps {
11
- env?: Env;
11
+ /**
12
+ * 数据对应的环境
13
+ */
14
+ env: Env;
12
15
  token?: string;
13
16
  h5?: boolean;
14
17
  msgs: IMMessage[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fle-ui/plus-im-record",
3
- "version": "0.0.8-beta.3",
3
+ "version": "0.0.8-beta.5",
4
4
  "description": "@fle-ui/plus-im-record",
5
5
  "keywords": [
6
6
  "fle-ui",
@@ -45,5 +45,5 @@
45
45
  "peerDependencies": {
46
46
  "react": ">=17.0.0"
47
47
  },
48
- "gitHead": "8df4fb031a0dd746ad5e62f346ee7dd88278e297"
48
+ "gitHead": "6a72544262a0411add48ab2f4a50293aa49ae701"
49
49
  }