yach.open.jssdk 4.3.6-beta2 → 4.3.6-beta4
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.6-beta4.js +1 -0
- package/es/api/app/custom/talYoungFilesUpload.js +2 -0
- package/es/api/biz/chat/chooseConversationByCorpId.js +2 -0
- package/es/api/biz/chat/openSingleChat.js +2 -0
- package/es/api/biz/chat/openSquad.js +2 -0
- package/es/api/biz/chat/openTeamChat.js +2 -0
- package/es/api/biz/chat/pickConversation.js +2 -0
- package/es/api/biz/chat/sendP2PMsg.js +2 -0
- package/es/api/biz/contact/complexPicker.js +2 -0
- package/es/api/biz/contact/departmentsPicker.js +2 -0
- package/es/api/biz/group/groupComplexPicker.js +2 -0
- package/es/api/biz/map/multipointView.js +2 -0
- package/es/api/biz/map/view.js +2 -0
- package/es/api/biz/navigation/close.js +2 -0
- package/es/api/biz/navigation/goBack.js +2 -0
- package/es/api/biz/navigation/quit.js +2 -0
- package/es/api/biz/navigation/replace.js +2 -0
- package/es/api/biz/navigation/setIcon.js +2 -0
- package/es/api/biz/navigation/setLeft.js +2 -0
- package/es/api/biz/navigation/setMenu.js +2 -0
- package/es/api/biz/navigation/setPanGestureEnable.js +2 -0
- package/es/api/biz/navigation/setRight.js +2 -0
- package/es/api/biz/navigation/setTitle.js +2 -0
- package/es/api/biz/navigation/setTitleExpandIcon.js +2 -0
- package/es/api/biz/navigation/setWindowBig.js +2 -0
- package/es/api/biz/navigation/tencentMeeting.js +2 -0
- package/es/api/biz/navigation/tencentMeetingBegin.js +2 -0
- package/es/api/biz/navigation/updateExpandTitle.js +2 -0
- package/es/api/biz/telephone/call.js +2 -0
- package/es/api/biz/telephone/showCallMenu.js +2 -0
- package/es/api/biz/util/addAppToNav.d.ts +9 -0
- package/es/api/biz/util/addAppToNav.js +25 -0
- package/es/api/biz/util/assistantCreate.js +2 -0
- package/es/api/biz/util/authFinish.js +2 -0
- package/es/api/biz/util/authStart.js +2 -0
- package/es/api/biz/util/chosen.js +2 -0
- package/es/api/biz/util/clipboardFileUpload.js +2 -0
- package/es/api/biz/util/closeWindow.js +2 -0
- package/es/api/biz/util/complain.js +2 -0
- package/es/api/biz/util/createModifySchedule.js +2 -0
- package/es/api/biz/util/datepicker.js +2 -0
- package/es/api/biz/util/datetimepicker.js +2 -0
- package/es/api/biz/util/disableScreenCapture.js +2 -0
- package/es/api/biz/util/downloadFile.js +2 -0
- package/es/api/biz/util/entergroupCheck.js +2 -0
- package/es/api/biz/util/externalLinkPreviewFile.js +2 -0
- package/es/api/biz/util/feedback.js +2 -0
- package/es/api/biz/util/getSingleWebviewData.js +2 -0
- package/es/api/biz/util/getTogetherConfig.js +2 -0
- package/es/api/biz/util/getToken.js +2 -0
- package/es/api/biz/util/injectScript.js +2 -0
- package/es/api/biz/util/invoice.js +2 -0
- package/es/api/biz/util/mediaFileUpload.js +2 -0
- package/es/api/biz/util/onlineDocmentOpenTeamChat.js +2 -0
- package/es/api/biz/util/open.js +2 -0
- package/es/api/biz/util/openFutureGroup.js +2 -0
- package/es/api/biz/util/openLink.js +2 -0
- package/es/api/biz/util/openMediaFileDialog.js +2 -0
- package/es/api/biz/util/openSingleWebview.js +2 -0
- package/es/api/biz/util/openSlidePanel.js +2 -0
- package/es/api/biz/util/openTalYoungToTopic.js +2 -0
- package/es/api/biz/util/openTogetherEyeWebview.js +2 -0
- package/es/api/biz/util/openUserSchedule.js +2 -0
- package/es/api/biz/util/openVideoPlayer.js +2 -0
- package/es/api/biz/util/previewFile.js +2 -0
- package/es/api/biz/util/previewImage.js +2 -0
- package/es/api/biz/util/proxy.js +2 -0
- package/es/api/biz/util/pushWorkMsg.js +2 -0
- package/es/api/biz/util/remind.js +2 -0
- package/es/api/biz/util/resetSessionUnread.js +2 -0
- package/es/api/biz/util/rouseApp.js +2 -0
- package/es/api/biz/util/savePic.js +2 -0
- package/es/api/biz/util/scan.js +2 -0
- package/es/api/biz/util/selectDepartment.js +2 -0
- package/es/api/biz/util/share.js +2 -0
- package/es/api/biz/util/takePicture.js +2 -0
- package/es/api/biz/util/uploadAttachment.js +2 -0
- package/es/api/biz/util/yachEvent.js +2 -0
- package/es/api/biz/util/zfbAuth.js +2 -0
- package/es/api/biz/webViewMessage/send.js +2 -0
- package/es/api/device/audio/download.js +2 -0
- package/es/api/device/audio/onPlayEnd.js +2 -0
- package/es/api/device/audio/onRecordEnd.js +2 -0
- package/es/api/device/audio/onRecordEnd_v2.js +2 -0
- package/es/api/device/audio/pause.js +2 -0
- package/es/api/device/audio/play.js +2 -0
- package/es/api/device/audio/resume.js +2 -0
- package/es/api/device/audio/startRecord.js +2 -0
- package/es/api/device/audio/startRecord_v2.js +2 -0
- package/es/api/device/audio/stop.js +2 -0
- package/es/api/device/audio/stopRecord.js +2 -0
- package/es/api/device/audio/stopRecord_v2.js +2 -0
- package/es/api/device/base/checkStepPermission.js +2 -0
- package/es/api/device/base/getPhoneInfo.js +2 -0
- package/es/api/device/base/getUUID.js +2 -0
- package/es/api/device/connection/getNetworkType.js +2 -0
- package/es/api/device/connection/isAtTal.js +4 -2
- package/es/api/device/geolocation/get.js +2 -0
- package/es/api/device/geolocation/getSwitch.js +2 -0
- package/es/api/device/notification/actionSheet.js +2 -0
- package/es/api/device/notification/alert.js +2 -0
- package/es/api/device/notification/confirm.js +2 -0
- package/es/api/device/notification/hidePreloader.js +2 -0
- package/es/api/device/notification/showPreloader.js +2 -0
- package/es/api/device/notification/toast.js +2 -0
- package/es/api/device/notification/vibrate.js +2 -0
- package/es/api/device/system/getLang.js +2 -0
- package/es/api/device/system/setLight.js +2 -0
- package/es/api/initAPI.js +5 -3
- package/es/api/primary/createTab.js +2 -0
- package/es/api/primary/exitFullScreen.js +2 -0
- package/es/api/primary/fullScreen.js +2 -0
- package/es/api/primary/weeklyShare.js +2 -0
- package/es/api/runtime/permission/requestAuthCode.js +2 -0
- package/es/api/ui/pullToRefresh/disable.js +2 -0
- package/es/api/ui/pullToRefresh/enable.js +2 -0
- package/es/api/ui/pullToRefresh/stop.js +2 -0
- package/es/api/ui/webViewBounce/disable.js +2 -0
- package/es/api/util/domainStorage/getItem.js +2 -0
- package/es/api/util/domainStorage/removeItem.js +2 -0
- package/es/api/util/domainStorage/setItem.js +2 -0
- package/es/api/util/tool/flushLog.js +2 -0
- package/es/api/util/tool/log.js +2 -0
- package/es/index.d.ts +3 -1
- package/es/index.js +29 -16
- package/es/lib/bridge/mobile.js +74 -26
- package/es/lib/bridge/pc.js +57 -13
- package/es/lib/helper/apiHelper.js +2 -0
- package/es/lib/helper/codeMap.js +2 -0
- package/es/lib/helper/event.js +19 -7
- package/es/lib/helper/pcIframe.js +52 -20
- package/es/lib/index.js +21 -7
- package/es/lib/sdk/index.js +49 -18
- package/es/lib/sdk/sdk.typings.d.ts +1 -0
- package/es/lib/sdk/sdk.typings.js +1 -0
- package/es/utils/bpitLog.js +13 -4
- package/es/utils/compareVersions.js +53 -26
- package/es/utils/console.js +17 -1
- package/es/utils/env.js +21 -12
- package/es/utils/index.js +7 -2
- package/libs/api/app/custom/talYoungFilesUpload.js +7 -2
- package/libs/api/biz/chat/chooseConversationByCorpId.js +7 -1
- package/libs/api/biz/chat/openSingleChat.js +7 -1
- package/libs/api/biz/chat/openSquad.js +7 -1
- package/libs/api/biz/chat/openTeamChat.js +7 -1
- package/libs/api/biz/chat/pickConversation.js +7 -1
- package/libs/api/biz/chat/sendP2PMsg.js +7 -1
- package/libs/api/biz/contact/complexPicker.js +7 -1
- package/libs/api/biz/contact/departmentsPicker.js +7 -1
- package/libs/api/biz/group/groupComplexPicker.js +7 -1
- package/libs/api/biz/map/multipointView.js +7 -1
- package/libs/api/biz/map/view.js +7 -1
- package/libs/api/biz/navigation/close.js +7 -1
- package/libs/api/biz/navigation/goBack.js +7 -1
- package/libs/api/biz/navigation/quit.js +7 -1
- package/libs/api/biz/navigation/replace.js +7 -1
- package/libs/api/biz/navigation/setIcon.js +8 -1
- package/libs/api/biz/navigation/setLeft.js +8 -1
- package/libs/api/biz/navigation/setMenu.js +8 -1
- package/libs/api/biz/navigation/setPanGestureEnable.js +8 -1
- package/libs/api/biz/navigation/setRight.js +8 -1
- package/libs/api/biz/navigation/setTitle.js +7 -1
- package/libs/api/biz/navigation/setTitleExpandIcon.js +8 -1
- package/libs/api/biz/navigation/setWindowBig.js +7 -2
- package/libs/api/biz/navigation/tencentMeeting.js +7 -1
- package/libs/api/biz/navigation/tencentMeetingBegin.js +7 -1
- package/libs/api/biz/navigation/updateExpandTitle.js +7 -1
- package/libs/api/biz/telephone/call.js +7 -1
- package/libs/api/biz/telephone/showCallMenu.js +7 -1
- package/libs/api/biz/util/addAppToNav.d.ts +9 -0
- package/libs/api/biz/util/addAppToNav.js +36 -0
- package/libs/api/biz/util/assistantCreate.js +7 -1
- package/libs/api/biz/util/authFinish.js +7 -1
- package/libs/api/biz/util/authStart.js +7 -1
- package/libs/api/biz/util/chosen.js +7 -1
- package/libs/api/biz/util/clipboardFileUpload.js +7 -1
- package/libs/api/biz/util/closeWindow.js +7 -1
- package/libs/api/biz/util/complain.js +7 -1
- package/libs/api/biz/util/createModifySchedule.js +7 -1
- package/libs/api/biz/util/datepicker.js +7 -1
- package/libs/api/biz/util/datetimepicker.js +7 -1
- package/libs/api/biz/util/disableScreenCapture.js +7 -1
- package/libs/api/biz/util/downloadFile.js +7 -1
- package/libs/api/biz/util/entergroupCheck.js +7 -1
- package/libs/api/biz/util/externalLinkPreviewFile.js +7 -1
- package/libs/api/biz/util/feedback.js +7 -1
- package/libs/api/biz/util/getSingleWebviewData.js +7 -1
- package/libs/api/biz/util/getTogetherConfig.js +7 -1
- package/libs/api/biz/util/getToken.js +7 -1
- package/libs/api/biz/util/injectScript.js +7 -1
- package/libs/api/biz/util/invoice.js +7 -2
- package/libs/api/biz/util/mediaFileUpload.js +7 -2
- package/libs/api/biz/util/onlineDocmentOpenTeamChat.js +7 -1
- package/libs/api/biz/util/open.js +7 -1
- package/libs/api/biz/util/openFutureGroup.js +7 -1
- package/libs/api/biz/util/openLink.js +7 -1
- package/libs/api/biz/util/openMediaFileDialog.js +7 -2
- package/libs/api/biz/util/openSingleWebview.js +7 -1
- package/libs/api/biz/util/openSlidePanel.js +7 -1
- package/libs/api/biz/util/openTalYoungToTopic.js +7 -2
- package/libs/api/biz/util/openTogetherEyeWebview.js +7 -1
- package/libs/api/biz/util/openUserSchedule.js +7 -1
- package/libs/api/biz/util/openVideoPlayer.js +7 -1
- package/libs/api/biz/util/previewFile.js +7 -1
- package/libs/api/biz/util/previewImage.js +7 -1
- package/libs/api/biz/util/proxy.js +7 -1
- package/libs/api/biz/util/pushWorkMsg.js +7 -2
- package/libs/api/biz/util/remind.js +7 -1
- package/libs/api/biz/util/resetSessionUnread.js +7 -1
- package/libs/api/biz/util/rouseApp.js +7 -2
- package/libs/api/biz/util/savePic.js +7 -1
- package/libs/api/biz/util/scan.js +7 -1
- package/libs/api/biz/util/selectDepartment.js +7 -1
- package/libs/api/biz/util/share.js +7 -1
- package/libs/api/biz/util/takePicture.js +7 -1
- package/libs/api/biz/util/uploadAttachment.js +7 -1
- package/libs/api/biz/util/yachEvent.js +7 -1
- package/libs/api/biz/util/zfbAuth.js +7 -1
- package/libs/api/biz/webViewMessage/send.js +7 -1
- package/libs/api/device/audio/download.js +7 -1
- package/libs/api/device/audio/onPlayEnd.js +7 -1
- package/libs/api/device/audio/onRecordEnd.js +7 -1
- package/libs/api/device/audio/onRecordEnd_v2.js +7 -1
- package/libs/api/device/audio/pause.js +7 -1
- package/libs/api/device/audio/play.js +7 -1
- package/libs/api/device/audio/resume.js +7 -1
- package/libs/api/device/audio/startRecord.js +7 -1
- package/libs/api/device/audio/startRecord_v2.js +7 -1
- package/libs/api/device/audio/stop.js +7 -1
- package/libs/api/device/audio/stopRecord.js +7 -1
- package/libs/api/device/audio/stopRecord_v2.js +7 -1
- package/libs/api/device/base/checkStepPermission.js +7 -1
- package/libs/api/device/base/getPhoneInfo.js +7 -1
- package/libs/api/device/base/getUUID.js +7 -1
- package/libs/api/device/connection/getNetworkType.js +7 -1
- package/libs/api/device/connection/isAtTal.js +9 -3
- package/libs/api/device/geolocation/get.js +7 -1
- package/libs/api/device/geolocation/getSwitch.js +7 -1
- package/libs/api/device/notification/actionSheet.js +7 -1
- package/libs/api/device/notification/alert.js +7 -1
- package/libs/api/device/notification/confirm.js +7 -1
- package/libs/api/device/notification/hidePreloader.js +7 -1
- package/libs/api/device/notification/showPreloader.js +7 -1
- package/libs/api/device/notification/toast.js +7 -1
- package/libs/api/device/notification/vibrate.js +7 -1
- package/libs/api/device/system/getLang.js +7 -1
- package/libs/api/device/system/setLight.js +7 -1
- package/libs/api/initAPI.js +13 -4
- package/libs/api/primary/createTab.js +7 -1
- package/libs/api/primary/exitFullScreen.js +7 -1
- package/libs/api/primary/fullScreen.js +7 -1
- package/libs/api/primary/weeklyShare.js +7 -1
- package/libs/api/runtime/permission/requestAuthCode.js +7 -1
- package/libs/api/ui/pullToRefresh/disable.js +7 -1
- package/libs/api/ui/pullToRefresh/enable.js +7 -1
- package/libs/api/ui/pullToRefresh/stop.js +7 -1
- package/libs/api/ui/webViewBounce/disable.js +7 -1
- package/libs/api/util/domainStorage/getItem.js +7 -1
- package/libs/api/util/domainStorage/removeItem.js +7 -1
- package/libs/api/util/domainStorage/setItem.js +7 -1
- package/libs/api/util/tool/flushLog.js +7 -1
- package/libs/api/util/tool/log.js +7 -1
- package/libs/index.d.ts +3 -1
- package/libs/index.js +512 -258
- package/libs/lib/bridge/index.js +13 -6
- package/libs/lib/bridge/mobile.js +96 -30
- package/libs/lib/bridge/pc.js +74 -18
- package/libs/lib/helper/apiHelper.js +7 -1
- package/libs/lib/helper/codeMap.js +7 -1
- package/libs/lib/helper/event.js +28 -8
- package/libs/lib/helper/pcIframe.js +59 -19
- package/libs/lib/index.js +33 -9
- package/libs/lib/sdk/index.js +58 -18
- package/libs/lib/sdk/sdk.typings.d.ts +1 -0
- package/libs/lib/sdk/sdk.typings.js +4 -0
- package/libs/utils/bpitLog.js +16 -4
- package/libs/utils/compareVersions.js +77 -32
- package/libs/utils/console.js +18 -2
- package/libs/utils/env.js +23 -12
- package/libs/utils/index.js +22 -9
- package/package.json +1 -1
- package/dist/yach_jssdk_4.3.6-beta2.js +0 -1
package/libs/lib/bridge/index.js
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
+
|
|
4
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
|
-
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _pc.PcBridgeInit;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
8
|
+
|
|
13
9
|
_Object$defineProperty(exports, "mobileBridge", {
|
|
14
10
|
enumerable: true,
|
|
15
11
|
get: function get() {
|
|
16
12
|
return _mobile.mobileBridge;
|
|
17
13
|
}
|
|
18
14
|
});
|
|
15
|
+
|
|
19
16
|
_Object$defineProperty(exports, "mobileBridgeInit", {
|
|
20
17
|
enumerable: true,
|
|
21
18
|
get: function get() {
|
|
22
19
|
return _mobile.mobileBridgeInit;
|
|
23
20
|
}
|
|
24
21
|
});
|
|
22
|
+
|
|
25
23
|
_Object$defineProperty(exports, "pcBridge", {
|
|
26
24
|
enumerable: true,
|
|
27
25
|
get: function get() {
|
|
28
26
|
return _pc.pcBridge;
|
|
29
27
|
}
|
|
30
28
|
});
|
|
29
|
+
|
|
30
|
+
_Object$defineProperty(exports, "PcBridgeInit", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _pc.PcBridgeInit;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
31
37
|
var _mobile = require("./mobile");
|
|
38
|
+
|
|
32
39
|
var _pc = require("./pc");
|
|
@@ -1,28 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
10
|
+
|
|
8
11
|
exports.mobileBridgeInit = exports.mobileBridge = void 0;
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/json/stringify"));
|
|
14
|
+
|
|
12
15
|
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/parse-int"));
|
|
16
|
+
|
|
17
|
+
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/assign"));
|
|
18
|
+
|
|
19
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
|
|
20
|
+
|
|
21
|
+
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/set-timeout"));
|
|
22
|
+
|
|
13
23
|
var _event = _interopRequireDefault(require("../helper/event"));
|
|
24
|
+
|
|
14
25
|
var _codeMap = require("../helper/codeMap");
|
|
26
|
+
|
|
15
27
|
var _utils = require("../../utils");
|
|
28
|
+
|
|
16
29
|
function setupWebViewJavascriptBridge(callback) {
|
|
17
30
|
if (window.WebViewJavascriptBridge) {
|
|
18
31
|
return callback(WebViewJavascriptBridge);
|
|
19
32
|
}
|
|
33
|
+
|
|
20
34
|
if (window.WKWebViewJavascriptBridge) {
|
|
21
35
|
return callback(WKWebViewJavascriptBridge);
|
|
22
36
|
}
|
|
37
|
+
|
|
23
38
|
if (window.WVJBCallbacks) {
|
|
24
39
|
return window.WVJBCallbacks.push(callback);
|
|
25
40
|
}
|
|
41
|
+
|
|
26
42
|
window.WVJBCallbacks = [callback];
|
|
27
43
|
var WVJBIframe = document.createElement('iframe');
|
|
28
44
|
WVJBIframe.style.display = 'none';
|
|
@@ -32,7 +48,8 @@ function setupWebViewJavascriptBridge(callback) {
|
|
|
32
48
|
document.documentElement.removeChild(WVJBIframe);
|
|
33
49
|
}, 0);
|
|
34
50
|
}
|
|
35
|
-
|
|
51
|
+
|
|
52
|
+
var mobileBridgeInit = function mobileBridgeInit() {
|
|
36
53
|
return new _promise["default"](function (resolve, reject) {
|
|
37
54
|
setupWebViewJavascriptBridge(function (bridge) {
|
|
38
55
|
(0, _utils.log)("\u6CE8\u518Cresume\u4E8B\u4EF6 ");
|
|
@@ -40,6 +57,7 @@ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
|
|
|
40
57
|
(0, _utils.log)("resume\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
41
58
|
resData: resData
|
|
42
59
|
});
|
|
60
|
+
|
|
43
61
|
_event["default"].execEvent('resume', resData);
|
|
44
62
|
});
|
|
45
63
|
(0, _utils.log)("\u6CE8\u518CunreadMsgAction\u4E8B\u4EF6 ");
|
|
@@ -47,6 +65,7 @@ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
|
|
|
47
65
|
(0, _utils.log)("unreadMsgAction\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
48
66
|
resData: resData
|
|
49
67
|
});
|
|
68
|
+
|
|
50
69
|
_event["default"].execEvent('unreadMsgAction', resData);
|
|
51
70
|
});
|
|
52
71
|
(0, _utils.log)("\u6CE8\u518CwebViewMsgReceive\u4E8B\u4EF6 ");
|
|
@@ -54,31 +73,38 @@ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
|
|
|
54
73
|
(0, _utils.log)("webViewMsgReceive\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
55
74
|
resData: resData
|
|
56
75
|
});
|
|
76
|
+
|
|
57
77
|
_event["default"].execEvent('webViewMsgReceive', resData);
|
|
58
78
|
});
|
|
59
79
|
bridge.registerHandler('pushWorkMsg', function (resData) {
|
|
60
80
|
(0, _utils.log)("pushWorkMsg\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
61
81
|
resData: resData
|
|
62
82
|
});
|
|
83
|
+
|
|
63
84
|
_event["default"].execEvent('pushWorkMsg', resData);
|
|
64
85
|
});
|
|
65
86
|
bridge.registerHandler('getTogetherCallback', function (resData) {
|
|
66
87
|
(0, _utils.log)("getTogetherCallback\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
67
88
|
resData: resData
|
|
68
89
|
});
|
|
90
|
+
|
|
69
91
|
_event["default"].execEvent('getTogetherCallback', resData);
|
|
70
92
|
});
|
|
71
93
|
bridge.registerHandler('sendMsgCommon', function (resData) {
|
|
72
94
|
(0, _utils.log)("sendMsgCommon ", {
|
|
73
95
|
resData: resData
|
|
74
96
|
});
|
|
97
|
+
|
|
75
98
|
_event["default"].execEvent('sendMsgCommon', resData);
|
|
76
99
|
});
|
|
77
100
|
resolve();
|
|
78
101
|
});
|
|
79
102
|
});
|
|
80
103
|
};
|
|
81
|
-
|
|
104
|
+
|
|
105
|
+
exports.mobileBridgeInit = mobileBridgeInit;
|
|
106
|
+
|
|
107
|
+
var mobileBridge = function mobileBridge(method, param) {
|
|
82
108
|
return new _promise["default"](function (resolve, reject) {
|
|
83
109
|
var p = (0, _assign["default"])({}, param);
|
|
84
110
|
setupWebViewJavascriptBridge(function (bridge) {
|
|
@@ -86,6 +112,7 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
|
|
|
86
112
|
bridge.registerHandler(method, function (data) {
|
|
87
113
|
var onSuccess = param.onSuccess;
|
|
88
114
|
delete p.onSuccess;
|
|
115
|
+
|
|
89
116
|
if ('function' === typeof onSuccess) {
|
|
90
117
|
onSuccess(data);
|
|
91
118
|
resolve({
|
|
@@ -95,31 +122,15 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
|
|
|
95
122
|
}
|
|
96
123
|
});
|
|
97
124
|
}
|
|
125
|
+
|
|
98
126
|
bridge.callHandler(method, param, function (e) {
|
|
99
127
|
var code = e.code,
|
|
100
|
-
|
|
101
|
-
|
|
128
|
+
message = e.message,
|
|
129
|
+
data = e.data;
|
|
130
|
+
|
|
102
131
|
var _code = (0, _parseInt2["default"])(code);
|
|
132
|
+
|
|
103
133
|
var callbackStr = (0, _codeMap.electronResCodeMap)(_code);
|
|
104
|
-
if (_code === -2 || _code === 7) {
|
|
105
|
-
(0, _utils.bpitLog)({
|
|
106
|
-
method: method,
|
|
107
|
-
errorcode: _code,
|
|
108
|
-
message: message || 'SDK执行失败回调,相关参数'
|
|
109
|
-
});
|
|
110
|
-
(0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
111
|
-
method: method,
|
|
112
|
-
param: param,
|
|
113
|
-
data: data,
|
|
114
|
-
_code: _code,
|
|
115
|
-
message: message
|
|
116
|
-
});
|
|
117
|
-
reject({
|
|
118
|
-
_code: _code,
|
|
119
|
-
message: message
|
|
120
|
-
});
|
|
121
|
-
// return;
|
|
122
|
-
}
|
|
123
134
|
var callbackFun = p[callbackStr];
|
|
124
135
|
(0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
125
136
|
method: method,
|
|
@@ -128,16 +139,71 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
|
|
|
128
139
|
_code: _code,
|
|
129
140
|
message: message,
|
|
130
141
|
callbackFun: callbackFun
|
|
131
|
-
});
|
|
142
|
+
}); // 请求失败
|
|
143
|
+
|
|
144
|
+
if (callbackStr === 'onFail') {
|
|
145
|
+
(0, _utils.bpitLog)({
|
|
146
|
+
method: method,
|
|
147
|
+
errorcode: _code,
|
|
148
|
+
message: message || (0, _stringify["default"])(data) || 'SDK执行失败回调,相关参数'
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
if ('function' === typeof callbackFun) {
|
|
152
|
+
message ? callbackFun({
|
|
153
|
+
code: code,
|
|
154
|
+
message: message
|
|
155
|
+
}) : callbackFun(data);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
reject({
|
|
159
|
+
_code: _code,
|
|
160
|
+
message: message,
|
|
161
|
+
data: data
|
|
162
|
+
});
|
|
163
|
+
return;
|
|
164
|
+
} // 请求成功
|
|
165
|
+
|
|
166
|
+
|
|
132
167
|
if ('function' === typeof callbackFun) {
|
|
133
168
|
callbackFun(data || message);
|
|
134
169
|
}
|
|
170
|
+
|
|
135
171
|
resolve({
|
|
136
172
|
_code: _code,
|
|
137
173
|
message: message,
|
|
138
174
|
data: data
|
|
139
|
-
});
|
|
175
|
+
}); // if (_code === -2 || _code === 7) {
|
|
176
|
+
// bpitLog({
|
|
177
|
+
// method,
|
|
178
|
+
// errorcode: _code,
|
|
179
|
+
// message: message || 'SDK执行失败回调,相关参数',
|
|
180
|
+
// });
|
|
181
|
+
// log(`SDK执行后回调,相关参数 `, {
|
|
182
|
+
// method,
|
|
183
|
+
// param,
|
|
184
|
+
// data,
|
|
185
|
+
// _code,
|
|
186
|
+
// message,
|
|
187
|
+
// });
|
|
188
|
+
// reject({_code, message});
|
|
189
|
+
// // return;
|
|
190
|
+
// }
|
|
191
|
+
// const callbackFun = p[callbackStr];
|
|
192
|
+
// log(`SDK执行后回调,相关参数 `, {
|
|
193
|
+
// method,
|
|
194
|
+
// param,
|
|
195
|
+
// data,
|
|
196
|
+
// _code,
|
|
197
|
+
// message,
|
|
198
|
+
// callbackFun,
|
|
199
|
+
// });
|
|
200
|
+
// if ('function' === typeof callbackFun) {
|
|
201
|
+
// callbackFun(data || message);
|
|
202
|
+
// }
|
|
203
|
+
// resolve({_code, message, data});
|
|
140
204
|
});
|
|
141
205
|
});
|
|
142
206
|
});
|
|
143
|
-
};
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
exports.mobileBridge = mobileBridge;
|
package/libs/lib/bridge/pc.js
CHANGED
|
@@ -1,34 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
exports.PcBridgeInit = exports.pcBridge = void 0;
|
|
12
|
+
|
|
13
|
+
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/json/stringify"));
|
|
14
|
+
|
|
10
15
|
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/parse-int"));
|
|
16
|
+
|
|
17
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
|
|
18
|
+
|
|
11
19
|
var _pcIframe = _interopRequireDefault(require("../helper/pcIframe"));
|
|
20
|
+
|
|
12
21
|
var _codeMap = require("../helper/codeMap");
|
|
22
|
+
|
|
13
23
|
var _utils = require("../../utils");
|
|
14
|
-
|
|
24
|
+
|
|
25
|
+
var PcBridgeInit = function PcBridgeInit() {
|
|
15
26
|
_pcIframe["default"].init();
|
|
16
27
|
};
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
|
|
29
|
+
exports.PcBridgeInit = PcBridgeInit;
|
|
30
|
+
|
|
31
|
+
var pcBridge = function pcBridge(method, param) {
|
|
32
|
+
return new _promise["default"](function (resolve, reject) {
|
|
19
33
|
return _pcIframe["default"].invokeAPI(method, param, function (_ref) {
|
|
20
34
|
var data = _ref.data,
|
|
21
|
-
|
|
22
|
-
|
|
35
|
+
code = _ref.code,
|
|
36
|
+
message = _ref.message;
|
|
37
|
+
|
|
23
38
|
var _code = (0, _parseInt2["default"])(code);
|
|
39
|
+
|
|
24
40
|
var callbackStr = (0, _codeMap.electronResCodeMap)(_code);
|
|
25
|
-
if (_code === -2) {
|
|
26
|
-
(0, _utils.bpitLog)({
|
|
27
|
-
method: method,
|
|
28
|
-
errorcode: _code,
|
|
29
|
-
message: message || 'SDK执行失败回调,相关参数'
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
41
|
var callbackFun = param[callbackStr];
|
|
33
42
|
(0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
34
43
|
method: method,
|
|
@@ -37,15 +46,62 @@ var pcBridge = exports.pcBridge = function pcBridge(method, param) {
|
|
|
37
46
|
_code: _code,
|
|
38
47
|
message: message,
|
|
39
48
|
callbackFun: callbackFun
|
|
40
|
-
});
|
|
49
|
+
}); // 请求失败
|
|
50
|
+
|
|
51
|
+
if (callbackStr === 'onFail') {
|
|
52
|
+
(0, _utils.bpitLog)({
|
|
53
|
+
method: method,
|
|
54
|
+
errorcode: _code,
|
|
55
|
+
message: message || (0, _stringify["default"])(data) || 'SDK执行失败回调,相关参数'
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if ('function' === typeof callbackFun) {
|
|
59
|
+
console.log('wenai-code', code, _code);
|
|
60
|
+
message ? callbackFun({
|
|
61
|
+
code: code,
|
|
62
|
+
message: message
|
|
63
|
+
}) : callbackFun(data);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
reject({
|
|
67
|
+
_code: _code,
|
|
68
|
+
message: message,
|
|
69
|
+
data: data
|
|
70
|
+
});
|
|
71
|
+
return;
|
|
72
|
+
} // 请求成功
|
|
73
|
+
|
|
74
|
+
|
|
41
75
|
if ('function' === typeof callbackFun) {
|
|
42
76
|
callbackFun(data || message);
|
|
43
77
|
}
|
|
78
|
+
|
|
44
79
|
resolve({
|
|
45
80
|
_code: _code,
|
|
46
81
|
message: message,
|
|
47
82
|
data: data
|
|
48
|
-
});
|
|
83
|
+
}); // if (_code === -2) {
|
|
84
|
+
// bpitLog({
|
|
85
|
+
// method,
|
|
86
|
+
// errorcode: _code,
|
|
87
|
+
// message: message || 'SDK执行失败回调,相关参数',
|
|
88
|
+
// });
|
|
89
|
+
// }
|
|
90
|
+
// const callbackFun = param[callbackStr];
|
|
91
|
+
// log(`SDK执行后回调,相关参数 `, {
|
|
92
|
+
// method,
|
|
93
|
+
// param,
|
|
94
|
+
// data,
|
|
95
|
+
// _code,
|
|
96
|
+
// message,
|
|
97
|
+
// callbackFun
|
|
98
|
+
// });
|
|
99
|
+
// if ('function' === typeof callbackFun) {
|
|
100
|
+
// callbackFun(data || message);
|
|
101
|
+
// }
|
|
102
|
+
// resolve({ _code, message, data });
|
|
49
103
|
});
|
|
50
104
|
});
|
|
51
|
-
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
exports.pcBridge = pcBridge;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
10
|
+
|
|
8
11
|
exports.genDefaultParamsDealFn = genDefaultParamsDealFn;
|
|
12
|
+
|
|
9
13
|
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/assign"));
|
|
14
|
+
|
|
10
15
|
function genDefaultParamsDealFn(p) {
|
|
11
16
|
return function (r) {
|
|
12
17
|
return (0, _assign["default"])((0, _assign["default"])({}, p), r);
|
|
13
18
|
};
|
|
14
19
|
}
|
|
20
|
+
|
|
15
21
|
;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
10
|
+
|
|
8
11
|
exports.electronResCodeMap = electronResCodeMap;
|
|
12
|
+
|
|
9
13
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/map"));
|
|
14
|
+
|
|
10
15
|
var resCodeMap = new _map["default"]([[0, 'onSuccess'], [-1, 'onCancel'], [-2, 'onFail'], [-3, 'onProgress'], [-4, 'onSubmit']]);
|
|
16
|
+
|
|
11
17
|
function electronResCodeMap(code) {
|
|
12
18
|
return resCodeMap.get(code) || 'onFail';
|
|
13
19
|
}
|
package/libs/lib/helper/event.js
CHANGED
|
@@ -1,39 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
6
|
+
|
|
5
7
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
10
|
+
|
|
8
11
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/index-of"));
|
|
11
|
-
var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/splice"));
|
|
12
|
+
|
|
12
13
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/for-each"));
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/splice"));
|
|
16
|
+
|
|
17
|
+
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/index-of"));
|
|
18
|
+
|
|
19
|
+
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/array/is-array"));
|
|
20
|
+
|
|
14
21
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
15
|
-
|
|
22
|
+
|
|
23
|
+
var Event = function Event() {
|
|
16
24
|
var _this = this;
|
|
25
|
+
|
|
17
26
|
(0, _classCallCheck2["default"])(this, Event);
|
|
27
|
+
|
|
18
28
|
this.on = function (event, fn) {
|
|
19
29
|
if (!event || 'function' !== typeof fn) throw 'eventName is null or handle is not a function, on fail';
|
|
20
30
|
if (!(0, _isArray["default"])(_this.eventsHandle[event])) _this.eventsHandle[event] = [];
|
|
31
|
+
|
|
21
32
|
_this.eventsHandle[event].push(fn);
|
|
22
33
|
};
|
|
34
|
+
|
|
23
35
|
this.off = function (event, fn) {
|
|
24
36
|
if (!event) throw 'eventName is null, invoke off fail';
|
|
37
|
+
|
|
25
38
|
if (!fn) {
|
|
26
39
|
_this.eventsHandle[event] = [];
|
|
27
40
|
return;
|
|
28
41
|
}
|
|
42
|
+
|
|
29
43
|
if ((0, _isArray["default"])(_this.eventsHandle[event])) {
|
|
30
44
|
var _context, _context2;
|
|
45
|
+
|
|
31
46
|
var n = (0, _indexOf["default"])(_context = _this.eventsHandle[event]).call(_context, fn);
|
|
32
47
|
-1 !== n && (0, _splice["default"])(_context2 = _this.eventsHandle[event]).call(_context2, n, 1);
|
|
33
48
|
}
|
|
34
49
|
};
|
|
50
|
+
|
|
35
51
|
this.execEvent = function (event, data) {
|
|
36
52
|
var _context3;
|
|
53
|
+
|
|
37
54
|
(0, _isArray["default"])(this.eventsHandle[event]) && (0, _forEach["default"])(_context3 = this.eventsHandle[event]).call(_context3, function (fn) {
|
|
38
55
|
try {
|
|
39
56
|
fn(data);
|
|
@@ -42,7 +59,10 @@ var Event = /*#__PURE__*/(0, _createClass2["default"])(function Event() {
|
|
|
42
59
|
}
|
|
43
60
|
});
|
|
44
61
|
};
|
|
62
|
+
|
|
45
63
|
this.eventsHandle = {};
|
|
46
|
-
}
|
|
64
|
+
};
|
|
65
|
+
|
|
47
66
|
var event = new Event();
|
|
48
|
-
var _default =
|
|
67
|
+
var _default = event;
|
|
68
|
+
exports["default"] = _default;
|