yach.open.jssdk 4.4.9 → 4.4.10-beta.2

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 (116) hide show
  1. package/dist/yach_jssdk_4.3.3.js +1 -0
  2. package/es/api/biz/navigation/close.d.ts +0 -1
  3. package/es/api/biz/navigation/tencentMeeting.d.ts +0 -1
  4. package/es/api/device/notification/hidePreloader.d.ts +1 -6
  5. package/es/api/device/notification/hidePreloader.js +2 -15
  6. package/es/api/device/notification/showPreloader.d.ts +1 -10
  7. package/es/api/device/notification/showPreloader.js +2 -15
  8. package/es/index.d.ts +3 -41
  9. package/es/index.js +5 -44
  10. package/es/lib/bridge/mobile.js +20 -61
  11. package/es/lib/bridge/pc.js +8 -50
  12. package/es/lib/helper/pcIframe.d.ts +25 -8
  13. package/es/lib/helper/pcIframe.js +8 -34
  14. package/es/lib/sdk/index.js +4 -13
  15. package/es/lib/sdk/sdk.typings.d.ts +0 -2
  16. package/es/utils/console.d.ts +1 -1
  17. package/es/utils/console.js +2 -2
  18. package/es/utils/env.js +3 -7
  19. package/es/utils/index.js +1 -1
  20. package/libs/api/biz/navigation/close.d.ts +0 -1
  21. package/libs/api/biz/navigation/tencentMeeting.d.ts +0 -1
  22. package/libs/api/device/notification/hidePreloader.d.ts +1 -6
  23. package/libs/api/device/notification/hidePreloader.js +1 -15
  24. package/libs/api/device/notification/showPreloader.d.ts +1 -10
  25. package/libs/api/device/notification/showPreloader.js +1 -15
  26. package/libs/api/initAPI.js +2 -1
  27. package/libs/index.d.ts +3 -41
  28. package/libs/index.js +25 -186
  29. package/libs/lib/bridge/mobile.js +25 -64
  30. package/libs/lib/bridge/pc.js +13 -53
  31. package/libs/lib/helper/event.js +2 -1
  32. package/libs/lib/helper/pcIframe.d.ts +25 -8
  33. package/libs/lib/helper/pcIframe.js +10 -35
  34. package/libs/lib/index.js +2 -1
  35. package/libs/lib/sdk/index.js +5 -13
  36. package/libs/lib/sdk/sdk.typings.d.ts +0 -2
  37. package/libs/lib/sdk/sdk.typings.js +1 -0
  38. package/libs/utils/compareVersions.js +8 -4
  39. package/libs/utils/console.d.ts +1 -1
  40. package/libs/utils/console.js +2 -2
  41. package/libs/utils/env.js +3 -7
  42. package/libs/utils/index.js +1 -1
  43. package/package.json +3 -1
  44. package/dist/yach_jssdk_4.4.9.js +0 -1
  45. package/es/api/biz/util/addAppToNav.d.ts +0 -9
  46. package/es/api/biz/util/addAppToNav.js +0 -23
  47. package/es/api/biz/util/copy.d.ts +0 -11
  48. package/es/api/biz/util/copy.js +0 -19
  49. package/es/api/biz/util/focus.d.ts +0 -7
  50. package/es/api/biz/util/focus.js +0 -23
  51. package/es/api/biz/util/getConfig.d.ts +0 -13
  52. package/es/api/biz/util/getConfig.js +0 -19
  53. package/es/api/biz/util/knowledgeBaseSelect.d.ts +0 -21
  54. package/es/api/biz/util/knowledgeBaseSelect.js +0 -23
  55. package/es/api/biz/util/knowledgeSelectParams.d.ts +0 -14
  56. package/es/api/biz/util/knowledgeSelectParams.js +0 -19
  57. package/es/api/biz/util/lorebaseRefreshNodeWebview.d.ts +0 -11
  58. package/es/api/biz/util/lorebaseRefreshNodeWebview.js +0 -19
  59. package/es/api/biz/util/lorebaseShowList.d.ts +0 -11
  60. package/es/api/biz/util/lorebaseShowList.js +0 -19
  61. package/es/api/biz/util/mediaFileUploadV2.d.ts +0 -26
  62. package/es/api/biz/util/mediaFileUploadV2.js +0 -15
  63. package/es/api/biz/util/openAudioPlayer.d.ts +0 -17
  64. package/es/api/biz/util/openAudioPlayer.js +0 -23
  65. package/es/api/biz/util/openFutureGroup.d.ts +0 -10
  66. package/es/api/biz/util/openFutureGroup.js +0 -23
  67. package/es/api/biz/util/openMediaFileDialogV2.d.ts +0 -23
  68. package/es/api/biz/util/openMediaFileDialogV2.js +0 -16
  69. package/es/api/biz/util/openPublish.d.ts +0 -22
  70. package/es/api/biz/util/openPublish.js +0 -15
  71. package/es/api/biz/util/screen.d.ts +0 -15
  72. package/es/api/biz/util/screen.js +0 -15
  73. package/es/api/biz/util/topicEvent.d.ts +0 -13
  74. package/es/api/biz/util/topicEvent.js +0 -27
  75. package/es/api/biz/util/weeklyRead.d.ts +0 -5
  76. package/es/api/biz/util/weeklyRead.js +0 -23
  77. package/es/api/device/connection/startNetworkChangeWatch.d.ts +0 -8
  78. package/es/api/device/connection/startNetworkChangeWatch.js +0 -23
  79. package/es/api/primary/updateTab.d.ts +0 -9
  80. package/es/api/primary/updateTab.js +0 -15
  81. package/libs/api/biz/util/addAppToNav.d.ts +0 -9
  82. package/libs/api/biz/util/addAppToNav.js +0 -30
  83. package/libs/api/biz/util/copy.d.ts +0 -11
  84. package/libs/api/biz/util/copy.js +0 -26
  85. package/libs/api/biz/util/focus.d.ts +0 -7
  86. package/libs/api/biz/util/focus.js +0 -30
  87. package/libs/api/biz/util/getConfig.d.ts +0 -13
  88. package/libs/api/biz/util/getConfig.js +0 -26
  89. package/libs/api/biz/util/knowledgeBaseSelect.d.ts +0 -21
  90. package/libs/api/biz/util/knowledgeBaseSelect.js +0 -30
  91. package/libs/api/biz/util/knowledgeSelectParams.d.ts +0 -14
  92. package/libs/api/biz/util/knowledgeSelectParams.js +0 -26
  93. package/libs/api/biz/util/lorebaseRefreshNodeWebview.d.ts +0 -11
  94. package/libs/api/biz/util/lorebaseRefreshNodeWebview.js +0 -26
  95. package/libs/api/biz/util/lorebaseShowList.d.ts +0 -11
  96. package/libs/api/biz/util/lorebaseShowList.js +0 -26
  97. package/libs/api/biz/util/mediaFileUploadV2.d.ts +0 -26
  98. package/libs/api/biz/util/mediaFileUploadV2.js +0 -23
  99. package/libs/api/biz/util/openAudioPlayer.d.ts +0 -17
  100. package/libs/api/biz/util/openAudioPlayer.js +0 -30
  101. package/libs/api/biz/util/openFutureGroup.d.ts +0 -10
  102. package/libs/api/biz/util/openFutureGroup.js +0 -30
  103. package/libs/api/biz/util/openMediaFileDialogV2.d.ts +0 -23
  104. package/libs/api/biz/util/openMediaFileDialogV2.js +0 -24
  105. package/libs/api/biz/util/openPublish.d.ts +0 -22
  106. package/libs/api/biz/util/openPublish.js +0 -22
  107. package/libs/api/biz/util/screen.d.ts +0 -15
  108. package/libs/api/biz/util/screen.js +0 -22
  109. package/libs/api/biz/util/topicEvent.d.ts +0 -13
  110. package/libs/api/biz/util/topicEvent.js +0 -34
  111. package/libs/api/biz/util/weeklyRead.d.ts +0 -5
  112. package/libs/api/biz/util/weeklyRead.js +0 -30
  113. package/libs/api/device/connection/startNetworkChangeWatch.d.ts +0 -8
  114. package/libs/api/device/connection/startNetworkChangeWatch.js +0 -30
  115. package/libs/api/primary/updateTab.d.ts +0 -9
  116. package/libs/api/primary/updateTab.js +0 -22
@@ -10,7 +10,6 @@ var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-j
10
10
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
11
11
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/assign"));
12
12
  var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/parse-int"));
13
- var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/json/stringify"));
14
13
  var _event = _interopRequireDefault(require("../helper/event"));
15
14
  var _codeMap = require("../helper/codeMap");
16
15
  var _utils = require("../../utils");
@@ -33,7 +32,7 @@ function setupWebViewJavascriptBridge(callback) {
33
32
  document.documentElement.removeChild(WVJBIframe);
34
33
  }, 0);
35
34
  }
36
- var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
35
+ var mobileBridgeInit = function mobileBridgeInit() {
37
36
  return new _promise["default"](function (resolve, reject) {
38
37
  setupWebViewJavascriptBridge(function (bridge) {
39
38
  (0, _utils.log)("\u6CE8\u518Cresume\u4E8B\u4EF6 ");
@@ -75,21 +74,12 @@ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
75
74
  });
76
75
  _event["default"].execEvent('sendMsgCommon', resData);
77
76
  });
78
- bridge.registerHandler('toolbarClickEvent', function (resData, responseCallback) {
79
- (0, _utils.log)("toolbarClickEvent ", {
80
- resData: resData
81
- });
82
- var responseData = {
83
- data: resData,
84
- callback: responseCallback
85
- };
86
- _event["default"].execEvent('toolbarClickEvent', responseData);
87
- });
88
77
  resolve();
89
78
  });
90
79
  });
91
80
  };
92
- var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
81
+ exports.mobileBridgeInit = mobileBridgeInit;
82
+ var mobileBridge = function mobileBridge(method, param) {
93
83
  return new _promise["default"](function (resolve, reject) {
94
84
  var p = (0, _assign["default"])({}, param);
95
85
  setupWebViewJavascriptBridge(function (bridge) {
@@ -112,6 +102,26 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
112
102
  data = e.data;
113
103
  var _code = (0, _parseInt2["default"])(code);
114
104
  var callbackStr = (0, _codeMap.electronResCodeMap)(_code);
105
+ if (_code === -2 || _code === 7) {
106
+ (0, _utils.bpitLog)({
107
+ method: method,
108
+ errorcode: _code,
109
+ message: message || 'SDK执行失败回调,相关参数'
110
+ });
111
+ (0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
112
+ method: method,
113
+ param: param,
114
+ data: data,
115
+ _code: _code,
116
+ message: message
117
+ });
118
+ reject({
119
+ _code: _code,
120
+ message: message
121
+ });
122
+ // return;
123
+ }
124
+
115
125
  var callbackFun = p[callbackStr];
116
126
  (0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
117
127
  method: method,
@@ -121,27 +131,6 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
121
131
  message: message,
122
132
  callbackFun: callbackFun
123
133
  });
124
- // 请求失败
125
- if (callbackStr === 'onFail') {
126
- (0, _utils.bpitLog)({
127
- method: method,
128
- errorcode: _code,
129
- message: message || (0, _stringify["default"])(data) || 'SDK执行失败回调,相关参数'
130
- });
131
- if ('function' === typeof callbackFun) {
132
- message ? callbackFun({
133
- code: code,
134
- message: message
135
- }) : callbackFun(data);
136
- }
137
- reject({
138
- _code: _code,
139
- message: message,
140
- data: data
141
- });
142
- return;
143
- }
144
- // 请求成功
145
134
  if ('function' === typeof callbackFun) {
146
135
  callbackFun(data || message);
147
136
  }
@@ -150,36 +139,8 @@ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
150
139
  message: message,
151
140
  data: data
152
141
  });
153
- // if (_code === -2 || _code === 7) {
154
- // bpitLog({
155
- // method,
156
- // errorcode: _code,
157
- // message: message || 'SDK执行失败回调,相关参数',
158
- // });
159
- // log(`SDK执行后回调,相关参数 `, {
160
- // method,
161
- // param,
162
- // data,
163
- // _code,
164
- // message,
165
- // });
166
- // reject({_code, message});
167
- // // return;
168
- // }
169
- // const callbackFun = p[callbackStr];
170
- // log(`SDK执行后回调,相关参数 `, {
171
- // method,
172
- // param,
173
- // data,
174
- // _code,
175
- // message,
176
- // callbackFun,
177
- // });
178
- // if ('function' === typeof callbackFun) {
179
- // callbackFun(data || message);
180
- // }
181
- // resolve({_code, message, data});
182
142
  });
183
143
  });
184
144
  });
185
- };
145
+ };
146
+ exports.mobileBridge = mobileBridge;
@@ -8,22 +8,28 @@ _Object$defineProperty(exports, "__esModule", {
8
8
  exports.pcBridge = exports.PcBridgeInit = void 0;
9
9
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/promise"));
10
10
  var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/parse-int"));
11
- var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/json/stringify"));
12
- var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/assign"));
13
11
  var _pcIframe = _interopRequireDefault(require("../helper/pcIframe"));
14
12
  var _codeMap = require("../helper/codeMap");
15
13
  var _utils = require("../../utils");
16
- var PcBridgeInit = exports.PcBridgeInit = function PcBridgeInit() {
14
+ var PcBridgeInit = function PcBridgeInit() {
17
15
  _pcIframe["default"].init();
18
16
  };
19
- var pcBridge = exports.pcBridge = function pcBridge(method, param) {
20
- return new _promise["default"](function (resolve, reject) {
17
+ exports.PcBridgeInit = PcBridgeInit;
18
+ var pcBridge = function pcBridge(method, param) {
19
+ return new _promise["default"](function (resolve) {
21
20
  return _pcIframe["default"].invokeAPI(method, param, function (_ref) {
22
21
  var data = _ref.data,
23
22
  code = _ref.code,
24
23
  message = _ref.message;
25
24
  var _code = (0, _parseInt2["default"])(code);
26
25
  var callbackStr = (0, _codeMap.electronResCodeMap)(_code);
26
+ if (_code === -2) {
27
+ (0, _utils.bpitLog)({
28
+ method: method,
29
+ errorcode: _code,
30
+ message: message || 'SDK执行失败回调,相关参数'
31
+ });
32
+ }
27
33
  var callbackFun = param[callbackStr];
28
34
  (0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
29
35
  method: method,
@@ -33,33 +39,6 @@ var pcBridge = exports.pcBridge = function pcBridge(method, param) {
33
39
  message: message,
34
40
  callbackFun: callbackFun
35
41
  });
36
- // 请求失败
37
- if (callbackStr === 'onFail') {
38
- (0, _utils.bpitLog)({
39
- method: method,
40
- errorcode: _code,
41
- message: message || (0, _stringify["default"])(data) || 'SDK执行失败回调,相关参数'
42
- });
43
- if ('function' === typeof callbackFun) {
44
- console.log('wenai-code', code, _code);
45
- var callbackData = Object.prototype.toString.call(data) === "[object Object]" ? (0, _assign["default"])((0, _assign["default"])({}, data), {
46
- code: code,
47
- message: message
48
- }) : {
49
- data: data,
50
- code: code,
51
- message: message
52
- };
53
- message ? callbackFun(callbackData) : callbackFun(data);
54
- }
55
- reject({
56
- _code: _code,
57
- message: message,
58
- data: data
59
- });
60
- return;
61
- }
62
- // 请求成功
63
42
  if ('function' === typeof callbackFun) {
64
43
  callbackFun(data || message);
65
44
  }
@@ -68,26 +47,7 @@ var pcBridge = exports.pcBridge = function pcBridge(method, param) {
68
47
  message: message,
69
48
  data: data
70
49
  });
71
- // if (_code === -2) {
72
- // bpitLog({
73
- // method,
74
- // errorcode: _code,
75
- // message: message || 'SDK执行失败回调,相关参数',
76
- // });
77
- // }
78
- // const callbackFun = param[callbackStr];
79
- // log(`SDK执行后回调,相关参数 `, {
80
- // method,
81
- // param,
82
- // data,
83
- // _code,
84
- // message,
85
- // callbackFun
86
- // });
87
- // if ('function' === typeof callbackFun) {
88
- // callbackFun(data || message);
89
- // }
90
- // resolve({ _code, message, data });
91
50
  });
92
51
  });
93
- };
52
+ };
53
+ exports.pcBridge = pcBridge;
@@ -45,4 +45,5 @@ var Event = /*#__PURE__*/(0, _createClass2["default"])(function Event() {
45
45
  this.eventsHandle = {};
46
46
  });
47
47
  var event = new Event();
48
- var _default = exports["default"] = event;
48
+ var _default = event;
49
+ exports["default"] = _default;
@@ -3,24 +3,41 @@ declare global {
3
3
  sendToHost: any;
4
4
  sendTo: any;
5
5
  receiveBrowserViewData: any;
6
- remoteSendToHost?: (payload: string) => void;
7
- remoteReceiveFromHost?: (callback: (result: Record<string, any>) => void, moduleId?: string) => void;
8
6
  }
9
7
  }
10
- declare type InvokeType = 'browserView' | 'moduleFederation' | '';
8
+ interface APIParams {
9
+ invokeType?: 'browserView' | '';
10
+ [propName: string]: any;
11
+ }
12
+ declare class GenPostMsg {
13
+ private id;
14
+ private PromiseObj;
15
+ private methodName;
16
+ private plainMsg;
17
+ callback: (v: any) => void;
18
+ result: Promise<any>;
19
+ invokeType: 'browserView' | '';
20
+ constructor(method: string, param: APIParams, callback: any);
21
+ genid: () => string;
22
+ receiveResponse: (data: any) => void;
23
+ getPayload: () => {
24
+ msgId: string;
25
+ methodName: string;
26
+ body: object;
27
+ type: string;
28
+ invokeType: "" | "browserView";
29
+ };
30
+ }
11
31
  declare class Frame {
12
32
  pendingMsgs: {};
13
- invokeType?: InvokeType;
14
- moduleId?: string;
15
33
  constructor();
16
34
  addPending: (e: any) => void;
17
35
  deletePending: (e: any) => void;
18
36
  getPending: (t: any) => any;
19
37
  invokeAPIInBrowserView: (payload: string) => void;
20
38
  invokeAPIInWebview: (payload: string) => void;
21
- invokeAPIInModuleFederation: (payload: string) => void;
22
- invokeAPI: (method: string, param: any, callback: any) => any;
23
- handleCallback: (datas: any, invokeType?: InvokeType) => void;
39
+ invokeAPI: (method: string, param: any, callback: any) => GenPostMsg;
40
+ handleCallback: (datas: any, invokeType?: 'browserView' | '') => void;
24
41
  init: () => void;
25
42
  }
26
43
  declare const frame: Frame;
@@ -29,7 +29,6 @@ var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(
29
29
  return {
30
30
  msgId: _this.id,
31
31
  methodName: _this.methodName,
32
- moduleId: _this.moduleId,
33
32
  body: _this.plainMsg,
34
33
  type: 'request',
35
34
  invokeType: _this.invokeType
@@ -43,7 +42,6 @@ var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(
43
42
  this.methodName = method;
44
43
  this.plainMsg = param;
45
44
  this.invokeType = param === null || param === void 0 ? void 0 : param.invokeType;
46
- this.moduleId = param === null || param === void 0 ? void 0 : param.moduleId;
47
45
  this.callback = callback;
48
46
  // this.result = new Promise(
49
47
  // function (resolve, reject) {
@@ -72,25 +70,12 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
72
70
  this.invokeAPIInWebview = function (payload) {
73
71
  window.sendToHost(payload);
74
72
  };
75
- this.invokeAPIInModuleFederation = function (payload) {
76
- window.remoteSendToHost(payload);
77
- };
78
73
  this.invokeAPI = function (method, param, callback) {
79
- var genPostMsg;
80
- if (_this2.invokeType === 'moduleFederation') {
81
- param.invokeType = _this2.invokeType;
82
- param.moduleId = _this2.moduleId;
83
- genPostMsg = new GenPostMsg(method, param, callback);
84
- var payload = (0, _stringify["default"])(genPostMsg.getPayload());
85
- _this2.invokeAPIInModuleFederation(payload);
86
- } else {
87
- genPostMsg = new GenPostMsg(method, param, callback);
88
- var _payload = (0, _stringify["default"])(genPostMsg.getPayload());
89
- var _param$invokeType = param.invokeType,
90
- invokeType = _param$invokeType === void 0 ? '' : _param$invokeType;
91
- invokeType === 'browserView' ? _this2.invokeAPIInBrowserView(_payload) : _this2.invokeAPIInWebview(_payload);
92
- }
93
- // 调用时传入 moduleId
74
+ var genPostMsg = new GenPostMsg(method, param, callback);
75
+ var payload = (0, _stringify["default"])(genPostMsg.getPayload());
76
+ var _param$invokeType = param.invokeType,
77
+ invokeType = _param$invokeType === void 0 ? '' : _param$invokeType;
78
+ invokeType === 'browserView' ? _this2.invokeAPIInBrowserView(payload) : _this2.invokeAPIInWebview(payload);
94
79
  _this2.addPending(genPostMsg);
95
80
  return genPostMsg;
96
81
  };
@@ -99,11 +84,9 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
99
84
  methodName = datas.methodName,
100
85
  eventName = datas.eventName,
101
86
  msgId = datas.msgId,
102
- _datas$data = datas.data,
103
- data = _datas$data === void 0 ? {} : _datas$data,
87
+ data = datas.data,
104
88
  code = datas.code,
105
- message = datas.message,
106
- msg = datas.msg;
89
+ message = datas.message;
107
90
  if (type === 'request') {
108
91
  // 壳子的调用
109
92
  switch (methodName) {
@@ -153,19 +136,12 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
153
136
  pending && pending.receiveResponse({
154
137
  data: data,
155
138
  code: code,
156
- message: message || msg || data.msg || data.message
139
+ message: message
157
140
  });
158
141
  code != -3 && _this2.deletePending(msgId);
159
142
  }
160
143
  };
161
144
  this.init = function () {
162
- var _a;
163
- if (_this2.invokeType === 'moduleFederation') {
164
- (_a = window.remoteReceiveFromHost) === null || _a === void 0 ? void 0 : _a.call(window, function (response) {
165
- _this2.handleCallback(response);
166
- }, _this2.moduleId);
167
- return;
168
- }
169
145
  window.addEventListener('message', function (msg) {
170
146
  (0, _utils.log)('electron res: ', msg);
171
147
  _this2.handleCallback(msg.data || {});
@@ -175,8 +151,7 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
175
151
  });
176
152
  };
177
153
  this.pendingMsgs = {};
178
- this.invokeType = window.remoteSendToHost && window.remoteReceiveFromHost && process ? 'moduleFederation' : '';
179
- this.moduleId = Math.random().toString(36).substring(2, 15);
180
154
  });
181
155
  var frame = new Frame();
182
- var _default = exports["default"] = frame;
156
+ var _default = frame;
157
+ exports["default"] = _default;
package/libs/lib/index.js CHANGED
@@ -42,7 +42,8 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
42
42
  };
43
43
  var env = (0, _utils.getENV)();
44
44
  var platform = env.platform;
45
- var yachSdk = exports.yachSdk = new _sdk["default"](env);
45
+ var yachSdk = new _sdk["default"](env);
46
+ exports.yachSdk = yachSdk;
46
47
  function initSdk() {
47
48
  var _this = this;
48
49
  var bridgeInit;
@@ -78,7 +78,7 @@ var Sdk = /*#__PURE__*/function () {
78
78
  }
79
79
  };
80
80
  }
81
- return (0, _createClass2["default"])(Sdk, [{
81
+ (0, _createClass2["default"])(Sdk, [{
82
82
  key: "setAPI",
83
83
  value: function setAPI(method, config) {
84
84
  this.invokeAPIConfigMapByMethod[method] = config;
@@ -150,20 +150,10 @@ var Sdk = /*#__PURE__*/function () {
150
150
  }
151
151
  // 主方法
152
152
  this.bridgeInitFn().then(function (fn) {
153
- fn(method, p).then(function (res) {
153
+ fn(method, p).then(function () {
154
154
  // 调用成功
155
- (0, _utils.log)("SDK \u8FD4\u56DE\u7ED3\u679C\u6210\u529F ", {
156
- method: method,
157
- params: p,
158
- result: res
159
- });
160
155
  })["catch"](function (error) {
161
156
  // 调用失败
162
- (0, _utils.log)("SDK \u8FD4\u56DE\u7ED3\u679C\u5931\u8D25", {
163
- method: method,
164
- params: p,
165
- error: error
166
- });
167
157
  });
168
158
  })["catch"](function (err) {
169
159
  console.log('wenai err', err);
@@ -173,5 +163,7 @@ var Sdk = /*#__PURE__*/function () {
173
163
  this._onFail(method, '-1', (0, _concat["default"])(_context2 = "[".concat(method, "] method do not support the current platform (")).call(_context2, this.env.platform, ")"), params.onFail);
174
164
  }
175
165
  }]);
166
+ return Sdk;
176
167
  }();
177
- var _default = exports["default"] = Sdk;
168
+ var _default = Sdk;
169
+ exports["default"] = _default;
@@ -17,7 +17,6 @@ export interface PlatformV2Props {
17
17
  inPC: boolean;
18
18
  inIpad: boolean;
19
19
  inIPhone: boolean;
20
- inHarmonyNext: boolean;
21
20
  }
22
21
  export interface IENV {
23
22
  /** current platform (ios or android or pc or notInYach) */
@@ -27,7 +26,6 @@ export interface IENV {
27
26
  /** @deprecated recommend use navigator.language to get current language */
28
27
  language?: string;
29
28
  platformV2: PlatformV2Props;
30
- env: 'test' | 'online';
31
29
  }
32
30
  export interface IInvokeAPIConfigMap {
33
31
  [platform: string]: IAPIConfig | undefined;
@@ -6,6 +6,7 @@ _Object$defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.ENV_ENUM = void 0;
8
8
  var ENV_ENUM;
9
+ exports.ENV_ENUM = ENV_ENUM;
9
10
  (function (ENV_ENUM) {
10
11
  ENV_ENUM["pc"] = "pc";
11
12
  ENV_ENUM["android"] = "android";
@@ -19,7 +19,7 @@ var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/in
19
19
  * @param v2 - Second version to compare
20
20
  * @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
21
  */
22
- var compareVersions = exports.compareVersions = function compareVersions(v1, v2) {
22
+ var compareVersions = function compareVersions(v1, v2) {
23
23
  // validate input and split into segments
24
24
  var n1 = validateAndParse(v1);
25
25
  var n2 = validateAndParse(v2);
@@ -50,7 +50,8 @@ var compareVersions = exports.compareVersions = function compareVersions(v1, v2)
50
50
  * validate('foo'); // return false
51
51
  * ```
52
52
  */
53
- var validate = exports.validate = function validate(version) {
53
+ exports.compareVersions = compareVersions;
54
+ var validate = function validate(version) {
54
55
  return typeof version === 'string' && /^[v\d]/.test(version) && semver.test(version);
55
56
  };
56
57
  /**
@@ -70,7 +71,8 @@ var validate = exports.validate = function validate(version) {
70
71
  * compare('10.1.1', '10.2.2', '>='); // return false
71
72
  * ```
72
73
  */
73
- var compare = exports.compare = function compare(v1, v2, operator) {
74
+ exports.validate = validate;
75
+ var compare = function compare(v1, v2, operator) {
74
76
  var _context;
75
77
  // validate input operator
76
78
  assertValidOperator(operator);
@@ -92,7 +94,8 @@ var compare = exports.compare = function compare(v1, v2, operator) {
92
94
  * satisfies('1.1.0', '~1.0.0'); // return false
93
95
  * ```
94
96
  */
95
- var satisfies = exports.satisfies = function satisfies(version, range) {
97
+ exports.compare = compare;
98
+ var satisfies = function satisfies(version, range) {
96
99
  // if no range operator then "="
97
100
  var m = range.match(/^([<>=~^]+)/);
98
101
  var op = m ? m[1] : '=';
@@ -116,6 +119,7 @@ var satisfies = exports.satisfies = function satisfies(version, range) {
116
119
  if (compareStrings(v2, r2) !== 0) return false;
117
120
  return compareStrings(v3, r3) >= 0;
118
121
  };
122
+ exports.satisfies = satisfies;
119
123
  var semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
120
124
  var validateAndParse = function validateAndParse(version) {
121
125
  if (typeof version !== 'string') {
@@ -1,4 +1,4 @@
1
1
  declare function log(...args: any): any;
2
2
  declare function error(...args: any): any;
3
3
  declare function warn(...args: any): any;
4
- export { log, error, warn };
4
+ export { log, error, warn, };
@@ -16,10 +16,10 @@ var myconsole = {
16
16
  warn: function warn() {},
17
17
  error: function error() {}
18
18
  };
19
- if (typeof window !== 'undefined' && window.console) {
19
+ if (window && window.console) {
20
20
  myconsole = window.console;
21
21
  }
22
- if (typeof document !== 'undefined' && document.body) {
22
+ if (document && document.body) {
23
23
  var iframe = document.createElement('iframe');
24
24
  if (iframe && iframe.contentWindow && iframe.contentWindow.console) {
25
25
  iframe.style.display = 'none';
package/libs/utils/env.js CHANGED
@@ -16,9 +16,7 @@ function getENV() {
16
16
  inAndroid = /Android/i.test(ua) && inYach,
17
17
  inPC = /YachPc/i.test(ua),
18
18
  inIpad = /iPad/i.test(ua) && inYach,
19
- inIPhone = /iPhone/i.test(ua) && inYach,
20
- isTest = /Yachtest/.test(ua) && inYach,
21
- inHarmonyNext = /HarmonyOSNext/i.test(ua) && inYach;
19
+ inIPhone = /iPhone/i.test(ua) && inYach;
22
20
  // platform
23
21
  var platform = _sdk.ENV_ENUM.notInYach;
24
22
  if (inIOS) {
@@ -43,11 +41,9 @@ function getENV() {
43
41
  inAndroid: inAndroid,
44
42
  inPC: inPC,
45
43
  inIpad: inIpad,
46
- inIPhone: inIPhone,
47
- inHarmonyNext: inHarmonyNext
44
+ inIPhone: inIPhone
48
45
  },
49
46
  version: version,
50
- language: language,
51
- env: isTest ? 'test' : 'online'
47
+ language: language
52
48
  };
53
49
  }
@@ -36,7 +36,7 @@ var _env = require("./env");
36
36
  var _bpitLog = _interopRequireDefault(require("./bpitLog"));
37
37
  var _console = require("./console");
38
38
  function staticsLog(config) {
39
- var env = (0, _env.getENV)().env;
39
+ var env = 'test';
40
40
  var version = (0, _env.getENV)().version;
41
41
  var timestamp = (0, _now["default"])();
42
42
  var params = (0, _assign["default"])({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yach.open.jssdk",
3
- "version": "4.4.9",
3
+ "version": "4.4.10-beta.2",
4
4
  "description": "",
5
5
  "module": "./es/index.js",
6
6
  "main": "./libs/index.js",
@@ -15,6 +15,8 @@
15
15
  "build": "node ./tools/run compile",
16
16
  "lint": "eslint 'src/**/*.{js,ts}'",
17
17
  "lint-fix": "eslint --fix 'src/**/*.{js,ts}'",
18
+ "async": "npm run build && yalc push",
19
+ "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,scss,less --debug -x 'npm run async'",
18
20
  "p:beta": "npm publish --tag=beta --access public",
19
21
  "p": "npm publish"
20
22
  },