@zjw-jszn/platform-imsdk 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/platform-imsdk.es.js +164 -45
- package/dist/platform-imsdk.umd.cjs +205 -0
- package/index.cjs +3 -0
- package/index.js +2 -0
- package/package.json +7 -4
- package/style.css +1465 -1
- package/dist/platform-imsdk.umd.js +0 -1
|
@@ -1,33 +1,151 @@
|
|
|
1
|
-
import { IMSDK as
|
|
1
|
+
import { IMSDK as IMSDK$1, applyModeDefaults, getUserInfo, http, initIM as initIM$1, warnModeOverrides } from "@zjw-jszn/shared-imsdk";
|
|
2
2
|
export * from "@zjw-jszn/shared-imsdk";
|
|
3
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/asyncToGenerator.js
|
|
4
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
5
|
+
try {
|
|
6
|
+
var i = n[a](c), u = i.value;
|
|
7
|
+
} catch (n) {
|
|
8
|
+
e(n);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
12
|
+
}
|
|
13
|
+
function _asyncToGenerator(n) {
|
|
14
|
+
return function() {
|
|
15
|
+
var t = this, e = arguments;
|
|
16
|
+
return new Promise(function(r, o) {
|
|
17
|
+
var a = n.apply(t, e);
|
|
18
|
+
function _next(n) {
|
|
19
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
20
|
+
}
|
|
21
|
+
function _throw(n) {
|
|
22
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
23
|
+
}
|
|
24
|
+
_next(void 0);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
3
29
|
//#region src/runtime-api.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
return `${
|
|
30
|
+
var PLATFORM_API_PREFIX = "/site/IM";
|
|
31
|
+
function buildPlatformApiPath(path) {
|
|
32
|
+
return `${PLATFORM_API_PREFIX}${path.startsWith("/") ? path : `/${path}`}`;
|
|
33
|
+
}
|
|
34
|
+
function ensureAuthorized(apiName) {
|
|
35
|
+
if (!http.getAuth()) throw new Error(`未登录,禁止请求 ${apiName},请先完成鉴权`);
|
|
36
|
+
}
|
|
37
|
+
function unwrapResult(response, apiName) {
|
|
38
|
+
if (response.result === void 0 || response.result === null) throw new Error(`${apiName} 接口返回 result 为空`);
|
|
39
|
+
return response.result;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 获取会话配置(平台扩展)
|
|
43
|
+
*/
|
|
44
|
+
function getChatConfig() {
|
|
45
|
+
return _getChatConfig.apply(this, arguments);
|
|
46
|
+
}
|
|
47
|
+
function _getChatConfig() {
|
|
48
|
+
_getChatConfig = _asyncToGenerator(function* () {
|
|
49
|
+
ensureAuthorized("getChatConfig");
|
|
50
|
+
return unwrapResult(yield http.post(buildPlatformApiPath("/chatConfig/getConfig")), "getChatConfig");
|
|
51
|
+
});
|
|
52
|
+
return _getChatConfig.apply(this, arguments);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 结束会话并清理缓存(平台扩展)
|
|
56
|
+
*/
|
|
57
|
+
function closeSession(_x) {
|
|
58
|
+
return _closeSession.apply(this, arguments);
|
|
59
|
+
}
|
|
60
|
+
function _closeSession() {
|
|
61
|
+
_closeSession = _asyncToGenerator(function* (data) {
|
|
62
|
+
ensureAuthorized("closeSession");
|
|
63
|
+
const hasUid = data.uid !== void 0 && data.uid !== null;
|
|
64
|
+
const hasSessionId = data.session_id !== void 0 && data.session_id !== null;
|
|
65
|
+
if (!hasUid && !hasSessionId) throw new Error("结束会话失败:uid 和 session_id 不能同时为空");
|
|
66
|
+
const payload = hasUid ? { uid: data.uid } : { session_id: data.session_id };
|
|
67
|
+
yield http.post(buildPlatformApiPath("/chat/closeSession"), payload);
|
|
68
|
+
return true;
|
|
69
|
+
});
|
|
70
|
+
return _closeSession.apply(this, arguments);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 获取客服会话聊天列表(平台扩展)
|
|
74
|
+
*/
|
|
75
|
+
function getCustomerChatList(_x2) {
|
|
76
|
+
return _getCustomerChatList.apply(this, arguments);
|
|
77
|
+
}
|
|
78
|
+
function _getCustomerChatList() {
|
|
79
|
+
_getCustomerChatList = _asyncToGenerator(function* (data) {
|
|
80
|
+
ensureAuthorized("getCustomerChatList");
|
|
81
|
+
return unwrapResult(yield http.post(buildPlatformApiPath("/customer/getChatList"), data), "getCustomerChatList");
|
|
82
|
+
});
|
|
83
|
+
return _getCustomerChatList.apply(this, arguments);
|
|
7
84
|
}
|
|
8
|
-
|
|
9
|
-
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/typeof.js
|
|
87
|
+
function _typeof(o) {
|
|
88
|
+
"@babel/helpers - typeof";
|
|
89
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
90
|
+
return typeof o;
|
|
91
|
+
} : function(o) {
|
|
92
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
93
|
+
}, _typeof(o);
|
|
10
94
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/toPrimitive.js
|
|
97
|
+
function toPrimitive(t, r) {
|
|
98
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
99
|
+
var e = t[Symbol.toPrimitive];
|
|
100
|
+
if (void 0 !== e) {
|
|
101
|
+
var i = e.call(t, r || "default");
|
|
102
|
+
if ("object" != _typeof(i)) return i;
|
|
103
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
104
|
+
}
|
|
105
|
+
return ("string" === r ? String : Number)(t);
|
|
14
106
|
}
|
|
15
|
-
|
|
16
|
-
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/toPropertyKey.js
|
|
109
|
+
function toPropertyKey(t) {
|
|
110
|
+
var i = toPrimitive(t, "string");
|
|
111
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
17
112
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/defineProperty.js
|
|
115
|
+
function _defineProperty(e, r, t) {
|
|
116
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
117
|
+
value: t,
|
|
118
|
+
enumerable: !0,
|
|
119
|
+
configurable: !0,
|
|
120
|
+
writable: !0
|
|
121
|
+
}) : e[r] = t, e;
|
|
24
122
|
}
|
|
25
|
-
|
|
26
|
-
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/objectSpread2.js
|
|
125
|
+
function ownKeys(e, r) {
|
|
126
|
+
var t = Object.keys(e);
|
|
127
|
+
if (Object.getOwnPropertySymbols) {
|
|
128
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
129
|
+
r && (o = o.filter(function(r) {
|
|
130
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
131
|
+
})), t.push.apply(t, o);
|
|
132
|
+
}
|
|
133
|
+
return t;
|
|
134
|
+
}
|
|
135
|
+
function _objectSpread2(e) {
|
|
136
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
137
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
138
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
139
|
+
_defineProperty(e, r, t[r]);
|
|
140
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
141
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return e;
|
|
27
145
|
}
|
|
28
146
|
//#endregion
|
|
29
147
|
//#region src/index.ts
|
|
30
|
-
var
|
|
148
|
+
var PLATFORM_DEFAULTS = {
|
|
31
149
|
api: {
|
|
32
150
|
prefix: "/site/IM",
|
|
33
151
|
userType: 4
|
|
@@ -37,31 +155,32 @@ var p = {
|
|
|
37
155
|
platform: "site"
|
|
38
156
|
}
|
|
39
157
|
};
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(
|
|
44
|
-
}
|
|
45
|
-
function h(e = {}) {
|
|
46
|
-
m(e);
|
|
47
|
-
let n = e;
|
|
48
|
-
return {
|
|
49
|
-
...t(e, p),
|
|
50
|
-
runtimeApi: {
|
|
51
|
-
...n.runtimeApi || {},
|
|
52
|
-
getChatConfig: u,
|
|
53
|
-
closeSession: d,
|
|
54
|
-
getCustomerChatList: f
|
|
55
|
-
}
|
|
56
|
-
};
|
|
158
|
+
function warnIgnoredPlatformModeOverrides(config) {
|
|
159
|
+
warnModeOverrides("platform-imsdk", config, PLATFORM_DEFAULTS);
|
|
160
|
+
const runtimeApi = config.runtimeApi;
|
|
161
|
+
if ((runtimeApi === null || runtimeApi === void 0 ? void 0 : runtimeApi.getChatConfig) || (runtimeApi === null || runtimeApi === void 0 ? void 0 : runtimeApi.closeSession) || (runtimeApi === null || runtimeApi === void 0 ? void 0 : runtimeApi.getCustomerChatList)) console.warn("[platform-imsdk] 已忽略 runtimeApi 的平台扩展覆盖配置,平台扩展接口由内置实现提供");
|
|
57
162
|
}
|
|
58
|
-
|
|
59
|
-
|
|
163
|
+
function mergePlatformConfig(config = {}) {
|
|
164
|
+
warnIgnoredPlatformModeOverrides(config);
|
|
165
|
+
const platformConfig = config;
|
|
166
|
+
return _objectSpread2(_objectSpread2({}, applyModeDefaults(config, PLATFORM_DEFAULTS)), {}, { runtimeApi: _objectSpread2(_objectSpread2({}, platformConfig.runtimeApi || {}), {}, {
|
|
167
|
+
getChatConfig,
|
|
168
|
+
closeSession,
|
|
169
|
+
getCustomerChatList
|
|
170
|
+
}) });
|
|
60
171
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
172
|
+
function initIM() {
|
|
173
|
+
return _initIM.apply(this, arguments);
|
|
174
|
+
}
|
|
175
|
+
function _initIM() {
|
|
176
|
+
_initIM = _asyncToGenerator(function* (config = {}) {
|
|
177
|
+
return initIM$1(mergePlatformConfig(config));
|
|
178
|
+
});
|
|
179
|
+
return _initIM.apply(this, arguments);
|
|
180
|
+
}
|
|
181
|
+
var IMSDK = _objectSpread2(_objectSpread2({}, IMSDK$1), {}, {
|
|
182
|
+
init: initIM,
|
|
183
|
+
getUserInfo
|
|
184
|
+
});
|
|
66
185
|
//#endregion
|
|
67
|
-
export {
|
|
186
|
+
export { IMSDK, IMSDK as default, closeSession, getChatConfig, getCustomerChatList, initIM };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@zjw-jszn/shared-imsdk")) : typeof define === "function" && define.amd ? define(["exports", "@zjw-jszn/shared-imsdk"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.PlatformIMSDK = {}, global.SharedIMSDK));
|
|
3
|
+
})(this, function(exports, _zjw_jszn_shared_imsdk) {
|
|
4
|
+
Object.defineProperties(exports, {
|
|
5
|
+
__esModule: { value: true },
|
|
6
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
7
|
+
});
|
|
8
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/asyncToGenerator.js
|
|
9
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
10
|
+
try {
|
|
11
|
+
var i = n[a](c), u = i.value;
|
|
12
|
+
} catch (n) {
|
|
13
|
+
e(n);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
17
|
+
}
|
|
18
|
+
function _asyncToGenerator(n) {
|
|
19
|
+
return function() {
|
|
20
|
+
var t = this, e = arguments;
|
|
21
|
+
return new Promise(function(r, o) {
|
|
22
|
+
var a = n.apply(t, e);
|
|
23
|
+
function _next(n) {
|
|
24
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
25
|
+
}
|
|
26
|
+
function _throw(n) {
|
|
27
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
28
|
+
}
|
|
29
|
+
_next(void 0);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/runtime-api.ts
|
|
35
|
+
var PLATFORM_API_PREFIX = "/site/IM";
|
|
36
|
+
function buildPlatformApiPath(path) {
|
|
37
|
+
return `${PLATFORM_API_PREFIX}${path.startsWith("/") ? path : `/${path}`}`;
|
|
38
|
+
}
|
|
39
|
+
function ensureAuthorized(apiName) {
|
|
40
|
+
if (!_zjw_jszn_shared_imsdk.http.getAuth()) throw new Error(`未登录,禁止请求 ${apiName},请先完成鉴权`);
|
|
41
|
+
}
|
|
42
|
+
function unwrapResult(response, apiName) {
|
|
43
|
+
if (response.result === void 0 || response.result === null) throw new Error(`${apiName} 接口返回 result 为空`);
|
|
44
|
+
return response.result;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 获取会话配置(平台扩展)
|
|
48
|
+
*/
|
|
49
|
+
function getChatConfig() {
|
|
50
|
+
return _getChatConfig.apply(this, arguments);
|
|
51
|
+
}
|
|
52
|
+
function _getChatConfig() {
|
|
53
|
+
_getChatConfig = _asyncToGenerator(function* () {
|
|
54
|
+
ensureAuthorized("getChatConfig");
|
|
55
|
+
return unwrapResult(yield _zjw_jszn_shared_imsdk.http.post(buildPlatformApiPath("/chatConfig/getConfig")), "getChatConfig");
|
|
56
|
+
});
|
|
57
|
+
return _getChatConfig.apply(this, arguments);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 结束会话并清理缓存(平台扩展)
|
|
61
|
+
*/
|
|
62
|
+
function closeSession(_x) {
|
|
63
|
+
return _closeSession.apply(this, arguments);
|
|
64
|
+
}
|
|
65
|
+
function _closeSession() {
|
|
66
|
+
_closeSession = _asyncToGenerator(function* (data) {
|
|
67
|
+
ensureAuthorized("closeSession");
|
|
68
|
+
const hasUid = data.uid !== void 0 && data.uid !== null;
|
|
69
|
+
const hasSessionId = data.session_id !== void 0 && data.session_id !== null;
|
|
70
|
+
if (!hasUid && !hasSessionId) throw new Error("结束会话失败:uid 和 session_id 不能同时为空");
|
|
71
|
+
const payload = hasUid ? { uid: data.uid } : { session_id: data.session_id };
|
|
72
|
+
yield _zjw_jszn_shared_imsdk.http.post(buildPlatformApiPath("/chat/closeSession"), payload);
|
|
73
|
+
return true;
|
|
74
|
+
});
|
|
75
|
+
return _closeSession.apply(this, arguments);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 获取客服会话聊天列表(平台扩展)
|
|
79
|
+
*/
|
|
80
|
+
function getCustomerChatList(_x2) {
|
|
81
|
+
return _getCustomerChatList.apply(this, arguments);
|
|
82
|
+
}
|
|
83
|
+
function _getCustomerChatList() {
|
|
84
|
+
_getCustomerChatList = _asyncToGenerator(function* (data) {
|
|
85
|
+
ensureAuthorized("getCustomerChatList");
|
|
86
|
+
return unwrapResult(yield _zjw_jszn_shared_imsdk.http.post(buildPlatformApiPath("/customer/getChatList"), data), "getCustomerChatList");
|
|
87
|
+
});
|
|
88
|
+
return _getCustomerChatList.apply(this, arguments);
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/typeof.js
|
|
92
|
+
function _typeof(o) {
|
|
93
|
+
"@babel/helpers - typeof";
|
|
94
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
95
|
+
return typeof o;
|
|
96
|
+
} : function(o) {
|
|
97
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
98
|
+
}, _typeof(o);
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/toPrimitive.js
|
|
102
|
+
function toPrimitive(t, r) {
|
|
103
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
104
|
+
var e = t[Symbol.toPrimitive];
|
|
105
|
+
if (void 0 !== e) {
|
|
106
|
+
var i = e.call(t, r || "default");
|
|
107
|
+
if ("object" != _typeof(i)) return i;
|
|
108
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
109
|
+
}
|
|
110
|
+
return ("string" === r ? String : Number)(t);
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/toPropertyKey.js
|
|
114
|
+
function toPropertyKey(t) {
|
|
115
|
+
var i = toPrimitive(t, "string");
|
|
116
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/defineProperty.js
|
|
120
|
+
function _defineProperty(e, r, t) {
|
|
121
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
122
|
+
value: t,
|
|
123
|
+
enumerable: !0,
|
|
124
|
+
configurable: !0,
|
|
125
|
+
writable: !0
|
|
126
|
+
}) : e[r] = t, e;
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region \0@oxc-project+runtime@0.120.0/helpers/objectSpread2.js
|
|
130
|
+
function ownKeys(e, r) {
|
|
131
|
+
var t = Object.keys(e);
|
|
132
|
+
if (Object.getOwnPropertySymbols) {
|
|
133
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
134
|
+
r && (o = o.filter(function(r) {
|
|
135
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
136
|
+
})), t.push.apply(t, o);
|
|
137
|
+
}
|
|
138
|
+
return t;
|
|
139
|
+
}
|
|
140
|
+
function _objectSpread2(e) {
|
|
141
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
142
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
143
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
|
|
144
|
+
_defineProperty(e, r, t[r]);
|
|
145
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
|
|
146
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return e;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/index.ts
|
|
153
|
+
var PLATFORM_DEFAULTS = {
|
|
154
|
+
api: {
|
|
155
|
+
prefix: "/site/IM",
|
|
156
|
+
userType: 4
|
|
157
|
+
},
|
|
158
|
+
ws: {
|
|
159
|
+
controller: "Site",
|
|
160
|
+
platform: "site"
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
function warnIgnoredPlatformModeOverrides(config) {
|
|
164
|
+
(0, _zjw_jszn_shared_imsdk.warnModeOverrides)("platform-imsdk", config, PLATFORM_DEFAULTS);
|
|
165
|
+
const runtimeApi = config.runtimeApi;
|
|
166
|
+
if ((runtimeApi === null || runtimeApi === void 0 ? void 0 : runtimeApi.getChatConfig) || (runtimeApi === null || runtimeApi === void 0 ? void 0 : runtimeApi.closeSession) || (runtimeApi === null || runtimeApi === void 0 ? void 0 : runtimeApi.getCustomerChatList)) console.warn("[platform-imsdk] 已忽略 runtimeApi 的平台扩展覆盖配置,平台扩展接口由内置实现提供");
|
|
167
|
+
}
|
|
168
|
+
function mergePlatformConfig(config = {}) {
|
|
169
|
+
warnIgnoredPlatformModeOverrides(config);
|
|
170
|
+
const platformConfig = config;
|
|
171
|
+
return _objectSpread2(_objectSpread2({}, (0, _zjw_jszn_shared_imsdk.applyModeDefaults)(config, PLATFORM_DEFAULTS)), {}, { runtimeApi: _objectSpread2(_objectSpread2({}, platformConfig.runtimeApi || {}), {}, {
|
|
172
|
+
getChatConfig,
|
|
173
|
+
closeSession,
|
|
174
|
+
getCustomerChatList
|
|
175
|
+
}) });
|
|
176
|
+
}
|
|
177
|
+
function initIM() {
|
|
178
|
+
return _initIM.apply(this, arguments);
|
|
179
|
+
}
|
|
180
|
+
function _initIM() {
|
|
181
|
+
_initIM = _asyncToGenerator(function* (config = {}) {
|
|
182
|
+
return (0, _zjw_jszn_shared_imsdk.initIM)(mergePlatformConfig(config));
|
|
183
|
+
});
|
|
184
|
+
return _initIM.apply(this, arguments);
|
|
185
|
+
}
|
|
186
|
+
var IMSDK = _objectSpread2(_objectSpread2({}, _zjw_jszn_shared_imsdk.IMSDK), {}, {
|
|
187
|
+
init: initIM,
|
|
188
|
+
getUserInfo: _zjw_jszn_shared_imsdk.getUserInfo
|
|
189
|
+
});
|
|
190
|
+
//#endregion
|
|
191
|
+
exports.IMSDK = IMSDK;
|
|
192
|
+
exports.default = IMSDK;
|
|
193
|
+
exports.closeSession = closeSession;
|
|
194
|
+
exports.getChatConfig = getChatConfig;
|
|
195
|
+
exports.getCustomerChatList = getCustomerChatList;
|
|
196
|
+
exports.initIM = initIM;
|
|
197
|
+
Object.keys(_zjw_jszn_shared_imsdk).forEach(function(k) {
|
|
198
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function() {
|
|
201
|
+
return _zjw_jszn_shared_imsdk[k];
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
});
|
package/index.cjs
ADDED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zjw-jszn/platform-imsdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
-
"import": "./index.js"
|
|
8
|
+
"import": "./index.js",
|
|
9
|
+
"require": "./index.cjs",
|
|
10
|
+
"default": "./index.js"
|
|
9
11
|
},
|
|
10
12
|
"./style.css": "./style.css"
|
|
11
13
|
},
|
|
12
|
-
"main": "./dist/platform-imsdk.umd.
|
|
14
|
+
"main": "./dist/platform-imsdk.umd.cjs",
|
|
13
15
|
"module": "./index.js",
|
|
14
16
|
"types": "./dist/index.d.ts",
|
|
15
17
|
"files": [
|
|
16
18
|
"dist",
|
|
17
19
|
"index.js",
|
|
20
|
+
"index.cjs",
|
|
18
21
|
"style.css"
|
|
19
22
|
],
|
|
20
23
|
"publishConfig": {
|
|
@@ -22,7 +25,7 @@
|
|
|
22
25
|
"registry": "https://registry.npmjs.org/"
|
|
23
26
|
},
|
|
24
27
|
"dependencies": {
|
|
25
|
-
"@zjw-jszn/shared-imsdk": "1.0.
|
|
28
|
+
"@zjw-jszn/shared-imsdk": "1.0.6"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
31
|
"typescript": "~5.9.3",
|