@daeryun/dr_components 0.7.78 → 0.7.80
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/asset/images/daeryuntalk/download.svg +5 -0
- package/dist/asset/images/daeryuntalk/firstGo.svg +5 -0
- package/dist/asset/images/daeryuntalk/objectBack.svg +4 -0
- package/dist/asset/images/daeryuntalk/viewer/close.svg +4 -0
- package/dist/asset/images/daeryuntalk/viewer/gray-download.svg +7 -0
- package/dist/asset/images/daeryuntalk/viewer/move-button.svg +4 -0
- package/dist/asset/images/daeryuntalk/viewer/rotate.svg +17 -0
- package/dist/asset/images/daeryuntalk/viewer/zoom-in.svg +5 -0
- package/dist/asset/images/daeryuntalk/viewer/zoom-out.svg +6 -0
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/components/Daeryuntalk/ChatButton.jsx +1 -0
- package/dist/components/Daeryuntalk/ChatButton.tsx +1 -0
- package/dist/components/Daeryuntalk/ChatConversation.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatConversation.jsx +19 -12
- package/dist/components/Daeryuntalk/ChatConversation.tsx +48 -11
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +27 -6
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +39 -8
- package/dist/components/Daeryuntalk/ChatInput.jsx +23 -3
- package/dist/components/Daeryuntalk/ChatInput.tsx +26 -10
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.d.ts +10 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +186 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +252 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.d.ts +8 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.jsx +87 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.tsx +115 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.d.ts +8 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.jsx +13 -0
- package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.tsx +25 -0
- package/dist/components/Daeryuntalk/ChatItem/RichText.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatItem/RichText.jsx +25 -0
- package/dist/components/Daeryuntalk/ChatItem/RichText.tsx +32 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowAuthForm.d.ts +8 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowAuthForm.jsx +19 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowAuthForm.tsx +31 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.jsx +20 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.tsx +36 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +9 -0
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +16 -0
- package/dist/components/Daeryuntalk/ChatMessage.d.ts +11 -1
- package/dist/components/Daeryuntalk/ChatMessage.jsx +116 -14
- package/dist/components/Daeryuntalk/ChatMessage.tsx +175 -20
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.d.ts +7 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.jsx +16 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectBack.tsx +28 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.d.ts +10 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.jsx +118 -0
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.tsx +162 -0
- package/dist/components/Daeryuntalk/ChatWidget.jsx +7 -3
- package/dist/components/Daeryuntalk/ChatWidget.tsx +9 -5
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +37 -5
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +71 -157
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +128 -189
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.d.ts +17 -0
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +57 -0
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +82 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.d.ts +3 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.jsx +172 -0
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.tsx +236 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +133 -0
- package/dist/{lib/api → components/Daeryuntalk/_api}/daeryuntalk/index.js +251 -46
- package/dist/{lib/api → components/Daeryuntalk/_api}/daeryuntalk/index.ts +353 -129
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.d.ts +115 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.js +1 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.ts +135 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.d.ts +6 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.js +11 -0
- package/dist/components/Daeryuntalk/_enums/ask-status.ts +11 -0
- package/dist/components/Daeryuntalk/_enums/message_type.d.ts +6 -0
- package/dist/components/Daeryuntalk/_enums/message_type.js +13 -0
- package/dist/components/Daeryuntalk/_enums/message_type.ts +13 -0
- package/dist/components/Daeryuntalk/_enums/sender_type.d.ts +8 -0
- package/dist/components/Daeryuntalk/_enums/sender_type.js +16 -0
- package/dist/components/Daeryuntalk/_enums/sender_type.ts +16 -0
- package/dist/components/Daeryuntalk/_enums/socket_type.d.ts +22 -0
- package/dist/components/Daeryuntalk/_enums/socket_type.js +23 -0
- package/dist/components/Daeryuntalk/_enums/socket_type.ts +31 -0
- package/dist/components/Daeryuntalk/_enums/template.d.ts +32 -0
- package/dist/components/Daeryuntalk/_enums/template.js +49 -0
- package/dist/components/Daeryuntalk/_enums/template.ts +53 -0
- package/dist/components/Daeryuntalk/_enums/work_flow_object_expose.d.ts +34 -0
- package/dist/components/Daeryuntalk/_enums/work_flow_object_expose.js +66 -0
- package/dist/components/Daeryuntalk/_enums/work_flow_object_expose.ts +69 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.d.ts +46 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +296 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +364 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHistory.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHistory.js +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHistory.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.js +22 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.ts +30 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +21 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +205 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +240 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useViewerHook.d.ts +8 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useViewerHook.js +18 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useViewerHook.ts +23 -0
- package/dist/components/Daeryuntalk/_lib/index.d.ts +7 -0
- package/dist/components/Daeryuntalk/_lib/index.js +101 -0
- package/dist/components/Daeryuntalk/_lib/index.ts +137 -0
- package/dist/components/Daeryuntalk/_lib/utils.d.ts +2 -0
- package/dist/components/Daeryuntalk/_lib/utils.js +16 -0
- package/dist/components/Daeryuntalk/_lib/utils.ts +17 -0
- package/dist/components/Daeryuntalk/{types.d.ts → _types/message.d.ts} +33 -17
- package/dist/components/Daeryuntalk/_types/message.js +19 -0
- package/dist/components/Daeryuntalk/{types.ts → _types/message.ts} +64 -19
- package/dist/components/Daeryuntalk/_types/message_object.d.ts +16 -0
- package/dist/components/Daeryuntalk/_types/message_object.js +1 -0
- package/dist/components/Daeryuntalk/_types/message_object.ts +20 -0
- package/dist/components/Daeryuntalk/_types/socket/message.d.ts +0 -0
- package/dist/components/Daeryuntalk/_types/socket/message.js +1 -0
- package/dist/components/Daeryuntalk/_types/socket/message.ts +0 -0
- package/dist/components/Daeryuntalk/_types/socket/workflow.d.ts +15 -0
- package/dist/components/Daeryuntalk/_types/socket/workflow.js +1 -0
- package/dist/components/Daeryuntalk/_types/socket/workflow.ts +15 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button1.d.ts +10 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button1.jsx +11 -0
- package/dist/components/Daeryuntalk/_ui/buttons/Button1.tsx +28 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input1.d.ts +12 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input1.jsx +9 -0
- package/dist/components/Daeryuntalk/_ui/inputs/Input1.tsx +39 -0
- package/dist/components/Daeryuntalk/index.tsx +1 -0
- package/dist/components/common/data/index.js +2 -2
- package/dist/components/common/data/index.ts +2 -2
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.ts +1 -1
- package/dist/styles/globals.css +161 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -2
- package/dist/components/Daeryuntalk/types.js +0 -8
- package/dist/lib/api/daeryuntalk/index.d.ts +0 -143
- /package/dist/{lib/api → components/Daeryuntalk/_api}/index.d.ts +0 -0
- /package/dist/{lib/api → components/Daeryuntalk/_api}/index.js +0 -0
- /package/dist/{lib/api → components/Daeryuntalk/_api}/index.ts +0 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { Dispatch, MutableRefObject, SetStateAction, useCallback, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { initializeDaeryuntalk as apiInitializeDaeryuntalk } from '../../_api/daeryuntalk';
|
|
4
|
+
import { Message } from '../../_types/message';
|
|
5
|
+
import { IChatInquiryMainDataResponse } from '../../_api/daeryuntalk/type/response';
|
|
6
|
+
import { convertApiMessageToUiMessage, convertSocketObjectToUiMessage } from '../../_lib';
|
|
7
|
+
import { MessageObject } from '../../_types/message_object';
|
|
8
|
+
import { IInquiryWorkFlowUpdate } from '../../_types/socket/workflow';
|
|
9
|
+
import { MessageSocketType } from '../../_enums/socket_type';
|
|
10
|
+
|
|
11
|
+
interface props {
|
|
12
|
+
setIsConnected: Dispatch<SetStateAction<boolean>>;
|
|
13
|
+
setIsLoading: Dispatch<SetStateAction<boolean>>;
|
|
14
|
+
setMessages: Dispatch<SetStateAction<Message[]>>;
|
|
15
|
+
setWorkFlowStack: Dispatch<SetStateAction<string[]>>;
|
|
16
|
+
setMessageObject: Dispatch<SetStateAction<MessageObject | null>>;
|
|
17
|
+
setInquiryMainData: Dispatch<SetStateAction<IChatInquiryMainDataResponse | null>>;
|
|
18
|
+
socketRef: MutableRefObject<WebSocket | null>;
|
|
19
|
+
}
|
|
20
|
+
export const useSocketEventHandler = ({
|
|
21
|
+
setIsConnected,
|
|
22
|
+
setIsLoading,
|
|
23
|
+
setMessages,
|
|
24
|
+
setInquiryMainData,
|
|
25
|
+
socketRef,
|
|
26
|
+
setWorkFlowStack,
|
|
27
|
+
setMessageObject
|
|
28
|
+
}: props) => {
|
|
29
|
+
/**
|
|
30
|
+
* 1. heartbeat
|
|
31
|
+
* - 목적: 사용자의 이탈 여부를 추적하기 위한 주기적 하트비트 전송
|
|
32
|
+
* - 설명: N초 주기로 전송되며, 이탈 판단 로직에 사용됨
|
|
33
|
+
* - 예시:
|
|
34
|
+
* {
|
|
35
|
+
* "type": "heartbeat",
|
|
36
|
+
* "payload": {
|
|
37
|
+
* "chat_inquiry_number": "C3213638792875684353"
|
|
38
|
+
* }
|
|
39
|
+
* }
|
|
40
|
+
*/
|
|
41
|
+
const sendHeartbeat = useCallback((chatInquiryNumber: string) => {
|
|
42
|
+
const socket = socketRef.current;
|
|
43
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
44
|
+
socket.send(
|
|
45
|
+
JSON.stringify({
|
|
46
|
+
type: 'heartbeat',
|
|
47
|
+
payload: { chat_inquiry_number: chatInquiryNumber }
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
console.log('[WebSocket] heartbeat 전송');
|
|
51
|
+
}
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 2. inquiry.joined
|
|
56
|
+
* - 목적: 특정 문의 세션에 참여를 알림
|
|
57
|
+
* - 설명: 이 요청 이후부터 해당 문의의 메시지 이벤트를 수신 가능
|
|
58
|
+
* - 예시:
|
|
59
|
+
* {
|
|
60
|
+
* "type": "inquiry.joined",
|
|
61
|
+
* "payload": {
|
|
62
|
+
* "chat_inquiry_number": "C3213638792875684353"
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
*/
|
|
66
|
+
const sendInquiryJoined = useCallback((chatInquiryNumber: string) => {
|
|
67
|
+
const socket = socketRef.current;
|
|
68
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
69
|
+
socket.send(
|
|
70
|
+
JSON.stringify({
|
|
71
|
+
type: 'inquiry.joined',
|
|
72
|
+
payload: { chat_inquiry_number: chatInquiryNumber }
|
|
73
|
+
})
|
|
74
|
+
);
|
|
75
|
+
console.log('[WebSocket] inquiry.joined 전송');
|
|
76
|
+
}
|
|
77
|
+
}, []);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 3. inquiry.left
|
|
81
|
+
* - 목적: 특정 문의 세션에서 이탈을 알림
|
|
82
|
+
* - 설명: 이 요청 이후 해당 문의의 메시지 이벤트는 수신되지 않음
|
|
83
|
+
* - 예시:
|
|
84
|
+
* {
|
|
85
|
+
* "type": "inquiry.left",
|
|
86
|
+
* "payload": {
|
|
87
|
+
* "chat_inquiry_number": "C3213638792875684353"
|
|
88
|
+
* }
|
|
89
|
+
* }
|
|
90
|
+
*/
|
|
91
|
+
const sendInquiryLeft = useCallback((chatInquiryNumber: string) => {
|
|
92
|
+
const socket = socketRef.current;
|
|
93
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
94
|
+
socket.send(
|
|
95
|
+
JSON.stringify({
|
|
96
|
+
type: 'inquiry.left',
|
|
97
|
+
payload: { chat_inquiry_number: chatInquiryNumber }
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
console.log('[WebSocket] inquiry.left 전송');
|
|
101
|
+
}
|
|
102
|
+
}, []);
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 4. history.entered
|
|
106
|
+
* - 목적: 히스토리 목록 화면 진입 시, 여러 문의의 메시지 이벤트 수신을 요청
|
|
107
|
+
* - 설명: 복수 문의 번호를 등록함으로써 여러 문의에 대한 변경사항을 동시에 수신
|
|
108
|
+
* - 예시:
|
|
109
|
+
* {
|
|
110
|
+
* "type": "history.entered",
|
|
111
|
+
* "payload": {
|
|
112
|
+
* "chat_inquiry_numbers": [
|
|
113
|
+
* "C3213638792875684353",
|
|
114
|
+
* "C3213638792875689999",
|
|
115
|
+
* "C3213638792875777"
|
|
116
|
+
* ]
|
|
117
|
+
* }
|
|
118
|
+
* }
|
|
119
|
+
*/
|
|
120
|
+
const sendHistoryEntered = useCallback((chatInquiryNumbers: string[]) => {
|
|
121
|
+
const socket = socketRef.current;
|
|
122
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
123
|
+
socket.send(
|
|
124
|
+
JSON.stringify({
|
|
125
|
+
type: 'history.entered',
|
|
126
|
+
payload: { chat_inquiry_numbers: chatInquiryNumbers }
|
|
127
|
+
})
|
|
128
|
+
);
|
|
129
|
+
console.log('[WebSocket] history.entered 전송');
|
|
130
|
+
}
|
|
131
|
+
}, []);
|
|
132
|
+
|
|
133
|
+
// Daeryuntalk API 초기화 메소드
|
|
134
|
+
const initializeDaeryuntalk = useCallback(async (version?: string) => {
|
|
135
|
+
console.log('[DaeryuntalkContext] 초기화 메소드 호출됨', version ? `버전: ${version}` : '기본 버전 사용');
|
|
136
|
+
try {
|
|
137
|
+
setIsLoading(true);
|
|
138
|
+
console.log('[DaeryuntalkContext] 로딩 상태 설정: true');
|
|
139
|
+
|
|
140
|
+
const { inquiryData, socket } = await apiInitializeDaeryuntalk(
|
|
141
|
+
socket => {
|
|
142
|
+
console.log('[DaeryuntalkContext] 웹소켓 연결 콜백 - 연결 성공');
|
|
143
|
+
setIsConnected(true);
|
|
144
|
+
},
|
|
145
|
+
event => {
|
|
146
|
+
console.log('[DaeryuntalkContext] 웹소켓 메시지 수신됨');
|
|
147
|
+
try {
|
|
148
|
+
const data = typeof event === 'string' ? JSON.parse(event) : event;
|
|
149
|
+
console.log('socket data', data);
|
|
150
|
+
// 메시지 생성
|
|
151
|
+
if (data.type === MessageSocketType.MESSAGE_CREATED && data.payload?.message) {
|
|
152
|
+
const newMessage = convertApiMessageToUiMessage(data.payload.message);
|
|
153
|
+
console.log('메세지 넣기 시작');
|
|
154
|
+
setMessages(prev => {
|
|
155
|
+
const isDuplicate = prev.some(msg => msg.messageNumber === newMessage.messageNumber);
|
|
156
|
+
return isDuplicate ? prev : [...prev, newMessage];
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
// 수정 기능 있었나??
|
|
160
|
+
if (data.type === MessageSocketType.MESSAGE_UPDATED) {
|
|
161
|
+
const newMessage = convertApiMessageToUiMessage(data.payload.message);
|
|
162
|
+
setMessages(prev => {
|
|
163
|
+
const index = prev.findIndex(msg => msg.messageNumber === newMessage.messageNumber);
|
|
164
|
+
|
|
165
|
+
if (index !== -1) {
|
|
166
|
+
// 기존 메시지가 있으면 해당 위치에 새 메시지로 교체
|
|
167
|
+
const updated = [...prev];
|
|
168
|
+
updated[index] = newMessage;
|
|
169
|
+
return updated;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// 없으면 새 메시지를 추가
|
|
173
|
+
return [...prev, newMessage];
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
// 메세지 회수됨 -> 이거는 관리자에서는 필요없는듯?
|
|
177
|
+
if (data.type === MessageSocketType.MESSAGE_COLLECTED) {
|
|
178
|
+
}
|
|
179
|
+
// 안읽음 count
|
|
180
|
+
if (data.type === MessageSocketType.INQUIRY_PREVIEW_UPDATED) {
|
|
181
|
+
}
|
|
182
|
+
// 새로운 문의가 생성됨
|
|
183
|
+
if (data.type === MessageSocketType.INQUIRY_OPENED) {
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// 문의 워크플로우 변경됨
|
|
187
|
+
if (data.type === MessageSocketType.INQUIRY_WORKFLOW_UPDATED) {
|
|
188
|
+
const socketPayloadData = data?.payload as IInquiryWorkFlowUpdate;
|
|
189
|
+
console.log('socketPayloadData', socketPayloadData);
|
|
190
|
+
// 워크플로우 스택 업데이트
|
|
191
|
+
setWorkFlowStack(socketPayloadData.work_flow_progress_stack);
|
|
192
|
+
// 오브젝트 업데이트
|
|
193
|
+
setMessageObject(convertSocketObjectToUiMessage(data?.payload));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// 문의가 종료됨
|
|
197
|
+
if (data.type === MessageSocketType.INQUIRY_CLOSED) {
|
|
198
|
+
}
|
|
199
|
+
// 업무 관리자 배정
|
|
200
|
+
if (data.type === MessageSocketType.INQUIRY_ASSIGNED) {
|
|
201
|
+
const payload: {
|
|
202
|
+
chat_inquiry_number: string;
|
|
203
|
+
operator_number: string;
|
|
204
|
+
} = data.payload;
|
|
205
|
+
// 이거는 찾아서 count를 처리해줘야하나??
|
|
206
|
+
}
|
|
207
|
+
// 할당된 상담원이 해제됨
|
|
208
|
+
if (data.type === MessageSocketType.INQUIRY_UNASSIGNED) {
|
|
209
|
+
}
|
|
210
|
+
// 고객 정보가 갱신됨
|
|
211
|
+
if (data.type === MessageSocketType.CUSTOMER_INFO_UPDATED) {
|
|
212
|
+
}
|
|
213
|
+
} catch (error) {
|
|
214
|
+
console.error('[DaeryuntalkContext] 웹소켓 메시지 처리 오류:', error);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
if (inquiryData) {
|
|
220
|
+
setInquiryMainData(inquiryData.data as IChatInquiryMainDataResponse);
|
|
221
|
+
}
|
|
222
|
+
if (socket) {
|
|
223
|
+
socketRef.current = socket;
|
|
224
|
+
}
|
|
225
|
+
} catch (error) {
|
|
226
|
+
console.error('[DaeryuntalkContext] 초기화 오류:', error);
|
|
227
|
+
} finally {
|
|
228
|
+
console.log('[DaeryuntalkContext] 로딩 상태 설정: false');
|
|
229
|
+
setIsLoading(false);
|
|
230
|
+
}
|
|
231
|
+
}, []);
|
|
232
|
+
|
|
233
|
+
return {
|
|
234
|
+
initializeDaeryuntalk,
|
|
235
|
+
sendHeartbeat,
|
|
236
|
+
sendInquiryJoined,
|
|
237
|
+
sendInquiryLeft,
|
|
238
|
+
sendHistoryEntered
|
|
239
|
+
};
|
|
240
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FileInfo, Message } from '../../_types/message';
|
|
2
|
+
export declare const useViewerHook: () => {
|
|
3
|
+
isImageViewerOpen: boolean;
|
|
4
|
+
selectedImageFile: FileInfo | null;
|
|
5
|
+
imageViewerMessage: Message | null;
|
|
6
|
+
openImageViewer: (file: FileInfo, msg: Message) => void;
|
|
7
|
+
closeImageViewer: () => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
export const useViewerHook = () => {
|
|
3
|
+
// 이미지 뷰어용
|
|
4
|
+
const [isImageViewerOpen, setIsImageViewerOpen] = useState(false);
|
|
5
|
+
const [selectedImageFile, setSelectedImageFile] = useState(null);
|
|
6
|
+
const [imageViewerMessage, setImageViewerMessage] = useState(null);
|
|
7
|
+
const openImageViewer = (file, msg) => {
|
|
8
|
+
setSelectedImageFile(file);
|
|
9
|
+
setImageViewerMessage(msg);
|
|
10
|
+
setIsImageViewerOpen(true);
|
|
11
|
+
};
|
|
12
|
+
const closeImageViewer = () => {
|
|
13
|
+
setIsImageViewerOpen(false);
|
|
14
|
+
setSelectedImageFile(null);
|
|
15
|
+
setImageViewerMessage(null);
|
|
16
|
+
};
|
|
17
|
+
return { isImageViewerOpen, selectedImageFile, imageViewerMessage, openImageViewer, closeImageViewer };
|
|
18
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { FileInfo, Message } from '../../_types/message';
|
|
3
|
+
|
|
4
|
+
export const useViewerHook = () => {
|
|
5
|
+
// 이미지 뷰어용
|
|
6
|
+
const [isImageViewerOpen, setIsImageViewerOpen] = useState(false);
|
|
7
|
+
const [selectedImageFile, setSelectedImageFile] = useState<FileInfo | null>(null);
|
|
8
|
+
const [imageViewerMessage, setImageViewerMessage] = useState<Message | null>(null);
|
|
9
|
+
|
|
10
|
+
const openImageViewer = (file: FileInfo, msg: Message) => {
|
|
11
|
+
setSelectedImageFile(file);
|
|
12
|
+
setImageViewerMessage(msg);
|
|
13
|
+
setIsImageViewerOpen(true);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const closeImageViewer = () => {
|
|
17
|
+
setIsImageViewerOpen(false);
|
|
18
|
+
setSelectedImageFile(null);
|
|
19
|
+
setImageViewerMessage(null);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return { isImageViewerOpen, selectedImageFile, imageViewerMessage, openImageViewer, closeImageViewer };
|
|
23
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChatInquiryDetailDataResponse, ChatMessage as ApiChatMessage } from '../_api/daeryuntalk/type/response';
|
|
2
|
+
import { Message } from '../_types/message';
|
|
3
|
+
import { MessageObject } from '../_types/message_object';
|
|
4
|
+
import { IInquiryWorkFlowUpdate } from '../_types/socket/workflow';
|
|
5
|
+
export declare const convertApiMessageToUiMessage: (apiMessage: ApiChatMessage) => Message;
|
|
6
|
+
export declare const convertApiMessageObjectToUiMessageObject: (apiObject: ChatInquiryDetailDataResponse) => MessageObject;
|
|
7
|
+
export declare const convertSocketObjectToUiMessage: (obj: IInquiryWorkFlowUpdate) => MessageObject;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export const convertApiMessageToUiMessage = (apiMessage) => {
|
|
2
|
+
var _a, _b, _c;
|
|
3
|
+
const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ messageNumber: apiMessage.message_number, plainText: apiMessage.plain_text,
|
|
4
|
+
// API에서 오는 모든 필드들
|
|
5
|
+
senderType: apiMessage.sender_type, messageType: apiMessage.message_type, messageStatus: apiMessage.message_status, userKey: apiMessage.user_key, inquiryNumber: apiMessage.inquiry_number, templateType: apiMessage.template_type, createdAt: new Date(apiMessage.created_at), updatedAt: apiMessage.updated_at ? new Date(apiMessage.updated_at) : undefined, language: apiMessage.language, timestamp: apiMessage.timestamp }, (apiMessage.rich_text && {
|
|
6
|
+
richText: {
|
|
7
|
+
version: ((_a = apiMessage.rich_text) === null || _a === void 0 ? void 0 : _a.version) || 0,
|
|
8
|
+
htmlContent: apiMessage.rich_text.html_content || '',
|
|
9
|
+
structuredData: ((_b = apiMessage === null || apiMessage === void 0 ? void 0 : apiMessage.rich_text) === null || _b === void 0 ? void 0 : _b.structured_data) || null
|
|
10
|
+
}
|
|
11
|
+
})), (apiMessage.blocks &&
|
|
12
|
+
apiMessage.blocks.length > 0 && {
|
|
13
|
+
blocks: apiMessage.blocks.map(block => (Object.assign({ type: block.type, value: block.value }, (block.icon_url && { iconUrl: block.icon_url }))))
|
|
14
|
+
})), (apiMessage.work_flow && {
|
|
15
|
+
workFlow: {
|
|
16
|
+
workFlowNumber: apiMessage.work_flow.work_flow_number,
|
|
17
|
+
optionExposureYn: apiMessage.work_flow.option_exposure_yn,
|
|
18
|
+
imageUrl: ((_c = apiMessage === null || apiMessage === void 0 ? void 0 : apiMessage.work_flow) === null || _c === void 0 ? void 0 : _c.image_url) || ''
|
|
19
|
+
}
|
|
20
|
+
})), (apiMessage.form && {
|
|
21
|
+
form: {
|
|
22
|
+
type: apiMessage.form.type,
|
|
23
|
+
inputs: apiMessage.form.inputs.length > 0
|
|
24
|
+
? apiMessage.form.inputs.map(item => {
|
|
25
|
+
return {
|
|
26
|
+
type: item.type,
|
|
27
|
+
label: item.label,
|
|
28
|
+
value: item.value,
|
|
29
|
+
readOnly: item.read_only,
|
|
30
|
+
bindingKey: item.binding_key
|
|
31
|
+
};
|
|
32
|
+
})
|
|
33
|
+
: [],
|
|
34
|
+
submittedAt: apiMessage.form.submitted_at || '',
|
|
35
|
+
submitButton: ''
|
|
36
|
+
}
|
|
37
|
+
})), (apiMessage.files && {
|
|
38
|
+
files: apiMessage.files.map(item => {
|
|
39
|
+
return {
|
|
40
|
+
fileNumber: item.file_number,
|
|
41
|
+
fileKey: item.file_key,
|
|
42
|
+
name: item.name,
|
|
43
|
+
type: item.type,
|
|
44
|
+
contentType: item.content_type,
|
|
45
|
+
size: item.size,
|
|
46
|
+
sequence: item.sequence,
|
|
47
|
+
thumbnailUrl: item.thumbnail_url,
|
|
48
|
+
originalUrl: item.original_url
|
|
49
|
+
};
|
|
50
|
+
})
|
|
51
|
+
}));
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
// API불러왔을 때용도
|
|
55
|
+
export const convertApiMessageObjectToUiMessageObject = (apiObject) => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
const result = {
|
|
58
|
+
exposeObjectListYn: apiObject.object_expose_info.expose_object_list_yn,
|
|
59
|
+
messageNumber: apiObject.object_expose_info.message_number,
|
|
60
|
+
workFlowNumber: apiObject.object_expose_info.work_flow_number,
|
|
61
|
+
objectList: (_a = apiObject === null || apiObject === void 0 ? void 0 : apiObject.object_expose_info.object_list) === null || _a === void 0 ? void 0 : _a.map(item => {
|
|
62
|
+
return {
|
|
63
|
+
objectNumber: item.object_number,
|
|
64
|
+
objectName: item.object_name,
|
|
65
|
+
iconImageUrl: item.icon_image_url,
|
|
66
|
+
sequence: item.sequence,
|
|
67
|
+
actionCode: item.action_code,
|
|
68
|
+
objectUiCode: item.object_ui_code
|
|
69
|
+
};
|
|
70
|
+
}),
|
|
71
|
+
// work_flow_progress_stack 이걸로 통일 예정
|
|
72
|
+
workFlowProgressStack: (_b = apiObject === null || apiObject === void 0 ? void 0 : apiObject.work_flow_progress_stack) !== null && _b !== void 0 ? _b : [],
|
|
73
|
+
objectGroupUiCode: (apiObject === null || apiObject === void 0 ? void 0 : apiObject.object_expose_info.object_group_ui_code) || ''
|
|
74
|
+
};
|
|
75
|
+
return result;
|
|
76
|
+
};
|
|
77
|
+
// 소켓으로 받았을 떄용도
|
|
78
|
+
export const convertSocketObjectToUiMessage = (obj) => {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
const result = {
|
|
81
|
+
exposeObjectListYn: true,
|
|
82
|
+
messageNumber: obj.message_number,
|
|
83
|
+
workFlowNumber: (obj === null || obj === void 0 ? void 0 : obj.work_flow_progress_stack)
|
|
84
|
+
? obj.work_flow_progress_stack[obj.work_flow_progress_stack.length - 1] || ''
|
|
85
|
+
: '',
|
|
86
|
+
objectList: (_a = obj === null || obj === void 0 ? void 0 : obj.object_list) === null || _a === void 0 ? void 0 : _a.map(item => {
|
|
87
|
+
return {
|
|
88
|
+
objectNumber: item.object_number,
|
|
89
|
+
objectName: item.object_name,
|
|
90
|
+
iconImageUrl: item.icon_image_url,
|
|
91
|
+
sequence: item.sequence,
|
|
92
|
+
actionCode: item.action_code,
|
|
93
|
+
objectUiCode: item.object_ui_code
|
|
94
|
+
};
|
|
95
|
+
}),
|
|
96
|
+
// work_flow_progress_stack 이걸로 통일 예정
|
|
97
|
+
workFlowProgressStack: (_b = obj === null || obj === void 0 ? void 0 : obj.work_flow_progress_stack) !== null && _b !== void 0 ? _b : [],
|
|
98
|
+
objectGroupUiCode: (obj === null || obj === void 0 ? void 0 : obj.object_group_ui_code) || ''
|
|
99
|
+
};
|
|
100
|
+
return result;
|
|
101
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChatInquiryDetailDataResponse,
|
|
3
|
+
ChatMessage as ApiChatMessage,
|
|
4
|
+
ObjectExposeInfo
|
|
5
|
+
} from '../_api/daeryuntalk/type/response';
|
|
6
|
+
import { FormInput, FormInputType, Message } from '../_types/message';
|
|
7
|
+
import { MessageObject } from '../_types/message_object';
|
|
8
|
+
import { IInquiryWorkFlowUpdate } from '../_types/socket/workflow';
|
|
9
|
+
|
|
10
|
+
export const convertApiMessageToUiMessage = (apiMessage: ApiChatMessage): Message => {
|
|
11
|
+
const result: Message = {
|
|
12
|
+
messageNumber: apiMessage.message_number,
|
|
13
|
+
plainText: apiMessage.plain_text,
|
|
14
|
+
|
|
15
|
+
// API에서 오는 모든 필드들
|
|
16
|
+
senderType: apiMessage.sender_type,
|
|
17
|
+
messageType: apiMessage.message_type,
|
|
18
|
+
messageStatus: apiMessage.message_status,
|
|
19
|
+
userKey: apiMessage.user_key,
|
|
20
|
+
inquiryNumber: apiMessage.inquiry_number,
|
|
21
|
+
templateType: apiMessage.template_type,
|
|
22
|
+
createdAt: new Date(apiMessage.created_at),
|
|
23
|
+
updatedAt: apiMessage.updated_at ? new Date(apiMessage.updated_at) : undefined,
|
|
24
|
+
language: apiMessage.language,
|
|
25
|
+
timestamp: apiMessage.timestamp,
|
|
26
|
+
|
|
27
|
+
// 팁탭 에디터 데이터
|
|
28
|
+
...(apiMessage.rich_text && {
|
|
29
|
+
richText: {
|
|
30
|
+
version: apiMessage.rich_text?.version || 0,
|
|
31
|
+
htmlContent: apiMessage.rich_text.html_content || '',
|
|
32
|
+
structuredData: apiMessage?.rich_text?.structured_data || null
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
|
|
36
|
+
// 블록 관련
|
|
37
|
+
...(apiMessage.blocks &&
|
|
38
|
+
apiMessage.blocks.length > 0 && {
|
|
39
|
+
blocks: apiMessage.blocks.map(block => ({
|
|
40
|
+
type: block.type,
|
|
41
|
+
value: block.value,
|
|
42
|
+
...(block.icon_url && { iconUrl: block.icon_url })
|
|
43
|
+
}))
|
|
44
|
+
}),
|
|
45
|
+
...(apiMessage.work_flow && {
|
|
46
|
+
workFlow: {
|
|
47
|
+
workFlowNumber: apiMessage.work_flow.work_flow_number,
|
|
48
|
+
optionExposureYn: apiMessage.work_flow.option_exposure_yn,
|
|
49
|
+
imageUrl: apiMessage?.work_flow?.image_url || ''
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
...(apiMessage.form && {
|
|
53
|
+
form: {
|
|
54
|
+
type: apiMessage.form.type,
|
|
55
|
+
inputs:
|
|
56
|
+
apiMessage.form.inputs.length > 0
|
|
57
|
+
? apiMessage.form.inputs.map(item => {
|
|
58
|
+
return {
|
|
59
|
+
type: item.type as FormInputType,
|
|
60
|
+
label: item.label,
|
|
61
|
+
value: item.value,
|
|
62
|
+
readOnly: item.read_only,
|
|
63
|
+
bindingKey: item.binding_key
|
|
64
|
+
};
|
|
65
|
+
})
|
|
66
|
+
: [],
|
|
67
|
+
submittedAt: apiMessage.form.submitted_at || '',
|
|
68
|
+
submitButton: ''
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
...(apiMessage.files && {
|
|
72
|
+
files: apiMessage.files.map(item => {
|
|
73
|
+
return {
|
|
74
|
+
fileNumber: item.file_number,
|
|
75
|
+
fileKey: item.file_key,
|
|
76
|
+
name: item.name,
|
|
77
|
+
type: item.type,
|
|
78
|
+
contentType: item.content_type,
|
|
79
|
+
size: item.size,
|
|
80
|
+
sequence: item.sequence,
|
|
81
|
+
thumbnailUrl: item.thumbnail_url,
|
|
82
|
+
originalUrl: item.original_url
|
|
83
|
+
};
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
return result;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// API불러왔을 때용도
|
|
91
|
+
export const convertApiMessageObjectToUiMessageObject = (apiObject: ChatInquiryDetailDataResponse): MessageObject => {
|
|
92
|
+
const result: MessageObject = {
|
|
93
|
+
exposeObjectListYn: apiObject.object_expose_info.expose_object_list_yn,
|
|
94
|
+
messageNumber: apiObject.object_expose_info.message_number,
|
|
95
|
+
workFlowNumber: apiObject.object_expose_info.work_flow_number,
|
|
96
|
+
objectList: apiObject?.object_expose_info.object_list?.map(item => {
|
|
97
|
+
return {
|
|
98
|
+
objectNumber: item.object_number,
|
|
99
|
+
objectName: item.object_name,
|
|
100
|
+
iconImageUrl: item.icon_image_url,
|
|
101
|
+
sequence: item.sequence,
|
|
102
|
+
actionCode: item.action_code,
|
|
103
|
+
objectUiCode: item.object_ui_code
|
|
104
|
+
};
|
|
105
|
+
}),
|
|
106
|
+
// work_flow_progress_stack 이걸로 통일 예정
|
|
107
|
+
workFlowProgressStack: apiObject?.work_flow_progress_stack ?? [],
|
|
108
|
+
objectGroupUiCode: apiObject?.object_expose_info.object_group_ui_code || ''
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return result;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// 소켓으로 받았을 떄용도
|
|
115
|
+
export const convertSocketObjectToUiMessage = (obj: IInquiryWorkFlowUpdate): MessageObject => {
|
|
116
|
+
const result: MessageObject = {
|
|
117
|
+
exposeObjectListYn: true,
|
|
118
|
+
messageNumber: obj.message_number,
|
|
119
|
+
workFlowNumber: obj?.work_flow_progress_stack
|
|
120
|
+
? obj.work_flow_progress_stack[obj.work_flow_progress_stack.length - 1] || ''
|
|
121
|
+
: '',
|
|
122
|
+
objectList: obj?.object_list?.map(item => {
|
|
123
|
+
return {
|
|
124
|
+
objectNumber: item.object_number,
|
|
125
|
+
objectName: item.object_name,
|
|
126
|
+
iconImageUrl: item.icon_image_url,
|
|
127
|
+
sequence: item.sequence,
|
|
128
|
+
actionCode: item.action_code,
|
|
129
|
+
objectUiCode: item.object_ui_code
|
|
130
|
+
};
|
|
131
|
+
}),
|
|
132
|
+
// work_flow_progress_stack 이걸로 통일 예정
|
|
133
|
+
workFlowProgressStack: obj?.work_flow_progress_stack ?? [],
|
|
134
|
+
objectGroupUiCode: obj?.object_group_ui_code || ''
|
|
135
|
+
};
|
|
136
|
+
return result;
|
|
137
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const formatFileSize = (size) => {
|
|
2
|
+
if (size === 0)
|
|
3
|
+
return '0 B';
|
|
4
|
+
const i = Math.floor(Math.log(size) / Math.log(1024));
|
|
5
|
+
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
6
|
+
return (size / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
|
|
7
|
+
};
|
|
8
|
+
export const formatDateToKorean = (timestamp) => {
|
|
9
|
+
const date = new Date(timestamp);
|
|
10
|
+
const year = date.getFullYear();
|
|
11
|
+
const month = date.getMonth() + 1; // 0-based
|
|
12
|
+
const day = date.getDate();
|
|
13
|
+
const hour = date.getHours();
|
|
14
|
+
const minute = date.getMinutes().toString().padStart(2, '0');
|
|
15
|
+
return `${year}년 ${month}월 ${day}일 ${hour}:${minute}`;
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const formatFileSize = (size: number): string => {
|
|
2
|
+
if (size === 0) return '0 B';
|
|
3
|
+
const i = Math.floor(Math.log(size) / Math.log(1024));
|
|
4
|
+
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
5
|
+
return (size / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const formatDateToKorean = (timestamp: string) => {
|
|
9
|
+
const date = new Date(timestamp);
|
|
10
|
+
const year = date.getFullYear();
|
|
11
|
+
const month = date.getMonth() + 1; // 0-based
|
|
12
|
+
const day = date.getDate();
|
|
13
|
+
const hour = date.getHours();
|
|
14
|
+
const minute = date.getMinutes().toString().padStart(2, '0');
|
|
15
|
+
|
|
16
|
+
return `${year}년 ${month}월 ${day}일 ${hour}:${minute}`;
|
|
17
|
+
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
export type MessageSender = 'user' | 'system' | 'operator' | 'bot';
|
|
2
1
|
export interface TextBlock {
|
|
3
2
|
type: string;
|
|
4
3
|
value: string;
|
|
4
|
+
iconUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface WorkFlowInfo {
|
|
7
|
+
workFlowNumber: string;
|
|
8
|
+
optionExposureYn: boolean;
|
|
9
|
+
imageUrl: string;
|
|
5
10
|
}
|
|
6
11
|
export interface Button {
|
|
7
12
|
id: string;
|
|
@@ -14,27 +19,25 @@ export interface FormInput {
|
|
|
14
19
|
type: FormInputType;
|
|
15
20
|
label: string;
|
|
16
21
|
value: string;
|
|
17
|
-
placeholder?: string;
|
|
18
|
-
required?: boolean;
|
|
19
22
|
readOnly?: boolean;
|
|
20
23
|
bindingKey?: string;
|
|
21
|
-
options?: Array<{
|
|
22
|
-
value: string;
|
|
23
|
-
label: string;
|
|
24
|
-
}>;
|
|
25
24
|
}
|
|
26
25
|
export interface Form {
|
|
27
26
|
type: string;
|
|
28
27
|
inputs: FormInput[];
|
|
29
|
-
submittedAt?:
|
|
28
|
+
submittedAt?: string;
|
|
30
29
|
submitButton?: string;
|
|
31
30
|
}
|
|
32
31
|
export interface FileInfo {
|
|
32
|
+
fileNumber: string;
|
|
33
|
+
fileKey: string;
|
|
33
34
|
name: string;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
size
|
|
37
|
-
|
|
35
|
+
type: 'image' | 'file';
|
|
36
|
+
contentType: string;
|
|
37
|
+
size: number;
|
|
38
|
+
sequence: number;
|
|
39
|
+
thumbnailUrl: string;
|
|
40
|
+
originalUrl: string;
|
|
38
41
|
}
|
|
39
42
|
export interface ImageInfo {
|
|
40
43
|
url: string;
|
|
@@ -43,18 +46,27 @@ export interface ImageInfo {
|
|
|
43
46
|
width?: number;
|
|
44
47
|
height?: number;
|
|
45
48
|
}
|
|
49
|
+
export interface IRichText {
|
|
50
|
+
version: number;
|
|
51
|
+
htmlContent: string;
|
|
52
|
+
structuredData: any | null;
|
|
53
|
+
}
|
|
46
54
|
export interface Message {
|
|
47
|
-
|
|
55
|
+
messageNumber: string;
|
|
48
56
|
plainText: string;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
senderType: string;
|
|
58
|
+
messageType?: string;
|
|
59
|
+
messageStatus?: string;
|
|
52
60
|
userKey?: string;
|
|
53
|
-
|
|
61
|
+
inquiryNumber?: string;
|
|
62
|
+
templateType?: string;
|
|
54
63
|
createdAt: Date;
|
|
55
64
|
updatedAt?: Date;
|
|
56
65
|
language?: string;
|
|
66
|
+
timestamp: number;
|
|
67
|
+
richText?: IRichText;
|
|
57
68
|
blocks?: TextBlock[];
|
|
69
|
+
workFlow?: WorkFlowInfo;
|
|
58
70
|
buttons?: Button[];
|
|
59
71
|
form?: Form;
|
|
60
72
|
files?: FileInfo[];
|
|
@@ -68,8 +80,12 @@ export interface Message {
|
|
|
68
80
|
isAPIMessage?: boolean;
|
|
69
81
|
}
|
|
70
82
|
export declare const hasBlocks: (message: Message) => boolean;
|
|
83
|
+
export declare const hasRichForm: (message: Message) => boolean;
|
|
84
|
+
export declare const hasCustomerWorkFlowClickData: (message: Message) => boolean;
|
|
71
85
|
export declare const hasButtons: (message: Message) => boolean;
|
|
72
86
|
export declare const hasForm: (message: Message) => boolean;
|
|
87
|
+
export declare const hasFileArray: (message: Message) => boolean;
|
|
73
88
|
export declare const hasFiles: (message: Message) => boolean;
|
|
74
89
|
export declare const hasImages: (message: Message) => boolean;
|
|
75
90
|
export declare const hasWebPage: (message: Message) => boolean;
|
|
91
|
+
export declare const hasWorkFlowImg: (message: Message) => boolean;
|