@daeryun/dr_components 0.7.99 → 0.8.1
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/asset/images/daeryuntalk/close.svg +5 -0
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +21 -7
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +21 -9
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +4 -4
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +4 -7
- package/dist/components/Daeryuntalk/ChatWidget.d.ts +2 -0
- package/dist/components/Daeryuntalk/ChatWidget.jsx +27 -9
- package/dist/components/Daeryuntalk/ChatWidget.tsx +34 -9
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +1 -0
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +6 -3
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +8 -3
- package/dist/components/Daeryuntalk/HistoryView.jsx +48 -37
- package/dist/components/Daeryuntalk/HistoryView.tsx +66 -52
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +4 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +23 -1
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +35 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +11 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +14 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/useScrollShadow.js +2 -2
- package/dist/components/Daeryuntalk/_hooks/useScrollShadow.ts +2 -2
- package/dist/components/Daeryuntalk/index.jsx +8 -2
- package/dist/components/Daeryuntalk/index.tsx +13 -4
- package/dist/components/common/strength/index.js +2 -2
- package/dist/components/common/strength/index.ts +2 -2
- package/dist/components/page/Strength/StrengthIntro.jsx +2 -3
- package/dist/components/page/Strength/StrengthIntro.tsx +2 -3
- package/dist/styles/globals.css +31 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -4,20 +4,38 @@ import ImageViewer from './Viewer/ImageViewer';
|
|
|
4
4
|
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
5
5
|
import ShadowBox from './_ui/ShadowBox';
|
|
6
6
|
import ToastRenderer from './Toast/ToastRender';
|
|
7
|
-
const ChatWidget = ({ isOpen }) => {
|
|
7
|
+
const ChatWidget = ({ isOpen, isMobile, onClose }) => {
|
|
8
8
|
const { containerRef, isScroll, isBottom } = useScrollShadow();
|
|
9
9
|
return (<>
|
|
10
10
|
<ImageViewer />
|
|
11
11
|
|
|
12
|
-
<div className="relative">
|
|
13
|
-
<div className={`
|
|
14
|
-
|
|
15
|
-
rounded-[30px]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
<div className="relative z-[999998] ">
|
|
13
|
+
<div className={`
|
|
14
|
+
fixed
|
|
15
|
+
${isMobile ? 'inset-0 w-screen rounded-none' : 'bottom-[110px] right-[30px] max-w-[390px] rounded-[30px]'}
|
|
16
|
+
w-full
|
|
17
|
+
bg-white shadow-[0px_4px_10px_0px_#00000026]
|
|
18
|
+
transition-transform duration-300 ease-out
|
|
19
|
+
${isMobile
|
|
20
|
+
? isOpen
|
|
21
|
+
? 'translate-y-0' // 열릴 때: 아래에서 위로 올라옴
|
|
22
|
+
: 'translate-y-full' // 닫힐 때: 현재 위치에서 아래로 내려감
|
|
23
|
+
: isOpen
|
|
24
|
+
? 'translate-y-0 scale-100 opacity-100'
|
|
25
|
+
: 'pointer-events-none translate-y-6 opacity-0'}
|
|
26
|
+
`}>
|
|
27
|
+
{/*/!* 닫기 버튼 (모바일 전용) *!/*/}
|
|
28
|
+
{/*{isMobile && (*/}
|
|
29
|
+
{/* <button*/}
|
|
30
|
+
{/* onClick={onClose}*/}
|
|
31
|
+
{/* className="absolute right-4 top-4 z-10 rounded-full bg-white/70 p-2 backdrop-blur"*/}
|
|
32
|
+
{/* aria-label="닫기"*/}
|
|
33
|
+
{/* >*/}
|
|
34
|
+
{/* X*/}
|
|
35
|
+
{/* </button>*/}
|
|
36
|
+
{/*)}*/}
|
|
19
37
|
{/* 실제로 스크롤되는 컨테이너에 ref 연결 */}
|
|
20
|
-
<div ref={containerRef} className="no-scrollbar h-full overflow-y-auto rounded-[30px] bg-white">
|
|
38
|
+
<div ref={containerRef} className="no-scrollbar flex h-full items-center justify-center overflow-y-auto rounded-[30px] bg-white">
|
|
21
39
|
<ChatHomeView />
|
|
22
40
|
</div>
|
|
23
41
|
|
|
@@ -8,25 +8,50 @@ import ToastRenderer from './Toast/ToastRender';
|
|
|
8
8
|
|
|
9
9
|
interface ChatWidgetProps {
|
|
10
10
|
isOpen: boolean;
|
|
11
|
+
isMobile: boolean;
|
|
12
|
+
onClose: () => void;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen }) => {
|
|
15
|
+
const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose }) => {
|
|
14
16
|
const { containerRef, isScroll, isBottom } = useScrollShadow<HTMLDivElement>();
|
|
15
17
|
return (
|
|
16
18
|
<>
|
|
17
19
|
<ImageViewer />
|
|
18
20
|
|
|
19
|
-
<div className="relative">
|
|
21
|
+
<div className="relative z-[999998] ">
|
|
20
22
|
<div
|
|
21
|
-
className={`
|
|
22
|
-
|
|
23
|
-
rounded-[30px]
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
className={`
|
|
24
|
+
fixed
|
|
25
|
+
${isMobile ? 'inset-0 w-screen rounded-none' : 'bottom-[110px] right-[30px] max-w-[390px] rounded-[30px]'}
|
|
26
|
+
w-full
|
|
27
|
+
bg-white shadow-[0px_4px_10px_0px_#00000026]
|
|
28
|
+
transition-transform duration-300 ease-out
|
|
29
|
+
${
|
|
30
|
+
isMobile
|
|
31
|
+
? isOpen
|
|
32
|
+
? 'translate-y-0' // 열릴 때: 아래에서 위로 올라옴
|
|
33
|
+
: 'translate-y-full' // 닫힐 때: 현재 위치에서 아래로 내려감
|
|
34
|
+
: isOpen
|
|
35
|
+
? 'translate-y-0 scale-100 opacity-100'
|
|
36
|
+
: 'pointer-events-none translate-y-6 opacity-0'
|
|
37
|
+
}
|
|
38
|
+
`}
|
|
27
39
|
>
|
|
40
|
+
{/*/!* 닫기 버튼 (모바일 전용) *!/*/}
|
|
41
|
+
{/*{isMobile && (*/}
|
|
42
|
+
{/* <button*/}
|
|
43
|
+
{/* onClick={onClose}*/}
|
|
44
|
+
{/* className="absolute right-4 top-4 z-10 rounded-full bg-white/70 p-2 backdrop-blur"*/}
|
|
45
|
+
{/* aria-label="닫기"*/}
|
|
46
|
+
{/* >*/}
|
|
47
|
+
{/* X*/}
|
|
48
|
+
{/* </button>*/}
|
|
49
|
+
{/*)}*/}
|
|
28
50
|
{/* 실제로 스크롤되는 컨테이너에 ref 연결 */}
|
|
29
|
-
<div
|
|
51
|
+
<div
|
|
52
|
+
ref={containerRef}
|
|
53
|
+
className="no-scrollbar flex h-full items-center justify-center overflow-y-auto rounded-[30px] bg-white"
|
|
54
|
+
>
|
|
30
55
|
<ChatHomeView />
|
|
31
56
|
</div>
|
|
32
57
|
|
|
@@ -68,6 +68,7 @@ type DaeryuntalkContextType = {
|
|
|
68
68
|
sendHistoryLeft: (chatInquiryNumbers: string[]) => void;
|
|
69
69
|
startSelectedChat: (chatInquiryNumbers: string) => void;
|
|
70
70
|
sendInquiryJoined: (chatInquiryNumber: string) => void;
|
|
71
|
+
attendRoomByHistory: (chatInquiryNumber: string) => any;
|
|
71
72
|
};
|
|
72
73
|
declare const DaeryuntalkContext: React.Context<DaeryuntalkContextType>;
|
|
73
74
|
type DaeryuntalkProviderProps = {
|
|
@@ -50,7 +50,8 @@ const DaeryuntalkContext = createContext({
|
|
|
50
50
|
sendHistoryEntered: () => { },
|
|
51
51
|
sendHistoryLeft: () => { },
|
|
52
52
|
startSelectedChat: () => { },
|
|
53
|
-
sendInquiryJoined: () => { }
|
|
53
|
+
sendInquiryJoined: () => { },
|
|
54
|
+
attendRoomByHistory: () => { }
|
|
54
55
|
});
|
|
55
56
|
export const DaeryuntalkProvider = ({ children, propsTel }) => {
|
|
56
57
|
const [inquiryStatus, setInquiryStatus] = useState('');
|
|
@@ -83,7 +84,7 @@ export const DaeryuntalkProvider = ({ children, propsTel }) => {
|
|
|
83
84
|
});
|
|
84
85
|
// MSG15591497825895676
|
|
85
86
|
// 채팅 관련
|
|
86
|
-
const { startChat, sendMessage, createNewChat, startWorkFlow, workFlowBack, chatUserUpdate, getNextMessageList, startSelectedChat } = useChatHandler({
|
|
87
|
+
const { startChat, sendMessage, createNewChat, startWorkFlow, workFlowBack, chatUserUpdate, getNextMessageList, startSelectedChat, attendRoomByHistory } = useChatHandler({
|
|
87
88
|
setIsLoading,
|
|
88
89
|
inquiryMainData,
|
|
89
90
|
setChatInquiryNumber,
|
|
@@ -97,6 +98,7 @@ export const DaeryuntalkProvider = ({ children, propsTel }) => {
|
|
|
97
98
|
});
|
|
98
99
|
// 이미지 뷰어용
|
|
99
100
|
const { isImageViewerOpen, selectedImageFile, imageViewerMessage, openImageViewer, closeImageViewer } = useViewerHook();
|
|
101
|
+
//
|
|
100
102
|
const { goRequestPhone, goHistoryPhoneAuth, goGetHistoryList } = useHistoryHandler({
|
|
101
103
|
setIsAuthenticated,
|
|
102
104
|
setHistoryList
|
|
@@ -135,7 +137,8 @@ export const DaeryuntalkProvider = ({ children, propsTel }) => {
|
|
|
135
137
|
sendHistoryEntered,
|
|
136
138
|
sendHistoryLeft,
|
|
137
139
|
startSelectedChat,
|
|
138
|
-
sendInquiryJoined
|
|
140
|
+
sendInquiryJoined,
|
|
141
|
+
attendRoomByHistory
|
|
139
142
|
}}>
|
|
140
143
|
{children}
|
|
141
144
|
</DaeryuntalkContext.Provider>);
|
|
@@ -73,6 +73,7 @@ type DaeryuntalkContextType = {
|
|
|
73
73
|
sendHistoryLeft: (chatInquiryNumbers: string[]) => void;
|
|
74
74
|
startSelectedChat: (chatInquiryNumbers: string) => void;
|
|
75
75
|
sendInquiryJoined: (chatInquiryNumber: string) => void;
|
|
76
|
+
attendRoomByHistory: (chatInquiryNumber: string) => any;
|
|
76
77
|
};
|
|
77
78
|
|
|
78
79
|
// 기본값으로 컨텍스트 생성
|
|
@@ -113,7 +114,8 @@ const DaeryuntalkContext = createContext<DaeryuntalkContextType>({
|
|
|
113
114
|
sendHistoryEntered: () => {},
|
|
114
115
|
sendHistoryLeft: () => {},
|
|
115
116
|
startSelectedChat: () => {},
|
|
116
|
-
sendInquiryJoined: () => {}
|
|
117
|
+
sendInquiryJoined: () => {},
|
|
118
|
+
attendRoomByHistory: () => {}
|
|
117
119
|
});
|
|
118
120
|
|
|
119
121
|
// 프로바이더 컴포넌트 생성
|
|
@@ -175,7 +177,8 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
|
|
|
175
177
|
workFlowBack,
|
|
176
178
|
chatUserUpdate,
|
|
177
179
|
getNextMessageList,
|
|
178
|
-
startSelectedChat
|
|
180
|
+
startSelectedChat,
|
|
181
|
+
attendRoomByHistory
|
|
179
182
|
} = useChatHandler({
|
|
180
183
|
setIsLoading,
|
|
181
184
|
inquiryMainData,
|
|
@@ -193,6 +196,7 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
|
|
|
193
196
|
const { isImageViewerOpen, selectedImageFile, imageViewerMessage, openImageViewer, closeImageViewer } =
|
|
194
197
|
useViewerHook();
|
|
195
198
|
|
|
199
|
+
//
|
|
196
200
|
const { goRequestPhone, goHistoryPhoneAuth, goGetHistoryList } = useHistoryHandler({
|
|
197
201
|
setIsAuthenticated,
|
|
198
202
|
setHistoryList
|
|
@@ -234,7 +238,8 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
|
|
|
234
238
|
sendHistoryEntered,
|
|
235
239
|
sendHistoryLeft,
|
|
236
240
|
startSelectedChat,
|
|
237
|
-
sendInquiryJoined
|
|
241
|
+
sendInquiryJoined,
|
|
242
|
+
attendRoomByHistory
|
|
238
243
|
}}
|
|
239
244
|
>
|
|
240
245
|
{children}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import LinkRight from '../../asset/images/daeryuntalk/link_right.svg';
|
|
3
3
|
import EmptyMessage from '../../asset/images/daeryuntalk/empty_message.svg';
|
|
4
4
|
import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
5
5
|
import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
|
|
6
6
|
import AuthForm from './History/AuthForm';
|
|
7
|
-
|
|
7
|
+
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
8
|
+
import ShadowBox from './_ui/ShadowBox';
|
|
8
9
|
const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthenticated, historyLit, goGetHistoryList }) => {
|
|
10
|
+
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
checkScroll();
|
|
13
|
+
}, [historyLit]);
|
|
9
14
|
const formatTimestamp = (timestamp) => {
|
|
10
15
|
if (!timestamp)
|
|
11
16
|
return '';
|
|
@@ -35,6 +40,7 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
|
|
|
35
40
|
};
|
|
36
41
|
const hasHistories = historyLit.length > 0;
|
|
37
42
|
return (<div className="flex h-full flex-col">
|
|
43
|
+
{/* 헤더 */}
|
|
38
44
|
<div className="flex items-center justify-between border-b border-gray-200 p-4">
|
|
39
45
|
<button className="flex h-7 w-7 items-center justify-center" aria-label="이전" onClick={onBackClick}>
|
|
40
46
|
<PrevIcon width={28} height={28}/>
|
|
@@ -44,46 +50,51 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
|
|
|
44
50
|
</div>
|
|
45
51
|
<div className="w-7"></div>
|
|
46
52
|
</div>
|
|
53
|
+
|
|
47
54
|
{!isAuthenticated ? (<AuthForm goGetHistoryList={goGetHistoryList}/>) : (<>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
{/* 스크롤 가능한 컨텐츠 영역 */}
|
|
56
|
+
<div className="relative flex-1 overflow-hidden">
|
|
57
|
+
<div ref={containerRef} className="no-scrollbar h-full overflow-y-auto px-[20px] pb-[20px] pt-[24px]">
|
|
58
|
+
{hasHistories ? (historyLit.map(history => (<div key={history.chat_inquiry_number} className="cursor-pointer border-b border-gray-100 px-[12px] py-[18px] hover:bg-gray-50" onClick={() => onChatHistoryClick(history.chat_inquiry_number)}>
|
|
59
|
+
<div className="flex items-center justify-between">
|
|
60
|
+
<div className={`flex flex-row items-center gap-[10px]`}>
|
|
61
|
+
<span className="font-medium">{history.customer_name}</span>
|
|
62
|
+
{history.unread_message_count && history.unread_message_count > 0 ? (<span className="flex h-[18px] w-[18px] items-center justify-center rounded-full bg-[#AA1D36] px-[5.5px] py-[3px] text-[12px] font-medium leading-[100%] tracking-[-4%] text-white">
|
|
63
|
+
{history.unread_message_count}
|
|
64
|
+
</span>) : null}
|
|
65
|
+
</div>
|
|
66
|
+
<span className="text-xs text-gray-500">
|
|
67
|
+
{formatTimestamp(history.recent_message_date_time)}
|
|
68
|
+
</span>
|
|
56
69
|
</div>
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<LinkRight width={24} height={24} className="flex-shrink-0"/>
|
|
70
|
+
<div className="mt-1 flex items-center justify-between">
|
|
71
|
+
<p className="line-clamp-2 w-[85%] text-sm text-gray-700">
|
|
72
|
+
{history.recent_message_content}
|
|
73
|
+
</p>
|
|
74
|
+
<LinkRight width={24} height={24} className="flex-shrink-0"/>
|
|
75
|
+
</div>
|
|
76
|
+
</div>))) : (<div className="flex h-full flex-col items-center justify-center p-4">
|
|
77
|
+
<div className="mb-4">
|
|
78
|
+
<EmptyMessage />
|
|
67
79
|
</div>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</p>
|
|
77
|
-
</div>)}
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
<div className="p-4">
|
|
81
|
-
<button className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white" onClick={onNewChatClick}>
|
|
82
|
-
새 문의하기
|
|
83
|
-
<SendIcon width={24} height={24}/>
|
|
84
|
-
</button>
|
|
80
|
+
<p className="text-center text-gray-500">
|
|
81
|
+
이전 대화기록이 없습니다
|
|
82
|
+
<br />
|
|
83
|
+
대화를 시작해 보세요
|
|
84
|
+
</p>
|
|
85
|
+
</div>)}
|
|
86
|
+
</div>
|
|
87
|
+
{isScroll && !isBottom && <ShadowBox />}
|
|
85
88
|
</div>
|
|
86
89
|
</>)}
|
|
90
|
+
|
|
91
|
+
{/* 새 문의하기 버튼 - 항상 하단에 고정 */}
|
|
92
|
+
<div className="flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
93
|
+
<button className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white" onClick={onNewChatClick}>
|
|
94
|
+
새 문의하기
|
|
95
|
+
<SendIcon width={24} height={24}/>
|
|
96
|
+
</button>
|
|
97
|
+
</div>
|
|
87
98
|
</div>);
|
|
88
99
|
};
|
|
89
100
|
export default HistoryView;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import LinkRight from '../../asset/images/daeryuntalk/link_right.svg';
|
|
3
3
|
import EmptyMessage from '../../asset/images/daeryuntalk/empty_message.svg';
|
|
4
4
|
import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
5
5
|
import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
|
|
6
|
-
import Input1 from './_ui/inputs/Input1';
|
|
7
6
|
import AuthForm from './History/AuthForm';
|
|
8
7
|
import { History } from './_api/daeryuntalk/type/response';
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
9
|
+
import ShadowBox from './_ui/ShadowBox';
|
|
11
10
|
|
|
12
11
|
type HistoryViewProps = {
|
|
13
12
|
onBackClick: () => void;
|
|
@@ -26,6 +25,12 @@ const HistoryView: React.FC<HistoryViewProps> = ({
|
|
|
26
25
|
historyLit,
|
|
27
26
|
goGetHistoryList
|
|
28
27
|
}) => {
|
|
28
|
+
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow<HTMLDivElement>();
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
checkScroll();
|
|
32
|
+
}, [historyLit]);
|
|
33
|
+
|
|
29
34
|
const formatTimestamp = (timestamp: string): string => {
|
|
30
35
|
if (!timestamp) return '';
|
|
31
36
|
|
|
@@ -63,6 +68,7 @@ const HistoryView: React.FC<HistoryViewProps> = ({
|
|
|
63
68
|
|
|
64
69
|
return (
|
|
65
70
|
<div className="flex h-full flex-col">
|
|
71
|
+
{/* 헤더 */}
|
|
66
72
|
<div className="flex items-center justify-between border-b border-gray-200 p-4">
|
|
67
73
|
<button className="flex h-7 w-7 items-center justify-center" aria-label="이전" onClick={onBackClick}>
|
|
68
74
|
<PrevIcon width={28} height={28} />
|
|
@@ -72,65 +78,73 @@ const HistoryView: React.FC<HistoryViewProps> = ({
|
|
|
72
78
|
</div>
|
|
73
79
|
<div className="w-7"></div>
|
|
74
80
|
</div>
|
|
81
|
+
|
|
75
82
|
{!isAuthenticated ? (
|
|
76
83
|
<AuthForm goGetHistoryList={goGetHistoryList} />
|
|
77
84
|
) : (
|
|
78
85
|
<>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<div
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
{/* 스크롤 가능한 컨텐츠 영역 */}
|
|
87
|
+
<div className="relative flex-1 overflow-hidden">
|
|
88
|
+
<div
|
|
89
|
+
ref={containerRef}
|
|
90
|
+
className="no-scrollbar h-full overflow-y-auto px-[20px] pb-[20px] pt-[24px]"
|
|
91
|
+
>
|
|
92
|
+
{hasHistories ? (
|
|
93
|
+
historyLit.map(history => (
|
|
94
|
+
<div
|
|
95
|
+
key={history.chat_inquiry_number}
|
|
96
|
+
className="cursor-pointer border-b border-gray-100 px-[12px] py-[18px] hover:bg-gray-50"
|
|
97
|
+
onClick={() => onChatHistoryClick(history.chat_inquiry_number)}
|
|
98
|
+
>
|
|
99
|
+
<div className="flex items-center justify-between">
|
|
100
|
+
<div className={`flex flex-row items-center gap-[10px]`}>
|
|
101
|
+
<span className="font-medium">{history.customer_name}</span>
|
|
102
|
+
{history.unread_message_count && history.unread_message_count > 0 ? (
|
|
103
|
+
<span className="flex h-[18px] w-[18px] items-center justify-center rounded-full bg-[#AA1D36] px-[5.5px] py-[3px] text-[12px] font-medium leading-[100%] tracking-[-4%] text-white">
|
|
104
|
+
{history.unread_message_count}
|
|
105
|
+
</span>
|
|
106
|
+
) : null}
|
|
107
|
+
</div>
|
|
108
|
+
<span className="text-xs text-gray-500">
|
|
109
|
+
{formatTimestamp(history.recent_message_date_time)}
|
|
110
|
+
</span>
|
|
111
|
+
</div>
|
|
112
|
+
<div className="mt-1 flex items-center justify-between">
|
|
113
|
+
<p className="line-clamp-2 w-[85%] text-sm text-gray-700">
|
|
114
|
+
{history.recent_message_content}
|
|
115
|
+
</p>
|
|
116
|
+
<LinkRight width={24} height={24} className="flex-shrink-0" />
|
|
95
117
|
</div>
|
|
96
|
-
<span className="text-xs text-gray-500">
|
|
97
|
-
{formatTimestamp(history.recent_message_date_time)}
|
|
98
|
-
{/*{history.unread_message_count}*/}
|
|
99
|
-
</span>
|
|
100
118
|
</div>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<
|
|
119
|
+
))
|
|
120
|
+
) : (
|
|
121
|
+
<div className="flex h-full flex-col items-center justify-center p-4">
|
|
122
|
+
<div className="mb-4">
|
|
123
|
+
<EmptyMessage />
|
|
106
124
|
</div>
|
|
125
|
+
<p className="text-center text-gray-500">
|
|
126
|
+
이전 대화기록이 없습니다
|
|
127
|
+
<br />
|
|
128
|
+
대화를 시작해 보세요
|
|
129
|
+
</p>
|
|
107
130
|
</div>
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<div className="mb-4">
|
|
112
|
-
<EmptyMessage />
|
|
113
|
-
</div>
|
|
114
|
-
<p className="text-center text-gray-500">
|
|
115
|
-
이전 대화기록이 없습니다
|
|
116
|
-
<br />
|
|
117
|
-
대화를 시작해 보세요
|
|
118
|
-
</p>
|
|
119
|
-
</div>
|
|
120
|
-
)}
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<div className="p-4">
|
|
124
|
-
<button
|
|
125
|
-
className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white"
|
|
126
|
-
onClick={onNewChatClick}
|
|
127
|
-
>
|
|
128
|
-
새 문의하기
|
|
129
|
-
<SendIcon width={24} height={24} />
|
|
130
|
-
</button>
|
|
131
|
+
)}
|
|
132
|
+
</div>
|
|
133
|
+
{isScroll && !isBottom && <ShadowBox />}
|
|
131
134
|
</div>
|
|
132
135
|
</>
|
|
133
136
|
)}
|
|
137
|
+
|
|
138
|
+
{/* 새 문의하기 버튼 - 항상 하단에 고정 */}
|
|
139
|
+
<div className="flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
140
|
+
<button
|
|
141
|
+
className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white"
|
|
142
|
+
onClick={onNewChatClick}
|
|
143
|
+
>
|
|
144
|
+
새 문의하기
|
|
145
|
+
<SendIcon width={24} height={24} />
|
|
146
|
+
</button>
|
|
147
|
+
</div>
|
|
134
148
|
</div>
|
|
135
149
|
);
|
|
136
150
|
};
|
|
@@ -159,3 +159,7 @@ export declare const historyPhoneAuth: ({ name, cellPhoneNumber, certificationNu
|
|
|
159
159
|
export declare const getHistoryList: ({ version }: {
|
|
160
160
|
version?: string;
|
|
161
161
|
}) => Promise<IDaeryunTalkResponseWrapper<HistoryListResponse>>;
|
|
162
|
+
export declare const attendChatRoomByHistory: ({ chatInquiryNumber, version }: {
|
|
163
|
+
chatInquiryNumber: string;
|
|
164
|
+
version?: string;
|
|
165
|
+
}) => Promise<IDaeryunTalkResponseWrapper<HistoryListResponse>>;
|
|
@@ -32,7 +32,8 @@ const ENDPOINTS = {
|
|
|
32
32
|
/* 히스토리 */
|
|
33
33
|
HISTORY_PHONE_REQUEST: '/chatctm/his/occupancycertificationnumbersend', // 점유 인증 번호 요청
|
|
34
34
|
HISTORY_PHONE_AUTHENTICATION: '/chatctm/his/occupancycertificationnumberverification', // 점유 인증 번호 검증
|
|
35
|
-
HISTORY_LIST: '/chatctm/his/historychatinquirylistsearch' // 히스토리 채팅 문의 목록 조회
|
|
35
|
+
HISTORY_LIST: '/chatctm/his/historychatinquirylistsearch', // 히스토리 채팅 문의 목록 조회
|
|
36
|
+
ATTEND_CHAT_BY_HISTORY: '/chatctm/his/historychatinquiryparticipation' // 채팅문의 참여
|
|
36
37
|
};
|
|
37
38
|
// 메인
|
|
38
39
|
const TEST_CENTER_CODE = 'CT0000';
|
|
@@ -672,3 +673,24 @@ export const getHistoryList = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
672
673
|
throw error;
|
|
673
674
|
}
|
|
674
675
|
});
|
|
676
|
+
export const attendChatRoomByHistory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ chatInquiryNumber, version = DEFAULT_API_VERSION }) {
|
|
677
|
+
const consoleName = '히스토리 채팅 문의 참여';
|
|
678
|
+
try {
|
|
679
|
+
console.log(`[${consoleName} 진행]`);
|
|
680
|
+
const body = {
|
|
681
|
+
d: {
|
|
682
|
+
chat_inquiry_number: chatInquiryNumber // required
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.ATTEND_CHAT_BY_HISTORY}`, {
|
|
686
|
+
method: 'POST',
|
|
687
|
+
body: JSON.stringify(body)
|
|
688
|
+
}, version);
|
|
689
|
+
console.log(`[${consoleName} 완료]`, response);
|
|
690
|
+
return response;
|
|
691
|
+
}
|
|
692
|
+
catch (error) {
|
|
693
|
+
console.error(`[${consoleName} 실패] 오류:`, error);
|
|
694
|
+
throw error;
|
|
695
|
+
}
|
|
696
|
+
});
|
|
@@ -48,7 +48,8 @@ const ENDPOINTS = {
|
|
|
48
48
|
/* 히스토리 */
|
|
49
49
|
HISTORY_PHONE_REQUEST: '/chatctm/his/occupancycertificationnumbersend', // 점유 인증 번호 요청
|
|
50
50
|
HISTORY_PHONE_AUTHENTICATION: '/chatctm/his/occupancycertificationnumberverification', // 점유 인증 번호 검증
|
|
51
|
-
HISTORY_LIST: '/chatctm/his/historychatinquirylistsearch' // 히스토리 채팅 문의 목록 조회
|
|
51
|
+
HISTORY_LIST: '/chatctm/his/historychatinquirylistsearch', // 히스토리 채팅 문의 목록 조회
|
|
52
|
+
ATTEND_CHAT_BY_HISTORY: '/chatctm/his/historychatinquiryparticipation' // 채팅문의 참여
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
// 메인
|
|
@@ -897,3 +898,36 @@ export const getHistoryList = async ({ version = DEFAULT_API_VERSION }: { versio
|
|
|
897
898
|
throw error;
|
|
898
899
|
}
|
|
899
900
|
};
|
|
901
|
+
|
|
902
|
+
export const attendChatRoomByHistory = async ({
|
|
903
|
+
chatInquiryNumber,
|
|
904
|
+
version = DEFAULT_API_VERSION
|
|
905
|
+
}: {
|
|
906
|
+
chatInquiryNumber: string;
|
|
907
|
+
version?: string;
|
|
908
|
+
}) => {
|
|
909
|
+
const consoleName = '히스토리 채팅 문의 참여';
|
|
910
|
+
try {
|
|
911
|
+
console.log(`[${consoleName} 진행]`);
|
|
912
|
+
|
|
913
|
+
const body = {
|
|
914
|
+
d: {
|
|
915
|
+
chat_inquiry_number: chatInquiryNumber // required
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
const response = await fetchWithCookies<IDaeryunTalkResponseWrapper<HistoryListResponse>>(
|
|
919
|
+
`${API_BASE_URL}${ENDPOINTS.ATTEND_CHAT_BY_HISTORY}`,
|
|
920
|
+
{
|
|
921
|
+
method: 'POST',
|
|
922
|
+
body: JSON.stringify(body)
|
|
923
|
+
},
|
|
924
|
+
version
|
|
925
|
+
);
|
|
926
|
+
|
|
927
|
+
console.log(`[${consoleName} 완료]`, response);
|
|
928
|
+
return response;
|
|
929
|
+
} catch (error) {
|
|
930
|
+
console.error(`[${consoleName} 실패] 오류:`, error);
|
|
931
|
+
throw error;
|
|
932
|
+
}
|
|
933
|
+
};
|
|
@@ -15,6 +15,7 @@ interface props {
|
|
|
15
15
|
setInquiryMainData: Dispatch<SetStateAction<IChatInquiryMainDataResponse | null>>;
|
|
16
16
|
}
|
|
17
17
|
export declare const useChatHandler: ({ setIsLoading, inquiryMainData, setChatInquiryNumber, setMessages, setInquiryStatus, setMessageObject, chatInquiryNumber, setIsNextPage, setWorkFlowStack, setInquiryMainData }: props) => {
|
|
18
|
+
attendRoomByHistory: (chatInquiryNumber: string) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").HistoryListResponse>>;
|
|
18
19
|
startChat: () => Promise<string>;
|
|
19
20
|
sendMessage: (htmlContent: string, jsonData: any, retry?: boolean) => Promise<void>;
|
|
20
21
|
createNewChat: (version?: string) => Promise<void>;
|
|
@@ -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 { chatUserUpdate as apiChatUserUpdate, chatWorkFlow, chatWorkFlowBack, generateChatInquiry, getChatInquiryDetailNew, getChatInquiryMessageList, sendChatMessage } from '../../_api';
|
|
11
|
+
import { attendChatRoomByHistory, chatUserUpdate as apiChatUserUpdate, chatWorkFlow, chatWorkFlowBack, generateChatInquiry, getChatInquiryDetailNew, getChatInquiryMessageList, sendChatMessage } from '../../_api';
|
|
12
12
|
import { convertApiMessageObjectToUiMessageObject, convertApiMessageToUiMessage } from '../../_lib';
|
|
13
13
|
import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
|
|
14
14
|
export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNumber, setMessages, setInquiryStatus, setMessageObject, chatInquiryNumber, setIsNextPage, setWorkFlowStack, setInquiryMainData }) => {
|
|
@@ -360,7 +360,17 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
|
|
|
360
360
|
toast.error('메세지 조회에 실패했습니다.');
|
|
361
361
|
}
|
|
362
362
|
}), []);
|
|
363
|
+
const attendRoomByHistory = useCallback((chatInquiryNumber) => __awaiter(void 0, void 0, void 0, function* () {
|
|
364
|
+
const res = yield attendChatRoomByHistory({ chatInquiryNumber });
|
|
365
|
+
if (res.result_info.result_cd === 'OK' || res.result_info.result_type_cd === 'OK') {
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
toast.error('채팅방 참여에 실패했습니다.');
|
|
369
|
+
}
|
|
370
|
+
return res;
|
|
371
|
+
}), [chatInquiryNumber]);
|
|
363
372
|
return {
|
|
373
|
+
attendRoomByHistory,
|
|
364
374
|
startChat,
|
|
365
375
|
sendMessage,
|
|
366
376
|
createNewChat,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction, useCallback } from 'react';
|
|
2
2
|
import {
|
|
3
|
+
attendChatRoomByHistory,
|
|
3
4
|
chatUserUpdate as apiChatUserUpdate,
|
|
4
5
|
chatWorkFlow,
|
|
5
6
|
chatWorkFlowBack,
|
|
@@ -424,7 +425,20 @@ export const useChatHandler = ({
|
|
|
424
425
|
}
|
|
425
426
|
}, []);
|
|
426
427
|
|
|
428
|
+
const attendRoomByHistory = useCallback(
|
|
429
|
+
async (chatInquiryNumber: string) => {
|
|
430
|
+
const res = await attendChatRoomByHistory({ chatInquiryNumber });
|
|
431
|
+
if (res.result_info.result_cd === 'OK' || res.result_info.result_type_cd === 'OK') {
|
|
432
|
+
} else {
|
|
433
|
+
toast.error('채팅방 참여에 실패했습니다.');
|
|
434
|
+
}
|
|
435
|
+
return res;
|
|
436
|
+
},
|
|
437
|
+
[chatInquiryNumber]
|
|
438
|
+
);
|
|
439
|
+
|
|
427
440
|
return {
|
|
441
|
+
attendRoomByHistory,
|
|
428
442
|
startChat,
|
|
429
443
|
sendMessage,
|
|
430
444
|
createNewChat,
|