@daeryun/dr_components 1.2.78 → 1.2.80
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.
|
@@ -11,8 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
import React, { useEffect, useRef, useState } from 'react';
|
|
12
12
|
import Image from 'next/image';
|
|
13
13
|
import { useMutation } from '@tanstack/react-query';
|
|
14
|
-
import { getCookie } from '../../../lib';
|
|
14
|
+
import { getCookie, setCookie } from '../../../lib';
|
|
15
15
|
import ConfirmModal from './LoginComp/Modal/ConfirmModal';
|
|
16
|
+
import * as gtag from '../../../lib/gtag';
|
|
16
17
|
const Box = ({ code, code_name, selected, selectedList, setSelectedList, activeTooltipId, setActiveTooltipId, tooltipTimeoutRef }) => {
|
|
17
18
|
const [tooltipStyle, setTooltipStyle] = useState({});
|
|
18
19
|
const buttonRef = useRef(null);
|
|
@@ -172,6 +173,28 @@ const StepOne = () => {
|
|
|
172
173
|
{ code: 'CT0029', code_name: '디지털포렌식' },
|
|
173
174
|
{ code: 'CT0030', code_name: '경호' }
|
|
174
175
|
];
|
|
176
|
+
const signUpGAEvent = (userId) => {
|
|
177
|
+
gtag.event({
|
|
178
|
+
action: 'sign_up_ga_event',
|
|
179
|
+
category: 'sign_up',
|
|
180
|
+
label: `회원가입 완료 - ${userId}`,
|
|
181
|
+
value: '1'
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
const appendUuidToRedirect = (redirect, uuid) => {
|
|
185
|
+
if (!uuid)
|
|
186
|
+
return redirect;
|
|
187
|
+
try {
|
|
188
|
+
const url = new URL(redirect, window.location.origin);
|
|
189
|
+
if (url.origin !== window.location.origin)
|
|
190
|
+
return redirect; // 외부 도메인 차단
|
|
191
|
+
url.searchParams.set('uuid', uuid);
|
|
192
|
+
return url.pathname + url.search;
|
|
193
|
+
}
|
|
194
|
+
catch (_a) {
|
|
195
|
+
return redirect;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
175
198
|
const modalHandleClose = () => {
|
|
176
199
|
setIsModal(false);
|
|
177
200
|
setModalObj({ title: '', subTitle: '' });
|
|
@@ -202,18 +225,32 @@ const StepOne = () => {
|
|
|
202
225
|
uuid: bodyData.uuid
|
|
203
226
|
})
|
|
204
227
|
});
|
|
228
|
+
// PATCH 성공 후 GET으로 상세 정보 조회
|
|
229
|
+
const userGetResponse = yield fetch(`/api/lawfirm/app/user`, {
|
|
230
|
+
method: 'GET',
|
|
231
|
+
headers: { 'Content-Type': 'application/json' },
|
|
232
|
+
credentials: 'include'
|
|
233
|
+
});
|
|
205
234
|
if (!userResponse.ok) {
|
|
206
235
|
throw new Error('사용자 정보 API 호출 실패');
|
|
207
236
|
}
|
|
237
|
+
const userData = yield userGetResponse.json();
|
|
208
238
|
return {
|
|
209
239
|
marketing: yield marketingResponse.json(),
|
|
210
|
-
user:
|
|
240
|
+
user: userData
|
|
211
241
|
};
|
|
212
242
|
}),
|
|
213
|
-
onSuccess: () => {
|
|
243
|
+
onSuccess: (data) => {
|
|
244
|
+
var _a, _b;
|
|
245
|
+
console.log('data: ', data);
|
|
246
|
+
const redirect = decodeURIComponent(getCookie('redirect')) || '/';
|
|
247
|
+
const newRedirect = appendUuidToRedirect(redirect, (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.uuid);
|
|
248
|
+
setCookie({ key: 'redirect', value: newRedirect });
|
|
214
249
|
setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
|
|
215
250
|
setIsModal(true);
|
|
216
251
|
sessionStorage.removeItem('login');
|
|
252
|
+
// ga trigger
|
|
253
|
+
signUpGAEvent((_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.uuid);
|
|
217
254
|
},
|
|
218
255
|
onError: error => {
|
|
219
256
|
console.error('Skip API 호출 실패:', error);
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import Image from 'next/image';
|
|
5
5
|
import { useMutation } from '@tanstack/react-query';
|
|
6
|
-
import { getCookie } from '../../../lib';
|
|
6
|
+
import { getCookie, setCookie } from '../../../lib';
|
|
7
7
|
import ConfirmModal from './LoginComp/Modal/ConfirmModal';
|
|
8
|
+
import * as gtag from '../../../lib/gtag';
|
|
8
9
|
|
|
9
10
|
const Box = ({
|
|
10
11
|
code,
|
|
@@ -234,6 +235,27 @@ const StepOne = () => {
|
|
|
234
235
|
{ code: 'CT0030', code_name: '경호' }
|
|
235
236
|
];
|
|
236
237
|
|
|
238
|
+
const signUpGAEvent = (userId: string) => {
|
|
239
|
+
gtag.event({
|
|
240
|
+
action: 'sign_up_ga_event',
|
|
241
|
+
category: 'sign_up',
|
|
242
|
+
label: `회원가입 완료 - ${userId}`,
|
|
243
|
+
value: '1'
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const appendUuidToRedirect = (redirect: string, uuid?: string) => {
|
|
248
|
+
if (!uuid) return redirect;
|
|
249
|
+
try {
|
|
250
|
+
const url = new URL(redirect, window.location.origin);
|
|
251
|
+
if (url.origin !== window.location.origin) return redirect; // 외부 도메인 차단
|
|
252
|
+
url.searchParams.set('uuid', uuid);
|
|
253
|
+
return url.pathname + url.search;
|
|
254
|
+
} catch {
|
|
255
|
+
return redirect;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
|
|
237
259
|
const modalHandleClose = () => {
|
|
238
260
|
setIsModal(false);
|
|
239
261
|
setModalObj({ title: '', subTitle: '' });
|
|
@@ -269,20 +291,36 @@ const StepOne = () => {
|
|
|
269
291
|
})
|
|
270
292
|
});
|
|
271
293
|
|
|
294
|
+
// PATCH 성공 후 GET으로 상세 정보 조회
|
|
295
|
+
const userGetResponse = await fetch(`/api/lawfirm/app/user`, {
|
|
296
|
+
method: 'GET',
|
|
297
|
+
headers: { 'Content-Type': 'application/json' },
|
|
298
|
+
credentials: 'include'
|
|
299
|
+
});
|
|
300
|
+
|
|
272
301
|
if (!userResponse.ok) {
|
|
273
302
|
throw new Error('사용자 정보 API 호출 실패');
|
|
274
303
|
}
|
|
275
304
|
|
|
305
|
+
const userData = await userGetResponse.json()
|
|
306
|
+
|
|
276
307
|
return {
|
|
277
308
|
marketing: await marketingResponse.json(),
|
|
278
|
-
user:
|
|
309
|
+
user: userData
|
|
279
310
|
};
|
|
280
311
|
},
|
|
281
|
-
onSuccess: () => {
|
|
312
|
+
onSuccess: (data) => {
|
|
313
|
+
console.log('data: ', data);
|
|
314
|
+
const redirect = decodeURIComponent(getCookie('redirect')) || '/';
|
|
315
|
+
const newRedirect = appendUuidToRedirect(redirect, data?.user?.uuid);
|
|
316
|
+
setCookie({ key: 'redirect', value: newRedirect });
|
|
282
317
|
setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
|
|
283
318
|
setIsModal(true);
|
|
284
319
|
|
|
285
320
|
sessionStorage.removeItem('login');
|
|
321
|
+
|
|
322
|
+
// ga trigger
|
|
323
|
+
signUpGAEvent(data?.user?.uuid);
|
|
286
324
|
},
|
|
287
325
|
onError: error => {
|
|
288
326
|
console.error('Skip API 호출 실패:', error);
|
|
@@ -229,7 +229,7 @@ const StepTwo = () => {
|
|
|
229
229
|
if (url.origin !== window.location.origin)
|
|
230
230
|
return redirect; // 외부 도메인 차단
|
|
231
231
|
url.searchParams.set('uuid', uuid);
|
|
232
|
-
return url.pathname + url.search;
|
|
232
|
+
return url.pathname + url.search;
|
|
233
233
|
}
|
|
234
234
|
catch (_a) {
|
|
235
235
|
return redirect;
|
|
@@ -286,7 +286,7 @@ const StepTwo = () => {
|
|
|
286
286
|
const url = new URL(redirect, window.location.origin);
|
|
287
287
|
if (url.origin !== window.location.origin) return redirect; // 외부 도메인 차단
|
|
288
288
|
url.searchParams.set('uuid', uuid);
|
|
289
|
-
return url.pathname + url.search;
|
|
289
|
+
return url.pathname + url.search;
|
|
290
290
|
} catch {
|
|
291
291
|
return redirect;
|
|
292
292
|
}
|