yach.open.jssdk 4.4.9 → 4.4.10-beta.2
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/yach_jssdk_4.3.3.js +1 -0
- package/es/api/biz/navigation/close.d.ts +0 -1
- package/es/api/biz/navigation/tencentMeeting.d.ts +0 -1
- package/es/api/device/notification/hidePreloader.d.ts +1 -6
- package/es/api/device/notification/hidePreloader.js +2 -15
- package/es/api/device/notification/showPreloader.d.ts +1 -10
- package/es/api/device/notification/showPreloader.js +2 -15
- package/es/index.d.ts +3 -41
- package/es/index.js +5 -44
- package/es/lib/bridge/mobile.js +20 -61
- package/es/lib/bridge/pc.js +8 -50
- package/es/lib/helper/pcIframe.d.ts +25 -8
- package/es/lib/helper/pcIframe.js +8 -34
- package/es/lib/sdk/index.js +4 -13
- package/es/lib/sdk/sdk.typings.d.ts +0 -2
- package/es/utils/console.d.ts +1 -1
- package/es/utils/console.js +2 -2
- package/es/utils/env.js +3 -7
- package/es/utils/index.js +1 -1
- package/libs/api/biz/navigation/close.d.ts +0 -1
- package/libs/api/biz/navigation/tencentMeeting.d.ts +0 -1
- package/libs/api/device/notification/hidePreloader.d.ts +1 -6
- package/libs/api/device/notification/hidePreloader.js +1 -15
- package/libs/api/device/notification/showPreloader.d.ts +1 -10
- package/libs/api/device/notification/showPreloader.js +1 -15
- package/libs/api/initAPI.js +2 -1
- package/libs/index.d.ts +3 -41
- package/libs/index.js +25 -186
- package/libs/lib/bridge/mobile.js +25 -64
- package/libs/lib/bridge/pc.js +13 -53
- package/libs/lib/helper/event.js +2 -1
- package/libs/lib/helper/pcIframe.d.ts +25 -8
- package/libs/lib/helper/pcIframe.js +10 -35
- package/libs/lib/index.js +2 -1
- package/libs/lib/sdk/index.js +5 -13
- package/libs/lib/sdk/sdk.typings.d.ts +0 -2
- package/libs/lib/sdk/sdk.typings.js +1 -0
- package/libs/utils/compareVersions.js +8 -4
- package/libs/utils/console.d.ts +1 -1
- package/libs/utils/console.js +2 -2
- package/libs/utils/env.js +3 -7
- package/libs/utils/index.js +1 -1
- package/package.json +3 -1
- package/dist/yach_jssdk_4.4.9.js +0 -1
- package/es/api/biz/util/addAppToNav.d.ts +0 -9
- package/es/api/biz/util/addAppToNav.js +0 -23
- package/es/api/biz/util/copy.d.ts +0 -11
- package/es/api/biz/util/copy.js +0 -19
- package/es/api/biz/util/focus.d.ts +0 -7
- package/es/api/biz/util/focus.js +0 -23
- package/es/api/biz/util/getConfig.d.ts +0 -13
- package/es/api/biz/util/getConfig.js +0 -19
- package/es/api/biz/util/knowledgeBaseSelect.d.ts +0 -21
- package/es/api/biz/util/knowledgeBaseSelect.js +0 -23
- package/es/api/biz/util/knowledgeSelectParams.d.ts +0 -14
- package/es/api/biz/util/knowledgeSelectParams.js +0 -19
- package/es/api/biz/util/lorebaseRefreshNodeWebview.d.ts +0 -11
- package/es/api/biz/util/lorebaseRefreshNodeWebview.js +0 -19
- package/es/api/biz/util/lorebaseShowList.d.ts +0 -11
- package/es/api/biz/util/lorebaseShowList.js +0 -19
- package/es/api/biz/util/mediaFileUploadV2.d.ts +0 -26
- package/es/api/biz/util/mediaFileUploadV2.js +0 -15
- package/es/api/biz/util/openAudioPlayer.d.ts +0 -17
- package/es/api/biz/util/openAudioPlayer.js +0 -23
- package/es/api/biz/util/openFutureGroup.d.ts +0 -10
- package/es/api/biz/util/openFutureGroup.js +0 -23
- package/es/api/biz/util/openMediaFileDialogV2.d.ts +0 -23
- package/es/api/biz/util/openMediaFileDialogV2.js +0 -16
- package/es/api/biz/util/openPublish.d.ts +0 -22
- package/es/api/biz/util/openPublish.js +0 -15
- package/es/api/biz/util/screen.d.ts +0 -15
- package/es/api/biz/util/screen.js +0 -15
- package/es/api/biz/util/topicEvent.d.ts +0 -13
- package/es/api/biz/util/topicEvent.js +0 -27
- package/es/api/biz/util/weeklyRead.d.ts +0 -5
- package/es/api/biz/util/weeklyRead.js +0 -23
- package/es/api/device/connection/startNetworkChangeWatch.d.ts +0 -8
- package/es/api/device/connection/startNetworkChangeWatch.js +0 -23
- package/es/api/primary/updateTab.d.ts +0 -9
- package/es/api/primary/updateTab.js +0 -15
- package/libs/api/biz/util/addAppToNav.d.ts +0 -9
- package/libs/api/biz/util/addAppToNav.js +0 -30
- package/libs/api/biz/util/copy.d.ts +0 -11
- package/libs/api/biz/util/copy.js +0 -26
- package/libs/api/biz/util/focus.d.ts +0 -7
- package/libs/api/biz/util/focus.js +0 -30
- package/libs/api/biz/util/getConfig.d.ts +0 -13
- package/libs/api/biz/util/getConfig.js +0 -26
- package/libs/api/biz/util/knowledgeBaseSelect.d.ts +0 -21
- package/libs/api/biz/util/knowledgeBaseSelect.js +0 -30
- package/libs/api/biz/util/knowledgeSelectParams.d.ts +0 -14
- package/libs/api/biz/util/knowledgeSelectParams.js +0 -26
- package/libs/api/biz/util/lorebaseRefreshNodeWebview.d.ts +0 -11
- package/libs/api/biz/util/lorebaseRefreshNodeWebview.js +0 -26
- package/libs/api/biz/util/lorebaseShowList.d.ts +0 -11
- package/libs/api/biz/util/lorebaseShowList.js +0 -26
- package/libs/api/biz/util/mediaFileUploadV2.d.ts +0 -26
- package/libs/api/biz/util/mediaFileUploadV2.js +0 -23
- package/libs/api/biz/util/openAudioPlayer.d.ts +0 -17
- package/libs/api/biz/util/openAudioPlayer.js +0 -30
- package/libs/api/biz/util/openFutureGroup.d.ts +0 -10
- package/libs/api/biz/util/openFutureGroup.js +0 -30
- package/libs/api/biz/util/openMediaFileDialogV2.d.ts +0 -23
- package/libs/api/biz/util/openMediaFileDialogV2.js +0 -24
- package/libs/api/biz/util/openPublish.d.ts +0 -22
- package/libs/api/biz/util/openPublish.js +0 -22
- package/libs/api/biz/util/screen.d.ts +0 -15
- package/libs/api/biz/util/screen.js +0 -22
- package/libs/api/biz/util/topicEvent.d.ts +0 -13
- package/libs/api/biz/util/topicEvent.js +0 -34
- package/libs/api/biz/util/weeklyRead.d.ts +0 -5
- package/libs/api/biz/util/weeklyRead.js +0 -30
- package/libs/api/device/connection/startNetworkChangeWatch.d.ts +0 -8
- package/libs/api/device/connection/startNetworkChangeWatch.js +0 -30
- package/libs/api/primary/updateTab.d.ts +0 -9
- package/libs/api/primary/updateTab.js +0 -22
package/es/lib/bridge/mobile.js
CHANGED
|
@@ -2,7 +2,6 @@ import _setTimeout from "@babel/runtime-corejs3/core-js/set-timeout";
|
|
|
2
2
|
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
3
3
|
import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
|
|
4
4
|
import _parseInt from "@babel/runtime-corejs3/core-js/parse-int";
|
|
5
|
-
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
6
5
|
import Event from '../helper/event';
|
|
7
6
|
import { electronResCodeMap } from '../helper/codeMap';
|
|
8
7
|
import { log, bpitLog } from '../../utils';
|
|
@@ -67,16 +66,6 @@ var mobileBridgeInit = function mobileBridgeInit() {
|
|
|
67
66
|
});
|
|
68
67
|
Event.execEvent('sendMsgCommon', resData);
|
|
69
68
|
});
|
|
70
|
-
bridge.registerHandler('toolbarClickEvent', function (resData, responseCallback) {
|
|
71
|
-
log("toolbarClickEvent ", {
|
|
72
|
-
resData: resData
|
|
73
|
-
});
|
|
74
|
-
var responseData = {
|
|
75
|
-
data: resData,
|
|
76
|
-
callback: responseCallback
|
|
77
|
-
};
|
|
78
|
-
Event.execEvent('toolbarClickEvent', responseData);
|
|
79
|
-
});
|
|
80
69
|
resolve();
|
|
81
70
|
});
|
|
82
71
|
});
|
|
@@ -104,6 +93,26 @@ var mobileBridge = function mobileBridge(method, param) {
|
|
|
104
93
|
data = e.data;
|
|
105
94
|
var _code = _parseInt(code);
|
|
106
95
|
var callbackStr = electronResCodeMap(_code);
|
|
96
|
+
if (_code === -2 || _code === 7) {
|
|
97
|
+
bpitLog({
|
|
98
|
+
method: method,
|
|
99
|
+
errorcode: _code,
|
|
100
|
+
message: message || 'SDK执行失败回调,相关参数'
|
|
101
|
+
});
|
|
102
|
+
log("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
103
|
+
method: method,
|
|
104
|
+
param: param,
|
|
105
|
+
data: data,
|
|
106
|
+
_code: _code,
|
|
107
|
+
message: message
|
|
108
|
+
});
|
|
109
|
+
reject({
|
|
110
|
+
_code: _code,
|
|
111
|
+
message: message
|
|
112
|
+
});
|
|
113
|
+
// return;
|
|
114
|
+
}
|
|
115
|
+
|
|
107
116
|
var callbackFun = p[callbackStr];
|
|
108
117
|
log("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
109
118
|
method: method,
|
|
@@ -113,27 +122,6 @@ var mobileBridge = function mobileBridge(method, param) {
|
|
|
113
122
|
message: message,
|
|
114
123
|
callbackFun: callbackFun
|
|
115
124
|
});
|
|
116
|
-
// 请求失败
|
|
117
|
-
if (callbackStr === 'onFail') {
|
|
118
|
-
bpitLog({
|
|
119
|
-
method: method,
|
|
120
|
-
errorcode: _code,
|
|
121
|
-
message: message || _JSON$stringify(data) || 'SDK执行失败回调,相关参数'
|
|
122
|
-
});
|
|
123
|
-
if ('function' === typeof callbackFun) {
|
|
124
|
-
message ? callbackFun({
|
|
125
|
-
code: code,
|
|
126
|
-
message: message
|
|
127
|
-
}) : callbackFun(data);
|
|
128
|
-
}
|
|
129
|
-
reject({
|
|
130
|
-
_code: _code,
|
|
131
|
-
message: message,
|
|
132
|
-
data: data
|
|
133
|
-
});
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
// 请求成功
|
|
137
125
|
if ('function' === typeof callbackFun) {
|
|
138
126
|
callbackFun(data || message);
|
|
139
127
|
}
|
|
@@ -142,35 +130,6 @@ var mobileBridge = function mobileBridge(method, param) {
|
|
|
142
130
|
message: message,
|
|
143
131
|
data: data
|
|
144
132
|
});
|
|
145
|
-
// if (_code === -2 || _code === 7) {
|
|
146
|
-
// bpitLog({
|
|
147
|
-
// method,
|
|
148
|
-
// errorcode: _code,
|
|
149
|
-
// message: message || 'SDK执行失败回调,相关参数',
|
|
150
|
-
// });
|
|
151
|
-
// log(`SDK执行后回调,相关参数 `, {
|
|
152
|
-
// method,
|
|
153
|
-
// param,
|
|
154
|
-
// data,
|
|
155
|
-
// _code,
|
|
156
|
-
// message,
|
|
157
|
-
// });
|
|
158
|
-
// reject({_code, message});
|
|
159
|
-
// // return;
|
|
160
|
-
// }
|
|
161
|
-
// const callbackFun = p[callbackStr];
|
|
162
|
-
// log(`SDK执行后回调,相关参数 `, {
|
|
163
|
-
// method,
|
|
164
|
-
// param,
|
|
165
|
-
// data,
|
|
166
|
-
// _code,
|
|
167
|
-
// message,
|
|
168
|
-
// callbackFun,
|
|
169
|
-
// });
|
|
170
|
-
// if ('function' === typeof callbackFun) {
|
|
171
|
-
// callbackFun(data || message);
|
|
172
|
-
// }
|
|
173
|
-
// resolve({_code, message, data});
|
|
174
133
|
});
|
|
175
134
|
});
|
|
176
135
|
});
|
package/es/lib/bridge/pc.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
2
2
|
import _parseInt from "@babel/runtime-corejs3/core-js/parse-int";
|
|
3
|
-
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
4
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
|
|
5
3
|
import PcIframe from '../helper/pcIframe';
|
|
6
4
|
import { electronResCodeMap } from '../helper/codeMap';
|
|
7
5
|
import { log, bpitLog } from '../../utils';
|
|
@@ -9,13 +7,20 @@ var PcBridgeInit = function PcBridgeInit() {
|
|
|
9
7
|
PcIframe.init();
|
|
10
8
|
};
|
|
11
9
|
var pcBridge = function pcBridge(method, param) {
|
|
12
|
-
return new _Promise(function (resolve
|
|
10
|
+
return new _Promise(function (resolve) {
|
|
13
11
|
return PcIframe.invokeAPI(method, param, function (_ref) {
|
|
14
12
|
var data = _ref.data,
|
|
15
13
|
code = _ref.code,
|
|
16
14
|
message = _ref.message;
|
|
17
15
|
var _code = _parseInt(code);
|
|
18
16
|
var callbackStr = electronResCodeMap(_code);
|
|
17
|
+
if (_code === -2) {
|
|
18
|
+
bpitLog({
|
|
19
|
+
method: method,
|
|
20
|
+
errorcode: _code,
|
|
21
|
+
message: message || 'SDK执行失败回调,相关参数'
|
|
22
|
+
});
|
|
23
|
+
}
|
|
19
24
|
var callbackFun = param[callbackStr];
|
|
20
25
|
log("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
21
26
|
method: method,
|
|
@@ -25,33 +30,6 @@ var pcBridge = function pcBridge(method, param) {
|
|
|
25
30
|
message: message,
|
|
26
31
|
callbackFun: callbackFun
|
|
27
32
|
});
|
|
28
|
-
// 请求失败
|
|
29
|
-
if (callbackStr === 'onFail') {
|
|
30
|
-
bpitLog({
|
|
31
|
-
method: method,
|
|
32
|
-
errorcode: _code,
|
|
33
|
-
message: message || _JSON$stringify(data) || 'SDK执行失败回调,相关参数'
|
|
34
|
-
});
|
|
35
|
-
if ('function' === typeof callbackFun) {
|
|
36
|
-
console.log('wenai-code', code, _code);
|
|
37
|
-
var callbackData = Object.prototype.toString.call(data) === "[object Object]" ? _Object$assign(_Object$assign({}, data), {
|
|
38
|
-
code: code,
|
|
39
|
-
message: message
|
|
40
|
-
}) : {
|
|
41
|
-
data: data,
|
|
42
|
-
code: code,
|
|
43
|
-
message: message
|
|
44
|
-
};
|
|
45
|
-
message ? callbackFun(callbackData) : callbackFun(data);
|
|
46
|
-
}
|
|
47
|
-
reject({
|
|
48
|
-
_code: _code,
|
|
49
|
-
message: message,
|
|
50
|
-
data: data
|
|
51
|
-
});
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
// 请求成功
|
|
55
33
|
if ('function' === typeof callbackFun) {
|
|
56
34
|
callbackFun(data || message);
|
|
57
35
|
}
|
|
@@ -60,26 +38,6 @@ var pcBridge = function pcBridge(method, param) {
|
|
|
60
38
|
message: message,
|
|
61
39
|
data: data
|
|
62
40
|
});
|
|
63
|
-
// if (_code === -2) {
|
|
64
|
-
// bpitLog({
|
|
65
|
-
// method,
|
|
66
|
-
// errorcode: _code,
|
|
67
|
-
// message: message || 'SDK执行失败回调,相关参数',
|
|
68
|
-
// });
|
|
69
|
-
// }
|
|
70
|
-
// const callbackFun = param[callbackStr];
|
|
71
|
-
// log(`SDK执行后回调,相关参数 `, {
|
|
72
|
-
// method,
|
|
73
|
-
// param,
|
|
74
|
-
// data,
|
|
75
|
-
// _code,
|
|
76
|
-
// message,
|
|
77
|
-
// callbackFun
|
|
78
|
-
// });
|
|
79
|
-
// if ('function' === typeof callbackFun) {
|
|
80
|
-
// callbackFun(data || message);
|
|
81
|
-
// }
|
|
82
|
-
// resolve({ _code, message, data });
|
|
83
41
|
});
|
|
84
42
|
});
|
|
85
43
|
};
|
|
@@ -3,24 +3,41 @@ declare global {
|
|
|
3
3
|
sendToHost: any;
|
|
4
4
|
sendTo: any;
|
|
5
5
|
receiveBrowserViewData: any;
|
|
6
|
-
remoteSendToHost?: (payload: string) => void;
|
|
7
|
-
remoteReceiveFromHost?: (callback: (result: Record<string, any>) => void, moduleId?: string) => void;
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
|
-
|
|
8
|
+
interface APIParams {
|
|
9
|
+
invokeType?: 'browserView' | '';
|
|
10
|
+
[propName: string]: any;
|
|
11
|
+
}
|
|
12
|
+
declare class GenPostMsg {
|
|
13
|
+
private id;
|
|
14
|
+
private PromiseObj;
|
|
15
|
+
private methodName;
|
|
16
|
+
private plainMsg;
|
|
17
|
+
callback: (v: any) => void;
|
|
18
|
+
result: Promise<any>;
|
|
19
|
+
invokeType: 'browserView' | '';
|
|
20
|
+
constructor(method: string, param: APIParams, callback: any);
|
|
21
|
+
genid: () => string;
|
|
22
|
+
receiveResponse: (data: any) => void;
|
|
23
|
+
getPayload: () => {
|
|
24
|
+
msgId: string;
|
|
25
|
+
methodName: string;
|
|
26
|
+
body: object;
|
|
27
|
+
type: string;
|
|
28
|
+
invokeType: "" | "browserView";
|
|
29
|
+
};
|
|
30
|
+
}
|
|
11
31
|
declare class Frame {
|
|
12
32
|
pendingMsgs: {};
|
|
13
|
-
invokeType?: InvokeType;
|
|
14
|
-
moduleId?: string;
|
|
15
33
|
constructor();
|
|
16
34
|
addPending: (e: any) => void;
|
|
17
35
|
deletePending: (e: any) => void;
|
|
18
36
|
getPending: (t: any) => any;
|
|
19
37
|
invokeAPIInBrowserView: (payload: string) => void;
|
|
20
38
|
invokeAPIInWebview: (payload: string) => void;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
handleCallback: (datas: any, invokeType?: InvokeType) => void;
|
|
39
|
+
invokeAPI: (method: string, param: any, callback: any) => GenPostMsg;
|
|
40
|
+
handleCallback: (datas: any, invokeType?: 'browserView' | '') => void;
|
|
24
41
|
init: () => void;
|
|
25
42
|
}
|
|
26
43
|
declare const frame: Frame;
|
|
@@ -21,7 +21,6 @@ var GenPostMsg = /*#__PURE__*/_createClass(function GenPostMsg(method, param, ca
|
|
|
21
21
|
return {
|
|
22
22
|
msgId: _this.id,
|
|
23
23
|
methodName: _this.methodName,
|
|
24
|
-
moduleId: _this.moduleId,
|
|
25
24
|
body: _this.plainMsg,
|
|
26
25
|
type: 'request',
|
|
27
26
|
invokeType: _this.invokeType
|
|
@@ -35,7 +34,6 @@ var GenPostMsg = /*#__PURE__*/_createClass(function GenPostMsg(method, param, ca
|
|
|
35
34
|
this.methodName = method;
|
|
36
35
|
this.plainMsg = param;
|
|
37
36
|
this.invokeType = param === null || param === void 0 ? void 0 : param.invokeType;
|
|
38
|
-
this.moduleId = param === null || param === void 0 ? void 0 : param.moduleId;
|
|
39
37
|
this.callback = callback;
|
|
40
38
|
// this.result = new Promise(
|
|
41
39
|
// function (resolve, reject) {
|
|
@@ -64,25 +62,12 @@ var Frame = /*#__PURE__*/_createClass(function Frame() {
|
|
|
64
62
|
this.invokeAPIInWebview = function (payload) {
|
|
65
63
|
window.sendToHost(payload);
|
|
66
64
|
};
|
|
67
|
-
this.invokeAPIInModuleFederation = function (payload) {
|
|
68
|
-
window.remoteSendToHost(payload);
|
|
69
|
-
};
|
|
70
65
|
this.invokeAPI = function (method, param, callback) {
|
|
71
|
-
var genPostMsg;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var payload = _JSON$stringify(genPostMsg.getPayload());
|
|
77
|
-
_this2.invokeAPIInModuleFederation(payload);
|
|
78
|
-
} else {
|
|
79
|
-
genPostMsg = new GenPostMsg(method, param, callback);
|
|
80
|
-
var _payload = _JSON$stringify(genPostMsg.getPayload());
|
|
81
|
-
var _param$invokeType = param.invokeType,
|
|
82
|
-
invokeType = _param$invokeType === void 0 ? '' : _param$invokeType;
|
|
83
|
-
invokeType === 'browserView' ? _this2.invokeAPIInBrowserView(_payload) : _this2.invokeAPIInWebview(_payload);
|
|
84
|
-
}
|
|
85
|
-
// 调用时传入 moduleId
|
|
66
|
+
var genPostMsg = new GenPostMsg(method, param, callback);
|
|
67
|
+
var payload = _JSON$stringify(genPostMsg.getPayload());
|
|
68
|
+
var _param$invokeType = param.invokeType,
|
|
69
|
+
invokeType = _param$invokeType === void 0 ? '' : _param$invokeType;
|
|
70
|
+
invokeType === 'browserView' ? _this2.invokeAPIInBrowserView(payload) : _this2.invokeAPIInWebview(payload);
|
|
86
71
|
_this2.addPending(genPostMsg);
|
|
87
72
|
return genPostMsg;
|
|
88
73
|
};
|
|
@@ -91,11 +76,9 @@ var Frame = /*#__PURE__*/_createClass(function Frame() {
|
|
|
91
76
|
methodName = datas.methodName,
|
|
92
77
|
eventName = datas.eventName,
|
|
93
78
|
msgId = datas.msgId,
|
|
94
|
-
|
|
95
|
-
data = _datas$data === void 0 ? {} : _datas$data,
|
|
79
|
+
data = datas.data,
|
|
96
80
|
code = datas.code,
|
|
97
|
-
message = datas.message
|
|
98
|
-
msg = datas.msg;
|
|
81
|
+
message = datas.message;
|
|
99
82
|
if (type === 'request') {
|
|
100
83
|
// 壳子的调用
|
|
101
84
|
switch (methodName) {
|
|
@@ -145,19 +128,12 @@ var Frame = /*#__PURE__*/_createClass(function Frame() {
|
|
|
145
128
|
pending && pending.receiveResponse({
|
|
146
129
|
data: data,
|
|
147
130
|
code: code,
|
|
148
|
-
message: message
|
|
131
|
+
message: message
|
|
149
132
|
});
|
|
150
133
|
code != -3 && _this2.deletePending(msgId);
|
|
151
134
|
}
|
|
152
135
|
};
|
|
153
136
|
this.init = function () {
|
|
154
|
-
var _a;
|
|
155
|
-
if (_this2.invokeType === 'moduleFederation') {
|
|
156
|
-
(_a = window.remoteReceiveFromHost) === null || _a === void 0 ? void 0 : _a.call(window, function (response) {
|
|
157
|
-
_this2.handleCallback(response);
|
|
158
|
-
}, _this2.moduleId);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
137
|
window.addEventListener('message', function (msg) {
|
|
162
138
|
log('electron res: ', msg);
|
|
163
139
|
_this2.handleCallback(msg.data || {});
|
|
@@ -167,8 +143,6 @@ var Frame = /*#__PURE__*/_createClass(function Frame() {
|
|
|
167
143
|
});
|
|
168
144
|
};
|
|
169
145
|
this.pendingMsgs = {};
|
|
170
|
-
this.invokeType = window.remoteSendToHost && window.remoteReceiveFromHost && process ? 'moduleFederation' : '';
|
|
171
|
-
this.moduleId = Math.random().toString(36).substring(2, 15);
|
|
172
146
|
});
|
|
173
147
|
var frame = new Frame();
|
|
174
148
|
export default frame;
|
package/es/lib/sdk/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
3
3
|
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
4
4
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
5
|
-
import { bpitLog
|
|
5
|
+
import { bpitLog } from '../../utils';
|
|
6
6
|
import { compareVersions } from '../../utils/compareVersions';
|
|
7
7
|
import packageInfo from '../../../package.json';
|
|
8
8
|
var Sdk = /*#__PURE__*/function () {
|
|
@@ -70,7 +70,7 @@ var Sdk = /*#__PURE__*/function () {
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
_createClass(Sdk, [{
|
|
74
74
|
key: "setAPI",
|
|
75
75
|
value: function setAPI(method, config) {
|
|
76
76
|
this.invokeAPIConfigMapByMethod[method] = config;
|
|
@@ -142,20 +142,10 @@ var Sdk = /*#__PURE__*/function () {
|
|
|
142
142
|
}
|
|
143
143
|
// 主方法
|
|
144
144
|
this.bridgeInitFn().then(function (fn) {
|
|
145
|
-
fn(method, p).then(function (
|
|
145
|
+
fn(method, p).then(function () {
|
|
146
146
|
// 调用成功
|
|
147
|
-
log("SDK \u8FD4\u56DE\u7ED3\u679C\u6210\u529F ", {
|
|
148
|
-
method: method,
|
|
149
|
-
params: p,
|
|
150
|
-
result: res
|
|
151
|
-
});
|
|
152
147
|
})["catch"](function (error) {
|
|
153
148
|
// 调用失败
|
|
154
|
-
log("SDK \u8FD4\u56DE\u7ED3\u679C\u5931\u8D25", {
|
|
155
|
-
method: method,
|
|
156
|
-
params: p,
|
|
157
|
-
error: error
|
|
158
|
-
});
|
|
159
149
|
});
|
|
160
150
|
})["catch"](function (err) {
|
|
161
151
|
console.log('wenai err', err);
|
|
@@ -165,5 +155,6 @@ var Sdk = /*#__PURE__*/function () {
|
|
|
165
155
|
this._onFail(method, '-1', _concatInstanceProperty(_context2 = "[".concat(method, "] method do not support the current platform (")).call(_context2, this.env.platform, ")"), params.onFail);
|
|
166
156
|
}
|
|
167
157
|
}]);
|
|
158
|
+
return Sdk;
|
|
168
159
|
}();
|
|
169
160
|
export default Sdk;
|
|
@@ -17,7 +17,6 @@ export interface PlatformV2Props {
|
|
|
17
17
|
inPC: boolean;
|
|
18
18
|
inIpad: boolean;
|
|
19
19
|
inIPhone: boolean;
|
|
20
|
-
inHarmonyNext: boolean;
|
|
21
20
|
}
|
|
22
21
|
export interface IENV {
|
|
23
22
|
/** current platform (ios or android or pc or notInYach) */
|
|
@@ -27,7 +26,6 @@ export interface IENV {
|
|
|
27
26
|
/** @deprecated recommend use navigator.language to get current language */
|
|
28
27
|
language?: string;
|
|
29
28
|
platformV2: PlatformV2Props;
|
|
30
|
-
env: 'test' | 'online';
|
|
31
29
|
}
|
|
32
30
|
export interface IInvokeAPIConfigMap {
|
|
33
31
|
[platform: string]: IAPIConfig | undefined;
|
package/es/utils/console.d.ts
CHANGED
package/es/utils/console.js
CHANGED
|
@@ -6,10 +6,10 @@ var myconsole = {
|
|
|
6
6
|
warn: function warn() {},
|
|
7
7
|
error: function error() {}
|
|
8
8
|
};
|
|
9
|
-
if (
|
|
9
|
+
if (window && window.console) {
|
|
10
10
|
myconsole = window.console;
|
|
11
11
|
}
|
|
12
|
-
if (
|
|
12
|
+
if (document && document.body) {
|
|
13
13
|
var iframe = document.createElement('iframe');
|
|
14
14
|
if (iframe && iframe.contentWindow && iframe.contentWindow.console) {
|
|
15
15
|
iframe.style.display = 'none';
|
package/es/utils/env.js
CHANGED
|
@@ -9,9 +9,7 @@ function getENV() {
|
|
|
9
9
|
inAndroid = /Android/i.test(ua) && inYach,
|
|
10
10
|
inPC = /YachPc/i.test(ua),
|
|
11
11
|
inIpad = /iPad/i.test(ua) && inYach,
|
|
12
|
-
inIPhone = /iPhone/i.test(ua) && inYach
|
|
13
|
-
isTest = /Yachtest/.test(ua) && inYach,
|
|
14
|
-
inHarmonyNext = /HarmonyOSNext/i.test(ua) && inYach;
|
|
12
|
+
inIPhone = /iPhone/i.test(ua) && inYach;
|
|
15
13
|
// platform
|
|
16
14
|
var platform = ENV_ENUM.notInYach;
|
|
17
15
|
if (inIOS) {
|
|
@@ -36,12 +34,10 @@ function getENV() {
|
|
|
36
34
|
inAndroid: inAndroid,
|
|
37
35
|
inPC: inPC,
|
|
38
36
|
inIpad: inIpad,
|
|
39
|
-
inIPhone: inIPhone
|
|
40
|
-
inHarmonyNext: inHarmonyNext
|
|
37
|
+
inIPhone: inIPhone
|
|
41
38
|
},
|
|
42
39
|
version: version,
|
|
43
|
-
language: language
|
|
44
|
-
env: isTest ? 'test' : 'online'
|
|
40
|
+
language: language
|
|
45
41
|
};
|
|
46
42
|
}
|
|
47
43
|
export { getENV };
|
package/es/utils/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getENV } from './env';
|
|
|
4
4
|
import bpitLog from './bpitLog';
|
|
5
5
|
import { log, error, warn } from './console';
|
|
6
6
|
function staticsLog(config) {
|
|
7
|
-
var env =
|
|
7
|
+
var env = 'test';
|
|
8
8
|
var version = getENV().version;
|
|
9
9
|
var timestamp = _Date$now();
|
|
10
10
|
var params = _Object$assign({
|
|
@@ -4,9 +4,4 @@ export interface IDeviceNotificationHidePreloaderParams {
|
|
|
4
4
|
onFail?: (err: IError) => void;
|
|
5
5
|
}
|
|
6
6
|
declare function hidePreloader(params?: IDeviceNotificationHidePreloaderParams): void;
|
|
7
|
-
|
|
8
|
-
onSuccess?: () => void;
|
|
9
|
-
onFail?: (err: IError) => void;
|
|
10
|
-
}
|
|
11
|
-
declare function hideCustomOverlayContent(params?: IDeviceNotificationHideCustomPreloaderParams): void;
|
|
12
|
-
export { hidePreloader, hideCustomOverlayContent };
|
|
7
|
+
export { hidePreloader };
|
|
@@ -5,7 +5,6 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
5
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.hideCustomOverlayContent = hideCustomOverlayContent;
|
|
9
8
|
exports.hidePreloader = hidePreloader;
|
|
10
9
|
var _initAPI = _interopRequireDefault(require("../../initAPI"));
|
|
11
10
|
var apiName = 'device.notification.hidePreloader';
|
|
@@ -15,26 +14,13 @@ var ios = {
|
|
|
15
14
|
var android = {
|
|
16
15
|
vs: '0.0.0'
|
|
17
16
|
};
|
|
18
|
-
var pc = {
|
|
19
|
-
vs: '1.9.9'
|
|
20
|
-
};
|
|
21
17
|
var platform = {
|
|
22
18
|
ios: ios,
|
|
23
|
-
android: android
|
|
24
|
-
pc: pc
|
|
19
|
+
android: android
|
|
25
20
|
};
|
|
26
21
|
function hidePreloader(params) {
|
|
27
22
|
(0, _initAPI["default"])(apiName, {
|
|
28
23
|
params: params,
|
|
29
24
|
platform: platform
|
|
30
25
|
});
|
|
31
|
-
}
|
|
32
|
-
var apiNameCustom = 'device.notification.hideCustomOverlayContent';
|
|
33
|
-
function hideCustomOverlayContent(params) {
|
|
34
|
-
(0, _initAPI["default"])(apiNameCustom, {
|
|
35
|
-
params: params,
|
|
36
|
-
platform: {
|
|
37
|
-
pc: pc
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
26
|
}
|
|
@@ -2,17 +2,8 @@ import { IError } from '../../common.typings';
|
|
|
2
2
|
export interface IDeviceNotificationShowPreloaderParams {
|
|
3
3
|
text?: string;
|
|
4
4
|
showIcon?: boolean;
|
|
5
|
-
showCancel?: boolean;
|
|
6
5
|
onSuccess?: () => void;
|
|
7
6
|
onFail?: (err: IError) => void;
|
|
8
7
|
}
|
|
9
8
|
declare function showPreloader(params?: IDeviceNotificationShowPreloaderParams): void;
|
|
10
|
-
|
|
11
|
-
html: string;
|
|
12
|
-
styles?: string;
|
|
13
|
-
containerClassName?: string;
|
|
14
|
-
onSuccess?: () => void;
|
|
15
|
-
onFail?: (err: IError) => void;
|
|
16
|
-
}
|
|
17
|
-
declare function showCustomOverlayContent(params?: IDeviceNotificationShowCustomPreloaderParams): void;
|
|
18
|
-
export { showPreloader, showCustomOverlayContent };
|
|
9
|
+
export { showPreloader };
|
|
@@ -5,7 +5,6 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
5
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.showCustomOverlayContent = showCustomOverlayContent;
|
|
9
8
|
exports.showPreloader = showPreloader;
|
|
10
9
|
var _initAPI = _interopRequireDefault(require("../../initAPI"));
|
|
11
10
|
var apiName = 'device.notification.showPreloader';
|
|
@@ -15,26 +14,13 @@ var ios = {
|
|
|
15
14
|
var android = {
|
|
16
15
|
vs: '0.0.0'
|
|
17
16
|
};
|
|
18
|
-
var pc = {
|
|
19
|
-
vs: '1.9.9'
|
|
20
|
-
};
|
|
21
17
|
var platform = {
|
|
22
18
|
ios: ios,
|
|
23
|
-
android: android
|
|
24
|
-
pc: pc
|
|
19
|
+
android: android
|
|
25
20
|
};
|
|
26
21
|
function showPreloader(params) {
|
|
27
22
|
(0, _initAPI["default"])(apiName, {
|
|
28
23
|
params: params,
|
|
29
24
|
platform: platform
|
|
30
25
|
});
|
|
31
|
-
}
|
|
32
|
-
var apiNameCustom = 'device.notification.showCustomOverlayContent';
|
|
33
|
-
function showCustomOverlayContent(params) {
|
|
34
|
-
(0, _initAPI["default"])(apiNameCustom, {
|
|
35
|
-
params: params,
|
|
36
|
-
platform: {
|
|
37
|
-
pc: pc
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
26
|
}
|
package/libs/api/initAPI.js
CHANGED