@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
|
@@ -22,7 +22,7 @@ import RichText from './ChatItem/RichText';
|
|
|
22
22
|
import ChatFile from './ChatItem/ChatFile';
|
|
23
23
|
import FieldWorkObject from './ChatObject/FieldWorkObject';
|
|
24
24
|
import TimeWrapper from './ChatItem/TimeWrapper';
|
|
25
|
-
import {
|
|
25
|
+
import { InquiryStatusEnum } from './_enums/ask-status';
|
|
26
26
|
|
|
27
27
|
type ChatMessageProps = {
|
|
28
28
|
message: Message;
|
|
@@ -37,6 +37,7 @@ type ChatMessageProps = {
|
|
|
37
37
|
isHovered: boolean;
|
|
38
38
|
scrollEnd: () => void;
|
|
39
39
|
inquiryStatus: string;
|
|
40
|
+
isMobile: boolean;
|
|
40
41
|
};
|
|
41
42
|
|
|
42
43
|
const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
@@ -47,7 +48,8 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
47
48
|
workFlowStack,
|
|
48
49
|
isHovered,
|
|
49
50
|
scrollEnd,
|
|
50
|
-
inquiryStatus
|
|
51
|
+
inquiryStatus,
|
|
52
|
+
isMobile
|
|
51
53
|
}) => {
|
|
52
54
|
// 고객 , 오퍼레이터 분리
|
|
53
55
|
const isOperator = message.senderType !== MessageSenderType.CUSTOMER;
|
|
@@ -82,6 +84,7 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
82
84
|
const isAuthForm = hasForm(message);
|
|
83
85
|
const isRichForm = hasRichForm(message);
|
|
84
86
|
const isFile = hasFileArray(message);
|
|
87
|
+
console.log('inquiryStatus', inquiryStatus);
|
|
85
88
|
|
|
86
89
|
// 파일이 있는경우
|
|
87
90
|
if (isFile) {
|
|
@@ -121,7 +124,7 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
121
124
|
if (isWorkFlow) {
|
|
122
125
|
return (
|
|
123
126
|
<TimeWrapper time={time}>
|
|
124
|
-
<WorkFlowImg message={message} />
|
|
127
|
+
<WorkFlowImg message={message} isOperator={isOperator} isMobile={isMobile} />
|
|
125
128
|
</TimeWrapper>
|
|
126
129
|
);
|
|
127
130
|
}
|
|
@@ -138,7 +141,7 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
138
141
|
return (
|
|
139
142
|
<TimeWrapper time={time}>
|
|
140
143
|
<ChatWrapper isOperator={isOperator}>
|
|
141
|
-
<p className="dr_talk_body_medium2 whitespace-pre-line">{message
|
|
144
|
+
<p className="dr_talk_body_medium2 whitespace-pre-line">{message?.plainText}</p>
|
|
142
145
|
</ChatWrapper>
|
|
143
146
|
</TimeWrapper>
|
|
144
147
|
);
|
|
@@ -163,61 +166,62 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
163
166
|
>
|
|
164
167
|
{renderText(message, isObject)}
|
|
165
168
|
{/* 오브젝트 박스 */}
|
|
166
|
-
{inquiryStatus ===
|
|
167
|
-
|
|
168
|
-
<div
|
|
169
|
-
|
|
169
|
+
{inquiryStatus === InquiryStatusEnum.OPEN ||
|
|
170
|
+
(inquiryStatus === InquiryStatusEnum.PERSONAL_INFO && object && object.exposeObjectListYn && (
|
|
171
|
+
<div className={`mt-[10px] flex w-[calc(100%-35px)] flex-col gap-[10px] `}>
|
|
172
|
+
<div
|
|
173
|
+
className={`
|
|
170
174
|
${
|
|
171
175
|
WorkFlowButtonUiCode.TILE_BUTTON === object?.objectGroupUiCode
|
|
172
176
|
? 'flex flex-row flex-wrap gap-x-[4px] gap-y-[8px]'
|
|
173
177
|
: 'flex flex-col gap-[8px]'
|
|
174
178
|
}
|
|
175
179
|
`}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
180
|
+
>
|
|
181
|
+
{WorkFlowButtonUiCode.TILE_BUTTON !== object?.objectGroupUiCode
|
|
182
|
+
? object.objectList
|
|
183
|
+
?.sort((a, b) => a.sequence - b.sequence)
|
|
184
|
+
?.map((item, index) => {
|
|
185
|
+
return (
|
|
186
|
+
<ObjectButton
|
|
187
|
+
key={`object-expose-${index}`}
|
|
188
|
+
object={item}
|
|
189
|
+
messageNumber={object?.messageNumber || ''}
|
|
190
|
+
workFlowNumber={message?.workFlow?.workFlowNumber || ''}
|
|
191
|
+
isFirstObject={objectFirstQuestionCheck}
|
|
192
|
+
objectGroupUiCode={object?.objectGroupUiCode || ''}
|
|
193
|
+
/>
|
|
194
|
+
);
|
|
195
|
+
})
|
|
196
|
+
: null}
|
|
197
|
+
{/* 더보기 들어간 타입 */}
|
|
198
|
+
{WorkFlowButtonUiCode.TILE_BUTTON === object?.objectGroupUiCode && (
|
|
199
|
+
<FieldWorkObject
|
|
200
|
+
object={object}
|
|
201
|
+
message={message}
|
|
202
|
+
isFirstObject={objectFirstQuestionCheck}
|
|
203
|
+
scrollEnd={scrollEnd}
|
|
204
|
+
/>
|
|
205
|
+
)}
|
|
206
|
+
</div>
|
|
207
|
+
{!objectFirstQuestionCheck && (
|
|
208
|
+
<ObjectBack
|
|
209
|
+
isBack={objectIsBack}
|
|
210
|
+
handleBtn={async () => {
|
|
211
|
+
if (handelObjectBack) {
|
|
212
|
+
await handelObjectBack({
|
|
213
|
+
chatInquiryNumber: chatInquiryNumber,
|
|
214
|
+
messageNumber: object?.messageNumber || '',
|
|
215
|
+
workFlowNavigationCode: objectIsBack
|
|
216
|
+
? WorkFlowBackOrInit.BACK
|
|
217
|
+
: WorkFlowBackOrInit.INIT
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}}
|
|
200
221
|
/>
|
|
201
222
|
)}
|
|
202
223
|
</div>
|
|
203
|
-
|
|
204
|
-
<ObjectBack
|
|
205
|
-
isBack={objectIsBack}
|
|
206
|
-
handleBtn={async () => {
|
|
207
|
-
if (handelObjectBack) {
|
|
208
|
-
await handelObjectBack({
|
|
209
|
-
chatInquiryNumber: chatInquiryNumber,
|
|
210
|
-
messageNumber: object?.messageNumber || '',
|
|
211
|
-
workFlowNavigationCode: objectIsBack
|
|
212
|
-
? WorkFlowBackOrInit.BACK
|
|
213
|
-
: WorkFlowBackOrInit.INIT
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}}
|
|
217
|
-
/>
|
|
218
|
-
)}
|
|
219
|
-
</div>
|
|
220
|
-
)}
|
|
224
|
+
))}
|
|
221
225
|
</div>
|
|
222
226
|
);
|
|
223
227
|
};
|
|
@@ -78,10 +78,11 @@ const ObjectButton = ({ object, messageNumber, workFlowNumber, isFirstObject = f
|
|
|
78
78
|
const renderButton = (className) => {
|
|
79
79
|
return (<button type="button" onClick={() => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
80
|
yield handleButton(object);
|
|
81
|
-
})} className={className}>
|
|
81
|
+
})} className={`${className}`}>
|
|
82
82
|
<div className="h-[18px] w-[18px]">
|
|
83
|
-
<Image src={object.iconImageUrl} width={
|
|
83
|
+
<Image src={object.iconImageUrl} width={18} height={18} alt={object.objectName} className="h-[18px] w-[18px] object-cover"/>
|
|
84
84
|
</div>
|
|
85
|
+
|
|
85
86
|
<div className="flex items-center">
|
|
86
87
|
{isFirstObject ? objectListRender(object.objectNumber) : object.objectName}
|
|
87
88
|
</div>
|
|
@@ -105,6 +106,7 @@ const ObjectButton = ({ object, messageNumber, workFlowNumber, isFirstObject = f
|
|
|
105
106
|
return <>{renderButton(filterClassName())}</>;
|
|
106
107
|
};
|
|
107
108
|
export default ObjectButton;
|
|
109
|
+
// 예외케이스
|
|
108
110
|
const objectListRender = (objectNumber) => {
|
|
109
111
|
switch (objectNumber) {
|
|
110
112
|
case ObjectNumber.FIRST_VISIT:
|
|
@@ -103,17 +103,18 @@ const ObjectButton = ({
|
|
|
103
103
|
onClick={async () => {
|
|
104
104
|
await handleButton(object);
|
|
105
105
|
}}
|
|
106
|
-
className={className}
|
|
106
|
+
className={`${className}`}
|
|
107
107
|
>
|
|
108
108
|
<div className="h-[18px] w-[18px]">
|
|
109
109
|
<Image
|
|
110
110
|
src={object.iconImageUrl}
|
|
111
|
-
width={
|
|
112
|
-
height={
|
|
111
|
+
width={18}
|
|
112
|
+
height={18}
|
|
113
113
|
alt={object.objectName}
|
|
114
|
-
className="h-
|
|
114
|
+
className="h-[18px] w-[18px] object-cover"
|
|
115
115
|
/>
|
|
116
116
|
</div>
|
|
117
|
+
|
|
117
118
|
<div className="flex items-center">
|
|
118
119
|
{isFirstObject ? objectListRender(object.objectNumber) : object.objectName}
|
|
119
120
|
</div>
|
|
@@ -143,6 +144,7 @@ const ObjectButton = ({
|
|
|
143
144
|
|
|
144
145
|
export default ObjectButton;
|
|
145
146
|
|
|
147
|
+
// 예외케이스
|
|
146
148
|
const objectListRender = (objectNumber: string) => {
|
|
147
149
|
switch (objectNumber) {
|
|
148
150
|
case ObjectNumber.FIRST_VISIT:
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import ChatHomeView from './ChatHomeView';
|
|
3
3
|
import ImageViewer from './Viewer/ImageViewer';
|
|
4
4
|
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
5
|
-
const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
|
|
5
|
+
const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue, animationState }) => {
|
|
6
6
|
const { containerRef, isScroll, isBottom } = useScrollShadow();
|
|
7
7
|
const isHash = !!hashValue; // 해쉬 있을 경우
|
|
8
8
|
// 모바일 웹
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Dispatch, SetStateAction } from 'react';
|
|
1
|
+
import React, { Dispatch, SetStateAction, useState } from 'react';
|
|
2
2
|
import ChatHomeView from './ChatHomeView';
|
|
3
3
|
import ImageViewer from './Viewer/ImageViewer';
|
|
4
4
|
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
@@ -10,9 +10,17 @@ interface ChatWidgetProps {
|
|
|
10
10
|
onClose: () => void;
|
|
11
11
|
hashValue: string | null;
|
|
12
12
|
setHashValue: Dispatch<SetStateAction<string | null>>;
|
|
13
|
+
animationState: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
16
|
+
const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
17
|
+
isOpen,
|
|
18
|
+
isMobile,
|
|
19
|
+
onClose,
|
|
20
|
+
hashValue,
|
|
21
|
+
setHashValue,
|
|
22
|
+
animationState
|
|
23
|
+
}) => {
|
|
16
24
|
const { containerRef, isScroll, isBottom } = useScrollShadow<HTMLDivElement>();
|
|
17
25
|
const isHash = !!hashValue; // 해쉬 있을 경우
|
|
18
26
|
|
|
@@ -73,6 +73,7 @@ type DaeryuntalkContextType = {
|
|
|
73
73
|
retryInquiryMain: (channelNumber: string) => any;
|
|
74
74
|
setMessageObject: (obj: MessageObject | null) => void;
|
|
75
75
|
setWorkFlowStack: (arr: string[]) => void;
|
|
76
|
+
retryInitData: () => void;
|
|
76
77
|
};
|
|
77
78
|
declare const DaeryuntalkContext: React.Context<DaeryuntalkContextType>;
|
|
78
79
|
type DaeryuntalkProviderProps = {
|
|
@@ -55,7 +55,8 @@ const DaeryuntalkContext = createContext({
|
|
|
55
55
|
attendRoomByHistory: () => { },
|
|
56
56
|
retryInquiryMain: () => { },
|
|
57
57
|
setMessageObject: () => { },
|
|
58
|
-
setWorkFlowStack: () => { }
|
|
58
|
+
setWorkFlowStack: () => { },
|
|
59
|
+
retryInitData: () => { }
|
|
59
60
|
});
|
|
60
61
|
export const DaeryuntalkProvider = ({ children, propsTel, isMobile }) => {
|
|
61
62
|
const [inquiryStatus, setInquiryStatus] = useState('');
|
|
@@ -76,7 +77,7 @@ export const DaeryuntalkProvider = ({ children, propsTel, isMobile }) => {
|
|
|
76
77
|
// 히스토리 리스트
|
|
77
78
|
const [historyList, setHistoryList] = useState([]);
|
|
78
79
|
// 소켓 관련 API + 채팅 시작
|
|
79
|
-
const { initializeDaeryuntalk, sendHeartbeat, sendInquiryJoined, sendInquiryLeft, sendHistoryEntered, sendHistoryLeft, sendInquiryWatching, retryInquiryMain } = useSocketEventHandler({
|
|
80
|
+
const { initializeDaeryuntalk, sendHeartbeat, sendInquiryJoined, sendInquiryLeft, sendHistoryEntered, sendHistoryLeft, sendInquiryWatching, retryInquiryMain, retryInitData } = useSocketEventHandler({
|
|
80
81
|
setIsConnected,
|
|
81
82
|
setIsLoading,
|
|
82
83
|
setMessages,
|
|
@@ -151,7 +152,8 @@ export const DaeryuntalkProvider = ({ children, propsTel, isMobile }) => {
|
|
|
151
152
|
attendRoomByHistory,
|
|
152
153
|
retryInquiryMain,
|
|
153
154
|
setMessageObject,
|
|
154
|
-
setWorkFlowStack
|
|
155
|
+
setWorkFlowStack,
|
|
156
|
+
retryInitData
|
|
155
157
|
}}>
|
|
156
158
|
{children}
|
|
157
159
|
</DaeryuntalkContext.Provider>);
|
|
@@ -78,6 +78,7 @@ type DaeryuntalkContextType = {
|
|
|
78
78
|
retryInquiryMain: (channelNumber: string) => any;
|
|
79
79
|
setMessageObject: (obj: MessageObject | null) => void;
|
|
80
80
|
setWorkFlowStack: (arr: string[]) => void;
|
|
81
|
+
retryInitData: () => void;
|
|
81
82
|
};
|
|
82
83
|
|
|
83
84
|
// 기본값으로 컨텍스트 생성
|
|
@@ -123,7 +124,8 @@ const DaeryuntalkContext = createContext<DaeryuntalkContextType>({
|
|
|
123
124
|
attendRoomByHistory: () => {},
|
|
124
125
|
retryInquiryMain: () => {},
|
|
125
126
|
setMessageObject: () => {},
|
|
126
|
-
setWorkFlowStack: () => {}
|
|
127
|
+
setWorkFlowStack: () => {},
|
|
128
|
+
retryInitData: () => {}
|
|
127
129
|
});
|
|
128
130
|
|
|
129
131
|
// 프로바이더 컴포넌트 생성
|
|
@@ -165,7 +167,8 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
|
|
|
165
167
|
sendHistoryEntered,
|
|
166
168
|
sendHistoryLeft,
|
|
167
169
|
sendInquiryWatching,
|
|
168
|
-
retryInquiryMain
|
|
170
|
+
retryInquiryMain,
|
|
171
|
+
retryInitData
|
|
169
172
|
} = useSocketEventHandler({
|
|
170
173
|
setIsConnected,
|
|
171
174
|
setIsLoading,
|
|
@@ -259,7 +262,8 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
|
|
|
259
262
|
attendRoomByHistory,
|
|
260
263
|
retryInquiryMain,
|
|
261
264
|
setMessageObject,
|
|
262
|
-
setWorkFlowStack
|
|
265
|
+
setWorkFlowStack,
|
|
266
|
+
retryInitData
|
|
263
267
|
}}
|
|
264
268
|
>
|
|
265
269
|
{children}
|
|
@@ -85,6 +85,8 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
|
|
|
85
85
|
useEffect(() => {
|
|
86
86
|
checkScroll();
|
|
87
87
|
}, [inquiryMainData]);
|
|
88
|
+
const tempSasulation = `안녕하세요.\n법무법인(유한)대륜입니다.\n방문해 주셔서 감사합니다. \n궁금한 점이나 도움이 필요하신 부분 \n말씀해 주시면 도와드리겠습니다.\n\n※ 성함과 연락처를 남겨주시면 갑작스럽게 채팅이 중단될 경우 전화나 문자(알림톡)를 통해 중요한 답변을 놓치지 않도록 도와드리고 있으며 이전 내역 확인 후 빠른 안내가 가능합니다. \n\n※ 만 14세 미만의 경우에는 보호자의 동의 없이는 개인정보 수집 및 이용이 불가능합니다. \n만 14세 미만의 미성년자의 경우 법정대리인의 연락처를 알려 주시면 동의서를 보내드리도록 하겠습니다.\n\n채팅방을 나가신 후 문의하실 경우에도 동일한 내용으로 대화를 이어가실 수 있습니다. \n\n수집된 개인 정보는 답변 알림 및 상담예약안내 목적으로만 이용되며 삭제를 요청하시기 전까지 보유됩니다. 개인정보 입력시 개인정보제공에 동의한 것으로 봅니다. 개인정보제공에 동의하지 않으실 경우 답변 알림을 받으실 수 없습니다.\n\n✅ 6:00~24:00 외 시간에는 인력편성에 따라 순차적으로 응대를 도와드리고 있습니다."
|
|
89
|
+
`;
|
|
88
90
|
const backgroundImage = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.sleeve_image_url) || DaeryuntalkIntro;
|
|
89
91
|
return (<div ref={wrapperRef} className={`
|
|
90
92
|
no-scrollbar relative w-full rounded-t-[30px]
|
|
@@ -121,14 +123,7 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
|
|
|
121
123
|
</h1>
|
|
122
124
|
</div>
|
|
123
125
|
<div className="dr_talk_body_medium2 relative ml-[42px] mr-[16px] mt-[16px] whitespace-pre-line">
|
|
124
|
-
{(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.salutation) ||
|
|
125
|
-
`안녕하세요.
|
|
126
|
-
법무법인(유한)대륜입니다.
|
|
127
|
-
방문해 주셔서 감사합니다.\n
|
|
128
|
-
궁금한 점이나 도움이 필요하신 부분
|
|
129
|
-
말씀해 주시면 도와드리겠습니다.
|
|
130
|
-
6:00~24:00 외 시간에는 상담인력의 편성에 따라 순차적으로 응대를 도와드리고 있습니다.
|
|
131
|
-
`}
|
|
126
|
+
{(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.salutation) || tempSasulation}
|
|
132
127
|
</div>
|
|
133
128
|
</div>
|
|
134
129
|
{isScroll && !isBottom && <ShadowBox />}
|
|
@@ -136,7 +131,7 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
|
|
|
136
131
|
|
|
137
132
|
<Button3 onClick={handleStartChat} isDisabled={isLoading} className="mt-[40px]">
|
|
138
133
|
<div className="flex items-center justify-center gap-[4px]">
|
|
139
|
-
<div>{isLoading ? '로딩 중...' : '문의하기'}</div>
|
|
134
|
+
{!(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_number) ? (<div>{'로딩 중...'}</div>) : (<div>{isLoading ? '로딩 중...' : '문의하기'}</div>)}
|
|
140
135
|
{!isLoading && <SendIcon width={24} height={24}/>}
|
|
141
136
|
</div>
|
|
142
137
|
</Button3>
|
|
@@ -106,6 +106,9 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
|
|
|
106
106
|
checkScroll();
|
|
107
107
|
}, [inquiryMainData]);
|
|
108
108
|
|
|
109
|
+
const tempSasulation = `안녕하세요.\n법무법인(유한)대륜입니다.\n방문해 주셔서 감사합니다. \n궁금한 점이나 도움이 필요하신 부분 \n말씀해 주시면 도와드리겠습니다.\n\n※ 성함과 연락처를 남겨주시면 갑작스럽게 채팅이 중단될 경우 전화나 문자(알림톡)를 통해 중요한 답변을 놓치지 않도록 도와드리고 있으며 이전 내역 확인 후 빠른 안내가 가능합니다. \n\n※ 만 14세 미만의 경우에는 보호자의 동의 없이는 개인정보 수집 및 이용이 불가능합니다. \n만 14세 미만의 미성년자의 경우 법정대리인의 연락처를 알려 주시면 동의서를 보내드리도록 하겠습니다.\n\n채팅방을 나가신 후 문의하실 경우에도 동일한 내용으로 대화를 이어가실 수 있습니다. \n\n수집된 개인 정보는 답변 알림 및 상담예약안내 목적으로만 이용되며 삭제를 요청하시기 전까지 보유됩니다. 개인정보 입력시 개인정보제공에 동의한 것으로 봅니다. 개인정보제공에 동의하지 않으실 경우 답변 알림을 받으실 수 없습니다.\n\n✅ 6:00~24:00 외 시간에는 인력편성에 따라 순차적으로 응대를 도와드리고 있습니다."
|
|
110
|
+
`;
|
|
111
|
+
|
|
109
112
|
const backgroundImage = inquiryMainData?.sleeve_image_url || DaeryuntalkIntro;
|
|
110
113
|
return (
|
|
111
114
|
<div
|
|
@@ -176,14 +179,7 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
|
|
|
176
179
|
</h1>
|
|
177
180
|
</div>
|
|
178
181
|
<div className="dr_talk_body_medium2 relative ml-[42px] mr-[16px] mt-[16px] whitespace-pre-line">
|
|
179
|
-
{inquiryMainData?.salutation ||
|
|
180
|
-
`안녕하세요.
|
|
181
|
-
법무법인(유한)대륜입니다.
|
|
182
|
-
방문해 주셔서 감사합니다.\n
|
|
183
|
-
궁금한 점이나 도움이 필요하신 부분
|
|
184
|
-
말씀해 주시면 도와드리겠습니다.
|
|
185
|
-
6:00~24:00 외 시간에는 상담인력의 편성에 따라 순차적으로 응대를 도와드리고 있습니다.
|
|
186
|
-
`}
|
|
182
|
+
{inquiryMainData?.salutation || tempSasulation}
|
|
187
183
|
</div>
|
|
188
184
|
</div>
|
|
189
185
|
{isScroll && !isBottom && <ShadowBox />}
|
|
@@ -191,7 +187,11 @@ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClo
|
|
|
191
187
|
|
|
192
188
|
<Button3 onClick={handleStartChat} isDisabled={isLoading} className="mt-[40px]">
|
|
193
189
|
<div className="flex items-center justify-center gap-[4px]">
|
|
194
|
-
|
|
190
|
+
{!inquiryMainData?.channel_number ? (
|
|
191
|
+
<div>{'로딩 중...'}</div>
|
|
192
|
+
) : (
|
|
193
|
+
<div>{isLoading ? '로딩 중...' : '문의하기'}</div>
|
|
194
|
+
)}
|
|
195
195
|
{!isLoading && <SendIcon width={24} height={24} />}
|
|
196
196
|
</div>
|
|
197
197
|
</Button3>
|
|
@@ -5,7 +5,7 @@ const NavigationFooter = ({ activeView, onHomeClick, onHistoryClick, historyList
|
|
|
5
5
|
if (activeView === 'conversation') {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
8
|
-
return (<footer className={`z-10`}>
|
|
8
|
+
return (<footer className={`z-10 bg-white`}>
|
|
9
9
|
<div className="h-px w-full bg-drTalkGrayscale4" role="separator"></div>
|
|
10
10
|
<nav className={' flex h-[64px] justify-around px-8 pb-[12px] pt-[8px]'}>
|
|
11
11
|
<div className={`group flex cursor-pointer flex-col items-center ${activeView === 'home' ? 'text-drTalkCrimson' : 'text-gray-400 hover:text-drTalkCrimson'}`} role="button" tabIndex={0} onClick={onHomeClick}>
|
|
@@ -22,7 +22,7 @@ const NavigationFooter: React.FC<NavigationFooterProps> = ({
|
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
24
|
return (
|
|
25
|
-
<footer className={`z-10`}>
|
|
25
|
+
<footer className={`z-10 bg-white`}>
|
|
26
26
|
<div className="h-px w-full bg-drTalkGrayscale4" role="separator"></div>
|
|
27
27
|
<nav className={' flex h-[64px] justify-around px-8 pb-[12px] pt-[8px]'}>
|
|
28
28
|
<div
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { JSONContent } from '@tiptap/core';
|
|
2
3
|
export interface TiptapEditorRef {
|
|
3
4
|
clearContent: () => void;
|
|
@@ -14,5 +15,5 @@ interface TiptapProps {
|
|
|
14
15
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
15
16
|
contentClassName?: string;
|
|
16
17
|
}
|
|
17
|
-
declare const Tiptap:
|
|
18
|
+
declare const Tiptap: React.ForwardRefExoticComponent<TiptapProps & React.RefAttributes<TiptapEditorRef>>;
|
|
18
19
|
export default Tiptap;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { EditorContent, useEditor } from '@tiptap/react';
|
|
2
2
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
3
|
-
import { forwardRef, useEffect, useImperativeHandle } from 'react';
|
|
3
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
4
4
|
import HardBreak from '@tiptap/extension-hard-break'; // 추가
|
|
5
5
|
import Document from '@tiptap/extension-document';
|
|
6
6
|
import Paragraph from '@tiptap/extension-paragraph';
|
|
7
7
|
import Text from '@tiptap/extension-text';
|
|
8
|
-
|
|
8
|
+
import ShadowBox from '../_ui/ShadowBox';
|
|
9
|
+
const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력해 주세요.', onEnterKeyPress, onKeyDown, contentClassName = '' }, ref) => {
|
|
10
|
+
const containerRef = useRef(null);
|
|
11
|
+
const [isScroll, setIsScroll] = useState(false);
|
|
12
|
+
const [isBottom, setIsBottom] = useState(false);
|
|
9
13
|
const editor = useEditor({
|
|
10
14
|
extensions: [
|
|
11
15
|
Document,
|
|
@@ -36,7 +40,7 @@ const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력하세
|
|
|
36
40
|
},
|
|
37
41
|
editorProps: {
|
|
38
42
|
attributes: {
|
|
39
|
-
class: `dr_talk_body_medium2 focus:outline-none
|
|
43
|
+
class: `dr_talk_body_medium2 focus:outline-none overflow-y-auto resize-none pt-[6px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere no-scrollbar `
|
|
40
44
|
},
|
|
41
45
|
handleKeyDown: (view, event) => {
|
|
42
46
|
const isMobile = /Mobi|Android/i.test(navigator.userAgent); // 모바일 여부 판별
|
|
@@ -88,10 +92,39 @@ const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력하세
|
|
|
88
92
|
editor === null || editor === void 0 ? void 0 : editor.commands.insertContent(content);
|
|
89
93
|
}
|
|
90
94
|
}));
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
var _a;
|
|
97
|
+
const checkScroll = () => {
|
|
98
|
+
var _a;
|
|
99
|
+
const proseEl = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.ProseMirror');
|
|
100
|
+
if (!proseEl)
|
|
101
|
+
return;
|
|
102
|
+
const hasScroll = proseEl.scrollHeight > proseEl.clientHeight;
|
|
103
|
+
const atBottom = proseEl.scrollTop + proseEl.clientHeight >= proseEl.scrollHeight - 1;
|
|
104
|
+
setIsScroll(hasScroll);
|
|
105
|
+
setIsBottom(atBottom);
|
|
106
|
+
};
|
|
107
|
+
const proseEl = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.ProseMirror');
|
|
108
|
+
if (proseEl) {
|
|
109
|
+
proseEl.addEventListener('scroll', checkScroll);
|
|
110
|
+
const observer = new ResizeObserver(checkScroll);
|
|
111
|
+
observer.observe(proseEl);
|
|
112
|
+
// 초기 체크
|
|
113
|
+
checkScroll();
|
|
114
|
+
return () => {
|
|
115
|
+
proseEl.removeEventListener('scroll', checkScroll);
|
|
116
|
+
observer.disconnect();
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}, [editor]);
|
|
91
120
|
if (!editor)
|
|
92
121
|
return null;
|
|
93
|
-
|
|
94
|
-
|
|
122
|
+
return (<div className={`relative w-full `}>
|
|
123
|
+
<div ref={containerRef} className={`w-full`}>
|
|
124
|
+
<EditorContent editor={editor} tabIndex={0} className={`${contentClassName} max-h-[72px] min-h-[36px] w-full overflow-hidden rounded-md border !text-black dark:text-white `}/>
|
|
125
|
+
</div>
|
|
126
|
+
{isScroll && !isBottom && <ShadowBox />}
|
|
127
|
+
</div>);
|
|
95
128
|
});
|
|
96
129
|
Tiptap.displayName = 'Tiptap';
|
|
97
130
|
export default Tiptap;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { EditorContent, useEditor } from '@tiptap/react';
|
|
2
2
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
3
|
-
import { forwardRef, useEffect, useImperativeHandle } from 'react';
|
|
3
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
4
4
|
import HardBreak from '@tiptap/extension-hard-break'; // 추가
|
|
5
5
|
|
|
6
6
|
import { JSONContent } from '@tiptap/core'; // 추가 필요
|
|
7
7
|
import Document from '@tiptap/extension-document';
|
|
8
8
|
import Paragraph from '@tiptap/extension-paragraph';
|
|
9
9
|
import Text from '@tiptap/extension-text';
|
|
10
|
+
import { useScrollShadow } from '../_hooks/useScrollShadow';
|
|
11
|
+
import ShadowBox from '../_ui/ShadowBox';
|
|
10
12
|
|
|
11
13
|
export interface TiptapEditorRef {
|
|
12
14
|
clearContent: () => void;
|
|
@@ -26,7 +28,12 @@ interface TiptapProps {
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
|
|
29
|
-
({ onChange, placeholder = '메시지를
|
|
31
|
+
({ onChange, placeholder = '메시지를 입력해 주세요.', onEnterKeyPress, onKeyDown, contentClassName = '' }, ref) => {
|
|
32
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
33
|
+
|
|
34
|
+
const [isScroll, setIsScroll] = useState(false);
|
|
35
|
+
const [isBottom, setIsBottom] = useState(false);
|
|
36
|
+
|
|
30
37
|
const editor = useEditor({
|
|
31
38
|
extensions: [
|
|
32
39
|
Document,
|
|
@@ -57,7 +64,7 @@ const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
|
|
|
57
64
|
},
|
|
58
65
|
editorProps: {
|
|
59
66
|
attributes: {
|
|
60
|
-
class: `dr_talk_body_medium2 focus:outline-none
|
|
67
|
+
class: `dr_talk_body_medium2 focus:outline-none overflow-y-auto resize-none pt-[6px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere no-scrollbar `
|
|
61
68
|
},
|
|
62
69
|
handleKeyDown: (view, event) => {
|
|
63
70
|
const isMobile = /Mobi|Android/i.test(navigator.userAgent); // 모바일 여부 판별
|
|
@@ -114,15 +121,47 @@ const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
|
|
|
114
121
|
}
|
|
115
122
|
}));
|
|
116
123
|
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const checkScroll = () => {
|
|
126
|
+
const proseEl = containerRef.current?.querySelector('.ProseMirror');
|
|
127
|
+
if (!proseEl) return;
|
|
128
|
+
|
|
129
|
+
const hasScroll = proseEl.scrollHeight > proseEl.clientHeight;
|
|
130
|
+
const atBottom = proseEl.scrollTop + proseEl.clientHeight >= proseEl.scrollHeight - 1;
|
|
131
|
+
|
|
132
|
+
setIsScroll(hasScroll);
|
|
133
|
+
setIsBottom(atBottom);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const proseEl = containerRef.current?.querySelector('.ProseMirror');
|
|
137
|
+
if (proseEl) {
|
|
138
|
+
proseEl.addEventListener('scroll', checkScroll);
|
|
139
|
+
const observer = new ResizeObserver(checkScroll);
|
|
140
|
+
observer.observe(proseEl);
|
|
141
|
+
|
|
142
|
+
// 초기 체크
|
|
143
|
+
checkScroll();
|
|
144
|
+
|
|
145
|
+
return () => {
|
|
146
|
+
proseEl.removeEventListener('scroll', checkScroll);
|
|
147
|
+
observer.disconnect();
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}, [editor]);
|
|
151
|
+
|
|
117
152
|
if (!editor) return null;
|
|
118
153
|
|
|
119
|
-
// return <EditorContent editor={editor} tabIndex={0} className="rounded-md border text-black dark:text-white" />;
|
|
120
154
|
return (
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
155
|
+
<div className={`relative w-full `}>
|
|
156
|
+
<div ref={containerRef} className={`w-full`}>
|
|
157
|
+
<EditorContent
|
|
158
|
+
editor={editor}
|
|
159
|
+
tabIndex={0}
|
|
160
|
+
className={`${contentClassName} max-h-[72px] min-h-[36px] w-full overflow-hidden rounded-md border !text-black dark:text-white `}
|
|
161
|
+
/>
|
|
162
|
+
</div>
|
|
163
|
+
{isScroll && !isBottom && <ShadowBox />}
|
|
164
|
+
</div>
|
|
126
165
|
);
|
|
127
166
|
}
|
|
128
167
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
export type ToastType = 'success' | 'warning' | 'error';
|
|
3
|
+
export type AnimationState = 'hidden' | 'entering' | 'visible' | 'exiting';
|
|
3
4
|
interface ToastItem {
|
|
4
5
|
type: ToastType;
|
|
5
6
|
title: string;
|
|
@@ -8,7 +9,7 @@ interface ToastItem {
|
|
|
8
9
|
}
|
|
9
10
|
interface ToastContextProps {
|
|
10
11
|
toast: ToastItem | null;
|
|
11
|
-
|
|
12
|
+
animationState: AnimationState;
|
|
12
13
|
hideToast: () => void;
|
|
13
14
|
success: (title: string, desc?: string, duration?: number) => void;
|
|
14
15
|
warning: (title: string, desc?: string, duration?: number) => void;
|