@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import React, { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import React, { Dispatch, SetStateAction, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import ChatHomeView, { ViewState } from './ChatHomeView';
|
|
4
4
|
import ImageViewer from './Viewer/ImageViewer';
|
|
5
5
|
import { useScrollShadow } from './_hooks/useScrollShadow';
|
|
@@ -13,6 +13,7 @@ interface ChatWidgetProps {
|
|
|
13
13
|
animationState: string;
|
|
14
14
|
isMobileSafari?: boolean;
|
|
15
15
|
androidViewportHeight?: number;
|
|
16
|
+
isMobileAndroid?: boolean;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
@@ -23,10 +24,11 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
|
23
24
|
setHashValue,
|
|
24
25
|
animationState,
|
|
25
26
|
isMobileSafari = false,
|
|
26
|
-
androidViewportHeight = 0
|
|
27
|
+
androidViewportHeight = 0,
|
|
28
|
+
isMobileAndroid = false
|
|
27
29
|
}) => {
|
|
28
|
-
const { containerRef
|
|
29
|
-
const isHash = !!hashValue;
|
|
30
|
+
const { containerRef } = useScrollShadow<HTMLDivElement>();
|
|
31
|
+
const isHash = !!hashValue;
|
|
30
32
|
const chatWidgetRef = useRef<HTMLDivElement>(null);
|
|
31
33
|
|
|
32
34
|
// iOS Safari viewport 계산
|
|
@@ -35,9 +37,13 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
|
35
37
|
|
|
36
38
|
const [viewState, setViewState] = useState<ViewState>('conversation');
|
|
37
39
|
|
|
40
|
+
const isConversationView = useMemo(() => {
|
|
41
|
+
return viewState === 'conversation';
|
|
42
|
+
}, [viewState]);
|
|
43
|
+
|
|
38
44
|
useEffect(() => {
|
|
45
|
+
if (!isConversationView) return;
|
|
39
46
|
if (!isMobileSafari) return;
|
|
40
|
-
|
|
41
47
|
const updateViewport = () => {
|
|
42
48
|
if (!window.visualViewport) return;
|
|
43
49
|
|
|
@@ -60,7 +66,7 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
|
60
66
|
window.visualViewport?.removeEventListener('resize', onResize);
|
|
61
67
|
window.visualViewport?.removeEventListener('scroll', onScroll);
|
|
62
68
|
};
|
|
63
|
-
}, [isMobileSafari]);
|
|
69
|
+
}, [isMobileSafari, isConversationView]);
|
|
64
70
|
|
|
65
71
|
useEffect(() => {
|
|
66
72
|
const isScrollableElement = (element: Element): boolean => {
|
|
@@ -68,7 +74,6 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
|
68
74
|
const hasScrollableY = style.overflowY === 'auto' || style.overflowY === 'scroll';
|
|
69
75
|
const hasScrollable = style.overflow === 'auto' || style.overflow === 'scroll';
|
|
70
76
|
|
|
71
|
-
// 실제로 스크롤이 가능한지 확인 (내용이 컨테이너보다 큰지)
|
|
72
77
|
if (hasScrollableY || hasScrollable) {
|
|
73
78
|
return element.scrollHeight > element.clientHeight;
|
|
74
79
|
}
|
|
@@ -78,41 +83,134 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
|
78
83
|
const handleWheel = (e: WheelEvent) => {
|
|
79
84
|
let target = e.target as Element;
|
|
80
85
|
|
|
81
|
-
// 타겟부터 시작하여 부모 요소들을 확인
|
|
82
86
|
while (target && target !== chatWidgetRef.current) {
|
|
83
87
|
if (isScrollableElement(target)) {
|
|
84
|
-
// 스크롤 가능한 요소라면 이벤트를 허용
|
|
85
88
|
return;
|
|
86
89
|
}
|
|
87
90
|
target = target.parentElement as Element;
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
// 스크롤 가능한 요소가 아니라면 이벤트 차단
|
|
91
93
|
e.preventDefault();
|
|
92
94
|
e.stopPropagation();
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
const element = chatWidgetRef.current;
|
|
96
98
|
if (element && isOpen) {
|
|
97
|
-
// passive: false로 설정하여 preventDefault()가 작동하도록 함
|
|
98
99
|
element.addEventListener('wheel', handleWheel, { passive: false });
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
return () => {
|
|
102
|
-
if (element)
|
|
103
|
-
element.removeEventListener('wheel', handleWheel);
|
|
104
|
-
}
|
|
103
|
+
if (element) element.removeEventListener('wheel', handleWheel);
|
|
105
104
|
};
|
|
106
105
|
}, [isOpen]);
|
|
107
106
|
|
|
108
|
-
//
|
|
107
|
+
// Safari 뒤 스크롤 방지 -> 뒷 스크롤시 스크롤 원래대로 되돌리기
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (!isConversationView) return;
|
|
110
|
+
if (!(isMobileSafari && isMobile && isOpen)) return;
|
|
111
|
+
|
|
112
|
+
let initialScrollY = 0;
|
|
113
|
+
|
|
114
|
+
const handleScrollLock = () => {
|
|
115
|
+
const currentScrollY = window.scrollY;
|
|
116
|
+
|
|
117
|
+
const active = document.activeElement;
|
|
118
|
+
// 현재 포커스된 요소가 "입력 중인 요소"인지 판단하는 조건
|
|
119
|
+
const isTyping =
|
|
120
|
+
active &&
|
|
121
|
+
(active.tagName === 'INPUT' || // 일반 input 요소
|
|
122
|
+
active.tagName === 'TEXTAREA' || // textarea
|
|
123
|
+
active.getAttribute('contenteditable') === 'true'); // contenteditable 요소 (채팅 입력창 등)
|
|
124
|
+
|
|
125
|
+
if (isTyping) {
|
|
126
|
+
// 키보드가 올라온 '첫 순간'에 scrollY 값을 저장
|
|
127
|
+
// Safari는 키보드가 뜨면 화면을 밀어내며 scrollY가 증가하므로
|
|
128
|
+
// 최초 scrollY 위치를 기억했다가 계속 유지해야 함
|
|
129
|
+
if (!initialScrollY) initialScrollY = currentScrollY;
|
|
130
|
+
|
|
131
|
+
// Safari가 화면 전체를 아래로 밀려고 하면 scrollY 값이 증가함
|
|
132
|
+
// → 즉시 원래 위치(initialScrollY)로 되돌려서 "뷰포트 스크롤"을 차단
|
|
133
|
+
if (currentScrollY > initialScrollY) {
|
|
134
|
+
window.scrollTo(0, initialScrollY); // Safari의 아래로 끌림(검은 화면)을 무력화
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
initialScrollY = 0;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
window.addEventListener('scroll', handleScrollLock, { passive: false });
|
|
142
|
+
window.visualViewport?.addEventListener('resize', handleScrollLock);
|
|
143
|
+
|
|
144
|
+
return () => {
|
|
145
|
+
window.removeEventListener('scroll', handleScrollLock);
|
|
146
|
+
window.visualViewport?.removeEventListener('resize', handleScrollLock);
|
|
147
|
+
};
|
|
148
|
+
}, [isMobileSafari, isMobile, isOpen, isConversationView]);
|
|
149
|
+
|
|
150
|
+
// 크롬같은 모바일 사파리 외 키보드 열림 감지 및 blur 방지
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
if (!isConversationView) return;
|
|
153
|
+
if (!isOpen) return;
|
|
154
|
+
if (!isMobile) return;
|
|
155
|
+
if (isMobileSafari) return;
|
|
156
|
+
|
|
157
|
+
let keyboardOpened = false;
|
|
158
|
+
let blurLock = false;
|
|
159
|
+
|
|
160
|
+
const detectKeyboard = () => {
|
|
161
|
+
const vv = window.visualViewport;
|
|
162
|
+
if (!vv) return;
|
|
163
|
+
|
|
164
|
+
const heightDiff = window.innerHeight - vv.height;
|
|
165
|
+
|
|
166
|
+
if (heightDiff > 150) {
|
|
167
|
+
keyboardOpened = true;
|
|
168
|
+
} else {
|
|
169
|
+
keyboardOpened = false;
|
|
170
|
+
|
|
171
|
+
// 키보드 내려간 직후 blur 방지 lock
|
|
172
|
+
blurLock = true;
|
|
173
|
+
setTimeout(() => {
|
|
174
|
+
blurLock = false;
|
|
175
|
+
}, 250);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const handleWrapperTouch = (e: TouchEvent) => {
|
|
180
|
+
if (!keyboardOpened) return;
|
|
181
|
+
if (blurLock) return;
|
|
182
|
+
|
|
183
|
+
const active = document.activeElement as HTMLElement | null;
|
|
184
|
+
if (!active) return;
|
|
185
|
+
|
|
186
|
+
const wrapper = document.querySelector('.daeryuntalk-wrapper');
|
|
187
|
+
if (!wrapper) return;
|
|
188
|
+
|
|
189
|
+
// wrapper 터치면 blur
|
|
190
|
+
if (wrapper.contains(e.target as HTMLElement)) {
|
|
191
|
+
blurLock = true;
|
|
192
|
+
active.blur();
|
|
193
|
+
setTimeout(() => (blurLock = false), 250);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
window.visualViewport?.addEventListener('resize', detectKeyboard);
|
|
198
|
+
|
|
199
|
+
const wrapper = document.querySelector('.daeryuntalk-wrapper');
|
|
200
|
+
wrapper?.addEventListener('touchstart', handleWrapperTouch as EventListener, { passive: true });
|
|
201
|
+
|
|
202
|
+
return () => {
|
|
203
|
+
window.visualViewport?.removeEventListener('resize', detectKeyboard);
|
|
204
|
+
wrapper?.removeEventListener('touchstart', handleWrapperTouch as EventListener);
|
|
205
|
+
};
|
|
206
|
+
}, [isOpen, isConversationView, isMobileSafari, isMobile]);
|
|
207
|
+
|
|
109
208
|
const mobileWrapperCss = `
|
|
110
209
|
fixed inset-0 h-full w-full bg-white z-[999998] rounded-none flex flex-col
|
|
111
210
|
duration-500 ease-in-out
|
|
112
211
|
${isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
|
|
113
212
|
`;
|
|
114
213
|
|
|
115
|
-
// 웹 모바일 ~480px
|
|
116
214
|
const webSmallWrapperCss = `
|
|
117
215
|
${isHash ? `duration-300 ease-in-out` : `duration-300 ease-in-out`}
|
|
118
216
|
${isHash ? `${isOpen ? ' translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'} ` : isOpen ? 'translate-y-0 opacity-100' : 'translate-y-full opacity-0 pointer-events-none'}
|
|
@@ -120,7 +218,6 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
|
120
218
|
bottom-0 right-0 h-[100dvh]
|
|
121
219
|
`;
|
|
122
220
|
|
|
123
|
-
// 해쉬 있을 경우는 여기서 중앙배치 css로
|
|
124
221
|
const webTbPCWrapperCss = `
|
|
125
222
|
${isHash ? `` : 'xs:duration-300 ease-in-out'}
|
|
126
223
|
${
|
|
@@ -145,23 +242,11 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
|
145
242
|
}
|
|
146
243
|
`;
|
|
147
244
|
|
|
148
|
-
//
|
|
149
245
|
const innerMobileWrapperCss = `
|
|
150
246
|
rounded-none sm:max-w-[640px] sm:m-auto
|
|
151
247
|
`;
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
rounded-none
|
|
155
|
-
`;
|
|
156
|
-
|
|
157
|
-
// 웹 480~1023px , pc 1024px~
|
|
158
|
-
const innerWebTbPCWrapperCss = `
|
|
159
|
-
xs:rounded-[30px]
|
|
160
|
-
`;
|
|
161
|
-
|
|
162
|
-
// 웹 모바일
|
|
163
|
-
|
|
164
|
-
// 태블릿 크기 이상 2
|
|
248
|
+
const innerWebSmallWrapperCss = `rounded-none`;
|
|
249
|
+
const innerWebTbPCWrapperCss = `xs:rounded-[30px]`;
|
|
165
250
|
|
|
166
251
|
return (
|
|
167
252
|
<>
|
|
@@ -170,17 +255,15 @@ const ChatWidget: React.FC<ChatWidgetProps> = ({
|
|
|
170
255
|
<div className="relative">
|
|
171
256
|
<div
|
|
172
257
|
ref={chatWidgetRef}
|
|
173
|
-
className={`
|
|
174
|
-
|
|
175
|
-
${isMobile ? `${mobileWrapperCss}` : `${webSmallWrapperCss} ${webTbPCWrapperCss} `}
|
|
176
|
-
`}
|
|
258
|
+
className={`${isMobile ? mobileWrapperCss : `${webSmallWrapperCss} ${webTbPCWrapperCss}`}`}
|
|
177
259
|
>
|
|
178
260
|
<div
|
|
179
261
|
ref={containerRef}
|
|
180
262
|
className={`
|
|
181
263
|
relative z-[999998]
|
|
182
|
-
flex h-full flex-col items-center
|
|
183
|
-
${
|
|
264
|
+
flex h-full flex-col items-center
|
|
265
|
+
${isHash ? 'justify-center' : 'justify-end'}
|
|
266
|
+
${isMobile ? innerMobileWrapperCss : `${innerWebSmallWrapperCss} ${innerWebTbPCWrapperCss}`}
|
|
184
267
|
`}
|
|
185
268
|
style={
|
|
186
269
|
viewState !== 'conversation' || !isMobile
|
|
@@ -8,15 +8,6 @@ import { Swiper, SwiperSlide } from 'swiper/react';
|
|
|
8
8
|
import 'swiper/css';
|
|
9
9
|
import 'swiper/css/navigation';
|
|
10
10
|
|
|
11
|
-
// 이미지
|
|
12
|
-
// import RotateCCWIcon from '../../../asset/images/daeryuntalk/viewer/rotate.svg';
|
|
13
|
-
// import ZoomOutIcon from '../../../asset/images/daeryuntalk/viewer/zoom-out.svg';
|
|
14
|
-
// import ZoomInIcon from '../../../asset/images/daeryuntalk/viewer/zoom-in.svg';
|
|
15
|
-
// import DownloadIcon from '../../../asset/images/daeryuntalk/download.svg';
|
|
16
|
-
// import CloseIcon from '../../../asset/images/daeryuntalk/viewer/close.svg';
|
|
17
|
-
// import MoveSwipingIcon from '../../../asset/images/daeryuntalk/viewer/move-button.svg';
|
|
18
|
-
// import DaeryunLogoIcon from '../../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
19
|
-
|
|
20
11
|
interface ITbPcViewerProps {
|
|
21
12
|
imageViewerMessage?: Message | null;
|
|
22
13
|
handleDownload: () => void;
|
|
@@ -13,6 +13,7 @@ const Daeryuntalk = ({ tel = '1800-7905', centerCode = 'CT0000', bannerHeight =
|
|
|
13
13
|
const [isOpen, setIsOpen] = useState(false);
|
|
14
14
|
const [isMobile, setIsMobile] = useState(false);
|
|
15
15
|
const [isMobileSafari, setIsMobileSafari] = useState(false); // ios + 모바일
|
|
16
|
+
const [isMobileAndroid, setIsMobileAndroid] = useState(false); // android + 모바일
|
|
16
17
|
const [androidViewportHeight, setAndroidViewportHeight] = useState(0); //
|
|
17
18
|
const pathName = usePathname();
|
|
18
19
|
const windowSize = useWindowSize();
|
|
@@ -55,6 +56,21 @@ const Daeryuntalk = ({ tel = '1800-7905', centerCode = 'CT0000', bannerHeight =
|
|
|
55
56
|
openModal();
|
|
56
57
|
}
|
|
57
58
|
};
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (typeof window === 'undefined')
|
|
61
|
+
return;
|
|
62
|
+
const ua = navigator.userAgent;
|
|
63
|
+
const isAndroid = /Android/i.test(ua);
|
|
64
|
+
const isMobileDevice = /Mobile/i.test(ua);
|
|
65
|
+
// Safari(iOS) 제외
|
|
66
|
+
const isSafari = /Safari/i.test(ua) && !/Chrome/i.test(ua);
|
|
67
|
+
if (isAndroid && isMobileDevice && !isSafari) {
|
|
68
|
+
setIsMobileAndroid(true);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
setIsMobileAndroid(false);
|
|
72
|
+
}
|
|
73
|
+
}, []);
|
|
58
74
|
useEffect(() => {
|
|
59
75
|
var _a;
|
|
60
76
|
if (!isMobile) {
|
|
@@ -182,7 +198,7 @@ const Daeryuntalk = ({ tel = '1800-7905', centerCode = 'CT0000', bannerHeight =
|
|
|
182
198
|
<ViewportHandler isMobile={isMobile} isDisable={!isOpen || !isMobile}/>
|
|
183
199
|
<DaeryuntalkProvider propsTel={tel} isMobile={isMobile} onClose={closeModal} centerCode={currentCenterCode || ''} isOpen={isOpen}>
|
|
184
200
|
{isMobile ? (isOpen || !currentCenterCode ? null : (<ChatButton isOpen={isOpen} isMobile={isMobile} hashValue={hashValue} onClick={toggleChat}/>)) : !currentCenterCode ? null : (<ChatButton isOpen={isOpen} isMobile={isMobile} hashValue={hashValue} onClick={toggleChat} bannerHeight={bannerHeight}/>)}
|
|
185
|
-
<ChatWidget isOpen={hashValue ? true : isOpen} isMobile={isMobile} onClose={closeModal} hashValue={hashValue} setHashValue={setHashValue} animationState={animationState} isMobileSafari={isMobileSafari} androidViewportHeight={androidViewportHeight}/>
|
|
201
|
+
<ChatWidget isOpen={hashValue ? true : isOpen} isMobile={isMobile} onClose={closeModal} hashValue={hashValue} setHashValue={setHashValue} animationState={animationState} isMobileSafari={isMobileSafari} androidViewportHeight={androidViewportHeight} isMobileAndroid={isMobileAndroid}/>
|
|
186
202
|
</DaeryuntalkProvider>
|
|
187
203
|
</DaeryuntalkToastProvider>
|
|
188
204
|
</div>);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import React, { use, useEffect, useState } from 'react';
|
|
4
4
|
import ChatButton from './ChatButton';
|
|
5
5
|
import ChatWidget from './ChatWidget';
|
|
6
6
|
import { DaeryuntalkProvider } from './DaeryuntalkContext';
|
|
@@ -17,10 +17,15 @@ type DaeryuntalkProps = {
|
|
|
17
17
|
bannerHeight?: number;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const Daeryuntalk: React.FC<DaeryuntalkProps> = ({
|
|
20
|
+
const Daeryuntalk: React.FC<DaeryuntalkProps> = ({
|
|
21
|
+
tel = '1800-7905',
|
|
22
|
+
centerCode = 'CT0000',
|
|
23
|
+
bannerHeight = 0
|
|
24
|
+
}) => {
|
|
21
25
|
const [isOpen, setIsOpen] = useState(false);
|
|
22
26
|
const [isMobile, setIsMobile] = useState(false);
|
|
23
27
|
const [isMobileSafari, setIsMobileSafari] = useState(false); // ios + 모바일
|
|
28
|
+
const [isMobileAndroid, setIsMobileAndroid] = useState(false); // android + 모바일
|
|
24
29
|
const [androidViewportHeight, setAndroidViewportHeight] = useState(0); //
|
|
25
30
|
|
|
26
31
|
const pathName = usePathname();
|
|
@@ -70,6 +75,24 @@ const Daeryuntalk: React.FC<DaeryuntalkProps> = ({ tel = '1800-7905', centerCode
|
|
|
70
75
|
}
|
|
71
76
|
};
|
|
72
77
|
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (typeof window === 'undefined') return;
|
|
80
|
+
|
|
81
|
+
const ua = navigator.userAgent;
|
|
82
|
+
|
|
83
|
+
const isAndroid = /Android/i.test(ua);
|
|
84
|
+
const isMobileDevice = /Mobile/i.test(ua);
|
|
85
|
+
|
|
86
|
+
// Safari(iOS) 제외
|
|
87
|
+
const isSafari = /Safari/i.test(ua) && !/Chrome/i.test(ua);
|
|
88
|
+
|
|
89
|
+
if (isAndroid && isMobileDevice && !isSafari) {
|
|
90
|
+
setIsMobileAndroid(true);
|
|
91
|
+
} else {
|
|
92
|
+
setIsMobileAndroid(false);
|
|
93
|
+
}
|
|
94
|
+
}, []);
|
|
95
|
+
|
|
73
96
|
useEffect(() => {
|
|
74
97
|
if (!isMobile) {
|
|
75
98
|
return;
|
|
@@ -247,6 +270,7 @@ const Daeryuntalk: React.FC<DaeryuntalkProps> = ({ tel = '1800-7905', centerCode
|
|
|
247
270
|
animationState={animationState}
|
|
248
271
|
isMobileSafari={isMobileSafari}
|
|
249
272
|
androidViewportHeight={androidViewportHeight}
|
|
273
|
+
isMobileAndroid={isMobileAndroid}
|
|
250
274
|
/>
|
|
251
275
|
</DaeryuntalkProvider>
|
|
252
276
|
</DaeryuntalkToastProvider>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ChatButtonProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
apiVersion?: string;
|
|
6
|
+
isMobile?: boolean;
|
|
7
|
+
hashValue?: string | null;
|
|
8
|
+
bannerHeight?: number;
|
|
9
|
+
}
|
|
10
|
+
declare const ChatButton: React.FC<ChatButtonProps>;
|
|
11
|
+
export default ChatButton;
|
|
@@ -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;
|