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