@daeryun/dr_components 1.2.86 → 1.2.88

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.
@@ -16,17 +16,23 @@ import * as gtag from '../../lib/gtag';
16
16
  */
17
17
  export const useLoginUuidSync = () => {
18
18
  const hasProcessed = useRef(false);
19
+ // console.log('useLoginUuidSync 훅 호출됨');
19
20
  useEffect(() => {
21
+ // console.log('useLoginUuidSync useEffect 실행, hasProcessed:', hasProcessed.current);
20
22
  // 이미 처리했으면 스킵
21
- if (hasProcessed.current)
23
+ if (hasProcessed.current) {
24
+ // console.log('useLoginUuidSync: 이미 처리됨, 스킵');
22
25
  return;
26
+ }
23
27
  const syncUuid = () => __awaiter(void 0, void 0, void 0, function* () {
24
28
  var _a, _b, _c;
29
+ // console.log('useLoginUuidSync syncUuid 함수 시작');
25
30
  try {
26
31
  // URL에 이미 uuid가 있으면 스킵
27
32
  const urlParams = new URLSearchParams(window.location.search);
33
+ // console.log('useLoginUuidSync 현재 URL:', window.location.href);
28
34
  if (urlParams.has('uuid')) {
29
- console.log('useLoginUuidSync: URL에 이미 uuid 있음');
35
+ // console.log('useLoginUuidSync: URL에 이미 uuid 있음');
30
36
  return;
31
37
  }
32
38
  // 로그인 상태 및 idx 조회
@@ -35,18 +41,18 @@ export const useLoginUuidSync = () => {
35
41
  headers: { 'Content-Type': 'application/json' },
36
42
  credentials: 'include'
37
43
  }).then(res => res.json());
38
- console.log('useLoginUuidSync result:', result);
44
+ // console.log('useLoginUuidSync result:', result);
39
45
  // 로그인 안 됨
40
46
  if (!((_a = result.data) === null || _a === void 0 ? void 0 : _a.email) || !((_b = result.data) === null || _b === void 0 ? void 0 : _b.name) || !((_c = result.data) === null || _c === void 0 ? void 0 : _c.phone_number)) {
41
- console.log('useLoginUuidSync: 로그인 안 됨');
47
+ // console.log('useLoginUuidSync: 로그인 안 됨');
42
48
  return;
43
49
  }
44
50
  const idx = result.data.idx;
45
51
  if (!idx) {
46
- console.log('useLoginUuidSync: idx 없음');
52
+ // console.log('useLoginUuidSync: idx 없음');
47
53
  return;
48
54
  }
49
- console.log('useLoginUuidSync: 로그인 확인, idx:', idx);
55
+ // console.log('useLoginUuidSync: 로그인 확인, idx:', idx);
50
56
  // URL에 uuid 추가
51
57
  const url = new URL(window.location.href);
52
58
  url.searchParams.set('uuid', String(idx));
@@ -55,13 +61,13 @@ export const useLoginUuidSync = () => {
55
61
  gtag.event({
56
62
  action: 'login_complete',
57
63
  category: 'login',
58
- label: `로그인 완료 - ${idx}`,
64
+ label: `로그인 이후 돌아온 페이지 ${newUrl} - ${idx}`,
59
65
  value: '1'
60
66
  });
61
67
  hasProcessed.current = true;
62
68
  // URL 업데이트 (히스토리에 추가하지 않고 교체)
63
69
  window.history.replaceState({}, '', newUrl);
64
- console.log('useLoginUuidSync: URL 업데이트 완료', newUrl);
70
+ // console.log('useLoginUuidSync: URL 업데이트 완료', newUrl);
65
71
  }
66
72
  catch (error) {
67
73
  console.error('useLoginUuidSync 에러:', error);
@@ -9,16 +9,25 @@ import * as gtag from '../../lib/gtag';
9
9
  export const useLoginUuidSync = () => {
10
10
  const hasProcessed = useRef(false);
11
11
 
12
+ // console.log('useLoginUuidSync 훅 호출됨');
13
+
12
14
  useEffect(() => {
15
+ // console.log('useLoginUuidSync useEffect 실행, hasProcessed:', hasProcessed.current);
16
+
13
17
  // 이미 처리했으면 스킵
14
- if (hasProcessed.current) return;
18
+ if (hasProcessed.current) {
19
+ // console.log('useLoginUuidSync: 이미 처리됨, 스킵');
20
+ return;
21
+ }
15
22
 
16
23
  const syncUuid = async () => {
24
+ // console.log('useLoginUuidSync syncUuid 함수 시작');
17
25
  try {
18
26
  // URL에 이미 uuid가 있으면 스킵
19
27
  const urlParams = new URLSearchParams(window.location.search);
28
+ // console.log('useLoginUuidSync 현재 URL:', window.location.href);
20
29
  if (urlParams.has('uuid')) {
21
- console.log('useLoginUuidSync: URL에 이미 uuid 있음');
30
+ // console.log('useLoginUuidSync: URL에 이미 uuid 있음');
22
31
  return;
23
32
  }
24
33
 
@@ -29,21 +38,21 @@ export const useLoginUuidSync = () => {
29
38
  credentials: 'include'
30
39
  }).then(res => res.json());
31
40
 
32
- console.log('useLoginUuidSync result:', result);
41
+ // console.log('useLoginUuidSync result:', result);
33
42
 
34
43
  // 로그인 안 됨
35
44
  if (!result.data?.email || !result.data?.name || !result.data?.phone_number) {
36
- console.log('useLoginUuidSync: 로그인 안 됨');
45
+ // console.log('useLoginUuidSync: 로그인 안 됨');
37
46
  return;
38
47
  }
39
48
 
40
49
  const idx = result.data.idx;
41
50
  if (!idx) {
42
- console.log('useLoginUuidSync: idx 없음');
51
+ // console.log('useLoginUuidSync: idx 없음');
43
52
  return;
44
53
  }
45
54
 
46
- console.log('useLoginUuidSync: 로그인 확인, idx:', idx);
55
+ // console.log('useLoginUuidSync: 로그인 확인, idx:', idx);
47
56
 
48
57
  // URL에 uuid 추가
49
58
  const url = new URL(window.location.href);
@@ -54,7 +63,7 @@ export const useLoginUuidSync = () => {
54
63
  gtag.event({
55
64
  action: 'login_complete',
56
65
  category: 'login',
57
- label: `로그인 완료 - ${idx}`,
66
+ label: `로그인 이후 돌아온 페이지 ${newUrl} - ${idx}`,
58
67
  value: '1'
59
68
  });
60
69
 
@@ -62,7 +71,7 @@ export const useLoginUuidSync = () => {
62
71
 
63
72
  // URL 업데이트 (히스토리에 추가하지 않고 교체)
64
73
  window.history.replaceState({}, '', newUrl);
65
- console.log('useLoginUuidSync: URL 업데이트 완료', newUrl);
74
+ // console.log('useLoginUuidSync: URL 업데이트 완료', newUrl);
66
75
  } catch (error) {
67
76
  console.error('useLoginUuidSync 에러:', error);
68
77
  }
@@ -81,3 +81,5 @@ export * from '../components/common/types/strength_new';
81
81
  export { default as PaginationForGroup } from './PaginationForGroup/PaginationForGroup';
82
82
  export { default as SuccessList } from './page/Success/SuccessList';
83
83
  export { default as GlobalOfficeSection } from './GlobalOfficeSection/GlobalOfficeSection';
84
+ // Hooks
85
+ export { useLoginUuidSync } from './hook/useLoginUuidSync';
@@ -81,3 +81,6 @@ export * from '../components/common/types/strength_new';
81
81
  export { default as PaginationForGroup } from './PaginationForGroup/PaginationForGroup';
82
82
  export { default as SuccessList } from './page/Success/SuccessList';
83
83
  export { default as GlobalOfficeSection } from './GlobalOfficeSection/GlobalOfficeSection';
84
+
85
+ // Hooks
86
+ export { useLoginUuidSync } from './hook/useLoginUuidSync';
@@ -46,19 +46,19 @@ const LoginContainer = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px]
46
46
  });
47
47
  // 로그인 체크 + idx 조회
48
48
  const fetchUserWithIdx = () => __awaiter(void 0, void 0, void 0, function* () {
49
- var _a, _b, _c, _d, _e, _f, _g;
49
+ var _a, _b, _c, _d;
50
50
  try {
51
51
  const result = yield fetch(`/api/lawfirm/app/user`, {
52
52
  method: 'GET',
53
53
  headers: { 'Content-Type': 'application/json' },
54
54
  credentials: 'include'
55
55
  }).then(res => res.json());
56
- console.log('fetchUserWithIdx result:', result);
56
+ // console.log('fetchUserWithIdx result:', result);
57
57
  if (((_a = result.data) === null || _a === void 0 ? void 0 : _a.email) && ((_b = result.data) === null || _b === void 0 ? void 0 : _b.name) && ((_c = result.data) === null || _c === void 0 ? void 0 : _c.phone_number)) {
58
- console.log('로그인 성공, idx:', result.data.idx);
58
+ // console.log('로그인 성공, idx:', result.data.idx);
59
59
  return { isLogin: true, idx: (_d = result.data.idx) !== null && _d !== void 0 ? _d : null };
60
60
  }
61
- console.log('로그인 조건 미충족 - email:', (_e = result.data) === null || _e === void 0 ? void 0 : _e.email, 'name:', (_f = result.data) === null || _f === void 0 ? void 0 : _f.name, 'phone_number:', (_g = result.data) === null || _g === void 0 ? void 0 : _g.phone_number);
61
+ // console.log('로그인 조건 미충족 - email:', result.data?.email, 'name:', result.data?.name, 'phone_number:', result.data?.phone_number);
62
62
  return { isLogin: false, idx: null };
63
63
  }
64
64
  catch (error) {
@@ -115,13 +115,13 @@ const LoginContainer = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px]
115
115
  checkLogoutLogAction();
116
116
  }, []);
117
117
  useEffect(() => {
118
- console.log('로그인 체크 useEffect 시작');
118
+ // console.log('로그인 체크 useEffect 시작');
119
119
  let attemptCount = 0; // 시도 횟수
120
120
  const maxAttempts = 3; // 최대 4번
121
121
  const intervalTime = 3000; // 3초
122
122
  const interval = setInterval(() => __awaiter(void 0, void 0, void 0, function* () {
123
123
  attemptCount++;
124
- console.log(`로그인 체크 시도 ${attemptCount}/${maxAttempts}`);
124
+ // console.log(`로그인 체크 시도 ${attemptCount}/${maxAttempts}`);
125
125
  try {
126
126
  const { isLogin, idx } = yield fetchUserWithIdx();
127
127
  if (isLogin) {
@@ -61,13 +61,13 @@ const LoginContainer = ({
61
61
  credentials: 'include'
62
62
  }).then(res => res.json());
63
63
 
64
- console.log('fetchUserWithIdx result:', result);
64
+ // console.log('fetchUserWithIdx result:', result);
65
65
 
66
66
  if (result.data?.email && result.data?.name && result.data?.phone_number) {
67
- console.log('로그인 성공, idx:', result.data.idx);
67
+ // console.log('로그인 성공, idx:', result.data.idx);
68
68
  return { isLogin: true, idx: result.data.idx ?? null };
69
69
  }
70
- console.log('로그인 조건 미충족 - email:', result.data?.email, 'name:', result.data?.name, 'phone_number:', result.data?.phone_number);
70
+ // console.log('로그인 조건 미충족 - email:', result.data?.email, 'name:', result.data?.name, 'phone_number:', result.data?.phone_number);
71
71
  return { isLogin: false, idx: null };
72
72
  } catch (error) {
73
73
  console.error('fetchUserWithIdx 에러:', error);
@@ -123,14 +123,14 @@ const LoginContainer = ({
123
123
  }, []);
124
124
 
125
125
  useEffect(() => {
126
- console.log('로그인 체크 useEffect 시작');
126
+ // console.log('로그인 체크 useEffect 시작');
127
127
  let attemptCount = 0; // 시도 횟수
128
128
  const maxAttempts = 3; // 최대 4번
129
129
  const intervalTime = 3000; // 3초
130
130
 
131
131
  const interval = setInterval(async () => {
132
132
  attemptCount++;
133
- console.log(`로그인 체크 시도 ${attemptCount}/${maxAttempts}`);
133
+ // console.log(`로그인 체크 시도 ${attemptCount}/${maxAttempts}`);
134
134
 
135
135
  try {
136
136
  const { isLogin, idx } = await fetchUserWithIdx();
@@ -242,11 +242,11 @@ const StepOne = () => {
242
242
  }),
243
243
  onSuccess: (data) => {
244
244
  var _a, _b;
245
- console.log('data: ', data);
245
+ // console.log('data: ', data);
246
246
  const userIdx = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.idx;
247
247
  const redirect = decodeURIComponent(getCookie('redirect')) || '/';
248
248
  const newRedirect = appendUuidToRedirect(redirect, String(userIdx !== null && userIdx !== void 0 ? userIdx : ''));
249
- console.log('newRedirect:', newRedirect);
249
+ // console.log('newRedirect:', newRedirect);
250
250
  setCookie({ key: 'redirect', value: newRedirect });
251
251
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
252
252
  setIsModal(true);
@@ -310,12 +310,12 @@ const StepOne = () => {
310
310
  };
311
311
  },
312
312
  onSuccess: (data) => {
313
- console.log('data: ', data);
313
+ // console.log('data: ', data);
314
314
  const userIdx = data?.user?.data?.idx;
315
315
 
316
316
  const redirect = decodeURIComponent(getCookie('redirect')) || '/';
317
317
  const newRedirect = appendUuidToRedirect(redirect, String(userIdx ?? ''));
318
- console.log('newRedirect:', newRedirect);
318
+ // console.log('newRedirect:', newRedirect);
319
319
 
320
320
  setCookie({ key: 'redirect', value: newRedirect });
321
321
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
@@ -281,11 +281,11 @@ const StepTwo = () => {
281
281
  }),
282
282
  onSuccess: (data) => {
283
283
  var _a, _b;
284
- console.log('data: ', data);
284
+ // console.log('data: ', data);
285
285
  const userIdx = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.idx;
286
286
  const redirect = decodeURIComponent(getCookie('redirect')) || '/';
287
287
  const newRedirect = appendUuidToRedirect(redirect, String(userIdx !== null && userIdx !== void 0 ? userIdx : ''));
288
- console.log('newRedirect:', newRedirect);
288
+ // console.log('newRedirect:', newRedirect);
289
289
  setCookie({ key: 'redirect', value: newRedirect });
290
290
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
291
291
  setIsModal(true);
@@ -350,12 +350,12 @@ const StepTwo = () => {
350
350
  };
351
351
  },
352
352
  onSuccess: (data) => {
353
- console.log('data: ', data);
353
+ // console.log('data: ', data);
354
354
  const userIdx = data?.user?.data?.idx;
355
355
 
356
356
  const redirect = decodeURIComponent(getCookie('redirect')) || '/';
357
357
  const newRedirect = appendUuidToRedirect(redirect, String(userIdx ?? ''));
358
- console.log('newRedirect:', newRedirect);
358
+ // console.log('newRedirect:', newRedirect);
359
359
 
360
360
  setCookie({ key: 'redirect', value: newRedirect });
361
361
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });