@daeryun/dr_components 0.8.1 → 0.8.3
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/components/Daeryuntalk/ChatButton.d.ts +2 -0
- package/dist/components/Daeryuntalk/ChatButton.jsx +12 -3
- package/dist/components/Daeryuntalk/ChatButton.tsx +15 -3
- package/dist/components/Daeryuntalk/ChatHomeView.d.ts +7 -2
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +20 -22
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +38 -31
- package/dist/components/Daeryuntalk/ChatWidget.d.ts +3 -1
- package/dist/components/Daeryuntalk/ChatWidget.jsx +16 -20
- package/dist/components/Daeryuntalk/ChatWidget.tsx +21 -21
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +1 -1
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +1 -1
- package/dist/components/Daeryuntalk/HistoryView.jsx +6 -6
- package/dist/components/Daeryuntalk/HistoryView.tsx +11 -9
- package/dist/components/Daeryuntalk/NavigationFooter.d.ts +1 -1
- package/dist/components/Daeryuntalk/NavigationFooter.jsx +3 -0
- package/dist/components/Daeryuntalk/NavigationFooter.tsx +4 -1
- package/dist/components/Daeryuntalk/Toast/ToastRender.jsx +0 -1
- package/dist/components/Daeryuntalk/Toast/ToastRender.tsx +0 -1
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +4 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +24 -1
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +30 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +1 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +18 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +17 -3
- package/dist/components/Daeryuntalk/index.jsx +22 -5
- package/dist/components/Daeryuntalk/index.tsx +34 -10
- package/dist/styles/globals.css +12 -18
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
|
-
const ChatButton = ({ isOpen, onClick, apiVersion }) => {
|
|
3
|
+
const ChatButton = ({ isOpen, onClick, apiVersion, isMobile = false, hashValue = null }) => {
|
|
4
4
|
const { initializeDaeryuntalk, goGetHistoryList } = useDaeryuntalk();
|
|
5
5
|
const handleClick = useCallback(() => {
|
|
6
6
|
// 채팅 버튼이 클릭되면 초기화 메소드 호출
|
|
7
7
|
if (!isOpen) {
|
|
8
8
|
// 여기서 대륜톡 초기화
|
|
9
|
-
initializeDaeryuntalk(apiVersion);
|
|
9
|
+
initializeDaeryuntalk('', apiVersion);
|
|
10
10
|
}
|
|
11
11
|
// 히스토리도 불러와서 인증 확인
|
|
12
12
|
goGetHistoryList({});
|
|
13
13
|
// 원래 onClick 핸들러 호출
|
|
14
14
|
onClick();
|
|
15
15
|
}, [isOpen, onClick, initializeDaeryuntalk, apiVersion]);
|
|
16
|
+
// 해쉬 값이 있는경우
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (hashValue) {
|
|
19
|
+
initializeDaeryuntalk(hashValue, apiVersion);
|
|
20
|
+
// 히스토리도 불러와서 인증 확인
|
|
21
|
+
goGetHistoryList({});
|
|
22
|
+
}
|
|
23
|
+
}, [hashValue]);
|
|
16
24
|
return (<button aria-label="채팅 상담 열기" onClick={handleClick} className={`
|
|
25
|
+
${hashValue ? 'pointer-events-none opacity-0' : ''}
|
|
17
26
|
fixed bottom-[85px] right-[20px] h-[60px] w-[60px] rounded-[10px] border lg:bottom-[30px] lg:right-[30px]
|
|
18
27
|
${isOpen ? 'border-gray-200 bg-white' : 'border-[#AA1D36] bg-[#AA1D36]'}
|
|
19
28
|
z-[999999] flex transform cursor-pointer items-center justify-center
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
|
|
4
4
|
interface ChatButtonProps {
|
|
5
5
|
isOpen: boolean;
|
|
6
6
|
onClick: () => void;
|
|
7
7
|
apiVersion?: string;
|
|
8
|
+
isMobile?: boolean;
|
|
9
|
+
hashValue?: string | null;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
const ChatButton: React.FC<ChatButtonProps> = ({ isOpen, onClick, apiVersion }) => {
|
|
12
|
+
const ChatButton: React.FC<ChatButtonProps> = ({ isOpen, onClick, apiVersion, isMobile = false, hashValue = null }) => {
|
|
11
13
|
const { initializeDaeryuntalk, goGetHistoryList } = useDaeryuntalk();
|
|
12
14
|
|
|
13
15
|
const handleClick = useCallback(() => {
|
|
14
16
|
// 채팅 버튼이 클릭되면 초기화 메소드 호출
|
|
15
17
|
if (!isOpen) {
|
|
16
18
|
// 여기서 대륜톡 초기화
|
|
17
|
-
initializeDaeryuntalk(apiVersion);
|
|
19
|
+
initializeDaeryuntalk('', apiVersion);
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
// 히스토리도 불러와서 인증 확인
|
|
@@ -23,11 +25,21 @@ const ChatButton: React.FC<ChatButtonProps> = ({ isOpen, onClick, apiVersion })
|
|
|
23
25
|
onClick();
|
|
24
26
|
}, [isOpen, onClick, initializeDaeryuntalk, apiVersion]);
|
|
25
27
|
|
|
28
|
+
// 해쉬 값이 있는경우
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (hashValue) {
|
|
31
|
+
initializeDaeryuntalk(hashValue, apiVersion);
|
|
32
|
+
// 히스토리도 불러와서 인증 확인
|
|
33
|
+
goGetHistoryList({});
|
|
34
|
+
}
|
|
35
|
+
}, [hashValue]);
|
|
36
|
+
|
|
26
37
|
return (
|
|
27
38
|
<button
|
|
28
39
|
aria-label="채팅 상담 열기"
|
|
29
40
|
onClick={handleClick}
|
|
30
41
|
className={`
|
|
42
|
+
${hashValue ? 'pointer-events-none opacity-0' : ''}
|
|
31
43
|
fixed bottom-[85px] right-[20px] h-[60px] w-[60px] rounded-[10px] border lg:bottom-[30px] lg:right-[30px]
|
|
32
44
|
${isOpen ? 'border-gray-200 bg-white' : 'border-[#AA1D36] bg-[#AA1D36]'}
|
|
33
45
|
z-[999999] flex transform cursor-pointer items-center justify-center
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
type ChatHomeViewProps = {
|
|
3
|
+
hashValue: string | null;
|
|
4
|
+
setHashValue: Dispatch<SetStateAction<string | null>>;
|
|
5
|
+
isMobile: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const ChatHomeView: React.FC<ChatHomeViewProps>;
|
|
3
8
|
export default ChatHomeView;
|
|
@@ -22,12 +22,20 @@ import { useChatSocketState } from './_hooks/talkprovider/useChatSocketState';
|
|
|
22
22
|
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
23
23
|
import ShadowBox from './_ui/ShadowBox';
|
|
24
24
|
import { useDaeryunTalkToast } from './Toast/DaeryuntalkToastProvider';
|
|
25
|
-
|
|
26
|
-
|
|
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();
|
|
27
28
|
const [viewState, setViewState] = useState('home');
|
|
28
29
|
const [mainData, setMainData] = useState(null);
|
|
29
30
|
const [isLoading, setIsLoading] = useState(false);
|
|
30
31
|
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
|
|
32
|
+
// 아직 커버이미지 url이 안나옴
|
|
33
|
+
const backgroundImage = (mainData === null || mainData === void 0 ? void 0 : mainData.sleeve_image_url) ? mainData.sleeve_image_url : DaeryuntalkIntro;
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (hashValue && isConnected) {
|
|
36
|
+
handleStartChat();
|
|
37
|
+
}
|
|
38
|
+
}, [hashValue, isConnected]);
|
|
31
39
|
useEffect(() => {
|
|
32
40
|
checkScroll();
|
|
33
41
|
}, [mainData]);
|
|
@@ -110,38 +118,26 @@ const ChatHomeView = () => {
|
|
|
110
118
|
setIsLoading(false);
|
|
111
119
|
}
|
|
112
120
|
});
|
|
113
|
-
// 채팅 문의 창
|
|
114
|
-
if (viewState === 'conversation') {
|
|
115
|
-
return (<main className="flex h-[690px] w-[390px] items-center justify-center rounded-[30px]">
|
|
116
|
-
<div className="relative h-[690px] w-[390px] overflow-hidden rounded-[30px] bg-white shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]">
|
|
117
|
-
<ChatConversation onBackClick={handleBackToHome} isActive={viewState === 'conversation'} onChatNew={handleNewStartChat}/>
|
|
118
|
-
</div>
|
|
119
|
-
</main>);
|
|
120
|
-
}
|
|
121
121
|
const renderWithNavigation = (content, activeView) => {
|
|
122
|
-
return (<main className={`flex h-[690px] w-[390px] items-center justify-center rounded-[30px]`}>
|
|
122
|
+
return (<main className={`relative flex h-[690px] w-[390px] items-center justify-center rounded-[30px]`}>
|
|
123
123
|
<div className="relative h-[690px] w-[390px] overflow-hidden rounded-[30px] bg-white shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]">
|
|
124
|
-
{/*{isMobile && (*/}
|
|
125
|
-
{/* <button*/}
|
|
126
|
-
{/* onClick={onClose}*/}
|
|
127
|
-
{/* className="absolute right-4 top-4 z-10 rounded-full p-2 backdrop-blur"*/}
|
|
128
|
-
{/* >*/}
|
|
129
|
-
{/* <CloseSvgIcon />*/}
|
|
130
|
-
{/* </button>*/}
|
|
131
|
-
{/*)}*/}
|
|
132
124
|
<div className="flex h-full flex-col">
|
|
133
125
|
<div className="flex-1 overflow-hidden">{content}</div>
|
|
134
126
|
|
|
135
127
|
<NavigationFooter activeView={activeView} onHomeClick={handleBackToHome} onHistoryClick={handleHistoryClick}/>
|
|
136
128
|
</div>
|
|
137
129
|
</div>
|
|
130
|
+
{isMobile && <ToastRenderer />}
|
|
138
131
|
</main>);
|
|
139
132
|
};
|
|
133
|
+
// 채팅 문의 창
|
|
134
|
+
if (viewState === 'conversation') {
|
|
135
|
+
return renderWithNavigation(<ChatConversation onBackClick={handleBackToHome} isActive={viewState === 'conversation'} onChatNew={handleNewStartChat}/>, 'conversation');
|
|
136
|
+
}
|
|
140
137
|
if (viewState === 'history') {
|
|
141
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');
|
|
142
139
|
}
|
|
143
|
-
//
|
|
144
|
-
const backgroundImage = (mainData === null || mainData === void 0 ? void 0 : mainData.sleeve_image_url) ? mainData.sleeve_image_url : DaeryuntalkIntro;
|
|
140
|
+
// 홈
|
|
145
141
|
return renderWithNavigation(<div className={`relative h-full w-full`}>
|
|
146
142
|
<div className="absolute left-0 top-0 z-0 h-full w-full overflow-hidden">
|
|
147
143
|
<Image src={backgroundImage} alt="대화 배경" fill className="object-contain object-top will-change-transform"/>
|
|
@@ -153,7 +149,9 @@ const ChatHomeView = () => {
|
|
|
153
149
|
<span>24시간 운영</span>
|
|
154
150
|
</header>
|
|
155
151
|
|
|
156
|
-
<section className="mx-auto mt-[150px] flex w-[320px] flex-col gap-5 rounded-[12px] bg-white px-4 py-6 "
|
|
152
|
+
<section className=" mx-auto mt-[150px] flex w-[320px] flex-col gap-5 rounded-[12px] bg-white px-4 py-6 " style={{
|
|
153
|
+
boxShadow: '0px 4px 10px 0px #00000026'
|
|
154
|
+
}}>
|
|
157
155
|
<div className="flex items-center">
|
|
158
156
|
{(mainData === null || mainData === void 0 ? void 0 : mainData.channel_logo_image_url) ? (<Image src={mainData.channel_logo_image_url} alt="로고" width={24} height={24} className="mr-2"/>) : (<DaeryunLogoIcon width={24} height={24} className="mr-2"/>)}
|
|
159
157
|
<h1 className="font-medium">{(mainData === null || mainData === void 0 ? void 0 : mainData.channel_name) || '법무법인(유한)대륜'}</h1>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
|
2
2
|
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
3
3
|
import ChatConversation from './ChatConversation';
|
|
4
4
|
import HistoryView from './HistoryView';
|
|
@@ -15,11 +15,18 @@ import { useChatSocketState } from './_hooks/talkprovider/useChatSocketState';
|
|
|
15
15
|
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
16
16
|
import ShadowBox from './_ui/ShadowBox';
|
|
17
17
|
import { useDaeryunTalkToast } from './Toast/DaeryuntalkToastProvider';
|
|
18
|
+
import ToastRenderer from './Toast/ToastRender';
|
|
18
19
|
|
|
19
20
|
type ViewState = 'home' | 'conversation' | 'history';
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
type ChatHomeViewProps = {
|
|
23
|
+
hashValue: string | null;
|
|
24
|
+
setHashValue: Dispatch<SetStateAction<string | null>>;
|
|
25
|
+
isMobile: boolean;
|
|
26
|
+
};
|
|
27
|
+
const ChatHomeView: React.FC<ChatHomeViewProps> = ({ hashValue, setHashValue, isMobile }) => {
|
|
22
28
|
const {
|
|
29
|
+
isConnected,
|
|
23
30
|
isAuthenticated,
|
|
24
31
|
historyList,
|
|
25
32
|
inquiryMainData,
|
|
@@ -38,6 +45,13 @@ const ChatHomeView: React.FC = () => {
|
|
|
38
45
|
const [mainData, setMainData] = useState<IChatInquiryMainDataResponse | null>(null);
|
|
39
46
|
const [isLoading, setIsLoading] = useState(false);
|
|
40
47
|
const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow<HTMLDivElement>();
|
|
48
|
+
// 아직 커버이미지 url이 안나옴
|
|
49
|
+
const backgroundImage = mainData?.sleeve_image_url ? mainData.sleeve_image_url : DaeryuntalkIntro;
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (hashValue && isConnected) {
|
|
52
|
+
handleStartChat();
|
|
53
|
+
}
|
|
54
|
+
}, [hashValue, isConnected]);
|
|
41
55
|
useEffect(() => {
|
|
42
56
|
checkScroll();
|
|
43
57
|
}, [mainData]);
|
|
@@ -125,33 +139,10 @@ const ChatHomeView: React.FC = () => {
|
|
|
125
139
|
}
|
|
126
140
|
};
|
|
127
141
|
|
|
128
|
-
|
|
129
|
-
if (viewState === 'conversation') {
|
|
142
|
+
const renderWithNavigation = (content: React.ReactNode, activeView: 'home' | 'history' | 'conversation') => {
|
|
130
143
|
return (
|
|
131
|
-
<main className=
|
|
144
|
+
<main className={`relative flex h-[690px] w-[390px] items-center justify-center rounded-[30px]`}>
|
|
132
145
|
<div className="relative h-[690px] w-[390px] overflow-hidden rounded-[30px] bg-white shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]">
|
|
133
|
-
<ChatConversation
|
|
134
|
-
onBackClick={handleBackToHome}
|
|
135
|
-
isActive={viewState === 'conversation'}
|
|
136
|
-
onChatNew={handleNewStartChat}
|
|
137
|
-
/>
|
|
138
|
-
</div>
|
|
139
|
-
</main>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const renderWithNavigation = (content: React.ReactNode, activeView: 'home' | 'history') => {
|
|
144
|
-
return (
|
|
145
|
-
<main className={`flex h-[690px] w-[390px] items-center justify-center rounded-[30px]`}>
|
|
146
|
-
<div className="relative h-[690px] w-[390px] overflow-hidden rounded-[30px] bg-white shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]">
|
|
147
|
-
{/*{isMobile && (*/}
|
|
148
|
-
{/* <button*/}
|
|
149
|
-
{/* onClick={onClose}*/}
|
|
150
|
-
{/* className="absolute right-4 top-4 z-10 rounded-full p-2 backdrop-blur"*/}
|
|
151
|
-
{/* >*/}
|
|
152
|
-
{/* <CloseSvgIcon />*/}
|
|
153
|
-
{/* </button>*/}
|
|
154
|
-
{/*)}*/}
|
|
155
146
|
<div className="flex h-full flex-col">
|
|
156
147
|
<div className="flex-1 overflow-hidden">{content}</div>
|
|
157
148
|
|
|
@@ -162,10 +153,23 @@ const ChatHomeView: React.FC = () => {
|
|
|
162
153
|
/>
|
|
163
154
|
</div>
|
|
164
155
|
</div>
|
|
156
|
+
{isMobile && <ToastRenderer />}
|
|
165
157
|
</main>
|
|
166
158
|
);
|
|
167
159
|
};
|
|
168
160
|
|
|
161
|
+
// 채팅 문의 창
|
|
162
|
+
if (viewState === 'conversation') {
|
|
163
|
+
return renderWithNavigation(
|
|
164
|
+
<ChatConversation
|
|
165
|
+
onBackClick={handleBackToHome}
|
|
166
|
+
isActive={viewState === 'conversation'}
|
|
167
|
+
onChatNew={handleNewStartChat}
|
|
168
|
+
/>,
|
|
169
|
+
'conversation'
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
169
173
|
if (viewState === 'history') {
|
|
170
174
|
return renderWithNavigation(
|
|
171
175
|
<HistoryView
|
|
@@ -180,9 +184,7 @@ const ChatHomeView: React.FC = () => {
|
|
|
180
184
|
);
|
|
181
185
|
}
|
|
182
186
|
|
|
183
|
-
//
|
|
184
|
-
const backgroundImage = mainData?.sleeve_image_url ? mainData.sleeve_image_url : DaeryuntalkIntro;
|
|
185
|
-
|
|
187
|
+
// 홈
|
|
186
188
|
return renderWithNavigation(
|
|
187
189
|
<div className={`relative h-full w-full`}>
|
|
188
190
|
<div className="absolute left-0 top-0 z-0 h-full w-full overflow-hidden">
|
|
@@ -200,7 +202,12 @@ const ChatHomeView: React.FC = () => {
|
|
|
200
202
|
<span>24시간 운영</span>
|
|
201
203
|
</header>
|
|
202
204
|
|
|
203
|
-
<section
|
|
205
|
+
<section
|
|
206
|
+
className=" mx-auto mt-[150px] flex w-[320px] flex-col gap-5 rounded-[12px] bg-white px-4 py-6 "
|
|
207
|
+
style={{
|
|
208
|
+
boxShadow: '0px 4px 10px 0px #00000026'
|
|
209
|
+
}}
|
|
210
|
+
>
|
|
204
211
|
<div className="flex items-center">
|
|
205
212
|
{mainData?.channel_logo_image_url ? (
|
|
206
213
|
<Image
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
interface ChatWidgetProps {
|
|
3
3
|
isOpen: boolean;
|
|
4
4
|
isMobile: boolean;
|
|
5
5
|
onClose: () => void;
|
|
6
|
+
hashValue: string | null;
|
|
7
|
+
setHashValue: Dispatch<SetStateAction<string | null>>;
|
|
6
8
|
}
|
|
7
9
|
declare const ChatWidget: React.FC<ChatWidgetProps>;
|
|
8
10
|
export default ChatWidget;
|
|
@@ -4,44 +4,40 @@ import ImageViewer from './Viewer/ImageViewer';
|
|
|
4
4
|
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
5
5
|
import ShadowBox from './_ui/ShadowBox';
|
|
6
6
|
import ToastRenderer from './Toast/ToastRender';
|
|
7
|
-
const ChatWidget = ({ isOpen, isMobile, onClose }) => {
|
|
7
|
+
const ChatWidget = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
|
|
8
8
|
const { containerRef, isScroll, isBottom } = useScrollShadow();
|
|
9
|
+
const isHash = !!hashValue;
|
|
9
10
|
return (<>
|
|
10
11
|
<ImageViewer />
|
|
11
12
|
|
|
12
13
|
<div className="relative z-[999998] ">
|
|
13
14
|
<div className={`
|
|
14
15
|
fixed
|
|
15
|
-
|
|
16
|
-
w-full
|
|
16
|
+
w-full transform
|
|
17
17
|
bg-white shadow-[0px_4px_10px_0px_#00000026]
|
|
18
|
-
|
|
18
|
+
duration-300 ease-in-out
|
|
19
|
+
|
|
20
|
+
${isHash && isMobile
|
|
21
|
+
? 'inset-0 h-[100dvh] w-screen rounded-none'
|
|
22
|
+
: isMobile || isHash
|
|
23
|
+
? 'inset-0 w-screen rounded-none'
|
|
24
|
+
: 'bottom-[165px] right-[30px] max-w-[390px] rounded-[30px] lg:bottom-[110px]'}
|
|
25
|
+
|
|
19
26
|
${isMobile
|
|
20
27
|
? isOpen
|
|
21
|
-
? 'translate-y-0'
|
|
22
|
-
: 'translate-y-full'
|
|
28
|
+
? 'translate-y-0'
|
|
29
|
+
: 'translate-y-full'
|
|
23
30
|
: isOpen
|
|
24
31
|
? 'translate-y-0 scale-100 opacity-100'
|
|
25
32
|
: 'pointer-events-none translate-y-6 opacity-0'}
|
|
26
33
|
`}>
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
{/* <button*/}
|
|
30
|
-
{/* onClick={onClose}*/}
|
|
31
|
-
{/* className="absolute right-4 top-4 z-10 rounded-full bg-white/70 p-2 backdrop-blur"*/}
|
|
32
|
-
{/* aria-label="닫기"*/}
|
|
33
|
-
{/* >*/}
|
|
34
|
-
{/* X*/}
|
|
35
|
-
{/* </button>*/}
|
|
36
|
-
{/*)}*/}
|
|
37
|
-
{/* 실제로 스크롤되는 컨테이너에 ref 연결 */}
|
|
38
|
-
<div ref={containerRef} className="no-scrollbar flex h-full items-center justify-center overflow-y-auto rounded-[30px] bg-white">
|
|
39
|
-
<ChatHomeView />
|
|
34
|
+
<div ref={containerRef} className="no-scrollbar relative flex h-full items-center justify-center overflow-auto rounded-[30px] bg-white">
|
|
35
|
+
<ChatHomeView hashValue={hashValue} setHashValue={setHashValue} isMobile={isMobile}/>
|
|
40
36
|
</div>
|
|
41
37
|
|
|
42
38
|
{/* 투명 그라데이션 그림자 표시 */}
|
|
43
39
|
{!isScroll && !isBottom && <ShadowBox />}
|
|
44
|
-
<ToastRenderer />
|
|
40
|
+
{!isMobile && <ToastRenderer />}
|
|
45
41
|
</div>
|
|
46
42
|
</div>
|
|
47
43
|
</>);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import ChatHomeView from './ChatHomeView';
|
|
3
3
|
import ImageViewer from './Viewer/ImageViewer';
|
|
4
4
|
import { DaeryuntalkToastProvider } from './Toast/DaeryuntalkToastProvider';
|
|
@@ -10,10 +10,13 @@ interface ChatWidgetProps {
|
|
|
10
10
|
isOpen: boolean;
|
|
11
11
|
isMobile: boolean;
|
|
12
12
|
onClose: () => void;
|
|
13
|
+
hashValue: string | null;
|
|
14
|
+
setHashValue: Dispatch<SetStateAction<string | null>>;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose }) => {
|
|
17
|
+
const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose, hashValue, setHashValue }) => {
|
|
16
18
|
const { containerRef, isScroll, isBottom } = useScrollShadow<HTMLDivElement>();
|
|
19
|
+
const isHash = !!hashValue;
|
|
17
20
|
return (
|
|
18
21
|
<>
|
|
19
22
|
<ImageViewer />
|
|
@@ -22,42 +25,39 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({ isOpen, isMobile, onClose }) =>
|
|
|
22
25
|
<div
|
|
23
26
|
className={`
|
|
24
27
|
fixed
|
|
25
|
-
|
|
26
|
-
w-full
|
|
28
|
+
w-full transform
|
|
27
29
|
bg-white shadow-[0px_4px_10px_0px_#00000026]
|
|
28
|
-
|
|
30
|
+
duration-300 ease-in-out
|
|
31
|
+
|
|
32
|
+
${
|
|
33
|
+
isHash && isMobile
|
|
34
|
+
? 'inset-0 h-[100dvh] w-screen rounded-none'
|
|
35
|
+
: isMobile || isHash
|
|
36
|
+
? 'inset-0 w-screen rounded-none'
|
|
37
|
+
: 'bottom-[165px] right-[30px] max-w-[390px] rounded-[30px] lg:bottom-[110px]'
|
|
38
|
+
}
|
|
39
|
+
|
|
29
40
|
${
|
|
30
41
|
isMobile
|
|
31
42
|
? isOpen
|
|
32
|
-
? 'translate-y-0'
|
|
33
|
-
: 'translate-y-full'
|
|
43
|
+
? 'translate-y-0'
|
|
44
|
+
: 'translate-y-full'
|
|
34
45
|
: isOpen
|
|
35
46
|
? 'translate-y-0 scale-100 opacity-100'
|
|
36
47
|
: 'pointer-events-none translate-y-6 opacity-0'
|
|
37
48
|
}
|
|
38
49
|
`}
|
|
39
50
|
>
|
|
40
|
-
{/*/!* 닫기 버튼 (모바일 전용) *!/*/}
|
|
41
|
-
{/*{isMobile && (*/}
|
|
42
|
-
{/* <button*/}
|
|
43
|
-
{/* onClick={onClose}*/}
|
|
44
|
-
{/* className="absolute right-4 top-4 z-10 rounded-full bg-white/70 p-2 backdrop-blur"*/}
|
|
45
|
-
{/* aria-label="닫기"*/}
|
|
46
|
-
{/* >*/}
|
|
47
|
-
{/* X*/}
|
|
48
|
-
{/* </button>*/}
|
|
49
|
-
{/*)}*/}
|
|
50
|
-
{/* 실제로 스크롤되는 컨테이너에 ref 연결 */}
|
|
51
51
|
<div
|
|
52
52
|
ref={containerRef}
|
|
53
|
-
className="no-scrollbar flex h-full items-center justify-center overflow-
|
|
53
|
+
className="no-scrollbar relative flex h-full items-center justify-center overflow-auto rounded-[30px] bg-white"
|
|
54
54
|
>
|
|
55
|
-
<ChatHomeView />
|
|
55
|
+
<ChatHomeView hashValue={hashValue} setHashValue={setHashValue} isMobile={isMobile} />
|
|
56
56
|
</div>
|
|
57
57
|
|
|
58
58
|
{/* 투명 그라데이션 그림자 표시 */}
|
|
59
59
|
{!isScroll && !isBottom && <ShadowBox />}
|
|
60
|
-
<ToastRenderer />
|
|
60
|
+
{!isMobile && <ToastRenderer />}
|
|
61
61
|
</div>
|
|
62
62
|
</div>
|
|
63
63
|
</>
|
|
@@ -10,7 +10,7 @@ type DaeryuntalkContextType = {
|
|
|
10
10
|
isConnected: boolean;
|
|
11
11
|
isLoading: boolean;
|
|
12
12
|
sendMessage: (htmlContent: string, jsonData: any) => void;
|
|
13
|
-
initializeDaeryuntalk: (version?: string) => void;
|
|
13
|
+
initializeDaeryuntalk: (hashValue: string, version?: string) => void;
|
|
14
14
|
startChat: () => Promise<string | void>;
|
|
15
15
|
createNewChat: () => void;
|
|
16
16
|
startWorkFlow: (data: {
|
|
@@ -16,7 +16,7 @@ type DaeryuntalkContextType = {
|
|
|
16
16
|
isConnected: boolean;
|
|
17
17
|
isLoading: boolean;
|
|
18
18
|
sendMessage: (htmlContent: string, jsonData: any) => void;
|
|
19
|
-
initializeDaeryuntalk: (version?: string) => void;
|
|
19
|
+
initializeDaeryuntalk: (hashValue: string, version?: string) => void;
|
|
20
20
|
startChat: () => Promise<string | void>;
|
|
21
21
|
createNewChat: () => void;
|
|
22
22
|
startWorkFlow: (data: {
|
|
@@ -89,12 +89,12 @@ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthen
|
|
|
89
89
|
</>)}
|
|
90
90
|
|
|
91
91
|
{/* 새 문의하기 버튼 - 항상 하단에 고정 */}
|
|
92
|
-
<div className="flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
{isAuthenticated && (<div className="flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
93
|
+
<button className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white" onClick={onNewChatClick}>
|
|
94
|
+
새 문의하기
|
|
95
|
+
<SendIcon width={24} height={24}/>
|
|
96
|
+
</button>
|
|
97
|
+
</div>)}
|
|
98
98
|
</div>);
|
|
99
99
|
};
|
|
100
100
|
export default HistoryView;
|
|
@@ -136,15 +136,17 @@ const HistoryView: React.FC<HistoryViewProps> = ({
|
|
|
136
136
|
)}
|
|
137
137
|
|
|
138
138
|
{/* 새 문의하기 버튼 - 항상 하단에 고정 */}
|
|
139
|
-
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
{isAuthenticated && (
|
|
140
|
+
<div className="flex-shrink-0 border-t border-gray-100 bg-white p-4">
|
|
141
|
+
<button
|
|
142
|
+
className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white"
|
|
143
|
+
onClick={onNewChatClick}
|
|
144
|
+
>
|
|
145
|
+
새 문의하기
|
|
146
|
+
<SendIcon width={24} height={24} />
|
|
147
|
+
</button>
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
148
150
|
</div>
|
|
149
151
|
);
|
|
150
152
|
};
|
|
@@ -2,6 +2,9 @@ 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
4
|
const NavigationFooter = ({ activeView, onHomeClick, onHistoryClick }) => {
|
|
5
|
+
if (activeView === 'conversation') {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
5
8
|
return (<footer>
|
|
6
9
|
<div className="h-px w-full bg-gray-200" role="separator"></div>
|
|
7
10
|
<nav className="flex justify-around px-8 py-3">
|
|
@@ -3,12 +3,15 @@ import Home from '../../asset/images/daeryuntalk/home.svg';
|
|
|
3
3
|
import History from '../../asset/images/daeryuntalk/history.svg';
|
|
4
4
|
|
|
5
5
|
type NavigationFooterProps = {
|
|
6
|
-
activeView: 'home' | 'history';
|
|
6
|
+
activeView: 'home' | 'history' | 'conversation';
|
|
7
7
|
onHomeClick: () => void;
|
|
8
8
|
onHistoryClick: () => void;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const NavigationFooter: React.FC<NavigationFooterProps> = ({ activeView, onHomeClick, onHistoryClick }) => {
|
|
12
|
+
if (activeView === 'conversation') {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
12
15
|
return (
|
|
13
16
|
<footer>
|
|
14
17
|
<div className="h-px w-full bg-gray-200" role="separator"></div>
|
|
@@ -8,7 +8,6 @@ export default function ToastRenderer() {
|
|
|
8
8
|
if (!context)
|
|
9
9
|
return null;
|
|
10
10
|
const { toast, isVisible, hideToast } = context;
|
|
11
|
-
console.log('isVisible', isVisible);
|
|
12
11
|
return (<div className="absolute bottom-0 left-1/2 z-[50] w-[90%] -translate-x-1/2">
|
|
13
12
|
<div className={`transition-all duration-300 ${isVisible ? '-translate-y-[96px] opacity-100' : 'pointer-events-none translate-y-0 opacity-0'}`}>
|
|
14
13
|
{toast && <DaeryunTalkToast {...toast} onClose={hideToast}/>}
|
|
@@ -163,3 +163,7 @@ export declare const attendChatRoomByHistory: ({ chatInquiryNumber, version }: {
|
|
|
163
163
|
chatInquiryNumber: string;
|
|
164
164
|
version?: string;
|
|
165
165
|
}) => Promise<IDaeryunTalkResponseWrapper<HistoryListResponse>>;
|
|
166
|
+
export declare const followupAttend: ({ token, version }: {
|
|
167
|
+
token: string;
|
|
168
|
+
version?: string;
|
|
169
|
+
}) => Promise<IDaeryunTalkResponseWrapper<HistoryListResponse>>;
|
|
@@ -33,7 +33,9 @@ const ENDPOINTS = {
|
|
|
33
33
|
HISTORY_PHONE_REQUEST: '/chatctm/his/occupancycertificationnumbersend', // 점유 인증 번호 요청
|
|
34
34
|
HISTORY_PHONE_AUTHENTICATION: '/chatctm/his/occupancycertificationnumberverification', // 점유 인증 번호 검증
|
|
35
35
|
HISTORY_LIST: '/chatctm/his/historychatinquirylistsearch', // 히스토리 채팅 문의 목록 조회
|
|
36
|
-
ATTEND_CHAT_BY_HISTORY: '/chatctm/his/historychatinquiryparticipation' // 채팅문의 참여
|
|
36
|
+
ATTEND_CHAT_BY_HISTORY: '/chatctm/his/historychatinquiryparticipation', // 채팅문의 참여
|
|
37
|
+
/* 팔로업 알림 인증 */
|
|
38
|
+
FOLLOWUP_ATTENTD: '/chatctm/chi/chatinquiryalarmparticipation' // 채팅 문의 알림 참여
|
|
37
39
|
};
|
|
38
40
|
// 메인
|
|
39
41
|
const TEST_CENTER_CODE = 'CT0000';
|
|
@@ -694,3 +696,24 @@ export const attendChatRoomByHistory = (_a) => __awaiter(void 0, [_a], void 0, f
|
|
|
694
696
|
throw error;
|
|
695
697
|
}
|
|
696
698
|
});
|
|
699
|
+
export const followupAttend = (_a) => __awaiter(void 0, [_a], void 0, function* ({ token, version = DEFAULT_API_VERSION }) {
|
|
700
|
+
const consoleName = '히스토리 채팅 문의 참여';
|
|
701
|
+
try {
|
|
702
|
+
console.log(`[${consoleName} 진행]`);
|
|
703
|
+
const body = {
|
|
704
|
+
d: {
|
|
705
|
+
token: token // required
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.FOLLOWUP_ATTENTD}`, {
|
|
709
|
+
method: 'POST',
|
|
710
|
+
body: JSON.stringify(body)
|
|
711
|
+
}, version);
|
|
712
|
+
console.log(`[${consoleName} 완료]`, response);
|
|
713
|
+
return response;
|
|
714
|
+
}
|
|
715
|
+
catch (error) {
|
|
716
|
+
console.error(`[${consoleName} 실패] 오류:`, error);
|
|
717
|
+
throw error;
|
|
718
|
+
}
|
|
719
|
+
});
|