yach.open.jssdk 4.4.3 → 4.4.4-beta.11
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.4.4-beta.11.js +1 -0
- package/es/api/app/custom/talYoungFilesUpload.js +0 -2
- package/es/api/biz/chat/chooseConversationByCorpId.js +0 -2
- package/es/api/biz/chat/openSingleChat.js +0 -2
- package/es/api/biz/chat/openSquad.js +0 -2
- package/es/api/biz/chat/openTeamChat.js +0 -2
- package/es/api/biz/chat/pickConversation.js +0 -2
- package/es/api/biz/chat/sendP2PMsg.js +0 -2
- package/es/api/biz/contact/complexPicker.js +0 -2
- package/es/api/biz/contact/departmentsPicker.js +0 -2
- package/es/api/biz/group/groupComplexPicker.js +0 -2
- package/es/api/biz/map/multipointView.js +0 -2
- package/es/api/biz/map/view.js +0 -2
- package/es/api/biz/navigation/close.js +0 -2
- package/es/api/biz/navigation/goBack.js +0 -2
- package/es/api/biz/navigation/quit.js +0 -2
- package/es/api/biz/navigation/replace.js +0 -2
- package/es/api/biz/navigation/setIcon.js +0 -2
- package/es/api/biz/navigation/setLeft.js +0 -2
- package/es/api/biz/navigation/setMenu.js +0 -2
- package/es/api/biz/navigation/setPanGestureEnable.js +0 -2
- package/es/api/biz/navigation/setRight.js +0 -2
- package/es/api/biz/navigation/setTitle.js +0 -2
- package/es/api/biz/navigation/setTitleExpandIcon.js +0 -2
- package/es/api/biz/navigation/setWindowBig.js +0 -2
- package/es/api/biz/navigation/tencentMeeting.js +0 -2
- package/es/api/biz/navigation/tencentMeetingBegin.js +0 -2
- package/es/api/biz/navigation/updateExpandTitle.js +0 -2
- package/es/api/biz/telephone/call.js +0 -2
- package/es/api/biz/telephone/showCallMenu.js +0 -2
- package/es/api/biz/util/addAppToNav.js +0 -2
- package/es/api/biz/util/assistantCreate.js +0 -2
- package/es/api/biz/util/authFinish.js +0 -2
- package/es/api/biz/util/authStart.js +0 -2
- package/es/api/biz/util/chosen.js +0 -2
- package/es/api/biz/util/clipboardFileUpload.js +0 -2
- package/es/api/biz/util/closeWindow.js +0 -2
- package/es/api/biz/util/complain.js +0 -2
- package/es/api/biz/util/copy.d.ts +11 -0
- package/es/api/biz/util/copy.js +19 -0
- package/es/api/biz/util/createModifySchedule.js +0 -2
- package/es/api/biz/util/datepicker.js +0 -2
- package/es/api/biz/util/datetimepicker.js +0 -2
- package/es/api/biz/util/disableScreenCapture.js +0 -2
- package/es/api/biz/util/downloadFile.js +0 -2
- package/es/api/biz/util/entergroupCheck.js +0 -2
- package/es/api/biz/util/externalLinkPreviewFile.js +0 -2
- package/es/api/biz/util/feedback.js +0 -2
- package/es/api/biz/util/getConfig.d.ts +13 -0
- package/es/api/biz/util/getConfig.js +19 -0
- package/es/api/biz/util/getSingleWebviewData.js +0 -2
- package/es/api/biz/util/getTogetherConfig.js +0 -2
- package/es/api/biz/util/getToken.js +0 -2
- package/es/api/biz/util/injectScript.js +0 -2
- package/es/api/biz/util/invoice.js +0 -2
- package/es/api/biz/util/knowledgeBaseSelect.js +9 -3
- package/es/api/biz/util/knowledgeSelectParams.d.ts +14 -0
- package/es/api/biz/util/knowledgeSelectParams.js +19 -0
- package/es/api/biz/util/lorebaseRefreshNodeWebview.d.ts +11 -0
- package/es/api/biz/util/lorebaseRefreshNodeWebview.js +19 -0
- package/es/api/biz/util/lorebaseShowList.d.ts +11 -0
- package/es/api/biz/util/lorebaseShowList.js +19 -0
- package/es/api/biz/util/mediaFileUpload.js +0 -2
- package/es/api/biz/util/onlineDocmentOpenTeamChat.js +0 -2
- package/es/api/biz/util/open.js +0 -2
- package/es/api/biz/util/openFutureGroup.js +0 -2
- package/es/api/biz/util/openLink.js +0 -2
- package/es/api/biz/util/openMediaFileDialog.js +0 -2
- package/es/api/biz/util/openPublish.d.ts +22 -0
- package/es/api/biz/util/openPublish.js +15 -0
- package/es/api/biz/util/openSingleWebview.js +0 -2
- package/es/api/biz/util/openSlidePanel.js +0 -2
- package/es/api/biz/util/openTalYoungToTopic.js +0 -2
- package/es/api/biz/util/openTogetherEyeWebview.js +0 -2
- package/es/api/biz/util/openUserSchedule.js +0 -2
- package/es/api/biz/util/openVideoPlayer.js +0 -2
- package/es/api/biz/util/previewFile.js +0 -2
- package/es/api/biz/util/previewImage.js +0 -2
- package/es/api/biz/util/proxy.js +0 -2
- package/es/api/biz/util/pushWorkMsg.js +0 -2
- package/es/api/biz/util/remind.js +0 -2
- package/es/api/biz/util/resetSessionUnread.js +0 -2
- package/es/api/biz/util/rouseApp.js +0 -2
- package/es/api/biz/util/savePic.js +0 -2
- package/es/api/biz/util/scan.js +0 -2
- package/es/api/biz/util/screen.js +0 -2
- package/es/api/biz/util/selectDepartment.js +0 -2
- package/es/api/biz/util/share.js +0 -2
- package/es/api/biz/util/takePicture.js +0 -2
- package/es/api/biz/util/topicEvent.js +0 -2
- package/es/api/biz/util/uploadAttachment.js +0 -2
- package/es/api/biz/util/weeklyRead.js +0 -2
- package/es/api/biz/util/yachEvent.js +0 -2
- package/es/api/biz/util/zfbAuth.js +0 -2
- package/es/api/biz/webViewMessage/send.js +0 -2
- package/es/api/device/audio/download.js +0 -2
- package/es/api/device/audio/onPlayEnd.js +0 -2
- package/es/api/device/audio/onRecordEnd.js +0 -2
- package/es/api/device/audio/onRecordEnd_v2.js +0 -2
- package/es/api/device/audio/pause.js +0 -2
- package/es/api/device/audio/play.js +0 -2
- package/es/api/device/audio/resume.js +0 -2
- package/es/api/device/audio/startRecord.js +0 -2
- package/es/api/device/audio/startRecord_v2.js +0 -2
- package/es/api/device/audio/stop.js +0 -2
- package/es/api/device/audio/stopRecord.js +0 -2
- package/es/api/device/audio/stopRecord_v2.js +0 -2
- package/es/api/device/base/checkStepPermission.js +0 -2
- package/es/api/device/base/getPhoneInfo.js +0 -2
- package/es/api/device/base/getUUID.js +0 -2
- package/es/api/device/connection/getNetworkType.js +0 -2
- package/es/api/device/connection/isAtTal.js +2 -4
- package/es/api/device/geolocation/get.js +0 -2
- package/es/api/device/geolocation/getSwitch.js +0 -2
- package/es/api/device/notification/actionSheet.js +0 -2
- package/es/api/device/notification/alert.js +0 -2
- package/es/api/device/notification/confirm.js +0 -2
- package/es/api/device/notification/hidePreloader.js +0 -4
- package/es/api/device/notification/showPreloader.js +0 -4
- package/es/api/device/notification/toast.js +0 -2
- package/es/api/device/notification/vibrate.js +0 -2
- package/es/api/device/system/getLang.js +0 -2
- package/es/api/device/system/setLight.js +0 -2
- package/es/api/initAPI.js +3 -5
- package/es/api/primary/createTab.js +0 -2
- package/es/api/primary/exitFullScreen.js +0 -2
- package/es/api/primary/fullScreen.js +0 -2
- package/es/api/primary/updateTab.d.ts +9 -0
- package/es/api/primary/updateTab.js +15 -0
- package/es/api/primary/weeklyShare.js +0 -2
- package/es/api/runtime/permission/requestAuthCode.js +0 -2
- package/es/api/ui/pullToRefresh/disable.js +0 -2
- package/es/api/ui/pullToRefresh/enable.js +0 -2
- package/es/api/ui/pullToRefresh/stop.js +0 -2
- package/es/api/ui/webViewBounce/disable.js +0 -2
- package/es/api/util/domainStorage/getItem.js +0 -2
- package/es/api/util/domainStorage/removeItem.js +0 -2
- package/es/api/util/domainStorage/setItem.js +0 -2
- package/es/api/util/tool/flushLog.js +0 -2
- package/es/api/util/tool/log.js +0 -2
- package/es/index.d.ts +13 -1
- package/es/index.js +29 -28
- package/es/lib/bridge/mobile.js +22 -27
- package/es/lib/bridge/pc.js +11 -18
- package/es/lib/helper/apiHelper.js +0 -2
- package/es/lib/helper/codeMap.js +0 -2
- package/es/lib/helper/event.js +7 -19
- package/es/lib/helper/pcIframe.d.ts +8 -25
- package/es/lib/helper/pcIframe.js +48 -54
- package/es/lib/index.js +7 -21
- package/es/lib/sdk/index.js +16 -37
- package/es/lib/sdk/sdk.typings.d.ts +1 -0
- package/es/lib/sdk/sdk.typings.js +0 -1
- package/es/utils/bpitLog.js +4 -13
- package/es/utils/compareVersions.js +26 -53
- package/es/utils/console.js +1 -17
- package/es/utils/env.js +15 -20
- package/es/utils/index.js +1 -6
- package/libs/api/app/custom/talYoungFilesUpload.js +2 -7
- package/libs/api/biz/chat/chooseConversationByCorpId.js +1 -7
- package/libs/api/biz/chat/openSingleChat.js +1 -7
- package/libs/api/biz/chat/openSquad.js +1 -7
- package/libs/api/biz/chat/openTeamChat.js +1 -7
- package/libs/api/biz/chat/pickConversation.js +1 -7
- package/libs/api/biz/chat/sendP2PMsg.js +1 -7
- package/libs/api/biz/contact/complexPicker.js +1 -7
- package/libs/api/biz/contact/departmentsPicker.js +1 -7
- package/libs/api/biz/group/groupComplexPicker.js +1 -7
- package/libs/api/biz/map/multipointView.js +1 -7
- package/libs/api/biz/map/view.js +1 -7
- package/libs/api/biz/navigation/close.js +1 -7
- package/libs/api/biz/navigation/goBack.js +1 -7
- package/libs/api/biz/navigation/quit.js +1 -7
- package/libs/api/biz/navigation/replace.js +1 -7
- package/libs/api/biz/navigation/setIcon.js +1 -8
- package/libs/api/biz/navigation/setLeft.js +1 -8
- package/libs/api/biz/navigation/setMenu.js +1 -8
- package/libs/api/biz/navigation/setPanGestureEnable.js +1 -8
- package/libs/api/biz/navigation/setRight.js +1 -8
- package/libs/api/biz/navigation/setTitle.js +1 -7
- package/libs/api/biz/navigation/setTitleExpandIcon.js +1 -8
- package/libs/api/biz/navigation/setWindowBig.js +2 -7
- package/libs/api/biz/navigation/tencentMeeting.js +1 -7
- package/libs/api/biz/navigation/tencentMeetingBegin.js +1 -7
- package/libs/api/biz/navigation/updateExpandTitle.js +1 -7
- package/libs/api/biz/telephone/call.js +1 -7
- package/libs/api/biz/telephone/showCallMenu.js +1 -7
- package/libs/api/biz/util/addAppToNav.js +1 -7
- package/libs/api/biz/util/assistantCreate.js +1 -7
- package/libs/api/biz/util/authFinish.js +1 -7
- package/libs/api/biz/util/authStart.js +1 -7
- package/libs/api/biz/util/chosen.js +1 -7
- package/libs/api/biz/util/clipboardFileUpload.js +1 -7
- package/libs/api/biz/util/closeWindow.js +1 -7
- package/libs/api/biz/util/complain.js +1 -7
- package/libs/api/biz/util/copy.d.ts +11 -0
- package/libs/api/biz/util/copy.js +26 -0
- package/libs/api/biz/util/createModifySchedule.js +1 -7
- package/libs/api/biz/util/datepicker.js +1 -7
- package/libs/api/biz/util/datetimepicker.js +1 -7
- package/libs/api/biz/util/disableScreenCapture.js +1 -7
- package/libs/api/biz/util/downloadFile.js +1 -7
- package/libs/api/biz/util/entergroupCheck.js +1 -7
- package/libs/api/biz/util/externalLinkPreviewFile.js +1 -7
- package/libs/api/biz/util/feedback.js +1 -7
- package/libs/api/biz/util/getConfig.d.ts +13 -0
- package/libs/api/biz/util/getConfig.js +26 -0
- package/libs/api/biz/util/getSingleWebviewData.js +1 -7
- package/libs/api/biz/util/getTogetherConfig.js +1 -7
- package/libs/api/biz/util/getToken.js +1 -7
- package/libs/api/biz/util/injectScript.js +1 -7
- package/libs/api/biz/util/invoice.js +2 -7
- package/libs/api/biz/util/knowledgeBaseSelect.js +10 -8
- package/libs/api/biz/util/knowledgeSelectParams.d.ts +14 -0
- package/libs/api/biz/util/knowledgeSelectParams.js +26 -0
- package/libs/api/biz/util/lorebaseRefreshNodeWebview.d.ts +11 -0
- package/libs/api/biz/util/lorebaseRefreshNodeWebview.js +26 -0
- package/libs/api/biz/util/lorebaseShowList.d.ts +11 -0
- package/libs/api/biz/util/lorebaseShowList.js +26 -0
- package/libs/api/biz/util/mediaFileUpload.js +2 -7
- package/libs/api/biz/util/onlineDocmentOpenTeamChat.js +1 -7
- package/libs/api/biz/util/open.js +1 -7
- package/libs/api/biz/util/openFutureGroup.js +1 -7
- package/libs/api/biz/util/openLink.js +1 -7
- package/libs/api/biz/util/openMediaFileDialog.js +2 -7
- package/libs/api/biz/util/openPublish.d.ts +22 -0
- package/libs/api/biz/util/openPublish.js +22 -0
- package/libs/api/biz/util/openSingleWebview.js +1 -7
- package/libs/api/biz/util/openSlidePanel.js +1 -7
- package/libs/api/biz/util/openTalYoungToTopic.js +2 -7
- package/libs/api/biz/util/openTogetherEyeWebview.js +1 -7
- package/libs/api/biz/util/openUserSchedule.js +1 -7
- package/libs/api/biz/util/openVideoPlayer.js +1 -7
- package/libs/api/biz/util/previewFile.js +1 -7
- package/libs/api/biz/util/previewImage.js +1 -7
- package/libs/api/biz/util/proxy.js +1 -7
- package/libs/api/biz/util/pushWorkMsg.js +2 -7
- package/libs/api/biz/util/remind.js +1 -7
- package/libs/api/biz/util/resetSessionUnread.js +1 -7
- package/libs/api/biz/util/rouseApp.js +2 -7
- package/libs/api/biz/util/savePic.js +1 -7
- package/libs/api/biz/util/scan.js +1 -7
- package/libs/api/biz/util/screen.js +1 -7
- package/libs/api/biz/util/selectDepartment.js +1 -7
- package/libs/api/biz/util/share.js +1 -7
- package/libs/api/biz/util/takePicture.js +1 -7
- package/libs/api/biz/util/topicEvent.js +1 -7
- package/libs/api/biz/util/uploadAttachment.js +1 -7
- package/libs/api/biz/util/weeklyRead.js +1 -7
- package/libs/api/biz/util/yachEvent.js +1 -7
- package/libs/api/biz/util/zfbAuth.js +1 -7
- package/libs/api/biz/webViewMessage/send.js +1 -7
- package/libs/api/device/audio/download.js +1 -7
- package/libs/api/device/audio/onPlayEnd.js +1 -7
- package/libs/api/device/audio/onRecordEnd.js +1 -7
- package/libs/api/device/audio/onRecordEnd_v2.js +1 -7
- package/libs/api/device/audio/pause.js +1 -7
- package/libs/api/device/audio/play.js +1 -7
- package/libs/api/device/audio/resume.js +1 -7
- package/libs/api/device/audio/startRecord.js +1 -7
- package/libs/api/device/audio/startRecord_v2.js +1 -7
- package/libs/api/device/audio/stop.js +1 -7
- package/libs/api/device/audio/stopRecord.js +1 -7
- package/libs/api/device/audio/stopRecord_v2.js +1 -7
- package/libs/api/device/base/checkStepPermission.js +1 -7
- package/libs/api/device/base/getPhoneInfo.js +1 -7
- package/libs/api/device/base/getUUID.js +1 -7
- package/libs/api/device/connection/getNetworkType.js +1 -7
- package/libs/api/device/connection/isAtTal.js +3 -9
- package/libs/api/device/geolocation/get.js +1 -7
- package/libs/api/device/geolocation/getSwitch.js +1 -7
- package/libs/api/device/notification/actionSheet.js +1 -7
- package/libs/api/device/notification/alert.js +1 -7
- package/libs/api/device/notification/confirm.js +1 -7
- package/libs/api/device/notification/hidePreloader.js +2 -10
- package/libs/api/device/notification/showPreloader.js +2 -10
- package/libs/api/device/notification/toast.js +1 -7
- package/libs/api/device/notification/vibrate.js +1 -7
- package/libs/api/device/system/getLang.js +1 -7
- package/libs/api/device/system/setLight.js +1 -7
- package/libs/api/initAPI.js +4 -13
- package/libs/api/primary/createTab.js +1 -7
- package/libs/api/primary/exitFullScreen.js +1 -7
- package/libs/api/primary/fullScreen.js +1 -7
- package/libs/api/primary/updateTab.d.ts +9 -0
- package/libs/api/primary/updateTab.js +22 -0
- package/libs/api/primary/weeklyShare.js +1 -7
- package/libs/api/runtime/permission/requestAuthCode.js +1 -7
- package/libs/api/ui/pullToRefresh/disable.js +1 -7
- package/libs/api/ui/pullToRefresh/enable.js +1 -7
- package/libs/api/ui/pullToRefresh/stop.js +1 -7
- package/libs/api/ui/webViewBounce/disable.js +1 -7
- package/libs/api/util/domainStorage/getItem.js +1 -7
- package/libs/api/util/domainStorage/removeItem.js +1 -7
- package/libs/api/util/domainStorage/setItem.js +1 -7
- package/libs/api/util/tool/flushLog.js +1 -7
- package/libs/api/util/tool/log.js +1 -7
- package/libs/index.d.ts +13 -1
- package/libs/index.js +316 -536
- package/libs/lib/bridge/index.js +6 -13
- package/libs/lib/bridge/mobile.js +26 -50
- package/libs/lib/bridge/pc.js +16 -37
- package/libs/lib/helper/apiHelper.js +1 -7
- package/libs/lib/helper/codeMap.js +1 -7
- package/libs/lib/helper/event.js +8 -28
- package/libs/lib/helper/pcIframe.d.ts +8 -25
- package/libs/lib/helper/pcIframe.js +47 -61
- package/libs/lib/index.js +9 -33
- package/libs/lib/sdk/index.js +17 -47
- package/libs/lib/sdk/sdk.typings.d.ts +1 -0
- package/libs/lib/sdk/sdk.typings.js +0 -4
- package/libs/utils/bpitLog.js +4 -16
- package/libs/utils/compareVersions.js +32 -77
- package/libs/utils/console.js +2 -18
- package/libs/utils/env.js +15 -22
- package/libs/utils/index.js +8 -21
- package/package.json +4 -6
- package/dist/yach_jssdk_4.4.3.js +0 -1
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _Date$now from "@babel/runtime-corejs3/core-js/date/now";
|
|
1
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
3
2
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
3
|
+
import _Date$now from "@babel/runtime-corejs3/core-js/date/now";
|
|
4
|
+
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
4
5
|
import { log } from '../../utils';
|
|
5
|
-
import Event from './event';
|
|
6
|
-
|
|
7
|
-
var GenPostMsg = function GenPostMsg(method, param, callback) {
|
|
6
|
+
import Event from './event';
|
|
7
|
+
// 处理posmessage参数
|
|
8
|
+
var GenPostMsg = /*#__PURE__*/_createClass(function GenPostMsg(method, param, callback) {
|
|
8
9
|
var _this = this;
|
|
9
|
-
|
|
10
10
|
_classCallCheck(this, GenPostMsg);
|
|
11
|
-
|
|
12
11
|
this.genid = function () {
|
|
13
12
|
var idStr = _Date$now().toString(36);
|
|
14
|
-
|
|
15
13
|
idStr += Math.random().toString(36).substr(3);
|
|
16
14
|
return idStr;
|
|
17
15
|
};
|
|
18
|
-
|
|
19
16
|
this.receiveResponse = function (data) {
|
|
20
17
|
//this.PromiseObj.resolve(data);
|
|
21
18
|
_this.callback(data);
|
|
22
19
|
};
|
|
23
|
-
|
|
24
20
|
this.getPayload = function () {
|
|
25
21
|
return {
|
|
26
22
|
msgId: _this.id,
|
|
27
23
|
methodName: _this.methodName,
|
|
24
|
+
moduleId: _this.moduleId,
|
|
28
25
|
body: _this.plainMsg,
|
|
29
26
|
type: 'request',
|
|
30
27
|
invokeType: _this.invokeType
|
|
31
28
|
};
|
|
32
29
|
};
|
|
33
|
-
|
|
34
30
|
this.id = this.genid();
|
|
35
31
|
this.PromiseObj = {
|
|
36
32
|
resolve: null,
|
|
@@ -39,7 +35,9 @@ var GenPostMsg = function GenPostMsg(method, param, callback) {
|
|
|
39
35
|
this.methodName = method;
|
|
40
36
|
this.plainMsg = param;
|
|
41
37
|
this.invokeType = param === null || param === void 0 ? void 0 : param.invokeType;
|
|
42
|
-
this.
|
|
38
|
+
this.moduleId = param === null || param === void 0 ? void 0 : param.moduleId;
|
|
39
|
+
this.callback = callback;
|
|
40
|
+
// this.result = new Promise(
|
|
43
41
|
// function (resolve, reject) {
|
|
44
42
|
// this.PromiseObj = {
|
|
45
43
|
// resolve,
|
|
@@ -47,81 +45,75 @@ var GenPostMsg = function GenPostMsg(method, param, callback) {
|
|
|
47
45
|
// };
|
|
48
46
|
// }.bind(this)
|
|
49
47
|
// );
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
var Frame = function Frame() {
|
|
48
|
+
});
|
|
49
|
+
var Frame = /*#__PURE__*/_createClass(function Frame() {
|
|
53
50
|
var _this2 = this;
|
|
54
|
-
|
|
55
51
|
_classCallCheck(this, Frame);
|
|
56
|
-
|
|
57
52
|
this.addPending = function (e) {
|
|
58
53
|
_this2.pendingMsgs[e.id] = e;
|
|
59
54
|
};
|
|
60
|
-
|
|
61
55
|
this.deletePending = function (e) {
|
|
62
56
|
delete _this2.pendingMsgs[e.id];
|
|
63
57
|
};
|
|
64
|
-
|
|
65
58
|
this.getPending = function (t) {
|
|
66
59
|
return this.pendingMsgs[t];
|
|
67
60
|
};
|
|
68
|
-
|
|
69
61
|
this.invokeAPIInBrowserView = function (payload) {
|
|
70
62
|
window.sendTo(payload);
|
|
71
63
|
};
|
|
72
|
-
|
|
73
64
|
this.invokeAPIInWebview = function (payload) {
|
|
74
65
|
window.sendToHost(payload);
|
|
75
66
|
};
|
|
76
|
-
|
|
67
|
+
this.invokeAPIInModuleFederation = function (payload) {
|
|
68
|
+
window.remoteSendToHost(payload);
|
|
69
|
+
};
|
|
77
70
|
this.invokeAPI = function (method, param, callback) {
|
|
78
|
-
var genPostMsg
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
var genPostMsg;
|
|
72
|
+
if (_this2.invokeType === 'moduleFederation') {
|
|
73
|
+
param.invokeType = _this2.invokeType;
|
|
74
|
+
param.moduleId = _this2.moduleId;
|
|
75
|
+
genPostMsg = new GenPostMsg(method, param, callback);
|
|
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,
|
|
83
82
|
invokeType = _param$invokeType === void 0 ? '' : _param$invokeType;
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
invokeType === 'browserView' ? _this2.invokeAPIInBrowserView(_payload) : _this2.invokeAPIInWebview(_payload);
|
|
84
|
+
}
|
|
85
|
+
// 调用时传入 moduleId
|
|
86
86
|
_this2.addPending(genPostMsg);
|
|
87
|
-
|
|
88
87
|
return genPostMsg;
|
|
89
88
|
};
|
|
90
|
-
|
|
91
89
|
this.handleCallback = function (datas, invokeType) {
|
|
92
90
|
var type = datas.type,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
methodName = datas.methodName,
|
|
92
|
+
eventName = datas.eventName,
|
|
93
|
+
msgId = datas.msgId,
|
|
94
|
+
_datas$data = datas.data,
|
|
95
|
+
data = _datas$data === void 0 ? {} : _datas$data,
|
|
96
|
+
code = datas.code,
|
|
97
|
+
message = datas.message,
|
|
98
|
+
msg = datas.msg;
|
|
102
99
|
if (type === 'request') {
|
|
103
100
|
// 壳子的调用
|
|
104
101
|
switch (methodName) {
|
|
105
102
|
case 'refresh':
|
|
106
103
|
window.location.reload();
|
|
107
104
|
break;
|
|
108
|
-
|
|
109
105
|
case 'back':
|
|
110
106
|
window.history.back();
|
|
111
107
|
break;
|
|
112
|
-
|
|
113
108
|
case 'forward':
|
|
114
109
|
window.history.forward();
|
|
115
110
|
break;
|
|
116
|
-
|
|
117
111
|
case 'event':
|
|
118
112
|
Event.execEvent(eventName, data);
|
|
119
113
|
break;
|
|
120
|
-
|
|
121
114
|
case 'zoomInClick':
|
|
122
115
|
var scrollTopVal = document.documentElement.scrollTop || document.body.scrollTop,
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
url = window.location.href;
|
|
125
117
|
if (invokeType === 'browserView') {
|
|
126
118
|
window.sendTo(_JSON$stringify({
|
|
127
119
|
type: type,
|
|
@@ -143,16 +135,13 @@ var Frame = function Frame() {
|
|
|
143
135
|
}
|
|
144
136
|
}));
|
|
145
137
|
}
|
|
146
|
-
|
|
147
138
|
break;
|
|
148
|
-
|
|
149
139
|
default:
|
|
150
140
|
break;
|
|
151
141
|
}
|
|
152
142
|
} else if (type === 'response') {
|
|
153
143
|
// 响应壳子的回调
|
|
154
144
|
var pending = _this2.getPending(msgId);
|
|
155
|
-
|
|
156
145
|
pending && pending.receiveResponse({
|
|
157
146
|
data: data,
|
|
158
147
|
code: code,
|
|
@@ -161,20 +150,25 @@ var Frame = function Frame() {
|
|
|
161
150
|
code != -3 && _this2.deletePending(msgId);
|
|
162
151
|
}
|
|
163
152
|
};
|
|
164
|
-
|
|
165
153
|
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
|
+
}
|
|
166
161
|
window.addEventListener('message', function (msg) {
|
|
167
162
|
log('electron res: ', msg);
|
|
168
|
-
|
|
169
163
|
_this2.handleCallback(msg.data || {});
|
|
170
164
|
});
|
|
171
165
|
window.receiveBrowserViewData && window.receiveBrowserViewData(function (e, response) {
|
|
172
166
|
return _this2.handleCallback(response);
|
|
173
167
|
});
|
|
174
168
|
};
|
|
175
|
-
|
|
176
169
|
this.pendingMsgs = {};
|
|
177
|
-
|
|
178
|
-
|
|
170
|
+
this.invokeType = window.remoteSendToHost && window.remoteReceiveFromHost && process ? 'moduleFederation' : '';
|
|
171
|
+
this.moduleId = Math.random().toString(36).substring(2, 15);
|
|
172
|
+
});
|
|
179
173
|
var frame = new Frame();
|
|
180
174
|
export default frame;
|
package/es/lib/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
2
2
|
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
3
|
-
|
|
4
3
|
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
5
4
|
function adopt(value) {
|
|
6
5
|
return value instanceof P ? value : new P(function (resolve) {
|
|
7
6
|
resolve(value);
|
|
8
7
|
});
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
return new (P || (P = _Promise))(function (resolve, reject) {
|
|
12
10
|
function fulfilled(value) {
|
|
13
11
|
try {
|
|
@@ -16,7 +14,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
16
14
|
reject(e);
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
function rejected(value) {
|
|
21
18
|
try {
|
|
22
19
|
step(generator["throw"](value));
|
|
@@ -24,15 +21,12 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
24
21
|
reject(e);
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
function step(result) {
|
|
29
25
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
30
26
|
}
|
|
31
|
-
|
|
32
27
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
28
|
});
|
|
34
29
|
};
|
|
35
|
-
|
|
36
30
|
import { getENV } from '../utils';
|
|
37
31
|
import Sdk from './sdk';
|
|
38
32
|
import { mobileBridge, mobileBridgeInit, PcBridgeInit, pcBridge } from './bridge';
|
|
@@ -40,26 +34,20 @@ import Event from './helper/event';
|
|
|
40
34
|
var env = getENV();
|
|
41
35
|
var platform = env.platform;
|
|
42
36
|
var yachSdk = new Sdk(env);
|
|
43
|
-
|
|
44
37
|
function initSdk() {
|
|
45
38
|
var _this = this;
|
|
46
|
-
|
|
47
39
|
var bridgeInit;
|
|
48
|
-
|
|
49
40
|
if (platform === 'pc') {
|
|
50
41
|
bridgeInit = function bridgeInit() {
|
|
51
42
|
return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
52
43
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
53
|
-
while (1) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
case "end":
|
|
61
|
-
return _context.stop();
|
|
62
|
-
}
|
|
44
|
+
while (1) switch (_context.prev = _context.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
PcBridgeInit();
|
|
47
|
+
return _context.abrupt("return", pcBridge);
|
|
48
|
+
case 2:
|
|
49
|
+
case "end":
|
|
50
|
+
return _context.stop();
|
|
63
51
|
}
|
|
64
52
|
}, _callee);
|
|
65
53
|
}));
|
|
@@ -71,7 +59,6 @@ function initSdk() {
|
|
|
71
59
|
});
|
|
72
60
|
};
|
|
73
61
|
}
|
|
74
|
-
|
|
75
62
|
var config = {
|
|
76
63
|
platform: platform,
|
|
77
64
|
authMethod: 'config',
|
|
@@ -87,6 +74,5 @@ function initSdk() {
|
|
|
87
74
|
};
|
|
88
75
|
yachSdk.setPlatform(config);
|
|
89
76
|
}
|
|
90
|
-
|
|
91
77
|
initSdk();
|
|
92
78
|
export { yachSdk, initSdk };
|
package/es/lib/sdk/index.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
2
|
-
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
3
1
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
4
2
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
3
|
+
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
4
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
5
5
|
import { bpitLog, log } from '../../utils';
|
|
6
6
|
import { compareVersions } from '../../utils/compareVersions';
|
|
7
7
|
import packageInfo from '../../../package.json';
|
|
8
|
-
|
|
9
8
|
var Sdk = /*#__PURE__*/function () {
|
|
10
9
|
function Sdk(env) {
|
|
11
10
|
var _this = this;
|
|
12
|
-
|
|
13
11
|
_classCallCheck(this, Sdk);
|
|
14
|
-
|
|
15
12
|
this.invokeAPIConfigMapByMethod = {};
|
|
16
13
|
this.configJsApiList = [];
|
|
17
14
|
this.platformConfigMap = {};
|
|
@@ -32,11 +29,9 @@ var Sdk = /*#__PURE__*/function () {
|
|
|
32
29
|
platformV2: env.platformV2,
|
|
33
30
|
config: function config() {
|
|
34
31
|
var _config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35
|
-
|
|
36
32
|
// 鉴权
|
|
37
33
|
var _config$jsApiList = _config.jsApiList,
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
jsApiList = _config$jsApiList === void 0 ? [] : _config$jsApiList;
|
|
40
35
|
if (_this.hadConfig) {
|
|
41
36
|
console.log('Config has been executed');
|
|
42
37
|
} else {
|
|
@@ -44,7 +39,6 @@ var Sdk = /*#__PURE__*/function () {
|
|
|
44
39
|
fn('config', _config).then(function (value) {
|
|
45
40
|
// 鉴权成功
|
|
46
41
|
_this.cacheP.resolve(value);
|
|
47
|
-
|
|
48
42
|
_this.hadConfig = true;
|
|
49
43
|
_this.configJsApiList = jsApiList;
|
|
50
44
|
})["catch"](function (error) {
|
|
@@ -76,19 +70,19 @@ var Sdk = /*#__PURE__*/function () {
|
|
|
76
70
|
}
|
|
77
71
|
};
|
|
78
72
|
}
|
|
79
|
-
|
|
80
73
|
_createClass(Sdk, [{
|
|
81
74
|
key: "setAPI",
|
|
82
75
|
value: function setAPI(method, config) {
|
|
83
76
|
this.invokeAPIConfigMapByMethod[method] = config;
|
|
84
|
-
}
|
|
85
|
-
|
|
77
|
+
}
|
|
78
|
+
// 确定端的同事初始化bridge
|
|
86
79
|
}, {
|
|
87
80
|
key: "setPlatform",
|
|
88
81
|
value: function setPlatform(value) {
|
|
89
82
|
var platform = value.platform,
|
|
90
|
-
|
|
91
|
-
this.platformConfigMap[platform] = value;
|
|
83
|
+
bridgeInit = value.bridgeInit;
|
|
84
|
+
this.platformConfigMap[platform] = value;
|
|
85
|
+
// if (this.env.platform === platform) bridgeInit();
|
|
92
86
|
}
|
|
93
87
|
}, {
|
|
94
88
|
key: "bridgeInitFn",
|
|
@@ -97,16 +91,13 @@ var Sdk = /*#__PURE__*/function () {
|
|
|
97
91
|
if (this.bridgeInitFnPromise) {
|
|
98
92
|
return this.bridgeInitFnPromise;
|
|
99
93
|
}
|
|
100
|
-
|
|
101
94
|
var o = this.platformConfigMap[this.env.platform];
|
|
102
|
-
|
|
103
95
|
if (o) {
|
|
104
96
|
this.bridgeInitFnPromise = o.bridgeInit();
|
|
105
97
|
} else {
|
|
106
98
|
var n = 'Do not support the current environment�' + this.env.platform;
|
|
107
99
|
this.bridgeInitFnPromise = _Promise.reject(new Error(n));
|
|
108
100
|
}
|
|
109
|
-
|
|
110
101
|
return this.bridgeInitFnPromise;
|
|
111
102
|
}
|
|
112
103
|
}, {
|
|
@@ -126,39 +117,30 @@ var Sdk = /*#__PURE__*/function () {
|
|
|
126
117
|
key: "invokeAPI",
|
|
127
118
|
value: function invokeAPI(method, params) {
|
|
128
119
|
var _context2;
|
|
129
|
-
|
|
130
120
|
if (!params) params = {};
|
|
131
|
-
if (!method) return;
|
|
132
|
-
|
|
121
|
+
if (!method) return;
|
|
122
|
+
// 验证方法是否可用
|
|
133
123
|
var apiConfigs = this.invokeAPIConfigMapByMethod[method];
|
|
134
|
-
|
|
135
124
|
if (!apiConfigs) {
|
|
136
125
|
return this._onFail(method, '-1', "[".concat(method, "] method is not exist"), params.onFail);
|
|
137
126
|
}
|
|
138
|
-
|
|
139
127
|
var apiConfig = apiConfigs[this.env.platform];
|
|
140
|
-
|
|
141
128
|
if (apiConfig) {
|
|
142
129
|
var supportVersion = apiConfig.vs || '0.0.0';
|
|
143
|
-
|
|
144
130
|
if (compareVersions(this.env.version, supportVersion) < 0) {
|
|
145
131
|
var _context;
|
|
146
|
-
|
|
147
132
|
return this._onFail(method, '-1', _concatInstanceProperty(_context = "The current application version is ".concat(this.env.version, ". This method does not support versions less than ")).call(_context, supportVersion), params.onFail);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
133
|
+
}
|
|
134
|
+
// 确定参数
|
|
135
|
+
var p = apiConfig.paramsDeal ? apiConfig.paramsDeal(params) : params;
|
|
136
|
+
// 确定回调
|
|
153
137
|
if ('function' == typeof p.onSuccess) {
|
|
154
138
|
var v = p.onSuccess;
|
|
155
|
-
|
|
156
139
|
p.onSuccess = function (e) {
|
|
157
140
|
v(e);
|
|
158
141
|
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
142
|
+
}
|
|
143
|
+
// 主方法
|
|
162
144
|
this.bridgeInitFn().then(function (fn) {
|
|
163
145
|
fn(method, p).then(function (res) {
|
|
164
146
|
// 调用成功
|
|
@@ -180,12 +162,9 @@ var Sdk = /*#__PURE__*/function () {
|
|
|
180
162
|
});
|
|
181
163
|
return;
|
|
182
164
|
}
|
|
183
|
-
|
|
184
165
|
this._onFail(method, '-1', _concatInstanceProperty(_context2 = "[".concat(method, "] method do not support the current platform (")).call(_context2, this.env.platform, ")"), params.onFail);
|
|
185
166
|
}
|
|
186
167
|
}]);
|
|
187
|
-
|
|
188
168
|
return Sdk;
|
|
189
169
|
}();
|
|
190
|
-
|
|
191
170
|
export default Sdk;
|
package/es/utils/bpitLog.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
function loadScript(url) {
|
|
2
2
|
var script = document.createElement('script');
|
|
3
3
|
script.type = 'text/javascript';
|
|
4
|
-
|
|
5
4
|
if (script.readyState) {
|
|
6
5
|
// ie 浏览器
|
|
7
6
|
script.onreadystatechange = function () {
|
|
@@ -16,38 +15,31 @@ function loadScript(url) {
|
|
|
16
15
|
document.getElementsByTagName('head')[0].removeChild(script);
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
script.src = url;
|
|
21
19
|
document.getElementsByTagName('head')[0].appendChild(script);
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
export default function bpitLog(options) {
|
|
25
22
|
if (!options) {
|
|
26
23
|
console.log('bpit error: need options');
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
if (!options.group) {
|
|
31
27
|
console.log('bpit error: need options.group');
|
|
32
28
|
return;
|
|
33
29
|
}
|
|
34
|
-
|
|
35
30
|
if (!options.project) {
|
|
36
31
|
console.log('bpit error: need options.project');
|
|
37
32
|
return;
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
if (!options.hasOwnProperty('env')) {
|
|
41
35
|
console.log('bpit error: need options.env');
|
|
42
36
|
return;
|
|
43
37
|
}
|
|
44
|
-
|
|
45
38
|
if (!options.hasOwnProperty('version')) {
|
|
46
39
|
console.log('bpit error: need options.version');
|
|
47
40
|
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
}
|
|
42
|
+
// upload data
|
|
51
43
|
var uploadData = ['https://es.zhiyinlou.com/log.js?'];
|
|
52
44
|
uploadData.push('group=' + options.group);
|
|
53
45
|
uploadData.push('&project=' + options.project);
|
|
@@ -58,13 +50,12 @@ export default function bpitLog(options) {
|
|
|
58
50
|
if (options.workcode) uploadData.push('&workcode=' + options.workcode);
|
|
59
51
|
if (options.timestamp) uploadData.push('×tamp=' + options.timestamp);
|
|
60
52
|
if (options.errorcode) uploadData.push('&errorcode=' + options.errorcode);
|
|
61
|
-
if (options.message) uploadData.push('&message=' + options.message);
|
|
62
|
-
|
|
53
|
+
if (options.message) uploadData.push('&message=' + options.message);
|
|
54
|
+
// api load time
|
|
63
55
|
if (options.api && options.time) {
|
|
64
56
|
uploadData.push('&api=' + options.api);
|
|
65
57
|
uploadData.push('&load_time=' + options.time);
|
|
66
58
|
}
|
|
67
|
-
|
|
68
59
|
var uploadDataUrl = uploadData.join('');
|
|
69
60
|
loadScript(uploadDataUrl);
|
|
70
61
|
if (options.env != 'online') console.log(uploadDataUrl);
|