yach.open.jssdk 4.4.1-beta10 → 4.4.1-beta12
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-beta12.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.d.ts +1 -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/knowledgeBaseSelect.d.ts +21 -0
- package/es/api/biz/util/knowledgeBaseSelect.js +17 -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.d.ts +10 -0
- package/es/api/biz/util/openFutureGroup.js +25 -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 +13 -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.d.ts +5 -0
- package/es/api/biz/util/weeklyRead.js +25 -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 +7 -1
- package/es/api/device/notification/showPreloader.d.ts +1 -0
- package/es/api/device/notification/showPreloader.js +7 -1
- 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 +11 -1
- package/es/index.js +39 -17
- package/es/lib/bridge/mobile.js +74 -27
- package/es/lib/bridge/pc.js +63 -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.d.ts +1 -1
- package/es/utils/console.js +19 -3
- 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.d.ts +1 -0
- 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/knowledgeBaseSelect.d.ts +21 -0
- package/libs/api/biz/util/knowledgeBaseSelect.js +28 -0
- 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.d.ts +10 -0
- package/libs/api/biz/util/openFutureGroup.js +36 -0
- 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 +13 -0
- package/libs/api/biz/util/screen.js +28 -0
- 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.d.ts +5 -0
- package/libs/api/biz/util/weeklyRead.js +36 -0
- 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 +12 -2
- package/libs/api/device/notification/showPreloader.d.ts +1 -0
- package/libs/api/device/notification/showPreloader.js +12 -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 +11 -3
- 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 +11 -1
- package/libs/index.js +543 -249
- package/libs/lib/bridge/index.js +13 -6
- package/libs/lib/bridge/mobile.js +91 -28
- package/libs/lib/bridge/pc.js +76 -15
- package/libs/lib/helper/apiHelper.js +7 -1
- package/libs/lib/helper/codeMap.js +7 -1
- package/libs/lib/helper/event.js +26 -7
- package/libs/lib/helper/pcIframe.js +57 -18
- package/libs/lib/index.js +31 -8
- package/libs/lib/sdk/index.js +56 -17
- package/libs/lib/sdk/sdk.typings.d.ts +1 -0
- package/libs/lib/sdk/sdk.typings.js +3 -0
- package/libs/utils/bpitLog.js +16 -4
- package/libs/utils/compareVersions.js +69 -28
- package/libs/utils/console.d.ts +1 -1
- package/libs/utils/console.js +20 -4
- 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.3.js +0 -1
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';
|
|
@@ -48,8 +50,12 @@ import { openUserSchedule } from './api/biz/util/openUserSchedule';
|
|
|
48
50
|
import { onlineDocmentOpenTeamChat } from './api/biz/util/onlineDocmentOpenTeamChat';
|
|
49
51
|
import { entergroupCheck } from './api/biz/util/entergroupCheck';
|
|
50
52
|
import { resetSessionUnread } from './api/biz/util/resetSessionUnread';
|
|
53
|
+
import { weeklyRead } from './api/biz/util/weeklyRead';
|
|
51
54
|
import { disableScreenCapture } from './api/biz/util/disableScreenCapture';
|
|
55
|
+
import { openFutureGroup } from './api/biz/util/openFutureGroup';
|
|
56
|
+
import { knowledgeBaseSelect } from './api/biz/util/knowledgeBaseSelect';
|
|
52
57
|
/**navigation*/
|
|
58
|
+
|
|
53
59
|
import { setIcon } from './api/biz/navigation/setIcon';
|
|
54
60
|
import { setTitle } from './api/biz/navigation/setTitle';
|
|
55
61
|
import { setMenu } from './api/biz/navigation/setMenu';
|
|
@@ -66,11 +72,14 @@ import { tencentMeeting } from './api/biz/navigation/tencentMeeting';
|
|
|
66
72
|
import { tencentMeetingBegin } from './api/biz/navigation/tencentMeetingBegin';
|
|
67
73
|
import { setPanGestureEnable } from './api/biz/navigation/setPanGestureEnable';
|
|
68
74
|
/**contact*/
|
|
75
|
+
|
|
69
76
|
import { complexPicker } from './api/biz/contact/complexPicker';
|
|
70
77
|
import { departmentsPicker } from './api/biz/contact/departmentsPicker';
|
|
71
78
|
/** group*/
|
|
79
|
+
|
|
72
80
|
import { groupComplexPicker } from './api/biz/group/groupComplexPicker';
|
|
73
81
|
/** chat*/
|
|
82
|
+
|
|
74
83
|
import { chooseConversationByCorpId } from './api/biz/chat/chooseConversationByCorpId';
|
|
75
84
|
import { pickConversation } from './api/biz/chat/pickConversation';
|
|
76
85
|
import { openSingleChat } from './api/biz/chat/openSingleChat';
|
|
@@ -78,13 +87,16 @@ import { openTeamChat } from './api/biz/chat/openTeamChat';
|
|
|
78
87
|
import { openSquad } from './api/biz/chat/openSquad';
|
|
79
88
|
import { sendP2PMsg } from './api/biz/chat/sendP2PMsg';
|
|
80
89
|
/* primary*****************************/
|
|
90
|
+
|
|
81
91
|
import { createTab } from './api/primary/createTab';
|
|
82
92
|
import { weeklyShare } from './api/primary/weeklyShare';
|
|
83
93
|
import { fullScreen } from './api/primary/fullScreen';
|
|
84
94
|
import { exitFullScreen } from './api/primary/exitFullScreen';
|
|
85
95
|
/* runtime*****************************/
|
|
96
|
+
|
|
86
97
|
import { requestAuthCode } from './api/runtime/permission/requestAuthCode';
|
|
87
98
|
/** device */
|
|
99
|
+
|
|
88
100
|
import { showPreloader } from './api/device/notification/showPreloader';
|
|
89
101
|
import { hidePreloader } from './api/device/notification/hidePreloader';
|
|
90
102
|
import { vibrate } from './api/device/notification/vibrate';
|
|
@@ -114,35 +126,40 @@ import { startRecord_v2 } from './api/device/audio/startRecord_v2';
|
|
|
114
126
|
import { stopRecord_v2 } from './api/device/audio/stopRecord_v2';
|
|
115
127
|
import { setLight } from './api/device/system/setLight';
|
|
116
128
|
/** telephone */
|
|
129
|
+
|
|
117
130
|
import { showCallMenu } from './api/biz/telephone/showCallMenu';
|
|
118
131
|
import { call } from './api/biz/telephone/call';
|
|
119
132
|
/** ui */
|
|
133
|
+
|
|
120
134
|
import { disable as webViewBounceDisable } from './api/ui/webViewBounce/disable';
|
|
121
135
|
import { enable as pullToRefreshEnable } from './api/ui/pullToRefresh/enable';
|
|
122
136
|
import { stop as pullToRefreshStop } from './api/ui/pullToRefresh/stop';
|
|
123
|
-
import { disable as pullToRefreshDisable } from './api/ui/pullToRefresh/disable';
|
|
124
|
-
|
|
137
|
+
import { disable as pullToRefreshDisable } from './api/ui/pullToRefresh/disable'; // demainStorage
|
|
138
|
+
|
|
125
139
|
import { getItem } from './api/util/domainStorage/getItem';
|
|
126
140
|
import { setItem } from './api/util/domainStorage/setItem';
|
|
127
|
-
import { removeItem } from './api/util/domainStorage/removeItem';
|
|
128
|
-
|
|
141
|
+
import { removeItem } from './api/util/domainStorage/removeItem'; // log
|
|
142
|
+
|
|
129
143
|
import { writeLog } from './api/util/tool/log';
|
|
130
|
-
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';
|
|
131
147
|
import { send as webViewMessageSend } from './api/biz/webViewMessage/send';
|
|
132
148
|
import { talYoungFilesUpload } from './api/app/custom/talYoungFilesUpload';
|
|
149
|
+
import { addAppToNav } from './api/biz/util/addAppToNav';
|
|
133
150
|
console.log('add rouseApp ------------>', rouseApp);
|
|
134
151
|
var _yachSdk$exportSdk = yachSdk.exportSdk,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
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, openTogetherEyeWebview, getTogetherConfig, rouseApp, externalLinkPreviewFile, savePic, zfbAuth, complain, onRecordEnd_v2, startRecord_v2, stopRecord_v2, selectDepartment, setWindowBig, tencentMeeting, tencentMeetingBegin, createModifySchedule, onlineDocmentOpenTeamChat, entergroupCheck, resetSessionUnread, setLight, openUserSchedule, disableScreenCapture, setPanGestureEnable };
|
|
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, 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, 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 };
|
|
146
163
|
export default {
|
|
147
164
|
version: version,
|
|
148
165
|
sdkVersion: sdkVersion,
|
|
@@ -177,6 +194,8 @@ export default {
|
|
|
177
194
|
onlineDocmentOpenTeamChat: onlineDocmentOpenTeamChat,
|
|
178
195
|
entergroupCheck: entergroupCheck,
|
|
179
196
|
resetSessionUnread: resetSessionUnread,
|
|
197
|
+
weeklyRead: weeklyRead,
|
|
198
|
+
openFutureGroup: openFutureGroup,
|
|
180
199
|
closeWindow: closeWindow,
|
|
181
200
|
remind: remind,
|
|
182
201
|
takePicture: takePicture,
|
|
@@ -201,7 +220,10 @@ export default {
|
|
|
201
220
|
selectDepartment: selectDepartment,
|
|
202
221
|
createModifySchedule: createModifySchedule,
|
|
203
222
|
openUserSchedule: openUserSchedule,
|
|
204
|
-
disableScreenCapture: disableScreenCapture
|
|
223
|
+
disableScreenCapture: disableScreenCapture,
|
|
224
|
+
addAppToNav: addAppToNav,
|
|
225
|
+
knowledgeBaseSelect: knowledgeBaseSelect,
|
|
226
|
+
capturePage: capturePage
|
|
205
227
|
},
|
|
206
228
|
telephone: {
|
|
207
229
|
showCallMenu: showCallMenu,
|
package/es/lib/bridge/mobile.js
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
3
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
|
|
1
|
+
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
4
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";
|
|
5
6
|
import Event from '../helper/event';
|
|
6
7
|
import { electronResCodeMap } from '../helper/codeMap';
|
|
7
8
|
import { log, bpitLog } from '../../utils';
|
|
9
|
+
|
|
8
10
|
function setupWebViewJavascriptBridge(callback) {
|
|
9
11
|
if (window.WebViewJavascriptBridge) {
|
|
10
12
|
return callback(WebViewJavascriptBridge);
|
|
11
13
|
}
|
|
14
|
+
|
|
12
15
|
if (window.WKWebViewJavascriptBridge) {
|
|
13
16
|
return callback(WKWebViewJavascriptBridge);
|
|
14
17
|
}
|
|
18
|
+
|
|
15
19
|
if (window.WVJBCallbacks) {
|
|
16
20
|
return window.WVJBCallbacks.push(callback);
|
|
17
21
|
}
|
|
22
|
+
|
|
18
23
|
window.WVJBCallbacks = [callback];
|
|
19
24
|
var WVJBIframe = document.createElement('iframe');
|
|
20
25
|
WVJBIframe.style.display = 'none';
|
|
21
26
|
WVJBIframe.src = 'https://__bridge_loaded__';
|
|
22
27
|
document.documentElement.appendChild(WVJBIframe);
|
|
28
|
+
|
|
23
29
|
_setTimeout(function () {
|
|
24
30
|
document.documentElement.removeChild(WVJBIframe);
|
|
25
31
|
}, 0);
|
|
26
32
|
}
|
|
33
|
+
|
|
27
34
|
var mobileBridgeInit = function mobileBridgeInit() {
|
|
28
35
|
return new _Promise(function (resolve, reject) {
|
|
29
36
|
setupWebViewJavascriptBridge(function (bridge) {
|
|
@@ -70,14 +77,17 @@ var mobileBridgeInit = function mobileBridgeInit() {
|
|
|
70
77
|
});
|
|
71
78
|
});
|
|
72
79
|
};
|
|
80
|
+
|
|
73
81
|
var mobileBridge = function mobileBridge(method, param) {
|
|
74
82
|
return new _Promise(function (resolve, reject) {
|
|
75
83
|
var p = _Object$assign({}, param);
|
|
84
|
+
|
|
76
85
|
setupWebViewJavascriptBridge(function (bridge) {
|
|
77
86
|
if (param.control) {
|
|
78
87
|
bridge.registerHandler(method, function (data) {
|
|
79
88
|
var onSuccess = param.onSuccess;
|
|
80
89
|
delete p.onSuccess;
|
|
90
|
+
|
|
81
91
|
if ('function' === typeof onSuccess) {
|
|
82
92
|
onSuccess(data);
|
|
83
93
|
resolve({
|
|
@@ -87,32 +97,15 @@ var mobileBridge = function mobileBridge(method, param) {
|
|
|
87
97
|
}
|
|
88
98
|
});
|
|
89
99
|
}
|
|
100
|
+
|
|
90
101
|
bridge.callHandler(method, param, function (e) {
|
|
91
102
|
var code = e.code,
|
|
92
|
-
|
|
93
|
-
|
|
103
|
+
message = e.message,
|
|
104
|
+
data = e.data;
|
|
105
|
+
|
|
94
106
|
var _code = _parseInt(code);
|
|
95
|
-
var callbackStr = electronResCodeMap(_code);
|
|
96
|
-
if (_code === -2 || _code === 7) {
|
|
97
|
-
bpitLog({
|
|
98
|
-
method: method,
|
|
99
|
-
errorcode: _code,
|
|
100
|
-
message: message || 'SDK执行失败回调,相关参数'
|
|
101
|
-
});
|
|
102
|
-
log("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
103
|
-
method: method,
|
|
104
|
-
param: param,
|
|
105
|
-
data: data,
|
|
106
|
-
_code: _code,
|
|
107
|
-
message: message
|
|
108
|
-
});
|
|
109
|
-
reject({
|
|
110
|
-
_code: _code,
|
|
111
|
-
message: message
|
|
112
|
-
});
|
|
113
|
-
// return;
|
|
114
|
-
}
|
|
115
107
|
|
|
108
|
+
var callbackStr = electronResCodeMap(_code);
|
|
116
109
|
var callbackFun = p[callbackStr];
|
|
117
110
|
log("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
118
111
|
method: method,
|
|
@@ -121,17 +114,71 @@ var mobileBridge = function mobileBridge(method, param) {
|
|
|
121
114
|
_code: _code,
|
|
122
115
|
message: message,
|
|
123
116
|
callbackFun: callbackFun
|
|
124
|
-
});
|
|
117
|
+
}); // 请求失败
|
|
118
|
+
|
|
119
|
+
if (callbackStr === 'onFail') {
|
|
120
|
+
bpitLog({
|
|
121
|
+
method: method,
|
|
122
|
+
errorcode: _code,
|
|
123
|
+
message: message || _JSON$stringify(data) || 'SDK执行失败回调,相关参数'
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
if ('function' === typeof callbackFun) {
|
|
127
|
+
message ? callbackFun({
|
|
128
|
+
code: code,
|
|
129
|
+
message: message
|
|
130
|
+
}) : callbackFun(data);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
reject({
|
|
134
|
+
_code: _code,
|
|
135
|
+
message: message,
|
|
136
|
+
data: data
|
|
137
|
+
});
|
|
138
|
+
return;
|
|
139
|
+
} // 请求成功
|
|
140
|
+
|
|
141
|
+
|
|
125
142
|
if ('function' === typeof callbackFun) {
|
|
126
143
|
callbackFun(data || message);
|
|
127
144
|
}
|
|
145
|
+
|
|
128
146
|
resolve({
|
|
129
147
|
_code: _code,
|
|
130
148
|
message: message,
|
|
131
149
|
data: data
|
|
132
|
-
});
|
|
150
|
+
}); // if (_code === -2 || _code === 7) {
|
|
151
|
+
// bpitLog({
|
|
152
|
+
// method,
|
|
153
|
+
// errorcode: _code,
|
|
154
|
+
// message: message || 'SDK执行失败回调,相关参数',
|
|
155
|
+
// });
|
|
156
|
+
// log(`SDK执行后回调,相关参数 `, {
|
|
157
|
+
// method,
|
|
158
|
+
// param,
|
|
159
|
+
// data,
|
|
160
|
+
// _code,
|
|
161
|
+
// message,
|
|
162
|
+
// });
|
|
163
|
+
// reject({_code, message});
|
|
164
|
+
// // return;
|
|
165
|
+
// }
|
|
166
|
+
// const callbackFun = p[callbackStr];
|
|
167
|
+
// log(`SDK执行后回调,相关参数 `, {
|
|
168
|
+
// method,
|
|
169
|
+
// param,
|
|
170
|
+
// data,
|
|
171
|
+
// _code,
|
|
172
|
+
// message,
|
|
173
|
+
// callbackFun,
|
|
174
|
+
// });
|
|
175
|
+
// if ('function' === typeof callbackFun) {
|
|
176
|
+
// callbackFun(data || message);
|
|
177
|
+
// }
|
|
178
|
+
// resolve({_code, message, data});
|
|
133
179
|
});
|
|
134
180
|
});
|
|
135
181
|
});
|
|
136
182
|
};
|
|
183
|
+
|
|
137
184
|
export { mobileBridge, mobileBridgeInit };
|
package/es/lib/bridge/pc.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
|
|
2
|
+
import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
2
3
|
import _parseInt from "@babel/runtime-corejs3/core-js/parse-int";
|
|
4
|
+
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
3
5
|
import PcIframe from '../helper/pcIframe';
|
|
4
6
|
import { electronResCodeMap } from '../helper/codeMap';
|
|
5
7
|
import { log, bpitLog } from '../../utils';
|
|
8
|
+
|
|
6
9
|
var PcBridgeInit = function PcBridgeInit() {
|
|
7
10
|
PcIframe.init();
|
|
8
11
|
};
|
|
12
|
+
|
|
9
13
|
var pcBridge = function pcBridge(method, param) {
|
|
10
|
-
return new _Promise(function (resolve) {
|
|
14
|
+
return new _Promise(function (resolve, reject) {
|
|
11
15
|
return PcIframe.invokeAPI(method, param, function (_ref) {
|
|
12
16
|
var data = _ref.data,
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
code = _ref.code,
|
|
18
|
+
message = _ref.message;
|
|
19
|
+
|
|
15
20
|
var _code = _parseInt(code);
|
|
21
|
+
|
|
16
22
|
var callbackStr = electronResCodeMap(_code);
|
|
17
|
-
if (_code === -2) {
|
|
18
|
-
bpitLog({
|
|
19
|
-
method: method,
|
|
20
|
-
errorcode: _code,
|
|
21
|
-
message: message || 'SDK执行失败回调,相关参数'
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
23
|
var callbackFun = param[callbackStr];
|
|
25
24
|
log("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
|
|
26
25
|
method: method,
|
|
@@ -29,16 +28,67 @@ var pcBridge = function pcBridge(method, param) {
|
|
|
29
28
|
_code: _code,
|
|
30
29
|
message: message,
|
|
31
30
|
callbackFun: callbackFun
|
|
32
|
-
});
|
|
31
|
+
}); // 请求失败
|
|
32
|
+
|
|
33
|
+
if (callbackStr === 'onFail') {
|
|
34
|
+
bpitLog({
|
|
35
|
+
method: method,
|
|
36
|
+
errorcode: _code,
|
|
37
|
+
message: message || _JSON$stringify(data) || 'SDK执行失败回调,相关参数'
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if ('function' === typeof callbackFun) {
|
|
41
|
+
console.log('wenai-code', code, _code);
|
|
42
|
+
var callbackData = Object.prototype.toString.call(data) === "[object Object]" ? _Object$assign(_Object$assign({}, data), {
|
|
43
|
+
code: code,
|
|
44
|
+
message: message
|
|
45
|
+
}) : {
|
|
46
|
+
data: data,
|
|
47
|
+
code: code,
|
|
48
|
+
message: message
|
|
49
|
+
};
|
|
50
|
+
message ? callbackFun(callbackData) : callbackFun(data);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
reject({
|
|
54
|
+
_code: _code,
|
|
55
|
+
message: message,
|
|
56
|
+
data: data
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
59
|
+
} // 请求成功
|
|
60
|
+
|
|
61
|
+
|
|
33
62
|
if ('function' === typeof callbackFun) {
|
|
34
63
|
callbackFun(data || message);
|
|
35
64
|
}
|
|
65
|
+
|
|
36
66
|
resolve({
|
|
37
67
|
_code: _code,
|
|
38
68
|
message: message,
|
|
39
69
|
data: data
|
|
40
|
-
});
|
|
70
|
+
}); // if (_code === -2) {
|
|
71
|
+
// bpitLog({
|
|
72
|
+
// method,
|
|
73
|
+
// errorcode: _code,
|
|
74
|
+
// message: message || 'SDK执行失败回调,相关参数',
|
|
75
|
+
// });
|
|
76
|
+
// }
|
|
77
|
+
// const callbackFun = param[callbackStr];
|
|
78
|
+
// log(`SDK执行后回调,相关参数 `, {
|
|
79
|
+
// method,
|
|
80
|
+
// param,
|
|
81
|
+
// data,
|
|
82
|
+
// _code,
|
|
83
|
+
// message,
|
|
84
|
+
// callbackFun
|
|
85
|
+
// });
|
|
86
|
+
// if ('function' === typeof callbackFun) {
|
|
87
|
+
// callbackFun(data || message);
|
|
88
|
+
// }
|
|
89
|
+
// resolve({ _code, message, data });
|
|
41
90
|
});
|
|
42
91
|
});
|
|
43
92
|
};
|
|
93
|
+
|
|
44
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,60 +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
|
-
|
|
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
|
+
|
|
82
102
|
if (type === 'request') {
|
|
83
103
|
// 壳子的调用
|
|
84
104
|
switch (methodName) {
|
|
85
105
|
case 'refresh':
|
|
86
106
|
window.location.reload();
|
|
87
107
|
break;
|
|
108
|
+
|
|
88
109
|
case 'back':
|
|
89
110
|
window.history.back();
|
|
90
111
|
break;
|
|
112
|
+
|
|
91
113
|
case 'forward':
|
|
92
114
|
window.history.forward();
|
|
93
115
|
break;
|
|
116
|
+
|
|
94
117
|
case 'event':
|
|
95
118
|
Event.execEvent(eventName, data);
|
|
96
119
|
break;
|
|
120
|
+
|
|
97
121
|
case 'zoomInClick':
|
|
98
122
|
var scrollTopVal = document.documentElement.scrollTop || document.body.scrollTop,
|
|
99
|
-
|
|
123
|
+
url = window.location.href;
|
|
124
|
+
|
|
100
125
|
if (invokeType === 'browserView') {
|
|
101
126
|
window.sendTo(_JSON$stringify({
|
|
102
127
|
type: type,
|
|
@@ -118,31 +143,38 @@ var Frame = /*#__PURE__*/_createClass(function Frame() {
|
|
|
118
143
|
}
|
|
119
144
|
}));
|
|
120
145
|
}
|
|
146
|
+
|
|
121
147
|
break;
|
|
148
|
+
|
|
122
149
|
default:
|
|
123
150
|
break;
|
|
124
151
|
}
|
|
125
152
|
} else if (type === 'response') {
|
|
126
153
|
// 响应壳子的回调
|
|
127
154
|
var pending = _this2.getPending(msgId);
|
|
155
|
+
|
|
128
156
|
pending && pending.receiveResponse({
|
|
129
157
|
data: data,
|
|
130
158
|
code: code,
|
|
131
|
-
message: message
|
|
159
|
+
message: message || msg || data.msg || data.message
|
|
132
160
|
});
|
|
133
161
|
code != -3 && _this2.deletePending(msgId);
|
|
134
162
|
}
|
|
135
163
|
};
|
|
164
|
+
|
|
136
165
|
this.init = function () {
|
|
137
166
|
window.addEventListener('message', function (msg) {
|
|
138
167
|
log('electron res: ', msg);
|
|
168
|
+
|
|
139
169
|
_this2.handleCallback(msg.data || {});
|
|
140
170
|
});
|
|
141
171
|
window.receiveBrowserViewData && window.receiveBrowserViewData(function (e, response) {
|
|
142
172
|
return _this2.handleCallback(response);
|
|
143
173
|
});
|
|
144
174
|
};
|
|
175
|
+
|
|
145
176
|
this.pendingMsgs = {};
|
|
146
|
-
}
|
|
177
|
+
};
|
|
178
|
+
|
|
147
179
|
var frame = new Frame();
|
|
148
180
|
export default frame;
|