@daeryun/dr_components 0.8.20 → 0.8.22

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 (32) hide show
  1. package/dist/components/Daeryuntalk/ChatConversation.jsx +25 -23
  2. package/dist/components/Daeryuntalk/ChatConversation.tsx +24 -27
  3. package/dist/components/Daeryuntalk/ChatHomeView.d.ts +1 -0
  4. package/dist/components/Daeryuntalk/ChatHomeView.jsx +8 -7
  5. package/dist/components/Daeryuntalk/ChatHomeView.tsx +18 -6
  6. package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +2 -2
  7. package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +2 -2
  8. package/dist/components/Daeryuntalk/ChatMessage.jsx +4 -5
  9. package/dist/components/Daeryuntalk/ChatMessage.tsx +2 -4
  10. package/dist/components/Daeryuntalk/ChatWidget.jsx +2 -2
  11. package/dist/components/Daeryuntalk/ChatWidget.tsx +7 -2
  12. package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +2 -1
  13. package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +3 -1
  14. package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +6 -2
  15. package/dist/components/Daeryuntalk/NavigationFooter.d.ts +3 -0
  16. package/dist/components/Daeryuntalk/NavigationFooter.jsx +9 -2
  17. package/dist/components/Daeryuntalk/NavigationFooter.tsx +24 -2
  18. package/dist/components/Daeryuntalk/_enums/socket_type.js +2 -2
  19. package/dist/components/Daeryuntalk/_enums/socket_type.ts +2 -2
  20. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +2 -5
  21. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +2 -4
  22. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.d.ts +1 -1
  23. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.js +18 -13
  24. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.ts +24 -16
  25. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +2 -1
  26. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +15 -2
  27. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +18 -2
  28. package/dist/components/Daeryuntalk/index.jsx +1 -1
  29. package/dist/components/Daeryuntalk/index.tsx +1 -1
  30. package/dist/styles/globals.css +12 -4
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +1 -1
@@ -9,34 +9,36 @@ 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
11
  const ChatConversation = ({ onBackClick, onChatNew, isActive, isMobile }) => {
12
- const { inquiryStatus, messages, isLoading, inquiryMainData, messageObject, workFlowBack, workFlowStack, chatInquiryNumber, sendHeartbeat, sendInquiryLeft, sendInquiryJoined } = useDaeryuntalk();
12
+ const { inquiryStatus, messages, isLoading, inquiryMainData, messageObject, workFlowBack, workFlowStack, chatInquiryNumber, } = useDaeryuntalk();
13
13
  const [isHovered, setIsHovered] = useState(false);
14
14
  const messagesEndRef = useRef(null);
15
15
  const defaultNoticeContent = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_explanation) ||
16
16
  '본 채팅을 통해 제공되는 서비스는 일반적인 법률정보 제공 및 고객 편의 도모를 위한 것 입니다. 본 채팅을 통해 제공된 정보를 이용한 행위에 대해서는 당사는 어떠한 법적 책임을 지지 않으며 구체적인 사안에 대한 적용은 변호사와의 추가 상담을 통해 자문을 받으시기를 권해드립니다.';
17
17
  const noticeContent = defaultNoticeContent;
18
- useEffect(() => {
19
- // 컴포넌트 마운트 시: 입장 처리
20
- if (chatInquiryNumber) {
21
- sendInquiryJoined(chatInquiryNumber);
22
- }
23
- // 10초 간격으로 sendHeartbeat 호출
24
- let heartbeatInterval = null;
25
- if (chatInquiryNumber) {
26
- heartbeatInterval = setInterval(() => {
27
- sendHeartbeat(chatInquiryNumber);
28
- }, 10000); // 10,000ms = 10초
29
- }
30
- // 언마운트 시: 퇴장 처리 및 인터벌 해제
31
- return () => {
32
- if (chatInquiryNumber) {
33
- sendInquiryLeft(chatInquiryNumber);
34
- }
35
- if (heartbeatInterval) {
36
- clearInterval(heartbeatInterval);
37
- }
38
- };
39
- }, [chatInquiryNumber]);
18
+ // useEffect(() => {
19
+ // // 컴포넌트 마운트 시: 입장 처리
20
+ // if (chatInquiryNumber) {
21
+ // sendInquiryJoined(chatInquiryNumber);
22
+ // }
23
+ //
24
+ // // 10초 간격으로 sendHeartbeat 호출
25
+ // let heartbeatInterval: ReturnType<typeof setInterval> | null = null;
26
+ // if (chatInquiryNumber) {
27
+ // heartbeatInterval = setInterval(() => {
28
+ // sendHeartbeat(chatInquiryNumber);
29
+ // }, 10000); // 10,000ms = 10초
30
+ // }
31
+ //
32
+ // // 언마운트 시: 퇴장 처리 및 인터벌 해제
33
+ // return () => {
34
+ // if (chatInquiryNumber) {
35
+ // sendInquiryLeft(chatInquiryNumber);
36
+ // }
37
+ // if (heartbeatInterval) {
38
+ // clearInterval(heartbeatInterval);
39
+ // }
40
+ // };
41
+ // }, [chatInquiryNumber]);
40
42
  const scrollEnd = () => {
41
43
  var _a;
42
44
  (_a = messagesEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
@@ -29,9 +29,6 @@ const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick, onChat
29
29
  workFlowBack,
30
30
  workFlowStack,
31
31
  chatInquiryNumber,
32
- sendHeartbeat,
33
- sendInquiryLeft,
34
- sendInquiryJoined
35
32
  } = useDaeryuntalk();
36
33
  const [isHovered, setIsHovered] = useState<boolean>(false);
37
34
  const messagesEndRef = useRef<HTMLDivElement>(null);
@@ -41,30 +38,30 @@ const ChatConversation: React.FC<ChatConversationProps> = ({ onBackClick, onChat
41
38
  '본 채팅을 통해 제공되는 서비스는 일반적인 법률정보 제공 및 고객 편의 도모를 위한 것 입니다. 본 채팅을 통해 제공된 정보를 이용한 행위에 대해서는 당사는 어떠한 법적 책임을 지지 않으며 구체적인 사안에 대한 적용은 변호사와의 추가 상담을 통해 자문을 받으시기를 권해드립니다.';
42
39
 
43
40
  const noticeContent = defaultNoticeContent;
44
- useEffect(() => {
45
- // 컴포넌트 마운트 시: 입장 처리
46
- if (chatInquiryNumber) {
47
- sendInquiryJoined(chatInquiryNumber);
48
- }
49
-
50
- // 10초 간격으로 sendHeartbeat 호출
51
- let heartbeatInterval: ReturnType<typeof setInterval> | null = null;
52
- if (chatInquiryNumber) {
53
- heartbeatInterval = setInterval(() => {
54
- sendHeartbeat(chatInquiryNumber);
55
- }, 10000); // 10,000ms = 10초
56
- }
57
-
58
- // 언마운트 시: 퇴장 처리 및 인터벌 해제
59
- return () => {
60
- if (chatInquiryNumber) {
61
- sendInquiryLeft(chatInquiryNumber);
62
- }
63
- if (heartbeatInterval) {
64
- clearInterval(heartbeatInterval);
65
- }
66
- };
67
- }, [chatInquiryNumber]);
41
+ // useEffect(() => {
42
+ // // 컴포넌트 마운트 시: 입장 처리
43
+ // if (chatInquiryNumber) {
44
+ // sendInquiryJoined(chatInquiryNumber);
45
+ // }
46
+ //
47
+ // // 10초 간격으로 sendHeartbeat 호출
48
+ // let heartbeatInterval: ReturnType<typeof setInterval> | null = null;
49
+ // if (chatInquiryNumber) {
50
+ // heartbeatInterval = setInterval(() => {
51
+ // sendHeartbeat(chatInquiryNumber);
52
+ // }, 10000); // 10,000ms = 10초
53
+ // }
54
+ //
55
+ // // 언마운트 시: 퇴장 처리 및 인터벌 해제
56
+ // return () => {
57
+ // if (chatInquiryNumber) {
58
+ // sendInquiryLeft(chatInquiryNumber);
59
+ // }
60
+ // if (heartbeatInterval) {
61
+ // clearInterval(heartbeatInterval);
62
+ // }
63
+ // };
64
+ // }, [chatInquiryNumber]);
68
65
 
69
66
  const scrollEnd = () => {
70
67
  messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
@@ -3,6 +3,7 @@ type ChatHomeViewProps = {
3
3
  hashValue: string | null;
4
4
  setHashValue: Dispatch<SetStateAction<string | null>>;
5
5
  isMobile: boolean;
6
+ isHash: boolean;
6
7
  };
7
8
  declare const ChatHomeView: React.FC<ChatHomeViewProps>;
8
9
  export default ChatHomeView;
@@ -23,8 +23,8 @@ import { useScrollShadow } from './_hooks/useScrollShadow';
23
23
  import ShadowBox from './_ui/ShadowBox';
24
24
  import { useDaeryunTalkToast } from './Toast/DaeryuntalkToastProvider';
25
25
  import ToastRenderer from './Toast/ToastRender';
26
- const ChatHomeView = ({ hashValue, setHashValue, isMobile }) => {
27
- const { isConnected, isAuthenticated, historyList, inquiryMainData, startChat, createNewChat, chatInquiryNumber, sendHeartbeat, sendInquiryLeft, goGetHistoryList, sendHistoryEntered, sendHistoryLeft, startSelectedChat, attendRoomByHistory } = useDaeryuntalk();
26
+ const ChatHomeView = ({ hashValue, setHashValue, isMobile, isHash }) => {
27
+ const { isConnected, isAuthenticated, historyList, inquiryMainData, startChat, createNewChat, chatInquiryNumber, sendInquiryJoined, sendHeartbeat, sendInquiryWatching, sendInquiryLeft, goGetHistoryList, sendHistoryEntered, startSelectedChat, attendRoomByHistory } = useDaeryuntalk();
28
28
  const [viewState, setViewState] = useState('home');
29
29
  const [mainData, setMainData] = useState(null);
30
30
  const [isLoading, setIsLoading] = useState(false);
@@ -48,14 +48,14 @@ const ChatHomeView = ({ hashValue, setHashValue, isMobile }) => {
48
48
  }
49
49
  });
50
50
  useEffect(() => {
51
- if (hashValue && isConnected) {
51
+ if (hashValue && isConnected && inquiryMainData) {
52
52
  console.log('해쉬 실행');
53
53
  handleStartChat();
54
54
  }
55
55
  else {
56
56
  console.log('해쉬 실행안함');
57
57
  }
58
- }, [hashValue, isConnected]);
58
+ }, [hashValue, isConnected, inquiryMainData]);
59
59
  useEffect(() => {
60
60
  checkScroll();
61
61
  }, [mainData]);
@@ -71,11 +71,12 @@ const ChatHomeView = ({ hashValue, setHashValue, isMobile }) => {
71
71
  }, [inquiryMainData]);
72
72
  useEffect(() => {
73
73
  if (isConnected && isAuthenticated) {
74
+ console.log('history entered', historyList);
74
75
  sendHistoryEntered(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
75
76
  }
76
77
  }, [isConnected, isAuthenticated, historyList, viewState]);
77
78
  // 채팅창관리
78
- useChatSocketState(chatInquiryNumber, viewState, sendHeartbeat, sendInquiryLeft);
79
+ useChatSocketState(chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryJoined, sendHeartbeat, sendInquiryLeft);
79
80
  // 히스토리에서 사용
80
81
  const handleNewStartChat = () => __awaiter(void 0, void 0, void 0, function* () {
81
82
  try {
@@ -124,10 +125,10 @@ const ChatHomeView = ({ hashValue, setHashValue, isMobile }) => {
124
125
  <div className="flex h-full flex-col">
125
126
  <div className="flex-1 overflow-hidden">{content}</div>
126
127
 
127
- <NavigationFooter activeView={activeView} onHomeClick={handleBackToHome} onHistoryClick={handleHistoryClick}/>
128
+ <NavigationFooter activeView={activeView} onHomeClick={handleBackToHome} onHistoryClick={handleHistoryClick} historyList={historyList} isAuthenticated={isAuthenticated}/>
128
129
  </div>
129
130
  </div>
130
- {isMobile && <ToastRenderer />}
131
+ {(isMobile || isHash) && <ToastRenderer />}
131
132
  </main>);
132
133
  };
133
134
  // 채팅 문의 창
@@ -23,8 +23,9 @@ type ChatHomeViewProps = {
23
23
  hashValue: string | null;
24
24
  setHashValue: Dispatch<SetStateAction<string | null>>;
25
25
  isMobile: boolean;
26
+ isHash: boolean;
26
27
  };
27
- const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, isMobile }) => {
28
+ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, isMobile, isHash }) => {
28
29
  const {
29
30
  isConnected,
30
31
  isAuthenticated,
@@ -33,11 +34,12 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
33
34
  startChat,
34
35
  createNewChat,
35
36
  chatInquiryNumber,
37
+ sendInquiryJoined,
36
38
  sendHeartbeat,
39
+ sendInquiryWatching,
37
40
  sendInquiryLeft,
38
41
  goGetHistoryList,
39
42
  sendHistoryEntered,
40
- sendHistoryLeft,
41
43
  startSelectedChat,
42
44
  attendRoomByHistory
43
45
  } = useDaeryuntalk();
@@ -64,13 +66,13 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
64
66
  };
65
67
 
66
68
  useEffect(() => {
67
- if (hashValue && isConnected) {
69
+ if (hashValue && isConnected && inquiryMainData) {
68
70
  console.log('해쉬 실행');
69
71
  handleStartChat();
70
72
  } else {
71
73
  console.log('해쉬 실행안함');
72
74
  }
73
- }, [hashValue, isConnected]);
75
+ }, [hashValue, isConnected, inquiryMainData]);
74
76
  useEffect(() => {
75
77
  checkScroll();
76
78
  }, [mainData]);
@@ -89,12 +91,20 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
89
91
 
90
92
  useEffect(() => {
91
93
  if (isConnected && isAuthenticated) {
94
+ console.log('history entered', historyList);
92
95
  sendHistoryEntered(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
93
96
  }
94
97
  }, [isConnected, isAuthenticated, historyList, viewState]);
95
98
 
96
99
  // 채팅창관리
97
- useChatSocketState(chatInquiryNumber, viewState, sendHeartbeat, sendInquiryLeft);
100
+ useChatSocketState(
101
+ chatInquiryNumber,
102
+ viewState,
103
+ sendInquiryWatching,
104
+ sendInquiryJoined,
105
+ sendHeartbeat,
106
+ sendInquiryLeft
107
+ );
98
108
 
99
109
  // 히스토리에서 사용
100
110
  const handleNewStartChat = async () => {
@@ -151,10 +161,12 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
151
161
  activeView={activeView}
152
162
  onHomeClick={handleBackToHome}
153
163
  onHistoryClick={handleHistoryClick}
164
+ historyList={historyList}
165
+ isAuthenticated={isAuthenticated}
154
166
  />
155
167
  </div>
156
168
  </div>
157
- {isMobile && <ToastRenderer />}
169
+ {(isMobile || isHash) && <ToastRenderer />}
158
170
  </main>
159
171
  );
160
172
  };
@@ -2,8 +2,8 @@ import React from 'react';
2
2
  import Image from 'next/image';
3
3
  const WorkFlowImg = ({ message }) => {
4
4
  const workFlowItem = message.workFlow;
5
- return (<div className={`mb-[10px] h-[311px] w-[281px] overflow-hidden rounded-[10px] border-[1px] border-solid`}>
6
- <Image src={(workFlowItem === null || workFlowItem === void 0 ? void 0 : workFlowItem.imageUrl) || ''} alt={''} width={300} height={300} className={`h-full w-full`}/>
5
+ return (<div className={`mb-[10px] h-[311px] w-[250px] overflow-hidden rounded-[10px]`}>
6
+ <Image src={(workFlowItem === null || workFlowItem === void 0 ? void 0 : workFlowItem.imageUrl) || ''} alt={''} width={251} height={300} className={`h-full w-full`}/>
7
7
  </div>);
8
8
  };
9
9
  export default WorkFlowImg;
@@ -7,8 +7,8 @@ interface props {
7
7
  const WorkFlowImg = ({ message }: props) => {
8
8
  const workFlowItem = message.workFlow;
9
9
  return (
10
- <div className={`mb-[10px] h-[311px] w-[281px] overflow-hidden rounded-[10px] border-[1px] border-solid`}>
11
- <Image src={workFlowItem?.imageUrl || ''} alt={''} width={300} height={300} className={`h-full w-full`} />
10
+ <div className={`mb-[10px] h-[311px] w-[250px] overflow-hidden rounded-[10px]`}>
11
+ <Image src={workFlowItem?.imageUrl || ''} alt={''} width={251} height={300} className={`h-full w-full`} />
12
12
  </div>
13
13
  );
14
14
  };
@@ -94,14 +94,13 @@ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, wor
94
94
  </ChatWrapper>);
95
95
  };
96
96
  const renderMessageContent = () => {
97
- var _a, _b, _c;
97
+ var _a, _b;
98
98
  const objectFirstQuestionCheck = Array.isArray(object === null || object === void 0 ? void 0 : object.objectList)
99
99
  ? Object.values(ObjectNumber).every(enumValue => { var _a; return (_a = object === null || object === void 0 ? void 0 : object.objectList) === null || _a === void 0 ? void 0 : _a.some(obj => (obj === null || obj === void 0 ? void 0 : obj.objectNumber) === enumValue); })
100
100
  : false;
101
101
  const objectIsBack = workFlowStack.length >= 3;
102
- const isAllFieldOfWork = !!(object === null || object === void 0 ? void 0 : object.objectList) && ((_a = object === null || object === void 0 ? void 0 : object.objectList) === null || _a === void 0 ? void 0 : _a.length) > 20;
103
102
  return (<div className={`
104
- message-content
103
+ message-content max-w-[251px]
105
104
  `}>
106
105
  {/*{hasBlocks(message) && message.blocks?.map((block, index) => renderTextBlock(block, index))}*/}
107
106
  {renderText(message)}
@@ -112,8 +111,8 @@ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, wor
112
111
  ? 'flex flex-row flex-wrap gap-x-[4px] gap-y-[8px]'
113
112
  : 'flex flex-col gap-[8px]'}
114
113
  `}>
115
- {!isAllFieldOfWork
116
- ? (_c = (_b = object.objectList) === null || _b === void 0 ? void 0 : _b.sort((a, b) => a.sequence - b.sequence)) === null || _c === void 0 ? void 0 : _c.map((item, index) => {
114
+ {WorkFlowButtonUiCode.TILE_BUTTON !== (object === null || object === void 0 ? void 0 : object.objectGroupUiCode)
115
+ ? (_b = (_a = object.objectList) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a.sequence - b.sequence)) === null || _b === void 0 ? void 0 : _b.map((item, index) => {
117
116
  var _a;
118
117
  return (<ObjectButton key={`object-expose-${index}`} object={item} messageNumber={(object === null || object === void 0 ? void 0 : object.messageNumber) || ''} workFlowNumber={((_a = message === null || message === void 0 ? void 0 : message.workFlow) === null || _a === void 0 ? void 0 : _a.workFlowNumber) || ''} isFirstObject={objectFirstQuestionCheck} objectGroupUiCode={(object === null || object === void 0 ? void 0 : object.objectGroupUiCode) || ''}/>);
119
118
  })
@@ -155,12 +155,10 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
155
155
 
156
156
  const objectIsBack = workFlowStack.length >= 3;
157
157
 
158
- const isAllFieldOfWork = !!object?.objectList && object?.objectList?.length > 20;
159
-
160
158
  return (
161
159
  <div
162
160
  className={`
163
- message-content
161
+ message-content max-w-[251px]
164
162
  `}
165
163
  >
166
164
  {/*{hasBlocks(message) && message.blocks?.map((block, index) => renderTextBlock(block, index))}*/}
@@ -177,7 +175,7 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
177
175
  }
178
176
  `}
179
177
  >
180
- {!isAllFieldOfWork
178
+ {WorkFlowButtonUiCode.TILE_BUTTON !== object?.objectGroupUiCode
181
179
  ? object.objectList
182
180
  ?.sort((a, b) => a.sequence - b.sequence)
183
181
  ?.map((item, index) => {
@@ -31,12 +31,12 @@ const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
31
31
  : 'pointer-events-none translate-y-6 opacity-0'}
32
32
  `}>
33
33
  <div ref={containerRef} className={`${isMobile ? 'rounded-none' : 'rounded-[30px]'} no-scrollbar relative flex h-full items-center justify-center overflow-auto bg-white`}>
34
- <ChatHomeView hashValue={hashValue} setHashValue={setHashValue} isMobile={isMobile}/>
34
+ <ChatHomeView hashValue={hashValue} setHashValue={setHashValue} isMobile={isMobile} isHash={isHash}/>
35
35
  </div>
36
36
 
37
37
  {/* 투명 그라데이션 그림자 표시 */}
38
38
  {!isScroll && !isBottom && <ShadowBox />}
39
- {!isMobile && <ToastRenderer />}
39
+ {!isMobile && !isHash && <ToastRenderer />}
40
40
  </div>
41
41
  </div>
42
42
  </>);
@@ -51,12 +51,17 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
51
51
  ref={containerRef}
52
52
  className={`${isMobile ? 'rounded-none' : 'rounded-[30px]'} no-scrollbar relative flex h-full items-center justify-center overflow-auto bg-white`}
53
53
  >
54
- <ChatHomeView hashValue={hashValue} setHashValue={setHashValue} isMobile={isMobile} />
54
+ <ChatHomeView
55
+ hashValue={hashValue}
56
+ setHashValue={setHashValue}
57
+ isMobile={isMobile}
58
+ isHash={isHash}
59
+ />
55
60
  </div>
56
61
 
57
62
  {/* 투명 그라데이션 그림자 표시 */}
58
63
  {!isScroll && !isBottom && <ShadowBox />}
59
- {!isMobile && <ToastRenderer />}
64
+ {!isMobile && !isHash && <ToastRenderer />}
60
65
  </div>
61
66
  </div>
62
67
  </>
@@ -26,7 +26,8 @@ type DaeryuntalkContextType = {
26
26
  }) => void;
27
27
  chatInquiryNumber: string | null;
28
28
  workFlowStack: string[];
29
- sendHeartbeat: (chatInquiryNumber: string) => void;
29
+ sendHeartbeat: () => void;
30
+ sendInquiryWatching: (chatInquiryNumber: string) => void;
30
31
  sendInquiryLeft: (chatInquiryNumber: string) => void;
31
32
  chatUserUpdate: (data: {
32
33
  chatInquiryNumber: string;
@@ -30,6 +30,7 @@ const DaeryuntalkContext = createContext({
30
30
  chatInquiryNumber: '',
31
31
  workFlowStack: [],
32
32
  sendHeartbeat: () => { },
33
+ sendInquiryWatching: () => { },
33
34
  sendInquiryLeft: () => { },
34
35
  chatUserUpdate: () => { },
35
36
  getNextMessageList: () => { },
@@ -72,7 +73,7 @@ export const DaeryuntalkProvider = ({ children, propsTel }) => {
72
73
  // 히스토리 리스트
73
74
  const [historyList, setHistoryList] = useState([]);
74
75
  // 소켓 관련 API + 채팅 시작
75
- const { initializeDaeryuntalk, sendHeartbeat, sendInquiryJoined, sendInquiryLeft, sendHistoryEntered, sendHistoryLeft } = useSocketEventHandler({
76
+ const { initializeDaeryuntalk, sendHeartbeat, sendInquiryJoined, sendInquiryLeft, sendHistoryEntered, sendHistoryLeft, sendInquiryWatching } = useSocketEventHandler({
76
77
  setIsConnected,
77
78
  setIsLoading,
78
79
  setMessages,
@@ -122,6 +123,7 @@ export const DaeryuntalkProvider = ({ children, propsTel }) => {
122
123
  workFlowBack,
123
124
  workFlowStack,
124
125
  sendHeartbeat,
126
+ sendInquiryWatching,
125
127
  sendInquiryLeft,
126
128
  chatUserUpdate,
127
129
  getNextMessageList,
@@ -28,7 +28,8 @@ type DaeryuntalkContextType = {
28
28
  workFlowBack: (data: { chatInquiryNumber: string; messageNumber: string; workFlowNavigationCode: string }) => void;
29
29
  chatInquiryNumber: string | null;
30
30
  workFlowStack: string[];
31
- sendHeartbeat: (chatInquiryNumber: string) => void;
31
+ sendHeartbeat: () => void;
32
+ sendInquiryWatching: (chatInquiryNumber: string) => void;
32
33
  sendInquiryLeft: (chatInquiryNumber: string) => void;
33
34
  chatUserUpdate: (data: {
34
35
  chatInquiryNumber: string;
@@ -94,6 +95,7 @@ const DaeryuntalkContext = createContext<DaeryuntalkContextType>({
94
95
  chatInquiryNumber: '',
95
96
  workFlowStack: [],
96
97
  sendHeartbeat: () => {},
98
+ sendInquiryWatching: () => {},
97
99
  sendInquiryLeft: () => {},
98
100
  chatUserUpdate: () => {},
99
101
  getNextMessageList: () => {},
@@ -154,7 +156,8 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
154
156
  sendInquiryJoined,
155
157
  sendInquiryLeft,
156
158
  sendHistoryEntered,
157
- sendHistoryLeft
159
+ sendHistoryLeft,
160
+ sendInquiryWatching
158
161
  } = useSocketEventHandler({
159
162
  setIsConnected,
160
163
  setIsLoading,
@@ -223,6 +226,7 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
223
226
  workFlowBack,
224
227
  workFlowStack,
225
228
  sendHeartbeat,
229
+ sendInquiryWatching,
226
230
  sendInquiryLeft,
227
231
  chatUserUpdate,
228
232
  getNextMessageList,
@@ -1,8 +1,11 @@
1
1
  import React from 'react';
2
+ import { History as HisResType } from '../../components/Daeryuntalk/_api/daeryuntalk/type/response';
2
3
  type NavigationFooterProps = {
3
4
  activeView: 'home' | 'history' | 'conversation';
4
5
  onHomeClick: () => void;
5
6
  onHistoryClick: () => void;
7
+ historyList: HisResType[];
8
+ isAuthenticated: boolean;
6
9
  };
7
10
  declare const NavigationFooter: React.FC<NavigationFooterProps>;
8
11
  export default NavigationFooter;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import Home from '../../asset/images/daeryuntalk/home.svg';
3
3
  import History from '../../asset/images/daeryuntalk/history.svg';
4
- const NavigationFooter = ({ activeView, onHomeClick, onHistoryClick }) => {
4
+ const NavigationFooter = ({ activeView, onHomeClick, onHistoryClick, historyList, isAuthenticated }) => {
5
5
  if (activeView === 'conversation') {
6
6
  return null;
7
7
  }
@@ -14,7 +14,14 @@ const NavigationFooter = ({ activeView, onHomeClick, onHistoryClick }) => {
14
14
  홈
15
15
  </span>
16
16
  </div>
17
- <div className={`group flex cursor-pointer flex-col items-center ${activeView === 'history' ? 'text-[#AA1D36]' : 'text-gray-400 hover:text-[#AA1D36]'}`} role="button" tabIndex={0} onClick={onHistoryClick}>
17
+ <div className={`group relative flex cursor-pointer flex-col items-center ${activeView === 'history' ? 'text-[#AA1D36]' : 'text-gray-400 hover:text-[#AA1D36]'}`} role="button" tabIndex={0} onClick={onHistoryClick}>
18
+ {isAuthenticated &&
19
+ (() => {
20
+ const unreadCount = historyList.reduce((sum, item) => sum + (item.unread_message_count || 0), 0);
21
+ return unreadCount > 0 ? (<span className="absolute -right-1 -top-1 flex h-[18px] w-[18px] items-center justify-center rounded-full bg-[#AA1D36] px-[5.5px] py-[3px] text-[12px] font-medium leading-[100%] tracking-[-4%] text-white">
22
+ {unreadCount}
23
+ </span>) : null;
24
+ })()}
18
25
  <History width={32} height={32} className="mb-1"/>
19
26
  <span className={`text-xs font-bold ${activeView === 'history' ? 'text-[#AA1D36]' : 'text-gray-400 group-hover:text-[#AA1D36]'}`}>
20
27
  히스토리
@@ -1,14 +1,23 @@
1
1
  import React from 'react';
2
2
  import Home from '../../asset/images/daeryuntalk/home.svg';
3
3
  import History from '../../asset/images/daeryuntalk/history.svg';
4
+ import { History as HisResType } from '../../components/Daeryuntalk/_api/daeryuntalk/type/response';
4
5
 
5
6
  type NavigationFooterProps = {
6
7
  activeView: 'home' | 'history' | 'conversation';
7
8
  onHomeClick: () => void;
8
9
  onHistoryClick: () => void;
10
+ historyList: HisResType[];
11
+ isAuthenticated: boolean;
9
12
  };
10
13
 
11
- const NavigationFooter: React.FC<NavigationFooterProps> = ({ activeView, onHomeClick, onHistoryClick }) => {
14
+ const NavigationFooter: React.FC<NavigationFooterProps> = ({
15
+ activeView,
16
+ onHomeClick,
17
+ onHistoryClick,
18
+ historyList,
19
+ isAuthenticated
20
+ }) => {
12
21
  if (activeView === 'conversation') {
13
22
  return null;
14
23
  }
@@ -34,13 +43,26 @@ const NavigationFooter: React.FC<NavigationFooterProps> = ({ activeView, onHomeC
34
43
  </span>
35
44
  </div>
36
45
  <div
37
- className={`group flex cursor-pointer flex-col items-center ${
46
+ className={`group relative flex cursor-pointer flex-col items-center ${
38
47
  activeView === 'history' ? 'text-[#AA1D36]' : 'text-gray-400 hover:text-[#AA1D36]'
39
48
  }`}
40
49
  role="button"
41
50
  tabIndex={0}
42
51
  onClick={onHistoryClick}
43
52
  >
53
+ {isAuthenticated &&
54
+ (() => {
55
+ const unreadCount = historyList.reduce(
56
+ (sum, item) => sum + (item.unread_message_count || 0),
57
+ 0
58
+ );
59
+
60
+ return unreadCount > 0 ? (
61
+ <span className="absolute -right-1 -top-1 flex h-[18px] w-[18px] items-center justify-center rounded-full bg-[#AA1D36] px-[5.5px] py-[3px] text-[12px] font-medium leading-[100%] tracking-[-4%] text-white">
62
+ {unreadCount}
63
+ </span>
64
+ ) : null;
65
+ })()}
44
66
  <History width={32} height={32} className="mb-1" />
45
67
  <span
46
68
  className={`text-xs font-bold ${
@@ -11,10 +11,10 @@ export var MessageSocketType;
11
11
  // -> 해당 메시지 UI 삭제 처리
12
12
  /** 문의 목록에서 보여지는 미리보기 정보 갱신 */
13
13
  MessageSocketType["INQUIRY_PREVIEW_UPDATED"] = "inquiry.preview.updated";
14
- // -> 미처라
14
+ // -> 미처리
15
15
  /** 새로운 문의가 생성됨 */
16
16
  MessageSocketType["INQUIRY_OPENED"] = "inquiry.opened";
17
- // -> 미처라
17
+ // -> 미처리
18
18
  /** 문의 워크플로우 변경됨 */
19
19
  MessageSocketType["INQUIRY_WORKFLOW_UPDATED"] = "inquiry.workflow.updated";
20
20
  // -> 워크플로우 업데이트 처리
@@ -13,11 +13,11 @@ export enum MessageSocketType {
13
13
 
14
14
  /** 문의 목록에서 보여지는 미리보기 정보 갱신 */
15
15
  INQUIRY_PREVIEW_UPDATED = 'inquiry.preview.updated',
16
- // -> 미처라
16
+ // -> 미처리
17
17
 
18
18
  /** 새로운 문의가 생성됨 */
19
19
  INQUIRY_OPENED = 'inquiry.opened',
20
- // -> 미처라
20
+ // -> 미처리
21
21
 
22
22
  /** 문의 워크플로우 변경됨 */
23
23
  INQUIRY_WORKFLOW_UPDATED = 'inquiry.workflow.updated',
@@ -11,20 +11,17 @@ import { useCallback } from 'react';
11
11
  import { attendChatRoomByHistory, chatUserUpdate as apiChatUserUpdate, chatWorkFlow, chatWorkFlowBack, generateChatInquiry, getChatInquiryDetailNew, getChatInquiryMessageList, sendChatMessage } from '../../_api';
12
12
  import { convertApiMessageObjectToUiMessageObject, convertApiMessageToUiMessage } from '../../_lib';
13
13
  import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
14
- import { usePathname, useSearchParams } from 'next/navigation';
15
14
  import { useFullURL } from './useFullURL';
16
15
  export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNumber, setMessages, setInquiryStatus, setMessageObject, chatInquiryNumber, setIsNextPage, setWorkFlowStack, setInquiryMainData }) => {
17
16
  const toast = useDaeryunTalkToast();
18
- const pathname = usePathname(); // => "/daeryuntalk"
19
- const searchParams = useSearchParams(); // => URLSearchParams 객체
20
17
  const fullUrl = useFullURL();
21
- console.log('fullUrl', fullUrl);
22
18
  // 채팅 시작 (문의하기 버튼 클릭 시)
23
19
  const startChat = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
24
20
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
25
21
  try {
26
22
  setIsLoading(true);
27
23
  console.log('[DaeryuntalkContext] 채팅 시작 요청');
24
+ console.log('inquiryMainData', inquiryMainData);
28
25
  // 기존 문의가 있는지 확인
29
26
  const hasExistingInquiry = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.progress_inquiry_number) && (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.progress_inquiry_number.trim()) !== '';
30
27
  let currentChatInquiryNumber = '';
@@ -109,7 +106,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
109
106
  finally {
110
107
  setIsLoading(false);
111
108
  }
112
- }), [inquiryMainData]);
109
+ }), [inquiryMainData, fullUrl]);
113
110
  // 선택된 히스토리의 채팅창 시작
114
111
  const startSelectedChat = useCallback((chatInquiryNumber) => __awaiter(void 0, void 0, void 0, function* () {
115
112
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
@@ -44,15 +44,13 @@ export const useChatHandler = ({
44
44
  setInquiryMainData
45
45
  }: props) => {
46
46
  const toast = useDaeryunTalkToast();
47
- const pathname = usePathname(); // => "/daeryuntalk"
48
- const searchParams = useSearchParams(); // => URLSearchParams 객체
49
47
  const fullUrl = useFullURL();
50
- console.log('fullUrl', fullUrl);
51
48
  // 채팅 시작 (문의하기 버튼 클릭 시)
52
49
  const startChat = useCallback(async () => {
53
50
  try {
54
51
  setIsLoading(true);
55
52
  console.log('[DaeryuntalkContext] 채팅 시작 요청');
53
+ console.log('inquiryMainData', inquiryMainData);
56
54
 
57
55
  // 기존 문의가 있는지 확인
58
56
  const hasExistingInquiry =
@@ -147,7 +145,7 @@ export const useChatHandler = ({
147
145
  } finally {
148
146
  setIsLoading(false);
149
147
  }
150
- }, [inquiryMainData]);
148
+ }, [inquiryMainData, fullUrl]);
151
149
 
152
150
  // 선택된 히스토리의 채팅창 시작
153
151
  const startSelectedChat = useCallback(
@@ -1 +1 @@
1
- export declare const useChatSocketState: (chatInquiryNumber: string | null, viewState: "home" | "conversation" | "history", sendHeartbeat: (chatInquiryNumber: string) => void, sendInquiryLeft: (chatInquiryNumber: string) => void) => void;
1
+ export declare const useChatSocketState: (chatInquiryNumber: string | null, viewState: "home" | "conversation" | "history", sendInquiryWatching: (chatInquiryNumber: string) => void, sendInquiryJoined: (chatInquiryNumber: string) => void, sendHeartbeat: () => void, sendInquiryLeft: (chatInquiryNumber: string) => void) => void;