@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
@@ -1,6 +1,8 @@
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'; // 추가
5
+
4
6
  import { JSONContent } from '@tiptap/core'; // 추가 필요
5
7
  import Document from '@tiptap/extension-document';
6
8
  import Paragraph from '@tiptap/extension-paragraph';
@@ -25,7 +27,18 @@ interface TiptapProps {
25
27
  const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
26
28
  ({ onChange, placeholder = '메시지를 입력하세요...', onEnterKeyPress, onKeyDown }, ref) => {
27
29
  const editor = useEditor({
28
- extensions: [Document, Paragraph, Text, Placeholder.configure({ placeholder })],
30
+ extensions: [
31
+ Document,
32
+ Paragraph,
33
+ Text,
34
+ Placeholder.configure({ placeholder }),
35
+ HardBreak.configure({
36
+ keepMarks: false,
37
+ HTMLAttributes: {
38
+ class: 'my-custom-hard-break'
39
+ }
40
+ })
41
+ ],
29
42
  content: '',
30
43
  enableInputRules: false,
31
44
  enablePasteRules: false,
@@ -43,20 +56,24 @@ const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
43
56
  },
44
57
  editorProps: {
45
58
  attributes: {
46
- 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'
59
+ 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'
47
60
  },
48
61
  handleKeyDown: (view, event) => {
49
62
  if (event.key === 'Enter') {
50
63
  if (event.shiftKey) {
51
- // 줄바꿈 이후 스크롤 이동 보장
52
- requestAnimationFrame(() => {
53
- if (view && view.dom) {
54
- // 가장 아래에 스크롤되도록 처리
55
- view.dom.scrollTop = view.dom.scrollHeight;
56
- }
57
- });
58
- return false;
64
+ // Shift+Enter: 줄바꿈 (hard break) 삽입
65
+ if (editor) {
66
+ editor.commands.setHardBreak();
67
+ // 줄바꿈 이후 스크롤 이동 보장
68
+ requestAnimationFrame(() => {
69
+ if (view && view.dom) {
70
+ view.dom.scrollTop = view.dom.scrollHeight;
71
+ }
72
+ });
73
+ }
74
+ return true; // 기본 동작 방지
59
75
  } else {
76
+ // Enter: 메시지 전송
60
77
  event.preventDefault();
61
78
  const content = editor?.getText();
62
79
  if (content && content.trim() && onEnterKeyPress) {
@@ -96,7 +113,14 @@ const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
96
113
 
97
114
  if (!editor) return null;
98
115
 
99
- return <EditorContent editor={editor} tabIndex={0} className="rounded-md border text-black dark:text-white" />;
116
+ // return <EditorContent editor={editor} tabIndex={0} className="rounded-md border text-black dark:text-white" />;
117
+ return (
118
+ <EditorContent
119
+ editor={editor}
120
+ tabIndex={0}
121
+ className="w-full overflow-hidden rounded-md border text-black dark:text-white"
122
+ />
123
+ );
100
124
  }
101
125
  );
102
126
 
@@ -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
+ }
@@ -1,6 +1,7 @@
1
1
  export declare const formatFileSize: (size: number) => string;
2
2
  export declare const formatDateToKorean: (timestamp: string) => string;
3
3
  export declare const onlyNumbers: (phoneNumber: string) => string;
4
+ export declare const isEmptyHtml: (html: string | null | undefined) => boolean;
4
5
  export declare const phoneCheck: (value: string) => {
5
6
  phoneNumber: string;
6
7
  isValid: boolean;
@@ -17,6 +17,15 @@ export const formatDateToKorean = (timestamp) => {
17
17
  export const onlyNumbers = (phoneNumber) => {
18
18
  return phoneNumber.replace(/\D/g, '');
19
19
  };
20
+ export const isEmptyHtml = (html) => {
21
+ if (!html)
22
+ return true;
23
+ const trimmed = html
24
+ .replace(/<p><br><\/p>/g, '')
25
+ .replace(/<p>\s*<\/p>/g, '')
26
+ .trim();
27
+ return trimmed === '';
28
+ };
20
29
  export const phoneCheck = (value) => {
21
30
  const phoneNumber = onlyNumbers(value);
22
31
  // 10자리 또는 11자리만 통과
@@ -20,6 +20,15 @@ export const onlyNumbers = (phoneNumber: string): string => {
20
20
  return phoneNumber.replace(/\D/g, '');
21
21
  };
22
22
 
23
+ export const isEmptyHtml = (html: string | null | undefined): boolean => {
24
+ if (!html) return true;
25
+ const trimmed = html
26
+ .replace(/<p><br><\/p>/g, '')
27
+ .replace(/<p>\s*<\/p>/g, '')
28
+ .trim();
29
+ return trimmed === '';
30
+ };
31
+
23
32
  export const phoneCheck = (
24
33
  value: string
25
34
  ): {
@@ -1,9 +1,10 @@
1
1
  // todo 올바른 타입 정의 필요
2
2
  import { InquiryMessageTemplateType } from '../_enums/template';
3
+ import { isEmptyHtml } from '../_lib/utils';
3
4
  // 메시지에 특정 컨텐츠가 있는지 확인하는 헬퍼 함수들
4
5
  export const hasBlocks = (message) => !!message.blocks && message.blocks.length > 0;
5
6
  //
6
- export const hasRichForm = (message) => !!message.richText && message.richText.structuredData;
7
+ export const hasRichForm = (message) => { var _a; return !!message.richText && message.richText.structuredData && isEmptyHtml((_a = message === null || message === void 0 ? void 0 : message.richText) === null || _a === void 0 ? void 0 : _a.htmlContent); };
7
8
  // 사용자가 워크플로우 대답 클릭한거
8
9
  export const hasCustomerWorkFlowClickData = (message) => message.templateType === InquiryMessageTemplateType.WORK_FLOW_TEMPLATE_3;
9
10
  export const hasButtons = (message) => !!message.buttons && message.buttons.length > 0;
@@ -3,6 +3,7 @@
3
3
  // 텍스트 블록 타입
4
4
  import exp from 'constants';
5
5
  import { InquiryMessageTemplateType } from '../_enums/template';
6
+ import { isEmptyHtml } from '../_lib/utils';
6
7
 
7
8
  export interface TextBlock {
8
9
  type: string;
@@ -125,7 +126,8 @@ export interface Message {
125
126
  export const hasBlocks = (message: Message): boolean => !!message.blocks && message.blocks.length > 0;
126
127
 
127
128
  //
128
- export const hasRichForm = (message: Message): boolean => !!message.richText && message.richText.structuredData;
129
+ export const hasRichForm = (message: Message): boolean =>
130
+ !!message.richText && message.richText.structuredData && isEmptyHtml(message?.richText?.htmlContent);
129
131
 
130
132
  // 사용자가 워크플로우 대답 클릭한거
131
133
  export const hasCustomerWorkFlowClickData = (message: Message): boolean =>
@@ -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;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+
3
+ const ShadowBox = () => {
4
+ return (
5
+ <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)]" />
6
+ );
7
+ };
8
+
9
+ export default ShadowBox;
@@ -3,14 +3,17 @@ import React, { useState } from 'react';
3
3
  import ChatButton from './ChatButton';
4
4
  import ChatWidget from './ChatWidget';
5
5
  import { DaeryuntalkProvider } from './DaeryuntalkContext';
6
+ import { DaeryuntalkToastProvider } from './Toast/DaeryuntalkToastProvider';
6
7
  const Daeryuntalk = ({ tel = '1800-7905' }) => {
7
8
  const [isOpen, setIsOpen] = useState(false);
8
9
  const toggleChat = () => {
9
10
  setIsOpen(prev => !prev);
10
11
  };
11
- return (<DaeryuntalkProvider propsTel={tel}>
12
- <ChatButton isOpen={isOpen} onClick={toggleChat}/>
13
- <ChatWidget isOpen={isOpen}/>
14
- </DaeryuntalkProvider>);
12
+ return (<DaeryuntalkToastProvider>
13
+ <DaeryuntalkProvider propsTel={tel}>
14
+ <ChatButton isOpen={isOpen} onClick={toggleChat}/>
15
+ <ChatWidget isOpen={isOpen}/>
16
+ </DaeryuntalkProvider>
17
+ </DaeryuntalkToastProvider>);
15
18
  };
16
19
  export default Daeryuntalk;
@@ -5,6 +5,7 @@ import ChatButton from './ChatButton';
5
5
  import ChatWidget from './ChatWidget';
6
6
  import { DaeryuntalkProvider } from './DaeryuntalkContext';
7
7
  import ImageViewer from './Viewer/ImageViewer';
8
+ import { DaeryuntalkToastProvider } from './Toast/DaeryuntalkToastProvider';
8
9
 
9
10
  type DaeryuntalkProps = {
10
11
  tel: string;
@@ -18,10 +19,12 @@ const Daeryuntalk: React.FC<DaeryuntalkProps> = ({ tel = '1800-7905' }) => {
18
19
  };
19
20
 
20
21
  return (
21
- <DaeryuntalkProvider propsTel={tel}>
22
- <ChatButton isOpen={isOpen} onClick={toggleChat} />
23
- <ChatWidget isOpen={isOpen} />
24
- </DaeryuntalkProvider>
22
+ <DaeryuntalkToastProvider>
23
+ <DaeryuntalkProvider propsTel={tel}>
24
+ <ChatButton isOpen={isOpen} onClick={toggleChat} />
25
+ <ChatWidget isOpen={isOpen} />
26
+ </DaeryuntalkProvider>
27
+ </DaeryuntalkToastProvider>
25
28
  );
26
29
  };
27
30