@daeryun/dr_components 0.7.82 → 0.7.84

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 (40) hide show
  1. package/dist/asset/images/daeryuntalk/minus.svg +4 -0
  2. package/dist/asset/images/daeryuntalk/plus.svg +4 -0
  3. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  4. package/dist/components/Daeryuntalk/ChatConversation.jsx +19 -11
  5. package/dist/components/Daeryuntalk/ChatConversation.tsx +43 -34
  6. package/dist/components/Daeryuntalk/ChatInput.jsx +2 -0
  7. package/dist/components/Daeryuntalk/ChatInput.tsx +2 -0
  8. package/dist/components/Daeryuntalk/ChatMessage.d.ts +1 -0
  9. package/dist/components/Daeryuntalk/ChatMessage.jsx +25 -8
  10. package/dist/components/Daeryuntalk/ChatMessage.tsx +45 -15
  11. package/dist/components/Daeryuntalk/ChatObject/FieldWorkObject.d.ts +9 -0
  12. package/dist/components/Daeryuntalk/ChatObject/FieldWorkObject.jsx +33 -0
  13. package/dist/components/Daeryuntalk/ChatObject/FieldWorkObject.tsx +65 -0
  14. package/dist/components/Daeryuntalk/ChatObject/ObjectButton.jsx +10 -3
  15. package/dist/components/Daeryuntalk/ChatObject/ObjectButton.tsx +12 -4
  16. package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +2 -0
  17. package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +6 -3
  18. package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +8 -3
  19. package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +15 -12
  20. package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +15 -11
  21. package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +1 -1
  22. package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +1 -1
  23. package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.d.ts +1 -0
  24. package/dist/components/Daeryuntalk/_api/daeryuntalk/type/response.ts +1 -0
  25. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +3 -0
  26. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +6 -0
  27. package/dist/components/Daeryuntalk/_hooks/talkprovider/useWorkFlow.d.ts +9 -0
  28. package/dist/components/Daeryuntalk/_hooks/talkprovider/useWorkFlow.js +109 -0
  29. package/dist/components/Daeryuntalk/_hooks/talkprovider/useWorkFlow.ts +122 -0
  30. package/dist/components/Daeryuntalk/_lib/index.js +5 -2
  31. package/dist/components/Daeryuntalk/_lib/index.ts +5 -2
  32. package/dist/components/Daeryuntalk/_types/message_object.d.ts +1 -0
  33. package/dist/components/Daeryuntalk/_types/message_object.ts +1 -0
  34. package/dist/components/Daeryuntalk/index.d.ts +4 -1
  35. package/dist/components/Daeryuntalk/index.jsx +2 -2
  36. package/dist/components/Daeryuntalk/index.tsx +6 -2
  37. package/dist/components/common/integrate/index.d.ts +1 -1
  38. package/dist/styles/globals.css +314 -305
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +1 -1
@@ -20,8 +20,8 @@ import WorkFlowAuthForm from './ChatItem/WorkFlowAuthForm';
20
20
  import ChatWrapper from './ChatItem/ChatWrapper';
21
21
  import RichText from './ChatItem/RichText';
22
22
  import ChatFile from './ChatItem/ChatFile';
23
- import { getMessageFileDownloadUrl } from './_api';
24
- const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, workFlowStack, isHovered }) => {
23
+ import FieldWorkObject from './ChatObject/FieldWorkObject';
24
+ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, workFlowStack, isHovered, scrollEnd }) => {
25
25
  // 고객 , 오퍼레이터 분리
26
26
  const isOperator = message.senderType !== MessageSenderType.CUSTOMER;
27
27
  const formatTime = (date) => {
@@ -30,7 +30,6 @@ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, wor
30
30
  return `${hours}:${minutes}`;
31
31
  };
32
32
  const time = formatTime(message.createdAt);
33
- getMessageFileDownloadUrl;
34
33
  // 텍스트 블록 렌더링
35
34
  const renderText = (message) => {
36
35
  /**
@@ -82,11 +81,25 @@ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, wor
82
81
  };
83
82
  /** todo 메시지 내용 렌더링 추후 추가 될듯 */
84
83
  const renderMessageContent = () => {
85
- var _a;
84
+ var _a, _b, _c;
86
85
  const objectFirstQuestionCheck = Array.isArray(object === null || object === void 0 ? void 0 : object.objectList)
87
86
  ? Object.values(ObjectNumber).every(enumValue => { var _a; return (_a = object === null || object === void 0 ? void 0 : object.objectList) === null || _a === void 0 ? void 0 : _a.some(obj => (obj === null || obj === void 0 ? void 0 : obj.objectNumber) === enumValue); })
88
87
  : false;
89
88
  const objectIsBack = workFlowStack.length >= 3;
89
+ // // PK없어서 이렇게
90
+ // const fieldKeywords = [
91
+ // '기업법무',
92
+ // '지식재산권',
93
+ // '공정거래',
94
+ // '건설',
95
+ // '이혼',
96
+ // '상속',
97
+ // '조세',
98
+ // '형사',
99
+ // '노동',
100
+ // '금융'
101
+ // ];
102
+ const isAllFieldOfWork = !!(object === null || object === void 0 ? void 0 : object.objectList) && ((_a = object === null || object === void 0 ? void 0 : object.objectList) === null || _a === void 0 ? void 0 : _a.length) > 20;
90
103
  return (<div className={`
91
104
  message-content
92
105
  `}>
@@ -100,10 +113,14 @@ const ChatMessage = ({ message, object, handelObjectBack, chatInquiryNumber, wor
100
113
  : 'flex flex-col gap-[8px]'}
101
114
 
102
115
  `}>
103
- {(_a = object.objectList) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
104
- var _a;
105
- return (<ObjectButton key={`object-expose-${index}`} object={item} messageNumber={(object === null || object === void 0 ? void 0 : object.messageNumber) || ''} workFlowNumber={((_a = message === null || message === void 0 ? void 0 : message.workFlow) === null || _a === void 0 ? void 0 : _a.workFlowNumber) || ''} isFirstObject={objectFirstQuestionCheck} objectGroupUiCode={(object === null || object === void 0 ? void 0 : object.objectGroupUiCode) || ''}/>);
106
- })}
116
+ {/* 업무분야 리스트면 따로 빼자 */}
117
+ {!isAllFieldOfWork
118
+ ? (_c = (_b = object.objectList) === null || _b === void 0 ? void 0 : _b.sort((a, b) => a.sequence - b.sequence)) === null || _c === void 0 ? void 0 : _c.map((item, index) => {
119
+ var _a;
120
+ return (<ObjectButton key={`object-expose-${index}`} object={item} messageNumber={(object === null || object === void 0 ? void 0 : object.messageNumber) || ''} workFlowNumber={((_a = message === null || message === void 0 ? void 0 : message.workFlow) === null || _a === void 0 ? void 0 : _a.workFlowNumber) || ''} isFirstObject={objectFirstQuestionCheck} objectGroupUiCode={(object === null || object === void 0 ? void 0 : object.objectGroupUiCode) || ''}/>);
121
+ })
122
+ : null}
123
+ {isAllFieldOfWork && (<FieldWorkObject object={object} message={message} isFirstObject={objectFirstQuestionCheck} scrollEnd={scrollEnd}/>)}
107
124
  </div>
108
125
  {!objectFirstQuestionCheck && (<ObjectBack isBack={objectIsBack} handleBtn={() => __awaiter(void 0, void 0, void 0, function* () {
109
126
  if (handelObjectBack) {
@@ -26,6 +26,7 @@ import ChatWrapper from './ChatItem/ChatWrapper';
26
26
  import RichText from './ChatItem/RichText';
27
27
  import ChatFile from './ChatItem/ChatFile';
28
28
  import { getMessageFileDownloadUrl } from './_api';
29
+ import FieldWorkObject from './ChatObject/FieldWorkObject';
29
30
 
30
31
  type ChatMessageProps = {
31
32
  message: Message;
@@ -38,6 +39,7 @@ type ChatMessageProps = {
38
39
  chatInquiryNumber: string;
39
40
  workFlowStack: string[];
40
41
  isHovered: boolean;
42
+ scrollEnd: () => void;
41
43
  };
42
44
 
43
45
  const ChatMessage: React.FC<ChatMessageProps> = ({
@@ -46,7 +48,8 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
46
48
  handelObjectBack,
47
49
  chatInquiryNumber,
48
50
  workFlowStack,
49
- isHovered
51
+ isHovered,
52
+ scrollEnd
50
53
  }) => {
51
54
  // 고객 , 오퍼레이터 분리
52
55
  const isOperator = message.senderType !== MessageSenderType.CUSTOMER;
@@ -59,8 +62,6 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
59
62
 
60
63
  const time = formatTime(message.createdAt);
61
64
 
62
- getMessageFileDownloadUrl;
63
-
64
65
  // 텍스트 블록 렌더링
65
66
  const renderText = (message: Message) => {
66
67
  /**
@@ -134,6 +135,22 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
134
135
 
135
136
  const objectIsBack = workFlowStack.length >= 3;
136
137
 
138
+ // // PK없어서 이렇게
139
+ // const fieldKeywords = [
140
+ // '기업법무',
141
+ // '지식재산권',
142
+ // '공정거래',
143
+ // '건설',
144
+ // '이혼',
145
+ // '상속',
146
+ // '조세',
147
+ // '형사',
148
+ // '노동',
149
+ // '금융'
150
+ // ];
151
+
152
+ const isAllFieldOfWork = !!object?.objectList && object?.objectList?.length > 20;
153
+
137
154
  return (
138
155
  <div
139
156
  className={`
@@ -155,18 +172,31 @@ const ChatMessage: React.FC<ChatMessageProps> = ({
155
172
 
156
173
  `}
157
174
  >
158
- {object.objectList?.map((item, index) => {
159
- return (
160
- <ObjectButton
161
- key={`object-expose-${index}`}
162
- object={item}
163
- messageNumber={object?.messageNumber || ''}
164
- workFlowNumber={message?.workFlow?.workFlowNumber || ''}
165
- isFirstObject={objectFirstQuestionCheck}
166
- objectGroupUiCode={object?.objectGroupUiCode || ''}
167
- />
168
- );
169
- })}
175
+ {/* 업무분야 리스트면 따로 빼자 */}
176
+ {!isAllFieldOfWork
177
+ ? object.objectList
178
+ ?.sort((a, b) => a.sequence - b.sequence)
179
+ ?.map((item, index) => {
180
+ return (
181
+ <ObjectButton
182
+ key={`object-expose-${index}`}
183
+ object={item}
184
+ messageNumber={object?.messageNumber || ''}
185
+ workFlowNumber={message?.workFlow?.workFlowNumber || ''}
186
+ isFirstObject={objectFirstQuestionCheck}
187
+ objectGroupUiCode={object?.objectGroupUiCode || ''}
188
+ />
189
+ );
190
+ })
191
+ : null}
192
+ {isAllFieldOfWork && (
193
+ <FieldWorkObject
194
+ object={object}
195
+ message={message}
196
+ isFirstObject={objectFirstQuestionCheck}
197
+ scrollEnd={scrollEnd}
198
+ />
199
+ )}
170
200
  </div>
171
201
  {!objectFirstQuestionCheck && (
172
202
  <ObjectBack
@@ -0,0 +1,9 @@
1
+ import { MessageObject } from '../_types/message_object';
2
+ import { Message } from '../_types/message';
3
+ declare const FieldWorkObject: ({ object, message, isFirstObject, scrollEnd }: {
4
+ object: MessageObject;
5
+ message: Message;
6
+ isFirstObject: boolean;
7
+ scrollEnd: () => void;
8
+ }) => import("react").JSX.Element;
9
+ export default FieldWorkObject;
@@ -0,0 +1,33 @@
1
+ import { useEffect, useState } from 'react';
2
+ import ObjectButton from './ObjectButton';
3
+ import PlusIcon from '../../../asset/images/daeryuntalk/plus.svg';
4
+ import MinusIcon from '../../../asset/images/daeryuntalk/minus.svg';
5
+ const FieldWorkObject = ({ object, message, isFirstObject, scrollEnd }) => {
6
+ var _a, _b;
7
+ const [isExpanded, setIsExpanded] = useState(false);
8
+ const objectList = (_b = (_a = object === null || object === void 0 ? void 0 : object.objectList) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a.sequence - b.sequence)) !== null && _b !== void 0 ? _b : [];
9
+ const MAX_VISIBLE = 10;
10
+ const hasMoreThanMax = objectList.length > MAX_VISIBLE;
11
+ const visibleList = isExpanded ? objectList : objectList.slice(0, MAX_VISIBLE);
12
+ useEffect(() => {
13
+ if (isExpanded) {
14
+ scrollEnd();
15
+ }
16
+ }, [isExpanded]);
17
+ return (<>
18
+ {visibleList.map((item, index) => {
19
+ var _a;
20
+ return (<ObjectButton key={`object-expose-${index}`} object={item} messageNumber={(object === null || object === void 0 ? void 0 : object.messageNumber) || ''} workFlowNumber={((_a = message === null || message === void 0 ? void 0 : message.workFlow) === null || _a === void 0 ? void 0 : _a.workFlowNumber) || ''} isFirstObject={isFirstObject} objectGroupUiCode={(object === null || object === void 0 ? void 0 : object.objectGroupUiCode) || ''}/>);
21
+ })}
22
+
23
+ {hasMoreThanMax && (<button type="button" onClick={() => {
24
+ setIsExpanded(prev => !prev);
25
+ }} className={`flex h-[36px] w-full items-center justify-center gap-[4px] rounded-[250px] bg-[#F7F7F7] py-[9px]`}>
26
+ {isExpanded ? <MinusIcon /> : <PlusIcon />}
27
+ <span className={`text-[14px] font-[700] leading-[100%] tracking-[-4%] text-[#777777] `}>
28
+ {isExpanded ? '접기' : '더보기'}
29
+ </span>
30
+ </button>)}
31
+ </>);
32
+ };
33
+ export default FieldWorkObject;
@@ -0,0 +1,65 @@
1
+ import { useEffect, useState } from 'react';
2
+ import ObjectButton from './ObjectButton';
3
+ import { MessageObject, MessageObjectExpose } from '../_types/message_object';
4
+ import { Message } from '../_types/message'; // 실제 경로에 맞게 수정하세요
5
+ import PlusIcon from '../../../asset/images/daeryuntalk/plus.svg';
6
+ import MinusIcon from '../../../asset/images/daeryuntalk/minus.svg';
7
+
8
+ const FieldWorkObject = ({
9
+ object,
10
+ message,
11
+ isFirstObject,
12
+ scrollEnd
13
+ }: {
14
+ object: MessageObject;
15
+ message: Message;
16
+ isFirstObject: boolean;
17
+ scrollEnd: () => void;
18
+ }) => {
19
+ const [isExpanded, setIsExpanded] = useState(false);
20
+
21
+ const objectList: MessageObjectExpose[] = object?.objectList?.sort((a, b) => a.sequence - b.sequence) ?? [];
22
+
23
+ const MAX_VISIBLE = 10;
24
+ const hasMoreThanMax = objectList.length > MAX_VISIBLE;
25
+
26
+ const visibleList = isExpanded ? objectList : objectList.slice(0, MAX_VISIBLE);
27
+
28
+ useEffect(() => {
29
+ if (isExpanded) {
30
+ scrollEnd();
31
+ }
32
+ }, [isExpanded]);
33
+
34
+ return (
35
+ <>
36
+ {visibleList.map((item, index) => (
37
+ <ObjectButton
38
+ key={`object-expose-${index}`}
39
+ object={item}
40
+ messageNumber={object?.messageNumber || ''}
41
+ workFlowNumber={message?.workFlow?.workFlowNumber || ''}
42
+ isFirstObject={isFirstObject}
43
+ objectGroupUiCode={object?.objectGroupUiCode || ''}
44
+ />
45
+ ))}
46
+
47
+ {hasMoreThanMax && (
48
+ <button
49
+ type="button"
50
+ onClick={() => {
51
+ setIsExpanded(prev => !prev);
52
+ }}
53
+ className={`flex h-[36px] w-full items-center justify-center gap-[4px] rounded-[250px] bg-[#F7F7F7] py-[9px]`}
54
+ >
55
+ {isExpanded ? <MinusIcon /> : <PlusIcon />}
56
+ <span className={`text-[14px] font-[700] leading-[100%] tracking-[-4%] text-[#777777] `}>
57
+ {isExpanded ? '접기' : '더보기'}
58
+ </span>
59
+ </button>
60
+ )}
61
+ </>
62
+ );
63
+ };
64
+
65
+ export default FieldWorkObject;
@@ -11,12 +11,17 @@ import React from 'react';
11
11
  import Image from 'next/image';
12
12
  import { ObjectNumber, WorkFlowButtonActionType, WorkFlowButtonUiCode } from '../_enums/work_flow_object_expose';
13
13
  import { useDaeryuntalk } from '../DaeryuntalkContext';
14
+ import { useWorkFlow } from '../_hooks/talkprovider/useWorkFlow';
14
15
  // 길이 fit 형
15
16
  // 길이 full 형
16
17
  // 업무 그룹형
18
+ // link_url
17
19
  const ObjectButton = ({ object, messageNumber, workFlowNumber, isFirstObject = false, objectGroupUiCode }) => {
18
- const { startWorkFlow, chatInquiryNumber, workFlowStack, workFlowBack } = useDaeryuntalk();
19
- // fit 용
20
+ const { startWorkFlow, chatInquiryNumber, workFlowStack, workFlowBack, tel } = useDaeryuntalk();
21
+ const { onClickKakao, onClickTel } = useWorkFlow({ tel: tel });
22
+ const openExternalLink = (url) => {
23
+ window.open(url, '_blank', 'noopener,noreferrer');
24
+ };
20
25
  const fitClassName = `
21
26
  flex w-fit flex-row items-center gap-[6px] rounded-[4px] border-[1px]
22
27
  border-solid border-[#EDEDED] bg-[#F7F7F780] px-[10px] py-[12.5px]
@@ -33,13 +38,13 @@ const ObjectButton = ({ object, messageNumber, workFlowNumber, isFirstObject = f
33
38
  text-[14px] font-[400] leading-[110%] tracking-[-4%]
34
39
  `;
35
40
  const handleButton = (object) => __awaiter(void 0, void 0, void 0, function* () {
36
- console.log('object', object);
37
41
  const actionType = (object === null || object === void 0 ? void 0 : object.actionCode) || '';
38
42
  // 내부링크
39
43
  if (actionType === WorkFlowButtonActionType.INTERNAL_LINK) {
40
44
  }
41
45
  // 외부링크
42
46
  else if (actionType === WorkFlowButtonActionType.EXTERNAL_LINK) {
47
+ openExternalLink(object.linkUrl);
43
48
  }
44
49
  // 입력
45
50
  else if (actionType === WorkFlowButtonActionType.INPUT) {
@@ -55,9 +60,11 @@ const ObjectButton = ({ object, messageNumber, workFlowNumber, isFirstObject = f
55
60
  }
56
61
  // 전화연결
57
62
  else if (actionType === WorkFlowButtonActionType.PHONE_CALL) {
63
+ onClickTel();
58
64
  }
59
65
  // 카카오연동
60
66
  else if (actionType === WorkFlowButtonActionType.KAKAO_CONNECT) {
67
+ onClickKakao();
61
68
  }
62
69
  });
63
70
  const renderButton = (className) => {
@@ -8,11 +8,14 @@ import {
8
8
  } from '../_enums/work_flow_object_expose';
9
9
  import { MessageObjectExpose } from '../_types/message_object';
10
10
  import { useDaeryuntalk } from '../DaeryuntalkContext';
11
+ import { useRouter } from 'next/router';
12
+ import { useWorkFlow } from '../_hooks/talkprovider/useWorkFlow';
11
13
 
12
14
  // 길이 fit 형
13
15
  // 길이 full 형
14
16
  // 업무 그룹형
15
17
 
18
+ // link_url
16
19
  const ObjectButton = ({
17
20
  object,
18
21
  messageNumber,
@@ -26,10 +29,12 @@ const ObjectButton = ({
26
29
  isFirstObject: boolean;
27
30
  objectGroupUiCode: string;
28
31
  }) => {
29
- const { startWorkFlow, chatInquiryNumber, workFlowStack, workFlowBack } = useDaeryuntalk();
30
-
31
- // fit 용
32
+ const { startWorkFlow, chatInquiryNumber, workFlowStack, workFlowBack, tel } = useDaeryuntalk();
33
+ const { onClickKakao, onClickTel } = useWorkFlow({ tel: tel });
32
34
 
35
+ const openExternalLink = (url: string) => {
36
+ window.open(url, '_blank', 'noopener,noreferrer');
37
+ };
33
38
  const fitClassName = `
34
39
  flex w-fit flex-row items-center gap-[6px] rounded-[4px] border-[1px]
35
40
  border-solid border-[#EDEDED] bg-[#F7F7F780] px-[10px] py-[12.5px]
@@ -49,13 +54,14 @@ const ObjectButton = ({
49
54
  `;
50
55
 
51
56
  const handleButton = async (object: MessageObjectExpose) => {
52
- console.log('object', object);
53
57
  const actionType = object?.actionCode || '';
58
+
54
59
  // 내부링크
55
60
  if (actionType === WorkFlowButtonActionType.INTERNAL_LINK) {
56
61
  }
57
62
  // 외부링크
58
63
  else if (actionType === WorkFlowButtonActionType.EXTERNAL_LINK) {
64
+ openExternalLink(object.linkUrl);
59
65
  }
60
66
  // 입력
61
67
  else if (actionType === WorkFlowButtonActionType.INPUT) {
@@ -71,9 +77,11 @@ const ObjectButton = ({
71
77
  }
72
78
  // 전화연결
73
79
  else if (actionType === WorkFlowButtonActionType.PHONE_CALL) {
80
+ onClickTel();
74
81
  }
75
82
  // 카카오연동
76
83
  else if (actionType === WorkFlowButtonActionType.KAKAO_CONNECT) {
84
+ onClickKakao();
77
85
  }
78
86
  };
79
87
 
@@ -49,10 +49,12 @@ type DaeryuntalkContextType = {
49
49
  imageViewerMessage?: Message | null;
50
50
  openImageViewer?: (file: FileInfo, message: Message) => void;
51
51
  closeImageViewer?: () => void;
52
+ tel: string;
52
53
  };
53
54
  declare const DaeryuntalkContext: React.Context<DaeryuntalkContextType>;
54
55
  type DaeryuntalkProviderProps = {
55
56
  children: ReactNode;
57
+ propsTel: string;
56
58
  };
57
59
  export declare const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps>;
58
60
  export declare const useDaeryuntalk: () => DaeryuntalkContextType;
@@ -41,11 +41,13 @@ const DaeryuntalkContext = createContext({
41
41
  isSocketInitialized: false,
42
42
  isSocketConnected: false,
43
43
  error: null,
44
- closeDaeryuntalk: () => { }
44
+ closeDaeryuntalk: () => { },
45
+ tel: ''
45
46
  // 이미지 뷰어용
46
47
  });
47
- export const DaeryuntalkProvider = ({ children }) => {
48
+ export const DaeryuntalkProvider = ({ children, propsTel }) => {
48
49
  const [inquiryStatus, setInquiryStatus] = useState('');
50
+ const [tel, setTel] = useState(propsTel);
49
51
  // 채팅 진행중에 필요한 state들
50
52
  const [messages, setMessages] = useState([]);
51
53
  const [messageObject, setMessageObject] = useState(null);
@@ -110,7 +112,8 @@ export const DaeryuntalkProvider = ({ children }) => {
110
112
  selectedImageFile,
111
113
  imageViewerMessage,
112
114
  openImageViewer,
113
- closeImageViewer
115
+ closeImageViewer,
116
+ tel: tel
114
117
  }}>
115
118
  {children}
116
119
  </DaeryuntalkContext.Provider>);
@@ -53,6 +53,7 @@ type DaeryuntalkContextType = {
53
53
  imageViewerMessage?: Message | null;
54
54
  openImageViewer?: (file: FileInfo, message: Message) => void;
55
55
  closeImageViewer?: () => void;
56
+ tel: string;
56
57
  };
57
58
 
58
59
  // 기본값으로 컨텍스트 생성
@@ -85,7 +86,8 @@ const DaeryuntalkContext = createContext<DaeryuntalkContextType>({
85
86
  isSocketInitialized: false,
86
87
  isSocketConnected: false,
87
88
  error: null,
88
- closeDaeryuntalk: () => {}
89
+ closeDaeryuntalk: () => {},
90
+ tel: ''
89
91
 
90
92
  // 이미지 뷰어용
91
93
  });
@@ -93,10 +95,12 @@ const DaeryuntalkContext = createContext<DaeryuntalkContextType>({
93
95
  // 프로바이더 컴포넌트 생성
94
96
  type DaeryuntalkProviderProps = {
95
97
  children: ReactNode;
98
+ propsTel: string;
96
99
  };
97
100
 
98
- export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ children }) => {
101
+ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ children, propsTel }) => {
99
102
  const [inquiryStatus, setInquiryStatus] = useState<string>('');
103
+ const [tel, setTel] = useState(propsTel);
100
104
 
101
105
  // 채팅 진행중에 필요한 state들
102
106
  const [messages, setMessages] = useState<Message[]>([]);
@@ -183,7 +187,8 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
183
187
  selectedImageFile,
184
188
  imageViewerMessage,
185
189
  openImageViewer,
186
- closeImageViewer
190
+ closeImageViewer,
191
+ tel: tel
187
192
  }}
188
193
  >
189
194
  {children}
@@ -1,27 +1,30 @@
1
1
  import { useEditor, EditorContent } from '@tiptap/react';
2
- import StarterKit from '@tiptap/starter-kit';
3
2
  import Placeholder from '@tiptap/extension-placeholder';
4
3
  import { useImperativeHandle, forwardRef } from 'react';
4
+ import Document from '@tiptap/extension-document';
5
+ import Paragraph from '@tiptap/extension-paragraph';
6
+ import Text from '@tiptap/extension-text';
5
7
  const Tiptap = forwardRef(({ onChange, placeholder = '메시지를 입력하세요...', onEnterKeyPress, onKeyDown }, ref) => {
6
8
  const editor = useEditor({
7
- extensions: [
8
- StarterKit.configure({
9
- heading: false,
10
- blockquote: false,
11
- codeBlock: false,
12
- horizontalRule: false
13
- }),
14
- Placeholder.configure({ placeholder })
15
- ],
9
+ extensions: [Document, Paragraph, Text, Placeholder.configure({ placeholder })],
16
10
  content: '',
17
11
  enableInputRules: false,
18
12
  enablePasteRules: false,
19
13
  onUpdate: ({ editor }) => {
20
- onChange === null || onChange === void 0 ? void 0 : onChange(editor.getHTML(), editor.getJSON());
14
+ const text = editor.getText().trim();
15
+ const html = editor.getHTML();
16
+ const json = editor.getJSON();
17
+ if (!text) {
18
+ // 비어있는 경우엔 빈 문자열 반환
19
+ onChange === null || onChange === void 0 ? void 0 : onChange('', json);
20
+ }
21
+ else {
22
+ onChange === null || onChange === void 0 ? void 0 : onChange(html, json);
23
+ }
21
24
  },
22
25
  editorProps: {
23
26
  attributes: {
24
- class: 'focus:outline-none min-h-[44px] max-h-[72px] overflow-y-auto resize-none px-[10px] py-[4px]'
27
+ class: 'focus:outline-none min-h-[44px] max-h-[72px] overflow-y-auto resize-none px-[10px] py-[4px] flex items-center'
25
28
  },
26
29
  handleKeyDown: (view, event) => {
27
30
  if (event.key === 'Enter' && !event.shiftKey) {
@@ -3,6 +3,9 @@ import StarterKit from '@tiptap/starter-kit';
3
3
  import Placeholder from '@tiptap/extension-placeholder';
4
4
  import { useImperativeHandle, forwardRef } from 'react';
5
5
  import { JSONContent } from '@tiptap/core'; // 추가 필요
6
+ import Document from '@tiptap/extension-document';
7
+ import Paragraph from '@tiptap/extension-paragraph';
8
+ import Text from '@tiptap/extension-text';
6
9
 
7
10
  export interface TiptapEditorRef {
8
11
  clearContent: () => void;
@@ -23,24 +26,25 @@ interface TiptapProps {
23
26
  const Tiptap = forwardRef<TiptapEditorRef, TiptapProps>(
24
27
  ({ onChange, placeholder = '메시지를 입력하세요...', onEnterKeyPress, onKeyDown }, ref) => {
25
28
  const editor = useEditor({
26
- extensions: [
27
- StarterKit.configure({
28
- heading: false,
29
- blockquote: false,
30
- codeBlock: false,
31
- horizontalRule: false
32
- }),
33
- Placeholder.configure({ placeholder })
34
- ],
29
+ extensions: [Document, Paragraph, Text, Placeholder.configure({ placeholder })],
35
30
  content: '',
36
31
  enableInputRules: false,
37
32
  enablePasteRules: false,
38
33
  onUpdate: ({ editor }) => {
39
- onChange?.(editor.getHTML(), editor.getJSON());
34
+ const text = editor.getText().trim();
35
+ const html = editor.getHTML();
36
+ const json = editor.getJSON();
37
+
38
+ if (!text) {
39
+ // 비어있는 경우엔 빈 문자열 반환
40
+ onChange?.('', json);
41
+ } else {
42
+ onChange?.(html, json);
43
+ }
40
44
  },
41
45
  editorProps: {
42
46
  attributes: {
43
- class: 'focus:outline-none min-h-[44px] max-h-[72px] overflow-y-auto resize-none px-[10px] py-[4px]'
47
+ class: 'focus:outline-none min-h-[44px] max-h-[72px] overflow-y-auto resize-none px-[10px] py-[4px] flex items-center'
44
48
  },
45
49
  handleKeyDown: (view, event) => {
46
50
  if (event.key === 'Enter' && !event.shiftKey) {
@@ -340,7 +340,7 @@ export function getChatInquiryMessageList(chatInquiryNumber, standardDateTime, s
340
340
  const body = {
341
341
  d: Object.assign(Object.assign({ chat_inquiry_number: chatInquiryNumber }, (standardDateTime && { standard_date_time: standardDateTime })), {
342
342
  // standard_date_time: standard_date_time ?? new Date().toISOString(),
343
- size: size !== null && size !== void 0 ? size : 10 })
343
+ size: size !== null && size !== void 0 ? size : 100 })
344
344
  };
345
345
  console.log('[채팅 메세지 리스트] 문의 번호:', chatInquiryNumber, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
346
346
  try {
@@ -429,7 +429,7 @@ export async function getChatInquiryMessageList(
429
429
  chat_inquiry_number: chatInquiryNumber,
430
430
  ...(standardDateTime && { standard_date_time: standardDateTime }),
431
431
  // standard_date_time: standard_date_time ?? new Date().toISOString(),
432
- size: size ?? 10
432
+ size: size ?? 100
433
433
  }
434
434
  };
435
435
 
@@ -92,6 +92,7 @@ export interface ObjectList {
92
92
  sequence: number;
93
93
  action_code: string;
94
94
  object_ui_code: string;
95
+ link_url: string;
95
96
  }
96
97
  export interface ObjectExposeInfo {
97
98
  expose_object_list_yn: boolean;
@@ -105,6 +105,7 @@ export interface ObjectList {
105
105
  sequence: number;
106
106
  action_code: string;
107
107
  object_ui_code: string;
108
+ link_url: string;
108
109
  }
109
110
 
110
111
  // 오브젝트 정보
@@ -145,6 +145,9 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
145
145
  }
146
146
  // 메세지 회수됨 -> 이거는 관리자에서는 필요없는듯?
147
147
  if (data.type === MessageSocketType.MESSAGE_COLLECTED) {
148
+ // 여기서는
149
+ const payload = data.payload;
150
+ setMessages(prev => prev.filter(fil => fil.messageNumber !== payload.message_number));
148
151
  }
149
152
  // 안읽음 count
150
153
  if (data.type === MessageSocketType.INQUIRY_PREVIEW_UPDATED) {
@@ -175,6 +175,12 @@ export const useSocketEventHandler = ({
175
175
  }
176
176
  // 메세지 회수됨 -> 이거는 관리자에서는 필요없는듯?
177
177
  if (data.type === MessageSocketType.MESSAGE_COLLECTED) {
178
+ // 여기서는
179
+ const payload: {
180
+ chat_inquiry_number: string;
181
+ message_number: string;
182
+ } = data.payload;
183
+ setMessages(prev => prev.filter(fil => fil.messageNumber !== payload.message_number));
178
184
  }
179
185
  // 안읽음 count
180
186
  if (data.type === MessageSocketType.INQUIRY_PREVIEW_UPDATED) {
@@ -0,0 +1,9 @@
1
+ export declare const useWorkFlow: (props: {
2
+ tel: string;
3
+ aceUrl?: string;
4
+ wideBottom?: boolean;
5
+ centerConsultUrl?: string;
6
+ }) => {
7
+ onClickKakao: () => void;
8
+ onClickTel: () => void;
9
+ };