@daeryun/dr_components 1.2.18 → 1.2.20

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 (241) hide show
  1. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  2. package/dist/components/Daeryuntalk/ChatButton.jsx +1 -1
  3. package/dist/components/Daeryuntalk/ChatButton.tsx +1 -1
  4. package/dist/components/Daeryuntalk/ChatWidget.d.ts +1 -0
  5. package/dist/components/Daeryuntalk/ChatWidget.jsx +114 -31
  6. package/dist/components/Daeryuntalk/ChatWidget.tsx +120 -37
  7. package/dist/components/Daeryuntalk/Viewer/TbPcViewer.tsx +0 -9
  8. package/dist/components/Daeryuntalk/index.jsx +17 -1
  9. package/dist/components/Daeryuntalk/index.tsx +26 -2
  10. package/dist/components/DaeryuntalkBackup/ChatButton.d.ts +11 -0
  11. package/dist/components/DaeryuntalkBackup/ChatButton.jsx +123 -0
  12. package/dist/components/DaeryuntalkBackup/ChatButton.tsx +157 -0
  13. package/dist/components/DaeryuntalkBackup/ChatConversation.d.ts +21 -0
  14. package/dist/components/DaeryuntalkBackup/ChatConversation.jsx +259 -0
  15. package/dist/components/DaeryuntalkBackup/ChatConversation.tsx +390 -0
  16. package/dist/components/DaeryuntalkBackup/ChatConversationItem/ChatConversationHeader.d.ts +16 -0
  17. package/dist/components/DaeryuntalkBackup/ChatConversationItem/ChatConversationHeader.jsx +50 -0
  18. package/dist/components/DaeryuntalkBackup/ChatConversationItem/ChatConversationHeader.tsx +108 -0
  19. package/dist/components/DaeryuntalkBackup/ChatHomeView.d.ts +14 -0
  20. package/dist/components/DaeryuntalkBackup/ChatHomeView.jsx +147 -0
  21. package/dist/components/DaeryuntalkBackup/ChatHomeView.tsx +262 -0
  22. package/dist/components/DaeryuntalkBackup/ChatInput.d.ts +8 -0
  23. package/dist/components/DaeryuntalkBackup/ChatInput.jsx +64 -0
  24. package/dist/components/DaeryuntalkBackup/ChatInput.tsx +98 -0
  25. package/dist/components/DaeryuntalkBackup/ChatItem/AgeCheckBox.d.ts +6 -0
  26. package/dist/components/DaeryuntalkBackup/ChatItem/AgeCheckBox.jsx +19 -0
  27. package/dist/components/DaeryuntalkBackup/ChatItem/AgeCheckBox.tsx +27 -0
  28. package/dist/components/DaeryuntalkBackup/ChatItem/ChatFile.d.ts +10 -0
  29. package/dist/components/DaeryuntalkBackup/ChatItem/ChatFile.jsx +165 -0
  30. package/dist/components/DaeryuntalkBackup/ChatItem/ChatFile.tsx +244 -0
  31. package/dist/components/DaeryuntalkBackup/ChatItem/ChatLoading.d.ts +6 -0
  32. package/dist/components/DaeryuntalkBackup/ChatItem/ChatLoading.jsx +12 -0
  33. package/dist/components/DaeryuntalkBackup/ChatItem/ChatLoading.tsx +25 -0
  34. package/dist/components/DaeryuntalkBackup/ChatItem/ChatPrivacyAuth.d.ts +8 -0
  35. package/dist/components/DaeryuntalkBackup/ChatItem/ChatPrivacyAuth.jsx +100 -0
  36. package/dist/components/DaeryuntalkBackup/ChatItem/ChatPrivacyAuth.tsx +135 -0
  37. package/dist/components/DaeryuntalkBackup/ChatItem/ChatWrapper.d.ts +8 -0
  38. package/dist/components/DaeryuntalkBackup/ChatItem/ChatWrapper.jsx +14 -0
  39. package/dist/components/DaeryuntalkBackup/ChatItem/ChatWrapper.tsx +26 -0
  40. package/dist/components/DaeryuntalkBackup/ChatItem/RichText.d.ts +7 -0
  41. package/dist/components/DaeryuntalkBackup/ChatItem/RichText.jsx +37 -0
  42. package/dist/components/DaeryuntalkBackup/ChatItem/RichText.tsx +45 -0
  43. package/dist/components/DaeryuntalkBackup/ChatItem/TimeWrapper.d.ts +9 -0
  44. package/dist/components/DaeryuntalkBackup/ChatItem/TimeWrapper.jsx +10 -0
  45. package/dist/components/DaeryuntalkBackup/ChatItem/TimeWrapper.tsx +21 -0
  46. package/dist/components/DaeryuntalkBackup/ChatItem/TypingComp.d.ts +3 -0
  47. package/dist/components/DaeryuntalkBackup/ChatItem/TypingComp.jsx +34 -0
  48. package/dist/components/DaeryuntalkBackup/ChatItem/TypingComp.tsx +43 -0
  49. package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowAuthForm.d.ts +8 -0
  50. package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowAuthForm.jsx +20 -0
  51. package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowAuthForm.tsx +32 -0
  52. package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowClickData.d.ts +7 -0
  53. package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowClickData.jsx +21 -0
  54. package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowClickData.tsx +37 -0
  55. package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowImg.d.ts +9 -0
  56. package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowImg.jsx +178 -0
  57. package/dist/components/DaeryuntalkBackup/ChatItem/WorkFlowImg.tsx +233 -0
  58. package/dist/components/DaeryuntalkBackup/ChatMessage.d.ts +20 -0
  59. package/dist/components/DaeryuntalkBackup/ChatMessage.jsx +198 -0
  60. package/dist/components/DaeryuntalkBackup/ChatMessage.tsx +295 -0
  61. package/dist/components/DaeryuntalkBackup/ChatObject/FieldWorkObject.d.ts +9 -0
  62. package/dist/components/DaeryuntalkBackup/ChatObject/FieldWorkObject.jsx +39 -0
  63. package/dist/components/DaeryuntalkBackup/ChatObject/FieldWorkObject.tsx +75 -0
  64. package/dist/components/DaeryuntalkBackup/ChatObject/ObjectBack.d.ts +7 -0
  65. package/dist/components/DaeryuntalkBackup/ChatObject/ObjectBack.jsx +20 -0
  66. package/dist/components/DaeryuntalkBackup/ChatObject/ObjectBack.tsx +39 -0
  67. package/dist/components/DaeryuntalkBackup/ChatObject/ObjectButton.d.ts +10 -0
  68. package/dist/components/DaeryuntalkBackup/ChatObject/ObjectButton.jsx +138 -0
  69. package/dist/components/DaeryuntalkBackup/ChatObject/ObjectButton.tsx +177 -0
  70. package/dist/components/DaeryuntalkBackup/ChatWidget.d.ts +13 -0
  71. package/dist/components/DaeryuntalkBackup/ChatWidget.jsx +154 -0
  72. package/dist/components/DaeryuntalkBackup/ChatWidget.tsx +221 -0
  73. package/dist/components/DaeryuntalkBackup/DaeryuntalkContext.d.ts +103 -0
  74. package/dist/components/DaeryuntalkBackup/DaeryuntalkContext.jsx +207 -0
  75. package/dist/components/DaeryuntalkBackup/DaeryuntalkContext.tsx +350 -0
  76. package/dist/components/DaeryuntalkBackup/DateSeparator.d.ts +6 -0
  77. package/dist/components/DaeryuntalkBackup/DateSeparator.jsx +14 -0
  78. package/dist/components/DaeryuntalkBackup/DateSeparator.tsx +24 -0
  79. package/dist/components/DaeryuntalkBackup/FixedErrorBox.d.ts +7 -0
  80. package/dist/components/DaeryuntalkBackup/FixedErrorBox.jsx +34 -0
  81. package/dist/components/DaeryuntalkBackup/FixedErrorBox.tsx +73 -0
  82. package/dist/components/DaeryuntalkBackup/History/AuthForm.d.ts +10 -0
  83. package/dist/components/DaeryuntalkBackup/History/AuthForm.jsx +157 -0
  84. package/dist/components/DaeryuntalkBackup/History/AuthForm.tsx +206 -0
  85. package/dist/components/DaeryuntalkBackup/HistoryView.d.ts +19 -0
  86. package/dist/components/DaeryuntalkBackup/HistoryView.jsx +94 -0
  87. package/dist/components/DaeryuntalkBackup/HistoryView.tsx +182 -0
  88. package/dist/components/DaeryuntalkBackup/HomeView.d.ts +12 -0
  89. package/dist/components/DaeryuntalkBackup/HomeView.jsx +178 -0
  90. package/dist/components/DaeryuntalkBackup/HomeView.tsx +261 -0
  91. package/dist/components/DaeryuntalkBackup/NavigationFooter.d.ts +11 -0
  92. package/dist/components/DaeryuntalkBackup/NavigationFooter.jsx +44 -0
  93. package/dist/components/DaeryuntalkBackup/NavigationFooter.tsx +98 -0
  94. package/dist/components/DaeryuntalkBackup/NoticeMessage.d.ts +7 -0
  95. package/dist/components/DaeryuntalkBackup/NoticeMessage.jsx +40 -0
  96. package/dist/components/DaeryuntalkBackup/NoticeMessage.tsx +60 -0
  97. package/dist/components/DaeryuntalkBackup/Tiptap/DisabledInput.d.ts +6 -0
  98. package/dist/components/DaeryuntalkBackup/Tiptap/DisabledInput.jsx +17 -0
  99. package/dist/components/DaeryuntalkBackup/Tiptap/DisabledInput.tsx +28 -0
  100. package/dist/components/DaeryuntalkBackup/Tiptap/Tiptap.d.ts +20 -0
  101. package/dist/components/DaeryuntalkBackup/Tiptap/Tiptap.jsx +130 -0
  102. package/dist/components/DaeryuntalkBackup/Tiptap/Tiptap.tsx +181 -0
  103. package/dist/components/DaeryuntalkBackup/Toast/DaeryuntalkToastProvider.d.ts +23 -0
  104. package/dist/components/DaeryuntalkBackup/Toast/DaeryuntalkToastProvider.jsx +40 -0
  105. package/dist/components/DaeryuntalkBackup/Toast/DaeryuntalkToastProvider.tsx +70 -0
  106. package/dist/components/DaeryuntalkBackup/Toast/Toast.d.ts +11 -0
  107. package/dist/components/DaeryuntalkBackup/Toast/Toast.jsx +64 -0
  108. package/dist/components/DaeryuntalkBackup/Toast/Toast.tsx +98 -0
  109. package/dist/components/DaeryuntalkBackup/Toast/ToastRender.d.ts +1 -0
  110. package/dist/components/DaeryuntalkBackup/Toast/ToastRender.jsx +22 -0
  111. package/dist/components/DaeryuntalkBackup/Toast/ToastRender.tsx +30 -0
  112. package/dist/components/DaeryuntalkBackup/Viewer/ImageViewer.d.ts +9 -0
  113. package/dist/components/DaeryuntalkBackup/Viewer/ImageViewer.jsx +98 -0
  114. package/dist/components/DaeryuntalkBackup/Viewer/ImageViewer.tsx +138 -0
  115. package/dist/components/DaeryuntalkBackup/Viewer/MobileViewer.d.ts +18 -0
  116. package/dist/components/DaeryuntalkBackup/Viewer/MobileViewer.jsx +104 -0
  117. package/dist/components/DaeryuntalkBackup/Viewer/MobileViewer.tsx +182 -0
  118. package/dist/components/DaeryuntalkBackup/Viewer/TbPcViewer.d.ts +24 -0
  119. package/dist/components/DaeryuntalkBackup/Viewer/TbPcViewer.jsx +141 -0
  120. package/dist/components/DaeryuntalkBackup/Viewer/TbPcViewer.tsx +278 -0
  121. package/dist/components/DaeryuntalkBackup/ViewportHandler.d.ts +6 -0
  122. package/dist/components/DaeryuntalkBackup/ViewportHandler.jsx +25 -0
  123. package/dist/components/DaeryuntalkBackup/ViewportHandler.tsx +32 -0
  124. package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/index.d.ts +177 -0
  125. package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/index.js +801 -0
  126. package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/index.ts +1097 -0
  127. package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/type/response.d.ts +131 -0
  128. package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/type/response.js +1 -0
  129. package/dist/components/DaeryuntalkBackup/_api/daeryuntalk/type/response.ts +159 -0
  130. package/dist/components/DaeryuntalkBackup/_api/index.d.ts +6 -0
  131. package/dist/components/DaeryuntalkBackup/_api/index.js +6 -0
  132. package/dist/components/DaeryuntalkBackup/_api/index.ts +7 -0
  133. package/dist/components/DaeryuntalkBackup/_enums/ags_check_status.d.ts +5 -0
  134. package/dist/components/DaeryuntalkBackup/_enums/ags_check_status.js +9 -0
  135. package/dist/components/DaeryuntalkBackup/_enums/ags_check_status.ts +9 -0
  136. package/dist/components/DaeryuntalkBackup/_enums/ask-status.d.ts +13 -0
  137. package/dist/components/DaeryuntalkBackup/_enums/ask-status.js +25 -0
  138. package/dist/components/DaeryuntalkBackup/_enums/ask-status.ts +26 -0
  139. package/dist/components/DaeryuntalkBackup/_enums/error.d.ts +109 -0
  140. package/dist/components/DaeryuntalkBackup/_enums/error.js +254 -0
  141. package/dist/components/DaeryuntalkBackup/_enums/error.ts +289 -0
  142. package/dist/components/DaeryuntalkBackup/_enums/message_type.d.ts +6 -0
  143. package/dist/components/DaeryuntalkBackup/_enums/message_type.js +13 -0
  144. package/dist/components/DaeryuntalkBackup/_enums/message_type.ts +13 -0
  145. package/dist/components/DaeryuntalkBackup/_enums/sender_type.d.ts +8 -0
  146. package/dist/components/DaeryuntalkBackup/_enums/sender_type.js +16 -0
  147. package/dist/components/DaeryuntalkBackup/_enums/sender_type.ts +16 -0
  148. package/dist/components/DaeryuntalkBackup/_enums/socket_type.d.ts +34 -0
  149. package/dist/components/DaeryuntalkBackup/_enums/socket_type.js +46 -0
  150. package/dist/components/DaeryuntalkBackup/_enums/socket_type.ts +56 -0
  151. package/dist/components/DaeryuntalkBackup/_enums/template.d.ts +32 -0
  152. package/dist/components/DaeryuntalkBackup/_enums/template.js +76 -0
  153. package/dist/components/DaeryuntalkBackup/_enums/template.ts +81 -0
  154. package/dist/components/DaeryuntalkBackup/_enums/work_flow_object_expose.d.ts +33 -0
  155. package/dist/components/DaeryuntalkBackup/_enums/work_flow_object_expose.js +66 -0
  156. package/dist/components/DaeryuntalkBackup/_enums/work_flow_object_expose.ts +71 -0
  157. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useChatHandler.d.ts +48 -0
  158. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useChatHandler.js +465 -0
  159. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useChatHandler.ts +595 -0
  160. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useFullURL.d.ts +1 -0
  161. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useFullURL.jsx +15 -0
  162. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useFullURL.tsx +17 -0
  163. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useHistoryHandler.d.ts +24 -0
  164. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useHistoryHandler.js +112 -0
  165. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useHistoryHandler.ts +144 -0
  166. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useSocketEventHandler.d.ts +44 -0
  167. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useSocketEventHandler.js +534 -0
  168. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useSocketEventHandler.ts +706 -0
  169. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useViewerHook.d.ts +8 -0
  170. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useViewerHook.js +18 -0
  171. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useViewerHook.ts +23 -0
  172. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useWorkFlow.d.ts +9 -0
  173. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useWorkFlow.js +109 -0
  174. package/dist/components/DaeryuntalkBackup/_hooks/talkprovider/useWorkFlow.ts +121 -0
  175. package/dist/components/DaeryuntalkBackup/_hooks/useHoverScrollbar.d.ts +12 -0
  176. package/dist/components/DaeryuntalkBackup/_hooks/useHoverScrollbar.js +48 -0
  177. package/dist/components/DaeryuntalkBackup/_hooks/useHoverScrollbar.ts +73 -0
  178. package/dist/components/DaeryuntalkBackup/_hooks/useScrollShadow.d.ts +7 -0
  179. package/dist/components/DaeryuntalkBackup/_hooks/useScrollShadow.js +42 -0
  180. package/dist/components/DaeryuntalkBackup/_hooks/useScrollShadow.ts +52 -0
  181. package/dist/components/DaeryuntalkBackup/_hooks/useWindowSize.d.ts +6 -0
  182. package/dist/components/DaeryuntalkBackup/_hooks/useWindowSize.js +20 -0
  183. package/dist/components/DaeryuntalkBackup/_hooks/useWindowSize.ts +30 -0
  184. package/dist/components/DaeryuntalkBackup/_hooks/view/useChatSocketState.d.ts +2 -0
  185. package/dist/components/DaeryuntalkBackup/_hooks/view/useChatSocketState.js +26 -0
  186. package/dist/components/DaeryuntalkBackup/_hooks/view/useChatSocketState.ts +43 -0
  187. package/dist/components/DaeryuntalkBackup/_hooks/view/useHistoryView.d.ts +27 -0
  188. package/dist/components/DaeryuntalkBackup/_hooks/view/useHistoryView.js +80 -0
  189. package/dist/components/DaeryuntalkBackup/_hooks/view/useHistoryView.ts +101 -0
  190. package/dist/components/DaeryuntalkBackup/_hooks/view/useHomeView.d.ts +18 -0
  191. package/dist/components/DaeryuntalkBackup/_hooks/view/useHomeView.js +66 -0
  192. package/dist/components/DaeryuntalkBackup/_hooks/view/useHomeView.ts +75 -0
  193. package/dist/components/DaeryuntalkBackup/_lib/index.d.ts +7 -0
  194. package/dist/components/DaeryuntalkBackup/_lib/index.js +103 -0
  195. package/dist/components/DaeryuntalkBackup/_lib/index.ts +136 -0
  196. package/dist/components/DaeryuntalkBackup/_lib/utils.d.ts +17 -0
  197. package/dist/components/DaeryuntalkBackup/_lib/utils.js +94 -0
  198. package/dist/components/DaeryuntalkBackup/_lib/utils.ts +119 -0
  199. package/dist/components/DaeryuntalkBackup/_types/message.d.ts +92 -0
  200. package/dist/components/DaeryuntalkBackup/_types/message.js +25 -0
  201. package/dist/components/DaeryuntalkBackup/_types/message.ts +156 -0
  202. package/dist/components/DaeryuntalkBackup/_types/message_object.d.ts +17 -0
  203. package/dist/components/DaeryuntalkBackup/_types/message_object.js +1 -0
  204. package/dist/components/DaeryuntalkBackup/_types/message_object.ts +18 -0
  205. package/dist/components/DaeryuntalkBackup/_types/socket/workflow.d.ts +15 -0
  206. package/dist/components/DaeryuntalkBackup/_types/socket/workflow.js +1 -0
  207. package/dist/components/DaeryuntalkBackup/_types/socket/workflow.ts +15 -0
  208. package/dist/components/DaeryuntalkBackup/_ui/ShadowBox.d.ts +6 -0
  209. package/dist/components/DaeryuntalkBackup/_ui/ShadowBox.jsx +5 -0
  210. package/dist/components/DaeryuntalkBackup/_ui/ShadowBox.tsx +15 -0
  211. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button1.d.ts +10 -0
  212. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button1.jsx +12 -0
  213. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button1.tsx +29 -0
  214. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button2.d.ts +10 -0
  215. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button2.jsx +12 -0
  216. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button2.tsx +29 -0
  217. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button3.d.ts +10 -0
  218. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button3.jsx +12 -0
  219. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button3.tsx +29 -0
  220. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button4.d.ts +10 -0
  221. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button4.jsx +12 -0
  222. package/dist/components/DaeryuntalkBackup/_ui/buttons/Button4.tsx +29 -0
  223. package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox1.d.ts +8 -0
  224. package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox1.jsx +15 -0
  225. package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox1.tsx +38 -0
  226. package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox2.d.ts +8 -0
  227. package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox2.jsx +21 -0
  228. package/dist/components/DaeryuntalkBackup/_ui/checkboxs/CheckBox2.tsx +50 -0
  229. package/dist/components/DaeryuntalkBackup/_ui/inputs/Input1.d.ts +12 -0
  230. package/dist/components/DaeryuntalkBackup/_ui/inputs/Input1.jsx +9 -0
  231. package/dist/components/DaeryuntalkBackup/_ui/inputs/Input1.tsx +39 -0
  232. package/dist/components/DaeryuntalkBackup/_ui/inputs/Input2.d.ts +13 -0
  233. package/dist/components/DaeryuntalkBackup/_ui/inputs/Input2.jsx +10 -0
  234. package/dist/components/DaeryuntalkBackup/_ui/inputs/Input2.tsx +43 -0
  235. package/dist/components/DaeryuntalkBackup/index.d.ts +8 -0
  236. package/dist/components/DaeryuntalkBackup/index.jsx +190 -0
  237. package/dist/components/DaeryuntalkBackup/index.tsx +261 -0
  238. package/dist/components/common/integrate/index.d.ts +1 -1
  239. package/dist/styles/globals.css +415 -414
  240. package/dist/tsconfig.tsbuildinfo +1 -1
  241. package/package.json +5 -1
@@ -0,0 +1,40 @@
1
+ 'use client';
2
+ import { createContext, useContext, useState } from 'react';
3
+ export const ToastContext = createContext(undefined);
4
+ export const useDaeryunTalkToast = () => {
5
+ const ctx = useContext(ToastContext);
6
+ if (!ctx)
7
+ throw new Error('ToastContext가 없습니다.');
8
+ return ctx;
9
+ };
10
+ export const DaeryuntalkToastProvider = ({ children }) => {
11
+ const [toast, setToast] = useState(null);
12
+ const [animationState, setAnimationState] = useState('hidden');
13
+ const hideToast = () => {
14
+ setAnimationState('exiting');
15
+ setTimeout(() => {
16
+ setAnimationState('hidden');
17
+ setToast(null);
18
+ }, 500);
19
+ };
20
+ const showToast = (type, title, description, duration = 3000) => {
21
+ setToast({ type, title, description, duration });
22
+ setAnimationState('entering');
23
+ // 짧은 딜레이 후 visible 상태로 전환 (아래에서 위로 애니메이션)
24
+ setTimeout(() => {
25
+ setAnimationState('visible');
26
+ }, 50);
27
+ // duration 후 자동 숨김
28
+ setTimeout(() => {
29
+ if (animationState !== 'hidden') {
30
+ hideToast();
31
+ }
32
+ }, duration);
33
+ };
34
+ const success = (title, d, t) => showToast('success', title, d, t);
35
+ const warning = (title, d, t) => showToast('warning', title, d, t);
36
+ const error = (title, d, t) => showToast('error', title, d, t);
37
+ return (<ToastContext.Provider value={{ toast, animationState, hideToast, success, warning, error }}>
38
+ {children}
39
+ </ToastContext.Provider>);
40
+ };
@@ -0,0 +1,70 @@
1
+ 'use client';
2
+
3
+ import { createContext, ReactNode, useContext, useState } from 'react';
4
+
5
+ export type ToastType = 'success' | 'warning' | 'error';
6
+ export type AnimationState = 'hidden' | 'entering' | 'visible' | 'exiting';
7
+
8
+ interface ToastItem {
9
+ type: ToastType;
10
+ title: string;
11
+ description?: string;
12
+ duration?: number;
13
+ }
14
+
15
+ interface ToastContextProps {
16
+ toast: ToastItem | null;
17
+ animationState: AnimationState;
18
+ hideToast: () => void;
19
+ success: (title: string, desc?: string, duration?: number) => void;
20
+ warning: (title: string, desc?: string, duration?: number) => void;
21
+ error: (title: string, desc?: string, duration?: number) => void;
22
+ }
23
+
24
+ export const ToastContext = createContext<ToastContextProps | undefined>(undefined);
25
+
26
+ export const useDaeryunTalkToast = () => {
27
+ const ctx = useContext(ToastContext);
28
+ if (!ctx) throw new Error('ToastContext가 없습니다.');
29
+ return ctx;
30
+ };
31
+
32
+ export const DaeryuntalkToastProvider = ({ children }: { children: ReactNode }) => {
33
+ const [toast, setToast] = useState<ToastItem | null>(null);
34
+ const [animationState, setAnimationState] = useState<AnimationState>('hidden');
35
+
36
+ const hideToast = () => {
37
+ setAnimationState('exiting');
38
+ setTimeout(() => {
39
+ setAnimationState('hidden');
40
+ setToast(null);
41
+ }, 500);
42
+ };
43
+
44
+ const showToast = (type: ToastType, title: string, description?: string, duration = 3000) => {
45
+ setToast({ type, title, description, duration });
46
+ setAnimationState('entering');
47
+
48
+ // 짧은 딜레이 후 visible 상태로 전환 (아래에서 위로 애니메이션)
49
+ setTimeout(() => {
50
+ setAnimationState('visible');
51
+ }, 50);
52
+
53
+ // duration 후 자동 숨김
54
+ setTimeout(() => {
55
+ if (animationState !== 'hidden') {
56
+ hideToast();
57
+ }
58
+ }, duration);
59
+ };
60
+
61
+ const success = (title: string, d?: string, t?: number) => showToast('success', title, d, t);
62
+ const warning = (title: string, d?: string, t?: number) => showToast('warning', title, d, t);
63
+ const error = (title: string, d?: string, t?: number) => showToast('error', title, d, t);
64
+
65
+ return (
66
+ <ToastContext.Provider value={{ toast, animationState, hideToast, success, warning, error }}>
67
+ {children}
68
+ </ToastContext.Provider>
69
+ );
70
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ type ToastType = 'success' | 'warning' | 'error';
3
+ interface ToastProps {
4
+ type: ToastType;
5
+ title: string;
6
+ description?: string;
7
+ duration?: number;
8
+ onClose: () => void;
9
+ }
10
+ declare const _default: React.MemoExoticComponent<({ type, title, description, duration, onClose }: ToastProps) => React.JSX.Element>;
11
+ export default _default;
@@ -0,0 +1,64 @@
1
+ 'use client';
2
+ import React, { useEffect, useRef } from 'react';
3
+ // 1. 함수 이름을 PascalCase로 변경
4
+ const WarningIcon = ({ className = '' }) => {
5
+ return (<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" className={className}>
6
+ <g clipPath="url(#clip0_1775_25245)">
7
+ <path d="M3 12C3 13.1819 3.23279 14.3522 3.68508 15.4442C4.13738 16.5361 4.80031 17.5282 5.63604 18.364C6.47177 19.1997 7.46392 19.8626 8.55585 20.3149C9.64778 20.7672 10.8181 21 12 21C13.1819 21 14.3522 20.7672 15.4442 20.3149C16.5361 19.8626 17.5282 19.1997 18.364 18.364C19.1997 17.5282 19.8626 16.5361 20.3149 15.4442C20.7672 14.3522 21 13.1819 21 12C21 9.61305 20.0518 7.32387 18.364 5.63604C16.6761 3.94821 14.3869 3 12 3C9.61305 3 7.32387 3.94821 5.63604 5.63604C3.94821 7.32387 3 9.61305 3 12Z" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
8
+ <path d="M12 16V16.01" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
9
+ <path d="M12 8.5L12 13" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
10
+ </g>
11
+ <defs>
12
+ <clipPath id="clip0_1775_25245">
13
+ <rect width="24" height="24" fill="white"/>
14
+ </clipPath>
15
+ </defs>
16
+ </svg>);
17
+ };
18
+ const ICONS = {
19
+ success: <WarningIcon className="h-6 w-6 text-white"/>,
20
+ warning: <WarningIcon className="h-6 w-6 text-white"/>,
21
+ error: <WarningIcon className="h-6 w-6 text-white"/>
22
+ };
23
+ const DaeryunTalkToast = ({ type, title, description, duration = 3000, onClose }) => {
24
+ const timerRef = useRef(null);
25
+ useEffect(() => {
26
+ if (timerRef.current) {
27
+ clearTimeout(timerRef.current);
28
+ }
29
+ const timer = setTimeout(() => {
30
+ onClose();
31
+ }, duration || 3000);
32
+ timerRef.current = timer;
33
+ return () => {
34
+ clearTimeout(timer);
35
+ };
36
+ }, [duration, onClose]);
37
+ const closeToast = () => {
38
+ if (timerRef.current) {
39
+ clearTimeout(timerRef.current);
40
+ timerRef.current = null;
41
+ }
42
+ onClose();
43
+ };
44
+ return (<>
45
+ <div className=" flex min-h-[48px] w-full items-center justify-center space-x-[6px] rounded-[25px] bg-[#505050] text-white">
46
+ <div className="mt-0.5 flex-shrink-0">{ICONS[type]}</div>
47
+ <div className="flex">
48
+ <h3 className="whitespace-pre-line text-[14px] font-[400] leading-[130%] tracking-[-4%]">
49
+ {title}
50
+ </h3>
51
+ {/*{description && <p className="mt-0.5 text-sm text-white text-opacity-90">{description}</p>}*/}
52
+ </div>
53
+ </div>
54
+ {/*<button*/}
55
+ {/* onClick={closeToast}*/}
56
+ {/* className="ml-3 flex-shrink-0 rounded-full bg-white bg-opacity-10 p-1 hover:bg-opacity-20"*/}
57
+ {/*>*/}
58
+ {/* <svg className="h-4 w-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">*/}
59
+ {/* <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />*/}
60
+ {/* </svg>*/}
61
+ {/*</button>*/}
62
+ </>);
63
+ };
64
+ export default React.memo(DaeryunTalkToast);
@@ -0,0 +1,98 @@
1
+ 'use client';
2
+ import React, { useEffect, useRef } from 'react';
3
+
4
+ type ToastType = 'success' | 'warning' | 'error';
5
+
6
+ interface ToastProps {
7
+ type: ToastType;
8
+ title: string;
9
+ description?: string;
10
+ duration?: number;
11
+ onClose: () => void;
12
+ }
13
+
14
+ // 1. 함수 이름을 PascalCase로 변경
15
+ const WarningIcon = ({ className = '' }: { className?: string }) => {
16
+ return (
17
+ <svg
18
+ width="24"
19
+ height="24"
20
+ viewBox="0 0 24 24"
21
+ fill="none"
22
+ xmlns="http://www.w3.org/2000/svg"
23
+ className={className}
24
+ >
25
+ <g clipPath="url(#clip0_1775_25245)">
26
+ <path
27
+ d="M3 12C3 13.1819 3.23279 14.3522 3.68508 15.4442C4.13738 16.5361 4.80031 17.5282 5.63604 18.364C6.47177 19.1997 7.46392 19.8626 8.55585 20.3149C9.64778 20.7672 10.8181 21 12 21C13.1819 21 14.3522 20.7672 15.4442 20.3149C16.5361 19.8626 17.5282 19.1997 18.364 18.364C19.1997 17.5282 19.8626 16.5361 20.3149 15.4442C20.7672 14.3522 21 13.1819 21 12C21 9.61305 20.0518 7.32387 18.364 5.63604C16.6761 3.94821 14.3869 3 12 3C9.61305 3 7.32387 3.94821 5.63604 5.63604C3.94821 7.32387 3 9.61305 3 12Z"
28
+ stroke="white"
29
+ strokeWidth="2"
30
+ strokeLinecap="round"
31
+ strokeLinejoin="round"
32
+ />
33
+ <path d="M12 16V16.01" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
34
+ <path d="M12 8.5L12 13" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
35
+ </g>
36
+ <defs>
37
+ <clipPath id="clip0_1775_25245">
38
+ <rect width="24" height="24" fill="white" />
39
+ </clipPath>
40
+ </defs>
41
+ </svg>
42
+ );
43
+ };
44
+
45
+ const ICONS = {
46
+ success: <WarningIcon className="h-6 w-6 text-white" />,
47
+ warning: <WarningIcon className="h-6 w-6 text-white" />,
48
+ error: <WarningIcon className="h-6 w-6 text-white" />
49
+ };
50
+
51
+ const DaeryunTalkToast = ({ type, title, description, duration = 3000, onClose }: ToastProps) => {
52
+ const timerRef = useRef<NodeJS.Timeout | null>(null);
53
+
54
+ useEffect(() => {
55
+ if (timerRef.current) {
56
+ clearTimeout(timerRef.current);
57
+ }
58
+ const timer = setTimeout(() => {
59
+ onClose();
60
+ }, duration || 3000);
61
+ timerRef.current = timer;
62
+ return () => {
63
+ clearTimeout(timer);
64
+ };
65
+ }, [duration, onClose]);
66
+
67
+ const closeToast = () => {
68
+ if (timerRef.current) {
69
+ clearTimeout(timerRef.current);
70
+ timerRef.current = null;
71
+ }
72
+ onClose();
73
+ };
74
+
75
+ return (
76
+ <>
77
+ <div className=" flex min-h-[48px] w-full items-center justify-center space-x-[6px] rounded-[25px] bg-[#505050] text-white">
78
+ <div className="mt-0.5 flex-shrink-0">{ICONS[type]}</div>
79
+ <div className="flex">
80
+ <h3 className="whitespace-pre-line text-[14px] font-[400] leading-[130%] tracking-[-4%]">
81
+ {title}
82
+ </h3>
83
+ {/*{description && <p className="mt-0.5 text-sm text-white text-opacity-90">{description}</p>}*/}
84
+ </div>
85
+ </div>
86
+ {/*<button*/}
87
+ {/* onClick={closeToast}*/}
88
+ {/* className="ml-3 flex-shrink-0 rounded-full bg-white bg-opacity-10 p-1 hover:bg-opacity-20"*/}
89
+ {/*>*/}
90
+ {/* <svg className="h-4 w-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">*/}
91
+ {/* <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />*/}
92
+ {/* </svg>*/}
93
+ {/*</button>*/}
94
+ </>
95
+ );
96
+ };
97
+
98
+ export default React.memo(DaeryunTalkToast);
@@ -0,0 +1 @@
1
+ export default function ToastRenderer(): import("react").JSX.Element | null;
@@ -0,0 +1,22 @@
1
+ // ./Toast/ToastRenderer.tsx
2
+ 'use client';
3
+ import { useContext } from 'react';
4
+ import { ToastContext } from './DaeryuntalkToastProvider';
5
+ import DaeryunTalkToast from './Toast';
6
+ export default function ToastRenderer() {
7
+ const context = useContext(ToastContext);
8
+ if (!context)
9
+ return null;
10
+ const { toast, animationState, hideToast } = context;
11
+ return (<div className="absolute bottom-0 left-1/2 z-[10] w-[90%] -translate-x-1/2">
12
+ <div className={`
13
+ transition-all duration-500 ease-out
14
+ ${animationState === 'hidden' && 'pointer-events-none translate-y-[20px] opacity-0'}
15
+ ${animationState === 'entering' && 'translate-y-[20px] opacity-0'}
16
+ ${animationState === 'visible' && 'translate-y-[-80px] opacity-100'}
17
+ ${animationState === 'exiting' && 'pointer-events-none translate-y-[-80px] opacity-0'}
18
+ `}>
19
+ {toast && <DaeryunTalkToast {...toast} onClose={hideToast}/>}
20
+ </div>
21
+ </div>);
22
+ }
@@ -0,0 +1,30 @@
1
+ // ./Toast/ToastRenderer.tsx
2
+ 'use client';
3
+
4
+ import { useContext } from 'react';
5
+ import { ToastContext } from './DaeryuntalkToastProvider';
6
+ import DaeryunTalkToast from './Toast';
7
+
8
+ export default function ToastRenderer() {
9
+ const context = useContext(ToastContext);
10
+
11
+ if (!context) return null;
12
+
13
+ const { toast, animationState, hideToast } = context;
14
+
15
+ return (
16
+ <div className="absolute bottom-0 left-1/2 z-[10] w-[90%] -translate-x-1/2">
17
+ <div
18
+ className={`
19
+ transition-all duration-500 ease-out
20
+ ${animationState === 'hidden' && 'pointer-events-none translate-y-[20px] opacity-0'}
21
+ ${animationState === 'entering' && 'translate-y-[20px] opacity-0'}
22
+ ${animationState === 'visible' && 'translate-y-[-80px] opacity-100'}
23
+ ${animationState === 'exiting' && 'pointer-events-none translate-y-[-80px] opacity-0'}
24
+ `}
25
+ >
26
+ {toast && <DaeryunTalkToast {...toast} onClose={hideToast} />}
27
+ </div>
28
+ </div>
29
+ );
30
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { FileInfo } from '../_types/message';
3
+ export declare const ZOOM_LEVELS: number[];
4
+ export type PreviewImage = {
5
+ file: FileInfo;
6
+ url: string;
7
+ };
8
+ declare const ImageViewer: () => React.JSX.Element | null;
9
+ export default ImageViewer;
@@ -0,0 +1,98 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import React, { useEffect, useState } from 'react';
11
+ import { getMessageFileDownloadUrl } from '../_api';
12
+ import { useDaeryuntalk } from '../DaeryuntalkContext';
13
+ import MobileViewer from './MobileViewer';
14
+ import TbPcViewer from './TbPcViewer';
15
+ export const ZOOM_LEVELS = [25, 50, 75, 100, 125, 150, 200];
16
+ const ImageViewer = () => {
17
+ var _a;
18
+ const { isImageViewerOpen, selectedImageFile, imageViewerMessage, closeImageViewer } = useDaeryuntalk();
19
+ const images = ((_a = imageViewerMessage === null || imageViewerMessage === void 0 ? void 0 : imageViewerMessage.files) === null || _a === void 0 ? void 0 : _a.filter(item => (item === null || item === void 0 ? void 0 : item.type) === 'image')) || [];
20
+ const initialIndex = images.findIndex(img => img.fileNumber === (selectedImageFile === null || selectedImageFile === void 0 ? void 0 : selectedImageFile.fileNumber));
21
+ const [currentIndex, setCurrentIndex] = useState(initialIndex >= 0 ? initialIndex : 0);
22
+ const [rotation, setRotation] = useState(0);
23
+ const [zoomLevel, setZoomLevel] = useState(3);
24
+ const [previewImages, setPreviewImages] = useState([]);
25
+ const currentImage = previewImages[currentIndex];
26
+ const currentZoom = ZOOM_LEVELS[zoomLevel];
27
+ useEffect(() => {
28
+ const handleKeyDown = (e) => {
29
+ if (e.key === 'Escape' && closeImageViewer) {
30
+ closeImageViewer();
31
+ }
32
+ };
33
+ window.addEventListener('keydown', handleKeyDown);
34
+ return () => {
35
+ window.removeEventListener('keydown', handleKeyDown);
36
+ };
37
+ }, [closeImageViewer]);
38
+ // 모든 이미지 URL 미리 생성
39
+ useEffect(() => {
40
+ if (!imageViewerMessage || images.length === 0)
41
+ return;
42
+ const fetchAllUrls = () => __awaiter(void 0, void 0, void 0, function* () {
43
+ // STEP 1: 썸네일 기반 먼저 세팅
44
+ const initialPreviews = images.map(file => ({
45
+ file,
46
+ url: file.thumbnailUrl // 빠르게 미리 보여주기
47
+ }));
48
+ setPreviewImages(initialPreviews);
49
+ });
50
+ fetchAllUrls();
51
+ }, [imageViewerMessage, selectedImageFile]);
52
+ useEffect(() => {
53
+ setCurrentIndex(initialIndex >= 0 ? initialIndex : 0);
54
+ setRotation(0);
55
+ setZoomLevel(3);
56
+ }, [selectedImageFile]);
57
+ const rotateImage = () => setRotation(prev => (prev + 90) % 360);
58
+ const zoomIn = () => setZoomLevel(prev => (prev < ZOOM_LEVELS.length - 1 ? prev + 1 : prev));
59
+ const zoomOut = () => setZoomLevel(prev => (prev > 0 ? prev - 1 : prev));
60
+ const handleDownload = () => __awaiter(void 0, void 0, void 0, function* () {
61
+ var _a;
62
+ if (!currentImage || !imageViewerMessage)
63
+ return;
64
+ try {
65
+ const res = yield getMessageFileDownloadUrl({
66
+ chatInquiryNumber: imageViewerMessage.inquiryNumber || '',
67
+ fileNumber: currentImage.file.fileNumber
68
+ });
69
+ const filePath = res.data.url;
70
+ const response = yield fetch(filePath);
71
+ const blob = yield response.blob();
72
+ const url = window.URL.createObjectURL(blob);
73
+ const link = document.createElement('a');
74
+ link.href = url;
75
+ link.download = ((_a = currentImage.file) === null || _a === void 0 ? void 0 : _a.name) || '';
76
+ document.body.appendChild(link);
77
+ link.click();
78
+ window.URL.revokeObjectURL(url);
79
+ document.body.removeChild(link);
80
+ }
81
+ catch (err) {
82
+ console.error('다운로드 URL 요청 실패:', err);
83
+ // 사용자에게 알림 또는 토스트 표시 등을 추가할 수 있습니다.
84
+ }
85
+ });
86
+ const handleBackdropClick = (e) => {
87
+ if (e.target === e.currentTarget)
88
+ closeImageViewer === null || closeImageViewer === void 0 ? void 0 : closeImageViewer();
89
+ };
90
+ if (!isImageViewerOpen || !currentImage)
91
+ return null;
92
+ return (<div className={`fixed inset-0 z-[999999] bg-black/90`} onClick={handleBackdropClick}>
93
+ {/* 900px 이하 */}
94
+ <MobileViewer imageViewerMessage={imageViewerMessage} handleDownload={handleDownload} currentIndex={currentIndex} setCurrentIndex={setCurrentIndex} currentImage={currentImage} closeImageViewer={closeImageViewer} previewImages={previewImages} setRotation={setRotation} setZoomLevel={setZoomLevel}/>
95
+ <TbPcViewer imageViewerMessage={imageViewerMessage} handleDownload={handleDownload} currentIndex={currentIndex} setCurrentIndex={setCurrentIndex} rotation={rotation} currentZoom={currentZoom} currentImage={currentImage} closeImageViewer={closeImageViewer} previewImages={previewImages} setRotation={setRotation} setZoomLevel={setZoomLevel} rotateImage={rotateImage} zoomIn={zoomIn} zoomOut={zoomOut} zoomLevel={zoomLevel}/>
96
+ </div>);
97
+ };
98
+ export default ImageViewer;
@@ -0,0 +1,138 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { getMessageFileDownloadUrl } from '../_api';
3
+ import { useDaeryuntalk } from '../DaeryuntalkContext';
4
+ import { FileInfo } from '../_types/message';
5
+ import MobileViewer from './MobileViewer';
6
+ import TbPcViewer from './TbPcViewer';
7
+
8
+ export const ZOOM_LEVELS = [25, 50, 75, 100, 125, 150, 200];
9
+
10
+ export type PreviewImage = {
11
+ file: FileInfo;
12
+ url: string;
13
+ };
14
+
15
+ const ImageViewer = () => {
16
+ const { isImageViewerOpen, selectedImageFile, imageViewerMessage, closeImageViewer } = useDaeryuntalk();
17
+
18
+ const images = imageViewerMessage?.files?.filter(item => item?.type === 'image') || [];
19
+ const initialIndex = images.findIndex(img => img.fileNumber === selectedImageFile?.fileNumber);
20
+
21
+ const [currentIndex, setCurrentIndex] = useState<number>(initialIndex >= 0 ? initialIndex : 0);
22
+ const [rotation, setRotation] = useState(0);
23
+ const [zoomLevel, setZoomLevel] = useState(3);
24
+ const [previewImages, setPreviewImages] = useState<PreviewImage[]>([]);
25
+
26
+ const currentImage = previewImages[currentIndex];
27
+ const currentZoom = ZOOM_LEVELS[zoomLevel];
28
+
29
+ useEffect(() => {
30
+ const handleKeyDown = (e: KeyboardEvent) => {
31
+ if (e.key === 'Escape' && closeImageViewer) {
32
+ closeImageViewer();
33
+ }
34
+ };
35
+
36
+ window.addEventListener('keydown', handleKeyDown);
37
+
38
+ return () => {
39
+ window.removeEventListener('keydown', handleKeyDown);
40
+ };
41
+ }, [closeImageViewer]);
42
+
43
+ // 모든 이미지 URL 미리 생성
44
+ useEffect(() => {
45
+ if (!imageViewerMessage || images.length === 0) return;
46
+
47
+ const fetchAllUrls = async () => {
48
+ // STEP 1: 썸네일 기반 먼저 세팅
49
+ const initialPreviews = images.map(file => ({
50
+ file,
51
+ url: file.thumbnailUrl // 빠르게 미리 보여주기
52
+ }));
53
+
54
+ setPreviewImages(initialPreviews);
55
+ };
56
+
57
+ fetchAllUrls();
58
+ }, [imageViewerMessage, selectedImageFile]);
59
+
60
+ useEffect(() => {
61
+ setCurrentIndex(initialIndex >= 0 ? initialIndex : 0);
62
+ setRotation(0);
63
+ setZoomLevel(3);
64
+ }, [selectedImageFile]);
65
+
66
+ const rotateImage = () => setRotation(prev => (prev + 90) % 360);
67
+ const zoomIn = () => setZoomLevel(prev => (prev < ZOOM_LEVELS.length - 1 ? prev + 1 : prev));
68
+ const zoomOut = () => setZoomLevel(prev => (prev > 0 ? prev - 1 : prev));
69
+
70
+ const handleDownload = async () => {
71
+ if (!currentImage || !imageViewerMessage) return;
72
+
73
+ try {
74
+ const res = await getMessageFileDownloadUrl({
75
+ chatInquiryNumber: imageViewerMessage.inquiryNumber || '',
76
+ fileNumber: currentImage.file.fileNumber
77
+ });
78
+
79
+ const filePath = res.data.url;
80
+ const response = await fetch(filePath);
81
+ const blob = await response.blob();
82
+
83
+ const url = window.URL.createObjectURL(blob);
84
+ const link = document.createElement('a');
85
+ link.href = url;
86
+ link.download = currentImage.file?.name || '';
87
+ document.body.appendChild(link);
88
+ link.click();
89
+ window.URL.revokeObjectURL(url);
90
+ document.body.removeChild(link);
91
+ } catch (err) {
92
+ console.error('다운로드 URL 요청 실패:', err);
93
+ // 사용자에게 알림 또는 토스트 표시 등을 추가할 수 있습니다.
94
+ }
95
+ };
96
+
97
+ const handleBackdropClick = (e: React.MouseEvent<HTMLDivElement>) => {
98
+ if (e.target === e.currentTarget) closeImageViewer?.();
99
+ };
100
+
101
+ if (!isImageViewerOpen || !currentImage) return null;
102
+
103
+ return (
104
+ <div className={`fixed inset-0 z-[999999] bg-black/90`} onClick={handleBackdropClick}>
105
+ {/* 900px 이하 */}
106
+ <MobileViewer
107
+ imageViewerMessage={imageViewerMessage}
108
+ handleDownload={handleDownload}
109
+ currentIndex={currentIndex}
110
+ setCurrentIndex={setCurrentIndex}
111
+ currentImage={currentImage}
112
+ closeImageViewer={closeImageViewer}
113
+ previewImages={previewImages}
114
+ setRotation={setRotation}
115
+ setZoomLevel={setZoomLevel}
116
+ />
117
+ <TbPcViewer
118
+ imageViewerMessage={imageViewerMessage}
119
+ handleDownload={handleDownload}
120
+ currentIndex={currentIndex}
121
+ setCurrentIndex={setCurrentIndex}
122
+ rotation={rotation}
123
+ currentZoom={currentZoom}
124
+ currentImage={currentImage}
125
+ closeImageViewer={closeImageViewer}
126
+ previewImages={previewImages}
127
+ setRotation={setRotation}
128
+ setZoomLevel={setZoomLevel}
129
+ rotateImage={rotateImage}
130
+ zoomIn={zoomIn}
131
+ zoomOut={zoomOut}
132
+ zoomLevel={zoomLevel}
133
+ />
134
+ </div>
135
+ );
136
+ };
137
+
138
+ export default ImageViewer;
@@ -0,0 +1,18 @@
1
+ import React, { Dispatch, SetStateAction } from 'react';
2
+ import { Message } from '../_types/message';
3
+ import { PreviewImage } from './ImageViewer';
4
+ import 'swiper/css';
5
+ import 'swiper/css/navigation';
6
+ interface IMobileViewerProps {
7
+ imageViewerMessage?: Message | null;
8
+ handleDownload: () => void;
9
+ currentIndex: number;
10
+ setCurrentIndex: Dispatch<SetStateAction<number>>;
11
+ currentImage: PreviewImage;
12
+ closeImageViewer?: () => void;
13
+ previewImages: PreviewImage[];
14
+ setRotation: Dispatch<SetStateAction<number>>;
15
+ setZoomLevel: Dispatch<SetStateAction<number>>;
16
+ }
17
+ declare const MobileViewer: ({ imageViewerMessage, handleDownload, currentIndex, setCurrentIndex, currentImage, closeImageViewer, previewImages, setRotation, setZoomLevel }: IMobileViewerProps) => React.JSX.Element;
18
+ export default MobileViewer;