@daeryun/dr_components 1.2.15 → 1.2.17

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.
@@ -53,13 +53,13 @@ const TbPcViewer = ({
53
53
  zoomLevel
54
54
  }: ITbPcViewerProps) => {
55
55
  const s3Url = process.env.NEXT_PUBLIC_S3_URL;
56
- const RotateCCWIcon = `${s3Url}/daeryuntalk/viewer/rotate.svg`;
57
- const ZoomOutIcon = `${s3Url}/daeryuntalk/viewer/zoom-out.svg`;
58
- const ZoomInIcon = `${s3Url}/daeryuntalk/viewer/zoom-in.svg`;
59
- const DownloadIcon = `${s3Url}/daeryuntalk/download.svg`;
60
- const CloseIcon = `${s3Url}/daeryuntalk/viewer/close.svg`;
61
- const MoveSwipingIcon = `${s3Url}/daeryuntalk/viewer/move-button.svg`;
62
- const DaeryunLogoIcon = `${s3Url}/daeryuntalk/daeryun-logo.svg`;
56
+ const rotateCCWIcon = `${s3Url}/daeryuntalk/viewer/rotate.svg`;
57
+ const zoomOutIcon = `${s3Url}/daeryuntalk/viewer/zoom-out.svg`;
58
+ const zoomInIcon = `${s3Url}/daeryuntalk/viewer/zoom-in.svg`;
59
+ const downloadIcon = `${s3Url}/daeryuntalk/download.svg`;
60
+ const closeIcon = `${s3Url}/daeryuntalk/viewer/close.svg`;
61
+ const moveSwipingIcon = `${s3Url}/daeryuntalk/viewer/move-button.svg`;
62
+ const daeryunLogoIcon = `${s3Url}/daeryuntalk/daeryun-logo.svg`;
63
63
  return (
64
64
  <div className={`hidden md2:block`}>
65
65
  <div className={`flex h-[100dvh] flex-col items-center justify-center gap-[60px] px-[88px]`}>
@@ -71,10 +71,8 @@ const TbPcViewer = ({
71
71
  disabled={currentIndex < 1}
72
72
  className={`${currentIndex < 1 ? ' disabled:pointer-events-none disabled:opacity-30 ' : ' hover:scale-110 '} absolute top-1/2 z-20 -translate-y-1/2 rotate-180 text-white transition-transform md2:-left-[48px] lg:-left-[68px]`}
73
73
  >
74
- <MoveSwipingIcon />
75
- {/* <MoveSwipingIcon /> */}
76
74
  <Image
77
- src={MoveSwipingIcon}
75
+ src={moveSwipingIcon}
78
76
  alt="이동"
79
77
  width={48}
80
78
  height={48}
@@ -92,13 +90,12 @@ const TbPcViewer = ({
92
90
  `}
93
91
  >
94
92
  <Image
95
- src={MoveSwipingIcon}
93
+ src={moveSwipingIcon}
96
94
  alt="이동"
97
95
  width={48}
98
96
  height={48}
99
97
  className="h-full w-full text-white"
100
98
  />
101
- {/* <MoveSwipingIcon /> */}
102
99
  </button>
103
100
 
104
101
  {/* 고정된 위치의 닫기 버튼 */}
@@ -106,8 +103,7 @@ const TbPcViewer = ({
106
103
  onClick={closeImageViewer}
107
104
  className="absolute right-[20px] top-[20px] z-20 transition-transform hover:scale-110"
108
105
  >
109
- <Image src={CloseIcon} alt="닫기" width={24} height={24} className="h-6 w-6 text-white" />
110
- {/* <CloseIcon className="h-6 w-6 text-white" /> */}
106
+ <Image src={closeIcon} alt="닫기" width={24} height={24} className="h-6 w-6 text-white" />
111
107
  </button>
112
108
 
113
109
  {/* 이미지 컨테이너 */}
@@ -127,8 +123,8 @@ const TbPcViewer = ({
127
123
  }}
128
124
  >
129
125
  <Image
130
- src={currentImage.url}
131
- alt={currentImage.file.name}
126
+ src={currentImage?.url || ''}
127
+ alt={currentImage?.file?.name || ''}
132
128
  width={100}
133
129
  height={100}
134
130
  className="h-auto max-h-[500px] w-full max-w-[684px] object-contain"
@@ -143,8 +139,7 @@ const TbPcViewer = ({
143
139
  <div className={`flex items-center gap-[10px]`}>
144
140
  <div className="flex-shrink-0 rounded-full">
145
141
  <div className="relative h-full w-full">
146
- <Image src={DaeryunLogoIcon} alt="대륜 로고" width={28} height={28} />
147
- {/* <DaeryunLogoIcon width={28} height={28} /> */}
142
+ <Image src={daeryunLogoIcon} alt="대륜 로고" width={28} height={28} />
148
143
  </div>
149
144
  </div>
150
145
  <div className={`dr_talk_subtitle_medium text-drTalkWhite`}>
@@ -158,7 +153,13 @@ const TbPcViewer = ({
158
153
  </div>
159
154
  <div className={`flex flex-row gap-[20px]`}>
160
155
  <button onClick={rotateImage} className="transition-transform hover:scale-110">
161
- <RotateCCWIcon />
156
+ <Image
157
+ src={rotateCCWIcon}
158
+ alt="회전"
159
+ width={24}
160
+ height={24}
161
+ className="h-6 w-6 text-white"
162
+ />
162
163
  </button>
163
164
  <button
164
165
  onClick={zoomOut}
@@ -170,9 +171,8 @@ const TbPcViewer = ({
170
171
  : 'hover:scale-110 hover:opacity-80'
171
172
  } transition-all`}
172
173
  >
173
- {/* <ZoomOutIcon /> */}
174
174
  <Image
175
- src={ZoomOutIcon}
175
+ src={zoomOutIcon}
176
176
  alt="확대"
177
177
  width={24}
178
178
  height={24}
@@ -188,9 +188,8 @@ const TbPcViewer = ({
188
188
  : 'hover:scale-110 hover:opacity-80'
189
189
  } transition-all`}
190
190
  >
191
- {/* <ZoomInIcon /> */}
192
191
  <Image
193
- src={ZoomInIcon}
192
+ src={zoomInIcon}
194
193
  alt="확대"
195
194
  width={24}
196
195
  height={24}
@@ -198,10 +197,9 @@ const TbPcViewer = ({
198
197
  />
199
198
  </button>
200
199
  <button onClick={handleDownload} className="transition-transform hover:scale-110">
201
- {/* <DownloadIcon className="bg-transparent text-white" /> */}
202
200
  <Image
203
- src={DownloadIcon}
204
- alt="다요로드"
201
+ src={downloadIcon}
202
+ alt="다운로드"
205
203
  width={24}
206
204
  height={24}
207
205
  className="bg-transparent text-white"
@@ -28,8 +28,9 @@ interface props {
28
28
  setInitialLoading: Dispatch<SetStateAction<boolean | null>>;
29
29
  setChatInquiryNumber: Dispatch<SetStateAction<string | null>>;
30
30
  setAgeCheckStatus: Dispatch<SetStateAction<AgeCheckStatusEnums | null>>;
31
+ isOpen: boolean;
31
32
  }
32
- export declare const useSocketEventHandler: ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated, setIsTyping, onClose, centerCode, setPreviewState, setIsUserExpried, chatInquiryNumber, setIsNextPage, setInitialLoading, setChatInquiryNumber, setAgeCheckStatus }: props) => {
33
+ export declare const useSocketEventHandler: ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated, setIsTyping, onClose, centerCode, setPreviewState, setIsUserExpried, chatInquiryNumber, setIsNextPage, setInitialLoading, setChatInquiryNumber, setAgeCheckStatus, isOpen }: props) => {
33
34
  initializeDaeryuntalk: (hashValue: string | null, isOpen: boolean, centerCode: string, version?: string) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<IChatInquiryMainDataResponse> | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryCreateDataResponse> | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryDetailDataResponse> | import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<import("../../_api/daeryuntalk/type/response").ChatInquiryMessageListDataResponse> | null | undefined>;
34
35
  sendInquiryWatching: (chatInquiryNumber: string) => void;
35
36
  retryInquiryMain: (channelNumber: string) => Promise<import("../../_api/daeryuntalk/type/response").IDaeryunTalkResponseWrapper<IChatInquiryMainDataResponse>>;
@@ -16,7 +16,7 @@ import { useDaeryunTalkToast } from '../../Toast/DaeryuntalkToastProvider';
16
16
  import { getErrorMessageMap } from '../../_enums/error';
17
17
  import { consoleFn } from '../../_lib/utils';
18
18
  import { useFullURL } from './useFullURL';
19
- export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated, setIsTyping, onClose, centerCode, setPreviewState, setIsUserExpried, chatInquiryNumber, setIsNextPage, setInitialLoading, setChatInquiryNumber, setAgeCheckStatus }) => {
19
+ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessages, setInquiryMainData, socketRef, setWorkFlowStack, setMessageObject, setInquiryStatus, setHistoryList, historyList, inquiryMainData, isMobile, setIsAuthenticated, setIsTyping, onClose, centerCode, setPreviewState, setIsUserExpried, chatInquiryNumber, setIsNextPage, setInitialLoading, setChatInquiryNumber, setAgeCheckStatus, isOpen }) => {
20
20
  var _a;
21
21
  const typingBlockRef = useRef(null);
22
22
  const typingTimeoutRef = useRef(null);
@@ -165,6 +165,8 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
165
165
  const visible = document.visibilityState === 'visible';
166
166
  setIsVisible(visible);
167
167
  consoleFn('visible', visible);
168
+ if (!isOpen)
169
+ return;
168
170
  if (visible) {
169
171
  consoleFn('socketRef.current', socketRef.current);
170
172
  consoleFn('화면 켜짐 확인 - 재연결 시도');
@@ -180,7 +182,7 @@ export const useSocketEventHandler = ({ setIsConnected, setIsLoading, setMessage
180
182
  };
181
183
  document.addEventListener('visibilitychange', handleVisibilityChange);
182
184
  return () => document.removeEventListener('visibilitychange', handleVisibilityChange);
183
- }, []);
185
+ }, [isOpen]);
184
186
  const webSocketMessageHandler = useCallback((event) => {
185
187
  var _a;
186
188
  consoleFn('[DaeryuntalkContext] 웹소켓 메시지 수신됨');
@@ -53,6 +53,7 @@ interface props {
53
53
  setInitialLoading: Dispatch<SetStateAction<boolean | null>>;
54
54
  setChatInquiryNumber: Dispatch<SetStateAction<string | null>>;
55
55
  setAgeCheckStatus: Dispatch<SetStateAction<AgeCheckStatusEnums | null>>;
56
+ isOpen: boolean;
56
57
  }
57
58
 
58
59
  export const useSocketEventHandler = ({
@@ -78,7 +79,8 @@ export const useSocketEventHandler = ({
78
79
  setIsNextPage,
79
80
  setInitialLoading,
80
81
  setChatInquiryNumber,
81
- setAgeCheckStatus
82
+ setAgeCheckStatus,
83
+ isOpen
82
84
  }: props) => {
83
85
  const typingBlockRef = useRef<NodeJS.Timeout | null>(null);
84
86
  const typingTimeoutRef = useRef<NodeJS.Timeout | null>(null);
@@ -254,6 +256,7 @@ export const useSocketEventHandler = ({
254
256
  setIsVisible(visible);
255
257
 
256
258
  consoleFn('visible', visible);
259
+ if (!isOpen) return;
257
260
  if (visible) {
258
261
  consoleFn('socketRef.current', socketRef.current);
259
262
  consoleFn('화면 켜짐 확인 - 재연결 시도');
@@ -268,7 +271,7 @@ export const useSocketEventHandler = ({
268
271
  };
269
272
  document.addEventListener('visibilitychange', handleVisibilityChange);
270
273
  return () => document.removeEventListener('visibilitychange', handleVisibilityChange);
271
- }, []);
274
+ }, [isOpen]);
272
275
 
273
276
  const webSocketMessageHandler = useCallback((event: MessageEvent) => {
274
277
  consoleFn('[DaeryuntalkContext] 웹소켓 메시지 수신됨');
@@ -180,7 +180,7 @@ const Daeryuntalk = ({ tel = '1800-7905', centerCode = 'CT0000', bannerHeight =
180
180
  </style>
181
181
  <DaeryuntalkToastProvider>
182
182
  <ViewportHandler isMobile={isMobile} isDisable={!isOpen || !isMobile}/>
183
- <DaeryuntalkProvider propsTel={tel} isMobile={isMobile} onClose={closeModal} centerCode={currentCenterCode || ''}>
183
+ <DaeryuntalkProvider propsTel={tel} isMobile={isMobile} onClose={closeModal} centerCode={currentCenterCode || ''} isOpen={isOpen}>
184
184
  {isMobile ? (isOpen || !currentCenterCode ? null : (<ChatButton isOpen={isOpen} isMobile={isMobile} hashValue={hashValue} onClick={toggleChat}/>)) : !currentCenterCode ? null : (<ChatButton isOpen={isOpen} isMobile={isMobile} hashValue={hashValue} onClick={toggleChat} bannerHeight={bannerHeight}/>)}
185
185
  <ChatWidget isOpen={hashValue ? true : isOpen} isMobile={isMobile} onClose={closeModal} hashValue={hashValue} setHashValue={setHashValue} animationState={animationState} isMobileSafari={isMobileSafari} androidViewportHeight={androidViewportHeight}/>
186
186
  </DaeryuntalkProvider>
@@ -218,6 +218,7 @@ const Daeryuntalk: React.FC<DaeryuntalkProps> = ({ tel = '1800-7905', centerCode
218
218
  isMobile={isMobile}
219
219
  onClose={closeModal}
220
220
  centerCode={currentCenterCode || ''}
221
+ isOpen={isOpen}
221
222
  >
222
223
  {isMobile ? (
223
224
  isOpen || !currentCenterCode ? null : (