@daeryun/dr_components 0.7.93 → 0.7.95

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.
Files changed (34) hide show
  1. package/dist/components/Daeryuntalk/ChatButton.jsx +1 -1
  2. package/dist/components/Daeryuntalk/ChatButton.tsx +1 -1
  3. package/dist/components/Daeryuntalk/ChatConversation.d.ts +1 -0
  4. package/dist/components/Daeryuntalk/ChatConversation.jsx +8 -2
  5. package/dist/components/Daeryuntalk/ChatConversation.tsx +17 -2
  6. package/dist/components/Daeryuntalk/ChatHomeView.jsx +13 -5
  7. package/dist/components/Daeryuntalk/ChatHomeView.tsx +22 -6
  8. package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +10 -38
  9. package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +16 -38
  10. package/dist/components/Daeryuntalk/ChatWidget.jsx +19 -9
  11. package/dist/components/Daeryuntalk/ChatWidget.tsx +21 -10
  12. package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +1 -1
  13. package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +0 -1
  14. package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +28 -11
  15. package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +35 -11
  16. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.d.ts +0 -6
  17. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +31 -22
  18. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +27 -29
  19. package/dist/components/Daeryuntalk/_hooks/useScrollShadow.d.ts +6 -0
  20. package/dist/components/Daeryuntalk/_hooks/useScrollShadow.js +27 -0
  21. package/dist/components/Daeryuntalk/_hooks/useScrollShadow.ts +34 -0
  22. package/dist/components/Daeryuntalk/_lib/utils.d.ts +1 -0
  23. package/dist/components/Daeryuntalk/_lib/utils.js +9 -0
  24. package/dist/components/Daeryuntalk/_lib/utils.ts +9 -0
  25. package/dist/components/Daeryuntalk/_types/message.js +2 -1
  26. package/dist/components/Daeryuntalk/_types/message.ts +3 -1
  27. package/dist/components/Daeryuntalk/_ui/ShadowBox.d.ts +3 -0
  28. package/dist/components/Daeryuntalk/_ui/ShadowBox.jsx +5 -0
  29. package/dist/components/Daeryuntalk/_ui/ShadowBox.tsx +9 -0
  30. package/dist/components/Daeryuntalk/index.jsx +7 -4
  31. package/dist/components/Daeryuntalk/index.tsx +7 -4
  32. package/dist/styles/globals.css +259 -8
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +2 -1
@@ -14,7 +14,7 @@ const ChatButton = ({ isOpen, onClick, apiVersion }) => {
14
14
  onClick();
15
15
  }, [isOpen, onClick, initializeDaeryuntalk, apiVersion]);
16
16
  return (<button aria-label="채팅 상담 열기" onClick={handleClick} className={`
17
- fixed bottom-[30px] right-[30px] h-[60px] w-[60px] rounded-[10px] border
17
+ fixed bottom-[85px] right-[20px] h-[60px] w-[60px] rounded-[10px] border lg:bottom-[30px] lg:right-[30px]
18
18
  ${isOpen ? 'border-gray-200 bg-white' : 'border-[#AA1D36] bg-[#AA1D36]'}
19
19
  z-[999999] flex transform cursor-pointer items-center justify-center
20
20
  p-0 shadow-lg outline-none transition-all duration-300 ease-in-out
@@ -28,7 +28,7 @@ const ChatButton: React.FC<ChatButtonProps> = ({ isOpen, onClick, apiVersion })
28
28
  aria-label="채팅 상담 열기"
29
29
  onClick={handleClick}
30
30
  className={`
31
- fixed bottom-[30px] right-[30px] h-[60px] w-[60px] rounded-[10px] border
31
+ fixed bottom-[85px] right-[20px] h-[60px] w-[60px] rounded-[10px] border lg:bottom-[30px] lg:right-[30px]
32
32
  ${isOpen ? 'border-gray-200 bg-white' : 'border-[#AA1D36] bg-[#AA1D36]'}
33
33
  z-[999999] flex transform cursor-pointer items-center justify-center
34
34
  p-0 shadow-lg outline-none transition-all duration-300 ease-in-out
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  type ChatConversationProps = {
3
3
  onBackClick?: () => void;
4
+ onChatNew?: () => void;
4
5
  isActive: boolean;
5
6
  };
6
7
  declare const ChatConversation: React.FC<ChatConversationProps>;
@@ -8,7 +8,7 @@ import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
8
8
  import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
9
9
  import Image from 'next/image';
10
10
  import { InquiryStatus } from './_enums/ask-status';
11
- const ChatConversation = ({ onBackClick, isActive }) => {
11
+ const ChatConversation = ({ onBackClick, onChatNew, isActive }) => {
12
12
  const { inquiryStatus, messages, isLoading, inquiryMainData, messageObject, workFlowBack, workFlowStack, chatInquiryNumber, sendHeartbeat, sendInquiryLeft, sendInquiryJoined } = useDaeryuntalk();
13
13
  const [isHovered, setIsHovered] = useState(false);
14
14
  const messagesEndRef = useRef(null);
@@ -108,7 +108,13 @@ const ChatConversation = ({ onBackClick, isActive }) => {
108
108
  </div>
109
109
 
110
110
  <div className="border-t border-gray-200 p-4">
111
- <ChatInput />
111
+ {inquiryStatus === InquiryStatus.CLOSED ? (<div className="">
112
+ <button className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white" onClick={() => {
113
+ onChatNew && onChatNew();
114
+ }}>
115
+ 새 문의하기
116
+ </button>
117
+ </div>) : (<ChatInput />)}
112
118
  </div>
113
119
  </div>);
114
120
  };
@@ -10,13 +10,15 @@ import Image from 'next/image';
10
10
  import { useChatSocketState } from './_hooks/talkprovider/useChatSocketState';
11
11
  import { getMessageFileDownloadUrl } from './_api';
12
12
  import { InquiryStatus } from './_enums/ask-status';
13
+ import SendIcon from '../../asset/images/daeryuntalk/send.svg';
13
14
 
14
15
  type ChatConversationProps = {
15
16
  onBackClick?: () => void;
17
+ onChatNew?: () => void;
16
18
  isActive: boolean;
17
19
  };
18
20
 
19
- const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick, isActive }) => {
21
+ const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick, onChatNew, isActive }) => {
20
22
  const {
21
23
  inquiryStatus,
22
24
  messages,
@@ -183,7 +185,20 @@ const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick, isActi
183
185
  </div>
184
186
 
185
187
  <div className="border-t border-gray-200 p-4">
186
- <ChatInput />
188
+ {inquiryStatus === InquiryStatus.CLOSED ? (
189
+ <div className="">
190
+ <button
191
+ className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white"
192
+ onClick={() => {
193
+ onChatNew && onChatNew();
194
+ }}
195
+ >
196
+ 새 문의하기
197
+ </button>
198
+ </div>
199
+ ) : (
200
+ <ChatInput />
201
+ )}
187
202
  </div>
188
203
  </div>
189
204
  );
@@ -20,11 +20,17 @@ import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
20
20
  import DaeryuntalkIntro from '../../asset/images/daeryuntalk/daeryuntalk-intro.png';
21
21
  import { useChatSocketState } from './_hooks/talkprovider/useChatSocketState';
22
22
  import { useDearyunTalkToast } from './Toast/DaeryuntalkToastProvider';
23
+ import { useScrollShadow } from './_hooks/useScrollShadow';
24
+ import ShadowBox from './_ui/ShadowBox';
23
25
  const ChatHomeView = () => {
24
26
  const { isAuthenticated, historyList, inquiryMainData, startChat, createNewChat, chatInquiryNumber, sendHeartbeat, sendInquiryLeft, goGetHistoryList, sendHistoryEntered, sendHistoryLeft, startSelectedChat } = useDaeryuntalk();
25
27
  const [viewState, setViewState] = useState('home');
26
28
  const [mainData, setMainData] = useState(null);
27
29
  const [isLoading, setIsLoading] = useState(false);
30
+ const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
31
+ useEffect(() => {
32
+ checkScroll();
33
+ }, [mainData]);
28
34
  const toast = useDearyunTalkToast();
29
35
  useEffect(() => {
30
36
  if (viewState === 'history') {
@@ -88,7 +94,6 @@ const ChatHomeView = () => {
88
94
  try {
89
95
  setIsLoading(true);
90
96
  const res = yield startSelectedChat(chatNumber);
91
- console.log('res', res);
92
97
  setViewState('conversation');
93
98
  }
94
99
  catch (e) {
@@ -102,7 +107,7 @@ const ChatHomeView = () => {
102
107
  if (viewState === 'conversation') {
103
108
  return (<main className="flex h-[690px] w-[390px] items-center justify-center rounded-[30px]">
104
109
  <div className="relative h-[690px] w-[390px] overflow-hidden rounded-[30px] bg-white shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]">
105
- <ChatConversation onBackClick={handleBackToHome} isActive={viewState === 'conversation'}/>
110
+ <ChatConversation onBackClick={handleBackToHome} isActive={viewState === 'conversation'} onChatNew={handleNewStartChat}/>
106
111
  </div>
107
112
  </main>);
108
113
  }
@@ -134,14 +139,15 @@ const ChatHomeView = () => {
134
139
  <span>24시간 운영</span>
135
140
  </header>
136
141
 
137
- <section className="mx-auto mt-[150px] flex w-[320px] flex-col gap-5 rounded-[12px] bg-white px-4 py-6 shadow-[0px_4px_10px_0px_#00000026]">
142
+ <section className="mx-auto mt-[150px] flex w-[320px] flex-col gap-5 rounded-[12px] bg-white px-4 py-6 ">
138
143
  <div className="flex items-center">
139
144
  {(mainData === null || mainData === void 0 ? void 0 : mainData.channel_logo_image_url) ? (<Image src={mainData.channel_logo_image_url} alt="로고" width={24} height={24} className="mr-2"/>) : (<DaeryunLogoIcon width={24} height={24} className="mr-2"/>)}
140
145
  <h1 className="font-medium">{(mainData === null || mainData === void 0 ? void 0 : mainData.channel_name) || '법무법인(유한)대륜'}</h1>
141
146
  </div>
142
147
 
143
- <div className="mx-8 max-h-[162px] overflow-auto whitespace-pre-line text-sm font-normal leading-[130%]">
144
- {(mainData === null || mainData === void 0 ? void 0 : mainData.salutation) ||
148
+ <div className={`relative`}>
149
+ <div ref={containerRef} className="no-scrollbar relative mx-8 max-h-[162px] overflow-auto whitespace-pre-line text-sm font-normal leading-[130%]">
150
+ {(mainData === null || mainData === void 0 ? void 0 : mainData.salutation) ||
145
151
  `안녕하세요.
146
152
  법무법인(유한)대륜입니다.
147
153
  방문해 주셔서 감사합니다.
@@ -149,6 +155,8 @@ const ChatHomeView = () => {
149
155
  말씀해 주시면 도와드리겠습니다.
150
156
 
151
157
  6:00~24:00 외 시간에는 상담인력의 편성에 따라 순차적으로 응대를 도와드리고 있습니다.`}
158
+ </div>
159
+ {!isScroll && !isBottom && <ShadowBox />}
152
160
  </div>
153
161
 
154
162
  <button className="mt-4 flex h-[48px] w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white" aria-label={`문의하기`} onClick={handleStartChat} disabled={isLoading}>
@@ -12,6 +12,8 @@ import DaeryuntalkIntro from '../../asset/images/daeryuntalk/daeryuntalk-intro.p
12
12
  import { IChatInquiryMainDataResponse } from './_api/daeryuntalk/type/response';
13
13
  import { useChatSocketState } from './_hooks/talkprovider/useChatSocketState';
14
14
  import { useDearyunTalkToast } from './Toast/DaeryuntalkToastProvider';
15
+ import { useScrollShadow } from './_hooks/useScrollShadow';
16
+ import ShadowBox from './_ui/ShadowBox';
15
17
 
16
18
  type ViewState = 'home' | 'conversation' | 'history';
17
19
 
@@ -33,6 +35,11 @@ const ChatHomeView: React.FC = () => {
33
35
  const [viewState, setViewState] = useState<ViewState>('home');
34
36
  const [mainData, setMainData] = useState<IChatInquiryMainDataResponse | null>(null);
35
37
  const [isLoading, setIsLoading] = useState(false);
38
+ const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow<HTMLDivElement>();
39
+ useEffect(() => {
40
+ checkScroll();
41
+ }, [mainData]);
42
+
36
43
  const toast = useDearyunTalkToast();
37
44
 
38
45
  useEffect(() => {
@@ -104,7 +111,6 @@ const ChatHomeView: React.FC = () => {
104
111
  try {
105
112
  setIsLoading(true);
106
113
  const res = await startSelectedChat(chatNumber);
107
- console.log('res', res);
108
114
  setViewState('conversation');
109
115
  } catch (e) {
110
116
  console.error('e', e);
@@ -118,7 +124,11 @@ const ChatHomeView: React.FC = () => {
118
124
  return (
119
125
  <main className="flex h-[690px] w-[390px] items-center justify-center rounded-[30px]">
120
126
  <div className="relative h-[690px] w-[390px] overflow-hidden rounded-[30px] bg-white shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]">
121
- <ChatConversation onBackClick={handleBackToHome} isActive={viewState === 'conversation'} />
127
+ <ChatConversation
128
+ onBackClick={handleBackToHome}
129
+ isActive={viewState === 'conversation'}
130
+ onChatNew={handleNewStartChat}
131
+ />
122
132
  </div>
123
133
  </main>
124
134
  );
@@ -178,7 +188,7 @@ const ChatHomeView: React.FC = () => {
178
188
  <span>24시간 운영</span>
179
189
  </header>
180
190
 
181
- <section className="mx-auto mt-[150px] flex w-[320px] flex-col gap-5 rounded-[12px] bg-white px-4 py-6 shadow-[0px_4px_10px_0px_#00000026]">
191
+ <section className="mx-auto mt-[150px] flex w-[320px] flex-col gap-5 rounded-[12px] bg-white px-4 py-6 ">
182
192
  <div className="flex items-center">
183
193
  {mainData?.channel_logo_image_url ? (
184
194
  <Image
@@ -194,15 +204,21 @@ const ChatHomeView: React.FC = () => {
194
204
  <h1 className="font-medium">{mainData?.channel_name || '법무법인(유한)대륜'}</h1>
195
205
  </div>
196
206
 
197
- <div className="mx-8 max-h-[162px] overflow-auto whitespace-pre-line text-sm font-normal leading-[130%]">
198
- {mainData?.salutation ||
199
- `안녕하세요.
207
+ <div className={`relative`}>
208
+ <div
209
+ ref={containerRef}
210
+ className="no-scrollbar relative mx-8 max-h-[162px] overflow-auto whitespace-pre-line text-sm font-normal leading-[130%]"
211
+ >
212
+ {mainData?.salutation ||
213
+ `안녕하세요.
200
214
  법무법인(유한)대륜입니다.
201
215
  방문해 주셔서 감사합니다.
202
216
  궁금한 점이나 도움이 필요하신 부분
203
217
  말씀해 주시면 도와드리겠습니다.
204
218
 
205
219
  6:00~24:00 외 시간에는 상담인력의 편성에 따라 순차적으로 응대를 도와드리고 있습니다.`}
220
+ </div>
221
+ {!isScroll && !isBottom && <ShadowBox />}
206
222
  </div>
207
223
 
208
224
  <button
@@ -55,7 +55,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
55
55
  return (<div className={`flex w-full items-end justify-start gap-[4px]`}>
56
56
  {media.images.length > 1 ? (<div className={`flex flex-col`}>
57
57
  {/* grid로 감싸진 짝수 개수 또는 홀수에서 마지막 전까지 */}
58
- <div className="grid grid-cols-2 gap-2 rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]">
58
+ <div className="group grid grid-cols-2 gap-2 rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]">
59
59
  {media.images.map((file, index) => {
60
60
  const isLastOdd = media.images.length % 2 === 1 && index === media.images.length - 1;
61
61
  if (isLastOdd)
@@ -69,7 +69,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
69
69
  <button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
70
70
  e.stopPropagation();
71
71
  yield handleDownload(file);
72
- })} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full">
72
+ })} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100">
73
73
  <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white"/>
74
74
  </button>
75
75
  </div>);
@@ -89,7 +89,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
89
89
  if (media.type === 'image') {
90
90
  yield handleDownload(media.images[media.images.length - 1]);
91
91
  }
92
- })} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full">
92
+ })} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100">
93
93
  <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full text-[#777777] "/>
94
94
  </button>
95
95
  </div>
@@ -108,54 +108,23 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
108
108
  if (media.type === 'image') {
109
109
  yield handleDownload(media.images[0]);
110
110
  }
111
- })} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full">
111
+ })} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100">
112
112
  <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white"/>
113
113
  </button>
114
114
  </div>
115
115
  </div>)}
116
- {/*<div*/}
117
- {/* className={`*/}
118
- {/* grid rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]*/}
119
- {/* ${media.images.length > 1 ? 'grid-cols-2 gap-2' : ''}*/}
120
- {/*`}*/}
121
- {/*>*/}
122
- {/* {media.images.map((file, index) => (*/}
123
- {/* <div*/}
124
- {/* key={index}*/}
125
- {/* className={`group/image relative overflow-hidden rounded-[5px] */}
126
- {/* ${media.images.length > 1 ? 'aspect-square w-[120px]' : 'aspect-auto h-[100px] w-[160px]'} `}*/}
127
- {/* >*/}
128
- {/* <Image*/}
129
- {/* src={file.thumbnailUrl}*/}
130
- {/* alt={file.name}*/}
131
- {/* width={media.images.length > 1 ? 113 : 160}*/}
132
- {/* height={media.images.length > 1 ? 100 : 100}*/}
133
- {/* className={`h-full w-full cursor-pointer rounded-md object-cover `}*/}
134
- {/* onClick={() => {}}*/}
135
- {/* />*/}
136
- {/* <button*/}
137
- {/* onClick={e => {*/}
138
- {/* e.stopPropagation();*/}
139
- {/* }}*/}
140
- {/* className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full"*/}
141
- {/* >*/}
142
- {/* <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />*/}
143
- {/* </button>*/}
144
- {/* </div>*/}
145
- {/* ))}*/}
146
- {/*</div>*/}
147
116
  <div className={`text-[12px] font-[400] text-[#C2C2C2]`}>{time}</div>
148
117
  </div>);
149
118
  }
150
119
  else if (media.type === 'file') {
151
- return (<div className={`flex w-fit items-end gap-[4px]`}>
120
+ return (<div className={` flex w-fit items-end gap-[4px]`}>
152
121
  <div className="flex w-full flex-col gap-[10px] ">
153
122
  {media.files.map((file, index) => {
154
123
  const fileExtension = file.name.split('.').pop() || '';
155
124
  const baseName = file.name.replace(`.${fileExtension}`, '');
156
125
  const truncatedName = baseName.length > 12 ? `${baseName.slice(0, 12)}…` : baseName;
157
126
  const fileName = `${truncatedName}.${fileExtension}`;
158
- return (<div key={index} className={`flex w-full items-end justify-start gap-[4px]`}>
127
+ return (<div key={index} className={`group relative flex w-full items-end justify-start gap-[4px]`}>
159
128
  <div key={index} className={`
160
129
  flex items-center justify-between gap-[16px]
161
130
  rounded-[10px] border-[1px] border-[#EDEDED] p-[12px]
@@ -166,7 +135,10 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
166
135
  {formatFileSize(file.size)} | {file.name.split('.').pop()}
167
136
  </span>
168
137
  </div>
169
- <button onClick={() => { }} className="">
138
+ <button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
139
+ e.stopPropagation();
140
+ yield handleDownload(file);
141
+ })} className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover:opacity-100">
170
142
  <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white"/>
171
143
  </button>
172
144
  </div>
@@ -62,7 +62,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
62
62
  {media.images.length > 1 ? (
63
63
  <div className={`flex flex-col`}>
64
64
  {/* grid로 감싸진 짝수 개수 또는 홀수에서 마지막 전까지 */}
65
- <div className="grid grid-cols-2 gap-2 rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]">
65
+ <div className="group grid grid-cols-2 gap-2 rounded-[10px] border-[1px] border-[#EDEDED] p-[8px]">
66
66
  {media.images.map((file, index) => {
67
67
  const isLastOdd =
68
68
  media.images.length % 2 === 1 && index === media.images.length - 1;
@@ -91,7 +91,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
91
91
  e.stopPropagation();
92
92
  await handleDownload(file);
93
93
  }}
94
- className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full"
94
+ className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100"
95
95
  >
96
96
  <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />
97
97
  </button>
@@ -126,7 +126,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
126
126
  await handleDownload(media.images[media.images.length - 1]);
127
127
  }
128
128
  }}
129
- className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full"
129
+ className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100"
130
130
  >
131
131
  <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full text-[#777777] " />
132
132
  </button>
@@ -160,50 +160,19 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
160
160
  await handleDownload(media.images[0]);
161
161
  }
162
162
  }}
163
- className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full"
163
+ className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover/image:opacity-100"
164
164
  >
165
165
  <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />
166
166
  </button>
167
167
  </div>
168
168
  </div>
169
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
170
  <div className={`text-[12px] font-[400] text-[#C2C2C2]`}>{time}</div>
202
171
  </div>
203
172
  );
204
173
  } else if (media.type === 'file') {
205
174
  return (
206
- <div className={`flex w-fit items-end gap-[4px]`}>
175
+ <div className={` flex w-fit items-end gap-[4px]`}>
207
176
  <div className="flex w-full flex-col gap-[10px] ">
208
177
  {media.files.map((file, index) => {
209
178
  const fileExtension = file.name.split('.').pop() || '';
@@ -214,7 +183,10 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
214
183
  const fileName = `${truncatedName}.${fileExtension}`;
215
184
 
216
185
  return (
217
- <div key={index} className={`flex w-full items-end justify-start gap-[4px]`}>
186
+ <div
187
+ key={index}
188
+ className={`group relative flex w-full items-end justify-start gap-[4px]`}
189
+ >
218
190
  <div
219
191
  key={index}
220
192
  className={`
@@ -228,7 +200,13 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
228
200
  {formatFileSize(file.size)} | {file.name.split('.').pop()}
229
201
  </span>
230
202
  </div>
231
- <button onClick={() => {}} className="">
203
+ <button
204
+ onClick={async e => {
205
+ e.stopPropagation();
206
+ await handleDownload(file);
207
+ }}
208
+ className="absolute bottom-[10px] right-[10px] z-10 flex h-[24px] w-[24px] items-center justify-center rounded-full opacity-0 transition-opacity group-hover:opacity-100"
209
+ >
232
210
  <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />
233
211
  </button>
234
212
  </div>
@@ -1,18 +1,28 @@
1
1
  import React from 'react';
2
2
  import ChatHomeView from './ChatHomeView';
3
3
  import ImageViewer from './Viewer/ImageViewer';
4
- import { DaeryuntalkToastProvider } from './Toast/DaeryuntalkToastProvider';
4
+ import { useScrollShadow } from './_hooks/useScrollShadow';
5
+ import ShadowBox from './_ui/ShadowBox';
5
6
  const ChatWidget = ({ isOpen }) => {
7
+ const { containerRef, isScroll, isBottom } = useScrollShadow();
6
8
  return (<>
7
9
  <ImageViewer />
8
- <div className={`
9
- fixed bottom-[110px] right-[30px] z-[999998]
10
- transition-all duration-300 ease-out
11
- ${isOpen ? 'translate-y-0 scale-100 opacity-100' : 'pointer-events-none translate-y-6 opacity-0'}
12
- `}>
13
- <DaeryuntalkToastProvider>
14
- <ChatHomeView />
15
- </DaeryuntalkToastProvider>
10
+
11
+ <div className="relative">
12
+ <div className={`fixed bottom-[110px] right-[30px] z-[999998]
13
+ h-[690px] max-h-[calc(100vh-120px)]
14
+ rounded-[30px] shadow-[0px_4px_10px_0px_#00000026]
15
+ transition-all duration-300 ease-out
16
+ ${isOpen ? 'translate-y-0 scale-100 opacity-100' : 'pointer-events-none translate-y-6 opacity-0'}
17
+ `}>
18
+ {/* 실제로 스크롤되는 컨테이너에 ref 연결 */}
19
+ <div ref={containerRef} className="no-scrollbar h-full overflow-y-auto rounded-[30px] bg-white">
20
+ <ChatHomeView />
21
+ </div>
22
+
23
+ {/* 투명 그라데이션 그림자 표시 */}
24
+ {!isScroll && !isBottom && <ShadowBox />}
25
+ </div>
16
26
  </div>
17
27
  </>);
18
28
  };
@@ -2,25 +2,36 @@ import React from 'react';
2
2
  import ChatHomeView from './ChatHomeView';
3
3
  import ImageViewer from './Viewer/ImageViewer';
4
4
  import { DaeryuntalkToastProvider } from './Toast/DaeryuntalkToastProvider';
5
+ import { useScrollShadow } from './_hooks/useScrollShadow';
6
+ import ShadowBox from './_ui/ShadowBox';
5
7
 
6
8
  interface ChatWidgetProps {
7
9
  isOpen: boolean;
8
10
  }
9
11
 
10
12
  const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen }) => {
13
+ const { containerRef, isScroll, isBottom } = useScrollShadow<HTMLDivElement>();
11
14
  return (
12
15
  <>
13
16
  <ImageViewer />
14
- <div
15
- className={`
16
- fixed bottom-[110px] right-[30px] z-[999998]
17
- transition-all duration-300 ease-out
18
- ${isOpen ? 'translate-y-0 scale-100 opacity-100' : 'pointer-events-none translate-y-6 opacity-0'}
19
- `}
20
- >
21
- <DaeryuntalkToastProvider>
22
- <ChatHomeView />
23
- </DaeryuntalkToastProvider>
17
+
18
+ <div className="relative">
19
+ <div
20
+ className={`fixed bottom-[110px] right-[30px] z-[999998]
21
+ h-[690px] max-h-[calc(100vh-120px)]
22
+ rounded-[30px] shadow-[0px_4px_10px_0px_#00000026]
23
+ transition-all duration-300 ease-out
24
+ ${isOpen ? 'translate-y-0 scale-100 opacity-100' : 'pointer-events-none translate-y-6 opacity-0'}
25
+ `}
26
+ >
27
+ {/* 실제로 스크롤되는 컨테이너에 ref 연결 */}
28
+ <div ref={containerRef} className="no-scrollbar h-full overflow-y-auto rounded-[30px] bg-white">
29
+ <ChatHomeView />
30
+ </div>
31
+
32
+ {/* 투명 그라데이션 그림자 표시 */}
33
+ {!isScroll && !isBottom && <ShadowBox />}
34
+ </div>
24
35
  </div>
25
36
  </>
26
37
  );
@@ -83,7 +83,7 @@ export const DaeryuntalkProvider = ({ children, propsTel }) => {
83
83
  });
84
84
  // MSG15591497825895676
85
85
  // 채팅 관련
86
- const { startChat, sendMessage, createNewChat, startWorkFlow, workFlowBack, chatUserUpdate, getNextMessageList, getDownLoadUrl, startSelectedChat } = useChatHandler({
86
+ const { startChat, sendMessage, createNewChat, startWorkFlow, workFlowBack, chatUserUpdate, getNextMessageList, startSelectedChat } = useChatHandler({
87
87
  setIsLoading,
88
88
  inquiryMainData,
89
89
  setChatInquiryNumber,
@@ -175,7 +175,6 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
175
175
  workFlowBack,
176
176
  chatUserUpdate,
177
177
  getNextMessageList,
178
- getDownLoadUrl,
179
178
  startSelectedChat
180
179
  } = useChatHandler({
181
180
  setIsLoading,
@@ -1,12 +1,24 @@
1
1
  import { EditorContent, useEditor } from '@tiptap/react';
2
2
  import Placeholder from '@tiptap/extension-placeholder';
3
3
  import { forwardRef, useEffect, useImperativeHandle } from 'react';
4
+ import HardBreak from '@tiptap/extension-hard-break'; // 추가
4
5
  import Document from '@tiptap/extension-document';
5
6
  import Paragraph from '@tiptap/extension-paragraph';
6
7
  import Text from '@tiptap/extension-text';
7
8
  const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력하세요...', onEnterKeyPress, onKeyDown }, ref) => {
8
9
  const editor = useEditor({
9
- extensions: [Document, Paragraph, Text, Placeholder.configure({ placeholder })],
10
+ extensions: [
11
+ Document,
12
+ Paragraph,
13
+ Text,
14
+ Placeholder.configure({ placeholder }),
15
+ HardBreak.configure({
16
+ keepMarks: false,
17
+ HTMLAttributes: {
18
+ class: 'my-custom-hard-break'
19
+ }
20
+ })
21
+ ],
10
22
  content: '',
11
23
  enableInputRules: false,
12
24
  enablePasteRules: false,
@@ -24,21 +36,25 @@ const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력하세
24
36
  },
25
37
  editorProps: {
26
38
  attributes: {
27
- class: 'focus:outline-none min-h-[34px] max-h-[72px] overflow-y-auto resize-none px-[10px] mt-[4px] pt-[4px] pb-[4px] break-words whitespace-pre-wrap'
39
+ class: 'focus:outline-none min-h-[34px] max-h-[72px] overflow-y-auto resize-none px-[10px] mt-[4px] pt-[4px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere'
28
40
  },
29
41
  handleKeyDown: (view, event) => {
30
42
  if (event.key === 'Enter') {
31
43
  if (event.shiftKey) {
32
- // 줄바꿈 이후 스크롤 이동 보장
33
- requestAnimationFrame(() => {
34
- if (view && view.dom) {
35
- // 가장 아래에 스크롤되도록 처리
36
- view.dom.scrollTop = view.dom.scrollHeight;
37
- }
38
- });
39
- return false;
44
+ // Shift+Enter: 줄바꿈 (hard break) 삽입
45
+ if (editor) {
46
+ editor.commands.setHardBreak();
47
+ // 줄바꿈 이후 스크롤 이동 보장
48
+ requestAnimationFrame(() => {
49
+ if (view && view.dom) {
50
+ view.dom.scrollTop = view.dom.scrollHeight;
51
+ }
52
+ });
53
+ }
54
+ return true; // 기본 동작 방지
40
55
  }
41
56
  else {
57
+ // Enter: 메시지 전송
42
58
  event.preventDefault();
43
59
  const content = editor === null || editor === void 0 ? void 0 : editor.getText();
44
60
  if (content && content.trim() && onEnterKeyPress) {
@@ -74,7 +90,8 @@ const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력하세
74
90
  }));
75
91
  if (!editor)
76
92
  return null;
77
- return <EditorContent editor={editor} tabIndex={0} className="rounded-md border text-black dark:text-white"/>;
93
+ // return <EditorContent editor={editor} tabIndex={0} className="rounded-md border text-black dark:text-white" />;
94
+ return (<EditorContent editor={editor} tabIndex={0} className="w-full overflow-hidden rounded-md border text-black dark:text-white"/>);
78
95
  });
79
96
  Tiptap.displayName = 'Tiptap';
80
97
  export default Tiptap;