@ray-js/lock-sdk 1.2.0-beta.5 → 1.2.0-beta.6
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/service.d.ts +26 -0
- package/lib/api/service.js +25 -0
- package/lib/entries/main/exports/index.d.ts +1 -0
- package/lib/entries/main/exports/index.js +1 -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/service.d.ts +4 -0
- package/lib/entries/main/exports/service.js +11 -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 +5 -0
- package/lib/feature/service/goto-service.d.ts +1 -0
- package/lib/feature/service/goto-service.js +4 -1
- package/lib/feature/service/value-added.d.ts +4 -0
- package/lib/feature/service/value-added.js +4 -0
- package/lib/feature/unlock/sync/unlock-method.js +3 -0
- package/lib/interface.d.ts +5 -0
- package/package.json +1 -1
|
@@ -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
|
+
};
|
|
@@ -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,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
|
+
}
|
|
@@ -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 {
|
|
@@ -52,6 +52,11 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
52
52
|
cloudStorage: {
|
|
53
53
|
support: deviceAdvancedAbility.types.includes(0),
|
|
54
54
|
},
|
|
55
|
+
vr: {
|
|
56
|
+
support: false,
|
|
57
|
+
defaultMode: "",
|
|
58
|
+
modes: [],
|
|
59
|
+
},
|
|
55
60
|
ai: {
|
|
56
61
|
support: false,
|
|
57
62
|
config: {},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
2
|
export interface GotoServiceParams {
|
|
3
3
|
tab?: "cloudStorage" | "AI";
|
|
4
|
+
showGift?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export declare function gotoServiceForRuntime(rt: LockDeviceRuntime, params?: GotoServiceParams): Promise<unknown>;
|
|
@@ -5,7 +5,10 @@ export function gotoServiceForRuntime(rt, params) {
|
|
|
5
5
|
type = 3;
|
|
6
6
|
}
|
|
7
7
|
return new Promise((resolve, reject) => {
|
|
8
|
-
|
|
8
|
+
let url = `godzilla://tyawqoyej4wi3pqebb?deviceId=${rt.config.devInfo.devId}&commodityType=${type}`;
|
|
9
|
+
if (params?.showGift) {
|
|
10
|
+
url += `&showGift=true`;
|
|
11
|
+
}
|
|
9
12
|
navigateToMiniProgram({
|
|
10
13
|
position: "bottom",
|
|
11
14
|
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);
|
|
@@ -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(","),
|
package/lib/interface.d.ts
CHANGED