@daeryun/dr_components 0.7.94 → 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.
@@ -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
@@ -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') {
@@ -133,14 +139,15 @@ const ChatHomeView = () => {
133
139
  <span>24시간 운영</span>
134
140
  </header>
135
141
 
136
- <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 ">
137
143
  <div className="flex items-center">
138
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"/>)}
139
145
  <h1 className="font-medium">{(mainData === null || mainData === void 0 ? void 0 : mainData.channel_name) || '법무법인(유한)대륜'}</h1>
140
146
  </div>
141
147
 
142
- <div className="mx-8 max-h-[162px] overflow-auto whitespace-pre-line text-sm font-normal leading-[130%]">
143
- {(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) ||
144
151
  `안녕하세요.
145
152
  법무법인(유한)대륜입니다.
146
153
  방문해 주셔서 감사합니다.
@@ -148,6 +155,8 @@ const ChatHomeView = () => {
148
155
  말씀해 주시면 도와드리겠습니다.
149
156
 
150
157
  6:00~24:00 외 시간에는 상담인력의 편성에 따라 순차적으로 응대를 도와드리고 있습니다.`}
158
+ </div>
159
+ {!isScroll && !isBottom && <ShadowBox />}
151
160
  </div>
152
161
 
153
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(() => {
@@ -181,7 +188,7 @@ const ChatHomeView: React.FC = () => {
181
188
  <span>24시간 운영</span>
182
189
  </header>
183
190
 
184
- <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 ">
185
192
  <div className="flex items-center">
186
193
  {mainData?.channel_logo_image_url ? (
187
194
  <Image
@@ -197,15 +204,21 @@ const ChatHomeView: React.FC = () => {
197
204
  <h1 className="font-medium">{mainData?.channel_name || '법무법인(유한)대륜'}</h1>
198
205
  </div>
199
206
 
200
- <div className="mx-8 max-h-[162px] overflow-auto whitespace-pre-line text-sm font-normal leading-[130%]">
201
- {mainData?.salutation ||
202
- `안녕하세요.
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
+ `안녕하세요.
203
214
  법무법인(유한)대륜입니다.
204
215
  방문해 주셔서 감사합니다.
205
216
  궁금한 점이나 도움이 필요하신 부분
206
217
  말씀해 주시면 도와드리겠습니다.
207
218
 
208
219
  6:00~24:00 외 시간에는 상담인력의 편성에 따라 순차적으로 응대를 도와드리고 있습니다.`}
220
+ </div>
221
+ {!isScroll && !isBottom && <ShadowBox />}
209
222
  </div>
210
223
 
211
224
  <button
@@ -117,14 +117,14 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
117
117
  </div>);
118
118
  }
119
119
  else if (media.type === 'file') {
120
- return (<div className={`flex w-fit items-end gap-[4px]`}>
120
+ return (<div className={` flex w-fit items-end gap-[4px]`}>
121
121
  <div className="flex w-full flex-col gap-[10px] ">
122
122
  {media.files.map((file, index) => {
123
123
  const fileExtension = file.name.split('.').pop() || '';
124
124
  const baseName = file.name.replace(`.${fileExtension}`, '');
125
125
  const truncatedName = baseName.length > 12 ? `${baseName.slice(0, 12)}…` : baseName;
126
126
  const fileName = `${truncatedName}.${fileExtension}`;
127
- 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]`}>
128
128
  <div key={index} className={`
129
129
  flex items-center justify-between gap-[16px]
130
130
  rounded-[10px] border-[1px] border-[#EDEDED] p-[12px]
@@ -138,7 +138,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }) => {
138
138
  <button onClick={(e) => __awaiter(void 0, void 0, void 0, function* () {
139
139
  e.stopPropagation();
140
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/image:opacity-100">
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">
142
142
  <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white"/>
143
143
  </button>
144
144
  </div>
@@ -172,7 +172,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
172
172
  );
173
173
  } else if (media.type === 'file') {
174
174
  return (
175
- <div className={`flex w-fit items-end gap-[4px]`}>
175
+ <div className={` flex w-fit items-end gap-[4px]`}>
176
176
  <div className="flex w-full flex-col gap-[10px] ">
177
177
  {media.files.map((file, index) => {
178
178
  const fileExtension = file.name.split('.').pop() || '';
@@ -183,7 +183,10 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
183
183
  const fileName = `${truncatedName}.${fileExtension}`;
184
184
 
185
185
  return (
186
- <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
+ >
187
190
  <div
188
191
  key={index}
189
192
  className={`
@@ -202,7 +205,7 @@ const ChatFile = ({ message, isOperator, isHovered, time }: props) => {
202
205
  e.stopPropagation();
203
206
  await handleDownload(file);
204
207
  }}
205
- 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"
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"
206
209
  >
207
210
  <FileDownLoadIcon className="h-[24px] w-[24px] rounded-full bg-white" />
208
211
  </button>
@@ -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,
@@ -36,12 +36,6 @@ export declare const useChatHandler: ({ setIsLoading, inquiryMainData, setChatIn
36
36
  cellPhoneNumber: string;
37
37
  }) => Promise<void>;
38
38
  getNextMessageList: (chatInquiryNumber: string, standardDateTime: any) => Promise<void>;
39
- getDownLoadUrl: ({ chatInquiryNumber, fileNumber }: {
40
- chatInquiryNumber: string;
41
- fileNumber: string;
42
- }) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<{
43
- url: string;
44
- }>>;
45
39
  startSelectedChat: (chatInquiryNumber: string) => Promise<string>;
46
40
  };
47
41
  export {};
@@ -8,9 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { useCallback } from 'react';
11
- import { chatUserUpdate as apiChatUserUpdate, chatWorkFlow, chatWorkFlowBack, generateChatInquiry, getChatInquiryDetailNew, getChatInquiryMessageList, getMessageFileDownloadUrl, sendChatMessage } from '../../_api';
11
+ import { chatUserUpdate as apiChatUserUpdate, chatWorkFlow, chatWorkFlowBack, generateChatInquiry, getChatInquiryDetailNew, getChatInquiryMessageList, sendChatMessage } from '../../_api';
12
12
  import { convertApiMessageObjectToUiMessageObject, convertApiMessageToUiMessage } from '../../_lib';
13
+ import { useDearyunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
13
14
  export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNumber, setMessages, setInquiryStatus, setMessageObject, chatInquiryNumber, setIsNextPage, setWorkFlowStack, setInquiryMainData }) => {
15
+ const toast = useDearyunTalkToast();
14
16
  // 채팅 시작 (문의하기 버튼 클릭 시)
15
17
  const startChat = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
16
18
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
@@ -94,6 +96,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
94
96
  return currentChatInquiryNumber;
95
97
  }
96
98
  catch (error) {
99
+ toast.error('문의 시작에 실패했습니다.');
97
100
  console.error('[DaeryuntalkContext] 채팅 시작 오류:', error);
98
101
  throw error;
99
102
  }
@@ -166,6 +169,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
166
169
  return chatInquiryNumber;
167
170
  }
168
171
  catch (error) {
172
+ toast.error('채팅 시작에 실패했습니다.');
169
173
  console.error('[DaeryuntalkContext] 채팅 시작 오류:', error);
170
174
  throw error;
171
175
  }
@@ -181,6 +185,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
181
185
  yield sendChatMessage(chatInquiryNumber, htmlContent, jsonData);
182
186
  }
183
187
  catch (error) {
188
+ toast.error('메시지 전송에 실패했습니다.');
184
189
  console.error('[DaeryuntalkContext] 메시지 전송 중 오류 발생:', error);
185
190
  }
186
191
  finally {
@@ -248,6 +253,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
248
253
  }
249
254
  }
250
255
  catch (error) {
256
+ toast.error('채팅 문의 생성에 실패했습니다.');
251
257
  console.error('[DaeryuntalkContext] 신규 채팅문의 생성:', error);
252
258
  }
253
259
  finally {
@@ -273,6 +279,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
273
279
  yield chatWorkFlow(chatInquiryNumber, messageNumber, workFlowNumber, objectNumber);
274
280
  }
275
281
  catch (error) {
282
+ toast.error('워크플로우 생성에 실패했습니다.');
276
283
  console.error('[워크 플로우 생성 실패]:', error);
277
284
  }
278
285
  finally {
@@ -295,6 +302,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
295
302
  yield chatWorkFlowBack(chatInquiryNumber, messageNumber, workFlowNavigationCode);
296
303
  }
297
304
  catch (error) {
305
+ toast.error('동작에 실패했습니다.');
298
306
  console.error('[워크 플로우 생성 실패]:', error);
299
307
  }
300
308
  finally {
@@ -320,6 +328,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
320
328
  yield apiChatUserUpdate(chatInquiryNumber, messageNumber, name, cellPhoneNumber);
321
329
  }
322
330
  catch (error) {
331
+ toast.error('개인정보 업데이트에 실패했습니다.');
323
332
  console.error('[워크 플로우 생성 실패]:', error);
324
333
  }
325
334
  finally {
@@ -328,27 +337,28 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
328
337
  }), []);
329
338
  const getNextMessageList = useCallback((chatInquiryNumber, standardDateTime) => __awaiter(void 0, void 0, void 0, function* () {
330
339
  const chatList = yield getChatInquiryMessageList(chatInquiryNumber, standardDateTime);
331
- if (chatList.data) {
332
- // 앞에 생성될 여기서는 앞에서부터 채워야함
333
- const newMessageList = chatList.data.message_list
334
- .sort((a, b) => a.timestamp - b.timestamp)
335
- .map(item => {
336
- return convertApiMessageToUiMessage(item);
337
- });
338
- setIsNextPage(chatList.data.next_page_yn);
339
- setMessages(prev => {
340
- if (newMessageList && newMessageList.length > 0) {
341
- return [...newMessageList, ...prev];
342
- }
343
- else {
344
- return [...prev];
345
- }
346
- });
340
+ if (chatList.result_info.result_cd === 'OK' || chatList.result_info.result_type_cd === 'OK') {
341
+ if (chatList.data) {
342
+ // 앞에 생성될 여기서는 앞에서부터 채워야함
343
+ const newMessageList = chatList.data.message_list
344
+ .sort((a, b) => a.timestamp - b.timestamp)
345
+ .map(item => {
346
+ return convertApiMessageToUiMessage(item);
347
+ });
348
+ setIsNextPage(chatList.data.next_page_yn);
349
+ setMessages(prev => {
350
+ if (newMessageList && newMessageList.length > 0) {
351
+ return [...newMessageList, ...prev];
352
+ }
353
+ else {
354
+ return [...prev];
355
+ }
356
+ });
357
+ }
358
+ }
359
+ else {
360
+ toast.error('메세지 조회에 실패했습니다.');
347
361
  }
348
- }), []);
349
- // 파일 다운로드 url
350
- const getDownLoadUrl = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ chatInquiryNumber, fileNumber }) {
351
- return yield getMessageFileDownloadUrl({ chatInquiryNumber, fileNumber });
352
362
  }), []);
353
363
  return {
354
364
  startChat,
@@ -358,7 +368,6 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
358
368
  workFlowBack,
359
369
  chatUserUpdate,
360
370
  getNextMessageList,
361
- getDownLoadUrl,
362
371
  startSelectedChat
363
372
  };
364
373
  };
@@ -13,6 +13,7 @@ import { convertApiMessageObjectToUiMessageObject, convertApiMessageToUiMessage
13
13
  import { IChatInquiryMainDataResponse } from '../../_api/daeryuntalk/type/response';
14
14
  import { Message } from '../../_types/message';
15
15
  import { MessageObject } from '../../_types/message_object';
16
+ import { useDearyunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
16
17
 
17
18
  interface props {
18
19
  setIsLoading: Dispatch<SetStateAction<boolean>>;
@@ -39,6 +40,7 @@ export const useChatHandler = ({
39
40
  setWorkFlowStack,
40
41
  setInquiryMainData
41
42
  }: props) => {
43
+ const toast = useDearyunTalkToast();
42
44
  // 채팅 시작 (문의하기 버튼 클릭 시)
43
45
  const startChat = useCallback(async () => {
44
46
  try {
@@ -132,6 +134,7 @@ export const useChatHandler = ({
132
134
 
133
135
  return currentChatInquiryNumber;
134
136
  } catch (error) {
137
+ toast.error('문의 시작에 실패했습니다.');
135
138
  console.error('[DaeryuntalkContext] 채팅 시작 오류:', error);
136
139
  throw error;
137
140
  } finally {
@@ -213,6 +216,7 @@ export const useChatHandler = ({
213
216
 
214
217
  return chatInquiryNumber;
215
218
  } catch (error) {
219
+ toast.error('채팅 시작에 실패했습니다.');
216
220
  console.error('[DaeryuntalkContext] 채팅 시작 오류:', error);
217
221
  throw error;
218
222
  } finally {
@@ -230,6 +234,7 @@ export const useChatHandler = ({
230
234
  console.log('chatInquiryNumber', chatInquiryNumber);
231
235
  await sendChatMessage(chatInquiryNumber as string, htmlContent, jsonData);
232
236
  } catch (error) {
237
+ toast.error('메시지 전송에 실패했습니다.');
233
238
  console.error('[DaeryuntalkContext] 메시지 전송 중 오류 발생:', error);
234
239
  } finally {
235
240
  setIsLoading(false);
@@ -298,6 +303,7 @@ export const useChatHandler = ({
298
303
  } else {
299
304
  }
300
305
  } catch (error) {
306
+ toast.error('채팅 문의 생성에 실패했습니다.');
301
307
  console.error('[DaeryuntalkContext] 신규 채팅문의 생성:', error);
302
308
  } finally {
303
309
  setIsLoading(false);
@@ -330,6 +336,7 @@ export const useChatHandler = ({
330
336
  try {
331
337
  await chatWorkFlow(chatInquiryNumber, messageNumber, workFlowNumber, objectNumber);
332
338
  } catch (error) {
339
+ toast.error('워크플로우 생성에 실패했습니다.');
333
340
  console.error('[워크 플로우 생성 실패]:', error);
334
341
  } finally {
335
342
  setIsLoading(false);
@@ -354,6 +361,7 @@ export const useChatHandler = ({
354
361
  try {
355
362
  await chatWorkFlowBack(chatInquiryNumber, messageNumber, workFlowNavigationCode);
356
363
  } catch (error) {
364
+ toast.error('동작에 실패했습니다.');
357
365
  console.error('[워크 플로우 생성 실패]:', error);
358
366
  } finally {
359
367
  setIsLoading(false);
@@ -384,6 +392,7 @@ export const useChatHandler = ({
384
392
  try {
385
393
  await apiChatUserUpdate(chatInquiryNumber, messageNumber, name, cellPhoneNumber);
386
394
  } catch (error) {
395
+ toast.error('개인정보 업데이트에 실패했습니다.');
387
396
  console.error('[워크 플로우 생성 실패]:', error);
388
397
  } finally {
389
398
  setIsLoading(false);
@@ -394,38 +403,28 @@ export const useChatHandler = ({
394
403
 
395
404
  const getNextMessageList = useCallback(async (chatInquiryNumber: string, standardDateTime: any) => {
396
405
  const chatList = await getChatInquiryMessageList(chatInquiryNumber, standardDateTime);
397
- if (chatList.data) {
398
- // 앞에 생성될 여기서는 앞에서부터 채워야함
399
- const newMessageList = chatList.data.message_list
400
- .sort((a, b) => a.timestamp - b.timestamp)
401
- .map(item => {
402
- return convertApiMessageToUiMessage(item);
406
+ if (chatList.result_info.result_cd === 'OK' || chatList.result_info.result_type_cd === 'OK') {
407
+ if (chatList.data) {
408
+ // 앞에 생성될 여기서는 앞에서부터 채워야함
409
+ const newMessageList = chatList.data.message_list
410
+ .sort((a, b) => a.timestamp - b.timestamp)
411
+ .map(item => {
412
+ return convertApiMessageToUiMessage(item);
413
+ });
414
+ setIsNextPage(chatList.data.next_page_yn);
415
+ setMessages(prev => {
416
+ if (newMessageList && newMessageList.length > 0) {
417
+ return [...newMessageList, ...prev];
418
+ } else {
419
+ return [...prev];
420
+ }
403
421
  });
404
- setIsNextPage(chatList.data.next_page_yn);
405
- setMessages(prev => {
406
- if (newMessageList && newMessageList.length > 0) {
407
- return [...newMessageList, ...prev];
408
- } else {
409
- return [...prev];
410
- }
411
- });
422
+ }
423
+ } else {
424
+ toast.error('메세지 조회에 실패했습니다.');
412
425
  }
413
426
  }, []);
414
427
 
415
- // 파일 다운로드 url
416
- const getDownLoadUrl = useCallback(
417
- async ({
418
- chatInquiryNumber,
419
- fileNumber
420
- }: {
421
- chatInquiryNumber: string; // required
422
- fileNumber: string;
423
- }) => {
424
- return await getMessageFileDownloadUrl({ chatInquiryNumber, fileNumber });
425
- },
426
- []
427
- );
428
-
429
428
  return {
430
429
  startChat,
431
430
  sendMessage,
@@ -434,7 +433,6 @@ export const useChatHandler = ({
434
433
  workFlowBack,
435
434
  chatUserUpdate,
436
435
  getNextMessageList,
437
- getDownLoadUrl,
438
436
  startSelectedChat
439
437
  };
440
438
  };
@@ -0,0 +1,6 @@
1
+ export declare function useScrollShadow<T extends HTMLElement>(): {
2
+ containerRef: import("react").MutableRefObject<T | null>;
3
+ isScroll: boolean;
4
+ isBottom: boolean;
5
+ checkScroll: () => void;
6
+ };
@@ -0,0 +1,27 @@
1
+ import { useEffect, useRef, useState, useCallback } from 'react';
2
+ export function useScrollShadow() {
3
+ const containerRef = useRef(null);
4
+ const [isScroll, setIsScroll] = useState(false);
5
+ const [isBottom, setIsBottom] = useState(false);
6
+ const checkScroll = useCallback(() => {
7
+ const container = containerRef.current;
8
+ if (!container)
9
+ return;
10
+ const { scrollHeight, scrollTop, clientHeight } = container;
11
+ const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
12
+ setIsScroll(scrollHeight > clientHeight && scrollPercentage >= 0.9);
13
+ setIsBottom(scrollPercentage >= 0.95);
14
+ }, []);
15
+ useEffect(() => {
16
+ const container = containerRef.current;
17
+ if (!container)
18
+ return;
19
+ container.addEventListener('scroll', checkScroll);
20
+ // mount 시 초기 상태 확인
21
+ checkScroll();
22
+ return () => {
23
+ container.removeEventListener('scroll', checkScroll);
24
+ };
25
+ }, [checkScroll]);
26
+ return { containerRef, isScroll, isBottom, checkScroll };
27
+ }
@@ -0,0 +1,34 @@
1
+ import { useEffect, useRef, useState, useCallback } from 'react';
2
+
3
+ export function useScrollShadow<T extends HTMLElement>() {
4
+ const containerRef = useRef<T | null>(null);
5
+ const [isScroll, setIsScroll] = useState(false);
6
+ const [isBottom, setIsBottom] = useState(false);
7
+
8
+ const checkScroll = useCallback(() => {
9
+ const container = containerRef.current;
10
+ if (!container) return;
11
+
12
+ const { scrollHeight, scrollTop, clientHeight } = container;
13
+ const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
14
+
15
+ setIsScroll(scrollHeight > clientHeight && scrollPercentage >= 0.9);
16
+ setIsBottom(scrollPercentage >= 0.95);
17
+ }, []);
18
+
19
+ useEffect(() => {
20
+ const container = containerRef.current;
21
+ if (!container) return;
22
+
23
+ container.addEventListener('scroll', checkScroll);
24
+
25
+ // mount 시 초기 상태 확인
26
+ checkScroll();
27
+
28
+ return () => {
29
+ container.removeEventListener('scroll', checkScroll);
30
+ };
31
+ }, [checkScroll]);
32
+
33
+ return { containerRef, isScroll, isBottom, checkScroll };
34
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const ShadowBox: () => React.JSX.Element;
3
+ export default ShadowBox;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ const ShadowBox = () => {
3
+ return (<div className="absolute bottom-0 left-0 z-[10] h-[50px] w-full bg-gradient-to-t from-[rgba(255,255,255,1)] to-[rgba(255,255,255,0)]"/>);
4
+ };
5
+ export default ShadowBox;