@daeryun/dr_components 0.8.20 → 0.8.22
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/dist/components/Daeryuntalk/ChatConversation.jsx +25 -23
- package/dist/components/Daeryuntalk/ChatConversation.tsx +24 -27
- package/dist/components/Daeryuntalk/ChatHomeView.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +8 -7
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +18 -6
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +2 -2
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +2 -2
- package/dist/components/Daeryuntalk/ChatMessage.jsx +4 -5
- package/dist/components/Daeryuntalk/ChatMessage.tsx +2 -4
- package/dist/components/Daeryuntalk/ChatWidget.jsx +2 -2
- package/dist/components/Daeryuntalk/ChatWidget.tsx +7 -2
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +2 -1
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +3 -1
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +6 -2
- package/dist/components/Daeryuntalk/NavigationFooter.d.ts +3 -0
- package/dist/components/Daeryuntalk/NavigationFooter.jsx +9 -2
- package/dist/components/Daeryuntalk/NavigationFooter.tsx +24 -2
- package/dist/components/Daeryuntalk/_enums/socket_type.js +2 -2
- package/dist/components/Daeryuntalk/_enums/socket_type.ts +2 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +2 -5
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +2 -4
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.d.ts +1 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.js +18 -13
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.ts +24 -16
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +2 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +15 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +18 -2
- package/dist/components/Daeryuntalk/index.jsx +1 -1
- package/dist/components/Daeryuntalk/index.tsx +1 -1
- package/dist/styles/globals.css +12 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
export const useChatSocketState = (chatInquiryNumber, viewState, sendHeartbeat, sendInquiryLeft) => {
|
|
2
|
+
export const useChatSocketState = (chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryJoined, sendHeartbeat, sendInquiryLeft) => {
|
|
3
|
+
// 1. 공통 하트비트 (항상 실행)
|
|
3
4
|
useEffect(() => {
|
|
4
|
-
|
|
5
|
+
sendHeartbeat();
|
|
6
|
+
const heartbeatInterval = setInterval(() => {
|
|
7
|
+
sendHeartbeat();
|
|
8
|
+
}, 5000);
|
|
9
|
+
return () => clearInterval(heartbeatInterval);
|
|
10
|
+
}, [sendHeartbeat]);
|
|
11
|
+
// 2. 뷰 상태에 따른 watch / leave
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (!chatInquiryNumber)
|
|
5
14
|
return;
|
|
6
|
-
}
|
|
7
15
|
if (viewState === 'conversation') {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
16
|
+
sendInquiryJoined(chatInquiryNumber);
|
|
17
|
+
sendInquiryWatching(chatInquiryNumber);
|
|
18
|
+
const watchingInterval = setInterval(() => {
|
|
19
|
+
sendInquiryWatching(chatInquiryNumber);
|
|
12
20
|
}, 5000);
|
|
13
|
-
return () => clearInterval(
|
|
21
|
+
return () => clearInterval(watchingInterval);
|
|
14
22
|
}
|
|
15
|
-
// 접속 채팅이 있다면 떠나감 처리
|
|
16
23
|
else {
|
|
17
|
-
|
|
18
|
-
sendInquiryLeft(chatInquiryNumber);
|
|
19
|
-
}
|
|
24
|
+
sendInquiryLeft(chatInquiryNumber);
|
|
20
25
|
}
|
|
21
|
-
}, [chatInquiryNumber, viewState,
|
|
26
|
+
}, [chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryLeft]);
|
|
22
27
|
};
|
|
@@ -3,28 +3,36 @@ import { useEffect } from 'react';
|
|
|
3
3
|
export const useChatSocketState = (
|
|
4
4
|
chatInquiryNumber: string | null,
|
|
5
5
|
viewState: 'home' | 'conversation' | 'history',
|
|
6
|
-
|
|
6
|
+
sendInquiryWatching: (chatInquiryNumber: string) => void,
|
|
7
|
+
sendInquiryJoined: (chatInquiryNumber: string) => void,
|
|
8
|
+
sendHeartbeat: () => void,
|
|
7
9
|
sendInquiryLeft: (chatInquiryNumber: string) => void
|
|
8
10
|
) => {
|
|
11
|
+
// 1. 공통 하트비트 (항상 실행)
|
|
9
12
|
useEffect(() => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
sendHeartbeat();
|
|
14
|
+
const heartbeatInterval = setInterval(() => {
|
|
15
|
+
sendHeartbeat();
|
|
16
|
+
}, 5000);
|
|
17
|
+
|
|
18
|
+
return () => clearInterval(heartbeatInterval);
|
|
19
|
+
}, [sendHeartbeat]);
|
|
20
|
+
|
|
21
|
+
// 2. 뷰 상태에 따른 watch / leave
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!chatInquiryNumber) return;
|
|
13
24
|
|
|
14
25
|
if (viewState === 'conversation') {
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
sendInquiryJoined(chatInquiryNumber);
|
|
27
|
+
sendInquiryWatching(chatInquiryNumber);
|
|
17
28
|
|
|
18
|
-
const
|
|
19
|
-
|
|
29
|
+
const watchingInterval = setInterval(() => {
|
|
30
|
+
sendInquiryWatching(chatInquiryNumber);
|
|
20
31
|
}, 5000);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (chatInquiryNumber) {
|
|
26
|
-
sendInquiryLeft(chatInquiryNumber);
|
|
27
|
-
}
|
|
32
|
+
|
|
33
|
+
return () => clearInterval(watchingInterval);
|
|
34
|
+
} else {
|
|
35
|
+
sendInquiryLeft(chatInquiryNumber);
|
|
28
36
|
}
|
|
29
|
-
}, [chatInquiryNumber, viewState,
|
|
37
|
+
}, [chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryLeft]);
|
|
30
38
|
};
|
|
@@ -16,10 +16,11 @@ interface props {
|
|
|
16
16
|
}
|
|
17
17
|
export declare const useSocketEventHandler: ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList }: props) => {
|
|
18
18
|
initializeDaeryuntalk: (hashValue: string | null, version?: string) => Promise<void>;
|
|
19
|
-
sendHeartbeat: (
|
|
19
|
+
sendHeartbeat: () => void;
|
|
20
20
|
sendInquiryJoined: (chatInquiryNumber: string) => void;
|
|
21
21
|
sendInquiryLeft: (chatInquiryNumber: string) => void;
|
|
22
22
|
sendHistoryEntered: (chatInquiryNumbers: string[]) => void;
|
|
23
23
|
sendHistoryLeft: (chatInquiryNumbers: string[]) => void;
|
|
24
|
+
sendInquiryWatching: (chatInquiryNumber: string) => void;
|
|
24
25
|
};
|
|
25
26
|
export {};
|
|
@@ -27,11 +27,21 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
|
|
|
27
27
|
* }
|
|
28
28
|
* }
|
|
29
29
|
*/
|
|
30
|
-
const sendHeartbeat = useCallback((
|
|
30
|
+
const sendHeartbeat = useCallback(() => {
|
|
31
31
|
const socket = socketRef.current;
|
|
32
32
|
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
33
33
|
socket.send(JSON.stringify({
|
|
34
34
|
type: 'heartbeat',
|
|
35
|
+
payload: {}
|
|
36
|
+
}));
|
|
37
|
+
console.log('[WebSocket] heartbeat 전송');
|
|
38
|
+
}
|
|
39
|
+
}, []);
|
|
40
|
+
const sendInquiryWatching = useCallback((chatInquiryNumber) => {
|
|
41
|
+
const socket = socketRef.current;
|
|
42
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
43
|
+
socket.send(JSON.stringify({
|
|
44
|
+
type: 'inquiry.watching',
|
|
35
45
|
payload: { chat_inquiry_number: chatInquiryNumber }
|
|
36
46
|
}));
|
|
37
47
|
console.log('[WebSocket] heartbeat 전송');
|
|
@@ -205,8 +215,10 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
|
|
|
205
215
|
console.error('[DaeryuntalkContext] 웹소켓 메시지 처리 오류:', error);
|
|
206
216
|
}
|
|
207
217
|
});
|
|
218
|
+
console.log('hashValue', hashValue);
|
|
208
219
|
if (hashValue) {
|
|
209
220
|
if (((_a = hashAuth === null || hashAuth === void 0 ? void 0 : hashAuth.result_info) === null || _a === void 0 ? void 0 : _a.result_cd) === 'OK' || ((_b = hashAuth === null || hashAuth === void 0 ? void 0 : hashAuth.result_info) === null || _b === void 0 ? void 0 : _b.result_type_cd) === 'OK') {
|
|
221
|
+
console.log('해쉬 인증 완료');
|
|
210
222
|
}
|
|
211
223
|
else {
|
|
212
224
|
toast.error('인증에 실패했습니다.');
|
|
@@ -234,6 +246,7 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
|
|
|
234
246
|
sendInquiryJoined,
|
|
235
247
|
sendInquiryLeft,
|
|
236
248
|
sendHistoryEntered,
|
|
237
|
-
sendHistoryLeft
|
|
249
|
+
sendHistoryLeft,
|
|
250
|
+
sendInquiryWatching
|
|
238
251
|
};
|
|
239
252
|
};
|
|
@@ -47,12 +47,25 @@ export const useSocketEventHandler = ({
|
|
|
47
47
|
* }
|
|
48
48
|
* }
|
|
49
49
|
*/
|
|
50
|
-
const sendHeartbeat = useCallback((
|
|
50
|
+
const sendHeartbeat = useCallback(() => {
|
|
51
51
|
const socket = socketRef.current;
|
|
52
52
|
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
53
53
|
socket.send(
|
|
54
54
|
JSON.stringify({
|
|
55
55
|
type: 'heartbeat',
|
|
56
|
+
payload: {}
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
console.log('[WebSocket] heartbeat 전송');
|
|
60
|
+
}
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
const sendInquiryWatching = useCallback((chatInquiryNumber: string) => {
|
|
64
|
+
const socket = socketRef.current;
|
|
65
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
66
|
+
socket.send(
|
|
67
|
+
JSON.stringify({
|
|
68
|
+
type: 'inquiry.watching',
|
|
56
69
|
payload: { chat_inquiry_number: chatInquiryNumber }
|
|
57
70
|
})
|
|
58
71
|
);
|
|
@@ -266,8 +279,10 @@ export const useSocketEventHandler = ({
|
|
|
266
279
|
}
|
|
267
280
|
}
|
|
268
281
|
);
|
|
282
|
+
console.log('hashValue', hashValue);
|
|
269
283
|
if (hashValue) {
|
|
270
284
|
if (hashAuth?.result_info?.result_cd === 'OK' || hashAuth?.result_info?.result_type_cd === 'OK') {
|
|
285
|
+
console.log('해쉬 인증 완료');
|
|
271
286
|
} else {
|
|
272
287
|
toast.error('인증에 실패했습니다.');
|
|
273
288
|
window.location.hash = '/';
|
|
@@ -296,6 +311,7 @@ export const useSocketEventHandler = ({
|
|
|
296
311
|
sendInquiryJoined,
|
|
297
312
|
sendInquiryLeft,
|
|
298
313
|
sendHistoryEntered,
|
|
299
|
-
sendHistoryLeft
|
|
314
|
+
sendHistoryLeft,
|
|
315
|
+
sendInquiryWatching
|
|
300
316
|
};
|
|
301
317
|
};
|
package/dist/styles/globals.css
CHANGED
|
@@ -990,6 +990,10 @@ video {
|
|
|
990
990
|
right: -0.125rem;
|
|
991
991
|
}
|
|
992
992
|
|
|
993
|
+
.-right-1 {
|
|
994
|
+
right: -0.25rem;
|
|
995
|
+
}
|
|
996
|
+
|
|
993
997
|
.-right-\[20px\] {
|
|
994
998
|
right: -20px;
|
|
995
999
|
}
|
|
@@ -998,6 +1002,10 @@ video {
|
|
|
998
1002
|
right: -50px;
|
|
999
1003
|
}
|
|
1000
1004
|
|
|
1005
|
+
.-top-1 {
|
|
1006
|
+
top: -0.25rem;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1001
1009
|
.-top-10 {
|
|
1002
1010
|
top: -2.5rem;
|
|
1003
1011
|
}
|
|
@@ -3019,10 +3027,6 @@ video {
|
|
|
3019
3027
|
width: 27px;
|
|
3020
3028
|
}
|
|
3021
3029
|
|
|
3022
|
-
.w-\[281px\] {
|
|
3023
|
-
width: 281px;
|
|
3024
|
-
}
|
|
3025
|
-
|
|
3026
3030
|
.w-\[28px\] {
|
|
3027
3031
|
width: 28px;
|
|
3028
3032
|
}
|
|
@@ -3448,6 +3452,10 @@ video {
|
|
|
3448
3452
|
max-width: 1920px;
|
|
3449
3453
|
}
|
|
3450
3454
|
|
|
3455
|
+
.max-w-\[251px\] {
|
|
3456
|
+
max-width: 251px;
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3451
3459
|
.max-w-\[300px\] {
|
|
3452
3460
|
max-width: 300px;
|
|
3453
3461
|
}
|