@onekeyfe/hd-web-sdk 0.0.5 → 0.0.6

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.
@@ -14069,7 +14069,9 @@ const UI_REQUEST$1 = {
14069
14069
  REQUEST_PIN: 'ui-request_pin',
14070
14070
  INVALID_PIN: 'ui-invalid_pin',
14071
14071
  REQUEST_BUTTON: 'ui-button',
14072
- CLOSE_UI_WINDOW: 'ui-close_window'
14072
+ CLOSE_UI_WINDOW: 'ui-close_window',
14073
+ BLUETOOTH_PERMISSION: 'ui-bluetooth_permission',
14074
+ LOCATION_PERMISSION: 'ui-location_permission'
14073
14075
  };
14074
14076
 
14075
14077
  const createUiMessage = (type, payload) => ({
@@ -17303,7 +17305,7 @@ let _uiPromises = [];
17303
17305
  let _callPromise;
17304
17306
 
17305
17307
  const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
17306
- var _a;
17308
+ var _a, _b;
17307
17309
 
17308
17310
  if (!message.id || !message.payload || message.type !== IFRAME.CALL) {
17309
17311
  return Promise.reject(TypedError('Method_InvalidParameter', 'onCall: message.id or message.payload is missing'));
@@ -17325,7 +17327,10 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
17325
17327
  const response = yield method.run();
17326
17328
  return createResponseMessage(method.responseID, true, response);
17327
17329
  } catch (error) {
17328
- return createResponseMessage(method.responseID, false, error);
17330
+ return createResponseMessage(method.responseID, false, {
17331
+ code: error.code,
17332
+ error: (_a = error.message) !== null && _a !== void 0 ? _a : error
17333
+ });
17329
17334
  }
17330
17335
  }
17331
17336
 
@@ -17349,7 +17354,7 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
17349
17354
  }
17350
17355
 
17351
17356
  Log.debug('Call API - setDevice: ', device);
17352
- (_a = method.setDevice) === null || _a === void 0 ? void 0 : _a.call(method, device);
17357
+ (_b = method.setDevice) === null || _b === void 0 ? void 0 : _b.call(method, device);
17353
17358
  device.on(DEVICE.PIN, onDevicePinHandler);
17354
17359
  device.on(DEVICE.BUTTON, (d, code) => {
17355
17360
  onDeviceButtonHandler(d, code);
@@ -17384,7 +17389,13 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
17384
17389
  const deviceRun = () => device.run(inner);
17385
17390
 
17386
17391
  _callPromise = create(deviceRun);
17387
- return yield _callPromise.promise;
17392
+
17393
+ try {
17394
+ return yield _callPromise.promise;
17395
+ } catch (e) {
17396
+ console.log('Device Run Error: ', e);
17397
+ return createResponseMessage(method.responseID, false, e.message);
17398
+ }
17388
17399
  } catch (error) {
17389
17400
  messageResponse = createResponseMessage(method.responseID, false, error);
17390
17401
  _callPromise === null || _callPromise === void 0 ? void 0 : _callPromise.reject(TypedError('Call_API', error));
@@ -17525,6 +17536,13 @@ class Core extends events.exports {
17525
17536
  break;
17526
17537
  }
17527
17538
 
17539
+ case UI_REQUEST$1.BLUETOOTH_PERMISSION:
17540
+ case UI_REQUEST$1.LOCATION_PERMISSION:
17541
+ {
17542
+ postMessage(message);
17543
+ break;
17544
+ }
17545
+
17528
17546
  case IFRAME.CALL:
17529
17547
  {
17530
17548
  const response = yield callAPI(message);
@@ -17559,7 +17577,7 @@ const init = (settings, Transport) => __awaiter(void 0, void 0, void 0, function
17559
17577
  try {
17560
17578
  yield DataManager.load(settings);
17561
17579
  initTransport(Transport);
17562
- } catch (_b) {
17580
+ } catch (_c) {
17563
17581
  Log.error('DataManager.load error');
17564
17582
  }
17565
17583