@daeryun/dr_components 1.2.17 → 1.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Daeryuntalk/ChatButton.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/banner/TopBanner.jsx +2 -2
- package/dist/components/banner/TopBanner.tsx +4 -2
- package/dist/styles/globals.css +5 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
12
|
+
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
13
|
+
import useBrowser from '../common/hook/useBrowser';
|
|
14
|
+
const ChatButton = ({ isOpen, onClick, apiVersion, isMobile = false, hashValue = null, bannerHeight = 0 }) => {
|
|
15
|
+
const { initializeDaeryuntalk, centerCode } = useDaeryuntalk();
|
|
16
|
+
const { width } = useBrowser();
|
|
17
|
+
const [isScrollTop, setIsScrollTop] = useState(true);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const handleScroll = () => {
|
|
20
|
+
const scrollTop = window.scrollY || document.documentElement.scrollTop;
|
|
21
|
+
setIsScrollTop(scrollTop === 0);
|
|
22
|
+
};
|
|
23
|
+
handleScroll();
|
|
24
|
+
window.addEventListener('scroll', handleScroll);
|
|
25
|
+
return () => {
|
|
26
|
+
window.removeEventListener('scroll', handleScroll);
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
const handleClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
onClick();
|
|
31
|
+
if (!isOpen) {
|
|
32
|
+
try {
|
|
33
|
+
yield initializeDaeryuntalk('', isOpen, centerCode, apiVersion);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
console.error('Daeryuntalk 초기화 실패:', err);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}), [isOpen, onClick, initializeDaeryuntalk, apiVersion]);
|
|
40
|
+
// 해쉬 있을 경우
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (hashValue) {
|
|
43
|
+
const init = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
|
+
try {
|
|
45
|
+
yield initializeDaeryuntalk(hashValue, isOpen, centerCode, apiVersion);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
console.error('해시 기반 Daeryuntalk 초기화 실패:', err);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
init();
|
|
52
|
+
}
|
|
53
|
+
}, [hashValue]);
|
|
54
|
+
return (<button aria-label="채팅 상담 열기" onClick={handleClick} style={{
|
|
55
|
+
bottom: bannerHeight > 0 && (!isScrollTop || width >= 1024)
|
|
56
|
+
? width >= 1024
|
|
57
|
+
? `${bannerHeight + 20}px`
|
|
58
|
+
: `${bannerHeight + 78}px`
|
|
59
|
+
: width >= 1024
|
|
60
|
+
? '20px'
|
|
61
|
+
: '88px'
|
|
62
|
+
}} className={`
|
|
63
|
+
${isOpen ? 'hidden h-[50px] w-[50px] xs:block ' : 'h-[70px] w-[70px] 5xl:h-[100px] 5xl:w-[100px]'}
|
|
64
|
+
${hashValue ? 'pointer-events-none opacity-0' : ''}
|
|
65
|
+
fixed right-[10px] rounded-[10px] border lg:right-[25px]
|
|
66
|
+
${isOpen ? 'border-gray-200 bg-white' : 'border-[#AA1D36] bg-[#AA1D36]'}
|
|
67
|
+
z-[50] flex transform cursor-pointer items-center justify-center
|
|
68
|
+
p-0 shadow-lg outline-none transition-all duration-300 ease-in-out
|
|
69
|
+
hover:${isOpen ? 'bg-gray-100' : 'bg-[#8A1729]'}
|
|
70
|
+
`}>
|
|
71
|
+
{!isOpen && (<span style={{
|
|
72
|
+
position: 'absolute',
|
|
73
|
+
inset: '0',
|
|
74
|
+
border: '2px solid #aa1d36',
|
|
75
|
+
borderRadius: '10px',
|
|
76
|
+
pointerEvents: 'none',
|
|
77
|
+
animation: 'pulseBox 1.5s infinite ease-out'
|
|
78
|
+
}}/>)}
|
|
79
|
+
|
|
80
|
+
<div className={`
|
|
81
|
+
absolute inset-0 flex flex-col items-center justify-center gap-[4px]
|
|
82
|
+
transition-opacity duration-300 ease-in-out
|
|
83
|
+
${isOpen ? 'opacity-0' : 'opacity-100'}
|
|
84
|
+
`}>
|
|
85
|
+
<div className="h-[28px] w-[28px] 5xl:h-[40px] 5xl:w-[40px]">
|
|
86
|
+
<svg width="100%" height="100%" viewBox="0 0 40 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
87
|
+
<path d="M36.5048 11.4403C36.4671 11.4403 36.4357 11.4403 36.4044 11.4403C33.7626 5.17055 27.5191 0.75 20.2527 0.75C12.9864 0.75 6.74281 5.17055 4.10106 11.4403C4.06969 11.4403 4.03205 11.4403 4.00068 11.4403C2.17468 11.4403 0.6875 12.9159 0.6875 14.7277V21.5079C0.6875 23.3197 2.17468 24.7953 4.00068 24.7953C5.82668 24.7953 7.31382 23.3197 7.31382 21.5079V14.7277C7.31382 13.8373 6.95616 13.0342 6.37886 12.4427C8.63156 7.0384 14.0029 3.22178 20.2527 3.22178C26.5025 3.22178 31.8739 7.03217 34.1266 12.4427C33.5493 13.0342 33.1916 13.8373 33.1916 14.7277V21.5079C33.1916 22.3983 33.5493 23.2014 34.1266 23.7929C32.2692 28.2508 28.2909 31.6192 23.453 32.6652C22.8004 31.5818 21.6144 30.8533 20.2527 30.8533C18.2008 30.8533 16.5254 32.5095 16.5254 34.5517C16.5254 36.5938 18.1945 38.25 20.2527 38.25C22.1226 38.25 23.6725 36.874 23.9361 35.0871C29.5773 33.8793 34.2207 29.9692 36.4044 24.7891C36.4357 24.7891 36.4734 24.7891 36.5048 24.7891C38.3308 24.7891 39.8179 23.3135 39.8179 21.5017V14.7214C39.8179 12.9096 38.3308 11.434 36.5048 11.434V11.4403Z" fill="white"/>
|
|
88
|
+
<path d="M23.1823 25.5673V21.6261H24.4623C27.1166 21.6261 29.2752 19.4906 29.2752 16.8507C29.2752 14.2108 27.1229 12.0753 24.4623 12.0753H16.0414C13.3871 12.0753 11.2285 14.2108 11.2285 16.8507C11.2285 19.4906 13.3808 21.6261 16.0414 21.6261H19.342L23.1823 25.5673Z" fill="white"/>
|
|
89
|
+
</svg>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<span className="text-[12px] font-[800] tracking-[-4%] text-white 5xl:text-[16px]">1:1 상담</span>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div className={`
|
|
96
|
+
absolute inset-0 flex items-center justify-center
|
|
97
|
+
transition-opacity duration-300 ease-in-out
|
|
98
|
+
${!isOpen ? 'opacity-0' : 'opacity-100'}
|
|
99
|
+
`}>
|
|
100
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
101
|
+
<path d="M6 6L18 18" stroke="#777777" strokeWidth="2" strokeLinecap="round"/>
|
|
102
|
+
<path d="M18 6L6 18" stroke="#777777" strokeWidth="2" strokeLinecap="round"/>
|
|
103
|
+
</svg>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
{/* 어디든 1회 선언 필요 */}
|
|
107
|
+
<style>
|
|
108
|
+
{`
|
|
109
|
+
@keyframes pulseBox {
|
|
110
|
+
0% {
|
|
111
|
+
transform: scale(1);
|
|
112
|
+
opacity: 0.6;
|
|
113
|
+
}
|
|
114
|
+
100% {
|
|
115
|
+
transform: scale(1.3);
|
|
116
|
+
opacity: 0;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
`}
|
|
120
|
+
</style>
|
|
121
|
+
</button>);
|
|
122
|
+
};
|
|
123
|
+
export default ChatButton;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
4
|
+
import useBrowser from '../common/hook/useBrowser';
|
|
5
|
+
|
|
6
|
+
interface ChatButtonProps {
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
apiVersion?: string;
|
|
10
|
+
isMobile?: boolean;
|
|
11
|
+
hashValue?: string | null;
|
|
12
|
+
bannerHeight?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const ChatButton: React.FC<ChatButtonProps> = ({
|
|
16
|
+
isOpen,
|
|
17
|
+
onClick,
|
|
18
|
+
apiVersion,
|
|
19
|
+
isMobile = false,
|
|
20
|
+
hashValue = null,
|
|
21
|
+
bannerHeight = 0
|
|
22
|
+
}) => {
|
|
23
|
+
const { initializeDaeryuntalk, centerCode } = useDaeryuntalk();
|
|
24
|
+
const { width } = useBrowser();
|
|
25
|
+
const [isScrollTop, setIsScrollTop] = useState(true);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const handleScroll = () => {
|
|
29
|
+
const scrollTop = window.scrollY || document.documentElement.scrollTop;
|
|
30
|
+
setIsScrollTop(scrollTop === 0);
|
|
31
|
+
};
|
|
32
|
+
handleScroll();
|
|
33
|
+
|
|
34
|
+
window.addEventListener('scroll', handleScroll);
|
|
35
|
+
|
|
36
|
+
return () => {
|
|
37
|
+
window.removeEventListener('scroll', handleScroll);
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
const handleClick = useCallback(async () => {
|
|
42
|
+
onClick();
|
|
43
|
+
if (!isOpen) {
|
|
44
|
+
try {
|
|
45
|
+
await initializeDaeryuntalk('', isOpen, centerCode, apiVersion);
|
|
46
|
+
} catch (err) {
|
|
47
|
+
console.error('Daeryuntalk 초기화 실패:', err);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, [isOpen, onClick, initializeDaeryuntalk, apiVersion]);
|
|
51
|
+
|
|
52
|
+
// 해쉬 있을 경우
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (hashValue) {
|
|
55
|
+
const init = async () => {
|
|
56
|
+
try {
|
|
57
|
+
await initializeDaeryuntalk(hashValue, isOpen, centerCode, apiVersion);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
console.error('해시 기반 Daeryuntalk 초기화 실패:', err);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
init();
|
|
63
|
+
}
|
|
64
|
+
}, [hashValue]);
|
|
65
|
+
return (
|
|
66
|
+
<button
|
|
67
|
+
aria-label="채팅 상담 열기"
|
|
68
|
+
onClick={handleClick}
|
|
69
|
+
style={{
|
|
70
|
+
bottom:
|
|
71
|
+
bannerHeight > 0 && (!isScrollTop || width >= 1024)
|
|
72
|
+
? width >= 1024
|
|
73
|
+
? `${bannerHeight + 20}px`
|
|
74
|
+
: `${bannerHeight + 78}px`
|
|
75
|
+
: width >= 1024
|
|
76
|
+
? '20px'
|
|
77
|
+
: '88px'
|
|
78
|
+
}}
|
|
79
|
+
className={`
|
|
80
|
+
${isOpen ? 'hidden h-[50px] w-[50px] xs:block ' : 'h-[70px] w-[70px] 5xl:h-[100px] 5xl:w-[100px]'}
|
|
81
|
+
${hashValue ? 'pointer-events-none opacity-0' : ''}
|
|
82
|
+
fixed right-[10px] rounded-[10px] border lg:right-[25px]
|
|
83
|
+
${isOpen ? 'border-gray-200 bg-white' : 'border-[#AA1D36] bg-[#AA1D36]'}
|
|
84
|
+
z-[50] flex transform cursor-pointer items-center justify-center
|
|
85
|
+
p-0 shadow-lg outline-none transition-all duration-300 ease-in-out
|
|
86
|
+
hover:${isOpen ? 'bg-gray-100' : 'bg-[#8A1729]'}
|
|
87
|
+
`}
|
|
88
|
+
>
|
|
89
|
+
{!isOpen && (
|
|
90
|
+
<span
|
|
91
|
+
style={{
|
|
92
|
+
position: 'absolute',
|
|
93
|
+
inset: '0',
|
|
94
|
+
border: '2px solid #aa1d36',
|
|
95
|
+
borderRadius: '10px',
|
|
96
|
+
pointerEvents: 'none',
|
|
97
|
+
animation: 'pulseBox 1.5s infinite ease-out'
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
)}
|
|
101
|
+
|
|
102
|
+
<div
|
|
103
|
+
className={`
|
|
104
|
+
absolute inset-0 flex flex-col items-center justify-center gap-[4px]
|
|
105
|
+
transition-opacity duration-300 ease-in-out
|
|
106
|
+
${isOpen ? 'opacity-0' : 'opacity-100'}
|
|
107
|
+
`}
|
|
108
|
+
>
|
|
109
|
+
<div className="h-[28px] w-[28px] 5xl:h-[40px] 5xl:w-[40px]">
|
|
110
|
+
<svg width="100%" height="100%" viewBox="0 0 40 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
111
|
+
<path
|
|
112
|
+
d="M36.5048 11.4403C36.4671 11.4403 36.4357 11.4403 36.4044 11.4403C33.7626 5.17055 27.5191 0.75 20.2527 0.75C12.9864 0.75 6.74281 5.17055 4.10106 11.4403C4.06969 11.4403 4.03205 11.4403 4.00068 11.4403C2.17468 11.4403 0.6875 12.9159 0.6875 14.7277V21.5079C0.6875 23.3197 2.17468 24.7953 4.00068 24.7953C5.82668 24.7953 7.31382 23.3197 7.31382 21.5079V14.7277C7.31382 13.8373 6.95616 13.0342 6.37886 12.4427C8.63156 7.0384 14.0029 3.22178 20.2527 3.22178C26.5025 3.22178 31.8739 7.03217 34.1266 12.4427C33.5493 13.0342 33.1916 13.8373 33.1916 14.7277V21.5079C33.1916 22.3983 33.5493 23.2014 34.1266 23.7929C32.2692 28.2508 28.2909 31.6192 23.453 32.6652C22.8004 31.5818 21.6144 30.8533 20.2527 30.8533C18.2008 30.8533 16.5254 32.5095 16.5254 34.5517C16.5254 36.5938 18.1945 38.25 20.2527 38.25C22.1226 38.25 23.6725 36.874 23.9361 35.0871C29.5773 33.8793 34.2207 29.9692 36.4044 24.7891C36.4357 24.7891 36.4734 24.7891 36.5048 24.7891C38.3308 24.7891 39.8179 23.3135 39.8179 21.5017V14.7214C39.8179 12.9096 38.3308 11.434 36.5048 11.434V11.4403Z"
|
|
113
|
+
fill="white"
|
|
114
|
+
/>
|
|
115
|
+
<path
|
|
116
|
+
d="M23.1823 25.5673V21.6261H24.4623C27.1166 21.6261 29.2752 19.4906 29.2752 16.8507C29.2752 14.2108 27.1229 12.0753 24.4623 12.0753H16.0414C13.3871 12.0753 11.2285 14.2108 11.2285 16.8507C11.2285 19.4906 13.3808 21.6261 16.0414 21.6261H19.342L23.1823 25.5673Z"
|
|
117
|
+
fill="white"
|
|
118
|
+
/>
|
|
119
|
+
</svg>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<span className="text-[12px] font-[800] tracking-[-4%] text-white 5xl:text-[16px]">1:1 상담</span>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<div
|
|
126
|
+
className={`
|
|
127
|
+
absolute inset-0 flex items-center justify-center
|
|
128
|
+
transition-opacity duration-300 ease-in-out
|
|
129
|
+
${!isOpen ? 'opacity-0' : 'opacity-100'}
|
|
130
|
+
`}
|
|
131
|
+
>
|
|
132
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
133
|
+
<path d="M6 6L18 18" stroke="#777777" strokeWidth="2" strokeLinecap="round" />
|
|
134
|
+
<path d="M18 6L6 18" stroke="#777777" strokeWidth="2" strokeLinecap="round" />
|
|
135
|
+
</svg>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
{/* 어디든 1회 선언 필요 */}
|
|
139
|
+
<style>
|
|
140
|
+
{`
|
|
141
|
+
@keyframes pulseBox {
|
|
142
|
+
0% {
|
|
143
|
+
transform: scale(1);
|
|
144
|
+
opacity: 0.6;
|
|
145
|
+
}
|
|
146
|
+
100% {
|
|
147
|
+
transform: scale(1.3);
|
|
148
|
+
opacity: 0;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
`}
|
|
152
|
+
</style>
|
|
153
|
+
</button>
|
|
154
|
+
);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export default ChatButton;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewState } from './ChatHomeView';
|
|
3
|
+
import { History } from './_api/daeryuntalk/type/response';
|
|
4
|
+
import { AgeCheckStatusEnums } from './_enums/ags_check_status';
|
|
5
|
+
type ChatConversationProps = {
|
|
6
|
+
onChatNew?: () => void;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
isMobile: boolean;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
isHash: boolean;
|
|
11
|
+
initialLoading: boolean | null;
|
|
12
|
+
viewState: ViewState;
|
|
13
|
+
handleHistoryClick?: () => void;
|
|
14
|
+
isAuthenticated: boolean;
|
|
15
|
+
historyList: History[];
|
|
16
|
+
ageCheckStatus: AgeCheckStatusEnums | null;
|
|
17
|
+
isMobileSafari?: boolean;
|
|
18
|
+
androidViewportHeight?: number;
|
|
19
|
+
};
|
|
20
|
+
declare const ChatConversation: React.FC<ChatConversationProps>;
|
|
21
|
+
export default ChatConversation;
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
12
|
+
import { useDaeryuntalk } from './DaeryuntalkContext';
|
|
13
|
+
import ChatMessage from './ChatMessage';
|
|
14
|
+
import ChatInput from './ChatInput';
|
|
15
|
+
import NoticeMessage from './NoticeMessage';
|
|
16
|
+
import DateSeparator from './DateSeparator';
|
|
17
|
+
import { InquiryStatusEnum } from './_enums/ask-status';
|
|
18
|
+
import Button3 from './_ui/buttons/Button3';
|
|
19
|
+
import ChatConversationHeader from './ChatConversationItem/ChatConversationHeader';
|
|
20
|
+
import ChatLoading from './ChatItem/ChatLoading';
|
|
21
|
+
import { useWindowSize } from './_hooks/useWindowSize';
|
|
22
|
+
import TypingComp from './ChatItem/TypingComp';
|
|
23
|
+
import { useHoverScrollbar } from './_hooks/useHoverScrollbar';
|
|
24
|
+
import AgeCheckBox from './ChatItem/AgeCheckBox';
|
|
25
|
+
import { AgeCheckStatusEnums } from './_enums/ags_check_status';
|
|
26
|
+
const ChatConversation = ({
|
|
27
|
+
// onBackClick,
|
|
28
|
+
onChatNew, isActive, isMobile, onClose, isHash, initialLoading, viewState, handleHistoryClick, isAuthenticated, historyList, ageCheckStatus, isMobileSafari = false, androidViewportHeight = 0 }) => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const { getNextMessageList, isNextPage, inquiryStatus, messages, isLoading, inquiryMainData, messageObject, workFlowBack, workFlowStack, chatInquiryNumber, isTyping, ageConfirm } = useDaeryuntalk();
|
|
31
|
+
const isNotAgeCheck = ageCheckStatus === AgeCheckStatusEnums.DISAGREED;
|
|
32
|
+
const [isFetchingPrev, setIsFetchingPrev] = useState(false);
|
|
33
|
+
const sortedMessages = useMemo(() => {
|
|
34
|
+
return (messages === null || messages === void 0 ? void 0 : messages.length) ? messages.slice().sort((a, b) => a.timestamp - b.timestamp) : [];
|
|
35
|
+
}, [messages]);
|
|
36
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
37
|
+
const headerRef = useRef(null);
|
|
38
|
+
const pcBottomRef = useRef(null);
|
|
39
|
+
const [bottomHeight, setBottomHeight] = useState(0);
|
|
40
|
+
const isClosed = inquiryStatus === InquiryStatusEnum.CLOSED;
|
|
41
|
+
const windowSize = useWindowSize();
|
|
42
|
+
// 최초 렌더 여부 플래그
|
|
43
|
+
const isInitialMount = useRef(true);
|
|
44
|
+
// 이후
|
|
45
|
+
const messagesContainerRef = useRef(null);
|
|
46
|
+
const messagesEndRef = useRef(null);
|
|
47
|
+
const { style: hoverStyle } = useHoverScrollbar(messagesContainerRef, [messages.length]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
const bottomRef = pcBottomRef;
|
|
50
|
+
let retries = 10;
|
|
51
|
+
const tryMeasure = () => {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
const height = (_b = (_a = bottomRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height) !== null && _b !== void 0 ? _b : 0;
|
|
54
|
+
console.log('measure:', height);
|
|
55
|
+
if (height > 0 || retries-- <= 0) {
|
|
56
|
+
setBottomHeight(height);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
requestAnimationFrame(tryMeasure);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
tryMeasure();
|
|
63
|
+
}, [windowSize.width]);
|
|
64
|
+
const defaultNoticeContent = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_explanation) || '';
|
|
65
|
+
const noticeContent = defaultNoticeContent;
|
|
66
|
+
const scrollEnd = () => {
|
|
67
|
+
var _a;
|
|
68
|
+
(_a = messagesEndRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: 'smooth' });
|
|
69
|
+
};
|
|
70
|
+
// 새 메시지가 도착할 때 자동으로 스크롤 최하단으로 이동 sortedMessages의 마지막 행에 type이 live일 경우만 scrollEnd 실행
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const lastMessage = sortedMessages && sortedMessages.length > 0 && sortedMessages[sortedMessages.length - 1];
|
|
73
|
+
if (!lastMessage || (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type) !== 'live')
|
|
74
|
+
return;
|
|
75
|
+
const timeout = setTimeout(() => {
|
|
76
|
+
scrollEnd();
|
|
77
|
+
}, 200);
|
|
78
|
+
return () => clearTimeout(timeout); // cleanup
|
|
79
|
+
}, [sortedMessages, messageObject]);
|
|
80
|
+
// 최초 진입 시 스크롤 최하단으로 이동
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!isInitialMount.current)
|
|
83
|
+
return;
|
|
84
|
+
if (sortedMessages.length === 0)
|
|
85
|
+
return;
|
|
86
|
+
const container = messagesContainerRef.current;
|
|
87
|
+
if (!container)
|
|
88
|
+
return;
|
|
89
|
+
const images = container.querySelectorAll('img');
|
|
90
|
+
let hasScrolled = false;
|
|
91
|
+
const scrollToBottom = () => {
|
|
92
|
+
if (hasScrolled)
|
|
93
|
+
return;
|
|
94
|
+
hasScrolled = true;
|
|
95
|
+
requestAnimationFrame(() => {
|
|
96
|
+
scrollEnd(); // 무조건 실행
|
|
97
|
+
isInitialMount.current = false;
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
if (images.length === 0) {
|
|
101
|
+
scrollToBottom();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
let loaded = 0;
|
|
105
|
+
const total = images.length;
|
|
106
|
+
images.forEach(img => {
|
|
107
|
+
const done = () => {
|
|
108
|
+
loaded++;
|
|
109
|
+
if (loaded === total) {
|
|
110
|
+
setTimeout(scrollToBottom, 50);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
if (img.complete) {
|
|
114
|
+
// 강제 로드 보장
|
|
115
|
+
const newImg = new Image();
|
|
116
|
+
newImg.src = img.src;
|
|
117
|
+
newImg.onload = done;
|
|
118
|
+
newImg.onerror = done;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
img.addEventListener('load', done, { once: true });
|
|
122
|
+
img.addEventListener('error', done, { once: true });
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
// fallback 타이머로 scrollToBottom 보장 (예: 이미지 로딩 실패 시)
|
|
126
|
+
const fallback = setTimeout(() => {
|
|
127
|
+
scrollToBottom();
|
|
128
|
+
}, 500); // 1초 후 강제 실행
|
|
129
|
+
return () => clearTimeout(fallback);
|
|
130
|
+
}, [sortedMessages, messageObject]);
|
|
131
|
+
// 무한 스크롤
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
const container = messagesContainerRef.current;
|
|
134
|
+
if (!container || !isNextPage || !chatInquiryNumber || sortedMessages.length === 0)
|
|
135
|
+
return;
|
|
136
|
+
const handleScroll = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
137
|
+
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
138
|
+
// 스크롤이 없더라도 무시하지 않음! → handleScroll은 무한스크롤 용도에만 사용
|
|
139
|
+
const scrolledPercent = (scrollTop / scrollHeight) * 100;
|
|
140
|
+
if (scrolledPercent < 5 && !isFetchingPrev) {
|
|
141
|
+
setIsFetchingPrev(true);
|
|
142
|
+
const prevScrollHeight = container.scrollHeight;
|
|
143
|
+
const oldestMessage = sortedMessages[0];
|
|
144
|
+
if (!(oldestMessage === null || oldestMessage === void 0 ? void 0 : oldestMessage.createdAt))
|
|
145
|
+
return;
|
|
146
|
+
try {
|
|
147
|
+
yield getNextMessageList(chatInquiryNumber, oldestMessage.timestamp);
|
|
148
|
+
requestAnimationFrame(() => {
|
|
149
|
+
const newScrollHeight = container.scrollHeight;
|
|
150
|
+
container.scrollTop = newScrollHeight - prevScrollHeight;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
setIsFetchingPrev(false);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
handleScroll();
|
|
159
|
+
container.addEventListener('scroll', handleScroll);
|
|
160
|
+
return () => container.removeEventListener('scroll', handleScroll);
|
|
161
|
+
}, [sortedMessages, chatInquiryNumber, isNextPage, isFetchingPrev, getNextMessageList]);
|
|
162
|
+
const isNewDay = (date1, date2) => {
|
|
163
|
+
return (date1.getFullYear() !== date2.getFullYear() ||
|
|
164
|
+
date1.getMonth() !== date2.getMonth() ||
|
|
165
|
+
date1.getDate() !== date2.getDate());
|
|
166
|
+
};
|
|
167
|
+
const renderedMessages = useMemo(() => {
|
|
168
|
+
const elements = [];
|
|
169
|
+
if (sortedMessages.length < 1) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
sortedMessages.forEach((message, index) => {
|
|
173
|
+
const findObject = message.workFlow &&
|
|
174
|
+
(messageObject === null || messageObject === void 0 ? void 0 : messageObject.exposeObjectListYn) &&
|
|
175
|
+
(messageObject === null || messageObject === void 0 ? void 0 : messageObject.messageNumber) === message.messageNumber
|
|
176
|
+
? messageObject
|
|
177
|
+
: null;
|
|
178
|
+
if (index === 0 || isNewDay(message.createdAt, sortedMessages[index - 1].createdAt)) {
|
|
179
|
+
elements.push(<DateSeparator key={`date-${message.messageNumber}`} date={message.createdAt}/>);
|
|
180
|
+
}
|
|
181
|
+
elements.push(<ChatMessage isMobile={isMobile} inquiryStatus={inquiryStatus} key={message.messageNumber} message={message} object={findObject} handelObjectBack={workFlowBack} chatInquiryNumber={chatInquiryNumber || ''} workFlowStack={workFlowStack} isHovered={isHovered} scrollEnd={scrollEnd}/>);
|
|
182
|
+
});
|
|
183
|
+
return elements;
|
|
184
|
+
}, [
|
|
185
|
+
sortedMessages,
|
|
186
|
+
messageObject, // 둘 다 바뀌면 리렌더됨
|
|
187
|
+
isMobile,
|
|
188
|
+
inquiryStatus,
|
|
189
|
+
workFlowBack,
|
|
190
|
+
chatInquiryNumber,
|
|
191
|
+
workFlowStack,
|
|
192
|
+
isHovered,
|
|
193
|
+
scrollEnd
|
|
194
|
+
]);
|
|
195
|
+
const onAgree = () => {
|
|
196
|
+
ageConfirm(chatInquiryNumber || '', AgeCheckStatusEnums.AGREED);
|
|
197
|
+
};
|
|
198
|
+
return (<>
|
|
199
|
+
{/*isMoblie true일때 헤더 주의 내용이 상단에 있고 ,나머지 높이영역은 메시지 리스트로 붙게*/}
|
|
200
|
+
<div className={` flex ${isMobile ? ' h-full' : 'h-[100vh]'} flex-col items-center justify-between xs:h-[calc(100vh-165px)] xs:max-h-[690px] lg:h-[calc(100vh-110px)] `}>
|
|
201
|
+
<div className={`
|
|
202
|
+
relative h-full w-full
|
|
203
|
+
rounded-t-[30px]
|
|
204
|
+
xs:max-h-[690px] xs:min-h-[320px] xs:justify-start
|
|
205
|
+
${isMobile ? 'flex flex-col items-center justify-between' : 'flex flex-col'}
|
|
206
|
+
`}>
|
|
207
|
+
{/* 헤더 부분 */}
|
|
208
|
+
<div ref={headerRef} className={`flex w-full flex-col`}>
|
|
209
|
+
<ChatConversationHeader inquiryMainData={inquiryMainData !== null && inquiryMainData !== void 0 ? inquiryMainData : null} isMobile={isMobile} viewState={viewState} onClose={onClose} isHash={isHash}
|
|
210
|
+
// onBackClick={onBackClick}
|
|
211
|
+
onHistoryClick={handleHistoryClick} isAuthenticated={isAuthenticated} historyList={historyList}/>
|
|
212
|
+
|
|
213
|
+
<NoticeMessage content={noticeContent} isMobile={isMobile}/>
|
|
214
|
+
</div>
|
|
215
|
+
{/* 메시지 노출 부분 -> 무한스크롤 변환 필요 */}
|
|
216
|
+
{/* 여기서 isMpblie일때 위에 2개 헤더부분이랑 아래 메시지 입력이랑 높이를 빼서 넣어야한ㄷ */}
|
|
217
|
+
<div ref={messagesContainerRef} className={`
|
|
218
|
+
${isMobile ? ` ${isLoading ? ' pb-[50px]' : ''} mx-[20px] overflow-y-auto ` : 'flex- ml-[20px] mr-[5px] xs:pb-[100px] '} overlay-scrollbar overflow-auto pt-[20px]
|
|
219
|
+
`} style={Object.assign({ height: isMobile ?
|
|
220
|
+
isMobileSafari ?
|
|
221
|
+
`calc(100vh - ${bottomHeight}px - ${((_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0}px)`
|
|
222
|
+
: `100%`
|
|
223
|
+
: bottomHeight && headerRef.current
|
|
224
|
+
? `calc(100% - ${bottomHeight}px - ${(_b = headerRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight}px)`
|
|
225
|
+
: '100%' }, (!isMobile ? hoverStyle : {}))}>
|
|
226
|
+
{initialLoading === null ? (<div className={`flex h-full w-full items-center justify-center `}>
|
|
227
|
+
<ChatLoading outerClass={`!pl-0`}/>
|
|
228
|
+
</div>) : (<div className={` w-full`} onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
|
|
229
|
+
{renderedMessages}
|
|
230
|
+
{/* 타이핑 UI */}
|
|
231
|
+
{isTyping && <TypingComp />}
|
|
232
|
+
{isClosed && (<div className={` dr_talk_body_medium2 pb-[16px] text-center text-drTalkGrayscale1`}>
|
|
233
|
+
문의가 종료되었습니다.
|
|
234
|
+
</div>)}
|
|
235
|
+
{isLoading && <ChatLoading />}
|
|
236
|
+
<div ref={messagesEndRef}/>
|
|
237
|
+
</div>)}
|
|
238
|
+
</div>
|
|
239
|
+
{!isClosed && isNotAgeCheck && <AgeCheckBox onAgree={onAgree}/>}
|
|
240
|
+
|
|
241
|
+
<div ref={pcBottomRef} className={`!z-[50] w-full`}>
|
|
242
|
+
{/* 높이가 부모에 스크롤이 줄어도 해당 부분은 바텀에 고정 필요 */}
|
|
243
|
+
{isClosed ? (<div className='w-full border-t border-drTalkGrayscale4 px-[20px] py-[16px]'>
|
|
244
|
+
<div className=''>
|
|
245
|
+
<Button3 onClick={() => {
|
|
246
|
+
onChatNew && onChatNew();
|
|
247
|
+
}} className={`w-full`}>
|
|
248
|
+
새 문의하기
|
|
249
|
+
</Button3>
|
|
250
|
+
</div>
|
|
251
|
+
</div>) : (<div className=' w-full border-t border-drTalkGrayscale4 px-[20px] py-[8px]'>
|
|
252
|
+
<ChatInput isMobile={isMobile} isNotAgeCheck={isNotAgeCheck} chatInquiryNumber={chatInquiryNumber || ''}/>
|
|
253
|
+
</div>)}
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
</>);
|
|
258
|
+
};
|
|
259
|
+
export default ChatConversation;
|