@daeryun/dr_components 1.1.16 → 1.1.19

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 (50) hide show
  1. package/dist/asset/images/daeryuntalk/active_checkbox_blue.png +0 -0
  2. package/dist/asset/images/daeryuntalk/non_active_checkbox.png +0 -0
  3. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  4. package/dist/components/Daeryuntalk/ChatConversation.d.ts +2 -0
  5. package/dist/components/Daeryuntalk/ChatConversation.jsx +13 -5
  6. package/dist/components/Daeryuntalk/ChatConversation.tsx +23 -5
  7. package/dist/components/Daeryuntalk/ChatHomeView.jsx +2 -3
  8. package/dist/components/Daeryuntalk/ChatHomeView.tsx +2 -1
  9. package/dist/components/Daeryuntalk/ChatInput.d.ts +2 -0
  10. package/dist/components/Daeryuntalk/ChatInput.jsx +7 -7
  11. package/dist/components/Daeryuntalk/ChatInput.tsx +30 -19
  12. package/dist/components/Daeryuntalk/ChatItem/AgeCheckBox.d.ts +6 -0
  13. package/dist/components/Daeryuntalk/ChatItem/AgeCheckBox.jsx +18 -0
  14. package/dist/components/Daeryuntalk/ChatItem/AgeCheckBox.tsx +26 -0
  15. package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.jsx +7 -8
  16. package/dist/components/Daeryuntalk/ChatItem/ChatPrivacyAuth.tsx +7 -7
  17. package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +4 -0
  18. package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +15 -6
  19. package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +20 -7
  20. package/dist/components/Daeryuntalk/NoticeMessage.jsx +14 -5
  21. package/dist/components/Daeryuntalk/NoticeMessage.tsx +15 -5
  22. package/dist/components/Daeryuntalk/Tiptap/DisabledInput.d.ts +6 -0
  23. package/dist/components/Daeryuntalk/Tiptap/DisabledInput.jsx +17 -0
  24. package/dist/components/Daeryuntalk/Tiptap/DisabledInput.tsx +28 -0
  25. package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +2 -0
  26. package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +24 -0
  27. package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +32 -0
  28. package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.d.ts +2 -0
  29. package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.ts +5 -0
  30. package/dist/components/Daeryuntalk/_enums/ags_check_status.d.ts +5 -0
  31. package/dist/components/Daeryuntalk/_enums/ags_check_status.js +9 -0
  32. package/dist/components/Daeryuntalk/_enums/ags_check_status.ts +9 -0
  33. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.d.ts +4 -1
  34. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +49 -23
  35. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +52 -14
  36. package/dist/components/Daeryuntalk/_hooks/talkprovider/useFullURL.jsx +8 -18
  37. package/dist/components/Daeryuntalk/_hooks/talkprovider/useFullURL.tsx +7 -19
  38. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +3 -1
  39. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +9 -5
  40. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +9 -1
  41. package/dist/components/Daeryuntalk/_hooks/talkprovider/useWorkFlow.ts +1 -1
  42. package/dist/components/Daeryuntalk/_ui/buttons/Button4.d.ts +10 -0
  43. package/dist/components/Daeryuntalk/_ui/buttons/Button4.jsx +12 -0
  44. package/dist/components/Daeryuntalk/_ui/buttons/Button4.tsx +29 -0
  45. package/dist/components/Daeryuntalk/_ui/checkboxs/CheckBox2.d.ts +8 -0
  46. package/dist/components/Daeryuntalk/_ui/checkboxs/CheckBox2.jsx +20 -0
  47. package/dist/components/Daeryuntalk/_ui/checkboxs/CheckBox2.tsx +47 -0
  48. package/dist/styles/globals.css +45 -0
  49. package/dist/tsconfig.tsbuildinfo +1 -1
  50. package/package.json +1 -1
@@ -24,6 +24,7 @@ import { Dispatch, SetStateAction } from 'react';
24
24
  import { ErrorEnum } from '../../_enums/error';
25
25
  import { MessageSocketType } from '../../_enums/socket_type';
26
26
  import { consoleFn } from '../../_lib/utils';
27
+ import { AgeCheckStatusEnums } from '../../_enums/ags_check_status';
27
28
 
28
29
  // API 기본 URL
29
30
  const API_BASE_URL = process.env.NEXT_PUBLIC_CHAT_CUSTOMER_API;
@@ -50,6 +51,7 @@ const ENDPOINTS = {
50
51
  CHAT_MESSAGE_WORKFLOW_BACK: '/chatctm/chi/chatinquiryworkflowrollback', // 채팅 문의 워크플로우 되돌리기
51
52
  /* 유저 */
52
53
  USER_INFO_UPDATE: '/chatctm/chi/individualinformationupdate', //개인 정보 업데이트
54
+ AGE_CHECK_UPDATE: '/chatctm/chi/ageconsentupdate', // 연령 동의 업데이트
53
55
  /* 히스토리 */
54
56
  HISTORY_PHONE_REQUEST: '/chatctm/his/occupancycertificationnumbersend', // 점유 인증 번호 요청
55
57
  HISTORY_PHONE_AUTHENTICATION: '/chatctm/his/occupancycertificationnumberverification', // 점유 인증 번호 검증
@@ -851,6 +853,36 @@ export async function chatUserUpdate(
851
853
  }
852
854
  }
853
855
 
856
+ export async function ageCheckUpdate(
857
+ chatInquiryNumber: string,
858
+ ageConsentStateCode: AgeCheckStatusEnums,
859
+ version?: string
860
+ ): Promise<IDaeryunTalkResponseWrapper<any>> {
861
+ const body = {
862
+ d: {
863
+ chat_inquiry_number: chatInquiryNumber,
864
+ age_consent_state_code: ageConsentStateCode // AGE00100001(미동의), AGE00100002(동의)
865
+ }
866
+ };
867
+
868
+ consoleFn('[채팅 연령 동의 업데이트] 시작');
869
+ try {
870
+ const response = await fetchWithCookies<{ result: string }>(
871
+ `${API_BASE_URL}${ENDPOINTS.AGE_CHECK_UPDATE}`,
872
+ {
873
+ method: 'POST',
874
+ body: JSON.stringify(body)
875
+ },
876
+ version
877
+ );
878
+ consoleFn('[채팅 연령 동의 업데이트 성공]', response);
879
+ return response;
880
+ } catch (error) {
881
+ console.error('[채팅 연령 동의 업데이트 실패]', error);
882
+ throw error;
883
+ }
884
+ }
885
+
854
886
  /**
855
887
  * 채팅문의 메시지 파일 다운로드 URL 생성
856
888
  * @param chatInquiryNumber 채팅문의번호
@@ -1,3 +1,4 @@
1
+ import { AgeCheckStatusEnums } from "../../../_enums/ags_check_status";
1
2
  export interface IDaeryunTalkResponseWrapper<T = unknown> {
2
3
  result_info: {
3
4
  result_cd: string;
@@ -103,6 +104,7 @@ export interface ObjectExposeInfo {
103
104
  object_group_ui_code?: string;
104
105
  }
105
106
  export interface ChatInquiryDetailDataResponse {
107
+ age_consent_state_code: AgeCheckStatusEnums;
106
108
  chat_inquiry_state_code?: string;
107
109
  object_expose_info: ObjectExposeInfo;
108
110
  work_flow_progress_stack: string[];
@@ -1,3 +1,7 @@
1
+ import { AgeCheckStatusEnums } from "../../../_enums/ags_check_status";
2
+
3
+
4
+
1
5
  export interface IDaeryunTalkResponseWrapper<T = unknown> {
2
6
  result_info: {
3
7
  result_cd: string;
@@ -121,6 +125,7 @@ export interface ObjectExposeInfo {
121
125
 
122
126
  // 채팅 문의 상세 데이터 타입 정의
123
127
  export interface ChatInquiryDetailDataResponse {
128
+ age_consent_state_code: AgeCheckStatusEnums; // 연령 체크 여부 확인
124
129
  chat_inquiry_state_code?: string; // 채팅 문의 상태 코드
125
130
  object_expose_info: ObjectExposeInfo; // 오브젝트 노출 정보
126
131
  work_flow_progress_stack: string[]; // 워크플로우 스택
@@ -0,0 +1,5 @@
1
+ export declare enum AgeCheckStatusEnums {
2
+ DISAGREED = "AGE00100001",
3
+ AGREED = "AGE00100002"
4
+ }
5
+ export declare const AgeCheckStatusLabel: Record<AgeCheckStatusEnums, string>;
@@ -0,0 +1,9 @@
1
+ export var AgeCheckStatusEnums;
2
+ (function (AgeCheckStatusEnums) {
3
+ AgeCheckStatusEnums["DISAGREED"] = "AGE00100001";
4
+ AgeCheckStatusEnums["AGREED"] = "AGE00100002";
5
+ })(AgeCheckStatusEnums || (AgeCheckStatusEnums = {}));
6
+ export const AgeCheckStatusLabel = {
7
+ [AgeCheckStatusEnums.DISAGREED]: '미동의',
8
+ [AgeCheckStatusEnums.AGREED]: '동의'
9
+ };
@@ -0,0 +1,9 @@
1
+ export enum AgeCheckStatusEnums {
2
+ DISAGREED = 'AGE00100001',
3
+ AGREED = 'AGE00100002'
4
+ }
5
+
6
+ export const AgeCheckStatusLabel: Record<AgeCheckStatusEnums, string> = {
7
+ [AgeCheckStatusEnums.DISAGREED]: '미동의',
8
+ [AgeCheckStatusEnums.AGREED]: '동의'
9
+ };
@@ -2,6 +2,7 @@ import { Dispatch, SetStateAction } from 'react';
2
2
  import { IChatInquiryMainDataResponse } from '../../_api/daeryuntalk/type/response';
3
3
  import { Message } from '../../_types/message';
4
4
  import { MessageObject } from '../../_types/message_object';
5
+ import { AgeCheckStatusEnums } from '../../_enums/ags_check_status';
5
6
  interface props {
6
7
  setIsLoading: Dispatch<SetStateAction<boolean>>;
7
8
  inquiryMainData: IChatInquiryMainDataResponse | null;
@@ -14,8 +15,9 @@ interface props {
14
15
  setWorkFlowStack: Dispatch<SetStateAction<string[]>>;
15
16
  setInquiryMainData: Dispatch<SetStateAction<IChatInquiryMainDataResponse | null>>;
16
17
  centerCode: string;
18
+ setAgeCheckStatus: Dispatch<SetStateAction<AgeCheckStatusEnums | null>>;
17
19
  }
18
- export declare const useChatHandler: ({ setIsLoading, inquiryMainData, setChatInquiryNumber, setMessages, setInquiryStatus, setMessageObject, chatInquiryNumber, setIsNextPage, setWorkFlowStack, setInquiryMainData, centerCode }: props) => {
20
+ export declare const useChatHandler: ({ setIsLoading, inquiryMainData, setChatInquiryNumber, setMessages, setInquiryStatus, setMessageObject, chatInquiryNumber, setIsNextPage, setWorkFlowStack, setInquiryMainData, centerCode, setAgeCheckStatus }: props) => {
19
21
  attendRoomByHistory: (chatInquiryNumber: string) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").HistoryListResponse> | undefined>;
20
22
  startChat: (inquiryNumber?: string) => Promise<string | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryCreateDataResponse> | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryDetailDataResponse> | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryMessageListDataResponse> | {
21
23
  error: unknown;
@@ -41,5 +43,6 @@ export declare const useChatHandler: ({ setIsLoading, inquiryMainData, setChatIn
41
43
  }) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<any> | undefined>;
42
44
  getNextMessageList: (chatInquiryNumber: string, standardTimestamp: number) => Promise<void>;
43
45
  startSelectedChat: (chatInquiryNumber: string) => Promise<string | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryDetailDataResponse> | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryMessageListDataResponse>>;
46
+ ageConfirm: (chatInquiryNumber: string, ageConsentStateCode: AgeCheckStatusEnums) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<any> | undefined>;
44
47
  };
45
48
  export {};
@@ -8,13 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { useCallback } from 'react';
11
- import { attendChatRoomByHistory, chatUserUpdate as apiChatUserUpdate, chatWorkFlow, chatWorkFlowBack, generateChatInquiry, getChatInquiryDetailNew, getChatInquiryMessageList, sendChatMessage } from '../../_api';
11
+ import { attendChatRoomByHistory, chatUserUpdate as apiChatUserUpdate, chatWorkFlow, chatWorkFlowBack, generateChatInquiry, getChatInquiryDetailNew, getChatInquiryMessageList, sendChatMessage, ageCheckUpdate } from '../../_api';
12
12
  import { convertApiMessageObjectToUiMessageObject, convertApiMessageToUiMessage } from '../../_lib';
13
13
  import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
14
14
  import { useFullURL } from './useFullURL';
15
15
  import { getErrorMessageMap } from '../../_enums/error';
16
16
  import { consoleFn } from '../../_lib/utils';
17
- export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNumber, setMessages, setInquiryStatus, setMessageObject, chatInquiryNumber, setIsNextPage, setWorkFlowStack, setInquiryMainData, centerCode }) => {
17
+ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNumber, setMessages, setInquiryStatus, setMessageObject, chatInquiryNumber, setIsNextPage, setWorkFlowStack, setInquiryMainData, centerCode, setAgeCheckStatus }) => {
18
18
  const toast = useDaeryunTalkToast();
19
19
  const fullUrl = useFullURL();
20
20
  const resetData = useCallback(() => {
@@ -118,7 +118,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
118
118
  }), [inquiryMainData, fullUrl]);
119
119
  // 선택된 히스토리의 채팅창 시작
120
120
  const startSelectedChat = useCallback((chatInquiryNumber) => __awaiter(void 0, void 0, void 0, function* () {
121
- var _a, _b, _c, _d, _e, _f, _g, _h;
121
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
122
122
  try {
123
123
  setIsLoading(true);
124
124
  // 문의 상세 조회
@@ -168,18 +168,22 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
168
168
  if ((_c = detailResponse.data) === null || _c === void 0 ? void 0 : _c.chat_inquiry_state_code) {
169
169
  setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
170
170
  }
171
+ // 해당 문의 연령 체크
172
+ if ((_d = detailResponse.data) === null || _d === void 0 ? void 0 : _d.age_consent_state_code) {
173
+ setAgeCheckStatus(detailResponse.data.age_consent_state_code);
174
+ }
171
175
  // 해당 문의 오브젝트
172
- if ((_d = detailResponse.data) === null || _d === void 0 ? void 0 : _d.object_expose_info) {
176
+ if ((_e = detailResponse.data) === null || _e === void 0 ? void 0 : _e.object_expose_info) {
173
177
  const uiObject = convertApiMessageObjectToUiMessageObject(detailResponse.data);
174
178
  setMessageObject(uiObject);
175
179
  }
176
180
  // 해당 문의 상태
177
- if ((_e = detailResponse.data) === null || _e === void 0 ? void 0 : _e.chat_inquiry_state_code) {
181
+ if ((_f = detailResponse.data) === null || _f === void 0 ? void 0 : _f.chat_inquiry_state_code) {
178
182
  setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
179
183
  }
180
184
  // 워크플로우 스택 업데이트
181
- if ((_f = detailResponse.data) === null || _f === void 0 ? void 0 : _f.work_flow_progress_stack) {
182
- setWorkFlowStack((_h = (_g = detailResponse.data) === null || _g === void 0 ? void 0 : _g.work_flow_progress_stack) !== null && _h !== void 0 ? _h : []);
185
+ if ((_g = detailResponse.data) === null || _g === void 0 ? void 0 : _g.work_flow_progress_stack) {
186
+ setWorkFlowStack((_j = (_h = detailResponse.data) === null || _h === void 0 ? void 0 : _h.work_flow_progress_stack) !== null && _j !== void 0 ? _j : []);
183
187
  }
184
188
  return chatInquiryNumber;
185
189
  }
@@ -213,7 +217,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
213
217
  }), [chatInquiryNumber]);
214
218
  // 신규 채팅 문의 생성
215
219
  const createNewChat = useCallback((version) => __awaiter(void 0, void 0, void 0, function* () {
216
- var _a, _b, _c, _d, _e, _f, _g;
220
+ var _a, _b, _c, _d, _e, _f, _g, _h;
217
221
  try {
218
222
  if (!inquiryMainData) {
219
223
  toast.error('채널이 존재하지 않습니다.');
@@ -267,12 +271,16 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
267
271
  if ((_c = detailResponse.data) === null || _c === void 0 ? void 0 : _c.chat_inquiry_state_code) {
268
272
  setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
269
273
  }
274
+ // 해당 문의 연령 체크
275
+ if ((_d = detailResponse.data) === null || _d === void 0 ? void 0 : _d.age_consent_state_code) {
276
+ setAgeCheckStatus(detailResponse.data.age_consent_state_code);
277
+ }
270
278
  // 워크플로우 스택 업데이트
271
- if ((_d = detailResponse.data) === null || _d === void 0 ? void 0 : _d.work_flow_progress_stack) {
272
- setWorkFlowStack((_f = (_e = detailResponse.data) === null || _e === void 0 ? void 0 : _e.work_flow_progress_stack) !== null && _f !== void 0 ? _f : []);
279
+ if ((_e = detailResponse.data) === null || _e === void 0 ? void 0 : _e.work_flow_progress_stack) {
280
+ setWorkFlowStack((_g = (_f = detailResponse.data) === null || _f === void 0 ? void 0 : _f.work_flow_progress_stack) !== null && _g !== void 0 ? _g : []);
273
281
  }
274
282
  // 해당 문의 오브젝트
275
- if ((_g = detailResponse.data) === null || _g === void 0 ? void 0 : _g.object_expose_info) {
283
+ if ((_h = detailResponse.data) === null || _h === void 0 ? void 0 : _h.object_expose_info) {
276
284
  const uiObject = convertApiMessageObjectToUiMessageObject(detailResponse.data);
277
285
  setMessageObject(uiObject);
278
286
  }
@@ -351,22 +359,23 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
351
359
  }), []);
352
360
  const chatUserUpdate = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
353
361
  const { chatInquiryNumber, messageNumber, name, cellPhoneNumber } = data;
354
- if (!chatInquiryNumber) {
355
- toast.error('채팅 개인 정보 업데이트: 문의 번호가 없음');
356
- return;
357
- }
358
- if (!messageNumber) {
359
- toast.error('채팅 개인 정보 업데이트: 메시지 번호 없음');
362
+ // if (!chatInquiryNumber) {
363
+ // toast.error('채팅 개인 정보 업데이트: 문의 번호가 없음');
364
+ // return;
365
+ // }
366
+ // console.log('chatInquiryNumber', chatInquiryNumber);
367
+ if (!cellPhoneNumber) {
368
+ toast.error('이름과 휴대폰 번호를 입력해 주세요');
360
369
  return;
361
370
  }
362
371
  if (!name) {
363
- toast.error('채팅 개인 정보 업데이트: 이름 없음');
364
- return;
365
- }
366
- if (!cellPhoneNumber) {
367
- toast.error('채팅 개인 정보 업데이트: 메시지 번호 없음');
372
+ toast.error('이름과 휴대폰 번호를 입력해 주세요');
368
373
  return;
369
374
  }
375
+ // if (!cellPhoneNumber) {
376
+ // toast.error('채팅 개인 정보 업데이트: 메시지 번호 없음');
377
+ // return;
378
+ // }
370
379
  try {
371
380
  setIsLoading === null || setIsLoading === void 0 ? void 0 : setIsLoading(true);
372
381
  const response = yield apiChatUserUpdate(chatInquiryNumber, messageNumber, name, cellPhoneNumber);
@@ -425,6 +434,22 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
425
434
  finally {
426
435
  }
427
436
  }), [chatInquiryNumber]);
437
+ const ageConfirm = useCallback((chatInquiryNumber, ageConsentStateCode) => __awaiter(void 0, void 0, void 0, function* () {
438
+ try {
439
+ const response = yield ageCheckUpdate(chatInquiryNumber, ageConsentStateCode);
440
+ if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
441
+ toast.error(getErrorMessageMap(response));
442
+ return;
443
+ }
444
+ setAgeCheckStatus(ageConsentStateCode);
445
+ return response;
446
+ }
447
+ catch (error) {
448
+ console.error(`[연령 확인 실패]:`, error);
449
+ }
450
+ finally {
451
+ }
452
+ }), []);
428
453
  return {
429
454
  attendRoomByHistory,
430
455
  startChat,
@@ -434,6 +459,7 @@ export const useChatHandler = ({ setIsLoading, inquiryMainData, setChatInquiryNu
434
459
  workFlowBack,
435
460
  chatUserUpdate,
436
461
  getNextMessageList,
437
- startSelectedChat
462
+ startSelectedChat,
463
+ ageConfirm
438
464
  };
439
465
  };
@@ -7,7 +7,8 @@ import {
7
7
  generateChatInquiry,
8
8
  getChatInquiryDetailNew,
9
9
  getChatInquiryMessageList,
10
- sendChatMessage
10
+ sendChatMessage,
11
+ ageCheckUpdate
11
12
  } from '../../_api';
12
13
  import { convertApiMessageObjectToUiMessageObject, convertApiMessageToUiMessage } from '../../_lib';
13
14
  import { IChatInquiryMainDataResponse } from '../../_api/daeryuntalk/type/response';
@@ -17,6 +18,7 @@ import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
17
18
  import { useFullURL } from './useFullURL';
18
19
  import { getErrorMessageMap } from '../../_enums/error';
19
20
  import { consoleFn } from '../../_lib/utils';
21
+ import { AgeCheckStatusEnums } from '../../_enums/ags_check_status';
20
22
 
21
23
  interface props {
22
24
  setIsLoading: Dispatch<SetStateAction<boolean>>;
@@ -30,6 +32,7 @@ interface props {
30
32
  setWorkFlowStack: Dispatch<SetStateAction<string[]>>;
31
33
  setInquiryMainData: Dispatch<SetStateAction<IChatInquiryMainDataResponse | null>>;
32
34
  centerCode: string;
35
+ setAgeCheckStatus: Dispatch<SetStateAction<AgeCheckStatusEnums | null>>;
33
36
  }
34
37
 
35
38
  export const useChatHandler = ({
@@ -43,7 +46,8 @@ export const useChatHandler = ({
43
46
  setIsNextPage,
44
47
  setWorkFlowStack,
45
48
  setInquiryMainData,
46
- centerCode
49
+ centerCode,
50
+ setAgeCheckStatus
47
51
  }: props) => {
48
52
  const toast = useDaeryunTalkToast();
49
53
  const fullUrl = useFullURL();
@@ -239,6 +243,10 @@ export const useChatHandler = ({
239
243
  if (detailResponse.data?.chat_inquiry_state_code) {
240
244
  setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
241
245
  }
246
+ // 해당 문의 연령 체크
247
+ if (detailResponse.data?.age_consent_state_code) {
248
+ setAgeCheckStatus(detailResponse.data.age_consent_state_code);
249
+ }
242
250
  // 해당 문의 오브젝트
243
251
  if (detailResponse.data?.object_expose_info) {
244
252
  const uiObject = convertApiMessageObjectToUiMessageObject(detailResponse.data);
@@ -358,6 +366,10 @@ export const useChatHandler = ({
358
366
  if (detailResponse.data?.chat_inquiry_state_code) {
359
367
  setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
360
368
  }
369
+ // 해당 문의 연령 체크
370
+ if (detailResponse.data?.age_consent_state_code) {
371
+ setAgeCheckStatus(detailResponse.data.age_consent_state_code);
372
+ }
361
373
  // 워크플로우 스택 업데이트
362
374
  if (detailResponse.data?.work_flow_progress_stack) {
363
375
  setWorkFlowStack(detailResponse.data?.work_flow_progress_stack ?? []);
@@ -456,25 +468,28 @@ export const useChatHandler = ({
456
468
  async (data: { chatInquiryNumber: string; messageNumber: string; name: string; cellPhoneNumber: string }) => {
457
469
  const { chatInquiryNumber, messageNumber, name, cellPhoneNumber } = data;
458
470
 
459
- if (!chatInquiryNumber) {
460
- toast.error('채팅 개인 정보 업데이트: 문의 번호가 없음');
461
- return;
462
- }
471
+ // if (!chatInquiryNumber) {
472
+ // toast.error('채팅 개인 정보 업데이트: 문의 번호가 없음');
473
+ // return;
474
+ // }
463
475
 
464
- if (!messageNumber) {
465
- toast.error('채팅 개인 정보 업데이트: 메시지 번호 없음');
476
+ // console.log('chatInquiryNumber', chatInquiryNumber);
477
+
478
+
479
+ if (!cellPhoneNumber) {
480
+ toast.error('이름과 휴대폰 번호를 입력해 주세요');
466
481
  return;
467
482
  }
468
483
 
469
484
  if (!name) {
470
- toast.error('채팅 개인 정보 업데이트: 이름 없음');
485
+ toast.error('이름과 휴대폰 번호를 입력해 주세요');
471
486
  return;
472
487
  }
473
488
 
474
- if (!cellPhoneNumber) {
475
- toast.error('채팅 개인 정보 업데이트: 메시지 번호 없음');
476
- return;
477
- }
489
+ // if (!cellPhoneNumber) {
490
+ // toast.error('채팅 개인 정보 업데이트: 메시지 번호 없음');
491
+ // return;
492
+ // }
478
493
 
479
494
  try {
480
495
  setIsLoading?.(true);
@@ -543,6 +558,28 @@ export const useChatHandler = ({
543
558
  [chatInquiryNumber]
544
559
  );
545
560
 
561
+ const ageConfirm = useCallback(
562
+ async (
563
+ chatInquiryNumber: string,
564
+ ageConsentStateCode: AgeCheckStatusEnums
565
+ ) => {
566
+ try {
567
+ const response = await ageCheckUpdate(chatInquiryNumber, ageConsentStateCode);
568
+
569
+ if (!(response.result_info.result_cd === 'OK' || response.result_info.result_type_cd === 'OK')) {
570
+ toast.error(getErrorMessageMap(response));
571
+ return;
572
+ }
573
+ setAgeCheckStatus(ageConsentStateCode);
574
+ return response;
575
+ } catch (error: any) {
576
+ console.error(`[연령 확인 실패]:`, error);
577
+ } finally {
578
+ }
579
+ },
580
+ []
581
+ );
582
+
546
583
  return {
547
584
  attendRoomByHistory,
548
585
  startChat,
@@ -552,6 +589,7 @@ export const useChatHandler = ({
552
589
  workFlowBack,
553
590
  chatUserUpdate,
554
591
  getNextMessageList,
555
- startSelectedChat
592
+ startSelectedChat,
593
+ ageConfirm
556
594
  };
557
595
  };
@@ -1,25 +1,15 @@
1
1
  import { usePathname, useSearchParams } from 'next/navigation';
2
- import { useEffect, useState } from 'react';
2
+ import { useMemo } from 'react';
3
3
  export function useFullURL() {
4
4
  const pathname = usePathname();
5
5
  const searchParams = useSearchParams();
6
- const [fullUrl, setFullUrl] = useState(() => {
7
- if (typeof window !== 'undefined') {
8
- const origin = window.location.origin;
9
- const query = searchParams.toString();
10
- const hash = window.location.hash;
11
- return origin + pathname + (query ? `?${query}` : '') + hash;
12
- }
13
- return '';
14
- });
15
- useEffect(() => {
16
- if (typeof window !== 'undefined') {
17
- const origin = window.location.origin;
18
- const query = searchParams.toString();
19
- const hash = window.location.hash;
20
- const fullPath = origin + pathname + (query ? `?${query}` : '') + hash;
21
- setFullUrl(fullPath);
22
- }
6
+ const fullUrl = useMemo(() => {
7
+ if (typeof window === 'undefined')
8
+ return '';
9
+ const origin = window.location.origin;
10
+ const query = searchParams.toString();
11
+ const hash = window.location.hash;
12
+ return origin + pathname + (query ? `?${query}` : '') + hash;
23
13
  }, [pathname, searchParams]);
24
14
  return fullUrl;
25
15
  }
@@ -1,28 +1,16 @@
1
1
  import { usePathname, useSearchParams } from 'next/navigation';
2
- import { useEffect, useState } from 'react';
2
+ import { useMemo } from 'react';
3
3
 
4
4
  export function useFullURL() {
5
5
  const pathname = usePathname();
6
6
  const searchParams = useSearchParams();
7
7
 
8
- const [fullUrl, setFullUrl] = useState(() => {
9
- if (typeof window !== 'undefined') {
10
- const origin = window.location.origin;
11
- const query = searchParams.toString();
12
- const hash = window.location.hash;
13
- return origin + pathname + (query ? `?${query}` : '') + hash;
14
- }
15
- return '';
16
- });
17
-
18
- useEffect(() => {
19
- if (typeof window !== 'undefined') {
20
- const origin = window.location.origin;
21
- const query = searchParams.toString();
22
- const hash = window.location.hash;
23
- const fullPath = origin + pathname + (query ? `?${query}` : '') + hash;
24
- setFullUrl(fullPath);
25
- }
8
+ const fullUrl = useMemo(() => {
9
+ if (typeof window === 'undefined') return '';
10
+ const origin = window.location.origin;
11
+ const query = searchParams.toString();
12
+ const hash = window.location.hash;
13
+ return origin + pathname + (query ? `?${query}` : '') + hash;
26
14
  }, [pathname, searchParams]);
27
15
 
28
16
  return fullUrl;
@@ -3,6 +3,7 @@ import { Message } from '../../_types/message';
3
3
  import { History, IChatInquiryMainDataResponse } from '../../_api/daeryuntalk/type/response';
4
4
  import { MessageObject } from '../../_types/message_object';
5
5
  import { ViewState } from '../../ChatHomeView';
6
+ import { AgeCheckStatusEnums } from '../../_enums/ags_check_status';
6
7
  interface props {
7
8
  setIsConnected: Dispatch<SetStateAction<boolean | null>>;
8
9
  setIsLoading: Dispatch<SetStateAction<boolean>>;
@@ -26,8 +27,9 @@ interface props {
26
27
  setIsNextPage: Dispatch<SetStateAction<boolean | null>>;
27
28
  setInitialLoading: Dispatch<SetStateAction<boolean | null>>;
28
29
  setChatInquiryNumber: Dispatch<SetStateAction<string | null>>;
30
+ setAgeCheckStatus: Dispatch<SetStateAction<AgeCheckStatusEnums | null>>;
29
31
  }
30
- export declare const useSocketEventHandler: ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated, setIsTyping, onClose, centerCode, setPreviewState, setIsUserExpried, chatInquiryNumber, setIsNextPage, setInitialLoading, setChatInquiryNumber }: props) => {
32
+ export declare const useSocketEventHandler: ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated, setIsTyping, onClose, centerCode, setPreviewState, setIsUserExpried, chatInquiryNumber, setIsNextPage, setInitialLoading, setChatInquiryNumber, setAgeCheckStatus }: props) => {
31
33
  initializeDaeryuntalk: (hashValue: string | null, isOpen: boolean, centerCode: string, version?: string) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<IChatInquiryMainDataResponse> | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryCreateDataResponse> | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryDetailDataResponse> | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryMessageListDataResponse> | null | undefined>;
32
34
  sendInquiryWatching: (chatInquiryNumber: string) => void;
33
35
  retryInquiryMain: (channelNumber: string) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<IChatInquiryMainDataResponse>>;
@@ -16,7 +16,7 @@ import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
16
16
  import { getErrorMessageMap } from '../../_enums/error';
17
17
  import { consoleFn } from '../../_lib/utils';
18
18
  import { useFullURL } from './useFullURL';
19
- export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated, setIsTyping, onClose, centerCode, setPreviewState, setIsUserExpried, chatInquiryNumber, setIsNextPage, setInitialLoading, setChatInquiryNumber }) => {
19
+ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated, setIsTyping, onClose, centerCode, setPreviewState, setIsUserExpried, chatInquiryNumber, setIsNextPage, setInitialLoading, setChatInquiryNumber, setAgeCheckStatus }) => {
20
20
  var _a;
21
21
  const typingBlockRef = useRef(null);
22
22
  const typingTimeoutRef = useRef(null);
@@ -377,7 +377,7 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
377
377
  };
378
378
  // Daeryuntalk API 초기화 메소드
379
379
  const initializeDaeryuntalk = useCallback((hashValue, isOpen, centerCode, version) => __awaiter(void 0, void 0, void 0, function* () {
380
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
380
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
381
381
  if (userExpiredRef.current) {
382
382
  consoleFn('유저 만료 상태로 초기화 X');
383
383
  return;
@@ -474,13 +474,17 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
474
474
  const uiObject = convertApiMessageObjectToUiMessageObject(detailResponse.data);
475
475
  setMessageObject(uiObject);
476
476
  }
477
+ // 해당 문의 연령 체크
478
+ if ((_t = detailResponse.data) === null || _t === void 0 ? void 0 : _t.age_consent_state_code) {
479
+ setAgeCheckStatus(detailResponse.data.age_consent_state_code);
480
+ }
477
481
  // 해당 문의 상태
478
- if ((_t = detailResponse.data) === null || _t === void 0 ? void 0 : _t.chat_inquiry_state_code) {
482
+ if ((_u = detailResponse.data) === null || _u === void 0 ? void 0 : _u.chat_inquiry_state_code) {
479
483
  setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
480
484
  }
481
485
  // 워크플로우 스택 업데이트
482
- if ((_u = detailResponse.data) === null || _u === void 0 ? void 0 : _u.work_flow_progress_stack) {
483
- setWorkFlowStack((_w = (_v = detailResponse.data) === null || _v === void 0 ? void 0 : _v.work_flow_progress_stack) !== null && _w !== void 0 ? _w : []);
486
+ if ((_v = detailResponse.data) === null || _v === void 0 ? void 0 : _v.work_flow_progress_stack) {
487
+ setWorkFlowStack((_x = (_w = detailResponse.data) === null || _w === void 0 ? void 0 : _w.work_flow_progress_stack) !== null && _x !== void 0 ? _x : []);
484
488
  }
485
489
  setInquiryMainData(Object.assign(Object.assign({}, inquiryData.data), { progress_inquiry_number: chatNumber }));
486
490
  if (socket) {
@@ -23,6 +23,7 @@ import { getErrorMessageMap } from '../../_enums/error';
23
23
  import { ViewState } from '../../ChatHomeView';
24
24
  import { consoleFn } from '../../_lib/utils';
25
25
  import { useFullURL } from './useFullURL';
26
+ import { AgeCheckStatusEnums } from '../../_enums/ags_check_status';
26
27
 
27
28
  interface props {
28
29
  setIsConnected: Dispatch<SetStateAction<boolean | null>>;
@@ -47,6 +48,7 @@ interface props {
47
48
  setIsNextPage: Dispatch<SetStateAction<boolean | null>>;
48
49
  setInitialLoading: Dispatch<SetStateAction<boolean | null>>;
49
50
  setChatInquiryNumber: Dispatch<SetStateAction<string | null>>;
51
+ setAgeCheckStatus: Dispatch<SetStateAction<AgeCheckStatusEnums | null>>;
50
52
  }
51
53
 
52
54
  export const useSocketEventHandler = ({
@@ -71,7 +73,8 @@ export const useSocketEventHandler = ({
71
73
  chatInquiryNumber,
72
74
  setIsNextPage,
73
75
  setInitialLoading,
74
- setChatInquiryNumber
76
+ setChatInquiryNumber,
77
+ setAgeCheckStatus
75
78
  }: props) => {
76
79
 
77
80
  const typingBlockRef = useRef<NodeJS.Timeout | null>(null);
@@ -634,6 +637,11 @@ export const useSocketEventHandler = ({
634
637
  setMessageObject(uiObject);
635
638
  }
636
639
 
640
+ // 해당 문의 연령 체크
641
+ if (detailResponse.data?.age_consent_state_code) {
642
+ setAgeCheckStatus(detailResponse.data.age_consent_state_code);
643
+ }
644
+
637
645
  // 해당 문의 상태
638
646
  if (detailResponse.data?.chat_inquiry_state_code) {
639
647
  setInquiryStatus(detailResponse.data.chat_inquiry_state_code);
@@ -118,4 +118,4 @@ export const useWorkFlow = (props: {
118
118
  onClickKakao: onClickKakao,
119
119
  onClickTel: onClickTel
120
120
  };
121
- };
121
+ };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface Button4Props {
3
+ onClick?: () => void | Promise<void>;
4
+ type?: 'button' | 'submit' | 'reset';
5
+ className?: string;
6
+ children: React.ReactNode;
7
+ isDisabled?: boolean;
8
+ }
9
+ declare const Button4: ({ onClick, type, className, children, isDisabled }: Button4Props) => React.JSX.Element;
10
+ export default Button4;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ const Button4 = ({ onClick, type = 'button', className = '', children, isDisabled = false }) => {
3
+ return (<button type={type} onClick={onClick} disabled={isDisabled} className={`
4
+ dr_talk_body_medium2 h-[26px]
5
+ rounded-[4px] bg-drTalkBtnActive1 px-[12px] text-drTalkWhite
6
+ disabled:cursor-not-allowed disabled:bg-drTalkGrayscale3
7
+ ${className}
8
+ `}>
9
+ {children}
10
+ </button>);
11
+ };
12
+ export default Button4;