@daeryun/dr_components 0.8.80 → 0.8.83
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 +23 -15
- package/dist/components/Daeryuntalk/ChatConversation.tsx +47 -36
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +15 -5
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +24 -11
- package/dist/components/Daeryuntalk/ChatInput.jsx +15 -4
- package/dist/components/Daeryuntalk/ChatInput.tsx +17 -5
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +1 -1
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.d.ts +3 -1
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +164 -3
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +197 -4
- package/dist/components/Daeryuntalk/ChatMessage.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatMessage.jsx +31 -29
- package/dist/components/Daeryuntalk/ChatMessage.tsx +54 -50
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.jsx +4 -2
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.tsx +6 -4
- package/dist/components/Daeryuntalk/ChatWidget.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatWidget.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatWidget.tsx +10 -2
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +1 -0
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +5 -3
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +7 -3
- package/dist/components/Daeryuntalk/HomeView.jsx +4 -9
- package/dist/components/Daeryuntalk/HomeView.tsx +9 -9
- package/dist/components/Daeryuntalk/NavigationFooter.jsx +1 -1
- package/dist/components/Daeryuntalk/NavigationFooter.tsx +1 -1
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.d.ts +2 -1
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +38 -5
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +48 -9
- package/dist/components/Daeryuntalk/Toast/DaeryuntalkToastProvider.d.ts +2 -1
- package/dist/components/Daeryuntalk/Toast/DaeryuntalkToastProvider.jsx +18 -7
- package/dist/components/Daeryuntalk/Toast/DaeryuntalkToastProvider.tsx +24 -8
- package/dist/components/Daeryuntalk/Toast/ToastRender.jsx +9 -3
- package/dist/components/Daeryuntalk/Toast/ToastRender.tsx +10 -6
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.jsx +6 -8
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.tsx +7 -10
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.d.ts +2 -0
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.jsx +52 -19
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.tsx +89 -43
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.d.ts +2 -0
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.jsx +35 -5
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.tsx +57 -21
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +1 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +14 -12
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +9 -8
- package/dist/components/Daeryuntalk/_enums/ask-status.d.ts +2 -2
- package/dist/components/Daeryuntalk/_enums/ask-status.js +9 -9
- package/dist/components/Daeryuntalk/_enums/ask-status.ts +5 -5
- package/dist/components/Daeryuntalk/_enums/error.js +119 -111
- package/dist/components/Daeryuntalk/_enums/error.ts +135 -127
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +10 -4
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +12 -4
- package/dist/components/Daeryuntalk/_hooks/view/useHomeView.js +1 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHomeView.ts +1 -0
- package/dist/components/Daeryuntalk/_lib/utils.d.ts +2 -0
- package/dist/components/Daeryuntalk/_lib/utils.js +12 -0
- package/dist/components/Daeryuntalk/_lib/utils.ts +15 -0
- package/dist/components/Daeryuntalk/index.jsx +34 -5
- package/dist/components/Daeryuntalk/index.tsx +37 -6
- package/dist/styles/globals.css +30 -24
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import ChatMessage from './ChatMessage';
|
|
4
4
|
import ChatInput from './ChatInput';
|
|
5
5
|
import NoticeMessage from './NoticeMessage';
|
|
6
6
|
import DateSeparator from './DateSeparator';
|
|
7
|
-
import {
|
|
7
|
+
import { InquiryStatusEnum } from './_enums/ask-status';
|
|
8
8
|
import Button3 from './_ui/buttons/Button3';
|
|
9
9
|
import ChatConversationHeader from './ChatConversationItem/ChatConversationHeader';
|
|
10
10
|
import ChatLoading from './ChatItem/ChatLoading';
|
|
@@ -69,24 +69,32 @@ const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose,
|
|
|
69
69
|
date1.getMonth() !== date2.getMonth() ||
|
|
70
70
|
date1.getDate() !== date2.getDate());
|
|
71
71
|
};
|
|
72
|
-
const
|
|
72
|
+
const renderedMessages = useMemo(() => {
|
|
73
73
|
const elements = [];
|
|
74
|
-
messages
|
|
75
|
-
|
|
76
|
-
.forEach((message, index) => {
|
|
77
|
-
// 오브젝트 워크플로우 있는경우는 넣어주기
|
|
74
|
+
const sortedMessages = [...messages].sort((a, b) => a.timestamp - b.timestamp);
|
|
75
|
+
sortedMessages.forEach((message, index) => {
|
|
78
76
|
const findObject = message.workFlow &&
|
|
79
77
|
(messageObject === null || messageObject === void 0 ? void 0 : messageObject.exposeObjectListYn) &&
|
|
80
78
|
(messageObject === null || messageObject === void 0 ? void 0 : messageObject.messageNumber) === message.messageNumber
|
|
81
79
|
? messageObject
|
|
82
80
|
: null;
|
|
83
|
-
if (index === 0 || isNewDay(message.createdAt,
|
|
81
|
+
if (index === 0 || isNewDay(message.createdAt, sortedMessages[index - 1].createdAt)) {
|
|
84
82
|
elements.push(<DateSeparator key={`date-${message.messageNumber}`} date={message.createdAt}/>);
|
|
85
83
|
}
|
|
86
|
-
elements.push(<ChatMessage inquiryStatus={inquiryStatus} key={message.messageNumber} message={message} object={findObject} handelObjectBack={workFlowBack} chatInquiryNumber={chatInquiryNumber || ''} workFlowStack={workFlowStack} isHovered={isHovered} scrollEnd={scrollEnd}/>);
|
|
84
|
+
elements.push(<ChatMessage isMobile={isMobile} inquiryStatus={inquiryStatus} key={message.messageNumber} message={message} object={findObject} handelObjectBack={workFlowBack} chatInquiryNumber={chatInquiryNumber || ''} workFlowStack={workFlowStack} isHovered={isHovered} scrollEnd={scrollEnd}/>);
|
|
87
85
|
});
|
|
88
86
|
return elements;
|
|
89
|
-
}
|
|
87
|
+
}, [
|
|
88
|
+
messages,
|
|
89
|
+
messageObject, // 둘 다 바뀌면 리렌더됨
|
|
90
|
+
isMobile,
|
|
91
|
+
inquiryStatus,
|
|
92
|
+
workFlowBack,
|
|
93
|
+
chatInquiryNumber,
|
|
94
|
+
workFlowStack,
|
|
95
|
+
isHovered,
|
|
96
|
+
scrollEnd
|
|
97
|
+
]);
|
|
90
98
|
return (<>
|
|
91
99
|
{/*isMoblie true일때 헤더 주의 내용이 상단에 있고 ,나머지 높이영역은 메시지 리스트로 붙게*/}
|
|
92
100
|
<div className={` no-scrollbar flex h-[100dvh] flex-col items-center justify-between xs:h-[calc(100vh-165px)] xs:max-h-[690px] lg:h-[calc(100vh-110px)] `}>
|
|
@@ -104,7 +112,7 @@ const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose,
|
|
|
104
112
|
{/* 메시지 노출 부분 -> 무한스크롤 변환 필요 */}
|
|
105
113
|
{/* 여기서 isMpblie일때 위에 2개 헤더부분이랑 아래 메시지 입력이랑 높이를 빼서 넣어야한ㄷ */}
|
|
106
114
|
<div className={`
|
|
107
|
-
${isMobile ? ' ' : 'flex- xs:pb-[100px]'} no-scrollbar mx-[20px] overflow-auto pt-[20px]
|
|
115
|
+
${isMobile ? `${isLoading ? ' pb-[50px]' : ''} ` : 'flex- xs:pb-[100px]'} no-scrollbar mx-[20px] overflow-auto pt-[20px]
|
|
108
116
|
`} style={{
|
|
109
117
|
height: isMobile
|
|
110
118
|
? `calc(100vh - ${bottomHeight}px - ${((_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0}px)`
|
|
@@ -116,8 +124,8 @@ const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose,
|
|
|
116
124
|
<p>문의하실 내용을 입력해 주세요.</p>
|
|
117
125
|
<p className="mt-2 text-sm">24시간 운영하고 있습니다.</p>
|
|
118
126
|
</div>) : (<div className={``} onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
|
|
119
|
-
{
|
|
120
|
-
{inquiryStatus ===
|
|
127
|
+
{renderedMessages}
|
|
128
|
+
{inquiryStatus === InquiryStatusEnum.CLOSED && (<div className={` dr_talk_body_medium2 text-center text-drTalkGrayscale1 `}>
|
|
121
129
|
문의가 종료되었습니다.
|
|
122
130
|
</div>)}
|
|
123
131
|
{isLoading && <ChatLoading />}
|
|
@@ -125,9 +133,9 @@ const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile, onClose,
|
|
|
125
133
|
</div>)}
|
|
126
134
|
</div>
|
|
127
135
|
|
|
128
|
-
<div ref={pcBottomRef} className={
|
|
136
|
+
<div ref={pcBottomRef} className={`!z-[50] w-full`}>
|
|
129
137
|
{/* 높이가 부모에 스크롤이 줄어도 해당 부분은 바텀에 고정 필요 */}
|
|
130
|
-
{inquiryStatus ===
|
|
138
|
+
{inquiryStatus === InquiryStatusEnum.CLOSED ? (<div className="w-full border-t border-drTalkGrayscale4 px-[20px] py-[16px]">
|
|
131
139
|
<div className="">
|
|
132
140
|
<Button3 onClick={() => {
|
|
133
141
|
onChatNew && onChatNew();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import ChatMessage from './ChatMessage';
|
|
4
4
|
import ChatInput from './ChatInput';
|
|
5
5
|
import NoticeMessage from './NoticeMessage';
|
|
6
6
|
import DateSeparator from './DateSeparator';
|
|
7
|
-
import {
|
|
7
|
+
import { InquiryStatusEnum } from './_enums/ask-status';
|
|
8
8
|
import Button3 from './_ui/buttons/Button3';
|
|
9
9
|
import ChatConversationHeader from './ChatConversationItem/ChatConversationHeader';
|
|
10
10
|
import ChatLoading from './ChatItem/ChatLoading';
|
|
@@ -108,40 +108,51 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
108
108
|
);
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
const
|
|
111
|
+
const renderedMessages = useMemo(() => {
|
|
112
112
|
const elements: React.ReactNode[] = [];
|
|
113
113
|
|
|
114
|
-
messages
|
|
115
|
-
.sort((a, b) => a.timestamp - b.timestamp)
|
|
116
|
-
.forEach((message, index) => {
|
|
117
|
-
// 오브젝트 워크플로우 있는경우는 넣어주기
|
|
118
|
-
const findObject =
|
|
119
|
-
message.workFlow &&
|
|
120
|
-
messageObject?.exposeObjectListYn &&
|
|
121
|
-
messageObject?.messageNumber === message.messageNumber
|
|
122
|
-
? messageObject
|
|
123
|
-
: null;
|
|
114
|
+
const sortedMessages = [...messages].sort((a, b) => a.timestamp - b.timestamp);
|
|
124
115
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
116
|
+
sortedMessages.forEach((message, index) => {
|
|
117
|
+
const findObject =
|
|
118
|
+
message.workFlow &&
|
|
119
|
+
messageObject?.exposeObjectListYn &&
|
|
120
|
+
messageObject?.messageNumber === message.messageNumber
|
|
121
|
+
? messageObject
|
|
122
|
+
: null;
|
|
123
|
+
|
|
124
|
+
if (index === 0 || isNewDay(message.createdAt, sortedMessages[index - 1].createdAt)) {
|
|
125
|
+
elements.push(<DateSeparator key={`date-${message.messageNumber}`} date={message.createdAt} />);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
elements.push(
|
|
129
|
+
<ChatMessage
|
|
130
|
+
isMobile={isMobile}
|
|
131
|
+
inquiryStatus={inquiryStatus}
|
|
132
|
+
key={message.messageNumber}
|
|
133
|
+
message={message}
|
|
134
|
+
object={findObject}
|
|
135
|
+
handelObjectBack={workFlowBack}
|
|
136
|
+
chatInquiryNumber={chatInquiryNumber || ''}
|
|
137
|
+
workFlowStack={workFlowStack}
|
|
138
|
+
isHovered={isHovered}
|
|
139
|
+
scrollEnd={scrollEnd}
|
|
140
|
+
/>
|
|
141
|
+
);
|
|
142
|
+
});
|
|
142
143
|
|
|
143
144
|
return elements;
|
|
144
|
-
}
|
|
145
|
+
}, [
|
|
146
|
+
messages,
|
|
147
|
+
messageObject, // 둘 다 바뀌면 리렌더됨
|
|
148
|
+
isMobile,
|
|
149
|
+
inquiryStatus,
|
|
150
|
+
workFlowBack,
|
|
151
|
+
chatInquiryNumber,
|
|
152
|
+
workFlowStack,
|
|
153
|
+
isHovered,
|
|
154
|
+
scrollEnd
|
|
155
|
+
]);
|
|
145
156
|
|
|
146
157
|
return (
|
|
147
158
|
<>
|
|
@@ -172,7 +183,7 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
172
183
|
{/* 여기서 isMpblie일때 위에 2개 헤더부분이랑 아래 메시지 입력이랑 높이를 빼서 넣어야한ㄷ */}
|
|
173
184
|
<div
|
|
174
185
|
className={`
|
|
175
|
-
${isMobile ? ' ' : 'flex- xs:pb-[100px]'} no-scrollbar mx-[20px] overflow-auto pt-[20px]
|
|
186
|
+
${isMobile ? `${isLoading ? ' pb-[50px]' : ''} ` : 'flex- xs:pb-[100px]'} no-scrollbar mx-[20px] overflow-auto pt-[20px]
|
|
176
187
|
`}
|
|
177
188
|
style={{
|
|
178
189
|
height: isMobile
|
|
@@ -193,8 +204,8 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
193
204
|
onMouseEnter={() => setIsHovered(true)}
|
|
194
205
|
onMouseLeave={() => setIsHovered(false)}
|
|
195
206
|
>
|
|
196
|
-
{
|
|
197
|
-
{inquiryStatus ===
|
|
207
|
+
{renderedMessages}
|
|
208
|
+
{inquiryStatus === InquiryStatusEnum.CLOSED && (
|
|
198
209
|
<div className={` dr_talk_body_medium2 text-center text-drTalkGrayscale1 `}>
|
|
199
210
|
문의가 종료되었습니다.
|
|
200
211
|
</div>
|
|
@@ -205,9 +216,9 @@ const ChatConversation: React.FC<ChatConversationProps> = ({
|
|
|
205
216
|
)}
|
|
206
217
|
</div>
|
|
207
218
|
|
|
208
|
-
<div ref={pcBottomRef} className={
|
|
219
|
+
<div ref={pcBottomRef} className={`!z-[50] w-full`}>
|
|
209
220
|
{/* 높이가 부모에 스크롤이 줄어도 해당 부분은 바텀에 고정 필요 */}
|
|
210
|
-
{inquiryStatus ===
|
|
221
|
+
{inquiryStatus === InquiryStatusEnum.CLOSED ? (
|
|
211
222
|
<div className="w-full border-t border-drTalkGrayscale4 px-[20px] py-[16px]">
|
|
212
223
|
<div className="">
|
|
213
224
|
<Button3
|
|
@@ -12,7 +12,7 @@ import FixedErrorBox from './FixedErrorBox';
|
|
|
12
12
|
const ChatHomeView = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
13
13
|
const [viewState, setViewState] = useState(hashValue ? 'conversation' : 'home');
|
|
14
14
|
const [isLoading, setIsLoading] = useState(false);
|
|
15
|
-
const { isConnected, isAuthenticated, historyList, inquiryMainData, chatInquiryNumber, startChat } = useDaeryuntalk();
|
|
15
|
+
const { isConnected, isAuthenticated, historyList, inquiryMainData, chatInquiryNumber, startChat, retryInitData } = useDaeryuntalk();
|
|
16
16
|
// 소켓 이벤트
|
|
17
17
|
const { sendInquiryJoined, sendHeartbeat, sendInquiryWatching, sendInquiryLeft, sendHistoryEntered } = useDaeryuntalk();
|
|
18
18
|
// 홈
|
|
@@ -52,6 +52,13 @@ const ChatHomeView = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
|
52
52
|
goGetHistoryList({});
|
|
53
53
|
}
|
|
54
54
|
}, [viewState, isAuthenticated]);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (inquiryMainData !== null) {
|
|
57
|
+
if (!(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_number)) {
|
|
58
|
+
retryInitData();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, [inquiryMainData]);
|
|
55
62
|
const renderWithNavigation = (content, activeView) => {
|
|
56
63
|
return (
|
|
57
64
|
//
|
|
@@ -62,7 +69,8 @@ const ChatHomeView = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
|
62
69
|
boxShadow: '0px 0px 20px 0px #00000040'
|
|
63
70
|
}}>
|
|
64
71
|
<div className={`
|
|
65
|
-
relative overflow-hidden
|
|
72
|
+
relative overflow-hidden
|
|
73
|
+
bg-white
|
|
66
74
|
${isMobile
|
|
67
75
|
? `h-[100dvh] w-screen rounded-[0px]`
|
|
68
76
|
: `
|
|
@@ -80,14 +88,16 @@ const ChatHomeView = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
|
80
88
|
`}
|
|
81
89
|
|
|
82
90
|
`}>
|
|
83
|
-
<div className="flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]">
|
|
91
|
+
<div className=" flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]">
|
|
84
92
|
<div className={`
|
|
85
93
|
no-scrollbar ${isMobile ? '' : ` overflow-hidden xs:overflow-auto ${viewState === 'conversation' ? ' ' : ' '} `}
|
|
86
94
|
`}>
|
|
87
95
|
{content}
|
|
88
96
|
</div>
|
|
89
|
-
{
|
|
90
|
-
|
|
97
|
+
<div className={`!z-[50]`}>
|
|
98
|
+
{/* 얘는 아래 64px로 고정 */}
|
|
99
|
+
<NavigationFooter activeView={activeView} onHomeClick={handleBackToHome} onHistoryClick={handleHistoryClick} historyList={historyList} isAuthenticated={isAuthenticated}/>
|
|
100
|
+
</div>
|
|
91
101
|
</div>
|
|
92
102
|
</div>
|
|
93
103
|
{/*얘는 abolute라서 고려 X*/}
|
|
@@ -32,8 +32,10 @@ type ChatHomeViewProps = {
|
|
|
32
32
|
const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobile, isHash }) => {
|
|
33
33
|
const [viewState, setViewState] = useState<ViewState>(hashValue ? 'conversation' : 'home');
|
|
34
34
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
const { isConnected, isAuthenticated, historyList, inquiryMainData, chatInquiryNumber, startChat, retryInitData } =
|
|
36
37
|
useDaeryuntalk();
|
|
38
|
+
|
|
37
39
|
// 소켓 이벤트
|
|
38
40
|
const { sendInquiryJoined, sendHeartbeat, sendInquiryWatching, sendInquiryLeft, sendHistoryEntered } =
|
|
39
41
|
useDaeryuntalk();
|
|
@@ -103,6 +105,14 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
103
105
|
}
|
|
104
106
|
}, [viewState, isAuthenticated]);
|
|
105
107
|
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (inquiryMainData !== null) {
|
|
110
|
+
if (!inquiryMainData?.channel_number) {
|
|
111
|
+
retryInitData();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, [inquiryMainData]);
|
|
115
|
+
|
|
106
116
|
const renderWithNavigation = (content: React.ReactNode, activeView: 'home' | 'history' | 'conversation') => {
|
|
107
117
|
return (
|
|
108
118
|
//
|
|
@@ -117,7 +127,8 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
117
127
|
>
|
|
118
128
|
<div
|
|
119
129
|
className={`
|
|
120
|
-
relative overflow-hidden
|
|
130
|
+
relative overflow-hidden
|
|
131
|
+
bg-white
|
|
121
132
|
${
|
|
122
133
|
isMobile
|
|
123
134
|
? `h-[100dvh] w-screen rounded-[0px]`
|
|
@@ -140,7 +151,7 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
140
151
|
|
|
141
152
|
`}
|
|
142
153
|
>
|
|
143
|
-
<div className="flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]">
|
|
154
|
+
<div className=" flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]">
|
|
144
155
|
<div
|
|
145
156
|
className={`
|
|
146
157
|
no-scrollbar ${isMobile ? '' : ` overflow-hidden xs:overflow-auto ${viewState === 'conversation' ? ' ' : ' '} `}
|
|
@@ -148,14 +159,16 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, onClose, isMobil
|
|
|
148
159
|
>
|
|
149
160
|
{content}
|
|
150
161
|
</div>
|
|
151
|
-
{
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
162
|
+
<div className={`!z-[50]`}>
|
|
163
|
+
{/* 얘는 아래 64px로 고정 */}
|
|
164
|
+
<NavigationFooter
|
|
165
|
+
activeView={activeView}
|
|
166
|
+
onHomeClick={handleBackToHome}
|
|
167
|
+
onHistoryClick={handleHistoryClick}
|
|
168
|
+
historyList={historyList}
|
|
169
|
+
isAuthenticated={isAuthenticated}
|
|
170
|
+
/>
|
|
171
|
+
</div>
|
|
159
172
|
</div>
|
|
160
173
|
</div>
|
|
161
174
|
{/*얘는 abolute라서 고려 X*/}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import React, { useRef, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
4
4
|
import Tiptap from './Tiptap/Tiptap';
|
|
5
|
+
import { stripHtmlTags } from './_lib/utils';
|
|
5
6
|
const ChatInput = () => {
|
|
6
7
|
const [message, setMessage] = useState('');
|
|
7
8
|
const { sendMessage, isLoading } = useDaeryuntalk();
|
|
8
9
|
const tiptapRef = useRef(null);
|
|
10
|
+
const [isEmpty, setIsEmpty] = useState(false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setIsEmpty(!stripHtmlTags(message));
|
|
13
|
+
}, [message]);
|
|
9
14
|
const handleSubmit = (e) => {
|
|
10
15
|
var _a, _b, _c;
|
|
11
16
|
e.preventDefault();
|
|
@@ -28,14 +33,20 @@ const ChatInput = () => {
|
|
|
28
33
|
}
|
|
29
34
|
};
|
|
30
35
|
return (<form onSubmit={handleSubmit} className="flex w-full items-center gap-2">
|
|
31
|
-
<div className="flex flex-1 justify-center gap-[10px] rounded-[10px] border-[1px] border-solid border-grayScale6 p-[4px]">
|
|
36
|
+
<div className="flex flex-1 justify-center gap-[10px] rounded-[10px] border-[1px] border-solid border-grayScale6 bg-drTalkGrayscale5 p-[4px]">
|
|
32
37
|
{/* 최초 높이 44 */}
|
|
33
38
|
{/*내용이 2줄 이상되면 입력창 높이도 키워져야합니다. 최대한 4줄까지만 보이도록 해주시고, 그 이상은 스크롤 될 수 있도록 해주시는 게 좋을 것 같습니다. max height 값을 72로 지정 부탁드립니다*/}
|
|
39
|
+
|
|
34
40
|
<Tiptap ref={tiptapRef}
|
|
35
41
|
// value={message}
|
|
36
|
-
onChange={setMessage} onEnterKeyPress={handleEnter} placeholder="메시지를
|
|
42
|
+
onChange={setMessage} onEnterKeyPress={handleEnter} placeholder="메시지를 입력해 주세요." contentClassName={`!outline-none !border-[0px] !pt-[4px] !pl-[4px]`}/>
|
|
43
|
+
|
|
37
44
|
<div className={`flex flex-col justify-end`}>
|
|
38
|
-
<button type="submit" className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-drTalkBtnActive2 text-white ${isLoading
|
|
45
|
+
<button type="submit" className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-drTalkBtnActive2 text-white ${isLoading
|
|
46
|
+
? 'cursor-not-allowed opacity-50'
|
|
47
|
+
: isEmpty
|
|
48
|
+
? ' bg-drTalkBtnActive2 '
|
|
49
|
+
: ' bg-drTalkCrimson '}`} disabled={isLoading}>
|
|
39
50
|
<div className="flex h-9 w-9 items-center justify-center">
|
|
40
51
|
<SendIcon width={24} height={24}/>
|
|
41
52
|
</div>
|
|
@@ -2,12 +2,19 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
4
4
|
import Tiptap, { TiptapEditorRef } from './Tiptap/Tiptap';
|
|
5
|
+
import { stripHtmlTags } from './_lib/utils';
|
|
6
|
+
import ShadowBox from './_ui/ShadowBox';
|
|
7
|
+
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
5
8
|
|
|
6
9
|
const ChatInput: React.FC = () => {
|
|
7
10
|
const [message, setMessage] = useState('');
|
|
8
11
|
const { sendMessage, isLoading } = useDaeryuntalk();
|
|
9
12
|
const tiptapRef = useRef<TiptapEditorRef | null>(null);
|
|
13
|
+
const [isEmpty, setIsEmpty] = useState<boolean>(false);
|
|
10
14
|
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
setIsEmpty(!stripHtmlTags(message));
|
|
17
|
+
}, [message]);
|
|
11
18
|
const handleSubmit = (e: React.FormEvent) => {
|
|
12
19
|
e.preventDefault();
|
|
13
20
|
if (message.trim() && !isLoading) {
|
|
@@ -28,27 +35,32 @@ const ChatInput: React.FC = () => {
|
|
|
28
35
|
tiptapRef.current?.clearContent(); // 입력창 초기화
|
|
29
36
|
}
|
|
30
37
|
};
|
|
31
|
-
|
|
32
38
|
return (
|
|
33
39
|
<form onSubmit={handleSubmit} className="flex w-full items-center gap-2">
|
|
34
|
-
<div className="flex flex-1 justify-center gap-[10px] rounded-[10px] border-[1px] border-solid border-grayScale6 p-[4px]">
|
|
40
|
+
<div className="flex flex-1 justify-center gap-[10px] rounded-[10px] border-[1px] border-solid border-grayScale6 bg-drTalkGrayscale5 p-[4px]">
|
|
35
41
|
{/* 최초 높이 44 */}
|
|
36
42
|
{/*내용이 2줄 이상되면 입력창 높이도 키워져야합니다. 최대한 4줄까지만 보이도록 해주시고, 그 이상은 스크롤 될 수 있도록 해주시는 게 좋을 것 같습니다. max height 값을 72로 지정 부탁드립니다*/}
|
|
43
|
+
|
|
37
44
|
<Tiptap
|
|
38
45
|
ref={tiptapRef}
|
|
39
46
|
// value={message}
|
|
40
47
|
onChange={setMessage}
|
|
41
48
|
onEnterKeyPress={handleEnter}
|
|
42
|
-
placeholder="메시지를
|
|
49
|
+
placeholder="메시지를 입력해 주세요."
|
|
43
50
|
contentClassName={`!outline-none !border-[0px] !pt-[4px] !pl-[4px]`}
|
|
44
51
|
/>
|
|
52
|
+
|
|
45
53
|
<div className={`flex flex-col justify-end`}>
|
|
46
54
|
<button
|
|
47
55
|
type="submit"
|
|
48
56
|
className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-drTalkBtnActive2 text-white ${
|
|
49
|
-
isLoading
|
|
57
|
+
isLoading
|
|
58
|
+
? 'cursor-not-allowed opacity-50'
|
|
59
|
+
: isEmpty
|
|
60
|
+
? ' bg-drTalkBtnActive2 '
|
|
61
|
+
: ' bg-drTalkCrimson '
|
|
50
62
|
}`}
|
|
51
|
-
disabled={isLoading
|
|
63
|
+
disabled={isLoading}
|
|
52
64
|
>
|
|
53
65
|
<div className="flex h-9 w-9 items-center justify-center">
|
|
54
66
|
<SendIcon width={24} height={24} />
|
|
@@ -44,7 +44,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
|
|
|
44
44
|
? message.files.filter(file => file.type === 'image').sort((a, b) => a.sequence - b.sequence)
|
|
45
45
|
: [];
|
|
46
46
|
const files = message.files
|
|
47
|
-
? message.files.filter(file => file.type
|
|
47
|
+
? message.files.filter(file => file.type === 'file').sort((a, b) => a.sequence - b.sequence)
|
|
48
48
|
: [];
|
|
49
49
|
return (<div className={`flex flex-col gap-[10px]`}>
|
|
50
50
|
{images.length > 0 && renderMedia({ type: 'image', images })}
|
|
@@ -45,7 +45,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
|
45
45
|
? message.files.filter(file => file.type === 'image').sort((a, b) => a.sequence - b.sequence)
|
|
46
46
|
: [];
|
|
47
47
|
const files = message.files
|
|
48
|
-
? message.files.filter(file => file.type
|
|
48
|
+
? message.files.filter(file => file.type === 'file').sort((a, b) => a.sequence - b.sequence)
|
|
49
49
|
: [];
|
|
50
50
|
|
|
51
51
|
return (
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { Message } from '../_types/message';
|
|
3
3
|
interface props {
|
|
4
4
|
message: Message;
|
|
5
|
+
isOperator: boolean;
|
|
6
|
+
isMobile: boolean;
|
|
5
7
|
}
|
|
6
|
-
declare const WorkFlowImg: ({ message }: props) => React.JSX.Element;
|
|
8
|
+
declare const WorkFlowImg: ({ message, isOperator, isMobile }: props) => React.JSX.Element;
|
|
7
9
|
export default WorkFlowImg;
|