@daeryun/dr_components 0.7.79 → 0.7.81
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/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
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Daeryuntalk API 클라이언트 모듈 2025-04-23
|
|
3
|
-
*
|
|
4
|
-
* 이 모듈은 Daeryuntalk 채팅 API와 상호작용하기 위한 함수를 제공
|
|
5
|
-
* 1. 고객 인증
|
|
6
|
-
* 2. 웹소켓 연결 초기화
|
|
7
|
-
* 3. 웹소켓 연결
|
|
8
|
-
* 4. 채팅 문의 관리
|
|
9
|
-
*/
|
|
10
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
11
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -22,15 +13,25 @@ const API_BASE_URL = 'https://chat-client-api.lawmance.com';
|
|
|
22
13
|
const DEFAULT_API_VERSION = '1.0.0';
|
|
23
14
|
// API 엔드포인트
|
|
24
15
|
const ENDPOINTS = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
/* 시작점 */
|
|
17
|
+
AUTHENTICATE: '/chatctm/ctf/crtfica', // 유저 인증
|
|
18
|
+
WEBSOCKET_INIT: '/chatctm/cmp/ws-init', // 웹 소켓 초기화
|
|
19
|
+
/* 채팅 */
|
|
20
|
+
CHAT_INQUIRY_MAIN: '/chatctm/hom/chatinquirymainsearch', // 채팅 문의 메인 조회
|
|
21
|
+
CHAT_INQUIRY_CREATE: '/chatctm/hom/chatinquirycreate', // XXX
|
|
29
22
|
CHAT_INQUIRY_DETAIL: '/chatctm/hom/chatinquirydetailsearch',
|
|
30
|
-
CHAT_INQUIRY_GENERATION: '/chatctm/chi/chatinquirygeneration',
|
|
31
|
-
CHAT_INQUIRY_DETAIL_NEW: '/chatctm/chi/chatinquirydetail',
|
|
32
|
-
|
|
23
|
+
CHAT_INQUIRY_GENERATION: '/chatctm/chi/chatinquirygeneration', // 채팅 문의 생성
|
|
24
|
+
CHAT_INQUIRY_DETAIL_NEW: '/chatctm/chi/chatinquirydetail', // 채팅 문의 상세 조회
|
|
25
|
+
CHAT_INQUIRY_MESSAGE_LIST: '/chatctm/chi/chatinquirymessagelist', // 채팅 문의 메시지 목록 조회
|
|
26
|
+
CHAT_MESSAGE_SEND: '/chatctm/chi/chatinquirymessagesend', // 채팅 문의 메시지 전송
|
|
27
|
+
CHAT_MESSAGE_FILE_URL_REQUEST: '/chatctm/chi/chatinquirymessagefiledownloadurlgeneration', //채팅 문의 메시지 파일 다운로드 URL 생성 요청
|
|
28
|
+
CHAT_MESSAGE_WORKFLOW_START: '/chatctm/chi/chatinquiryworkflowprogress', // 채팅 문의 워크플로우 진행
|
|
29
|
+
CHAT_MESSAGE_WORKFLOW_BACK: '/chatctm/chi/chatinquiryworkflowrollback', // 채팅 문의 워크플로우 되돌리기
|
|
30
|
+
/* 유저 */
|
|
31
|
+
USER_INFO_UPDATE: '/chatctm/chi/individualinformationupdate' //개인 정보 업데이트
|
|
33
32
|
};
|
|
33
|
+
// 메인
|
|
34
|
+
const TEST_CENTER_CODE = 'CT0000';
|
|
34
35
|
// 채팅 메시지 유형 상수
|
|
35
36
|
export const MESSAGE_TYPES = {
|
|
36
37
|
SYSTEM: 'MSP00100001',
|
|
@@ -50,11 +51,18 @@ function fetchWithCookies(url_1) {
|
|
|
50
51
|
if (!headers.has('Content-Type')) {
|
|
51
52
|
headers.set('Content-Type', 'application/json');
|
|
52
53
|
}
|
|
54
|
+
if (typeof window !== 'undefined') {
|
|
55
|
+
const AuthToken = localStorage.getItem('daeryunchatinquirytoken') || '';
|
|
56
|
+
// 로컬스토리지에 존재하면, 헤더에 추가
|
|
57
|
+
if (AuthToken) {
|
|
58
|
+
headers.set('a', AuthToken);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
53
61
|
// 버전 헤더 추가
|
|
54
62
|
headers.set('v', version);
|
|
55
63
|
const defaultOptions = {
|
|
56
64
|
credentials: 'include', // 요청에 쿠키 포함
|
|
57
|
-
headers
|
|
65
|
+
headers: headers
|
|
58
66
|
};
|
|
59
67
|
const mergedOptions = Object.assign(Object.assign(Object.assign({}, defaultOptions), options), { headers });
|
|
60
68
|
console.log(`[API 요청] ${options.method || 'GET'} ${url}`, {
|
|
@@ -132,17 +140,29 @@ function fetchWithCookies(url_1) {
|
|
|
132
140
|
* @param version API 버전 (기본값: 1.0.0)
|
|
133
141
|
* @returns 인증 응답
|
|
134
142
|
*/
|
|
135
|
-
export function authenticateUser(version) {
|
|
143
|
+
export function authenticateUser(centerCode, version) {
|
|
136
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
var _a;
|
|
137
146
|
console.log('[인증 시작] 사용자 인증 요청', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
138
147
|
try {
|
|
148
|
+
const body = {
|
|
149
|
+
d: {
|
|
150
|
+
center_code: centerCode
|
|
151
|
+
}
|
|
152
|
+
};
|
|
139
153
|
// 인증 API 호출
|
|
140
|
-
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.AUTHENTICATE}`, {
|
|
154
|
+
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.AUTHENTICATE}`, {
|
|
155
|
+
method: 'POST',
|
|
156
|
+
body: JSON.stringify(body)
|
|
157
|
+
}, version);
|
|
141
158
|
// 빈 응답인 경우에도 성공으로 처리
|
|
142
159
|
if (Object.keys(response).length === 0) {
|
|
143
160
|
console.log('[인증 성공] 사용자 인증 완료 - 빈 응답 (쿠키만 설정됨)');
|
|
144
161
|
return { success: true, status: 'authenticated' };
|
|
145
162
|
}
|
|
163
|
+
if (typeof window !== 'undefined' && ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.token)) {
|
|
164
|
+
localStorage.setItem('daeryunchatinquirytoken', response.data.token);
|
|
165
|
+
}
|
|
146
166
|
console.log('[인증 성공] 사용자 인증 완료', response);
|
|
147
167
|
return response;
|
|
148
168
|
}
|
|
@@ -192,12 +212,18 @@ export function connectWebSocket(wsUrl, token, onMessage, onOpen, onClose, onErr
|
|
|
192
212
|
if (onOpen)
|
|
193
213
|
onOpen(event);
|
|
194
214
|
};
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
215
|
+
socket.onmessage = event => {
|
|
216
|
+
console.log('[웹소켓 메시지 수신]', event.data);
|
|
217
|
+
try {
|
|
218
|
+
const data = JSON.parse(event.data);
|
|
219
|
+
console.log('📩 New Message (parsed):', data);
|
|
220
|
+
}
|
|
221
|
+
catch (err) {
|
|
222
|
+
console.error('[웹소켓] JSON 파싱 오류:', err);
|
|
223
|
+
}
|
|
224
|
+
if (onMessage)
|
|
225
|
+
onMessage(event.data); // event 전체 넘기기 (event.data는 string)
|
|
226
|
+
};
|
|
201
227
|
if (onClose) {
|
|
202
228
|
socket.onclose = event => {
|
|
203
229
|
console.log('[웹소켓 연결 종료] 코드:', event.code, '사유:', event.reason);
|
|
@@ -219,14 +245,15 @@ export function connectWebSocket(wsUrl, token, onMessage, onOpen, onClose, onErr
|
|
|
219
245
|
}
|
|
220
246
|
/**
|
|
221
247
|
* 채팅 문의 메인 조회
|
|
248
|
+
* @param channelNumber 전달받은 채널
|
|
222
249
|
* @param version API 버전 (기본값: 1.0.0)
|
|
223
250
|
* @returns 채팅 문의 메인 데이터
|
|
224
251
|
*/
|
|
225
|
-
export function getChatInquiryMain(version) {
|
|
252
|
+
export function getChatInquiryMain(channelNumber, version) {
|
|
226
253
|
return __awaiter(this, void 0, void 0, function* () {
|
|
227
254
|
const body = {
|
|
228
255
|
d: {
|
|
229
|
-
channel_number:
|
|
256
|
+
channel_number: channelNumber
|
|
230
257
|
}
|
|
231
258
|
};
|
|
232
259
|
console.log('[채팅 문의 메인 조회 시작] 채널 번호:', body.d.channel_number, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
@@ -249,12 +276,12 @@ export function getChatInquiryMain(version) {
|
|
|
249
276
|
* @param version API 버전 (기본값: 1.0.0)
|
|
250
277
|
* @returns 문의 번호가 포함된 생성된 채팅 문의 데이터
|
|
251
278
|
*/
|
|
252
|
-
export function generateChatInquiry(version) {
|
|
279
|
+
export function generateChatInquiry(channelNumber, version) {
|
|
253
280
|
return __awaiter(this, void 0, void 0, function* () {
|
|
254
281
|
console.log('[새 채팅 문의 생성 시작 (개선)]', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
255
282
|
const body = {
|
|
256
283
|
d: {
|
|
257
|
-
channel_number:
|
|
284
|
+
channel_number: channelNumber
|
|
258
285
|
}
|
|
259
286
|
};
|
|
260
287
|
try {
|
|
@@ -277,15 +304,15 @@ export function generateChatInquiry(version) {
|
|
|
277
304
|
* @param version API 버전 (기본값: 1.0.0)
|
|
278
305
|
* @returns 채팅 문의 상세 정보
|
|
279
306
|
*/
|
|
280
|
-
export function getChatInquiryDetailNew(
|
|
307
|
+
export function getChatInquiryDetailNew(chat_inquiry_number, version) {
|
|
281
308
|
return __awaiter(this, void 0, void 0, function* () {
|
|
282
309
|
const body = {
|
|
283
310
|
d: {
|
|
284
|
-
|
|
285
|
-
|
|
311
|
+
chat_inquiry_number: chat_inquiry_number, // 채팅문의 번호
|
|
312
|
+
size: 10
|
|
286
313
|
}
|
|
287
314
|
};
|
|
288
|
-
console.log('[채팅 문의 상세 조회 시작 (개선)] 문의 번호:',
|
|
315
|
+
console.log('[채팅 문의 상세 조회 시작 (개선)] 문의 번호:', chat_inquiry_number, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
289
316
|
try {
|
|
290
317
|
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_DETAIL_NEW}`, {
|
|
291
318
|
method: 'POST',
|
|
@@ -300,6 +327,36 @@ export function getChatInquiryDetailNew(chatInquiryNumber, version) {
|
|
|
300
327
|
}
|
|
301
328
|
});
|
|
302
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* 채팅 메세지 목록 조회
|
|
332
|
+
* @param chatInquiryNumber 채팅 문의 번호
|
|
333
|
+
* @param standard_date_time 기준 일시
|
|
334
|
+
* @param size 사이즈
|
|
335
|
+
* @param version API 버전 (기본값: 1.0.0)
|
|
336
|
+
* @returns 채팅 메세지 리스트
|
|
337
|
+
*/
|
|
338
|
+
export function getChatInquiryMessageList(chatInquiryNumber, standardDateTime, size, version) {
|
|
339
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
340
|
+
const body = {
|
|
341
|
+
d: Object.assign(Object.assign({ chat_inquiry_number: chatInquiryNumber }, (standardDateTime && { standard_date_time: standardDateTime })), {
|
|
342
|
+
// standard_date_time: standard_date_time ?? new Date().toISOString(),
|
|
343
|
+
size: size !== null && size !== void 0 ? size : 10 })
|
|
344
|
+
};
|
|
345
|
+
console.log('[채팅 메세지 리스트] 문의 번호:', chatInquiryNumber, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
346
|
+
try {
|
|
347
|
+
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_MESSAGE_LIST}`, {
|
|
348
|
+
method: 'POST',
|
|
349
|
+
body: JSON.stringify(body)
|
|
350
|
+
}, version);
|
|
351
|
+
console.log('[채팅 메세지 리스트]', response);
|
|
352
|
+
return response;
|
|
353
|
+
}
|
|
354
|
+
catch (error) {
|
|
355
|
+
console.error('[채팅 메세지 리스트]', error);
|
|
356
|
+
throw error;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}
|
|
303
360
|
/**
|
|
304
361
|
* Daeryuntalk 초기화 완료 흐름
|
|
305
362
|
* 이 함수는 인증부터 웹소켓 연결까지 완전한 흐름을 처리
|
|
@@ -314,32 +371,39 @@ export function initializeDaeryuntalk(onWebSocketConnected, onWebSocketMessage,
|
|
|
314
371
|
try {
|
|
315
372
|
// 1단계: 사용자 인증
|
|
316
373
|
console.log('[Daeryuntalk 초기화] 1단계: 사용자 인증 시작');
|
|
317
|
-
yield authenticateUser(version);
|
|
374
|
+
const authResponse = yield authenticateUser(TEST_CENTER_CODE, version);
|
|
318
375
|
console.log('[Daeryuntalk 초기화] 1단계: 사용자 인증 완료');
|
|
319
376
|
// 2단계: 웹소켓 초기화
|
|
320
377
|
console.log('[Daeryuntalk 초기화] 2단계: 웹소켓 초기화 시작');
|
|
321
378
|
const wsInitData = yield initializeWebSocket(version);
|
|
322
379
|
console.log('[Daeryuntalk 초기화] 2단계: 웹소켓 초기화 완료', {
|
|
323
|
-
cnnc_url: wsInitData.data.
|
|
324
|
-
token_일부: wsInitData.data.
|
|
380
|
+
cnnc_url: wsInitData.data.connection_url,
|
|
381
|
+
token_일부: wsInitData.data.connection_token
|
|
382
|
+
? `${wsInitData.data.connection_token.substring(0, 10)}...`
|
|
383
|
+
: '없음'
|
|
325
384
|
});
|
|
326
385
|
// 3단계: 웹소켓 연결
|
|
327
386
|
console.log('[Daeryuntalk 초기화] 3단계: 웹소켓 연결 시작');
|
|
328
|
-
const socket = connectWebSocket(wsInitData.data.
|
|
387
|
+
const socket = connectWebSocket(wsInitData.data.connection_url, wsInitData.data.connection_token, onWebSocketMessage, onWebSocketConnected
|
|
329
388
|
? () => {
|
|
330
389
|
console.log('[Daeryuntalk 초기화] 3단계: 웹소켓 연결 콜백 실행');
|
|
331
|
-
onWebSocketConnected
|
|
390
|
+
if (onWebSocketConnected) {
|
|
391
|
+
onWebSocketConnected(socket);
|
|
392
|
+
}
|
|
332
393
|
}
|
|
333
394
|
: undefined);
|
|
395
|
+
// console.log('socket', socket);
|
|
334
396
|
console.log('[Daeryuntalk 초기화] 3단계: 웹소켓 연결 객체 생성됨');
|
|
397
|
+
console.log('authResponse', authResponse);
|
|
335
398
|
// 4단계: 채팅 문의 메인 조회
|
|
336
399
|
console.log('[Daeryuntalk 초기화] 4단계: 채팅 문의 메인 조회 시작');
|
|
337
|
-
const chatInquiryData = yield getChatInquiryMain(version);
|
|
400
|
+
const chatInquiryData = yield getChatInquiryMain(authResponse.data.channel_number, version);
|
|
338
401
|
console.log('[Daeryuntalk 초기화] 4단계: 채팅 문의 메인 조회 완료', chatInquiryData);
|
|
339
|
-
console.log('[Daeryuntalk 초기화 완료] 모든 단계 성공');
|
|
340
402
|
return {
|
|
341
|
-
inquiryData: chatInquiryData
|
|
403
|
+
inquiryData: chatInquiryData,
|
|
404
|
+
socket: socket
|
|
342
405
|
};
|
|
406
|
+
console.log('[Daeryuntalk 초기화 완료] 모든 단계 성공');
|
|
343
407
|
}
|
|
344
408
|
catch (error) {
|
|
345
409
|
console.error('[Daeryuntalk 초기화 실패] 오류 발생:', error);
|
|
@@ -347,21 +411,100 @@ export function initializeDaeryuntalk(onWebSocketConnected, onWebSocketMessage,
|
|
|
347
411
|
}
|
|
348
412
|
});
|
|
349
413
|
}
|
|
350
|
-
|
|
414
|
+
/**
|
|
415
|
+
* 채팅 워크플로우 진행 처리
|
|
416
|
+
*
|
|
417
|
+
* @param chatInquiryNumber 채팅 문의 번호 required
|
|
418
|
+
* @param messageNumber 메시지 번호 required
|
|
419
|
+
* @param workFlowNumber 워크플로우 번호 required
|
|
420
|
+
* @param objectNumber 오브젝트 번호 required
|
|
421
|
+
* @param version API 버전 (기본값: 1.0.0)
|
|
422
|
+
* @returns 전송된 메시지 데이터
|
|
423
|
+
*/
|
|
424
|
+
export function chatWorkFlow(chatInquiryNumber, messageNumber, workFlowNumber, objectNumber, version) {
|
|
425
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
426
|
+
const body = {
|
|
427
|
+
d: {
|
|
428
|
+
chat_inquiry_number: chatInquiryNumber,
|
|
429
|
+
message_number: messageNumber,
|
|
430
|
+
work_flow_number: workFlowNumber,
|
|
431
|
+
object_number: objectNumber
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
console.log('[채팅 워크플로우 시작]', '문의 번호:', chatInquiryNumber, '메시지 번호:', messageNumber, '워크플로우 번호:', workFlowNumber, '오브젝트 번호:', objectNumber, version ? `버전: ${version}` : '기본 버전: 1.0.0');
|
|
435
|
+
try {
|
|
436
|
+
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_MESSAGE_WORKFLOW_START}`, {
|
|
437
|
+
method: 'POST',
|
|
438
|
+
body: JSON.stringify(body)
|
|
439
|
+
}, version);
|
|
440
|
+
console.log('[채팅 워크플로우 시작 성공]', response);
|
|
441
|
+
return response;
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
console.error('[채팅 워크플로우 시작 실패]', error);
|
|
445
|
+
throw error;
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* 채팅 워크플로우 되돌리기
|
|
451
|
+
*
|
|
452
|
+
* @param chatInquiryNumber 채팅 문의 번호 required
|
|
453
|
+
* @param messageNumber 메시지 번호 required
|
|
454
|
+
* @param workFlowNavigationCode 워크플로우네비게이션코드 번호 required
|
|
455
|
+
* @param version API 버전 (기본값: 1.0.0)
|
|
456
|
+
* @returns 전송된 메시지 데이터
|
|
457
|
+
*/
|
|
458
|
+
export function chatWorkFlowBack(chatInquiryNumber, messageNumber, workFlowNavigationCode, version) {
|
|
459
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
460
|
+
const body = {
|
|
461
|
+
d: {
|
|
462
|
+
chat_inquiry_number: chatInquiryNumber,
|
|
463
|
+
message_number: messageNumber,
|
|
464
|
+
work_flow_navigation_code: workFlowNavigationCode
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
console.log('[채팅 워크플로우 되돌리기 시작]', '문의 번호:', chatInquiryNumber, '메시지 번호:', messageNumber, '워크플로우네비게이션코드 번호:', workFlowNavigationCode, version ? `버전: ${version}` : '기본 버전: 1.0.0');
|
|
468
|
+
try {
|
|
469
|
+
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_MESSAGE_WORKFLOW_BACK}`, {
|
|
470
|
+
method: 'POST',
|
|
471
|
+
body: JSON.stringify(body)
|
|
472
|
+
}, version);
|
|
473
|
+
console.log('[채팅 워크플로우 되돌리기 성공]', response);
|
|
474
|
+
return response;
|
|
475
|
+
}
|
|
476
|
+
catch (error) {
|
|
477
|
+
console.error('[채팅 워크플로우 되돌리기 실패]', error);
|
|
478
|
+
throw error;
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* 채팅 메시지 전송
|
|
484
|
+
* @param chatInquiryNumber 채팅 문의 번호
|
|
485
|
+
* @param messageText 메시지 내용
|
|
486
|
+
* @param version API 버전 (기본값: 1.0.0)
|
|
487
|
+
* @returns 전송된 메시지 데이터
|
|
488
|
+
*/
|
|
489
|
+
export function sendChatMessage(chatInquiryNumber, htmlContent, jsonData, version) {
|
|
351
490
|
return __awaiter(this, void 0, void 0, function* () {
|
|
352
491
|
if (!chatInquiryNumber) {
|
|
353
492
|
throw new Error('채팅 메시지 전송 실패: 문의 번호가 없음');
|
|
354
493
|
}
|
|
355
|
-
if (!
|
|
494
|
+
if (!htmlContent) {
|
|
356
495
|
throw new Error('채팅 메시지 전송 실패: 메시지가 없음');
|
|
357
496
|
}
|
|
497
|
+
if (!jsonData) {
|
|
498
|
+
throw new Error('채팅 메시지 전송 실패: json 데이터 없음');
|
|
499
|
+
}
|
|
358
500
|
const body = {
|
|
359
501
|
d: {
|
|
360
|
-
|
|
361
|
-
|
|
502
|
+
chat_inquiry_number: chatInquiryNumber, // required
|
|
503
|
+
html_content: htmlContent, // required, tiptap html
|
|
504
|
+
json_data: jsonData // required, tiptab json
|
|
362
505
|
}
|
|
363
506
|
};
|
|
364
|
-
console.log('[채팅 메시지 전송 시작] 문의 번호:', chatInquiryNumber, '메시지:',
|
|
507
|
+
console.log('[채팅 메시지 전송 시작] 문의 번호:', chatInquiryNumber, '메시지:', htmlContent, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
365
508
|
try {
|
|
366
509
|
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_MESSAGE_SEND}`, {
|
|
367
510
|
method: 'POST',
|
|
@@ -376,3 +519,65 @@ export function sendChatMessage(chatInquiryNumber, messageText, version) {
|
|
|
376
519
|
}
|
|
377
520
|
});
|
|
378
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* 채팅 개인 정보 업데이트
|
|
524
|
+
* @param chatInquiryNumber 채팅 문의 번호
|
|
525
|
+
* @param messageNumber 해당 채팅 번호
|
|
526
|
+
* @param name 이름
|
|
527
|
+
* @param cellPhoneNumber 전화번호
|
|
528
|
+
* @param version API 버전 (기본값: 1.0.0)
|
|
529
|
+
* @returns 전송된 메시지 데이터
|
|
530
|
+
*/
|
|
531
|
+
export function chatUserUpdate(chatInquiryNumber, messageNumber, name, cellPhoneNumber, version) {
|
|
532
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
533
|
+
const body = {
|
|
534
|
+
d: {
|
|
535
|
+
chat_inquiry_number: chatInquiryNumber, // required
|
|
536
|
+
message_number: messageNumber, // required
|
|
537
|
+
name: name, // required
|
|
538
|
+
cell_phone_number: cellPhoneNumber // required
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
console.log('[채팅 개인 정보 업데이트] 시작');
|
|
542
|
+
try {
|
|
543
|
+
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.USER_INFO_UPDATE}`, {
|
|
544
|
+
method: 'POST',
|
|
545
|
+
body: JSON.stringify(body)
|
|
546
|
+
}, version);
|
|
547
|
+
console.log('[채팅 메시지 전송 성공]', response);
|
|
548
|
+
return response;
|
|
549
|
+
}
|
|
550
|
+
catch (error) {
|
|
551
|
+
console.error('[채팅 메시지 전송 실패]', error);
|
|
552
|
+
throw error;
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* 채팅문의 메시지 파일 다운로드 URL 생성
|
|
558
|
+
* @param chatInquiryNumber 채팅문의번호
|
|
559
|
+
* @param fileNumber 파일번호
|
|
560
|
+
* @param version
|
|
561
|
+
*/
|
|
562
|
+
export const getMessageFileDownloadUrl = (_a) => __awaiter(void 0, [_a], void 0, function* ({ chatInquiryNumber, fileNumber, version = DEFAULT_API_VERSION }) {
|
|
563
|
+
const consoleName = '채팅문의 메시지 파일 다운로드 URL 생성';
|
|
564
|
+
try {
|
|
565
|
+
const body = {
|
|
566
|
+
d: {
|
|
567
|
+
chat_inquiry_number: chatInquiryNumber, // required
|
|
568
|
+
file_number: fileNumber // required
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
console.log(`[${consoleName} 진행]`);
|
|
572
|
+
const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_MESSAGE_FILE_URL_REQUEST}`, {
|
|
573
|
+
method: 'POST',
|
|
574
|
+
body: JSON.stringify(body)
|
|
575
|
+
}, version);
|
|
576
|
+
console.log(`[${consoleName} 완료]`, response);
|
|
577
|
+
return response;
|
|
578
|
+
}
|
|
579
|
+
catch (error) {
|
|
580
|
+
console.error(`[${consoleName} 실패] 오류:`, error);
|
|
581
|
+
throw error;
|
|
582
|
+
}
|
|
583
|
+
});
|