@daeryun/dr_components 0.6.48 → 0.6.50

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.
Files changed (43) hide show
  1. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  2. package/dist/components/Daeryuntalk/ChatConversation.jsx +11 -8
  3. package/dist/components/Daeryuntalk/ChatConversation.tsx +17 -9
  4. package/dist/components/Daeryuntalk/ChatHomeView.jsx +54 -26
  5. package/dist/components/Daeryuntalk/ChatHomeView.tsx +57 -26
  6. package/dist/components/Daeryuntalk/ChatMessage.jsx +3 -46
  7. package/dist/components/Daeryuntalk/ChatMessage.tsx +2 -81
  8. package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +3 -5
  9. package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +128 -501
  10. package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +149 -548
  11. package/dist/components/Daeryuntalk/index.jsx +1 -11
  12. package/dist/components/Daeryuntalk/index.tsx +1 -13
  13. package/dist/components/Daeryuntalk/socketManager.js +1 -9
  14. package/dist/components/Daeryuntalk/socketManager.ts +1 -9
  15. package/dist/components/Daeryuntalk/types.d.ts +14 -14
  16. package/dist/components/Daeryuntalk/types.js +0 -72
  17. package/dist/components/Daeryuntalk/types.ts +34 -104
  18. package/dist/components/PageTitleBox/PageTitleBox.jsx +2 -2
  19. package/dist/components/PageTitleBox/PageTitleBox.tsx +2 -2
  20. package/dist/lib/api/daeryuntalk/index.d.ts +64 -9
  21. package/dist/lib/api/daeryuntalk/index.js +79 -18
  22. package/dist/lib/api/daeryuntalk/index.ts +160 -31
  23. package/dist/lib/api/index.d.ts +0 -2
  24. package/dist/lib/api/index.js +0 -2
  25. package/dist/lib/api/index.ts +0 -2
  26. package/dist/styles/globals.css +0 -45
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +1 -1
  29. package/dist/components/Daeryuntalk/DaeryuntalkProvider.d.ts +0 -11
  30. package/dist/components/Daeryuntalk/DaeryuntalkProvider.jsx +0 -59
  31. package/dist/components/Daeryuntalk/DaeryuntalkProvider.tsx +0 -68
  32. package/dist/components/Daeryuntalk/message-components/FileContent.d.ts +0 -8
  33. package/dist/components/Daeryuntalk/message-components/FileContent.jsx +0 -32
  34. package/dist/components/Daeryuntalk/message-components/FileContent.tsx +0 -43
  35. package/dist/components/Daeryuntalk/message-components/FormContent.d.ts +0 -8
  36. package/dist/components/Daeryuntalk/message-components/FormContent.jsx +0 -104
  37. package/dist/components/Daeryuntalk/message-components/FormContent.tsx +0 -184
  38. package/dist/lib/api/daeryuntalk/chatInquiry.d.ts +0 -23
  39. package/dist/lib/api/daeryuntalk/chatInquiry.js +0 -78
  40. package/dist/lib/api/daeryuntalk/chatInquiry.ts +0 -80
  41. package/dist/lib/api/daeryuntalk/useDaeryuntalkApi.d.ts +0 -23
  42. package/dist/lib/api/daeryuntalk/useDaeryuntalkApi.js +0 -140
  43. package/dist/lib/api/daeryuntalk/useDaeryuntalkApi.ts +0 -187
@@ -26,7 +26,18 @@ const ENDPOINTS = {
26
26
  WEBSOCKET_INIT: '/chatctm/cmp/ws-init',
27
27
  CHAT_INQUIRY_MAIN: '/chatctm/hom/chatinquirymainsearch',
28
28
  CHAT_INQUIRY_CREATE: '/chatctm/hom/chatinquirycreate',
29
- CHAT_INQUIRY_DETAIL: '/chatctm/hom/chatinquirydetailsearch'
29
+ CHAT_INQUIRY_DETAIL: '/chatctm/hom/chatinquirydetailsearch',
30
+ CHAT_INQUIRY_GENERATION: '/chatctm/chi/chatinquirygeneration',
31
+ CHAT_INQUIRY_DETAIL_NEW: '/chatctm/chi/chatinquirydetail',
32
+ CHAT_MESSAGE_SEND: '/chatctm/chi/chatinquirymessagesend'
33
+ };
34
+ // 채팅 메시지 유형 상수
35
+ export const MESSAGE_TYPES = {
36
+ SYSTEM: 'MSP00100001',
37
+ BOT: 'MSP00100002',
38
+ CUSTOMER: 'MSP00100003',
39
+ OPERATOR: 'MSP00100004',
40
+ MACRO: 'MSP00100005'
30
41
  };
31
42
  /**
32
43
  * 쿠키 지원이 포함된 기본 fetch 함수
@@ -51,6 +62,8 @@ function fetchWithCookies(url_1) {
51
62
  본문: mergedOptions.body,
52
63
  버전: version
53
64
  });
65
+ // 인증 요청인지 확인
66
+ const isAuthRequest = url.includes(ENDPOINTS.AUTHENTICATE);
54
67
  try {
55
68
  const response = yield fetch(url, mergedOptions);
56
69
  if (!response.ok) {
@@ -87,10 +100,21 @@ function fetchWithCookies(url_1) {
87
100
  // 유효한 JSON인 경우만 파싱
88
101
  data = JSON.parse(responseText);
89
102
  console.log(`[API 응답 데이터] ${options.method || 'GET'} ${url}`, data);
103
+ // 인증 요청이 아닌 경우, result_info.result_type_cd가 "OK"인지 확인
104
+ if (!isAuthRequest && data.result_info) {
105
+ if (data.result_info.result_type_cd !== 'OK') {
106
+ console.error(`[API 결과 오류] result_type_cd가 OK가 아님:`, data.result_info);
107
+ throw new Error(`API 결과 오류: ${data.result_info.result_msg || '알 수 없는 오류'}`);
108
+ }
109
+ }
90
110
  }
91
111
  }
92
112
  catch (error) {
93
113
  console.error(`[API 응답 JSON 파싱 오류] ${options.method || 'GET'} ${url}`, error);
114
+ // 에러 메시지에 'API 결과 오류'가 포함된 경우는 이미 처리된 오류이므로 그대로 전파
115
+ if (error instanceof Error && error.message.includes('API 결과 오류')) {
116
+ throw error;
117
+ }
94
118
  // JSON 파싱 오류가 발생해도 요청은 성공했으므로 빈 객체 반환
95
119
  data = {};
96
120
  }
@@ -171,7 +195,7 @@ export function connectWebSocket(wsUrl, token, onMessage, onOpen, onClose, onErr
171
195
  if (onMessage) {
172
196
  socket.onmessage = event => {
173
197
  console.log('[웹소켓 메시지 수신]', event.data);
174
- onMessage(event);
198
+ onMessage(event.data);
175
199
  };
176
200
  }
177
201
  if (onClose) {
@@ -221,48 +245,57 @@ export function getChatInquiryMain(version) {
221
245
  });
222
246
  }
223
247
  /**
224
- * 새 채팅 문의 생성 (처음 방문자용)
248
+ * 새 채팅 문의 생성 (개선된 API)
225
249
  * @param version API 버전 (기본값: 1.0.0)
226
250
  * @returns 문의 번호가 포함된 생성된 채팅 문의 데이터
227
251
  */
228
- export function createChatInquiry(version) {
252
+ export function generateChatInquiry(version) {
229
253
  return __awaiter(this, void 0, void 0, function* () {
230
- console.log('[새 채팅 문의 생성 시작]', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
254
+ console.log('[새 채팅 문의 생성 시작 (개선)]', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
255
+ const body = {
256
+ d: {
257
+ channel_number: 'CH123456789012345678'
258
+ }
259
+ };
231
260
  try {
232
- const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_CREATE}`, { method: 'POST' }, version);
233
- console.log('[새 채팅 문의 생성 성공] 문의 번호:', response.chat_inquiry_number);
261
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_GENERATION}`, {
262
+ method: 'POST',
263
+ body: JSON.stringify(body)
264
+ }, version);
265
+ console.log('[새 채팅 문의 생성 성공 (개선)] 문의 번호:', response.data.chat_inquiry_number);
234
266
  return response;
235
267
  }
236
268
  catch (error) {
237
- console.error('[새 채팅 문의 생성 실패]', error);
269
+ console.error('[새 채팅 문의 생성 실패 (개선)]', error);
238
270
  throw error;
239
271
  }
240
272
  });
241
273
  }
242
274
  /**
243
- * 채팅 문의 상세 조회
244
- * @param inquiryNumber 채팅 문의 번호
275
+ * 채팅 문의 상세 조회 (개선된 API)
276
+ * @param chatInquiryNumber 채팅 문의 번호
245
277
  * @param version API 버전 (기본값: 1.0.0)
246
278
  * @returns 채팅 문의 상세 정보
247
279
  */
248
- export function getChatInquiryDetail(inquiryNumber, version) {
280
+ export function getChatInquiryDetailNew(chatInquiryNumber, version) {
249
281
  return __awaiter(this, void 0, void 0, function* () {
250
282
  const body = {
251
283
  d: {
252
- inquiry_number: inquiryNumber
284
+ channel_number: 'CH123456789012345678', // 고정값
285
+ chat_inquiry_number: chatInquiryNumber
253
286
  }
254
287
  };
255
- console.log('[채팅 문의 상세 조회 시작] 문의 번호:', inquiryNumber, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
288
+ console.log('[채팅 문의 상세 조회 시작 (개선)] 문의 번호:', chatInquiryNumber, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
256
289
  try {
257
- const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_DETAIL}`, {
290
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_DETAIL_NEW}`, {
258
291
  method: 'POST',
259
292
  body: JSON.stringify(body)
260
293
  }, version);
261
- console.log('[채팅 문의 상세 조회 성공]', response);
294
+ console.log('[채팅 문의 상세 조회 성공 (개선)]', response);
262
295
  return response;
263
296
  }
264
297
  catch (error) {
265
- console.error('[채팅 문의 상세 조회 실패]', error);
298
+ console.error('[채팅 문의 상세 조회 실패 (개선)]', error);
266
299
  throw error;
267
300
  }
268
301
  });
@@ -286,7 +319,7 @@ export function initializeDaeryuntalk(onWebSocketConnected, onWebSocketMessage,
286
319
  // 2단계: 웹소켓 초기화
287
320
  console.log('[Daeryuntalk 초기화] 2단계: 웹소켓 초기화 시작');
288
321
  const wsInitData = yield initializeWebSocket(version);
289
- console.log('[Daeryuntalk 초기화] 2단계: 웹소켓 초기화 완료', {
322
+ console.log('[Daeryuntalk 초기화] 2단계: 웹소켓 초기화 완료', {
290
323
  cnnc_url: wsInitData.data.cnnc_url,
291
324
  token_일부: wsInitData.data.cnnc_token ? `${wsInitData.data.cnnc_token.substring(0, 10)}...` : '없음'
292
325
  });
@@ -305,7 +338,6 @@ export function initializeDaeryuntalk(onWebSocketConnected, onWebSocketMessage,
305
338
  console.log('[Daeryuntalk 초기화] 4단계: 채팅 문의 메인 조회 완료', chatInquiryData);
306
339
  console.log('[Daeryuntalk 초기화 완료] 모든 단계 성공');
307
340
  return {
308
- socket,
309
341
  inquiryData: chatInquiryData
310
342
  };
311
343
  }
@@ -315,3 +347,32 @@ export function initializeDaeryuntalk(onWebSocketConnected, onWebSocketMessage,
315
347
  }
316
348
  });
317
349
  }
350
+ export function sendChatMessage(chatInquiryNumber, messageText, version) {
351
+ return __awaiter(this, void 0, void 0, function* () {
352
+ if (!chatInquiryNumber) {
353
+ throw new Error('채팅 메시지 전송 실패: 문의 번호가 없음');
354
+ }
355
+ if (!messageText.trim()) {
356
+ throw new Error('채팅 메시지 전송 실패: 메시지가 없음');
357
+ }
358
+ const body = {
359
+ d: {
360
+ inquiry_number: chatInquiryNumber,
361
+ plain_text: messageText
362
+ }
363
+ };
364
+ console.log('[채팅 메시지 전송 시작] 문의 번호:', chatInquiryNumber, '메시지:', messageText, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
365
+ try {
366
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_MESSAGE_SEND}`, {
367
+ method: 'POST',
368
+ body: JSON.stringify(body)
369
+ }, version);
370
+ console.log('[채팅 메시지 전송 성공]', response);
371
+ return response;
372
+ }
373
+ catch (error) {
374
+ console.error('[채팅 메시지 전송 실패]', error);
375
+ throw error;
376
+ }
377
+ });
378
+ }
@@ -20,7 +20,10 @@ const ENDPOINTS = {
20
20
  WEBSOCKET_INIT: '/chatctm/cmp/ws-init',
21
21
  CHAT_INQUIRY_MAIN: '/chatctm/hom/chatinquirymainsearch',
22
22
  CHAT_INQUIRY_CREATE: '/chatctm/hom/chatinquirycreate',
23
- CHAT_INQUIRY_DETAIL: '/chatctm/hom/chatinquirydetailsearch'
23
+ CHAT_INQUIRY_DETAIL: '/chatctm/hom/chatinquirydetailsearch',
24
+ CHAT_INQUIRY_GENERATION: '/chatctm/chi/chatinquirygeneration',
25
+ CHAT_INQUIRY_DETAIL_NEW: '/chatctm/chi/chatinquirydetail',
26
+ CHAT_MESSAGE_SEND: '/chatctm/chi/chatinquirymessagesend'
24
27
  };
25
28
 
26
29
  // 타입 정의
@@ -31,36 +34,80 @@ export interface WebSocketInitResponse {
31
34
  };
32
35
  }
33
36
 
37
+ export interface ChatInquiryMainData {
38
+ channel_name: string;
39
+ channel_logo_image_url: string;
40
+ sleeve_image_url: string;
41
+ salutation: string;
42
+ answer_speed_message: string;
43
+ progress_inquiry_number: string;
44
+ }
45
+
46
+ export interface ResultInfo {
47
+ result_type_cd: string;
48
+ result_cd: string;
49
+ result_msg: string;
50
+ }
51
+
34
52
  export interface ChatInquiryMainResponse {
35
- // 흐름에 기반한 예상 속성
36
- ongoingInquiry?: boolean;
37
- inquiryNumber?: string;
38
- // todo: trophy198 실제 응답 구조 확인 후 속성 추가 필요
53
+ result_info: ResultInfo;
54
+ data: ChatInquiryMainData;
39
55
  }
40
56
 
41
57
  export interface ChatInquiryCreateResponse {
42
- // todo: trophy198 chat_inquiry_number 포함한 응답 타입 필요
43
- chat_inquiry_number?: string;
58
+ result_info: ResultInfo;
59
+ data: {
60
+ chat_inquiry_number: string;
61
+ };
44
62
  }
45
63
 
46
64
  // 채팅 문의 상세 데이터 타입 정의
47
65
  export interface ChatInquiryDetailData {
48
- // todo: trophy198 실제 상세 데이터 구조 정의 필요
49
66
  inquiry_number?: string;
50
67
  status?: string;
51
68
  created_at?: string;
52
69
  updated_at?: string;
53
- // 기타 상세 데이터 필드들
70
+ description?: string;
71
+ messages?: ChatMessage[];
54
72
  }
55
73
 
56
74
  export interface ChatInquiryDetailResponse {
57
- // todo: trophy198 실제 응답 구조 확인 후 응답 타입 정의 필요
75
+ result_info?: ResultInfo;
58
76
  data?: ChatInquiryDetailData; // data 속성 추가
59
77
  success?: boolean;
60
78
  error_code?: string;
61
79
  error_message?: string;
62
80
  }
63
81
 
82
+ // 채팅 메시지 유형 상수
83
+ export const MESSAGE_TYPES = {
84
+ SYSTEM: 'MSP00100001',
85
+ BOT: 'MSP00100002',
86
+ CUSTOMER: 'MSP00100003',
87
+ OPERATOR: 'MSP00100004',
88
+ MACRO: 'MSP00100005'
89
+ };
90
+
91
+ // 메시지 블록 타입 정의
92
+ export interface MessageBlock {
93
+ type: string;
94
+ value: string;
95
+ }
96
+
97
+ // 채팅 메시지 타입 정의
98
+ export interface ChatMessage {
99
+ msg_no: string;
100
+ msg_type: string;
101
+ msg_status: string;
102
+ user_key: string;
103
+ inquiry_no: string;
104
+ created_at: string;
105
+ updated_at: string;
106
+ language: string;
107
+ plain_text: string;
108
+ blocks: MessageBlock[];
109
+ }
110
+
64
111
  /**
65
112
  * 쿠키 지원이 포함된 기본 fetch 함수
66
113
  */
@@ -96,6 +143,9 @@ async function fetchWithCookies<T>(
96
143
  버전: version
97
144
  });
98
145
 
146
+ // 인증 요청인지 확인
147
+ const isAuthRequest = url.includes(ENDPOINTS.AUTHENTICATE);
148
+
99
149
  try {
100
150
  const response = await fetch(url, mergedOptions);
101
151
 
@@ -133,9 +183,21 @@ async function fetchWithCookies<T>(
133
183
  // 유효한 JSON인 경우만 파싱
134
184
  data = JSON.parse(responseText);
135
185
  console.log(`[API 응답 데이터] ${options.method || 'GET'} ${url}`, data);
186
+
187
+ // 인증 요청이 아닌 경우, result_info.result_type_cd가 "OK"인지 확인
188
+ if (!isAuthRequest && data.result_info) {
189
+ if (data.result_info.result_type_cd !== 'OK') {
190
+ console.error(`[API 결과 오류] result_type_cd가 OK가 아님:`, data.result_info);
191
+ throw new Error(`API 결과 오류: ${data.result_info.result_msg || '알 수 없는 오류'}`);
192
+ }
193
+ }
136
194
  }
137
195
  } catch (error) {
138
196
  console.error(`[API 응답 JSON 파싱 오류] ${options.method || 'GET'} ${url}`, error);
197
+ // 에러 메시지에 'API 결과 오류'가 포함된 경우는 이미 처리된 오류이므로 그대로 전파
198
+ if (error instanceof Error && error.message.includes('API 결과 오류')) {
199
+ throw error;
200
+ }
139
201
  // JSON 파싱 오류가 발생해도 요청은 성공했으므로 빈 객체 반환
140
202
  data = {} as T;
141
203
  }
@@ -234,7 +296,7 @@ export function connectWebSocket(
234
296
  if (onMessage) {
235
297
  socket.onmessage = event => {
236
298
  console.log('[웹소켓 메시지 수신]', event.data);
237
- onMessage(event);
299
+ onMessage(event.data);
238
300
  };
239
301
  }
240
302
 
@@ -294,60 +356,71 @@ export async function getChatInquiryMain(version?: string): Promise<ChatInquiryM
294
356
  }
295
357
 
296
358
  /**
297
- * 새 채팅 문의 생성 (처음 방문자용)
359
+ * 새 채팅 문의 생성 (개선된 API)
298
360
  * @param version API 버전 (기본값: 1.0.0)
299
361
  * @returns 문의 번호가 포함된 생성된 채팅 문의 데이터
300
362
  */
301
- export async function createChatInquiry(version?: string): Promise<ChatInquiryCreateResponse> {
302
- console.log('[새 채팅 문의 생성 시작]', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
363
+ export async function generateChatInquiry(version?: string): Promise<ChatInquiryCreateResponse> {
364
+ console.log('[새 채팅 문의 생성 시작 (개선)]', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
365
+
366
+ const body = {
367
+ d: {
368
+ channel_number: 'CH123456789012345678'
369
+ }
370
+ };
371
+
303
372
  try {
304
373
  const response = await fetchWithCookies<ChatInquiryCreateResponse>(
305
- `${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_CREATE}`,
306
- { method: 'POST' },
374
+ `${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_GENERATION}`,
375
+ {
376
+ method: 'POST',
377
+ body: JSON.stringify(body)
378
+ },
307
379
  version
308
380
  );
309
- console.log('[새 채팅 문의 생성 성공] 문의 번호:', response.chat_inquiry_number);
381
+ console.log('[새 채팅 문의 생성 성공 (개선)] 문의 번호:', response.data.chat_inquiry_number);
310
382
  return response;
311
383
  } catch (error) {
312
- console.error('[새 채팅 문의 생성 실패]', error);
384
+ console.error('[새 채팅 문의 생성 실패 (개선)]', error);
313
385
  throw error;
314
386
  }
315
387
  }
316
388
 
317
389
  /**
318
- * 채팅 문의 상세 조회
319
- * @param inquiryNumber 채팅 문의 번호
390
+ * 채팅 문의 상세 조회 (개선된 API)
391
+ * @param chatInquiryNumber 채팅 문의 번호
320
392
  * @param version API 버전 (기본값: 1.0.0)
321
393
  * @returns 채팅 문의 상세 정보
322
394
  */
323
- export async function getChatInquiryDetail(
324
- inquiryNumber: string,
395
+ export async function getChatInquiryDetailNew(
396
+ chatInquiryNumber: string,
325
397
  version?: string
326
398
  ): Promise<ChatInquiryDetailResponse> {
327
399
  const body = {
328
400
  d: {
329
- inquiry_number: inquiryNumber
401
+ channel_number: 'CH123456789012345678', // 고정값
402
+ chat_inquiry_number: chatInquiryNumber
330
403
  }
331
404
  };
332
405
 
333
406
  console.log(
334
- '[채팅 문의 상세 조회 시작] 문의 번호:',
335
- inquiryNumber,
407
+ '[채팅 문의 상세 조회 시작 (개선)] 문의 번호:',
408
+ chatInquiryNumber,
336
409
  version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`
337
410
  );
338
411
  try {
339
412
  const response = await fetchWithCookies<ChatInquiryDetailResponse>(
340
- `${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_DETAIL}`,
413
+ `${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_DETAIL_NEW}`,
341
414
  {
342
415
  method: 'POST',
343
416
  body: JSON.stringify(body)
344
417
  },
345
418
  version
346
419
  );
347
- console.log('[채팅 문의 상세 조회 성공]', response);
420
+ console.log('[채팅 문의 상세 조회 성공 (개선)]', response);
348
421
  return response;
349
422
  } catch (error) {
350
- console.error('[채팅 문의 상세 조회 실패]', error);
423
+ console.error('[채팅 문의 상세 조회 실패 (개선)]', error);
351
424
  throw error;
352
425
  }
353
426
  }
@@ -365,7 +438,6 @@ export async function initializeDaeryuntalk(
365
438
  onWebSocketMessage?: (event: MessageEvent) => void,
366
439
  version?: string
367
440
  ): Promise<{
368
- socket: WebSocket;
369
441
  inquiryData?: any;
370
442
  }> {
371
443
  console.log(
@@ -381,7 +453,7 @@ export async function initializeDaeryuntalk(
381
453
  // 2단계: 웹소켓 초기화
382
454
  console.log('[Daeryuntalk 초기화] 2단계: 웹소켓 초기화 시작');
383
455
  const wsInitData = await initializeWebSocket(version);
384
- console.log('[Daeryuntalk 초기화] 2단계: 웹소켓 초기화 완료', {
456
+ console.log('[Daeryuntalk 초기화] 2단계: 웹소켓 초기화 완료', {
385
457
  cnnc_url: wsInitData.data.cnnc_url,
386
458
  token_일부: wsInitData.data.cnnc_token ? `${wsInitData.data.cnnc_token.substring(0, 10)}...` : '없음'
387
459
  });
@@ -408,7 +480,6 @@ export async function initializeDaeryuntalk(
408
480
 
409
481
  console.log('[Daeryuntalk 초기화 완료] 모든 단계 성공');
410
482
  return {
411
- socket,
412
483
  inquiryData: chatInquiryData
413
484
  };
414
485
  } catch (error) {
@@ -416,3 +487,61 @@ export async function initializeDaeryuntalk(
416
487
  throw error;
417
488
  }
418
489
  }
490
+
491
+ /**
492
+ * 채팅 메시지 전송
493
+ * @param chatInquiryNumber 채팅 문의 번호
494
+ * @param messageText 메시지 내용
495
+ * @param version API 버전 (기본값: 1.0.0)
496
+ * @returns 전송된 메시지 데이터
497
+ */
498
+ export interface SendMessageResponse {
499
+ result_info: ResultInfo;
500
+ data?: {
501
+ message: ChatMessage;
502
+ };
503
+ }
504
+
505
+ export async function sendChatMessage(
506
+ chatInquiryNumber: string,
507
+ messageText: string,
508
+ version?: string
509
+ ): Promise<SendMessageResponse> {
510
+ if (!chatInquiryNumber) {
511
+ throw new Error('채팅 메시지 전송 실패: 문의 번호가 없음');
512
+ }
513
+
514
+ if (!messageText.trim()) {
515
+ throw new Error('채팅 메시지 전송 실패: 메시지가 없음');
516
+ }
517
+
518
+ const body = {
519
+ d: {
520
+ inquiry_number: chatInquiryNumber,
521
+ plain_text: messageText
522
+ }
523
+ };
524
+
525
+ console.log(
526
+ '[채팅 메시지 전송 시작] 문의 번호:',
527
+ chatInquiryNumber,
528
+ '메시지:',
529
+ messageText,
530
+ version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`
531
+ );
532
+ try {
533
+ const response = await fetchWithCookies<SendMessageResponse>(
534
+ `${API_BASE_URL}${ENDPOINTS.CHAT_MESSAGE_SEND}`,
535
+ {
536
+ method: 'POST',
537
+ body: JSON.stringify(body)
538
+ },
539
+ version
540
+ );
541
+ console.log('[채팅 메시지 전송 성공]', response);
542
+ return response;
543
+ } catch (error) {
544
+ console.error('[채팅 메시지 전송 실패]', error);
545
+ throw error;
546
+ }
547
+ }
@@ -4,5 +4,3 @@
4
4
  * Daeryuntalk API 모듈 내보내기
5
5
  */
6
6
  export * from './daeryuntalk';
7
- export * from './daeryuntalk/chatInquiry';
8
- export { useDaeryuntalkApi } from './daeryuntalk/useDaeryuntalkApi';
@@ -4,5 +4,3 @@
4
4
  * Daeryuntalk API 모듈 내보내기
5
5
  */
6
6
  export * from './daeryuntalk';
7
- export * from './daeryuntalk/chatInquiry';
8
- export { useDaeryuntalkApi } from './daeryuntalk/useDaeryuntalkApi';
@@ -5,5 +5,3 @@
5
5
  */
6
6
 
7
7
  export * from './daeryuntalk';
8
- export * from './daeryuntalk/chatInquiry';
9
- export { useDaeryuntalkApi } from './daeryuntalk/useDaeryuntalkApi';
@@ -1814,10 +1814,6 @@ video {
1814
1814
  height: 5rem;
1815
1815
  }
1816
1816
 
1817
- .h-4 {
1818
- height: 1rem;
1819
- }
1820
-
1821
1817
  .h-7 {
1822
1818
  height: 1.75rem;
1823
1819
  }
@@ -2348,10 +2344,6 @@ video {
2348
2344
  width: 5rem;
2349
2345
  }
2350
2346
 
2351
- .w-4 {
2352
- width: 1rem;
2353
- }
2354
-
2355
2347
  .w-4\/5 {
2356
2348
  width: 80%;
2357
2349
  }
@@ -3566,12 +3558,6 @@ video {
3566
3558
  margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
3567
3559
  }
3568
3560
 
3569
- .space-y-4 > :not([hidden]) ~ :not([hidden]) {
3570
- --tw-space-y-reverse: 0;
3571
- margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
3572
- margin-bottom: calc(1rem * var(--tw-space-y-reverse));
3573
- }
3574
-
3575
3561
  .overflow-hidden {
3576
3562
  overflow: hidden;
3577
3563
  }
@@ -3714,10 +3700,6 @@ video {
3714
3700
  border-radius: 9999px;
3715
3701
  }
3716
3702
 
3717
- .rounded-lg {
3718
- border-radius: 0.5rem;
3719
- }
3720
-
3721
3703
  .rounded-md {
3722
3704
  border-radius: 0.375rem;
3723
3705
  }
@@ -3864,10 +3846,6 @@ video {
3864
3846
  border-color: rgb(40 95 167 / var(--tw-border-opacity, 1));
3865
3847
  }
3866
3848
 
3867
- .border-\[\#2E385B4D\] {
3868
- border-color: #2E385B4D;
3869
- }
3870
-
3871
3849
  .border-\[\#2E385B\] {
3872
3850
  --tw-border-opacity: 1;
3873
3851
  border-color: rgb(46 56 91 / var(--tw-border-opacity, 1));
@@ -4676,11 +4654,6 @@ video {
4676
4654
  padding-right: 0.5rem;
4677
4655
  }
4678
4656
 
4679
- .px-2\.5 {
4680
- padding-left: 0.625rem;
4681
- padding-right: 0.625rem;
4682
- }
4683
-
4684
4657
  .px-3 {
4685
4658
  padding-left: 0.75rem;
4686
4659
  padding-right: 0.75rem;
@@ -4811,11 +4784,6 @@ video {
4811
4784
  padding-bottom: 0.25rem;
4812
4785
  }
4813
4786
 
4814
- .py-1\.5 {
4815
- padding-top: 0.375rem;
4816
- padding-bottom: 0.375rem;
4817
- }
4818
-
4819
4787
  .py-2 {
4820
4788
  padding-top: 0.5rem;
4821
4789
  padding-bottom: 0.5rem;
@@ -7426,10 +7394,6 @@ body {
7426
7394
  background-color: rgb(33 94 170 / var(--tw-bg-opacity, 1));
7427
7395
  }
7428
7396
 
7429
- .hover\:bg-\[\#2E385B\]\/10:hover {
7430
- background-color: rgb(46 56 91 / 0.1);
7431
- }
7432
-
7433
7397
  .hover\:bg-\[\#722D6D\]:hover {
7434
7398
  --tw-bg-opacity: 1;
7435
7399
  background-color: rgb(114 45 109 / var(--tw-bg-opacity, 1));
@@ -7469,10 +7433,6 @@ body {
7469
7433
  background-color: rgb(245 245 245 / var(--tw-bg-opacity, 1));
7470
7434
  }
7471
7435
 
7472
- .hover\:bg-opacity-90:hover {
7473
- --tw-bg-opacity: 0.9;
7474
- }
7475
-
7476
7436
  .hover\:font-\[700\]:hover {
7477
7437
  font-weight: 700;
7478
7438
  }
@@ -7507,11 +7467,6 @@ body {
7507
7467
  border-color: rgb(61 61 61 / var(--tw-border-opacity, 1));
7508
7468
  }
7509
7469
 
7510
- .focus\:border-\[\#AA1D36\]:focus {
7511
- --tw-border-opacity: 1;
7512
- border-color: rgb(170 29 54 / var(--tw-border-opacity, 1));
7513
- }
7514
-
7515
7470
  .focus\:outline-none:focus {
7516
7471
  outline: 2px solid transparent;
7517
7472
  outline-offset: 2px;