@ray-js/lock-sdk 1.2.0-beta.1 → 1.2.0-beta.11
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/index.d.ts +3 -1
- package/lib/api/index.js +16 -0
- package/lib/api/notify.d.ts +28 -0
- package/lib/api/notify.js +17 -0
- package/lib/api/screen.d.ts +1 -0
- package/lib/api/service.d.ts +26 -0
- package/lib/api/service.js +25 -0
- package/lib/api/video.d.ts +9 -0
- package/lib/api/video.js +30 -0
- package/lib/api/voip.d.ts +10 -0
- package/lib/api/voip.js +17 -0
- package/lib/config/dp-code/index.d.ts +1 -0
- package/lib/config/dp-code/index.js +1 -0
- package/lib/config/dp-map/media.d.ts +13 -0
- package/lib/config/dp-map/media.js +19 -0
- package/lib/entries/fit/index.js +1 -1
- package/lib/entries/main/bootstrap/bootstrap.js +1 -0
- package/lib/entries/main/exports/ai.d.ts +4 -0
- package/lib/entries/main/exports/ai.js +11 -0
- package/lib/entries/main/exports/index.d.ts +4 -0
- package/lib/entries/main/exports/index.js +4 -0
- package/lib/entries/main/exports/media.d.ts +10 -1
- package/lib/entries/main/exports/media.js +29 -1
- package/lib/entries/main/exports/misc.d.ts +1 -1
- package/lib/entries/main/exports/notify.d.ts +7 -0
- package/lib/entries/main/exports/notify.js +8 -0
- package/lib/entries/main/exports/screen/bind.d.ts +6 -3
- package/lib/entries/main/exports/screen/bind.js +7 -0
- package/lib/entries/main/exports/service.d.ts +4 -0
- package/lib/entries/main/exports/service.js +11 -0
- package/lib/entries/main/exports/voip.d.ts +3 -0
- package/lib/entries/main/exports/voip.js +8 -0
- package/lib/entries/main/index.js +1 -1
- package/lib/entries/screen/exports/bind-events.d.ts +4 -0
- package/lib/entries/screen/exports/bind-events.js +8 -0
- package/lib/entries/screen/exports/index.d.ts +1 -0
- package/lib/entries/screen/exports/index.js +1 -0
- package/lib/feature/ai/report.d.ts +5 -0
- package/lib/feature/ai/report.js +37 -0
- package/lib/feature/media/camera.d.ts +18 -0
- package/lib/feature/media/camera.js +36 -0
- package/lib/feature/media/media.d.ts +10 -0
- package/lib/feature/media/media.js +31 -0
- package/lib/feature/misc/capability.js +63 -6
- package/lib/feature/misc/connect-device.js +2 -1
- package/lib/feature/notify/notify.d.ts +4 -0
- package/lib/feature/notify/notify.js +3 -0
- package/lib/feature/password/temporary/custom-dp.js +59 -54
- package/lib/feature/screen/bind-watch.d.ts +18 -0
- package/lib/feature/screen/bind-watch.js +92 -0
- package/lib/feature/screen/bind.d.ts +2 -2
- package/lib/feature/screen/bind.js +8 -38
- package/lib/feature/screen/list.js +13 -0
- package/lib/feature/service/goto-service.d.ts +3 -2
- package/lib/feature/service/goto-service.js +7 -1
- package/lib/feature/service/value-added.d.ts +4 -0
- package/lib/feature/service/value-added.js +4 -0
- package/lib/feature/state/device-status.js +2 -2
- package/lib/feature/state/init-state.js +26 -18
- package/lib/feature/state/remote-permissions.js +16 -0
- package/lib/feature/storage/index.d.ts +5 -0
- package/lib/feature/storage/index.js +32 -0
- package/lib/feature/unlock/sync/unlock-method.js +3 -0
- package/lib/feature/voip/voip.d.ts +3 -0
- package/lib/feature/voip/voip.js +3 -0
- package/lib/interface.d.ts +25 -1
- package/lib/platform/device.d.ts +5 -4
- package/lib/platform/device.js +1 -1
- package/lib/platform/index.d.ts +1 -0
- package/lib/platform/index.js +1 -0
- package/lib/platform/ipc.d.ts +3 -0
- package/lib/platform/ipc.js +23 -7
- package/lib/platform/storage.d.ts +3 -0
- package/lib/platform/storage.js +9 -0
- package/lib/runtime/lock-config.d.ts +3 -1
- package/lib/runtime/lock-config.js +2 -0
- package/lib/utils/errors.js +3 -1
- package/lib/utils/index.d.ts +35 -0
- package/lib/utils/index.js +11 -1
- package/lib/utils/parse.js +1 -1
- package/package.json +1 -1
package/lib/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DpValue } from "../interface";
|
|
1
|
+
import { AIReportPopup, DpValue } from "../interface";
|
|
2
2
|
export declare const sendPhoneVerifyCode: (params: {
|
|
3
3
|
account: string;
|
|
4
4
|
devId: string;
|
|
@@ -35,4 +35,6 @@ export declare const getFileRemoteUrl: ({ biz, resources, }: {
|
|
|
35
35
|
}) => Promise<{
|
|
36
36
|
signedUrls: Record<string, string>;
|
|
37
37
|
}>;
|
|
38
|
+
export declare const fetchAIReportPopup: (devId: string) => Promise<AIReportPopup | null>;
|
|
39
|
+
export declare const acknowledgeAIReport: (devId: string, reportId: string) => Promise<void>;
|
|
38
40
|
export {};
|
package/lib/api/index.js
CHANGED
|
@@ -90,3 +90,19 @@ export const getFileRemoteUrl = ({ biz, resources, }) => {
|
|
|
90
90
|
},
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
+
export const fetchAIReportPopup = (devId) => {
|
|
94
|
+
return requestApi({
|
|
95
|
+
logName: "fetchAIReportPopup",
|
|
96
|
+
api: "m.lock.ai.report.popup",
|
|
97
|
+
version: "1.0",
|
|
98
|
+
data: { devId },
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
export const acknowledgeAIReport = (devId, reportId) => {
|
|
102
|
+
return requestApi({
|
|
103
|
+
logName: "acknowledgeAIReport",
|
|
104
|
+
api: "m.lock.ai.report.acknowledge",
|
|
105
|
+
version: "1.0",
|
|
106
|
+
data: { devId, reportId },
|
|
107
|
+
});
|
|
108
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface VasNotifyPushConfig {
|
|
2
|
+
appNotify?: boolean;
|
|
3
|
+
iosVoip?: boolean;
|
|
4
|
+
cloudPhone?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface VasNotifyScene {
|
|
7
|
+
enable: boolean;
|
|
8
|
+
pushConfig?: VasNotifyPushConfig;
|
|
9
|
+
}
|
|
10
|
+
export interface VasNotifyConfig {
|
|
11
|
+
alert?: boolean | VasNotifyScene;
|
|
12
|
+
doorBell?: VasNotifyScene;
|
|
13
|
+
lockDoor?: VasNotifyScene;
|
|
14
|
+
unlockDoor?: VasNotifyScene & {
|
|
15
|
+
contacts?: Array<Record<string, any>>;
|
|
16
|
+
};
|
|
17
|
+
cloudPhone?: boolean;
|
|
18
|
+
iosVoip?: boolean;
|
|
19
|
+
appNotify?: boolean;
|
|
20
|
+
[k: string]: any;
|
|
21
|
+
}
|
|
22
|
+
export interface UpdateVasNotifyConfigParams {
|
|
23
|
+
key: string;
|
|
24
|
+
enable: boolean;
|
|
25
|
+
userId?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const getVasNotifyConfigApi: (devId: string) => Promise<VasNotifyConfig>;
|
|
28
|
+
export declare const updateVasNotifyConfigApi: (devId: string, params: UpdateVasNotifyConfigParams) => Promise<VasNotifyConfig>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { requestApi } from "./request";
|
|
2
|
+
export const getVasNotifyConfigApi = (devId) => {
|
|
3
|
+
return requestApi({
|
|
4
|
+
logName: "getVasNotifyConfig",
|
|
5
|
+
api: "m.lock.vas.notify.config.get",
|
|
6
|
+
version: "1.0",
|
|
7
|
+
data: { devId },
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const updateVasNotifyConfigApi = (devId, params) => {
|
|
11
|
+
return requestApi({
|
|
12
|
+
logName: "updateVasNotifyConfig",
|
|
13
|
+
api: "m.lock.vas.notify.config.update",
|
|
14
|
+
version: "1.0",
|
|
15
|
+
data: { devId, ...params },
|
|
16
|
+
});
|
|
17
|
+
};
|
package/lib/api/screen.d.ts
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface CloudServiceStatus {
|
|
2
|
+
isExit: boolean;
|
|
3
|
+
duration: number;
|
|
4
|
+
imgDuration: number;
|
|
5
|
+
hasPurchasedOrder: boolean;
|
|
6
|
+
isFree: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ServiceBenefitPopupItem {
|
|
9
|
+
name: string;
|
|
10
|
+
serviceCode: string;
|
|
11
|
+
catalogCode: string;
|
|
12
|
+
batchId: string;
|
|
13
|
+
expireTime: number;
|
|
14
|
+
usedTimes?: number;
|
|
15
|
+
numPerDevice?: number;
|
|
16
|
+
popupType: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ClaimResultItem {
|
|
19
|
+
success: boolean;
|
|
20
|
+
errorCode?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
purchasedName?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const getCloudServiceStatusApi: (devId: string) => Promise<CloudServiceStatus>;
|
|
25
|
+
export declare const getServicePopupListApi: (devId: string) => Promise<ServiceBenefitPopupItem[]>;
|
|
26
|
+
export declare const claimServiceApi: (devId: string, batchId: string) => Promise<ClaimResultItem[]>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { requestApi } from "./request";
|
|
2
|
+
export const getCloudServiceStatusApi = (devId) => {
|
|
3
|
+
return requestApi({
|
|
4
|
+
logName: "getCloudServiceStatus",
|
|
5
|
+
api: "m.lock.media.effect.credential",
|
|
6
|
+
version: "1.0",
|
|
7
|
+
data: { devId },
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const getServicePopupListApi = (devId) => {
|
|
11
|
+
return requestApi({
|
|
12
|
+
logName: "getServicePopupList",
|
|
13
|
+
api: "m.lock.vas.popup.content",
|
|
14
|
+
version: "1.0",
|
|
15
|
+
data: { devId, catalogCodes: "" },
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export const claimServiceApi = (devId, batchId) => {
|
|
19
|
+
return requestApi({
|
|
20
|
+
logName: "claimService",
|
|
21
|
+
api: "m.lock.vas.collect.trigger",
|
|
22
|
+
version: "1.0",
|
|
23
|
+
data: { devId, catalogCodes: "", batchId },
|
|
24
|
+
});
|
|
25
|
+
};
|
package/lib/api/video.d.ts
CHANGED
|
@@ -28,4 +28,13 @@ export declare const getIPCConfig: (devId: string) => Promise<{
|
|
|
28
28
|
hardwareCapability: number[];
|
|
29
29
|
};
|
|
30
30
|
}>;
|
|
31
|
+
export interface MediaViewTimesResult {
|
|
32
|
+
count: number;
|
|
33
|
+
}
|
|
34
|
+
export declare const getMediaViewTimes: (devId: string) => Promise<MediaViewTimesResult>;
|
|
35
|
+
export declare const setMediaViewTimes: (devId: string) => Promise<MediaViewTimesResult>;
|
|
36
|
+
export interface getAlbumDateListResult {
|
|
37
|
+
dateList: string[];
|
|
38
|
+
}
|
|
39
|
+
export declare const getAlbumDateList: (devId: string) => Promise<getAlbumDateListResult>;
|
|
31
40
|
export {};
|
package/lib/api/video.js
CHANGED
|
@@ -30,3 +30,33 @@ export const getIPCConfig = (devId) => {
|
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
|
+
export const getMediaViewTimes = (devId) => {
|
|
34
|
+
return requestApi({
|
|
35
|
+
logName: "getMediaViewTimes",
|
|
36
|
+
api: `${THING}.m.device.lock.media.view.times.get`,
|
|
37
|
+
version: "1.0",
|
|
38
|
+
data: {
|
|
39
|
+
devId,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
export const setMediaViewTimes = (devId) => {
|
|
44
|
+
return requestApi({
|
|
45
|
+
logName: "setMediaViewTimes",
|
|
46
|
+
api: `${THING}.m.device.lock.media.view.times.set`,
|
|
47
|
+
version: "1.0",
|
|
48
|
+
data: {
|
|
49
|
+
devId,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
export const getAlbumDateList = (devId) => {
|
|
54
|
+
return requestApi({
|
|
55
|
+
logName: "getAlbumDateList",
|
|
56
|
+
api: "m.lock.album.media.date.list",
|
|
57
|
+
version: "1.0",
|
|
58
|
+
data: {
|
|
59
|
+
devId,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface VoipAuth {
|
|
2
|
+
isAuth: boolean;
|
|
3
|
+
isValid: boolean;
|
|
4
|
+
userId: string;
|
|
5
|
+
userName: string;
|
|
6
|
+
avatarUrl: string;
|
|
7
|
+
[k: string]: any;
|
|
8
|
+
}
|
|
9
|
+
export declare const getVoipAuthApi: (devId: string) => Promise<VoipAuth>;
|
|
10
|
+
export declare const saveVoipAuthApi: (devId: string, userId: string) => Promise<boolean>;
|
package/lib/api/voip.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { requestApi } from "./request";
|
|
2
|
+
export const getVoipAuthApi = (devId) => {
|
|
3
|
+
return requestApi({
|
|
4
|
+
logName: "getVoipAuth",
|
|
5
|
+
api: "m.lock.device.voip.auth.get",
|
|
6
|
+
version: "1.0",
|
|
7
|
+
data: { devId },
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const saveVoipAuthApi = (devId, userId) => {
|
|
11
|
+
return requestApi({
|
|
12
|
+
logName: "saveVoipAuth",
|
|
13
|
+
api: "m.lock.device.voip.auth.save",
|
|
14
|
+
version: "1.0",
|
|
15
|
+
data: { devId, userId },
|
|
16
|
+
});
|
|
17
|
+
};
|
|
@@ -67,6 +67,7 @@ declare const dpCodes: {
|
|
|
67
67
|
readonly doorOpened: "door_opened";
|
|
68
68
|
readonly unlockApp: "unlock_app";
|
|
69
69
|
readonly initiativeMessage: "initiative_message";
|
|
70
|
+
readonly locationSelect: "location_select";
|
|
70
71
|
readonly manualLock: "manual_lock";
|
|
71
72
|
readonly checkCodeSet: "check_code_set";
|
|
72
73
|
readonly bleKeyCreate: "ble_key_create";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const locationSelectReportMap: readonly [{
|
|
2
|
+
readonly name: "status";
|
|
3
|
+
}, {
|
|
4
|
+
readonly name: "list";
|
|
5
|
+
readonly bytes: 2;
|
|
6
|
+
readonly loop: true;
|
|
7
|
+
readonly type: "child";
|
|
8
|
+
readonly childMap: readonly [{
|
|
9
|
+
readonly name: "index";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "type";
|
|
12
|
+
}];
|
|
13
|
+
}];
|
package/lib/entries/fit/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export const initFit = async (options) => {
|
|
|
18
18
|
const { devInfo, deviceId } = opts;
|
|
19
19
|
if (!devInfo && !deviceId) {
|
|
20
20
|
const { query } = getLaunchOptionsSync();
|
|
21
|
-
opts.deviceId = query
|
|
21
|
+
opts.deviceId = query['deviceId'];
|
|
22
22
|
if (!opts.deviceId) {
|
|
23
23
|
throw getError(1000);
|
|
24
24
|
}
|
|
@@ -47,6 +47,7 @@ export async function applyLockOptionsToRuntime(runtime, options) {
|
|
|
47
47
|
config.idsByCode = idsByCode;
|
|
48
48
|
config.supportBigData = !!dpSchema[dpCodes.synchMethodW];
|
|
49
49
|
config.preFetch = options?.preFetch ?? false;
|
|
50
|
+
config.notSupportWake = options?.notSupportWake ?? false;
|
|
50
51
|
config.communication = getCapabilities(devInfo.capability).map((item) => item.id);
|
|
51
52
|
sdkLog("info", "bootstrap", "applyOptions", {
|
|
52
53
|
devId: config.devInfo.devId,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
+
import { getAIReportForRuntime, acknowledgeAIReportForRuntime, isAIReportEnabledForRuntime, } from "../../../feature/ai/report";
|
|
3
|
+
export async function getAIReport() {
|
|
4
|
+
return getAIReportForRuntime(resolveRuntimeFromExportThis(this));
|
|
5
|
+
}
|
|
6
|
+
export async function acknowledgeAIReport(reportId) {
|
|
7
|
+
return acknowledgeAIReportForRuntime(resolveRuntimeFromExportThis(this), reportId);
|
|
8
|
+
}
|
|
9
|
+
export async function isAIReportEnabled() {
|
|
10
|
+
return isAIReportEnabledForRuntime(resolveRuntimeFromExportThis(this));
|
|
11
|
+
}
|
|
@@ -11,10 +11,14 @@ export * from "./log";
|
|
|
11
11
|
export * from "./signal";
|
|
12
12
|
export * from "./sleep";
|
|
13
13
|
export * from "./misc";
|
|
14
|
+
export * from "./service";
|
|
15
|
+
export * from "./notify";
|
|
16
|
+
export * from "./voip";
|
|
14
17
|
export * from "./media";
|
|
15
18
|
export * from "./voice-file";
|
|
16
19
|
export * from "./linkage";
|
|
17
20
|
export * from "./capability";
|
|
21
|
+
export * from "./ai";
|
|
18
22
|
export * from "./accessory-binding";
|
|
19
23
|
export * from "./screen/list";
|
|
20
24
|
export * from "./screen/bind";
|
|
@@ -11,10 +11,14 @@ export * from "./log";
|
|
|
11
11
|
export * from "./signal";
|
|
12
12
|
export * from "./sleep";
|
|
13
13
|
export * from "./misc";
|
|
14
|
+
export * from "./service";
|
|
15
|
+
export * from "./notify";
|
|
16
|
+
export * from "./voip";
|
|
14
17
|
export * from "./media";
|
|
15
18
|
export * from "./voice-file";
|
|
16
19
|
export * from "./linkage";
|
|
17
20
|
export * from "./capability";
|
|
21
|
+
export * from "./ai";
|
|
18
22
|
export * from "./accessory-binding";
|
|
19
23
|
export * from "./screen/list";
|
|
20
24
|
export * from "./screen/bind";
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { GetMediaUrlParams, OpenLocalAlbumParams } from "../../../feature/media/media";
|
|
1
|
+
import { GetMediaUrlParams, OpenLocalAlbumParams, GotoPlaybackParams } from "../../../feature/media/media";
|
|
2
2
|
export declare function getMediaUrl(params: GetMediaUrlParams): Promise<import("../../../feature/media/media").MediaUrlResult>;
|
|
3
3
|
export declare function isSupportMedia(): boolean;
|
|
4
4
|
export declare function getMediaRotate(): import("../../../feature/media/rotate").MediaRotate;
|
|
5
5
|
export declare function getMediaInfo(): import("../../../feature/media/media").MediaInfo;
|
|
6
6
|
export declare function openLocalAlbum(params?: OpenLocalAlbumParams): Promise<void>;
|
|
7
|
+
export declare function gotoPlayback(params?: GotoPlaybackParams): Promise<void>;
|
|
8
|
+
export declare function isSupportMultiCamera(): boolean;
|
|
9
|
+
export declare function getCameraInfo(): import("../../../feature/media/camera").CameraDpInfo | undefined;
|
|
10
|
+
export declare function queryCameraInfo(): Promise<import("../../../feature/media/camera").CameraInfo | undefined>;
|
|
11
|
+
export declare function switchCamera(index: number): Promise<true>;
|
|
12
|
+
export declare function getMediaViewTimes(): Promise<import("../../../api/video").MediaViewTimesResult>;
|
|
13
|
+
export declare function addMediaViewTimes(): Promise<import("../../../api/video").MediaViewTimesResult>;
|
|
14
|
+
export declare function getAlbumDateList(): Promise<import("../../../api/video").getAlbumDateListResult>;
|
|
15
|
+
export declare function getCameraConfig(): import("../../..").CameraConfig[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
-
import { getMediaUrlForRuntime, isSupportMediaForRuntime, openLocalAlbumForRuntime, getMediaInfoForRuntime, } from "../../../feature/media/media";
|
|
2
|
+
import { getMediaUrlForRuntime, isSupportMediaForRuntime, openLocalAlbumForRuntime, gotoPlaybackForRuntime, getMediaInfoForRuntime, getMediaViewTimesForRuntime, setMediaViewTimesForRuntime, getAlbumDateListForRuntime, } from "../../../feature/media/media";
|
|
3
3
|
import { getMediaRotateForRuntime } from "../../../feature/media/rotate";
|
|
4
|
+
import { isSupportMultiCameraForRuntime, getCameraInfoForRuntime, queryCameraInfoForRuntime, switchCameraForRuntime, getCameraConfigForRuntime, } from "../../../feature/media/camera";
|
|
4
5
|
export async function getMediaUrl(params) {
|
|
5
6
|
return getMediaUrlForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
6
7
|
}
|
|
@@ -16,3 +17,30 @@ export function getMediaInfo() {
|
|
|
16
17
|
export function openLocalAlbum(params) {
|
|
17
18
|
return openLocalAlbumForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
18
19
|
}
|
|
20
|
+
export function gotoPlayback(params) {
|
|
21
|
+
return gotoPlaybackForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
22
|
+
}
|
|
23
|
+
export function isSupportMultiCamera() {
|
|
24
|
+
return isSupportMultiCameraForRuntime(resolveRuntimeFromExportThis(this));
|
|
25
|
+
}
|
|
26
|
+
export function getCameraInfo() {
|
|
27
|
+
return getCameraInfoForRuntime(resolveRuntimeFromExportThis(this));
|
|
28
|
+
}
|
|
29
|
+
export async function queryCameraInfo() {
|
|
30
|
+
return queryCameraInfoForRuntime(resolveRuntimeFromExportThis(this));
|
|
31
|
+
}
|
|
32
|
+
export async function switchCamera(index) {
|
|
33
|
+
return switchCameraForRuntime(resolveRuntimeFromExportThis(this), index);
|
|
34
|
+
}
|
|
35
|
+
export async function getMediaViewTimes() {
|
|
36
|
+
return getMediaViewTimesForRuntime(resolveRuntimeFromExportThis(this));
|
|
37
|
+
}
|
|
38
|
+
export async function addMediaViewTimes() {
|
|
39
|
+
return setMediaViewTimesForRuntime(resolveRuntimeFromExportThis(this));
|
|
40
|
+
}
|
|
41
|
+
export async function getAlbumDateList() {
|
|
42
|
+
return getAlbumDateListForRuntime(resolveRuntimeFromExportThis(this));
|
|
43
|
+
}
|
|
44
|
+
export function getCameraConfig() {
|
|
45
|
+
return getCameraConfigForRuntime(resolveRuntimeFromExportThis(this));
|
|
46
|
+
}
|
|
@@ -14,5 +14,5 @@ export interface UpdateDpPeriodTimeOption {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function updateDpPeriodTime(dpCode: string, data: UpdateDpPeriodTimeParams, option?: UpdateDpPeriodTimeOption): Promise<void>;
|
|
16
16
|
export declare function connectDevice(): Promise<true>;
|
|
17
|
-
export declare function gotoService(params?: GotoServiceParams): Promise<
|
|
17
|
+
export declare function gotoService(params?: GotoServiceParams): Promise<void>;
|
|
18
18
|
export declare function validatePwdComplexity(password: string): Promise<boolean>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { VasNotifyConfig, VasNotifyScene, VasNotifyPushConfig, UpdateVasNotifyConfigParams, } from "../../../api/notify";
|
|
2
|
+
export declare function getVasNotifyConfig(): Promise<import("../../../api/notify").VasNotifyConfig>;
|
|
3
|
+
export declare function updateVasNotifyConfig(params: {
|
|
4
|
+
key: string;
|
|
5
|
+
enable: boolean;
|
|
6
|
+
userId?: string;
|
|
7
|
+
}): Promise<import("../../../api/notify").VasNotifyConfig>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
+
import { getVasNotifyConfigForRuntime, updateVasNotifyConfigForRuntime, } from "../../../feature/notify/notify";
|
|
3
|
+
export async function getVasNotifyConfig() {
|
|
4
|
+
return getVasNotifyConfigForRuntime(resolveRuntimeFromExportThis(this));
|
|
5
|
+
}
|
|
6
|
+
export async function updateVasNotifyConfig(params) {
|
|
7
|
+
return updateVasNotifyConfigForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
8
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import { type BindLockToScreenEvent, type BindLockToScreenListener } from "../../../../feature/screen/bind-watch";
|
|
2
|
+
import type { AddBindingResult, BindingResult, UnbindingResult } from "../../../../api/screen";
|
|
3
|
+
export type { AddBindingResult, BindingResult, UnbindingResult, BindLockToScreenEvent, BindLockToScreenListener, };
|
|
4
|
+
export declare function bindLockToScreen(lockDevId: string): Promise<AddBindingResult>;
|
|
5
|
+
export declare function onBindLockToScreen(listener: BindLockToScreenListener): void;
|
|
6
|
+
export declare function offBindLockToScreen(listener: BindLockToScreenListener): void;
|
|
4
7
|
export declare function unbindLockFromScreen(relationId: string): Promise<UnbindingResult>;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { bindLockForRuntime, unbindLockForRuntime, } from "../../../../feature/screen/bind";
|
|
2
|
+
import { onBindLockToScreenForRuntime, offBindLockToScreenForRuntime, } from "../../../../feature/screen/bind-watch";
|
|
2
3
|
import { resolveRuntimeFromExportThis } from "../../bootstrap/resolve-runtime-from-export-this";
|
|
3
4
|
export function bindLockToScreen(lockDevId) {
|
|
4
5
|
return bindLockForRuntime(resolveRuntimeFromExportThis(this), lockDevId);
|
|
5
6
|
}
|
|
7
|
+
export function onBindLockToScreen(listener) {
|
|
8
|
+
onBindLockToScreenForRuntime(resolveRuntimeFromExportThis(this), listener);
|
|
9
|
+
}
|
|
10
|
+
export function offBindLockToScreen(listener) {
|
|
11
|
+
offBindLockToScreenForRuntime(resolveRuntimeFromExportThis(this), listener);
|
|
12
|
+
}
|
|
6
13
|
export function unbindLockFromScreen(relationId) {
|
|
7
14
|
return unbindLockForRuntime(resolveRuntimeFromExportThis(this), relationId);
|
|
8
15
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { CloudServiceStatus, ServiceBenefitPopupItem, ClaimResultItem, } from "../../../api/service";
|
|
2
|
+
export declare function getCloudServiceStatus(): Promise<import("../../../api/service").CloudServiceStatus>;
|
|
3
|
+
export declare function getServicePopupList(): Promise<import("../../../api/service").ServiceBenefitPopupItem[]>;
|
|
4
|
+
export declare function claimService(batchId: string): Promise<import("../../../api/service").ClaimResultItem[]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
+
import { getCloudServiceStatusForRuntime, getServicePopupListForRuntime, claimServiceForRuntime, } from "../../../feature/service/value-added";
|
|
3
|
+
export async function getCloudServiceStatus() {
|
|
4
|
+
return getCloudServiceStatusForRuntime(resolveRuntimeFromExportThis(this));
|
|
5
|
+
}
|
|
6
|
+
export async function getServicePopupList() {
|
|
7
|
+
return getServicePopupListForRuntime(resolveRuntimeFromExportThis(this));
|
|
8
|
+
}
|
|
9
|
+
export async function claimService(batchId) {
|
|
10
|
+
return claimServiceForRuntime(resolveRuntimeFromExportThis(this), batchId);
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
+
import { getVoipAuthForRuntime, saveVoipAuthForRuntime, } from "../../../feature/voip/voip";
|
|
3
|
+
export async function getVoipAuth() {
|
|
4
|
+
return getVoipAuthForRuntime(resolveRuntimeFromExportThis(this));
|
|
5
|
+
}
|
|
6
|
+
export async function saveVoipAuth(userId) {
|
|
7
|
+
return saveVoipAuthForRuntime(resolveRuntimeFromExportThis(this), userId);
|
|
8
|
+
}
|
|
@@ -18,7 +18,7 @@ export const init = async (options) => {
|
|
|
18
18
|
const { devInfo, deviceId } = opts;
|
|
19
19
|
if (!devInfo && !deviceId) {
|
|
20
20
|
const { query } = getLaunchOptionsSync();
|
|
21
|
-
opts.deviceId = query
|
|
21
|
+
opts.deviceId = query['deviceId'];
|
|
22
22
|
if (!opts.deviceId) {
|
|
23
23
|
throw getError(1000);
|
|
24
24
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type BindLockToScreenEvent, type BindLockToScreenListener } from "../../../feature/screen/bind-watch";
|
|
2
|
+
export type { BindLockToScreenEvent, BindLockToScreenListener };
|
|
3
|
+
export declare function onBindLockToScreen(listener: BindLockToScreenListener): void;
|
|
4
|
+
export declare function offBindLockToScreen(listener: BindLockToScreenListener): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { onBindLockToScreenForRuntime, offBindLockToScreenForRuntime, } from "../../../feature/screen/bind-watch";
|
|
2
|
+
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
3
|
+
export function onBindLockToScreen(listener) {
|
|
4
|
+
onBindLockToScreenForRuntime(resolveRuntimeFromExportThis(this), listener);
|
|
5
|
+
}
|
|
6
|
+
export function offBindLockToScreen(listener) {
|
|
7
|
+
offBindLockToScreenForRuntime(resolveRuntimeFromExportThis(this), listener);
|
|
8
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AIReportPopup } from "../../interface";
|
|
2
|
+
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
3
|
+
export declare const isAIReportEnabledForRuntime: (runtime: LockDeviceRuntime) => Promise<boolean>;
|
|
4
|
+
export declare const getAIReportForRuntime: (runtime: LockDeviceRuntime) => Promise<AIReportPopup | null>;
|
|
5
|
+
export declare const acknowledgeAIReportForRuntime: (runtime: LockDeviceRuntime, reportId: string) => Promise<void>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { fetchAIReportPopup, acknowledgeAIReport as acknowledgeAIReportApi, } from "../../api";
|
|
2
|
+
import { getDeviceProperties } from "../../api/setting";
|
|
3
|
+
import { getDeviceAdvancedAbilitiesForRuntime } from "../misc/capability";
|
|
4
|
+
const LOCK_UNLOCK_REPORT = "LOCK_UNLOCK_REPORT";
|
|
5
|
+
export const isAIReportEnabledForRuntime = async (runtime) => {
|
|
6
|
+
const ability = await getDeviceAdvancedAbilitiesForRuntime(runtime);
|
|
7
|
+
const dataReport = !!ability?.ai?.config?.["ai_data_report"];
|
|
8
|
+
if (!dataReport) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const props = await getDeviceProperties(runtime.devId, [LOCK_UNLOCK_REPORT]);
|
|
13
|
+
return props?.[LOCK_UNLOCK_REPORT] !== "false";
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const getAIReportForRuntime = async (runtime) => {
|
|
20
|
+
const enabled = await isAIReportEnabledForRuntime(runtime);
|
|
21
|
+
if (!enabled) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const res = await fetchAIReportPopup(runtime.devId);
|
|
26
|
+
return res?.reportId ? res : null;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const acknowledgeAIReportForRuntime = async (runtime, reportId) => {
|
|
33
|
+
if (!reportId) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
await acknowledgeAIReportApi(runtime.devId, reportId);
|
|
37
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
+
import type { CameraConfig, DpMapDataType } from "../../interface";
|
|
3
|
+
import { locationSelectReportMap } from "../../config/dp-map/media";
|
|
4
|
+
export type CameraInfo = DpMapDataType<typeof locationSelectReportMap>;
|
|
5
|
+
export declare const isSupportMultiCameraForRuntime: (runtime: LockDeviceRuntime) => boolean;
|
|
6
|
+
interface CameraItem {
|
|
7
|
+
index: number;
|
|
8
|
+
type: number;
|
|
9
|
+
}
|
|
10
|
+
export interface CameraDpInfo {
|
|
11
|
+
status: number;
|
|
12
|
+
list: CameraItem[];
|
|
13
|
+
}
|
|
14
|
+
export declare const getCameraInfoForRuntime: (runtime: LockDeviceRuntime) => CameraDpInfo | undefined;
|
|
15
|
+
export declare const queryCameraInfoForRuntime: (runtime: LockDeviceRuntime) => Promise<CameraInfo | undefined>;
|
|
16
|
+
export declare const switchCameraForRuntime: (runtime: LockDeviceRuntime, index: number) => Promise<true>;
|
|
17
|
+
export declare const getCameraConfigForRuntime: (runtime: LockDeviceRuntime) => CameraConfig[];
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import dpUtils from "@ray-js/tuya-dp-transform";
|
|
2
|
+
import dpCodes from "../../config/dp-code";
|
|
3
|
+
import { locationSelectReportMap } from "../../config/dp-map/media";
|
|
4
|
+
import { getDpValueForRuntime } from "../dp/get-dp-value";
|
|
5
|
+
import { hasDpForRuntime } from "../dp/has-dp";
|
|
6
|
+
import { publishDpsForRuntime } from "../dp/publish-dps";
|
|
7
|
+
import { getError } from "../../utils/errors";
|
|
8
|
+
export const isSupportMultiCameraForRuntime = (runtime) => hasDpForRuntime(runtime, dpCodes.locationSelect);
|
|
9
|
+
export const getCameraInfoForRuntime = (runtime) => {
|
|
10
|
+
const raw = getDpValueForRuntime(runtime, dpCodes.locationSelect);
|
|
11
|
+
if (!raw) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return dpUtils.parse(raw, locationSelectReportMap);
|
|
15
|
+
};
|
|
16
|
+
export const queryCameraInfoForRuntime = async (runtime) => {
|
|
17
|
+
await publishDpsForRuntime(runtime, { [dpCodes.locationSelect]: "ff" });
|
|
18
|
+
return getCameraInfoForRuntime(runtime);
|
|
19
|
+
};
|
|
20
|
+
export const switchCameraForRuntime = async (runtime, index) => {
|
|
21
|
+
const value = index.toString(16).padStart(2, "0");
|
|
22
|
+
await publishDpsForRuntime(runtime, { [dpCodes.locationSelect]: value });
|
|
23
|
+
const info = getCameraInfoForRuntime(runtime);
|
|
24
|
+
switch (info?.status) {
|
|
25
|
+
case 0:
|
|
26
|
+
return true;
|
|
27
|
+
case 2:
|
|
28
|
+
throw getError(1105);
|
|
29
|
+
case 1:
|
|
30
|
+
default:
|
|
31
|
+
throw getError(1104);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export const getCameraConfigForRuntime = (runtime) => {
|
|
35
|
+
return runtime.config.cameraConfig;
|
|
36
|
+
};
|