@fle-ui/plus-im-record 0.0.3-beta.1 → 0.0.7-beta.0
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/README.md +25 -25
- package/es/ChatMessageItem/index.d.ts +4 -2
- package/es/ChatMessageList/index.d.ts +5 -7
- package/es/ChatMessageList/index.js +2 -4
- package/es/ChatMessageList/index.less +1 -2
- package/es/GoodsCard/index.d.ts +0 -1
- package/es/GoodsCard/index.js +2 -4
- package/es/GoodsOrderCard/index.d.ts +5 -2
- package/es/GoodsOrderCard/index.js +1 -1
- package/es/ParseSession/index.d.ts +5 -2
- package/es/api/index.d.ts +1 -2
- package/es/index.d.ts +9 -12
- package/es/index.js +14 -15
- package/lib/ChatMessageItem/index.d.ts +4 -2
- package/lib/ChatMessageList/index.d.ts +5 -7
- package/lib/ChatMessageList/index.js +2 -4
- package/lib/ChatMessageList/index.less +1 -2
- package/lib/GoodsCard/index.d.ts +0 -1
- package/lib/GoodsCard/index.js +2 -4
- package/lib/GoodsOrderCard/index.d.ts +5 -2
- package/lib/GoodsOrderCard/index.js +1 -1
- package/lib/ParseSession/index.d.ts +5 -2
- package/lib/api/index.d.ts +1 -2
- package/lib/index.d.ts +9 -12
- package/lib/index.js +13 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# @fle-ui/plus-im-record
|
|
2
|
-
|
|
3
|
-
> @fle-ui/plus-im-record
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
Using npm:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
$ npm install --save @fle-ui/plus-im-record
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
or using yarn:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
|
|
18
|
-
$ yarn add @fle-ui/plus-im-record
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## 使用
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
import ImRecord from '@fle-ui/plus-im-record';
|
|
25
|
-
```
|
|
1
|
+
# @fle-ui/plus-im-record
|
|
2
|
+
|
|
3
|
+
> @fle-ui/plus-im-record
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Using npm:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
$ npm install --save @fle-ui/plus-im-record
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
or using yarn:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
|
|
18
|
+
$ yarn add @fle-ui/plus-im-record
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 使用
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import ImRecord from '@fle-ui/plus-im-record';
|
|
25
|
+
```
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IMMessage } from '../@types';
|
|
3
|
-
import { RecordSession } from '../ChatMessageList';
|
|
4
3
|
import './index.less';
|
|
5
4
|
declare const ChatMessageItem: React.FC<{
|
|
6
5
|
h5?: boolean;
|
|
@@ -10,6 +9,9 @@ declare const ChatMessageItem: React.FC<{
|
|
|
10
9
|
myAccount?: string;
|
|
11
10
|
accountInfo: any;
|
|
12
11
|
isSessionEnd: boolean;
|
|
13
|
-
recordSession?:
|
|
12
|
+
recordSession?: {
|
|
13
|
+
relationId: string | number;
|
|
14
|
+
accid: string;
|
|
15
|
+
};
|
|
14
16
|
}>;
|
|
15
17
|
export default ChatMessageItem;
|
|
@@ -3,18 +3,12 @@ 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
|
-
}
|
|
11
6
|
export interface ChatMessageListProps {
|
|
12
7
|
h5?: boolean;
|
|
13
8
|
msgs: IMMessage[];
|
|
14
9
|
myAccount?: string;
|
|
15
10
|
loadingStarus?: LoadingStatus;
|
|
16
11
|
onScrollTop?: UIEventHandler<HTMLDivElement>;
|
|
17
|
-
onScrollBottom?: UIEventHandler<HTMLDivElement>;
|
|
18
12
|
accountsMap?: Record<string, {
|
|
19
13
|
accid: string;
|
|
20
14
|
nickname: string;
|
|
@@ -22,7 +16,11 @@ export interface ChatMessageListProps {
|
|
|
22
16
|
}>;
|
|
23
17
|
style?: React.CSSProperties;
|
|
24
18
|
isSessionEnd?: boolean;
|
|
25
|
-
recordSession?:
|
|
19
|
+
recordSession?: {
|
|
20
|
+
relationId: string | number;
|
|
21
|
+
accid: string;
|
|
22
|
+
relationType?: number;
|
|
23
|
+
};
|
|
26
24
|
}
|
|
27
25
|
declare const ChatMessageList: React.ForwardRefExoticComponent<ChatMessageListProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
26
|
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
|
-
onScrollTop = _ref.onScrollTop,
|
|
14
|
-
|
|
13
|
+
_ref$onScrollTop = _ref.onScrollTop,
|
|
14
|
+
onScrollTop = _ref$onScrollTop === void 0 ? function () {} : _ref$onScrollTop,
|
|
15
15
|
_ref$loadingStarus = _ref.loadingStarus,
|
|
16
16
|
loadingStarus = _ref$loadingStarus === void 0 ? '' : _ref$loadingStarus,
|
|
17
17
|
myAccount = _ref.myAccount,
|
|
@@ -25,10 +25,8 @@ 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;
|
|
29
28
|
var isTop = scrollElRef.current.scrollTop < 20;
|
|
30
29
|
isTop && (onScrollTop === null || onScrollTop === void 0 ? void 0 : onScrollTop(e));
|
|
31
|
-
isBottom && (onScrollBottom === null || onScrollBottom === void 0 ? void 0 : onScrollBottom(e));
|
|
32
30
|
}, 200);
|
|
33
31
|
return /*#__PURE__*/React.createElement("div", {
|
|
34
32
|
className: prefixCls,
|
package/es/GoodsCard/index.d.ts
CHANGED
package/es/GoodsCard/index.js
CHANGED
|
@@ -16,8 +16,7 @@ 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
|
|
20
|
-
orderProductId = content.orderProductId;
|
|
19
|
+
relationType = content.relationType;
|
|
21
20
|
var _useState = useState({}),
|
|
22
21
|
_useState2 = _slicedToArray(_useState, 2),
|
|
23
22
|
data = _useState2[0],
|
|
@@ -29,8 +28,7 @@ var OrderCard = function OrderCard(props) {
|
|
|
29
28
|
api.getProductById({
|
|
30
29
|
productId: productId,
|
|
31
30
|
relationId: relationId,
|
|
32
|
-
relationType: relationType
|
|
33
|
-
orderProductId: orderProductId
|
|
31
|
+
relationType: relationType
|
|
34
32
|
}).then(function (_ref) {
|
|
35
33
|
var data = _ref.data;
|
|
36
34
|
setData(data || {});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RecordSession } from '../ChatMessageList';
|
|
3
2
|
import './index.less';
|
|
4
3
|
export declare function fitUrl(url: string): string;
|
|
5
4
|
declare const GoodsOrderCard: React.FC<{
|
|
@@ -9,6 +8,10 @@ declare const GoodsOrderCard: React.FC<{
|
|
|
9
8
|
onClose?: Function;
|
|
10
9
|
orderSn?: any;
|
|
11
10
|
orderId?: any;
|
|
12
|
-
recordSession?:
|
|
11
|
+
recordSession?: {
|
|
12
|
+
relationId: string | number;
|
|
13
|
+
accid: string;
|
|
14
|
+
relationType?: number;
|
|
15
|
+
};
|
|
13
16
|
}>;
|
|
14
17
|
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 (orderId || orderSn) {
|
|
65
|
+
if ((orderId || orderSn) && relationId && accid) {
|
|
66
66
|
api.getCSOrder({
|
|
67
67
|
orderSn: orderSn,
|
|
68
68
|
orderId: Number(orderId) || orderId,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IMMessage } from '../@types';
|
|
3
|
-
import { RecordSession } from '../ChatMessageList';
|
|
4
3
|
import './index.less';
|
|
5
4
|
export interface IParseSessionProps {
|
|
6
5
|
prefix?: string;
|
|
@@ -9,7 +8,11 @@ export interface IParseSessionProps {
|
|
|
9
8
|
msg: IMMessage;
|
|
10
9
|
isSessionEnd?: boolean;
|
|
11
10
|
onChartHistoryClick?: Function;
|
|
12
|
-
recordSession?:
|
|
11
|
+
recordSession?: {
|
|
12
|
+
relationId: string | number;
|
|
13
|
+
accid: string;
|
|
14
|
+
relationType?: number;
|
|
15
|
+
};
|
|
13
16
|
}
|
|
14
17
|
export declare const pauseAllAudio: () => HTMLAudioElement;
|
|
15
18
|
export declare const pauseOtherVideo: (idClient: string) => void;
|
package/es/api/index.d.ts
CHANGED
|
@@ -13,12 +13,11 @@ interface ApiMethods {
|
|
|
13
13
|
productId: number;
|
|
14
14
|
relationId: string | number;
|
|
15
15
|
relationType: string | number;
|
|
16
|
-
orderProductId?: number;
|
|
17
16
|
}) => Promise<any>;
|
|
18
17
|
getCSOrder: (data: {
|
|
19
18
|
orderSn: number | string;
|
|
20
19
|
orderId: any;
|
|
21
|
-
accid
|
|
20
|
+
accid: string;
|
|
22
21
|
relationId?: string | number;
|
|
23
22
|
relationType?: number;
|
|
24
23
|
}) => Promise<any>;
|
package/es/index.d.ts
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { RecordSession } from './ChatMessageList';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { apiCreate, Env } from './api';
|
|
4
3
|
import { IMMessage } from './@types';
|
|
5
4
|
import './styles/index.less';
|
|
6
5
|
/**
|
|
7
6
|
* @name 客服记录组件
|
|
8
|
-
* @description
|
|
7
|
+
* @description 代码由小鲤客服平台搬运简化而来
|
|
9
8
|
*/
|
|
10
9
|
export interface IMRecordProps {
|
|
11
10
|
env?: Env;
|
|
12
11
|
token?: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
isSessionEnd?: boolean;
|
|
21
|
-
recordSession?: RecordSession;
|
|
12
|
+
msgRecords: IMMessage[];
|
|
13
|
+
onScrollTop?: () => void;
|
|
14
|
+
recordSession?: {
|
|
15
|
+
relationId: string | number;
|
|
16
|
+
accid: string;
|
|
17
|
+
relationType?: number;
|
|
18
|
+
};
|
|
22
19
|
}
|
|
23
20
|
export interface ImContextProps {
|
|
24
21
|
api: ReturnType<typeof apiCreate>;
|
package/es/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
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
|
-
var _excluded = ["env", "token", "msgs", "recordSession"];
|
|
3
|
-
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); }
|
|
4
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; }
|
|
5
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; }
|
|
6
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; }
|
|
@@ -16,33 +14,30 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
16
14
|
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; }
|
|
17
15
|
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; } }
|
|
18
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
|
|
20
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
21
|
-
import React, { createContext, useEffect, useRef, useState } from 'react';
|
|
17
|
+
import React, { createContext, useEffect, useState } from 'react';
|
|
22
18
|
import ChatMessageList from './ChatMessageList';
|
|
23
19
|
import { apiCreate } from './api';
|
|
24
20
|
import './styles/index.less';
|
|
25
21
|
export var ImContext = /*#__PURE__*/createContext({});
|
|
26
22
|
var IMRecord = function IMRecord(_ref) {
|
|
27
23
|
var env = _ref.env,
|
|
24
|
+
msgRecords = _ref.msgRecords,
|
|
28
25
|
token = _ref.token,
|
|
29
|
-
msgs = _ref.msgs,
|
|
30
26
|
recordSession = _ref.recordSession,
|
|
31
|
-
|
|
27
|
+
onScrollTop = _ref.onScrollTop;
|
|
32
28
|
var api = apiCreate(env, token);
|
|
33
29
|
var _useState = useState({}),
|
|
34
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35
31
|
accountsMap = _useState2[0],
|
|
36
32
|
setAccountsMap = _useState2[1];
|
|
37
|
-
var messageListDomRef = useRef(null);
|
|
38
33
|
useEffect(function () {
|
|
39
|
-
var accids = _toConsumableArray(new Set(
|
|
34
|
+
var accids = _toConsumableArray(new Set(msgRecords.map(function (x) {
|
|
40
35
|
return x.from;
|
|
41
36
|
})));
|
|
42
37
|
if (accids.length) {
|
|
43
38
|
getAccountByAccids(accids);
|
|
44
39
|
}
|
|
45
|
-
}, [
|
|
40
|
+
}, [msgRecords]);
|
|
46
41
|
function getAccountByAccids(accids) {
|
|
47
42
|
api.getAccountInfoByAccid({
|
|
48
43
|
accids: accids
|
|
@@ -65,13 +60,17 @@ var IMRecord = function IMRecord(_ref) {
|
|
|
65
60
|
value: {
|
|
66
61
|
api: api
|
|
67
62
|
}
|
|
68
|
-
}, /*#__PURE__*/React.createElement(ChatMessageList,
|
|
69
|
-
|
|
70
|
-
msgs: msgs,
|
|
63
|
+
}, /*#__PURE__*/React.createElement(ChatMessageList, {
|
|
64
|
+
msgs: msgRecords,
|
|
71
65
|
h5: true,
|
|
66
|
+
style: {
|
|
67
|
+
height: '100%',
|
|
68
|
+
background: '#f7f7f7'
|
|
69
|
+
},
|
|
72
70
|
accountsMap: accountsMap,
|
|
73
71
|
isSessionEnd: true,
|
|
74
|
-
recordSession: recordSession
|
|
75
|
-
|
|
72
|
+
recordSession: recordSession,
|
|
73
|
+
onScrollTop: onScrollTop
|
|
74
|
+
}));
|
|
76
75
|
};
|
|
77
76
|
export default IMRecord;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IMMessage } from '../@types';
|
|
3
|
-
import { RecordSession } from '../ChatMessageList';
|
|
4
3
|
import './index.less';
|
|
5
4
|
declare const ChatMessageItem: React.FC<{
|
|
6
5
|
h5?: boolean;
|
|
@@ -10,6 +9,9 @@ declare const ChatMessageItem: React.FC<{
|
|
|
10
9
|
myAccount?: string;
|
|
11
10
|
accountInfo: any;
|
|
12
11
|
isSessionEnd: boolean;
|
|
13
|
-
recordSession?:
|
|
12
|
+
recordSession?: {
|
|
13
|
+
relationId: string | number;
|
|
14
|
+
accid: string;
|
|
15
|
+
};
|
|
14
16
|
}>;
|
|
15
17
|
export default ChatMessageItem;
|
|
@@ -3,18 +3,12 @@ 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
|
-
}
|
|
11
6
|
export interface ChatMessageListProps {
|
|
12
7
|
h5?: boolean;
|
|
13
8
|
msgs: IMMessage[];
|
|
14
9
|
myAccount?: string;
|
|
15
10
|
loadingStarus?: LoadingStatus;
|
|
16
11
|
onScrollTop?: UIEventHandler<HTMLDivElement>;
|
|
17
|
-
onScrollBottom?: UIEventHandler<HTMLDivElement>;
|
|
18
12
|
accountsMap?: Record<string, {
|
|
19
13
|
accid: string;
|
|
20
14
|
nickname: string;
|
|
@@ -22,7 +16,11 @@ export interface ChatMessageListProps {
|
|
|
22
16
|
}>;
|
|
23
17
|
style?: React.CSSProperties;
|
|
24
18
|
isSessionEnd?: boolean;
|
|
25
|
-
recordSession?:
|
|
19
|
+
recordSession?: {
|
|
20
|
+
relationId: string | number;
|
|
21
|
+
accid: string;
|
|
22
|
+
relationType?: number;
|
|
23
|
+
};
|
|
26
24
|
}
|
|
27
25
|
declare const ChatMessageList: React.ForwardRefExoticComponent<ChatMessageListProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
26
|
export default ChatMessageList;
|
|
@@ -17,8 +17,8 @@ var LOAD_LIMIT = 15;
|
|
|
17
17
|
var ChatMessageList = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
18
18
|
var h5 = _ref.h5,
|
|
19
19
|
msgs = _ref.msgs,
|
|
20
|
-
onScrollTop = _ref.onScrollTop,
|
|
21
|
-
|
|
20
|
+
_ref$onScrollTop = _ref.onScrollTop,
|
|
21
|
+
onScrollTop = _ref$onScrollTop === void 0 ? function () {} : _ref$onScrollTop,
|
|
22
22
|
_ref$loadingStarus = _ref.loadingStarus,
|
|
23
23
|
loadingStarus = _ref$loadingStarus === void 0 ? '' : _ref$loadingStarus,
|
|
24
24
|
myAccount = _ref.myAccount,
|
|
@@ -32,10 +32,8 @@ var ChatMessageList = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
|
32
32
|
var onScrollHandler = (0, _utils.debounce)(function (e) {
|
|
33
33
|
var scrollElRef = ref;
|
|
34
34
|
if (!(scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current)) return;
|
|
35
|
-
var isBottom = scrollElRef.current.scrollTop >= scrollElRef.current.scrollHeight - scrollElRef.current.clientHeight - 20;
|
|
36
35
|
var isTop = scrollElRef.current.scrollTop < 20;
|
|
37
36
|
isTop && (onScrollTop === null || onScrollTop === void 0 ? void 0 : onScrollTop(e));
|
|
38
|
-
isBottom && (onScrollBottom === null || onScrollBottom === void 0 ? void 0 : onScrollBottom(e));
|
|
39
37
|
}, 200);
|
|
40
38
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
41
39
|
className: prefixCls,
|
package/lib/GoodsCard/index.d.ts
CHANGED
package/lib/GoodsCard/index.js
CHANGED
|
@@ -26,8 +26,7 @@ var OrderCard = function OrderCard(props) {
|
|
|
26
26
|
content = props.content;
|
|
27
27
|
var productId = content.productId,
|
|
28
28
|
relationId = content.relationId,
|
|
29
|
-
relationType = content.relationType
|
|
30
|
-
orderProductId = content.orderProductId;
|
|
29
|
+
relationType = content.relationType;
|
|
31
30
|
var _useState = (0, _react.useState)({}),
|
|
32
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
33
32
|
data = _useState2[0],
|
|
@@ -39,8 +38,7 @@ var OrderCard = function OrderCard(props) {
|
|
|
39
38
|
api.getProductById({
|
|
40
39
|
productId: productId,
|
|
41
40
|
relationId: relationId,
|
|
42
|
-
relationType: relationType
|
|
43
|
-
orderProductId: orderProductId
|
|
41
|
+
relationType: relationType
|
|
44
42
|
}).then(function (_ref) {
|
|
45
43
|
var data = _ref.data;
|
|
46
44
|
setData(data || {});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RecordSession } from '../ChatMessageList';
|
|
3
2
|
import './index.less';
|
|
4
3
|
export declare function fitUrl(url: string): string;
|
|
5
4
|
declare const GoodsOrderCard: React.FC<{
|
|
@@ -9,6 +8,10 @@ declare const GoodsOrderCard: React.FC<{
|
|
|
9
8
|
onClose?: Function;
|
|
10
9
|
orderSn?: any;
|
|
11
10
|
orderId?: any;
|
|
12
|
-
recordSession?:
|
|
11
|
+
recordSession?: {
|
|
12
|
+
relationId: string | number;
|
|
13
|
+
accid: string;
|
|
14
|
+
relationType?: number;
|
|
15
|
+
};
|
|
13
16
|
}>;
|
|
14
17
|
export default GoodsOrderCard;
|
|
@@ -70,7 +70,7 @@ var GoodsOrderCard = function GoodsOrderCard(props) {
|
|
|
70
70
|
data = _useState2[0],
|
|
71
71
|
setData = _useState2[1];
|
|
72
72
|
(0, _react.useEffect)(function () {
|
|
73
|
-
if (orderId || orderSn) {
|
|
73
|
+
if ((orderId || orderSn) && relationId && accid) {
|
|
74
74
|
api.getCSOrder({
|
|
75
75
|
orderSn: orderSn,
|
|
76
76
|
orderId: Number(orderId) || orderId,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IMMessage } from '../@types';
|
|
3
|
-
import { RecordSession } from '../ChatMessageList';
|
|
4
3
|
import './index.less';
|
|
5
4
|
export interface IParseSessionProps {
|
|
6
5
|
prefix?: string;
|
|
@@ -9,7 +8,11 @@ export interface IParseSessionProps {
|
|
|
9
8
|
msg: IMMessage;
|
|
10
9
|
isSessionEnd?: boolean;
|
|
11
10
|
onChartHistoryClick?: Function;
|
|
12
|
-
recordSession?:
|
|
11
|
+
recordSession?: {
|
|
12
|
+
relationId: string | number;
|
|
13
|
+
accid: string;
|
|
14
|
+
relationType?: number;
|
|
15
|
+
};
|
|
13
16
|
}
|
|
14
17
|
export declare const pauseAllAudio: () => HTMLAudioElement;
|
|
15
18
|
export declare const pauseOtherVideo: (idClient: string) => void;
|
package/lib/api/index.d.ts
CHANGED
|
@@ -13,12 +13,11 @@ interface ApiMethods {
|
|
|
13
13
|
productId: number;
|
|
14
14
|
relationId: string | number;
|
|
15
15
|
relationType: string | number;
|
|
16
|
-
orderProductId?: number;
|
|
17
16
|
}) => Promise<any>;
|
|
18
17
|
getCSOrder: (data: {
|
|
19
18
|
orderSn: number | string;
|
|
20
19
|
orderId: any;
|
|
21
|
-
accid
|
|
20
|
+
accid: string;
|
|
22
21
|
relationId?: string | number;
|
|
23
22
|
relationType?: number;
|
|
24
23
|
}) => Promise<any>;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { RecordSession } from './ChatMessageList';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { apiCreate, Env } from './api';
|
|
4
3
|
import { IMMessage } from './@types';
|
|
5
4
|
import './styles/index.less';
|
|
6
5
|
/**
|
|
7
6
|
* @name 客服记录组件
|
|
8
|
-
* @description
|
|
7
|
+
* @description 代码由小鲤客服平台搬运简化而来
|
|
9
8
|
*/
|
|
10
9
|
export interface IMRecordProps {
|
|
11
10
|
env?: Env;
|
|
12
11
|
token?: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
isSessionEnd?: boolean;
|
|
21
|
-
recordSession?: RecordSession;
|
|
12
|
+
msgRecords: IMMessage[];
|
|
13
|
+
onScrollTop?: () => void;
|
|
14
|
+
recordSession?: {
|
|
15
|
+
relationId: string | number;
|
|
16
|
+
accid: string;
|
|
17
|
+
relationType?: number;
|
|
18
|
+
};
|
|
22
19
|
}
|
|
23
20
|
export interface ImContextProps {
|
|
24
21
|
api: ReturnType<typeof apiCreate>;
|
package/lib/index.js
CHANGED
|
@@ -9,11 +9,9 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _ChatMessageList = _interopRequireDefault(require("./ChatMessageList"));
|
|
10
10
|
var _api = require("./api");
|
|
11
11
|
require("./styles/index.less");
|
|
12
|
-
var _excluded = ["env", "token", "msgs", "recordSession"];
|
|
13
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
13
|
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
14
|
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 _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); }
|
|
17
15
|
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; }
|
|
18
16
|
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; }
|
|
19
17
|
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; }
|
|
@@ -29,29 +27,26 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
29
27
|
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; }
|
|
30
28
|
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; } }
|
|
31
29
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
-
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; }
|
|
33
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
34
30
|
var ImContext = exports.ImContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
35
31
|
var IMRecord = function IMRecord(_ref) {
|
|
36
32
|
var env = _ref.env,
|
|
33
|
+
msgRecords = _ref.msgRecords,
|
|
37
34
|
token = _ref.token,
|
|
38
|
-
msgs = _ref.msgs,
|
|
39
35
|
recordSession = _ref.recordSession,
|
|
40
|
-
|
|
36
|
+
onScrollTop = _ref.onScrollTop;
|
|
41
37
|
var api = (0, _api.apiCreate)(env, token);
|
|
42
38
|
var _useState = (0, _react.useState)({}),
|
|
43
39
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
40
|
accountsMap = _useState2[0],
|
|
45
41
|
setAccountsMap = _useState2[1];
|
|
46
|
-
var messageListDomRef = (0, _react.useRef)(null);
|
|
47
42
|
(0, _react.useEffect)(function () {
|
|
48
|
-
var accids = _toConsumableArray(new Set(
|
|
43
|
+
var accids = _toConsumableArray(new Set(msgRecords.map(function (x) {
|
|
49
44
|
return x.from;
|
|
50
45
|
})));
|
|
51
46
|
if (accids.length) {
|
|
52
47
|
getAccountByAccids(accids);
|
|
53
48
|
}
|
|
54
|
-
}, [
|
|
49
|
+
}, [msgRecords]);
|
|
55
50
|
function getAccountByAccids(accids) {
|
|
56
51
|
api.getAccountInfoByAccid({
|
|
57
52
|
accids: accids
|
|
@@ -74,13 +69,17 @@ var IMRecord = function IMRecord(_ref) {
|
|
|
74
69
|
value: {
|
|
75
70
|
api: api
|
|
76
71
|
}
|
|
77
|
-
}, /*#__PURE__*/_react.default.createElement(_ChatMessageList.default,
|
|
78
|
-
|
|
79
|
-
msgs: msgs,
|
|
72
|
+
}, /*#__PURE__*/_react.default.createElement(_ChatMessageList.default, {
|
|
73
|
+
msgs: msgRecords,
|
|
80
74
|
h5: true,
|
|
75
|
+
style: {
|
|
76
|
+
height: '100%',
|
|
77
|
+
background: '#f7f7f7'
|
|
78
|
+
},
|
|
81
79
|
accountsMap: accountsMap,
|
|
82
80
|
isSessionEnd: true,
|
|
83
|
-
recordSession: recordSession
|
|
84
|
-
|
|
81
|
+
recordSession: recordSession,
|
|
82
|
+
onScrollTop: onScrollTop
|
|
83
|
+
}));
|
|
85
84
|
};
|
|
86
85
|
var _default = exports.default = IMRecord;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fle-ui/plus-im-record",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7-beta.0",
|
|
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": "
|
|
48
|
+
"gitHead": "009fe2c46a634dc85deb25d46b39b611b09bafab"
|
|
49
49
|
}
|