yach.open.jssdk 4.3.6-beta2 → 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.
Files changed (282) hide show
  1. package/dist/yach_jssdk_4.3.6-beta3.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/setPanGestureEnable.js +2 -0
  22. package/es/api/biz/navigation/setRight.js +2 -0
  23. package/es/api/biz/navigation/setTitle.js +2 -0
  24. package/es/api/biz/navigation/setTitleExpandIcon.js +2 -0
  25. package/es/api/biz/navigation/setWindowBig.js +2 -0
  26. package/es/api/biz/navigation/tencentMeeting.js +2 -0
  27. package/es/api/biz/navigation/tencentMeetingBegin.js +2 -0
  28. package/es/api/biz/navigation/updateExpandTitle.js +2 -0
  29. package/es/api/biz/telephone/call.js +2 -0
  30. package/es/api/biz/telephone/showCallMenu.js +2 -0
  31. package/es/api/biz/util/addAppToNav.d.ts +8 -0
  32. package/es/api/biz/util/addAppToNav.js +25 -0
  33. package/es/api/biz/util/assistantCreate.js +2 -0
  34. package/es/api/biz/util/authFinish.js +2 -0
  35. package/es/api/biz/util/authStart.js +2 -0
  36. package/es/api/biz/util/chosen.js +2 -0
  37. package/es/api/biz/util/clipboardFileUpload.js +2 -0
  38. package/es/api/biz/util/closeWindow.js +2 -0
  39. package/es/api/biz/util/complain.js +2 -0
  40. package/es/api/biz/util/createModifySchedule.js +2 -0
  41. package/es/api/biz/util/datepicker.js +2 -0
  42. package/es/api/biz/util/datetimepicker.js +2 -0
  43. package/es/api/biz/util/disableScreenCapture.js +2 -0
  44. package/es/api/biz/util/downloadFile.js +2 -0
  45. package/es/api/biz/util/entergroupCheck.js +2 -0
  46. package/es/api/biz/util/externalLinkPreviewFile.js +2 -0
  47. package/es/api/biz/util/feedback.js +2 -0
  48. package/es/api/biz/util/getSingleWebviewData.js +2 -0
  49. package/es/api/biz/util/getTogetherConfig.js +2 -0
  50. package/es/api/biz/util/getToken.js +2 -0
  51. package/es/api/biz/util/injectScript.js +2 -0
  52. package/es/api/biz/util/invoice.js +2 -0
  53. package/es/api/biz/util/mediaFileUpload.js +2 -0
  54. package/es/api/biz/util/onlineDocmentOpenTeamChat.js +2 -0
  55. package/es/api/biz/util/open.js +2 -0
  56. package/es/api/biz/util/openFutureGroup.js +2 -0
  57. package/es/api/biz/util/openLink.js +2 -0
  58. package/es/api/biz/util/openMediaFileDialog.js +2 -0
  59. package/es/api/biz/util/openSingleWebview.js +2 -0
  60. package/es/api/biz/util/openSlidePanel.js +2 -0
  61. package/es/api/biz/util/openTalYoungToTopic.js +2 -0
  62. package/es/api/biz/util/openTogetherEyeWebview.js +2 -0
  63. package/es/api/biz/util/openUserSchedule.js +2 -0
  64. package/es/api/biz/util/openVideoPlayer.js +2 -0
  65. package/es/api/biz/util/previewFile.js +2 -0
  66. package/es/api/biz/util/previewImage.js +2 -0
  67. package/es/api/biz/util/proxy.js +2 -0
  68. package/es/api/biz/util/pushWorkMsg.js +2 -0
  69. package/es/api/biz/util/remind.js +2 -0
  70. package/es/api/biz/util/resetSessionUnread.js +2 -0
  71. package/es/api/biz/util/rouseApp.js +2 -0
  72. package/es/api/biz/util/savePic.js +2 -0
  73. package/es/api/biz/util/scan.js +2 -0
  74. package/es/api/biz/util/selectDepartment.js +2 -0
  75. package/es/api/biz/util/share.js +2 -0
  76. package/es/api/biz/util/takePicture.js +2 -0
  77. package/es/api/biz/util/uploadAttachment.js +2 -0
  78. package/es/api/biz/util/yachEvent.js +2 -0
  79. package/es/api/biz/util/zfbAuth.js +2 -0
  80. package/es/api/biz/webViewMessage/send.js +2 -0
  81. package/es/api/device/audio/download.js +2 -0
  82. package/es/api/device/audio/onPlayEnd.js +2 -0
  83. package/es/api/device/audio/onRecordEnd.js +2 -0
  84. package/es/api/device/audio/onRecordEnd_v2.js +2 -0
  85. package/es/api/device/audio/pause.js +2 -0
  86. package/es/api/device/audio/play.js +2 -0
  87. package/es/api/device/audio/resume.js +2 -0
  88. package/es/api/device/audio/startRecord.js +2 -0
  89. package/es/api/device/audio/startRecord_v2.js +2 -0
  90. package/es/api/device/audio/stop.js +2 -0
  91. package/es/api/device/audio/stopRecord.js +2 -0
  92. package/es/api/device/audio/stopRecord_v2.js +2 -0
  93. package/es/api/device/base/checkStepPermission.js +2 -0
  94. package/es/api/device/base/getPhoneInfo.js +2 -0
  95. package/es/api/device/base/getUUID.js +2 -0
  96. package/es/api/device/connection/getNetworkType.js +2 -0
  97. package/es/api/device/connection/isAtTal.js +4 -2
  98. package/es/api/device/geolocation/get.js +2 -0
  99. package/es/api/device/geolocation/getSwitch.js +2 -0
  100. package/es/api/device/notification/actionSheet.js +2 -0
  101. package/es/api/device/notification/alert.js +2 -0
  102. package/es/api/device/notification/confirm.js +2 -0
  103. package/es/api/device/notification/hidePreloader.js +2 -0
  104. package/es/api/device/notification/showPreloader.js +2 -0
  105. package/es/api/device/notification/toast.js +2 -0
  106. package/es/api/device/notification/vibrate.js +2 -0
  107. package/es/api/device/system/getLang.js +2 -0
  108. package/es/api/device/system/setLight.js +2 -0
  109. package/es/api/initAPI.js +5 -3
  110. package/es/api/primary/createTab.js +2 -0
  111. package/es/api/primary/exitFullScreen.js +2 -0
  112. package/es/api/primary/fullScreen.js +2 -0
  113. package/es/api/primary/weeklyShare.js +2 -0
  114. package/es/api/runtime/permission/requestAuthCode.js +2 -0
  115. package/es/api/ui/pullToRefresh/disable.js +2 -0
  116. package/es/api/ui/pullToRefresh/enable.js +2 -0
  117. package/es/api/ui/pullToRefresh/stop.js +2 -0
  118. package/es/api/ui/webViewBounce/disable.js +2 -0
  119. package/es/api/util/domainStorage/getItem.js +2 -0
  120. package/es/api/util/domainStorage/removeItem.js +2 -0
  121. package/es/api/util/domainStorage/setItem.js +2 -0
  122. package/es/api/util/tool/flushLog.js +2 -0
  123. package/es/api/util/tool/log.js +2 -0
  124. package/es/index.d.ts +3 -1
  125. package/es/index.js +29 -16
  126. package/es/lib/bridge/mobile.js +74 -26
  127. package/es/lib/bridge/pc.js +57 -13
  128. package/es/lib/helper/apiHelper.js +2 -0
  129. package/es/lib/helper/codeMap.js +2 -0
  130. package/es/lib/helper/event.js +19 -7
  131. package/es/lib/helper/pcIframe.js +52 -20
  132. package/es/lib/index.js +21 -7
  133. package/es/lib/sdk/index.js +49 -18
  134. package/es/lib/sdk/sdk.typings.d.ts +1 -0
  135. package/es/lib/sdk/sdk.typings.js +1 -0
  136. package/es/utils/bpitLog.js +13 -4
  137. package/es/utils/compareVersions.js +53 -26
  138. package/es/utils/console.js +17 -1
  139. package/es/utils/env.js +21 -12
  140. package/es/utils/index.js +7 -2
  141. package/libs/api/app/custom/talYoungFilesUpload.js +7 -2
  142. package/libs/api/biz/chat/chooseConversationByCorpId.js +7 -1
  143. package/libs/api/biz/chat/openSingleChat.js +7 -1
  144. package/libs/api/biz/chat/openSquad.js +7 -1
  145. package/libs/api/biz/chat/openTeamChat.js +7 -1
  146. package/libs/api/biz/chat/pickConversation.js +7 -1
  147. package/libs/api/biz/chat/sendP2PMsg.js +7 -1
  148. package/libs/api/biz/contact/complexPicker.js +7 -1
  149. package/libs/api/biz/contact/departmentsPicker.js +7 -1
  150. package/libs/api/biz/group/groupComplexPicker.js +7 -1
  151. package/libs/api/biz/map/multipointView.js +7 -1
  152. package/libs/api/biz/map/view.js +7 -1
  153. package/libs/api/biz/navigation/close.js +7 -1
  154. package/libs/api/biz/navigation/goBack.js +7 -1
  155. package/libs/api/biz/navigation/quit.js +7 -1
  156. package/libs/api/biz/navigation/replace.js +7 -1
  157. package/libs/api/biz/navigation/setIcon.js +8 -1
  158. package/libs/api/biz/navigation/setLeft.js +8 -1
  159. package/libs/api/biz/navigation/setMenu.js +8 -1
  160. package/libs/api/biz/navigation/setPanGestureEnable.js +8 -1
  161. package/libs/api/biz/navigation/setRight.js +8 -1
  162. package/libs/api/biz/navigation/setTitle.js +7 -1
  163. package/libs/api/biz/navigation/setTitleExpandIcon.js +8 -1
  164. package/libs/api/biz/navigation/setWindowBig.js +7 -2
  165. package/libs/api/biz/navigation/tencentMeeting.js +7 -1
  166. package/libs/api/biz/navigation/tencentMeetingBegin.js +7 -1
  167. package/libs/api/biz/navigation/updateExpandTitle.js +7 -1
  168. package/libs/api/biz/telephone/call.js +7 -1
  169. package/libs/api/biz/telephone/showCallMenu.js +7 -1
  170. package/libs/api/biz/util/addAppToNav.d.ts +8 -0
  171. package/libs/api/biz/util/addAppToNav.js +36 -0
  172. package/libs/api/biz/util/assistantCreate.js +7 -1
  173. package/libs/api/biz/util/authFinish.js +7 -1
  174. package/libs/api/biz/util/authStart.js +7 -1
  175. package/libs/api/biz/util/chosen.js +7 -1
  176. package/libs/api/biz/util/clipboardFileUpload.js +7 -1
  177. package/libs/api/biz/util/closeWindow.js +7 -1
  178. package/libs/api/biz/util/complain.js +7 -1
  179. package/libs/api/biz/util/createModifySchedule.js +7 -1
  180. package/libs/api/biz/util/datepicker.js +7 -1
  181. package/libs/api/biz/util/datetimepicker.js +7 -1
  182. package/libs/api/biz/util/disableScreenCapture.js +7 -1
  183. package/libs/api/biz/util/downloadFile.js +7 -1
  184. package/libs/api/biz/util/entergroupCheck.js +7 -1
  185. package/libs/api/biz/util/externalLinkPreviewFile.js +7 -1
  186. package/libs/api/biz/util/feedback.js +7 -1
  187. package/libs/api/biz/util/getSingleWebviewData.js +7 -1
  188. package/libs/api/biz/util/getTogetherConfig.js +7 -1
  189. package/libs/api/biz/util/getToken.js +7 -1
  190. package/libs/api/biz/util/injectScript.js +7 -1
  191. package/libs/api/biz/util/invoice.js +7 -2
  192. package/libs/api/biz/util/mediaFileUpload.js +7 -2
  193. package/libs/api/biz/util/onlineDocmentOpenTeamChat.js +7 -1
  194. package/libs/api/biz/util/open.js +7 -1
  195. package/libs/api/biz/util/openFutureGroup.js +7 -1
  196. package/libs/api/biz/util/openLink.js +7 -1
  197. package/libs/api/biz/util/openMediaFileDialog.js +7 -2
  198. package/libs/api/biz/util/openSingleWebview.js +7 -1
  199. package/libs/api/biz/util/openSlidePanel.js +7 -1
  200. package/libs/api/biz/util/openTalYoungToTopic.js +7 -2
  201. package/libs/api/biz/util/openTogetherEyeWebview.js +7 -1
  202. package/libs/api/biz/util/openUserSchedule.js +7 -1
  203. package/libs/api/biz/util/openVideoPlayer.js +7 -1
  204. package/libs/api/biz/util/previewFile.js +7 -1
  205. package/libs/api/biz/util/previewImage.js +7 -1
  206. package/libs/api/biz/util/proxy.js +7 -1
  207. package/libs/api/biz/util/pushWorkMsg.js +7 -2
  208. package/libs/api/biz/util/remind.js +7 -1
  209. package/libs/api/biz/util/resetSessionUnread.js +7 -1
  210. package/libs/api/biz/util/rouseApp.js +7 -2
  211. package/libs/api/biz/util/savePic.js +7 -1
  212. package/libs/api/biz/util/scan.js +7 -1
  213. package/libs/api/biz/util/selectDepartment.js +7 -1
  214. package/libs/api/biz/util/share.js +7 -1
  215. package/libs/api/biz/util/takePicture.js +7 -1
  216. package/libs/api/biz/util/uploadAttachment.js +7 -1
  217. package/libs/api/biz/util/yachEvent.js +7 -1
  218. package/libs/api/biz/util/zfbAuth.js +7 -1
  219. package/libs/api/biz/webViewMessage/send.js +7 -1
  220. package/libs/api/device/audio/download.js +7 -1
  221. package/libs/api/device/audio/onPlayEnd.js +7 -1
  222. package/libs/api/device/audio/onRecordEnd.js +7 -1
  223. package/libs/api/device/audio/onRecordEnd_v2.js +7 -1
  224. package/libs/api/device/audio/pause.js +7 -1
  225. package/libs/api/device/audio/play.js +7 -1
  226. package/libs/api/device/audio/resume.js +7 -1
  227. package/libs/api/device/audio/startRecord.js +7 -1
  228. package/libs/api/device/audio/startRecord_v2.js +7 -1
  229. package/libs/api/device/audio/stop.js +7 -1
  230. package/libs/api/device/audio/stopRecord.js +7 -1
  231. package/libs/api/device/audio/stopRecord_v2.js +7 -1
  232. package/libs/api/device/base/checkStepPermission.js +7 -1
  233. package/libs/api/device/base/getPhoneInfo.js +7 -1
  234. package/libs/api/device/base/getUUID.js +7 -1
  235. package/libs/api/device/connection/getNetworkType.js +7 -1
  236. package/libs/api/device/connection/isAtTal.js +9 -3
  237. package/libs/api/device/geolocation/get.js +7 -1
  238. package/libs/api/device/geolocation/getSwitch.js +7 -1
  239. package/libs/api/device/notification/actionSheet.js +7 -1
  240. package/libs/api/device/notification/alert.js +7 -1
  241. package/libs/api/device/notification/confirm.js +7 -1
  242. package/libs/api/device/notification/hidePreloader.js +7 -1
  243. package/libs/api/device/notification/showPreloader.js +7 -1
  244. package/libs/api/device/notification/toast.js +7 -1
  245. package/libs/api/device/notification/vibrate.js +7 -1
  246. package/libs/api/device/system/getLang.js +7 -1
  247. package/libs/api/device/system/setLight.js +7 -1
  248. package/libs/api/initAPI.js +13 -4
  249. package/libs/api/primary/createTab.js +7 -1
  250. package/libs/api/primary/exitFullScreen.js +7 -1
  251. package/libs/api/primary/fullScreen.js +7 -1
  252. package/libs/api/primary/weeklyShare.js +7 -1
  253. package/libs/api/runtime/permission/requestAuthCode.js +7 -1
  254. package/libs/api/ui/pullToRefresh/disable.js +7 -1
  255. package/libs/api/ui/pullToRefresh/enable.js +7 -1
  256. package/libs/api/ui/pullToRefresh/stop.js +7 -1
  257. package/libs/api/ui/webViewBounce/disable.js +7 -1
  258. package/libs/api/util/domainStorage/getItem.js +7 -1
  259. package/libs/api/util/domainStorage/removeItem.js +7 -1
  260. package/libs/api/util/domainStorage/setItem.js +7 -1
  261. package/libs/api/util/tool/flushLog.js +7 -1
  262. package/libs/api/util/tool/log.js +7 -1
  263. package/libs/index.d.ts +3 -1
  264. package/libs/index.js +512 -258
  265. package/libs/lib/bridge/index.js +13 -6
  266. package/libs/lib/bridge/mobile.js +96 -30
  267. package/libs/lib/bridge/pc.js +74 -18
  268. package/libs/lib/helper/apiHelper.js +7 -1
  269. package/libs/lib/helper/codeMap.js +7 -1
  270. package/libs/lib/helper/event.js +28 -8
  271. package/libs/lib/helper/pcIframe.js +59 -19
  272. package/libs/lib/index.js +33 -9
  273. package/libs/lib/sdk/index.js +58 -18
  274. package/libs/lib/sdk/sdk.typings.d.ts +1 -0
  275. package/libs/lib/sdk/sdk.typings.js +4 -0
  276. package/libs/utils/bpitLog.js +16 -4
  277. package/libs/utils/compareVersions.js +77 -32
  278. package/libs/utils/console.js +18 -2
  279. package/libs/utils/env.js +23 -12
  280. package/libs/utils/index.js +22 -9
  281. package/package.json +1 -1
  282. package/dist/yach_jssdk_4.3.6-beta2.js +0 -1
@@ -1,14 +1,17 @@
1
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
2
+ import _Promise from "@babel/runtime-corejs3/core-js/promise";
1
3
  import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
2
4
  import _createClass from "@babel/runtime-corejs3/helpers/createClass";
3
- import _Promise from "@babel/runtime-corejs3/core-js/promise";
4
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
5
- import { bpitLog } from '../../utils';
5
+ import { bpitLog, log } from '../../utils';
6
6
  import { compareVersions } from '../../utils/compareVersions';
7
7
  import packageInfo from '../../../package.json';
8
+
8
9
  var Sdk = /*#__PURE__*/function () {
9
10
  function Sdk(env) {
10
11
  var _this = this;
12
+
11
13
  _classCallCheck(this, Sdk);
14
+
12
15
  this.invokeAPIConfigMapByMethod = {};
13
16
  this.configJsApiList = [];
14
17
  this.platformConfigMap = {};
@@ -29,9 +32,11 @@ var Sdk = /*#__PURE__*/function () {
29
32
  platformV2: env.platformV2,
30
33
  config: function config() {
31
34
  var _config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
35
+
32
36
  // 鉴权
33
37
  var _config$jsApiList = _config.jsApiList,
34
- jsApiList = _config$jsApiList === void 0 ? [] : _config$jsApiList;
38
+ jsApiList = _config$jsApiList === void 0 ? [] : _config$jsApiList;
39
+
35
40
  if (_this.hadConfig) {
36
41
  console.log('Config has been executed');
37
42
  } else {
@@ -39,6 +44,7 @@ var Sdk = /*#__PURE__*/function () {
39
44
  fn('config', _config).then(function (value) {
40
45
  // 鉴权成功
41
46
  _this.cacheP.resolve(value);
47
+
42
48
  _this.hadConfig = true;
43
49
  _this.configJsApiList = jsApiList;
44
50
  })["catch"](function (error) {
@@ -70,19 +76,19 @@ var Sdk = /*#__PURE__*/function () {
70
76
  }
71
77
  };
72
78
  }
79
+
73
80
  _createClass(Sdk, [{
74
81
  key: "setAPI",
75
82
  value: function setAPI(method, config) {
76
83
  this.invokeAPIConfigMapByMethod[method] = config;
77
- }
78
- // 确定端的同事初始化bridge
84
+ } // 确定端的同事初始化bridge
85
+
79
86
  }, {
80
87
  key: "setPlatform",
81
88
  value: function setPlatform(value) {
82
89
  var platform = value.platform,
83
- bridgeInit = value.bridgeInit;
84
- this.platformConfigMap[platform] = value;
85
- // if (this.env.platform === platform) bridgeInit();
90
+ bridgeInit = value.bridgeInit;
91
+ this.platformConfigMap[platform] = value; // if (this.env.platform === platform) bridgeInit();
86
92
  }
87
93
  }, {
88
94
  key: "bridgeInitFn",
@@ -91,13 +97,16 @@ var Sdk = /*#__PURE__*/function () {
91
97
  if (this.bridgeInitFnPromise) {
92
98
  return this.bridgeInitFnPromise;
93
99
  }
100
+
94
101
  var o = this.platformConfigMap[this.env.platform];
102
+
95
103
  if (o) {
96
104
  this.bridgeInitFnPromise = o.bridgeInit();
97
105
  } else {
98
106
  var n = 'Do not support the current environment�' + this.env.platform;
99
107
  this.bridgeInitFnPromise = _Promise.reject(new Error(n));
100
108
  }
109
+
101
110
  return this.bridgeInitFnPromise;
102
111
  }
103
112
  }, {
@@ -117,44 +126,66 @@ var Sdk = /*#__PURE__*/function () {
117
126
  key: "invokeAPI",
118
127
  value: function invokeAPI(method, params) {
119
128
  var _context2;
129
+
120
130
  if (!params) params = {};
121
- if (!method) return;
122
- // 验证方法是否可用
131
+ if (!method) return; // 验证方法是否可用
132
+
123
133
  var apiConfigs = this.invokeAPIConfigMapByMethod[method];
134
+
124
135
  if (!apiConfigs) {
125
136
  return this._onFail(method, '-1', "[".concat(method, "] method is not exist"), params.onFail);
126
137
  }
138
+
127
139
  var apiConfig = apiConfigs[this.env.platform];
140
+
128
141
  if (apiConfig) {
129
142
  var supportVersion = apiConfig.vs || '0.0.0';
143
+
130
144
  if (compareVersions(this.env.version, supportVersion) < 0) {
131
145
  var _context;
146
+
132
147
  return this._onFail(method, '-1', _concatInstanceProperty(_context = "The current application version is ".concat(this.env.version, ". This method does not support versions less than ")).call(_context, supportVersion), params.onFail);
133
- }
134
- // 确定参数
135
- var p = apiConfig.paramsDeal ? apiConfig.paramsDeal(params) : params;
136
- // 确定回调
148
+ } // 确定参数
149
+
150
+
151
+ var p = apiConfig.paramsDeal ? apiConfig.paramsDeal(params) : params; // 确定回调
152
+
137
153
  if ('function' == typeof p.onSuccess) {
138
154
  var v = p.onSuccess;
155
+
139
156
  p.onSuccess = function (e) {
140
157
  v(e);
141
158
  };
142
- }
143
- // 主方法
159
+ } // 主方法
160
+
161
+
144
162
  this.bridgeInitFn().then(function (fn) {
145
- fn(method, p).then(function () {
163
+ fn(method, p).then(function (res) {
146
164
  // 调用成功
165
+ log("SDK \u8FD4\u56DE\u7ED3\u679C\u6210\u529F ", {
166
+ method: method,
167
+ params: p,
168
+ result: res
169
+ });
147
170
  })["catch"](function (error) {
148
171
  // 调用失败
172
+ log("SDK \u8FD4\u56DE\u7ED3\u679C\u5931\u8D25", {
173
+ method: method,
174
+ params: p,
175
+ error: error
176
+ });
149
177
  });
150
178
  })["catch"](function (err) {
151
179
  console.log('wenai err', err);
152
180
  });
153
181
  return;
154
182
  }
183
+
155
184
  this._onFail(method, '-1', _concatInstanceProperty(_context2 = "[".concat(method, "] method do not support the current platform (")).call(_context2, this.env.platform, ")"), params.onFail);
156
185
  }
157
186
  }]);
187
+
158
188
  return Sdk;
159
189
  }();
190
+
160
191
  export default Sdk;
@@ -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,4 +1,5 @@
1
1
  export var ENV_ENUM;
2
+
2
3
  (function (ENV_ENUM) {
3
4
  ENV_ENUM["pc"] = "pc";
4
5
  ENV_ENUM["android"] = "android";
@@ -1,6 +1,7 @@
1
1
  function loadScript(url) {
2
2
  var script = document.createElement('script');
3
3
  script.type = 'text/javascript';
4
+
4
5
  if (script.readyState) {
5
6
  // ie 浏览器
6
7
  script.onreadystatechange = function () {
@@ -15,31 +16,38 @@ function loadScript(url) {
15
16
  document.getElementsByTagName('head')[0].removeChild(script);
16
17
  };
17
18
  }
19
+
18
20
  script.src = url;
19
21
  document.getElementsByTagName('head')[0].appendChild(script);
20
22
  }
23
+
21
24
  export default function bpitLog(options) {
22
25
  if (!options) {
23
26
  console.log('bpit error: need options');
24
27
  return;
25
28
  }
29
+
26
30
  if (!options.group) {
27
31
  console.log('bpit error: need options.group');
28
32
  return;
29
33
  }
34
+
30
35
  if (!options.project) {
31
36
  console.log('bpit error: need options.project');
32
37
  return;
33
38
  }
39
+
34
40
  if (!options.hasOwnProperty('env')) {
35
41
  console.log('bpit error: need options.env');
36
42
  return;
37
43
  }
44
+
38
45
  if (!options.hasOwnProperty('version')) {
39
46
  console.log('bpit error: need options.version');
40
47
  return;
41
- }
42
- // upload data
48
+ } // upload data
49
+
50
+
43
51
  var uploadData = ['https://es.zhiyinlou.com/log.js?'];
44
52
  uploadData.push('group=' + options.group);
45
53
  uploadData.push('&project=' + options.project);
@@ -50,12 +58,13 @@ export default function bpitLog(options) {
50
58
  if (options.workcode) uploadData.push('&workcode=' + options.workcode);
51
59
  if (options.timestamp) uploadData.push('&timestamp=' + options.timestamp);
52
60
  if (options.errorcode) uploadData.push('&errorcode=' + options.errorcode);
53
- if (options.message) uploadData.push('&message=' + options.message);
54
- // api load time
61
+ if (options.message) uploadData.push('&message=' + options.message); // api load time
62
+
55
63
  if (options.api && options.time) {
56
64
  uploadData.push('&api=' + options.api);
57
65
  uploadData.push('&load_time=' + options.time);
58
66
  }
67
+
59
68
  var uploadDataUrl = uploadData.join('');
60
69
  loadScript(uploadDataUrl);
61
70
  if (options.env != 'online') console.log(uploadDataUrl);
@@ -1,9 +1,10 @@
1
+ import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js/instance/index-of";
2
+ import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
1
3
  import _typeof from "@babel/runtime-corejs3/helpers/typeof";
4
+ import _parseInt from "@babel/runtime-corejs3/core-js/parse-int";
2
5
  import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
3
6
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
4
- import _parseInt from "@babel/runtime-corejs3/core-js/parse-int";
5
- import _Object$keys from "@babel/runtime-corejs3/core-js/object/keys";
6
- import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js/instance/index-of";
7
+
7
8
  /**
8
9
  * Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
9
10
  * 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`.
@@ -14,19 +15,20 @@ import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js/instance/in
14
15
  export var compareVersions = function compareVersions(v1, v2) {
15
16
  // validate input and split into segments
16
17
  var n1 = validateAndParse(v1);
17
- var n2 = validateAndParse(v2);
18
- // pop off the patch
18
+ var n2 = validateAndParse(v2); // pop off the patch
19
+
19
20
  var p1 = n1.pop();
20
- var p2 = n2.pop();
21
- // validate numbers
21
+ var p2 = n2.pop(); // validate numbers
22
+
22
23
  var r = compareSegments(n1, n2);
23
- if (r !== 0) return r;
24
- // validate pre-release
24
+ if (r !== 0) return r; // validate pre-release
25
+
25
26
  if (p1 && p2) {
26
27
  return compareSegments(p1.split('.'), p2.split('.'));
27
28
  } else if (p1 || p2) {
28
29
  return p1 ? -1 : 1;
29
30
  }
31
+
30
32
  return 0;
31
33
  };
32
34
  /**
@@ -42,6 +44,7 @@ export var compareVersions = function compareVersions(v1, v2) {
42
44
  * validate('foo'); // return false
43
45
  * ```
44
46
  */
47
+
45
48
  export var validate = function validate(version) {
46
49
  return typeof version === 'string' && /^[v\d]/.test(version) && semver.test(version);
47
50
  };
@@ -62,12 +65,14 @@ export var validate = function validate(version) {
62
65
  * compare('10.1.1', '10.2.2', '>='); // return false
63
66
  * ```
64
67
  */
68
+
65
69
  export var compare = function compare(v1, v2, operator) {
66
70
  var _context;
71
+
67
72
  // validate input operator
68
- assertValidOperator(operator);
69
- // since result of compareVersions can only be -1 or 0 or 1
73
+ assertValidOperator(operator); // since result of compareVersions can only be -1 or 0 or 1
70
74
  // a simple map can be used to replace switch
75
+
71
76
  var res = compareVersions(v1, v2);
72
77
  return _includesInstanceProperty(_context = operatorResMap[operator]).call(_context, res);
73
78
  };
@@ -84,69 +89,88 @@ export var compare = function compare(v1, v2, operator) {
84
89
  * satisfies('1.1.0', '~1.0.0'); // return false
85
90
  * ```
86
91
  */
92
+
87
93
  export var satisfies = function satisfies(version, range) {
88
94
  // if no range operator then "="
89
95
  var m = range.match(/^([<>=~^]+)/);
90
- var op = m ? m[1] : '=';
91
- // if gt/lt/eq then operator compare
92
- if (op !== '^' && op !== '~') return compare(version, range, op);
93
- // else range of either "~" or "^" is assumed
96
+ var op = m ? m[1] : '='; // if gt/lt/eq then operator compare
97
+
98
+ if (op !== '^' && op !== '~') return compare(version, range, op); // else range of either "~" or "^" is assumed
99
+
94
100
  var _validateAndParse = validateAndParse(version),
95
- _validateAndParse2 = _slicedToArray(_validateAndParse, 3),
96
- v1 = _validateAndParse2[0],
97
- v2 = _validateAndParse2[1],
98
- v3 = _validateAndParse2[2];
101
+ _validateAndParse2 = _slicedToArray(_validateAndParse, 3),
102
+ v1 = _validateAndParse2[0],
103
+ v2 = _validateAndParse2[1],
104
+ v3 = _validateAndParse2[2];
105
+
99
106
  var _validateAndParse3 = validateAndParse(range),
100
- _validateAndParse4 = _slicedToArray(_validateAndParse3, 3),
101
- r1 = _validateAndParse4[0],
102
- r2 = _validateAndParse4[1],
103
- r3 = _validateAndParse4[2];
107
+ _validateAndParse4 = _slicedToArray(_validateAndParse3, 3),
108
+ r1 = _validateAndParse4[0],
109
+ r2 = _validateAndParse4[1],
110
+ r3 = _validateAndParse4[2];
111
+
104
112
  if (compareStrings(v1, r1) !== 0) return false;
113
+
105
114
  if (op === '^') {
106
115
  return compareSegments([v2, v3], [r2, r3]) >= 0;
107
116
  }
117
+
108
118
  if (compareStrings(v2, r2) !== 0) return false;
109
119
  return compareStrings(v3, r3) >= 0;
110
120
  };
111
121
  var semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
122
+
112
123
  var validateAndParse = function validateAndParse(version) {
113
124
  if (typeof version !== 'string') {
114
125
  throw new TypeError('Invalid argument expected string');
115
126
  }
127
+
116
128
  var match = version.match(semver);
129
+
117
130
  if (!match) {
118
131
  throw new Error("Invalid argument not valid semver ('".concat(version, "' received)"));
119
132
  }
133
+
120
134
  match.shift();
121
135
  return match;
122
136
  };
137
+
123
138
  var isWildcard = function isWildcard(s) {
124
139
  return s === '*' || s === 'x' || s === 'X';
125
140
  };
141
+
126
142
  var tryParse = function tryParse(v) {
127
143
  var n = _parseInt(v, 10);
144
+
128
145
  return isNaN(n) ? v : n;
129
146
  };
147
+
130
148
  var forceType = function forceType(a, b) {
131
149
  return _typeof(a) !== _typeof(b) ? [String(a), String(b)] : [a, b];
132
150
  };
151
+
133
152
  var compareStrings = function compareStrings(a, b) {
134
153
  if (isWildcard(a) || isWildcard(b)) return 0;
154
+
135
155
  var _forceType = forceType(tryParse(a), tryParse(b)),
136
- _forceType2 = _slicedToArray(_forceType, 2),
137
- ap = _forceType2[0],
138
- bp = _forceType2[1];
156
+ _forceType2 = _slicedToArray(_forceType, 2),
157
+ ap = _forceType2[0],
158
+ bp = _forceType2[1];
159
+
139
160
  if (ap > bp) return 1;
140
161
  if (ap < bp) return -1;
141
162
  return 0;
142
163
  };
164
+
143
165
  var compareSegments = function compareSegments(a, b) {
144
166
  for (var i = 0; i < Math.max(a.length, b.length); i++) {
145
167
  var r = compareStrings(a[i] || '0', b[i] || '0');
146
168
  if (r !== 0) return r;
147
169
  }
170
+
148
171
  return 0;
149
172
  };
173
+
150
174
  var operatorResMap = {
151
175
  '>': [1],
152
176
  '>=': [0, 1],
@@ -154,11 +178,14 @@ var operatorResMap = {
154
178
  '<=': [-1, 0],
155
179
  '<': [-1]
156
180
  };
181
+
157
182
  var allowedOperators = _Object$keys(operatorResMap);
183
+
158
184
  var assertValidOperator = function assertValidOperator(op) {
159
185
  if (typeof op !== 'string') {
160
186
  throw new TypeError("Invalid operator type, expected string but got ".concat(_typeof(op)));
161
187
  }
188
+
162
189
  if (_indexOfInstanceProperty(allowedOperators).call(allowedOperators, op) === -1) {
163
190
  throw new Error("Invalid operator, expected one of ".concat(allowedOperators.join('|')));
164
191
  }
@@ -1,44 +1,60 @@
1
- var _context, _context2, _context3;
2
1
  import _bindInstanceProperty from "@babel/runtime-corejs3/core-js/instance/bind";
2
+
3
+ var _context, _context2, _context3;
4
+
3
5
  // 防止被应用复写console
4
6
  var myconsole = {
5
7
  log: function log() {},
6
8
  warn: function warn() {},
7
9
  error: function error() {}
8
10
  };
11
+
9
12
  if (window && window.console) {
10
13
  myconsole = window.console;
11
14
  }
15
+
12
16
  if (document && document.body) {
13
17
  var iframe = document.createElement('iframe');
18
+
14
19
  if (iframe && iframe.contentWindow && iframe.contentWindow.console) {
15
20
  iframe.style.display = 'none';
16
21
  document.body.appendChild(iframe);
17
22
  myconsole = iframe.contentWindow.console;
18
23
  }
19
24
  }
25
+
20
26
  var myLog = _bindInstanceProperty(_context = myconsole.log).call(_context, myconsole);
27
+
21
28
  var myWarn = _bindInstanceProperty(_context2 = myconsole.warn).call(_context2, myconsole);
29
+
22
30
  var myError = _bindInstanceProperty(_context3 = myconsole.error).call(_context3, myconsole);
31
+
23
32
  var style = 'color:#fff;font-weight:bold;border-radius:5px;background:#67c23a;';
24
33
  var styleError = "".concat(style, "background-color:red;");
25
34
  var styleWarn = "".concat(style, "background-color:orange;");
35
+
26
36
  function log() {
27
37
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28
38
  args[_key] = arguments[_key];
29
39
  }
40
+
30
41
  return myLog("%c Yach-jssdk log: ", style, args);
31
42
  }
43
+
32
44
  function error() {
33
45
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
34
46
  args[_key2] = arguments[_key2];
35
47
  }
48
+
36
49
  return myWarn("%c Yach-jssdk log: ", styleError, args);
37
50
  }
51
+
38
52
  function warn() {
39
53
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
40
54
  args[_key3] = arguments[_key3];
41
55
  }
56
+
42
57
  return myError("%c Yach-jssdk log: ", styleWarn, args);
43
58
  }
59
+
44
60
  export { log, error, warn };
package/es/utils/env.js CHANGED
@@ -1,30 +1,37 @@
1
1
  import { ENV_ENUM } from '../lib/sdk/sdk.typings';
2
+
2
3
  function getUA() {
3
4
  return typeof navigator !== 'undefined' ? navigator.userAgent : '';
4
5
  }
6
+
5
7
  function getENV() {
6
8
  var ua = getUA(),
7
- inYach = /Yach/i.test(ua),
8
- inIOS = /iPhone|iPad|iPod|iOS/i.test(ua) && inYach,
9
- inAndroid = /Android/i.test(ua) && inYach,
10
- inPC = /YachPc/i.test(ua),
11
- inIpad = /iPad/i.test(ua) && inYach,
12
- inIPhone = /iPhone/i.test(ua) && inYach;
13
- // platform
9
+ inYach = /Yach/i.test(ua),
10
+ inIOS = /iPhone|iPad|iPod|iOS/i.test(ua) && inYach,
11
+ inAndroid = /Android/i.test(ua) && inYach,
12
+ inPC = /YachPc/i.test(ua),
13
+ inIpad = /iPad/i.test(ua) && inYach,
14
+ inIPhone = /iPhone/i.test(ua) && inYach,
15
+ isTest = /Yachtest/.test(ua) && inYach; // platform
16
+
14
17
  var platform = ENV_ENUM.notInYach;
18
+
15
19
  if (inIOS) {
16
20
  platform = ENV_ENUM.ios;
17
21
  }
22
+
18
23
  if (inAndroid) {
19
24
  platform = ENV_ENUM.android;
20
25
  }
26
+
21
27
  if (inPC) {
22
28
  platform = ENV_ENUM.pc;
23
- }
24
- // version
29
+ } // version
30
+
31
+
25
32
  var versionArr = ua.match(/Yach\/[a-zA-Z0-9.-]+/) || [];
26
- var version = (versionArr[0] || '').split('/')[1] || '';
27
- // language
33
+ var version = (versionArr[0] || '').split('/')[1] || ''; // language
34
+
28
35
  var language = typeof navigator !== 'undefined' ? navigator.language : '*';
29
36
  return {
30
37
  platform: platform,
@@ -37,7 +44,9 @@ function getENV() {
37
44
  inIPhone: inIPhone
38
45
  },
39
46
  version: version,
40
- language: language
47
+ language: language,
48
+ env: isTest ? 'test' : 'online'
41
49
  };
42
50
  }
51
+
43
52
  export { getENV };
package/es/utils/index.js CHANGED
@@ -1,12 +1,15 @@
1
- import _Date$now from "@babel/runtime-corejs3/core-js/date/now";
2
1
  import _Object$assign from "@babel/runtime-corejs3/core-js/object/assign";
2
+ import _Date$now from "@babel/runtime-corejs3/core-js/date/now";
3
3
  import { getENV } from './env';
4
4
  import bpitLog from './bpitLog';
5
5
  import { log, error, warn } from './console';
6
+
6
7
  function staticsLog(config) {
7
- var env = 'test';
8
+ var env = getENV().env;
8
9
  var version = getENV().version;
10
+
9
11
  var timestamp = _Date$now();
12
+
10
13
  var params = _Object$assign({
11
14
  group: 'yach',
12
15
  project: 'yach_31_jssdk',
@@ -14,7 +17,9 @@ function staticsLog(config) {
14
17
  version: version,
15
18
  timestamp: timestamp
16
19
  }, config);
20
+
17
21
  console.log('jssdk 项目 bpit 上报数据:', params);
18
22
  bpitLog(params);
19
23
  }
24
+
20
25
  export { log, error, warn, staticsLog as bpitLog, getENV };
@@ -1,12 +1,17 @@
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.talYoungFilesUpload = talYoungFilesUpload;
12
+
9
13
  var _initAPI = _interopRequireDefault(require("../../initAPI"));
14
+
10
15
  /*
11
16
  * @Descripttion:
12
17
  * @Author: olei<wangzheng_jzb@100tal.com>
@@ -15,8 +20,8 @@ var _initAPI = _interopRequireDefault(require("../../initAPI"));
15
20
  * @LastEditTime: 2020-09-10 16:51:44
16
21
  * yach > 1.4.7 已经废弃,目前只保留 sdk 入口兼容 yach 低版本调用
17
22
  */
18
-
19
23
  var apiName = 'app.custom.talYoungFilesUpload';
24
+
20
25
  function talYoungFilesUpload(params) {
21
26
  (0, _initAPI["default"])(apiName, {
22
27
  params: params
@@ -1,13 +1,19 @@
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.chooseConversationByCorpId = chooseConversationByCorpId;
12
+
9
13
  var _initAPI = _interopRequireDefault(require("../../initAPI"));
14
+
10
15
  var apiName = 'biz.chat.chooseConversationByCorpId';
16
+
11
17
  function chooseConversationByCorpId(params) {
12
18
  (0, _initAPI["default"])(apiName, {
13
19
  params: params
@@ -1,13 +1,19 @@
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.openSingleChat = openSingleChat;
12
+
9
13
  var _initAPI = _interopRequireDefault(require("../../initAPI"));
14
+
10
15
  var apiName = 'biz.chat.openSingleChat';
16
+
11
17
  function openSingleChat(params) {
12
18
  (0, _initAPI["default"])(apiName, {
13
19
  params: params
@@ -1,13 +1,19 @@
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.openSquad = openSquad;
12
+
9
13
  var _initAPI = _interopRequireDefault(require("../../initAPI"));
14
+
10
15
  var apiName = 'biz.chat.openSquad';
16
+
11
17
  function openSquad(params) {
12
18
  (0, _initAPI["default"])(apiName, {
13
19
  params: params