yach.open.jssdk 4.4.1-beta11 → 4.4.1-beta13
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.1-beta13.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.js +2 -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/knowledgeBaseSelect.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/screen.d.ts +15 -0
- package/es/api/biz/util/screen.js +17 -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/weeklyRead.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.d.ts +6 -1
- package/es/api/device/notification/hidePreloader.js +19 -2
- package/es/api/device/notification/showPreloader.d.ts +10 -1
- package/es/api/device/notification/showPreloader.js +19 -2
- 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 +7 -5
- package/es/index.js +35 -21
- package/es/lib/bridge/mobile.js +28 -12
- package/es/lib/bridge/pc.js +19 -11
- 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 +51 -21
- package/es/lib/index.js +21 -7
- package/es/lib/sdk/index.js +39 -17
- 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 +19 -12
- package/es/utils/index.js +6 -1
- 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.js +7 -1
- 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/knowledgeBaseSelect.js +7 -1
- 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/screen.d.ts +15 -0
- package/libs/api/biz/util/{topicEvent.js → screen.js} +11 -17
- 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/weeklyRead.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.d.ts +6 -1
- package/libs/api/device/notification/hidePreloader.js +24 -2
- package/libs/api/device/notification/showPreloader.d.ts +10 -1
- package/libs/api/device/notification/showPreloader.js +24 -2
- 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 +7 -5
- package/libs/index.js +537 -268
- package/libs/lib/bridge/index.js +13 -6
- package/libs/lib/bridge/mobile.js +50 -16
- package/libs/lib/bridge/pc.js +37 -16
- 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 +58 -20
- package/libs/lib/index.js +33 -9
- package/libs/lib/sdk/index.js +49 -18
- 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 +21 -12
- package/libs/utils/index.js +21 -8
- package/package.json +1 -1
- package/dist/yach_jssdk_4.4.1-beta11.js +0 -1
- package/es/api/biz/util/topicEvent.d.ts +0 -13
- package/es/api/biz/util/topicEvent.js +0 -27
- package/libs/api/biz/util/topicEvent.d.ts +0 -13
package/es/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { yachSdk } from './lib';
|
|
2
2
|
/*biz*****************************/
|
|
3
|
+
|
|
3
4
|
/**util*/
|
|
5
|
+
|
|
4
6
|
import { openLink } from './api/biz/util/openLink';
|
|
5
7
|
import { feedback } from './api/biz/util/feedback';
|
|
6
8
|
import { open } from './api/biz/util/open';
|
|
@@ -35,7 +37,6 @@ import { authStart } from './api/biz/util/authStart';
|
|
|
35
37
|
import { authFinish } from './api/biz/util/authFinish';
|
|
36
38
|
import { assistantCreate } from './api/biz/util/assistantCreate';
|
|
37
39
|
import { yachEvent } from './api/biz/util/yachEvent';
|
|
38
|
-
import { topicEvent } from './api/biz/util/topicEvent';
|
|
39
40
|
import { openTogetherEyeWebview } from './api/biz/util/openTogetherEyeWebview';
|
|
40
41
|
import { getTogetherConfig } from './api/biz/util/getTogetherConfig';
|
|
41
42
|
import { rouseApp } from './api/biz/util/rouseApp';
|
|
@@ -54,6 +55,7 @@ import { disableScreenCapture } from './api/biz/util/disableScreenCapture';
|
|
|
54
55
|
import { openFutureGroup } from './api/biz/util/openFutureGroup';
|
|
55
56
|
import { knowledgeBaseSelect } from './api/biz/util/knowledgeBaseSelect';
|
|
56
57
|
/**navigation*/
|
|
58
|
+
|
|
57
59
|
import { setIcon } from './api/biz/navigation/setIcon';
|
|
58
60
|
import { setTitle } from './api/biz/navigation/setTitle';
|
|
59
61
|
import { setMenu } from './api/biz/navigation/setMenu';
|
|
@@ -70,11 +72,14 @@ import { tencentMeeting } from './api/biz/navigation/tencentMeeting';
|
|
|
70
72
|
import { tencentMeetingBegin } from './api/biz/navigation/tencentMeetingBegin';
|
|
71
73
|
import { setPanGestureEnable } from './api/biz/navigation/setPanGestureEnable';
|
|
72
74
|
/**contact*/
|
|
75
|
+
|
|
73
76
|
import { complexPicker } from './api/biz/contact/complexPicker';
|
|
74
77
|
import { departmentsPicker } from './api/biz/contact/departmentsPicker';
|
|
75
78
|
/** group*/
|
|
79
|
+
|
|
76
80
|
import { groupComplexPicker } from './api/biz/group/groupComplexPicker';
|
|
77
81
|
/** chat*/
|
|
82
|
+
|
|
78
83
|
import { chooseConversationByCorpId } from './api/biz/chat/chooseConversationByCorpId';
|
|
79
84
|
import { pickConversation } from './api/biz/chat/pickConversation';
|
|
80
85
|
import { openSingleChat } from './api/biz/chat/openSingleChat';
|
|
@@ -82,15 +87,18 @@ import { openTeamChat } from './api/biz/chat/openTeamChat';
|
|
|
82
87
|
import { openSquad } from './api/biz/chat/openSquad';
|
|
83
88
|
import { sendP2PMsg } from './api/biz/chat/sendP2PMsg';
|
|
84
89
|
/* primary*****************************/
|
|
90
|
+
|
|
85
91
|
import { createTab } from './api/primary/createTab';
|
|
86
92
|
import { weeklyShare } from './api/primary/weeklyShare';
|
|
87
93
|
import { fullScreen } from './api/primary/fullScreen';
|
|
88
94
|
import { exitFullScreen } from './api/primary/exitFullScreen';
|
|
89
95
|
/* runtime*****************************/
|
|
96
|
+
|
|
90
97
|
import { requestAuthCode } from './api/runtime/permission/requestAuthCode';
|
|
91
98
|
/** device */
|
|
92
|
-
|
|
93
|
-
import {
|
|
99
|
+
|
|
100
|
+
import { showPreloader, showCustomOverlayContent } from './api/device/notification/showPreloader';
|
|
101
|
+
import { hidePreloader, hideCustomOverlayContent } from './api/device/notification/hidePreloader';
|
|
94
102
|
import { vibrate } from './api/device/notification/vibrate';
|
|
95
103
|
import { toast } from './api/device/notification/toast';
|
|
96
104
|
import { actionSheet } from './api/device/notification/actionSheet';
|
|
@@ -118,36 +126,40 @@ import { startRecord_v2 } from './api/device/audio/startRecord_v2';
|
|
|
118
126
|
import { stopRecord_v2 } from './api/device/audio/stopRecord_v2';
|
|
119
127
|
import { setLight } from './api/device/system/setLight';
|
|
120
128
|
/** telephone */
|
|
129
|
+
|
|
121
130
|
import { showCallMenu } from './api/biz/telephone/showCallMenu';
|
|
122
131
|
import { call } from './api/biz/telephone/call';
|
|
123
132
|
/** ui */
|
|
133
|
+
|
|
124
134
|
import { disable as webViewBounceDisable } from './api/ui/webViewBounce/disable';
|
|
125
135
|
import { enable as pullToRefreshEnable } from './api/ui/pullToRefresh/enable';
|
|
126
136
|
import { stop as pullToRefreshStop } from './api/ui/pullToRefresh/stop';
|
|
127
|
-
import { disable as pullToRefreshDisable } from './api/ui/pullToRefresh/disable';
|
|
128
|
-
|
|
137
|
+
import { disable as pullToRefreshDisable } from './api/ui/pullToRefresh/disable'; // demainStorage
|
|
138
|
+
|
|
129
139
|
import { getItem } from './api/util/domainStorage/getItem';
|
|
130
140
|
import { setItem } from './api/util/domainStorage/setItem';
|
|
131
|
-
import { removeItem } from './api/util/domainStorage/removeItem';
|
|
132
|
-
|
|
141
|
+
import { removeItem } from './api/util/domainStorage/removeItem'; // log
|
|
142
|
+
|
|
133
143
|
import { writeLog } from './api/util/tool/log';
|
|
134
|
-
import { flushLog } from './api/util/tool/flushLog';
|
|
144
|
+
import { flushLog } from './api/util/tool/flushLog'; // screen
|
|
145
|
+
|
|
146
|
+
import { capturePage } from './api/biz/util/screen';
|
|
135
147
|
import { send as webViewMessageSend } from './api/biz/webViewMessage/send';
|
|
136
148
|
import { talYoungFilesUpload } from './api/app/custom/talYoungFilesUpload';
|
|
137
149
|
import { addAppToNav } from './api/biz/util/addAppToNav';
|
|
138
150
|
console.log('add rouseApp ------------>', rouseApp);
|
|
139
151
|
var _yachSdk$exportSdk = yachSdk.exportSdk,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
export { version, sdkVersion, env, platform, platformV2, config, ready, error, on, off, openLink, feedback, open, openSlidePanel, share, previewFile, previewImage, downloadFile, uploadAttachment, clipboardFileUpload, proxy, datepicker, scan, chosen, openSingleWebview, getSingleWebviewData, injectScript, closeWindow, showCallMenu, call, setIcon, setTitle, setMenu, close, replacePage, quit, setRight, setTitleExpandIcon, updateExpandTitle, setLeft, goBack, complexPicker, departmentsPicker, groupComplexPicker, chooseConversationByCorpId, pickConversation, openSingleChat, openTeamChat, openSquad, sendP2PMsg, mapView, multipointView, requestAuthCode, createTab, weeklyShare, fullScreen, exitFullScreen, showPreloader, hidePreloader, vibrate, toast, alert, confirm, getPhoneInfo, getUUID, checkStepPermission, getGeolocation, getGeolocationSwitch, getLang, startRecord, stopRecord, onRecordEnd, downloadAudio, playAudio, pauseAudio, stopAudio, onPlayEnd, resumeAudio, getNetworkType, isAtTal, webViewBounceDisable, pullToRefreshEnable, pullToRefreshStop, pullToRefreshDisable, getItem, setItem, removeItem, writeLog, flushLog, remind, takePicture, datetimepicker, actionSheet, webViewMessageSend, talYoungFilesUpload, openVideoPlayer, openMediaFileDialog, mediaFileUpload, invoice, pushWorkMsg, openTalYoungToTopic, getToken, authStart, authFinish, assistantCreate, yachEvent,
|
|
152
|
+
version = _yachSdk$exportSdk.version,
|
|
153
|
+
sdkVersion = _yachSdk$exportSdk.sdkVersion,
|
|
154
|
+
env = _yachSdk$exportSdk.env,
|
|
155
|
+
platform = _yachSdk$exportSdk.platform,
|
|
156
|
+
platformV2 = _yachSdk$exportSdk.platformV2,
|
|
157
|
+
config = _yachSdk$exportSdk.config,
|
|
158
|
+
ready = _yachSdk$exportSdk.ready,
|
|
159
|
+
error = _yachSdk$exportSdk.error,
|
|
160
|
+
on = _yachSdk$exportSdk.on,
|
|
161
|
+
off = _yachSdk$exportSdk.off;
|
|
162
|
+
export { version, sdkVersion, env, platform, platformV2, config, ready, error, on, off, openLink, feedback, open, openSlidePanel, share, previewFile, previewImage, downloadFile, uploadAttachment, clipboardFileUpload, proxy, datepicker, scan, chosen, openSingleWebview, getSingleWebviewData, injectScript, closeWindow, showCallMenu, call, setIcon, setTitle, setMenu, close, replacePage, quit, setRight, setTitleExpandIcon, updateExpandTitle, setLeft, goBack, complexPicker, departmentsPicker, groupComplexPicker, chooseConversationByCorpId, pickConversation, openSingleChat, openTeamChat, openSquad, sendP2PMsg, mapView, multipointView, requestAuthCode, createTab, weeklyShare, fullScreen, exitFullScreen, showPreloader, showCustomOverlayContent, hidePreloader, hideCustomOverlayContent, vibrate, toast, alert, confirm, getPhoneInfo, getUUID, checkStepPermission, getGeolocation, getGeolocationSwitch, getLang, startRecord, stopRecord, onRecordEnd, downloadAudio, playAudio, pauseAudio, stopAudio, onPlayEnd, resumeAudio, getNetworkType, isAtTal, webViewBounceDisable, pullToRefreshEnable, pullToRefreshStop, pullToRefreshDisable, getItem, setItem, removeItem, writeLog, flushLog, remind, takePicture, datetimepicker, actionSheet, webViewMessageSend, talYoungFilesUpload, openVideoPlayer, openMediaFileDialog, mediaFileUpload, invoice, pushWorkMsg, openTalYoungToTopic, getToken, authStart, authFinish, assistantCreate, yachEvent, openTogetherEyeWebview, getTogetherConfig, rouseApp, externalLinkPreviewFile, savePic, zfbAuth, complain, onRecordEnd_v2, startRecord_v2, stopRecord_v2, selectDepartment, setWindowBig, tencentMeeting, tencentMeetingBegin, createModifySchedule, onlineDocmentOpenTeamChat, entergroupCheck, resetSessionUnread, weeklyRead, openFutureGroup, knowledgeBaseSelect, setLight, openUserSchedule, disableScreenCapture, setPanGestureEnable, addAppToNav, capturePage };
|
|
151
163
|
export default {
|
|
152
164
|
version: version,
|
|
153
165
|
sdkVersion: sdkVersion,
|
|
@@ -198,7 +210,6 @@ export default {
|
|
|
198
210
|
authFinish: authFinish,
|
|
199
211
|
assistantCreate: assistantCreate,
|
|
200
212
|
yachEvent: yachEvent,
|
|
201
|
-
topicEvent: topicEvent,
|
|
202
213
|
openTogetherEyeWebview: openTogetherEyeWebview,
|
|
203
214
|
getTogetherConfig: getTogetherConfig,
|
|
204
215
|
rouseApp: rouseApp,
|
|
@@ -211,7 +222,8 @@ export default {
|
|
|
211
222
|
openUserSchedule: openUserSchedule,
|
|
212
223
|
disableScreenCapture: disableScreenCapture,
|
|
213
224
|
addAppToNav: addAppToNav,
|
|
214
|
-
knowledgeBaseSelect: knowledgeBaseSelect
|
|
225
|
+
knowledgeBaseSelect: knowledgeBaseSelect,
|
|
226
|
+
capturePage: capturePage
|
|
215
227
|
},
|
|
216
228
|
telephone: {
|
|
217
229
|
showCallMenu: showCallMenu,
|
|
@@ -271,7 +283,9 @@ export default {
|
|
|
271
283
|
device: {
|
|
272
284
|
notification: {
|
|
273
285
|
showPreloader: showPreloader,
|
|
286
|
+
showCustomOverlayContent: showCustomOverlayContent,
|
|
274
287
|
hidePreloader: hidePreloader,
|
|
288
|
+
hideCustomOverlayContent: hideCustomOverlayContent,
|
|
275
289
|
vibrate: vibrate,
|
|
276
290
|
toast: toast,
|
|
277
291
|
alert: alert,
|
package/es/lib/bridge/mobile.js
CHANGED
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
import _setTimeout from "@babel/runtime-corejs3/core-js/set-timeout";
|
|
2
|
-
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
3
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
|
|
4
|
-
import _parseInt from "@babel/runtime-corejs3/core-js/parse-int";
|
|
5
1
|
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
2
|
+
import _parseInt from "@babel/runtime-corejs3/core-js/parse-int";
|
|
3
|
+
import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
|
|
4
|
+
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
5
|
+
import _setTimeout from "@babel/runtime-corejs3/core-js/set-timeout";
|
|
6
6
|
import Event from '../helper/event';
|
|
7
7
|
import { electronResCodeMap } from '../helper/codeMap';
|
|
8
8
|
import { log, bpitLog } from '../../utils';
|
|
9
|
+
|
|
9
10
|
function setupWebViewJavascriptBridge(callback) {
|
|
10
11
|
if (window.WebViewJavascriptBridge) {
|
|
11
12
|
return callback(WebViewJavascriptBridge);
|
|
12
13
|
}
|
|
14
|
+
|
|
13
15
|
if (window.WKWebViewJavascriptBridge) {
|
|
14
16
|
return callback(WKWebViewJavascriptBridge);
|
|
15
17
|
}
|
|
18
|
+
|
|
16
19
|
if (window.WVJBCallbacks) {
|
|
17
20
|
return window.WVJBCallbacks.push(callback);
|
|
18
21
|
}
|
|
22
|
+
|
|
19
23
|
window.WVJBCallbacks = [callback];
|
|
20
24
|
var WVJBIframe = document.createElement('iframe');
|
|
21
25
|
WVJBIframe.style.display = 'none';
|
|
22
26
|
WVJBIframe.src = 'https://__bridge_loaded__';
|
|
23
27
|
document.documentElement.appendChild(WVJBIframe);
|
|
28
|
+
|
|
24
29
|
_setTimeout(function () {
|
|
25
30
|
document.documentElement.removeChild(WVJBIframe);
|
|
26
31
|
}, 0);
|
|
27
32
|
}
|
|
33
|
+
|
|
28
34
|
var mobileBridgeInit = function mobileBridgeInit() {
|
|
29
35
|
return new _Promise(function (resolve, reject) {
|
|
30
36
|
setupWebViewJavascriptBridge(function (bridge) {
|
|
@@ -71,14 +77,17 @@ var mobileBridgeInit = function mobileBridgeInit() {
|
|
|
71
77
|
});
|
|
72
78
|
});
|
|
73
79
|
};
|
|
80
|
+
|
|
74
81
|
var mobileBridge = function mobileBridge(method, param) {
|
|
75
82
|
return new _Promise(function (resolve, reject) {
|
|
76
83
|
var p = _Object$assign({}, param);
|
|
84
|
+
|
|
77
85
|
setupWebViewJavascriptBridge(function (bridge) {
|
|
78
86
|
if (param.control) {
|
|
79
87
|
bridge.registerHandler(method, function (data) {
|
|
80
88
|
var onSuccess = param.onSuccess;
|
|
81
89
|
delete p.onSuccess;
|
|
90
|
+
|
|
82
91
|
if ('function' === typeof onSuccess) {
|
|
83
92
|
onSuccess(data);
|
|
84
93
|
resolve({
|
|
@@ -88,11 +97,14 @@ var mobileBridge = function mobileBridge(method, param) {
|
|
|
88
97
|
}
|
|
89
98
|
});
|
|
90
99
|
}
|
|
100
|
+
|
|
91
101
|
bridge.callHandler(method, param, function (e) {
|
|
92
102
|
var code = e.code,
|
|
93
|
-
|
|
94
|
-
|
|
103
|
+
message = e.message,
|
|
104
|
+
data = e.data;
|
|
105
|
+
|
|
95
106
|
var _code = _parseInt(code);
|
|
107
|
+
|
|
96
108
|
var callbackStr = electronResCodeMap(_code);
|
|
97
109
|
var callbackFun = p[callbackStr];
|
|
98
110
|
log("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
@@ -102,37 +114,40 @@ var mobileBridge = function mobileBridge(method, param) {
|
|
|
102
114
|
_code: _code,
|
|
103
115
|
message: message,
|
|
104
116
|
callbackFun: callbackFun
|
|
105
|
-
});
|
|
106
|
-
|
|
117
|
+
}); // 请求失败
|
|
118
|
+
|
|
107
119
|
if (callbackStr === 'onFail') {
|
|
108
120
|
bpitLog({
|
|
109
121
|
method: method,
|
|
110
122
|
errorcode: _code,
|
|
111
123
|
message: message || _JSON$stringify(data) || 'SDK执行失败回调,相关参数'
|
|
112
124
|
});
|
|
125
|
+
|
|
113
126
|
if ('function' === typeof callbackFun) {
|
|
114
127
|
message ? callbackFun({
|
|
115
128
|
code: code,
|
|
116
129
|
message: message
|
|
117
130
|
}) : callbackFun(data);
|
|
118
131
|
}
|
|
132
|
+
|
|
119
133
|
reject({
|
|
120
134
|
_code: _code,
|
|
121
135
|
message: message,
|
|
122
136
|
data: data
|
|
123
137
|
});
|
|
124
138
|
return;
|
|
125
|
-
}
|
|
126
|
-
|
|
139
|
+
} // 请求成功
|
|
140
|
+
|
|
141
|
+
|
|
127
142
|
if ('function' === typeof callbackFun) {
|
|
128
143
|
callbackFun(data || message);
|
|
129
144
|
}
|
|
145
|
+
|
|
130
146
|
resolve({
|
|
131
147
|
_code: _code,
|
|
132
148
|
message: message,
|
|
133
149
|
data: data
|
|
134
|
-
});
|
|
135
|
-
// if (_code === -2 || _code === 7) {
|
|
150
|
+
}); // if (_code === -2 || _code === 7) {
|
|
136
151
|
// bpitLog({
|
|
137
152
|
// method,
|
|
138
153
|
// errorcode: _code,
|
|
@@ -165,4 +180,5 @@ var mobileBridge = function mobileBridge(method, param) {
|
|
|
165
180
|
});
|
|
166
181
|
});
|
|
167
182
|
};
|
|
183
|
+
|
|
168
184
|
export { mobileBridge, mobileBridgeInit };
|
package/es/lib/bridge/pc.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
2
|
-
import _parseInt from "@babel/runtime-corejs3/core-js/parse-int";
|
|
3
|
-
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
4
1
|
import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
|
|
2
|
+
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
3
|
+
import _parseInt from "@babel/runtime-corejs3/core-js/parse-int";
|
|
4
|
+
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
5
5
|
import PcIframe from '../helper/pcIframe';
|
|
6
6
|
import { electronResCodeMap } from '../helper/codeMap';
|
|
7
7
|
import { log, bpitLog } from '../../utils';
|
|
8
|
+
|
|
8
9
|
var PcBridgeInit = function PcBridgeInit() {
|
|
9
10
|
PcIframe.init();
|
|
10
11
|
};
|
|
12
|
+
|
|
11
13
|
var pcBridge = function pcBridge(method, param) {
|
|
12
14
|
return new _Promise(function (resolve, reject) {
|
|
13
15
|
return PcIframe.invokeAPI(method, param, function (_ref) {
|
|
14
16
|
var data = _ref.data,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
code = _ref.code,
|
|
18
|
+
message = _ref.message;
|
|
19
|
+
|
|
17
20
|
var _code = _parseInt(code);
|
|
21
|
+
|
|
18
22
|
var callbackStr = electronResCodeMap(_code);
|
|
19
23
|
var callbackFun = param[callbackStr];
|
|
20
24
|
log("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
@@ -24,14 +28,15 @@ var pcBridge = function pcBridge(method, param) {
|
|
|
24
28
|
_code: _code,
|
|
25
29
|
message: message,
|
|
26
30
|
callbackFun: callbackFun
|
|
27
|
-
});
|
|
28
|
-
|
|
31
|
+
}); // 请求失败
|
|
32
|
+
|
|
29
33
|
if (callbackStr === 'onFail') {
|
|
30
34
|
bpitLog({
|
|
31
35
|
method: method,
|
|
32
36
|
errorcode: _code,
|
|
33
37
|
message: message || _JSON$stringify(data) || 'SDK执行失败回调,相关参数'
|
|
34
38
|
});
|
|
39
|
+
|
|
35
40
|
if ('function' === typeof callbackFun) {
|
|
36
41
|
console.log('wenai-code', code, _code);
|
|
37
42
|
var callbackData = Object.prototype.toString.call(data) === "[object Object]" ? _Object$assign(_Object$assign({}, data), {
|
|
@@ -44,23 +49,25 @@ var pcBridge = function pcBridge(method, param) {
|
|
|
44
49
|
};
|
|
45
50
|
message ? callbackFun(callbackData) : callbackFun(data);
|
|
46
51
|
}
|
|
52
|
+
|
|
47
53
|
reject({
|
|
48
54
|
_code: _code,
|
|
49
55
|
message: message,
|
|
50
56
|
data: data
|
|
51
57
|
});
|
|
52
58
|
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
59
|
+
} // 请求成功
|
|
60
|
+
|
|
61
|
+
|
|
55
62
|
if ('function' === typeof callbackFun) {
|
|
56
63
|
callbackFun(data || message);
|
|
57
64
|
}
|
|
65
|
+
|
|
58
66
|
resolve({
|
|
59
67
|
_code: _code,
|
|
60
68
|
message: message,
|
|
61
69
|
data: data
|
|
62
|
-
});
|
|
63
|
-
// if (_code === -2) {
|
|
70
|
+
}); // if (_code === -2) {
|
|
64
71
|
// bpitLog({
|
|
65
72
|
// method,
|
|
66
73
|
// errorcode: _code,
|
|
@@ -83,4 +90,5 @@ var pcBridge = function pcBridge(method, param) {
|
|
|
83
90
|
});
|
|
84
91
|
});
|
|
85
92
|
};
|
|
93
|
+
|
|
86
94
|
export { pcBridge, PcBridgeInit };
|
package/es/lib/helper/codeMap.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _Map from "@babel/runtime-corejs3/core-js/map";
|
|
2
2
|
var resCodeMap = new _Map([[0, 'onSuccess'], [-1, 'onCancel'], [-2, 'onFail'], [-3, 'onProgress'], [-4, 'onSubmit']]);
|
|
3
|
+
|
|
3
4
|
function electronResCodeMap(code) {
|
|
4
5
|
return resCodeMap.get(code) || 'onFail';
|
|
5
6
|
}
|
|
7
|
+
|
|
6
8
|
export { electronResCodeMap };
|
package/es/lib/helper/event.js
CHANGED
|
@@ -1,31 +1,41 @@
|
|
|
1
|
-
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
2
|
-
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
3
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js/array/is-array";
|
|
4
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js/instance/index-of";
|
|
5
|
-
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/splice";
|
|
6
1
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js/instance/for-each";
|
|
7
|
-
|
|
2
|
+
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/splice";
|
|
3
|
+
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js/instance/index-of";
|
|
4
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js/array/is-array";
|
|
5
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
6
|
+
|
|
7
|
+
var Event = function Event() {
|
|
8
8
|
var _this = this;
|
|
9
|
+
|
|
9
10
|
_classCallCheck(this, Event);
|
|
11
|
+
|
|
10
12
|
this.on = function (event, fn) {
|
|
11
13
|
if (!event || 'function' !== typeof fn) throw 'eventName is null or handle is not a function, on fail';
|
|
12
14
|
if (!_Array$isArray(_this.eventsHandle[event])) _this.eventsHandle[event] = [];
|
|
15
|
+
|
|
13
16
|
_this.eventsHandle[event].push(fn);
|
|
14
17
|
};
|
|
18
|
+
|
|
15
19
|
this.off = function (event, fn) {
|
|
16
20
|
if (!event) throw 'eventName is null, invoke off fail';
|
|
21
|
+
|
|
17
22
|
if (!fn) {
|
|
18
23
|
_this.eventsHandle[event] = [];
|
|
19
24
|
return;
|
|
20
25
|
}
|
|
26
|
+
|
|
21
27
|
if (_Array$isArray(_this.eventsHandle[event])) {
|
|
22
28
|
var _context, _context2;
|
|
29
|
+
|
|
23
30
|
var n = _indexOfInstanceProperty(_context = _this.eventsHandle[event]).call(_context, fn);
|
|
31
|
+
|
|
24
32
|
-1 !== n && _spliceInstanceProperty(_context2 = _this.eventsHandle[event]).call(_context2, n, 1);
|
|
25
33
|
}
|
|
26
34
|
};
|
|
35
|
+
|
|
27
36
|
this.execEvent = function (event, data) {
|
|
28
37
|
var _context3;
|
|
38
|
+
|
|
29
39
|
_Array$isArray(this.eventsHandle[event]) && _forEachInstanceProperty(_context3 = this.eventsHandle[event]).call(_context3, function (fn) {
|
|
30
40
|
try {
|
|
31
41
|
fn(data);
|
|
@@ -34,7 +44,9 @@ var Event = /*#__PURE__*/_createClass(function Event() {
|
|
|
34
44
|
}
|
|
35
45
|
});
|
|
36
46
|
};
|
|
47
|
+
|
|
37
48
|
this.eventsHandle = {};
|
|
38
|
-
}
|
|
49
|
+
};
|
|
50
|
+
|
|
39
51
|
var event = new Event();
|
|
40
52
|
export default event;
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
2
|
-
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
3
|
-
import _Date$now from "@babel/runtime-corejs3/core-js/date/now";
|
|
4
1
|
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
2
|
+
import _Date$now from "@babel/runtime-corejs3/core-js/date/now";
|
|
3
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
5
4
|
import { log } from '../../utils';
|
|
6
|
-
import Event from './event';
|
|
7
|
-
|
|
8
|
-
var GenPostMsg =
|
|
5
|
+
import Event from './event'; // 处理posmessage参数
|
|
6
|
+
|
|
7
|
+
var GenPostMsg = function GenPostMsg(method, param, callback) {
|
|
9
8
|
var _this = this;
|
|
9
|
+
|
|
10
10
|
_classCallCheck(this, GenPostMsg);
|
|
11
|
+
|
|
11
12
|
this.genid = function () {
|
|
12
13
|
var idStr = _Date$now().toString(36);
|
|
14
|
+
|
|
13
15
|
idStr += Math.random().toString(36).substr(3);
|
|
14
16
|
return idStr;
|
|
15
17
|
};
|
|
18
|
+
|
|
16
19
|
this.receiveResponse = function (data) {
|
|
17
20
|
//this.PromiseObj.resolve(data);
|
|
18
21
|
_this.callback(data);
|
|
19
22
|
};
|
|
23
|
+
|
|
20
24
|
this.getPayload = function () {
|
|
21
25
|
return {
|
|
22
26
|
msgId: _this.id,
|
|
@@ -26,6 +30,7 @@ var GenPostMsg = /*#__PURE__*/_createClass(function GenPostMsg(method, param, ca
|
|
|
26
30
|
invokeType: _this.invokeType
|
|
27
31
|
};
|
|
28
32
|
};
|
|
33
|
+
|
|
29
34
|
this.id = this.genid();
|
|
30
35
|
this.PromiseObj = {
|
|
31
36
|
resolve: null,
|
|
@@ -34,8 +39,7 @@ var GenPostMsg = /*#__PURE__*/_createClass(function GenPostMsg(method, param, ca
|
|
|
34
39
|
this.methodName = method;
|
|
35
40
|
this.plainMsg = param;
|
|
36
41
|
this.invokeType = param === null || param === void 0 ? void 0 : param.invokeType;
|
|
37
|
-
this.callback = callback;
|
|
38
|
-
// this.result = new Promise(
|
|
42
|
+
this.callback = callback; // this.result = new Promise(
|
|
39
43
|
// function (resolve, reject) {
|
|
40
44
|
// this.PromiseObj = {
|
|
41
45
|
// resolve,
|
|
@@ -43,62 +47,81 @@ var GenPostMsg = /*#__PURE__*/_createClass(function GenPostMsg(method, param, ca
|
|
|
43
47
|
// };
|
|
44
48
|
// }.bind(this)
|
|
45
49
|
// );
|
|
46
|
-
}
|
|
47
|
-
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var Frame = function Frame() {
|
|
48
53
|
var _this2 = this;
|
|
54
|
+
|
|
49
55
|
_classCallCheck(this, Frame);
|
|
56
|
+
|
|
50
57
|
this.addPending = function (e) {
|
|
51
58
|
_this2.pendingMsgs[e.id] = e;
|
|
52
59
|
};
|
|
60
|
+
|
|
53
61
|
this.deletePending = function (e) {
|
|
54
62
|
delete _this2.pendingMsgs[e.id];
|
|
55
63
|
};
|
|
64
|
+
|
|
56
65
|
this.getPending = function (t) {
|
|
57
66
|
return this.pendingMsgs[t];
|
|
58
67
|
};
|
|
68
|
+
|
|
59
69
|
this.invokeAPIInBrowserView = function (payload) {
|
|
60
70
|
window.sendTo(payload);
|
|
61
71
|
};
|
|
72
|
+
|
|
62
73
|
this.invokeAPIInWebview = function (payload) {
|
|
63
74
|
window.sendToHost(payload);
|
|
64
75
|
};
|
|
76
|
+
|
|
65
77
|
this.invokeAPI = function (method, param, callback) {
|
|
66
78
|
var genPostMsg = new GenPostMsg(method, param, callback);
|
|
79
|
+
|
|
67
80
|
var payload = _JSON$stringify(genPostMsg.getPayload());
|
|
81
|
+
|
|
68
82
|
var _param$invokeType = param.invokeType,
|
|
69
|
-
|
|
83
|
+
invokeType = _param$invokeType === void 0 ? '' : _param$invokeType;
|
|
70
84
|
invokeType === 'browserView' ? _this2.invokeAPIInBrowserView(payload) : _this2.invokeAPIInWebview(payload);
|
|
85
|
+
|
|
71
86
|
_this2.addPending(genPostMsg);
|
|
87
|
+
|
|
72
88
|
return genPostMsg;
|
|
73
89
|
};
|
|
90
|
+
|
|
74
91
|
this.handleCallback = function (datas, invokeType) {
|
|
75
92
|
var type = datas.type,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
methodName = datas.methodName,
|
|
94
|
+
eventName = datas.eventName,
|
|
95
|
+
msgId = datas.msgId,
|
|
96
|
+
_datas$data = datas.data,
|
|
97
|
+
data = _datas$data === void 0 ? {} : _datas$data,
|
|
98
|
+
code = datas.code,
|
|
99
|
+
message = datas.message,
|
|
100
|
+
msg = datas.msg;
|
|
101
|
+
|
|
84
102
|
if (type === 'request') {
|
|
85
103
|
// 壳子的调用
|
|
86
104
|
switch (methodName) {
|
|
87
105
|
case 'refresh':
|
|
88
106
|
window.location.reload();
|
|
89
107
|
break;
|
|
108
|
+
|
|
90
109
|
case 'back':
|
|
91
110
|
window.history.back();
|
|
92
111
|
break;
|
|
112
|
+
|
|
93
113
|
case 'forward':
|
|
94
114
|
window.history.forward();
|
|
95
115
|
break;
|
|
116
|
+
|
|
96
117
|
case 'event':
|
|
97
118
|
Event.execEvent(eventName, data);
|
|
98
119
|
break;
|
|
120
|
+
|
|
99
121
|
case 'zoomInClick':
|
|
100
122
|
var scrollTopVal = document.documentElement.scrollTop || document.body.scrollTop,
|
|
101
|
-
|
|
123
|
+
url = window.location.href;
|
|
124
|
+
|
|
102
125
|
if (invokeType === 'browserView') {
|
|
103
126
|
window.sendTo(_JSON$stringify({
|
|
104
127
|
type: type,
|
|
@@ -120,13 +143,16 @@ var Frame = /*#__PURE__*/_createClass(function Frame() {
|
|
|
120
143
|
}
|
|
121
144
|
}));
|
|
122
145
|
}
|
|
146
|
+
|
|
123
147
|
break;
|
|
148
|
+
|
|
124
149
|
default:
|
|
125
150
|
break;
|
|
126
151
|
}
|
|
127
152
|
} else if (type === 'response') {
|
|
128
153
|
// 响应壳子的回调
|
|
129
154
|
var pending = _this2.getPending(msgId);
|
|
155
|
+
|
|
130
156
|
pending && pending.receiveResponse({
|
|
131
157
|
data: data,
|
|
132
158
|
code: code,
|
|
@@ -135,16 +161,20 @@ var Frame = /*#__PURE__*/_createClass(function Frame() {
|
|
|
135
161
|
code != -3 && _this2.deletePending(msgId);
|
|
136
162
|
}
|
|
137
163
|
};
|
|
164
|
+
|
|
138
165
|
this.init = function () {
|
|
139
166
|
window.addEventListener('message', function (msg) {
|
|
140
167
|
log('electron res: ', msg);
|
|
168
|
+
|
|
141
169
|
_this2.handleCallback(msg.data || {});
|
|
142
170
|
});
|
|
143
171
|
window.receiveBrowserViewData && window.receiveBrowserViewData(function (e, response) {
|
|
144
172
|
return _this2.handleCallback(response);
|
|
145
173
|
});
|
|
146
174
|
};
|
|
175
|
+
|
|
147
176
|
this.pendingMsgs = {};
|
|
148
|
-
}
|
|
177
|
+
};
|
|
178
|
+
|
|
149
179
|
var frame = new Frame();
|
|
150
180
|
export default frame;
|