@ray-js/lock-sdk 1.2.0-beta.9 → 1.2.0
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/lib/api/fit.d.ts +55 -2
- package/lib/api/fit.js +43 -1
- package/lib/api/gesture.d.ts +11 -0
- package/lib/api/gesture.js +18 -0
- package/lib/api/log.d.ts +52 -4
- package/lib/api/log.js +22 -0
- package/lib/api/temp.d.ts +21 -0
- package/lib/api/temp.js +24 -0
- package/lib/config/dp-code/index.d.ts +1 -1
- package/lib/config/dp-code/index.js +1 -0
- package/lib/entries/main/bootstrap/bootstrap-lock-instance.d.ts +2 -1
- package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +23 -8
- package/lib/entries/main/bootstrap/bootstrap.d.ts +3 -2
- package/lib/entries/main/bootstrap/bootstrap.js +10 -6
- package/lib/entries/main/bootstrap/primary-instance.d.ts +1 -2
- package/lib/entries/main/bootstrap/primary-instance.js +1 -1
- package/lib/entries/main/bootstrap/resolve-runtime-from-export-this.js +1 -1
- package/lib/entries/main/build-instance.d.ts +6 -3
- package/lib/entries/main/build-instance.js +13 -1
- package/lib/entries/main/exports/capability.d.ts +2 -0
- package/lib/entries/main/exports/capability.js +7 -1
- package/lib/entries/main/exports/fit-sdk/binding.d.ts +10 -0
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.js +6 -3
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.d.ts +11 -10
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.js +20 -20
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.d.ts +1 -0
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.js +1 -0
- package/lib/entries/main/exports/fit-sdk/log.d.ts +3 -0
- package/lib/entries/main/exports/fit-sdk/log.js +5 -0
- package/lib/entries/main/exports/fit-sdk/temp.d.ts +40 -0
- package/lib/entries/main/exports/fit-sdk/temp.js +59 -0
- package/lib/entries/main/exports/gesture.d.ts +6 -0
- package/lib/entries/main/exports/gesture.js +8 -0
- package/lib/entries/main/exports/index.d.ts +5 -0
- package/lib/entries/main/exports/index.js +5 -0
- package/lib/entries/main/exports/log.d.ts +2 -0
- package/lib/entries/main/exports/log.js +7 -1
- package/lib/entries/main/exports/misc.d.ts +4 -2
- package/lib/entries/main/exports/misc.js +2 -2
- package/lib/entries/main/index.d.ts +3 -3
- package/lib/entries/main/index.js +11 -5
- package/lib/feature/fit/bind-lock-to-fit.d.ts +1 -0
- package/lib/feature/fit/bind-lock-to-fit.js +53 -0
- package/lib/feature/fit/ble-key.d.ts +10 -4
- package/lib/feature/fit/ble-key.js +145 -4
- package/lib/feature/fit/device-bv.d.ts +2 -0
- package/lib/feature/fit/device-bv.js +15 -0
- package/lib/feature/fit/invalid-password.d.ts +10 -0
- package/lib/feature/fit/invalid-password.js +43 -0
- package/lib/feature/fit/list.d.ts +12 -2
- package/lib/feature/fit/list.js +54 -5
- package/lib/feature/fit/log.d.ts +7 -0
- package/lib/feature/fit/log.js +123 -0
- package/lib/feature/fit/method/add-flow.js +2 -2
- package/lib/feature/fit/method/add-password.js +2 -2
- package/lib/feature/fit/method/update-remove.js +40 -14
- package/lib/feature/fit/password-list.d.ts +37 -0
- package/lib/feature/fit/password-list.js +44 -1
- package/lib/feature/fit/security-channel.d.ts +3 -0
- package/lib/feature/fit/security-channel.js +43 -0
- package/lib/feature/fit/shared.d.ts +8 -0
- package/lib/feature/fit/shared.js +40 -1
- package/lib/feature/fit/sync.d.ts +4 -2
- package/lib/feature/fit/sync.js +63 -22
- package/lib/feature/fit/temp-password.d.ts +23 -0
- package/lib/feature/fit/temp-password.js +95 -3
- package/lib/feature/fit/users.d.ts +1 -0
- package/lib/feature/fit/users.js +1 -0
- package/lib/feature/gesture/gesture.d.ts +6 -0
- package/lib/feature/gesture/gesture.js +3 -0
- package/lib/feature/log/log.d.ts +5 -1
- package/lib/feature/log/log.js +53 -6
- package/lib/feature/misc/ble-control.js +2 -2
- package/lib/feature/misc/capability.d.ts +2 -0
- package/lib/feature/misc/capability.js +33 -31
- package/lib/feature/misc/connect-device.d.ts +1 -1
- package/lib/feature/misc/connect-device.js +7 -6
- package/lib/feature/misc/is-use-near-channel-for-runtime.js +8 -1
- package/lib/feature/password/temporary/offline-create.d.ts +14 -0
- package/lib/feature/password/temporary/offline-create.js +77 -1
- package/lib/feature/service/goto-service.d.ts +1 -1
- package/lib/feature/state/clear.js +1 -0
- package/lib/feature/state/device-status.js +17 -6
- package/lib/feature/state/init-state.js +17 -9
- package/lib/feature/state/platform-routing.js +12 -3
- package/lib/feature/state/remote-permissions.js +2 -1
- package/lib/feature/state/sync/remote-serect-key.js +7 -0
- package/lib/feature/storage/swr-cache.d.ts +7 -0
- package/lib/feature/storage/swr-cache.js +54 -0
- package/lib/feature/unlock/method/add-flow.js +2 -2
- package/lib/feature/unlock/method/add-password.js +2 -2
- package/lib/feature/user/sync-user.js +4 -2
- package/lib/feature/utils/index.d.ts +1 -0
- package/lib/feature/utils/index.js +1 -0
- package/lib/interface.d.ts +23 -1
- package/lib/platform/device.d.ts +4 -3
- package/lib/platform/ipc.d.ts +3 -0
- package/lib/platform/ipc.js +13 -0
- package/lib/platform/storage.d.ts +1 -1
- package/lib/runtime/LockDeviceRuntime.js +3 -0
- package/lib/runtime/lock-config.d.ts +3 -0
- package/lib/runtime/lock-config.js +5 -0
- package/lib/runtime/runtime-state-types.d.ts +6 -0
- package/lib/utils/constant.d.ts +1 -0
- package/lib/utils/constant.js +6 -0
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +1 -0
- package/package.json +1 -11
- package/lib/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/bootstrap/bootstrap-lock-instance.js +0 -16
- package/lib/bootstrap/bootstrap.d.ts +0 -4
- package/lib/bootstrap/bootstrap.js +0 -53
- package/lib/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/bootstrap/primary-instance.d.ts +0 -6
- package/lib/bootstrap/primary-instance.js +0 -24
- package/lib/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/ble/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/ble/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/ble/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/ble/bootstrap/bootstrap.js +0 -53
- package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/ble/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/ble/bootstrap/primary-instance.js +0 -24
- package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/ble/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/ble/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/ble/build-instance.d.ts +0 -9
- package/lib/entries/ble/build-instance.js +0 -50
- package/lib/entries/ble/exports/capability.d.ts +0 -6
- package/lib/entries/ble/exports/capability.js +0 -17
- package/lib/entries/ble/exports/config.d.ts +0 -3
- package/lib/entries/ble/exports/config.js +0 -5
- package/lib/entries/ble/exports/dp.d.ts +0 -9
- package/lib/entries/ble/exports/dp.js +0 -13
- package/lib/entries/ble/exports/index.d.ts +0 -16
- package/lib/entries/ble/exports/index.js +0 -16
- package/lib/entries/ble/exports/linkage.d.ts +0 -5
- package/lib/entries/ble/exports/linkage.js +0 -15
- package/lib/entries/ble/exports/log.d.ts +0 -9
- package/lib/entries/ble/exports/log.js +0 -21
- package/lib/entries/ble/exports/media.d.ts +0 -4
- package/lib/entries/ble/exports/media.js +0 -12
- package/lib/entries/ble/exports/misc.d.ts +0 -19
- package/lib/entries/ble/exports/misc.js +0 -30
- package/lib/entries/ble/exports/offline-dps.d.ts +0 -8
- package/lib/entries/ble/exports/offline-dps.js +0 -24
- package/lib/entries/ble/exports/open/do-open-close-action.d.ts +0 -2
- package/lib/entries/ble/exports/open/do-open-close-action.js +0 -36
- package/lib/entries/ble/exports/open/index.d.ts +0 -18
- package/lib/entries/ble/exports/open/index.js +0 -45
- package/lib/entries/ble/exports/signal.d.ts +0 -6
- package/lib/entries/ble/exports/signal.js +0 -14
- package/lib/entries/ble/exports/sleep.d.ts +0 -13
- package/lib/entries/ble/exports/sleep.js +0 -31
- package/lib/entries/ble/exports/state.d.ts +0 -6
- package/lib/entries/ble/exports/state.js +0 -19
- package/lib/entries/ble/exports/temporary.d.ts +0 -31
- package/lib/entries/ble/exports/temporary.js +0 -91
- package/lib/entries/ble/exports/unlock/sync.d.ts +0 -1
- package/lib/entries/ble/exports/unlock/sync.js +0 -5
- package/lib/entries/ble/exports/unlock-method.d.ts +0 -19
- package/lib/entries/ble/exports/unlock-method.js +0 -58
- package/lib/entries/ble/exports/user/index.d.ts +0 -23
- package/lib/entries/ble/exports/user/index.js +0 -22
- package/lib/entries/ble/exports/user/sync.d.ts +0 -1
- package/lib/entries/ble/exports/user/sync.js +0 -5
- package/lib/entries/ble/index.d.ts +0 -8
- package/lib/entries/ble/index.js +0 -39
- package/lib/entries/fit/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/fit/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/fit/bootstrap/bootstrap.js +0 -69
- package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/fit/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/fit/bootstrap/primary-instance.js +0 -24
- package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/fit/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/fit/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/fit/build-instance.d.ts +0 -9
- package/lib/entries/fit/build-instance.js +0 -57
- package/lib/entries/fit/exports/binding.d.ts +0 -8
- package/lib/entries/fit/exports/temp.d.ts +0 -19
- package/lib/entries/fit/exports/temp.js +0 -18
- package/lib/entries/fit/index.d.ts +0 -8
- package/lib/entries/fit/index.js +0 -36
- package/lib/entries/main/exports/open.d.ts +0 -16
- package/lib/entries/main/exports/open.js +0 -44
- package/lib/entries/screen/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/screen/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/screen/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/screen/bootstrap/bootstrap.js +0 -69
- package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/screen/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/screen/bootstrap/primary-instance.js +0 -24
- package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/screen/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/screen/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/screen/build-instance.d.ts +0 -9
- package/lib/entries/screen/build-instance.js +0 -57
- package/lib/entries/screen/exports/bind-events.d.ts +0 -4
- package/lib/entries/screen/exports/bind-events.js +0 -8
- package/lib/entries/screen/exports/binding.d.ts +0 -6
- package/lib/entries/screen/exports/binding.js +0 -15
- package/lib/entries/screen/exports/device.d.ts +0 -16
- package/lib/entries/screen/exports/device.js +0 -41
- package/lib/entries/screen/exports/event.d.ts +0 -3
- package/lib/entries/screen/exports/event.js +0 -5
- package/lib/entries/screen/exports/index.d.ts +0 -5
- package/lib/entries/screen/exports/index.js +0 -5
- package/lib/entries/screen/exports/user.d.ts +0 -2
- package/lib/entries/screen/exports/user.js +0 -8
- package/lib/entries/screen/index.d.ts +0 -8
- package/lib/entries/screen/index.js +0 -36
- package/lib/feature/unlock/door/door-action.d.ts +0 -2
- package/lib/feature/unlock/door/door-action.js +0 -32
- package/lib/fit.d.ts +0 -4
- package/lib/fit.js +0 -3
- package/lib/runtime/device-status/compute-device-status.d.ts +0 -25
- package/lib/runtime/device-status/compute-device-status.js +0 -94
- package/lib/screen.d.ts +0 -4
- package/lib/screen.js +0 -3
|
@@ -3,10 +3,12 @@ import { deleteUserForRuntime } from "./delete-user-dp";
|
|
|
3
3
|
import { isUseNearChannelForRuntime } from "../misc/is-use-near-channel-for-runtime";
|
|
4
4
|
import { publishDpsOnlyWithRuntime, } from "../dp/publish-dps";
|
|
5
5
|
import dpCodes from "../../config/dp-code";
|
|
6
|
-
import { isBlePureDeviceForRuntime } from "../misc/capability";
|
|
6
|
+
import { hasCapabilityForRuntime, isBlePureDeviceForRuntime } from "../misc/capability";
|
|
7
7
|
import { sdkLog } from "../../utils/sdk-log";
|
|
8
|
+
import { ProductCommunicationType } from "../../constant";
|
|
8
9
|
export async function syncDeleteUsersWithRuntime(runtime) {
|
|
9
|
-
|
|
10
|
+
const hasWifi = hasCapabilityForRuntime(runtime, ProductCommunicationType.WIFI);
|
|
11
|
+
if (hasWifi && runtime.config.devInfo.wifiEnableState !== 1) {
|
|
10
12
|
sdkLog("debug", "syncUser", "deleteUsersSkipped", {
|
|
11
13
|
devId: runtime.devId,
|
|
12
14
|
data: { reason: "wifiActive" },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { UnlockMethodConfig } from "../../interface";
|
|
2
2
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
3
|
+
export declare const unlockMethodDpCodes: string[];
|
|
3
4
|
export declare const getUnlockMethodTypeByDpCodeForRuntime: (rt: LockDeviceRuntime, dpCode: string) => UnlockMethodConfig;
|
|
4
5
|
export declare const getUnlockMethodTypeByIdForRuntime: (rt: LockDeviceRuntime, id: number | string) => UnlockMethodConfig;
|
|
5
6
|
export declare const getUnlockMethodTypeByTypeForRuntime: (rt: LockDeviceRuntime, type: string) => UnlockMethodConfig;
|
|
@@ -33,6 +33,7 @@ const unlockMethodConfigs = [
|
|
|
33
33
|
id: 6,
|
|
34
34
|
},
|
|
35
35
|
];
|
|
36
|
+
export const unlockMethodDpCodes = unlockMethodConfigs.reduce((res, item) => res.concat(item.codes), []);
|
|
36
37
|
const getUnlockMethodTypeForRuntime = (rt, cb) => {
|
|
37
38
|
const result = unlockMethodConfigs.find(cb);
|
|
38
39
|
if (result) {
|
package/lib/interface.d.ts
CHANGED
|
@@ -12,9 +12,12 @@ export interface LockSDKOption {
|
|
|
12
12
|
supportMultipleFace?: boolean;
|
|
13
13
|
supportOfflineDps?: boolean;
|
|
14
14
|
preFetch?: boolean;
|
|
15
|
+
localCache?: boolean;
|
|
16
|
+
notSupportWake?: boolean;
|
|
15
17
|
logLevel?: SDKLogLevel;
|
|
16
18
|
logger?: SDKLogSink;
|
|
17
19
|
logToConsole?: boolean;
|
|
20
|
+
kind?: "lock" | "fit" | "screen";
|
|
18
21
|
}
|
|
19
22
|
export interface ErrorData {
|
|
20
23
|
errorCode: number;
|
|
@@ -180,6 +183,16 @@ export interface EffectiveConfig {
|
|
|
180
183
|
effectiveTime?: number;
|
|
181
184
|
expiredTime?: number;
|
|
182
185
|
}
|
|
186
|
+
export interface FitBleKeyItem {
|
|
187
|
+
id: string;
|
|
188
|
+
unlockBindingId: string;
|
|
189
|
+
name: string;
|
|
190
|
+
opModeSubType?: number;
|
|
191
|
+
effectiveConfig: EffectiveConfig;
|
|
192
|
+
sn?: number;
|
|
193
|
+
userName?: string;
|
|
194
|
+
devNameList?: string[];
|
|
195
|
+
}
|
|
183
196
|
export interface UnBindUnlockMethod {
|
|
184
197
|
dpId: number;
|
|
185
198
|
dpCode: string;
|
|
@@ -204,6 +217,8 @@ export interface DeviceStatus {
|
|
|
204
217
|
};
|
|
205
218
|
isWifiActive: boolean;
|
|
206
219
|
isWifiMatter: boolean;
|
|
220
|
+
isActiveThread: boolean;
|
|
221
|
+
isShareThread: boolean;
|
|
207
222
|
}
|
|
208
223
|
export interface UnionUnlockInfo {
|
|
209
224
|
userId: string;
|
|
@@ -254,6 +269,11 @@ export interface MediaInfo {
|
|
|
254
269
|
fileUrl: string;
|
|
255
270
|
mediaBucket: string;
|
|
256
271
|
mediaKey: string;
|
|
272
|
+
width: number;
|
|
273
|
+
height: number;
|
|
274
|
+
angle: number;
|
|
275
|
+
position: number;
|
|
276
|
+
isVR: boolean;
|
|
257
277
|
}
|
|
258
278
|
export type LogType = "alarm_record" | "close_record" | "unlock_record" | "operation" | "local_operation";
|
|
259
279
|
export type CloseValue = "UNDEFINED" | "VOICE_REMOTE" | "APP_REMOTE" | "AUTO" | "LOCAL_MANUAL" | "FITTINGS" | "APP" | "GEO_FENCE";
|
|
@@ -269,6 +289,8 @@ export interface LogData {
|
|
|
269
289
|
dpCode: string;
|
|
270
290
|
data: any;
|
|
271
291
|
userName: string;
|
|
292
|
+
avatarUrl?: string;
|
|
293
|
+
relateDevName?: string;
|
|
272
294
|
bindable: boolean;
|
|
273
295
|
unlockName: string;
|
|
274
296
|
mediaInfo?: MediaInfo[];
|
|
@@ -407,6 +429,6 @@ export interface CameraConfig {
|
|
|
407
429
|
width: number;
|
|
408
430
|
height: number;
|
|
409
431
|
rotate: number;
|
|
410
|
-
|
|
432
|
+
location: number;
|
|
411
433
|
}
|
|
412
434
|
export {};
|
package/lib/platform/device.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare const getSystemInfoSync: () => {
|
|
|
52
52
|
locationEnabled: boolean;
|
|
53
53
|
wifiEnabled: boolean;
|
|
54
54
|
theme?: ty.Themes;
|
|
55
|
-
deviceOrientation?: ty.
|
|
55
|
+
deviceOrientation?: ty.PhoneOrientation;
|
|
56
56
|
deviceLevel: string;
|
|
57
57
|
isSupportPinShortcut?: boolean;
|
|
58
58
|
deviceType?: string;
|
|
@@ -74,9 +74,10 @@ export declare const requestCloud: <T>(options: {
|
|
|
74
74
|
export declare const getLaunchOptionsSync: () => {
|
|
75
75
|
path: string;
|
|
76
76
|
scene?: ty.MiniAppScene;
|
|
77
|
-
query: any
|
|
77
|
+
query: Record<string, any>;
|
|
78
78
|
referrerInfo: ty.ReferrerInfo;
|
|
79
79
|
apiCategory?: string;
|
|
80
|
+
extraQuery?: Record<string, any>;
|
|
80
81
|
};
|
|
81
82
|
export declare function encrypt(deviceId: string, plaintext: string): Promise<string>;
|
|
82
83
|
export declare function decrypt(deviceId: string, plaintext: string): Promise<string>;
|
|
@@ -219,7 +220,7 @@ export declare const onResetMemberName: (cb: HomeMemberListener) => void;
|
|
|
219
220
|
export declare const offResetMemberName: (cb: HomeMemberListener) => void;
|
|
220
221
|
export declare const onResetMemberRole: (cb: HomeMemberListener) => void;
|
|
221
222
|
export declare const offResetMemberRole: (cb: HomeMemberListener) => void;
|
|
222
|
-
export declare const getLogManager: () => ty.
|
|
223
|
+
export declare const getLogManager: () => ty.LogManager;
|
|
223
224
|
export declare const getAppUserInfo: () => Promise<{
|
|
224
225
|
nickName: string;
|
|
225
226
|
avatarUrl: string;
|
package/lib/platform/ipc.d.ts
CHANGED
package/lib/platform/ipc.js
CHANGED
|
@@ -31,10 +31,23 @@ const getCurrentSupportedTalkMode = (deviceId) => {
|
|
|
31
31
|
}
|
|
32
32
|
return Promise.reject(new Error("not support"));
|
|
33
33
|
};
|
|
34
|
+
const getTTTAbilityKeyList = (key) => {
|
|
35
|
+
if (ty.ipc.getTTTAbilityKeyList) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
ty.ipc.getTTTAbilityKeyList({
|
|
38
|
+
key,
|
|
39
|
+
success: resolve,
|
|
40
|
+
fail: reject,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return Promise.resolve({ abilityList: [] });
|
|
45
|
+
};
|
|
34
46
|
export default {
|
|
35
47
|
wakeUpDoorBell,
|
|
36
48
|
isConnected,
|
|
37
49
|
isConnecting,
|
|
38
50
|
connect,
|
|
39
51
|
getCurrentSupportedTalkMode,
|
|
52
|
+
getTTTAbilityKeyList,
|
|
40
53
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const setStorageSync: (key: string, data:
|
|
1
|
+
export declare const setStorageSync: (key: string, data: string) => void;
|
|
2
2
|
export declare const getStorageSync: (key: string) => any;
|
|
3
3
|
export declare const removeStorageSync: (key: string) => void;
|
|
@@ -14,6 +14,7 @@ export class LockDeviceRuntime {
|
|
|
14
14
|
offlineDpCache: undefined,
|
|
15
15
|
isActiveThreadCache: false,
|
|
16
16
|
deviceAdvanceAbilityCache: undefined,
|
|
17
|
+
fitDeviceBvCache: undefined,
|
|
17
18
|
};
|
|
18
19
|
this.sync = {
|
|
19
20
|
hasSyncedT0: false,
|
|
@@ -21,6 +22,8 @@ export class LockDeviceRuntime {
|
|
|
21
22
|
unlockMethodAutoSyncEnabled: true,
|
|
22
23
|
tempAutoSyncEnabled: true,
|
|
23
24
|
tempPayloadSyncing: false,
|
|
25
|
+
fitSyncReportHandler: null,
|
|
26
|
+
fitBindingsSyncStarted: false,
|
|
24
27
|
};
|
|
25
28
|
this.infra = {
|
|
26
29
|
eventsRegistered: false,
|
|
@@ -21,9 +21,12 @@ export type LockConfigState = {
|
|
|
21
21
|
supportMultipleFace: boolean;
|
|
22
22
|
supportOfflineDps: boolean;
|
|
23
23
|
preFetch: boolean;
|
|
24
|
+
localCache: boolean;
|
|
24
25
|
supportTalk: boolean;
|
|
25
26
|
isTwoWayTalk: boolean;
|
|
26
27
|
cameraConfig: CameraConfig[];
|
|
28
|
+
notSupportWake: boolean;
|
|
29
|
+
isFitting: boolean;
|
|
27
30
|
};
|
|
28
31
|
export declare function createDefaultDeviceStatus(): DeviceStatus;
|
|
29
32
|
export declare function createLockConfigState(): LockConfigState;
|
|
@@ -7,6 +7,8 @@ export function createDefaultDeviceStatus() {
|
|
|
7
7
|
onlineTypes: [],
|
|
8
8
|
isWifiActive: false,
|
|
9
9
|
isWifiMatter: false,
|
|
10
|
+
isActiveThread: false,
|
|
11
|
+
isShareThread: false,
|
|
10
12
|
};
|
|
11
13
|
}
|
|
12
14
|
export function createLockConfigState() {
|
|
@@ -31,8 +33,11 @@ export function createLockConfigState() {
|
|
|
31
33
|
supportMultipleFace: false,
|
|
32
34
|
supportOfflineDps: false,
|
|
33
35
|
preFetch: false,
|
|
36
|
+
localCache: true,
|
|
34
37
|
supportTalk: false,
|
|
35
38
|
isTwoWayTalk: false,
|
|
36
39
|
cameraConfig: [],
|
|
40
|
+
notSupportWake: false,
|
|
41
|
+
isFitting: false
|
|
37
42
|
};
|
|
38
43
|
}
|
|
@@ -5,6 +5,7 @@ export interface LockRuntimeCacheFields {
|
|
|
5
5
|
offlineDpCache: OfflineDps | undefined;
|
|
6
6
|
isActiveThreadCache: boolean;
|
|
7
7
|
deviceAdvanceAbilityCache: DeviceAdvancedAbility | undefined;
|
|
8
|
+
fitDeviceBvCache: Promise<number> | undefined;
|
|
8
9
|
}
|
|
9
10
|
export interface LockRuntimeSyncFlags {
|
|
10
11
|
hasSyncedT0: boolean;
|
|
@@ -12,6 +13,11 @@ export interface LockRuntimeSyncFlags {
|
|
|
12
13
|
unlockMethodAutoSyncEnabled: boolean;
|
|
13
14
|
tempAutoSyncEnabled: boolean;
|
|
14
15
|
tempPayloadSyncing: boolean;
|
|
16
|
+
fitSyncReportHandler: ((data: {
|
|
17
|
+
deviceId?: string;
|
|
18
|
+
data?: string;
|
|
19
|
+
}) => void) | null;
|
|
20
|
+
fitBindingsSyncStarted: boolean;
|
|
15
21
|
}
|
|
16
22
|
export interface LockRuntimeInfraFields {
|
|
17
23
|
eventsRegistered: boolean;
|
package/lib/utils/constant.d.ts
CHANGED
package/lib/utils/constant.js
CHANGED
package/lib/utils/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare const getSystemInfo: () => {
|
|
|
32
32
|
locationEnabled: boolean;
|
|
33
33
|
wifiEnabled: boolean;
|
|
34
34
|
theme?: ty.Themes;
|
|
35
|
-
deviceOrientation?: ty.
|
|
35
|
+
deviceOrientation?: ty.PhoneOrientation;
|
|
36
36
|
deviceLevel: string;
|
|
37
37
|
isSupportPinShortcut?: boolean;
|
|
38
38
|
deviceType?: string;
|
|
@@ -121,6 +121,7 @@ export declare function getCapabilities(capability: number): ({
|
|
|
121
121
|
readonly short: "thread";
|
|
122
122
|
})[];
|
|
123
123
|
export declare const formatWeek: (value: number[]) => number;
|
|
124
|
+
export declare const formatCloudUnlockId: (dpId: number | string, sn: number) => string;
|
|
124
125
|
export declare const parseWeek: (value: number) => Week;
|
|
125
126
|
export declare const getPermanentSetting: () => {
|
|
126
127
|
startTime: number;
|
package/lib/utils/index.js
CHANGED
|
@@ -56,6 +56,7 @@ export const formatWeek = (value) => {
|
|
|
56
56
|
const temp = value.slice(0, 7);
|
|
57
57
|
return parseInt(temp.reverse().join(""), 2);
|
|
58
58
|
};
|
|
59
|
+
export const formatCloudUnlockId = (dpId, sn) => `${dpId}-${sn.toString(16).padStart(2, "0")}`;
|
|
59
60
|
export const parseWeek = (value) => {
|
|
60
61
|
return Number(value)
|
|
61
62
|
.toString(2)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/lock-sdk",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib",
|
|
6
6
|
"LICENSE.md"
|
|
@@ -12,16 +12,6 @@
|
|
|
12
12
|
"types": "./lib/index.d.ts",
|
|
13
13
|
"import": "./lib/index.js",
|
|
14
14
|
"default": "./lib/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./fit": {
|
|
17
|
-
"types": "./lib/fit.d.ts",
|
|
18
|
-
"import": "./lib/fit.js",
|
|
19
|
-
"default": "./lib/fit.js"
|
|
20
|
-
},
|
|
21
|
-
"./screen": {
|
|
22
|
-
"types": "./lib/screen.d.ts",
|
|
23
|
-
"import": "./lib/screen.js",
|
|
24
|
-
"default": "./lib/screen.js"
|
|
25
15
|
}
|
|
26
16
|
},
|
|
27
17
|
"scripts": {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { LockSDKOption } from "../interface";
|
|
2
|
-
import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
|
|
3
|
-
import { type LockSDKInstance } from "../entries/main/build-instance";
|
|
4
|
-
export declare function bootstrapRegisteredLockInstance(options?: LockSDKOption): Promise<{
|
|
5
|
-
runtime: LockDeviceRuntime;
|
|
6
|
-
instance: LockSDKInstance;
|
|
7
|
-
}>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { addEvents } from "../feature/state/platform-routing";
|
|
2
|
-
import { initState } from "../feature/state/init-state";
|
|
3
|
-
import { registerRuntime } from "../runtime/registry";
|
|
4
|
-
import { buildLockSDKInstance, } from "../entries/main/build-instance";
|
|
5
|
-
import * as MainDeviceExports from "../entries/main/exports";
|
|
6
|
-
import { createBootstrappedRuntime } from "./bootstrap";
|
|
7
|
-
export async function bootstrapRegisteredLockInstance(options) {
|
|
8
|
-
const runtime = await createBootstrappedRuntime(options);
|
|
9
|
-
registerRuntime(runtime);
|
|
10
|
-
addEvents(runtime);
|
|
11
|
-
await initState(runtime);
|
|
12
|
-
return {
|
|
13
|
-
runtime,
|
|
14
|
-
instance: buildLockSDKInstance(runtime, MainDeviceExports),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { LockSDKOption } from "../interface";
|
|
2
|
-
import { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
|
|
3
|
-
export declare function applyLockOptionsToRuntime(runtime: LockDeviceRuntime, options?: LockSDKOption): Promise<void>;
|
|
4
|
-
export declare function createBootstrappedRuntime(options?: LockSDKOption): Promise<LockDeviceRuntime>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import dpCodes from "../config/dp-code";
|
|
2
|
-
import { getCapabilities } from "../utils";
|
|
3
|
-
import { getDeviceInfo, trackEvent } from "../platform/device";
|
|
4
|
-
import { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
|
|
5
|
-
export async function applyLockOptionsToRuntime(runtime, options) {
|
|
6
|
-
const { config } = runtime;
|
|
7
|
-
let { devInfo, deviceId } = options || {};
|
|
8
|
-
if (!devInfo && !deviceId) {
|
|
9
|
-
throw new Error("deviceId is required in lock sdk");
|
|
10
|
-
}
|
|
11
|
-
if (deviceId && (!devInfo || devInfo.devId !== deviceId)) {
|
|
12
|
-
devInfo = await getDeviceInfo(deviceId);
|
|
13
|
-
}
|
|
14
|
-
let dpSchema = {};
|
|
15
|
-
const codesById = {};
|
|
16
|
-
const idsByCode = {};
|
|
17
|
-
if (devInfo.schema) {
|
|
18
|
-
dpSchema = devInfo.schema.reduce((acc, cur) => {
|
|
19
|
-
acc[cur.code] = cur;
|
|
20
|
-
codesById[cur.id] = cur.code;
|
|
21
|
-
idsByCode[cur.code] = cur.id;
|
|
22
|
-
return acc;
|
|
23
|
-
}, {});
|
|
24
|
-
}
|
|
25
|
-
else if (devInfo.dpSchema) {
|
|
26
|
-
dpSchema = devInfo.dpSchema;
|
|
27
|
-
Object.keys(dpSchema).forEach((key) => {
|
|
28
|
-
const item = dpSchema[key];
|
|
29
|
-
codesById[item.id] = item.code;
|
|
30
|
-
idsByCode[item.code] = item.id;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
config.strictMode = options?.strictMode ?? true;
|
|
34
|
-
config.passwordDigitalBase = options?.passwordDigitalBase ?? 10;
|
|
35
|
-
config.passwordSupportZero = options?.passwordSupportZero ?? true;
|
|
36
|
-
config.supportMultipleFace = options?.supportMultipleFace ?? false;
|
|
37
|
-
config.supportOfflineDps = options?.supportOfflineDps ?? false;
|
|
38
|
-
config.devInfo = devInfo;
|
|
39
|
-
config.dpSchema = dpSchema;
|
|
40
|
-
config.codesById = codesById;
|
|
41
|
-
config.idsByCode = idsByCode;
|
|
42
|
-
config.supportBigData = !!dpSchema[dpCodes.synchMethodW];
|
|
43
|
-
config.preFetch = options?.preFetch ?? false;
|
|
44
|
-
config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
|
|
45
|
-
trackEvent("t$y_UztB3Lj9Qns375R0r7dA0L5Kr2VytH3J".replace("$", ""), {
|
|
46
|
-
pid: devInfo.productId,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export async function createBootstrappedRuntime(options) {
|
|
50
|
-
const runtime = new LockDeviceRuntime();
|
|
51
|
-
await applyLockOptionsToRuntime(runtime, options);
|
|
52
|
-
return runtime;
|
|
53
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
|
|
2
|
-
export declare function registerLockSDKInstanceRuntime(instance: object, runtime: LockDeviceRuntime): void;
|
|
3
|
-
export declare function getRuntimeForLockSDKInstance(instance: object): LockDeviceRuntime | undefined;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { LockDeviceRuntime } from "../runtime/LockDeviceRuntime";
|
|
2
|
-
import type { LockSDKInstance } from "../entries/main/build-instance";
|
|
3
|
-
export declare function setPrimaryLockSDKInstance(instance: LockSDKInstance): void;
|
|
4
|
-
export declare function getPrimaryLockSDKRuntime(): LockDeviceRuntime | null;
|
|
5
|
-
export declare function clearPrimaryLockSDKInstance(): void;
|
|
6
|
-
export declare function clearPrimaryLockSDKInstanceIfDevId(devId: string): void;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { getRuntimeForLockSDKInstance } from "./lock-instance-runtime-ref";
|
|
2
|
-
let primaryDevId = null;
|
|
3
|
-
let primaryRuntime = null;
|
|
4
|
-
export function setPrimaryLockSDKInstance(instance) {
|
|
5
|
-
const runtime = getRuntimeForLockSDKInstance(instance);
|
|
6
|
-
if (!runtime) {
|
|
7
|
-
throw new Error("setPrimaryLockSDKInstance: instance must be returned by createLockSDK or init");
|
|
8
|
-
}
|
|
9
|
-
primaryDevId = runtime.devId;
|
|
10
|
-
primaryRuntime = runtime;
|
|
11
|
-
}
|
|
12
|
-
export function getPrimaryLockSDKRuntime() {
|
|
13
|
-
return primaryRuntime;
|
|
14
|
-
}
|
|
15
|
-
export function clearPrimaryLockSDKInstance() {
|
|
16
|
-
primaryDevId = null;
|
|
17
|
-
primaryRuntime = null;
|
|
18
|
-
}
|
|
19
|
-
export function clearPrimaryLockSDKInstanceIfDevId(devId) {
|
|
20
|
-
if (primaryDevId === devId) {
|
|
21
|
-
primaryDevId = null;
|
|
22
|
-
primaryRuntime = null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { getRuntimeByDevId } from "../runtime/registry";
|
|
2
|
-
import { getRuntimeForLockSDKInstance } from "./lock-instance-runtime-ref";
|
|
3
|
-
import { resolveTopLevelTargetRuntime } from "./top-level-runtime";
|
|
4
|
-
export function resolveRuntimeFromExportThis(thisArg) {
|
|
5
|
-
if (thisArg !== null &&
|
|
6
|
-
thisArg !== undefined &&
|
|
7
|
-
typeof thisArg === "object") {
|
|
8
|
-
const rtFromInstance = getRuntimeForLockSDKInstance(thisArg);
|
|
9
|
-
if (rtFromInstance) {
|
|
10
|
-
return rtFromInstance;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
if (thisArg !== null &&
|
|
14
|
-
thisArg !== undefined &&
|
|
15
|
-
typeof thisArg === "object" &&
|
|
16
|
-
"devId" in thisArg &&
|
|
17
|
-
typeof thisArg.devId === "string") {
|
|
18
|
-
const devId = thisArg.devId;
|
|
19
|
-
if (devId.length === 0) {
|
|
20
|
-
throw new Error("Lock SDK: bound context devId must be non-empty");
|
|
21
|
-
}
|
|
22
|
-
const rt = getRuntimeByDevId(devId);
|
|
23
|
-
if (!rt) {
|
|
24
|
-
throw new Error(`Lock SDK: no registered runtime for devId "${devId}"; use createLockSDK or init first`);
|
|
25
|
-
}
|
|
26
|
-
return rt;
|
|
27
|
-
}
|
|
28
|
-
return resolveTopLevelTargetRuntime();
|
|
29
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { getError } from "../utils/errors";
|
|
2
|
-
import { getPrimaryLockSDKRuntime } from "./primary-instance";
|
|
3
|
-
export function resolveTopLevelTargetRuntime() {
|
|
4
|
-
const primary = getPrimaryLockSDKRuntime();
|
|
5
|
-
if (!primary) {
|
|
6
|
-
throw getError(1071);
|
|
7
|
-
}
|
|
8
|
-
return primary;
|
|
9
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { LockSDKOption } from "../../../interface";
|
|
2
|
-
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
3
|
-
import { type LockSDKInstance } from "../build-instance";
|
|
4
|
-
export declare function bootstrapRegisteredLockInstance(options?: LockSDKOption): Promise<{
|
|
5
|
-
runtime: LockDeviceRuntime;
|
|
6
|
-
instance: LockSDKInstance;
|
|
7
|
-
}>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { addEvents } from "../../../feature/state/platform-routing";
|
|
2
|
-
import { initState } from "../../../feature/state/init-state";
|
|
3
|
-
import { registerRuntime } from "../../../runtime/registry";
|
|
4
|
-
import { buildLockSDKInstance, } from "../build-instance";
|
|
5
|
-
import { createBootstrappedRuntime } from "./bootstrap";
|
|
6
|
-
export async function bootstrapRegisteredLockInstance(options) {
|
|
7
|
-
const runtime = await createBootstrappedRuntime(options);
|
|
8
|
-
registerRuntime(runtime);
|
|
9
|
-
addEvents(runtime);
|
|
10
|
-
await initState(runtime);
|
|
11
|
-
return { runtime, instance: buildLockSDKInstance(runtime) };
|
|
12
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { LockSDKOption } from "../../../interface";
|
|
2
|
-
import { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
3
|
-
export declare function applyLockOptionsToRuntime(runtime: LockDeviceRuntime, options?: LockSDKOption): Promise<void>;
|
|
4
|
-
export declare function createBootstrappedRuntime(options?: LockSDKOption): Promise<LockDeviceRuntime>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import dpCodes from "../../../config/dp-code";
|
|
2
|
-
import { getCapabilities } from "../../../utils";
|
|
3
|
-
import { getDeviceInfo, trackEvent, } from "../../../platform/device";
|
|
4
|
-
import { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
5
|
-
export async function applyLockOptionsToRuntime(runtime, options) {
|
|
6
|
-
const { config } = runtime;
|
|
7
|
-
let { devInfo, deviceId } = options || {};
|
|
8
|
-
if (!devInfo && !deviceId) {
|
|
9
|
-
throw new Error("deviceId is required in lock sdk");
|
|
10
|
-
}
|
|
11
|
-
if (deviceId && (!devInfo || devInfo.devId !== deviceId)) {
|
|
12
|
-
devInfo = await getDeviceInfo(deviceId);
|
|
13
|
-
}
|
|
14
|
-
let dpSchema = {};
|
|
15
|
-
const codesById = {};
|
|
16
|
-
const idsByCode = {};
|
|
17
|
-
if (devInfo.schema) {
|
|
18
|
-
dpSchema = devInfo.schema.reduce((acc, cur) => {
|
|
19
|
-
acc[cur.code] = cur;
|
|
20
|
-
codesById[cur.id] = cur.code;
|
|
21
|
-
idsByCode[cur.code] = cur.id;
|
|
22
|
-
return acc;
|
|
23
|
-
}, {});
|
|
24
|
-
}
|
|
25
|
-
else if (devInfo.dpSchema) {
|
|
26
|
-
dpSchema = devInfo.dpSchema;
|
|
27
|
-
Object.keys(dpSchema).forEach((key) => {
|
|
28
|
-
const item = dpSchema[key];
|
|
29
|
-
codesById[item.id] = item.code;
|
|
30
|
-
idsByCode[item.code] = item.id;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
config.strictMode = options?.strictMode ?? true;
|
|
34
|
-
config.passwordDigitalBase = options?.passwordDigitalBase ?? 10;
|
|
35
|
-
config.passwordSupportZero = options?.passwordSupportZero ?? true;
|
|
36
|
-
config.supportMultipleFace = options?.supportMultipleFace ?? false;
|
|
37
|
-
config.supportOfflineDps = options?.supportOfflineDps ?? false;
|
|
38
|
-
config.devInfo = devInfo;
|
|
39
|
-
config.dpSchema = dpSchema;
|
|
40
|
-
config.codesById = codesById;
|
|
41
|
-
config.idsByCode = idsByCode;
|
|
42
|
-
config.supportBigData = !!dpSchema[dpCodes.synchMethodW];
|
|
43
|
-
config.preFetch = options?.preFetch ?? false;
|
|
44
|
-
config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
|
|
45
|
-
trackEvent("t$y_UztB3Lj9Qns375R0r7dA0L5Kr2VytH3J".replace("$", ""), {
|
|
46
|
-
pid: devInfo.productId,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export async function createBootstrappedRuntime(options) {
|
|
50
|
-
const runtime = new LockDeviceRuntime();
|
|
51
|
-
await applyLockOptionsToRuntime(runtime, options);
|
|
52
|
-
return runtime;
|
|
53
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
2
|
-
export declare function registerLockSDKInstanceRuntime(instance: object, runtime: LockDeviceRuntime): void;
|
|
3
|
-
export declare function getRuntimeForLockSDKInstance(instance: object): LockDeviceRuntime | undefined;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
2
|
-
import type { LockSDKInstance } from "../build-instance";
|
|
3
|
-
export declare function setPrimaryLockSDKInstance(instance: LockSDKInstance): void;
|
|
4
|
-
export declare function getPrimaryLockSDKRuntime(): LockDeviceRuntime | null;
|
|
5
|
-
export declare function clearPrimaryLockSDKInstance(): void;
|
|
6
|
-
export declare function clearPrimaryLockSDKInstanceIfDevId(devId: string): void;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { getRuntimeForLockSDKInstance } from "./lock-instance-runtime-ref";
|
|
2
|
-
let primaryDevId = null;
|
|
3
|
-
let primaryRuntime = null;
|
|
4
|
-
export function setPrimaryLockSDKInstance(instance) {
|
|
5
|
-
const runtime = getRuntimeForLockSDKInstance(instance);
|
|
6
|
-
if (!runtime) {
|
|
7
|
-
throw new Error("setPrimaryLockSDKInstance: instance must be returned by createLockSDK or init");
|
|
8
|
-
}
|
|
9
|
-
primaryDevId = runtime.devId;
|
|
10
|
-
primaryRuntime = runtime;
|
|
11
|
-
}
|
|
12
|
-
export function getPrimaryLockSDKRuntime() {
|
|
13
|
-
return primaryRuntime;
|
|
14
|
-
}
|
|
15
|
-
export function clearPrimaryLockSDKInstance() {
|
|
16
|
-
primaryDevId = null;
|
|
17
|
-
primaryRuntime = null;
|
|
18
|
-
}
|
|
19
|
-
export function clearPrimaryLockSDKInstanceIfDevId(devId) {
|
|
20
|
-
if (primaryDevId === devId) {
|
|
21
|
-
primaryDevId = null;
|
|
22
|
-
primaryRuntime = null;
|
|
23
|
-
}
|
|
24
|
-
}
|