yach.open.jssdk 4.3.0-beta2 → 4.3.1-beta

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.
Files changed (276) hide show
  1. package/dist/yach_jssdk_4.1.32-bata.1.js +1 -0
  2. package/es/api/app/custom/talYoungFilesUpload.js +2 -0
  3. package/es/api/biz/chat/chooseConversationByCorpId.js +2 -0
  4. package/es/api/biz/chat/openSingleChat.js +2 -0
  5. package/es/api/biz/chat/openSquad.js +2 -0
  6. package/es/api/biz/chat/openTeamChat.js +2 -0
  7. package/es/api/biz/chat/pickConversation.js +2 -0
  8. package/es/api/biz/chat/sendP2PMsg.js +2 -0
  9. package/es/api/biz/contact/complexPicker.js +2 -0
  10. package/es/api/biz/contact/departmentsPicker.js +2 -0
  11. package/es/api/biz/group/groupComplexPicker.js +2 -0
  12. package/es/api/biz/map/multipointView.js +2 -0
  13. package/es/api/biz/map/view.js +2 -0
  14. package/es/api/biz/navigation/close.js +2 -0
  15. package/es/api/biz/navigation/goBack.js +2 -0
  16. package/es/api/biz/navigation/quit.js +2 -0
  17. package/es/api/biz/navigation/replace.js +2 -0
  18. package/es/api/biz/navigation/setIcon.js +2 -0
  19. package/es/api/biz/navigation/setLeft.js +2 -0
  20. package/es/api/biz/navigation/setMenu.js +2 -0
  21. package/es/api/biz/navigation/setRight.js +2 -0
  22. package/es/api/biz/navigation/setTitle.js +2 -0
  23. package/es/api/biz/navigation/setTitleExpandIcon.js +2 -0
  24. package/es/api/biz/navigation/setWindowBig.js +2 -0
  25. package/es/api/biz/navigation/tencentMeeting.js +2 -0
  26. package/es/api/biz/navigation/tencentMeetingBegin.js +2 -0
  27. package/es/api/biz/navigation/updateExpandTitle.js +2 -0
  28. package/es/api/biz/telephone/call.js +2 -0
  29. package/es/api/biz/telephone/showCallMenu.js +2 -0
  30. package/es/api/biz/util/authFinish.js +2 -0
  31. package/es/api/biz/util/authStart.js +2 -0
  32. package/es/api/biz/util/chosen.js +2 -0
  33. package/es/api/biz/util/clipboardFileUpload.js +2 -0
  34. package/es/api/biz/util/closeWindow.js +2 -0
  35. package/es/api/biz/util/complain.js +2 -0
  36. package/es/api/biz/util/createModifySchedule.js +2 -0
  37. package/es/api/biz/util/datepicker.js +2 -0
  38. package/es/api/biz/util/datetimepicker.js +2 -0
  39. package/es/api/biz/util/downloadFile.js +2 -0
  40. package/es/api/biz/util/entergroupCheck.js +3 -1
  41. package/es/api/biz/util/externalLinkPreviewFile.js +2 -0
  42. package/es/api/biz/util/feedback.js +2 -0
  43. package/es/api/biz/util/getSingleWebviewData.js +2 -0
  44. package/es/api/biz/util/getTogetherConfig.js +2 -0
  45. package/es/api/biz/util/getToken.js +2 -0
  46. package/es/api/biz/util/injectScript.js +2 -0
  47. package/es/api/biz/util/invoice.js +2 -0
  48. package/es/api/biz/util/mediaFileUpload.js +2 -0
  49. package/es/api/biz/util/onlineDocmentOpenTeamChat.js +2 -0
  50. package/es/api/biz/util/open.js +2 -0
  51. package/es/api/biz/util/openLink.js +2 -0
  52. package/es/api/biz/util/openMediaFileDialog.js +2 -0
  53. package/es/api/biz/util/openSingleWebview.js +2 -0
  54. package/es/api/biz/util/openSlidePanel.js +2 -0
  55. package/es/api/biz/util/openTalYoungToTopic.js +2 -0
  56. package/es/api/biz/util/openTogetherEyeWebview.js +2 -0
  57. package/es/api/biz/util/openUserSchedule.js +2 -0
  58. package/es/api/biz/util/openVideoPlayer.js +2 -0
  59. package/es/api/biz/util/previewFile.js +2 -0
  60. package/es/api/biz/util/previewImage.js +2 -0
  61. package/es/api/biz/util/proxy.js +2 -0
  62. package/es/api/biz/util/pushWorkMsg.js +2 -0
  63. package/es/api/biz/util/remind.js +2 -0
  64. package/es/api/biz/util/rouseApp.js +2 -0
  65. package/es/api/biz/util/savePic.js +2 -0
  66. package/es/api/biz/util/scan.js +2 -0
  67. package/es/api/biz/util/selectDepartment.js +2 -0
  68. package/es/api/biz/util/share.js +2 -0
  69. package/es/api/biz/util/takePicture.js +2 -0
  70. package/es/api/biz/util/uploadAttachment.js +2 -0
  71. package/es/api/biz/util/zfbAuth.js +2 -0
  72. package/es/api/biz/webViewMessage/send.js +2 -0
  73. package/es/api/device/audio/download.js +2 -0
  74. package/es/api/device/audio/onPlayEnd.js +2 -0
  75. package/es/api/device/audio/onRecordEnd.js +2 -0
  76. package/es/api/device/audio/onRecordEnd_v2.js +2 -0
  77. package/es/api/device/audio/pause.js +2 -0
  78. package/es/api/device/audio/play.js +2 -0
  79. package/es/api/device/audio/resume.js +2 -0
  80. package/es/api/device/audio/startRecord.js +2 -0
  81. package/es/api/device/audio/startRecord_v2.js +2 -0
  82. package/es/api/device/audio/stop.js +2 -0
  83. package/es/api/device/audio/stopRecord.js +2 -0
  84. package/es/api/device/audio/stopRecord_v2.js +2 -0
  85. package/es/api/device/base/checkStepPermission.js +2 -0
  86. package/es/api/device/base/getPhoneInfo.js +2 -0
  87. package/es/api/device/base/getUUID.js +3 -5
  88. package/es/api/device/connection/getNetworkType.js +2 -0
  89. package/es/api/device/connection/isAtTal.js +4 -2
  90. package/es/api/device/geolocation/get.js +2 -0
  91. package/es/api/device/geolocation/getSwitch.js +2 -0
  92. package/es/api/device/notification/actionSheet.js +2 -0
  93. package/es/api/device/notification/alert.js +2 -0
  94. package/es/api/device/notification/confirm.js +2 -0
  95. package/es/api/device/notification/hidePreloader.js +2 -0
  96. package/es/api/device/notification/showPreloader.js +2 -0
  97. package/es/api/device/notification/toast.js +2 -0
  98. package/es/api/device/notification/vibrate.js +2 -0
  99. package/es/api/device/system/getLang.js +2 -0
  100. package/es/api/device/system/setLight.js +2 -0
  101. package/es/api/initAPI.js +5 -3
  102. package/es/api/primary/createTab.js +2 -0
  103. package/es/api/primary/exitFullScreen.js +2 -0
  104. package/es/api/primary/fullScreen.js +2 -0
  105. package/es/api/primary/weeklyShare.js +2 -0
  106. package/es/api/runtime/permission/requestAuthCode.js +2 -0
  107. package/es/api/ui/pullToRefresh/disable.js +2 -0
  108. package/es/api/ui/pullToRefresh/enable.js +2 -0
  109. package/es/api/ui/pullToRefresh/stop.js +2 -0
  110. package/es/api/ui/webViewBounce/disable.js +2 -0
  111. package/es/api/util/domainStorage/getItem.js +2 -0
  112. package/es/api/util/domainStorage/removeItem.js +2 -0
  113. package/es/api/util/domainStorage/setItem.js +2 -0
  114. package/es/api/util/tool/flushLog.js +2 -0
  115. package/es/api/util/tool/log.js +2 -0
  116. package/es/index.d.ts +1 -7
  117. package/es/index.js +27 -22
  118. package/es/lib/bridge/mobile.js +19 -4
  119. package/es/lib/bridge/pc.js +11 -2
  120. package/es/lib/helper/apiHelper.js +2 -0
  121. package/es/lib/helper/codeMap.js +2 -0
  122. package/es/lib/helper/event.js +13 -0
  123. package/es/lib/helper/pcIframe.js +43 -12
  124. package/es/lib/index.js +21 -7
  125. package/es/lib/sdk/index.js +37 -18
  126. package/es/lib/sdk/sdk.typings.js +1 -0
  127. package/es/utils/bpitLog.js +13 -4
  128. package/es/utils/compareVersions.js +50 -23
  129. package/es/utils/console.js +15 -0
  130. package/es/utils/env.js +18 -11
  131. package/es/utils/index.js +5 -0
  132. package/libs/api/app/custom/talYoungFilesUpload.js +6 -1
  133. package/libs/api/biz/chat/chooseConversationByCorpId.js +6 -0
  134. package/libs/api/biz/chat/openSingleChat.js +6 -0
  135. package/libs/api/biz/chat/openSquad.js +6 -0
  136. package/libs/api/biz/chat/openTeamChat.js +6 -0
  137. package/libs/api/biz/chat/pickConversation.js +6 -0
  138. package/libs/api/biz/chat/sendP2PMsg.js +6 -0
  139. package/libs/api/biz/contact/complexPicker.js +6 -0
  140. package/libs/api/biz/contact/departmentsPicker.js +6 -0
  141. package/libs/api/biz/group/groupComplexPicker.js +6 -0
  142. package/libs/api/biz/map/multipointView.js +6 -0
  143. package/libs/api/biz/map/view.js +6 -0
  144. package/libs/api/biz/navigation/close.js +6 -0
  145. package/libs/api/biz/navigation/goBack.js +6 -0
  146. package/libs/api/biz/navigation/quit.js +6 -0
  147. package/libs/api/biz/navigation/replace.js +6 -0
  148. package/libs/api/biz/navigation/setIcon.js +7 -0
  149. package/libs/api/biz/navigation/setLeft.js +7 -0
  150. package/libs/api/biz/navigation/setMenu.js +7 -0
  151. package/libs/api/biz/navigation/setRight.js +7 -0
  152. package/libs/api/biz/navigation/setTitle.js +6 -0
  153. package/libs/api/biz/navigation/setTitleExpandIcon.js +7 -0
  154. package/libs/api/biz/navigation/setWindowBig.js +6 -1
  155. package/libs/api/biz/navigation/tencentMeeting.js +6 -0
  156. package/libs/api/biz/navigation/tencentMeetingBegin.js +6 -0
  157. package/libs/api/biz/navigation/updateExpandTitle.js +6 -0
  158. package/libs/api/biz/telephone/call.js +6 -0
  159. package/libs/api/biz/telephone/showCallMenu.js +6 -0
  160. package/libs/api/biz/util/authFinish.js +6 -0
  161. package/libs/api/biz/util/authStart.js +6 -0
  162. package/libs/api/biz/util/chosen.js +6 -0
  163. package/libs/api/biz/util/clipboardFileUpload.js +6 -0
  164. package/libs/api/biz/util/closeWindow.js +6 -0
  165. package/libs/api/biz/util/complain.js +6 -0
  166. package/libs/api/biz/util/createModifySchedule.js +6 -0
  167. package/libs/api/biz/util/datepicker.js +6 -0
  168. package/libs/api/biz/util/datetimepicker.js +6 -0
  169. package/libs/api/biz/util/downloadFile.js +6 -0
  170. package/libs/api/biz/util/entergroupCheck.js +7 -1
  171. package/libs/api/biz/util/externalLinkPreviewFile.js +6 -0
  172. package/libs/api/biz/util/feedback.js +6 -0
  173. package/libs/api/biz/util/getSingleWebviewData.js +6 -0
  174. package/libs/api/biz/util/getTogetherConfig.js +6 -0
  175. package/libs/api/biz/util/getToken.js +6 -0
  176. package/libs/api/biz/util/injectScript.js +6 -0
  177. package/libs/api/biz/util/invoice.js +6 -1
  178. package/libs/api/biz/util/mediaFileUpload.js +6 -1
  179. package/libs/api/biz/util/onlineDocmentOpenTeamChat.js +6 -0
  180. package/libs/api/biz/util/open.js +6 -0
  181. package/libs/api/biz/util/openLink.js +6 -0
  182. package/libs/api/biz/util/openMediaFileDialog.js +6 -1
  183. package/libs/api/biz/util/openSingleWebview.js +6 -0
  184. package/libs/api/biz/util/openSlidePanel.js +6 -0
  185. package/libs/api/biz/util/openTalYoungToTopic.js +6 -1
  186. package/libs/api/biz/util/openTogetherEyeWebview.js +6 -0
  187. package/libs/api/biz/util/openUserSchedule.js +6 -0
  188. package/libs/api/biz/util/openVideoPlayer.js +6 -0
  189. package/libs/api/biz/util/previewFile.js +6 -0
  190. package/libs/api/biz/util/previewImage.js +6 -0
  191. package/libs/api/biz/util/proxy.js +6 -0
  192. package/libs/api/biz/util/pushWorkMsg.js +6 -1
  193. package/libs/api/biz/util/remind.js +6 -0
  194. package/libs/api/biz/util/rouseApp.js +6 -1
  195. package/libs/api/biz/util/savePic.js +6 -0
  196. package/libs/api/biz/util/scan.js +6 -0
  197. package/libs/api/biz/util/selectDepartment.js +6 -0
  198. package/libs/api/biz/util/share.js +6 -0
  199. package/libs/api/biz/util/takePicture.js +6 -0
  200. package/libs/api/biz/util/uploadAttachment.js +6 -0
  201. package/libs/api/biz/util/zfbAuth.js +6 -0
  202. package/libs/api/biz/webViewMessage/send.js +6 -0
  203. package/libs/api/device/audio/download.js +6 -0
  204. package/libs/api/device/audio/onPlayEnd.js +6 -0
  205. package/libs/api/device/audio/onRecordEnd.js +6 -0
  206. package/libs/api/device/audio/onRecordEnd_v2.js +6 -0
  207. package/libs/api/device/audio/pause.js +6 -0
  208. package/libs/api/device/audio/play.js +6 -0
  209. package/libs/api/device/audio/resume.js +6 -0
  210. package/libs/api/device/audio/startRecord.js +6 -0
  211. package/libs/api/device/audio/startRecord_v2.js +6 -0
  212. package/libs/api/device/audio/stop.js +6 -0
  213. package/libs/api/device/audio/stopRecord.js +6 -0
  214. package/libs/api/device/audio/stopRecord_v2.js +6 -0
  215. package/libs/api/device/base/checkStepPermission.js +6 -0
  216. package/libs/api/device/base/getPhoneInfo.js +6 -0
  217. package/libs/api/device/base/getUUID.js +7 -5
  218. package/libs/api/device/connection/getNetworkType.js +6 -0
  219. package/libs/api/device/connection/isAtTal.js +8 -2
  220. package/libs/api/device/geolocation/get.js +6 -0
  221. package/libs/api/device/geolocation/getSwitch.js +6 -0
  222. package/libs/api/device/notification/actionSheet.js +6 -0
  223. package/libs/api/device/notification/alert.js +6 -0
  224. package/libs/api/device/notification/confirm.js +6 -0
  225. package/libs/api/device/notification/hidePreloader.js +6 -0
  226. package/libs/api/device/notification/showPreloader.js +6 -0
  227. package/libs/api/device/notification/toast.js +6 -0
  228. package/libs/api/device/notification/vibrate.js +6 -0
  229. package/libs/api/device/system/getLang.js +6 -0
  230. package/libs/api/device/system/setLight.js +6 -0
  231. package/libs/api/initAPI.js +13 -4
  232. package/libs/api/primary/createTab.js +6 -0
  233. package/libs/api/primary/exitFullScreen.js +6 -0
  234. package/libs/api/primary/fullScreen.js +6 -0
  235. package/libs/api/primary/weeklyShare.js +6 -0
  236. package/libs/api/runtime/permission/requestAuthCode.js +6 -0
  237. package/libs/api/ui/pullToRefresh/disable.js +6 -0
  238. package/libs/api/ui/pullToRefresh/enable.js +6 -0
  239. package/libs/api/ui/pullToRefresh/stop.js +6 -0
  240. package/libs/api/ui/webViewBounce/disable.js +6 -0
  241. package/libs/api/util/domainStorage/getItem.js +6 -0
  242. package/libs/api/util/domainStorage/removeItem.js +6 -0
  243. package/libs/api/util/domainStorage/setItem.js +6 -0
  244. package/libs/api/util/tool/flushLog.js +6 -0
  245. package/libs/api/util/tool/log.js +6 -0
  246. package/libs/index.d.ts +1 -7
  247. package/libs/index.js +271 -37
  248. package/libs/lib/bridge/index.js +7 -0
  249. package/libs/lib/bridge/mobile.js +39 -7
  250. package/libs/lib/bridge/pc.js +25 -5
  251. package/libs/lib/helper/apiHelper.js +6 -0
  252. package/libs/lib/helper/codeMap.js +6 -0
  253. package/libs/lib/helper/event.js +22 -1
  254. package/libs/lib/helper/pcIframe.js +49 -11
  255. package/libs/lib/index.js +32 -8
  256. package/libs/lib/sdk/index.js +47 -19
  257. package/libs/lib/sdk/sdk.typings.js +4 -0
  258. package/libs/utils/bpitLog.js +16 -4
  259. package/libs/utils/compareVersions.js +72 -27
  260. package/libs/utils/console.js +16 -0
  261. package/libs/utils/env.js +20 -11
  262. package/libs/utils/index.js +13 -0
  263. package/package.json +1 -1
  264. package/dist/yach_jssdk_4.3.0-beta2.js +0 -1
  265. package/es/api/biz/util/assistantCreate.d.ts +0 -11
  266. package/es/api/biz/util/assistantCreate.js +0 -23
  267. package/es/api/biz/util/disableScreenCapture.d.ts +0 -8
  268. package/es/api/biz/util/disableScreenCapture.js +0 -19
  269. package/es/api/biz/util/yachEvent.d.ts +0 -12
  270. package/es/api/biz/util/yachEvent.js +0 -27
  271. package/libs/api/biz/util/assistantCreate.d.ts +0 -11
  272. package/libs/api/biz/util/assistantCreate.js +0 -30
  273. package/libs/api/biz/util/disableScreenCapture.d.ts +0 -8
  274. package/libs/api/biz/util/disableScreenCapture.js +0 -26
  275. package/libs/api/biz/util/yachEvent.d.ts +0 -12
  276. package/libs/api/biz/util/yachEvent.js +0 -34
@@ -1,32 +1,39 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+
4
5
  _Object$defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
8
+
7
9
  _Object$defineProperty(exports, "PcBridgeInit", {
8
10
  enumerable: true,
9
11
  get: function get() {
10
12
  return _pc.PcBridgeInit;
11
13
  }
12
14
  });
15
+
13
16
  _Object$defineProperty(exports, "mobileBridge", {
14
17
  enumerable: true,
15
18
  get: function get() {
16
19
  return _mobile.mobileBridge;
17
20
  }
18
21
  });
22
+
19
23
  _Object$defineProperty(exports, "mobileBridgeInit", {
20
24
  enumerable: true,
21
25
  get: function get() {
22
26
  return _mobile.mobileBridgeInit;
23
27
  }
24
28
  });
29
+
25
30
  _Object$defineProperty(exports, "pcBridge", {
26
31
  enumerable: true,
27
32
  get: function get() {
28
33
  return _pc.pcBridge;
29
34
  }
30
35
  });
36
+
31
37
  var _mobile = require("./mobile");
38
+
32
39
  var _pc = require("./pc");
@@ -1,28 +1,42 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+
4
5
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
5
7
  _Object$defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
10
+
8
11
  exports.mobileBridgeInit = exports.mobileBridge = void 0;
12
+
9
13
  var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/set-timeout"));
14
+
10
15
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
16
+
11
17
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/assign"));
18
+
12
19
  var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/parse-int"));
20
+
13
21
  var _event = _interopRequireDefault(require("../helper/event"));
22
+
14
23
  var _codeMap = require("../helper/codeMap");
24
+
15
25
  var _utils = require("../../utils");
26
+
16
27
  function setupWebViewJavascriptBridge(callback) {
17
28
  if (window.WebViewJavascriptBridge) {
18
29
  return callback(WebViewJavascriptBridge);
19
30
  }
31
+
20
32
  if (window.WKWebViewJavascriptBridge) {
21
33
  return callback(WKWebViewJavascriptBridge);
22
34
  }
35
+
23
36
  if (window.WVJBCallbacks) {
24
37
  return window.WVJBCallbacks.push(callback);
25
38
  }
39
+
26
40
  window.WVJBCallbacks = [callback];
27
41
  var WVJBIframe = document.createElement('iframe');
28
42
  WVJBIframe.style.display = 'none';
@@ -32,7 +46,8 @@ function setupWebViewJavascriptBridge(callback) {
32
46
  document.documentElement.removeChild(WVJBIframe);
33
47
  }, 0);
34
48
  }
35
- var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
49
+
50
+ var mobileBridgeInit = function mobileBridgeInit() {
36
51
  return new _promise["default"](function (resolve, reject) {
37
52
  setupWebViewJavascriptBridge(function (bridge) {
38
53
  (0, _utils.log)("\u6CE8\u518Cresume\u4E8B\u4EF6 ");
@@ -40,6 +55,7 @@ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
40
55
  (0, _utils.log)("resume\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
41
56
  resData: resData
42
57
  });
58
+
43
59
  _event["default"].execEvent('resume', resData);
44
60
  });
45
61
  (0, _utils.log)("\u6CE8\u518CunreadMsgAction\u4E8B\u4EF6 ");
@@ -47,6 +63,7 @@ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
47
63
  (0, _utils.log)("unreadMsgAction\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
48
64
  resData: resData
49
65
  });
66
+
50
67
  _event["default"].execEvent('unreadMsgAction', resData);
51
68
  });
52
69
  (0, _utils.log)("\u6CE8\u518CwebViewMsgReceive\u4E8B\u4EF6 ");
@@ -54,31 +71,38 @@ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
54
71
  (0, _utils.log)("webViewMsgReceive\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
55
72
  resData: resData
56
73
  });
74
+
57
75
  _event["default"].execEvent('webViewMsgReceive', resData);
58
76
  });
59
77
  bridge.registerHandler('pushWorkMsg', function (resData) {
60
78
  (0, _utils.log)("pushWorkMsg\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
61
79
  resData: resData
62
80
  });
81
+
63
82
  _event["default"].execEvent('pushWorkMsg', resData);
64
83
  });
65
84
  bridge.registerHandler('getTogetherCallback', function (resData) {
66
85
  (0, _utils.log)("getTogetherCallback\u76D1\u542C\u5230\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
67
86
  resData: resData
68
87
  });
88
+
69
89
  _event["default"].execEvent('getTogetherCallback', resData);
70
90
  });
71
91
  bridge.registerHandler('sendMsgCommon', function (resData) {
72
92
  (0, _utils.log)("sendMsgCommon ", {
73
93
  resData: resData
74
94
  });
95
+
75
96
  _event["default"].execEvent('sendMsgCommon', resData);
76
97
  });
77
98
  resolve();
78
99
  });
79
100
  });
80
101
  };
81
- var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
102
+
103
+ exports.mobileBridgeInit = mobileBridgeInit;
104
+
105
+ var mobileBridge = function mobileBridge(method, param) {
82
106
  return new _promise["default"](function (resolve, reject) {
83
107
  var p = (0, _assign["default"])({}, param);
84
108
  setupWebViewJavascriptBridge(function (bridge) {
@@ -86,6 +110,7 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
86
110
  bridge.registerHandler(method, function (data) {
87
111
  var onSuccess = param.onSuccess;
88
112
  delete p.onSuccess;
113
+
89
114
  if ('function' === typeof onSuccess) {
90
115
  onSuccess(data);
91
116
  resolve({
@@ -95,12 +120,16 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
95
120
  }
96
121
  });
97
122
  }
123
+
98
124
  bridge.callHandler(method, param, function (e) {
99
125
  var code = e.code,
100
- message = e.message,
101
- data = e.data;
126
+ message = e.message,
127
+ data = e.data;
128
+
102
129
  var _code = (0, _parseInt2["default"])(code);
130
+
103
131
  var callbackStr = (0, _codeMap.electronResCodeMap)(_code);
132
+
104
133
  if (_code === -2 || _code === 7) {
105
134
  (0, _utils.bpitLog)({
106
135
  method: method,
@@ -117,8 +146,7 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
117
146
  reject({
118
147
  _code: _code,
119
148
  message: message
120
- });
121
- // return;
149
+ }); // return;
122
150
  }
123
151
 
124
152
  var callbackFun = p[callbackStr];
@@ -130,9 +158,11 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
130
158
  message: message,
131
159
  callbackFun: callbackFun
132
160
  });
161
+
133
162
  if ('function' === typeof callbackFun) {
134
163
  callbackFun(data || message);
135
164
  }
165
+
136
166
  resolve({
137
167
  _code: _code,
138
168
  message: message,
@@ -141,4 +171,6 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
141
171
  });
142
172
  });
143
173
  });
144
- };
174
+ };
175
+
176
+ exports.mobileBridge = mobileBridge;
@@ -1,27 +1,42 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+
4
5
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
5
7
  _Object$defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
10
+
8
11
  exports.pcBridge = exports.PcBridgeInit = void 0;
12
+
9
13
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
14
+
10
15
  var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/parse-int"));
16
+
11
17
  var _pcIframe = _interopRequireDefault(require("../helper/pcIframe"));
18
+
12
19
  var _codeMap = require("../helper/codeMap");
20
+
13
21
  var _utils = require("../../utils");
14
- var PcBridgeInit = exports.PcBridgeInit = function PcBridgeInit() {
22
+
23
+ var PcBridgeInit = function PcBridgeInit() {
15
24
  _pcIframe["default"].init();
16
25
  };
17
- var pcBridge = exports.pcBridge = function pcBridge(method, param) {
26
+
27
+ exports.PcBridgeInit = PcBridgeInit;
28
+
29
+ var pcBridge = function pcBridge(method, param) {
18
30
  return new _promise["default"](function (resolve) {
19
31
  return _pcIframe["default"].invokeAPI(method, param, function (_ref) {
20
32
  var data = _ref.data,
21
- code = _ref.code,
22
- message = _ref.message;
33
+ code = _ref.code,
34
+ message = _ref.message;
35
+
23
36
  var _code = (0, _parseInt2["default"])(code);
37
+
24
38
  var callbackStr = (0, _codeMap.electronResCodeMap)(_code);
39
+
25
40
  if (_code === -2) {
26
41
  (0, _utils.bpitLog)({
27
42
  method: method,
@@ -29,6 +44,7 @@ var pcBridge = exports.pcBridge = function pcBridge(method, param) {
29
44
  message: message || 'SDK执行失败回调,相关参数'
30
45
  });
31
46
  }
47
+
32
48
  var callbackFun = param[callbackStr];
33
49
  (0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
34
50
  method: method,
@@ -38,9 +54,11 @@ var pcBridge = exports.pcBridge = function pcBridge(method, param) {
38
54
  message: message,
39
55
  callbackFun: callbackFun
40
56
  });
57
+
41
58
  if ('function' === typeof callbackFun) {
42
59
  callbackFun(data || message);
43
60
  }
61
+
44
62
  resolve({
45
63
  _code: _code,
46
64
  message: message,
@@ -48,4 +66,6 @@ var pcBridge = exports.pcBridge = function pcBridge(method, param) {
48
66
  });
49
67
  });
50
68
  });
51
- };
69
+ };
70
+
71
+ exports.pcBridge = pcBridge;
@@ -1,15 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+
4
5
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
5
7
  _Object$defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
10
+
8
11
  exports.genDefaultParamsDealFn = genDefaultParamsDealFn;
12
+
9
13
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/assign"));
14
+
10
15
  function genDefaultParamsDealFn(p) {
11
16
  return function (r) {
12
17
  return (0, _assign["default"])((0, _assign["default"])({}, p), r);
13
18
  };
14
19
  }
20
+
15
21
  ;
@@ -1,13 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+
4
5
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
5
7
  _Object$defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
10
+
8
11
  exports.electronResCodeMap = electronResCodeMap;
12
+
9
13
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/map"));
14
+
10
15
  var resCodeMap = new _map["default"]([[0, 'onSuccess'], [-1, 'onCancel'], [-2, 'onFail'], [-3, 'onProgress'], [-4, 'onSubmit']]);
16
+
11
17
  function electronResCodeMap(code) {
12
18
  return resCodeMap.get(code) || 'onFail';
13
19
  }
@@ -1,39 +1,58 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+
4
5
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
5
7
  _Object$defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
10
+
8
11
  exports["default"] = void 0;
12
+
9
13
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/array/is-array"));
14
+
10
15
  var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/index-of"));
16
+
11
17
  var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/splice"));
18
+
12
19
  var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/for-each"));
20
+
13
21
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
22
+
14
23
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
24
+
15
25
  var Event = /*#__PURE__*/(0, _createClass2["default"])(function Event() {
16
26
  var _this = this;
27
+
17
28
  (0, _classCallCheck2["default"])(this, Event);
29
+
18
30
  this.on = function (event, fn) {
19
31
  if (!event || 'function' !== typeof fn) throw 'eventName is null or handle is not a function, on fail';
20
32
  if (!(0, _isArray["default"])(_this.eventsHandle[event])) _this.eventsHandle[event] = [];
33
+
21
34
  _this.eventsHandle[event].push(fn);
22
35
  };
36
+
23
37
  this.off = function (event, fn) {
24
38
  if (!event) throw 'eventName is null, invoke off fail';
39
+
25
40
  if (!fn) {
26
41
  _this.eventsHandle[event] = [];
27
42
  return;
28
43
  }
44
+
29
45
  if ((0, _isArray["default"])(_this.eventsHandle[event])) {
30
46
  var _context, _context2;
47
+
31
48
  var n = (0, _indexOf["default"])(_context = _this.eventsHandle[event]).call(_context, fn);
32
49
  -1 !== n && (0, _splice["default"])(_context2 = _this.eventsHandle[event]).call(_context2, n, 1);
33
50
  }
34
51
  };
52
+
35
53
  this.execEvent = function (event, data) {
36
54
  var _context3;
55
+
37
56
  (0, _isArray["default"])(this.eventsHandle[event]) && (0, _forEach["default"])(_context3 = this.eventsHandle[event]).call(_context3, function (fn) {
38
57
  try {
39
58
  fn(data);
@@ -42,7 +61,9 @@ var Event = /*#__PURE__*/(0, _createClass2["default"])(function Event() {
42
61
  }
43
62
  });
44
63
  };
64
+
45
65
  this.eventsHandle = {};
46
66
  });
47
67
  var event = new Event();
48
- var _default = exports["default"] = event;
68
+ var _default = event;
69
+ exports["default"] = _default;
@@ -1,30 +1,44 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+
4
5
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
5
7
  _Object$defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
10
+
8
11
  exports["default"] = void 0;
12
+
9
13
  var _now = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/date/now"));
14
+
10
15
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/json/stringify"));
16
+
11
17
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
18
+
12
19
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
20
+
13
21
  var _utils = require("../../utils");
22
+
14
23
  var _event = _interopRequireDefault(require("./event"));
24
+
15
25
  // 处理posmessage参数
16
26
  var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(method, param, callback) {
17
27
  var _this = this;
28
+
18
29
  (0, _classCallCheck2["default"])(this, GenPostMsg);
30
+
19
31
  this.genid = function () {
20
32
  var idStr = (0, _now["default"])().toString(36);
21
33
  idStr += Math.random().toString(36).substr(3);
22
34
  return idStr;
23
35
  };
36
+
24
37
  this.receiveResponse = function (data) {
25
38
  //this.PromiseObj.resolve(data);
26
39
  _this.callback(data);
27
40
  };
41
+
28
42
  this.getPayload = function () {
29
43
  return {
30
44
  msgId: _this.id,
@@ -34,6 +48,7 @@ var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(
34
48
  invokeType: _this.invokeType
35
49
  };
36
50
  };
51
+
37
52
  this.id = this.genid();
38
53
  this.PromiseObj = {
39
54
  resolve: null,
@@ -42,8 +57,7 @@ var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(
42
57
  this.methodName = method;
43
58
  this.plainMsg = param;
44
59
  this.invokeType = param === null || param === void 0 ? void 0 : param.invokeType;
45
- this.callback = callback;
46
- // this.result = new Promise(
60
+ this.callback = callback; // this.result = new Promise(
47
61
  // function (resolve, reject) {
48
62
  // this.PromiseObj = {
49
63
  // resolve,
@@ -54,57 +68,74 @@ var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(
54
68
  });
55
69
  var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
56
70
  var _this2 = this;
71
+
57
72
  (0, _classCallCheck2["default"])(this, Frame);
73
+
58
74
  this.addPending = function (e) {
59
75
  _this2.pendingMsgs[e.id] = e;
60
76
  };
77
+
61
78
  this.deletePending = function (e) {
62
79
  delete _this2.pendingMsgs[e.id];
63
80
  };
81
+
64
82
  this.getPending = function (t) {
65
83
  return this.pendingMsgs[t];
66
84
  };
85
+
67
86
  this.invokeAPIInBrowserView = function (payload) {
68
87
  window.sendTo(payload);
69
88
  };
89
+
70
90
  this.invokeAPIInWebview = function (payload) {
71
91
  window.sendToHost(payload);
72
92
  };
93
+
73
94
  this.invokeAPI = function (method, param, callback) {
74
95
  var genPostMsg = new GenPostMsg(method, param, callback);
75
96
  var payload = (0, _stringify["default"])(genPostMsg.getPayload());
76
97
  var _param$invokeType = param.invokeType,
77
- invokeType = _param$invokeType === void 0 ? '' : _param$invokeType;
98
+ invokeType = _param$invokeType === void 0 ? '' : _param$invokeType;
78
99
  invokeType === 'browserView' ? _this2.invokeAPIInBrowserView(payload) : _this2.invokeAPIInWebview(payload);
100
+
79
101
  _this2.addPending(genPostMsg);
102
+
80
103
  return genPostMsg;
81
104
  };
105
+
82
106
  this.handleCallback = function (datas, invokeType) {
83
107
  var type = datas.type,
84
- methodName = datas.methodName,
85
- eventName = datas.eventName,
86
- msgId = datas.msgId,
87
- data = datas.data,
88
- code = datas.code,
89
- message = datas.message;
108
+ methodName = datas.methodName,
109
+ eventName = datas.eventName,
110
+ msgId = datas.msgId,
111
+ data = datas.data,
112
+ code = datas.code,
113
+ message = datas.message;
114
+
90
115
  if (type === 'request') {
91
116
  // 壳子的调用
92
117
  switch (methodName) {
93
118
  case 'refresh':
94
119
  window.location.reload();
95
120
  break;
121
+
96
122
  case 'back':
97
123
  window.history.back();
98
124
  break;
125
+
99
126
  case 'forward':
100
127
  window.history.forward();
101
128
  break;
129
+
102
130
  case 'event':
103
131
  _event["default"].execEvent(eventName, data);
132
+
104
133
  break;
134
+
105
135
  case 'zoomInClick':
106
136
  var scrollTopVal = document.documentElement.scrollTop || document.body.scrollTop,
107
- url = window.location.href;
137
+ url = window.location.href;
138
+
108
139
  if (invokeType === 'browserView') {
109
140
  window.sendTo((0, _stringify["default"])({
110
141
  type: type,
@@ -126,13 +157,16 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
126
157
  }
127
158
  }));
128
159
  }
160
+
129
161
  break;
162
+
130
163
  default:
131
164
  break;
132
165
  }
133
166
  } else if (type === 'response') {
134
167
  // 响应壳子的回调
135
168
  var pending = _this2.getPending(msgId);
169
+
136
170
  pending && pending.receiveResponse({
137
171
  data: data,
138
172
  code: code,
@@ -141,16 +175,20 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
141
175
  code != -3 && _this2.deletePending(msgId);
142
176
  }
143
177
  };
178
+
144
179
  this.init = function () {
145
180
  window.addEventListener('message', function (msg) {
146
181
  (0, _utils.log)('electron res: ', msg);
182
+
147
183
  _this2.handleCallback(msg.data || {});
148
184
  });
149
185
  window.receiveBrowserViewData && window.receiveBrowserViewData(function (e, response) {
150
186
  return _this2.handleCallback(response);
151
187
  });
152
188
  };
189
+
153
190
  this.pendingMsgs = {};
154
191
  });
155
192
  var frame = new Frame();
156
- var _default = exports["default"] = frame;
193
+ var _default = frame;
194
+ exports["default"] = _default;
package/libs/lib/index.js CHANGED
@@ -1,24 +1,35 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
4
+
4
5
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
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 = exports.yachSdk = new _sdk["default"](env);
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) switch (_context.prev = _context.next) {
54
- case 0:
55
- (0, _bridge.PcBridgeInit)();
56
- return _context.abrupt("return", _bridge.pcBridge);
57
- case 2:
58
- case "end":
59
- return _context.stop();
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();