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

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 (119) hide show
  1. package/dist/yach_jssdk_4.4.10-beta.3.js +1 -0
  2. package/es/api/biz/navigation/close.d.ts +1 -0
  3. package/es/api/biz/navigation/tencentMeeting.d.ts +1 -0
  4. package/es/api/biz/util/addAppToNav.d.ts +9 -0
  5. package/es/api/biz/util/addAppToNav.js +23 -0
  6. package/es/api/biz/util/copy.d.ts +11 -0
  7. package/es/api/biz/util/copy.js +19 -0
  8. package/es/api/biz/util/focus.d.ts +7 -0
  9. package/es/api/biz/util/focus.js +23 -0
  10. package/es/api/biz/util/getConfig.d.ts +13 -0
  11. package/es/api/biz/util/getConfig.js +19 -0
  12. package/es/api/biz/util/knowledgeBaseSelect.d.ts +21 -0
  13. package/es/api/biz/util/knowledgeBaseSelect.js +23 -0
  14. package/es/api/biz/util/knowledgeSelectParams.d.ts +14 -0
  15. package/es/api/biz/util/knowledgeSelectParams.js +19 -0
  16. package/es/api/biz/util/lorebaseRefreshNodeWebview.d.ts +11 -0
  17. package/es/api/biz/util/lorebaseRefreshNodeWebview.js +19 -0
  18. package/es/api/biz/util/lorebaseShowList.d.ts +11 -0
  19. package/es/api/biz/util/lorebaseShowList.js +19 -0
  20. package/es/api/biz/util/mediaFileUploadV2.d.ts +26 -0
  21. package/es/api/biz/util/mediaFileUploadV2.js +15 -0
  22. package/es/api/biz/util/openAudioPlayer.d.ts +17 -0
  23. package/es/api/biz/util/openAudioPlayer.js +23 -0
  24. package/es/api/biz/util/openFutureGroup.d.ts +10 -0
  25. package/es/api/biz/util/openFutureGroup.js +23 -0
  26. package/es/api/biz/util/openMediaFileDialogV2.d.ts +23 -0
  27. package/es/api/biz/util/openMediaFileDialogV2.js +16 -0
  28. package/es/api/biz/util/openPublish.d.ts +22 -0
  29. package/es/api/biz/util/openPublish.js +15 -0
  30. package/es/api/biz/util/screen.d.ts +15 -0
  31. package/es/api/biz/util/screen.js +15 -0
  32. package/es/api/biz/util/topicEvent.d.ts +13 -0
  33. package/es/api/biz/util/topicEvent.js +27 -0
  34. package/es/api/biz/util/weeklyRead.d.ts +5 -0
  35. package/es/api/biz/util/weeklyRead.js +23 -0
  36. package/es/api/device/connection/startNetworkChangeWatch.d.ts +8 -0
  37. package/es/api/device/connection/startNetworkChangeWatch.js +23 -0
  38. package/es/api/device/notification/actionSheet.d.ts +6 -0
  39. package/es/api/device/notification/hidePreloader.d.ts +6 -1
  40. package/es/api/device/notification/hidePreloader.js +15 -2
  41. package/es/api/device/notification/showPreloader.d.ts +10 -1
  42. package/es/api/device/notification/showPreloader.js +15 -2
  43. package/es/api/primary/updateTab.d.ts +9 -0
  44. package/es/api/primary/updateTab.js +15 -0
  45. package/es/index.d.ts +41 -3
  46. package/es/index.js +44 -5
  47. package/es/lib/bridge/mobile.js +61 -20
  48. package/es/lib/bridge/pc.js +50 -8
  49. package/es/lib/helper/pcIframe.d.ts +8 -25
  50. package/es/lib/helper/pcIframe.js +34 -8
  51. package/es/lib/index.js +2 -2
  52. package/es/lib/sdk/index.js +13 -4
  53. package/es/lib/sdk/sdk.typings.d.ts +2 -0
  54. package/es/utils/console.d.ts +1 -1
  55. package/es/utils/console.js +2 -2
  56. package/es/utils/env.js +7 -3
  57. package/es/utils/index.js +1 -1
  58. package/libs/api/biz/navigation/close.d.ts +1 -0
  59. package/libs/api/biz/navigation/tencentMeeting.d.ts +1 -0
  60. package/libs/api/biz/util/addAppToNav.d.ts +9 -0
  61. package/libs/api/biz/util/addAppToNav.js +30 -0
  62. package/libs/api/biz/util/copy.d.ts +11 -0
  63. package/libs/api/biz/util/copy.js +26 -0
  64. package/libs/api/biz/util/focus.d.ts +7 -0
  65. package/libs/api/biz/util/focus.js +30 -0
  66. package/libs/api/biz/util/getConfig.d.ts +13 -0
  67. package/libs/api/biz/util/getConfig.js +26 -0
  68. package/libs/api/biz/util/knowledgeBaseSelect.d.ts +21 -0
  69. package/libs/api/biz/util/knowledgeBaseSelect.js +30 -0
  70. package/libs/api/biz/util/knowledgeSelectParams.d.ts +14 -0
  71. package/libs/api/biz/util/knowledgeSelectParams.js +26 -0
  72. package/libs/api/biz/util/lorebaseRefreshNodeWebview.d.ts +11 -0
  73. package/libs/api/biz/util/lorebaseRefreshNodeWebview.js +26 -0
  74. package/libs/api/biz/util/lorebaseShowList.d.ts +11 -0
  75. package/libs/api/biz/util/lorebaseShowList.js +26 -0
  76. package/libs/api/biz/util/mediaFileUploadV2.d.ts +26 -0
  77. package/libs/api/biz/util/mediaFileUploadV2.js +23 -0
  78. package/libs/api/biz/util/openAudioPlayer.d.ts +17 -0
  79. package/libs/api/biz/util/openAudioPlayer.js +30 -0
  80. package/libs/api/biz/util/openFutureGroup.d.ts +10 -0
  81. package/libs/api/biz/util/openFutureGroup.js +30 -0
  82. package/libs/api/biz/util/openMediaFileDialogV2.d.ts +23 -0
  83. package/libs/api/biz/util/openMediaFileDialogV2.js +24 -0
  84. package/libs/api/biz/util/openPublish.d.ts +22 -0
  85. package/libs/api/biz/util/openPublish.js +22 -0
  86. package/libs/api/biz/util/screen.d.ts +15 -0
  87. package/libs/api/biz/util/screen.js +22 -0
  88. package/libs/api/biz/util/topicEvent.d.ts +13 -0
  89. package/libs/api/biz/util/topicEvent.js +34 -0
  90. package/libs/api/biz/util/weeklyRead.d.ts +5 -0
  91. package/libs/api/biz/util/weeklyRead.js +30 -0
  92. package/libs/api/device/connection/startNetworkChangeWatch.d.ts +8 -0
  93. package/libs/api/device/connection/startNetworkChangeWatch.js +30 -0
  94. package/libs/api/device/notification/actionSheet.d.ts +6 -0
  95. package/libs/api/device/notification/hidePreloader.d.ts +6 -1
  96. package/libs/api/device/notification/hidePreloader.js +15 -1
  97. package/libs/api/device/notification/showPreloader.d.ts +10 -1
  98. package/libs/api/device/notification/showPreloader.js +15 -1
  99. package/libs/api/initAPI.js +1 -2
  100. package/libs/api/primary/updateTab.d.ts +9 -0
  101. package/libs/api/primary/updateTab.js +22 -0
  102. package/libs/index.d.ts +41 -3
  103. package/libs/index.js +186 -25
  104. package/libs/lib/bridge/mobile.js +64 -25
  105. package/libs/lib/bridge/pc.js +53 -13
  106. package/libs/lib/helper/event.js +1 -2
  107. package/libs/lib/helper/pcIframe.d.ts +8 -25
  108. package/libs/lib/helper/pcIframe.js +35 -10
  109. package/libs/lib/index.js +3 -4
  110. package/libs/lib/sdk/index.js +13 -5
  111. package/libs/lib/sdk/sdk.typings.d.ts +2 -0
  112. package/libs/lib/sdk/sdk.typings.js +0 -1
  113. package/libs/utils/compareVersions.js +4 -8
  114. package/libs/utils/console.d.ts +1 -1
  115. package/libs/utils/console.js +2 -2
  116. package/libs/utils/env.js +7 -3
  117. package/libs/utils/index.js +1 -1
  118. package/package.json +1 -3
  119. package/dist/yach_jssdk_4.3.3.js +0 -1
@@ -10,6 +10,7 @@ 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"));
13
14
  var _event = _interopRequireDefault(require("../helper/event"));
14
15
  var _codeMap = require("../helper/codeMap");
15
16
  var _utils = require("../../utils");
@@ -32,7 +33,7 @@ function setupWebViewJavascriptBridge(callback) {
32
33
  document.documentElement.removeChild(WVJBIframe);
33
34
  }, 0);
34
35
  }
35
- var mobileBridgeInit = function mobileBridgeInit() {
36
+ var mobileBridgeInit = exports.mobileBridgeInit = function mobileBridgeInit() {
36
37
  return new _promise["default"](function (resolve, reject) {
37
38
  setupWebViewJavascriptBridge(function (bridge) {
38
39
  (0, _utils.log)("\u6CE8\u518Cresume\u4E8B\u4EF6 ");
@@ -74,12 +75,21 @@ var mobileBridgeInit = function mobileBridgeInit() {
74
75
  });
75
76
  _event["default"].execEvent('sendMsgCommon', resData);
76
77
  });
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
+ });
77
88
  resolve();
78
89
  });
79
90
  });
80
91
  };
81
- exports.mobileBridgeInit = mobileBridgeInit;
82
- var mobileBridge = function mobileBridge(method, param) {
92
+ var mobileBridge = exports.mobileBridge = function mobileBridge(method, param) {
83
93
  return new _promise["default"](function (resolve, reject) {
84
94
  var p = (0, _assign["default"])({}, param);
85
95
  setupWebViewJavascriptBridge(function (bridge) {
@@ -102,26 +112,6 @@ var mobileBridge = function mobileBridge(method, param) {
102
112
  data = e.data;
103
113
  var _code = (0, _parseInt2["default"])(code);
104
114
  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
-
125
115
  var callbackFun = p[callbackStr];
126
116
  (0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
127
117
  method: method,
@@ -131,6 +121,27 @@ var mobileBridge = function mobileBridge(method, param) {
131
121
  message: message,
132
122
  callbackFun: callbackFun
133
123
  });
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
+ // 请求成功
134
145
  if ('function' === typeof callbackFun) {
135
146
  callbackFun(data || message);
136
147
  }
@@ -139,8 +150,36 @@ var mobileBridge = function mobileBridge(method, param) {
139
150
  message: message,
140
151
  data: data
141
152
  });
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});
142
182
  });
143
183
  });
144
184
  });
145
- };
146
- exports.mobileBridge = mobileBridge;
185
+ };
@@ -8,28 +8,22 @@ _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"));
11
13
  var _pcIframe = _interopRequireDefault(require("../helper/pcIframe"));
12
14
  var _codeMap = require("../helper/codeMap");
13
15
  var _utils = require("../../utils");
14
- var PcBridgeInit = function PcBridgeInit() {
16
+ var PcBridgeInit = exports.PcBridgeInit = function PcBridgeInit() {
15
17
  _pcIframe["default"].init();
16
18
  };
17
- exports.PcBridgeInit = PcBridgeInit;
18
- var pcBridge = function pcBridge(method, param) {
19
- return new _promise["default"](function (resolve) {
19
+ var pcBridge = exports.pcBridge = function pcBridge(method, param) {
20
+ return new _promise["default"](function (resolve, reject) {
20
21
  return _pcIframe["default"].invokeAPI(method, param, function (_ref) {
21
22
  var data = _ref.data,
22
23
  code = _ref.code,
23
24
  message = _ref.message;
24
25
  var _code = (0, _parseInt2["default"])(code);
25
26
  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
- }
33
27
  var callbackFun = param[callbackStr];
34
28
  (0, _utils.log)("SDK\u6267\u884C\u540E\u56DE\u8C03\uFF0C\u76F8\u5173\u53C2\u6570 ", {
35
29
  method: method,
@@ -39,6 +33,33 @@ var pcBridge = function pcBridge(method, param) {
39
33
  message: message,
40
34
  callbackFun: callbackFun
41
35
  });
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
+ // 请求成功
42
63
  if ('function' === typeof callbackFun) {
43
64
  callbackFun(data || message);
44
65
  }
@@ -47,7 +68,26 @@ var pcBridge = function pcBridge(method, param) {
47
68
  message: message,
48
69
  data: data
49
70
  });
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 });
50
91
  });
51
92
  });
52
- };
53
- exports.pcBridge = pcBridge;
93
+ };
@@ -45,5 +45,4 @@ var Event = /*#__PURE__*/(0, _createClass2["default"])(function Event() {
45
45
  this.eventsHandle = {};
46
46
  });
47
47
  var event = new Event();
48
- var _default = event;
49
- exports["default"] = _default;
48
+ var _default = exports["default"] = event;
@@ -3,41 +3,24 @@ 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;
6
8
  }
7
9
  }
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
- }
10
+ declare type InvokeType = 'browserView' | 'moduleFederation' | '';
31
11
  declare class Frame {
32
12
  pendingMsgs: {};
13
+ invokeType?: InvokeType;
14
+ moduleId?: string;
33
15
  constructor();
34
16
  addPending: (e: any) => void;
35
17
  deletePending: (e: any) => void;
36
18
  getPending: (t: any) => any;
37
19
  invokeAPIInBrowserView: (payload: string) => void;
38
20
  invokeAPIInWebview: (payload: string) => void;
39
- invokeAPI: (method: string, param: any, callback: any) => GenPostMsg;
40
- handleCallback: (datas: any, invokeType?: 'browserView' | '') => void;
21
+ invokeAPIInModuleFederation: (payload: string) => void;
22
+ invokeAPI: (method: string, param: any, callback: any) => any;
23
+ handleCallback: (datas: any, invokeType?: InvokeType) => void;
41
24
  init: () => void;
42
25
  }
43
26
  declare const frame: Frame;
@@ -29,6 +29,7 @@ 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,
32
33
  body: _this.plainMsg,
33
34
  type: 'request',
34
35
  invokeType: _this.invokeType
@@ -42,6 +43,7 @@ var GenPostMsg = /*#__PURE__*/(0, _createClass2["default"])(function GenPostMsg(
42
43
  this.methodName = method;
43
44
  this.plainMsg = param;
44
45
  this.invokeType = param === null || param === void 0 ? void 0 : param.invokeType;
46
+ this.moduleId = param === null || param === void 0 ? void 0 : param.moduleId;
45
47
  this.callback = callback;
46
48
  // this.result = new Promise(
47
49
  // function (resolve, reject) {
@@ -70,12 +72,25 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
70
72
  this.invokeAPIInWebview = function (payload) {
71
73
  window.sendToHost(payload);
72
74
  };
75
+ this.invokeAPIInModuleFederation = function (payload) {
76
+ window.remoteSendToHost(payload);
77
+ };
73
78
  this.invokeAPI = function (method, param, callback) {
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);
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
79
94
  _this2.addPending(genPostMsg);
80
95
  return genPostMsg;
81
96
  };
@@ -84,9 +99,11 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
84
99
  methodName = datas.methodName,
85
100
  eventName = datas.eventName,
86
101
  msgId = datas.msgId,
87
- data = datas.data,
102
+ _datas$data = datas.data,
103
+ data = _datas$data === void 0 ? {} : _datas$data,
88
104
  code = datas.code,
89
- message = datas.message;
105
+ message = datas.message,
106
+ msg = datas.msg;
90
107
  if (type === 'request') {
91
108
  // 壳子的调用
92
109
  switch (methodName) {
@@ -136,12 +153,19 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
136
153
  pending && pending.receiveResponse({
137
154
  data: data,
138
155
  code: code,
139
- message: message
156
+ message: message || msg || data.msg || data.message
140
157
  });
141
158
  code != -3 && _this2.deletePending(msgId);
142
159
  }
143
160
  };
144
161
  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
+ }
145
169
  window.addEventListener('message', function (msg) {
146
170
  (0, _utils.log)('electron res: ', msg);
147
171
  _this2.handleCallback(msg.data || {});
@@ -151,7 +175,8 @@ var Frame = /*#__PURE__*/(0, _createClass2["default"])(function Frame() {
151
175
  });
152
176
  };
153
177
  this.pendingMsgs = {};
178
+ this.invokeType = window.remoteSendToHost && window.remoteReceiveFromHost && process ? 'moduleFederation' : '';
179
+ this.moduleId = Math.random().toString(36).substring(2, 15);
154
180
  });
155
181
  var frame = new Frame();
156
- var _default = frame;
157
- exports["default"] = _default;
182
+ var _default = exports["default"] = frame;
package/libs/lib/index.js CHANGED
@@ -42,20 +42,19 @@ 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 = new _sdk["default"](env);
46
- exports.yachSdk = yachSdk;
45
+ var yachSdk = exports.yachSdk = new _sdk["default"](env);
47
46
  function initSdk() {
48
47
  var _this = this;
49
48
  var bridgeInit;
50
49
  if (platform === 'pc') {
51
50
  bridgeInit = function bridgeInit() {
52
51
  return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee() {
53
- return _regenerator["default"].wrap(function _callee$(_context) {
52
+ return _regenerator["default"].wrap(function (_context) {
54
53
  while (1) switch (_context.prev = _context.next) {
55
54
  case 0:
56
55
  (0, _bridge.PcBridgeInit)();
57
56
  return _context.abrupt("return", _bridge.pcBridge);
58
- case 2:
57
+ case 1:
59
58
  case "end":
60
59
  return _context.stop();
61
60
  }
@@ -78,7 +78,7 @@ var Sdk = /*#__PURE__*/function () {
78
78
  }
79
79
  };
80
80
  }
81
- (0, _createClass2["default"])(Sdk, [{
81
+ return (0, _createClass2["default"])(Sdk, [{
82
82
  key: "setAPI",
83
83
  value: function setAPI(method, config) {
84
84
  this.invokeAPIConfigMapByMethod[method] = config;
@@ -150,10 +150,20 @@ var Sdk = /*#__PURE__*/function () {
150
150
  }
151
151
  // 主方法
152
152
  this.bridgeInitFn().then(function (fn) {
153
- fn(method, p).then(function () {
153
+ fn(method, p).then(function (res) {
154
154
  // 调用成功
155
+ (0, _utils.log)("SDK \u8FD4\u56DE\u7ED3\u679C\u6210\u529F ", {
156
+ method: method,
157
+ params: p,
158
+ result: res
159
+ });
155
160
  })["catch"](function (error) {
156
161
  // 调用失败
162
+ (0, _utils.log)("SDK \u8FD4\u56DE\u7ED3\u679C\u5931\u8D25", {
163
+ method: method,
164
+ params: p,
165
+ error: error
166
+ });
157
167
  });
158
168
  })["catch"](function (err) {
159
169
  console.log('wenai err', err);
@@ -163,7 +173,5 @@ var Sdk = /*#__PURE__*/function () {
163
173
  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
174
  }
165
175
  }]);
166
- return Sdk;
167
176
  }();
168
- var _default = Sdk;
169
- exports["default"] = _default;
177
+ var _default = exports["default"] = Sdk;
@@ -17,6 +17,7 @@ export interface PlatformV2Props {
17
17
  inPC: boolean;
18
18
  inIpad: boolean;
19
19
  inIPhone: boolean;
20
+ inHarmonyNext: boolean;
20
21
  }
21
22
  export interface IENV {
22
23
  /** current platform (ios or android or pc or notInYach) */
@@ -26,6 +27,7 @@ export interface IENV {
26
27
  /** @deprecated recommend use navigator.language to get current language */
27
28
  language?: string;
28
29
  platformV2: PlatformV2Props;
30
+ env: 'test' | 'online';
29
31
  }
30
32
  export interface IInvokeAPIConfigMap {
31
33
  [platform: string]: IAPIConfig | undefined;
@@ -6,7 +6,6 @@ _Object$defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.ENV_ENUM = void 0;
8
8
  var ENV_ENUM;
9
- exports.ENV_ENUM = ENV_ENUM;
10
9
  (function (ENV_ENUM) {
11
10
  ENV_ENUM["pc"] = "pc";
12
11
  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 = function compareVersions(v1, v2) {
22
+ var compareVersions = exports.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,8 +50,7 @@ var compareVersions = function compareVersions(v1, v2) {
50
50
  * validate('foo'); // return false
51
51
  * ```
52
52
  */
53
- exports.compareVersions = compareVersions;
54
- var validate = function validate(version) {
53
+ var validate = exports.validate = function validate(version) {
55
54
  return typeof version === 'string' && /^[v\d]/.test(version) && semver.test(version);
56
55
  };
57
56
  /**
@@ -71,8 +70,7 @@ var validate = function validate(version) {
71
70
  * compare('10.1.1', '10.2.2', '>='); // return false
72
71
  * ```
73
72
  */
74
- exports.validate = validate;
75
- var compare = function compare(v1, v2, operator) {
73
+ var compare = exports.compare = function compare(v1, v2, operator) {
76
74
  var _context;
77
75
  // validate input operator
78
76
  assertValidOperator(operator);
@@ -94,8 +92,7 @@ var compare = function compare(v1, v2, operator) {
94
92
  * satisfies('1.1.0', '~1.0.0'); // return false
95
93
  * ```
96
94
  */
97
- exports.compare = compare;
98
- var satisfies = function satisfies(version, range) {
95
+ var satisfies = exports.satisfies = function satisfies(version, range) {
99
96
  // if no range operator then "="
100
97
  var m = range.match(/^([<>=~^]+)/);
101
98
  var op = m ? m[1] : '=';
@@ -119,7 +116,6 @@ var satisfies = function satisfies(version, range) {
119
116
  if (compareStrings(v2, r2) !== 0) return false;
120
117
  return compareStrings(v3, r3) >= 0;
121
118
  };
122
- exports.satisfies = satisfies;
123
119
  var semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
124
120
  var validateAndParse = function validateAndParse(version) {
125
121
  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 (window && window.console) {
19
+ if (typeof window !== 'undefined' && window.console) {
20
20
  myconsole = window.console;
21
21
  }
22
- if (document && document.body) {
22
+ if (typeof document !== 'undefined' && 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,7 +16,9 @@ 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;
19
+ inIPhone = /iPhone/i.test(ua) && inYach,
20
+ isTest = /Yachtest/.test(ua) && inYach,
21
+ inHarmonyNext = /HarmonyOSNext/i.test(ua) && inYach;
20
22
  // platform
21
23
  var platform = _sdk.ENV_ENUM.notInYach;
22
24
  if (inIOS) {
@@ -41,9 +43,11 @@ function getENV() {
41
43
  inAndroid: inAndroid,
42
44
  inPC: inPC,
43
45
  inIpad: inIpad,
44
- inIPhone: inIPhone
46
+ inIPhone: inIPhone,
47
+ inHarmonyNext: inHarmonyNext
45
48
  },
46
49
  version: version,
47
- language: language
50
+ language: language,
51
+ env: isTest ? 'test' : 'online'
48
52
  };
49
53
  }
@@ -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 = 'test';
39
+ var env = (0, _env.getENV)().env;
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.10-beta.2",
3
+ "version": "4.4.10-beta.4",
4
4
  "description": "",
5
5
  "module": "./es/index.js",
6
6
  "main": "./libs/index.js",
@@ -15,8 +15,6 @@
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'",
20
18
  "p:beta": "npm publish --tag=beta --access public",
21
19
  "p": "npm publish"
22
20
  },