@ray-js/ipc-player-integration 0.0.59-beta.0 → 0.0.61-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.
Files changed (126) hide show
  1. package/README.md +0 -6
  2. package/lib/ctx/ctx.album.test.d.ts +1 -0
  3. package/lib/ctx/ctx.album.test.js +197 -0
  4. package/lib/ctx/ctx.composition.js +19 -4
  5. package/lib/ctx/ctx.js +103 -55
  6. package/lib/ctx/ports.output.d.ts +1 -0
  7. package/lib/ctx/resolution.d.ts +1 -1
  8. package/lib/ctx/resolution.js +3 -1
  9. package/lib/i18n/index.d.ts +12 -0
  10. package/lib/i18n/strings.d.ts +6 -0
  11. package/lib/i18n/strings.js +6 -0
  12. package/lib/index.d.ts +0 -4
  13. package/lib/index.js +1 -3
  14. package/lib/interface.d.ts +19 -3
  15. package/lib/ui/absoluteContent.d.ts +2 -0
  16. package/lib/ui/absoluteContent.js +3 -0
  17. package/lib/ui/bottomLeftContent.js +55 -119
  18. package/lib/ui/bottomRightContent.js +3 -6
  19. package/lib/ui/ui.d.ts +2 -5
  20. package/lib/ui/ui.js +49 -63
  21. package/lib/utils/captureResult.d.ts +14 -0
  22. package/lib/utils/captureResult.js +70 -0
  23. package/lib/utils/captureResult.test.d.ts +1 -0
  24. package/lib/utils/captureResult.test.js +117 -0
  25. package/lib/utils/fullLinkTracking.d.ts +5 -0
  26. package/lib/utils/fullLinkTracking.js +71 -0
  27. package/lib/utils/navigation.d.ts +2 -1
  28. package/lib/utils/navigation.js +13 -3
  29. package/lib/utils/ttt.js +2 -8
  30. package/lib/widgets/battery/battery.js +1 -2
  31. package/lib/widgets/battery/batteryFull.js +1 -2
  32. package/lib/widgets/captureResult/captureResult.d.ts +16 -0
  33. package/lib/widgets/captureResult/captureResult.js +85 -0
  34. package/lib/widgets/captureResult/captureResult.less +144 -0
  35. package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
  36. package/lib/widgets/captureResult/captureResult.test.js +80 -0
  37. package/lib/widgets/captureResult/index.d.ts +2 -0
  38. package/lib/widgets/captureResult/index.js +2 -0
  39. package/lib/widgets/floodlight/floodlight.js +1 -2
  40. package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
  41. package/lib/widgets/fullScreen/fullScreen.js +1 -2
  42. package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
  43. package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
  44. package/lib/widgets/fullScreen/verticalScreen.js +1 -2
  45. package/lib/widgets/index.d.ts +1 -0
  46. package/lib/widgets/index.js +2 -1
  47. package/lib/widgets/moveInteractiveControl/controlButton.js +1 -2
  48. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +3 -12
  49. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
  50. package/lib/widgets/multiCamera/landscapeTip.js +1 -2
  51. package/lib/widgets/multiCamera/moveablePtzControl.js +1 -1
  52. package/lib/widgets/multiCamera/multiPtz.js +1 -2
  53. package/lib/widgets/multiCamera/ptzMoveableTip.js +1 -2
  54. package/lib/widgets/multiCamera/switchLayout.js +1 -2
  55. package/lib/widgets/multiCamera/tileMultiPtz.js +1 -2
  56. package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
  57. package/lib/widgets/multiCamera/tileTip.js +1 -2
  58. package/lib/widgets/muted/muted.js +10 -5
  59. package/lib/widgets/muted/muted.less +5 -1
  60. package/lib/widgets/muted/muted.test.d.ts +1 -0
  61. package/lib/widgets/muted/muted.test.js +81 -0
  62. package/lib/widgets/ptz/ptz.js +1 -2
  63. package/lib/widgets/ptz/ptzControl.js +1 -1
  64. package/lib/widgets/ptzControlTip/ptzControlTip.js +3 -6
  65. package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
  66. package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
  67. package/lib/widgets/recordVideo/recordVideo.js +53 -53
  68. package/lib/widgets/recordVideo/recordVideo.less +17 -74
  69. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +1 -0
  70. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +106 -0
  71. package/lib/widgets/recordVideo/recordVideo.test.js +1 -0
  72. package/lib/widgets/resolution/fullResolutionControl.js +19 -29
  73. package/lib/widgets/resolution/resolution.js +2 -3
  74. package/lib/widgets/screenshot/screenshot.js +66 -45
  75. package/lib/widgets/screenshot/screenshot.less +1 -40
  76. package/lib/widgets/screenshot/screenshot.test.d.ts +1 -0
  77. package/lib/widgets/screenshot/screenshot.test.js +120 -0
  78. package/lib/widgets/signal4G/signal4G.js +1 -4
  79. package/lib/widgets/siren/siren.js +1 -2
  80. package/lib/widgets/tempHumidity/tempHumidity.js +1 -2
  81. package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +1 -2
  82. package/lib/widgets/trialBadge/index.d.ts +2 -1
  83. package/lib/widgets/trialBadge/index.js +20 -17
  84. package/lib/widgets/trialBadge/index.less +0 -24
  85. package/lib/widgets/trialBadge/useTrialBadge.d.ts +3 -2
  86. package/lib/widgets/trialBadge/useTrialBadge.js +13 -2
  87. package/lib/widgets/tryExperience/tryExperience.js +1 -3
  88. package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
  89. package/lib/widgets/voiceIntercom/voiceIntercom.js +24 -50
  90. package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -16
  91. package/lib/widgets/zoomTurntable/turntable/index.d.ts +7 -5
  92. package/lib/widgets/zoomTurntable/turntable/index.js +1 -2
  93. package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +1 -2
  94. package/lib/widgets/zoomTurntable/zoomTurntableTip.js +1 -2
  95. package/package.json +8 -15
  96. package/lib/renderer/capabilities.d.ts +0 -8
  97. package/lib/renderer/capabilities.js +0 -19
  98. package/lib/renderer/context.d.ts +0 -5
  99. package/lib/renderer/context.js +0 -6
  100. package/lib/renderer/directionControl.d.ts +0 -6
  101. package/lib/renderer/directionControl.js +0 -3
  102. package/lib/renderer/font.less +0 -5
  103. package/lib/renderer/glyphs.d.ts +0 -1
  104. package/lib/renderer/glyphs.js +0 -256
  105. package/lib/renderer/index.module.less +0 -48
  106. package/lib/renderer/ptzZoom.d.ts +0 -6
  107. package/lib/renderer/ptzZoom.js +0 -3
  108. package/lib/renderer/text.d.ts +0 -4
  109. package/lib/renderer/text.js +0 -32
  110. package/lib/renderer/text.module.less +0 -4
  111. package/lib/renderer/viewport.d.ts +0 -7
  112. package/lib/renderer/viewport.js +0 -24
  113. package/lib/res/lynx-signal/index.d.ts +0 -1
  114. package/lib/res/lynx-signal/index.js +0 -22
  115. package/lib/res/lynx-signal/signalFour0.png +0 -0
  116. package/lib/res/lynx-signal/signalFour1.png +0 -0
  117. package/lib/res/lynx-signal/signalFour2.png +0 -0
  118. package/lib/res/lynx-signal/signalFour3.png +0 -0
  119. package/lib/res/lynx-signal/signalFour4.png +0 -0
  120. package/lib/res/lynx-signal/signalThree0.png +0 -0
  121. package/lib/res/lynx-signal/signalThree1.png +0 -0
  122. package/lib/res/lynx-signal/signalThree2.png +0 -0
  123. package/lib/res/lynx-signal/signalThree3.png +0 -0
  124. package/lib/res/player-more-arrow.png +0 -0
  125. package/lib/ui/scrollHintArrow.d.ts +0 -23
  126. package/lib/ui/scrollHintArrow.js +0 -82
package/lib/ui/ui.js CHANGED
@@ -12,10 +12,6 @@ import clsx from 'clsx';
12
12
  import IPCPlayer from '@ray-js/ray-ipc-player';
13
13
  import { ipcTTTOperatorLog } from '@ray-js/ray-ipc-utils';
14
14
  import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
15
- import { PlayerRenderModeContext, PlayerControlVisibilityContext } from '../renderer/context';
16
- import lynxStyles from '../renderer/index.module.less';
17
- import { getPlayerViewport } from '../renderer/viewport';
18
- import { LynxPlayerAdaptersContext } from '../renderer/capabilities';
19
15
  import { PlayState, PlayerStreamStatus, MultiCameraScreenMode } from '../interface';
20
16
  import { useCtx } from '../ctx/ctx.composition';
21
17
  import { useStore, updateAtom, getDefaultStore } from '../ctx/store';
@@ -32,7 +28,9 @@ import { Storage } from '../utils/storage';
32
28
  import './ui.less';
33
29
  import { updatePlayerWidgetProps } from '../features';
34
30
  import { getNgRawData, getSmartImageQualityState, isLowPhone } from '../utils/ttt';
31
+ import { getCaptureResultSummary } from '../utils/captureResult';
35
32
  import { lensCount } from '../widgets/zoomTurntable/lensSkill';
33
+ import { shouldRenderContent } from './absoluteContent';
36
34
  const AutoClarityOnly = _ref => {
37
35
  let {
38
36
  instance
@@ -63,11 +61,12 @@ const StandaloneAutoClarity = _ref2 => {
63
61
  instance: instance
64
62
  }));
65
63
  };
66
- function getCtxInstance(instance, devId) {
64
+ function getCtxInstance(instance, devId, autoClarityDisabled) {
67
65
  if (instance) return instance;
68
66
  // eslint-disable-next-line react-hooks/rules-of-hooks
69
67
  return useCtx({
70
- devId
68
+ devId,
69
+ autoClarityDisabled
71
70
  });
72
71
  }
73
72
 
@@ -103,7 +102,6 @@ const SCALE_MATCH_EPS = 0.01;
103
102
  const BOTTOM_RIGHT_SAFE_GAP = 4;
104
103
  export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
105
104
  const {
106
- renderMode = 'webview',
107
105
  className,
108
106
  devId,
109
107
  style,
@@ -131,7 +129,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
131
129
  const {
132
130
  event
133
131
  } = useContext(UIEventContext);
134
- const instance = getCtxInstance(props.instance, devId);
132
+ const instance = getCtxInstance(props.instance, devId, props.autoClarityDisabled);
135
133
  const {
136
134
  setPlayState,
137
135
  setScreenType,
@@ -568,7 +566,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
568
566
  // canOpenSettings: true,
569
567
  // };
570
568
  const getNgRes = await getNgRawData();
571
- console.log('res===getSmartImageQualityState', res);
572
569
  updatePlayerWidgetProps(instance, 'bottomLeft', 'TryExperience', {
573
570
  isPurchase: res.isPurchase,
574
571
  buttonState: res.buttonState,
@@ -691,14 +688,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
691
688
  ipcTTTOperatorLog('hide: 调用停止录制方法');
692
689
  setRecording(false, true);
693
690
  setIntercom(false, true);
694
- instance === null || instance === void 0 || instance.IPCPlayerInstance.stopRecord({
695
- saveToAlbum: 1,
696
- success: () => {
697
- ipcTTTOperatorLog('hide: 调用停止录制方法成功');
698
- },
699
- fail: () => {
700
- ipcTTTOperatorLog('hide: 调用停止录制方法失败');
701
- }
691
+ instance === null || instance === void 0 || instance.stopRecordingOnUnload().then(async result => {
692
+ var _instance$multiLens, _instance$multiCamera;
693
+ const summary = await getCaptureResultSummary(result, {
694
+ multiLens: (_instance$multiLens = instance === null || instance === void 0 ? void 0 : instance.multiLens) !== null && _instance$multiLens !== void 0 ? _instance$multiLens : false,
695
+ protocolCount: instance === null || instance === void 0 || (_instance$multiCamera = instance.multiCameraCtx) === null || _instance$multiCamera === void 0 || (_instance$multiCamera = _instance$multiCamera.protocol) === null || _instance$multiCamera === void 0 ? void 0 : _instance$multiCamera.total_split_num,
696
+ devId
697
+ });
698
+ ipcTTTOperatorLog(summary !== null && summary !== void 0 && summary.isMultiLens ? `hide: stop recording succeeded with ${summary.count} files` : 'hide: 调用停止录制方法成功');
699
+ }).catch(() => {
700
+ ipcTTTOperatorLog('hide: 调用停止录制方法失败');
702
701
  });
703
702
  ipcTTTOperatorLog('hide: 调用停止对讲方法');
704
703
  instance === null || instance === void 0 || instance.IPCPlayerInstance.stopTalk({
@@ -1092,31 +1091,22 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
1092
1091
  });
1093
1092
  const playerContainerHeight = screenType === 'vertical' ? (style === null || style === void 0 ? void 0 : style.height) || '100%' : '100vh';
1094
1093
  const isVerticalFullMode = isVerticalFullLayout && screenType === 'vertical';
1095
- const lynxVerticalFull = renderMode === 'lynx' && isVerticalFullMode;
1096
- const viewport = getPlayerViewport(renderMode, isVerticalFullMode, playerContainerHeight);
1097
- return /*#__PURE__*/React.createElement(PlayerRenderModeContext.Provider, {
1098
- value: renderMode
1099
- }, /*#__PURE__*/React.createElement(LynxPlayerAdaptersContext.Provider, {
1100
- value: props.lynxAdapters || {}
1101
- }, /*#__PURE__*/React.createElement(UIEventContext.Provider, {
1094
+ return /*#__PURE__*/React.createElement(UIEventContext.Provider, {
1102
1095
  value: {
1103
1096
  event: eventRef.current,
1104
1097
  componentHideState,
1105
1098
  refreshElement
1106
1099
  }
1107
1100
  }, /*#__PURE__*/React.createElement(View, {
1108
- className: clsx('ipc-player-content', renderMode === 'lynx' && lynxStyles.root, isSmallScreen && 'ipc-player-content-small-screen', className),
1101
+ className: clsx('ipc-player-content', isSmallScreen && 'ipc-player-content-small-screen', className),
1109
1102
  style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultCSSVariable), CSSVariable), style), {}, {
1110
1103
  height: playerContainerHeight
1111
- }, lynxVerticalFull ? {
1112
- backgroundColor: '#000'
1113
- } : {})
1104
+ })
1114
1105
  }, /*#__PURE__*/React.createElement(View, {
1115
- className: lynxVerticalFull ? lynxStyles.verticalViewport : undefined,
1116
- style: viewport.style
1117
- }, /*#__PURE__*/React.createElement(IPCPlayer, _extends({}, renderMode === 'lynx' ? {
1118
- renderMode: 'lynx'
1119
- } : {}, {
1106
+ style: {
1107
+ height: isVerticalFullMode ? `calc(${playerContainerHeight} - 48px)` : playerContainerHeight
1108
+ }
1109
+ }, /*#__PURE__*/React.createElement(IPCPlayer, {
1120
1110
  defaultMute: mute,
1121
1111
  devId: devId,
1122
1112
  onlineStatus: deviceOnline,
@@ -1135,7 +1125,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
1135
1125
  onCameraNotifyWeakNetwork: data => {
1136
1126
  console.log(`onCameraNotifyWeakNetwork: ${JSON.stringify(data)}`);
1137
1127
  },
1138
- clarity: decodeClarityDic[String(resolution).toUpperCase()] || decodeClarityDic.HD,
1128
+ clarity: decodeClarityDic[resolution],
1139
1129
  onZoomChange: onZoomChange
1140
1130
  // objectFit={
1141
1131
  // screenType === 'vertical'
@@ -1149,7 +1139,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
1149
1139
  // scaleMultiple={0}
1150
1140
  ,
1151
1141
  awakeStatus: awakeStatus,
1152
- objectFit: viewport.objectFit,
1142
+ objectFit: "fillCrop",
1153
1143
  scaleMultiple: scaleMultiple
1154
1144
  // 安卓横屏问题
1155
1145
  // ptzControllable={screenType === 'vertical'}
@@ -1169,17 +1159,17 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
1169
1159
  // 这一下起,自动隐藏倒计时才开始生效
1170
1160
  hasUserTappedPlayerRef.current = true;
1171
1161
  if (instance.multiCameraCtx.isSupport) {
1172
- var _instance$multiCamera, _instance$multiCamera2;
1173
- const preTapIndex = (_instance$multiCamera = (_instance$multiCamera2 = instance.multiCameraCtx.selectedLenInfoRef.current) === null || _instance$multiCamera2 === void 0 ? void 0 : _instance$multiCamera2.index) !== null && _instance$multiCamera !== void 0 ? _instance$multiCamera : prevSelectedIndexRef.current;
1162
+ var _instance$multiCamera2, _instance$multiCamera3;
1163
+ const preTapIndex = (_instance$multiCamera2 = (_instance$multiCamera3 = instance.multiCameraCtx.selectedLenInfoRef.current) === null || _instance$multiCamera3 === void 0 ? void 0 : _instance$multiCamera3.index) !== null && _instance$multiCamera2 !== void 0 ? _instance$multiCamera2 : prevSelectedIndexRef.current;
1174
1164
  const wasHidden = componentHideState;
1175
1165
  instance.multiCameraCtx.selectVideoFiredRef.current = false;
1176
1166
  if (multiTapTimerRef.current) {
1177
1167
  clearTimeout(multiTapTimerRef.current);
1178
1168
  }
1179
1169
  multiTapTimerRef.current = setTimeout(() => {
1180
- var _instance$multiCamera3, _instance$multiCamera4;
1170
+ var _instance$multiCamera4, _instance$multiCamera5;
1181
1171
  const selectFired = !!instance.multiCameraCtx.selectVideoFiredRef.current;
1182
- const currentIndex = (_instance$multiCamera3 = (_instance$multiCamera4 = instance.multiCameraCtx.selectedLenInfoRef.current) === null || _instance$multiCamera4 === void 0 ? void 0 : _instance$multiCamera4.index) !== null && _instance$multiCamera3 !== void 0 ? _instance$multiCamera3 : preTapIndex;
1172
+ const currentIndex = (_instance$multiCamera4 = (_instance$multiCamera5 = instance.multiCameraCtx.selectedLenInfoRef.current) === null || _instance$multiCamera5 === void 0 ? void 0 : _instance$multiCamera5.index) !== null && _instance$multiCamera4 !== void 0 ? _instance$multiCamera4 : preTapIndex;
1183
1173
  if (selectFired && currentIndex === preTapIndex) {
1184
1174
  if (wasHidden) {
1185
1175
  showComponents();
@@ -1231,11 +1221,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
1231
1221
  limitFlow: limitFlow,
1232
1222
  autoWakeUp: autoWakeUp,
1233
1223
  extend: _objectSpread(_objectSpread({
1234
- backgroundColor: viewport.backgroundColor
1224
+ backgroundColor: '#262626'
1235
1225
  }, instance.multiCameraCtx.extendProps), extend)
1236
- }))), /*#__PURE__*/React.createElement(PlayerControlVisibilityContext.Provider, {
1237
- value: !componentHideState && !refreshElement
1238
- }, showTopContent && /*#__PURE__*/React.createElement(View, {
1226
+ })), showTopContent && /*#__PURE__*/React.createElement(View, {
1239
1227
  className: clsx('ipc-player-top-content', {
1240
1228
  'ipc-player-top-content-hide': componentHideState,
1241
1229
  'ipc-player-top-content-show': !componentHideState
@@ -1249,17 +1237,18 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
1249
1237
  ctx: instance
1250
1238
  }, renderTopRightContent, !hasVisibleBitrateWidget && /*#__PURE__*/React.createElement(AutoClarityOnly, {
1251
1239
  instance: instance
1252
- })))), /*#__PURE__*/React.createElement(View, {
1240
+ })))), /*#__PURE__*/React.createElement(StandaloneAutoClarity, {
1241
+ instance: instance,
1242
+ show: !showTopContent || componentHideState || !playerReady
1243
+ }), /*#__PURE__*/React.createElement(View, {
1253
1244
  className: clsx('ipc-player-bottom-content', {
1254
1245
  'ipc-player-bottom-content-hide': componentHideState,
1255
1246
  'ipc-player-bottom-content-show': !componentHideState,
1256
1247
  'ipc-player-bottom-content-full': isVerticalFullMode
1257
1248
  }),
1258
- style: _objectSpread({
1249
+ style: {
1259
1250
  height: screenType === 'vertical' ? '48px' : '72px'
1260
- }, lynxVerticalFull ? {
1261
- paddingBottom: 0
1262
- } : {})
1251
+ }
1263
1252
  }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BottomLeftContent, {
1264
1253
  ctx: instance,
1265
1254
  reservedRight: bottomRightReserved
@@ -1267,19 +1256,19 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
1267
1256
  ctx: instance,
1268
1257
  width: bottomRightStyleWidth,
1269
1258
  onWidthChange: handleBottomRightWidthChange
1270
- }, renderBottomRightContent)))), /*#__PURE__*/React.createElement(StandaloneAutoClarity, {
1271
- instance: instance,
1272
- show: !showTopContent || componentHideState || !playerReady
1273
- }), (() => {
1259
+ }, renderBottomRightContent))), (() => {
1274
1260
  if (!absoluteContent || !(absoluteContent !== null && absoluteContent !== void 0 && absoluteContent.length)) return null;
1275
1261
  return absoluteContent.map(item => {
1276
- if (item.hidden) return null;
1262
+ if (!shouldRenderContent(item, {
1263
+ playState
1264
+ })) return null;
1265
+ const contentProps = _objectSpread(_objectSpread(_objectSpread({
1266
+ key: item.id
1267
+ }, item.initProps), instance), {}, {
1268
+ IPCPlayerContext: instance.IPCPlayerInstance
1269
+ });
1277
1270
  if (item.absoluteNoCoverView) {
1278
- return /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
1279
- key: item.id
1280
- }, item.initProps), instance), {}, {
1281
- IPCPlayerContext: instance.IPCPlayerInstance
1282
- }));
1271
+ return /*#__PURE__*/React.createElement(item.content, contentProps);
1283
1272
  }
1284
1273
  return /*#__PURE__*/React.createElement(CoverView, {
1285
1274
  key: item.id,
@@ -1287,13 +1276,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
1287
1276
  position: 'absolute'
1288
1277
  }, item.absolutePosition),
1289
1278
  className: item.absoluteContentClassName
1290
- }, /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
1291
- key: item.id
1292
- }, item.initProps), instance), {}, {
1293
- IPCPlayerContext: instance.IPCPlayerInstance,
1279
+ }, /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread({}, contentProps), {}, {
1294
1280
  // 添加通用变量单独组件类名
1295
1281
  className: clsx('absolute-item-container')
1296
1282
  })));
1297
1283
  });
1298
- })()))));
1284
+ })()));
1299
1285
  });
@@ -0,0 +1,14 @@
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>;
@@ -0,0 +1,70 @@
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
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,117 @@
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
+ });
@@ -0,0 +1,5 @@
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>;
@@ -0,0 +1,71 @@
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,7 +1,8 @@
1
+ import { EntryTracking } from './fullLinkTracking';
1
2
  export declare const miniIdLabs: {
2
3
  aiDrawMini: string;
3
4
  securityCloudService: string;
4
5
  };
5
6
  export declare function gotoAIDrawMiniProgram(devId: string, brandColor: string): void;
6
7
  export declare function gotoSecurityCloudService(homeId: string, uuid: string): Promise<void>;
7
- export declare function gotoSecurityCloudService2(devId: string): Promise<import("@ray-js/ray-ipc-utils/lib/interface").IRes<unknown>>;
8
+ export declare function gotoSecurityCloudService2(devId: string, tracking?: EntryTracking): Promise<import("@ray-js/ray-ipc-utils/lib/interface").IRes<unknown>>;
@@ -1,5 +1,6 @@
1
- import { getServiceUrl, goToMiniProgramByShortLink } from '@ray-js/ray-ipc-utils';
1
+ import { getServiceUrl, goToMiniProgramByShortLink, jumpToWebView } from '@ray-js/ray-ipc-utils';
2
2
  import Color from 'color';
3
+ import { appendTrackingQuery } from './fullLinkTracking';
3
4
 
4
5
  // 小程序ID集合
5
6
  export const miniIdLabs = {
@@ -18,6 +19,15 @@ export async function gotoSecurityCloudService(homeId, uuid) {
18
19
  const url = `godzilla://${miniIdLabs.securityCloudService}${'/pages/serviceList/index'}?homeId=${homeId}&deviceId=${uuid}&categoryCode=${'security_cloud_service'}`;
19
20
  goToMiniProgramByShortLink(url, 'right');
20
21
  }
21
- export async function gotoSecurityCloudService2(devId) {
22
- return getServiceUrl(devId, 'security_cloud_service', {}, true);
22
+ export async function gotoSecurityCloudService2(devId, tracking) {
23
+ var _result$data;
24
+ const serviceType = 'security_cloud_service';
25
+ const params = {};
26
+ if (!tracking) return getServiceUrl(devId, serviceType, params, true);
27
+ const result = await getServiceUrl(devId, serviceType, params, false, tracking.utm_rtid);
28
+ if ((result === null || result === void 0 ? void 0 : result.code) !== 0 || !((_result$data = result.data) !== null && _result$data !== void 0 && _result$data.url)) {
29
+ throw new Error('Failed to fetch the cloud service URL');
30
+ }
31
+ const url = appendTrackingQuery(result.data.url, tracking);
32
+ return result.data.type === 2 ? goToMiniProgramByShortLink(url) : jumpToWebView(url);
23
33
  }
package/lib/utils/ttt.js CHANGED
@@ -37,11 +37,9 @@ export function getAIFrameFeature(devId) {
37
37
  ty.ipc.getAIFrameFeature({
38
38
  devId,
39
39
  success: data => {
40
- console.log('res===getAIFrameFeature data', data);
41
40
  resolve(data);
42
41
  },
43
- fail: e => {
44
- console.warn('res===getAIFrameFeature fail', e);
42
+ fail: () => {
45
43
  resolve(null);
46
44
  }
47
45
  });
@@ -61,11 +59,9 @@ export function setAIFrameFeature(params) {
61
59
  try {
62
60
  ty.ipc.setAIFrameFeature(_objectSpread(_objectSpread({}, params), {}, {
63
61
  success: data => {
64
- console.log('res===setAIFrameFeature data', data);
65
62
  resolve(data);
66
63
  },
67
- fail: e => {
68
- console.warn('res===setAIFrameFeature fail', e);
64
+ fail: () => {
69
65
  resolve(null);
70
66
  }
71
67
  }));
@@ -135,7 +131,6 @@ export function notifyOfflineShown(deviceId) {
135
131
  return false;
136
132
  }
137
133
  try {
138
- console.warn('res===notifyOfflineShown', deviceId);
139
134
  method({
140
135
  deviceId,
141
136
  scene: 'preview_mini'
@@ -246,7 +241,6 @@ export function subscribeClarityChanged(devId, handler) {
246
241
  try {
247
242
  ipc.onClarityChanged(listener);
248
243
  } catch (error) {
249
- console.warn('res===onClarityChanged fail', error);
250
244
  return () => undefined;
251
245
  }
252
246
  return () => {
@@ -1,7 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
- import { View } from '@ray-js/ray';
2
+ import { View, Text } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
- import { PlayerText as Text } from '../../renderer/text';
5
4
  import { useStore } from '../../ctx/store';
6
5
  import { PowerMode } from '../../ports.output';
7
6
  import './battery.less';
@@ -1,7 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
- import { View } from '@ray-js/ray';
2
+ import { View, Text } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
- import { PlayerText as Text } from '../../renderer/text';
5
4
  import { useStore } from '../../ctx/store';
6
5
  import { PowerMode } from '../../ports.output';
7
6
  import './battery.less';
@@ -0,0 +1,16 @@
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;