@daeryun/dr_components 0.8.79 → 0.8.82
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.
- package/dist/components/Daeryuntalk/ChatConversation.jsx +3 -3
- package/dist/components/Daeryuntalk/ChatConversation.tsx +3 -2
- package/dist/components/Daeryuntalk/ChatHomeView.jsx +15 -5
- package/dist/components/Daeryuntalk/ChatHomeView.tsx +24 -11
- package/dist/components/Daeryuntalk/ChatInput.jsx +15 -4
- package/dist/components/Daeryuntalk/ChatInput.tsx +17 -5
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatItem/ChatFile.tsx +1 -1
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.d.ts +3 -1
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.jsx +174 -3
- package/dist/components/Daeryuntalk/ChatItem/WorkFlowImg.tsx +211 -3
- package/dist/components/Daeryuntalk/ChatMessage.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatMessage.jsx +11 -6
- package/dist/components/Daeryuntalk/ChatMessage.tsx +14 -6
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.jsx +4 -2
- package/dist/components/Daeryuntalk/ChatObject/ObjectButton.tsx +6 -4
- package/dist/components/Daeryuntalk/ChatWidget.d.ts +1 -0
- package/dist/components/Daeryuntalk/ChatWidget.jsx +1 -1
- package/dist/components/Daeryuntalk/ChatWidget.tsx +10 -2
- package/dist/components/Daeryuntalk/DaeryuntalkContext.d.ts +1 -0
- package/dist/components/Daeryuntalk/DaeryuntalkContext.jsx +5 -3
- package/dist/components/Daeryuntalk/DaeryuntalkContext.tsx +7 -3
- package/dist/components/Daeryuntalk/HistoryView.jsx +1 -2
- package/dist/components/Daeryuntalk/HistoryView.tsx +1 -1
- package/dist/components/Daeryuntalk/HomeView.jsx +4 -9
- package/dist/components/Daeryuntalk/HomeView.tsx +9 -9
- package/dist/components/Daeryuntalk/NavigationFooter.jsx +1 -1
- package/dist/components/Daeryuntalk/NavigationFooter.tsx +1 -1
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.d.ts +2 -1
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.jsx +38 -5
- package/dist/components/Daeryuntalk/Tiptap/Tiptap.tsx +48 -9
- package/dist/components/Daeryuntalk/Toast/DaeryuntalkToastProvider.d.ts +2 -1
- package/dist/components/Daeryuntalk/Toast/DaeryuntalkToastProvider.jsx +18 -7
- package/dist/components/Daeryuntalk/Toast/DaeryuntalkToastProvider.tsx +24 -8
- package/dist/components/Daeryuntalk/Toast/ToastRender.jsx +9 -3
- package/dist/components/Daeryuntalk/Toast/ToastRender.tsx +10 -6
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.jsx +6 -8
- package/dist/components/Daeryuntalk/Viewer/ImageViewer.tsx +7 -10
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.d.ts +2 -0
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.jsx +52 -19
- package/dist/components/Daeryuntalk/Viewer/MobileViewer.tsx +89 -43
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.d.ts +2 -0
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.jsx +35 -5
- package/dist/components/Daeryuntalk/Viewer/TbPcViewer.tsx +57 -21
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.d.ts +1 -0
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.js +14 -12
- package/dist/components/Daeryuntalk/_api/daeryuntalk/index.ts +9 -8
- package/dist/components/Daeryuntalk/_enums/error.js +119 -111
- package/dist/components/Daeryuntalk/_enums/error.ts +135 -127
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.d.ts +1 -0
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.js +8 -2
- package/dist/components/Daeryuntalk/_hooks/talkprovider/useSocketEventHandler.ts +10 -2
- package/dist/components/Daeryuntalk/_hooks/view/useHomeView.js +1 -0
- package/dist/components/Daeryuntalk/_hooks/view/useHomeView.ts +1 -0
- package/dist/components/Daeryuntalk/_lib/utils.d.ts +2 -0
- package/dist/components/Daeryuntalk/_lib/utils.js +12 -0
- package/dist/components/Daeryuntalk/_lib/utils.ts +15 -0
- package/dist/components/Daeryuntalk/_types/message.d.ts +1 -1
- package/dist/components/Daeryuntalk/_types/message.js +6 -1
- package/dist/components/Daeryuntalk/_types/message.ts +7 -1
- package/dist/components/Daeryuntalk/index.jsx +34 -5
- package/dist/components/Daeryuntalk/index.tsx +37 -6
- package/dist/styles/globals.css +30 -24
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Dispatch, SetStateAction } from 'react';
|
|
1
|
+
import React, { Dispatch, SetStateAction, useRef } from 'react';
|
|
2
2
|
import DaeryunLogoIcon from '../../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
3
3
|
import { formatDateToKorean } from '../_lib/utils';
|
|
4
4
|
import DownloadIcon from '../../../asset/images/daeryuntalk/download.svg';
|
|
@@ -6,6 +6,11 @@ import { Message } from '../_types/message';
|
|
|
6
6
|
import Image from 'next/image';
|
|
7
7
|
import CloseIcon from '../../../asset/images/daeryuntalk/viewer/close.svg';
|
|
8
8
|
import { PreviewImage } from './ImageViewer';
|
|
9
|
+
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
10
|
+
import { Swiper as SwiperClass } from 'swiper';
|
|
11
|
+
|
|
12
|
+
import 'swiper/css';
|
|
13
|
+
import 'swiper/css/navigation';
|
|
9
14
|
interface IMobileViewerProps {
|
|
10
15
|
imageViewerMessage?: Message | null;
|
|
11
16
|
handleDownload: () => void;
|
|
@@ -28,6 +33,8 @@ const MobileViewer = ({
|
|
|
28
33
|
setRotation,
|
|
29
34
|
setZoomLevel
|
|
30
35
|
}: IMobileViewerProps) => {
|
|
36
|
+
const thumbSwiperRef = useRef<SwiperClass | null>(null);
|
|
37
|
+
|
|
31
38
|
return (
|
|
32
39
|
<div className={`md2:hidden`}>
|
|
33
40
|
<div className="flex h-[68px] w-full items-center justify-between bg-black/90 p-[20px] text-white">
|
|
@@ -62,54 +69,93 @@ const MobileViewer = ({
|
|
|
62
69
|
<div
|
|
63
70
|
className={`mx-[20px] flex h-[calc(100dvh-68px-155px)] flex-col items-center justify-center overflow-auto`}
|
|
64
71
|
>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
<div className="group relative flex w-full items-center justify-center overflow-auto">
|
|
73
|
+
<Swiper
|
|
74
|
+
spaceBetween={0}
|
|
75
|
+
slidesPerView={1}
|
|
76
|
+
initialSlide={currentIndex}
|
|
77
|
+
onSlideChange={swiper => {
|
|
78
|
+
setCurrentIndex(swiper.activeIndex);
|
|
79
|
+
setRotation(0);
|
|
80
|
+
setZoomLevel(3);
|
|
81
|
+
}}
|
|
82
|
+
onSwiper={swiper => {
|
|
83
|
+
thumbSwiperRef.current = swiper;
|
|
84
|
+
}}
|
|
85
|
+
allowTouchMove={previewImages.length > 1}
|
|
86
|
+
className="w-full"
|
|
87
|
+
>
|
|
88
|
+
{previewImages.map((img, idx) => (
|
|
89
|
+
<SwiperSlide key={idx} className="flex items-center justify-center rounded-[20px] ">
|
|
90
|
+
<div className="relative flex h-auto max-h-[500px] items-center justify-center rounded-[20px]">
|
|
91
|
+
<Image
|
|
92
|
+
src={img.url}
|
|
93
|
+
alt={img.file.name}
|
|
94
|
+
width={500}
|
|
95
|
+
height={500}
|
|
96
|
+
className="mx-auto h-auto max-h-[500px] w-fit max-w-full rounded-[20px] object-contain"
|
|
97
|
+
unoptimized
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
</SwiperSlide>
|
|
101
|
+
))}
|
|
102
|
+
</Swiper>
|
|
83
103
|
</div>
|
|
84
|
-
{/* 여기는 하단 고정 */}
|
|
85
104
|
</div>
|
|
105
|
+
{/*<div*/}
|
|
106
|
+
{/* className={`mx-[20px] flex h-[calc(100dvh-68px-155px)] flex-col items-center justify-center overflow-auto`}*/}
|
|
107
|
+
{/*>*/}
|
|
108
|
+
{/* <div className="group relative flex items-center justify-center overflow-auto">*/}
|
|
109
|
+
{/* <div className="relative h-auto max-h-[500px] w-full">*/}
|
|
110
|
+
{/* <Image*/}
|
|
111
|
+
{/* src={currentImage.url}*/}
|
|
112
|
+
{/* alt={currentImage.file.name}*/}
|
|
113
|
+
{/* width={500}*/}
|
|
114
|
+
{/* height={500}*/}
|
|
115
|
+
{/* className="h-auto w-full rounded-[20px] object-contain"*/}
|
|
116
|
+
{/* unoptimized*/}
|
|
117
|
+
{/* />*/}
|
|
118
|
+
{/* </div>*/}
|
|
119
|
+
{/* </div>*/}
|
|
120
|
+
{/*</div>*/}
|
|
86
121
|
{/* Thumbnail Preview */}
|
|
87
|
-
<div className=
|
|
122
|
+
<div className="relative flex items-center justify-center px-[20px] pb-[65px] pt-[40px]">
|
|
88
123
|
{previewImages.length > 1 ? (
|
|
89
|
-
<
|
|
124
|
+
<Swiper
|
|
125
|
+
spaceBetween={10}
|
|
126
|
+
slidesPerView={Math.min(previewImages.length, 5)}
|
|
127
|
+
watchSlidesProgress
|
|
128
|
+
allowTouchMove
|
|
129
|
+
>
|
|
90
130
|
{previewImages.map((img, idx) => (
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
131
|
+
<SwiperSlide key={idx} className={`!w-fit`}>
|
|
132
|
+
<div
|
|
133
|
+
onClick={() => {
|
|
134
|
+
setCurrentIndex(idx);
|
|
135
|
+
setRotation(0);
|
|
136
|
+
setZoomLevel(3);
|
|
137
|
+
thumbSwiperRef.current?.slideTo(idx); // 👈 스와이퍼 이동
|
|
138
|
+
}}
|
|
139
|
+
className={`
|
|
140
|
+
relative
|
|
141
|
+
h-[50px] w-[50px] cursor-pointer overflow-hidden rounded-[10px] border-[1px]
|
|
142
|
+
${idx === currentIndex ? 'border-white' : 'opacity-50 hover:border-white hover:opacity-100'}
|
|
143
|
+
`}
|
|
144
|
+
>
|
|
145
|
+
{/*<div className={`absolute left-0 top-0 bg-yellow-200 !text-black`}>{idx}</div>*/}
|
|
146
|
+
|
|
147
|
+
<Image
|
|
148
|
+
src={img.file.thumbnailUrl}
|
|
149
|
+
alt={img.file.name}
|
|
150
|
+
width={200}
|
|
151
|
+
height={200}
|
|
152
|
+
className="h-full w-full object-cover"
|
|
153
|
+
unoptimized
|
|
154
|
+
/>
|
|
155
|
+
</div>
|
|
156
|
+
</SwiperSlide>
|
|
111
157
|
))}
|
|
112
|
-
</
|
|
158
|
+
</Swiper>
|
|
113
159
|
) : (
|
|
114
160
|
<div></div>
|
|
115
161
|
)}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { Message } from '../_types/message';
|
|
3
3
|
import { PreviewImage } from './ImageViewer';
|
|
4
|
+
import 'swiper/css';
|
|
5
|
+
import 'swiper/css/navigation';
|
|
4
6
|
interface ITbPcViewerProps {
|
|
5
7
|
imageViewerMessage?: Message | null;
|
|
6
8
|
handleDownload: () => void;
|
|
@@ -9,6 +9,9 @@ import CloseIcon from '../../../asset/images/daeryuntalk/viewer/close.svg';
|
|
|
9
9
|
import MoveSwipingIcon from '../../../asset/images/daeryuntalk/viewer/move-button.svg';
|
|
10
10
|
import DaeryunLogoIcon from '../../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
11
11
|
import { formatDateToKorean } from '../_lib/utils';
|
|
12
|
+
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
13
|
+
import 'swiper/css';
|
|
14
|
+
import 'swiper/css/navigation';
|
|
12
15
|
const TbPcViewer = ({ imageViewerMessage, handleDownload, currentIndex, setCurrentIndex, rotation, currentZoom, currentImage, closeImageViewer, previewImages, setRotation, setZoomLevel, rotateImage, zoomIn, zoomOut, zoomLevel }) => {
|
|
13
16
|
return (<div className={`hidden md2:block`}>
|
|
14
17
|
<div className={`flex h-[100dvh] flex-col items-center justify-center gap-[60px] px-[88px]`}>
|
|
@@ -92,14 +95,41 @@ const TbPcViewer = ({ imageViewerMessage, handleDownload, currentIndex, setCurre
|
|
|
92
95
|
|
|
93
96
|
{/* Thumbnail Preview - 고정된 위치 */}
|
|
94
97
|
{previewImages.length > 1 && (<div className="flex w-full max-w-[90vw] flex-row justify-center gap-[10px] overflow-x-auto px-[20px] md2:w-[830px]">
|
|
95
|
-
|
|
98
|
+
<Swiper spaceBetween={10} slidesPerView={Math.min(previewImages.length, 5)} watchSlidesProgress allowTouchMove>
|
|
99
|
+
{previewImages.map((img, idx) => (<SwiperSlide key={idx} className={`!w-fit`}>
|
|
100
|
+
<div onClick={() => {
|
|
96
101
|
setCurrentIndex(idx);
|
|
97
102
|
setRotation(0);
|
|
98
103
|
setZoomLevel(3);
|
|
99
|
-
}} className={`
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
}} className={`
|
|
105
|
+
h-[60px] w-[96px] shrink-0 cursor-pointer overflow-hidden rounded-[10px] border-[1px]
|
|
106
|
+
${idx === currentIndex ? 'border-white' : 'border-transparent opacity-50 hover:opacity-100'}
|
|
107
|
+
`}>
|
|
108
|
+
<Image src={img.file.thumbnailUrl} alt={img.file.name} width={96} height={60} className="h-full w-full object-cover" unoptimized/>
|
|
109
|
+
</div>
|
|
110
|
+
</SwiperSlide>))}
|
|
111
|
+
</Swiper>
|
|
112
|
+
{/*{previewImages.map((img, idx) => (*/}
|
|
113
|
+
{/* <div*/}
|
|
114
|
+
{/* key={img.file.fileNumber}*/}
|
|
115
|
+
{/* onClick={() => {*/}
|
|
116
|
+
{/* setCurrentIndex(idx);*/}
|
|
117
|
+
{/* setRotation(0);*/}
|
|
118
|
+
{/* setZoomLevel(3);*/}
|
|
119
|
+
{/* }}*/}
|
|
120
|
+
{/* className={`h-[60px] w-[96px] shrink-0 cursor-pointer overflow-hidden rounded-[10px] border-[1px]*/}
|
|
121
|
+
{/* ${idx === currentIndex ? 'border-white' : 'border-transparent opacity-50 hover:opacity-100'}`}*/}
|
|
122
|
+
{/* >*/}
|
|
123
|
+
{/* <Image*/}
|
|
124
|
+
{/* src={img.file.thumbnailUrl}*/}
|
|
125
|
+
{/* alt={img.file.name}*/}
|
|
126
|
+
{/* width={96}*/}
|
|
127
|
+
{/* height={60}*/}
|
|
128
|
+
{/* className="h-full w-full object-cover"*/}
|
|
129
|
+
{/* unoptimized*/}
|
|
130
|
+
{/* />*/}
|
|
131
|
+
{/* </div>*/}
|
|
132
|
+
{/*))}*/}
|
|
103
133
|
</div>)}
|
|
104
134
|
</div>
|
|
105
135
|
</div>);
|
|
@@ -10,6 +10,11 @@ import CloseIcon from '../../../asset/images/daeryuntalk/viewer/close.svg';
|
|
|
10
10
|
import MoveSwipingIcon from '../../../asset/images/daeryuntalk/viewer/move-button.svg';
|
|
11
11
|
import DaeryunLogoIcon from '../../../asset/images/daeryuntalk/daeryun-logo.svg';
|
|
12
12
|
import { formatDateToKorean } from '../_lib/utils';
|
|
13
|
+
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
14
|
+
import { Swiper as SwiperClass } from 'swiper';
|
|
15
|
+
|
|
16
|
+
import 'swiper/css';
|
|
17
|
+
import 'swiper/css/navigation';
|
|
13
18
|
|
|
14
19
|
interface ITbPcViewerProps {
|
|
15
20
|
imageViewerMessage?: Message | null;
|
|
@@ -165,27 +170,58 @@ const TbPcViewer = ({
|
|
|
165
170
|
{/* Thumbnail Preview - 고정된 위치 */}
|
|
166
171
|
{previewImages.length > 1 && (
|
|
167
172
|
<div className="flex w-full max-w-[90vw] flex-row justify-center gap-[10px] overflow-x-auto px-[20px] md2:w-[830px]">
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
173
|
+
<Swiper
|
|
174
|
+
spaceBetween={10}
|
|
175
|
+
slidesPerView={Math.min(previewImages.length, 5)}
|
|
176
|
+
watchSlidesProgress
|
|
177
|
+
allowTouchMove
|
|
178
|
+
>
|
|
179
|
+
{previewImages.map((img, idx) => (
|
|
180
|
+
<SwiperSlide key={idx} className={`!w-fit`}>
|
|
181
|
+
<div
|
|
182
|
+
onClick={() => {
|
|
183
|
+
setCurrentIndex(idx);
|
|
184
|
+
setRotation(0);
|
|
185
|
+
setZoomLevel(3);
|
|
186
|
+
}}
|
|
187
|
+
className={`
|
|
188
|
+
h-[60px] w-[96px] shrink-0 cursor-pointer overflow-hidden rounded-[10px] border-[1px]
|
|
189
|
+
${idx === currentIndex ? 'border-white' : 'border-transparent opacity-50 hover:opacity-100'}
|
|
190
|
+
`}
|
|
191
|
+
>
|
|
192
|
+
<Image
|
|
193
|
+
src={img.file.thumbnailUrl}
|
|
194
|
+
alt={img.file.name}
|
|
195
|
+
width={96}
|
|
196
|
+
height={60}
|
|
197
|
+
className="h-full w-full object-cover"
|
|
198
|
+
unoptimized
|
|
199
|
+
/>
|
|
200
|
+
</div>
|
|
201
|
+
</SwiperSlide>
|
|
202
|
+
))}
|
|
203
|
+
</Swiper>
|
|
204
|
+
{/*{previewImages.map((img, idx) => (*/}
|
|
205
|
+
{/* <div*/}
|
|
206
|
+
{/* key={img.file.fileNumber}*/}
|
|
207
|
+
{/* onClick={() => {*/}
|
|
208
|
+
{/* setCurrentIndex(idx);*/}
|
|
209
|
+
{/* setRotation(0);*/}
|
|
210
|
+
{/* setZoomLevel(3);*/}
|
|
211
|
+
{/* }}*/}
|
|
212
|
+
{/* className={`h-[60px] w-[96px] shrink-0 cursor-pointer overflow-hidden rounded-[10px] border-[1px]*/}
|
|
213
|
+
{/* ${idx === currentIndex ? 'border-white' : 'border-transparent opacity-50 hover:opacity-100'}`}*/}
|
|
214
|
+
{/* >*/}
|
|
215
|
+
{/* <Image*/}
|
|
216
|
+
{/* src={img.file.thumbnailUrl}*/}
|
|
217
|
+
{/* alt={img.file.name}*/}
|
|
218
|
+
{/* width={96}*/}
|
|
219
|
+
{/* height={60}*/}
|
|
220
|
+
{/* className="h-full w-full object-cover"*/}
|
|
221
|
+
{/* unoptimized*/}
|
|
222
|
+
{/* />*/}
|
|
223
|
+
{/* </div>*/}
|
|
224
|
+
{/*))}*/}
|
|
189
225
|
</div>
|
|
190
226
|
)}
|
|
191
227
|
</div>
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { IDaeryunTalkResponseWrapper, WebSocketInitDataResponse, IChatInquiryMainDataResponse, ChatInquiryCreateDataResponse, ChatInquiryDetailDataResponse, SendMessageResponse, ChatInquiryMessageListDataResponse, HistoryListResponse, RequestConfirmNumberResponse } from './type/response';
|
|
11
11
|
import { Dispatch, SetStateAction } from 'react';
|
|
12
12
|
export declare const DEFAULT_API_VERSION = "1.0.0";
|
|
13
|
+
export declare const TEST_CENTER_CODE: string;
|
|
13
14
|
export declare const MESSAGE_TYPES: {
|
|
14
15
|
SYSTEM: string;
|
|
15
16
|
BOT: string;
|
|
@@ -39,7 +39,7 @@ const ENDPOINTS = {
|
|
|
39
39
|
FOLLOWUP_ATTENTD: '/chatctm/chi/chatinquiryalarmparticipation' // 채팅 문의 알림 참여
|
|
40
40
|
};
|
|
41
41
|
// 메인
|
|
42
|
-
const TEST_CENTER_CODE = 'CT0000';
|
|
42
|
+
export const TEST_CENTER_CODE = 'CT0000';
|
|
43
43
|
// 채팅 메시지 유형 상수
|
|
44
44
|
export const MESSAGE_TYPES = {
|
|
45
45
|
SYSTEM: 'MSP00100001',
|
|
@@ -142,8 +142,6 @@ function fetchWithCookies(url_1) {
|
|
|
142
142
|
export function authenticateUser(centerCode, version, retry) {
|
|
143
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
144
|
var _a;
|
|
145
|
-
console.log('retry', retry);
|
|
146
|
-
console.log('[인증 시작] 사용자 인증 요청', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
147
145
|
try {
|
|
148
146
|
const body = {
|
|
149
147
|
d: {
|
|
@@ -316,9 +314,14 @@ export function getChatInquiryMain(channelNumber, version) {
|
|
|
316
314
|
export function generateChatInquiry(channelNumber, currentUrl, version) {
|
|
317
315
|
return __awaiter(this, void 0, void 0, function* () {
|
|
318
316
|
console.log('[새 채팅 문의 생성 시작 (개선)]', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
317
|
+
let channelId = channelNumber;
|
|
318
|
+
if (!channelNumber) {
|
|
319
|
+
const authRes = yield authenticateUser(TEST_CENTER_CODE, version);
|
|
320
|
+
channelId = authRes.data.channel_number;
|
|
321
|
+
}
|
|
319
322
|
const body = {
|
|
320
323
|
d: {
|
|
321
|
-
channel_number:
|
|
324
|
+
channel_number: channelId,
|
|
322
325
|
current_url: currentUrl
|
|
323
326
|
}
|
|
324
327
|
};
|
|
@@ -404,7 +407,7 @@ export function getChatInquiryMessageList(chatInquiryNumber, standardDateTime, s
|
|
|
404
407
|
*/
|
|
405
408
|
export function initializeDaeryuntalk(hashValue, isOpen, setIsConnected, isMobile, onWebSocketConnected, onWebSocketMessage, version) {
|
|
406
409
|
return __awaiter(this, void 0, void 0, function* () {
|
|
407
|
-
var _a, _b, _c, _d, _e, _f
|
|
410
|
+
var _a, _b, _c, _d, _e, _f;
|
|
408
411
|
if (typeof window !== 'undefined' && hashValue) {
|
|
409
412
|
localStorage.removeItem('daeryunchatinquirytoken');
|
|
410
413
|
}
|
|
@@ -414,17 +417,17 @@ export function initializeDaeryuntalk(hashValue, isOpen, setIsConnected, isMobil
|
|
|
414
417
|
let errorData = null;
|
|
415
418
|
// 1단계: 사용자 인증
|
|
416
419
|
let authResponse = yield retryable(() => authenticateUser(TEST_CENTER_CODE, version), 1, 350, '사용자 인증');
|
|
420
|
+
console.log('authResponse11', authResponse);
|
|
417
421
|
// 9379809eec4c09ea276496b15b5d2778a2ef7af312c25d95bd2a0f884cb72bf3
|
|
418
422
|
// 만약 만료된 토큰이라면?
|
|
419
423
|
// console.log('authResponse', authResponse);
|
|
420
424
|
// console.log('ErrorEnum.CE_TOKEN_EXPIRED', ErrorEnum.CE_TOKEN_EXPIRED);
|
|
421
425
|
// console.log('authResponse?.result_info?.result_cd', authResponse?.result_info?.result_cd);
|
|
422
|
-
|
|
423
|
-
if (((_b = authResponse === null || authResponse === void 0 ? void 0 : authResponse.result_info) === null || _b === void 0 ? void 0 : _b.result_cd) === 'OK' || ((_c = authResponse === null || authResponse === void 0 ? void 0 : authResponse.result_info) === null || _c === void 0 ? void 0 : _c.result_type_cd) === 'OK') {
|
|
426
|
+
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') {
|
|
424
427
|
}
|
|
425
428
|
else {
|
|
426
|
-
if (((
|
|
427
|
-
((
|
|
429
|
+
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 ||
|
|
430
|
+
((_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) {
|
|
428
431
|
// 재인증 시작
|
|
429
432
|
errorData = authResponse;
|
|
430
433
|
console.log('재인증 시작');
|
|
@@ -441,10 +444,9 @@ export function initializeDaeryuntalk(hashValue, isOpen, setIsConnected, isMobil
|
|
|
441
444
|
};
|
|
442
445
|
}
|
|
443
446
|
}
|
|
444
|
-
console.log('authResponse', authResponse);
|
|
445
447
|
// 2단계: 웹소켓 초기화
|
|
446
448
|
const wsInitData = yield retryable(() => initializeWebSocket(version), 3, 350, '웹소켓 초기화');
|
|
447
|
-
if (!(((
|
|
449
|
+
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')) {
|
|
448
450
|
errorData = wsInitData;
|
|
449
451
|
return {
|
|
450
452
|
inquiryData: null,
|
|
@@ -481,7 +483,7 @@ export function initializeDaeryuntalk(hashValue, isOpen, setIsConnected, isMobil
|
|
|
481
483
|
inquiryData: chatInquiryData,
|
|
482
484
|
socket,
|
|
483
485
|
hashAuth,
|
|
484
|
-
errorCode:
|
|
486
|
+
errorCode: errorData
|
|
485
487
|
};
|
|
486
488
|
}
|
|
487
489
|
catch (error) {
|
|
@@ -57,7 +57,7 @@ const ENDPOINTS = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
// 메인
|
|
60
|
-
const TEST_CENTER_CODE: string = 'CT0000';
|
|
60
|
+
export const TEST_CENTER_CODE: string = 'CT0000';
|
|
61
61
|
|
|
62
62
|
// 채팅 메시지 유형 상수
|
|
63
63
|
export const MESSAGE_TYPES = {
|
|
@@ -174,8 +174,6 @@ async function fetchWithCookies<T>(
|
|
|
174
174
|
*/
|
|
175
175
|
|
|
176
176
|
export async function authenticateUser(centerCode: string, version?: string, retry?: boolean): Promise<any> {
|
|
177
|
-
console.log('retry', retry);
|
|
178
|
-
console.log('[인증 시작] 사용자 인증 요청', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
179
177
|
try {
|
|
180
178
|
const body = {
|
|
181
179
|
d: {
|
|
@@ -390,10 +388,15 @@ export async function generateChatInquiry(
|
|
|
390
388
|
version?: string
|
|
391
389
|
): Promise<IDaeryunTalkResponseWrapper<ChatInquiryCreateDataResponse>> {
|
|
392
390
|
console.log('[새 채팅 문의 생성 시작 (개선)]', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
|
|
391
|
+
let channelId = channelNumber;
|
|
392
|
+
if (!channelNumber) {
|
|
393
|
+
const authRes = await authenticateUser(TEST_CENTER_CODE, version);
|
|
394
|
+
channelId = authRes.data.channel_number;
|
|
395
|
+
}
|
|
393
396
|
|
|
394
397
|
const body = {
|
|
395
398
|
d: {
|
|
396
|
-
channel_number:
|
|
399
|
+
channel_number: channelId,
|
|
397
400
|
current_url: currentUrl
|
|
398
401
|
}
|
|
399
402
|
};
|
|
@@ -534,12 +537,12 @@ export async function initializeDaeryuntalk(
|
|
|
534
537
|
// 1단계: 사용자 인증
|
|
535
538
|
let authResponse = await retryable(() => authenticateUser(TEST_CENTER_CODE, version), 1, 350, '사용자 인증');
|
|
536
539
|
|
|
540
|
+
console.log('authResponse11', authResponse);
|
|
537
541
|
// 9379809eec4c09ea276496b15b5d2778a2ef7af312c25d95bd2a0f884cb72bf3
|
|
538
542
|
// 만약 만료된 토큰이라면?
|
|
539
543
|
// console.log('authResponse', authResponse);
|
|
540
544
|
// console.log('ErrorEnum.CE_TOKEN_EXPIRED', ErrorEnum.CE_TOKEN_EXPIRED);
|
|
541
545
|
// console.log('authResponse?.result_info?.result_cd', authResponse?.result_info?.result_cd);
|
|
542
|
-
console.log(authResponse?.result_info?.result_cd === ErrorEnum.CE_TOKEN_EXPIRED);
|
|
543
546
|
if (authResponse?.result_info?.result_cd === 'OK' || authResponse?.result_info?.result_type_cd === 'OK') {
|
|
544
547
|
} else {
|
|
545
548
|
if (
|
|
@@ -567,8 +570,6 @@ export async function initializeDaeryuntalk(
|
|
|
567
570
|
}
|
|
568
571
|
}
|
|
569
572
|
|
|
570
|
-
console.log('authResponse', authResponse);
|
|
571
|
-
|
|
572
573
|
// 2단계: 웹소켓 초기화
|
|
573
574
|
const wsInitData = await retryable(() => initializeWebSocket(version), 3, 350, '웹소켓 초기화');
|
|
574
575
|
|
|
@@ -632,7 +633,7 @@ export async function initializeDaeryuntalk(
|
|
|
632
633
|
inquiryData: chatInquiryData,
|
|
633
634
|
socket,
|
|
634
635
|
hashAuth,
|
|
635
|
-
errorCode:
|
|
636
|
+
errorCode: errorData
|
|
636
637
|
};
|
|
637
638
|
} catch (error) {
|
|
638
639
|
console.error('[Daeryuntalk 초기화 실패] 오류 발생:', error);
|