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,21 +1,33 @@
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 _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
14
+
10
15
  var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/concat"));
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
- jsApiList = _config$jsApiList === void 0 ? [] : _config$jsApiList;
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
- // 确定端的同事初始化bridge
101
+ } // 确定端的同事初始化bridge
102
+
87
103
  }, {
88
104
  key: "setPlatform",
89
105
  value: function setPlatform(value) {
90
106
  var platform = value.platform,
91
- bridgeInit = value.bridgeInit;
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,54 @@ 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
- var p = apiConfig.paramsDeal ? apiConfig.paramsDeal(params) : params;
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 () {
154
- // 调用成功
155
- })["catch"](function (error) {
156
- // 调用失败
180
+ fn(method, p).then(function () {// 调用成功
181
+ })["catch"](function (error) {// 调用失败
157
182
  });
158
183
  })["catch"](function (err) {
159
184
  console.log('wenai err', err);
160
185
  });
161
186
  return;
162
187
  }
188
+
163
189
  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
190
  }
165
191
  }]);
166
192
  return Sdk;
167
193
  }();
168
- var _default = exports["default"] = Sdk;
194
+
195
+ var _default = Sdk;
196
+ exports["default"] = _default;
@@ -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";
@@ -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
- // upload data
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('&timestamp=' + options.timestamp);
59
70
  if (options.errorcode) uploadData.push('&errorcode=' + options.errorcode);
60
- if (options.message) uploadData.push('&message=' + options.message);
61
- // api load time
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);
@@ -1,17 +1,27 @@
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.validate = exports.satisfies = exports.compareVersions = exports.compare = void 0;
12
+
9
13
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
14
+
10
15
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
16
+
11
17
  var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/includes"));
18
+
12
19
  var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/parse-int"));
20
+
13
21
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/keys"));
22
+
14
23
  var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/index-of"));
24
+
15
25
  /**
16
26
  * Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
17
27
  * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
@@ -19,22 +29,23 @@ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/in
19
29
  * @param v2 - Second version to compare
20
30
  * @returns Numeric value compatible with the [Array.sort(fn) interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).
21
31
  */
22
- var compareVersions = exports.compareVersions = function compareVersions(v1, v2) {
32
+ var compareVersions = function compareVersions(v1, v2) {
23
33
  // validate input and split into segments
24
34
  var n1 = validateAndParse(v1);
25
- var n2 = validateAndParse(v2);
26
- // pop off the patch
35
+ var n2 = validateAndParse(v2); // pop off the patch
36
+
27
37
  var p1 = n1.pop();
28
- var p2 = n2.pop();
29
- // validate numbers
38
+ var p2 = n2.pop(); // validate numbers
39
+
30
40
  var r = compareSegments(n1, n2);
31
- if (r !== 0) return r;
32
- // validate pre-release
41
+ if (r !== 0) return r; // validate pre-release
42
+
33
43
  if (p1 && p2) {
34
44
  return compareSegments(p1.split('.'), p2.split('.'));
35
45
  } else if (p1 || p2) {
36
46
  return p1 ? -1 : 1;
37
47
  }
48
+
38
49
  return 0;
39
50
  };
40
51
  /**
@@ -50,7 +61,11 @@ var compareVersions = exports.compareVersions = function compareVersions(v1, v2)
50
61
  * validate('foo'); // return false
51
62
  * ```
52
63
  */
53
- var validate = exports.validate = function validate(version) {
64
+
65
+
66
+ exports.compareVersions = compareVersions;
67
+
68
+ var validate = function validate(version) {
54
69
  return typeof version === 'string' && /^[v\d]/.test(version) && semver.test(version);
55
70
  };
56
71
  /**
@@ -70,12 +85,17 @@ var validate = exports.validate = function validate(version) {
70
85
  * compare('10.1.1', '10.2.2', '>='); // return false
71
86
  * ```
72
87
  */
73
- var compare = exports.compare = function compare(v1, v2, operator) {
88
+
89
+
90
+ exports.validate = validate;
91
+
92
+ var compare = function compare(v1, v2, operator) {
74
93
  var _context;
94
+
75
95
  // validate input operator
76
- assertValidOperator(operator);
77
- // since result of compareVersions can only be -1 or 0 or 1
96
+ assertValidOperator(operator); // since result of compareVersions can only be -1 or 0 or 1
78
97
  // a simple map can be used to replace switch
98
+
79
99
  var res = compareVersions(v1, v2);
80
100
  return (0, _includes["default"])(_context = operatorResMap[operator]).call(_context, res);
81
101
  };
@@ -92,69 +112,92 @@ var compare = exports.compare = function compare(v1, v2, operator) {
92
112
  * satisfies('1.1.0', '~1.0.0'); // return false
93
113
  * ```
94
114
  */
95
- var satisfies = exports.satisfies = function satisfies(version, range) {
115
+
116
+
117
+ exports.compare = compare;
118
+
119
+ var satisfies = function satisfies(version, range) {
96
120
  // if no range operator then "="
97
121
  var m = range.match(/^([<>=~^]+)/);
98
- var op = m ? m[1] : '=';
99
- // if gt/lt/eq then operator compare
100
- if (op !== '^' && op !== '~') return compare(version, range, op);
101
- // else range of either "~" or "^" is assumed
122
+ var op = m ? m[1] : '='; // if gt/lt/eq then operator compare
123
+
124
+ if (op !== '^' && op !== '~') return compare(version, range, op); // else range of either "~" or "^" is assumed
125
+
102
126
  var _validateAndParse = validateAndParse(version),
103
- _validateAndParse2 = (0, _slicedToArray2["default"])(_validateAndParse, 3),
104
- v1 = _validateAndParse2[0],
105
- v2 = _validateAndParse2[1],
106
- v3 = _validateAndParse2[2];
127
+ _validateAndParse2 = (0, _slicedToArray2["default"])(_validateAndParse, 3),
128
+ v1 = _validateAndParse2[0],
129
+ v2 = _validateAndParse2[1],
130
+ v3 = _validateAndParse2[2];
131
+
107
132
  var _validateAndParse3 = validateAndParse(range),
108
- _validateAndParse4 = (0, _slicedToArray2["default"])(_validateAndParse3, 3),
109
- r1 = _validateAndParse4[0],
110
- r2 = _validateAndParse4[1],
111
- r3 = _validateAndParse4[2];
133
+ _validateAndParse4 = (0, _slicedToArray2["default"])(_validateAndParse3, 3),
134
+ r1 = _validateAndParse4[0],
135
+ r2 = _validateAndParse4[1],
136
+ r3 = _validateAndParse4[2];
137
+
112
138
  if (compareStrings(v1, r1) !== 0) return false;
139
+
113
140
  if (op === '^') {
114
141
  return compareSegments([v2, v3], [r2, r3]) >= 0;
115
142
  }
143
+
116
144
  if (compareStrings(v2, r2) !== 0) return false;
117
145
  return compareStrings(v3, r3) >= 0;
118
146
  };
147
+
148
+ exports.satisfies = satisfies;
119
149
  var semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
150
+
120
151
  var validateAndParse = function validateAndParse(version) {
121
152
  if (typeof version !== 'string') {
122
153
  throw new TypeError('Invalid argument expected string');
123
154
  }
155
+
124
156
  var match = version.match(semver);
157
+
125
158
  if (!match) {
126
159
  throw new Error("Invalid argument not valid semver ('".concat(version, "' received)"));
127
160
  }
161
+
128
162
  match.shift();
129
163
  return match;
130
164
  };
165
+
131
166
  var isWildcard = function isWildcard(s) {
132
167
  return s === '*' || s === 'x' || s === 'X';
133
168
  };
169
+
134
170
  var tryParse = function tryParse(v) {
135
171
  var n = (0, _parseInt2["default"])(v, 10);
136
172
  return isNaN(n) ? v : n;
137
173
  };
174
+
138
175
  var forceType = function forceType(a, b) {
139
176
  return (0, _typeof2["default"])(a) !== (0, _typeof2["default"])(b) ? [String(a), String(b)] : [a, b];
140
177
  };
178
+
141
179
  var compareStrings = function compareStrings(a, b) {
142
180
  if (isWildcard(a) || isWildcard(b)) return 0;
181
+
143
182
  var _forceType = forceType(tryParse(a), tryParse(b)),
144
- _forceType2 = (0, _slicedToArray2["default"])(_forceType, 2),
145
- ap = _forceType2[0],
146
- bp = _forceType2[1];
183
+ _forceType2 = (0, _slicedToArray2["default"])(_forceType, 2),
184
+ ap = _forceType2[0],
185
+ bp = _forceType2[1];
186
+
147
187
  if (ap > bp) return 1;
148
188
  if (ap < bp) return -1;
149
189
  return 0;
150
190
  };
191
+
151
192
  var compareSegments = function compareSegments(a, b) {
152
193
  for (var i = 0; i < Math.max(a.length, b.length); i++) {
153
194
  var r = compareStrings(a[i] || '0', b[i] || '0');
154
195
  if (r !== 0) return r;
155
196
  }
197
+
156
198
  return 0;
157
199
  };
200
+
158
201
  var operatorResMap = {
159
202
  '>': [1],
160
203
  '>=': [0, 1],
@@ -163,10 +206,12 @@ var operatorResMap = {
163
206
  '<': [-1]
164
207
  };
165
208
  var allowedOperators = (0, _keys["default"])(operatorResMap);
209
+
166
210
  var assertValidOperator = function assertValidOperator(op) {
167
211
  if (typeof op !== 'string') {
168
212
  throw new TypeError("Invalid operator type, expected string but got ".concat((0, _typeof2["default"])(op)));
169
213
  }
214
+
170
215
  if ((0, _indexOf["default"])(allowedOperators).call(allowedOperators, op) === -1) {
171
216
  throw new Error("Invalid operator, expected one of ".concat(allowedOperators.join('|')));
172
217
  }
@@ -1,53 +1,69 @@
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.error = error;
9
12
  exports.log = log;
10
13
  exports.warn = warn;
14
+
11
15
  var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/bind"));
16
+
12
17
  var _context, _context2, _context3;
18
+
13
19
  // 防止被应用复写console
14
20
  var myconsole = {
15
21
  log: function log() {},
16
22
  warn: function warn() {},
17
23
  error: function error() {}
18
24
  };
25
+
19
26
  if (window && window.console) {
20
27
  myconsole = window.console;
21
28
  }
29
+
22
30
  if (document && document.body) {
23
31
  var iframe = document.createElement('iframe');
32
+
24
33
  if (iframe && iframe.contentWindow && iframe.contentWindow.console) {
25
34
  iframe.style.display = 'none';
26
35
  document.body.appendChild(iframe);
27
36
  myconsole = iframe.contentWindow.console;
28
37
  }
29
38
  }
39
+
30
40
  var myLog = (0, _bind["default"])(_context = myconsole.log).call(_context, myconsole);
31
41
  var myWarn = (0, _bind["default"])(_context2 = myconsole.warn).call(_context2, myconsole);
32
42
  var myError = (0, _bind["default"])(_context3 = myconsole.error).call(_context3, myconsole);
33
43
  var style = 'color:#fff;font-weight:bold;border-radius:5px;background:#67c23a;';
34
44
  var styleError = "".concat(style, "background-color:red;");
35
45
  var styleWarn = "".concat(style, "background-color:orange;");
46
+
36
47
  function log() {
37
48
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
38
49
  args[_key] = arguments[_key];
39
50
  }
51
+
40
52
  return myLog("%c Yach-jssdk log: ", style, args);
41
53
  }
54
+
42
55
  function error() {
43
56
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
44
57
  args[_key2] = arguments[_key2];
45
58
  }
59
+
46
60
  return myWarn("%c Yach-jssdk log: ", styleError, args);
47
61
  }
62
+
48
63
  function warn() {
49
64
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
50
65
  args[_key3] = arguments[_key3];
51
66
  }
67
+
52
68
  return myError("%c Yach-jssdk log: ", styleWarn, args);
53
69
  }
package/libs/utils/env.js CHANGED
@@ -1,37 +1,46 @@
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.getENV = getENV;
10
+
8
11
  var _sdk = require("../lib/sdk/sdk.typings");
12
+
9
13
  function getUA() {
10
14
  return typeof navigator !== 'undefined' ? navigator.userAgent : '';
11
15
  }
16
+
12
17
  function getENV() {
13
18
  var ua = getUA(),
14
- inYach = /Yach/i.test(ua),
15
- inIOS = /iPhone|iPad|iPod|iOS/i.test(ua) && inYach,
16
- inAndroid = /Android/i.test(ua) && inYach,
17
- inPC = /YachPc/i.test(ua),
18
- inIpad = /iPad/i.test(ua) && inYach,
19
- inIPhone = /iPhone/i.test(ua) && inYach;
20
- // platform
19
+ inYach = /Yach/i.test(ua),
20
+ inIOS = /iPhone|iPad|iPod|iOS/i.test(ua) && inYach,
21
+ inAndroid = /Android/i.test(ua) && inYach,
22
+ inPC = /YachPc/i.test(ua),
23
+ inIpad = /iPad/i.test(ua) && inYach,
24
+ inIPhone = /iPhone/i.test(ua) && inYach; // platform
25
+
21
26
  var platform = _sdk.ENV_ENUM.notInYach;
27
+
22
28
  if (inIOS) {
23
29
  platform = _sdk.ENV_ENUM.ios;
24
30
  }
31
+
25
32
  if (inAndroid) {
26
33
  platform = _sdk.ENV_ENUM.android;
27
34
  }
35
+
28
36
  if (inPC) {
29
37
  platform = _sdk.ENV_ENUM.pc;
30
- }
31
- // version
38
+ } // version
39
+
40
+
32
41
  var versionArr = ua.match(/Yach\/[a-zA-Z0-9.-]+/) || [];
33
- var version = (versionArr[0] || '').split('/')[1] || '';
34
- // language
42
+ var version = (versionArr[0] || '').split('/')[1] || ''; // language
43
+
35
44
  var language = typeof navigator !== 'undefined' ? navigator.language : '*';
36
45
  return {
37
46
  platform: platform,
@@ -1,40 +1,53 @@
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.bpitLog = staticsLog;
12
+
9
13
  _Object$defineProperty(exports, "error", {
10
14
  enumerable: true,
11
15
  get: function get() {
12
16
  return _console.error;
13
17
  }
14
18
  });
19
+
15
20
  _Object$defineProperty(exports, "getENV", {
16
21
  enumerable: true,
17
22
  get: function get() {
18
23
  return _env.getENV;
19
24
  }
20
25
  });
26
+
21
27
  _Object$defineProperty(exports, "log", {
22
28
  enumerable: true,
23
29
  get: function get() {
24
30
  return _console.log;
25
31
  }
26
32
  });
33
+
27
34
  _Object$defineProperty(exports, "warn", {
28
35
  enumerable: true,
29
36
  get: function get() {
30
37
  return _console.warn;
31
38
  }
32
39
  });
40
+
33
41
  var _now = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/date/now"));
42
+
34
43
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/assign"));
44
+
35
45
  var _env = require("./env");
46
+
36
47
  var _bpitLog = _interopRequireDefault(require("./bpitLog"));
48
+
37
49
  var _console = require("./console");
50
+
38
51
  function staticsLog(config) {
39
52
  var env = 'test';
40
53
  var version = (0, _env.getENV)().version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yach.open.jssdk",
3
- "version": "4.3.0-beta2",
3
+ "version": "4.3.1-beta",
4
4
  "description": "",
5
5
  "module": "./es/index.js",
6
6
  "main": "./libs/index.js",