@daeryun/dr_components 0.7.79 → 0.7.80
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/download.svg +5 -0
- package/dist/asset/images/daeryuntalk/firstGo.svg +5 -0
- package/dist/asset/images/daeryuntalk/objectBack.svg +4 -0
- package/dist/asset/images/daeryuntalk/viewer/close.svg +4 -0
- package/dist/asset/images/daeryuntalk/viewer/gray-download.svg +7 -0
- package/dist/asset/images/daeryuntalk/viewer/move-button.svg +4 -0
- package/dist/asset/images/daeryuntalk/viewer/rotate.svg +17 -0
- package/dist/asset/images/daeryuntalk/viewer/zoom-in.svg +5 -0
- package/dist/asset/images/daeryuntalk/viewer/zoom-out.svg +6 -0
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatButton.jsx +1 -0
- package/dist/components/Daeryuntalk/ChatButton.tsx +1 -0
- package/dist/components/Daeryuntalk/ChatConversation.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatConversation.jsx +19 -12
- package/dist/components/Daeryuntalk/ChatConversation.tsx +48 -11
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +27 -6
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +39 -8
- package/dist/components/Daeryuntalk/ChatInput.jsx +23 -3
- package/dist/components/Daeryuntalk/ChatInput.tsx +26 -10
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.d.ts +10 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +186 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +252 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.d.ts +8 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.jsx +87 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.tsx +115 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.d.ts +8 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.jsx +13 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.tsx +25 -0
- package/dist/components/Daeryuntalk/ChatItem/RichText.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatItem/RichText.jsx +25 -0
- package/dist/components/Daeryuntalk/ChatItem/RichText.tsx +32 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowAuthForm.d.ts +8 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowAuthForm.jsx +19 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowAuthForm.tsx +31 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.jsx +20 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.tsx +36 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +9 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +16 -0
- package/dist/components/Daeryuntalk/ChatMessage.d.ts +11 -1
- package/dist/components/Daeryuntalk/ChatMessage.jsx +116 -14
- package/dist/components/Daeryuntalk/ChatMessage.tsx +175 -20
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.jsx +16 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.tsx +28 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.d.ts +10 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.jsx +118 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.tsx +162 -0
- package/dist/components/Daeryuntalk/ChatWidget.jsx +7 -3
- package/dist/components/Daeryuntalk/ChatWidget.tsx +9 -5
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +37 -5
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +71 -157
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +128 -189
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.d.ts +17 -0
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +57 -0
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +82 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.d.ts +3 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.jsx +172 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.tsx +236 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +133 -0
- package/dist/{lib/api → components/Daeryuntalk/_api}/daeryuntalk/index.js +251 -46
- package/dist/{lib/api → components/Daeryuntalk/_api}/daeryuntalk/index.ts +353 -129
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.d.ts +115 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.js +1 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.ts +135 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.d.ts +6 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.js +11 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.ts +11 -0
- package/dist/components/Daeryuntalk/_enums/message_type.d.ts +6 -0
- package/dist/components/Daeryuntalk/_enums/message_type.js +13 -0
- package/dist/components/Daeryuntalk/_enums/message_type.ts +13 -0
- package/dist/components/Daeryuntalk/_enums/sender_type.d.ts +8 -0
- package/dist/components/Daeryuntalk/_enums/sender_type.js +16 -0
- package/dist/components/Daeryuntalk/_enums/sender_type.ts +16 -0
- package/dist/components/Daeryuntalk/_enums/socket_type.d.ts +22 -0
- package/dist/components/Daeryuntalk/_enums/socket_type.js +23 -0
- package/dist/components/Daeryuntalk/_enums/socket_type.ts +31 -0
- package/dist/components/Daeryuntalk/_enums/template.d.ts +32 -0
- package/dist/components/Daeryuntalk/_enums/template.js +49 -0
- package/dist/components/Daeryuntalk/_enums/template.ts +53 -0
- package/dist/components/Daeryuntalk/_enums/work_flow_object_expose.d.ts +34 -0
- package/dist/components/Daeryuntalk/_enums/work_flow_object_expose.js +66 -0
- package/dist/components/Daeryuntalk/_enums/work_flow_object_expose.ts +69 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.d.ts +46 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +296 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +364 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHistory.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHistory.js +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHistory.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.js +22 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.ts +30 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +21 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +205 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +240 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useViewerHook.d.ts +8 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useViewerHook.js +18 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useViewerHook.ts +23 -0
- package/dist/components/Daeryuntalk/_lib/index.d.ts +7 -0
- package/dist/components/Daeryuntalk/_lib/index.js +101 -0
- package/dist/components/Daeryuntalk/_lib/index.ts +137 -0
- package/dist/components/Daeryuntalk/_lib/utils.d.ts +2 -0
- package/dist/components/Daeryuntalk/_lib/utils.js +16 -0
- package/dist/components/Daeryuntalk/_lib/utils.ts +17 -0
- package/dist/components/Daeryuntalk/{types.d.ts → _types/message.d.ts} +33 -17
- package/dist/components/Daeryuntalk/_types/message.js +19 -0
- package/dist/components/Daeryuntalk/{types.ts → _types/message.ts} +64 -19
- package/dist/components/Daeryuntalk/_types/message_object.d.ts +16 -0
- package/dist/components/Daeryuntalk/_types/message_object.js +1 -0
- package/dist/components/Daeryuntalk/_types/message_object.ts +20 -0
- package/dist/components/Daeryuntalk/_types/socket/message.d.ts +0 -0
- package/dist/components/Daeryuntalk/_types/socket/message.js +1 -0
- package/dist/components/Daeryuntalk/_types/socket/message.ts +0 -0
- package/dist/components/Daeryuntalk/_types/socket/workflow.d.ts +15 -0
- package/dist/components/Daeryuntalk/_types/socket/workflow.js +1 -0
- package/dist/components/Daeryuntalk/_types/socket/workflow.ts +15 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button1.d.ts +10 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button1.jsx +11 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button1.tsx +28 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input1.d.ts +12 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input1.jsx +9 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input1.tsx +39 -0
- package/dist/components/Daeryuntalk/index.tsx +1 -0
- package/dist/lib/categoryMenuName.js +0 -3
- package/dist/lib/categoryMenuName.ts +0 -2
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.ts +1 -1
- package/dist/styles/globals.css +161 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -2
- package/dist/components/Daeryuntalk/types.js +0 -8
- package/dist/lib/api/daeryuntalk/index.d.ts +0 -143
- /package/dist/{lib/api → components/Daeryuntalk/_api}/index.d.ts +0 -0
- /package/dist/{lib/api → components/Daeryuntalk/_api}/index.js +0 -0
- /package/dist/{lib/api → components/Daeryuntalk/_api}/index.ts +0 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { FileInfo, Message } from '../_types/message';
|
|
3
|
+
import Image from 'next/image';
|
|
4
|
+
import { formatFileSize } from '../_lib/utils';
|
|
5
|
+
import FileDownLoadIcon from '../../../asset/images/daeryuntalk/viewer/gray-download.svg';
|
|
6
|
+
import { useDaeryuntalk } from '../DaeryuntalkContext';
|
|
7
|
+
import { getMessageFileDownloadUrl } from '../_api';
|
|
8
|
+
interface props {
|
|
9
|
+
message: Message;
|
|
10
|
+
isOperator: boolean;
|
|
11
|
+
isHovered: boolean;
|
|
12
|
+
time: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
|
|
16
|
+
const { openImageViewer } = useDaeryuntalk();
|
|
17
|
+
|
|
18
|
+
const handleDownload = async (file: FileInfo) => {
|
|
19
|
+
try {
|
|
20
|
+
const res = await getMessageFileDownloadUrl({
|
|
21
|
+
chatInquiryNumber: message.inquiryNumber || '',
|
|
22
|
+
fileNumber: file.fileNumber
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const filePath = res.data.url;
|
|
26
|
+
const response = await fetch(filePath);
|
|
27
|
+
const blob = await response.blob();
|
|
28
|
+
|
|
29
|
+
const url = window.URL.createObjectURL(blob);
|
|
30
|
+
const link = document.createElement('a');
|
|
31
|
+
link.href = url;
|
|
32
|
+
link.download = file.name;
|
|
33
|
+
document.body.appendChild(link);
|
|
34
|
+
link.click();
|
|
35
|
+
window.URL.revokeObjectURL(url);
|
|
36
|
+
document.body.removeChild(link);
|
|
37
|
+
} catch (err) {
|
|
38
|
+
console.error('다운로드 URL 요청 실패:', err);
|
|
39
|
+
// 사용자에게 알림 또는 토스트 표시 등을 추가할 수 있습니다.
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const renderMediaContent = () => {
|
|
43
|
+
const images = message.files
|
|
44
|
+
? message.files.filter(file => file.type === 'image').sort((a, b) => a.sequence - b.sequence)
|
|
45
|
+
: [];
|
|
46
|
+
const files = message.files
|
|
47
|
+
? message.files.filter(file => file.type !== 'image').sort((a, b) => a.sequence - b.sequence)
|
|
48
|
+
: [];
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className={`flex flex-col gap-3`}>
|
|
52
|
+
{images.length > 0 && renderMedia({ type: 'image', images })}
|
|
53
|
+
{files.length > 0 && renderMedia({ type: 'file', files })}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const renderMedia = (media: { type: 'image'; images: FileInfo[] } | { type: 'file'; files: FileInfo[] }) => {
|
|
59
|
+
if (media.type === 'image') {
|
|
60
|
+
return (
|
|
61
|
+
<div className={`flex w-full items-end justify-start gap-[4px]`}>
|
|
62
|
+
{media.images.length > 1 ? (
|
|
63
|
+
<div className={`flex flex-col`}>
|
|
64
|
+
{/* grid로 감싸진 짝수 개수 또는 홀수에서 마지막 전까지 */}
|
|
65
|
+
<div className="grid grid-cols-2 gap-2 rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]">
|
|
66
|
+
{media.images.map((file, index) => {
|
|
67
|
+
const isLastOdd =
|
|
68
|
+
media.images.length % 2 === 1 && index === media.images.length - 1;
|
|
69
|
+
if (isLastOdd) return null;
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div
|
|
73
|
+
key={index}
|
|
74
|
+
className="group/image relative aspect-square h-[100px] w-[113px] overflow-hidden rounded-[5px]"
|
|
75
|
+
onClick={() => {
|
|
76
|
+
if (media.type === 'image') {
|
|
77
|
+
openImageViewer?.(media.images[media.images.length - 1], message);
|
|
78
|
+
}
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<Image
|
|
82
|
+
src={file.thumbnailUrl}
|
|
83
|
+
alt={file.name}
|
|
84
|
+
width={113}
|
|
85
|
+
height={100}
|
|
86
|
+
className="h-full w-full cursor-pointer rounded-md object-cover"
|
|
87
|
+
onClick={() => {}}
|
|
88
|
+
/>
|
|
89
|
+
<button
|
|
90
|
+
onClick={async e => {
|
|
91
|
+
e.stopPropagation();
|
|
92
|
+
await handleDownload(file);
|
|
93
|
+
}}
|
|
94
|
+
className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full"
|
|
95
|
+
>
|
|
96
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />
|
|
97
|
+
</button>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
})}
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
{/* 홀수 개수일 때 마지막 하나는 별도로 */}
|
|
104
|
+
{media.images.length % 2 === 1 && (
|
|
105
|
+
<div
|
|
106
|
+
className="mt-2 rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]"
|
|
107
|
+
onClick={() => {
|
|
108
|
+
if (media.type === 'image') {
|
|
109
|
+
openImageViewer?.(media.images[media.images.length - 1], message);
|
|
110
|
+
}
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<div className="group/image relative h-[100px] w-[100%] overflow-hidden rounded-[5px]">
|
|
114
|
+
<Image
|
|
115
|
+
src={media.images[media.images.length - 1].thumbnailUrl}
|
|
116
|
+
alt={media.images[media.images.length - 1].name}
|
|
117
|
+
width={160}
|
|
118
|
+
height={100}
|
|
119
|
+
className="h-full w-full cursor-pointer rounded-md object-cover"
|
|
120
|
+
onClick={() => {}}
|
|
121
|
+
/>
|
|
122
|
+
<button
|
|
123
|
+
onClick={async e => {
|
|
124
|
+
e.stopPropagation();
|
|
125
|
+
if (media.type === 'image') {
|
|
126
|
+
await handleDownload(media.images[media.images.length - 1]);
|
|
127
|
+
}
|
|
128
|
+
}}
|
|
129
|
+
className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full"
|
|
130
|
+
>
|
|
131
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full text-[#777777] " />
|
|
132
|
+
</button>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
)}
|
|
136
|
+
</div>
|
|
137
|
+
) : (
|
|
138
|
+
// 이미지 1장일 경우 (grid 없이 단독)
|
|
139
|
+
<div
|
|
140
|
+
className="rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]"
|
|
141
|
+
onClick={() => {
|
|
142
|
+
if (media.type === 'image') {
|
|
143
|
+
openImageViewer && openImageViewer(media.images[0], message);
|
|
144
|
+
}
|
|
145
|
+
}}
|
|
146
|
+
>
|
|
147
|
+
<div className="group/image relative h-[100px] w-[160px] overflow-hidden rounded-[5px]">
|
|
148
|
+
<Image
|
|
149
|
+
src={media.images[0].thumbnailUrl}
|
|
150
|
+
alt={media.images[0].name}
|
|
151
|
+
width={160}
|
|
152
|
+
height={100}
|
|
153
|
+
className="h-full w-full cursor-pointer rounded-md object-cover"
|
|
154
|
+
onClick={() => {}}
|
|
155
|
+
/>
|
|
156
|
+
<button
|
|
157
|
+
onClick={async e => {
|
|
158
|
+
e.stopPropagation();
|
|
159
|
+
if (media.type === 'image') {
|
|
160
|
+
await handleDownload(media.images[0]);
|
|
161
|
+
}
|
|
162
|
+
}}
|
|
163
|
+
className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full"
|
|
164
|
+
>
|
|
165
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />
|
|
166
|
+
</button>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
{/*<div*/}
|
|
171
|
+
{/* className={`*/}
|
|
172
|
+
{/* grid rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]*/}
|
|
173
|
+
{/* ${media.images.length > 1 ? 'grid-cols-2 gap-2' : ''}*/}
|
|
174
|
+
{/*`}*/}
|
|
175
|
+
{/*>*/}
|
|
176
|
+
{/* {media.images.map((file, index) => (*/}
|
|
177
|
+
{/* <div*/}
|
|
178
|
+
{/* key={index}*/}
|
|
179
|
+
{/* className={`group/image relative overflow-hidden rounded-[5px] */}
|
|
180
|
+
{/* ${media.images.length > 1 ? 'aspect-square w-[120px]' : 'aspect-auto h-[100px] w-[160px]'} `}*/}
|
|
181
|
+
{/* >*/}
|
|
182
|
+
{/* <Image*/}
|
|
183
|
+
{/* src={file.thumbnailUrl}*/}
|
|
184
|
+
{/* alt={file.name}*/}
|
|
185
|
+
{/* width={media.images.length > 1 ? 113 : 160}*/}
|
|
186
|
+
{/* height={media.images.length > 1 ? 100 : 100}*/}
|
|
187
|
+
{/* className={`h-full w-full cursor-pointer rounded-md object-cover `}*/}
|
|
188
|
+
{/* onClick={() => {}}*/}
|
|
189
|
+
{/* />*/}
|
|
190
|
+
{/* <button*/}
|
|
191
|
+
{/* onClick={e => {*/}
|
|
192
|
+
{/* e.stopPropagation();*/}
|
|
193
|
+
{/* }}*/}
|
|
194
|
+
{/* className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full"*/}
|
|
195
|
+
{/* >*/}
|
|
196
|
+
{/* <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />*/}
|
|
197
|
+
{/* </button>*/}
|
|
198
|
+
{/* </div>*/}
|
|
199
|
+
{/* ))}*/}
|
|
200
|
+
{/*</div>*/}
|
|
201
|
+
<div className={`text-[12px] font-[400] text-[#C2C2C2]`}>{time}</div>
|
|
202
|
+
</div>
|
|
203
|
+
);
|
|
204
|
+
} else if (media.type === 'file') {
|
|
205
|
+
return (
|
|
206
|
+
<div className={`flex w-fit items-end gap-[4px]`}>
|
|
207
|
+
<div className="flex w-full flex-col gap-[10px] ">
|
|
208
|
+
{media.files.map((file, index) => {
|
|
209
|
+
const fileExtension = file.name.split('.').pop() || '';
|
|
210
|
+
const baseName = file.name.replace(`.${fileExtension}`, '');
|
|
211
|
+
|
|
212
|
+
const truncatedName = baseName.length > 12 ? `${baseName.slice(0, 12)}…` : baseName;
|
|
213
|
+
|
|
214
|
+
const fileName = `${truncatedName}.${fileExtension}`;
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<div key={index} className={`flex w-full items-end justify-start gap-[4px]`}>
|
|
218
|
+
<div
|
|
219
|
+
key={index}
|
|
220
|
+
className={`
|
|
221
|
+
flex items-center justify-between gap-[16px]
|
|
222
|
+
rounded-[10px] border-[1px] border-[#EDEDED] p-[12px]
|
|
223
|
+
`}
|
|
224
|
+
>
|
|
225
|
+
<div className="flex flex-col gap-[4px] ">
|
|
226
|
+
<span className={`text-[14px] font-[400] `}>{fileName}</span>
|
|
227
|
+
<span className="flex items-center gap-[10px] text-[12px] text-[#777777]">
|
|
228
|
+
{formatFileSize(file.size)} | {file.name.split('.').pop()}
|
|
229
|
+
</span>
|
|
230
|
+
</div>
|
|
231
|
+
<button onClick={() => {}} className="">
|
|
232
|
+
<FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />
|
|
233
|
+
</button>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
);
|
|
237
|
+
})}
|
|
238
|
+
</div>
|
|
239
|
+
<div className={`text-[12px] font-[400] text-[#C2C2C2]`}>{time}</div>
|
|
240
|
+
</div>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
return null;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
if (!message.files) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
return <>{renderMediaContent()}</>;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
export default ChatFile;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Message } from '../_types/message';
|
|
3
|
+
interface props {
|
|
4
|
+
message: Message;
|
|
5
|
+
isOperator: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const ChatPrivacyAuth: ({ message, isOperator }: props) => React.JSX.Element | undefined;
|
|
8
|
+
export default ChatPrivacyAuth;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import React, { useState } from 'react';
|
|
11
|
+
import ChatWrapper from './ChatWrapper';
|
|
12
|
+
import Input1 from '../_ui/inputs/Input1';
|
|
13
|
+
import { useDaeryuntalk } from '../DaeryuntalkContext';
|
|
14
|
+
import Button1 from '../_ui/buttons/Button1';
|
|
15
|
+
// 채팅문의 번호 인증
|
|
16
|
+
const ChatPrivacyAuth = ({ message, isOperator }) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const { chatUserUpdate, chatInquiryNumber } = useDaeryuntalk();
|
|
19
|
+
const formData = (_a = message === null || message === void 0 ? void 0 : message.form) !== null && _a !== void 0 ? _a : null;
|
|
20
|
+
const [authObject, setAuthObject] = useState({
|
|
21
|
+
name: '',
|
|
22
|
+
cell_phone_number: ''
|
|
23
|
+
});
|
|
24
|
+
const [isModify, setIsModify] = useState(false);
|
|
25
|
+
const handleInput = (e) => {
|
|
26
|
+
const { name, value } = e.currentTarget;
|
|
27
|
+
setAuthObject(prev => {
|
|
28
|
+
return Object.assign(Object.assign({}, prev), { [name]: value });
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const update = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
yield chatUserUpdate({
|
|
33
|
+
chatInquiryNumber: chatInquiryNumber || '',
|
|
34
|
+
cellPhoneNumber: authObject.cell_phone_number || '',
|
|
35
|
+
name: authObject.name || '',
|
|
36
|
+
messageNumber: (message === null || message === void 0 ? void 0 : message.messageNumber) || ''
|
|
37
|
+
});
|
|
38
|
+
setIsModify(false);
|
|
39
|
+
});
|
|
40
|
+
const goModify = () => {
|
|
41
|
+
setIsModify(true);
|
|
42
|
+
};
|
|
43
|
+
if (!formData) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const renderSetAuth = () => (<div className="flex flex-col gap-[16px]">
|
|
47
|
+
{formData.inputs.map((item, index) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
return (<div className="flex flex-col gap-[8px]" key={index}>
|
|
50
|
+
<p className="text-[14px] font-[700] leading-[100%] tracking-[-4%]">{item.label}</p>
|
|
51
|
+
<Input1 onChange={handleInput} value={(_a = authObject[item.bindingKey]) !== null && _a !== void 0 ? _a : ''} type={item.type} name={item.bindingKey || ''} readOnly={isModify ? false : ((_b = item.readOnly) !== null && _b !== void 0 ? _b : false)}/>
|
|
52
|
+
</div>);
|
|
53
|
+
})}
|
|
54
|
+
<Button1 type="button" onClick={update}>
|
|
55
|
+
저장
|
|
56
|
+
</Button1>
|
|
57
|
+
</div>);
|
|
58
|
+
return (<ChatWrapper isOperator={isOperator}>
|
|
59
|
+
{/* 최초 요청 시 */}
|
|
60
|
+
{!formData.submittedAt && renderSetAuth()}
|
|
61
|
+
{/* 회원 정보 보여주기 */}
|
|
62
|
+
{formData.submittedAt && !isModify && (<div className={`flex flex-col gap-[16px]`}>
|
|
63
|
+
<div className={`flex flex-col`}>
|
|
64
|
+
{formData.inputs.map((input, index) => {
|
|
65
|
+
return (<div className={`flex flex-col ${index === 0 ? ' border-b-[1px] border-solid border-b-[#EDEDED] pb-[10px] ' : ' mt-[10px] '} `} key={`sub-not-modify-${index}`}>
|
|
66
|
+
<div className={`flex h-[28px] items-center text-[14px] font-[700] leading-[100%] tracking-[-4%] `}>
|
|
67
|
+
{input.label}
|
|
68
|
+
</div>
|
|
69
|
+
<div className={`flex h-[28px] items-center text-[16px] font-[400] leading-[140%] tracking-[-4%] `}>
|
|
70
|
+
{input.value}
|
|
71
|
+
</div>
|
|
72
|
+
</div>);
|
|
73
|
+
})}
|
|
74
|
+
</div>
|
|
75
|
+
<Button1 type={'button'} onClick={goModify}>
|
|
76
|
+
정보수정
|
|
77
|
+
</Button1>
|
|
78
|
+
<div className="w-full whitespace-normal break-all font-[400] leading-[140%] tracking-[-4%]">
|
|
79
|
+
정보가 다를 경우 <b className="font-[700] underline">회원정보 수정페이지</b>에서 변경해주세요.
|
|
80
|
+
</div>
|
|
81
|
+
</div>)}
|
|
82
|
+
|
|
83
|
+
{/* 회원 정보 수정 */}
|
|
84
|
+
{formData.submittedAt && isModify && renderSetAuth()}
|
|
85
|
+
</ChatWrapper>);
|
|
86
|
+
};
|
|
87
|
+
export default ChatPrivacyAuth;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React, { FormEvent, useState } from 'react';
|
|
2
|
+
import ChatWrapper from './ChatWrapper';
|
|
3
|
+
import { Form, Message } from '../_types/message';
|
|
4
|
+
import Input1 from '../_ui/inputs/Input1';
|
|
5
|
+
import { useDaeryuntalk } from '../DaeryuntalkContext';
|
|
6
|
+
import Button1 from '../_ui/buttons/Button1';
|
|
7
|
+
|
|
8
|
+
interface props {
|
|
9
|
+
message: Message;
|
|
10
|
+
isOperator: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// 채팅문의 번호 인증
|
|
14
|
+
const ChatPrivacyAuth = ({ message, isOperator }: props) => {
|
|
15
|
+
const { chatUserUpdate, chatInquiryNumber } = useDaeryuntalk();
|
|
16
|
+
const formData: Form | null = message?.form ?? null;
|
|
17
|
+
const [authObject, setAuthObject] = useState({
|
|
18
|
+
name: '',
|
|
19
|
+
cell_phone_number: ''
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const [isModify, setIsModify] = useState<boolean>(false);
|
|
23
|
+
|
|
24
|
+
const handleInput = (e: FormEvent<HTMLInputElement>) => {
|
|
25
|
+
const { name, value } = e.currentTarget;
|
|
26
|
+
setAuthObject(prev => {
|
|
27
|
+
return {
|
|
28
|
+
...prev,
|
|
29
|
+
[name]: value
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const update = async () => {
|
|
35
|
+
await chatUserUpdate({
|
|
36
|
+
chatInquiryNumber: chatInquiryNumber || '',
|
|
37
|
+
cellPhoneNumber: authObject.cell_phone_number || '',
|
|
38
|
+
name: authObject.name || '',
|
|
39
|
+
messageNumber: message?.messageNumber || ''
|
|
40
|
+
});
|
|
41
|
+
setIsModify(false);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const goModify = () => {
|
|
45
|
+
setIsModify(true);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (!formData) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const renderSetAuth = () => (
|
|
53
|
+
<div className="flex flex-col gap-[16px]">
|
|
54
|
+
{formData.inputs.map((item, index) => (
|
|
55
|
+
<div className="flex flex-col gap-[8px]" key={index}>
|
|
56
|
+
<p className="text-[14px] font-[700] leading-[100%] tracking-[-4%]">{item.label}</p>
|
|
57
|
+
<Input1
|
|
58
|
+
onChange={handleInput}
|
|
59
|
+
value={authObject[item.bindingKey as keyof typeof authObject] ?? ''}
|
|
60
|
+
type={item.type}
|
|
61
|
+
name={item.bindingKey || ''}
|
|
62
|
+
readOnly={isModify ? false : (item.readOnly ?? false)}
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
))}
|
|
66
|
+
<Button1 type="button" onClick={update}>
|
|
67
|
+
저장
|
|
68
|
+
</Button1>
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<ChatWrapper isOperator={isOperator}>
|
|
74
|
+
{/* 최초 요청 시 */}
|
|
75
|
+
{!formData.submittedAt && renderSetAuth()}
|
|
76
|
+
{/* 회원 정보 보여주기 */}
|
|
77
|
+
{formData.submittedAt && !isModify && (
|
|
78
|
+
<div className={`flex flex-col gap-[16px]`}>
|
|
79
|
+
<div className={`flex flex-col`}>
|
|
80
|
+
{formData.inputs.map((input, index) => {
|
|
81
|
+
return (
|
|
82
|
+
<div
|
|
83
|
+
className={`flex flex-col ${index === 0 ? ' border-b-[1px] border-solid border-b-[#EDEDED] pb-[10px] ' : ' mt-[10px] '} `}
|
|
84
|
+
key={`sub-not-modify-${index}`}
|
|
85
|
+
>
|
|
86
|
+
<div
|
|
87
|
+
className={`flex h-[28px] items-center text-[14px] font-[700] leading-[100%] tracking-[-4%] `}
|
|
88
|
+
>
|
|
89
|
+
{input.label}
|
|
90
|
+
</div>
|
|
91
|
+
<div
|
|
92
|
+
className={`flex h-[28px] items-center text-[16px] font-[400] leading-[140%] tracking-[-4%] `}
|
|
93
|
+
>
|
|
94
|
+
{input.value}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
})}
|
|
99
|
+
</div>
|
|
100
|
+
<Button1 type={'button'} onClick={goModify}>
|
|
101
|
+
정보수정
|
|
102
|
+
</Button1>
|
|
103
|
+
<div className="w-full whitespace-normal break-all font-[400] leading-[140%] tracking-[-4%]">
|
|
104
|
+
정보가 다를 경우 <b className="font-[700] underline">회원정보 수정페이지</b>에서 변경해주세요.
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
)}
|
|
108
|
+
|
|
109
|
+
{/* 회원 정보 수정 */}
|
|
110
|
+
{formData.submittedAt && isModify && renderSetAuth()}
|
|
111
|
+
</ChatWrapper>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export default ChatPrivacyAuth;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
const ChatWrapper = ({ isOperator, children, className = '' }) => {
|
|
3
|
+
const operatorClassName = 'border-[#EDEDED] text-black';
|
|
4
|
+
const customerClassName = 'border-[#2E385B] text-[#2E385B] bg-[#F7F7F7]';
|
|
5
|
+
return (<div className={`
|
|
6
|
+
${isOperator ? operatorClassName : customerClassName} ${className}
|
|
7
|
+
whitespace-pre-line rounded-[10px] border px-[12px]
|
|
8
|
+
py-[16px] text-[14px] leading-[130%] tracking-[-4%]
|
|
9
|
+
`}>
|
|
10
|
+
{children}
|
|
11
|
+
</div>);
|
|
12
|
+
};
|
|
13
|
+
export default ChatWrapper;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface props {
|
|
4
|
+
isOperator: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
const ChatWrapper = ({ isOperator, children, className = '' }: props) => {
|
|
9
|
+
const operatorClassName = 'border-[#EDEDED] text-black';
|
|
10
|
+
const customerClassName = 'border-[#2E385B] text-[#2E385B] bg-[#F7F7F7]';
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
className={`
|
|
15
|
+
${isOperator ? operatorClassName : customerClassName} ${className}
|
|
16
|
+
whitespace-pre-line rounded-[10px] border px-[12px]
|
|
17
|
+
py-[16px] text-[14px] leading-[130%] tracking-[-4%]
|
|
18
|
+
`}
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default ChatWrapper;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EditorContent, useEditor } from '@tiptap/react';
|
|
3
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
4
|
+
import Image from '@tiptap/extension-image';
|
|
5
|
+
import Color from '@tiptap/extension-color';
|
|
6
|
+
import Link from '@tiptap/extension-link';
|
|
7
|
+
import TextStyle from '@tiptap/extension-text-style';
|
|
8
|
+
const RichText = ({ message }) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const editor = useEditor({
|
|
11
|
+
extensions: [
|
|
12
|
+
StarterKit,
|
|
13
|
+
Image,
|
|
14
|
+
Link.configure({ openOnClick: true }),
|
|
15
|
+
TextStyle,
|
|
16
|
+
Color.configure({
|
|
17
|
+
types: ['textStyle']
|
|
18
|
+
})
|
|
19
|
+
],
|
|
20
|
+
content: (_a = message.richText) === null || _a === void 0 ? void 0 : _a.structuredData,
|
|
21
|
+
editable: false
|
|
22
|
+
});
|
|
23
|
+
return <EditorContent editor={editor}/>;
|
|
24
|
+
};
|
|
25
|
+
export default RichText;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Message } from '../_types/message';
|
|
3
|
+
import { EditorContent, useEditor } from '@tiptap/react';
|
|
4
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
5
|
+
import Image from '@tiptap/extension-image';
|
|
6
|
+
import Color from '@tiptap/extension-color';
|
|
7
|
+
import Link from '@tiptap/extension-link';
|
|
8
|
+
import TextStyle from '@tiptap/extension-text-style';
|
|
9
|
+
import ChatWrapper from './ChatWrapper';
|
|
10
|
+
|
|
11
|
+
interface props {
|
|
12
|
+
message: Message;
|
|
13
|
+
}
|
|
14
|
+
const RichText = ({ message }: props) => {
|
|
15
|
+
const editor = useEditor({
|
|
16
|
+
extensions: [
|
|
17
|
+
StarterKit,
|
|
18
|
+
Image,
|
|
19
|
+
Link.configure({ openOnClick: true }),
|
|
20
|
+
TextStyle,
|
|
21
|
+
Color.configure({
|
|
22
|
+
types: ['textStyle']
|
|
23
|
+
})
|
|
24
|
+
],
|
|
25
|
+
content: message.richText?.structuredData,
|
|
26
|
+
editable: false
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return <EditorContent editor={editor} />;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default RichText;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Message } from '../_types/message';
|
|
3
|
+
interface props {
|
|
4
|
+
message: Message;
|
|
5
|
+
isOperator: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const WorkFlowAuthForm: ({ message, isOperator }: props) => React.JSX.Element | null;
|
|
8
|
+
export default WorkFlowAuthForm;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ChatWrapper from './ChatWrapper';
|
|
3
|
+
import ChatPrivacyAuth from './ChatPrivacyAuth';
|
|
4
|
+
const WorkFlowAuthForm = ({ message, isOperator }) => {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
const formData = (_a = message === null || message === void 0 ? void 0 : message.form) !== null && _a !== void 0 ? _a : null;
|
|
7
|
+
if (!formData) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return (<div className={`flex flex-col gap-[10px]`}>
|
|
11
|
+
{message.blocks && ((_b = message.blocks) === null || _b === void 0 ? void 0 : _b.length) > 0 && (<ChatWrapper isOperator={isOperator}>
|
|
12
|
+
{message.blocks
|
|
13
|
+
.filter(fil => fil.type === 'text')
|
|
14
|
+
.map((item, index) => (<p key={index}>{item.value}</p>))}
|
|
15
|
+
</ChatWrapper>)}
|
|
16
|
+
{formData.type === '개인정보수집' && <ChatPrivacyAuth isOperator={isOperator} message={message}/>}
|
|
17
|
+
</div>);
|
|
18
|
+
};
|
|
19
|
+
export default WorkFlowAuthForm;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Message } from '../_types/message';
|
|
3
|
+
import ChatWrapper from './ChatWrapper';
|
|
4
|
+
import ChatPrivacyAuth from './ChatPrivacyAuth';
|
|
5
|
+
|
|
6
|
+
interface props {
|
|
7
|
+
message: Message;
|
|
8
|
+
isOperator: boolean;
|
|
9
|
+
}
|
|
10
|
+
const WorkFlowAuthForm = ({ message, isOperator }: props) => {
|
|
11
|
+
const formData = message?.form ?? null;
|
|
12
|
+
if (!formData) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return (
|
|
16
|
+
<div className={`flex flex-col gap-[10px]`}>
|
|
17
|
+
{message.blocks && message.blocks?.length > 0 && (
|
|
18
|
+
<ChatWrapper isOperator={isOperator}>
|
|
19
|
+
{message.blocks
|
|
20
|
+
.filter(fil => fil.type === 'text')
|
|
21
|
+
.map((item, index) => (
|
|
22
|
+
<p key={index}>{item.value}</p>
|
|
23
|
+
))}
|
|
24
|
+
</ChatWrapper>
|
|
25
|
+
)}
|
|
26
|
+
{formData.type === '개인정보수집' && <ChatPrivacyAuth isOperator={isOperator} message={message} />}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default WorkFlowAuthForm;
|