@onekeyfe/hd-web-sdk 0.1.0 → 0.1.1
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.6bb43909abd5d815e337.js +3 -0
- package/build/js/{iframe.ea300fd8da90869700fc.js.LICENSE.txt → iframe.6bb43909abd5d815e337.js.LICENSE.txt} +0 -0
- package/build/js/iframe.6bb43909abd5d815e337.js.map +1 -0
- package/build/onekey-js-sdk.js +75 -16
- 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/package.json +4 -4
- package/build/js/iframe.ea300fd8da90869700fc.js +0 -3
- package/build/js/iframe.ea300fd8da90869700fc.js.map +0 -1
package/build/onekey-js-sdk.js
CHANGED
|
@@ -13902,6 +13902,25 @@ var MessagesJSON = {
|
|
|
13902
13902
|
nested: nested
|
|
13903
13903
|
};
|
|
13904
13904
|
|
|
13905
|
+
const getReleaseStatus = (releases, currentVersion) => {
|
|
13906
|
+
const newVersions = releases.filter(r => semver__default["default"].gt(r.version.join('.'), currentVersion));
|
|
13907
|
+
|
|
13908
|
+
if (newVersions.length === 0) {
|
|
13909
|
+
return 'valid';
|
|
13910
|
+
}
|
|
13911
|
+
|
|
13912
|
+
if (newVersions.some(r => r.required)) {
|
|
13913
|
+
return 'required';
|
|
13914
|
+
}
|
|
13915
|
+
|
|
13916
|
+
return 'outdated';
|
|
13917
|
+
};
|
|
13918
|
+
|
|
13919
|
+
const getReleaseChangelog = (releases, currentVersion) => {
|
|
13920
|
+
const newVersions = releases.filter(r => semver__default["default"].gt(r.version.join('.'), currentVersion));
|
|
13921
|
+
return newVersions.map(r => r.changelog);
|
|
13922
|
+
};
|
|
13923
|
+
|
|
13905
13924
|
var _a;
|
|
13906
13925
|
|
|
13907
13926
|
class DataManager {
|
|
@@ -13981,17 +14000,31 @@ DataManager.getFirmwareStatus = features => {
|
|
|
13981
14000
|
}
|
|
13982
14001
|
|
|
13983
14002
|
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
14003
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
14004
|
+
return getReleaseStatus(targetDeviceConfigList, currentVersion);
|
|
14005
|
+
};
|
|
13988
14006
|
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
|
|
14007
|
+
DataManager.getFirmwareChangelog = features => {
|
|
14008
|
+
var _b, _c;
|
|
14009
|
+
|
|
14010
|
+
const deviceType = getDeviceType(features);
|
|
14011
|
+
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
14012
|
+
|
|
14013
|
+
if (features.firmware_present === false || deviceType === 'classic' && features.bootloader_mode) {
|
|
14014
|
+
return [];
|
|
13992
14015
|
}
|
|
13993
14016
|
|
|
13994
|
-
|
|
14017
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.firmware) !== null && _c !== void 0 ? _c : [];
|
|
14018
|
+
const currentVersion = deviceFirmwareVersion.join('.');
|
|
14019
|
+
return getReleaseChangelog(targetDeviceConfigList, currentVersion);
|
|
14020
|
+
};
|
|
14021
|
+
|
|
14022
|
+
DataManager.getFirmwareLeatestRelease = features => {
|
|
14023
|
+
var _b, _c;
|
|
14024
|
+
|
|
14025
|
+
const deviceType = getDeviceType(features);
|
|
14026
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.firmware) !== null && _c !== void 0 ? _c : [];
|
|
14027
|
+
return targetDeviceConfigList[targetDeviceConfigList.length - 1];
|
|
13995
14028
|
};
|
|
13996
14029
|
|
|
13997
14030
|
DataManager.getBLEFirmwareStatus = features => {
|
|
@@ -14005,17 +14038,31 @@ DataManager.getBLEFirmwareStatus = features => {
|
|
|
14005
14038
|
}
|
|
14006
14039
|
|
|
14007
14040
|
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
14041
|
const currentVersion = deviceBLEFirmwareVersion.join('.');
|
|
14042
|
+
return getReleaseStatus(targetDeviceConfigList, currentVersion);
|
|
14043
|
+
};
|
|
14044
|
+
|
|
14045
|
+
DataManager.getBleFirmwareChangelog = features => {
|
|
14046
|
+
var _b, _c;
|
|
14012
14047
|
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14048
|
+
const deviceType = getDeviceType(features);
|
|
14049
|
+
const deviceBLEFirmwareVersion = getDeviceBLEFirmwareVersion(features);
|
|
14050
|
+
|
|
14051
|
+
if (!deviceBLEFirmwareVersion) {
|
|
14052
|
+
return [];
|
|
14016
14053
|
}
|
|
14017
14054
|
|
|
14018
|
-
|
|
14055
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
|
|
14056
|
+
const currentVersion = deviceBLEFirmwareVersion.join('.');
|
|
14057
|
+
return getReleaseChangelog(targetDeviceConfigList, currentVersion);
|
|
14058
|
+
};
|
|
14059
|
+
|
|
14060
|
+
DataManager.getBleFirmwareLeatestRelease = features => {
|
|
14061
|
+
var _b, _c;
|
|
14062
|
+
|
|
14063
|
+
const deviceType = getDeviceType(features);
|
|
14064
|
+
const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b.ble) !== null && _c !== void 0 ? _c : [];
|
|
14065
|
+
return targetDeviceConfigList[targetDeviceConfigList.length - 1];
|
|
14019
14066
|
};
|
|
14020
14067
|
|
|
14021
14068
|
DataManager.getTransportStatus = localVersion => {
|
|
@@ -16232,7 +16279,13 @@ class CheckFirmwareRelease extends BaseMethod {
|
|
|
16232
16279
|
run() {
|
|
16233
16280
|
if (this.device.features) {
|
|
16234
16281
|
const firmwareStatus = DataManager.getFirmwareStatus(this.device.features);
|
|
16235
|
-
|
|
16282
|
+
const changelog = DataManager.getFirmwareChangelog(this.device.features);
|
|
16283
|
+
const release = DataManager.getFirmwareLeatestRelease(this.device.features);
|
|
16284
|
+
return Promise.resolve({
|
|
16285
|
+
status: firmwareStatus,
|
|
16286
|
+
changelog,
|
|
16287
|
+
release
|
|
16288
|
+
});
|
|
16236
16289
|
}
|
|
16237
16290
|
|
|
16238
16291
|
return Promise.resolve(null);
|
|
@@ -16248,7 +16301,13 @@ class CheckBLEFirmwareRelease extends BaseMethod {
|
|
|
16248
16301
|
run() {
|
|
16249
16302
|
if (this.device.features) {
|
|
16250
16303
|
const firmwareStatus = DataManager.getBLEFirmwareStatus(this.device.features);
|
|
16251
|
-
|
|
16304
|
+
const changelog = DataManager.getBleFirmwareChangelog(this.device.features);
|
|
16305
|
+
const release = DataManager.getBleFirmwareLeatestRelease(this.device.features);
|
|
16306
|
+
return Promise.resolve({
|
|
16307
|
+
status: firmwareStatus,
|
|
16308
|
+
changelog,
|
|
16309
|
+
release
|
|
16310
|
+
});
|
|
16252
16311
|
}
|
|
16253
16312
|
|
|
16254
16313
|
return Promise.resolve(null);
|