@daeryun/dr_components 0.8.47 → 0.8.48
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/asset/images/daeryuntalk/close.svg +2 -2
- package/dist/asset/images/daeryuntalk/time.svg +2 -2
- package/dist/asset/images/daeryuntalk/viewer/zoom-out.svg +2 -4
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatButton.jsx +5 -2
- package/dist/components/Daeryuntalk/ChatButton.tsx +5 -2
- package/dist/components/Daeryuntalk/ChatConversation.d.ts +2 -0
- package/dist/components/Daeryuntalk/ChatConversation.jsx +22 -63
- package/dist/components/Daeryuntalk/ChatConversation.tsx +42 -79
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.d.ts +11 -0
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.jsx +27 -0
- package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.tsx +57 -0
- package/dist/components/Daeryuntalk/ChatHomeView.d.ts +3 -2
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +59 -181
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +102 -206
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +15 -14
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +15 -14
- package/dist/components/Daeryuntalk/ChatItem/ChatLoading.d.ts +3 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatLoading.jsx +11 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatLoading.tsx +21 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.jsx +4 -4
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.tsx +4 -4
- package/dist/components/Daeryuntalk/ChatItem/RichText.jsx +2 -1
- package/dist/components/Daeryuntalk/ChatItem/RichText.tsx +2 -1
- package/dist/components/Daeryuntalk/ChatItem/TimeWrapper.d.ts +9 -0
- package/dist/components/Daeryuntalk/ChatItem/TimeWrapper.jsx +9 -0
- package/dist/components/Daeryuntalk/ChatItem/TimeWrapper.tsx +20 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.jsx +3 -3
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.tsx +3 -3
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +2 -2
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +2 -2
- package/dist/components/Daeryuntalk/ChatMessage.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatMessage.jsx +31 -36
- package/dist/components/Daeryuntalk/ChatMessage.tsx +34 -38
- package/dist/components/Daeryuntalk/ChatObject/FieldWorkObject.jsx +2 -2
- package/dist/components/Daeryuntalk/ChatObject/FieldWorkObject.tsx +2 -2
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.tsx +1 -1
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.jsx +6 -23
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.tsx +6 -23
- package/dist/components/Daeryuntalk/ChatWidget.jsx +60 -23
- package/dist/components/Daeryuntalk/ChatWidget.tsx +72 -34
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +2 -2
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +2 -2
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +5 -5
- package/dist/components/Daeryuntalk/DateSeparator.jsx +2 -2
- package/dist/components/Daeryuntalk/DateSeparator.tsx +2 -2
- package/dist/components/Daeryuntalk/FixedErrorBox.d.ts +7 -0
- package/dist/components/Daeryuntalk/FixedErrorBox.jsx +33 -0
- package/dist/components/Daeryuntalk/FixedErrorBox.tsx +73 -0
- package/dist/components/Daeryuntalk/History/AuthForm.d.ts +3 -1
- package/dist/components/Daeryuntalk/History/AuthForm.jsx +15 -45
- package/dist/components/Daeryuntalk/History/AuthForm.tsx +21 -53
- package/dist/components/Daeryuntalk/HistoryView.d.ts +4 -0
- package/dist/components/Daeryuntalk/HistoryView.jsx +17 -40
- package/dist/components/Daeryuntalk/HistoryView.tsx +36 -48
- package/dist/components/Daeryuntalk/HomeView.d.ts +12 -0
- package/dist/components/Daeryuntalk/HomeView.jsx +102 -0
- package/dist/components/Daeryuntalk/HomeView.tsx +150 -0
- package/dist/components/Daeryuntalk/NavigationFooter.jsx +17 -10
- package/dist/components/Daeryuntalk/NavigationFooter.tsx +22 -12
- package/dist/components/Daeryuntalk/NoticeMessage.jsx +7 -7
- package/dist/components/Daeryuntalk/NoticeMessage.tsx +7 -7
- package/dist/components/Daeryuntalk/Toast/ToastRender.jsx +1 -1
- package/dist/components/Daeryuntalk/Toast/ToastRender.tsx +2 -2
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.d.ts +6 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.jsx +18 -90
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.tsx +49 -135
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.d.ts +16 -0
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.jsx +66 -0
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.tsx +121 -0
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.d.ts +22 -0
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.jsx +104 -0
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.tsx +195 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +4 -3
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +81 -105
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +105 -121
- package/dist/components/Daeryuntalk/_enums/ask-status.d.ts +7 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.js +14 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.ts +14 -0
- package/dist/components/Daeryuntalk/_enums/error.d.ts +3 -0
- package/dist/components/Daeryuntalk/_enums/error.js +125 -0
- package/dist/components/Daeryuntalk/_enums/error.ts +143 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.d.ts +8 -8
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +227 -179
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +261 -185
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.d.ts +1 -1
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.js +54 -18
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.ts +68 -15
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +2 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +8 -7
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +13 -6
- package/dist/components/Daeryuntalk/_hooks/view/useChatSocketState.d.ts +2 -0
- package/dist/components/Daeryuntalk/_hooks/{talkprovider → view}/useChatSocketState.js +7 -1
- package/dist/components/Daeryuntalk/_hooks/{talkprovider → view}/useChatSocketState.ts +13 -1
- package/dist/components/Daeryuntalk/_hooks/view/useHistoryView.d.ts +26 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHistoryView.js +72 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHistoryView.ts +93 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHomeView.d.ts +16 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHomeView.js +61 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHomeView.ts +64 -0
- package/dist/components/Daeryuntalk/_lib/utils.d.ts +1 -0
- package/dist/components/Daeryuntalk/_lib/utils.js +27 -0
- package/dist/components/Daeryuntalk/_lib/utils.ts +33 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button2.jsx +3 -3
- package/dist/components/Daeryuntalk/_ui/buttons/Button2.tsx +3 -3
- package/dist/components/Daeryuntalk/_ui/buttons/Button3.d.ts +10 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button3.jsx +12 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button3.tsx +29 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input2.jsx +2 -1
- package/dist/components/Daeryuntalk/_ui/inputs/Input2.tsx +2 -1
- package/dist/components/Daeryuntalk/index.jsx +1 -1
- package/dist/components/Daeryuntalk/index.tsx +12 -1
- package/dist/styles/globals.css +510 -168
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/components/Daeryuntalk/_enums/error_code.d.ts +0 -21
- package/dist/components/Daeryuntalk/_enums/error_code.js +0 -23
- package/dist/components/Daeryuntalk/_enums/error_code.ts +0 -22
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.d.ts +0 -1
|
@@ -9,19 +9,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { useCallback } from 'react';
|
|
11
11
|
import { DEFAULT_API_VERSION, getHistoryList, historyPhoneAuth, requestPhone } from '../../_api';
|
|
12
|
+
import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
|
|
13
|
+
import { getErrorMessageMap } from '../../_enums/error';
|
|
12
14
|
export const useHistoryHandler = ({ setLoading, setIsAuthenticated, setHistoryList }) => {
|
|
15
|
+
const toast = useDaeryunTalkToast();
|
|
13
16
|
const goRequestPhone = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ name, cellPhoneNumber, version = DEFAULT_API_VERSION }) {
|
|
14
17
|
const consoleName = '점유 인증 번호 요청';
|
|
15
18
|
setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
|
|
16
|
-
if (!name)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
if (!name) {
|
|
20
|
+
toast.error('이름이 없습니다.');
|
|
21
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (!cellPhoneNumber) {
|
|
25
|
+
toast.error('번호가 없습니다.');
|
|
26
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
20
29
|
try {
|
|
21
|
-
|
|
30
|
+
const response = yield requestPhone({ name, cellPhoneNumber, version });
|
|
31
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
32
|
+
toast.error(getErrorMessageMap(response));
|
|
33
|
+
}
|
|
34
|
+
return response;
|
|
22
35
|
}
|
|
23
36
|
catch (error) {
|
|
24
37
|
console.error(`[${consoleName} 실패]:`, error);
|
|
38
|
+
toast.error((error === null || error === void 0 ? void 0 : error.message) || '오류가 발생했습니다.');
|
|
25
39
|
}
|
|
26
40
|
finally {
|
|
27
41
|
setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
|
|
@@ -30,17 +44,37 @@ export const useHistoryHandler = ({ setLoading, setIsAuthenticated, setHistoryLi
|
|
|
30
44
|
const goHistoryPhoneAuth = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ name, cellPhoneNumber, certificationNumber, version = DEFAULT_API_VERSION }) {
|
|
31
45
|
const consoleName = '점유 인증 번호 검증';
|
|
32
46
|
setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
|
|
33
|
-
if (!name)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
if (!name) {
|
|
48
|
+
toast.error('이름이 없습니다.');
|
|
49
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!cellPhoneNumber) {
|
|
53
|
+
toast.error('번호가 없습니다.');
|
|
54
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!certificationNumber) {
|
|
58
|
+
toast.error('인증번호가 없습니다.');
|
|
59
|
+
setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
39
62
|
try {
|
|
40
|
-
|
|
63
|
+
const response = yield historyPhoneAuth({
|
|
64
|
+
name,
|
|
65
|
+
cellPhoneNumber,
|
|
66
|
+
certificationNumber,
|
|
67
|
+
version
|
|
68
|
+
});
|
|
69
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
70
|
+
toast.error(getErrorMessageMap(response));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
return response;
|
|
41
74
|
}
|
|
42
75
|
catch (error) {
|
|
43
76
|
console.error(`[${consoleName} 실패]:`, error);
|
|
77
|
+
toast.error((error === null || error === void 0 ? void 0 : error.message) || '오류가 발생했습니다.');
|
|
44
78
|
}
|
|
45
79
|
finally {
|
|
46
80
|
setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
|
|
@@ -51,17 +85,19 @@ export const useHistoryHandler = ({ setLoading, setIsAuthenticated, setHistoryLi
|
|
|
51
85
|
const consoleName = '인증 이력 조회';
|
|
52
86
|
setLoading === null || setLoading === void 0 ? void 0 : setLoading(true);
|
|
53
87
|
try {
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
88
|
+
const response = yield getHistoryList({ version });
|
|
89
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
90
|
+
toast.error(getErrorMessageMap(response));
|
|
56
91
|
setIsAuthenticated === null || setIsAuthenticated === void 0 ? void 0 : setIsAuthenticated(false);
|
|
92
|
+
return;
|
|
57
93
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
94
|
+
setHistoryList === null || setHistoryList === void 0 ? void 0 : setHistoryList((_b = response.data.chat_inquiry_list) !== null && _b !== void 0 ? _b : []);
|
|
95
|
+
setIsAuthenticated === null || setIsAuthenticated === void 0 ? void 0 : setIsAuthenticated(true);
|
|
96
|
+
return response;
|
|
62
97
|
}
|
|
63
98
|
catch (error) {
|
|
64
99
|
console.error(`[${consoleName} 실패]:`, error);
|
|
100
|
+
toast.error((error === null || error === void 0 ? void 0 : error.message) || '오류가 발생했습니다.');
|
|
65
101
|
}
|
|
66
102
|
finally {
|
|
67
103
|
setLoading === null || setLoading === void 0 ? void 0 : setLoading(false);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction, useCallback } from 'react';
|
|
2
2
|
import { DEFAULT_API_VERSION, getHistoryList, historyPhoneAuth, requestPhone } from '../../_api';
|
|
3
3
|
import { History } from '../../_api/daeryuntalk/type/response';
|
|
4
|
+
import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
|
|
5
|
+
import { getErrorMessageMap } from '../../_enums/error';
|
|
4
6
|
|
|
5
7
|
interface props {
|
|
6
8
|
setLoading?: (loading: boolean) => void;
|
|
@@ -9,6 +11,8 @@ interface props {
|
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export const useHistoryHandler = ({ setLoading, setIsAuthenticated, setHistoryList }: props) => {
|
|
14
|
+
const toast = useDaeryunTalkToast();
|
|
15
|
+
|
|
12
16
|
const goRequestPhone = useCallback(
|
|
13
17
|
async ({
|
|
14
18
|
name,
|
|
@@ -21,13 +25,28 @@ export const useHistoryHandler = ({ setLoading, setIsAuthenticated, setHistoryLi
|
|
|
21
25
|
}) => {
|
|
22
26
|
const consoleName = '점유 인증 번호 요청';
|
|
23
27
|
setLoading?.(true);
|
|
24
|
-
|
|
25
|
-
if (!
|
|
28
|
+
|
|
29
|
+
if (!name) {
|
|
30
|
+
toast.error('이름이 없습니다.');
|
|
31
|
+
setLoading?.(false);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!cellPhoneNumber) {
|
|
36
|
+
toast.error('번호가 없습니다.');
|
|
37
|
+
setLoading?.(false);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
26
40
|
|
|
27
41
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
42
|
+
const response = await requestPhone({ name, cellPhoneNumber, version });
|
|
43
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
44
|
+
toast.error(getErrorMessageMap(response));
|
|
45
|
+
}
|
|
46
|
+
return response;
|
|
47
|
+
} catch (error: any) {
|
|
30
48
|
console.error(`[${consoleName} 실패]:`, error);
|
|
49
|
+
toast.error(error?.message || '오류가 발생했습니다.');
|
|
31
50
|
} finally {
|
|
32
51
|
setLoading?.(false);
|
|
33
52
|
}
|
|
@@ -49,14 +68,42 @@ export const useHistoryHandler = ({ setLoading, setIsAuthenticated, setHistoryLi
|
|
|
49
68
|
}) => {
|
|
50
69
|
const consoleName = '점유 인증 번호 검증';
|
|
51
70
|
setLoading?.(true);
|
|
52
|
-
|
|
53
|
-
if (!
|
|
54
|
-
|
|
71
|
+
|
|
72
|
+
if (!name) {
|
|
73
|
+
toast.error('이름이 없습니다.');
|
|
74
|
+
setLoading?.(false);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!cellPhoneNumber) {
|
|
79
|
+
toast.error('번호가 없습니다.');
|
|
80
|
+
setLoading?.(false);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!certificationNumber) {
|
|
85
|
+
toast.error('인증번호가 없습니다.');
|
|
86
|
+
setLoading?.(false);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
55
89
|
|
|
56
90
|
try {
|
|
57
|
-
|
|
58
|
-
|
|
91
|
+
const response = await historyPhoneAuth({
|
|
92
|
+
name,
|
|
93
|
+
cellPhoneNumber,
|
|
94
|
+
certificationNumber,
|
|
95
|
+
version
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
99
|
+
toast.error(getErrorMessageMap(response));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return response;
|
|
104
|
+
} catch (error: any) {
|
|
59
105
|
console.error(`[${consoleName} 실패]:`, error);
|
|
106
|
+
toast.error(error?.message || '오류가 발생했습니다.');
|
|
60
107
|
} finally {
|
|
61
108
|
setLoading?.(false);
|
|
62
109
|
}
|
|
@@ -67,16 +114,22 @@ export const useHistoryHandler = ({ setLoading, setIsAuthenticated, setHistoryLi
|
|
|
67
114
|
const goGetHistoryList = useCallback(async ({ version = DEFAULT_API_VERSION }: { version?: string }) => {
|
|
68
115
|
const consoleName = '인증 이력 조회';
|
|
69
116
|
setLoading?.(true);
|
|
117
|
+
|
|
70
118
|
try {
|
|
71
|
-
const
|
|
72
|
-
|
|
119
|
+
const response = await getHistoryList({ version });
|
|
120
|
+
|
|
121
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
122
|
+
toast.error(getErrorMessageMap(response));
|
|
73
123
|
setIsAuthenticated?.(false);
|
|
74
|
-
|
|
75
|
-
setHistoryList?.(res.data.chat_inquiry_list ?? []);
|
|
76
|
-
setIsAuthenticated?.(true);
|
|
124
|
+
return;
|
|
77
125
|
}
|
|
78
|
-
|
|
126
|
+
|
|
127
|
+
setHistoryList?.(response.data.chat_inquiry_list ?? []);
|
|
128
|
+
setIsAuthenticated?.(true);
|
|
129
|
+
return response;
|
|
130
|
+
} catch (error: any) {
|
|
79
131
|
console.error(`[${consoleName} 실패]:`, error);
|
|
132
|
+
toast.error(error?.message || '오류가 발생했습니다.');
|
|
80
133
|
} finally {
|
|
81
134
|
setLoading?.(false);
|
|
82
135
|
}
|
|
@@ -3,7 +3,7 @@ import { Message } from '../../_types/message';
|
|
|
3
3
|
import { History, IChatInquiryMainDataResponse } from '../../_api/daeryuntalk/type/response';
|
|
4
4
|
import { MessageObject } from '../../_types/message_object';
|
|
5
5
|
interface props {
|
|
6
|
-
setIsConnected: Dispatch<SetStateAction<boolean>>;
|
|
6
|
+
setIsConnected: Dispatch<SetStateAction<boolean | null>>;
|
|
7
7
|
setIsLoading: Dispatch<SetStateAction<boolean>>;
|
|
8
8
|
setMessages: Dispatch<SetStateAction<Message[]>>;
|
|
9
9
|
setWorkFlowStack: Dispatch<SetStateAction<string[]>>;
|
|
@@ -16,7 +16,7 @@ interface props {
|
|
|
16
16
|
inquiryMainData: IChatInquiryMainDataResponse | null;
|
|
17
17
|
}
|
|
18
18
|
export declare const useSocketEventHandler: ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData }: props) => {
|
|
19
|
-
initializeDaeryuntalk: (hashValue: string | null, version?: string) => Promise<
|
|
19
|
+
initializeDaeryuntalk: (hashValue: string | null, isOpen: boolean, version?: string) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<IChatInquiryMainDataResponse> | undefined>;
|
|
20
20
|
sendHeartbeat: () => void;
|
|
21
21
|
sendInquiryJoined: (chatInquiryNumber: string) => void;
|
|
22
22
|
sendInquiryLeft: (chatInquiryNumber: string) => void;
|
|
@@ -13,6 +13,7 @@ import { convertApiMessageToUiMessage, convertSocketObjectToUiMessage } from '..
|
|
|
13
13
|
import { MessageSocketType } from '../../_enums/socket_type';
|
|
14
14
|
import { InquiryStatus } from '../../_enums/ask-status';
|
|
15
15
|
import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
|
|
16
|
+
import { getErrorMessageMap } from '../../_enums/error';
|
|
16
17
|
export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData }) => {
|
|
17
18
|
const toast = useDaeryunTalkToast();
|
|
18
19
|
/**
|
|
@@ -128,13 +129,13 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
|
|
|
128
129
|
}
|
|
129
130
|
}, []);
|
|
130
131
|
// Daeryuntalk API 초기화 메소드
|
|
131
|
-
const initializeDaeryuntalk = useCallback((hashValue, version) => __awaiter(void 0, void 0, void 0, function* () {
|
|
132
|
-
var _a, _b;
|
|
132
|
+
const initializeDaeryuntalk = useCallback((hashValue, isOpen, version) => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
+
var _a, _b, _c, _d;
|
|
133
134
|
console.log('[DaeryuntalkContext] 초기화 메소드 호출됨', version ? `버전: ${version}` : '기본 버전 사용');
|
|
134
135
|
try {
|
|
135
136
|
setIsLoading(true);
|
|
136
137
|
console.log('[DaeryuntalkContext] 로딩 상태 설정: true');
|
|
137
|
-
const { inquiryData, socket, hashAuth } = yield apiInitializeDaeryuntalk(hashValue || '', socket => {
|
|
138
|
+
const { inquiryData, socket, hashAuth } = yield apiInitializeDaeryuntalk(hashValue || '', isOpen, setIsConnected, socket => {
|
|
138
139
|
console.log('[DaeryuntalkContext] 웹소켓 연결 콜백 - 연결 성공');
|
|
139
140
|
setIsConnected(true);
|
|
140
141
|
}, event => {
|
|
@@ -215,7 +216,6 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
|
|
|
215
216
|
console.error('[DaeryuntalkContext] 웹소켓 메시지 처리 오류:', error);
|
|
216
217
|
}
|
|
217
218
|
});
|
|
218
|
-
console.log('hashValue', hashValue);
|
|
219
219
|
if (hashValue) {
|
|
220
220
|
if (((_a = hashAuth === null || hashAuth === void 0 ? void 0 : hashAuth.result_info) === null || _a === void 0 ? void 0 : _a.result_cd) === 'OK' || ((_b = hashAuth === null || hashAuth === void 0 ? void 0 : hashAuth.result_info) === null || _b === void 0 ? void 0 : _b.result_type_cd) === 'OK') {
|
|
221
221
|
console.log('해쉬 인증 완료');
|
|
@@ -225,9 +225,11 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
|
|
|
225
225
|
window.location.hash = '/';
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
if (inquiryData) {
|
|
229
|
-
|
|
228
|
+
if (!(((_c = inquiryData === null || inquiryData === void 0 ? void 0 : inquiryData.result_info) === null || _c === void 0 ? void 0 : _c.result_cd) === 'OK' || ((_d = inquiryData === null || inquiryData === void 0 ? void 0 : inquiryData.result_info) === null || _d === void 0 ? void 0 : _d.result_type_cd) === 'OK')) {
|
|
229
|
+
toast.error(getErrorMessageMap(inquiryData));
|
|
230
|
+
return inquiryData;
|
|
230
231
|
}
|
|
232
|
+
setInquiryMainData(inquiryData.data);
|
|
231
233
|
if (socket) {
|
|
232
234
|
socketRef.current = socket;
|
|
233
235
|
}
|
|
@@ -243,7 +245,6 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
|
|
|
243
245
|
// C2121045680881362573
|
|
244
246
|
const retryInquiryMain = useCallback((channelNumber) => __awaiter(void 0, void 0, void 0, function* () {
|
|
245
247
|
const result = yield getChatInquiryMain(channelNumber || '');
|
|
246
|
-
console.log('리트ㅏ링 데이터', result.data);
|
|
247
248
|
setInquiryMainData(result.data);
|
|
248
249
|
return result;
|
|
249
250
|
}), [inquiryMainData]);
|
|
@@ -13,9 +13,10 @@ import { IInquiryWorkFlowUpdate } from '../../_types/socket/workflow';
|
|
|
13
13
|
import { MessageSocketType } from '../../_enums/socket_type';
|
|
14
14
|
import { InquiryStatus } from '../../_enums/ask-status';
|
|
15
15
|
import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
|
|
16
|
+
import { getErrorMessageMap } from '../../_enums/error';
|
|
16
17
|
|
|
17
18
|
interface props {
|
|
18
|
-
setIsConnected: Dispatch<SetStateAction<boolean>>;
|
|
19
|
+
setIsConnected: Dispatch<SetStateAction<boolean | null>>;
|
|
19
20
|
setIsLoading: Dispatch<SetStateAction<boolean>>;
|
|
20
21
|
setMessages: Dispatch<SetStateAction<Message[]>>;
|
|
21
22
|
setWorkFlowStack: Dispatch<SetStateAction<string[]>>;
|
|
@@ -173,7 +174,7 @@ export const useSocketEventHandler = ({
|
|
|
173
174
|
|
|
174
175
|
// Daeryuntalk API 초기화 메소드
|
|
175
176
|
const initializeDaeryuntalk = useCallback(
|
|
176
|
-
async (hashValue: string | null, version?: string) => {
|
|
177
|
+
async (hashValue: string | null, isOpen: boolean, version?: string) => {
|
|
177
178
|
console.log('[DaeryuntalkContext] 초기화 메소드 호출됨', version ? `버전: ${version}` : '기본 버전 사용');
|
|
178
179
|
try {
|
|
179
180
|
setIsLoading(true);
|
|
@@ -181,6 +182,8 @@ export const useSocketEventHandler = ({
|
|
|
181
182
|
|
|
182
183
|
const { inquiryData, socket, hashAuth } = await apiInitializeDaeryuntalk(
|
|
183
184
|
hashValue || '',
|
|
185
|
+
isOpen,
|
|
186
|
+
setIsConnected,
|
|
184
187
|
socket => {
|
|
185
188
|
console.log('[DaeryuntalkContext] 웹소켓 연결 콜백 - 연결 성공');
|
|
186
189
|
setIsConnected(true);
|
|
@@ -285,7 +288,7 @@ export const useSocketEventHandler = ({
|
|
|
285
288
|
}
|
|
286
289
|
}
|
|
287
290
|
);
|
|
288
|
-
|
|
291
|
+
|
|
289
292
|
if (hashValue) {
|
|
290
293
|
if (hashAuth?.result_info?.result_cd === 'OK' || hashAuth?.result_info?.result_type_cd === 'OK') {
|
|
291
294
|
console.log('해쉬 인증 완료');
|
|
@@ -295,9 +298,14 @@ export const useSocketEventHandler = ({
|
|
|
295
298
|
}
|
|
296
299
|
}
|
|
297
300
|
|
|
298
|
-
if (
|
|
299
|
-
|
|
301
|
+
if (
|
|
302
|
+
!(inquiryData?.result_info?.result_cd === 'OK' || inquiryData?.result_info?.result_type_cd === 'OK')
|
|
303
|
+
) {
|
|
304
|
+
toast.error(getErrorMessageMap(inquiryData));
|
|
305
|
+
return inquiryData;
|
|
300
306
|
}
|
|
307
|
+
|
|
308
|
+
setInquiryMainData(inquiryData.data as IChatInquiryMainDataResponse);
|
|
301
309
|
if (socket) {
|
|
302
310
|
socketRef.current = socket;
|
|
303
311
|
}
|
|
@@ -315,7 +323,6 @@ export const useSocketEventHandler = ({
|
|
|
315
323
|
const retryInquiryMain = useCallback(
|
|
316
324
|
async (channelNumber: string) => {
|
|
317
325
|
const result = await getChatInquiryMain(channelNumber || '');
|
|
318
|
-
console.log('리트ㅏ링 데이터', result.data);
|
|
319
326
|
setInquiryMainData(result.data as IChatInquiryMainDataResponse);
|
|
320
327
|
return result;
|
|
321
328
|
},
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { History } from '../../_api/daeryuntalk/type/response';
|
|
2
|
+
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, isConnected: boolean | null, isAuthenticated: boolean, sendHistoryEntered: (historyList: string[]) => void, historyList: History[]) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
export const useChatSocketState = (chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryJoined, sendHeartbeat, sendInquiryLeft) => {
|
|
2
|
+
export const useChatSocketState = (chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryJoined, sendHeartbeat, sendInquiryLeft, isConnected, isAuthenticated, sendHistoryEntered, historyList) => {
|
|
3
3
|
// 1. 공통 하트비트 (항상 실행)
|
|
4
4
|
useEffect(() => {
|
|
5
5
|
sendHeartbeat();
|
|
@@ -24,4 +24,10 @@ export const useChatSocketState = (chatInquiryNumber, viewState, sendInquiryWatc
|
|
|
24
24
|
sendInquiryLeft(chatInquiryNumber);
|
|
25
25
|
}
|
|
26
26
|
}, [chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryLeft]);
|
|
27
|
+
// 소켓
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (isConnected && isAuthenticated && viewState === 'history') {
|
|
30
|
+
sendHistoryEntered(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
|
|
31
|
+
}
|
|
32
|
+
}, [isConnected, isAuthenticated, historyList, viewState]);
|
|
27
33
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
+
import { History } from '../../_api/daeryuntalk/type/response';
|
|
2
3
|
|
|
3
4
|
export const useChatSocketState = (
|
|
4
5
|
chatInquiryNumber: string | null,
|
|
@@ -6,7 +7,11 @@ export const useChatSocketState = (
|
|
|
6
7
|
sendInquiryWatching: (chatInquiryNumber: string) => void,
|
|
7
8
|
sendInquiryJoined: (chatInquiryNumber: string) => void,
|
|
8
9
|
sendHeartbeat: () => void,
|
|
9
|
-
sendInquiryLeft: (chatInquiryNumber: string) => void
|
|
10
|
+
sendInquiryLeft: (chatInquiryNumber: string) => void,
|
|
11
|
+
isConnected: boolean | null,
|
|
12
|
+
isAuthenticated: boolean,
|
|
13
|
+
sendHistoryEntered: (historyList: string[]) => void,
|
|
14
|
+
historyList: History[]
|
|
10
15
|
) => {
|
|
11
16
|
// 1. 공통 하트비트 (항상 실행)
|
|
12
17
|
useEffect(() => {
|
|
@@ -35,4 +40,11 @@ export const useChatSocketState = (
|
|
|
35
40
|
sendInquiryLeft(chatInquiryNumber);
|
|
36
41
|
}
|
|
37
42
|
}, [chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryLeft]);
|
|
43
|
+
|
|
44
|
+
// 소켓
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (isConnected && isAuthenticated && viewState === 'history') {
|
|
47
|
+
sendHistoryEntered(historyList ? historyList.map(item => item.chat_inquiry_number) : []);
|
|
48
|
+
}
|
|
49
|
+
}, [isConnected, isAuthenticated, historyList, viewState]);
|
|
38
50
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { ViewState } from '../../ChatHomeView';
|
|
3
|
+
interface IHistoryProps {
|
|
4
|
+
setIsLoading: Dispatch<SetStateAction<boolean>>;
|
|
5
|
+
setViewState: Dispatch<SetStateAction<ViewState>>;
|
|
6
|
+
attendRoomByHistory: (chatNumber: string) => any;
|
|
7
|
+
startSelectedChat: (chatNumber: string) => any;
|
|
8
|
+
createNewChat: () => any;
|
|
9
|
+
goRequestPhone: ({ name, cellPhoneNumber }: {
|
|
10
|
+
name: string;
|
|
11
|
+
cellPhoneNumber: string;
|
|
12
|
+
}) => any;
|
|
13
|
+
goHistoryPhoneAuth: ({ name, cellPhoneNumber, certificationNumber }: {
|
|
14
|
+
name: string;
|
|
15
|
+
cellPhoneNumber: string;
|
|
16
|
+
certificationNumber: string;
|
|
17
|
+
}) => any;
|
|
18
|
+
}
|
|
19
|
+
export declare const useHistoryView: ({ attendRoomByHistory, startSelectedChat, setViewState, setIsLoading, createNewChat, goRequestPhone, goHistoryPhoneAuth }: IHistoryProps) => {
|
|
20
|
+
handleChatHistoryClick: (chatNumber: string) => Promise<void>;
|
|
21
|
+
handleNewStartChat: () => Promise<void>;
|
|
22
|
+
handleHistoryClick: () => Promise<void>;
|
|
23
|
+
handleGoRequestPhone: (name: string, cellPhoneNumber: string) => Promise<any>;
|
|
24
|
+
handleGoHistoryPhoneAuth: (name: string, cellPhoneNumber: string, certificationNumber: string) => Promise<any>;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
|
|
11
|
+
export const useHistoryView = ({ attendRoomByHistory, startSelectedChat, setViewState, setIsLoading, createNewChat, goRequestPhone, goHistoryPhoneAuth }) => {
|
|
12
|
+
const toast = useDaeryunTalkToast();
|
|
13
|
+
const handleChatHistoryClick = (chatNumber) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
try {
|
|
16
|
+
setIsLoading(true);
|
|
17
|
+
const response = yield attendRoomByHistory(chatNumber);
|
|
18
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.result_info) === null || _a === void 0 ? void 0 : _a.result_cd) === 'OK' || ((_b = response === null || response === void 0 ? void 0 : response.result_info) === null || _b === void 0 ? void 0 : _b.result_type_cd) === 'OK') {
|
|
19
|
+
yield startSelectedChat(chatNumber);
|
|
20
|
+
setViewState('conversation');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
console.error('e', e);
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
setIsLoading(false);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
// 히스토리 + conversatoion 에서 사용
|
|
31
|
+
const handleNewStartChat = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
try {
|
|
33
|
+
setIsLoading(true);
|
|
34
|
+
// 채팅 시작 - 새 문의 생성 또는 기존 문의 조회 처리
|
|
35
|
+
yield createNewChat();
|
|
36
|
+
// 대화 화면으로 전환
|
|
37
|
+
setViewState('conversation');
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.error('신규 채팅 실패:', error);
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
setIsLoading(false);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
// 히스토리 점유 인증번호 요청
|
|
47
|
+
const handleGoRequestPhone = (name, cellPhoneNumber) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
const res = yield goRequestPhone({
|
|
49
|
+
name,
|
|
50
|
+
cellPhoneNumber
|
|
51
|
+
});
|
|
52
|
+
return res;
|
|
53
|
+
});
|
|
54
|
+
const handleGoHistoryPhoneAuth = (name, cellPhoneNumber, certificationNumber) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
const res = yield goHistoryPhoneAuth({
|
|
56
|
+
name,
|
|
57
|
+
cellPhoneNumber,
|
|
58
|
+
certificationNumber
|
|
59
|
+
});
|
|
60
|
+
return res;
|
|
61
|
+
});
|
|
62
|
+
const handleHistoryClick = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
setViewState('history');
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
handleChatHistoryClick,
|
|
67
|
+
handleNewStartChat,
|
|
68
|
+
handleHistoryClick,
|
|
69
|
+
handleGoRequestPhone,
|
|
70
|
+
handleGoHistoryPhoneAuth
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
|
|
3
|
+
import { ViewState } from '../../ChatHomeView';
|
|
4
|
+
import { DEFAULT_API_VERSION } from '../../_api';
|
|
5
|
+
|
|
6
|
+
interface IHistoryProps {
|
|
7
|
+
setIsLoading: Dispatch<SetStateAction<boolean>>;
|
|
8
|
+
setViewState: Dispatch<SetStateAction<ViewState>>;
|
|
9
|
+
attendRoomByHistory: (chatNumber: string) => any;
|
|
10
|
+
startSelectedChat: (chatNumber: string) => any;
|
|
11
|
+
createNewChat: () => any;
|
|
12
|
+
goRequestPhone: ({ name, cellPhoneNumber }: { name: string; cellPhoneNumber: string }) => any;
|
|
13
|
+
goHistoryPhoneAuth: ({
|
|
14
|
+
name,
|
|
15
|
+
cellPhoneNumber,
|
|
16
|
+
certificationNumber
|
|
17
|
+
}: {
|
|
18
|
+
name: string;
|
|
19
|
+
cellPhoneNumber: string;
|
|
20
|
+
certificationNumber: string;
|
|
21
|
+
}) => any;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const useHistoryView = ({
|
|
25
|
+
attendRoomByHistory,
|
|
26
|
+
startSelectedChat,
|
|
27
|
+
setViewState,
|
|
28
|
+
setIsLoading,
|
|
29
|
+
createNewChat,
|
|
30
|
+
goRequestPhone,
|
|
31
|
+
goHistoryPhoneAuth
|
|
32
|
+
}: IHistoryProps) => {
|
|
33
|
+
const toast = useDaeryunTalkToast();
|
|
34
|
+
const handleChatHistoryClick = async (chatNumber: string) => {
|
|
35
|
+
try {
|
|
36
|
+
setIsLoading(true);
|
|
37
|
+
const response = await attendRoomByHistory(chatNumber);
|
|
38
|
+
if (response?.result_info?.result_cd === 'OK' || response?.result_info?.result_type_cd === 'OK') {
|
|
39
|
+
await startSelectedChat(chatNumber);
|
|
40
|
+
setViewState('conversation');
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
console.error('e', e);
|
|
44
|
+
} finally {
|
|
45
|
+
setIsLoading(false);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// 히스토리 + conversatoion 에서 사용
|
|
50
|
+
const handleNewStartChat = async () => {
|
|
51
|
+
try {
|
|
52
|
+
setIsLoading(true);
|
|
53
|
+
// 채팅 시작 - 새 문의 생성 또는 기존 문의 조회 처리
|
|
54
|
+
await createNewChat();
|
|
55
|
+
// 대화 화면으로 전환
|
|
56
|
+
setViewState('conversation');
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error('신규 채팅 실패:', error);
|
|
59
|
+
} finally {
|
|
60
|
+
setIsLoading(false);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// 히스토리 점유 인증번호 요청
|
|
65
|
+
const handleGoRequestPhone = async (name: string, cellPhoneNumber: string) => {
|
|
66
|
+
const res = await goRequestPhone({
|
|
67
|
+
name,
|
|
68
|
+
cellPhoneNumber
|
|
69
|
+
});
|
|
70
|
+
return res;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const handleGoHistoryPhoneAuth = async (name: string, cellPhoneNumber: string, certificationNumber: string) => {
|
|
74
|
+
const res = await goHistoryPhoneAuth({
|
|
75
|
+
name,
|
|
76
|
+
cellPhoneNumber,
|
|
77
|
+
certificationNumber
|
|
78
|
+
});
|
|
79
|
+
return res;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const handleHistoryClick = async () => {
|
|
83
|
+
setViewState('history');
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
handleChatHistoryClick,
|
|
88
|
+
handleNewStartChat,
|
|
89
|
+
handleHistoryClick,
|
|
90
|
+
handleGoRequestPhone,
|
|
91
|
+
handleGoHistoryPhoneAuth
|
|
92
|
+
};
|
|
93
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { ViewState } from '../../ChatHomeView';
|
|
3
|
+
import { IChatInquiryMainDataResponse } from '../../_api/daeryuntalk/type/response';
|
|
4
|
+
interface IHomeProps {
|
|
5
|
+
setIsLoading: Dispatch<SetStateAction<boolean>>;
|
|
6
|
+
setViewState: Dispatch<SetStateAction<ViewState>>;
|
|
7
|
+
retryInquiryMain: (channelNumber: string) => any;
|
|
8
|
+
inquiryMainData: IChatInquiryMainDataResponse | null;
|
|
9
|
+
startChat: (progressInquiryNumber?: string) => any;
|
|
10
|
+
}
|
|
11
|
+
export declare const useHomeView: ({ setIsLoading, setViewState, retryInquiryMain, inquiryMainData, startChat }: IHomeProps) => {
|
|
12
|
+
handleStartChat: () => Promise<void>;
|
|
13
|
+
handleHashStartChat: () => Promise<void>;
|
|
14
|
+
handleBackToHome: () => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|