@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,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IChatInquiryMainDataResponse } from '../_api/daeryuntalk/type/response';
|
|
3
|
+
import { ViewState } from '../ChatHomeView';
|
|
4
|
+
import { History } from '../_api/daeryuntalk/type/response';
|
|
5
|
+
interface IChatConversationHeaderProps {
|
|
6
|
+
inquiryMainData: IChatInquiryMainDataResponse | null;
|
|
7
|
+
isMobile: boolean;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
isHash: boolean;
|
|
10
|
+
onHistoryClick?: () => void;
|
|
11
|
+
viewState: ViewState;
|
|
12
|
+
isAuthenticated: boolean;
|
|
13
|
+
historyList: History[];
|
|
14
|
+
}
|
|
15
|
+
declare const ChatConversationHeader: ({ inquiryMainData, isMobile, onClose, isHash, viewState, onHistoryClick, isAuthenticated, historyList }: IChatConversationHeaderProps) => React.JSX.Element;
|
|
16
|
+
export default ChatConversationHeader;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
const ChatConversationHeader = ({ inquiryMainData, isMobile, onClose, isHash,
|
|
4
|
+
// onBackClick,
|
|
5
|
+
viewState, onHistoryClick, isAuthenticated, historyList }) => {
|
|
6
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
7
|
+
const HistoryNewbadge = `${s3Url}/daeryuntalk/history-new-badge.png`;
|
|
8
|
+
const DaeryunLogoIcon = `${s3Url}/daeryuntalk/daeryun-logo.svg`;
|
|
9
|
+
const PrevIcon = `${s3Url}/daeryuntalk/prev.svg`;
|
|
10
|
+
const CloseSvgIcon = `${s3Url}/daeryuntalk/close.svg`;
|
|
11
|
+
const HistoryIcon = `${s3Url}/daeryuntalk/history-icon.png`;
|
|
12
|
+
const channelName = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_name) || '';
|
|
13
|
+
const logoImageUrl = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_logo_image_url) || '';
|
|
14
|
+
const unreadCount = historyList.length > 0 ? historyList.reduce((sum, item) => sum + (item.unread_message_count || 0), 0) : 0;
|
|
15
|
+
const isNewBadge = isAuthenticated && unreadCount > 0;
|
|
16
|
+
const handleBackClick = () => {
|
|
17
|
+
// if (onBackClick) {
|
|
18
|
+
// onBackClick();
|
|
19
|
+
// }
|
|
20
|
+
};
|
|
21
|
+
const handleHistoryClick = () => {
|
|
22
|
+
if (onHistoryClick) {
|
|
23
|
+
onHistoryClick();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (<div className={`${isMobile ? '' : ''} flex h-[56px] w-full items-center justify-between border-b border-gray-200 px-[16px] `}>
|
|
27
|
+
{viewState === 'conversation' ? (<button type="button" className={`relative flex flex-col items-center justify-center`} onClick={handleHistoryClick}>
|
|
28
|
+
<Image src={HistoryIcon} alt="히스토리" width={20} height={20}/>
|
|
29
|
+
<span className="h-[10px] text-[10px] font-[700] leading-[100%] tracking-[-0.04%]">히스토리</span>
|
|
30
|
+
<div className={`${isNewBadge ? 'opacity-100' : 'opacity-0'} absolute -right-[4px] -top-[1px]`}>
|
|
31
|
+
<Image src={HistoryNewbadge} alt="뉴 히스토리 뱃지" width={12} height={12}/>
|
|
32
|
+
</div>
|
|
33
|
+
</button>) : (<button className={`flex h-[28px] w-[28px] items-center justify-center `} aria-label="이전" onClick={handleBackClick}>
|
|
34
|
+
<Image src={PrevIcon} alt="이전" width={28} height={28}/>
|
|
35
|
+
{/* <PrevIcon width={28} height={28} /> */}
|
|
36
|
+
</button>)}
|
|
37
|
+
<div className="flex items-center gap-[10px] ">
|
|
38
|
+
{logoImageUrl ? (<Image src={logoImageUrl} alt="로고" width={28} height={28} className=""/>) : (<Image src={DaeryunLogoIcon} alt="대륜 로고" width={28} height={28}/>)}
|
|
39
|
+
{/* <DaeryunLogoIcon width={28} height={28} /> */}
|
|
40
|
+
<p className={`dr_talk_title_small text-drTalkBlack`}>{channelName}</p>
|
|
41
|
+
</div>
|
|
42
|
+
<div
|
|
43
|
+
// className={`${isHash ? 'pointer-events-none !opacity-0' : ''} ${isMobile ? 'block' : ' xs:pointer-events-none xs:!opacity-0 '} py-[14px] text-drTalkGrayscale2 hover:cursor-pointer`}
|
|
44
|
+
className={`py-[14px] text-black hover:cursor-pointer`} onClick={onClose}>
|
|
45
|
+
<Image src={CloseSvgIcon} alt="닫기" width={28} height={28}/>
|
|
46
|
+
{/* <CloseSvgIcon width={28} height={28} /> */}
|
|
47
|
+
</div>
|
|
48
|
+
</div>);
|
|
49
|
+
};
|
|
50
|
+
export default ChatConversationHeader;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import { IChatInquiryMainDataResponse } from '../_api/daeryuntalk/type/response';
|
|
4
|
+
import { ViewState } from '../ChatHomeView';
|
|
5
|
+
import { History } from '../_api/daeryuntalk/type/response';
|
|
6
|
+
|
|
7
|
+
// 이미지
|
|
8
|
+
// import HistoryNewbadge from '../../../asset/images/daeryuntalk/history-new-badge.png';
|
|
9
|
+
// import DaeryunLogoIcon from '../../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
10
|
+
// import PrevIcon from '../../../asset/images/daeryuntalk/prev.svg';
|
|
11
|
+
// import CloseSvgIcon from '../../../asset/images/daeryuntalk/close.svg';
|
|
12
|
+
// import HistoryIcon from '../../../asset/images/daeryuntalk/history-icon.png';
|
|
13
|
+
|
|
14
|
+
interface IChatConversationHeaderProps {
|
|
15
|
+
inquiryMainData: IChatInquiryMainDataResponse | null;
|
|
16
|
+
isMobile: boolean;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
isHash: boolean;
|
|
19
|
+
// onBackClick?: () => void;
|
|
20
|
+
onHistoryClick?: () => void;
|
|
21
|
+
viewState: ViewState;
|
|
22
|
+
isAuthenticated: boolean;
|
|
23
|
+
historyList: History[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const ChatConversationHeader = ({
|
|
27
|
+
inquiryMainData,
|
|
28
|
+
isMobile,
|
|
29
|
+
onClose,
|
|
30
|
+
isHash,
|
|
31
|
+
// onBackClick,
|
|
32
|
+
viewState,
|
|
33
|
+
onHistoryClick,
|
|
34
|
+
isAuthenticated,
|
|
35
|
+
historyList
|
|
36
|
+
}: IChatConversationHeaderProps) => {
|
|
37
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
38
|
+
const HistoryNewbadge = `${s3Url}/daeryuntalk/history-new-badge.png`;
|
|
39
|
+
const DaeryunLogoIcon = `${s3Url}/daeryuntalk/daeryun-logo.svg`;
|
|
40
|
+
const PrevIcon = `${s3Url}/daeryuntalk/prev.svg`;
|
|
41
|
+
const CloseSvgIcon = `${s3Url}/daeryuntalk/close.svg`;
|
|
42
|
+
const HistoryIcon = `${s3Url}/daeryuntalk/history-icon.png`;
|
|
43
|
+
|
|
44
|
+
const channelName = inquiryMainData?.channel_name || '';
|
|
45
|
+
const logoImageUrl = inquiryMainData?.channel_logo_image_url || '';
|
|
46
|
+
const unreadCount =
|
|
47
|
+
historyList.length > 0 ? historyList.reduce((sum, item) => sum + (item.unread_message_count || 0), 0) : 0;
|
|
48
|
+
const isNewBadge = isAuthenticated && unreadCount > 0;
|
|
49
|
+
|
|
50
|
+
const handleBackClick = () => {
|
|
51
|
+
// if (onBackClick) {
|
|
52
|
+
// onBackClick();
|
|
53
|
+
// }
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleHistoryClick = () => {
|
|
57
|
+
if (onHistoryClick) {
|
|
58
|
+
onHistoryClick();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
className={`${isMobile ? '' : ''} flex h-[56px] w-full items-center justify-between border-b border-gray-200 px-[16px] `}
|
|
64
|
+
>
|
|
65
|
+
{viewState === 'conversation' ? (
|
|
66
|
+
<button
|
|
67
|
+
type="button"
|
|
68
|
+
className={`relative flex flex-col items-center justify-center`}
|
|
69
|
+
onClick={handleHistoryClick}
|
|
70
|
+
>
|
|
71
|
+
<Image src={HistoryIcon} alt="히스토리" width={20} height={20} />
|
|
72
|
+
<span className="h-[10px] text-[10px] font-[700] leading-[100%] tracking-[-0.04%]">히스토리</span>
|
|
73
|
+
<div className={`${isNewBadge ? 'opacity-100' : 'opacity-0'} absolute -right-[4px] -top-[1px]`}>
|
|
74
|
+
<Image src={HistoryNewbadge} alt="뉴 히스토리 뱃지" width={12} height={12} />
|
|
75
|
+
</div>
|
|
76
|
+
</button>
|
|
77
|
+
) : (
|
|
78
|
+
<button
|
|
79
|
+
className={`flex h-[28px] w-[28px] items-center justify-center `}
|
|
80
|
+
aria-label="이전"
|
|
81
|
+
onClick={handleBackClick}
|
|
82
|
+
>
|
|
83
|
+
<Image src={PrevIcon} alt="이전" width={28} height={28} />
|
|
84
|
+
{/* <PrevIcon width={28} height={28} /> */}
|
|
85
|
+
</button>
|
|
86
|
+
)}
|
|
87
|
+
<div className="flex items-center gap-[10px] ">
|
|
88
|
+
{logoImageUrl ? (
|
|
89
|
+
<Image src={logoImageUrl} alt="로고" width={28} height={28} className="" />
|
|
90
|
+
) : (
|
|
91
|
+
<Image src={DaeryunLogoIcon} alt="대륜 로고" width={28} height={28} />
|
|
92
|
+
)}
|
|
93
|
+
{/* <DaeryunLogoIcon width={28} height={28} /> */}
|
|
94
|
+
<p className={`dr_talk_title_small text-drTalkBlack`}>{channelName}</p>
|
|
95
|
+
</div>
|
|
96
|
+
<div
|
|
97
|
+
// className={`${isHash ? 'pointer-events-none !opacity-0' : ''} ${isMobile ? 'block' : ' xs:pointer-events-none xs:!opacity-0 '} py-[14px] text-drTalkGrayscale2 hover:cursor-pointer`}
|
|
98
|
+
className={`py-[14px] text-black hover:cursor-pointer`}
|
|
99
|
+
onClick={onClose}
|
|
100
|
+
>
|
|
101
|
+
<Image src={CloseSvgIcon} alt="닫기" width={28} height={28} />
|
|
102
|
+
{/* <CloseSvgIcon width={28} height={28} /> */}
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export default ChatConversationHeader;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export type ViewState = 'conversation' | 'history';
|
|
3
|
+
type ChatHomeViewProps = {
|
|
4
|
+
hashValue: string | null;
|
|
5
|
+
isMobile: boolean;
|
|
6
|
+
isHash: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
androidViewportHeight?: number;
|
|
9
|
+
isMobileSafari?: boolean;
|
|
10
|
+
viewState: ViewState;
|
|
11
|
+
setViewState: Dispatch<SetStateAction<ViewState>>;
|
|
12
|
+
};
|
|
13
|
+
declare const ChatHomeView: React.FC<ChatHomeViewProps>;
|
|
14
|
+
export default ChatHomeView;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
4
|
+
import ChatConversation from './ChatConversation';
|
|
5
|
+
import HistoryView from './HistoryView';
|
|
6
|
+
import { useChatSocketState } from './_hooks/view/useChatSocketState';
|
|
7
|
+
import ToastRenderer from './Toast/ToastRender';
|
|
8
|
+
import { useHistoryView } from './_hooks/view/useHistoryView';
|
|
9
|
+
import FixedErrorBox from './FixedErrorBox';
|
|
10
|
+
const ChatHomeView = ({ hashValue, onClose, isMobile, isHash, isMobileSafari = false, androidViewportHeight = 0, viewState, setViewState }) => {
|
|
11
|
+
const { isUserExpired, isConnected, isAuthenticated, historyList, ageCheckStatus,
|
|
12
|
+
// inquiryMainData,
|
|
13
|
+
chatInquiryNumber,
|
|
14
|
+
// startChat,
|
|
15
|
+
// retryInitData,
|
|
16
|
+
setIsTyping,
|
|
17
|
+
// setPreviewState,
|
|
18
|
+
// preViewState,
|
|
19
|
+
initialLoading } = useDaeryuntalk();
|
|
20
|
+
// 소켓 이벤트
|
|
21
|
+
const { sendInquiryJoined, sendHeartbeat, sendInquiryWatching, sendInquiryLeft, sendHistoryEntered } = useDaeryuntalk();
|
|
22
|
+
// 홈
|
|
23
|
+
// const { retryInquiryMain } = useDaeryuntalk();
|
|
24
|
+
// 히스토리
|
|
25
|
+
const { startSelectedChat, attendRoomByHistory, createNewChat, goRequestPhone, goGetHistoryList, goHistoryPhoneAuth } = useDaeryuntalk();
|
|
26
|
+
// 소켓 클라 -> 서버 관리
|
|
27
|
+
useChatSocketState(chatInquiryNumber, viewState, sendInquiryWatching, sendInquiryJoined, sendHeartbeat, sendInquiryLeft, isConnected, isAuthenticated, sendHistoryEntered, historyList);
|
|
28
|
+
// 홈 뷰 훅스
|
|
29
|
+
// const { handleStartChat, handleHashStartChat } = useHomeView({
|
|
30
|
+
// setIsLoading,
|
|
31
|
+
// setViewState,
|
|
32
|
+
// retryInquiryMain,
|
|
33
|
+
// inquiryMainData: inquiryMainData ?? null,
|
|
34
|
+
// startChat,
|
|
35
|
+
// preViewState,
|
|
36
|
+
// viewState,
|
|
37
|
+
// setPreviewState
|
|
38
|
+
// });
|
|
39
|
+
// 히스토리 뷰 hooks
|
|
40
|
+
const { handleChatHistoryClick, handleNewStartChat, handleHistoryClick, handleGoRequestPhone, handleGoHistoryPhoneAuth, handleBackClick } = useHistoryView({
|
|
41
|
+
attendRoomByHistory,
|
|
42
|
+
startSelectedChat,
|
|
43
|
+
setViewState,
|
|
44
|
+
// setIsLoading,
|
|
45
|
+
createNewChat,
|
|
46
|
+
goRequestPhone,
|
|
47
|
+
goHistoryPhoneAuth,
|
|
48
|
+
chatInquiryNumber
|
|
49
|
+
// setPreviewState
|
|
50
|
+
});
|
|
51
|
+
// useEffect(() => {
|
|
52
|
+
// if (hashValue && isConnected && inquiryMainData && inquiryMainData.channel_number) {
|
|
53
|
+
// handleHashStartChat();
|
|
54
|
+
// } else {
|
|
55
|
+
// }
|
|
56
|
+
// }, [hashValue, isConnected, inquiryMainData]);
|
|
57
|
+
// viewState 진입
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (isAuthenticated && viewState === 'history') {
|
|
60
|
+
goGetHistoryList({});
|
|
61
|
+
}
|
|
62
|
+
if (isAuthenticated && viewState === 'conversation') {
|
|
63
|
+
setIsTyping(false);
|
|
64
|
+
}
|
|
65
|
+
}, [viewState, isAuthenticated]);
|
|
66
|
+
// useEffect(() => {
|
|
67
|
+
// if (inquiryMainData !== null) {
|
|
68
|
+
// if (!inquiryMainData?.channel_number) {
|
|
69
|
+
// retryInitData();
|
|
70
|
+
// }
|
|
71
|
+
// }
|
|
72
|
+
// }, [inquiryMainData, inquiryMainData?.channel_number]);
|
|
73
|
+
const renderWithNavigation = (content, activeView) => {
|
|
74
|
+
return (
|
|
75
|
+
//
|
|
76
|
+
<main className={`
|
|
77
|
+
relative flex justify-end bg-white
|
|
78
|
+
${isMobile ? 'h-full w-full' : 'h-[100dvh] xs:h-auto xs:rounded-[30px] '}
|
|
79
|
+
`} style={{
|
|
80
|
+
boxShadow: '0px 0px 20px 0px #00000040'
|
|
81
|
+
}}>
|
|
82
|
+
<div className={`
|
|
83
|
+
relative overflow-hidden
|
|
84
|
+
${isMobile
|
|
85
|
+
? `h-full w-screen rounded-[0px]`
|
|
86
|
+
: `
|
|
87
|
+
${isHash
|
|
88
|
+
? `
|
|
89
|
+
h-[100dvh] w-full rounded-[0px]
|
|
90
|
+
xs:max-h-[690px] xs:w-[390px] xs:rounded-[30px]
|
|
91
|
+
xs:shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]
|
|
92
|
+
`
|
|
93
|
+
: `
|
|
94
|
+
w-screen rounded-[0px]
|
|
95
|
+
xs:w-[390px] xs:rounded-[30px]
|
|
96
|
+
`}
|
|
97
|
+
`}
|
|
98
|
+
|
|
99
|
+
`}>
|
|
100
|
+
<div className=' flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]'>
|
|
101
|
+
<div className={`
|
|
102
|
+
no-scrollbar ${isMobile ? 'h-full' : ` overflow-hidden xs:overflow-auto `}
|
|
103
|
+
`}>
|
|
104
|
+
{content}
|
|
105
|
+
</div>
|
|
106
|
+
{/* 얘는 아래 64px로 고정 */}
|
|
107
|
+
{/* <div className={`!z-[50]`}>
|
|
108
|
+
<NavigationFooter
|
|
109
|
+
activeView={activeView}
|
|
110
|
+
onHomeClick={handleHomeClick}
|
|
111
|
+
onHistoryClick={handleHistoryClick}
|
|
112
|
+
historyList={historyList}
|
|
113
|
+
isAuthenticated={isAuthenticated}
|
|
114
|
+
/>
|
|
115
|
+
</div> */}
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
{/*얘는 abolute라서 고려 X*/}
|
|
119
|
+
<ToastRenderer />
|
|
120
|
+
<FixedErrorBox isError={isUserExpired || (isConnected === null ? false : !isConnected)} message={isUserExpired
|
|
121
|
+
? `다른 기기에서 채팅 중입니다.\n새로고침 후 이 기기에서 다시 이용할 수 있습니다.`
|
|
122
|
+
: undefined}/>
|
|
123
|
+
</main>);
|
|
124
|
+
};
|
|
125
|
+
if (viewState === 'history') {
|
|
126
|
+
return renderWithNavigation(<HistoryView onBackClick={handleBackClick} onChatHistoryClick={handleChatHistoryClick} onNewChatClick={handleNewStartChat} isAuthenticated={isAuthenticated !== null && isAuthenticated !== void 0 ? isAuthenticated : false} historyLit={historyList !== null && historyList !== void 0 ? historyList : []} goGetHistoryList={goGetHistoryList} isMobile={isMobile} onClose={onClose} isHash={isHash} handleGoRequestPhone={handleGoRequestPhone} handleGoHistoryPhoneAuth={handleGoHistoryPhoneAuth}/>, 'history');
|
|
127
|
+
}
|
|
128
|
+
// 채팅 문의 창
|
|
129
|
+
// if (viewState === 'conversation') {
|
|
130
|
+
return renderWithNavigation(<ChatConversation
|
|
131
|
+
// onBackClick={handleBackToHome}
|
|
132
|
+
isActive={viewState === 'conversation'} initialLoading={initialLoading} onChatNew={handleNewStartChat} isMobile={isMobile} onClose={onClose} isHash={isHash} viewState={viewState} handleHistoryClick={handleHistoryClick} isAuthenticated={isAuthenticated !== null && isAuthenticated !== void 0 ? isAuthenticated : false} historyList={historyList !== null && historyList !== void 0 ? historyList : []} ageCheckStatus={ageCheckStatus} isMobileSafari={isMobileSafari} androidViewportHeight={androidViewportHeight}/>, 'conversation');
|
|
133
|
+
// }
|
|
134
|
+
// // 홈
|
|
135
|
+
// return renderWithNavigation(
|
|
136
|
+
// <HomeView
|
|
137
|
+
// inquiryMainData={inquiryMainData ?? null}
|
|
138
|
+
// isLoading={isLoading}
|
|
139
|
+
// handleStartChat={handleStartChat}
|
|
140
|
+
// isMobile={isMobile}
|
|
141
|
+
// onClose={onClose}
|
|
142
|
+
// isHash={isHash}
|
|
143
|
+
// />,
|
|
144
|
+
// 'home'
|
|
145
|
+
// );
|
|
146
|
+
};
|
|
147
|
+
export default ChatHomeView;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
|
3
|
+
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
4
|
+
import ChatConversation from './ChatConversation';
|
|
5
|
+
import HistoryView from './HistoryView';
|
|
6
|
+
import { useChatSocketState } from './_hooks/view/useChatSocketState';
|
|
7
|
+
import ToastRenderer from './Toast/ToastRender';
|
|
8
|
+
import { useHistoryView } from './_hooks/view/useHistoryView';
|
|
9
|
+
import FixedErrorBox from './FixedErrorBox';
|
|
10
|
+
|
|
11
|
+
export type ViewState = 'conversation' | 'history';
|
|
12
|
+
|
|
13
|
+
type ChatHomeViewProps = {
|
|
14
|
+
hashValue: string | null;
|
|
15
|
+
isMobile: boolean;
|
|
16
|
+
isHash: boolean;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
androidViewportHeight?: number;
|
|
19
|
+
isMobileSafari?: boolean;
|
|
20
|
+
viewState:ViewState
|
|
21
|
+
setViewState:Dispatch<SetStateAction<ViewState>>;
|
|
22
|
+
};
|
|
23
|
+
const ChatHomeView: React.FC<ChatHomeViewProps> = ({
|
|
24
|
+
hashValue,
|
|
25
|
+
onClose,
|
|
26
|
+
isMobile,
|
|
27
|
+
isHash,
|
|
28
|
+
isMobileSafari = false,
|
|
29
|
+
androidViewportHeight = 0,
|
|
30
|
+
viewState,
|
|
31
|
+
setViewState
|
|
32
|
+
}) => {
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
isUserExpired,
|
|
36
|
+
isConnected,
|
|
37
|
+
isAuthenticated,
|
|
38
|
+
historyList,
|
|
39
|
+
ageCheckStatus,
|
|
40
|
+
// inquiryMainData,
|
|
41
|
+
chatInquiryNumber,
|
|
42
|
+
// startChat,
|
|
43
|
+
// retryInitData,
|
|
44
|
+
setIsTyping,
|
|
45
|
+
// setPreviewState,
|
|
46
|
+
// preViewState,
|
|
47
|
+
initialLoading
|
|
48
|
+
} = useDaeryuntalk();
|
|
49
|
+
|
|
50
|
+
// 소켓 이벤트
|
|
51
|
+
const { sendInquiryJoined, sendHeartbeat, sendInquiryWatching, sendInquiryLeft, sendHistoryEntered } =
|
|
52
|
+
useDaeryuntalk();
|
|
53
|
+
// 홈
|
|
54
|
+
// const { retryInquiryMain } = useDaeryuntalk();
|
|
55
|
+
// 히스토리
|
|
56
|
+
const {
|
|
57
|
+
startSelectedChat,
|
|
58
|
+
attendRoomByHistory,
|
|
59
|
+
createNewChat,
|
|
60
|
+
goRequestPhone,
|
|
61
|
+
goGetHistoryList,
|
|
62
|
+
goHistoryPhoneAuth
|
|
63
|
+
} = useDaeryuntalk();
|
|
64
|
+
|
|
65
|
+
// 소켓 클라 -> 서버 관리
|
|
66
|
+
useChatSocketState(
|
|
67
|
+
chatInquiryNumber,
|
|
68
|
+
viewState,
|
|
69
|
+
sendInquiryWatching,
|
|
70
|
+
sendInquiryJoined,
|
|
71
|
+
sendHeartbeat,
|
|
72
|
+
sendInquiryLeft,
|
|
73
|
+
isConnected,
|
|
74
|
+
isAuthenticated,
|
|
75
|
+
sendHistoryEntered,
|
|
76
|
+
historyList
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
// 홈 뷰 훅스
|
|
80
|
+
// const { handleStartChat, handleHashStartChat } = useHomeView({
|
|
81
|
+
// setIsLoading,
|
|
82
|
+
// setViewState,
|
|
83
|
+
// retryInquiryMain,
|
|
84
|
+
// inquiryMainData: inquiryMainData ?? null,
|
|
85
|
+
// startChat,
|
|
86
|
+
// preViewState,
|
|
87
|
+
// viewState,
|
|
88
|
+
// setPreviewState
|
|
89
|
+
// });
|
|
90
|
+
|
|
91
|
+
// 히스토리 뷰 hooks
|
|
92
|
+
const {
|
|
93
|
+
handleChatHistoryClick,
|
|
94
|
+
handleNewStartChat,
|
|
95
|
+
handleHistoryClick,
|
|
96
|
+
handleGoRequestPhone,
|
|
97
|
+
handleGoHistoryPhoneAuth,
|
|
98
|
+
handleBackClick
|
|
99
|
+
} = useHistoryView({
|
|
100
|
+
attendRoomByHistory,
|
|
101
|
+
startSelectedChat,
|
|
102
|
+
setViewState,
|
|
103
|
+
// setIsLoading,
|
|
104
|
+
createNewChat,
|
|
105
|
+
goRequestPhone,
|
|
106
|
+
goHistoryPhoneAuth,
|
|
107
|
+
chatInquiryNumber
|
|
108
|
+
// setPreviewState
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// useEffect(() => {
|
|
112
|
+
// if (hashValue && isConnected && inquiryMainData && inquiryMainData.channel_number) {
|
|
113
|
+
// handleHashStartChat();
|
|
114
|
+
// } else {
|
|
115
|
+
// }
|
|
116
|
+
// }, [hashValue, isConnected, inquiryMainData]);
|
|
117
|
+
|
|
118
|
+
// viewState 진입
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (isAuthenticated && viewState === 'history') {
|
|
121
|
+
goGetHistoryList({});
|
|
122
|
+
}
|
|
123
|
+
if (isAuthenticated && viewState === 'conversation') {
|
|
124
|
+
setIsTyping(false);
|
|
125
|
+
}
|
|
126
|
+
}, [viewState, isAuthenticated]);
|
|
127
|
+
|
|
128
|
+
// useEffect(() => {
|
|
129
|
+
// if (inquiryMainData !== null) {
|
|
130
|
+
// if (!inquiryMainData?.channel_number) {
|
|
131
|
+
// retryInitData();
|
|
132
|
+
// }
|
|
133
|
+
// }
|
|
134
|
+
// }, [inquiryMainData, inquiryMainData?.channel_number]);
|
|
135
|
+
|
|
136
|
+
const renderWithNavigation = (content: React.ReactNode, activeView: 'history' | 'conversation') => {
|
|
137
|
+
return (
|
|
138
|
+
//
|
|
139
|
+
<main
|
|
140
|
+
className={`
|
|
141
|
+
relative flex justify-end bg-white
|
|
142
|
+
${isMobile ? 'h-full w-full' : 'h-[100dvh] xs:h-auto xs:rounded-[30px] '}
|
|
143
|
+
`}
|
|
144
|
+
style={{
|
|
145
|
+
boxShadow: '0px 0px 20px 0px #00000040'
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
<div
|
|
149
|
+
className={`
|
|
150
|
+
relative overflow-hidden
|
|
151
|
+
${
|
|
152
|
+
isMobile
|
|
153
|
+
? `h-full w-screen rounded-[0px]`
|
|
154
|
+
: `
|
|
155
|
+
${
|
|
156
|
+
isHash
|
|
157
|
+
? `
|
|
158
|
+
h-[100dvh] w-full rounded-[0px]
|
|
159
|
+
xs:max-h-[690px] xs:w-[390px] xs:rounded-[30px]
|
|
160
|
+
xs:shadow-[0px_12px_60px_5px_rgba(0,0,0,0.3)]
|
|
161
|
+
`
|
|
162
|
+
: `
|
|
163
|
+
w-screen rounded-[0px]
|
|
164
|
+
xs:w-[390px] xs:rounded-[30px]
|
|
165
|
+
`
|
|
166
|
+
}
|
|
167
|
+
`
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
`}
|
|
171
|
+
>
|
|
172
|
+
<div
|
|
173
|
+
className=' flex h-full flex-col justify-between border-[0px] border-solid xs:justify-start xs:rounded-[30px]'>
|
|
174
|
+
<div
|
|
175
|
+
className={`
|
|
176
|
+
no-scrollbar ${isMobile ? 'h-full' : ` overflow-hidden xs:overflow-auto `}
|
|
177
|
+
`}
|
|
178
|
+
>
|
|
179
|
+
{content}
|
|
180
|
+
</div>
|
|
181
|
+
{/* 얘는 아래 64px로 고정 */}
|
|
182
|
+
{/* <div className={`!z-[50]`}>
|
|
183
|
+
<NavigationFooter
|
|
184
|
+
activeView={activeView}
|
|
185
|
+
onHomeClick={handleHomeClick}
|
|
186
|
+
onHistoryClick={handleHistoryClick}
|
|
187
|
+
historyList={historyList}
|
|
188
|
+
isAuthenticated={isAuthenticated}
|
|
189
|
+
/>
|
|
190
|
+
</div> */}
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
{/*얘는 abolute라서 고려 X*/}
|
|
194
|
+
<ToastRenderer />
|
|
195
|
+
<FixedErrorBox
|
|
196
|
+
isError={isUserExpired || (isConnected === null ? false : !isConnected)}
|
|
197
|
+
message={
|
|
198
|
+
isUserExpired
|
|
199
|
+
? `다른 기기에서 채팅 중입니다.\n새로고침 후 이 기기에서 다시 이용할 수 있습니다.`
|
|
200
|
+
: undefined
|
|
201
|
+
}
|
|
202
|
+
/>
|
|
203
|
+
</main>
|
|
204
|
+
);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
if (viewState === 'history') {
|
|
208
|
+
return renderWithNavigation(
|
|
209
|
+
<HistoryView
|
|
210
|
+
onBackClick={handleBackClick}
|
|
211
|
+
onChatHistoryClick={handleChatHistoryClick}
|
|
212
|
+
onNewChatClick={handleNewStartChat}
|
|
213
|
+
isAuthenticated={isAuthenticated ?? false}
|
|
214
|
+
historyLit={historyList ?? []}
|
|
215
|
+
goGetHistoryList={goGetHistoryList}
|
|
216
|
+
isMobile={isMobile}
|
|
217
|
+
onClose={onClose}
|
|
218
|
+
isHash={isHash}
|
|
219
|
+
handleGoRequestPhone={handleGoRequestPhone}
|
|
220
|
+
handleGoHistoryPhoneAuth={handleGoHistoryPhoneAuth}
|
|
221
|
+
/>,
|
|
222
|
+
'history'
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
// 채팅 문의 창
|
|
226
|
+
// if (viewState === 'conversation') {
|
|
227
|
+
return renderWithNavigation(
|
|
228
|
+
<ChatConversation
|
|
229
|
+
// onBackClick={handleBackToHome}
|
|
230
|
+
isActive={viewState === 'conversation'}
|
|
231
|
+
initialLoading={initialLoading}
|
|
232
|
+
onChatNew={handleNewStartChat}
|
|
233
|
+
isMobile={isMobile}
|
|
234
|
+
onClose={onClose}
|
|
235
|
+
isHash={isHash}
|
|
236
|
+
viewState={viewState}
|
|
237
|
+
handleHistoryClick={handleHistoryClick}
|
|
238
|
+
isAuthenticated={isAuthenticated ?? false}
|
|
239
|
+
historyList={historyList ?? []}
|
|
240
|
+
ageCheckStatus={ageCheckStatus}
|
|
241
|
+
isMobileSafari={isMobileSafari}
|
|
242
|
+
androidViewportHeight={androidViewportHeight}
|
|
243
|
+
/>,
|
|
244
|
+
'conversation'
|
|
245
|
+
);
|
|
246
|
+
// }
|
|
247
|
+
|
|
248
|
+
// // 홈
|
|
249
|
+
// return renderWithNavigation(
|
|
250
|
+
// <HomeView
|
|
251
|
+
// inquiryMainData={inquiryMainData ?? null}
|
|
252
|
+
// isLoading={isLoading}
|
|
253
|
+
// handleStartChat={handleStartChat}
|
|
254
|
+
// isMobile={isMobile}
|
|
255
|
+
// onClose={onClose}
|
|
256
|
+
// isHash={isHash}
|
|
257
|
+
// />,
|
|
258
|
+
// 'home'
|
|
259
|
+
// );
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export default ChatHomeView;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
4
|
+
import Tiptap from './Tiptap/Tiptap';
|
|
5
|
+
import { stripHtmlTags } from './_lib/utils';
|
|
6
|
+
import DisabledInput from './Tiptap/DisabledInput';
|
|
7
|
+
import Image from 'next/image';
|
|
8
|
+
const ChatInput = ({ isMobile, isNotAgeCheck, chatInquiryNumber }) => {
|
|
9
|
+
const s3Url = process.env.NEXT_PUBLIC_S3_URL;
|
|
10
|
+
const SendIcon = `${s3Url}/daeryuntalk/send.svg`;
|
|
11
|
+
const [message, setMessage] = useState('');
|
|
12
|
+
const { sendMessage, isLoading } = useDaeryuntalk();
|
|
13
|
+
const tiptapRef = useRef(null);
|
|
14
|
+
const isEmpty = useMemo(() => {
|
|
15
|
+
return !stripHtmlTags(message);
|
|
16
|
+
}, [message]);
|
|
17
|
+
// useEffect(() => {
|
|
18
|
+
// setIsEmpty(!stripHtmlTags(message));
|
|
19
|
+
// }, [message]);
|
|
20
|
+
const handleSubmit = (e) => {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
if (message.trim() && !isLoading) {
|
|
24
|
+
const html = ((_a = tiptapRef.current) === null || _a === void 0 ? void 0 : _a.getHTML()) || ''; // HTML 형태
|
|
25
|
+
const json = ((_b = tiptapRef.current) === null || _b === void 0 ? void 0 : _b.getJSON()) || {}; // JSON 형태
|
|
26
|
+
setMessage('');
|
|
27
|
+
sendMessage(html, json);
|
|
28
|
+
(_c = tiptapRef.current) === null || _c === void 0 ? void 0 : _c.clearContent(); // 입력창 초기화
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const handleEnter = () => {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
if (message.trim() && !isLoading) {
|
|
34
|
+
const html = ((_a = tiptapRef.current) === null || _a === void 0 ? void 0 : _a.getHTML()) || ''; // HTML 형태
|
|
35
|
+
const json = ((_b = tiptapRef.current) === null || _b === void 0 ? void 0 : _b.getJSON()) || {}; // JSON 형태
|
|
36
|
+
sendMessage(html, json);
|
|
37
|
+
setMessage('');
|
|
38
|
+
(_c = tiptapRef.current) === null || _c === void 0 ? void 0 : _c.clearContent(); // 입력창 초기화
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return (<form onSubmit={handleSubmit} className="flex w-full items-center gap-2">
|
|
42
|
+
<div className={`${isNotAgeCheck ? 'bg-drTalkGrayscale4' : 'bg-drTalkGrayscale5'} flex flex-1 justify-center gap-[10px] rounded-[10px] border-[1px] border-solid border-drTalkGrayscale5 p-[4px]`}>
|
|
43
|
+
{/* 최초 높이 44 */}
|
|
44
|
+
{/*내용이 2줄 이상되면 입력창 높이도 키워져야합니다. 최대한 4줄까지만 보이도록 해주시고, 그 이상은 스크롤 될 수 있도록 해주시는 게 좋을 것 같습니다. max height 값을 72로 지정 부탁드립니다*/}
|
|
45
|
+
|
|
46
|
+
{isNotAgeCheck ? (<DisabledInput placeholder="만 14세 이상 확인 후 이용 가능합니다."/>) : (<Tiptap key={`${chatInquiryNumber}-${isNotAgeCheck}`} ref={tiptapRef} onChange={setMessage} onEnterKeyPress={handleEnter} placeholder={'상담내용을 입력해 주세요.'} contentClassName="!outline-none !border-[0px] !pt-[4px] !pl-[4px]" isMobile={isMobile}/>)}
|
|
47
|
+
|
|
48
|
+
<div className={`flex flex-col justify-end`}>
|
|
49
|
+
<button type="submit" className={`flex h-10 w-10 items-center justify-center rounded-[8px] bg-drTalkBtnActive2 text-white
|
|
50
|
+
${isLoading || isNotAgeCheck
|
|
51
|
+
? 'cursor-not-allowed opacity-50'
|
|
52
|
+
: isEmpty
|
|
53
|
+
? ' bg-drTalkBtnActive2 '
|
|
54
|
+
: ' bg-drTalkCrimson '}`} disabled={isLoading || isNotAgeCheck}>
|
|
55
|
+
<div className="flex h-9 w-9 items-center justify-center">
|
|
56
|
+
<Image src={SendIcon} alt="전송" width={24} height={24}/>
|
|
57
|
+
{/* <SendIcon width={24} height={24} /> */}
|
|
58
|
+
</div>
|
|
59
|
+
</button>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</form>);
|
|
63
|
+
};
|
|
64
|
+
export default ChatInput;
|