@daeryun/dr_components 0.8.84 → 0.8.86

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 (35) hide show
  1. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  2. package/dist/components/Daeryuntalk/ChatConversation.jsx +55 -3
  3. package/dist/components/Daeryuntalk/ChatConversation.tsx +61 -2
  4. package/dist/components/Daeryuntalk/ChatItem/ChatLoading.jsx +3 -3
  5. package/dist/components/Daeryuntalk/ChatItem/ChatLoading.tsx +3 -3
  6. package/dist/components/Daeryuntalk/ChatItem/TypingComp.d.ts +3 -0
  7. package/dist/components/Daeryuntalk/ChatItem/TypingComp.jsx +28 -0
  8. package/dist/components/Daeryuntalk/ChatItem/TypingComp.tsx +38 -0
  9. package/dist/components/Daeryuntalk/ChatMessage.jsx +0 -1
  10. package/dist/components/Daeryuntalk/ChatMessage.tsx +0 -1
  11. package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +1 -0
  12. package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +8 -3
  13. package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +10 -3
  14. package/dist/components/Daeryuntalk/HistoryView.jsx +1 -1
  15. package/dist/components/Daeryuntalk/HistoryView.tsx +3 -1
  16. package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +3 -4
  17. package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +3 -3
  18. package/dist/components/Daeryuntalk/Viewer/MobileViewer.jsx +7 -6
  19. package/dist/components/Daeryuntalk/Viewer/MobileViewer.tsx +7 -6
  20. package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +1 -0
  21. package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +1 -0
  22. package/dist/components/Daeryuntalk/_enums/socket_type.d.ts +3 -1
  23. package/dist/components/Daeryuntalk/_enums/socket_type.js +2 -0
  24. package/dist/components/Daeryuntalk/_enums/socket_type.ts +4 -1
  25. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +2 -1
  26. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +18 -2
  27. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +26 -1
  28. package/dist/components/Daeryuntalk/_hooks/view/useChatSocketState.js +5 -12
  29. package/dist/components/Daeryuntalk/_hooks/view/useChatSocketState.ts +5 -12
  30. package/dist/components/Daeryuntalk/_ui/ShadowBox.d.ts +4 -1
  31. package/dist/components/Daeryuntalk/_ui/ShadowBox.jsx +2 -2
  32. package/dist/components/Daeryuntalk/_ui/ShadowBox.tsx +7 -2
  33. package/dist/styles/globals.css +23 -10
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +1 -1
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import DaeryunLogoIcon from '../../../asset/images/daeryuntalk/daeryun-logo.svg';
3
+ import ChatWrapper from './ChatWrapper';
4
+ const TypingComp = () => {
5
+ return (<div className="flex flex-col">
6
+ <div className="flex items-center gap-[10px]">
7
+ <div className="flex-shrink-0 rounded-full">
8
+ <div className="relative h-full w-full">
9
+ <DaeryunLogoIcon width={24} height={24}/>
10
+ </div>
11
+ </div>
12
+ <span className="dr_talk_subtitle_medium text-drTalkBlack">법무법인(유한)대륜</span>
13
+ </div>
14
+
15
+ <div className="flex items-end pl-[34px]">
16
+ <ChatWrapper isOperator={true} className="!border-[0px] !px-[0px]">
17
+ <div className="flex h-[36px] items-center ">
18
+ <div className="flex animate-pulse space-x-2 rounded-full ">
19
+ <div className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale2 "></div>
20
+ <div className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale3" style={{ animationDelay: '0.2s' }}></div>
21
+ <div className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale3" style={{ animationDelay: '0.4s' }}></div>
22
+ </div>
23
+ </div>
24
+ </ChatWrapper>
25
+ </div>
26
+ </div>);
27
+ };
28
+ export default TypingComp;
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import DaeryunLogoIcon from '../../../asset/images/daeryuntalk/daeryun-logo.svg';
3
+ import ChatWrapper from './ChatWrapper';
4
+
5
+ const TypingComp = () => {
6
+ return (
7
+ <div className="flex flex-col">
8
+ <div className="flex items-center gap-[10px]">
9
+ <div className="flex-shrink-0 rounded-full">
10
+ <div className="relative h-full w-full">
11
+ <DaeryunLogoIcon width={24} height={24} />
12
+ </div>
13
+ </div>
14
+ <span className="dr_talk_subtitle_medium text-drTalkBlack">법무법인(유한)대륜</span>
15
+ </div>
16
+
17
+ <div className="flex items-end pl-[34px]">
18
+ <ChatWrapper isOperator={true} className="!border-[0px] !px-[0px]">
19
+ <div className="flex h-[36px] items-center ">
20
+ <div className="flex animate-pulse space-x-2 rounded-full ">
21
+ <div className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale2 "></div>
22
+ <div
23
+ className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale3"
24
+ style={{ animationDelay: '0.2s' }}
25
+ ></div>
26
+ <div
27
+ className="h-[8px] w-[8px] animate-bounce rounded-full bg-drTalkGrayscale3"
28
+ style={{ animationDelay: '0.4s' }}
29
+ ></div>
30
+ </div>
31
+ </div>
32
+ </ChatWrapper>
33
+ </div>
34
+ </div>
35
+ );
36
+ };
37
+
38
+ export default TypingComp;
@@ -53,7 +53,6 @@ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, wor
53
53
  const isAuthForm = hasForm(message);
54
54
  const isRichForm = hasRichForm(message);
55
55
  const isFile = hasFileArray(message);
56
- console.log('inquiryStatus', inquiryStatus);
57
56
  // 파일이 있는경우
58
57
  if (isFile) {
59
58
  return (<div className={`flex flex-col gap-[10px]`}>
@@ -84,7 +84,6 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
84
84
  const isAuthForm = hasForm(message);
85
85
  const isRichForm = hasRichForm(message);
86
86
  const isFile = hasFileArray(message);
87
- console.log('inquiryStatus', inquiryStatus);
88
87
 
89
88
  // 파일이 있는경우
90
89
  if (isFile) {
@@ -74,6 +74,7 @@ type DaeryuntalkContextType = {
74
74
  setMessageObject: (obj: MessageObject | null) => void;
75
75
  setWorkFlowStack: (arr: string[]) => void;
76
76
  retryInitData: () => void;
77
+ isTyping: boolean;
77
78
  };
78
79
  declare const DaeryuntalkContext: React.Context<DaeryuntalkContextType>;
79
80
  type DaeryuntalkProviderProps = {
@@ -56,7 +56,8 @@ const DaeryuntalkContext = createContext({
56
56
  retryInquiryMain: () => { },
57
57
  setMessageObject: () => { },
58
58
  setWorkFlowStack: () => { },
59
- retryInitData: () => { }
59
+ retryInitData: () => { },
60
+ isTyping: false
60
61
  });
61
62
  export const DaeryuntalkProvider = ({ children, propsTel, isMobile }) => {
62
63
  const [inquiryStatus, setInquiryStatus] = useState('');
@@ -76,6 +77,8 @@ export const DaeryuntalkProvider = ({ children, propsTel, isMobile }) => {
76
77
  const socketRef = useRef(null);
77
78
  // 히스토리 리스트
78
79
  const [historyList, setHistoryList] = useState([]);
80
+ // 채팅 입력중 UI여부
81
+ const [isTyping, setIsTyping] = useState(false);
79
82
  // 소켓 관련 API + 채팅 시작
80
83
  const { initializeDaeryuntalk, sendHeartbeat, sendInquiryJoined, sendInquiryLeft, sendHistoryEntered, sendHistoryLeft, sendInquiryWatching, retryInquiryMain, retryInitData } = useSocketEventHandler({
81
84
  setIsConnected,
@@ -90,7 +93,8 @@ export const DaeryuntalkProvider = ({ children, propsTel, isMobile }) => {
90
93
  historyList,
91
94
  inquiryMainData,
92
95
  isMobile,
93
- setIsAuthenticated
96
+ setIsAuthenticated,
97
+ setIsTyping
94
98
  });
95
99
  // MSG15591497825895676
96
100
  // 채팅 관련
@@ -153,7 +157,8 @@ export const DaeryuntalkProvider = ({ children, propsTel, isMobile }) => {
153
157
  retryInquiryMain,
154
158
  setMessageObject,
155
159
  setWorkFlowStack,
156
- retryInitData
160
+ retryInitData,
161
+ isTyping
157
162
  }}>
158
163
  {children}
159
164
  </DaeryuntalkContext.Provider>);
@@ -79,6 +79,7 @@ type DaeryuntalkContextType = {
79
79
  setMessageObject: (obj: MessageObject | null) => void;
80
80
  setWorkFlowStack: (arr: string[]) => void;
81
81
  retryInitData: () => void;
82
+ isTyping: boolean;
82
83
  };
83
84
 
84
85
  // 기본값으로 컨텍스트 생성
@@ -125,7 +126,8 @@ const DaeryuntalkContext = createContext<DaeryuntalkContextType>({
125
126
  retryInquiryMain: () => {},
126
127
  setMessageObject: () => {},
127
128
  setWorkFlowStack: () => {},
128
- retryInitData: () => {}
129
+ retryInitData: () => {},
130
+ isTyping: false
129
131
  });
130
132
 
131
133
  // 프로바이더 컴포넌트 생성
@@ -158,6 +160,9 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
158
160
  // 히스토리 리스트
159
161
  const [historyList, setHistoryList] = useState<History[]>([]);
160
162
 
163
+ // 채팅 입력중 UI여부
164
+ const [isTyping, setIsTyping] = useState(false);
165
+
161
166
  // 소켓 관련 API + 채팅 시작
162
167
  const {
163
168
  initializeDaeryuntalk,
@@ -182,7 +187,8 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
182
187
  historyList,
183
188
  inquiryMainData,
184
189
  isMobile,
185
- setIsAuthenticated
190
+ setIsAuthenticated,
191
+ setIsTyping
186
192
  });
187
193
 
188
194
  // MSG15591497825895676
@@ -263,7 +269,8 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
263
269
  retryInquiryMain,
264
270
  setMessageObject,
265
271
  setWorkFlowStack,
266
- retryInitData
272
+ retryInitData,
273
+ isTyping
267
274
  }}
268
275
  >
269
276
  {children}
@@ -51,7 +51,7 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
51
51
  </span>
52
52
  </div>
53
53
  <div className=" mt-[10px] flex items-center justify-between">
54
- <p className="dr_talk_body_medium2 line-clamp-2 w-[calc(100%-24px)] text-drTalkGrayscale2 ">
54
+ <p className={`${history.unread_message_count && history.unread_message_count > 0 ? 'text-black' : 'text-drTalkGrayscale2'} dr_talk_body_medium2 line-clamp-2 w-[calc(100%-24px)] `}>
55
55
  {history.recent_message_content}
56
56
  </p>
57
57
  <LinkRight width={18} height={18} className="flex-shrink-0"/>
@@ -112,7 +112,9 @@ const HistoryView: React.FC<HistoryViewProps> = ({
112
112
  </span>
113
113
  </div>
114
114
  <div className=" mt-[10px] flex items-center justify-between">
115
- <p className="dr_talk_body_medium2 line-clamp-2 w-[calc(100%-24px)] text-drTalkGrayscale2 ">
115
+ <p
116
+ className={`${history.unread_message_count && history.unread_message_count > 0 ? 'text-black' : 'text-drTalkGrayscale2'} dr_talk_body_medium2 line-clamp-2 w-[calc(100%-24px)] `}
117
+ >
116
118
  {history.recent_message_content}
117
119
  </p>
118
120
  <LinkRight width={18} height={18} className="flex-shrink-0" />
@@ -5,7 +5,6 @@ import HardBreak from '@tiptap/extension-hard-break'; // 추가
5
5
  import Document from '@tiptap/extension-document';
6
6
  import Paragraph from '@tiptap/extension-paragraph';
7
7
  import Text from '@tiptap/extension-text';
8
- import ShadowBox from '../_ui/ShadowBox';
9
8
  const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력해 주세요.', onEnterKeyPress, onKeyDown, contentClassName = '' }, ref) => {
10
9
  const containerRef = useRef(null);
11
10
  const [isScroll, setIsScroll] = useState(false);
@@ -40,7 +39,7 @@ const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력해 주
40
39
  },
41
40
  editorProps: {
42
41
  attributes: {
43
- class: `dr_talk_body_medium2 focus:outline-none overflow-y-auto resize-none pt-[6px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere no-scrollbar `
42
+ class: `max-h-[72px] min-h-[36px] overflow-auto dr_talk_body_medium2 focus:outline-none overflow-y-auto resize-none pt-[6px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere no-scrollbar `
44
43
  },
45
44
  handleKeyDown: (view, event) => {
46
45
  const isMobile = /Mobi|Android/i.test(navigator.userAgent); // 모바일 여부 판별
@@ -121,9 +120,9 @@ const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력해 주
121
120
  return null;
122
121
  return (<div className={`relative w-full `}>
123
122
  <div ref={containerRef} className={`w-full`}>
124
- <EditorContent editor={editor} tabIndex={0} className={`${contentClassName} max-h-[72px] min-h-[36px] w-full overflow-hidden rounded-md border !text-black dark:text-white `}/>
123
+ <EditorContent editor={editor} tabIndex={0} className={`${contentClassName} w-full rounded-md border !text-black dark:text-white `}/>
125
124
  </div>
126
- {isScroll && !isBottom && <ShadowBox />}
125
+ {/*{isScroll && !isBottom && <ShadowBox className={`!h-[5px]`} />}*/}
127
126
  </div>);
128
127
  });
129
128
  Tiptap.displayName = 'Tiptap';
@@ -64,7 +64,7 @@ const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
64
64
  },
65
65
  editorProps: {
66
66
  attributes: {
67
- class: `dr_talk_body_medium2 focus:outline-none overflow-y-auto resize-none pt-[6px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere no-scrollbar `
67
+ class: `max-h-[72px] min-h-[36px] overflow-auto dr_talk_body_medium2 focus:outline-none overflow-y-auto resize-none pt-[6px] pb-[4px] break-words whitespace-pre-wrap word-wrap break-word overflow-wrap-anywhere no-scrollbar `
68
68
  },
69
69
  handleKeyDown: (view, event) => {
70
70
  const isMobile = /Mobi|Android/i.test(navigator.userAgent); // 모바일 여부 판별
@@ -157,10 +157,10 @@ const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
157
157
  <EditorContent
158
158
  editor={editor}
159
159
  tabIndex={0}
160
- className={`${contentClassName} max-h-[72px] min-h-[36px] w-full overflow-hidden rounded-md border !text-black dark:text-white `}
160
+ className={`${contentClassName} w-full rounded-md border !text-black dark:text-white `}
161
161
  />
162
162
  </div>
163
- {isScroll && !isBottom && <ShadowBox />}
163
+ {/*{isScroll && !isBottom && <ShadowBox className={`!h-[5px]`} />}*/}
164
164
  </div>
165
165
  );
166
166
  }
@@ -39,18 +39,19 @@ const MobileViewer = ({ imageViewerMessage, handleDownload, currentIndex, setCur
39
39
  </div>
40
40
  </div>
41
41
  {/* 해당 공간은 중앙 배치 및 화면작아지면 스크롤 */}
42
+
42
43
  <div className={`mx-[20px] flex h-[calc(100dvh-68px-155px)] flex-col items-center justify-center overflow-auto`}>
43
- <div className="group relative flex w-full items-center justify-center overflow-auto">
44
- <Swiper spaceBetween={0} slidesPerView={1} initialSlide={currentIndex} onSlideChange={swiper => {
44
+ <div className="group relative flex h-full w-full items-center justify-center overflow-auto">
45
+ <Swiper spaceBetween={2} slidesPerView={1} initialSlide={currentIndex} onSlideChange={swiper => {
45
46
  setCurrentIndex(swiper.activeIndex);
46
47
  setRotation(0);
47
48
  setZoomLevel(3);
48
49
  }} onSwiper={swiper => {
49
50
  thumbSwiperRef.current = swiper;
50
- }} allowTouchMove={previewImages.length > 1} className="w-full">
51
- {previewImages.map((img, idx) => (<SwiperSlide key={idx} className="flex items-center justify-center rounded-[20px] ">
52
- <div className="relative flex h-auto max-h-[500px] items-center justify-center rounded-[20px]">
53
- <Image src={img.url} alt={img.file.name} width={500} height={500} className="mx-auto h-auto max-h-[500px] w-fit max-w-full rounded-[20px] object-contain" unoptimized/>
51
+ }} allowTouchMove={previewImages.length > 1} className="!h-full w-full">
52
+ {previewImages.map((img, idx) => (<SwiperSlide key={idx} className="flex !h-full items-center justify-center">
53
+ <div className="relative flex h-full w-full items-center justify-center">
54
+ <Image src={img.url} alt={img.file.name} width={500} height={500} className="h-auto max-h-full w-auto max-w-full rounded-[20px] object-contain" unoptimized/>
54
55
  </div>
55
56
  </SwiperSlide>))}
56
57
  </Swiper>
@@ -66,12 +66,13 @@ const MobileViewer = ({
66
66
  </div>
67
67
  </div>
68
68
  {/* 해당 공간은 중앙 배치 및 화면작아지면 스크롤 */}
69
+
69
70
  <div
70
71
  className={`mx-[20px] flex h-[calc(100dvh-68px-155px)] flex-col items-center justify-center overflow-auto`}
71
72
  >
72
- <div className="group relative flex w-full items-center justify-center overflow-auto">
73
+ <div className="group relative flex h-full w-full items-center justify-center overflow-auto">
73
74
  <Swiper
74
- spaceBetween={0}
75
+ spaceBetween={2}
75
76
  slidesPerView={1}
76
77
  initialSlide={currentIndex}
77
78
  onSlideChange={swiper => {
@@ -83,17 +84,17 @@ const MobileViewer = ({
83
84
  thumbSwiperRef.current = swiper;
84
85
  }}
85
86
  allowTouchMove={previewImages.length > 1}
86
- className="w-full"
87
+ className="!h-full w-full"
87
88
  >
88
89
  {previewImages.map((img, idx) => (
89
- <SwiperSlide key={idx} className="flex items-center justify-center rounded-[20px] ">
90
- <div className="relative flex h-auto max-h-[500px] items-center justify-center rounded-[20px]">
90
+ <SwiperSlide key={idx} className="flex !h-full items-center justify-center">
91
+ <div className="relative flex h-full w-full items-center justify-center">
91
92
  <Image
92
93
  src={img.url}
93
94
  alt={img.file.name}
94
95
  width={500}
95
96
  height={500}
96
- className="mx-auto h-auto max-h-[500px] w-fit max-w-full rounded-[20px] object-contain"
97
+ className="h-auto max-h-full w-auto max-w-full rounded-[20px] object-contain"
97
98
  unoptimized
98
99
  />
99
100
  </div>
@@ -253,6 +253,7 @@ export function connectWebSocket(wsUrl, token, isOpen, setIsConnected, onMessage
253
253
  setupSocketHandlers(newSocket);
254
254
  }
255
255
  catch (error) {
256
+ console.log('socket error', error);
256
257
  setIsConnected(false);
257
258
  }
258
259
  }
@@ -314,6 +314,7 @@ export function connectWebSocket(
314
314
  // 새 소켓에 핸들러 등록
315
315
  setupSocketHandlers(newSocket);
316
316
  } catch (error) {
317
+ console.log('socket error', error);
317
318
  setIsConnected(false);
318
319
  }
319
320
  } else {
@@ -18,5 +18,7 @@ export declare enum MessageSocketType {
18
18
  /** 할당된 상담원이 해제됨 */
19
19
  INQUIRY_UNASSIGNED = "inquiry.unassigned",
20
20
  /** 고객 정보가 갱신됨 */
21
- CUSTOMER_INFO_UPDATED = "customer.info.updated"
21
+ CUSTOMER_INFO_UPDATED = "customer.info.updated",
22
+ /** 타이핑중임 */
23
+ TYPING_STARTED = "typing.started"
22
24
  }
@@ -30,4 +30,6 @@ export var MessageSocketType;
30
30
  /** 고객 정보가 갱신됨 */
31
31
  MessageSocketType["CUSTOMER_INFO_UPDATED"] = "customer.info.updated";
32
32
  // -> 미처라
33
+ /** 타이핑중임 */
34
+ MessageSocketType["TYPING_STARTED"] = "typing.started";
33
35
  })(MessageSocketType || (MessageSocketType = {}));
@@ -36,6 +36,9 @@ export enum MessageSocketType {
36
36
  // -> 미처라
37
37
 
38
38
  /** 고객 정보가 갱신됨 */
39
- CUSTOMER_INFO_UPDATED = 'customer.info.updated'
39
+ CUSTOMER_INFO_UPDATED = 'customer.info.updated',
40
40
  // -> 미처라
41
+
42
+ /** 타이핑중임 */
43
+ TYPING_STARTED = 'typing.started'
41
44
  }
@@ -16,8 +16,9 @@ interface props {
16
16
  inquiryMainData: IChatInquiryMainDataResponse | null;
17
17
  isMobile: boolean;
18
18
  setIsAuthenticated: Dispatch<SetStateAction<boolean>>;
19
+ setIsTyping: Dispatch<SetStateAction<boolean>>;
19
20
  }
20
- export declare const useSocketEventHandler: ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated }: props) => {
21
+ export declare const useSocketEventHandler: ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated, setIsTyping }: props) => {
21
22
  initializeDaeryuntalk: (hashValue: string | null, isOpen: boolean, version?: string) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<IChatInquiryMainDataResponse> | null | undefined>;
22
23
  sendHeartbeat: () => void;
23
24
  sendInquiryJoined: (chatInquiryNumber: string) => void;
@@ -7,15 +7,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { useCallback } from 'react';
10
+ import { useCallback, useRef } from 'react';
11
11
  import { authenticateUser, getChatInquiryMain, getHistoryList, initializeDaeryuntalk as apiInitializeDaeryuntalk, TEST_CENTER_CODE } from '../../_api/daeryuntalk';
12
12
  import { convertApiMessageToUiMessage, convertSocketObjectToUiMessage } from '../../_lib';
13
13
  import { MessageSocketType } from '../../_enums/socket_type';
14
14
  import { InquiryStatusEnum } from '../../_enums/ask-status';
15
15
  import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
16
16
  import { getErrorMessageMap } from '../../_enums/error';
17
- export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated }) => {
17
+ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated, setIsTyping }) => {
18
+ const typingTimeoutRef = useRef(null);
18
19
  const toast = useDaeryunTalkToast();
20
+ const handleTypingStarted = () => {
21
+ setIsTyping(true);
22
+ if (typingTimeoutRef.current) {
23
+ clearTimeout(typingTimeoutRef.current);
24
+ }
25
+ // 일정 시간 타이핑 이벤트 없으면 UI 제거
26
+ typingTimeoutRef.current = setTimeout(() => {
27
+ setIsTyping(false);
28
+ }, 5000);
29
+ };
19
30
  /**
20
31
  * 1. heartbeat
21
32
  * - 목적: 사용자의 이탈 여부를 추적하기 위한 주기적 하트비트 전송
@@ -211,6 +222,11 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
211
222
  // 고객 정보가 갱신됨
212
223
  if (data.type === MessageSocketType.CUSTOMER_INFO_UPDATED) {
213
224
  }
225
+ //
226
+ if (data.type === MessageSocketType.TYPING_STARTED) {
227
+ const payload = data.payload;
228
+ handleTypingStarted();
229
+ }
214
230
  }
215
231
  catch (error) {
216
232
  console.error('[DaeryuntalkContext] 웹소켓 메시지 처리 오류:', error);
@@ -32,6 +32,7 @@ interface props {
32
32
  inquiryMainData: IChatInquiryMainDataResponse | null;
33
33
  isMobile: boolean;
34
34
  setIsAuthenticated: Dispatch<SetStateAction<boolean>>;
35
+ setIsTyping: Dispatch<SetStateAction<boolean>>;
35
36
  }
36
37
  export const useSocketEventHandler = ({
37
38
  setIsConnected,
@@ -46,9 +47,25 @@ export const useSocketEventHandler = ({
46
47
  historyList,
47
48
  inquiryMainData,
48
49
  isMobile,
49
- setIsAuthenticated
50
+ setIsAuthenticated,
51
+ setIsTyping
50
52
  }: props) => {
53
+ const typingTimeoutRef = useRef<NodeJS.Timeout | null>(null);
51
54
  const toast = useDaeryunTalkToast();
55
+
56
+ const handleTypingStarted = () => {
57
+ setIsTyping(true);
58
+
59
+ if (typingTimeoutRef.current) {
60
+ clearTimeout(typingTimeoutRef.current);
61
+ }
62
+
63
+ // 일정 시간 타이핑 이벤트 없으면 UI 제거
64
+ typingTimeoutRef.current = setTimeout(() => {
65
+ setIsTyping(false);
66
+ }, 5000);
67
+ };
68
+
52
69
  /**
53
70
  * 1. heartbeat
54
71
  * - 목적: 사용자의 이탈 여부를 추적하기 위한 주기적 하트비트 전송
@@ -291,6 +308,14 @@ export const useSocketEventHandler = ({
291
308
  // 고객 정보가 갱신됨
292
309
  if (data.type === MessageSocketType.CUSTOMER_INFO_UPDATED) {
293
310
  }
311
+ //
312
+ if (data.type === MessageSocketType.TYPING_STARTED) {
313
+ const payload: {
314
+ chat_inquiry_number: string;
315
+ user_key: string;
316
+ } = data.payload;
317
+ handleTypingStarted();
318
+ }
294
319
  } catch (error) {
295
320
  console.error('[DaeryuntalkContext] 웹소켓 메시지 처리 오류:', error);
296
321
  }
@@ -10,20 +10,13 @@ export const useChatSocketState = (chatInquiryNumber, viewState, sendInquiryWatc
10
10
  }, [sendHeartbeat]);
11
11
  // 2. 뷰 상태에 따른 watch / leave
12
12
  useEffect(() => {
13
- if (!chatInquiryNumber)
14
- return;
15
- if (viewState === 'conversation') {
13
+ if (viewState === 'conversation' && chatInquiryNumber) {
16
14
  sendInquiryJoined(chatInquiryNumber);
17
- sendInquiryWatching(chatInquiryNumber);
18
- const watchingInterval = setInterval(() => {
19
- sendInquiryWatching(chatInquiryNumber);
20
- }, 5000);
21
- return () => clearInterval(watchingInterval);
15
+ return () => {
16
+ sendInquiryLeft(chatInquiryNumber);
17
+ };
22
18
  }
23
- else {
24
- sendInquiryLeft(chatInquiryNumber);
25
- }
26
- }, [chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryLeft]);
19
+ }, [viewState, chatInquiryNumber]);
27
20
  // 소켓
28
21
  useEffect(() => {
29
22
  if (isConnected && isAuthenticated && viewState === 'history') {
@@ -25,21 +25,14 @@ export const useChatSocketState = (
25
25
 
26
26
  // 2. 뷰 상태에 따른 watch / leave
27
27
  useEffect(() => {
28
- if (!chatInquiryNumber) return;
29
-
30
- if (viewState === 'conversation') {
28
+ if (viewState === 'conversation' && chatInquiryNumber) {
31
29
  sendInquiryJoined(chatInquiryNumber);
32
- sendInquiryWatching(chatInquiryNumber);
33
-
34
- const watchingInterval = setInterval(() => {
35
- sendInquiryWatching(chatInquiryNumber);
36
- }, 5000);
37
30
 
38
- return () => clearInterval(watchingInterval);
39
- } else {
40
- sendInquiryLeft(chatInquiryNumber);
31
+ return () => {
32
+ sendInquiryLeft(chatInquiryNumber);
33
+ };
41
34
  }
42
- }, [chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryLeft]);
35
+ }, [viewState, chatInquiryNumber]);
43
36
 
44
37
  // 소켓
45
38
  useEffect(() => {
@@ -1,3 +1,6 @@
1
1
  import React from 'react';
2
- declare const ShadowBox: () => React.JSX.Element;
2
+ interface IShadowBox {
3
+ className?: string;
4
+ }
5
+ declare const ShadowBox: ({ className }: IShadowBox) => React.JSX.Element;
3
6
  export default ShadowBox;
@@ -1,5 +1,5 @@
1
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)]"/>);
2
+ const ShadowBox = ({ className = '' }) => {
3
+ return (<div className={`${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
4
  };
5
5
  export default ShadowBox;
@@ -1,8 +1,13 @@
1
1
  import React from 'react';
2
2
 
3
- const ShadowBox = () => {
3
+ interface IShadowBox {
4
+ className?: string;
5
+ }
6
+ const ShadowBox = ({ className = '' }: IShadowBox) => {
4
7
  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)]" />
8
+ <div
9
+ className={`${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)]`}
10
+ />
6
11
  );
7
12
  };
8
13
 
@@ -2267,10 +2267,18 @@ video {
2267
2267
  aspect-ratio: 16 / 9;
2268
2268
  }
2269
2269
 
2270
+ .\!h-\[5px\] {
2271
+ height: 5px !important;
2272
+ }
2273
+
2270
2274
  .\!h-\[83px\] {
2271
2275
  height: 83px !important;
2272
2276
  }
2273
2277
 
2278
+ .\!h-full {
2279
+ height: 100% !important;
2280
+ }
2281
+
2274
2282
  .h-0 {
2275
2283
  height: 0px;
2276
2284
  }
@@ -5246,11 +5254,6 @@ video {
5246
5254
  background-color: rgb(118 118 118 / var(--tw-bg-opacity, 1));
5247
5255
  }
5248
5256
 
5249
- .bg-\[\#777777\] {
5250
- --tw-bg-opacity: 1;
5251
- background-color: rgb(119 119 119 / var(--tw-bg-opacity, 1));
5252
- }
5253
-
5254
5257
  .bg-\[\#8A1729\] {
5255
5258
  --tw-bg-opacity: 1;
5256
5259
  background-color: rgb(138 23 41 / var(--tw-bg-opacity, 1));
@@ -5286,11 +5289,6 @@ video {
5286
5289
  background-color: rgb(185 185 185 / var(--tw-bg-opacity, 1));
5287
5290
  }
5288
5291
 
5289
- .bg-\[\#C2C2C2\] {
5290
- --tw-bg-opacity: 1;
5291
- background-color: rgb(194 194 194 / var(--tw-bg-opacity, 1));
5292
- }
5293
-
5294
5292
  .bg-\[\#C6F5CA\] {
5295
5293
  --tw-bg-opacity: 1;
5296
5294
  background-color: rgb(198 245 202 / var(--tw-bg-opacity, 1));
@@ -5506,6 +5504,16 @@ video {
5506
5504
  background-color: rgb(170 29 54 / var(--tw-bg-opacity, 1));
5507
5505
  }
5508
5506
 
5507
+ .bg-drTalkGrayscale2 {
5508
+ --tw-bg-opacity: 1;
5509
+ background-color: rgb(119 119 119 / var(--tw-bg-opacity, 1));
5510
+ }
5511
+
5512
+ .bg-drTalkGrayscale3 {
5513
+ --tw-bg-opacity: 1;
5514
+ background-color: rgb(194 194 194 / var(--tw-bg-opacity, 1));
5515
+ }
5516
+
5509
5517
  .bg-drTalkGrayscale4 {
5510
5518
  --tw-bg-opacity: 1;
5511
5519
  background-color: rgb(237 237 237 / var(--tw-bg-opacity, 1));
@@ -5928,6 +5936,11 @@ video {
5928
5936
  padding: 8px;
5929
5937
  }
5930
5938
 
5939
+ .\!px-\[0px\] {
5940
+ padding-left: 0px !important;
5941
+ padding-right: 0px !important;
5942
+ }
5943
+
5931
5944
  .\!py-\[12\.5px\] {
5932
5945
  padding-top: 12.5px !important;
5933
5946
  padding-bottom: 12.5px !important;