@fle-ui/plus-im-record 0.0.7-beta.0 → 0.0.8-beta.1
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/es/ChatMessageItem/index.d.ts +2 -4
- package/es/ChatMessageItem/index.less +1 -1
- package/es/ChatMessageList/index.d.ts +7 -5
- package/es/ChatMessageList/index.js +4 -2
- package/es/ChatMessageList/index.less +2 -1
- package/es/GoodsCard/index.d.ts +1 -0
- package/es/GoodsCard/index.js +4 -2
- package/es/GoodsCard/index.less +1 -1
- package/es/GoodsOrderCard/index.d.ts +2 -5
- package/es/GoodsOrderCard/index.js +1 -1
- package/es/GoodsOrderCard/index.less +1 -1
- package/es/ParseSession/AudioPlayer.d.ts +14 -0
- package/es/ParseSession/AudioPlayer.js +89 -0
- package/es/ParseSession/audioAndVideoTool.d.ts +3 -0
- package/es/ParseSession/audioAndVideoTool.js +21 -0
- package/es/ParseSession/index.d.ts +2 -8
- package/es/ParseSession/index.js +109 -71
- package/es/ParseSession/index.less +46 -1
- package/es/api/index.d.ts +2 -1
- package/es/audioAndVideoTool.d.ts +3 -0
- package/es/audioAndVideoTool.js +21 -0
- package/es/index.d.ts +12 -9
- package/es/index.js +15 -14
- package/lib/ChatMessageItem/index.d.ts +2 -4
- package/lib/ChatMessageItem/index.less +1 -1
- package/lib/ChatMessageList/index.d.ts +7 -5
- package/lib/ChatMessageList/index.js +4 -2
- package/lib/ChatMessageList/index.less +2 -1
- package/lib/GoodsCard/index.d.ts +1 -0
- package/lib/GoodsCard/index.js +4 -2
- package/lib/GoodsCard/index.less +1 -1
- package/lib/GoodsOrderCard/index.d.ts +2 -5
- package/lib/GoodsOrderCard/index.js +1 -1
- package/lib/GoodsOrderCard/index.less +1 -1
- package/lib/ParseSession/AudioPlayer.d.ts +14 -0
- package/lib/ParseSession/AudioPlayer.js +98 -0
- package/lib/ParseSession/audioAndVideoTool.d.ts +3 -0
- package/lib/ParseSession/audioAndVideoTool.js +27 -0
- package/lib/ParseSession/index.d.ts +2 -8
- package/lib/ParseSession/index.js +112 -74
- package/lib/ParseSession/index.less +46 -1
- package/lib/api/index.d.ts +2 -1
- package/lib/audioAndVideoTool.d.ts +3 -0
- package/lib/audioAndVideoTool.js +27 -0
- package/lib/index.d.ts +12 -9
- package/lib/index.js +14 -13
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IMMessage } from '../@types';
|
|
3
|
+
import { RecordSession } from '../ChatMessageList';
|
|
3
4
|
import './index.less';
|
|
4
5
|
declare const ChatMessageItem: React.FC<{
|
|
5
6
|
h5?: boolean;
|
|
@@ -9,9 +10,6 @@ declare const ChatMessageItem: React.FC<{
|
|
|
9
10
|
myAccount?: string;
|
|
10
11
|
accountInfo: any;
|
|
11
12
|
isSessionEnd: boolean;
|
|
12
|
-
recordSession?:
|
|
13
|
-
relationId: string | number;
|
|
14
|
-
accid: string;
|
|
15
|
-
};
|
|
13
|
+
recordSession?: RecordSession;
|
|
16
14
|
}>;
|
|
17
15
|
export default ChatMessageItem;
|
|
@@ -3,12 +3,18 @@ import { IMMessage } from '../@types';
|
|
|
3
3
|
import './index.less';
|
|
4
4
|
declare const LOADING_STATUS: any;
|
|
5
5
|
export type LoadingStatus = keyof typeof LOADING_STATUS | undefined;
|
|
6
|
+
export interface RecordSession {
|
|
7
|
+
relationId?: string | number;
|
|
8
|
+
accid?: string;
|
|
9
|
+
relationType?: number;
|
|
10
|
+
}
|
|
6
11
|
export interface ChatMessageListProps {
|
|
7
12
|
h5?: boolean;
|
|
8
13
|
msgs: IMMessage[];
|
|
9
14
|
myAccount?: string;
|
|
10
15
|
loadingStarus?: LoadingStatus;
|
|
11
16
|
onScrollTop?: UIEventHandler<HTMLDivElement>;
|
|
17
|
+
onScrollBottom?: UIEventHandler<HTMLDivElement>;
|
|
12
18
|
accountsMap?: Record<string, {
|
|
13
19
|
accid: string;
|
|
14
20
|
nickname: string;
|
|
@@ -16,11 +22,7 @@ export interface ChatMessageListProps {
|
|
|
16
22
|
}>;
|
|
17
23
|
style?: React.CSSProperties;
|
|
18
24
|
isSessionEnd?: boolean;
|
|
19
|
-
recordSession?:
|
|
20
|
-
relationId: string | number;
|
|
21
|
-
accid: string;
|
|
22
|
-
relationType?: number;
|
|
23
|
-
};
|
|
25
|
+
recordSession?: RecordSession;
|
|
24
26
|
}
|
|
25
27
|
declare const ChatMessageList: React.ForwardRefExoticComponent<ChatMessageListProps & React.RefAttributes<HTMLDivElement>>;
|
|
26
28
|
export default ChatMessageList;
|
|
@@ -10,8 +10,8 @@ var LOAD_LIMIT = 15;
|
|
|
10
10
|
var ChatMessageList = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
11
11
|
var h5 = _ref.h5,
|
|
12
12
|
msgs = _ref.msgs,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
onScrollTop = _ref.onScrollTop,
|
|
14
|
+
onScrollBottom = _ref.onScrollBottom,
|
|
15
15
|
_ref$loadingStarus = _ref.loadingStarus,
|
|
16
16
|
loadingStarus = _ref$loadingStarus === void 0 ? '' : _ref$loadingStarus,
|
|
17
17
|
myAccount = _ref.myAccount,
|
|
@@ -25,8 +25,10 @@ var ChatMessageList = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
25
25
|
var onScrollHandler = debounce(function (e) {
|
|
26
26
|
var scrollElRef = ref;
|
|
27
27
|
if (!(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current)) return;
|
|
28
|
+
var isBottom = scrollElRef.current.scrollTop >= scrollElRef.current.scrollHeight - scrollElRef.current.clientHeight - 20;
|
|
28
29
|
var isTop = scrollElRef.current.scrollTop < 20;
|
|
29
30
|
isTop && (onScrollTop === null || onScrollTop === void 0 ? void 0 : onScrollTop(e));
|
|
31
|
+
isBottom && (onScrollBottom === null || onScrollBottom === void 0 ? void 0 : onScrollBottom(e));
|
|
30
32
|
}, 200);
|
|
31
33
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
34
|
className: prefixCls,
|
package/es/GoodsCard/index.d.ts
CHANGED
package/es/GoodsCard/index.js
CHANGED
|
@@ -16,7 +16,8 @@ var OrderCard = function OrderCard(props) {
|
|
|
16
16
|
content = props.content;
|
|
17
17
|
var productId = content.productId,
|
|
18
18
|
relationId = content.relationId,
|
|
19
|
-
relationType = content.relationType
|
|
19
|
+
relationType = content.relationType,
|
|
20
|
+
orderProductId = content.orderProductId;
|
|
20
21
|
var _useState = useState({}),
|
|
21
22
|
_useState2 = _slicedToArray(_useState, 2),
|
|
22
23
|
data = _useState2[0],
|
|
@@ -28,7 +29,8 @@ var OrderCard = function OrderCard(props) {
|
|
|
28
29
|
api.getProductById({
|
|
29
30
|
productId: productId,
|
|
30
31
|
relationId: relationId,
|
|
31
|
-
relationType: relationType
|
|
32
|
+
relationType: relationType,
|
|
33
|
+
orderProductId: orderProductId
|
|
32
34
|
}).then(function (_ref) {
|
|
33
35
|
var data = _ref.data;
|
|
34
36
|
setData(data || {});
|
package/es/GoodsCard/index.less
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { RecordSession } from '../ChatMessageList';
|
|
2
3
|
import './index.less';
|
|
3
4
|
export declare function fitUrl(url: string): string;
|
|
4
5
|
declare const GoodsOrderCard: React.FC<{
|
|
@@ -8,10 +9,6 @@ declare const GoodsOrderCard: React.FC<{
|
|
|
8
9
|
onClose?: Function;
|
|
9
10
|
orderSn?: any;
|
|
10
11
|
orderId?: any;
|
|
11
|
-
recordSession?:
|
|
12
|
-
relationId: string | number;
|
|
13
|
-
accid: string;
|
|
14
|
-
relationType?: number;
|
|
15
|
-
};
|
|
12
|
+
recordSession?: RecordSession;
|
|
16
13
|
}>;
|
|
17
14
|
export default GoodsOrderCard;
|
|
@@ -62,7 +62,7 @@ var GoodsOrderCard = function GoodsOrderCard(props) {
|
|
|
62
62
|
data = _useState2[0],
|
|
63
63
|
setData = _useState2[1];
|
|
64
64
|
useEffect(function () {
|
|
65
|
-
if (
|
|
65
|
+
if (orderId || orderSn) {
|
|
66
66
|
api.getCSOrder({
|
|
67
67
|
orderSn: orderSn,
|
|
68
68
|
orderId: Number(orderId) || orderId,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AudioPlayerProps {
|
|
3
|
+
prefix: string;
|
|
4
|
+
msg: {
|
|
5
|
+
idClient: string;
|
|
6
|
+
flow: string;
|
|
7
|
+
};
|
|
8
|
+
url: string;
|
|
9
|
+
dur: number;
|
|
10
|
+
text?: string;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
declare const AudioPlayer: React.FC<AudioPlayerProps>;
|
|
14
|
+
export default AudioPlayer;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { useState, useRef } from 'react';
|
|
14
|
+
import Icon from '../Icon';
|
|
15
|
+
var AudioPlayer = function AudioPlayer(_ref) {
|
|
16
|
+
var prefix = _ref.prefix,
|
|
17
|
+
msg = _ref.msg,
|
|
18
|
+
url = _ref.url,
|
|
19
|
+
dur = _ref.dur,
|
|
20
|
+
text = _ref.text,
|
|
21
|
+
_ref$style = _ref.style,
|
|
22
|
+
style = _ref$style === void 0 ? {} : _ref$style;
|
|
23
|
+
var audioRef = useRef(null);
|
|
24
|
+
var _useState = useState(false),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
animationFlag = _useState2[0],
|
|
27
|
+
setAnimationFlag = _useState2[1];
|
|
28
|
+
var pauseAllAudio = function pauseAllAudio() {
|
|
29
|
+
var audio = document.getElementById('fxMessageAudio');
|
|
30
|
+
audio === null || audio === void 0 ? void 0 : audio.pause();
|
|
31
|
+
return audio;
|
|
32
|
+
};
|
|
33
|
+
var pauseAllVideo = function pauseAllVideo() {
|
|
34
|
+
var videoElements = document.getElementsByTagName('video');
|
|
35
|
+
for (var i = 0; i < videoElements.length; i++) {
|
|
36
|
+
if (videoElements[i].id.startsWith('fxMessageVideo-')) {
|
|
37
|
+
videoElements[i].pause();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var handleAudioClick = function handleAudioClick() {
|
|
42
|
+
var _audioRef$current;
|
|
43
|
+
pauseAllVideo();
|
|
44
|
+
var oldAudio = pauseAllAudio();
|
|
45
|
+
var msgId = oldAudio === null || oldAudio === void 0 ? void 0 : oldAudio.getAttribute('msgId');
|
|
46
|
+
if (msgId === msg.idClient) {
|
|
47
|
+
setAnimationFlag(false);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
var audio = new Audio(url);
|
|
51
|
+
audio.id = 'fxMessageAudio';
|
|
52
|
+
audio.setAttribute('msgId', msg.idClient);
|
|
53
|
+
audio.play();
|
|
54
|
+
(_audioRef$current = audioRef.current) === null || _audioRef$current === void 0 ? void 0 : _audioRef$current.appendChild(audio);
|
|
55
|
+
audio.addEventListener('ended', function () {
|
|
56
|
+
var _audio$parentNode;
|
|
57
|
+
setAnimationFlag(false);
|
|
58
|
+
(_audio$parentNode = audio.parentNode) === null || _audio$parentNode === void 0 ? void 0 : _audio$parentNode.removeChild(audio);
|
|
59
|
+
});
|
|
60
|
+
audio.addEventListener('pause', function () {
|
|
61
|
+
var _audio$parentNode2;
|
|
62
|
+
setAnimationFlag(false);
|
|
63
|
+
(_audio$parentNode2 = audio.parentNode) === null || _audio$parentNode2 === void 0 ? void 0 : _audio$parentNode2.removeChild(audio);
|
|
64
|
+
});
|
|
65
|
+
setAnimationFlag(true);
|
|
66
|
+
};
|
|
67
|
+
var duration = Math.floor(dur) || 0;
|
|
68
|
+
var durations = {
|
|
69
|
+
mm: Math.floor(duration / 60),
|
|
70
|
+
ss: duration % 60
|
|
71
|
+
};
|
|
72
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "".concat(prefix, "-audio"),
|
|
74
|
+
ref: audioRef,
|
|
75
|
+
style: _objectSpread({}, style)
|
|
76
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: msg.flow === 'in' ? "".concat(prefix, "-audio-in") : "".concat(prefix, "-audio-out"),
|
|
78
|
+
onClick: handleAudioClick
|
|
79
|
+
}, /*#__PURE__*/React.createElement("span", null, ' ', "".concat(durations.mm > 0 ? "".concat(durations.mm, "'") : '', " ").concat(durations.ss, "\"")), /*#__PURE__*/React.createElement("span", {
|
|
80
|
+
className: "".concat(prefix, "-audio-icon")
|
|
81
|
+
}, animationFlag ? /*#__PURE__*/React.createElement("img", {
|
|
82
|
+
src: "https://qa-oss.elebuys.com/tmpdir/202401152050070000640984.gif"
|
|
83
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
84
|
+
type: "icon-a-yuyin2"
|
|
85
|
+
}))), text && /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: "".concat(prefix, "-audio-audio2text")
|
|
87
|
+
}, text));
|
|
88
|
+
};
|
|
89
|
+
export default AudioPlayer;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export var pauseAllAudio = function pauseAllAudio() {
|
|
2
|
+
var audio = document.getElementById('fxMessageAudio');
|
|
3
|
+
audio === null || audio === void 0 ? void 0 : audio.pause();
|
|
4
|
+
return audio;
|
|
5
|
+
};
|
|
6
|
+
export var pauseOtherVideo = function pauseOtherVideo(idClient) {
|
|
7
|
+
var videoElements = document.getElementsByTagName('video');
|
|
8
|
+
for (var i = 0; i < videoElements.length; i++) {
|
|
9
|
+
if (videoElements[i].id !== "fxMessageVideo-".concat(idClient)) {
|
|
10
|
+
videoElements[i].pause();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export var pauseAllVideo = function pauseAllVideo() {
|
|
15
|
+
var videoElements = document.getElementsByTagName('video');
|
|
16
|
+
for (var i = 0; i < videoElements.length; i++) {
|
|
17
|
+
if (videoElements[i].id.startsWith('fxMessageVideo-')) {
|
|
18
|
+
videoElements[i].pause();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IMMessage } from '../@types';
|
|
3
|
+
import { RecordSession } from '../ChatMessageList';
|
|
3
4
|
import './index.less';
|
|
4
5
|
export interface IParseSessionProps {
|
|
5
6
|
prefix?: string;
|
|
@@ -8,14 +9,7 @@ export interface IParseSessionProps {
|
|
|
8
9
|
msg: IMMessage;
|
|
9
10
|
isSessionEnd?: boolean;
|
|
10
11
|
onChartHistoryClick?: Function;
|
|
11
|
-
recordSession?:
|
|
12
|
-
relationId: string | number;
|
|
13
|
-
accid: string;
|
|
14
|
-
relationType?: number;
|
|
15
|
-
};
|
|
12
|
+
recordSession?: RecordSession;
|
|
16
13
|
}
|
|
17
|
-
export declare const pauseAllAudio: () => HTMLAudioElement;
|
|
18
|
-
export declare const pauseOtherVideo: (idClient: string) => void;
|
|
19
|
-
export declare const pauseAllVideo: () => void;
|
|
20
14
|
declare const ParseSession: React.FC<IParseSessionProps>;
|
|
21
15
|
export default ParseSession;
|
package/es/ParseSession/index.js
CHANGED
|
@@ -27,28 +27,9 @@ import Icon from '../Icon';
|
|
|
27
27
|
import GoodsCard from '../GoodsCard';
|
|
28
28
|
import GoodsOrderCard from '../GoodsOrderCard';
|
|
29
29
|
import { ImContext } from '..';
|
|
30
|
+
import { pauseAllAudio, pauseOtherVideo } from '../audioAndVideoTool';
|
|
31
|
+
import AudioPlayer from './AudioPlayer';
|
|
30
32
|
import './index.less';
|
|
31
|
-
export var pauseAllAudio = function pauseAllAudio() {
|
|
32
|
-
var audio = document.getElementById('fxMessageAudio');
|
|
33
|
-
audio === null || audio === void 0 ? void 0 : audio.pause();
|
|
34
|
-
return audio;
|
|
35
|
-
};
|
|
36
|
-
export var pauseOtherVideo = function pauseOtherVideo(idClient) {
|
|
37
|
-
var videoElements = document.getElementsByTagName('video');
|
|
38
|
-
for (var i = 0; i < videoElements.length; i++) {
|
|
39
|
-
if (videoElements[i].id !== "fxMessageVideo-".concat(idClient)) {
|
|
40
|
-
videoElements[i].pause();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
export var pauseAllVideo = function pauseAllVideo() {
|
|
45
|
-
var videoElements = document.getElementsByTagName('video');
|
|
46
|
-
for (var i = 0; i < videoElements.length; i++) {
|
|
47
|
-
if (videoElements[i].id.startsWith('fxMessageVideo-')) {
|
|
48
|
-
videoElements[i].pause();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
33
|
//
|
|
53
34
|
var ParseSession = function ParseSession(_ref) {
|
|
54
35
|
var prefix = _ref.prefix,
|
|
@@ -61,17 +42,15 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
61
42
|
var _useContext = useContext(ImContext),
|
|
62
43
|
api = _useContext.api;
|
|
63
44
|
var formRef = useRef();
|
|
64
|
-
var
|
|
65
|
-
var _useState = useState(false),
|
|
45
|
+
var _useState = useState(),
|
|
66
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var _useState3 = useState(),
|
|
70
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
71
|
-
contactInfo = _useState4[0],
|
|
72
|
-
setContactInfo = _useState4[1];
|
|
47
|
+
contactInfo = _useState2[0],
|
|
48
|
+
setContactInfo = _useState2[1];
|
|
73
49
|
var attach = msg.attach || {};
|
|
74
50
|
var renderText = function renderText(preset) {
|
|
51
|
+
if (attach.refMsg) {
|
|
52
|
+
return renderRefMsg();
|
|
53
|
+
}
|
|
75
54
|
var text = reactStringReplace(attach.content, /(https?:\/\/\S+)/gi, function (match) {
|
|
76
55
|
return /*#__PURE__*/React.createElement("a", {
|
|
77
56
|
key: msg.idClient,
|
|
@@ -99,6 +78,101 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
99
78
|
className: "".concat(prefix, "-text")
|
|
100
79
|
}, preset || text.map(renderKeywordText));
|
|
101
80
|
};
|
|
81
|
+
var renderRefMsg = function renderRefMsg() {
|
|
82
|
+
var refContent = attach.refMsg.type !== 'text' ? JSON.parse(attach.refMsg.content) : attach.refMsg.content;
|
|
83
|
+
var nickname = attach.refMsg.nickname;
|
|
84
|
+
var content = attach.content;
|
|
85
|
+
var renderers = {
|
|
86
|
+
image: function image() {
|
|
87
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "".concat(prefix, "-ref-img-body")
|
|
89
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
90
|
+
src: refContent.url,
|
|
91
|
+
alt: ""
|
|
92
|
+
}));
|
|
93
|
+
},
|
|
94
|
+
video: function video() {
|
|
95
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: "".concat(prefix, "-ref-video-body")
|
|
97
|
+
}, /*#__PURE__*/React.createElement("video", {
|
|
98
|
+
key: msg.idServer,
|
|
99
|
+
playsInline: true,
|
|
100
|
+
preload: "auto",
|
|
101
|
+
controls: true,
|
|
102
|
+
autoPlay: false,
|
|
103
|
+
onLoadedData: function onLoadedData(event) {
|
|
104
|
+
return event.currentTarget.pause();
|
|
105
|
+
}
|
|
106
|
+
}, /*#__PURE__*/React.createElement("source", {
|
|
107
|
+
src: refContent.url,
|
|
108
|
+
type: "video/mp4"
|
|
109
|
+
}), "Your browser does not support the video element."));
|
|
110
|
+
},
|
|
111
|
+
audio: function audio() {
|
|
112
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
113
|
+
className: "".concat(prefix, "-ref-audio-body")
|
|
114
|
+
}, /*#__PURE__*/React.createElement(AudioPlayer, {
|
|
115
|
+
style: {
|
|
116
|
+
backgroundColor: '#fff',
|
|
117
|
+
borderRadius: 4,
|
|
118
|
+
width: 80
|
|
119
|
+
},
|
|
120
|
+
prefix: prefix || '',
|
|
121
|
+
msg: msg,
|
|
122
|
+
url: refContent.url,
|
|
123
|
+
dur: refContent.dur,
|
|
124
|
+
text: refContent.text
|
|
125
|
+
}));
|
|
126
|
+
},
|
|
127
|
+
file: function file() {
|
|
128
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: "".concat(prefix, "-ref-file")
|
|
130
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Icon, {
|
|
131
|
+
className: "".concat(prefix, "-file-icon"),
|
|
132
|
+
type: 'icon-wenjian',
|
|
133
|
+
style: {
|
|
134
|
+
fontSize: 16
|
|
135
|
+
}
|
|
136
|
+
}), /*#__PURE__*/React.createElement("a", {
|
|
137
|
+
style: {
|
|
138
|
+
marginLeft: 8
|
|
139
|
+
},
|
|
140
|
+
download: refContent.fileName,
|
|
141
|
+
href: addUrlSearch(refContent.url, "download=".concat(refContent.fileName)),
|
|
142
|
+
target: "_blank",
|
|
143
|
+
rel: "noreferrer"
|
|
144
|
+
}, refContent.fileName)));
|
|
145
|
+
},
|
|
146
|
+
product: function product() {
|
|
147
|
+
return /*#__PURE__*/React.createElement(GoodsCard, {
|
|
148
|
+
prefix: prefix,
|
|
149
|
+
content: refContent
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
order: function order() {
|
|
153
|
+
return /*#__PURE__*/React.createElement(GoodsOrderCard, {
|
|
154
|
+
prefix: prefix,
|
|
155
|
+
recordSession: recordSession,
|
|
156
|
+
orderSn: refContent.orderSn,
|
|
157
|
+
orderId: refContent.orderId
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
text: function text() {
|
|
161
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
162
|
+
className: "".concat(prefix, "-ref-text-body")
|
|
163
|
+
}, refContent);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
className: "".concat(prefix, "-ref")
|
|
168
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
169
|
+
className: "".concat(prefix, "-ref-body")
|
|
170
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
171
|
+
className: "".concat(prefix, "-ref-nickname")
|
|
172
|
+
}, nickname, ":"), renderers[attach.refMsg.type]()), /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
className: "".concat(prefix, "-text")
|
|
174
|
+
}, content));
|
|
175
|
+
};
|
|
102
176
|
var renderImage = function renderImage() {
|
|
103
177
|
return /*#__PURE__*/React.createElement(_Image, {
|
|
104
178
|
loading: "lazy",
|
|
@@ -259,48 +333,12 @@ var ParseSession = function ParseSession(_ref) {
|
|
|
259
333
|
var renderAudio = function renderAudio() {
|
|
260
334
|
var flow = msg.flow;
|
|
261
335
|
var duration = Math.floor(attach.content.dur) || 0;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
ref: audioRef
|
|
269
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
270
|
-
className: flow === 'in' ? "".concat(prefix, "-audio-in") : "".concat(prefix, "-audio-out"),
|
|
271
|
-
onClick: function onClick() {
|
|
272
|
-
var _audioRef$current;
|
|
273
|
-
pauseAllVideo();
|
|
274
|
-
var oldAudio = pauseAllAudio();
|
|
275
|
-
var msgId = oldAudio === null || oldAudio === void 0 ? void 0 : oldAudio.getAttribute('msgId');
|
|
276
|
-
if (msgId === msg.idClient) {
|
|
277
|
-
setAnimationFlag(false);
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
var audio = new Audio(attach.content.url);
|
|
281
|
-
audio.id = 'fxMessageAudio';
|
|
282
|
-
audio.setAttribute('msgId', msg.idClient);
|
|
283
|
-
audio.play();
|
|
284
|
-
(_audioRef$current = audioRef.current) === null || _audioRef$current === void 0 ? void 0 : _audioRef$current.appendChild(audio);
|
|
285
|
-
audio.addEventListener('ended', function () {
|
|
286
|
-
var _audio$parentNode;
|
|
287
|
-
setAnimationFlag(false);
|
|
288
|
-
(_audio$parentNode = audio.parentNode) === null || _audio$parentNode === void 0 ? void 0 : _audio$parentNode.removeChild(audio);
|
|
289
|
-
});
|
|
290
|
-
audio.addEventListener('pause', function () {
|
|
291
|
-
var _audio$parentNode2;
|
|
292
|
-
setAnimationFlag(false);
|
|
293
|
-
(_audio$parentNode2 = audio.parentNode) === null || _audio$parentNode2 === void 0 ? void 0 : _audio$parentNode2.removeChild(audio);
|
|
294
|
-
});
|
|
295
|
-
setAnimationFlag(true);
|
|
296
|
-
}
|
|
297
|
-
}, /*#__PURE__*/React.createElement("span", null, "".concat(durations.mm > 0 ? "".concat(durations.mm, "'") : '', " ").concat(durations.ss, "\"")), /*#__PURE__*/React.createElement("span", {
|
|
298
|
-
className: "".concat(prefix, "-audio-icon")
|
|
299
|
-
}, animationFlag ? /*#__PURE__*/React.createElement("img", {
|
|
300
|
-
src: "https://qa-oss.elebuys.com/tmpdir/202401152050070000640984.gif"
|
|
301
|
-
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
302
|
-
type: "icon-a-yuyin2"
|
|
303
|
-
}))));
|
|
336
|
+
return /*#__PURE__*/React.createElement(AudioPlayer, {
|
|
337
|
+
prefix: prefix || '',
|
|
338
|
+
msg: msg,
|
|
339
|
+
url: attach.content.url,
|
|
340
|
+
dur: duration
|
|
341
|
+
});
|
|
304
342
|
};
|
|
305
343
|
var renderVideo = function renderVideo() {
|
|
306
344
|
var _attach$content4;
|
|
@@ -5,6 +5,50 @@
|
|
|
5
5
|
padding: 8px;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
&-ref {
|
|
9
|
+
padding: 12px;
|
|
10
|
+
padding-bottom: 16px;
|
|
11
|
+
&-body {
|
|
12
|
+
border-left: 2px solid #c2d4ff;
|
|
13
|
+
padding-left: 8px;
|
|
14
|
+
}
|
|
15
|
+
&-text-body {
|
|
16
|
+
// width: 328px;
|
|
17
|
+
max-height: 115px;
|
|
18
|
+
font-size: 12px;
|
|
19
|
+
color: #777;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
display: -webkit-box;
|
|
22
|
+
word-break: break-all;
|
|
23
|
+
-webkit-line-clamp: 3;
|
|
24
|
+
-webkit-box-orient: vertical;
|
|
25
|
+
text-overflow: ellipsis;
|
|
26
|
+
}
|
|
27
|
+
&-img-body {
|
|
28
|
+
width: 170px;
|
|
29
|
+
height: 115px;
|
|
30
|
+
img {
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
object-fit: contain;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
&-video-body {
|
|
37
|
+
width: 170px;
|
|
38
|
+
height: 115px;
|
|
39
|
+
video {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
object-fit: contain;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
&-nickname {
|
|
46
|
+
font-size: 12px;
|
|
47
|
+
color: #777;
|
|
48
|
+
font-weight: 600;
|
|
49
|
+
margin-bottom: 8px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
8
52
|
&-image {
|
|
9
53
|
// padding: 4px;
|
|
10
54
|
border-radius: 6px;
|
|
@@ -26,7 +70,8 @@
|
|
|
26
70
|
|
|
27
71
|
&-in,
|
|
28
72
|
&-out {
|
|
29
|
-
width: 90px;
|
|
73
|
+
max-width: 90px;
|
|
74
|
+
min-width: 64px;
|
|
30
75
|
display: flex;
|
|
31
76
|
justify-content: space-between;
|
|
32
77
|
cursor: pointer;
|
package/es/api/index.d.ts
CHANGED
|
@@ -13,11 +13,12 @@ interface ApiMethods {
|
|
|
13
13
|
productId: number;
|
|
14
14
|
relationId: string | number;
|
|
15
15
|
relationType: string | number;
|
|
16
|
+
orderProductId?: number;
|
|
16
17
|
}) => Promise<any>;
|
|
17
18
|
getCSOrder: (data: {
|
|
18
19
|
orderSn: number | string;
|
|
19
20
|
orderId: any;
|
|
20
|
-
accid
|
|
21
|
+
accid?: string;
|
|
21
22
|
relationId?: string | number;
|
|
22
23
|
relationType?: number;
|
|
23
24
|
}) => Promise<any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export var pauseAllAudio = function pauseAllAudio() {
|
|
2
|
+
var audio = document.getElementById('fxMessageAudio');
|
|
3
|
+
audio === null || audio === void 0 ? void 0 : audio.pause();
|
|
4
|
+
return audio;
|
|
5
|
+
};
|
|
6
|
+
export var pauseOtherVideo = function pauseOtherVideo(idClient) {
|
|
7
|
+
var videoElements = document.getElementsByTagName('video');
|
|
8
|
+
for (var i = 0; i < videoElements.length; i++) {
|
|
9
|
+
if (videoElements[i].id !== "fxMessageVideo-".concat(idClient)) {
|
|
10
|
+
videoElements[i].pause();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export var pauseAllVideo = function pauseAllVideo() {
|
|
15
|
+
var videoElements = document.getElementsByTagName('video');
|
|
16
|
+
for (var i = 0; i < videoElements.length; i++) {
|
|
17
|
+
if (videoElements[i].id.startsWith('fxMessageVideo-')) {
|
|
18
|
+
videoElements[i].pause();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|