@ray-js/ipc-player-integration 0.0.65-beta.3 → 0.0.66-beta.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/README.md +6 -0
- package/lib/ctx/ctx.composition.js +3 -13
- package/lib/ctx/ctx.js +35 -46
- package/lib/ctx/multiCameraCtx.d.ts +0 -2
- package/lib/ctx/multiCameraCtx.js +1 -17
- package/lib/i18n/index.d.ts +0 -12
- package/lib/i18n/strings.d.ts +0 -6
- package/lib/i18n/strings.js +0 -6
- package/lib/index.d.ts +4 -0
- package/lib/index.js +3 -1
- package/lib/interface.d.ts +3 -17
- package/lib/renderer/capabilities.d.ts +8 -0
- package/lib/renderer/capabilities.js +19 -0
- package/lib/renderer/context.d.ts +5 -0
- package/lib/renderer/context.js +6 -0
- package/lib/renderer/directionControl.d.ts +6 -0
- package/lib/renderer/directionControl.js +3 -0
- package/lib/renderer/font.less +5 -0
- package/lib/renderer/glyphs.d.ts +1 -0
- package/lib/renderer/glyphs.js +256 -0
- package/lib/renderer/index.module.less +48 -0
- package/lib/renderer/ptzZoom.d.ts +6 -0
- package/lib/renderer/ptzZoom.js +3 -0
- package/lib/renderer/text.d.ts +4 -0
- package/lib/renderer/text.js +32 -0
- package/lib/renderer/text.module.less +4 -0
- package/lib/renderer/viewport.d.ts +7 -0
- package/lib/renderer/viewport.js +24 -0
- package/lib/res/lynx-signal/index.d.ts +1 -0
- package/lib/res/lynx-signal/index.js +22 -0
- package/lib/res/lynx-signal/signalFour0.png +0 -0
- package/lib/res/lynx-signal/signalFour1.png +0 -0
- package/lib/res/lynx-signal/signalFour2.png +0 -0
- package/lib/res/lynx-signal/signalFour3.png +0 -0
- package/lib/res/lynx-signal/signalFour4.png +0 -0
- package/lib/res/lynx-signal/signalThree0.png +0 -0
- package/lib/res/lynx-signal/signalThree1.png +0 -0
- package/lib/res/lynx-signal/signalThree2.png +0 -0
- package/lib/res/lynx-signal/signalThree3.png +0 -0
- package/lib/res/player-charging.png +0 -0
- package/lib/res/player-more-arrow.png +0 -0
- package/lib/res/player-solar.png +0 -0
- package/lib/ui/bottomLeftContent.js +119 -55
- package/lib/ui/bottomRightContent.js +6 -3
- package/lib/ui/scrollHintArrow.d.ts +23 -0
- package/lib/ui/scrollHintArrow.js +82 -0
- package/lib/ui/ui.d.ts +5 -0
- package/lib/ui/ui.js +89 -98
- package/lib/utils/navigation.d.ts +1 -2
- package/lib/utils/navigation.js +3 -13
- package/lib/widgets/battery/battery.js +7 -5
- package/lib/widgets/battery/batteryFull.js +7 -5
- package/lib/widgets/battery/statusIcon.d.ts +6 -0
- package/lib/widgets/battery/statusIcon.js +36 -0
- package/lib/widgets/battery/statusIcon.less +24 -0
- package/lib/widgets/floodlight/floodlight.js +2 -1
- package/lib/widgets/flowLowTip/flowLowTip.js +2 -1
- package/lib/widgets/fullScreen/fullScreen.js +2 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
- package/lib/widgets/fullScreen/verticalScreen.js +2 -1
- package/lib/widgets/index.d.ts +0 -1
- package/lib/widgets/index.js +1 -2
- package/lib/widgets/moveInteractiveControl/controlButton.js +2 -1
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +12 -3
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +24 -4
- package/lib/widgets/multiCamera/index.less +0 -1
- package/lib/widgets/multiCamera/landscapeTip.js +2 -1
- package/lib/widgets/multiCamera/moveablePtzControl.js +5 -5
- package/lib/widgets/multiCamera/multiPtz.js +3 -2
- package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -1
- package/lib/widgets/multiCamera/switchLayout.js +2 -1
- package/lib/widgets/multiCamera/tileMultiPtz.js +3 -2
- package/lib/widgets/multiCamera/tileSwitchLayout.js +2 -1
- package/lib/widgets/multiCamera/tileTip.js +2 -1
- package/lib/widgets/muted/muted.js +2 -1
- package/lib/widgets/muted/muted.test.js +66 -52
- package/lib/widgets/ptz/ptz.js +2 -1
- package/lib/widgets/ptz/ptzControl.js +1 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +6 -3
- package/lib/widgets/ptzControlTip/ptzControlTip.less +6 -0
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +2 -1
- package/lib/widgets/recordVideo/recordVideo.js +53 -53
- package/lib/widgets/recordVideo/recordVideo.less +74 -17
- package/lib/widgets/recordVideo/recordVideo.test.js +0 -1
- package/lib/widgets/resolution/fullResolutionControl.js +29 -19
- package/lib/widgets/resolution/resolution.js +3 -2
- package/lib/widgets/screenshot/screenshot.js +45 -66
- package/lib/widgets/screenshot/screenshot.less +40 -1
- package/lib/widgets/signal4G/signal4G.js +4 -1
- package/lib/widgets/siren/siren.js +2 -1
- package/lib/widgets/tempHumidity/tempHumidity.js +2 -1
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +2 -1
- package/lib/widgets/trialBadge/index.d.ts +1 -2
- package/lib/widgets/trialBadge/index.js +17 -20
- package/lib/widgets/trialBadge/index.less +24 -0
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +2 -3
- package/lib/widgets/trialBadge/useTrialBadge.js +2 -13
- package/lib/widgets/tryExperience/tryExperience.js +2 -1
- package/lib/widgets/videoBitKBP/videoBitKBP.js +2 -1
- package/lib/widgets/voiceIntercom/voiceIntercom.js +50 -24
- package/lib/widgets/voiceIntercom/voiceIntercom.less +16 -0
- package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +6 -0
- package/lib/widgets/zoomTurntable/lynxDockLayout.js +30 -0
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +5 -7
- package/lib/widgets/zoomTurntable/turntable/index.js +3 -1
- package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +5 -0
- package/lib/widgets/zoomTurntable/turntable/lynx.js +273 -0
- package/lib/widgets/zoomTurntable/turntable/lynx.less +9 -0
- package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +37 -0
- package/lib/widgets/zoomTurntable/turntable/lynxModel.js +122 -0
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +3 -0
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +36 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +2 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.js +1 -1
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +31 -18
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +23 -3
- package/package.json +15 -7
- package/lib/ctx/ctx.album.test.d.ts +0 -1
- package/lib/ctx/ctx.album.test.js +0 -197
- package/lib/ctx/multiCameraCtx.test.d.ts +0 -1
- package/lib/ctx/multiCameraCtx.test.js +0 -65
- package/lib/ui/absoluteContent.d.ts +0 -2
- package/lib/ui/absoluteContent.js +0 -3
- package/lib/utils/captureResult.d.ts +0 -14
- package/lib/utils/captureResult.js +0 -70
- package/lib/utils/captureResult.test.d.ts +0 -1
- package/lib/utils/captureResult.test.js +0 -117
- package/lib/utils/fullLinkTracking.d.ts +0 -5
- package/lib/utils/fullLinkTracking.js +0 -71
- package/lib/widgets/captureResult/captureResult.d.ts +0 -16
- package/lib/widgets/captureResult/captureResult.js +0 -85
- package/lib/widgets/captureResult/captureResult.less +0 -144
- package/lib/widgets/captureResult/captureResult.test.d.ts +0 -1
- package/lib/widgets/captureResult/captureResult.test.js +0 -80
- package/lib/widgets/captureResult/index.d.ts +0 -2
- package/lib/widgets/captureResult/index.js +0 -2
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +0 -1
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +0 -106
- package/lib/widgets/screenshot/screenshot.test.d.ts +0 -1
- package/lib/widgets/screenshot/screenshot.test.js +0 -120
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/ipc-player-integration",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.66-beta.0",
|
|
4
4
|
"description": "IPC 融合播放器",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -29,17 +29,19 @@
|
|
|
29
29
|
"start:web": "ray start ./example -t web",
|
|
30
30
|
"prepublishOnly": "yarn build",
|
|
31
31
|
"release-it": "standard-version",
|
|
32
|
-
"test": "yarn jest"
|
|
32
|
+
"test": "yarn jest",
|
|
33
|
+
"test:lynx": "node --test tests/*.test.cjs",
|
|
34
|
+
"test:features": "jest --runInBand --runTestsByPath tests/master-features.test.tsx tests/auto-clarity-config.test.tsx src/utils/authorize/album.test.ts src/widgets/recordVideo/recordVideo.test.tsx src/widgets/zoomTurntable/lensModel.test.ts src/widgets/muted/muted.test.tsx tests/zoom-turntable-tip.test.tsx tests/zoom-turntable-touch.test.tsx"
|
|
33
35
|
},
|
|
34
36
|
"peerDependencies": {
|
|
35
37
|
"ahooks": "^3.1.6"
|
|
36
38
|
},
|
|
37
39
|
"dependencies": {
|
|
38
|
-
"@ray-js/direction-control": "
|
|
39
|
-
"@ray-js/ipc-ptz-zoom": "
|
|
40
|
-
"@ray-js/ray-ipc-player": "2.1.7-beta.0",
|
|
40
|
+
"@ray-js/direction-control": "0.0.13-beta.1",
|
|
41
|
+
"@ray-js/ipc-ptz-zoom": "0.0.5-beta.0",
|
|
41
42
|
"@ray-js/panel-sdk": "^1.13.1",
|
|
42
|
-
"@ray-js/ray-ipc-
|
|
43
|
+
"@ray-js/ray-ipc-player": "2.1.8-beta.0",
|
|
44
|
+
"@ray-js/ray-ipc-utils": "^1.1.18",
|
|
43
45
|
"@ray-js/svg": "0.2.0",
|
|
44
46
|
"clsx": "^1.2.1",
|
|
45
47
|
"color": "^5.0.2",
|
|
@@ -57,7 +59,13 @@
|
|
|
57
59
|
"eslint-config-tuya-panel": "^0.4.2",
|
|
58
60
|
"husky": "^1.2.0",
|
|
59
61
|
"lint-staged": "^10.2.11",
|
|
60
|
-
"standard-version": "9.3.2"
|
|
62
|
+
"standard-version": "9.3.2",
|
|
63
|
+
"react": "17.0.2",
|
|
64
|
+
"react-dom": "17.0.2",
|
|
65
|
+
"typescript": "4.9.5",
|
|
66
|
+
"jest": "29.7.0",
|
|
67
|
+
"ts-jest": "29.2.6",
|
|
68
|
+
"jest-environment-jsdom": "29.7.0"
|
|
61
69
|
},
|
|
62
70
|
"resolutions": {
|
|
63
71
|
"@ray-js/builder-mp": "^1.7.62"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { act, renderHook } from '@testing-library/react-hooks/dom';
|
|
3
|
-
import { authorize, authorizeStatus, getSystemInfoSync, showModal } from '@ray-js/ray';
|
|
4
|
-
import { createUseCtx } from './ctx';
|
|
5
|
-
import { useStore } from './store';
|
|
6
|
-
jest.mock('@ray-js/ray', () => ({
|
|
7
|
-
authorize: jest.fn(),
|
|
8
|
-
authorizeStatus: jest.fn(),
|
|
9
|
-
getSystemInfoSync: jest.fn(),
|
|
10
|
-
openAppSystemSettingPage: jest.fn(),
|
|
11
|
-
showModal: jest.fn()
|
|
12
|
-
}));
|
|
13
|
-
jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({
|
|
14
|
-
ClarityType: {
|
|
15
|
-
HD: 'HD',
|
|
16
|
-
SD: 'SD',
|
|
17
|
-
AUTO: 'AUTO'
|
|
18
|
-
},
|
|
19
|
-
IntercomMode: {
|
|
20
|
-
OneWay: 'OneWay',
|
|
21
|
-
TwoWay: 'TwoWay'
|
|
22
|
-
}
|
|
23
|
-
}));
|
|
24
|
-
jest.mock('../i18n', () => ({
|
|
25
|
-
__esModule: true,
|
|
26
|
-
default: {
|
|
27
|
-
getLang: key => key
|
|
28
|
-
}
|
|
29
|
-
}));
|
|
30
|
-
jest.mock('./multiCameraCtx', () => ({
|
|
31
|
-
isMultiCameraTileSupported: () => false,
|
|
32
|
-
useMultiCameraCtx: () => ({})
|
|
33
|
-
}));
|
|
34
|
-
jest.mock('../utils/ttt', () => ({
|
|
35
|
-
getCachedAutoClarity: jest.fn(),
|
|
36
|
-
isClarityChangedSupported: () => false,
|
|
37
|
-
setCachedAutoClarity: jest.fn(),
|
|
38
|
-
subscribeClarityChanged: () => () => undefined
|
|
39
|
-
}));
|
|
40
|
-
beforeEach(() => {
|
|
41
|
-
jest.clearAllMocks();
|
|
42
|
-
getSystemInfoSync.mockReturnValue({
|
|
43
|
-
platform: 'android',
|
|
44
|
-
system: 'android 12'
|
|
45
|
-
});
|
|
46
|
-
authorizeStatus.mockImplementation(_ref => {
|
|
47
|
-
let {
|
|
48
|
-
fail
|
|
49
|
-
} = _ref;
|
|
50
|
-
return fail({
|
|
51
|
-
errorCode: 9004
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
authorize.mockImplementation(_ref2 => {
|
|
55
|
-
let {
|
|
56
|
-
fail
|
|
57
|
-
} = _ref2;
|
|
58
|
-
return fail({
|
|
59
|
-
errorCode: 9004
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
const mountContext = function () {
|
|
64
|
-
let saveToAlbum = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
65
|
-
const capture = {
|
|
66
|
-
tempImagePath: 'thingfile://capture.jpg',
|
|
67
|
-
filePath: 'thingfile://record.mp4'
|
|
68
|
-
};
|
|
69
|
-
const startRecord = jest.fn(_ref3 => {
|
|
70
|
-
let {
|
|
71
|
-
success
|
|
72
|
-
} = _ref3;
|
|
73
|
-
return success();
|
|
74
|
-
});
|
|
75
|
-
const stopRecord = jest.fn(_ref4 => {
|
|
76
|
-
let {
|
|
77
|
-
success
|
|
78
|
-
} = _ref4;
|
|
79
|
-
return success(capture);
|
|
80
|
-
});
|
|
81
|
-
const useCtx = createUseCtx({
|
|
82
|
-
createPlayContext: () => ({
|
|
83
|
-
startRecord,
|
|
84
|
-
stopRecord
|
|
85
|
-
}),
|
|
86
|
-
getMemoryState: jest.fn().mockResolvedValue({
|
|
87
|
-
resolution: 'HD',
|
|
88
|
-
resolutionList: ['HD', 'SD'],
|
|
89
|
-
mute: true,
|
|
90
|
-
intercomMode: 'TwoWay',
|
|
91
|
-
isIntercomSupported: false
|
|
92
|
-
}),
|
|
93
|
-
setResolutionMemoryState: jest.fn(),
|
|
94
|
-
setMuteMemoryState: jest.fn(),
|
|
95
|
-
authorizeStatus: jest.fn(),
|
|
96
|
-
toast: jest.fn()
|
|
97
|
-
});
|
|
98
|
-
const hook = renderHook(() => {
|
|
99
|
-
const ctx = useCtx({
|
|
100
|
-
devId: 'camera-1',
|
|
101
|
-
multiLens: true,
|
|
102
|
-
saveToAlbum
|
|
103
|
-
});
|
|
104
|
-
const state = useStore({
|
|
105
|
-
recording: ctx.recording
|
|
106
|
-
});
|
|
107
|
-
return _objectSpread(_objectSpread({}, ctx), {}, {
|
|
108
|
-
state
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
return _objectSpread(_objectSpread({}, hook), {}, {
|
|
112
|
-
startRecord,
|
|
113
|
-
stopRecord,
|
|
114
|
-
capture
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
it('starts without legacy authorization and retains the native stop result', async () => {
|
|
118
|
-
const {
|
|
119
|
-
result,
|
|
120
|
-
startRecord,
|
|
121
|
-
stopRecord,
|
|
122
|
-
capture,
|
|
123
|
-
unmount
|
|
124
|
-
} = mountContext();
|
|
125
|
-
await act(async () => {
|
|
126
|
-
expect(await result.current.setRecording(true)).toBe(true);
|
|
127
|
-
});
|
|
128
|
-
expect(startRecord).toHaveBeenCalledWith(expect.objectContaining({
|
|
129
|
-
saveToAlbum: 1
|
|
130
|
-
}));
|
|
131
|
-
expect(result.current.state.recording).toBe(true);
|
|
132
|
-
expect(result.current.multiLens).toBe(true);
|
|
133
|
-
await act(async () => {
|
|
134
|
-
expect(await result.current.setRecording(false)).toEqual(capture);
|
|
135
|
-
});
|
|
136
|
-
expect(stopRecord).toHaveBeenCalledTimes(1);
|
|
137
|
-
expect(result.current.state.recording).toBe(false);
|
|
138
|
-
expect(authorizeStatus).not.toHaveBeenCalled();
|
|
139
|
-
expect(authorize).not.toHaveBeenCalled();
|
|
140
|
-
unmount();
|
|
141
|
-
});
|
|
142
|
-
it('settles a denied start without calling the native recorder', async () => {
|
|
143
|
-
getSystemInfoSync.mockReturnValue({
|
|
144
|
-
platform: 'ios',
|
|
145
|
-
system: 'iOS 18'
|
|
146
|
-
});
|
|
147
|
-
const {
|
|
148
|
-
result,
|
|
149
|
-
startRecord,
|
|
150
|
-
unmount
|
|
151
|
-
} = mountContext();
|
|
152
|
-
await act(async () => {
|
|
153
|
-
expect(await result.current.setRecording(true)).toBe(false);
|
|
154
|
-
});
|
|
155
|
-
expect(startRecord).not.toHaveBeenCalled();
|
|
156
|
-
expect(result.current.state.recording).toBe(false);
|
|
157
|
-
expect(showModal).toHaveBeenCalledTimes(1);
|
|
158
|
-
unmount();
|
|
159
|
-
});
|
|
160
|
-
it('propagates a native start failure without entering recording state', async () => {
|
|
161
|
-
const {
|
|
162
|
-
result,
|
|
163
|
-
startRecord,
|
|
164
|
-
unmount
|
|
165
|
-
} = mountContext();
|
|
166
|
-
const error = {
|
|
167
|
-
errorCode: 1001,
|
|
168
|
-
errorMsg: 'Start failed'
|
|
169
|
-
};
|
|
170
|
-
startRecord.mockImplementationOnce(_ref5 => {
|
|
171
|
-
let {
|
|
172
|
-
fail
|
|
173
|
-
} = _ref5;
|
|
174
|
-
return fail(error);
|
|
175
|
-
});
|
|
176
|
-
await act(async () => {
|
|
177
|
-
await expect(result.current.setRecording(true)).rejects.toEqual(error);
|
|
178
|
-
});
|
|
179
|
-
expect(result.current.state.recording).toBe(false);
|
|
180
|
-
unmount();
|
|
181
|
-
});
|
|
182
|
-
it('keeps the requested album when stopping on page unload', async () => {
|
|
183
|
-
const {
|
|
184
|
-
result,
|
|
185
|
-
stopRecord,
|
|
186
|
-
capture,
|
|
187
|
-
unmount
|
|
188
|
-
} = mountContext(0);
|
|
189
|
-
await act(async () => {
|
|
190
|
-
expect(await result.current.stopRecordingOnUnload()).toEqual(capture);
|
|
191
|
-
});
|
|
192
|
-
expect(stopRecord).toHaveBeenCalledWith(expect.objectContaining({
|
|
193
|
-
saveToAlbum: 0
|
|
194
|
-
}));
|
|
195
|
-
expect(authorizeStatus).not.toHaveBeenCalled();
|
|
196
|
-
unmount();
|
|
197
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { act, renderHook } from '@testing-library/react-hooks';
|
|
2
|
-
jest.mock('@ray-js/ray-ipc-utils', () => ({}));
|
|
3
|
-
jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({}));
|
|
4
|
-
jest.mock('../hooks', () => ({
|
|
5
|
-
useDpSupport: () => ({})
|
|
6
|
-
}));
|
|
7
|
-
jest.mock('../utils', () => ({}));
|
|
8
|
-
const {
|
|
9
|
-
useMultiCameraCtx
|
|
10
|
-
} = require('./multiCameraCtx');
|
|
11
|
-
const {
|
|
12
|
-
getDefaultStore,
|
|
13
|
-
updateAtom
|
|
14
|
-
} = require('./store');
|
|
15
|
-
const {
|
|
16
|
-
MultiCameraScreenMode
|
|
17
|
-
} = require('../interface');
|
|
18
|
-
it('keeps the portrait PTZ opt-out across player remounts until the miniapp restarts', () => {
|
|
19
|
-
const props = {
|
|
20
|
-
devId: 'test-device',
|
|
21
|
-
IPCPlayerInstance: {
|
|
22
|
-
switchLayoutStyle: () => undefined
|
|
23
|
-
},
|
|
24
|
-
videoSplitProtocol: {
|
|
25
|
-
total_split_num: 2,
|
|
26
|
-
p_v: 3,
|
|
27
|
-
split_info: []
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const store = getDefaultStore();
|
|
31
|
-
const player = renderHook(() => useMultiCameraCtx(props));
|
|
32
|
-
const isOpen = () => store.get(player.result.current.ptzStatus);
|
|
33
|
-
act(() => player.result.current.openDefaultPtz());
|
|
34
|
-
expect(isOpen()).toBe(true);
|
|
35
|
-
|
|
36
|
-
// Programmatic collapse must not disable the next automatic expansion.
|
|
37
|
-
act(() => player.result.current.setPtzStatus(false));
|
|
38
|
-
act(() => player.result.current.openDefaultPtz());
|
|
39
|
-
expect(isOpen()).toBe(true);
|
|
40
|
-
|
|
41
|
-
// Landscape interaction must not opt out of the portrait-only policy.
|
|
42
|
-
act(() => updateAtom(player.result.current.screenMode, MultiCameraScreenMode.landscape));
|
|
43
|
-
act(() => player.result.current.togglePtz());
|
|
44
|
-
expect(isOpen()).toBe(false);
|
|
45
|
-
act(() => updateAtom(player.result.current.screenMode, MultiCameraScreenMode.full));
|
|
46
|
-
act(() => player.result.current.openDefaultPtz());
|
|
47
|
-
expect(isOpen()).toBe(true);
|
|
48
|
-
act(() => player.result.current.togglePtz());
|
|
49
|
-
act(() => player.result.current.openDefaultPtz());
|
|
50
|
-
expect(isOpen()).toBe(false);
|
|
51
|
-
|
|
52
|
-
// Explicit reopening remains available without clearing the opt-out.
|
|
53
|
-
act(() => player.result.current.togglePtz());
|
|
54
|
-
expect(isOpen()).toBe(true);
|
|
55
|
-
act(() => player.result.current.setPtzStatus(false));
|
|
56
|
-
act(() => player.result.current.openDefaultPtz());
|
|
57
|
-
expect(isOpen()).toBe(false);
|
|
58
|
-
player.unmount();
|
|
59
|
-
const remounted = renderHook(() => useMultiCameraCtx(props));
|
|
60
|
-
act(() => remounted.result.current.openDefaultPtz());
|
|
61
|
-
expect(store.get(remounted.result.current.ptzStatus)).toBe(false);
|
|
62
|
-
act(() => remounted.result.current.togglePtz());
|
|
63
|
-
expect(store.get(remounted.result.current.ptzStatus)).toBe(true);
|
|
64
|
-
remounted.unmount();
|
|
65
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { CaptureResult } from '../interface';
|
|
2
|
-
export type CaptureResultSummary = {
|
|
3
|
-
count: number;
|
|
4
|
-
isMultiLens: boolean;
|
|
5
|
-
thumbnailPath: string;
|
|
6
|
-
};
|
|
7
|
-
export type CaptureResultOptions = {
|
|
8
|
-
multiLens: boolean;
|
|
9
|
-
protocolCount?: number | string;
|
|
10
|
-
devId: string;
|
|
11
|
-
};
|
|
12
|
-
/** 从新多目高级能力配置获取当前设备的总镜头数 */
|
|
13
|
-
export declare function getMultiLensCountFromAbility(devId: string): Promise<number>;
|
|
14
|
-
export declare function getCaptureResultSummary(result: CaptureResult, { multiLens, protocolCount, devId }: CaptureResultOptions): Promise<CaptureResultSummary | null>;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/* eslint-disable camelcase */
|
|
2
|
-
|
|
3
|
-
import { getDeviceInfo } from './device';
|
|
4
|
-
const MULTI_LENS_ABILITY_CODE = 'tyabimr4v3';
|
|
5
|
-
const LENS_SUFFIX_PATTERN = /_lens\d+(?=\.[^./?#]+(?:[?#].*)?$)/;
|
|
6
|
-
const FILE_EXTENSION_PATTERN = /(\.[^./?#]+)([?#].*)?$/;
|
|
7
|
-
/** 从新多目高级能力配置获取当前设备的总镜头数 */
|
|
8
|
-
export async function getMultiLensCountFromAbility(devId) {
|
|
9
|
-
if (!devId) return 0;
|
|
10
|
-
try {
|
|
11
|
-
var _devInfo$configMetas;
|
|
12
|
-
const devInfo = await getDeviceInfo(devId);
|
|
13
|
-
const raw = devInfo === null || devInfo === void 0 || (_devInfo$configMetas = devInfo.configMetas) === null || _devInfo$configMetas === void 0 ? void 0 : _devInfo$configMetas[MULTI_LENS_ABILITY_CODE];
|
|
14
|
-
if (raw) {
|
|
15
|
-
const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;
|
|
16
|
-
const count = Number(parsed === null || parsed === void 0 ? void 0 : parsed.total_split_num) || (Array.isArray(parsed === null || parsed === void 0 ? void 0 : parsed.split_info) ? parsed.split_info.length : 0);
|
|
17
|
-
if (count > 1) {
|
|
18
|
-
return count;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
} catch (e) {
|
|
22
|
-
// ignore
|
|
23
|
-
}
|
|
24
|
-
return 0;
|
|
25
|
-
}
|
|
26
|
-
const normalizeMultiLensThumbnailPath = path => {
|
|
27
|
-
if (!path || LENS_SUFFIX_PATTERN.test(path)) return path;
|
|
28
|
-
return path.replace(FILE_EXTENSION_PATTERN, '_lens1$1$2');
|
|
29
|
-
};
|
|
30
|
-
const extractPath = item => {
|
|
31
|
-
if (!item) return '';
|
|
32
|
-
if (typeof item === 'string') return item;
|
|
33
|
-
if (typeof (item === null || item === void 0 ? void 0 : item.value) === 'string') return item.value;
|
|
34
|
-
return '';
|
|
35
|
-
};
|
|
36
|
-
export async function getCaptureResultSummary(result, _ref) {
|
|
37
|
-
let {
|
|
38
|
-
multiLens,
|
|
39
|
-
protocolCount,
|
|
40
|
-
devId
|
|
41
|
-
} = _ref;
|
|
42
|
-
if (!result || typeof result === 'boolean') return null;
|
|
43
|
-
const thumbnailPath = extractPath(result.tempImagePath) || extractPath(result.thumbPath) || extractPath(result.filePath) || '';
|
|
44
|
-
if (!multiLens) {
|
|
45
|
-
return {
|
|
46
|
-
count: 1,
|
|
47
|
-
isMultiLens: false,
|
|
48
|
-
thumbnailPath
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
const splitCount = Number(protocolCount) > 1 ? Number(protocolCount) : 0;
|
|
52
|
-
const multiLensAbilityCount = await getMultiLensCountFromAbility(devId);
|
|
53
|
-
|
|
54
|
-
// The native multi-lens snapshot can return one object while writing lens-specific
|
|
55
|
-
// files. Use the ability result to distinguish that file-name convention from the
|
|
56
|
-
// legacy split protocol.
|
|
57
|
-
const multiCount = splitCount || multiLensAbilityCount;
|
|
58
|
-
if (multiCount > 1) {
|
|
59
|
-
return {
|
|
60
|
-
count: multiCount,
|
|
61
|
-
isMultiLens: true,
|
|
62
|
-
thumbnailPath: multiLensAbilityCount > 1 ? normalizeMultiLensThumbnailPath(thumbnailPath) : thumbnailPath
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
count: 1,
|
|
67
|
-
isMultiLens: false,
|
|
68
|
-
thumbnailPath
|
|
69
|
-
};
|
|
70
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { getCaptureResultSummary } from './captureResult';
|
|
2
|
-
import { getDeviceInfo } from './device';
|
|
3
|
-
jest.mock('./device', () => ({
|
|
4
|
-
getDeviceInfo: jest.fn()
|
|
5
|
-
}));
|
|
6
|
-
const mockGetDeviceInfo = getDeviceInfo;
|
|
7
|
-
const basePath = 'thingfile://tmp/capture_123.jpg';
|
|
8
|
-
const createCaptureResult = tempImagePath => ({
|
|
9
|
-
tempImagePath,
|
|
10
|
-
filePath: tempImagePath
|
|
11
|
-
});
|
|
12
|
-
describe('getCaptureResultSummary', () => {
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
mockGetDeviceInfo.mockReset();
|
|
15
|
-
mockGetDeviceInfo.mockResolvedValue({
|
|
16
|
-
configMetas: {}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
it('normalizes the thumbnail path for the new multi-lens ability', async () => {
|
|
20
|
-
mockGetDeviceInfo.mockResolvedValue({
|
|
21
|
-
configMetas: {
|
|
22
|
-
tyabimr4v3: {
|
|
23
|
-
total_split_num: 4
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
await expect(getCaptureResultSummary(createCaptureResult(basePath), {
|
|
28
|
-
multiLens: true,
|
|
29
|
-
devId: 'dev-1'
|
|
30
|
-
})).resolves.toEqual({
|
|
31
|
-
count: 4,
|
|
32
|
-
isMultiLens: true,
|
|
33
|
-
thumbnailPath: 'thingfile://tmp/capture_123_lens1.jpg'
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
it('keeps the single-lens result for a legacy multi-camera device', async () => {
|
|
37
|
-
await expect(getCaptureResultSummary(createCaptureResult(basePath), {
|
|
38
|
-
multiLens: false,
|
|
39
|
-
protocolCount: 4,
|
|
40
|
-
devId: 'dev-1'
|
|
41
|
-
})).resolves.toEqual({
|
|
42
|
-
count: 1,
|
|
43
|
-
isMultiLens: false,
|
|
44
|
-
thumbnailPath: basePath
|
|
45
|
-
});
|
|
46
|
-
expect(mockGetDeviceInfo).not.toHaveBeenCalled();
|
|
47
|
-
});
|
|
48
|
-
it('uses the protocol count when the multi-lens mode is enabled', async () => {
|
|
49
|
-
await expect(getCaptureResultSummary(createCaptureResult(basePath), {
|
|
50
|
-
multiLens: true,
|
|
51
|
-
protocolCount: 4,
|
|
52
|
-
devId: 'dev-1'
|
|
53
|
-
})).resolves.toEqual({
|
|
54
|
-
count: 4,
|
|
55
|
-
isMultiLens: true,
|
|
56
|
-
thumbnailPath: basePath
|
|
57
|
-
});
|
|
58
|
-
expect(mockGetDeviceInfo).toHaveBeenCalledWith('dev-1');
|
|
59
|
-
});
|
|
60
|
-
it('uses the lens path when both multi-lens sources are present', async () => {
|
|
61
|
-
mockGetDeviceInfo.mockResolvedValue({
|
|
62
|
-
configMetas: {
|
|
63
|
-
tyabimr4v3: {
|
|
64
|
-
total_split_num: 4
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
await expect(getCaptureResultSummary(createCaptureResult(basePath), {
|
|
69
|
-
multiLens: true,
|
|
70
|
-
protocolCount: 4,
|
|
71
|
-
devId: 'dev-1'
|
|
72
|
-
})).resolves.toEqual({
|
|
73
|
-
count: 4,
|
|
74
|
-
isMultiLens: true,
|
|
75
|
-
thumbnailPath: 'thingfile://tmp/capture_123_lens1.jpg'
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
it('does not add a duplicate lens suffix', async () => {
|
|
79
|
-
mockGetDeviceInfo.mockResolvedValue({
|
|
80
|
-
configMetas: {
|
|
81
|
-
tyabimr4v3: JSON.stringify({
|
|
82
|
-
total_split_num: 4
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
const path = 'thingfile://tmp/capture_123_lens1.jpg';
|
|
87
|
-
await expect(getCaptureResultSummary(createCaptureResult(path), {
|
|
88
|
-
multiLens: true,
|
|
89
|
-
devId: 'dev-1'
|
|
90
|
-
})).resolves.toEqual({
|
|
91
|
-
count: 4,
|
|
92
|
-
isMultiLens: true,
|
|
93
|
-
thumbnailPath: path
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
it('keeps a mono result unchanged', async () => {
|
|
97
|
-
await expect(getCaptureResultSummary(createCaptureResult(basePath), {
|
|
98
|
-
multiLens: false,
|
|
99
|
-
devId: 'dev-1'
|
|
100
|
-
})).resolves.toEqual({
|
|
101
|
-
count: 1,
|
|
102
|
-
isMultiLens: false,
|
|
103
|
-
thumbnailPath: basePath
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
it('keeps a single-lens result when multi-lens mode has one lens', async () => {
|
|
107
|
-
await expect(getCaptureResultSummary(createCaptureResult(basePath), {
|
|
108
|
-
multiLens: true,
|
|
109
|
-
protocolCount: 1,
|
|
110
|
-
devId: 'dev-1'
|
|
111
|
-
})).resolves.toEqual({
|
|
112
|
-
count: 1,
|
|
113
|
-
isMultiLens: false,
|
|
114
|
-
thumbnailPath: basePath
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type EntryTracking = Record<'utm_source' | 'utm_medium' | 'entry_source_type' | 'utm_rtid', string>;
|
|
2
|
-
export declare const createEntryTracking: () => EntryTracking;
|
|
3
|
-
export declare const appendTrackingQuery: (url: string, tracking: EntryTracking) => string;
|
|
4
|
-
export declare const reportEntryView: (devId: string, tracking: EntryTracking) => Promise<void>;
|
|
5
|
-
export declare const reportEntryClick: (devId: string, tracking: EntryTracking) => Promise<void>;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
|
-
import "core-js/modules/esnext.iterator.filter.js";
|
|
4
|
-
import "core-js/modules/esnext.iterator.for-each.js";
|
|
5
|
-
import { getLaunchOptionsSync } from '@ray-js/ray';
|
|
6
|
-
import { getInitUtmTid } from '@ray-js/ray-ipc-utils';
|
|
7
|
-
export const createEntryTracking = () => {
|
|
8
|
-
let upstreamRtid;
|
|
9
|
-
try {
|
|
10
|
-
var _getLaunchOptionsSync;
|
|
11
|
-
upstreamRtid = (_getLaunchOptionsSync = getLaunchOptionsSync()) === null || _getLaunchOptionsSync === void 0 || (_getLaunchOptionsSync = _getLaunchOptionsSync.query) === null || _getLaunchOptionsSync === void 0 ? void 0 : _getLaunchOptionsSync.utm_rtid;
|
|
12
|
-
} catch (error) {
|
|
13
|
-
// Tracking must not prevent navigation when launch options are unavailable.
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
utm_source: 'miniprogram',
|
|
17
|
-
utm_medium: 'panel_smart_quality',
|
|
18
|
-
entry_source_type: 'organic',
|
|
19
|
-
utm_rtid: upstreamRtid || getInitUtmTid()
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export const appendTrackingQuery = (url, tracking) => {
|
|
23
|
-
const hashIndex = url.indexOf('#');
|
|
24
|
-
const base = hashIndex < 0 ? url : url.slice(0, hashIndex);
|
|
25
|
-
const hash = hashIndex < 0 ? '' : url.slice(hashIndex);
|
|
26
|
-
const queryIndex = base.indexOf('?');
|
|
27
|
-
const path = queryIndex < 0 ? base : base.slice(0, queryIndex);
|
|
28
|
-
const params = (queryIndex < 0 ? [] : base.slice(queryIndex + 1).split('&')).filter(param => {
|
|
29
|
-
if (!param) return false;
|
|
30
|
-
return !Object.prototype.hasOwnProperty.call(tracking, decodeURIComponent(param.split('=')[0]));
|
|
31
|
-
});
|
|
32
|
-
Object.entries(tracking).forEach(_ref => {
|
|
33
|
-
let [key, value] = _ref;
|
|
34
|
-
params.push(`${key}=${encodeURIComponent(value)}`);
|
|
35
|
-
});
|
|
36
|
-
return `${path}?${params.join('&')}${hash}`;
|
|
37
|
-
};
|
|
38
|
-
const reportEntry = async (eventType, devId, tracking) => {
|
|
39
|
-
try {
|
|
40
|
-
const {
|
|
41
|
-
homeId
|
|
42
|
-
} = await new Promise((resolve, reject) => {
|
|
43
|
-
ty.home.getCurrentHomeInfo({
|
|
44
|
-
success: resolve,
|
|
45
|
-
fail: reject
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
const {
|
|
49
|
-
miniProgram
|
|
50
|
-
} = ty.getAccountInfoSync();
|
|
51
|
-
const event = _objectSpread(_objectSpread({
|
|
52
|
-
project_type: 'cloud_storage',
|
|
53
|
-
event_type: eventType,
|
|
54
|
-
container_type: 'miniapp',
|
|
55
|
-
miniapp_code: miniProgram.appId,
|
|
56
|
-
miniapp_version: miniProgram.version,
|
|
57
|
-
service_type: 'security_cloud_service'
|
|
58
|
-
}, tracking), {}, {
|
|
59
|
-
device_id: devId,
|
|
60
|
-
homeid: homeId
|
|
61
|
-
});
|
|
62
|
-
ty.event({
|
|
63
|
-
eventId: eventType === 'card_view' ? 'ty_XjSozxV0YkDMjzH8orMHx0g2HMc6GQ3q' : 'ty_tUWSmFcHcSetzZd5soRTq6Y3nEYE0RgP',
|
|
64
|
-
event
|
|
65
|
-
});
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.warn('[IPC] entry tracking failed:', error);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
export const reportEntryView = (devId, tracking) => reportEntry('card_view', devId, tracking);
|
|
71
|
-
export const reportEntryClick = (devId, tracking) => reportEntry('card_click', devId, tracking);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './captureResult.less';
|
|
3
|
-
export type CaptureKind = 'record' | 'screenshot';
|
|
4
|
-
export interface CaptureResultToastProps {
|
|
5
|
-
brandColor: string;
|
|
6
|
-
kind: CaptureKind;
|
|
7
|
-
thumbnailPath: string;
|
|
8
|
-
onCheck: () => void;
|
|
9
|
-
count?: number;
|
|
10
|
-
/** 自定义标题(可选),不传时使用默认文案 */
|
|
11
|
-
title?: React.ReactNode;
|
|
12
|
-
/** 自定义操作按钮文案(可选),不传时默认为“查看” */
|
|
13
|
-
checkText?: string;
|
|
14
|
-
className?: string;
|
|
15
|
-
}
|
|
16
|
-
export declare function CaptureResultToast({ brandColor, count, kind, onCheck, thumbnailPath, title, checkText, className, }: CaptureResultToastProps): React.JSX.Element;
|