@daeryun/dr_components 0.8.47 → 0.8.48

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 (120) hide show
  1. package/dist/asset/images/daeryuntalk/close.svg +2 -2
  2. package/dist/asset/images/daeryuntalk/time.svg +2 -2
  3. package/dist/asset/images/daeryuntalk/viewer/zoom-out.svg +2 -4
  4. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  5. package/dist/components/Daeryuntalk/ChatButton.jsx +5 -2
  6. package/dist/components/Daeryuntalk/ChatButton.tsx +5 -2
  7. package/dist/components/Daeryuntalk/ChatConversation.d.ts +2 -0
  8. package/dist/components/Daeryuntalk/ChatConversation.jsx +22 -63
  9. package/dist/components/Daeryuntalk/ChatConversation.tsx +42 -79
  10. package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.d.ts +11 -0
  11. package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.jsx +27 -0
  12. package/dist/components/Daeryuntalk/ChatConversationItem/ChatConversationHeader.tsx +57 -0
  13. package/dist/components/Daeryuntalk/ChatHomeView.d.ts +3 -2
  14. package/dist/components/Daeryuntalk/ChatHomeView.jsx +59 -181
  15. package/dist/components/Daeryuntalk/ChatHomeView.tsx +102 -206
  16. package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +15 -14
  17. package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +15 -14
  18. package/dist/components/Daeryuntalk/ChatItem/ChatLoading.d.ts +3 -0
  19. package/dist/components/Daeryuntalk/ChatItem/ChatLoading.jsx +11 -0
  20. package/dist/components/Daeryuntalk/ChatItem/ChatLoading.tsx +21 -0
  21. package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.jsx +4 -4
  22. package/dist/components/Daeryuntalk/ChatItem/ChatWrapper.tsx +4 -4
  23. package/dist/components/Daeryuntalk/ChatItem/RichText.jsx +2 -1
  24. package/dist/components/Daeryuntalk/ChatItem/RichText.tsx +2 -1
  25. package/dist/components/Daeryuntalk/ChatItem/TimeWrapper.d.ts +9 -0
  26. package/dist/components/Daeryuntalk/ChatItem/TimeWrapper.jsx +9 -0
  27. package/dist/components/Daeryuntalk/ChatItem/TimeWrapper.tsx +20 -0
  28. package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.jsx +3 -3
  29. package/dist/components/Daeryuntalk/ChatItem/WorkFlowClickData.tsx +3 -3
  30. package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +2 -2
  31. package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +2 -2
  32. package/dist/components/Daeryuntalk/ChatMessage.d.ts +1 -0
  33. package/dist/components/Daeryuntalk/ChatMessage.jsx +31 -36
  34. package/dist/components/Daeryuntalk/ChatMessage.tsx +34 -38
  35. package/dist/components/Daeryuntalk/ChatObject/FieldWorkObject.jsx +2 -2
  36. package/dist/components/Daeryuntalk/ChatObject/FieldWorkObject.tsx +2 -2
  37. package/dist/components/Daeryuntalk/ChatObject/ObjectBack.jsx +1 -1
  38. package/dist/components/Daeryuntalk/ChatObject/ObjectBack.tsx +1 -1
  39. package/dist/components/Daeryuntalk/ChatObject/ObjectButton.jsx +6 -23
  40. package/dist/components/Daeryuntalk/ChatObject/ObjectButton.tsx +6 -23
  41. package/dist/components/Daeryuntalk/ChatWidget.jsx +60 -23
  42. package/dist/components/Daeryuntalk/ChatWidget.tsx +72 -34
  43. package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +2 -2
  44. package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +2 -2
  45. package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +5 -5
  46. package/dist/components/Daeryuntalk/DateSeparator.jsx +2 -2
  47. package/dist/components/Daeryuntalk/DateSeparator.tsx +2 -2
  48. package/dist/components/Daeryuntalk/FixedErrorBox.d.ts +7 -0
  49. package/dist/components/Daeryuntalk/FixedErrorBox.jsx +33 -0
  50. package/dist/components/Daeryuntalk/FixedErrorBox.tsx +73 -0
  51. package/dist/components/Daeryuntalk/History/AuthForm.d.ts +3 -1
  52. package/dist/components/Daeryuntalk/History/AuthForm.jsx +15 -45
  53. package/dist/components/Daeryuntalk/History/AuthForm.tsx +21 -53
  54. package/dist/components/Daeryuntalk/HistoryView.d.ts +4 -0
  55. package/dist/components/Daeryuntalk/HistoryView.jsx +17 -40
  56. package/dist/components/Daeryuntalk/HistoryView.tsx +36 -48
  57. package/dist/components/Daeryuntalk/HomeView.d.ts +12 -0
  58. package/dist/components/Daeryuntalk/HomeView.jsx +102 -0
  59. package/dist/components/Daeryuntalk/HomeView.tsx +150 -0
  60. package/dist/components/Daeryuntalk/NavigationFooter.jsx +17 -10
  61. package/dist/components/Daeryuntalk/NavigationFooter.tsx +22 -12
  62. package/dist/components/Daeryuntalk/NoticeMessage.jsx +7 -7
  63. package/dist/components/Daeryuntalk/NoticeMessage.tsx +7 -7
  64. package/dist/components/Daeryuntalk/Toast/ToastRender.jsx +1 -1
  65. package/dist/components/Daeryuntalk/Toast/ToastRender.tsx +2 -2
  66. package/dist/components/Daeryuntalk/Viewer/ImageViewer.d.ts +6 -0
  67. package/dist/components/Daeryuntalk/Viewer/ImageViewer.jsx +18 -90
  68. package/dist/components/Daeryuntalk/Viewer/ImageViewer.tsx +49 -135
  69. package/dist/components/Daeryuntalk/Viewer/MobileViewer.d.ts +16 -0
  70. package/dist/components/Daeryuntalk/Viewer/MobileViewer.jsx +66 -0
  71. package/dist/components/Daeryuntalk/Viewer/MobileViewer.tsx +121 -0
  72. package/dist/components/Daeryuntalk/Viewer/TbPcViewer.d.ts +22 -0
  73. package/dist/components/Daeryuntalk/Viewer/TbPcViewer.jsx +104 -0
  74. package/dist/components/Daeryuntalk/Viewer/TbPcViewer.tsx +195 -0
  75. package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +4 -3
  76. package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +81 -105
  77. package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +105 -121
  78. package/dist/components/Daeryuntalk/_enums/ask-status.d.ts +7 -0
  79. package/dist/components/Daeryuntalk/_enums/ask-status.js +14 -0
  80. package/dist/components/Daeryuntalk/_enums/ask-status.ts +14 -0
  81. package/dist/components/Daeryuntalk/_enums/error.d.ts +3 -0
  82. package/dist/components/Daeryuntalk/_enums/error.js +125 -0
  83. package/dist/components/Daeryuntalk/_enums/error.ts +143 -0
  84. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.d.ts +8 -8
  85. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.js +227 -179
  86. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatHandler.ts +261 -185
  87. package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.d.ts +1 -1
  88. package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.js +54 -18
  89. package/dist/components/Daeryuntalk/_hooks/talkprovider/useHistoryHandler.ts +68 -15
  90. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +2 -2
  91. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +8 -7
  92. package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +13 -6
  93. package/dist/components/Daeryuntalk/_hooks/view/useChatSocketState.d.ts +2 -0
  94. package/dist/components/Daeryuntalk/_hooks/{talkprovider → view}/useChatSocketState.js +7 -1
  95. package/dist/components/Daeryuntalk/_hooks/{talkprovider → view}/useChatSocketState.ts +13 -1
  96. package/dist/components/Daeryuntalk/_hooks/view/useHistoryView.d.ts +26 -0
  97. package/dist/components/Daeryuntalk/_hooks/view/useHistoryView.js +72 -0
  98. package/dist/components/Daeryuntalk/_hooks/view/useHistoryView.ts +93 -0
  99. package/dist/components/Daeryuntalk/_hooks/view/useHomeView.d.ts +16 -0
  100. package/dist/components/Daeryuntalk/_hooks/view/useHomeView.js +61 -0
  101. package/dist/components/Daeryuntalk/_hooks/view/useHomeView.ts +64 -0
  102. package/dist/components/Daeryuntalk/_lib/utils.d.ts +1 -0
  103. package/dist/components/Daeryuntalk/_lib/utils.js +27 -0
  104. package/dist/components/Daeryuntalk/_lib/utils.ts +33 -0
  105. package/dist/components/Daeryuntalk/_ui/buttons/Button2.jsx +3 -3
  106. package/dist/components/Daeryuntalk/_ui/buttons/Button2.tsx +3 -3
  107. package/dist/components/Daeryuntalk/_ui/buttons/Button3.d.ts +10 -0
  108. package/dist/components/Daeryuntalk/_ui/buttons/Button3.jsx +12 -0
  109. package/dist/components/Daeryuntalk/_ui/buttons/Button3.tsx +29 -0
  110. package/dist/components/Daeryuntalk/_ui/inputs/Input2.jsx +2 -1
  111. package/dist/components/Daeryuntalk/_ui/inputs/Input2.tsx +2 -1
  112. package/dist/components/Daeryuntalk/index.jsx +1 -1
  113. package/dist/components/Daeryuntalk/index.tsx +12 -1
  114. package/dist/styles/globals.css +510 -168
  115. package/dist/tsconfig.tsbuildinfo +1 -1
  116. package/package.json +1 -1
  117. package/dist/components/Daeryuntalk/_enums/error_code.d.ts +0 -21
  118. package/dist/components/Daeryuntalk/_enums/error_code.js +0 -23
  119. package/dist/components/Daeryuntalk/_enums/error_code.ts +0 -22
  120. package/dist/components/Daeryuntalk/_hooks/talkprovider/useChatSocketState.d.ts +0 -1
@@ -2,14 +2,15 @@ import React, { useState } from 'react';
2
2
  import Input2 from '../_ui/inputs/Input2';
3
3
  import { formatSecondsToMMSS, nameFilter, onlyNumbers, phoneCheck } from '../_lib/utils';
4
4
  import Button2 from '../_ui/buttons/Button2';
5
- import { historyPhoneAuth, requestPhone } from '../_api';
6
- import { AuthErrorCode } from '../_enums/error_code';
7
5
  import { useDaeryunTalkToast } from '../Toast/DaeryuntalkToastProvider';
6
+ import Button3 from '../_ui/buttons/Button3';
8
7
 
9
8
  interface IProps {
10
9
  goGetHistoryList: (data: { version?: string }) => void;
10
+ handleGoRequestPhone: (name: string, cellPhoneNumber: string) => any;
11
+ handleGoHistoryPhoneAuth: (name: string, cellPhoneNumber: string, certificationNumber: string) => any;
11
12
  }
12
- const AuthForm = ({ goGetHistoryList }: IProps) => {
13
+ const AuthForm = ({ goGetHistoryList, handleGoRequestPhone, handleGoHistoryPhoneAuth }: IProps) => {
13
14
  const [name, setName] = useState<{ value: string; isValid: boolean }>({ value: '', isValid: false });
14
15
  const [phone, setPhone] = useState<{ value: string; isValid: boolean }>({ value: '', isValid: false });
15
16
  const [authNumber, setAuthNumber] = useState<string>('');
@@ -17,7 +18,6 @@ const AuthForm = ({ goGetHistoryList }: IProps) => {
17
18
  const [timer, setTimer] = useState<number>(180); // 3분(180초)
18
19
  const [timerId, setTimerId] = useState<NodeJS.Timeout | null>(null);
19
20
  const [isLoading, setIsLoading] = useState(false);
20
-
21
21
  const toast = useDaeryunTalkToast();
22
22
  const resetTimerAndState = () => {
23
23
  if (timerId) clearInterval(timerId);
@@ -58,7 +58,7 @@ const AuthForm = ({ goGetHistoryList }: IProps) => {
58
58
  const handleSendAuth = async () => {
59
59
  try {
60
60
  setIsLoading(true);
61
- const res = await requestPhone({ name: name.value, cellPhoneNumber: phone.value });
61
+ const res = await handleGoRequestPhone(name.value, phone.value);
62
62
  if (res.result_info.result_type_cd === 'OK' || res.result_info.result_cd === 'OK') {
63
63
  setIsConfirmState(true);
64
64
  setAuthNumber('');
@@ -78,12 +78,6 @@ const AuthForm = ({ goGetHistoryList }: IProps) => {
78
78
  }, 1000);
79
79
 
80
80
  setTimerId(id);
81
- } else {
82
- if (res.result_info.result_cd === AuthErrorCode.OWNERSHIP_DUPLICATE_REQUEST_ERROR) {
83
- toast.warning('중복된 요청입니다.');
84
- } else {
85
- toast.warning('다시 요청해주세요.');
86
- }
87
81
  }
88
82
  } catch (err) {
89
83
  console.error('인증번호 발송 실패', err);
@@ -102,26 +96,11 @@ const AuthForm = ({ goGetHistoryList }: IProps) => {
102
96
 
103
97
  try {
104
98
  setIsLoading(true);
105
- const res = await historyPhoneAuth({
106
- name: name.value,
107
- cellPhoneNumber: phone.value,
108
- certificationNumber: authNumber
109
- });
99
+ const res = await handleGoHistoryPhoneAuth(name.value, phone.value, authNumber);
110
100
 
111
101
  if (res.result_info.result_type_cd === 'OK' || res.result_info.result_cd === 'OK') {
112
102
  await goGetHistoryList({});
113
103
  toast.success('인증이 완료되었습니다.');
114
- } else {
115
- switch (res.result_info.result_cd) {
116
- case AuthErrorCode.OWNERSHIP_CODE_MISMATCH:
117
- toast.warning('잘못된 인증번호입니다.');
118
- break;
119
- case AuthErrorCode.OWNERSHIP_EXPIRED:
120
- toast.warning('인증번호가 만료되었습니다.');
121
- break;
122
- default:
123
- toast.warning('인증에 실패했습니다. 다시 시도해주세요.');
124
- }
125
104
  }
126
105
  } catch (e) {
127
106
  console.error('인증 처리 중 오류 발생:', e);
@@ -134,16 +113,16 @@ const AuthForm = ({ goGetHistoryList }: IProps) => {
134
113
  return (
135
114
  <div
136
115
  className={`
137
- mt-[24px] p-4
116
+ mt-[40px] p-4
138
117
  `}
139
118
  >
140
- <div className={`p-[20px]`}>
141
- <div className={`text-[16px] font-[700] leading-[140%] tracking-[-4%]`}>
119
+ <div className={`px-[20px]`}>
120
+ <div className={` dr_talk_title_small `}>
142
121
  문의 히스토리 확인을 위해 이전에 문의하실 때 입력하신 정보를 입력해 주세요.
143
122
  </div>
144
123
  <div className={`flex flex-col`}>
145
124
  <div className={`mt-[40px] flex flex-col gap-[8px]`}>
146
- <div className={`text-[14px] font-[700] leading-[100%] tracking-[-4%]`}>이름</div>
125
+ <div className={`dr_talk_subtitle_medium`}>이름</div>
147
126
  <Input2
148
127
  onChange={handleInput}
149
128
  value={name.value}
@@ -154,7 +133,7 @@ const AuthForm = ({ goGetHistoryList }: IProps) => {
154
133
  />
155
134
  </div>
156
135
  <div className={`mt-[20px] flex flex-col gap-[8px]`}>
157
- <div className={`text-[14px] font-[700] leading-[100%] tracking-[-4%]`}>휴대폰 번호</div>
136
+ <div className={`dr_talk_subtitle_medium`}>휴대폰 번호</div>
158
137
  <div className={`flex flex-row gap-[4px]`}>
159
138
  <Input2
160
139
  onChange={handleInput}
@@ -179,9 +158,7 @@ const AuthForm = ({ goGetHistoryList }: IProps) => {
179
158
  </div>
180
159
  </div>
181
160
  {isConfirmState && (
182
- <div
183
- className={`mt-[4px] text-[12px] leading-[140%] tracking-[-4%] text-[#000] text-[#000]/80`}
184
- >
161
+ <div className={`dr_talk_body_small1 mt-[4px] text-drTalkGrayscale1`}>
185
162
  인증번호가 발송되었습니다.
186
163
  </div>
187
164
  )}
@@ -197,35 +174,26 @@ const AuthForm = ({ goGetHistoryList }: IProps) => {
197
174
  maxLength={6}
198
175
  placeholder={'인증 번호 입력'}
199
176
  />
200
- <div
201
- className={`absolute right-[8px] top-[15px] text-[12px] font-[400] leading-[100%] tracking-[-4%] text-[#AA1D36] `}
202
- >
177
+ <div className={`dr_talk_body_small2 absolute right-[8px] top-[15px] text-drTalkCrimson `}>
203
178
  {formatSecondsToMMSS(timer)}
204
179
  </div>
205
180
  </div>
206
181
  )}
207
182
 
208
183
  {isConfirmState && (
209
- <div
210
- className={`mt-[20px] text-[12px] leading-[140%] tracking-[-4%] text-[#000] text-[#000]/80`}
211
- >
184
+ <div className={`dr_talk_body_small1 mt-[20px] text-drTalkGrayscale1`}>
212
185
  인증번호가 오지 않는 경우 휴대폰 번호 차단 여부를 확인해주세요.(대륜 고객센터 1800-7905)
213
186
  </div>
214
187
  )}
215
188
 
216
189
  {isConfirmState && (
217
- <div className="mt-[40px]">
218
- <button
219
- disabled={isLoading || authNumber.length < 5}
220
- className={`
221
- flex w-full items-center justify-center gap-2.5 rounded-[25px] bg-[#2E385B]
222
- px-6 py-3 text-white disabled:bg-[#D2D2D2]
223
- `}
224
- onClick={handleSubmit}
225
- >
226
- 인증번호 확인
227
- </button>
228
- </div>
190
+ <Button3
191
+ onClick={handleSubmit}
192
+ isDisabled={isLoading || authNumber.length < 5}
193
+ className={`mt-[40px]`}
194
+ >
195
+ 인증번호 확인
196
+ </Button3>
229
197
  )}
230
198
  </div>
231
199
  </div>
@@ -10,6 +10,10 @@ type HistoryViewProps = {
10
10
  version?: string;
11
11
  }) => void;
12
12
  isMobile: boolean;
13
+ onClose: () => void;
14
+ isHash: boolean;
15
+ handleGoRequestPhone: (name: string, cellPhoneNumber: string) => any;
16
+ handleGoHistoryPhoneAuth: (name: string, cellPhoneNumber: string, certificationNumber: string) => any;
13
17
  };
14
18
  declare const HistoryView: React.FC<HistoryViewProps>;
15
19
  export default HistoryView;
@@ -6,72 +6,49 @@ import PrevIcon from '../../asset/images/daeryuntalk/prev.svg';
6
6
  import AuthForm from './History/AuthForm';
7
7
  import { useScrollShadow } from './_hooks/useScrollShadow';
8
8
  import ShadowBox from './_ui/ShadowBox';
9
- const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthenticated, historyLit, goGetHistoryList, isMobile }) => {
9
+ import CloseSvgIcon from '../../asset/images/daeryuntalk/close.svg';
10
+ import { formatTimestamp } from './_lib/utils';
11
+ const HistoryView = ({ onBackClick, onChatHistoryClick, onNewChatClick, isAuthenticated, historyLit, goGetHistoryList, isMobile, onClose, isHash, handleGoRequestPhone, handleGoHistoryPhoneAuth }) => {
10
12
  const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
11
13
  useEffect(() => {
12
14
  checkScroll();
13
15
  }, [historyLit]);
14
- const formatTimestamp = (timestamp) => {
15
- if (!timestamp)
16
- return '';
17
- // UTC string을 Date 객체로 변환
18
- const date = new Date(timestamp);
19
- const now = new Date();
20
- // 시간 차이(초)
21
- const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);
22
- if (diffInSeconds < 5) {
23
- return '방금';
24
- }
25
- if (diffInSeconds < 60 * 60 * 24) {
26
- // 오늘 내 메시지: 시:분
27
- const hours = date.getHours().toString().padStart(2, '0');
28
- const minutes = date.getMinutes().toString().padStart(2, '0');
29
- return `${hours}:${minutes}`;
30
- }
31
- if (diffInSeconds < 60 * 60 * 24 * 7) {
32
- // 일주일 내: N일전
33
- const days = Math.floor(diffInSeconds / (60 * 60 * 24));
34
- return `${days}일전`;
35
- }
36
- // 그 외: 월일
37
- const month = date.getMonth() + 1;
38
- const day = date.getDate();
39
- return `${month}월${day}일`;
40
- };
41
16
  const hasHistories = historyLit.length > 0;
42
- return (<div className="flex h-full flex-col">
17
+ return (<div className={`flex h-full flex-col`}>
43
18
  {/* 헤더 */}
44
- <div className="flex items-center justify-between border-b border-gray-200 p-4">
19
+ <div className={`flex h-[56px] items-center justify-between border-b border-gray-200 p-[16px]`}>
45
20
  <button className="flex h-7 w-7 items-center justify-center" aria-label="이전" onClick={onBackClick}>
46
21
  <PrevIcon width={28} height={28}/>
47
22
  </button>
48
23
  <div className="flex items-center">
49
- <h2 className="font-bold leading-[140%] tracking-[-4%]">히스토리</h2>
24
+ <h2 className=" dr_talk_title_small ">히스토리</h2>
25
+ </div>
26
+ <div className={`${isHash ? 'pointer-events-none !opacity-0' : ''} ${isMobile ? 'block' : ' xs:pointer-events-none xs:!opacity-0 '} py-[14px] text-drTalkGrayscale2 hover:cursor-pointer`} onClick={onClose}>
27
+ <CloseSvgIcon width={28} height={28}/>
50
28
  </div>
51
- <div className="w-7"></div>
52
29
  </div>
53
30
 
54
- {!isAuthenticated ? (<AuthForm goGetHistoryList={goGetHistoryList}/>) : (<>
31
+ {!isAuthenticated ? (<AuthForm goGetHistoryList={goGetHistoryList} handleGoRequestPhone={handleGoRequestPhone} handleGoHistoryPhoneAuth={handleGoHistoryPhoneAuth}/>) : (<>
55
32
  {/* 스크롤 가능한 컨텐츠 영역 */}
56
33
  <div className="relative flex-1 overflow-hidden">
57
34
  <div ref={containerRef} className="no-scrollbar h-full overflow-y-auto px-[20px] pb-[20px] pt-[24px]">
58
- {hasHistories ? (historyLit.map(history => (<div key={history.chat_inquiry_number} className="cursor-pointer border-b border-gray-100 px-[12px] py-[18px] hover:bg-gray-50" onClick={() => onChatHistoryClick(history.chat_inquiry_number)}>
35
+ {hasHistories ? (historyLit === null || historyLit === void 0 ? void 0 : historyLit.map((history, index) => (<div key={`${history.chat_inquiry_number}-${index}`} className="cursor-pointer border-b border-drTalkGrayscale4 px-[12px] py-[18px] hover:bg-gray-50" onClick={() => onChatHistoryClick(history.chat_inquiry_number)}>
59
36
  <div className="flex items-center justify-between">
60
37
  <div className={`flex flex-row items-center gap-[10px]`}>
61
- <span className="font-medium">{history.customer_name}</span>
62
- {history.unread_message_count && history.unread_message_count > 0 ? (<span className="flex h-[18px] w-[18px] items-center justify-center rounded-full bg-[#AA1D36] px-[5.5px] py-[3px] text-[12px] font-medium leading-[100%] tracking-[-4%] text-white">
38
+ <span className="dr_talk_subtitle_medium">{history.customer_name}</span>
39
+ {history.unread_message_count && history.unread_message_count > 0 ? (<span className={`${history.unread_message_count > 99 ? ' h-[18px] w-[31px] rounded-[15.5px] ' : ' h-[18px] w-[18px] rounded-full '} dr_talk_subtitle_small2 flex items-center justify-center bg-drTalkCrimson text-drTalkWhite`}>
63
40
  {history.unread_message_count}
64
41
  </span>) : null}
65
42
  </div>
66
- <span className="text-xs text-gray-500">
43
+ <span className=" dr_talk_body_small1 text-drTalkGrayscale2 ">
67
44
  {formatTimestamp(history.recent_message_date_time)}
68
45
  </span>
69
46
  </div>
70
- <div className="mt-1 flex items-center justify-between">
71
- <p className="line-clamp-2 w-[85%] text-sm text-gray-700">
47
+ <div className=" mt-[10px] flex items-center justify-between">
48
+ <p className="dr_talk_body_medium2 line-clamp-2 w-[calc(100%-24px)] text-drTalkGrayscale2 ">
72
49
  {history.recent_message_content}
73
50
  </p>
74
- <LinkRight width={24} height={24} className="flex-shrink-0"/>
51
+ <LinkRight width={18} height={18} className="flex-shrink-0"/>
75
52
  </div>
76
53
  </div>))) : (<div className="flex h-full flex-col items-center justify-center p-4">
77
54
  <div className="mb-4">
@@ -7,6 +7,8 @@ import AuthForm from './History/AuthForm';
7
7
  import { History } from './_api/daeryuntalk/type/response';
8
8
  import { useScrollShadow } from './_hooks/useScrollShadow';
9
9
  import ShadowBox from './_ui/ShadowBox';
10
+ import CloseSvgIcon from '../../asset/images/daeryuntalk/close.svg';
11
+ import { formatTimestamp } from './_lib/utils';
10
12
 
11
13
  type HistoryViewProps = {
12
14
  onBackClick: () => void;
@@ -16,6 +18,10 @@ type HistoryViewProps = {
16
18
  historyLit: History[];
17
19
  goGetHistoryList: (data: { version?: string }) => void;
18
20
  isMobile: boolean;
21
+ onClose: () => void;
22
+ isHash: boolean;
23
+ handleGoRequestPhone: (name: string, cellPhoneNumber: string) => any;
24
+ handleGoHistoryPhoneAuth: (name: string, cellPhoneNumber: string, certificationNumber: string) => any;
19
25
  };
20
26
 
21
27
  const HistoryView: React.FC<HistoryViewProps> = ({
@@ -25,7 +31,11 @@ const HistoryView: React.FC<HistoryViewProps> = ({
25
31
  isAuthenticated,
26
32
  historyLit,
27
33
  goGetHistoryList,
28
- isMobile
34
+ isMobile,
35
+ onClose,
36
+ isHash,
37
+ handleGoRequestPhone,
38
+ handleGoHistoryPhoneAuth
29
39
  }) => {
30
40
  const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow<HTMLDivElement>();
31
41
 
@@ -33,56 +43,32 @@ const HistoryView: React.FC<HistoryViewProps> = ({
33
43
  checkScroll();
34
44
  }, [historyLit]);
35
45
 
36
- const formatTimestamp = (timestamp: string): string => {
37
- if (!timestamp) return '';
38
-
39
- // UTC string을 Date 객체로 변환
40
- const date = new Date(timestamp);
41
- const now = new Date();
42
-
43
- // 시간 차이(초)
44
- const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);
45
-
46
- if (diffInSeconds < 5) {
47
- return '방금';
48
- }
49
-
50
- if (diffInSeconds < 60 * 60 * 24) {
51
- // 오늘 내 메시지: 시:분
52
- const hours = date.getHours().toString().padStart(2, '0');
53
- const minutes = date.getMinutes().toString().padStart(2, '0');
54
- return `${hours}:${minutes}`;
55
- }
56
-
57
- if (diffInSeconds < 60 * 60 * 24 * 7) {
58
- // 일주일 내: N일전
59
- const days = Math.floor(diffInSeconds / (60 * 60 * 24));
60
- return `${days}일전`;
61
- }
62
-
63
- // 그 외: 월일
64
- const month = date.getMonth() + 1;
65
- const day = date.getDate();
66
- return `${month}월${day}일`;
67
- };
68
-
69
46
  const hasHistories = historyLit.length > 0;
70
47
 
71
48
  return (
72
- <div className="flex h-full flex-col">
49
+ <div className={`flex h-full flex-col`}>
73
50
  {/* 헤더 */}
74
- <div className="flex items-center justify-between border-b border-gray-200 p-4">
51
+ <div className={`flex h-[56px] items-center justify-between border-b border-gray-200 p-[16px]`}>
75
52
  <button className="flex h-7 w-7 items-center justify-center" aria-label="이전" onClick={onBackClick}>
76
53
  <PrevIcon width={28} height={28} />
77
54
  </button>
78
55
  <div className="flex items-center">
79
- <h2 className="font-bold leading-[140%] tracking-[-4%]">히스토리</h2>
56
+ <h2 className=" dr_talk_title_small ">히스토리</h2>
57
+ </div>
58
+ <div
59
+ className={`${isHash ? 'pointer-events-none !opacity-0' : ''} ${isMobile ? 'block' : ' xs:pointer-events-none xs:!opacity-0 '} py-[14px] text-drTalkGrayscale2 hover:cursor-pointer`}
60
+ onClick={onClose}
61
+ >
62
+ <CloseSvgIcon width={28} height={28} />
80
63
  </div>
81
- <div className="w-7"></div>
82
64
  </div>
83
65
 
84
66
  {!isAuthenticated ? (
85
- <AuthForm goGetHistoryList={goGetHistoryList} />
67
+ <AuthForm
68
+ goGetHistoryList={goGetHistoryList}
69
+ handleGoRequestPhone={handleGoRequestPhone}
70
+ handleGoHistoryPhoneAuth={handleGoHistoryPhoneAuth}
71
+ />
86
72
  ) : (
87
73
  <>
88
74
  {/* 스크롤 가능한 컨텐츠 영역 */}
@@ -92,30 +78,32 @@ const HistoryView: React.FC<HistoryViewProps> = ({
92
78
  className="no-scrollbar h-full overflow-y-auto px-[20px] pb-[20px] pt-[24px]"
93
79
  >
94
80
  {hasHistories ? (
95
- historyLit.map(history => (
81
+ historyLit?.map((history, index) => (
96
82
  <div
97
- key={history.chat_inquiry_number}
98
- className="cursor-pointer border-b border-gray-100 px-[12px] py-[18px] hover:bg-gray-50"
83
+ key={`${history.chat_inquiry_number}-${index}`}
84
+ className="cursor-pointer border-b border-drTalkGrayscale4 px-[12px] py-[18px] hover:bg-gray-50"
99
85
  onClick={() => onChatHistoryClick(history.chat_inquiry_number)}
100
86
  >
101
87
  <div className="flex items-center justify-between">
102
88
  <div className={`flex flex-row items-center gap-[10px]`}>
103
- <span className="font-medium">{history.customer_name}</span>
89
+ <span className="dr_talk_subtitle_medium">{history.customer_name}</span>
104
90
  {history.unread_message_count && history.unread_message_count > 0 ? (
105
- <span className="flex h-[18px] w-[18px] items-center justify-center rounded-full bg-[#AA1D36] px-[5.5px] py-[3px] text-[12px] font-medium leading-[100%] tracking-[-4%] text-white">
91
+ <span
92
+ className={`${history.unread_message_count > 99 ? ' h-[18px] w-[31px] rounded-[15.5px] ' : ' h-[18px] w-[18px] rounded-full '} dr_talk_subtitle_small2 flex items-center justify-center bg-drTalkCrimson text-drTalkWhite`}
93
+ >
106
94
  {history.unread_message_count}
107
95
  </span>
108
96
  ) : null}
109
97
  </div>
110
- <span className="text-xs text-gray-500">
98
+ <span className=" dr_talk_body_small1 text-drTalkGrayscale2 ">
111
99
  {formatTimestamp(history.recent_message_date_time)}
112
100
  </span>
113
101
  </div>
114
- <div className="mt-1 flex items-center justify-between">
115
- <p className="line-clamp-2 w-[85%] text-sm text-gray-700">
102
+ <div className=" mt-[10px] flex items-center justify-between">
103
+ <p className="dr_talk_body_medium2 line-clamp-2 w-[calc(100%-24px)] text-drTalkGrayscale2 ">
116
104
  {history.recent_message_content}
117
105
  </p>
118
- <LinkRight width={24} height={24} className="flex-shrink-0" />
106
+ <LinkRight width={18} height={18} className="flex-shrink-0" />
119
107
  </div>
120
108
  </div>
121
109
  ))
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { IChatInquiryMainDataResponse } from './_api/daeryuntalk/type/response';
3
+ interface IHomeViewProps {
4
+ inquiryMainData: IChatInquiryMainDataResponse | null;
5
+ isLoading: boolean;
6
+ handleStartChat: () => void;
7
+ isMobile: boolean;
8
+ onClose: () => void;
9
+ isHash: boolean;
10
+ }
11
+ declare const HomeView: ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClose, isHash }: IHomeViewProps) => React.JSX.Element;
12
+ export default HomeView;
@@ -0,0 +1,102 @@
1
+ import React, { useEffect } from 'react';
2
+ import Image from 'next/image';
3
+ import TimeIcon from '../../asset/images/daeryuntalk/time.svg';
4
+ import DaeryunLogoIcon from '../../asset/images/daeryuntalk/daeryun-logo.svg';
5
+ import ShadowBox from './_ui/ShadowBox';
6
+ import SendIcon from '../../asset/images/daeryuntalk/send.svg';
7
+ import InfoIcon from '../../asset/images/daeryuntalk/info.svg';
8
+ import DaeryuntalkIntro from '../../asset/images/daeryuntalk/daeryuntalk-intro.png';
9
+ import CloseSvgIcon from '../../asset/images/daeryuntalk/close.svg';
10
+ import { useScrollShadow } from './_hooks/useScrollShadow';
11
+ import Button3 from './_ui/buttons/Button3';
12
+ const HomeView = ({ inquiryMainData, isLoading, handleStartChat, isMobile, onClose, isHash }) => {
13
+ const { containerRef, isScroll, isBottom, checkScroll } = useScrollShadow();
14
+ useEffect(() => {
15
+ checkScroll();
16
+ }, [inquiryMainData]);
17
+ // 아직 커버이미지 url이 안나옴
18
+ const backgroundImage = (inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.sleeve_image_url) ? inquiryMainData.sleeve_image_url : DaeryuntalkIntro;
19
+ return (<div className={`
20
+ relative h-full w-full
21
+ ${isMobile ? `flex flex-col items-center justify-between` : `flex flex-col items-center `}
22
+ `}>
23
+ <header className={`
24
+ z-10
25
+ flex h-[56px] w-full justify-between px-[20px]
26
+ `}>
27
+ <div className={`
28
+ dr_talk_subtitle_small flex items-center gap-[2px] pt-[31.5px] text-drTalkGrayscale1
29
+ `}>
30
+ <TimeIcon width={20} height={20}/>
31
+ <span>24시간 운영</span>
32
+ </div>
33
+
34
+ <div className={`${isHash ? 'pointer-events-none !opacity-0' : ''} ${isMobile ? 'block' : ' xs:pointer-events-none xs:!opacity-0 '} py-[14px] text-drTalkGrayscale2 hover:cursor-pointer`} onClick={onClose}>
35
+ <CloseSvgIcon width={28} height={28}/>
36
+ </div>
37
+ </header>
38
+ <div className={'absolute left-0 top-0 z-0 h-full w-full overflow-hidden'}>
39
+ <Image src={backgroundImage} alt="대화 배경" fill className={`
40
+ ${isMobile ? `h-full max-h-[360px] w-full object-center will-change-transform ` : `w-full object-contain object-top will-change-transform`}`}/>
41
+ </div>
42
+
43
+ <div className={`
44
+ relative z-10 px-[20px]
45
+ ${isMobile
46
+ ? `flex w-full justify-center `
47
+ : `
48
+ flex h-full w-full flex-col justify-center
49
+ `}
50
+ `}>
51
+ <section className={`
52
+ flex h-[408px] flex-col rounded-[12px] bg-white px-[16px] py-[24px]
53
+ ${isMobile ? `w-full` : ``}
54
+ `} style={{
55
+ boxShadow: '0px 4px 10px 0px #00000026'
56
+ }}>
57
+ {/*mx-auto mt-[150px] flex w-[320px] flex-col gap-5 rounded-[12px] bg-white px-4 py-6*/}
58
+ <div className={`flex items-center gap-[10px]`}>
59
+ {(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_logo_image_url) ? (<Image src={inquiryMainData.channel_logo_image_url} alt="로고" width={32} height={32} className={''}/>) : (<DaeryunLogoIcon width={24} height={24} className="mr-2"/>)}
60
+ <h1 className={`dr_talk_title_small text-drTalkBlack`}>
61
+ {(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.channel_name) || '법무법인(유한)대륜'}
62
+ </h1>
63
+ </div>
64
+
65
+ <div className={`dr_talk_body_medium2 relative ml-[42px] mr-[16px] mt-[16px]`}>
66
+ <div ref={containerRef} className={`
67
+
68
+ no-scrollbar
69
+ relative max-h-[144px] overflow-auto
70
+ whitespace-pre-line
71
+ `}>
72
+ {(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.salutation) ||
73
+ `안녕하세요.
74
+ 법무법인(유한)대륜입니다.
75
+ 방문해 주셔서 감사합니다.
76
+ 궁금한 점이나 도움이 필요하신 부분
77
+ 말씀해 주시면 도와드리겠습니다.
78
+
79
+ 6:00~24:00 외 시간에는 상담인력의 편성에 따라 순차적으로 응대를 도와드리고 있습니다.`}
80
+ </div>
81
+ {isScroll && !isBottom && <ShadowBox />}
82
+ </div>
83
+
84
+ <Button3 onClick={handleStartChat} isDisabled={isLoading} className={`mt-auto`}>
85
+ <div className={`flex items-center justify-center gap-[4px]`}>
86
+ <div>{isLoading ? '로딩 중...' : '문의하기'}</div>
87
+ {!isLoading && <SendIcon width={24} height={24}/>}
88
+ </div>
89
+ </Button3>
90
+
91
+ <div className={`flex items-center justify-center gap-[4px] pt-[20px]`}>
92
+ <InfoIcon width={20} height={20}/>
93
+ <span className={`dr_talk_body_small1 text-drTalkGrayscale2 `}>
94
+ {(inquiryMainData === null || inquiryMainData === void 0 ? void 0 : inquiryMainData.answer_speed_message) || '빠르게 답변 받으실 수 있어요'}
95
+ </span>
96
+ </div>
97
+ </section>
98
+ </div>
99
+ {isMobile && <div></div>}
100
+ </div>);
101
+ };
102
+ export default HomeView;