@uniai-fe/uds-templates 0.6.3 → 0.6.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniai-fe/uds-templates",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "UNIAI Design System; UI Templates Package",
5
5
  "type": "module",
6
6
  "private": false,
@@ -67,13 +67,13 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "clsx": "^2.1.1",
70
- "dayjs": "^1.11.20"
70
+ "dayjs": "^1.11.21"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@svgr/webpack": "^8.1.0",
74
- "@tanstack/react-query": "^5.100.11",
74
+ "@tanstack/react-query": "^5.101.0",
75
75
  "@types/node": "^24.12.3",
76
- "@types/react": "^19.2.15",
76
+ "@types/react": "^19.2.16",
77
77
  "@types/react-dom": "^19.2.3",
78
78
  "@uniai-fe/eslint-config": "workspace:*",
79
79
  "@uniai-fe/next-devkit": "workspace:*",
@@ -90,8 +90,8 @@
90
90
  "jotai": "^2.20.0",
91
91
  "next": "^15.5.18",
92
92
  "prettier": "^3.8.3",
93
- "react-hook-form": "^7.76.0",
94
- "sass": "^1.99.0",
93
+ "react-hook-form": "^7.77.0",
94
+ "sass": "^1.100.0",
95
95
  "typescript": "5.9.3"
96
96
  }
97
97
  }
@@ -58,11 +58,13 @@ export function useCctvRtcStreamRegistry(): CctvRtcStreamRegistry {
58
58
  * @property {string} [listUrl] company-list API 요청 경로
59
59
  * @property {string} [tokenUrl] token API 요청 경로
60
60
  * @property {string} [username] CCTV 조회시 권한 확인을 위한 계정명
61
+ * @property {string} [whepUsername] WHEP endpoint username 덮어쓰기 값
61
62
  * @property {ContextExtension} [defaultValues] 서비스 확장 context 기본값
62
63
  * @property {React.ReactNode} children
63
64
  */
64
65
  export default function CCTVProvider<ContextExtension extends object = object>({
65
66
  username,
67
+ whepUsername,
66
68
  company_id,
67
69
  cam_id,
68
70
  listUrl,
@@ -83,6 +85,7 @@ export default function CCTVProvider<ContextExtension extends object = object>({
83
85
  ...defaultValues,
84
86
  ...CCTV_CONTEXT_DEFAULT_VALUES,
85
87
  username,
88
+ whepUsername,
86
89
  company_id,
87
90
  cam_id,
88
91
  } as DefaultValues<CctvContext<ContextExtension>>;
@@ -122,15 +122,18 @@ export function useCctvRtcStream({
122
122
  const [isStreaming, setStreaming] = useState(false);
123
123
  const [hasConnected, setHasConnected] = useState(false);
124
124
 
125
- // react-hook-form 컨텍스트에서 username 추적한다.
125
+ // react-hook-form 컨텍스트에서 token username WHEP username override를 추적한다.
126
126
  const { control } = useFormContext();
127
- const username = useWatch({ control, name: "username" });
127
+ const tokenUsername = useWatch({ control, name: "username" });
128
+ const whepUsername = useWatch({ control, name: "whepUsername" });
129
+ const endpointUsername =
130
+ whepUsername === undefined ? tokenUsername : whepUsername;
128
131
 
129
132
  // 카메라/회사/사용자 정보를 토대로 WHEP 토큰을 발급받는다.
130
133
  const tokenQuery = useQueryCctvRtcToken({
131
134
  company_id: cam?.company_id ?? "",
132
135
  cam_id: cam?.cam_id ?? "",
133
- username,
136
+ username: tokenUsername,
134
137
  url: tokenUrl ?? contextTokenUrl,
135
138
  });
136
139
 
@@ -141,16 +144,18 @@ export function useCctvRtcStream({
141
144
  // 카메라의 RTC 엔드포인트와 사용자명을 조합해 실제 WHEP endpoint를 계산한다.
142
145
  const endpoint = useMemo(() => {
143
146
  if (!cam?.cam_rtc) return undefined;
144
- const query = username ? `?username=${encodeURIComponent(username)}` : "";
147
+ const query = endpointUsername
148
+ ? `?username=${encodeURIComponent(endpointUsername)}`
149
+ : "";
145
150
  return `${cam.cam_rtc.replace(/\/$/, "")}/whep${query}`;
146
- }, [cam?.cam_rtc, username]);
151
+ }, [cam?.cam_rtc, endpointUsername]);
147
152
 
148
153
  const streamKeyCandidate = useMemo(() => {
149
154
  if (!cam?.cam_id || !cam.cam_online || !endpoint || !tokenQuery.data?.token)
150
155
  return "";
151
156
 
152
157
  return [
153
- username,
158
+ tokenUsername,
154
159
  cam.company_id,
155
160
  cam.cam_id,
156
161
  endpoint,
@@ -163,14 +168,14 @@ export function useCctvRtcStream({
163
168
  endpoint,
164
169
  tokenQuery.data?.token,
165
170
  tokenQuery.dataUpdatedAt,
166
- username,
171
+ tokenUsername,
167
172
  ]);
168
173
 
169
174
  const streamIdentityKey = useMemo(() => {
170
175
  if (!cam?.cam_id || !endpoint) return "";
171
176
 
172
- return [username, cam.company_id, cam.cam_id, endpoint].join("|");
173
- }, [cam?.cam_id, cam?.company_id, endpoint, username]);
177
+ return [tokenUsername, cam.company_id, cam.cam_id, endpoint].join("|");
178
+ }, [cam?.cam_id, cam?.company_id, endpoint, tokenUsername]);
174
179
 
175
180
  useEffect(() => {
176
181
  setHasConnected(false);
@@ -168,6 +168,7 @@ export interface API_Res_CctvCompanyCameraList extends API_Res_CctvCameraData {
168
168
  * @property {string} cam_id 카메라 id코드
169
169
  * @property {string} stream_path 카메라 스트림 path
170
170
  * @property {boolean} is_public 카메라 외부공유 여부
171
+ * @property {boolean} [farm_cctv_is_public] farm 단위 CCTV 공개 동의 여부
171
172
  * @property {boolean} is_watching 외부시청 중 여부
172
173
  * @property {number} viewer_count 현재 외부시청 세션 수
173
174
  */
@@ -185,6 +186,10 @@ export interface API_Res_CctvViewerStatusData
185
186
  * 스트림 path
186
187
  */
187
188
  stream_path: string;
189
+ /**
190
+ * farm 단위 CCTV 공개 동의 여부
191
+ */
192
+ farm_cctv_is_public?: boolean;
188
193
  /**
189
194
  * 외부시청 중 여부
190
195
  */
@@ -195,12 +200,23 @@ export interface API_Res_CctvViewerStatusData
195
200
  viewer_count: number;
196
201
  }
197
202
 
203
+ /**
204
+ * CCTV; 카메라 외부시청 상태 목록 응답 데이터
205
+ * @property {API_Res_CctvViewerStatusData[]} items 카메라 외부시청 상태 목록
206
+ */
207
+ export interface API_Res_CctvViewerStatusBodyData {
208
+ /**
209
+ * 카메라 외부시청 상태 목록
210
+ */
211
+ items: API_Res_CctvViewerStatusData[];
212
+ }
213
+
198
214
  /**
199
215
  * CCTV; 카메라 외부시청 상태 응답
200
- * @typedef {API_Res_Base<API_Res_CctvViewerStatusData>} API_Res_CctvViewerStatus
216
+ * @typedef {API_Res_Base<API_Res_CctvViewerStatusBodyData>} API_Res_CctvViewerStatus
201
217
  */
202
218
  export type API_Res_CctvViewerStatus =
203
- API_Res_Base<API_Res_CctvViewerStatusData>;
219
+ API_Res_Base<API_Res_CctvViewerStatusBodyData>;
204
220
 
205
221
  /**
206
222
  * CCTV; 각 분야그룹의 업체목록
@@ -60,6 +60,7 @@ export interface CctvApiUrlContext {
60
60
  * @property {string} [company_id] 선택된 업체 id코드
61
61
  * @property {string} [cam_id] 선택된 카메라 id코드
62
62
  * @property {string} username CCTV 조회시 권한 확인을 위한 계정명
63
+ * @property {string} [whepUsername] WHEP endpoint username 덮어쓰기 값
63
64
  * @property {string} [search] 검색 키워드 (입력값)
64
65
  * @property {string} [filter] 검색 키워드 (필터값)
65
66
  * @property {API_Res_CctvCompanyGroup[]} rawData 원본 데이터 배열
@@ -71,6 +72,10 @@ export interface CctvBaseContext extends CctvSelectedContext {
71
72
  * CCTV 조회시 권한 확인을 위한 계정명
72
73
  */
73
74
  username: string;
75
+ /**
76
+ * WHEP endpoint username 덮어쓰기 값
77
+ */
78
+ whepUsername?: string;
74
79
  /**
75
80
  * 검색 키워드 (입력값)
76
81
  */
@@ -100,6 +105,7 @@ export interface CctvBaseContext extends CctvSelectedContext {
100
105
  * @property {string} [company_id] 선택된 업체 id코드
101
106
  * @property {string} [cam_id] 선택된 카메라 id코드
102
107
  * @property {string} username CCTV 조회시 권한 확인을 위한 계정명
108
+ * @property {string} [whepUsername] WHEP endpoint username 덮어쓰기 값
103
109
  * @property {string} search 검색 키워드 입력값
104
110
  * @property {string} filter 검색 키워드 필터값
105
111
  * @property {API_Res_CctvCompanyGroup[]} rawData 원본 데이터 배열
@@ -117,6 +123,7 @@ export type CctvContext<ContextExtension extends object = object> =
117
123
  * @property {string} [listUrl] company-list API 요청 경로
118
124
  * @property {string} [tokenUrl] token API 요청 경로
119
125
  * @property {string} [username] CCTV 조회시 권한 확인을 위한 계정명
126
+ * @property {string} [whepUsername] WHEP endpoint username 덮어쓰기 값
120
127
  * @property {ContextExtension} [defaultValues] 서비스 확장 context 기본값
121
128
  * @property {React.ReactNode} children
122
129
  */
@@ -127,6 +134,10 @@ export type CctvProviderProps<ContextExtension extends object = object> =
127
134
  * CCTV 조회시 권한 확인을 위한 계정명
128
135
  */
129
136
  username?: string;
137
+ /**
138
+ * WHEP endpoint username 덮어쓰기 값
139
+ */
140
+ whepUsername?: string;
130
141
  /**
131
142
  * 서비스 확장 context 기본값
132
143
  */