@daeryun/dr_components 0.8.19 → 0.8.21
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.
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatConversation.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatConversation.jsx +28 -26
- package/dist/components/Daeryuntalk/ChatConversation.tsx +28 -30
- package/dist/components/Daeryuntalk/ChatHomeView.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +34 -33
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +47 -33
- package/dist/components/Daeryuntalk/ChatMessage.jsx +3 -4
- package/dist/components/Daeryuntalk/ChatMessage.tsx +1 -3
- package/dist/components/Daeryuntalk/ChatWidget.jsx +6 -6
- package/dist/components/Daeryuntalk/ChatWidget.tsx +11 -6
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +2 -1
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +6 -2
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +9 -3
- package/dist/components/Daeryuntalk/HistoryView.d.ts +1 -0
- package/dist/components/Daeryuntalk/HistoryView.jsx +1 -1
- package/dist/components/Daeryuntalk/HistoryView.tsx +3 -1
- package/dist/components/Daeryuntalk/NavigationFooter.d.ts +3 -0
- package/dist/components/Daeryuntalk/NavigationFooter.jsx +9 -2
- package/dist/components/Daeryuntalk/NavigationFooter.tsx +24 -2
- package/dist/components/Daeryuntalk/NoticeMessage.jsx +1 -1
- package/dist/components/Daeryuntalk/NoticeMessage.tsx +1 -1
- package/dist/components/Daeryuntalk/ViewportHandler.jsx +11 -17
- package/dist/components/Daeryuntalk/ViewportHandler.tsx +13 -17
- package/dist/components/Daeryuntalk/_enums/socket_type.js +2 -2
- package/dist/components/Daeryuntalk/_enums/socket_type.ts +2 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +2 -5
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +2 -4
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.d.ts +1 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.js +18 -13
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.ts +24 -16
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +6 -3
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +27 -19
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +149 -119
- package/dist/components/Daeryuntalk/index.jsx +10 -8
- package/dist/components/Daeryuntalk/index.tsx +16 -14
- package/dist/components/page/Login/_fetch/fetch.js +0 -1
- package/dist/components/page/Login/_fetch/fetch.ts +0 -1
- package/dist/styles/globals.css +17 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -23,23 +23,42 @@ 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 {
|
|
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);
|
|
31
31
|
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
|
|
32
|
+
const toast = useDaeryunTalkToast();
|
|
32
33
|
// 아직 커버이미지 url이 안나옴
|
|
33
34
|
const backgroundImage = (mainData === null || mainData === void 0 ? void 0 : mainData.sleeve_image_url) ? mainData.sleeve_image_url : DaeryuntalkIntro;
|
|
35
|
+
const handleStartChat = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
setIsLoading(true);
|
|
38
|
+
// 채팅 시작 - 새 문의 생성 또는 기존 문의 조회 처리
|
|
39
|
+
yield startChat();
|
|
40
|
+
// 대화 화면으로 전환
|
|
41
|
+
setViewState('conversation');
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error('채팅 시작 실패:', error);
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
setIsLoading(false);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
34
50
|
useEffect(() => {
|
|
35
|
-
if (hashValue && isConnected &&
|
|
51
|
+
if (hashValue && isConnected && inquiryMainData) {
|
|
52
|
+
console.log('해쉬 실행');
|
|
36
53
|
handleStartChat();
|
|
37
54
|
}
|
|
38
|
-
|
|
55
|
+
else {
|
|
56
|
+
console.log('해쉬 실행안함');
|
|
57
|
+
}
|
|
58
|
+
}, [hashValue, isConnected, inquiryMainData]);
|
|
39
59
|
useEffect(() => {
|
|
40
60
|
checkScroll();
|
|
41
61
|
}, [mainData]);
|
|
42
|
-
const toast = useDaeryunTalkToast();
|
|
43
62
|
useEffect(() => {
|
|
44
63
|
if (viewState === 'history') {
|
|
45
64
|
goGetHistoryList({});
|
|
@@ -51,31 +70,13 @@ const ChatHomeView = ({ hashValue, setHashValue, isMobile }) => {
|
|
|
51
70
|
}
|
|
52
71
|
}, [inquiryMainData]);
|
|
53
72
|
useEffect(() => {
|
|
54
|
-
if (isAuthenticated) {
|
|
73
|
+
if (isConnected && isAuthenticated) {
|
|
74
|
+
console.log('history entered', historyList);
|
|
55
75
|
sendHistoryEntered(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
|
|
56
76
|
}
|
|
57
|
-
|
|
58
|
-
sendHistoryLeft(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
|
|
59
|
-
};
|
|
60
|
-
}, [isAuthenticated]);
|
|
77
|
+
}, [isConnected, isAuthenticated, historyList, viewState]);
|
|
61
78
|
// 채팅창관리
|
|
62
|
-
useChatSocketState(chatInquiryNumber, viewState, sendHeartbeat, sendInquiryLeft);
|
|
63
|
-
// 홈에서 사용
|
|
64
|
-
const handleStartChat = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
try {
|
|
66
|
-
setIsLoading(true);
|
|
67
|
-
// 채팅 시작 - 새 문의 생성 또는 기존 문의 조회 처리
|
|
68
|
-
yield startChat();
|
|
69
|
-
// 대화 화면으로 전환
|
|
70
|
-
setViewState('conversation');
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
console.error('채팅 시작 실패:', error);
|
|
74
|
-
}
|
|
75
|
-
finally {
|
|
76
|
-
setIsLoading(false);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
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 {
|
|
@@ -119,23 +120,23 @@ const ChatHomeView = ({ hashValue, setHashValue, isMobile }) => {
|
|
|
119
120
|
}
|
|
120
121
|
});
|
|
121
122
|
const renderWithNavigation = (content, activeView) => {
|
|
122
|
-
return (<main className={
|
|
123
|
-
<div className=
|
|
123
|
+
return (<main className={`${isMobile ? 'h-[100dvh] w-screen' : ''} relative flex items-center justify-center rounded-[30px]`}>
|
|
124
|
+
<div className={`${isMobile ? 'h-[100dvh] w-full' : ' h-[690px] w-[390px]'} relative overflow-hidden rounded-[30px] bg-white shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]`}>
|
|
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
|
// 채팅 문의 창
|
|
134
135
|
if (viewState === 'conversation') {
|
|
135
|
-
return renderWithNavigation(<ChatConversation onBackClick={handleBackToHome} isActive={viewState === 'conversation'} onChatNew={handleNewStartChat}/>, 'conversation');
|
|
136
|
+
return renderWithNavigation(<ChatConversation onBackClick={handleBackToHome} isActive={viewState === 'conversation'} onChatNew={handleNewStartChat} isMobile={isMobile}/>, 'conversation');
|
|
136
137
|
}
|
|
137
138
|
if (viewState === 'history') {
|
|
138
|
-
return renderWithNavigation(<HistoryView onBackClick={handleBackToHome} onChatHistoryClick={handleChatHistoryClick} onNewChatClick={handleNewStartChat} isAuthenticated={isAuthenticated !== null && isAuthenticated !== void 0 ? isAuthenticated : false} historyLit={historyList !== null && historyList !== void 0 ? historyList : []} goGetHistoryList={goGetHistoryList}/>, 'history');
|
|
139
|
+
return renderWithNavigation(<HistoryView onBackClick={handleBackToHome} onChatHistoryClick={handleChatHistoryClick} onNewChatClick={handleNewStartChat} isAuthenticated={isAuthenticated !== null && isAuthenticated !== void 0 ? isAuthenticated : false} historyLit={historyList !== null && historyList !== void 0 ? historyList : []} goGetHistoryList={goGetHistoryList} isMobile={isMobile}/>, 'history');
|
|
139
140
|
}
|
|
140
141
|
// 홈
|
|
141
142
|
return renderWithNavigation(<div className={`relative h-full w-full`}>
|
|
@@ -23,10 +23,10 @@ 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
|
-
isLoading: isProviderLoading,
|
|
30
30
|
isConnected,
|
|
31
31
|
isAuthenticated,
|
|
32
32
|
historyList,
|
|
@@ -34,11 +34,12 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
34
34
|
startChat,
|
|
35
35
|
createNewChat,
|
|
36
36
|
chatInquiryNumber,
|
|
37
|
+
sendInquiryJoined,
|
|
37
38
|
sendHeartbeat,
|
|
39
|
+
sendInquiryWatching,
|
|
38
40
|
sendInquiryLeft,
|
|
39
41
|
goGetHistoryList,
|
|
40
42
|
sendHistoryEntered,
|
|
41
|
-
sendHistoryLeft,
|
|
42
43
|
startSelectedChat,
|
|
43
44
|
attendRoomByHistory
|
|
44
45
|
} = useDaeryuntalk();
|
|
@@ -46,19 +47,36 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
46
47
|
const [mainData, setMainData] = useState<IChatInquiryMainDataResponse | null>(null);
|
|
47
48
|
const [isLoading, setIsLoading] = useState(false);
|
|
48
49
|
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow<HTMLDivElement>();
|
|
50
|
+
const toast = useDaeryunTalkToast();
|
|
49
51
|
// 아직 커버이미지 url이 안나옴
|
|
50
52
|
const backgroundImage = mainData?.sleeve_image_url ? mainData.sleeve_image_url : DaeryuntalkIntro;
|
|
53
|
+
const handleStartChat = async () => {
|
|
54
|
+
try {
|
|
55
|
+
setIsLoading(true);
|
|
56
|
+
|
|
57
|
+
// 채팅 시작 - 새 문의 생성 또는 기존 문의 조회 처리
|
|
58
|
+
await startChat();
|
|
59
|
+
// 대화 화면으로 전환
|
|
60
|
+
setViewState('conversation');
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error('채팅 시작 실패:', error);
|
|
63
|
+
} finally {
|
|
64
|
+
setIsLoading(false);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
51
68
|
useEffect(() => {
|
|
52
|
-
if (hashValue && isConnected &&
|
|
69
|
+
if (hashValue && isConnected && inquiryMainData) {
|
|
70
|
+
console.log('해쉬 실행');
|
|
53
71
|
handleStartChat();
|
|
72
|
+
} else {
|
|
73
|
+
console.log('해쉬 실행안함');
|
|
54
74
|
}
|
|
55
|
-
}, [hashValue, isConnected]);
|
|
75
|
+
}, [hashValue, isConnected, inquiryMainData]);
|
|
56
76
|
useEffect(() => {
|
|
57
77
|
checkScroll();
|
|
58
78
|
}, [mainData]);
|
|
59
79
|
|
|
60
|
-
const toast = useDaeryunTalkToast();
|
|
61
|
-
|
|
62
80
|
useEffect(() => {
|
|
63
81
|
if (viewState === 'history') {
|
|
64
82
|
goGetHistoryList({});
|
|
@@ -72,33 +90,21 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
72
90
|
}, [inquiryMainData]);
|
|
73
91
|
|
|
74
92
|
useEffect(() => {
|
|
75
|
-
if (isAuthenticated) {
|
|
93
|
+
if (isConnected && isAuthenticated) {
|
|
94
|
+
console.log('history entered', historyList);
|
|
76
95
|
sendHistoryEntered(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
|
|
77
96
|
}
|
|
78
|
-
|
|
79
|
-
return () => {
|
|
80
|
-
sendHistoryLeft(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
|
|
81
|
-
};
|
|
82
|
-
}, [isAuthenticated]);
|
|
97
|
+
}, [isConnected, isAuthenticated, historyList, viewState]);
|
|
83
98
|
|
|
84
99
|
// 채팅창관리
|
|
85
|
-
useChatSocketState(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
await startChat();
|
|
94
|
-
// 대화 화면으로 전환
|
|
95
|
-
setViewState('conversation');
|
|
96
|
-
} catch (error) {
|
|
97
|
-
console.error('채팅 시작 실패:', error);
|
|
98
|
-
} finally {
|
|
99
|
-
setIsLoading(false);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
100
|
+
useChatSocketState(
|
|
101
|
+
chatInquiryNumber,
|
|
102
|
+
viewState,
|
|
103
|
+
sendInquiryWatching,
|
|
104
|
+
sendInquiryJoined,
|
|
105
|
+
sendHeartbeat,
|
|
106
|
+
sendInquiryLeft
|
|
107
|
+
);
|
|
102
108
|
|
|
103
109
|
// 히스토리에서 사용
|
|
104
110
|
const handleNewStartChat = async () => {
|
|
@@ -142,8 +148,12 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
142
148
|
|
|
143
149
|
const renderWithNavigation = (content: React.ReactNode, activeView: 'home' | 'history' | 'conversation') => {
|
|
144
150
|
return (
|
|
145
|
-
<main
|
|
146
|
-
|
|
151
|
+
<main
|
|
152
|
+
className={`${isMobile ? 'h-[100dvh] w-screen' : ''} relative flex items-center justify-center rounded-[30px]`}
|
|
153
|
+
>
|
|
154
|
+
<div
|
|
155
|
+
className={`${isMobile ? 'h-[100dvh] w-full' : ' h-[690px] w-[390px]'} relative overflow-hidden rounded-[30px] bg-white shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]`}
|
|
156
|
+
>
|
|
147
157
|
<div className="flex h-full flex-col">
|
|
148
158
|
<div className="flex-1 overflow-hidden">{content}</div>
|
|
149
159
|
|
|
@@ -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
|
};
|
|
@@ -166,6 +178,7 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
166
178
|
onBackClick={handleBackToHome}
|
|
167
179
|
isActive={viewState === 'conversation'}
|
|
168
180
|
onChatNew={handleNewStartChat}
|
|
181
|
+
isMobile={isMobile}
|
|
169
182
|
/>,
|
|
170
183
|
'conversation'
|
|
171
184
|
);
|
|
@@ -180,6 +193,7 @@ const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, is
|
|
|
180
193
|
isAuthenticated={isAuthenticated ?? false}
|
|
181
194
|
historyLit={historyList ?? []}
|
|
182
195
|
goGetHistoryList={goGetHistoryList}
|
|
196
|
+
isMobile={isMobile}
|
|
183
197
|
/>,
|
|
184
198
|
'history'
|
|
185
199
|
);
|
|
@@ -94,12 +94,11 @@ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, wor
|
|
|
94
94
|
</ChatWrapper>);
|
|
95
95
|
};
|
|
96
96
|
const renderMessageContent = () => {
|
|
97
|
-
var _a, _b
|
|
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
103
|
message-content
|
|
105
104
|
`}>
|
|
@@ -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
|
-
{
|
|
116
|
-
? (
|
|
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,8 +155,6 @@ 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={`
|
|
@@ -177,7 +175,7 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
|
|
|
177
175
|
}
|
|
178
176
|
`}
|
|
179
177
|
>
|
|
180
|
-
{
|
|
178
|
+
{WorkFlowButtonUiCode.TILE_BUTTON !== object?.objectGroupUiCode
|
|
181
179
|
? object.objectList
|
|
182
180
|
?.sort((a, b) => a.sequence - b.sequence)
|
|
183
181
|
?.map((item, index) => {
|
|
@@ -10,16 +10,16 @@ const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
|
|
|
10
10
|
return (<>
|
|
11
11
|
<ImageViewer />
|
|
12
12
|
|
|
13
|
-
<div className="relative z-[999998]
|
|
13
|
+
<div className="relative z-[999998] ">
|
|
14
14
|
<div className={`
|
|
15
15
|
fixed
|
|
16
16
|
w-full transform
|
|
17
17
|
bg-white shadow-[0px_4px_10px_0px_#00000026]
|
|
18
18
|
${isMobile ? '' : 'duration-300 ease-in-out'}
|
|
19
19
|
${isHash && isMobile
|
|
20
|
-
? 'inset-0 h-
|
|
20
|
+
? 'inset-0 h-[100dvh] w-screen rounded-none'
|
|
21
21
|
: isMobile || isHash
|
|
22
|
-
? 'inset-0 h-
|
|
22
|
+
? 'inset-0 h-[100dvh] w-screen rounded-none'
|
|
23
23
|
: 'bottom-[165px] right-[30px] max-w-[390px] rounded-[30px] lg:bottom-[110px]'}
|
|
24
24
|
|
|
25
25
|
${isMobile
|
|
@@ -30,13 +30,13 @@ const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
|
|
|
30
30
|
? 'translate-y-0 scale-100 opacity-100'
|
|
31
31
|
: 'pointer-events-none translate-y-6 opacity-0'}
|
|
32
32
|
`}>
|
|
33
|
-
<div ref={containerRef} className=
|
|
34
|
-
<ChatHomeView hashValue={hashValue} setHashValue={setHashValue} isMobile={isMobile}/>
|
|
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} 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
|
</>);
|
|
@@ -21,7 +21,7 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
|
|
|
21
21
|
<>
|
|
22
22
|
<ImageViewer />
|
|
23
23
|
|
|
24
|
-
<div className="relative z-[999998]
|
|
24
|
+
<div className="relative z-[999998] ">
|
|
25
25
|
<div
|
|
26
26
|
className={`
|
|
27
27
|
fixed
|
|
@@ -30,9 +30,9 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
|
|
|
30
30
|
${isMobile ? '' : 'duration-300 ease-in-out'}
|
|
31
31
|
${
|
|
32
32
|
isHash && isMobile
|
|
33
|
-
? 'inset-0 h-
|
|
33
|
+
? 'inset-0 h-[100dvh] w-screen rounded-none'
|
|
34
34
|
: isMobile || isHash
|
|
35
|
-
? 'inset-0 h-
|
|
35
|
+
? 'inset-0 h-[100dvh] w-screen rounded-none'
|
|
36
36
|
: 'bottom-[165px] right-[30px] max-w-[390px] rounded-[30px] lg:bottom-[110px]'
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -49,14 +49,19 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hash
|
|
|
49
49
|
>
|
|
50
50
|
<div
|
|
51
51
|
ref={containerRef}
|
|
52
|
-
className=
|
|
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
|
|
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: (
|
|
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,
|
|
@@ -80,7 +81,9 @@ export const DaeryuntalkProvider = ({ children, propsTel }) => {
|
|
|
80
81
|
setWorkFlowStack,
|
|
81
82
|
setMessageObject,
|
|
82
83
|
socketRef: socketRef,
|
|
83
|
-
setInquiryStatus
|
|
84
|
+
setInquiryStatus,
|
|
85
|
+
setHistoryList,
|
|
86
|
+
historyList
|
|
84
87
|
});
|
|
85
88
|
// MSG15591497825895676
|
|
86
89
|
// 채팅 관련
|
|
@@ -120,6 +123,7 @@ export const DaeryuntalkProvider = ({ children, propsTel }) => {
|
|
|
120
123
|
workFlowBack,
|
|
121
124
|
workFlowStack,
|
|
122
125
|
sendHeartbeat,
|
|
126
|
+
sendInquiryWatching,
|
|
123
127
|
sendInquiryLeft,
|
|
124
128
|
chatUserUpdate,
|
|
125
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: (
|
|
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,
|
|
@@ -163,7 +166,9 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
|
|
|
163
166
|
setWorkFlowStack,
|
|
164
167
|
setMessageObject,
|
|
165
168
|
socketRef: socketRef,
|
|
166
|
-
setInquiryStatus
|
|
169
|
+
setInquiryStatus,
|
|
170
|
+
setHistoryList,
|
|
171
|
+
historyList
|
|
167
172
|
});
|
|
168
173
|
|
|
169
174
|
// MSG15591497825895676
|
|
@@ -221,6 +226,7 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
|
|
|
221
226
|
workFlowBack,
|
|
222
227
|
workFlowStack,
|
|
223
228
|
sendHeartbeat,
|
|
229
|
+
sendInquiryWatching,
|
|
224
230
|
sendInquiryLeft,
|
|
225
231
|
chatUserUpdate,
|
|
226
232
|
getNextMessageList,
|
|
@@ -6,7 +6,7 @@ import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
|
|
|
6
6
|
import AuthForm from './History/AuthForm';
|
|
7
7
|
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
8
8
|
import ShadowBox from './_ui/ShadowBox';
|
|
9
|
-
const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthenticated, historyLit, goGetHistoryList }) => {
|
|
9
|
+
const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthenticated, historyLit, goGetHistoryList, isMobile }) => {
|
|
10
10
|
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
checkScroll();
|
|
@@ -15,6 +15,7 @@ type HistoryViewProps = {
|
|
|
15
15
|
isAuthenticated: boolean;
|
|
16
16
|
historyLit: History[];
|
|
17
17
|
goGetHistoryList: (data: { version?: string }) => void;
|
|
18
|
+
isMobile: boolean;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const HistoryView: React.FC<HistoryViewProps> = ({
|
|
@@ -23,7 +24,8 @@ const HistoryView: React.FC<HistoryViewProps> = ({
|
|
|
23
24
|
onNewChatClick,
|
|
24
25
|
isAuthenticated,
|
|
25
26
|
historyLit,
|
|
26
|
-
goGetHistoryList
|
|
27
|
+
goGetHistoryList,
|
|
28
|
+
isMobile
|
|
27
29
|
}) => {
|
|
28
30
|
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow<HTMLDivElement>();
|
|
29
31
|
|
|
@@ -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> = ({
|
|
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 ${
|
|
@@ -3,7 +3,7 @@ import NoticeIcon from '../../asset/images/daeryuntalk/notice.svg';
|
|
|
3
3
|
import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
|
|
4
4
|
const NoticeMessage = ({ content }) => {
|
|
5
5
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
6
|
-
return (<div className="
|
|
6
|
+
return (<div className="bg-[#F7F7F7]/90 p-2 backdrop-blur-sm">
|
|
7
7
|
<div className="flex items-start">
|
|
8
8
|
<div className="mr-2 flex-shrink-0">
|
|
9
9
|
<NoticeIcon width={20} height={20}/>
|
|
@@ -11,7 +11,7 @@ const NoticeMessage: React.FC<NoticeMessageProps> = ({ content }) => {
|
|
|
11
11
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<div className="
|
|
14
|
+
<div className="bg-[#F7F7F7]/90 p-2 backdrop-blur-sm">
|
|
15
15
|
<div className="flex items-start">
|
|
16
16
|
<div className="mr-2 flex-shrink-0">
|
|
17
17
|
<NoticeIcon width={20} height={20} />
|