@daeryun/dr_components 0.3.53 → 0.3.54

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.
@@ -17,6 +17,4 @@ export { default as MedicalBrochureBtn } from './BrochureBtn/MedicalBrochureBtn'
17
17
  export { default as SeoStrength } from './Seo/SeoStrength';
18
18
  export { default as Personal } from './page/Login/Personal';
19
19
  export { default as Withdraw } from './page/Login/Withdraw';
20
- export { default as AppSign } from './page/Login/AppSign';
21
- export { default as AppPersonal } from './page/Login/AppPersonal';
22
20
  export { default as LoginShareCheckContainer } from './page/Login/LoginShareCheckContainer';
@@ -17,6 +17,4 @@ export { default as MedicalBrochureBtn } from './BrochureBtn/MedicalBrochureBtn'
17
17
  export { default as SeoStrength } from './Seo/SeoStrength';
18
18
  export { default as Personal } from './page/Login/Personal';
19
19
  export { default as Withdraw } from './page/Login/Withdraw';
20
- export { default as AppSign } from './page/Login/AppSign';
21
- export { default as AppPersonal } from './page/Login/AppPersonal';
22
20
  export { default as LoginShareCheckContainer } from './page/Login/LoginShareCheckContainer';
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { RecoilState } from 'recoil';
3
2
  import { ILoginInfo } from '../_types/login';
4
3
  export interface IOptionalCheckItem {
5
4
  title: string;
@@ -17,8 +16,7 @@ export interface IOptionalCheckAlarm {
17
16
  }
18
17
  type props = {
19
18
  layoutClassName?: string;
20
- session_key?: string;
21
- loginInfoAtom: RecoilState<ILoginInfo>;
19
+ setUser: (user: ILoginInfo) => void;
22
20
  };
23
- declare const SignContainer: ({ layoutClassName, session_key, loginInfoAtom }: props) => React.JSX.Element;
21
+ declare const SignContainer: ({ layoutClassName, setUser }: props) => React.JSX.Element;
24
22
  export default SignContainer;
@@ -9,10 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  import React, { useCallback, useEffect, useRef, useState, Suspense } from 'react';
12
- import { usePathname, useRouter, useSearchParams } from 'next/navigation';
12
+ import { useRouter } from 'next/navigation';
13
13
  import { formatPhoneNumber, formatTime, getCookie, getNameValue, getPhoneValue, onlyNumberFilter } from '../../../../lib';
14
14
  import { deleteToken, getToken } from '../_api/token';
15
- import { useSetRecoilState } from 'recoil';
16
15
  import { jwtDecode } from 'jwt-decode';
17
16
  import { sendNumber } from '../_api/sendNumber';
18
17
  import { confirmNumber } from '../_api/confirmNumber';
@@ -27,12 +26,10 @@ import RequiredCheckBox from './Sign/RequiredCheckBox';
27
26
  import LButton from './LButton';
28
27
  import LInput from './Linput';
29
28
  import Image from 'next/image';
30
- const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px]`, session_key = 'loginUser', loginInfoAtom }) => {
31
- const searchParam = useSearchParams();
32
- const pathName = usePathname();
29
+ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px]`, setUser }) => {
30
+ const session_key = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || '';
33
31
  const router = useRouter();
34
32
  const imagePath = process.env.NEXT_PUBLIC_S3_URL + '';
35
- const setLoginInfo = useSetRecoilState(loginInfoAtom);
36
33
  // 쿠키
37
34
  const [userJwtObj, setUserJwtObj] = useState({
38
35
  email: '',
@@ -394,7 +391,7 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
394
391
  isLogin: true
395
392
  };
396
393
  sessionStorage.setItem(session_key || '', JSON.stringify(userData));
397
- setLoginInfo(userData);
394
+ setUser(userData);
398
395
  router.push(redirect);
399
396
  }
400
397
  else {
@@ -67,21 +67,17 @@ export interface IOptionalCheckAlarm {
67
67
 
68
68
  type props = {
69
69
  layoutClassName?: string;
70
- session_key?: string;
71
- loginInfoAtom: RecoilState<ILoginInfo>;
70
+ setUser: (user: ILoginInfo) => void;
72
71
  };
73
72
 
74
73
  const SignContainer = ({
75
74
  layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px]`,
76
- session_key = 'loginUser',
77
- loginInfoAtom
75
+ setUser
78
76
  }: props) => {
79
- const searchParam = useSearchParams();
80
- const pathName = usePathname();
77
+ const session_key = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || '';
81
78
 
82
79
  const router = useRouter();
83
80
  const imagePath: string = process.env.NEXT_PUBLIC_S3_URL + '';
84
- const setLoginInfo = useSetRecoilState(loginInfoAtom);
85
81
  // 쿠키
86
82
  const [userJwtObj, setUserJwtObj] = useState<{
87
83
  email: string;
@@ -505,7 +501,7 @@ const SignContainer = ({
505
501
  isLogin: true
506
502
  };
507
503
  sessionStorage.setItem(session_key || '', JSON.stringify(userData));
508
- setLoginInfo(userData);
504
+ setUser(userData);
509
505
  router.push(redirect);
510
506
  } else {
511
507
  await deleteToken();
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  import React, { useEffect } from 'react';
12
- const SESSION_KEY = 'login_info';
13
12
  const LoginShareCheckContainer = ({ children, setUserInfo }) => {
13
+ const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || '';
14
14
  useEffect(() => {
15
15
  const initializeUser = () => __awaiter(void 0, void 0, void 0, function* () {
16
16
  const storedUser = sessionStorage.getItem(SESSION_KEY);
@@ -8,14 +8,13 @@ export interface UserInfo {
8
8
  isLogin: boolean;
9
9
  }
10
10
 
11
- const SESSION_KEY = 'login_info';
12
-
13
11
  interface Props {
14
12
  children: ReactNode;
15
13
  setUserInfo: (user: UserInfo) => void; // 상태 업데이트 함수 (Recoil, Jotai 대응 가능)
16
14
  }
17
15
 
18
16
  const LoginShareCheckContainer = ({ children, setUserInfo }: Props) => {
17
+ const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || '';
19
18
  useEffect(() => {
20
19
  const initializeUser = async () => {
21
20
  const storedUser = sessionStorage.getItem(SESSION_KEY);
@@ -1,6 +1,4 @@
1
1
  import React from 'react';
2
- import { RecoilState } from 'recoil';
3
- import { ILoginInfo } from './_types/login';
4
2
  export interface IOptionalCheckAlarm {
5
3
  title: string;
6
4
  checked: boolean;
@@ -9,7 +7,7 @@ export interface IOptionalCheckAlarm {
9
7
  }
10
8
  type props = {
11
9
  layoutClassName?: string;
12
- loginInfoAtom: RecoilState<ILoginInfo>;
10
+ resetUser: () => void;
13
11
  };
14
- declare const Personal: ({ layoutClassName, loginInfoAtom }: props) => React.JSX.Element;
12
+ declare const Personal: ({ layoutClassName, resetUser }: props) => React.JSX.Element;
15
13
  export default Personal;
@@ -29,7 +29,7 @@ import LButton from './LoginComp/LButton';
29
29
  import TermModal from './LoginComp/Modal/TermModal';
30
30
  import ConfirmModal from './LoginComp/Modal/ConfirmModal';
31
31
  import MyPageOptionalCheckBox from './LoginComp/Update/MyPageOptionalCheckBox';
32
- const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px] `, loginInfoAtom }) => {
32
+ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px] `, resetUser }) => {
33
33
  var _a, _b;
34
34
  const router = useRouter();
35
35
  const imagePath = process.env.NEXT_PUBLIC_S3_URL + '';
@@ -64,7 +64,7 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
64
64
  const timerRef = useRef(null); // 초
65
65
  const [sendApiCount, setSendApiCount] = useState(0);
66
66
  const [isTermModal, setIsTermModal] = useState(false);
67
- const logoutAction = useLogout({ loginInfoAtom: loginInfoAtom });
67
+ const logoutAction = useLogout();
68
68
  const [isModal, setIsModal] = useState(false);
69
69
  const [modalObj, setModalObj] = useState({
70
70
  title: '',
@@ -333,6 +333,7 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
333
333
  };
334
334
  const logoutStart = () => __awaiter(void 0, void 0, void 0, function* () {
335
335
  yield logoutAction();
336
+ resetUser();
336
337
  });
337
338
  const updateInfo = () => __awaiter(void 0, void 0, void 0, function* () {
338
339
  // // 이름이 바꼈거나 , 휴대전화 인증을 다시 완료했거나 , 약관 총합 값이 바꼈거나
@@ -57,12 +57,12 @@ interface IUserValid {
57
57
 
58
58
  type props = {
59
59
  layoutClassName?: string;
60
- loginInfoAtom: RecoilState<ILoginInfo>;
60
+ resetUser: () => void;
61
61
  };
62
62
 
63
63
  const Personal = ({
64
64
  layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px] `,
65
- loginInfoAtom
65
+ resetUser
66
66
  }: props) => {
67
67
  const router = useRouter();
68
68
  const imagePath: string = process.env.NEXT_PUBLIC_S3_URL + '';
@@ -102,7 +102,7 @@ const Personal = ({
102
102
  const [sendApiCount, setSendApiCount] = useState<number>(0);
103
103
  const [isTermModal, setIsTermModal] = useState<boolean>(false);
104
104
 
105
- const logoutAction = useLogout({ loginInfoAtom: loginInfoAtom });
105
+ const logoutAction = useLogout();
106
106
 
107
107
  const [isModal, setIsModal] = useState<boolean>(false);
108
108
  const [modalObj, setModalObj] = useState<{ title: string; subTitle: string; key: string }>({
@@ -421,6 +421,7 @@ const Personal = ({
421
421
 
422
422
  const logoutStart = async () => {
423
423
  await logoutAction();
424
+ resetUser();
424
425
  };
425
426
 
426
427
  const updateInfo = async () => {
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
- import { RecoilState } from 'recoil';
3
2
  import { ILoginInfo } from './_types/login';
4
3
  type props = {
5
4
  layoutClassName?: string;
6
- session_key?: string;
7
- loginInfoAtom: RecoilState<ILoginInfo>;
5
+ setUser: (user: ILoginInfo) => void;
8
6
  };
9
- declare const Sign: ({ layoutClassName, session_key, loginInfoAtom }: props) => React.JSX.Element;
7
+ declare const Sign: ({ layoutClassName, setUser }: props) => React.JSX.Element;
10
8
  export default Sign;
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import React, { Suspense } from 'react';
3
3
  import SignContainer from './LoginComp/SignContainer';
4
- const Sign = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px]`, session_key = 'loginUser', loginInfoAtom }) => {
4
+ const Sign = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px]`, setUser }) => {
5
5
  return (<Suspense>
6
- <SignContainer layoutClassName={layoutClassName} session_key={session_key} loginInfoAtom={loginInfoAtom}/>
6
+ <SignContainer layoutClassName={layoutClassName} setUser={setUser}/>
7
7
  </Suspense>);
8
8
  };
9
9
  export default Sign;
@@ -6,18 +6,16 @@ import { ILoginInfo } from './_types/login';
6
6
 
7
7
  type props = {
8
8
  layoutClassName?: string;
9
- session_key?: string;
10
- loginInfoAtom: RecoilState<ILoginInfo>;
9
+ setUser: (user: ILoginInfo) => void;
11
10
  };
12
11
 
13
12
  const Sign = ({
14
13
  layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px] max-lg:py-[112px] max-sm:mt-[28px] max-sm:py-[100px]`,
15
- session_key = 'loginUser',
16
- loginInfoAtom
14
+ setUser
17
15
  }: props) => {
18
16
  return (
19
17
  <Suspense>
20
- <SignContainer layoutClassName={layoutClassName} session_key={session_key} loginInfoAtom={loginInfoAtom} />
18
+ <SignContainer layoutClassName={layoutClassName} setUser={setUser} />
21
19
  </Suspense>
22
20
  );
23
21
  };
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import Fetch from '../_fetch/fetch';
11
11
  export const logout = () => __awaiter(void 0, void 0, void 0, function* () {
12
- const SESSION_KEY = 'loginUser';
12
+ const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || '';
13
13
  try {
14
14
  const res = yield Fetch('/api/lawfirm/app/auth/logout', {
15
15
  method: 'POST'
@@ -1,7 +1,7 @@
1
1
  import Fetch from '../_fetch/fetch';
2
2
 
3
3
  export const logout = async () => {
4
- const SESSION_KEY = 'loginUser';
4
+ const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || '';
5
5
  try {
6
6
  const res = await Fetch('/api/lawfirm/app/auth/logout', {
7
7
  method: 'POST'
@@ -1,9 +1 @@
1
- import { RecoilState } from 'recoil';
2
- import { ILoginInfo } from '../_types/login';
3
- type props = {
4
- sessionKey?: string;
5
- loginInfoAtom: RecoilState<ILoginInfo>;
6
- };
7
- export declare const useLogout: ({ sessionKey, loginInfoAtom }: props) => () => Promise<void>;
8
- export declare const useAppLogout: () => () => Promise<void>;
9
- export {};
1
+ export declare const useLogout: () => () => Promise<void>;
@@ -7,22 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { useSetRecoilState } from 'recoil';
11
10
  import { useQueryClient } from '@tanstack/react-query';
12
11
  import { logout } from '../_api/logout';
13
- export const useLogout = ({ sessionKey = 'loginUser', loginInfoAtom }) => {
14
- const queryClient = useQueryClient();
15
- const setLoginInfo = useSetRecoilState(loginInfoAtom);
16
- const logoutAction = () => __awaiter(void 0, void 0, void 0, function* () {
17
- sessionKey && sessionStorage.removeItem(sessionKey);
18
- setLoginInfo({ email: '', name: '', isLogin: false });
19
- yield logout(); // 서버 로그아웃 요청
20
- queryClient.invalidateQueries({ queryKey: ['getLoginInfo'] });
21
- queryClient.invalidateQueries({ queryKey: ['getLoginStatus'] });
22
- });
23
- return logoutAction;
24
- };
25
- export const useAppLogout = () => {
12
+ export const useLogout = () => {
26
13
  const queryClient = useQueryClient();
27
14
  const logoutAction = () => __awaiter(void 0, void 0, void 0, function* () {
28
15
  yield logout(); // 서버 로그아웃 요청
@@ -1,35 +1,7 @@
1
- import { RecoilState, useSetRecoilState } from 'recoil';
2
1
  import { useQueryClient } from '@tanstack/react-query';
3
2
  import { logout } from '../_api/logout';
4
- import { ILoginInfo } from '../_types/login';
5
3
 
6
- type props = {
7
- sessionKey?: string;
8
- loginInfoAtom: RecoilState<ILoginInfo>;
9
- };
10
-
11
- export const useLogout = ({ sessionKey = 'loginUser', loginInfoAtom }: props) => {
12
- const queryClient = useQueryClient();
13
- const setLoginInfo = useSetRecoilState(loginInfoAtom);
14
-
15
- const logoutAction = async () => {
16
- sessionKey && sessionStorage.removeItem(sessionKey);
17
-
18
- setLoginInfo({ email: '', name: '', isLogin: false });
19
- await logout(); // 서버 로그아웃 요청
20
-
21
- queryClient.invalidateQueries({ queryKey: ['getLoginInfo'] });
22
- queryClient.invalidateQueries({ queryKey: ['getLoginStatus'] });
23
- };
24
-
25
- return logoutAction;
26
- };
27
-
28
- type appProps = {
29
- resetUser: () => void;
30
- };
31
-
32
- export const useAppLogout = () => {
4
+ export const useLogout = () => {
33
5
  const queryClient = useQueryClient();
34
6
 
35
7
  const logoutAction = async () => {