@daeryun/dr_components 0.7.87 → 0.7.89
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 +3 -1
- package/dist/components/Daeryuntalk/ChatButton.tsx +3 -1
- package/dist/components/Daeryuntalk/ChatConversation.jsx +23 -5
- package/dist/components/Daeryuntalk/ChatConversation.tsx +27 -5
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +28 -11
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +34 -9
- package/dist/components/Daeryuntalk/ChatInput.tsx +1 -1
- package/dist/components/Daeryuntalk/ChatWidget.jsx +5 -2
- package/dist/components/Daeryuntalk/ChatWidget.tsx +5 -2
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +21 -3
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +32 -11
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +69 -23
- package/dist/components/Daeryuntalk/History/AuthForm.d.ts +8 -0
- package/dist/components/Daeryuntalk/History/AuthForm.jsx +149 -0
- package/dist/components/Daeryuntalk/History/AuthForm.tsx +196 -0
- package/dist/components/Daeryuntalk/HistoryView.d.ts +6 -0
- package/dist/components/Daeryuntalk/HistoryView.jsx +55 -35
- package/dist/components/Daeryuntalk/HistoryView.tsx +86 -47
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +9 -1
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +10 -1
- package/dist/components/Daeryuntalk/Toast/DaeryuntalkToastProvider.d.ts +12 -0
- package/dist/components/Daeryuntalk/Toast/DaeryuntalkToastProvider.jsx +33 -0
- package/dist/components/Daeryuntalk/Toast/DaeryuntalkToastProvider.tsx +67 -0
- package/dist/components/Daeryuntalk/Toast/Toast.d.ts +11 -0
- package/dist/components/Daeryuntalk/Toast/Toast.jsx +61 -0
- package/dist/components/Daeryuntalk/Toast/Toast.tsx +94 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.jsx +1 -1
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.tsx +1 -1
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +29 -1
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +98 -7
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +136 -8
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.d.ts +13 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.ts +17 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.d.ts +3 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +76 -8
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +88 -12
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.d.ts +24 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.js +75 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.ts +90 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +12 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +16 -2
- package/dist/components/Daeryuntalk/_lib/utils.d.ts +10 -0
- package/dist/components/Daeryuntalk/_lib/utils.js +25 -0
- package/dist/components/Daeryuntalk/_lib/utils.ts +39 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button2.d.ts +10 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button2.jsx +12 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button2.tsx +28 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input2.d.ts +13 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input2.jsx +9 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input2.tsx +42 -0
- package/dist/styles/globals.css +65 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,9 @@ import LinkRight from '../../asset/images/daeryuntalk/link_right.svg';
|
|
|
3
3
|
import EmptyMessage from '../../asset/images/daeryuntalk/empty_message.svg';
|
|
4
4
|
import SendIcon from '../../asset/images/daeryuntalk/send.svg';
|
|
5
5
|
import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
|
|
6
|
+
import Input1 from './_ui/inputs/Input1';
|
|
7
|
+
import AuthForm from './History/AuthForm';
|
|
8
|
+
import { History } from './_api/daeryuntalk/type/response';
|
|
6
9
|
|
|
7
10
|
const mockChatHistories: any[] = [];
|
|
8
11
|
|
|
@@ -10,34 +13,53 @@ type HistoryViewProps = {
|
|
|
10
13
|
onBackClick: () => void;
|
|
11
14
|
onChatHistoryClick: (historyId: string) => void;
|
|
12
15
|
onNewChatClick: () => void;
|
|
16
|
+
isAuthenticated: boolean;
|
|
17
|
+
historyLit: History[];
|
|
18
|
+
goGetHistoryList: (data: { version?: string }) => void;
|
|
13
19
|
};
|
|
14
20
|
|
|
15
|
-
const HistoryView: React.FC<HistoryViewProps> = ({
|
|
16
|
-
|
|
21
|
+
const HistoryView: React.FC<HistoryViewProps> = ({
|
|
22
|
+
onBackClick,
|
|
23
|
+
onChatHistoryClick,
|
|
24
|
+
onNewChatClick,
|
|
25
|
+
isAuthenticated,
|
|
26
|
+
historyLit,
|
|
27
|
+
goGetHistoryList
|
|
28
|
+
}) => {
|
|
29
|
+
const formatTimestamp = (timestamp: string): string => {
|
|
30
|
+
if (!timestamp) return '';
|
|
31
|
+
|
|
32
|
+
// UTC string을 Date 객체로 변환
|
|
33
|
+
const date = new Date(timestamp);
|
|
17
34
|
const now = new Date();
|
|
18
|
-
|
|
35
|
+
|
|
36
|
+
// 시간 차이(초)
|
|
37
|
+
const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);
|
|
19
38
|
|
|
20
39
|
if (diffInSeconds < 5) {
|
|
21
40
|
return '방금';
|
|
22
41
|
}
|
|
23
42
|
|
|
24
43
|
if (diffInSeconds < 60 * 60 * 24) {
|
|
25
|
-
|
|
26
|
-
const
|
|
44
|
+
// 오늘 내 메시지: 시:분
|
|
45
|
+
const hours = date.getHours().toString().padStart(2, '0');
|
|
46
|
+
const minutes = date.getMinutes().toString().padStart(2, '0');
|
|
27
47
|
return `${hours}:${minutes}`;
|
|
28
48
|
}
|
|
29
49
|
|
|
30
50
|
if (diffInSeconds < 60 * 60 * 24 * 7) {
|
|
51
|
+
// 일주일 내: N일전
|
|
31
52
|
const days = Math.floor(diffInSeconds / (60 * 60 * 24));
|
|
32
53
|
return `${days}일전`;
|
|
33
54
|
}
|
|
34
55
|
|
|
35
|
-
|
|
36
|
-
const
|
|
56
|
+
// 그 외: 월일
|
|
57
|
+
const month = date.getMonth() + 1;
|
|
58
|
+
const day = date.getDate();
|
|
37
59
|
return `${month}월${day}일`;
|
|
38
60
|
};
|
|
39
61
|
|
|
40
|
-
const hasHistories =
|
|
62
|
+
const hasHistories = historyLit.length > 0;
|
|
41
63
|
|
|
42
64
|
return (
|
|
43
65
|
<div className="flex h-full flex-col">
|
|
@@ -50,48 +72,65 @@ const HistoryView: React.FC<HistoryViewProps> = ({ onBackClick, onChatHistoryCli
|
|
|
50
72
|
</div>
|
|
51
73
|
<div className="w-7"></div>
|
|
52
74
|
</div>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
{!isAuthenticated ? (
|
|
76
|
+
<AuthForm goGetHistoryList={goGetHistoryList} />
|
|
77
|
+
) : (
|
|
78
|
+
<>
|
|
79
|
+
<div className="flex-1 overflow-y-auto px-[20px] pb-[20px] pt-[24px]">
|
|
80
|
+
{hasHistories ? (
|
|
81
|
+
historyLit.map(history => (
|
|
82
|
+
<div
|
|
83
|
+
key={history.chat_inquiry_number}
|
|
84
|
+
className="cursor-pointer border-b border-gray-100 px-[12px] py-[18px] hover:bg-gray-50"
|
|
85
|
+
onClick={() => onChatHistoryClick(history.chat_inquiry_number)}
|
|
86
|
+
>
|
|
87
|
+
<div className="flex items-center justify-between">
|
|
88
|
+
<div className={`flex flex-row items-center gap-[10px]`}>
|
|
89
|
+
<span className="font-medium">{history.customer_name}</span>
|
|
90
|
+
{history.unread_message_count && history.unread_message_count > 0 ? (
|
|
91
|
+
<span className="flex h-[18px] w-[18px] items-center justify-center rounded-full bg-[#AA1D36] px-[5.5px] py-[3px] text-[12px] font-medium leading-[100%] tracking-[-4%] text-white">
|
|
92
|
+
{history.unread_message_count}
|
|
93
|
+
</span>
|
|
94
|
+
) : null}
|
|
95
|
+
</div>
|
|
96
|
+
<span className="text-xs text-gray-500">
|
|
97
|
+
{formatTimestamp(history.recent_message_date_time)}
|
|
98
|
+
{/*{history.unread_message_count}*/}
|
|
99
|
+
</span>
|
|
100
|
+
</div>
|
|
101
|
+
<div className="mt-1 flex items-center justify-between">
|
|
102
|
+
<p className="line-clamp-2 w-[85%] text-sm text-gray-700">
|
|
103
|
+
{history.recent_message_content}
|
|
104
|
+
</p>
|
|
105
|
+
<LinkRight width={24} height={24} className="flex-shrink-0" />
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
))
|
|
109
|
+
) : (
|
|
110
|
+
<div className="flex h-full flex-col items-center justify-center p-4">
|
|
111
|
+
<div className="mb-4">
|
|
112
|
+
<EmptyMessage />
|
|
113
|
+
</div>
|
|
114
|
+
<p className="text-center text-gray-500">
|
|
115
|
+
이전 대화기록이 없습니다
|
|
116
|
+
<br />
|
|
117
|
+
대화를 시작해 보세요
|
|
118
|
+
</p>
|
|
69
119
|
</div>
|
|
70
|
-
|
|
71
|
-
))
|
|
72
|
-
) : (
|
|
73
|
-
<div className="flex h-full flex-col items-center justify-center p-4">
|
|
74
|
-
<div className="mb-4">
|
|
75
|
-
<EmptyMessage />
|
|
76
|
-
</div>
|
|
77
|
-
<p className="text-center text-gray-500">
|
|
78
|
-
이전 대화기록이 없습니다
|
|
79
|
-
<br />
|
|
80
|
-
대화를 시작해 보세요
|
|
81
|
-
</p>
|
|
120
|
+
)}
|
|
82
121
|
</div>
|
|
83
|
-
)}
|
|
84
|
-
</div>
|
|
85
122
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
<div className="p-4">
|
|
124
|
+
<button
|
|
125
|
+
className="flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B] px-6 py-3 text-white"
|
|
126
|
+
onClick={onNewChatClick}
|
|
127
|
+
>
|
|
128
|
+
새 문의하기
|
|
129
|
+
<SendIcon width={24} height={24} />
|
|
130
|
+
</button>
|
|
131
|
+
</div>
|
|
132
|
+
</>
|
|
133
|
+
)}
|
|
95
134
|
</div>
|
|
96
135
|
);
|
|
97
136
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEditor, EditorContent } from '@tiptap/react';
|
|
2
2
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
3
|
-
import { useImperativeHandle, forwardRef } from 'react';
|
|
3
|
+
import { useImperativeHandle, forwardRef, useEffect } from 'react';
|
|
4
4
|
import Document from '@tiptap/extension-document';
|
|
5
5
|
import Paragraph from '@tiptap/extension-paragraph';
|
|
6
6
|
import Text from '@tiptap/extension-text';
|
|
@@ -40,6 +40,14 @@ const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력하세
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
+
// 최초 렌더시 포커스 설정
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (editor) {
|
|
46
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.clearContent(true);
|
|
47
|
+
// 내용을 지운 후 포커스 유지
|
|
48
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.focus();
|
|
49
|
+
}
|
|
50
|
+
}, [editor]);
|
|
43
51
|
useImperativeHandle(ref, () => ({
|
|
44
52
|
clearContent: () => {
|
|
45
53
|
editor === null || editor === void 0 ? void 0 : editor.commands.clearContent(true);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEditor, EditorContent } from '@tiptap/react';
|
|
2
2
|
import StarterKit from '@tiptap/starter-kit';
|
|
3
3
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
4
|
-
import { useImperativeHandle, forwardRef } from 'react';
|
|
4
|
+
import { useImperativeHandle, forwardRef, useEffect } from 'react';
|
|
5
5
|
import { JSONContent } from '@tiptap/core'; // 추가 필요
|
|
6
6
|
import Document from '@tiptap/extension-document';
|
|
7
7
|
import Paragraph from '@tiptap/extension-paragraph';
|
|
@@ -62,6 +62,15 @@ const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
+
// 최초 렌더시 포커스 설정
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (editor) {
|
|
68
|
+
editor?.commands.clearContent(true);
|
|
69
|
+
// 내용을 지운 후 포커스 유지
|
|
70
|
+
editor?.commands.focus();
|
|
71
|
+
}
|
|
72
|
+
}, [editor]);
|
|
73
|
+
|
|
65
74
|
useImperativeHandle(ref, () => ({
|
|
66
75
|
clearContent: () => {
|
|
67
76
|
editor?.commands.clearContent(true);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface ToastContextProps {
|
|
3
|
+
success: (title: string, description?: string, duration?: number) => void;
|
|
4
|
+
warning: (title: string, description?: string, duration?: number) => void;
|
|
5
|
+
error: (title: string, description?: string, duration?: number) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const useDearyunTalkToast: () => ToastContextProps;
|
|
8
|
+
interface ToastProviderProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const DaeryuntalkToastProvider: ({ children }: ToastProviderProps) => import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createContext, useContext, useState } from 'react';
|
|
2
|
+
import DaeryunTalkToast from './Toast';
|
|
3
|
+
export const useDearyunTalkToast = () => {
|
|
4
|
+
const context = useContext(ToastContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error('토스트 프로바이더 설정이 필요합니다.');
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
10
|
+
const ToastContext = createContext(undefined);
|
|
11
|
+
export const DaeryuntalkToastProvider = ({ children }) => {
|
|
12
|
+
const [toast, setToast] = useState(null);
|
|
13
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
14
|
+
const showToast = (type, title, description, duration = 3000) => {
|
|
15
|
+
setToast({ type, title, description, duration });
|
|
16
|
+
setIsVisible(true);
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
setIsVisible(false);
|
|
19
|
+
setTimeout(() => setToast(null), 300); // exit transition
|
|
20
|
+
}, duration);
|
|
21
|
+
};
|
|
22
|
+
const success = (title, description, duration) => showToast('success', title, description, duration);
|
|
23
|
+
const warning = (title, description, duration) => showToast('warning', title, description, duration);
|
|
24
|
+
const error = (title, description, duration) => showToast('error', title, description, duration);
|
|
25
|
+
return (<ToastContext.Provider value={{ success, warning, error }}>
|
|
26
|
+
{children}
|
|
27
|
+
<div className="absolute bottom-0 left-1/2 z-50 w-[90%] -translate-x-1/2 rounded-[25px]">
|
|
28
|
+
<div className={`transition-all duration-300 ${isVisible ? '-translate-y-[96px] opacity-100' : 'pointer-events-none translate-y-0 opacity-0'}`}>
|
|
29
|
+
{toast && <DaeryunTalkToast {...toast} onClose={() => setIsVisible(false)}/>}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</ToastContext.Provider>);
|
|
33
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createContext, ReactNode, useContext, useState } from 'react';
|
|
2
|
+
import DaeryunTalkToast from './Toast';
|
|
3
|
+
|
|
4
|
+
type ToastType = 'success' | 'warning' | 'error';
|
|
5
|
+
|
|
6
|
+
interface ToastItem {
|
|
7
|
+
type: ToastType;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
duration?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ToastContextProps {
|
|
14
|
+
success: (title: string, description?: string, duration?: number) => void;
|
|
15
|
+
warning: (title: string, description?: string, duration?: number) => void;
|
|
16
|
+
error: (title: string, description?: string, duration?: number) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const useDearyunTalkToast = () => {
|
|
20
|
+
const context = useContext(ToastContext);
|
|
21
|
+
if (!context) {
|
|
22
|
+
throw new Error('토스트 프로바이더 설정이 필요합니다.');
|
|
23
|
+
}
|
|
24
|
+
return context;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const ToastContext = createContext<ToastContextProps | undefined>(undefined);
|
|
28
|
+
|
|
29
|
+
interface ToastProviderProps {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const DaeryuntalkToastProvider = ({ children }: ToastProviderProps) => {
|
|
34
|
+
const [toast, setToast] = useState<ToastItem | null>(null);
|
|
35
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
36
|
+
|
|
37
|
+
const showToast = (type: ToastType, title: string, description?: string, duration: number = 3000) => {
|
|
38
|
+
setToast({ type, title, description, duration });
|
|
39
|
+
setIsVisible(true);
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
setIsVisible(false);
|
|
42
|
+
setTimeout(() => setToast(null), 300); // exit transition
|
|
43
|
+
}, duration);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const success = (title: string, description?: string, duration?: number) =>
|
|
47
|
+
showToast('success', title, description, duration);
|
|
48
|
+
const warning = (title: string, description?: string, duration?: number) =>
|
|
49
|
+
showToast('warning', title, description, duration);
|
|
50
|
+
const error = (title: string, description?: string, duration?: number) =>
|
|
51
|
+
showToast('error', title, description, duration);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<ToastContext.Provider value={{ success, warning, error }}>
|
|
55
|
+
{children}
|
|
56
|
+
<div className="absolute bottom-0 left-1/2 z-50 w-[90%] -translate-x-1/2 rounded-[25px]">
|
|
57
|
+
<div
|
|
58
|
+
className={`transition-all duration-300 ${
|
|
59
|
+
isVisible ? '-translate-y-[96px] opacity-100' : 'pointer-events-none translate-y-0 opacity-0'
|
|
60
|
+
}`}
|
|
61
|
+
>
|
|
62
|
+
{toast && <DaeryunTalkToast {...toast} onClose={() => setIsVisible(false)} />}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</ToastContext.Provider>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ToastType = 'success' | 'warning' | 'error';
|
|
3
|
+
interface ToastProps {
|
|
4
|
+
type: ToastType;
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
duration?: number;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ type, title, description, duration, onClose }: ToastProps) => React.JSX.Element>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
// 1. 함수 이름을 PascalCase로 변경
|
|
3
|
+
const WarningIcon = ({ className = '' }) => {
|
|
4
|
+
return (<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" className={className}>
|
|
5
|
+
<g clipPath="url(#clip0_1775_25245)">
|
|
6
|
+
<path d="M3 12C3 13.1819 3.23279 14.3522 3.68508 15.4442C4.13738 16.5361 4.80031 17.5282 5.63604 18.364C6.47177 19.1997 7.46392 19.8626 8.55585 20.3149C9.64778 20.7672 10.8181 21 12 21C13.1819 21 14.3522 20.7672 15.4442 20.3149C16.5361 19.8626 17.5282 19.1997 18.364 18.364C19.1997 17.5282 19.8626 16.5361 20.3149 15.4442C20.7672 14.3522 21 13.1819 21 12C21 9.61305 20.0518 7.32387 18.364 5.63604C16.6761 3.94821 14.3869 3 12 3C9.61305 3 7.32387 3.94821 5.63604 5.63604C3.94821 7.32387 3 9.61305 3 12Z" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
7
|
+
<path d="M12 16V16.01" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
8
|
+
<path d="M12 8.5L12 13" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
9
|
+
</g>
|
|
10
|
+
<defs>
|
|
11
|
+
<clipPath id="clip0_1775_25245">
|
|
12
|
+
<rect width="24" height="24" fill="white"/>
|
|
13
|
+
</clipPath>
|
|
14
|
+
</defs>
|
|
15
|
+
</svg>);
|
|
16
|
+
};
|
|
17
|
+
const ICONS = {
|
|
18
|
+
success: <WarningIcon className="h-6 w-6 text-white"/>,
|
|
19
|
+
warning: <WarningIcon className="h-6 w-6 text-white"/>,
|
|
20
|
+
error: <WarningIcon className="h-6 w-6 text-white"/>
|
|
21
|
+
};
|
|
22
|
+
const DaeryunTalkToast = ({ type, title, description, duration = 3000, onClose }) => {
|
|
23
|
+
const timerRef = useRef(null);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (timerRef.current) {
|
|
26
|
+
clearTimeout(timerRef === null || timerRef === void 0 ? void 0 : timerRef.current);
|
|
27
|
+
}
|
|
28
|
+
const timer = setTimeout(() => {
|
|
29
|
+
onClose();
|
|
30
|
+
}, duration || 3000);
|
|
31
|
+
timerRef.current = timer;
|
|
32
|
+
return () => {
|
|
33
|
+
clearTimeout(timer);
|
|
34
|
+
};
|
|
35
|
+
}, [duration, onClose]);
|
|
36
|
+
const closeToast = () => {
|
|
37
|
+
if (timerRef.current) {
|
|
38
|
+
clearTimeout(timerRef.current);
|
|
39
|
+
timerRef.current = null;
|
|
40
|
+
}
|
|
41
|
+
onClose();
|
|
42
|
+
};
|
|
43
|
+
return (<>
|
|
44
|
+
<div className=" flex h-[48px] w-full items-center justify-center space-x-[6px] rounded-[25px] bg-[#505050] text-white">
|
|
45
|
+
<div className="mt-0.5 flex-shrink-0">{ICONS[type]}</div>
|
|
46
|
+
<div className="flex">
|
|
47
|
+
<h3 className="text-[14px] font-[400] leading-[130%] tracking-[-4%]">{title}</h3>
|
|
48
|
+
{/*{description && <p className="mt-0.5 text-sm text-white text-opacity-90">{description}</p>}*/}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
{/*<button*/}
|
|
52
|
+
{/* onClick={closeToast}*/}
|
|
53
|
+
{/* className="ml-3 flex-shrink-0 rounded-full bg-white bg-opacity-10 p-1 hover:bg-opacity-20"*/}
|
|
54
|
+
{/*>*/}
|
|
55
|
+
{/* <svg className="h-4 w-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">*/}
|
|
56
|
+
{/* <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />*/}
|
|
57
|
+
{/* </svg>*/}
|
|
58
|
+
{/*</button>*/}
|
|
59
|
+
</>);
|
|
60
|
+
};
|
|
61
|
+
export default React.memo(DaeryunTalkToast);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
type ToastType = 'success' | 'warning' | 'error';
|
|
3
|
+
|
|
4
|
+
interface ToastProps {
|
|
5
|
+
type: ToastType;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
duration?: number;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// 1. 함수 이름을 PascalCase로 변경
|
|
13
|
+
const WarningIcon = ({ className = '' }: { className?: string }) => {
|
|
14
|
+
return (
|
|
15
|
+
<svg
|
|
16
|
+
width="24"
|
|
17
|
+
height="24"
|
|
18
|
+
viewBox="0 0 24 24"
|
|
19
|
+
fill="none"
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
className={className}
|
|
22
|
+
>
|
|
23
|
+
<g clipPath="url(#clip0_1775_25245)">
|
|
24
|
+
<path
|
|
25
|
+
d="M3 12C3 13.1819 3.23279 14.3522 3.68508 15.4442C4.13738 16.5361 4.80031 17.5282 5.63604 18.364C6.47177 19.1997 7.46392 19.8626 8.55585 20.3149C9.64778 20.7672 10.8181 21 12 21C13.1819 21 14.3522 20.7672 15.4442 20.3149C16.5361 19.8626 17.5282 19.1997 18.364 18.364C19.1997 17.5282 19.8626 16.5361 20.3149 15.4442C20.7672 14.3522 21 13.1819 21 12C21 9.61305 20.0518 7.32387 18.364 5.63604C16.6761 3.94821 14.3869 3 12 3C9.61305 3 7.32387 3.94821 5.63604 5.63604C3.94821 7.32387 3 9.61305 3 12Z"
|
|
26
|
+
stroke="white"
|
|
27
|
+
strokeWidth="2"
|
|
28
|
+
strokeLinecap="round"
|
|
29
|
+
strokeLinejoin="round"
|
|
30
|
+
/>
|
|
31
|
+
<path d="M12 16V16.01" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
|
32
|
+
<path d="M12 8.5L12 13" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
|
33
|
+
</g>
|
|
34
|
+
<defs>
|
|
35
|
+
<clipPath id="clip0_1775_25245">
|
|
36
|
+
<rect width="24" height="24" fill="white" />
|
|
37
|
+
</clipPath>
|
|
38
|
+
</defs>
|
|
39
|
+
</svg>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const ICONS = {
|
|
44
|
+
success: <WarningIcon className="h-6 w-6 text-white" />,
|
|
45
|
+
warning: <WarningIcon className="h-6 w-6 text-white" />,
|
|
46
|
+
error: <WarningIcon className="h-6 w-6 text-white" />
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const DaeryunTalkToast = ({ type, title, description, duration = 3000, onClose }: ToastProps) => {
|
|
50
|
+
const timerRef = useRef<NodeJS.Timeout | null>(null);
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (timerRef.current) {
|
|
54
|
+
clearTimeout(timerRef?.current!);
|
|
55
|
+
}
|
|
56
|
+
const timer = setTimeout(() => {
|
|
57
|
+
onClose();
|
|
58
|
+
}, duration || 3000);
|
|
59
|
+
timerRef.current = timer;
|
|
60
|
+
return () => {
|
|
61
|
+
clearTimeout(timer);
|
|
62
|
+
};
|
|
63
|
+
}, [duration, onClose]);
|
|
64
|
+
|
|
65
|
+
const closeToast = () => {
|
|
66
|
+
if (timerRef.current) {
|
|
67
|
+
clearTimeout(timerRef.current!);
|
|
68
|
+
timerRef.current = null;
|
|
69
|
+
}
|
|
70
|
+
onClose();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<>
|
|
75
|
+
<div className=" flex h-[48px] w-full items-center justify-center space-x-[6px] rounded-[25px] bg-[#505050] text-white">
|
|
76
|
+
<div className="mt-0.5 flex-shrink-0">{ICONS[type]}</div>
|
|
77
|
+
<div className="flex">
|
|
78
|
+
<h3 className="text-[14px] font-[400] leading-[130%] tracking-[-4%]">{title}</h3>
|
|
79
|
+
{/*{description && <p className="mt-0.5 text-sm text-white text-opacity-90">{description}</p>}*/}
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
{/*<button*/}
|
|
83
|
+
{/* onClick={closeToast}*/}
|
|
84
|
+
{/* className="ml-3 flex-shrink-0 rounded-full bg-white bg-opacity-10 p-1 hover:bg-opacity-20"*/}
|
|
85
|
+
{/*>*/}
|
|
86
|
+
{/* <svg className="h-4 w-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">*/}
|
|
87
|
+
{/* <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />*/}
|
|
88
|
+
{/* </svg>*/}
|
|
89
|
+
{/*</button>*/}
|
|
90
|
+
</>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default React.memo(DaeryunTalkToast);
|
|
@@ -23,7 +23,7 @@ const ZOOM_LEVELS = [25, 50, 75, 100, 125, 150, 200];
|
|
|
23
23
|
const ImageViewer = () => {
|
|
24
24
|
var _a;
|
|
25
25
|
const { isImageViewerOpen, selectedImageFile, imageViewerMessage, closeImageViewer } = useDaeryuntalk();
|
|
26
|
-
const images = ((_a = imageViewerMessage === null || imageViewerMessage === void 0 ? void 0 : imageViewerMessage.files) === null || _a === void 0 ? void 0 : _a.filter(item => item.type === 'image')) || [];
|
|
26
|
+
const images = ((_a = imageViewerMessage === null || imageViewerMessage === void 0 ? void 0 : imageViewerMessage.files) === null || _a === void 0 ? void 0 : _a.filter(item => (item === null || item === void 0 ? void 0 : item.type) === 'image')) || [];
|
|
27
27
|
const initialIndex = images.findIndex(img => img.fileNumber === (selectedImageFile === null || selectedImageFile === void 0 ? void 0 : selectedImageFile.fileNumber));
|
|
28
28
|
const [currentIndex, setCurrentIndex] = useState(initialIndex >= 0 ? initialIndex : 0);
|
|
29
29
|
const [rotation, setRotation] = useState(0);
|
|
@@ -22,7 +22,7 @@ type PreviewImage = {
|
|
|
22
22
|
const ImageViewer = () => {
|
|
23
23
|
const { isImageViewerOpen, selectedImageFile, imageViewerMessage, closeImageViewer } = useDaeryuntalk();
|
|
24
24
|
|
|
25
|
-
const images = imageViewerMessage?.files?.filter(item => item
|
|
25
|
+
const images = imageViewerMessage?.files?.filter(item => item?.type === 'image') || [];
|
|
26
26
|
const initialIndex = images.findIndex(img => img.fileNumber === selectedImageFile?.fileNumber);
|
|
27
27
|
|
|
28
28
|
const [currentIndex, setCurrentIndex] = useState(initialIndex >= 0 ? initialIndex : 0);
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* 3. 웹소켓 연결
|
|
8
8
|
* 4. 채팅 문의 관리
|
|
9
9
|
*/
|
|
10
|
-
import { IDaeryunTalkResponseWrapper, WebSocketInitDataResponse, IChatInquiryMainDataResponse, ChatInquiryCreateDataResponse, ChatInquiryDetailDataResponse, SendMessageResponse, ChatInquiryMessageListDataResponse } from './type/response';
|
|
10
|
+
import { IDaeryunTalkResponseWrapper, WebSocketInitDataResponse, IChatInquiryMainDataResponse, ChatInquiryCreateDataResponse, ChatInquiryDetailDataResponse, SendMessageResponse, ChatInquiryMessageListDataResponse, HistoryListResponse, RequestConfirmNumberResponse } from './type/response';
|
|
11
|
+
export declare const DEFAULT_API_VERSION = "1.0.0";
|
|
11
12
|
export declare const MESSAGE_TYPES: {
|
|
12
13
|
SYSTEM: string;
|
|
13
14
|
BOT: string;
|
|
@@ -131,3 +132,30 @@ export declare const getMessageFileDownloadUrl: ({ chatInquiryNumber, fileNumber
|
|
|
131
132
|
}) => Promise<IDaeryunTalkResponseWrapper<{
|
|
132
133
|
url: string;
|
|
133
134
|
}>>;
|
|
135
|
+
/**
|
|
136
|
+
* 점유 인증 번호 요청
|
|
137
|
+
* @param name
|
|
138
|
+
* @param cellPhoneNumber
|
|
139
|
+
* @param version
|
|
140
|
+
*/
|
|
141
|
+
export declare const requestPhone: ({ name, cellPhoneNumber, version }: {
|
|
142
|
+
name: string;
|
|
143
|
+
cellPhoneNumber: string;
|
|
144
|
+
version?: string;
|
|
145
|
+
}) => Promise<IDaeryunTalkResponseWrapper<RequestConfirmNumberResponse>>;
|
|
146
|
+
/**
|
|
147
|
+
* 점유 인증 번호 검증
|
|
148
|
+
* @param name
|
|
149
|
+
* @param cellPhoneNumber
|
|
150
|
+
* @param certificationNumber
|
|
151
|
+
* @param version
|
|
152
|
+
*/
|
|
153
|
+
export declare const historyPhoneAuth: ({ name, cellPhoneNumber, certificationNumber, version }: {
|
|
154
|
+
name: string;
|
|
155
|
+
cellPhoneNumber: string;
|
|
156
|
+
certificationNumber: string;
|
|
157
|
+
version?: string;
|
|
158
|
+
}) => Promise<IDaeryunTalkResponseWrapper<unknown>>;
|
|
159
|
+
export declare const getHistoryList: ({ version }: {
|
|
160
|
+
version?: string;
|
|
161
|
+
}) => Promise<IDaeryunTalkResponseWrapper<HistoryListResponse>>;
|