@daeryun/dr_components 1.2.18 → 1.2.20
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/ChatButton.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatButton.tsx +1 -1
- package/dist/components/Daeryuntalk/ChatWidget.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatWidget.jsx +114 -31
- package/dist/components/Daeryuntalk/ChatWidget.tsx +120 -37
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.tsx +0 -9
- package/dist/components/Daeryuntalk/index.jsx +17 -1
- package/dist/components/Daeryuntalk/index.tsx +26 -2
- package/dist/components/DaeryuntalkBackup/ChatButton.d.ts +11 -0
- package/dist/components/DaeryuntalkBackup/ChatButton.jsx +123 -0
- package/dist/components/DaeryuntalkBackup/ChatButton.tsx +157 -0
- package/dist/components/DaeryuntalkBackup/ChatConversation.d.ts +21 -0
- package/dist/components/DaeryuntalkBackup/ChatConversation.jsx +259 -0
- package/dist/components/DaeryuntalkBackup/ChatConversation.tsx +390 -0
- package/dist/components/DaeryuntalkBackup/ChatConversationItem/ChatConversationHeader.d.ts +16 -0
- package/dist/components/DaeryuntalkBackup/ChatConversationItem/ChatConversationHeader.jsx +50 -0
- package/dist/components/DaeryuntalkBackup/ChatConversationItem/ChatConversationHeader.tsx +108 -0
- package/dist/components/DaeryuntalkBackup/ChatHomeView.d.ts +14 -0
- package/dist/components/DaeryuntalkBackup/ChatHomeView.jsx +147 -0
- package/dist/components/DaeryuntalkBackup/ChatHomeView.tsx +262 -0
- package/dist/components/DaeryuntalkBackup/ChatInput.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/ChatInput.jsx +64 -0
- package/dist/components/DaeryuntalkBackup/ChatInput.tsx +98 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/AgeCheckBox.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/AgeCheckBox.jsx +19 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/AgeCheckBox.tsx +27 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatFile.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatFile.jsx +165 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatFile.tsx +244 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatLoading.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatLoading.jsx +12 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatLoading.tsx +25 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatPrivacyAuth.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatPrivacyAuth.jsx +100 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatPrivacyAuth.tsx +135 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatWrapper.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatWrapper.jsx +14 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/ChatWrapper.tsx +26 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/RichText.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/RichText.jsx +37 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/RichText.tsx +45 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TimeWrapper.d.ts +9 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TimeWrapper.jsx +10 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TimeWrapper.tsx +21 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TypingComp.d.ts +3 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TypingComp.jsx +34 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/TypingComp.tsx +43 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowAuthForm.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowAuthForm.jsx +20 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowAuthForm.tsx +32 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowClickData.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowClickData.jsx +21 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowClickData.tsx +37 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowImg.d.ts +9 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowImg.jsx +178 -0
- package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowImg.tsx +233 -0
- package/dist/components/DaeryuntalkBackup/ChatMessage.d.ts +20 -0
- package/dist/components/DaeryuntalkBackup/ChatMessage.jsx +198 -0
- package/dist/components/DaeryuntalkBackup/ChatMessage.tsx +295 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/FieldWorkObject.d.ts +9 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/FieldWorkObject.jsx +39 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/FieldWorkObject.tsx +75 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectBack.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectBack.jsx +20 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectBack.tsx +39 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectButton.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectButton.jsx +138 -0
- package/dist/components/DaeryuntalkBackup/ChatObject/ObjectButton.tsx +177 -0
- package/dist/components/DaeryuntalkBackup/ChatWidget.d.ts +13 -0
- package/dist/components/DaeryuntalkBackup/ChatWidget.jsx +154 -0
- package/dist/components/DaeryuntalkBackup/ChatWidget.tsx +221 -0
- package/dist/components/DaeryuntalkBackup/DaeryuntalkContext.d.ts +103 -0
- package/dist/components/DaeryuntalkBackup/DaeryuntalkContext.jsx +207 -0
- package/dist/components/DaeryuntalkBackup/DaeryuntalkContext.tsx +350 -0
- package/dist/components/DaeryuntalkBackup/DateSeparator.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/DateSeparator.jsx +14 -0
- package/dist/components/DaeryuntalkBackup/DateSeparator.tsx +24 -0
- package/dist/components/DaeryuntalkBackup/FixedErrorBox.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/FixedErrorBox.jsx +34 -0
- package/dist/components/DaeryuntalkBackup/FixedErrorBox.tsx +73 -0
- package/dist/components/DaeryuntalkBackup/History/AuthForm.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/History/AuthForm.jsx +157 -0
- package/dist/components/DaeryuntalkBackup/History/AuthForm.tsx +206 -0
- package/dist/components/DaeryuntalkBackup/HistoryView.d.ts +19 -0
- package/dist/components/DaeryuntalkBackup/HistoryView.jsx +94 -0
- package/dist/components/DaeryuntalkBackup/HistoryView.tsx +182 -0
- package/dist/components/DaeryuntalkBackup/HomeView.d.ts +12 -0
- package/dist/components/DaeryuntalkBackup/HomeView.jsx +178 -0
- package/dist/components/DaeryuntalkBackup/HomeView.tsx +261 -0
- package/dist/components/DaeryuntalkBackup/NavigationFooter.d.ts +11 -0
- package/dist/components/DaeryuntalkBackup/NavigationFooter.jsx +44 -0
- package/dist/components/DaeryuntalkBackup/NavigationFooter.tsx +98 -0
- package/dist/components/DaeryuntalkBackup/NoticeMessage.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/NoticeMessage.jsx +40 -0
- package/dist/components/DaeryuntalkBackup/NoticeMessage.tsx +60 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/DisabledInput.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/DisabledInput.jsx +17 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/DisabledInput.tsx +28 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/Tiptap.d.ts +20 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/Tiptap.jsx +130 -0
- package/dist/components/DaeryuntalkBackup/Tiptap/Tiptap.tsx +181 -0
- package/dist/components/DaeryuntalkBackup/Toast/DaeryuntalkToastProvider.d.ts +23 -0
- package/dist/components/DaeryuntalkBackup/Toast/DaeryuntalkToastProvider.jsx +40 -0
- package/dist/components/DaeryuntalkBackup/Toast/DaeryuntalkToastProvider.tsx +70 -0
- package/dist/components/DaeryuntalkBackup/Toast/Toast.d.ts +11 -0
- package/dist/components/DaeryuntalkBackup/Toast/Toast.jsx +64 -0
- package/dist/components/DaeryuntalkBackup/Toast/Toast.tsx +98 -0
- package/dist/components/DaeryuntalkBackup/Toast/ToastRender.d.ts +1 -0
- package/dist/components/DaeryuntalkBackup/Toast/ToastRender.jsx +22 -0
- package/dist/components/DaeryuntalkBackup/Toast/ToastRender.tsx +30 -0
- package/dist/components/DaeryuntalkBackup/Viewer/ImageViewer.d.ts +9 -0
- package/dist/components/DaeryuntalkBackup/Viewer/ImageViewer.jsx +98 -0
- package/dist/components/DaeryuntalkBackup/Viewer/ImageViewer.tsx +138 -0
- package/dist/components/DaeryuntalkBackup/Viewer/MobileViewer.d.ts +18 -0
- package/dist/components/DaeryuntalkBackup/Viewer/MobileViewer.jsx +104 -0
- package/dist/components/DaeryuntalkBackup/Viewer/MobileViewer.tsx +182 -0
- package/dist/components/DaeryuntalkBackup/Viewer/TbPcViewer.d.ts +24 -0
- package/dist/components/DaeryuntalkBackup/Viewer/TbPcViewer.jsx +141 -0
- package/dist/components/DaeryuntalkBackup/Viewer/TbPcViewer.tsx +278 -0
- package/dist/components/DaeryuntalkBackup/ViewportHandler.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/ViewportHandler.jsx +25 -0
- package/dist/components/DaeryuntalkBackup/ViewportHandler.tsx +32 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/index.d.ts +177 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/index.js +801 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/index.ts +1097 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/type/response.d.ts +131 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/type/response.js +1 -0
- package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/type/response.ts +159 -0
- package/dist/components/DaeryuntalkBackup/_api/index.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/_api/index.js +6 -0
- package/dist/components/DaeryuntalkBackup/_api/index.ts +7 -0
- package/dist/components/DaeryuntalkBackup/_enums/ags_check_status.d.ts +5 -0
- package/dist/components/DaeryuntalkBackup/_enums/ags_check_status.js +9 -0
- package/dist/components/DaeryuntalkBackup/_enums/ags_check_status.ts +9 -0
- package/dist/components/DaeryuntalkBackup/_enums/ask-status.d.ts +13 -0
- package/dist/components/DaeryuntalkBackup/_enums/ask-status.js +25 -0
- package/dist/components/DaeryuntalkBackup/_enums/ask-status.ts +26 -0
- package/dist/components/DaeryuntalkBackup/_enums/error.d.ts +109 -0
- package/dist/components/DaeryuntalkBackup/_enums/error.js +254 -0
- package/dist/components/DaeryuntalkBackup/_enums/error.ts +289 -0
- package/dist/components/DaeryuntalkBackup/_enums/message_type.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/_enums/message_type.js +13 -0
- package/dist/components/DaeryuntalkBackup/_enums/message_type.ts +13 -0
- package/dist/components/DaeryuntalkBackup/_enums/sender_type.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/_enums/sender_type.js +16 -0
- package/dist/components/DaeryuntalkBackup/_enums/sender_type.ts +16 -0
- package/dist/components/DaeryuntalkBackup/_enums/socket_type.d.ts +34 -0
- package/dist/components/DaeryuntalkBackup/_enums/socket_type.js +46 -0
- package/dist/components/DaeryuntalkBackup/_enums/socket_type.ts +56 -0
- package/dist/components/DaeryuntalkBackup/_enums/template.d.ts +32 -0
- package/dist/components/DaeryuntalkBackup/_enums/template.js +76 -0
- package/dist/components/DaeryuntalkBackup/_enums/template.ts +81 -0
- package/dist/components/DaeryuntalkBackup/_enums/work_flow_object_expose.d.ts +33 -0
- package/dist/components/DaeryuntalkBackup/_enums/work_flow_object_expose.js +66 -0
- package/dist/components/DaeryuntalkBackup/_enums/work_flow_object_expose.ts +71 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useChatHandler.d.ts +48 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useChatHandler.js +465 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useChatHandler.ts +595 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useFullURL.d.ts +1 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useFullURL.jsx +15 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useFullURL.tsx +17 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useHistoryHandler.d.ts +24 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useHistoryHandler.js +112 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useHistoryHandler.ts +144 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useSocketEventHandler.d.ts +44 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useSocketEventHandler.js +534 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useSocketEventHandler.ts +706 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useViewerHook.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useViewerHook.js +18 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useViewerHook.ts +23 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useWorkFlow.d.ts +9 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useWorkFlow.js +109 -0
- package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useWorkFlow.ts +121 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useHoverScrollbar.d.ts +12 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useHoverScrollbar.js +48 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useHoverScrollbar.ts +73 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useScrollShadow.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useScrollShadow.js +42 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useScrollShadow.ts +52 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useWindowSize.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useWindowSize.js +20 -0
- package/dist/components/DaeryuntalkBackup/_hooks/useWindowSize.ts +30 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useChatSocketState.d.ts +2 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useChatSocketState.js +26 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useChatSocketState.ts +43 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHistoryView.d.ts +27 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHistoryView.js +80 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHistoryView.ts +101 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHomeView.d.ts +18 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHomeView.js +66 -0
- package/dist/components/DaeryuntalkBackup/_hooks/view/useHomeView.ts +75 -0
- package/dist/components/DaeryuntalkBackup/_lib/index.d.ts +7 -0
- package/dist/components/DaeryuntalkBackup/_lib/index.js +103 -0
- package/dist/components/DaeryuntalkBackup/_lib/index.ts +136 -0
- package/dist/components/DaeryuntalkBackup/_lib/utils.d.ts +17 -0
- package/dist/components/DaeryuntalkBackup/_lib/utils.js +94 -0
- package/dist/components/DaeryuntalkBackup/_lib/utils.ts +119 -0
- package/dist/components/DaeryuntalkBackup/_types/message.d.ts +92 -0
- package/dist/components/DaeryuntalkBackup/_types/message.js +25 -0
- package/dist/components/DaeryuntalkBackup/_types/message.ts +156 -0
- package/dist/components/DaeryuntalkBackup/_types/message_object.d.ts +17 -0
- package/dist/components/DaeryuntalkBackup/_types/message_object.js +1 -0
- package/dist/components/DaeryuntalkBackup/_types/message_object.ts +18 -0
- package/dist/components/DaeryuntalkBackup/_types/socket/workflow.d.ts +15 -0
- package/dist/components/DaeryuntalkBackup/_types/socket/workflow.js +1 -0
- package/dist/components/DaeryuntalkBackup/_types/socket/workflow.ts +15 -0
- package/dist/components/DaeryuntalkBackup/_ui/ShadowBox.d.ts +6 -0
- package/dist/components/DaeryuntalkBackup/_ui/ShadowBox.jsx +5 -0
- package/dist/components/DaeryuntalkBackup/_ui/ShadowBox.tsx +15 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button1.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button1.jsx +12 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button1.tsx +29 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button2.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button2.jsx +12 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button2.tsx +29 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button3.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button3.jsx +12 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button3.tsx +29 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button4.d.ts +10 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button4.jsx +12 -0
- package/dist/components/DaeryuntalkBackup/_ui/buttons/Button4.tsx +29 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox1.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox1.jsx +15 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox1.tsx +38 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox2.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox2.jsx +21 -0
- package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox2.tsx +50 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input1.d.ts +12 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input1.jsx +9 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input1.tsx +39 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input2.d.ts +13 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input2.jsx +10 -0
- package/dist/components/DaeryuntalkBackup/_ui/inputs/Input2.tsx +43 -0
- package/dist/components/DaeryuntalkBackup/index.d.ts +8 -0
- package/dist/components/DaeryuntalkBackup/index.jsx +190 -0
- package/dist/components/DaeryuntalkBackup/index.tsx +261 -0
- package/dist/components/common/integrate/index.d.ts +1 -1
- package/dist/styles/globals.css +415 -414
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,465 @@
|
|
|
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 { useCallback } from 'react';
|
|
11
|
+
import { attendChatRoomByHistory, chatUserUpdate as apiChatUserUpdate, chatWorkFlow, chatWorkFlowBack, generateChatInquiry, getChatInquiryDetailNew, getChatInquiryMessageList, sendChatMessage, ageCheckUpdate } from '../../_api';
|
|
12
|
+
import { convertApiMessageObjectToUiMessageObject, convertApiMessageToUiMessage } from '../../_lib';
|
|
13
|
+
import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
|
|
14
|
+
import { useFullURL } from './useFullURL';
|
|
15
|
+
import { getErrorMessageMap } from '../../_enums/error';
|
|
16
|
+
import { consoleFn } from '../../_lib/utils';
|
|
17
|
+
export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNumber, setMessages, setInquiryStatus, setMessageObject, chatInquiryNumber, setIsNextPage, setWorkFlowStack, setInquiryMainData, centerCode, setAgeCheckStatus }) => {
|
|
18
|
+
const toast = useDaeryunTalkToast();
|
|
19
|
+
const fullUrl = useFullURL();
|
|
20
|
+
const resetData = useCallback(() => {
|
|
21
|
+
setMessages([]);
|
|
22
|
+
setInquiryStatus('');
|
|
23
|
+
setMessageObject(null);
|
|
24
|
+
setIsNextPage(null);
|
|
25
|
+
}, []);
|
|
26
|
+
// const resetData = () => {};
|
|
27
|
+
// 채팅 시작 (문의하기 버튼 클릭 시)
|
|
28
|
+
const startChat = useCallback((inquiryNumber) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
30
|
+
try {
|
|
31
|
+
setIsLoading(true);
|
|
32
|
+
consoleFn('[DaeryuntalkContext] 채팅 시작 요청');
|
|
33
|
+
// 기존 문의가 있는지 확인
|
|
34
|
+
const hasExistingInquiry = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.progress_inquiry_number) && (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.progress_inquiry_number.trim()) !== '';
|
|
35
|
+
let currentChatInquiryNumber = '';
|
|
36
|
+
if (hasExistingInquiry || inquiryNumber) {
|
|
37
|
+
// 기존 문의가 있는 경우, 해당 문의번호 사용
|
|
38
|
+
currentChatInquiryNumber = inquiryNumber
|
|
39
|
+
? inquiryNumber
|
|
40
|
+
: (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.progress_inquiry_number) || '';
|
|
41
|
+
consoleFn('[DaeryuntalkContext] 기존 문의 사용:', currentChatInquiryNumber);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// 새 문의 생성
|
|
45
|
+
consoleFn('[DaeryuntalkContext] 새 문의 생성 시작');
|
|
46
|
+
const createResponse = yield generateChatInquiry((inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_number) || '', fullUrl, centerCode);
|
|
47
|
+
if (!(createResponse.result_info.result_cd === 'OK' ||
|
|
48
|
+
createResponse.result_info.result_type_cd === 'OK')) {
|
|
49
|
+
resetData();
|
|
50
|
+
toast.error(getErrorMessageMap(createResponse));
|
|
51
|
+
return createResponse;
|
|
52
|
+
}
|
|
53
|
+
currentChatInquiryNumber = createResponse.data.chat_inquiry_number;
|
|
54
|
+
}
|
|
55
|
+
// 문의 상세 조회
|
|
56
|
+
consoleFn('[DaeryuntalkContext] 문의 상세 조회 시작:', currentChatInquiryNumber);
|
|
57
|
+
const detailResponse = yield getChatInquiryDetailNew(currentChatInquiryNumber);
|
|
58
|
+
if (!(detailResponse.result_info.result_cd === 'OK' ||
|
|
59
|
+
detailResponse.result_info.result_type_cd === 'OK')) {
|
|
60
|
+
resetData();
|
|
61
|
+
toast.error(getErrorMessageMap(detailResponse));
|
|
62
|
+
return detailResponse;
|
|
63
|
+
}
|
|
64
|
+
consoleFn('[DaeryuntalkContext] 문의 상세 조회 완료:', detailResponse);
|
|
65
|
+
consoleFn('[DaeryuntalkContext] 문의 채팅 리스트 조회 시작:', currentChatInquiryNumber);
|
|
66
|
+
const chatList = yield getChatInquiryMessageList(currentChatInquiryNumber);
|
|
67
|
+
if (!(chatList.result_info.result_cd === 'OK' || chatList.result_info.result_type_cd === 'OK')) {
|
|
68
|
+
resetData();
|
|
69
|
+
toast.error(getErrorMessageMap(chatList));
|
|
70
|
+
return chatList;
|
|
71
|
+
}
|
|
72
|
+
consoleFn('[DaeryuntalkContext] 문의 채팅 리스트 조회 완료:', chatList);
|
|
73
|
+
// 문의 정보 저장
|
|
74
|
+
setChatInquiryNumber(currentChatInquiryNumber);
|
|
75
|
+
consoleFn('detailResponse.data.message_list', (_a = chatList === null || chatList === void 0 ? void 0 : chatList.data) === null || _a === void 0 ? void 0 : _a.message_list);
|
|
76
|
+
// 메시지 처리
|
|
77
|
+
// 메세지 리스트 후처리
|
|
78
|
+
if (chatList.data.message_list.length > 0) {
|
|
79
|
+
const uiMessages = chatList.data.message_list
|
|
80
|
+
.sort((a, b) => a.timestamp - b.timestamp)
|
|
81
|
+
.map(item => {
|
|
82
|
+
return convertApiMessageToUiMessage(item, 'basic');
|
|
83
|
+
});
|
|
84
|
+
setMessages(uiMessages);
|
|
85
|
+
consoleFn('[DaeryuntalkContext] 메시지 설정 완료:', uiMessages.length);
|
|
86
|
+
}
|
|
87
|
+
if (((_b = chatList.data) === null || _b === void 0 ? void 0 : _b.next_page_yn) !== null) {
|
|
88
|
+
setIsNextPage(chatList.data.next_page_yn);
|
|
89
|
+
}
|
|
90
|
+
// 해당 문의 상태
|
|
91
|
+
if ((_c = detailResponse.data) === null || _c === void 0 ? void 0 : _c.chat_inquiry_state_code) {
|
|
92
|
+
setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
|
|
93
|
+
}
|
|
94
|
+
// 해당 문의 오브젝트
|
|
95
|
+
if ((_d = detailResponse.data) === null || _d === void 0 ? void 0 : _d.object_expose_info) {
|
|
96
|
+
const uiObject = convertApiMessageObjectToUiMessageObject(detailResponse.data);
|
|
97
|
+
setMessageObject(uiObject);
|
|
98
|
+
}
|
|
99
|
+
// 해당 문의 상태
|
|
100
|
+
if ((_e = detailResponse.data) === null || _e === void 0 ? void 0 : _e.chat_inquiry_state_code) {
|
|
101
|
+
setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
|
|
102
|
+
}
|
|
103
|
+
// 워크플로우 스택 업데이트
|
|
104
|
+
if ((_f = detailResponse.data) === null || _f === void 0 ? void 0 : _f.work_flow_progress_stack) {
|
|
105
|
+
setWorkFlowStack((_h = (_g = detailResponse.data) === null || _g === void 0 ? void 0 : _g.work_flow_progress_stack) !== null && _h !== void 0 ? _h : []);
|
|
106
|
+
}
|
|
107
|
+
return currentChatInquiryNumber;
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
toast.error('문의 시작에 실패했습니다.');
|
|
111
|
+
console.error('[DaeryuntalkContext] 채팅 시작 오류:', error);
|
|
112
|
+
return { error }; // 에러를 던지지 않고 그대로 반환
|
|
113
|
+
// throw error;
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
setIsLoading(false);
|
|
117
|
+
}
|
|
118
|
+
}), [inquiryMainData, fullUrl]);
|
|
119
|
+
// 선택된 히스토리의 채팅창 시작
|
|
120
|
+
const startSelectedChat = useCallback((chatInquiryNumber) => __awaiter(void 0, void 0, void 0, function* () {
|
|
121
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
122
|
+
try {
|
|
123
|
+
setIsLoading(true);
|
|
124
|
+
// 문의 상세 조회
|
|
125
|
+
const detailResponse = yield getChatInquiryDetailNew(chatInquiryNumber);
|
|
126
|
+
if (!(detailResponse.result_info.result_cd === 'OK' ||
|
|
127
|
+
detailResponse.result_info.result_type_cd === 'OK')) {
|
|
128
|
+
resetData();
|
|
129
|
+
toast.error(getErrorMessageMap(detailResponse));
|
|
130
|
+
return detailResponse;
|
|
131
|
+
}
|
|
132
|
+
consoleFn('[DaeryuntalkContext] 문의 상세 조회 완료:', detailResponse);
|
|
133
|
+
const chatList = yield getChatInquiryMessageList(chatInquiryNumber);
|
|
134
|
+
consoleFn('[DaeryuntalkContext] 문의 채팅 리스트 조회 완료:', chatList);
|
|
135
|
+
if (!(chatList.result_info.result_cd === 'OK' || chatList.result_info.result_type_cd === 'OK')) {
|
|
136
|
+
resetData();
|
|
137
|
+
toast.error(getErrorMessageMap(chatList));
|
|
138
|
+
return chatList;
|
|
139
|
+
}
|
|
140
|
+
consoleFn('detailResponse.data.message_list', (_a = chatList === null || chatList === void 0 ? void 0 : chatList.data) === null || _a === void 0 ? void 0 : _a.message_list);
|
|
141
|
+
// 메시지 처리
|
|
142
|
+
// 문의 정보 저장
|
|
143
|
+
setChatInquiryNumber(chatInquiryNumber);
|
|
144
|
+
//
|
|
145
|
+
setInquiryMainData(prev => {
|
|
146
|
+
if (prev) {
|
|
147
|
+
return Object.assign(Object.assign({}, prev), { progress_inquiry_number: chatInquiryNumber });
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
// 메세지 리스트 후처리
|
|
154
|
+
if (chatList.data.message_list.length > 0) {
|
|
155
|
+
const uiMessages = chatList.data.message_list
|
|
156
|
+
.sort((a, b) => a.timestamp - b.timestamp)
|
|
157
|
+
.map(item => {
|
|
158
|
+
return convertApiMessageToUiMessage(item, 'basic');
|
|
159
|
+
});
|
|
160
|
+
// const uiMessages = chatList.data.message_list.map(convertApiMessageToUiMessage);
|
|
161
|
+
setMessages(uiMessages);
|
|
162
|
+
consoleFn('[DaeryuntalkContext] 메시지 설정 완료:', uiMessages.length);
|
|
163
|
+
}
|
|
164
|
+
if (((_b = chatList.data) === null || _b === void 0 ? void 0 : _b.next_page_yn) !== null) {
|
|
165
|
+
setIsNextPage(chatList.data.next_page_yn);
|
|
166
|
+
}
|
|
167
|
+
// 해당 문의 상태
|
|
168
|
+
if ((_c = detailResponse.data) === null || _c === void 0 ? void 0 : _c.chat_inquiry_state_code) {
|
|
169
|
+
setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
|
|
170
|
+
}
|
|
171
|
+
// 해당 문의 연령 체크
|
|
172
|
+
if ((_d = detailResponse.data) === null || _d === void 0 ? void 0 : _d.age_consent_state_code) {
|
|
173
|
+
setAgeCheckStatus(detailResponse.data.age_consent_state_code);
|
|
174
|
+
}
|
|
175
|
+
// 해당 문의 오브젝트
|
|
176
|
+
if ((_e = detailResponse.data) === null || _e === void 0 ? void 0 : _e.object_expose_info) {
|
|
177
|
+
const uiObject = convertApiMessageObjectToUiMessageObject(detailResponse.data);
|
|
178
|
+
setMessageObject(uiObject);
|
|
179
|
+
}
|
|
180
|
+
// 해당 문의 상태
|
|
181
|
+
if ((_f = detailResponse.data) === null || _f === void 0 ? void 0 : _f.chat_inquiry_state_code) {
|
|
182
|
+
setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
|
|
183
|
+
}
|
|
184
|
+
// 워크플로우 스택 업데이트
|
|
185
|
+
if ((_g = detailResponse.data) === null || _g === void 0 ? void 0 : _g.work_flow_progress_stack) {
|
|
186
|
+
setWorkFlowStack((_j = (_h = detailResponse.data) === null || _h === void 0 ? void 0 : _h.work_flow_progress_stack) !== null && _j !== void 0 ? _j : []);
|
|
187
|
+
}
|
|
188
|
+
return chatInquiryNumber;
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
toast.error('채팅 시작에 실패했습니다.');
|
|
192
|
+
console.error('[DaeryuntalkContext] 채팅 시작 오류:', error);
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
finally {
|
|
196
|
+
setIsLoading(false);
|
|
197
|
+
}
|
|
198
|
+
}), [inquiryMainData]);
|
|
199
|
+
// 메시지 전송
|
|
200
|
+
const sendMessage = useCallback((htmlContent, jsonData, retry) => __awaiter(void 0, void 0, void 0, function* () {
|
|
201
|
+
try {
|
|
202
|
+
setIsLoading === null || setIsLoading === void 0 ? void 0 : setIsLoading(true);
|
|
203
|
+
consoleFn('chatInquiryNumber', chatInquiryNumber);
|
|
204
|
+
const response = yield sendChatMessage(chatInquiryNumber, htmlContent, jsonData);
|
|
205
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
206
|
+
toast.error(getErrorMessageMap(response));
|
|
207
|
+
}
|
|
208
|
+
return response;
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
toast.error('메시지 전송에 실패했습니다.');
|
|
212
|
+
console.error('[DaeryuntalkContext] 메시지 전송 중 오류 발생:', error);
|
|
213
|
+
}
|
|
214
|
+
finally {
|
|
215
|
+
setIsLoading === null || setIsLoading === void 0 ? void 0 : setIsLoading(false);
|
|
216
|
+
}
|
|
217
|
+
}), [chatInquiryNumber]);
|
|
218
|
+
// 신규 채팅 문의 생성
|
|
219
|
+
const createNewChat = useCallback((version) => __awaiter(void 0, void 0, void 0, function* () {
|
|
220
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
221
|
+
try {
|
|
222
|
+
if (!inquiryMainData) {
|
|
223
|
+
toast.error('채널이 존재하지 않습니다.');
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
setIsLoading === null || setIsLoading === void 0 ? void 0 : setIsLoading(true);
|
|
227
|
+
consoleFn('chatInquiryNumber', chatInquiryNumber);
|
|
228
|
+
const createResponse = yield generateChatInquiry((inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_number) || '', fullUrl, centerCode);
|
|
229
|
+
if (!(createResponse.result_info.result_cd === 'OK' ||
|
|
230
|
+
createResponse.result_info.result_type_cd === 'OK')) {
|
|
231
|
+
toast.error(getErrorMessageMap(createResponse));
|
|
232
|
+
return createResponse;
|
|
233
|
+
}
|
|
234
|
+
consoleFn('[DaeryuntalkContext] 새 문의 생성 완료:', createResponse);
|
|
235
|
+
const currentChatInquiryNumber = createResponse.data.chat_inquiry_number;
|
|
236
|
+
// 문의 상세 조회
|
|
237
|
+
consoleFn('[DaeryuntalkContext] 문의 상세 조회 시작:', currentChatInquiryNumber);
|
|
238
|
+
const detailResponse = yield getChatInquiryDetailNew(currentChatInquiryNumber);
|
|
239
|
+
consoleFn('[DaeryuntalkContext] 문의 상세 조회 완료:', detailResponse);
|
|
240
|
+
if (!(detailResponse.result_info.result_cd === 'OK' ||
|
|
241
|
+
detailResponse.result_info.result_type_cd === 'OK')) {
|
|
242
|
+
resetData();
|
|
243
|
+
toast.error(getErrorMessageMap(detailResponse));
|
|
244
|
+
return detailResponse;
|
|
245
|
+
}
|
|
246
|
+
// 메세지 리스트
|
|
247
|
+
consoleFn('[DaeryuntalkContext] 문의 채팅 리스트 조회 시작:', currentChatInquiryNumber);
|
|
248
|
+
const chatList = yield getChatInquiryMessageList(currentChatInquiryNumber);
|
|
249
|
+
consoleFn('[DaeryuntalkContext] 문의 채팅 리스트 조회 완료:', chatList);
|
|
250
|
+
if (!(chatList.result_info.result_cd === 'OK' || chatList.result_info.result_type_cd === 'OK')) {
|
|
251
|
+
resetData();
|
|
252
|
+
toast.error(getErrorMessageMap(chatList));
|
|
253
|
+
return chatList;
|
|
254
|
+
}
|
|
255
|
+
// 메시지 처리
|
|
256
|
+
setChatInquiryNumber(currentChatInquiryNumber);
|
|
257
|
+
// 메세지 리스트 후처리
|
|
258
|
+
if (((_a = chatList.data) === null || _a === void 0 ? void 0 : _a.message_list) && chatList.data.message_list.length > 0) {
|
|
259
|
+
const uiMessages = chatList.data.message_list
|
|
260
|
+
.sort((a, b) => a.timestamp - b.timestamp)
|
|
261
|
+
.map(item => {
|
|
262
|
+
return convertApiMessageToUiMessage(item, 'basic');
|
|
263
|
+
});
|
|
264
|
+
setMessages(uiMessages);
|
|
265
|
+
consoleFn('[DaeryuntalkContext] 메시지 설정 완료:', uiMessages.length);
|
|
266
|
+
}
|
|
267
|
+
if (((_b = chatList.data) === null || _b === void 0 ? void 0 : _b.next_page_yn) !== null) {
|
|
268
|
+
setIsNextPage(chatList.data.next_page_yn);
|
|
269
|
+
}
|
|
270
|
+
// 해당 문의 상태
|
|
271
|
+
if ((_c = detailResponse.data) === null || _c === void 0 ? void 0 : _c.chat_inquiry_state_code) {
|
|
272
|
+
setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
|
|
273
|
+
}
|
|
274
|
+
// 해당 문의 연령 체크
|
|
275
|
+
if ((_d = detailResponse.data) === null || _d === void 0 ? void 0 : _d.age_consent_state_code) {
|
|
276
|
+
setAgeCheckStatus(detailResponse.data.age_consent_state_code);
|
|
277
|
+
}
|
|
278
|
+
// 워크플로우 스택 업데이트
|
|
279
|
+
if ((_e = detailResponse.data) === null || _e === void 0 ? void 0 : _e.work_flow_progress_stack) {
|
|
280
|
+
setWorkFlowStack((_g = (_f = detailResponse.data) === null || _f === void 0 ? void 0 : _f.work_flow_progress_stack) !== null && _g !== void 0 ? _g : []);
|
|
281
|
+
}
|
|
282
|
+
// 해당 문의 오브젝트
|
|
283
|
+
if ((_h = detailResponse.data) === null || _h === void 0 ? void 0 : _h.object_expose_info) {
|
|
284
|
+
const uiObject = convertApiMessageObjectToUiMessageObject(detailResponse.data);
|
|
285
|
+
setMessageObject(uiObject);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
toast.error('채팅 문의 생성에 실패했습니다.');
|
|
290
|
+
console.error('[DaeryuntalkContext] 신규 채팅문의 생성:', error);
|
|
291
|
+
}
|
|
292
|
+
finally {
|
|
293
|
+
setIsLoading(false);
|
|
294
|
+
}
|
|
295
|
+
}), [inquiryMainData, chatInquiryNumber]);
|
|
296
|
+
const startWorkFlow = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
297
|
+
const { chatInquiryNumber, messageNumber, workFlowNumber, objectNumber } = data;
|
|
298
|
+
if (!chatInquiryNumber) {
|
|
299
|
+
toast.error('채팅 문의 번호가 없습니다.');
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (!messageNumber) {
|
|
303
|
+
toast.error('메시지 번호가 없습니다.');
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
if (!workFlowNumber) {
|
|
307
|
+
toast.error('워크플로우 번호가 없습니다.');
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
if (!objectNumber) {
|
|
311
|
+
toast.error('오브젝트 번호가 없습니다.');
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
setIsLoading === null || setIsLoading === void 0 ? void 0 : setIsLoading(true);
|
|
316
|
+
const response = yield chatWorkFlow(chatInquiryNumber, messageNumber, workFlowNumber, objectNumber);
|
|
317
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
318
|
+
toast.error(getErrorMessageMap(response));
|
|
319
|
+
}
|
|
320
|
+
return response;
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
toast.error('워크플로우 생성에 실패했습니다.');
|
|
324
|
+
console.error('[워크 플로우 생성 실패]:', error);
|
|
325
|
+
}
|
|
326
|
+
finally {
|
|
327
|
+
setIsLoading === null || setIsLoading === void 0 ? void 0 : setIsLoading(false);
|
|
328
|
+
}
|
|
329
|
+
}), []);
|
|
330
|
+
const workFlowBack = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
331
|
+
const { chatInquiryNumber, messageNumber, workFlowNavigationCode } = data;
|
|
332
|
+
if (!chatInquiryNumber) {
|
|
333
|
+
toast.error('채팅 문의 번호가 없습니다.');
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (!messageNumber) {
|
|
337
|
+
toast.error('메시지 번호가 없습니다.');
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
if (!workFlowNavigationCode) {
|
|
341
|
+
toast.error('워크플로우 네비게이션 코드가 없습니다.');
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
try {
|
|
345
|
+
setIsLoading === null || setIsLoading === void 0 ? void 0 : setIsLoading(true);
|
|
346
|
+
const response = yield chatWorkFlowBack(chatInquiryNumber, messageNumber, workFlowNavigationCode);
|
|
347
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
348
|
+
toast.error(getErrorMessageMap(response));
|
|
349
|
+
}
|
|
350
|
+
return response;
|
|
351
|
+
}
|
|
352
|
+
catch (error) {
|
|
353
|
+
toast.error('동작에 실패했습니다.');
|
|
354
|
+
console.error('[워크 플로우 생성 실패]:', error);
|
|
355
|
+
}
|
|
356
|
+
finally {
|
|
357
|
+
setIsLoading === null || setIsLoading === void 0 ? void 0 : setIsLoading(false);
|
|
358
|
+
}
|
|
359
|
+
}), []);
|
|
360
|
+
const chatUserUpdate = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
361
|
+
const { chatInquiryNumber, messageNumber, name, cellPhoneNumber } = data;
|
|
362
|
+
// if (!chatInquiryNumber) {
|
|
363
|
+
// toast.error('채팅 개인 정보 업데이트: 문의 번호가 없음');
|
|
364
|
+
// return;
|
|
365
|
+
// }
|
|
366
|
+
// console.log('chatInquiryNumber', chatInquiryNumber);
|
|
367
|
+
if (!cellPhoneNumber) {
|
|
368
|
+
toast.error('이름과 휴대폰 번호를 입력해 주세요');
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
if (!name) {
|
|
372
|
+
toast.error('이름과 휴대폰 번호를 입력해 주세요');
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
// if (!cellPhoneNumber) {
|
|
376
|
+
// toast.error('채팅 개인 정보 업데이트: 메시지 번호 없음');
|
|
377
|
+
// return;
|
|
378
|
+
// }
|
|
379
|
+
try {
|
|
380
|
+
setIsLoading === null || setIsLoading === void 0 ? void 0 : setIsLoading(true);
|
|
381
|
+
const response = yield apiChatUserUpdate(chatInquiryNumber, messageNumber, name, cellPhoneNumber);
|
|
382
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
383
|
+
toast.error(getErrorMessageMap(response));
|
|
384
|
+
}
|
|
385
|
+
return response;
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
// toast.error('개인정보 업데이트에 실패했습니다.');
|
|
389
|
+
console.error('[워크 플로우 생성 실패]:', error);
|
|
390
|
+
}
|
|
391
|
+
finally {
|
|
392
|
+
setIsLoading === null || setIsLoading === void 0 ? void 0 : setIsLoading(false);
|
|
393
|
+
}
|
|
394
|
+
}), []);
|
|
395
|
+
// 무한스크롤 실행
|
|
396
|
+
const getNextMessageList = useCallback((chatInquiryNumber, standardTimestamp) => __awaiter(void 0, void 0, void 0, function* () {
|
|
397
|
+
try {
|
|
398
|
+
const response = yield getChatInquiryMessageList(chatInquiryNumber, standardTimestamp);
|
|
399
|
+
if (response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK') {
|
|
400
|
+
const newMessageList = response.data.message_list
|
|
401
|
+
.sort((a, b) => a.timestamp - b.timestamp)
|
|
402
|
+
.map(item => convertApiMessageToUiMessage(item, 'prev'));
|
|
403
|
+
setIsNextPage(response.data.next_page_yn);
|
|
404
|
+
setMessages(prev => {
|
|
405
|
+
if (!newMessageList || newMessageList.length === 0)
|
|
406
|
+
return prev;
|
|
407
|
+
const existingMessageNumbers = new Set(prev.map(msg => msg.messageNumber));
|
|
408
|
+
const filteredNewMessages = newMessageList.filter(msg => !existingMessageNumbers.has(msg.messageNumber));
|
|
409
|
+
return [...filteredNewMessages, ...prev];
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
toast.error(getErrorMessageMap(response));
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
catch (error) {
|
|
418
|
+
console.error(`[실패]:`, error);
|
|
419
|
+
}
|
|
420
|
+
}), []);
|
|
421
|
+
const attendRoomByHistory = useCallback((chatInquiryNumber) => __awaiter(void 0, void 0, void 0, function* () {
|
|
422
|
+
try {
|
|
423
|
+
const response = yield attendChatRoomByHistory({ chatInquiryNumber });
|
|
424
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
425
|
+
toast.error(getErrorMessageMap(response));
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
return response;
|
|
429
|
+
}
|
|
430
|
+
catch (error) {
|
|
431
|
+
console.error(`[실패]:`, error);
|
|
432
|
+
// toast.error(error?.message || '오류가 발생했습니다.');
|
|
433
|
+
}
|
|
434
|
+
finally {
|
|
435
|
+
}
|
|
436
|
+
}), [chatInquiryNumber]);
|
|
437
|
+
const ageConfirm = useCallback((chatInquiryNumber, ageConsentStateCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
438
|
+
try {
|
|
439
|
+
const response = yield ageCheckUpdate(chatInquiryNumber, ageConsentStateCode);
|
|
440
|
+
if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
|
|
441
|
+
toast.error(getErrorMessageMap(response));
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
setAgeCheckStatus(ageConsentStateCode);
|
|
445
|
+
return response;
|
|
446
|
+
}
|
|
447
|
+
catch (error) {
|
|
448
|
+
console.error(`[연령 확인 실패]:`, error);
|
|
449
|
+
}
|
|
450
|
+
finally {
|
|
451
|
+
}
|
|
452
|
+
}), []);
|
|
453
|
+
return {
|
|
454
|
+
attendRoomByHistory,
|
|
455
|
+
startChat,
|
|
456
|
+
sendMessage,
|
|
457
|
+
createNewChat,
|
|
458
|
+
startWorkFlow,
|
|
459
|
+
workFlowBack,
|
|
460
|
+
chatUserUpdate,
|
|
461
|
+
getNextMessageList,
|
|
462
|
+
startSelectedChat,
|
|
463
|
+
ageConfirm
|
|
464
|
+
};
|
|
465
|
+
};
|