@daeryun/dr_components 0.8.79 → 0.8.82
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 +3 -3
- package/dist/components/Daeryuntalk/ChatConversation.tsx +3 -2
- 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 +174 -3
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +211 -3
- package/dist/components/Daeryuntalk/ChatMessage.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatMessage.jsx +11 -6
- package/dist/components/Daeryuntalk/ChatMessage.tsx +14 -6
- 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/HistoryView.jsx +1 -2
- package/dist/components/Daeryuntalk/HistoryView.tsx +1 -1
- 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/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 +8 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +10 -2
- 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/_types/message.d.ts +1 -1
- package/dist/components/Daeryuntalk/_types/message.js +6 -1
- package/dist/components/Daeryuntalk/_types/message.ts +7 -1
- 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,21 +1,229 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Image from 'next/image';
|
|
3
3
|
import { Message } from '../_types/message';
|
|
4
|
+
import { InquiryMessageTemplateType } from '../_enums/template';
|
|
5
|
+
import DOMPurify from 'dompurify';
|
|
6
|
+
import RichText from './RichText';
|
|
7
|
+
import ChatWrapper from './ChatWrapper';
|
|
8
|
+
import { decodeDoubleEscapedHtml } from '../_lib/utils';
|
|
9
|
+
import { useWindowSize } from '../_hooks/useWindowSize';
|
|
10
|
+
|
|
4
11
|
interface props {
|
|
5
12
|
message: Message;
|
|
13
|
+
isOperator: boolean;
|
|
14
|
+
isMobile: boolean;
|
|
6
15
|
}
|
|
7
|
-
const WorkFlowImg = ({ message }: props) => {
|
|
16
|
+
const WorkFlowImg = ({ message, isOperator, isMobile }: props) => {
|
|
8
17
|
const workFlowItem = message.workFlow;
|
|
18
|
+
const messageType = message?.templateType || '';
|
|
19
|
+
const windowSize = useWindowSize();
|
|
20
|
+
// 워크플로우 메시지 템플릿 1 : 텍스트
|
|
21
|
+
if (messageType === InquiryMessageTemplateType.WORK_FLOW_TEMPLATE_1) {
|
|
22
|
+
return <ChatWrapper isOperator={isOperator}>{message?.blocks?.map(item => item?.value)}</ChatWrapper>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 워크플로우 메시지 템플릿 2 : 이미지 + 텍스트 (이미지)
|
|
26
|
+
if (messageType === InquiryMessageTemplateType.WORK_FLOW_TEMPLATE_2) {
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
{/*{message?.blocks && (*/}
|
|
30
|
+
{/* <ChatWrapper isOperator={isOperator}>{message?.blocks?.map(item => item?.value)}</ChatWrapper>*/}
|
|
31
|
+
{/*)}*/}
|
|
32
|
+
{workFlowItem?.imageUrl && (
|
|
33
|
+
<div
|
|
34
|
+
className={`flex h-auto flex-col overflow-hidden rounded-[10px] border-[1px] border-drTalkGrayscale4`}
|
|
35
|
+
>
|
|
36
|
+
<Image
|
|
37
|
+
src={workFlowItem?.imageUrl || ''}
|
|
38
|
+
alt={''}
|
|
39
|
+
width={500}
|
|
40
|
+
height={300}
|
|
41
|
+
className={`h-full w-full rounded-[10px] object-cover`}
|
|
42
|
+
unoptimized={true}
|
|
43
|
+
/>
|
|
44
|
+
{message?.blocks &&
|
|
45
|
+
message?.blocks?.map((item, index) => {
|
|
46
|
+
const decoded = decodeDoubleEscapedHtml(item.value);
|
|
47
|
+
const shouldRemoveBr = windowSize.width <= 480 || isMobile;
|
|
48
|
+
const cleaned = shouldRemoveBr ? decoded.replace(/<br\s*\/?>/gi, '') : decoded;
|
|
49
|
+
|
|
50
|
+
// // 여기서 ,
|
|
51
|
+
// windowSize.width<=480 || isMobile 일 경우 <br/>은 제거시켜버리고 싶다
|
|
52
|
+
const sanitizedHtml = DOMPurify.sanitize(cleaned);
|
|
53
|
+
|
|
54
|
+
return <div key={index} dangerouslySetInnerHTML={{ __html: sanitizedHtml }} />;
|
|
55
|
+
})}
|
|
56
|
+
</div>
|
|
57
|
+
)}
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 워크플로우 메시지 템플릿 3 : 아이콘 + 텍스트
|
|
63
|
+
if (messageType === InquiryMessageTemplateType.WORK_FLOW_TEMPLATE_3) {
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
{/*{message?.blocks && (*/}
|
|
67
|
+
{/* <ChatWrapper isOperator={isOperator}>{message?.blocks?.map(item => item?.value)}</ChatWrapper>*/}
|
|
68
|
+
{/*)}*/}
|
|
69
|
+
{workFlowItem?.imageUrl && (
|
|
70
|
+
<div
|
|
71
|
+
className={`flex h-auto flex-col overflow-hidden rounded-[10px] border-[1px] border-drTalkGrayscale4`}
|
|
72
|
+
>
|
|
73
|
+
<Image
|
|
74
|
+
src={workFlowItem?.imageUrl || ''}
|
|
75
|
+
alt={''}
|
|
76
|
+
width={500}
|
|
77
|
+
height={300}
|
|
78
|
+
className={`h-full w-full rounded-[10px] object-cover`}
|
|
79
|
+
unoptimized={true}
|
|
80
|
+
/>
|
|
81
|
+
{message?.blocks &&
|
|
82
|
+
message?.blocks?.map((item, index) => {
|
|
83
|
+
const decoded = decodeDoubleEscapedHtml(item.value);
|
|
84
|
+
const sanitizedHtml = DOMPurify.sanitize(decoded);
|
|
85
|
+
|
|
86
|
+
return <div key={index} dangerouslySetInnerHTML={{ __html: sanitizedHtml }} />;
|
|
87
|
+
})}
|
|
88
|
+
</div>
|
|
89
|
+
)}
|
|
90
|
+
</>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 워크플로우 메시지 템플릿 4 : 텍스트 + form
|
|
95
|
+
if (messageType === InquiryMessageTemplateType.WORK_FLOW_TEMPLATE_4) {
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// const case1 = `
|
|
99
|
+
// <div style="display: flex; flex-direction: column; gap: 8px; padding: 20px 16px; color: #000;">
|
|
100
|
+
// <div style="display: flex; height: 30px; align-items: flex-start; justify-content: center; border-bottom: 1px solid #EDEDED; text-align: center; font-size: 16px; font-weight: 700; line-height: 140%; letter-spacing: -4%; color: #000;">
|
|
101
|
+
// 대륜의 <span style="color: #AA1D36;">차별화</span>된
|
|
102
|
+
// <span style="color: #AA1D36;">조력 시스템</span>
|
|
103
|
+
// </div>
|
|
104
|
+
//
|
|
105
|
+
// <div style="display: flex; flex-direction: column; font-size: 16px; font-weight: 400; line-height: 100%; letter-spacing: -4%;">
|
|
106
|
+
// <div style="display: flex; flex-direction: row; align-items: center; height: 24px;">
|
|
107
|
+
// <div style="display: flex; height: 24px; width: 24px; align-items: center; justify-content: center;">
|
|
108
|
+
// <svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
109
|
+
// <path
|
|
110
|
+
// d="M9.5 1L4.5 7.5L1.5 4"
|
|
111
|
+
// stroke="#AA1D36"
|
|
112
|
+
// stroke-width="2"
|
|
113
|
+
// stroke-linecap="round"
|
|
114
|
+
// stroke-linejoin="round"
|
|
115
|
+
// />
|
|
116
|
+
// </svg>
|
|
117
|
+
// </div>
|
|
118
|
+
// 전문 변호사 직접 상담
|
|
119
|
+
// </div>
|
|
120
|
+
//
|
|
121
|
+
// <div style="display: flex; flex-direction: row; align-items: center; height: 24px;">
|
|
122
|
+
// <div style="display: flex; height: 24px; width: 24px; align-items: center; justify-content: center;">
|
|
123
|
+
// <svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
124
|
+
// <path
|
|
125
|
+
// d="M9.5 1L4.5 7.5L1.5 4"
|
|
126
|
+
// stroke="#AA1D36"
|
|
127
|
+
// stroke-width="2"
|
|
128
|
+
// stroke-linecap="round"
|
|
129
|
+
// stroke-linejoin="round"
|
|
130
|
+
// />
|
|
131
|
+
// </svg>
|
|
132
|
+
// </div>
|
|
133
|
+
// 분야별 해결사례 데이터베이스
|
|
134
|
+
// </div>
|
|
135
|
+
//
|
|
136
|
+
// <div style="display: flex; flex-direction: row; align-items: center; height: 24px;">
|
|
137
|
+
// <div style="display: flex; height: 24px; width: 24px; align-items: center; justify-content: center;">
|
|
138
|
+
// <svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
139
|
+
// <path
|
|
140
|
+
// d="M9.5 1L4.5 7.5L1.5 4"
|
|
141
|
+
// stroke="#AA1D36"
|
|
142
|
+
// stroke-width="2"
|
|
143
|
+
// stroke-linecap="round"
|
|
144
|
+
// stroke-linejoin="round"
|
|
145
|
+
// />
|
|
146
|
+
// </svg>
|
|
147
|
+
// </div>
|
|
148
|
+
// 전국 사무소 운영
|
|
149
|
+
// </div>
|
|
150
|
+
// </div>
|
|
151
|
+
// </div>
|
|
152
|
+
// `;
|
|
153
|
+
//
|
|
154
|
+
// const case2 = `
|
|
155
|
+
// <div style="display: flex; flex-direction: column; gap: 8px; padding: 20px 16px; font-size: 16px; line-height: 140%; letter-spacing: -4%; color: #000000;">
|
|
156
|
+
// <div style="font-weight: 400;">
|
|
157
|
+
// <span style="font-weight: 700; color: #AA1D36; line-height: 100%;">법무법인 대륜</span>은 다양한 분야의 법률<br/>
|
|
158
|
+
// 문제를 다루고 있습니다. 궁금하신 분<br/>야를 선택해 주세요.
|
|
159
|
+
// </div>
|
|
160
|
+
// </div>
|
|
161
|
+
// `;
|
|
162
|
+
//
|
|
163
|
+
// const case3 = `
|
|
164
|
+
// <div style="display: flex; flex-direction: column; gap: 8px; padding: 20px 16px; font-size: 16px; line-height: 140%; letter-spacing: -4%; color: #000000;">
|
|
165
|
+
// <div style="font-weight: 400;">
|
|
166
|
+
// 아래 버튼을 클릭하시면 <span style="font-weight: 700; color: #AA1D36; line-height: 100%;">채팅 문의 외<br/>다른 방법</span>으로 빠르게 문의하실 수 있<br/>습니다.
|
|
167
|
+
// </div>
|
|
168
|
+
// </div>
|
|
169
|
+
// `;
|
|
170
|
+
//
|
|
171
|
+
// const case4 = `
|
|
172
|
+
// <div style="display: flex; flex-direction: column; gap: 8px; padding: 20px 16px; font-size: 16px; line-height: 140%; letter-spacing: -4%; color: #000000;">
|
|
173
|
+
// <div style="font-weight: 400;">
|
|
174
|
+
// 해당 사건에 <span style="font-weight: 700; color: #AA1D36; line-height: 100%;">특화된 전문변호사</span>가<br/>토 후 신속한 대응 전략을 제시합니<br/>다.
|
|
175
|
+
// </div>
|
|
176
|
+
// </div>
|
|
177
|
+
// `;
|
|
178
|
+
//
|
|
179
|
+
// //
|
|
180
|
+
// const case5 = `
|
|
181
|
+
// <div style="display: flex; flex-direction: column; gap: 8px; padding: 20px 16px; font-size: 16px; font-weight: 400; line-height: 140%; letter-spacing: -4%; color: #000000;">
|
|
182
|
+
// <div>
|
|
183
|
+
// 전화 상담을 이용하시면 가장 빠르게<br />관련 상담을 진행하실 수 있습니다.
|
|
184
|
+
// </div>
|
|
185
|
+
// <div>
|
|
186
|
+
// <span style="font-weight: 700; color: #AA1D36; ">T.</span> <span style="font-weight: 700; ">1800-7905</span>
|
|
187
|
+
// </div>
|
|
188
|
+
// </div>
|
|
189
|
+
// `;
|
|
190
|
+
// const case6 = `
|
|
191
|
+
// <div style="display: flex; flex-direction: column; gap: 8px; padding: 20px 16px; font-size: 16px; line-height: 140%; letter-spacing: -4%; color: #000000;">
|
|
192
|
+
// <div style="font-weight: 400;">
|
|
193
|
+
// <span style="font-weight: 700; color: #AA1D36; line-height: 100%;">AI대륜</span>과 함께하면 법률상담이 더<br />쉬워집니다!
|
|
194
|
+
// </div>
|
|
195
|
+
// <div>
|
|
196
|
+
// <span style="font-weight: 700; color: #AA1D36; line-height: 100%;">24시간 신속</span>하고
|
|
197
|
+
// <span style="font-weight: 700; color: #AA1D36; line-height: 100%;">정확한 법률 정보</span>를<br />제공받고, 변호사 상담까지 빠르게 진<br />행하세요.
|
|
198
|
+
// </div>
|
|
199
|
+
// </div>
|
|
200
|
+
// `;
|
|
201
|
+
//
|
|
202
|
+
// const case7 = `
|
|
203
|
+
// <div style="display: flex; flex-direction: column; gap: 8px; padding: 20px 16px; font-size: 16px; font-weight: 400; line-height: 140%; letter-spacing: -4%; color: #000000;">
|
|
204
|
+
// <div>
|
|
205
|
+
// 많은 고객님들께서 실제로 궁금해하<br />
|
|
206
|
+
// 셨던 질문을 정리해 두었습니다.
|
|
207
|
+
// </div>
|
|
208
|
+
// <div>
|
|
209
|
+
// 문의 전 확인하시면 더욱 빠르고<br />
|
|
210
|
+
// 정확한 안내가 가능합니다.
|
|
211
|
+
// </div>
|
|
212
|
+
// </div>
|
|
213
|
+
// `;
|
|
214
|
+
// const sanitizedHtml = DOMPurify.sanitize(case1);
|
|
215
|
+
|
|
9
216
|
return (
|
|
10
|
-
<div className={`h-auto overflow-hidden rounded-[10px] border-[1px] border-drTalkGrayscale4`}>
|
|
217
|
+
<div className={`flex h-auto flex-col overflow-hidden rounded-[10px] border-[1px] border-drTalkGrayscale4`}>
|
|
11
218
|
<Image
|
|
12
219
|
src={workFlowItem?.imageUrl || ''}
|
|
13
220
|
alt={''}
|
|
14
|
-
width={
|
|
221
|
+
width={500}
|
|
15
222
|
height={300}
|
|
16
223
|
className={`h-full w-full rounded-[10px] object-cover`}
|
|
17
224
|
unoptimized={true}
|
|
18
225
|
/>
|
|
226
|
+
{/*<div dangerouslySetInnerHTML={{ __html: sanitizedHtml }} />*/}
|
|
19
227
|
</div>
|
|
20
228
|
);
|
|
21
229
|
};
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import { hasBlocks, hasCustomerWorkFlowClickData, hasFileArray, hasForm, hasRichForm,
|
|
11
|
+
import { hasBlocks, hasCustomerWorkFlowClickData, hasFileArray, hasForm, hasRichForm, hasWorkFlow } from './_types/message';
|
|
12
12
|
import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
13
13
|
import { ObjectNumber, WorkFlowBackOrInit, WorkFlowButtonUiCode } from './_enums/work_flow_object_expose';
|
|
14
14
|
import { MessageSenderType } from './_enums/sender_type';
|
|
@@ -23,7 +23,7 @@ import ChatFile from './ChatItem/ChatFile';
|
|
|
23
23
|
import FieldWorkObject from './ChatObject/FieldWorkObject';
|
|
24
24
|
import TimeWrapper from './ChatItem/TimeWrapper';
|
|
25
25
|
import { InquiryStatus } from './_enums/ask-status';
|
|
26
|
-
const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, workFlowStack, isHovered, scrollEnd, inquiryStatus }) => {
|
|
26
|
+
const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, workFlowStack, isHovered, scrollEnd, inquiryStatus, isMobile }) => {
|
|
27
27
|
// 고객 , 오퍼레이터 분리
|
|
28
28
|
const isOperator = message.senderType !== MessageSenderType.CUSTOMER;
|
|
29
29
|
const formatTime = (date) => {
|
|
@@ -44,8 +44,10 @@ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, wor
|
|
|
44
44
|
* MSP00300202 워크플로우이미지+(텍스트) -> 워크플로우 메시지 템플릿 2
|
|
45
45
|
* MSP00300203 아이콘+텍스트 -> 워크플로우 메시지 템플릿 3
|
|
46
46
|
* MSP00300204 텍스트+폼 -> 워크플로우 메시지 템플릿 4
|
|
47
|
+
*
|
|
48
|
+
*
|
|
47
49
|
*/
|
|
48
|
-
const
|
|
50
|
+
const isWorkFlow = hasWorkFlow(message);
|
|
49
51
|
const isBlock = hasBlocks(message);
|
|
50
52
|
const isWorkFlowCustomerClickData = hasCustomerWorkFlowClickData(message);
|
|
51
53
|
const isAuthForm = hasForm(message);
|
|
@@ -63,19 +65,22 @@ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, wor
|
|
|
63
65
|
<ChatFile message={message} isOperator={isOperator} isHovered={isHovered} time={time}/>
|
|
64
66
|
</div>);
|
|
65
67
|
}
|
|
68
|
+
// 워크플로우 개인정보 인증 폼
|
|
66
69
|
if (isAuthForm) {
|
|
67
70
|
return (<TimeWrapper time={time}>
|
|
68
71
|
<WorkFlowAuthForm message={message} isOperator={isOperator}/>
|
|
69
72
|
</TimeWrapper>);
|
|
70
73
|
}
|
|
74
|
+
// 워크플로우 고객이 클릭한 내역
|
|
71
75
|
if (isWorkFlowCustomerClickData) {
|
|
72
76
|
return (<TimeWrapper time={time} timePosition={'left'}>
|
|
73
77
|
<WorkFlowClickData message={message}/>
|
|
74
78
|
</TimeWrapper>);
|
|
75
79
|
}
|
|
76
|
-
|
|
80
|
+
// 워크플로우 이미지 -> ( 이미지 + 텍스트 ) 로 잡힐 예정
|
|
81
|
+
if (isWorkFlow) {
|
|
77
82
|
return (<TimeWrapper time={time}>
|
|
78
|
-
<WorkFlowImg message={message}/>
|
|
83
|
+
<WorkFlowImg message={message} isOperator={isOperator} isMobile={isMobile}/>
|
|
79
84
|
</TimeWrapper>);
|
|
80
85
|
}
|
|
81
86
|
if (isRichForm) {
|
|
@@ -87,7 +92,7 @@ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, wor
|
|
|
87
92
|
}
|
|
88
93
|
return (<TimeWrapper time={time}>
|
|
89
94
|
<ChatWrapper isOperator={isOperator}>
|
|
90
|
-
<p className="dr_talk_body_medium2 whitespace-pre-line">{message.plainText}</p>
|
|
95
|
+
<p className="dr_talk_body_medium2 whitespace-pre-line">{message === null || message === void 0 ? void 0 : message.plainText}</p>
|
|
91
96
|
</ChatWrapper>
|
|
92
97
|
</TimeWrapper>);
|
|
93
98
|
};
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
hasFileArray,
|
|
6
6
|
hasForm,
|
|
7
7
|
hasRichForm,
|
|
8
|
-
|
|
8
|
+
hasWorkFlow,
|
|
9
9
|
Message
|
|
10
10
|
} from './_types/message';
|
|
11
11
|
import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
@@ -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;
|
|
@@ -72,9 +74,11 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
72
74
|
* MSP00300202 워크플로우이미지+(텍스트) -> 워크플로우 메시지 템플릿 2
|
|
73
75
|
* MSP00300203 아이콘+텍스트 -> 워크플로우 메시지 템플릿 3
|
|
74
76
|
* MSP00300204 텍스트+폼 -> 워크플로우 메시지 템플릿 4
|
|
77
|
+
*
|
|
78
|
+
*
|
|
75
79
|
*/
|
|
76
80
|
|
|
77
|
-
const
|
|
81
|
+
const isWorkFlow = hasWorkFlow(message);
|
|
78
82
|
const isBlock = hasBlocks(message);
|
|
79
83
|
const isWorkFlowCustomerClickData = hasCustomerWorkFlowClickData(message);
|
|
80
84
|
const isAuthForm = hasForm(message);
|
|
@@ -98,6 +102,7 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
98
102
|
);
|
|
99
103
|
}
|
|
100
104
|
|
|
105
|
+
// 워크플로우 개인정보 인증 폼
|
|
101
106
|
if (isAuthForm) {
|
|
102
107
|
return (
|
|
103
108
|
<TimeWrapper time={time}>
|
|
@@ -105,6 +110,7 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
105
110
|
</TimeWrapper>
|
|
106
111
|
);
|
|
107
112
|
}
|
|
113
|
+
// 워크플로우 고객이 클릭한 내역
|
|
108
114
|
if (isWorkFlowCustomerClickData) {
|
|
109
115
|
return (
|
|
110
116
|
<TimeWrapper time={time} timePosition={'left'}>
|
|
@@ -112,10 +118,12 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
112
118
|
</TimeWrapper>
|
|
113
119
|
);
|
|
114
120
|
}
|
|
115
|
-
|
|
121
|
+
|
|
122
|
+
// 워크플로우 이미지 -> ( 이미지 + 텍스트 ) 로 잡힐 예정
|
|
123
|
+
if (isWorkFlow) {
|
|
116
124
|
return (
|
|
117
125
|
<TimeWrapper time={time}>
|
|
118
|
-
<WorkFlowImg message={message} />
|
|
126
|
+
<WorkFlowImg message={message} isOperator={isOperator} isMobile={isMobile} />
|
|
119
127
|
</TimeWrapper>
|
|
120
128
|
);
|
|
121
129
|
}
|
|
@@ -132,7 +140,7 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
132
140
|
return (
|
|
133
141
|
<TimeWrapper time={time}>
|
|
134
142
|
<ChatWrapper isOperator={isOperator}>
|
|
135
|
-
<p className="dr_talk_body_medium2 whitespace-pre-line">{message
|
|
143
|
+
<p className="dr_talk_body_medium2 whitespace-pre-line">{message?.plainText}</p>
|
|
136
144
|
</ChatWrapper>
|
|
137
145
|
</TimeWrapper>
|
|
138
146
|
);
|
|
@@ -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}
|
|
@@ -9,7 +9,6 @@ import ShadowBox from './_ui/ShadowBox';
|
|
|
9
9
|
import CloseSvgIcon from '../../asset/images/daeryuntalk/close.svg';
|
|
10
10
|
import { formatTimestamp } from './_lib/utils';
|
|
11
11
|
const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthenticated, historyLit, goGetHistoryList, isMobile, onClose, isHash, handleGoRequestPhone, handleGoHistoryPhoneAuth }) => {
|
|
12
|
-
var _a;
|
|
13
12
|
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
|
|
14
13
|
useEffect(() => {
|
|
15
14
|
checkScroll();
|
|
@@ -39,7 +38,7 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
|
|
|
39
38
|
{/* 스크롤 가능한 컨텐츠 영역 */}
|
|
40
39
|
<div className="relative w-full flex-1 overflow-hidden">
|
|
41
40
|
<div ref={containerRef} className="no-scrollbar h-full overflow-y-auto px-[20px] pb-[20px] pt-[24px]">
|
|
42
|
-
{hasHistories ? (
|
|
41
|
+
{hasHistories ? (historyLit.map((history, index) => (<div key={`${history.chat_inquiry_number}-${index}`} className="cursor-pointer border-b border-drTalkGrayscale4 px-[12px] py-[18px] hover:bg-gray-50" onClick={() => onChatHistoryClick(history.chat_inquiry_number)}>
|
|
43
42
|
<div className="flex items-center justify-between">
|
|
44
43
|
<div className={`flex flex-row items-center gap-[10px]`}>
|
|
45
44
|
<span className="dr_talk_subtitle_medium">{history.customer_name}</span>
|
|
@@ -90,7 +90,7 @@ const HistoryView: React.FC<HistoryViewProps> = ({
|
|
|
90
90
|
className="no-scrollbar h-full overflow-y-auto px-[20px] pb-[20px] pt-[24px]"
|
|
91
91
|
>
|
|
92
92
|
{hasHistories ? (
|
|
93
|
-
historyLit.
|
|
93
|
+
historyLit.map((history, index) => (
|
|
94
94
|
<div
|
|
95
95
|
key={`${history.chat_inquiry_number}-${index}`}
|
|
96
96
|
className="cursor-pointer border-b border-drTalkGrayscale4 px-[12px] py-[18px] hover:bg-gray-50"
|
|
@@ -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>
|