@ray-js/lock-sdk 1.2.0-beta.5 → 1.2.0-beta.7
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/notify.d.ts +28 -0
- package/lib/api/notify.js +17 -0
- package/lib/api/service.d.ts +26 -0
- package/lib/api/service.js +25 -0
- package/lib/api/voip.d.ts +10 -0
- package/lib/api/voip.js +17 -0
- package/lib/entries/main/exports/index.d.ts +3 -0
- package/lib/entries/main/exports/index.js +3 -0
- package/lib/entries/main/exports/media.d.ts +2 -1
- package/lib/entries/main/exports/media.js +4 -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/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/feature/media/camera.js +1 -1
- package/lib/feature/media/media.d.ts +6 -0
- package/lib/feature/media/media.js +21 -0
- package/lib/feature/misc/capability.js +77 -6
- package/lib/feature/notify/notify.d.ts +4 -0
- package/lib/feature/notify/notify.js +3 -0
- package/lib/feature/service/goto-service.d.ts +2 -1
- 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/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 +13 -1
- package/lib/platform/index.d.ts +1 -0
- package/lib/platform/index.js +1 -0
- package/lib/platform/storage.d.ts +3 -0
- package/lib/platform/storage.js +9 -0
- package/package.json +1 -1
|
@@ -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
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -11,6 +11,9 @@ 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";
|
|
@@ -11,6 +11,9 @@ 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";
|
|
@@ -1,9 +1,10 @@
|
|
|
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>;
|
|
7
8
|
export declare function isSupportMultiCamera(): boolean;
|
|
8
9
|
export declare function getCameraInfo(): import("../../../feature/media/camera").CameraInfo | undefined;
|
|
9
10
|
export declare function queryCameraInfo(): Promise<import("../../../feature/media/camera").CameraInfo | undefined>;
|
|
@@ -1,5 +1,5 @@
|
|
|
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, } from "../../../feature/media/media";
|
|
3
3
|
import { getMediaRotateForRuntime } from "../../../feature/media/rotate";
|
|
4
4
|
import { isSupportMultiCameraForRuntime, getCameraInfoForRuntime, queryCameraInfoForRuntime, switchCameraForRuntime, } from "../../../feature/media/camera";
|
|
5
5
|
export async function getMediaUrl(params) {
|
|
@@ -17,6 +17,9 @@ export function getMediaInfo() {
|
|
|
17
17
|
export function openLocalAlbum(params) {
|
|
18
18
|
return openLocalAlbumForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
19
19
|
}
|
|
20
|
+
export function gotoPlayback(params) {
|
|
21
|
+
return gotoPlaybackForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
22
|
+
}
|
|
20
23
|
export function isSupportMultiCamera() {
|
|
21
24
|
return isSupportMultiCameraForRuntime(resolveRuntimeFromExportThis(this));
|
|
22
25
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -4,7 +4,7 @@ import { locationSelectReportMap } from "../../config/dp-map/media";
|
|
|
4
4
|
import { getDpValueForRuntime } from "../dp/get-dp-value";
|
|
5
5
|
import { hasDpForRuntime } from "../dp/has-dp";
|
|
6
6
|
import { publishDpsForRuntime } from "../dp/publish-dps";
|
|
7
|
-
import { getError } from "
|
|
7
|
+
import { getError } from "../../utils/errors";
|
|
8
8
|
export const isSupportMultiCameraForRuntime = (runtime) => hasDpForRuntime(runtime, dpCodes.locationSelect);
|
|
9
9
|
export const getCameraInfoForRuntime = (runtime) => {
|
|
10
10
|
const raw = getDpValueForRuntime(runtime, dpCodes.locationSelect);
|
|
@@ -19,6 +19,12 @@ export interface OpenLocalAlbumParams {
|
|
|
19
19
|
serviceCode?: string;
|
|
20
20
|
}
|
|
21
21
|
export declare const openLocalAlbumForRuntime: (runtime: LockDeviceRuntime, params?: OpenLocalAlbumParams) => Promise<void>;
|
|
22
|
+
export interface GotoPlaybackParams {
|
|
23
|
+
tabs?: ("local" | "cloud")[];
|
|
24
|
+
isLowPower?: boolean;
|
|
25
|
+
rotate?: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const gotoPlaybackForRuntime: (runtime: LockDeviceRuntime, params?: GotoPlaybackParams) => Promise<void>;
|
|
22
28
|
export interface MediaInfo {
|
|
23
29
|
imageAngle: number;
|
|
24
30
|
videoAngle: number;
|
|
@@ -52,6 +52,27 @@ export const openLocalAlbumForRuntime = async (runtime, params) => {
|
|
|
52
52
|
}
|
|
53
53
|
return Promise.reject(getError(1013));
|
|
54
54
|
};
|
|
55
|
+
export const gotoPlaybackForRuntime = async (runtime, params) => {
|
|
56
|
+
const link = await isSupportShortLink("camera_playbacks_panel");
|
|
57
|
+
if (!link) {
|
|
58
|
+
return Promise.reject(getError(1013));
|
|
59
|
+
}
|
|
60
|
+
const tabs = params?.tabs && params.tabs.length ? params.tabs : ["local"];
|
|
61
|
+
let url = `tuyaSmart://${link}?extra_camera_uuid=${runtime.devId}&devId=${runtime.devId}&bizType=doorLock&defaultShowTabs=true&theme=1&tabs=${JSON.stringify(tabs)}`;
|
|
62
|
+
if (params?.isLowPower) {
|
|
63
|
+
url += `&isLowPowerDevice=true`;
|
|
64
|
+
}
|
|
65
|
+
if (params?.rotate !== undefined) {
|
|
66
|
+
url += `&rotate=${params.rotate}`;
|
|
67
|
+
}
|
|
68
|
+
return new Promise((resolve, reject) => {
|
|
69
|
+
ty.router({
|
|
70
|
+
url,
|
|
71
|
+
success: () => resolve(),
|
|
72
|
+
fail: (e) => reject(e),
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
};
|
|
55
76
|
export const getMediaInfoForRuntime = (runtime) => {
|
|
56
77
|
const isSEI = runtime.config.capabilities?.rotateType === RotateType.SEI;
|
|
57
78
|
return {
|
|
@@ -34,23 +34,52 @@ export const isActiveThreadForRuntime = async (rt) => {
|
|
|
34
34
|
}
|
|
35
35
|
return false;
|
|
36
36
|
};
|
|
37
|
+
const allModes = [
|
|
38
|
+
{
|
|
39
|
+
mode: "VR",
|
|
40
|
+
value: 1,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
mode: "original",
|
|
44
|
+
value: 0,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
mode: "vertical",
|
|
48
|
+
value: 3,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
mode: "horizontal",
|
|
52
|
+
value: 2,
|
|
53
|
+
},
|
|
54
|
+
];
|
|
37
55
|
export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
38
56
|
if (rt.cache.deviceAdvanceAbilityCache) {
|
|
39
57
|
return rt.cache.deviceAdvanceAbilityCache;
|
|
40
58
|
}
|
|
41
|
-
const [
|
|
59
|
+
const [productAbilitiesRes, deviceAdvancedAbilityRes] = await Promise.allSettled([
|
|
42
60
|
getProductAbilities(rt.config.devInfo.devId, [
|
|
43
61
|
"tyabi4ucx5",
|
|
44
62
|
"tyabis9tpe",
|
|
45
63
|
"tyabiwxrn9",
|
|
46
64
|
"tyabipd4hh",
|
|
47
65
|
"tyabin4u5v",
|
|
66
|
+
"visual_door_lock_cloud_store",
|
|
48
67
|
]),
|
|
49
68
|
getDeviceAdvancedAbility(rt.config.devInfo.devId),
|
|
50
69
|
]);
|
|
70
|
+
const productAbilities = productAbilitiesRes.status === "fulfilled" ? productAbilitiesRes.value : [];
|
|
71
|
+
const deviceAdvancedAbility = deviceAdvancedAbilityRes.status === "fulfilled"
|
|
72
|
+
? deviceAdvancedAbilityRes.value
|
|
73
|
+
: undefined;
|
|
51
74
|
const deviceAdvanceAbilityCache = {
|
|
52
75
|
cloudStorage: {
|
|
53
|
-
support: deviceAdvancedAbility
|
|
76
|
+
support: deviceAdvancedAbility?.types?.includes(0) ?? false,
|
|
77
|
+
},
|
|
78
|
+
vr: {
|
|
79
|
+
support: false,
|
|
80
|
+
defaultMode: "VR",
|
|
81
|
+
modes: [],
|
|
82
|
+
coverMode: "VR",
|
|
54
83
|
},
|
|
55
84
|
ai: {
|
|
56
85
|
support: false,
|
|
@@ -61,12 +90,12 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
61
90
|
config: {},
|
|
62
91
|
},
|
|
63
92
|
voip: {
|
|
64
|
-
support:
|
|
93
|
+
support: false,
|
|
65
94
|
config: {},
|
|
66
95
|
},
|
|
67
96
|
wechatVoip: {
|
|
68
97
|
support: false,
|
|
69
|
-
|
|
98
|
+
isPublice: true,
|
|
70
99
|
},
|
|
71
100
|
unlockGuide: {
|
|
72
101
|
support: false,
|
|
@@ -80,8 +109,11 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
80
109
|
productAbilities.forEach((item) => {
|
|
81
110
|
try {
|
|
82
111
|
if (item.isOpen) {
|
|
83
|
-
const data = JSON.parse(item.extConfig);
|
|
112
|
+
const data = item.extConfig ? JSON.parse(item.extConfig) : {};
|
|
84
113
|
switch (item.abilityCode) {
|
|
114
|
+
case "visual_door_lock_cloud_store":
|
|
115
|
+
deviceAdvanceAbilityCache.cloudStorage.support = true;
|
|
116
|
+
break;
|
|
85
117
|
case "tyabi4ucx5": {
|
|
86
118
|
deviceAdvanceAbilityCache.ai.config = data;
|
|
87
119
|
const dataReport = data?.ai_data_report ?? false;
|
|
@@ -95,6 +127,37 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
95
127
|
petRecognition ||
|
|
96
128
|
voice ||
|
|
97
129
|
message;
|
|
130
|
+
deviceAdvanceAbilityCache.vr.support = !!data?.lock_VR;
|
|
131
|
+
if (deviceAdvanceAbilityCache.vr.support) {
|
|
132
|
+
const modeMap = {
|
|
133
|
+
original: {
|
|
134
|
+
mode: "original",
|
|
135
|
+
value: 0,
|
|
136
|
+
},
|
|
137
|
+
VR: {
|
|
138
|
+
mode: "VR",
|
|
139
|
+
value: 1,
|
|
140
|
+
},
|
|
141
|
+
horizontal: {
|
|
142
|
+
mode: "horizontal",
|
|
143
|
+
value: 2,
|
|
144
|
+
},
|
|
145
|
+
vertical: {
|
|
146
|
+
mode: "vertical",
|
|
147
|
+
value: 3,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
deviceAdvanceAbilityCache.vr.modes = allModes.filter((item) => {
|
|
151
|
+
return data?.modes?.includes(item.mode);
|
|
152
|
+
});
|
|
153
|
+
deviceAdvanceAbilityCache.vr.defaultMode = data.default_mode;
|
|
154
|
+
const exist = deviceAdvanceAbilityCache.vr.modes.find((x) => x.mode === deviceAdvanceAbilityCache.vr.defaultMode);
|
|
155
|
+
if (!exist) {
|
|
156
|
+
deviceAdvanceAbilityCache.vr.defaultMode =
|
|
157
|
+
deviceAdvanceAbilityCache.vr.modes?.[0].mode;
|
|
158
|
+
}
|
|
159
|
+
deviceAdvanceAbilityCache.vr.coverMode = data.photo_cover_format;
|
|
160
|
+
}
|
|
98
161
|
break;
|
|
99
162
|
}
|
|
100
163
|
case "tyabis9tpe": {
|
|
@@ -104,8 +167,16 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
104
167
|
}
|
|
105
168
|
case "tyabiwxrn9": {
|
|
106
169
|
deviceAdvanceAbilityCache.wechatVoip.support =
|
|
170
|
+
deviceAdvancedAbility?.types?.includes(1) ?? false;
|
|
171
|
+
deviceAdvanceAbilityCache.wechatVoip.isPublice =
|
|
172
|
+
data?.WechatType === "0";
|
|
173
|
+
if (!deviceAdvanceAbilityCache.wechatVoip.isPublice) {
|
|
174
|
+
deviceAdvanceAbilityCache.wechatVoip.appId =
|
|
175
|
+
data["WechatMPAppid"];
|
|
176
|
+
deviceAdvanceAbilityCache.wechatVoip.modeId = data["WechatMPMid"];
|
|
177
|
+
}
|
|
178
|
+
deviceAdvanceAbilityCache.voip.support =
|
|
107
179
|
!!data?.voipType?.includes("0");
|
|
108
|
-
deviceAdvanceAbilityCache.wechatVoip.config = data;
|
|
109
180
|
break;
|
|
110
181
|
}
|
|
111
182
|
case "tyabipd4hh": {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type UpdateVasNotifyConfigParams } from "../../api/notify";
|
|
2
|
+
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
3
|
+
export declare const getVasNotifyConfigForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/notify").VasNotifyConfig>;
|
|
4
|
+
export declare const updateVasNotifyConfigForRuntime: (rt: LockDeviceRuntime, params: UpdateVasNotifyConfigParams) => Promise<import("../../api/notify").VasNotifyConfig>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { getVasNotifyConfigApi, updateVasNotifyConfigApi, } from "../../api/notify";
|
|
2
|
+
export const getVasNotifyConfigForRuntime = (rt) => getVasNotifyConfigApi(rt.config.devInfo.devId);
|
|
3
|
+
export const updateVasNotifyConfigForRuntime = (rt, params) => updateVasNotifyConfigApi(rt.config.devInfo.devId, params);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
2
|
export interface GotoServiceParams {
|
|
3
|
-
tab?: "cloudStorage" | "AI";
|
|
3
|
+
tab?: "cloudStorage" | "AI" | "voip";
|
|
4
|
+
showGift?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export declare function gotoServiceForRuntime(rt: LockDeviceRuntime, params?: GotoServiceParams): Promise<unknown>;
|
|
@@ -4,8 +4,14 @@ export function gotoServiceForRuntime(rt, params) {
|
|
|
4
4
|
if (params?.tab === "AI") {
|
|
5
5
|
type = 3;
|
|
6
6
|
}
|
|
7
|
+
else if (params?.tab === "voip") {
|
|
8
|
+
type = 1;
|
|
9
|
+
}
|
|
7
10
|
return new Promise((resolve, reject) => {
|
|
8
|
-
|
|
11
|
+
let url = `godzilla://tyawqoyej4wi3pqebb?deviceId=${rt.config.devInfo.devId}&commodityType=${type}`;
|
|
12
|
+
if (params?.showGift) {
|
|
13
|
+
url += `&showGift=true`;
|
|
14
|
+
}
|
|
9
15
|
navigateToMiniProgram({
|
|
10
16
|
position: "bottom",
|
|
11
17
|
shortLink: url,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
+
export declare const getCloudServiceStatusForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/service").CloudServiceStatus>;
|
|
3
|
+
export declare const getServicePopupListForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/service").ServiceBenefitPopupItem[]>;
|
|
4
|
+
export declare const claimServiceForRuntime: (rt: LockDeviceRuntime, batchId: string) => Promise<import("../../api/service").ClaimResultItem[]>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { getCloudServiceStatusApi, getServicePopupListApi, claimServiceApi, } from "../../api/service";
|
|
2
|
+
export const getCloudServiceStatusForRuntime = (rt) => getCloudServiceStatusApi(rt.config.devInfo.devId);
|
|
3
|
+
export const getServicePopupListForRuntime = (rt) => getServicePopupListApi(rt.config.devInfo.devId);
|
|
4
|
+
export const claimServiceForRuntime = (rt, batchId) => claimServiceApi(rt.config.devInfo.devId, batchId);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
+
export declare const setStorageForRuntime: (rt: LockDeviceRuntime, key: string, data: unknown) => void;
|
|
3
|
+
export declare const getStorageForRuntime: <T = unknown>(rt: LockDeviceRuntime, key: string) => T | null;
|
|
4
|
+
export declare const removeStorageForRuntime: (rt: LockDeviceRuntime, key: string) => void;
|
|
5
|
+
export declare const clearStorageForRuntime: (rt: LockDeviceRuntime, keys: string[]) => void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getStorageSync, removeStorageSync, setStorageSync, } from "../../platform";
|
|
2
|
+
const buildStorageKey = (rt, key) => {
|
|
3
|
+
const { devId, activeTime } = rt.config.devInfo;
|
|
4
|
+
return `${devId}_${activeTime}_${key}`;
|
|
5
|
+
};
|
|
6
|
+
export const setStorageForRuntime = (rt, key, data) => {
|
|
7
|
+
const value = typeof data === "string" ? data : JSON.stringify(data);
|
|
8
|
+
setStorageSync(buildStorageKey(rt, key), value);
|
|
9
|
+
};
|
|
10
|
+
export const getStorageForRuntime = (rt, key) => {
|
|
11
|
+
const raw = getStorageSync(buildStorageKey(rt, key));
|
|
12
|
+
if (raw == null || raw === "") {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
if (typeof raw === "string") {
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(raw);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return raw;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return raw;
|
|
24
|
+
};
|
|
25
|
+
export const removeStorageForRuntime = (rt, key) => {
|
|
26
|
+
removeStorageSync(buildStorageKey(rt, key));
|
|
27
|
+
};
|
|
28
|
+
export const clearStorageForRuntime = (rt, keys) => {
|
|
29
|
+
keys.forEach((key) => {
|
|
30
|
+
removeStorageSync(buildStorageKey(rt, key));
|
|
31
|
+
});
|
|
32
|
+
};
|
|
@@ -19,6 +19,9 @@ export const syncUnlockMethodWithRuntime = async (runtime) => {
|
|
|
19
19
|
});
|
|
20
20
|
rt.sync.unlockMethodAutoSyncEnabled = false;
|
|
21
21
|
const { allOpenDps = "" } = await getCurrentUserForRuntime(rt);
|
|
22
|
+
if (!allOpenDps) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
22
25
|
const { ins = "", distributed = false } = await fetchSyncUnlockMethodInfo({
|
|
23
26
|
devId: rt.config.devInfo.devId,
|
|
24
27
|
dpIds: allOpenDps.split(","),
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
+
export declare const getVoipAuthForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/voip").VoipAuth>;
|
|
3
|
+
export declare const saveVoipAuthForRuntime: (rt: LockDeviceRuntime, userId: string) => Promise<boolean>;
|
package/lib/interface.d.ts
CHANGED
|
@@ -334,10 +334,20 @@ export interface AlbumMessage extends MediaInfo {
|
|
|
334
334
|
type: number;
|
|
335
335
|
createTime: number;
|
|
336
336
|
}
|
|
337
|
+
export type VRModeType = "original" | "VR" | "horizontal" | "vertical";
|
|
337
338
|
export interface DeviceAdvancedAbility {
|
|
338
339
|
cloudStorage: {
|
|
339
340
|
support: boolean;
|
|
340
341
|
};
|
|
342
|
+
vr: {
|
|
343
|
+
support: boolean;
|
|
344
|
+
coverMode: VRModeType;
|
|
345
|
+
modes: Array<{
|
|
346
|
+
mode: VRModeType;
|
|
347
|
+
value: number;
|
|
348
|
+
}>;
|
|
349
|
+
defaultMode: VRModeType;
|
|
350
|
+
};
|
|
341
351
|
ai: {
|
|
342
352
|
support: boolean;
|
|
343
353
|
config: Record<string, any>;
|
|
@@ -348,7 +358,9 @@ export interface DeviceAdvancedAbility {
|
|
|
348
358
|
};
|
|
349
359
|
wechatVoip: {
|
|
350
360
|
support: boolean;
|
|
351
|
-
|
|
361
|
+
isPublice: boolean;
|
|
362
|
+
appId?: string;
|
|
363
|
+
modeId?: string;
|
|
352
364
|
};
|
|
353
365
|
voip: {
|
|
354
366
|
support: boolean;
|
package/lib/platform/index.d.ts
CHANGED
package/lib/platform/index.js
CHANGED