@daeryun/dr_components 1.2.18 → 1.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 -410
  240. package/dist/tsconfig.tsbuildinfo +1 -1
  241. package/package.json +1 -1
@@ -0,0 +1,801 @@
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 { ErrorEnum } from '../../_enums/error';
11
+ import { MessageSocketType } from '../../_enums/socket_type';
12
+ import { consoleFn } from '../../_lib/utils';
13
+ // API 기본 URL
14
+ const API_BASE_URL = process.env.NEXT_PUBLIC_CHAT_CUSTOMER_API;
15
+ // 'https://chat-client-api.lawmance.com';
16
+ // API 기본 버전
17
+ export const DEFAULT_API_VERSION = '1.0.0';
18
+ // API 엔드포인트
19
+ const ENDPOINTS = {
20
+ /* 시작점 */
21
+ AUTHENTICATE: '/chatctm/ctf/crtfica', // 유저 인증
22
+ WEBSOCKET_INIT: '/chatctm/ctf/ws-init', // 웹 소켓 초기화
23
+ /* 채팅 */
24
+ CHAT_INQUIRY_MAIN: '/chatctm/hom/chatinquirymainsearch', // 채팅 문의 메인 조회
25
+ CHAT_INQUIRY_CREATE: '/chatctm/hom/chatinquirycreate', // XXX
26
+ CHAT_INQUIRY_DETAIL: '/chatctm/hom/chatinquirydetailsearch',
27
+ CHAT_INQUIRY_GENERATION: '/chatctm/chi/chatinquirygeneration', // 채팅 문의 생성
28
+ CHAT_INQUIRY_DETAIL_NEW: '/chatctm/chi/chatinquirydetail', // 채팅 문의 상세 조회
29
+ CHAT_INQUIRY_MESSAGE_LIST: '/chatctm/chi/chatinquirymessagelist', // 채팅 문의 메시지 목록 조회
30
+ CHAT_MESSAGE_SEND: '/chatctm/chi/chatinquirymessagesend', // 채팅 문의 메시지 전송
31
+ CHAT_MESSAGE_FILE_URL_REQUEST: '/chatctm/chi/chatinquirymessagefiledownloadurlgeneration', //채팅 문의 메시지 파일 다운로드 URL 생성 요청
32
+ CHAT_MESSAGE_WORKFLOW_START: '/chatctm/chi/chatinquiryworkflowprogress', // 채팅 문의 워크플로우 진행
33
+ CHAT_MESSAGE_WORKFLOW_BACK: '/chatctm/chi/chatinquiryworkflowrollback', // 채팅 문의 워크플로우 되돌리기
34
+ /* 유저 */
35
+ USER_INFO_UPDATE: '/chatctm/chi/individualinformationupdate', //개인 정보 업데이트
36
+ AGE_CHECK_UPDATE: '/chatctm/chi/ageconsentupdate', // 연령 동의 업데이트
37
+ /* 히스토리 */
38
+ HISTORY_PHONE_REQUEST: '/chatctm/his/occupancycertificationnumbersend', // 점유 인증 번호 요청
39
+ HISTORY_PHONE_AUTHENTICATION: '/chatctm/his/occupancycertificationnumberverification', // 점유 인증 번호 검증
40
+ HISTORY_LIST: '/chatctm/his/historychatinquirylistsearch', // 히스토리 채팅 문의 목록 조회
41
+ ATTEND_CHAT_BY_HISTORY: '/chatctm/his/historychatinquiryparticipation', // 채팅문의 참여
42
+ /* 팔로업 알림 인증 */
43
+ FOLLOWUP_ATTENTD: '/chatctm/chi/chatinquiryalarmparticipation' // 채팅 문의 알림 참여
44
+ };
45
+ // 메인
46
+ // 채팅 메시지 유형 상수
47
+ export const MESSAGE_TYPES = {
48
+ SYSTEM: 'MSP00100001',
49
+ BOT: 'MSP00100002',
50
+ CUSTOMER: 'MSP00100003',
51
+ OPERATOR: 'MSP00100004',
52
+ MACRO: 'MSP00100005'
53
+ };
54
+ // 재시도
55
+ function retryable(fn_1) {
56
+ return __awaiter(this, arguments, void 0, function* (fn, maxAttempts = 3, delayMs = 350, label = '') {
57
+ let attempt = 0;
58
+ while (attempt < maxAttempts) {
59
+ try {
60
+ return yield fn();
61
+ }
62
+ catch (error) {
63
+ attempt++;
64
+ console.warn(`[재시도] ${label} ${attempt}회 실패`, error);
65
+ if (attempt >= maxAttempts)
66
+ throw new Error(`${label} 최대 재시도 초과`);
67
+ yield new Promise(res => setTimeout(res, delayMs));
68
+ }
69
+ }
70
+ throw new Error(`${label} 실패`);
71
+ });
72
+ }
73
+ /**
74
+ * 쿠키 지원이 포함된 기본 fetch 함수
75
+ */
76
+ function fetchWithCookies(url_1) {
77
+ return __awaiter(this, arguments, void 0, function* (url, options = {}, version = DEFAULT_API_VERSION, timeoutMs = 10000 // ⏰ 기본 타임아웃 10초
78
+ ) {
79
+ var _a, _b, _c, _d, _e;
80
+ const headers = new Headers(options.headers || {});
81
+ if (!headers.has('Content-Type')) {
82
+ headers.set('Content-Type', 'application/json');
83
+ }
84
+ if (typeof window !== 'undefined') {
85
+ const AuthToken = localStorage.getItem('daeryunchatinquirytoken') || '';
86
+ if (AuthToken) {
87
+ headers.set('a', AuthToken);
88
+ }
89
+ }
90
+ headers.set('v', version);
91
+ const controller = new AbortController();
92
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
93
+ const mergedOptions = Object.assign(Object.assign({ credentials: 'include' }, options), { headers });
94
+ const isAuthRequest = url.includes(ENDPOINTS.AUTHENTICATE);
95
+ try {
96
+ const response = yield fetch(url, mergedOptions);
97
+ clearTimeout(timer); // ✅ 정상 응답이면 타이머 해제
98
+ const contentLength = response.headers.get('content-length');
99
+ const isEmpty = contentLength === '0';
100
+ let data = null;
101
+ try {
102
+ const text = yield response.clone().text();
103
+ if (text && text.trim()) {
104
+ data = JSON.parse(text);
105
+ }
106
+ }
107
+ catch (err) {
108
+ console.error(`[API 응답 파싱 실패] ${url}`, err);
109
+ }
110
+ if (!response.ok || (!isAuthRequest && ((_a = data === null || data === void 0 ? void 0 : data.result_info) === null || _a === void 0 ? void 0 : _a.result_type_cd) !== 'OK')) {
111
+ // 실패 응답도 서버에서 온 데이터 그대로 반환
112
+ return {
113
+ result_info: (_b = data === null || data === void 0 ? void 0 : data.result_info) !== null && _b !== void 0 ? _b : {
114
+ result_cd: String(response.status),
115
+ result_type_cd: 'ERROR',
116
+ result_msg: `${response.status} ${response.statusText}`
117
+ },
118
+ data: (_c = data === null || data === void 0 ? void 0 : data.data) !== null && _c !== void 0 ? _c : null
119
+ };
120
+ }
121
+ // 성공 응답 처리 (서버 값 그대로)
122
+ return {
123
+ result_info: (_d = data === null || data === void 0 ? void 0 : data.result_info) !== null && _d !== void 0 ? _d : {
124
+ result_cd: '200',
125
+ result_type_cd: 'OK',
126
+ result_msg: '성공'
127
+ },
128
+ data: (_e = data === null || data === void 0 ? void 0 : data.data) !== null && _e !== void 0 ? _e : {}
129
+ };
130
+ }
131
+ catch (error) {
132
+ console.error(`[API 호출 실패] ${url}`, error);
133
+ clearTimeout(timer); // 💡 에러 발생 시에도 타이머 정리
134
+ console.error(`[API 호출 실패] ${url}`, error);
135
+ return {
136
+ result_info: {
137
+ result_cd: 'FETCH_ERROR',
138
+ result_type_cd: 'ERROR',
139
+ result_msg: error instanceof DOMException && error.name === 'AbortError'
140
+ ? '요청 시간이 초과되었습니다.'
141
+ : error instanceof Error
142
+ ? error.message
143
+ : '알 수 없는 오류'
144
+ },
145
+ data: null
146
+ };
147
+ }
148
+ });
149
+ }
150
+ /**
151
+ * 사용자 인증
152
+ * @param version API 버전 (기본값: 1.0.0)
153
+ * @returns 인증 응답
154
+ */
155
+ export function authenticateUser(centerCode, version, retry) {
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ var _a;
158
+ try {
159
+ const body = {
160
+ d: {
161
+ center_code: centerCode
162
+ }
163
+ };
164
+ // 인증 API 호출
165
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.AUTHENTICATE}`, {
166
+ method: 'POST',
167
+ body: JSON.stringify(body)
168
+ }, version);
169
+ // 빈 응답인 경우에도 성공으로 처리 -> 이거 지워야함
170
+ // if (Object.keys(response).length === 0) {
171
+ // consoleFn('[인증 성공] 사용자 인증 완료 - 빈 응답 (쿠키만 설정됨)');
172
+ // return { success: true, status: 'authenticated' };
173
+ // }
174
+ if (typeof window !== 'undefined' && ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.token)) {
175
+ localStorage.setItem('daeryunchatinquirytoken', response.data.token);
176
+ }
177
+ consoleFn('[인증 성공] 사용자 인증 완료', response);
178
+ return response;
179
+ }
180
+ catch (error) {
181
+ console.error('[인증 실패] 사용자 인증 오류:', error);
182
+ throw error;
183
+ }
184
+ });
185
+ }
186
+ /**
187
+ * 웹소켓 연결 초기화
188
+ * @param version API 버전 (기본값: 1.0.0)
189
+ * @returns 연결 URL과 토큰이 포함된 웹소켓 초기화 데이터
190
+ */
191
+ export function initializeWebSocket(version) {
192
+ return __awaiter(this, void 0, void 0, function* () {
193
+ consoleFn('[웹소켓 초기화 시작] 웹소켓 연결 초기화 요청', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
194
+ try {
195
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.WEBSOCKET_INIT}`, { method: 'POST' }, version);
196
+ return response;
197
+ }
198
+ catch (error) {
199
+ console.error('[웹소켓 초기화 실패] 웹소켓 연결 초기화 오류:', error);
200
+ throw error;
201
+ }
202
+ });
203
+ }
204
+ /**
205
+ * 웹소켓 연결
206
+ * @param wsUrl 웹소켓 URL
207
+ * @param token 연결 토큰
208
+ * @param onMessage 메시지 핸들러
209
+ * @param onOpen 연결 열림 핸들러
210
+ * @param onClose 연결 닫힘 핸들러
211
+ * @param onError 오류 핸들러
212
+ * @returns 웹소켓 인스턴스
213
+ */
214
+ export function connectWebSocket(wsUrl, token, isOpen, setIsConnected, userExpiredRef, onMessage, onOpen, onClose, onError) {
215
+ // URL에 토큰을 파라미터로 추가
216
+ const connectionUrl = `${wsUrl}?token=${token}`;
217
+ consoleFn('[웹소켓 연결 시작] 연결 URL:', connectionUrl);
218
+ try {
219
+ const socket = new WebSocket(connectionUrl);
220
+ const setupSocketHandlers = (socket) => {
221
+ socket.onopen = event => {
222
+ consoleFn('[웹소켓 연결 성공]');
223
+ if (onOpen)
224
+ onOpen(event);
225
+ };
226
+ socket.onmessage = event => {
227
+ var _a;
228
+ consoleFn('[웹소켓 메시지 수신]', event.data);
229
+ try {
230
+ const data = JSON.parse(event.data);
231
+ if ((data === null || data === void 0 ? void 0 : data.type) === 'user.expired' || ((_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.type) === MessageSocketType.USER_EXPIRED) {
232
+ userExpiredRef && (userExpiredRef.current = true);
233
+ }
234
+ consoleFn('📩 New Message (parsed):', data);
235
+ }
236
+ catch (err) {
237
+ console.error('[웹소켓] JSON 파싱 오류:', err);
238
+ }
239
+ if (onMessage)
240
+ onMessage(event.data);
241
+ };
242
+ socket.onclose = (event) => __awaiter(this, void 0, void 0, function* () {
243
+ console.warn('[웹소켓 종료]', event);
244
+ consoleFn('userExpiredRef.current', userExpiredRef.current);
245
+ if (userExpiredRef.current) {
246
+ consoleFn('[웹소켓 종료] 만기 유저는 소켓 연결 재시도 하지 않음');
247
+ return;
248
+ }
249
+ // 재연결 로직 추가
250
+ if (onClose)
251
+ onClose(event);
252
+ });
253
+ socket.onerror = event => {
254
+ console.error('[웹소켓 오류]', event);
255
+ if (onError)
256
+ onError(event);
257
+ };
258
+ };
259
+ setupSocketHandlers(socket);
260
+ return socket;
261
+ }
262
+ catch (error) {
263
+ console.error('[웹소켓 연결 실패]', error);
264
+ throw error;
265
+ }
266
+ }
267
+ /**
268
+ * 채팅 문의 메인 조회
269
+ * @param channelNumber 전달받은 채널
270
+ * @param version API 버전 (기본값: 1.0.0)
271
+ * @returns 채팅 문의 메인 데이터
272
+ */
273
+ export function getChatInquiryMain(channelNumber, version) {
274
+ return __awaiter(this, void 0, void 0, function* () {
275
+ const body = {
276
+ d: {
277
+ channel_number: channelNumber
278
+ }
279
+ };
280
+ consoleFn('body', body);
281
+ consoleFn('[채팅 문의 메인 조회 시작] 채널 번호:', body.d.channel_number, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
282
+ try {
283
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_MAIN}`, {
284
+ method: 'POST',
285
+ body: JSON.stringify(body)
286
+ }, version);
287
+ consoleFn('[채팅 문의 메인 조회 성공]', response);
288
+ return response;
289
+ }
290
+ catch (error) {
291
+ console.error('[채팅 문의 메인 조회 실패]', error);
292
+ throw error;
293
+ }
294
+ });
295
+ }
296
+ /**
297
+ * 새 채팅 문의 생성 (개선된 API)
298
+ * @param channelNumber
299
+ * @param currentUrl
300
+ * @param version
301
+ */
302
+ export function generateChatInquiry(channelNumber, currentUrl, centerCode, version) {
303
+ return __awaiter(this, void 0, void 0, function* () {
304
+ var _a;
305
+ consoleFn('[새 채팅 문의 생성 시작 (개선)]', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
306
+ let channelId = channelNumber;
307
+ if (!channelNumber) {
308
+ const authRes = yield authenticateUser((_a = (centerCode || 'CT0000')) !== null && _a !== void 0 ? _a : 'CT0000', version);
309
+ channelId = authRes.data.channel_number;
310
+ }
311
+ const body = {
312
+ d: {
313
+ channel_number: channelId,
314
+ current_url: currentUrl
315
+ }
316
+ };
317
+ try {
318
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_GENERATION}`, {
319
+ method: 'POST',
320
+ body: JSON.stringify(body)
321
+ }, version);
322
+ consoleFn('[새 채팅 문의 생성 성공 (개선)] 문의 번호:', response.data.chat_inquiry_number);
323
+ return response;
324
+ }
325
+ catch (error) {
326
+ console.error('[새 채팅 문의 생성 실패 (개선)]', error);
327
+ throw error;
328
+ }
329
+ });
330
+ }
331
+ /**
332
+ * 채팅 문의 상세 조회 (개선된 API)
333
+ * @param chatInquiryNumber 채팅 문의 번호
334
+ * @param version API 버전 (기본값: 1.0.0)
335
+ * @returns 채팅 문의 상세 정보
336
+ */
337
+ export function getChatInquiryDetailNew(chat_inquiry_number, version) {
338
+ return __awaiter(this, void 0, void 0, function* () {
339
+ const body = {
340
+ d: {
341
+ chat_inquiry_number: chat_inquiry_number // 채팅문의 번호
342
+ }
343
+ };
344
+ consoleFn('[채팅 문의 상세 조회 시작 (개선)] 문의 번호:', chat_inquiry_number, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
345
+ try {
346
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_DETAIL_NEW}`, {
347
+ method: 'POST',
348
+ body: JSON.stringify(body)
349
+ }, version);
350
+ consoleFn('[채팅 문의 상세 조회 성공 (개선)]', response);
351
+ return response;
352
+ }
353
+ catch (error) {
354
+ console.error('[채팅 문의 상세 조회 실패 (개선)]', error);
355
+ throw error;
356
+ }
357
+ });
358
+ }
359
+ /**
360
+ * 채팅 메세지 목록 조회
361
+ * @param chatInquiryNumber 채팅 문의 번호
362
+ * @param standard_date_time 기준 일시
363
+ * @param size 사이즈
364
+ * @param version API 버전 (기본값: 1.0.0)
365
+ * @returns 채팅 메세지 리스트
366
+ */
367
+ export function getChatInquiryMessageList(chatInquiryNumber, standardTimestamp, size, version) {
368
+ return __awaiter(this, void 0, void 0, function* () {
369
+ const body = {
370
+ d: Object.assign(Object.assign({ chat_inquiry_number: chatInquiryNumber }, (standardTimestamp && { standard_timestamp: standardTimestamp })), { size: size !== null && size !== void 0 ? size : 400 })
371
+ };
372
+ consoleFn('[채팅 메세지 리스트] 문의 번호:', chatInquiryNumber, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
373
+ try {
374
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_INQUIRY_MESSAGE_LIST}`, {
375
+ method: 'POST',
376
+ body: JSON.stringify(body)
377
+ }, version);
378
+ consoleFn('[채팅 메세지 리스트]', response);
379
+ return response;
380
+ }
381
+ catch (error) {
382
+ console.error('[채팅 메세지 리스트]', error);
383
+ throw error;
384
+ }
385
+ });
386
+ }
387
+ /**
388
+ * Daeryuntalk 초기화 완료 흐름
389
+ * 이 함수는 인증부터 웹소켓 연결까지 완전한 흐름을 처리
390
+ * @param onWebSocketConnected 웹소켓 연결 시 콜백
391
+ * @param onWebSocketMessage 메시지 핸들러
392
+ * @param onWebSocketClose 웹소켓 종료 시 콜백
393
+ * @param onWebSocketError 웹소켓 오류 시 콜백
394
+ * @param version API 버전 (기본값: 1.0.0)
395
+ * @returns 웹소켓 인스턴스 및 문의 데이터
396
+ */
397
+ export function initializeDaeryuntalk(hashValue, isOpen, setIsConnected, isMobile, centerCode, userExpiredRef, onWebSocketConnected, onWebSocketMessage, onWebSocketClose, onWebSocketError, version) {
398
+ return __awaiter(this, void 0, void 0, function* () {
399
+ var _a, _b, _c, _d, _e, _f;
400
+ // if (typeof window !== 'undefined' && hashValue) {
401
+ // localStorage.removeItem('daeryunchatinquirytoken');
402
+ // }
403
+ consoleFn('[Daeryuntalk 초기화 시작] 전체 흐름 실행', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
404
+ try {
405
+ consoleFn('[Daeryuntalk 초기화] 전체 흐름 시작');
406
+ let errorData = null;
407
+ // 1단계: 사용자 인증
408
+ let authResponse = yield retryable(() => authenticateUser(centerCode, version), 1, 350, '사용자 인증');
409
+ consoleFn('authResponse11', authResponse);
410
+ // 9379809eec4c09ea276496b15b5d2778a2ef7af312c25d95bd2a0f884cb72bf3
411
+ // 만약 만료된 토큰이라면?
412
+ // consoleFn('authResponse', authResponse);
413
+ // consoleFn('ErrorEnum.CE_TOKEN_EXPIRED', ErrorEnum.CE_TOKEN_EXPIRED);
414
+ // consoleFn('authResponse?.result_info?.result_cd', authResponse?.result_info?.result_cd);
415
+ if (((_a = authResponse === null || authResponse === void 0 ? void 0 : authResponse.result_info) === null || _a === void 0 ? void 0 : _a.result_cd) === 'OK' || ((_b = authResponse === null || authResponse === void 0 ? void 0 : authResponse.result_info) === null || _b === void 0 ? void 0 : _b.result_type_cd) === 'OK') {
416
+ }
417
+ else {
418
+ if (((_c = authResponse === null || authResponse === void 0 ? void 0 : authResponse.result_info) === null || _c === void 0 ? void 0 : _c.result_cd) === ErrorEnum.CE_TOKEN_EXPIRED ||
419
+ ((_d = authResponse === null || authResponse === void 0 ? void 0 : authResponse.result_info) === null || _d === void 0 ? void 0 : _d.result_type_cd) === ErrorEnum.CE_TOKEN_EXPIRED) {
420
+ // 재인증 시작
421
+ errorData = authResponse;
422
+ consoleFn('재인증 시작');
423
+ localStorage.removeItem('daeryunchatinquirytoken');
424
+ authResponse = yield retryable(() => authenticateUser(centerCode, version, true), 3, 350, '사용자 인증');
425
+ }
426
+ else {
427
+ errorData = authResponse;
428
+ return {
429
+ inquiryData: null,
430
+ socket: null,
431
+ hashAuth: '',
432
+ errorCode: errorData
433
+ };
434
+ }
435
+ }
436
+ // 2단계: 웹소켓 초기화
437
+ const wsInitData = yield retryable(() => initializeWebSocket(version), 3, 350, '웹소켓 초기화');
438
+ if (!(((_e = authResponse === null || authResponse === void 0 ? void 0 : authResponse.result_info) === null || _e === void 0 ? void 0 : _e.result_cd) === 'OK' || ((_f = authResponse === null || authResponse === void 0 ? void 0 : authResponse.result_info) === null || _f === void 0 ? void 0 : _f.result_type_cd) === 'OK')) {
439
+ errorData = wsInitData;
440
+ return {
441
+ inquiryData: null,
442
+ socket: null,
443
+ hashAuth: '',
444
+ errorCode: errorData
445
+ };
446
+ }
447
+ // 3단계: 웹소켓 연결
448
+ const socket = yield retryable(() => new Promise((resolve, reject) => {
449
+ try {
450
+ const ws = connectWebSocket(wsInitData.data.connection_url, wsInitData.data.connection_token, isOpen, setIsConnected, userExpiredRef, onWebSocketMessage, () => {
451
+ consoleFn('[웹소켓 연결 성공]');
452
+ onWebSocketConnected === null || onWebSocketConnected === void 0 ? void 0 : onWebSocketConnected(ws);
453
+ resolve(ws);
454
+ }, (event) => {
455
+ // onClose
456
+ onWebSocketClose === null || onWebSocketClose === void 0 ? void 0 : onWebSocketClose(event);
457
+ }, (event) => {
458
+ // onError
459
+ console.error('[웹소켓 연결 실패]', event);
460
+ onWebSocketError === null || onWebSocketError === void 0 ? void 0 : onWebSocketError(event);
461
+ reject(new Error('웹소켓 연결 실패'));
462
+ });
463
+ }
464
+ catch (err) {
465
+ reject(err);
466
+ }
467
+ }), 3, 2000, '웹소켓 연결');
468
+ // 4단계: 해시 인증
469
+ let hashAuth = null;
470
+ if (hashValue) {
471
+ hashAuth = yield retryable(() => followupAttend({ token: hashValue }), 2, 1000, '해시 인증');
472
+ }
473
+ // 5단계: 문의 조회
474
+ const chatInquiryData = yield retryable(() => getChatInquiryMain(authResponse.data.channel_number, version), 2, 350, '채팅 문의 메인 조회');
475
+ consoleFn('[Daeryuntalk 초기화 완료]');
476
+ return {
477
+ inquiryData: chatInquiryData,
478
+ socket,
479
+ hashAuth,
480
+ errorCode: errorData
481
+ };
482
+ }
483
+ catch (error) {
484
+ console.error('[Daeryuntalk 초기화 실패] 오류 발생:', error);
485
+ throw error;
486
+ }
487
+ });
488
+ }
489
+ /**
490
+ * 채팅 워크플로우 진행 처리
491
+ *
492
+ * @param chatInquiryNumber 채팅 문의 번호 required
493
+ * @param messageNumber 메시지 번호 required
494
+ * @param workFlowNumber 워크플로우 번호 required
495
+ * @param objectNumber 오브젝트 번호 required
496
+ * @param version API 버전 (기본값: 1.0.0)
497
+ * @returns 전송된 메시지 데이터
498
+ */
499
+ export function chatWorkFlow(chatInquiryNumber, messageNumber, workFlowNumber, objectNumber, version) {
500
+ return __awaiter(this, void 0, void 0, function* () {
501
+ const body = {
502
+ d: {
503
+ chat_inquiry_number: chatInquiryNumber,
504
+ message_number: messageNumber,
505
+ work_flow_number: workFlowNumber,
506
+ object_number: objectNumber
507
+ }
508
+ };
509
+ consoleFn('[채팅 워크플로우 시작]', '문의 번호:', chatInquiryNumber, '메시지 번호:', messageNumber, '워크플로우 번호:', workFlowNumber, '오브젝트 번호:', objectNumber, version ? `버전: ${version}` : '기본 버전: 1.0.0');
510
+ try {
511
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_MESSAGE_WORKFLOW_START}`, {
512
+ method: 'POST',
513
+ body: JSON.stringify(body)
514
+ }, version);
515
+ consoleFn('[채팅 워크플로우 시작 성공]', response);
516
+ return response;
517
+ }
518
+ catch (error) {
519
+ console.error('[채팅 워크플로우 시작 실패]', error);
520
+ throw error;
521
+ }
522
+ });
523
+ }
524
+ /**
525
+ * 채팅 워크플로우 되돌리기
526
+ *
527
+ * @param chatInquiryNumber 채팅 문의 번호 required
528
+ * @param messageNumber 메시지 번호 required
529
+ * @param workFlowNavigationCode 워크플로우네비게이션코드 번호 required
530
+ * @param version API 버전 (기본값: 1.0.0)
531
+ * @returns 전송된 메시지 데이터
532
+ */
533
+ export function chatWorkFlowBack(chatInquiryNumber, messageNumber, workFlowNavigationCode, version) {
534
+ return __awaiter(this, void 0, void 0, function* () {
535
+ const body = {
536
+ d: {
537
+ chat_inquiry_number: chatInquiryNumber,
538
+ message_number: messageNumber,
539
+ work_flow_navigation_code: workFlowNavigationCode
540
+ }
541
+ };
542
+ consoleFn('[채팅 워크플로우 되돌리기 시작]', '문의 번호:', chatInquiryNumber, '메시지 번호:', messageNumber, '워크플로우네비게이션코드 번호:', workFlowNavigationCode, version ? `버전: ${version}` : '기본 버전: 1.0.0');
543
+ try {
544
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_MESSAGE_WORKFLOW_BACK}`, {
545
+ method: 'POST',
546
+ body: JSON.stringify(body)
547
+ }, version);
548
+ consoleFn('[채팅 워크플로우 되돌리기 성공]', response);
549
+ return response;
550
+ }
551
+ catch (error) {
552
+ console.error('[채팅 워크플로우 되돌리기 실패]', error);
553
+ throw error;
554
+ }
555
+ });
556
+ }
557
+ /**
558
+ * 채팅 메시지 전송
559
+ * @param chatInquiryNumber 채팅 문의 번호
560
+ * @param messageText 메시지 내용
561
+ * @param version API 버전 (기본값: 1.0.0)
562
+ * @returns 전송된 메시지 데이터
563
+ */
564
+ export function sendChatMessage(chatInquiryNumber, htmlContent, jsonData, version) {
565
+ return __awaiter(this, void 0, void 0, function* () {
566
+ if (!chatInquiryNumber) {
567
+ throw new Error('채팅 메시지 전송 실패: 문의 번호가 없음');
568
+ }
569
+ if (!htmlContent) {
570
+ throw new Error('채팅 메시지 전송 실패: 메시지가 없음');
571
+ }
572
+ if (!jsonData) {
573
+ throw new Error('채팅 메시지 전송 실패: json 데이터 없음');
574
+ }
575
+ const body = {
576
+ d: {
577
+ chat_inquiry_number: chatInquiryNumber, // required
578
+ html_content: htmlContent, // required, tiptap html
579
+ json_data: jsonData // required, tiptab json
580
+ }
581
+ };
582
+ consoleFn('[채팅 메시지 전송 시작] 문의 번호:', chatInquiryNumber, '메시지:', htmlContent, version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
583
+ try {
584
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_MESSAGE_SEND}`, {
585
+ method: 'POST',
586
+ body: JSON.stringify(body)
587
+ }, version);
588
+ consoleFn('[채팅 메시지 전송 성공]', response);
589
+ return response;
590
+ }
591
+ catch (error) {
592
+ console.error('[채팅 메시지 전송 실패]', error);
593
+ throw error;
594
+ }
595
+ });
596
+ }
597
+ /**
598
+ * 채팅 개인 정보 업데이트
599
+ * @param chatInquiryNumber 채팅 문의 번호
600
+ * @param messageNumber 해당 채팅 번호
601
+ * @param name 이름
602
+ * @param cellPhoneNumber 전화번호
603
+ * @param version API 버전 (기본값: 1.0.0)
604
+ * @returns 전송된 메시지 데이터
605
+ */
606
+ export function chatUserUpdate(chatInquiryNumber, messageNumber, name, cellPhoneNumber, version) {
607
+ return __awaiter(this, void 0, void 0, function* () {
608
+ const body = {
609
+ d: {
610
+ chat_inquiry_number: chatInquiryNumber, // required
611
+ message_number: messageNumber, // required
612
+ name: name, // required
613
+ cell_phone_number: cellPhoneNumber // required
614
+ }
615
+ };
616
+ consoleFn('[채팅 개인 정보 업데이트] 시작');
617
+ try {
618
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.USER_INFO_UPDATE}`, {
619
+ method: 'POST',
620
+ body: JSON.stringify(body)
621
+ }, version);
622
+ consoleFn('[채팅 메시지 전송 성공]', response);
623
+ return response;
624
+ }
625
+ catch (error) {
626
+ console.error('[채팅 메시지 전송 실패]', error);
627
+ throw error;
628
+ }
629
+ });
630
+ }
631
+ export function ageCheckUpdate(chatInquiryNumber, ageConsentStateCode, version) {
632
+ return __awaiter(this, void 0, void 0, function* () {
633
+ const body = {
634
+ d: {
635
+ chat_inquiry_number: chatInquiryNumber,
636
+ age_consent_state_code: ageConsentStateCode // AGE00100001(미동의), AGE00100002(동의)
637
+ }
638
+ };
639
+ consoleFn('[채팅 연령 동의 업데이트] 시작');
640
+ try {
641
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.AGE_CHECK_UPDATE}`, {
642
+ method: 'POST',
643
+ body: JSON.stringify(body)
644
+ }, version);
645
+ consoleFn('[채팅 연령 동의 업데이트 성공]', response);
646
+ return response;
647
+ }
648
+ catch (error) {
649
+ console.error('[채팅 연령 동의 업데이트 실패]', error);
650
+ throw error;
651
+ }
652
+ });
653
+ }
654
+ /**
655
+ * 채팅문의 메시지 파일 다운로드 URL 생성
656
+ * @param chatInquiryNumber 채팅문의번호
657
+ * @param fileNumber 파일번호
658
+ * @param version
659
+ */
660
+ export const getMessageFileDownloadUrl = (_a) => __awaiter(void 0, [_a], void 0, function* ({ chatInquiryNumber, fileNumber, version = DEFAULT_API_VERSION }) {
661
+ const consoleName = '채팅문의 메시지 파일 다운로드 URL 생성';
662
+ try {
663
+ const body = {
664
+ d: {
665
+ chat_inquiry_number: chatInquiryNumber, // required
666
+ file_number: fileNumber // required
667
+ }
668
+ };
669
+ consoleFn(`[${consoleName} 진행]`);
670
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.CHAT_MESSAGE_FILE_URL_REQUEST}`, {
671
+ method: 'POST',
672
+ body: JSON.stringify(body)
673
+ }, version);
674
+ consoleFn(`[${consoleName} 완료]`, response);
675
+ return response;
676
+ }
677
+ catch (error) {
678
+ console.error(`[${consoleName} 실패] 오류:`, error);
679
+ throw error;
680
+ }
681
+ });
682
+ // /* 히스토리 */
683
+ // HISTORY_PHONE_REQUEST: '/chatctm/his/occupancycertificationnumbersend', // 점유 인증 번호 요청
684
+ // HISTORY_PHONE_AUTHENTICATION: '/chatctm/his/occupancycertificationnumberverification', // 점유 인증 번호 검증
685
+ // HISTORY_LIST: '/chatctm/his/historychatinquirylistsearch' // 히스토리 채팅 문의 목록 조회
686
+ /**
687
+ * 점유 인증 번호 요청
688
+ * @param name
689
+ * @param cellPhoneNumber
690
+ * @param version
691
+ */
692
+ export const requestPhone = (_a) => __awaiter(void 0, [_a], void 0, function* ({ name, cellPhoneNumber, version = DEFAULT_API_VERSION }) {
693
+ const consoleName = '점유 인증 번호 요청';
694
+ try {
695
+ const body = {
696
+ d: {
697
+ name: name, // required
698
+ cell_phone_number: cellPhoneNumber // required
699
+ }
700
+ };
701
+ consoleFn(`[${consoleName} 진행]`);
702
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.HISTORY_PHONE_REQUEST}`, {
703
+ method: 'POST',
704
+ body: JSON.stringify(body)
705
+ }, version);
706
+ consoleFn(`[${consoleName} 완료]`, response);
707
+ return response;
708
+ }
709
+ catch (error) {
710
+ console.error(`[${consoleName} 실패] 오류:`, error);
711
+ throw error;
712
+ }
713
+ });
714
+ /**
715
+ * 점유 인증 번호 검증
716
+ * @param name
717
+ * @param cellPhoneNumber
718
+ * @param certificationNumber
719
+ * @param version
720
+ */
721
+ export const historyPhoneAuth = (_a) => __awaiter(void 0, [_a], void 0, function* ({ name, cellPhoneNumber, certificationNumber, version = DEFAULT_API_VERSION }) {
722
+ const consoleName = '점유 인증 번호 검증';
723
+ try {
724
+ const body = {
725
+ d: {
726
+ name: name, // required
727
+ cell_phone_number: cellPhoneNumber, // required
728
+ certification_number: certificationNumber // required
729
+ }
730
+ };
731
+ consoleFn(`[${consoleName} 진행]`);
732
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.HISTORY_PHONE_AUTHENTICATION}`, {
733
+ method: 'POST',
734
+ body: JSON.stringify(body)
735
+ }, version);
736
+ consoleFn(`[${consoleName} 완료]`, response);
737
+ return response;
738
+ }
739
+ catch (error) {
740
+ console.error(`[${consoleName} 실패] 오류:`, error);
741
+ throw error;
742
+ }
743
+ });
744
+ export const getHistoryList = (_a) => __awaiter(void 0, [_a], void 0, function* ({ version = DEFAULT_API_VERSION }) {
745
+ const consoleName = '히스토리 채팅 문의 목록 조회';
746
+ try {
747
+ consoleFn(`[${consoleName} 진행]`);
748
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.HISTORY_LIST}`, {
749
+ method: 'POST'
750
+ // body: JSON.stringify(body)
751
+ }, version);
752
+ consoleFn(`[${consoleName} 완료]`, response);
753
+ return response;
754
+ }
755
+ catch (error) {
756
+ console.error(`[${consoleName} 실패] 오류:`, error);
757
+ throw error;
758
+ }
759
+ });
760
+ export const attendChatRoomByHistory = (_a) => __awaiter(void 0, [_a], void 0, function* ({ chatInquiryNumber, version = DEFAULT_API_VERSION }) {
761
+ const consoleName = '히스토리 채팅 문의 참여';
762
+ try {
763
+ consoleFn(`[${consoleName} 진행]`);
764
+ const body = {
765
+ d: {
766
+ chat_inquiry_number: chatInquiryNumber // required
767
+ }
768
+ };
769
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.ATTEND_CHAT_BY_HISTORY}`, {
770
+ method: 'POST',
771
+ body: JSON.stringify(body)
772
+ }, version);
773
+ consoleFn(`[${consoleName} 완료]`, response);
774
+ return response;
775
+ }
776
+ catch (error) {
777
+ console.error(`[${consoleName} 실패] 오류:`, error);
778
+ throw error;
779
+ }
780
+ });
781
+ export const followupAttend = (_a) => __awaiter(void 0, [_a], void 0, function* ({ token, version = DEFAULT_API_VERSION }) {
782
+ const consoleName = '히스토리 채팅 문의 참여';
783
+ try {
784
+ consoleFn(`[${consoleName} 진행]`);
785
+ const body = {
786
+ d: {
787
+ token: token // required
788
+ }
789
+ };
790
+ const response = yield fetchWithCookies(`${API_BASE_URL}${ENDPOINTS.FOLLOWUP_ATTENTD}`, {
791
+ method: 'POST',
792
+ body: JSON.stringify(body)
793
+ }, version);
794
+ consoleFn(`[${consoleName} 완료]`, response);
795
+ return response;
796
+ }
797
+ catch (error) {
798
+ console.error(`[${consoleName} 실패] 오류:`, error);
799
+ throw error;
800
+ }
801
+ });