@daeryun/dr_components 0.8.4 → 0.8.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/dist/components/Daeryuntalk/ChatHomeView.jsx +2 -2
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +2 -1
- package/dist/components/Daeryuntalk/ChatWidget.jsx +2 -2
- package/dist/components/Daeryuntalk/ChatWidget.tsx +2 -2
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +2 -1
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +10 -3
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +12 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +22 -15
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +21 -13
- package/dist/components/Daeryuntalk/index.jsx +1 -1
- package/dist/components/Daeryuntalk/index.tsx +1 -1
- package/dist/styles/globals.css +4 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ import ShadowBox from './_ui/ShadowBox';
|
|
|
24
24
|
import { useDaeryunTalkToast } from './Toast/DaeryuntalkToastProvider';
|
|
25
25
|
import ToastRenderer from './Toast/ToastRender';
|
|
26
26
|
const ChatHomeView = ({ hashValue, setHashValue, isMobile }) => {
|
|
27
|
-
const { isConnected, isAuthenticated, historyList, inquiryMainData, startChat, createNewChat, chatInquiryNumber, sendHeartbeat, sendInquiryLeft, goGetHistoryList, sendHistoryEntered, sendHistoryLeft, startSelectedChat, attendRoomByHistory } = useDaeryuntalk();
|
|
27
|
+
const { isLoading: isProviderLoading, isConnected, isAuthenticated, historyList, inquiryMainData, startChat, createNewChat, chatInquiryNumber, sendHeartbeat, sendInquiryLeft, goGetHistoryList, sendHistoryEntered, sendHistoryLeft, startSelectedChat, attendRoomByHistory } = useDaeryuntalk();
|
|
28
28
|
const [viewState, setViewState] = useState('home');
|
|
29
29
|
const [mainData, setMainData] = useState(null);
|
|
30
30
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -32,7 +32,7 @@ const ChatHomeView = ({ hashValue, setHashValue, isMobile }) => {
|
|
|
32
32
|
// 아직 커버이미지 url이 안나옴
|
|
33
33
|
const backgroundImage = (mainData === null || mainData === void 0 ? void 0 : mainData.sleeve_image_url) ? mainData.sleeve_image_url : DaeryuntalkIntro;
|
|
34
34
|
useEffect(() => {
|
|
35
|
-
if (hashValue && isConnected) {
|
|
35
|
+
if (hashValue && isConnected && !isProviderLoading) {
|
|
36
36
|
handleStartChat();
|
|
37
37
|
}
|
|
38
38
|
}, [hashValue, isConnected]);
|
|
@@ -26,6 +26,7 @@ type ChatHomeViewProps = {
|
|
|
26
26
|
};
|
|
27
27
|
const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, isMobile }) => {
|
|
28
28
|
const {
|
|
29
|
+
isLoading: isProviderLoading,
|
|
29
30
|
isConnected,
|
|
30
31
|
isAuthenticated,
|
|
31
32
|
historyList,
|
|
@@ -48,7 +49,7 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
48
49
|
// 아직 커버이미지 url이 안나옴
|
|
49
50
|
const backgroundImage = mainData?.sleeve_image_url ? mainData.sleeve_image_url : DaeryuntalkIntro;
|
|
50
51
|
useEffect(() => {
|
|
51
|
-
if (hashValue && isConnected) {
|
|
52
|
+
if (hashValue && isConnected && !isProviderLoading) {
|
|
52
53
|
handleStartChat();
|
|
53
54
|
}
|
|
54
55
|
}, [hashValue, isConnected]);
|
|
@@ -17,9 +17,9 @@ const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
|
|
|
17
17
|
bg-white shadow-[0px_4px_10px_0px_#00000026]
|
|
18
18
|
${isMobile ? '' : 'duration-300 ease-in-out'}
|
|
19
19
|
${isHash && isMobile
|
|
20
|
-
? 'inset-0 h-
|
|
20
|
+
? 'inset-0 h-screen w-screen rounded-none'
|
|
21
21
|
: isMobile || isHash
|
|
22
|
-
? 'inset-0 w-screen rounded-none'
|
|
22
|
+
? 'inset-0 h-screen w-screen rounded-none'
|
|
23
23
|
: 'bottom-[165px] right-[30px] max-w-[390px] rounded-[30px] lg:bottom-[110px]'}
|
|
24
24
|
|
|
25
25
|
${isMobile
|
|
@@ -30,9 +30,9 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
|
|
|
30
30
|
${isMobile ? '' : 'duration-300 ease-in-out'}
|
|
31
31
|
${
|
|
32
32
|
isHash && isMobile
|
|
33
|
-
? 'inset-0 h-
|
|
33
|
+
? 'inset-0 h-screen w-screen rounded-none'
|
|
34
34
|
: isMobile || isHash
|
|
35
|
-
? 'inset-0 w-screen rounded-none'
|
|
35
|
+
? 'inset-0 h-screen w-screen rounded-none'
|
|
36
36
|
: 'bottom-[165px] right-[30px] max-w-[390px] rounded-[30px] lg:bottom-[110px]'
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -76,9 +76,10 @@ export declare function getChatInquiryMessageList(chatInquiryNumber: string, sta
|
|
|
76
76
|
* @param version API 버전 (기본값: 1.0.0)
|
|
77
77
|
* @returns 웹소켓 인스턴스 및 문의 데이터
|
|
78
78
|
*/
|
|
79
|
-
export declare function initializeDaeryuntalk(onWebSocketConnected?: (socket: WebSocket) => void, onWebSocketMessage?: (event: MessageEvent) => void, version?: string): Promise<{
|
|
79
|
+
export declare function initializeDaeryuntalk(hashValue: string, onWebSocketConnected?: (socket: WebSocket) => void, onWebSocketMessage?: (event: MessageEvent) => void, version?: string): Promise<{
|
|
80
80
|
inquiryData?: IDaeryunTalkResponseWrapper<IChatInquiryMainDataResponse>;
|
|
81
81
|
socket: WebSocket;
|
|
82
|
+
hashAuth: any;
|
|
82
83
|
}>;
|
|
83
84
|
/**
|
|
84
85
|
* 채팅 워크플로우 진행 처리
|
|
@@ -356,7 +356,7 @@ export function getChatInquiryMessageList(chatInquiryNumber, standardDateTime, s
|
|
|
356
356
|
const body = {
|
|
357
357
|
d: Object.assign(Object.assign({ chat_inquiry_number: chatInquiryNumber }, (standardDateTime && { standard_date_time: standardDateTime })), {
|
|
358
358
|
// standard_date_time: standard_date_time ?? new Date().toISOString(),
|
|
359
|
-
size: size !== null && size !== void 0 ? size :
|
|
359
|
+
size: size !== null && size !== void 0 ? size : 200 })
|
|
360
360
|
};
|
|
361
361
|
console.log('[채팅 메세지 리스트] 문의 번호:', chatInquiryNumber, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
362
362
|
try {
|
|
@@ -381,7 +381,7 @@ export function getChatInquiryMessageList(chatInquiryNumber, standardDateTime, s
|
|
|
381
381
|
* @param version API 버전 (기본값: 1.0.0)
|
|
382
382
|
* @returns 웹소켓 인스턴스 및 문의 데이터
|
|
383
383
|
*/
|
|
384
|
-
export function initializeDaeryuntalk(onWebSocketConnected, onWebSocketMessage, version) {
|
|
384
|
+
export function initializeDaeryuntalk(hashValue, onWebSocketConnected, onWebSocketMessage, version) {
|
|
385
385
|
return __awaiter(this, void 0, void 0, function* () {
|
|
386
386
|
console.log('[Daeryuntalk 초기화 시작] 전체 흐름 실행', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
387
387
|
try {
|
|
@@ -410,6 +410,12 @@ export function initializeDaeryuntalk(onWebSocketConnected, onWebSocketMessage,
|
|
|
410
410
|
: undefined);
|
|
411
411
|
// console.log('socket', socket);
|
|
412
412
|
console.log('[Daeryuntalk 초기화] 3단계: 웹소켓 연결 객체 생성됨');
|
|
413
|
+
console.log('[DaeryuntalkContext] 로딩 상태 설정: true');
|
|
414
|
+
// 만약 해쉬값이 있으면 이것부터 해여함
|
|
415
|
+
let hashAuth;
|
|
416
|
+
if (hashValue) {
|
|
417
|
+
hashAuth = yield followupAttend({ token: hashValue });
|
|
418
|
+
}
|
|
413
419
|
console.log('authResponse', authResponse);
|
|
414
420
|
// 4단계: 채팅 문의 메인 조회
|
|
415
421
|
console.log('[Daeryuntalk 초기화] 4단계: 채팅 문의 메인 조회 시작');
|
|
@@ -417,7 +423,8 @@ export function initializeDaeryuntalk(onWebSocketConnected, onWebSocketMessage,
|
|
|
417
423
|
console.log('[Daeryuntalk 초기화] 4단계: 채팅 문의 메인 조회 완료', chatInquiryData);
|
|
418
424
|
return {
|
|
419
425
|
inquiryData: chatInquiryData,
|
|
420
|
-
socket: socket
|
|
426
|
+
socket: socket,
|
|
427
|
+
hashAuth: hashAuth
|
|
421
428
|
};
|
|
422
429
|
console.log('[Daeryuntalk 초기화 완료] 모든 단계 성공');
|
|
423
430
|
}
|
|
@@ -448,7 +448,7 @@ export async function getChatInquiryMessageList(
|
|
|
448
448
|
chat_inquiry_number: chatInquiryNumber,
|
|
449
449
|
...(standardDateTime && { standard_date_time: standardDateTime }),
|
|
450
450
|
// standard_date_time: standard_date_time ?? new Date().toISOString(),
|
|
451
|
-
size: size ??
|
|
451
|
+
size: size ?? 200
|
|
452
452
|
}
|
|
453
453
|
};
|
|
454
454
|
|
|
@@ -483,12 +483,14 @@ export async function getChatInquiryMessageList(
|
|
|
483
483
|
* @returns 웹소켓 인스턴스 및 문의 데이터
|
|
484
484
|
*/
|
|
485
485
|
export async function initializeDaeryuntalk(
|
|
486
|
+
hashValue: string,
|
|
486
487
|
onWebSocketConnected?: (socket: WebSocket) => void,
|
|
487
488
|
onWebSocketMessage?: (event: MessageEvent) => void,
|
|
488
489
|
version?: string
|
|
489
490
|
): Promise<{
|
|
490
491
|
inquiryData?: IDaeryunTalkResponseWrapper<IChatInquiryMainDataResponse>;
|
|
491
492
|
socket: WebSocket;
|
|
493
|
+
hashAuth: any;
|
|
492
494
|
}> {
|
|
493
495
|
console.log(
|
|
494
496
|
'[Daeryuntalk 초기화 시작] 전체 흐름 실행',
|
|
@@ -528,6 +530,13 @@ export async function initializeDaeryuntalk(
|
|
|
528
530
|
// console.log('socket', socket);
|
|
529
531
|
console.log('[Daeryuntalk 초기화] 3단계: 웹소켓 연결 객체 생성됨');
|
|
530
532
|
|
|
533
|
+
console.log('[DaeryuntalkContext] 로딩 상태 설정: true');
|
|
534
|
+
// 만약 해쉬값이 있으면 이것부터 해여함
|
|
535
|
+
let hashAuth;
|
|
536
|
+
if (hashValue) {
|
|
537
|
+
hashAuth = await followupAttend({ token: hashValue });
|
|
538
|
+
}
|
|
539
|
+
|
|
531
540
|
console.log('authResponse', authResponse);
|
|
532
541
|
// 4단계: 채팅 문의 메인 조회
|
|
533
542
|
console.log('[Daeryuntalk 초기화] 4단계: 채팅 문의 메인 조회 시작');
|
|
@@ -535,7 +544,8 @@ export async function initializeDaeryuntalk(
|
|
|
535
544
|
console.log('[Daeryuntalk 초기화] 4단계: 채팅 문의 메인 조회 완료', chatInquiryData);
|
|
536
545
|
return {
|
|
537
546
|
inquiryData: chatInquiryData,
|
|
538
|
-
socket: socket
|
|
547
|
+
socket: socket,
|
|
548
|
+
hashAuth: hashAuth
|
|
539
549
|
};
|
|
540
550
|
console.log('[Daeryuntalk 초기화 완료] 모든 단계 성공');
|
|
541
551
|
} catch (error) {
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { useCallback } from 'react';
|
|
11
|
-
import {
|
|
11
|
+
import { initializeDaeryuntalk as apiInitializeDaeryuntalk } from '../../_api/daeryuntalk';
|
|
12
12
|
import { convertApiMessageToUiMessage, convertSocketObjectToUiMessage } from '../../_lib';
|
|
13
13
|
import { MessageSocketType } from '../../_enums/socket_type';
|
|
14
14
|
import { InquiryStatus } from '../../_enums/ask-status';
|
|
@@ -124,20 +124,19 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
|
|
|
124
124
|
try {
|
|
125
125
|
setIsLoading(true);
|
|
126
126
|
console.log('[DaeryuntalkContext] 로딩 상태 설정: true');
|
|
127
|
-
// 만약 해쉬값이 있으면 이것부터 해여함
|
|
128
|
-
if (hashValue) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
const { inquiryData, socket } = yield apiInitializeDaeryuntalk(socket => {
|
|
127
|
+
// // 만약 해쉬값이 있으면 이것부터 해여함
|
|
128
|
+
// if (hashValue) {
|
|
129
|
+
// const hashAuth = await followupAttend({ token: hashValue });
|
|
130
|
+
// console.log('hashAuth', hashAuth);
|
|
131
|
+
// if (hashAuth?.result_info?.result_type_cd === 'OK' || hashAuth?.result_info?.result_cd === 'OK') {
|
|
132
|
+
// // 인증 완
|
|
133
|
+
// } else {
|
|
134
|
+
// toast.error('인증에 실패했습니다.');
|
|
135
|
+
// // window.location.href = '/';
|
|
136
|
+
// return;
|
|
137
|
+
// }
|
|
138
|
+
// }
|
|
139
|
+
const { inquiryData, socket, hashAuth } = yield apiInitializeDaeryuntalk(hashValue || '', socket => {
|
|
141
140
|
console.log('[DaeryuntalkContext] 웹소켓 연결 콜백 - 연결 성공');
|
|
142
141
|
setIsConnected(true);
|
|
143
142
|
}, event => {
|
|
@@ -211,6 +210,14 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
|
|
|
211
210
|
console.error('[DaeryuntalkContext] 웹소켓 메시지 처리 오류:', error);
|
|
212
211
|
}
|
|
213
212
|
});
|
|
213
|
+
if (hashValue) {
|
|
214
|
+
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') {
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
toast.error('인증에 실패했습니다.');
|
|
218
|
+
window.location.hash = '/';
|
|
219
|
+
}
|
|
220
|
+
}
|
|
214
221
|
if (inquiryData) {
|
|
215
222
|
setInquiryMainData(inquiryData.data);
|
|
216
223
|
}
|
|
@@ -154,20 +154,21 @@ export const useSocketEventHandler = ({
|
|
|
154
154
|
try {
|
|
155
155
|
setIsLoading(true);
|
|
156
156
|
console.log('[DaeryuntalkContext] 로딩 상태 설정: true');
|
|
157
|
-
// 만약 해쉬값이 있으면 이것부터 해여함
|
|
158
|
-
if (hashValue) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
157
|
+
// // 만약 해쉬값이 있으면 이것부터 해여함
|
|
158
|
+
// if (hashValue) {
|
|
159
|
+
// const hashAuth = await followupAttend({ token: hashValue });
|
|
160
|
+
// console.log('hashAuth', hashAuth);
|
|
161
|
+
// if (hashAuth?.result_info?.result_type_cd === 'OK' || hashAuth?.result_info?.result_cd === 'OK') {
|
|
162
|
+
// // 인증 완
|
|
163
|
+
// } else {
|
|
164
|
+
// toast.error('인증에 실패했습니다.');
|
|
165
|
+
// // window.location.href = '/';
|
|
166
|
+
// return;
|
|
167
|
+
// }
|
|
168
|
+
// }
|
|
169
169
|
|
|
170
|
-
const { inquiryData, socket } = await apiInitializeDaeryuntalk(
|
|
170
|
+
const { inquiryData, socket, hashAuth } = await apiInitializeDaeryuntalk(
|
|
171
|
+
hashValue || '',
|
|
171
172
|
socket => {
|
|
172
173
|
console.log('[DaeryuntalkContext] 웹소켓 연결 콜백 - 연결 성공');
|
|
173
174
|
setIsConnected(true);
|
|
@@ -253,6 +254,13 @@ export const useSocketEventHandler = ({
|
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
);
|
|
257
|
+
if (hashValue) {
|
|
258
|
+
if (hashAuth?.result_info?.result_cd === 'OK' || hashAuth?.result_info?.result_type_cd === 'OK') {
|
|
259
|
+
} else {
|
|
260
|
+
toast.error('인증에 실패했습니다.');
|
|
261
|
+
window.location.hash = '/';
|
|
262
|
+
}
|
|
263
|
+
}
|
|
256
264
|
|
|
257
265
|
if (inquiryData) {
|
|
258
266
|
setInquiryMainData(inquiryData.data as IChatInquiryMainDataResponse);
|
|
@@ -27,7 +27,7 @@ const Daeryuntalk = ({ tel = '1800-7905' }) => {
|
|
|
27
27
|
if (value) {
|
|
28
28
|
setHashValue(value);
|
|
29
29
|
// 해시 제거 (주소창에서 #... 부분 삭제)
|
|
30
|
-
|
|
30
|
+
window.history.replaceState(null, '', window.location.pathname + window.location.search);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -40,7 +40,7 @@ const Daeryuntalk: React.FC<DaeryuntalkProps> = ({ tel = '1800-7905' }) => {
|
|
|
40
40
|
setHashValue(value);
|
|
41
41
|
|
|
42
42
|
// 해시 제거 (주소창에서 #... 부분 삭제)
|
|
43
|
-
|
|
43
|
+
window.history.replaceState(null, '', window.location.pathname + window.location.search);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
package/dist/styles/globals.css
CHANGED
|
@@ -2216,10 +2216,6 @@ video {
|
|
|
2216
2216
|
height: 1000px;
|
|
2217
2217
|
}
|
|
2218
2218
|
|
|
2219
|
-
.h-\[100dvh\] {
|
|
2220
|
-
height: 100dvh;
|
|
2221
|
-
}
|
|
2222
|
-
|
|
2223
2219
|
.h-\[100px\] {
|
|
2224
2220
|
height: 100px;
|
|
2225
2221
|
}
|
|
@@ -2645,6 +2641,10 @@ video {
|
|
|
2645
2641
|
height: 1px;
|
|
2646
2642
|
}
|
|
2647
2643
|
|
|
2644
|
+
.h-screen {
|
|
2645
|
+
height: 100vh;
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
2648
|
.\!max-h-fit {
|
|
2649
2649
|
max-height: -moz-fit-content !important;
|
|
2650
2650
|
max-height: fit-content !important;
|