@onekeyfe/hd-web-sdk 0.1.0 → 0.1.3
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.
- package/build/iframe.html +1 -1
- package/build/js/iframe.435f82a3bee253ffd1d3.js +3 -0
- package/build/js/{iframe.ea300fd8da90869700fc.js.LICENSE.txt → iframe.435f82a3bee253ffd1d3.js.LICENSE.txt} +0 -0
- package/build/js/iframe.435f82a3bee253ffd1d3.js.map +1 -0
- package/build/onekey-js-sdk.js +188 -49
- package/build/onekey-js-sdk.js.map +1 -1
- package/build/onekey-js-sdk.min.js +1 -1
- package/build/onekey-js-sdk.min.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +3 -1
- package/build/js/iframe.ea300fd8da90869700fc.js +0 -3
- package/build/js/iframe.ea300fd8da90869700fc.js.map +0 -1
package/build/onekey-js-sdk.js
CHANGED
|
@@ -4782,6 +4782,7 @@ const ERROR_CODES = {
|
|
|
4782
4782
|
Device_UnexpectedMode: '',
|
|
4783
4783
|
Device_CallInProgress: '',
|
|
4784
4784
|
Device_InitializeFailed: '',
|
|
4785
|
+
Device_Interrupted: 'The device is performing other operations',
|
|
4785
4786
|
Not_Use_Onekey_Device: 'Please use onekey device',
|
|
4786
4787
|
Runtime: '',
|
|
4787
4788
|
Init_NotInitialized: 'Init_NotInitialized',
|
|
@@ -4833,7 +4834,7 @@ const colors = {
|
|
|
4833
4834
|
};
|
|
4834
4835
|
const MAX_ENTRIES = 100;
|
|
4835
4836
|
|
|
4836
|
-
class Log$
|
|
4837
|
+
class Log$6 {
|
|
4837
4838
|
constructor(prefix, enabled) {
|
|
4838
4839
|
this.prefix = prefix;
|
|
4839
4840
|
this.enabled = enabled;
|
|
@@ -4895,7 +4896,7 @@ class Log$5 {
|
|
|
4895
4896
|
const _logs = {};
|
|
4896
4897
|
|
|
4897
4898
|
const initLog = (prefix, enabled) => {
|
|
4898
|
-
const instance = new Log$
|
|
4899
|
+
const instance = new Log$6(prefix, !!enabled);
|
|
4899
4900
|
_logs[prefix] = instance;
|
|
4900
4901
|
return instance;
|
|
4901
4902
|
};
|
|
@@ -13902,6 +13903,25 @@ var MessagesJSON = {
|
|
|
13902
13903
|
nested: nested
|
|
13903
13904
|
};
|
|
13904
13905
|
|
|
13906
|
+
const getReleaseStatus = (releases, currentVersion) => {
|
|
13907
|
+
const newVersions = releases.filter(r => semver__default["default"].gt(r.version.join('.'), currentVersion));
|
|
13908
|
+
|
|
13909
|
+
if (newVersions.length === 0) {
|
|
13910
|
+
return 'valid';
|
|
13911
|
+
}
|
|
13912
|
+
|
|
13913
|
+
if (newVersions.some(r => r.required)) {
|
|
13914
|
+
return 'required';
|
|
13915
|
+
}
|
|
13916
|
+
|
|
13917
|
+
return 'outdated';
|
|
13918
|
+
};
|
|
13919
|
+
|
|
13920
|
+
const getReleaseChangelog = (releases, currentVersion) => {
|
|
13921
|
+
const newVersions = releases.filter(r => semver__default["default"].gt(r.version.join('.'), currentVersion));
|
|
13922
|
+
return newVersions.map(r => r.changelog);
|
|
13923
|
+
};
|
|
13924
|
+
|
|
13905
13925
|
var _a;
|
|
13906
13926
|
|
|
13907
13927
|
class DataManager {
|
|
@@ -13981,17 +14001,31 @@ DataManager.getFirmwareStatus = features => {
|
|
|
13981
14001
|
}
|
|
13982
14002
|
|
|
13983
14003
|
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.firmware) !== null && _c !== void 0 ? _c : [];
|
|
13984
|
-
const latestFirmware = targetDeviceConfigList[targetDeviceConfigList.length - 1];
|
|
13985
|
-
if (!latestFirmware) return 'valid';
|
|
13986
|
-
const latestVersion = latestFirmware.version.join('.');
|
|
13987
14004
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
14005
|
+
return getReleaseStatus(targetDeviceConfigList, currentVersion);
|
|
14006
|
+
};
|
|
14007
|
+
|
|
14008
|
+
DataManager.getFirmwareChangelog = features => {
|
|
14009
|
+
var _b, _c;
|
|
13988
14010
|
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
14011
|
+
const deviceType = getDeviceType(features);
|
|
14012
|
+
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
14013
|
+
|
|
14014
|
+
if (features.firmware_present === false || deviceType === 'classic' && features.bootloader_mode) {
|
|
14015
|
+
return [];
|
|
13992
14016
|
}
|
|
13993
14017
|
|
|
13994
|
-
|
|
14018
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.firmware) !== null && _c !== void 0 ? _c : [];
|
|
14019
|
+
const currentVersion = deviceFirmwareVersion.join('.');
|
|
14020
|
+
return getReleaseChangelog(targetDeviceConfigList, currentVersion);
|
|
14021
|
+
};
|
|
14022
|
+
|
|
14023
|
+
DataManager.getFirmwareLeatestRelease = features => {
|
|
14024
|
+
var _b, _c;
|
|
14025
|
+
|
|
14026
|
+
const deviceType = getDeviceType(features);
|
|
14027
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.firmware) !== null && _c !== void 0 ? _c : [];
|
|
14028
|
+
return targetDeviceConfigList[targetDeviceConfigList.length - 1];
|
|
13995
14029
|
};
|
|
13996
14030
|
|
|
13997
14031
|
DataManager.getBLEFirmwareStatus = features => {
|
|
@@ -14005,17 +14039,31 @@ DataManager.getBLEFirmwareStatus = features => {
|
|
|
14005
14039
|
}
|
|
14006
14040
|
|
|
14007
14041
|
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
|
|
14008
|
-
const latestBLEFirmware = targetDeviceConfigList[targetDeviceConfigList.length - 1];
|
|
14009
|
-
if (!latestBLEFirmware) return 'valid';
|
|
14010
|
-
const latestVersion = latestBLEFirmware.version.join('.');
|
|
14011
14042
|
const currentVersion = deviceBLEFirmwareVersion.join('.');
|
|
14043
|
+
return getReleaseStatus(targetDeviceConfigList, currentVersion);
|
|
14044
|
+
};
|
|
14045
|
+
|
|
14046
|
+
DataManager.getBleFirmwareChangelog = features => {
|
|
14047
|
+
var _b, _c;
|
|
14048
|
+
|
|
14049
|
+
const deviceType = getDeviceType(features);
|
|
14050
|
+
const deviceBLEFirmwareVersion = getDeviceBLEFirmwareVersion(features);
|
|
14012
14051
|
|
|
14013
|
-
if (
|
|
14014
|
-
|
|
14015
|
-
return 'outdated';
|
|
14052
|
+
if (!deviceBLEFirmwareVersion) {
|
|
14053
|
+
return [];
|
|
14016
14054
|
}
|
|
14017
14055
|
|
|
14018
|
-
|
|
14056
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
|
|
14057
|
+
const currentVersion = deviceBLEFirmwareVersion.join('.');
|
|
14058
|
+
return getReleaseChangelog(targetDeviceConfigList, currentVersion);
|
|
14059
|
+
};
|
|
14060
|
+
|
|
14061
|
+
DataManager.getBleFirmwareLeatestRelease = features => {
|
|
14062
|
+
var _b, _c;
|
|
14063
|
+
|
|
14064
|
+
const deviceType = getDeviceType(features);
|
|
14065
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
|
|
14066
|
+
return targetDeviceConfigList[targetDeviceConfigList.length - 1];
|
|
14019
14067
|
};
|
|
14020
14068
|
|
|
14021
14069
|
DataManager.getTransportStatus = localVersion => {
|
|
@@ -14027,7 +14075,7 @@ DataManager.getTransportStatus = localVersion => {
|
|
|
14027
14075
|
return isLatest ? 'valid' : 'outdated';
|
|
14028
14076
|
};
|
|
14029
14077
|
|
|
14030
|
-
const Log$
|
|
14078
|
+
const Log$5 = initLog('Transport');
|
|
14031
14079
|
|
|
14032
14080
|
class TransportManager {
|
|
14033
14081
|
static load() {
|
|
@@ -14040,24 +14088,24 @@ class TransportManager {
|
|
|
14040
14088
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14041
14089
|
try {
|
|
14042
14090
|
const env = DataManager.getSettings('env');
|
|
14043
|
-
Log$
|
|
14091
|
+
Log$5.debug('Initializing transports');
|
|
14044
14092
|
|
|
14045
14093
|
if (env === 'react-native') {
|
|
14046
14094
|
if (!this.reactNativeInit) {
|
|
14047
14095
|
yield this.transport.init();
|
|
14048
14096
|
this.reactNativeInit = true;
|
|
14049
14097
|
} else {
|
|
14050
|
-
Log$
|
|
14098
|
+
Log$5.debug('React Native Do Not Initializing transports');
|
|
14051
14099
|
}
|
|
14052
14100
|
} else {
|
|
14053
14101
|
yield this.transport.init();
|
|
14054
14102
|
}
|
|
14055
14103
|
|
|
14056
|
-
Log$
|
|
14104
|
+
Log$5.debug('Configuring transports');
|
|
14057
14105
|
yield this.transport.configure(JSON.stringify(this.defaultMessages));
|
|
14058
|
-
Log$
|
|
14106
|
+
Log$5.debug('Configuring transports done');
|
|
14059
14107
|
} catch (error) {
|
|
14060
|
-
Log$
|
|
14108
|
+
Log$5.debug('Initializing transports error: ', error);
|
|
14061
14109
|
}
|
|
14062
14110
|
});
|
|
14063
14111
|
}
|
|
@@ -14161,7 +14209,8 @@ const createUiMessage = (type, payload) => ({
|
|
|
14161
14209
|
const IFRAME = {
|
|
14162
14210
|
INIT: 'iframe-init',
|
|
14163
14211
|
INIT_BRIDGE: 'iframe-init-bridge',
|
|
14164
|
-
CALL: 'iframe-call'
|
|
14212
|
+
CALL: 'iframe-call',
|
|
14213
|
+
CANCEL: 'iframe-cancel'
|
|
14165
14214
|
};
|
|
14166
14215
|
|
|
14167
14216
|
const createIFrameMessage = (type, payload) => ({
|
|
@@ -14224,7 +14273,7 @@ const assertType = (res, resType) => {
|
|
|
14224
14273
|
}
|
|
14225
14274
|
};
|
|
14226
14275
|
|
|
14227
|
-
const Log$
|
|
14276
|
+
const Log$4 = initLog('DeviceCommands');
|
|
14228
14277
|
|
|
14229
14278
|
class DeviceCommands {
|
|
14230
14279
|
constructor(device, mainId) {
|
|
@@ -14235,8 +14284,16 @@ class DeviceCommands {
|
|
|
14235
14284
|
}
|
|
14236
14285
|
|
|
14237
14286
|
dispose() {
|
|
14287
|
+
var _a, _b;
|
|
14288
|
+
|
|
14238
14289
|
this.disposed = true;
|
|
14290
|
+
|
|
14291
|
+
if (this._cancelableRequest) {
|
|
14292
|
+
this._cancelableRequest();
|
|
14293
|
+
}
|
|
14294
|
+
|
|
14239
14295
|
this._cancelableRequest = undefined;
|
|
14296
|
+
(_b = (_a = this.transport).cancel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
14240
14297
|
}
|
|
14241
14298
|
|
|
14242
14299
|
call(type, msg = {}) {
|
|
@@ -14247,10 +14304,10 @@ class DeviceCommands {
|
|
|
14247
14304
|
const promise = this.transport.call(this.mainId, type, msg);
|
|
14248
14305
|
this.callPromise = promise;
|
|
14249
14306
|
const res = yield promise;
|
|
14250
|
-
Log$
|
|
14307
|
+
Log$4.debug('[DeviceCommands] [call] Received', res.type);
|
|
14251
14308
|
return res;
|
|
14252
14309
|
} catch (error) {
|
|
14253
|
-
Log$
|
|
14310
|
+
Log$4.debug('[DeviceCommands] [call] Received error', error);
|
|
14254
14311
|
throw error;
|
|
14255
14312
|
}
|
|
14256
14313
|
});
|
|
@@ -14474,7 +14531,7 @@ const parseRunOptions = options => {
|
|
|
14474
14531
|
return options;
|
|
14475
14532
|
};
|
|
14476
14533
|
|
|
14477
|
-
const Log$
|
|
14534
|
+
const Log$3 = initLog('Device');
|
|
14478
14535
|
|
|
14479
14536
|
class Device extends events.exports {
|
|
14480
14537
|
constructor(descriptor) {
|
|
@@ -14486,7 +14543,6 @@ class Device extends events.exports {
|
|
|
14486
14543
|
this.unavailableCapabilities = {};
|
|
14487
14544
|
this.instance = 0;
|
|
14488
14545
|
this.internalState = [];
|
|
14489
|
-
this.loaded = false;
|
|
14490
14546
|
this.needReloadDevice = false;
|
|
14491
14547
|
this.keepSession = false;
|
|
14492
14548
|
this.originalDescriptor = descriptor;
|
|
@@ -14561,10 +14617,10 @@ class Device extends events.exports {
|
|
|
14561
14617
|
if (env === 'react-native') {
|
|
14562
14618
|
const res = yield (_a = this.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(this.originalDescriptor.id);
|
|
14563
14619
|
this.mainId = (_b = res.uuid) !== null && _b !== void 0 ? _b : '';
|
|
14564
|
-
Log$
|
|
14620
|
+
Log$3.debug('Expected uuid:', this.mainId);
|
|
14565
14621
|
} else {
|
|
14566
14622
|
this.mainId = yield (_c = this.deviceConnector) === null || _c === void 0 ? void 0 : _c.acquire(this.originalDescriptor.path, this.originalDescriptor.session);
|
|
14567
|
-
Log$
|
|
14623
|
+
Log$3.debug('Expected session id:', this.mainId);
|
|
14568
14624
|
}
|
|
14569
14625
|
|
|
14570
14626
|
this.updateDescriptor({
|
|
@@ -14613,7 +14669,7 @@ class Device extends events.exports {
|
|
|
14613
14669
|
session: null
|
|
14614
14670
|
});
|
|
14615
14671
|
} catch (err) {
|
|
14616
|
-
Log$
|
|
14672
|
+
Log$3.error('[Device] release error: ', err);
|
|
14617
14673
|
} finally {
|
|
14618
14674
|
this.needReloadDevice = true;
|
|
14619
14675
|
}
|
|
@@ -14685,11 +14741,21 @@ class Device extends events.exports {
|
|
|
14685
14741
|
}
|
|
14686
14742
|
}
|
|
14687
14743
|
|
|
14744
|
+
updateFromCache(device) {
|
|
14745
|
+
this.mainId = device.mainId;
|
|
14746
|
+
this.commands = device.commands;
|
|
14747
|
+
this.updateDescriptor(device.originalDescriptor);
|
|
14748
|
+
|
|
14749
|
+
if (device.features) {
|
|
14750
|
+
this._updateFeatures(device.features);
|
|
14751
|
+
}
|
|
14752
|
+
}
|
|
14753
|
+
|
|
14688
14754
|
run(fn, options) {
|
|
14689
14755
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14690
14756
|
if (this.runPromise) {
|
|
14691
|
-
|
|
14692
|
-
|
|
14757
|
+
this.interruption();
|
|
14758
|
+
Log$3.debug('[Device] run error:', 'Device is running, but will cancel previous operate');
|
|
14693
14759
|
}
|
|
14694
14760
|
|
|
14695
14761
|
options = parseRunOptions(options);
|
|
@@ -14721,14 +14787,10 @@ class Device extends events.exports {
|
|
|
14721
14787
|
yield fn();
|
|
14722
14788
|
}
|
|
14723
14789
|
|
|
14724
|
-
if (this.loaded && this.features) {
|
|
14725
|
-
yield this.getFeatures();
|
|
14726
|
-
}
|
|
14727
|
-
|
|
14728
14790
|
if (!this.keepSession && typeof options.keepSession !== 'boolean' || options.keepSession === false) {
|
|
14729
14791
|
this.keepSession = false;
|
|
14730
14792
|
yield this.release();
|
|
14731
|
-
Log$
|
|
14793
|
+
Log$3.debug('release device, mainId: ', this.mainId);
|
|
14732
14794
|
}
|
|
14733
14795
|
|
|
14734
14796
|
if (this.runPromise) {
|
|
@@ -14736,13 +14798,19 @@ class Device extends events.exports {
|
|
|
14736
14798
|
}
|
|
14737
14799
|
|
|
14738
14800
|
this.runPromise = null;
|
|
14739
|
-
|
|
14740
|
-
if (!this.loaded) {
|
|
14741
|
-
this.loaded = true;
|
|
14742
|
-
}
|
|
14743
14801
|
});
|
|
14744
14802
|
}
|
|
14745
14803
|
|
|
14804
|
+
interruption() {
|
|
14805
|
+
if (this.commands) {
|
|
14806
|
+
this.commands.dispose();
|
|
14807
|
+
}
|
|
14808
|
+
|
|
14809
|
+
if (this.runPromise) {
|
|
14810
|
+
this.runPromise.reject(TypedError('Device_Interrupted'));
|
|
14811
|
+
}
|
|
14812
|
+
}
|
|
14813
|
+
|
|
14746
14814
|
getMode() {
|
|
14747
14815
|
var _a, _b, _c;
|
|
14748
14816
|
|
|
@@ -14820,6 +14888,9 @@ class Device extends events.exports {
|
|
|
14820
14888
|
|
|
14821
14889
|
}
|
|
14822
14890
|
|
|
14891
|
+
const cacheDeviceMap = new Map();
|
|
14892
|
+
const Log$2 = initLog('DeviceList');
|
|
14893
|
+
|
|
14823
14894
|
class DeviceList extends events.exports {
|
|
14824
14895
|
constructor() {
|
|
14825
14896
|
super(...arguments);
|
|
@@ -14841,7 +14912,7 @@ class DeviceList extends events.exports {
|
|
|
14841
14912
|
try {
|
|
14842
14913
|
for (var descriptorList_1 = __asyncValues(descriptorList), descriptorList_1_1; descriptorList_1_1 = yield descriptorList_1.next(), !descriptorList_1_1.done;) {
|
|
14843
14914
|
const descriptor = descriptorList_1_1.value;
|
|
14844
|
-
|
|
14915
|
+
let device = Device.fromDescriptor(descriptor);
|
|
14845
14916
|
device.deviceConnector = this.connector;
|
|
14846
14917
|
yield device.connect();
|
|
14847
14918
|
yield device.initialize();
|
|
@@ -14850,7 +14921,16 @@ class DeviceList extends events.exports {
|
|
|
14850
14921
|
|
|
14851
14922
|
if (device.features) {
|
|
14852
14923
|
const uuid = getDeviceUUID(device.features);
|
|
14924
|
+
|
|
14925
|
+
if (cacheDeviceMap.has(uuid)) {
|
|
14926
|
+
const cache = cacheDeviceMap.get(uuid);
|
|
14927
|
+
cache === null || cache === void 0 ? void 0 : cache.updateFromCache(device);
|
|
14928
|
+
device = cache;
|
|
14929
|
+
Log$2.debug('use cache device: ', uuid);
|
|
14930
|
+
}
|
|
14931
|
+
|
|
14853
14932
|
this.devices[uuid] = device;
|
|
14933
|
+
cacheDeviceMap.set(uuid, device);
|
|
14854
14934
|
}
|
|
14855
14935
|
}
|
|
14856
14936
|
} catch (e_1_1) {
|
|
@@ -16232,7 +16312,13 @@ class CheckFirmwareRelease extends BaseMethod {
|
|
|
16232
16312
|
run() {
|
|
16233
16313
|
if (this.device.features) {
|
|
16234
16314
|
const firmwareStatus = DataManager.getFirmwareStatus(this.device.features);
|
|
16235
|
-
|
|
16315
|
+
const changelog = DataManager.getFirmwareChangelog(this.device.features);
|
|
16316
|
+
const release = DataManager.getFirmwareLeatestRelease(this.device.features);
|
|
16317
|
+
return Promise.resolve({
|
|
16318
|
+
status: firmwareStatus,
|
|
16319
|
+
changelog,
|
|
16320
|
+
release
|
|
16321
|
+
});
|
|
16236
16322
|
}
|
|
16237
16323
|
|
|
16238
16324
|
return Promise.resolve(null);
|
|
@@ -16248,7 +16334,13 @@ class CheckBLEFirmwareRelease extends BaseMethod {
|
|
|
16248
16334
|
run() {
|
|
16249
16335
|
if (this.device.features) {
|
|
16250
16336
|
const firmwareStatus = DataManager.getBLEFirmwareStatus(this.device.features);
|
|
16251
|
-
|
|
16337
|
+
const changelog = DataManager.getBleFirmwareChangelog(this.device.features);
|
|
16338
|
+
const release = DataManager.getBleFirmwareLeatestRelease(this.device.features);
|
|
16339
|
+
return Promise.resolve({
|
|
16340
|
+
status: firmwareStatus,
|
|
16341
|
+
changelog,
|
|
16342
|
+
release
|
|
16343
|
+
});
|
|
16252
16344
|
}
|
|
16253
16345
|
|
|
16254
16346
|
return Promise.resolve(null);
|
|
@@ -18439,6 +18531,8 @@ let _uiPromises = [];
|
|
|
18439
18531
|
|
|
18440
18532
|
let _callPromise;
|
|
18441
18533
|
|
|
18534
|
+
const deviceCacheMap = new Map();
|
|
18535
|
+
|
|
18442
18536
|
const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
|
|
18443
18537
|
var _a, _b;
|
|
18444
18538
|
|
|
@@ -18621,13 +18715,44 @@ function initDeviceForBle(method) {
|
|
|
18621
18715
|
return initDevice(method);
|
|
18622
18716
|
}
|
|
18623
18717
|
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18718
|
+
let device;
|
|
18719
|
+
|
|
18720
|
+
if (deviceCacheMap.has(method.connectId)) {
|
|
18721
|
+
device = deviceCacheMap.get(method.connectId);
|
|
18722
|
+
} else {
|
|
18723
|
+
device = Device.fromDescriptor({
|
|
18724
|
+
id: method.connectId
|
|
18725
|
+
});
|
|
18726
|
+
deviceCacheMap.set(method.connectId, device);
|
|
18727
|
+
}
|
|
18728
|
+
|
|
18627
18729
|
device.deviceConnector = _connector;
|
|
18628
18730
|
return device;
|
|
18629
18731
|
}
|
|
18630
18732
|
|
|
18733
|
+
const cancel = connectId => {
|
|
18734
|
+
const env = DataManager.getSettings('env');
|
|
18735
|
+
|
|
18736
|
+
if (connectId) {
|
|
18737
|
+
let device;
|
|
18738
|
+
|
|
18739
|
+
if (env === 'react-native') {
|
|
18740
|
+
device = initDeviceForBle({
|
|
18741
|
+
connectId
|
|
18742
|
+
});
|
|
18743
|
+
} else {
|
|
18744
|
+
device = initDevice({
|
|
18745
|
+
connectId
|
|
18746
|
+
});
|
|
18747
|
+
}
|
|
18748
|
+
|
|
18749
|
+
device === null || device === void 0 ? void 0 : device.interruption();
|
|
18750
|
+
}
|
|
18751
|
+
|
|
18752
|
+
cleanup();
|
|
18753
|
+
closePopup();
|
|
18754
|
+
};
|
|
18755
|
+
|
|
18631
18756
|
const cleanup = () => {
|
|
18632
18757
|
_uiPromises = [];
|
|
18633
18758
|
Log.debug('Cleanup...');
|
|
@@ -18711,6 +18836,12 @@ class Core extends events.exports {
|
|
|
18711
18836
|
const response = yield callAPI(message);
|
|
18712
18837
|
return response;
|
|
18713
18838
|
}
|
|
18839
|
+
|
|
18840
|
+
case IFRAME.CANCEL:
|
|
18841
|
+
{
|
|
18842
|
+
cancel(message.payload.connectId);
|
|
18843
|
+
break;
|
|
18844
|
+
}
|
|
18714
18845
|
}
|
|
18715
18846
|
|
|
18716
18847
|
return Promise.resolve(message);
|
|
@@ -44393,7 +44524,15 @@ const uiResponse = response => {
|
|
|
44393
44524
|
});
|
|
44394
44525
|
};
|
|
44395
44526
|
|
|
44396
|
-
const cancel =
|
|
44527
|
+
const cancel = connectId => {
|
|
44528
|
+
sendMessage({
|
|
44529
|
+
event: dist/* IFRAME.CANCEL */.Bg.CANCEL,
|
|
44530
|
+
type: dist/* IFRAME.CANCEL */.Bg.CANCEL,
|
|
44531
|
+
payload: {
|
|
44532
|
+
connectId
|
|
44533
|
+
}
|
|
44534
|
+
});
|
|
44535
|
+
};
|
|
44397
44536
|
|
|
44398
44537
|
const createJSBridge = messageEvent => {
|
|
44399
44538
|
if (messageEvent.origin !== origin) {
|