@daeryun/dr_components 0.8.46 → 0.8.48
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 +2 -2
- package/dist/asset/images/daeryuntalk/time.svg +2 -2
- package/dist/asset/images/daeryuntalk/viewer/zoom-out.svg +2 -4
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatButton.jsx +5 -2
- package/dist/components/Daeryuntalk/ChatButton.tsx +5 -2
- package/dist/components/Daeryuntalk/ChatConversation.d.ts +2 -0
- package/dist/components/Daeryuntalk/ChatConversation.jsx +22 -63
- package/dist/components/Daeryuntalk/ChatConversation.tsx +42 -79
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.d.ts +11 -0
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.jsx +27 -0
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.tsx +57 -0
- package/dist/components/Daeryuntalk/ChatHomeView.d.ts +3 -2
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +59 -181
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +102 -206
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +15 -14
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +15 -14
- package/dist/components/Daeryuntalk/ChatItem/ChatLoading.d.ts +3 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatLoading.jsx +11 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatLoading.tsx +21 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.jsx +4 -4
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.tsx +4 -4
- package/dist/components/Daeryuntalk/ChatItem/RichText.jsx +2 -1
- package/dist/components/Daeryuntalk/ChatItem/RichText.tsx +2 -1
- package/dist/components/Daeryuntalk/ChatItem/TimeWrapper.d.ts +9 -0
- package/dist/components/Daeryuntalk/ChatItem/TimeWrapper.jsx +9 -0
- package/dist/components/Daeryuntalk/ChatItem/TimeWrapper.tsx +20 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.jsx +3 -3
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.tsx +3 -3
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +2 -2
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +2 -2
- package/dist/components/Daeryuntalk/ChatMessage.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatMessage.jsx +31 -36
- package/dist/components/Daeryuntalk/ChatMessage.tsx +34 -38
- package/dist/components/Daeryuntalk/ChatObject/FieldWorkObject.jsx +2 -2
- package/dist/components/Daeryuntalk/ChatObject/FieldWorkObject.tsx +2 -2
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.tsx +1 -1
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.jsx +6 -23
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.tsx +6 -23
- package/dist/components/Daeryuntalk/ChatWidget.jsx +60 -23
- package/dist/components/Daeryuntalk/ChatWidget.tsx +72 -34
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +2 -2
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +2 -2
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +5 -5
- package/dist/components/Daeryuntalk/DateSeparator.jsx +2 -2
- package/dist/components/Daeryuntalk/DateSeparator.tsx +2 -2
- package/dist/components/Daeryuntalk/FixedErrorBox.d.ts +7 -0
- package/dist/components/Daeryuntalk/FixedErrorBox.jsx +33 -0
- package/dist/components/Daeryuntalk/FixedErrorBox.tsx +73 -0
- package/dist/components/Daeryuntalk/History/AuthForm.d.ts +3 -1
- package/dist/components/Daeryuntalk/History/AuthForm.jsx +15 -45
- package/dist/components/Daeryuntalk/History/AuthForm.tsx +21 -53
- package/dist/components/Daeryuntalk/HistoryView.d.ts +4 -0
- package/dist/components/Daeryuntalk/HistoryView.jsx +17 -40
- package/dist/components/Daeryuntalk/HistoryView.tsx +36 -48
- package/dist/components/Daeryuntalk/HomeView.d.ts +12 -0
- package/dist/components/Daeryuntalk/HomeView.jsx +102 -0
- package/dist/components/Daeryuntalk/HomeView.tsx +150 -0
- package/dist/components/Daeryuntalk/NavigationFooter.jsx +17 -10
- package/dist/components/Daeryuntalk/NavigationFooter.tsx +22 -12
- package/dist/components/Daeryuntalk/NoticeMessage.jsx +7 -7
- package/dist/components/Daeryuntalk/NoticeMessage.tsx +7 -7
- package/dist/components/Daeryuntalk/Toast/ToastRender.jsx +1 -1
- package/dist/components/Daeryuntalk/Toast/ToastRender.tsx +2 -2
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.d.ts +6 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.jsx +18 -90
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.tsx +49 -135
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.d.ts +16 -0
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.jsx +66 -0
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.tsx +121 -0
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.d.ts +22 -0
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.jsx +104 -0
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.tsx +195 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +4 -3
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +81 -105
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +105 -121
- package/dist/components/Daeryuntalk/_enums/ask-status.d.ts +7 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.js +14 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.ts +14 -0
- package/dist/components/Daeryuntalk/_enums/error.d.ts +3 -0
- package/dist/components/Daeryuntalk/_enums/error.js +125 -0
- package/dist/components/Daeryuntalk/_enums/error.ts +143 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.d.ts +8 -8
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +227 -179
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +261 -185
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.d.ts +1 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.js +54 -18
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.ts +68 -15
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +2 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +8 -7
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +13 -6
- package/dist/components/Daeryuntalk/_hooks/view/useChatSocketState.d.ts +2 -0
- package/dist/components/Daeryuntalk/_hooks/{talkprovider → view}/useChatSocketState.js +7 -1
- package/dist/components/Daeryuntalk/_hooks/{talkprovider → view}/useChatSocketState.ts +13 -1
- package/dist/components/Daeryuntalk/_hooks/view/useHistoryView.d.ts +26 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHistoryView.js +72 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHistoryView.ts +93 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHomeView.d.ts +16 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHomeView.js +61 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHomeView.ts +64 -0
- package/dist/components/Daeryuntalk/_lib/utils.d.ts +1 -0
- package/dist/components/Daeryuntalk/_lib/utils.js +27 -0
- package/dist/components/Daeryuntalk/_lib/utils.ts +33 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button2.jsx +3 -3
- package/dist/components/Daeryuntalk/_ui/buttons/Button2.tsx +3 -3
- package/dist/components/Daeryuntalk/_ui/buttons/Button3.d.ts +10 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button3.jsx +12 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button3.tsx +29 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input2.jsx +2 -1
- package/dist/components/Daeryuntalk/_ui/inputs/Input2.tsx +2 -1
- package/dist/components/Daeryuntalk/index.jsx +1 -1
- package/dist/components/Daeryuntalk/index.tsx +12 -1
- package/dist/components/Seo/SeoStrength.jsx +5 -2
- package/dist/components/Seo/SeoStrength.tsx +5 -2
- package/dist/styles/globals.css +518 -172
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/components/Daeryuntalk/_enums/error_code.d.ts +0 -21
- package/dist/components/Daeryuntalk/_enums/error_code.js +0 -23
- package/dist/components/Daeryuntalk/_enums/error_code.ts +0 -22
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.d.ts +0 -1
|
@@ -8,180 +8,134 @@ import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
|
8
8
|
import TimeIcon from '../../asset/images/daeryuntalk/time.svg';
|
|
9
9
|
import InfoIcon from '../../asset/images/daeryuntalk/info.svg';
|
|
10
10
|
import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
11
|
-
|
|
12
|
-
import CloseSvgIcon from '../../asset/images/daeryuntalk/close.svg';
|
|
11
|
+
|
|
13
12
|
import { IChatInquiryMainDataResponse } from './_api/daeryuntalk/type/response';
|
|
14
|
-
import { useChatSocketState } from './_hooks/
|
|
13
|
+
import { useChatSocketState } from './_hooks/view/useChatSocketState';
|
|
15
14
|
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
16
15
|
import ShadowBox from './_ui/ShadowBox';
|
|
17
16
|
import { useDaeryunTalkToast } from './Toast/DaeryuntalkToastProvider';
|
|
18
17
|
import ToastRenderer from './Toast/ToastRender';
|
|
19
18
|
import { getChatInquiryMain } from './_api';
|
|
19
|
+
import HomeView from './HomeView';
|
|
20
|
+
import { useHistoryView } from './_hooks/view/useHistoryView';
|
|
21
|
+
import { useHomeView } from './_hooks/view/useHomeView';
|
|
22
|
+
import FixedErrorBox from './FixedErrorBox';
|
|
20
23
|
|
|
21
|
-
type ViewState = 'home' | 'conversation' | 'history';
|
|
24
|
+
export type ViewState = 'home' | 'conversation' | 'history';
|
|
22
25
|
|
|
23
26
|
type ChatHomeViewProps = {
|
|
24
27
|
hashValue: string | null;
|
|
25
|
-
setHashValue: Dispatch<SetStateAction<string | null>>;
|
|
26
28
|
isMobile: boolean;
|
|
27
29
|
isHash: boolean;
|
|
30
|
+
onClose: () => void;
|
|
28
31
|
};
|
|
29
|
-
const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue,
|
|
32
|
+
const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
33
|
+
const [viewState, setViewState] = useState<ViewState>('home');
|
|
34
|
+
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
35
|
+
const { isConnected, isAuthenticated, historyList, inquiryMainData, chatInquiryNumber, startChat } =
|
|
36
|
+
useDaeryuntalk();
|
|
37
|
+
// 소켓 이벤트
|
|
38
|
+
const { sendInquiryJoined, sendHeartbeat, sendInquiryWatching, sendInquiryLeft, sendHistoryEntered } =
|
|
39
|
+
useDaeryuntalk();
|
|
40
|
+
// 홈
|
|
41
|
+
const { retryInquiryMain } = useDaeryuntalk();
|
|
42
|
+
// 히스토리
|
|
30
43
|
const {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
historyList,
|
|
34
|
-
inquiryMainData,
|
|
35
|
-
startChat,
|
|
44
|
+
startSelectedChat,
|
|
45
|
+
attendRoomByHistory,
|
|
36
46
|
createNewChat,
|
|
47
|
+
goRequestPhone,
|
|
48
|
+
goGetHistoryList,
|
|
49
|
+
goHistoryPhoneAuth
|
|
50
|
+
} = useDaeryuntalk();
|
|
51
|
+
|
|
52
|
+
// 소켓 클라 -> 서버 관리
|
|
53
|
+
useChatSocketState(
|
|
37
54
|
chatInquiryNumber,
|
|
55
|
+
viewState,
|
|
56
|
+
sendInquiryWatching,
|
|
38
57
|
sendInquiryJoined,
|
|
39
58
|
sendHeartbeat,
|
|
40
|
-
sendInquiryWatching,
|
|
41
59
|
sendInquiryLeft,
|
|
42
|
-
|
|
60
|
+
isConnected,
|
|
61
|
+
isAuthenticated,
|
|
43
62
|
sendHistoryEntered,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
retryInquiryMain
|
|
47
|
-
} = useDaeryuntalk();
|
|
63
|
+
historyList
|
|
64
|
+
);
|
|
48
65
|
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
try {
|
|
58
|
-
setIsLoading(true);
|
|
59
|
-
const res = await retryInquiryMain(mainData?.channel_number || '');
|
|
60
|
-
if (res?.result_info?.result_cd === 'OK' || res?.result_info?.result_type_cd === 'OK') {
|
|
61
|
-
// 여기서 짚어넣고 main
|
|
62
|
-
// 채팅 시작 - 새 문의 생성 또는 기존 문의 조회 처리
|
|
63
|
-
//
|
|
64
|
-
const startRes = await startChat(res?.data?.progress_inquiry_number);
|
|
65
|
-
if (startRes) {
|
|
66
|
-
// 대화 화면으로 전환
|
|
67
|
-
setViewState('conversation');
|
|
68
|
-
} else {
|
|
69
|
-
toast.error('문의 시작에 실패했습니다.');
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
toast.error('채팅문의 시작에 실패했습니다.');
|
|
73
|
-
}
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error('채팅 시작 실패:', error);
|
|
76
|
-
} finally {
|
|
77
|
-
setIsLoading(false);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
66
|
+
// 홈 뷰 훅스
|
|
67
|
+
const { handleStartChat, handleHashStartChat, handleBackToHome } = useHomeView({
|
|
68
|
+
setIsLoading,
|
|
69
|
+
setViewState,
|
|
70
|
+
retryInquiryMain,
|
|
71
|
+
inquiryMainData: inquiryMainData ?? null,
|
|
72
|
+
startChat
|
|
73
|
+
});
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
75
|
+
// 히스토리 뷰 hooks
|
|
76
|
+
const {
|
|
77
|
+
handleChatHistoryClick,
|
|
78
|
+
handleNewStartChat,
|
|
79
|
+
handleHistoryClick,
|
|
80
|
+
handleGoRequestPhone,
|
|
81
|
+
handleGoHistoryPhoneAuth
|
|
82
|
+
} = useHistoryView({
|
|
83
|
+
attendRoomByHistory,
|
|
84
|
+
startSelectedChat,
|
|
85
|
+
setViewState,
|
|
86
|
+
setIsLoading,
|
|
87
|
+
createNewChat,
|
|
88
|
+
goRequestPhone,
|
|
89
|
+
goHistoryPhoneAuth
|
|
90
|
+
});
|
|
93
91
|
|
|
94
92
|
useEffect(() => {
|
|
95
93
|
if (hashValue && isConnected && inquiryMainData && inquiryMainData.channel_number) {
|
|
96
|
-
console.log('해쉬 실행');
|
|
97
94
|
handleHashStartChat();
|
|
98
95
|
} else {
|
|
99
|
-
console.log('해쉬 실행안함');
|
|
100
96
|
}
|
|
101
97
|
}, [hashValue, isConnected, inquiryMainData]);
|
|
102
98
|
|
|
103
|
-
//
|
|
104
|
-
useEffect(() => {
|
|
105
|
-
checkScroll();
|
|
106
|
-
}, [mainData]);
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
if (inquiryMainData) {
|
|
111
|
-
setMainData(inquiryMainData);
|
|
112
|
-
}
|
|
113
|
-
}, [inquiryMainData]);
|
|
114
|
-
|
|
115
99
|
// 히스토리 진입 시
|
|
116
100
|
useEffect(() => {
|
|
117
101
|
if (isAuthenticated && viewState === 'history') {
|
|
118
102
|
goGetHistoryList({});
|
|
119
103
|
}
|
|
120
104
|
}, [viewState, isAuthenticated]);
|
|
121
|
-
// 소켓
|
|
122
|
-
useEffect(() => {
|
|
123
|
-
if (isConnected && isAuthenticated && viewState === 'history') {
|
|
124
|
-
sendHistoryEntered(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
|
|
125
|
-
}
|
|
126
|
-
}, [isConnected, isAuthenticated, historyList, viewState]);
|
|
127
|
-
|
|
128
|
-
// 채팅창관리
|
|
129
|
-
useChatSocketState(
|
|
130
|
-
chatInquiryNumber,
|
|
131
|
-
viewState,
|
|
132
|
-
sendInquiryWatching,
|
|
133
|
-
sendInquiryJoined,
|
|
134
|
-
sendHeartbeat,
|
|
135
|
-
sendInquiryLeft
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
// 히스토리에서 사용
|
|
139
|
-
const handleNewStartChat = async () => {
|
|
140
|
-
try {
|
|
141
|
-
setIsLoading(true);
|
|
142
|
-
// 채팅 시작 - 새 문의 생성 또는 기존 문의 조회 처리
|
|
143
|
-
await createNewChat();
|
|
144
|
-
// 대화 화면으로 전환
|
|
145
|
-
setViewState('conversation');
|
|
146
|
-
} catch (error) {
|
|
147
|
-
console.error('신규 채팅 실패:', error);
|
|
148
|
-
} finally {
|
|
149
|
-
setIsLoading(false);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const handleHistoryClick = async () => {
|
|
154
|
-
setViewState('history');
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const handleBackToHome = () => {
|
|
158
|
-
setViewState('home');
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const handleChatHistoryClick = async (chatNumber: string) => {
|
|
162
|
-
try {
|
|
163
|
-
setIsLoading(true);
|
|
164
|
-
const response = await attendRoomByHistory(chatNumber);
|
|
165
|
-
if (response?.result_info?.result_cd === 'OK' || response?.result_info?.result_type_cd === 'OK') {
|
|
166
|
-
await startSelectedChat(chatNumber);
|
|
167
|
-
setViewState('conversation');
|
|
168
|
-
} else {
|
|
169
|
-
toast.error('문의 참여에 실패했습니다.');
|
|
170
|
-
}
|
|
171
|
-
} catch (e) {
|
|
172
|
-
console.error('e', e);
|
|
173
|
-
} finally {
|
|
174
|
-
setIsLoading(false);
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
105
|
|
|
178
106
|
const renderWithNavigation = (content: React.ReactNode, activeView: 'home' | 'history' | 'conversation') => {
|
|
179
107
|
return (
|
|
180
108
|
<main
|
|
181
|
-
className={
|
|
109
|
+
className={`
|
|
110
|
+
relative flex justify-end
|
|
111
|
+
${isMobile ? 'h-[100dvh]' : 'h-[100dvh] xs:h-auto xs:rounded-[30px] '}
|
|
112
|
+
`}
|
|
113
|
+
// ${isMobile ? 'h-[100dvh] w-screen' : ''} relative flex items-center justify-center rounded-[30px]
|
|
182
114
|
>
|
|
183
115
|
<div
|
|
184
|
-
className={
|
|
116
|
+
className={`
|
|
117
|
+
relative overflow-hidden bg-white
|
|
118
|
+
${
|
|
119
|
+
isMobile
|
|
120
|
+
? `h-[100dvh] w-full rounded-[0px]`
|
|
121
|
+
: `
|
|
122
|
+
${
|
|
123
|
+
isHash
|
|
124
|
+
? `
|
|
125
|
+
h-[100dvh] w-full rounded-[0px]
|
|
126
|
+
xs:max-h-[690px] xs:w-[390px] xs:rounded-[30px]
|
|
127
|
+
xs:shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]
|
|
128
|
+
`
|
|
129
|
+
: `
|
|
130
|
+
h-[100dvh] w-full rounded-[0px]
|
|
131
|
+
xs:max-h-[690px] xs:w-[390px] xs:rounded-[30px]
|
|
132
|
+
`
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
`
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
`}
|
|
185
139
|
>
|
|
186
140
|
<div className="flex h-full flex-col">
|
|
187
141
|
<div className="flex-1 overflow-hidden">{content}</div>
|
|
@@ -195,7 +149,8 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
195
149
|
/>
|
|
196
150
|
</div>
|
|
197
151
|
</div>
|
|
198
|
-
|
|
152
|
+
<ToastRenderer />
|
|
153
|
+
<FixedErrorBox isError={isConnected !== null && !isConnected} />
|
|
199
154
|
</main>
|
|
200
155
|
);
|
|
201
156
|
};
|
|
@@ -208,6 +163,8 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
208
163
|
isActive={viewState === 'conversation'}
|
|
209
164
|
onChatNew={handleNewStartChat}
|
|
210
165
|
isMobile={isMobile}
|
|
166
|
+
onClose={onClose}
|
|
167
|
+
isHash={isHash}
|
|
211
168
|
/>,
|
|
212
169
|
'conversation'
|
|
213
170
|
);
|
|
@@ -223,6 +180,10 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
223
180
|
historyLit={historyList ?? []}
|
|
224
181
|
goGetHistoryList={goGetHistoryList}
|
|
225
182
|
isMobile={isMobile}
|
|
183
|
+
onClose={onClose}
|
|
184
|
+
isHash={isHash}
|
|
185
|
+
handleGoRequestPhone={handleGoRequestPhone}
|
|
186
|
+
handleGoHistoryPhoneAuth={handleGoHistoryPhoneAuth}
|
|
226
187
|
/>,
|
|
227
188
|
'history'
|
|
228
189
|
);
|
|
@@ -230,79 +191,14 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
230
191
|
|
|
231
192
|
// 홈
|
|
232
193
|
return renderWithNavigation(
|
|
233
|
-
<
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
<div className="relative z-10 flex h-full flex-col">
|
|
244
|
-
<header className="mt-2 flex items-center p-4 text-xs text-black">
|
|
245
|
-
<TimeIcon width={16} height={16} />
|
|
246
|
-
<span>24시간 운영</span>
|
|
247
|
-
</header>
|
|
248
|
-
|
|
249
|
-
<section
|
|
250
|
-
className=" mx-auto mt-[150px] flex w-[320px] flex-col gap-5 rounded-[12px] bg-white px-4 py-6 "
|
|
251
|
-
style={{
|
|
252
|
-
boxShadow: '0px 4px 10px 0px #00000026'
|
|
253
|
-
}}
|
|
254
|
-
>
|
|
255
|
-
<div className="flex items-center">
|
|
256
|
-
{mainData?.channel_logo_image_url ? (
|
|
257
|
-
<Image
|
|
258
|
-
src={mainData.channel_logo_image_url}
|
|
259
|
-
alt="로고"
|
|
260
|
-
width={24}
|
|
261
|
-
height={24}
|
|
262
|
-
className="mr-2"
|
|
263
|
-
/>
|
|
264
|
-
) : (
|
|
265
|
-
<DaeryunLogoIcon width={24} height={24} className="mr-2" />
|
|
266
|
-
)}
|
|
267
|
-
<h1 className="font-medium">{mainData?.channel_name || '법무법인(유한)대륜'}</h1>
|
|
268
|
-
</div>
|
|
269
|
-
|
|
270
|
-
<div className={`relative`}>
|
|
271
|
-
<div
|
|
272
|
-
ref={containerRef}
|
|
273
|
-
className="no-scrollbar relative mx-8 max-h-[162px] overflow-auto whitespace-pre-line text-sm font-normal leading-[130%]"
|
|
274
|
-
>
|
|
275
|
-
{mainData?.salutation ||
|
|
276
|
-
`안녕하세요.
|
|
277
|
-
법무법인(유한)대륜입니다.
|
|
278
|
-
방문해 주셔서 감사합니다.
|
|
279
|
-
궁금한 점이나 도움이 필요하신 부분
|
|
280
|
-
말씀해 주시면 도와드리겠습니다.
|
|
281
|
-
|
|
282
|
-
6:00~24:00 외 시간에는 상담인력의 편성에 따라 순차적으로 응대를 도와드리고 있습니다.`}
|
|
283
|
-
</div>
|
|
284
|
-
{!isScroll && !isBottom && <ShadowBox />}
|
|
285
|
-
</div>
|
|
286
|
-
|
|
287
|
-
<button
|
|
288
|
-
className="mt-4 flex h-[48px] w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white"
|
|
289
|
-
aria-label={`문의하기`}
|
|
290
|
-
onClick={handleStartChat}
|
|
291
|
-
disabled={isLoading}
|
|
292
|
-
>
|
|
293
|
-
{isLoading ? '로딩 중...' : '문의하기'}
|
|
294
|
-
{!isLoading && <SendIcon width={24} height={24} />}
|
|
295
|
-
</button>
|
|
296
|
-
|
|
297
|
-
<div className="flex items-center justify-center gap-1">
|
|
298
|
-
<InfoIcon width={20} height={20} />
|
|
299
|
-
<span className="text-xs font-normal text-gray-500">
|
|
300
|
-
{mainData?.answer_speed_message || '빠르게 답변 받으실 수 있어요'}
|
|
301
|
-
</span>
|
|
302
|
-
</div>
|
|
303
|
-
</section>
|
|
304
|
-
</div>
|
|
305
|
-
</div>,
|
|
194
|
+
<HomeView
|
|
195
|
+
inquiryMainData={inquiryMainData ?? null}
|
|
196
|
+
isLoading={isLoading}
|
|
197
|
+
handleStartChat={handleStartChat}
|
|
198
|
+
isMobile={isMobile}
|
|
199
|
+
onClose={onClose}
|
|
200
|
+
isHash={isHash}
|
|
201
|
+
/>,
|
|
306
202
|
'home'
|
|
307
203
|
);
|
|
308
204
|
};
|
|
@@ -13,6 +13,7 @@ import { formatFileSize } from '../_lib/utils';
|
|
|
13
13
|
import FileDownLoadIcon from '../../../asset/images/daeryuntalk/viewer/gray-download.svg';
|
|
14
14
|
import { useDaeryuntalk } from '../DaeryuntalkContext';
|
|
15
15
|
import { getMessageFileDownloadUrl } from '../_api';
|
|
16
|
+
import TimeWrapper from './TimeWrapper';
|
|
16
17
|
const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
17
18
|
const { openImageViewer } = useDaeryuntalk();
|
|
18
19
|
const handleDownload = (file) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -45,24 +46,24 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
|
45
46
|
const files = message.files
|
|
46
47
|
? message.files.filter(file => file.type !== 'image').sort((a, b) => a.sequence - b.sequence)
|
|
47
48
|
: [];
|
|
48
|
-
return (<div className={`flex flex-col gap-
|
|
49
|
+
return (<div className={`flex flex-col gap-[10px]`}>
|
|
49
50
|
{images.length > 0 && renderMedia({ type: 'image', images })}
|
|
50
51
|
{files.length > 0 && renderMedia({ type: 'file', files })}
|
|
51
52
|
</div>);
|
|
52
53
|
};
|
|
53
54
|
const renderMedia = (media) => {
|
|
54
55
|
if (media.type === 'image') {
|
|
55
|
-
return (<
|
|
56
|
+
return (<TimeWrapper time={time}>
|
|
56
57
|
{media.images.length > 1 ? (<div className={`flex flex-col`}>
|
|
57
58
|
{/* grid로 감싸진 짝수 개수 또는 홀수에서 마지막 전까지 */}
|
|
58
|
-
<div className="group grid grid-cols-2 gap-
|
|
59
|
+
<div className="group grid grid-cols-2 gap-[8px] rounded-[10px] border-[1px] border-drTalkGrayscale4 p-[8px]">
|
|
59
60
|
{media.images.map((file, index) => {
|
|
60
61
|
const isLastOdd = media.images.length % 2 === 1 && index === media.images.length - 1;
|
|
61
62
|
if (isLastOdd)
|
|
62
63
|
return null;
|
|
63
64
|
return (<div key={index} className="group/image relative aspect-square h-[100px] w-[113px] overflow-hidden rounded-[5px]" onClick={() => {
|
|
64
65
|
if (media.type === 'image') {
|
|
65
|
-
openImageViewer === null || openImageViewer === void 0 ? void 0 : openImageViewer(media.images[
|
|
66
|
+
openImageViewer === null || openImageViewer === void 0 ? void 0 : openImageViewer(media.images[index], message);
|
|
66
67
|
}
|
|
67
68
|
}}>
|
|
68
69
|
<Image src={file.thumbnailUrl} alt={file.name} width={113} height={100} className="h-full w-full cursor-pointer rounded-md object-cover" onClick={() => { }}/>
|
|
@@ -70,7 +71,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
|
70
71
|
e.stopPropagation();
|
|
71
72
|
yield handleDownload(file);
|
|
72
73
|
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100">
|
|
73
|
-
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-
|
|
74
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-drTalkWhite"/>
|
|
74
75
|
</button>
|
|
75
76
|
</div>);
|
|
76
77
|
})}
|
|
@@ -90,7 +91,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
|
90
91
|
yield handleDownload(media.images[media.images.length - 1]);
|
|
91
92
|
}
|
|
92
93
|
})} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100">
|
|
93
|
-
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full text-
|
|
94
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full text-drTalkGrayscale2 "/>
|
|
94
95
|
</button>
|
|
95
96
|
</div>
|
|
96
97
|
</div>)}
|
|
@@ -113,24 +114,25 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
|
113
114
|
</button>
|
|
114
115
|
</div>
|
|
115
116
|
</div>)}
|
|
116
|
-
|
|
117
|
-
</div>);
|
|
117
|
+
</TimeWrapper>);
|
|
118
118
|
}
|
|
119
119
|
else if (media.type === 'file') {
|
|
120
|
-
return (<
|
|
120
|
+
return (<TimeWrapper time={time} className={`w-fit`}>
|
|
121
121
|
<div className="flex w-full flex-col gap-[10px] ">
|
|
122
122
|
{media.files.map((file, index) => {
|
|
123
123
|
const fileExtension = file.name.split('.').pop() || '';
|
|
124
124
|
const baseName = file.name.replace(`.${fileExtension}`, '');
|
|
125
125
|
const truncatedName = baseName.length > 12 ? `${baseName.slice(0, 12)}…` : baseName;
|
|
126
126
|
const fileName = `${truncatedName}.${fileExtension}`;
|
|
127
|
-
return (<div key={index} className={` group
|
|
127
|
+
return (<div key={index} className={` group flex w-full items-end justify-start gap-[4px]`}>
|
|
128
128
|
<div key={index} className={`
|
|
129
129
|
relative flex items-center justify-between
|
|
130
130
|
gap-[16px] rounded-[10px] border-[1px] border-[#EDEDED] p-[12px]
|
|
131
131
|
`}>
|
|
132
132
|
<div className="flex flex-col gap-[4px] ">
|
|
133
|
-
<span className={`
|
|
133
|
+
<span className={`dr_talk_body_medium2 line-clamp-1 text-drTalkBlack`}>
|
|
134
|
+
{fileName}
|
|
135
|
+
</span>
|
|
134
136
|
<span className="flex items-center gap-[10px] text-[12px] text-[#777777]">
|
|
135
137
|
{formatFileSize(file.size)} | {file.name.split('.').pop()}
|
|
136
138
|
</span>
|
|
@@ -138,15 +140,14 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
|
138
140
|
<button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
139
141
|
e.stopPropagation();
|
|
140
142
|
yield handleDownload(file);
|
|
141
|
-
})} className="
|
|
143
|
+
})} className="flex h-[24px] w-[24px] items-center justify-center rounded-full">
|
|
142
144
|
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white"/>
|
|
143
145
|
</button>
|
|
144
146
|
</div>
|
|
145
147
|
</div>);
|
|
146
148
|
})}
|
|
147
149
|
</div>
|
|
148
|
-
|
|
149
|
-
</div>);
|
|
150
|
+
</TimeWrapper>);
|
|
150
151
|
}
|
|
151
152
|
return null;
|
|
152
153
|
};
|
|
@@ -5,6 +5,7 @@ import { formatFileSize } from '../_lib/utils';
|
|
|
5
5
|
import FileDownLoadIcon from '../../../asset/images/daeryuntalk/viewer/gray-download.svg';
|
|
6
6
|
import { useDaeryuntalk } from '../DaeryuntalkContext';
|
|
7
7
|
import { getMessageFileDownloadUrl } from '../_api';
|
|
8
|
+
import TimeWrapper from './TimeWrapper';
|
|
8
9
|
interface props {
|
|
9
10
|
message: Message;
|
|
10
11
|
isOperator: boolean;
|
|
@@ -48,7 +49,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
48
49
|
: [];
|
|
49
50
|
|
|
50
51
|
return (
|
|
51
|
-
<div className={`flex flex-col gap-
|
|
52
|
+
<div className={`flex flex-col gap-[10px]`}>
|
|
52
53
|
{images.length > 0 && renderMedia({ type: 'image', images })}
|
|
53
54
|
{files.length > 0 && renderMedia({ type: 'file', files })}
|
|
54
55
|
</div>
|
|
@@ -58,11 +59,11 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
58
59
|
const renderMedia = (media: { type: 'image'; images: FileInfo[] } | { type: 'file'; files: FileInfo[] }) => {
|
|
59
60
|
if (media.type === 'image') {
|
|
60
61
|
return (
|
|
61
|
-
<
|
|
62
|
+
<TimeWrapper time={time}>
|
|
62
63
|
{media.images.length > 1 ? (
|
|
63
64
|
<div className={`flex flex-col`}>
|
|
64
65
|
{/* grid로 감싸진 짝수 개수 또는 홀수에서 마지막 전까지 */}
|
|
65
|
-
<div className="group grid grid-cols-2 gap-
|
|
66
|
+
<div className="group grid grid-cols-2 gap-[8px] rounded-[10px] border-[1px] border-drTalkGrayscale4 p-[8px]">
|
|
66
67
|
{media.images.map((file, index) => {
|
|
67
68
|
const isLastOdd =
|
|
68
69
|
media.images.length % 2 === 1 && index === media.images.length - 1;
|
|
@@ -74,7 +75,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
74
75
|
className="group/image relative aspect-square h-[100px] w-[113px] overflow-hidden rounded-[5px]"
|
|
75
76
|
onClick={() => {
|
|
76
77
|
if (media.type === 'image') {
|
|
77
|
-
openImageViewer?.(media.images[
|
|
78
|
+
openImageViewer?.(media.images[index], message);
|
|
78
79
|
}
|
|
79
80
|
}}
|
|
80
81
|
>
|
|
@@ -93,7 +94,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
93
94
|
}}
|
|
94
95
|
className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100"
|
|
95
96
|
>
|
|
96
|
-
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-
|
|
97
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-drTalkWhite" />
|
|
97
98
|
</button>
|
|
98
99
|
</div>
|
|
99
100
|
);
|
|
@@ -128,7 +129,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
128
129
|
}}
|
|
129
130
|
className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100"
|
|
130
131
|
>
|
|
131
|
-
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full text-
|
|
132
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full text-drTalkGrayscale2 " />
|
|
132
133
|
</button>
|
|
133
134
|
</div>
|
|
134
135
|
</div>
|
|
@@ -167,12 +168,11 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
167
168
|
</div>
|
|
168
169
|
</div>
|
|
169
170
|
)}
|
|
170
|
-
|
|
171
|
-
</div>
|
|
171
|
+
</TimeWrapper>
|
|
172
172
|
);
|
|
173
173
|
} else if (media.type === 'file') {
|
|
174
174
|
return (
|
|
175
|
-
<
|
|
175
|
+
<TimeWrapper time={time} className={`w-fit`}>
|
|
176
176
|
<div className="flex w-full flex-col gap-[10px] ">
|
|
177
177
|
{media.files.map((file, index) => {
|
|
178
178
|
const fileExtension = file.name.split('.').pop() || '';
|
|
@@ -183,7 +183,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
183
183
|
const fileName = `${truncatedName}.${fileExtension}`;
|
|
184
184
|
|
|
185
185
|
return (
|
|
186
|
-
<div key={index} className={` group
|
|
186
|
+
<div key={index} className={` group flex w-full items-end justify-start gap-[4px]`}>
|
|
187
187
|
<div
|
|
188
188
|
key={index}
|
|
189
189
|
className={`
|
|
@@ -192,7 +192,9 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
192
192
|
`}
|
|
193
193
|
>
|
|
194
194
|
<div className="flex flex-col gap-[4px] ">
|
|
195
|
-
<span className={`
|
|
195
|
+
<span className={`dr_talk_body_medium2 line-clamp-1 text-drTalkBlack`}>
|
|
196
|
+
{fileName}
|
|
197
|
+
</span>
|
|
196
198
|
<span className="flex items-center gap-[10px] text-[12px] text-[#777777]">
|
|
197
199
|
{formatFileSize(file.size)} | {file.name.split('.').pop()}
|
|
198
200
|
</span>
|
|
@@ -202,7 +204,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
202
204
|
e.stopPropagation();
|
|
203
205
|
await handleDownload(file);
|
|
204
206
|
}}
|
|
205
|
-
className="
|
|
207
|
+
className="flex h-[24px] w-[24px] items-center justify-center rounded-full"
|
|
206
208
|
>
|
|
207
209
|
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />
|
|
208
210
|
</button>
|
|
@@ -211,8 +213,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
211
213
|
);
|
|
212
214
|
})}
|
|
213
215
|
</div>
|
|
214
|
-
|
|
215
|
-
</div>
|
|
216
|
+
</TimeWrapper>
|
|
216
217
|
);
|
|
217
218
|
}
|
|
218
219
|
return null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
const ChatLoading = () => {
|
|
3
|
+
return (<div className="flex justify-start pl-8">
|
|
4
|
+
<div className="flex h-8 animate-pulse space-x-2 rounded-full ">
|
|
5
|
+
<div className="h-[8px] w-[8px] animate-bounce rounded-full bg-[#777777] "></div>
|
|
6
|
+
<div className="h-[8px] w-[8px] animate-bounce rounded-full bg-[#C2C2C2]" style={{ animationDelay: '0.2s' }}></div>
|
|
7
|
+
<div className="h-[8px] w-[8px] animate-bounce rounded-full bg-[#C2C2C2]" style={{ animationDelay: '0.4s' }}></div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>);
|
|
10
|
+
};
|
|
11
|
+
export default ChatLoading;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const ChatLoading = () => {
|
|
4
|
+
return (
|
|
5
|
+
<div className="flex justify-start pl-8">
|
|
6
|
+
<div className="flex h-8 animate-pulse space-x-2 rounded-full ">
|
|
7
|
+
<div className="h-[8px] w-[8px] animate-bounce rounded-full bg-[#777777] "></div>
|
|
8
|
+
<div
|
|
9
|
+
className="h-[8px] w-[8px] animate-bounce rounded-full bg-[#C2C2C2]"
|
|
10
|
+
style={{ animationDelay: '0.2s' }}
|
|
11
|
+
></div>
|
|
12
|
+
<div
|
|
13
|
+
className="h-[8px] w-[8px] animate-bounce rounded-full bg-[#C2C2C2]"
|
|
14
|
+
style={{ animationDelay: '0.4s' }}
|
|
15
|
+
></div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default ChatLoading;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
const ChatWrapper = ({ isOperator, children, className = '' }) => {
|
|
3
|
-
const operatorClassName = 'border-
|
|
4
|
-
const customerClassName = 'border-
|
|
3
|
+
const operatorClassName = 'border-drTalkGrayscale4 text-drTalkBlack';
|
|
4
|
+
const customerClassName = 'border-drTalkBtnActive2 text-drTalkHover bg-drTalkGrayscale5';
|
|
5
5
|
return (<div className={`
|
|
6
6
|
${isOperator ? operatorClassName : customerClassName} ${className}
|
|
7
|
-
whitespace-pre-line rounded-[10px]
|
|
8
|
-
|
|
7
|
+
dr_talk_body_medium2 whitespace-pre-line break-words rounded-[10px]
|
|
8
|
+
border px-[12px] py-[8px]
|
|
9
9
|
`}>
|
|
10
10
|
{children}
|
|
11
11
|
</div>);
|