crh-jssdk 1.0.0 → 1.0.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.
@@ -80,14 +80,15 @@ exports.default = {
80
80
  */
81
81
  goBack: function () {
82
82
  return __awaiter(this, arguments, void 0, function (params) {
83
- var error_1;
84
- if (params === void 0) { params = function () { }; }
83
+ var backParams, error_1;
84
+ if (params === void 0) { params = {}; }
85
85
  return __generator(this, function (_a) {
86
86
  switch (_a.label) {
87
87
  case 0:
88
88
  _a.trys.push([0, 2, , 3]);
89
- console.log("调用goBack,参数:", params);
90
- return [4 /*yield*/, utils_1.globalBridge.bridgeCallHandler("Promise", "goback", params)];
89
+ backParams = __assign({ type: "webpage" }, params);
90
+ console.log("调用goBack,参数:", backParams);
91
+ return [4 /*yield*/, utils_1.globalBridge.bridgeCallHandler("Promise", "goback", backParams)];
91
92
  case 1:
92
93
  _a.sent();
93
94
  console.log("返回App成功");
@@ -136,10 +137,10 @@ exports.default = {
136
137
  : "".concat(safeUrl, "?timestamp=").concat(timestamp);
137
138
  console.log('pinurl', pinurl);
138
139
  if (utils_1.ios) {
139
- location.href = "client://hxsecurity.frame.router/browser?url=".concat(encodeURIComponent(pinurl), "&rp_flag_push_to_stack_directly=true&rp_flag_back_to_last_tab=true&rp_flag_finish_when_back_to_last_tab=true&hideNavBar=1&isHiddenNavigationBar=1");
140
+ location.href = "client://hxsecurity.frame.router/browser?url=".concat(encodeURIComponent(pinurl), "&rp_flag_push_to_stack_directly=true&rp_flag_back_to_last_tab=true&rp_flag_finish_when_back_to_last_tab=true&hideNavBar=1&isHiddenNavigationBar=1&physicKey=1");
140
141
  }
141
142
  else {
142
- location.href = "client://hxsecurity.frame.router/browser?url=".concat(encodeURIComponent(pinurl), "&rp_flag_recreate=true&rp_flag_push_to_stack_directly=true&rp_flag_finish_when_back_to_last_tab=true&hideNavBar=1&isHiddenNavigationBar=1&fontzoom=no");
143
+ location.href = "client://hxsecurity.frame.router/quote_browser?url=".concat(encodeURIComponent(pinurl), "&rp_flag_recreate=true&rp_flag_push_to_stack_directly=true&rp_flag_finish_when_back_to_last_tab=true&hideNavBar=1&isHiddenNavigationBar=1&physicKey=1");
143
144
  }
144
145
  },
145
146
  /**
@@ -246,6 +247,34 @@ exports.default = {
246
247
  console.error("拦截返回键失败:", error);
247
248
  }
248
249
  },
250
+ /**
251
+ * 注册APP物理返回键拦截监听器
252
+ * @param callback 回调函数,当用户点击物理返回键时触发
253
+ * @description 通过registerHandler注册物理返回键的拦截事件,适用于Android/iOS/HarmonyOS等使用WebViewJavascriptBridge的环境
254
+ * @example
255
+ * ```javascript
256
+ * // 使用示例
257
+ * jssdk.registerPhysicalReturnListener(() => {
258
+ * console.log('用户点击了物理返回键');
259
+ * // 可以在这里自定义返回逻辑
260
+ * });
261
+ * ```
262
+ */
263
+ registerPhysicalReturnListener: function (callback) {
264
+ try {
265
+ console.log('注册物理返回键拦截监听器');
266
+ utils_1.globalBridge.registerHandler('clientPhysicalReturn', function (data) {
267
+ console.log('收到物理返回键事件:', data);
268
+ if (typeof callback === 'function') {
269
+ callback();
270
+ }
271
+ });
272
+ console.log('物理返回键拦截监听器注册成功');
273
+ }
274
+ catch (error) {
275
+ console.error('注册物理返回键拦截监听器失败:', error);
276
+ }
277
+ },
249
278
  /**
250
279
  * 跳转个股详情页
251
280
  */
@@ -188,6 +188,13 @@ var BUSINESS = /** @class */ (function () {
188
188
  }
189
189
  return this.sdkObj.interceptBack(fn);
190
190
  };
191
+ //注册APP物理返回键拦截监听器 --- 仅限联储证券
192
+ BUSINESS.prototype.registerPhysicalReturnListener = function (callback) {
193
+ if (!this.sdkObj.registerPhysicalReturnListener) {
194
+ return (0, utils_1.empty)("registerPhysicalReturnListener");
195
+ }
196
+ return this.sdkObj.registerPhysicalReturnListener(callback);
197
+ };
191
198
  //关闭页面
192
199
  BUSINESS.prototype.closeSJKH = function () {
193
200
  if (!this.sdkObj.closeSJKH) {
@@ -194,7 +194,7 @@ var Bridge = /** @class */ (function () {
194
194
  /**
195
195
  * 注册方法给App调用
196
196
  * @param name 方法名
197
- * @param callback 回调函数
197
+ * @param callback 回调函数,第二个参数responseCallback用于向App发送响应
198
198
  */
199
199
  Bridge.prototype.registerHandler = function (name, callback) {
200
200
  var _this = this;
@@ -204,8 +204,7 @@ var Bridge = /** @class */ (function () {
204
204
  var useBridge_3 = function (bridge) {
205
205
  if (bridge && typeof bridge.registerHandler === 'function') {
206
206
  bridge.registerHandler(name, function (data, responseCallback) {
207
- callback(data);
208
- responseCallback(data);
207
+ callback(data, responseCallback);
209
208
  });
210
209
  }
211
210
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crh-jssdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "crh-jssdk",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {