@daeryun/dr_components 0.9.49 → 0.9.51

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.
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  interface props {
3
3
  layoutClassName?: string;
4
4
  state: string;
5
+ isTestLogin?: boolean;
5
6
  }
6
- declare const Login: ({ layoutClassName, state }: props) => React.JSX.Element;
7
+ declare const Login: ({ layoutClassName, state, isTestLogin }: props) => React.JSX.Element;
7
8
  export default Login;
@@ -18,7 +18,7 @@ const Login = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px] min-h-[10
18
18
  ' max-md:max-h-[800px] max-md:min-h-[1100px] ' +
19
19
  ' mb-[192px] mt-[128px] ' +
20
20
  ' max-lg:mt-[112px] ' +
21
- ' max-sm:mt-[100px] ', state }) => {
21
+ ' max-sm:mt-[100px] ', state, isTestLogin = false }) => {
22
22
  const pathName = usePathname();
23
23
  const userCheck = () => __awaiter(void 0, void 0, void 0, function* () {
24
24
  const result = yield fetchUserData();
@@ -34,7 +34,7 @@ const Login = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px] min-h-[10
34
34
  checkUser();
35
35
  }, [pathName]);
36
36
  return (<Suspense>
37
- <LoginContainer layoutClassName={layoutClassName} state={state}/>
37
+ <LoginContainer layoutClassName={layoutClassName} state={state} isTestLogin={isTestLogin}/>
38
38
  </Suspense>);
39
39
  };
40
40
  export default Login;
@@ -13,6 +13,7 @@ import { fetchUserData } from './_api/fetchUserData';
13
13
  interface props {
14
14
  layoutClassName?: string; // 높이 및 마진값 조절
15
15
  state: string;
16
+ isTestLogin?: boolean;
16
17
  }
17
18
  const Login = ({
18
19
  layoutClassName = ' relative h-[100vh] max-h-[1200px] min-h-[1000px] w-full overflow-hidden bg-white font-[SUIT] ' +
@@ -22,7 +23,8 @@ const Login = ({
22
23
  ' mb-[192px] mt-[128px] ' +
23
24
  ' max-lg:mt-[112px] ' +
24
25
  ' max-sm:mt-[100px] ',
25
- state
26
+ state,
27
+ isTestLogin = false
26
28
  }: props) => {
27
29
  const pathName = usePathname();
28
30
  const userCheck = async (): Promise<boolean> => {
@@ -42,7 +44,7 @@ const Login = ({
42
44
  }, [pathName]);
43
45
  return (
44
46
  <Suspense>
45
- <LoginContainer layoutClassName={layoutClassName} state={state} />
47
+ <LoginContainer layoutClassName={layoutClassName} state={state} isTestLogin={isTestLogin} />
46
48
  </Suspense>
47
49
  );
48
50
  };
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  interface props {
3
3
  layoutClassName?: string;
4
4
  state: string;
5
+ isTestLogin?: boolean;
5
6
  }
6
- declare const LoginContainer: ({ layoutClassName, state }: props) => React.JSX.Element;
7
+ declare const LoginContainer: ({ layoutClassName, state, isTestLogin }: props) => React.JSX.Element;
7
8
  export default LoginContainer;
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import React, { useEffect } from 'react';
3
- import { usePathname, useSearchParams } from 'next/navigation';
3
+ import { usePathname, useSearchParams, useRouter } from 'next/navigation';
4
4
  import Image from 'next/image';
5
5
  import PageWrapper from '../../../Layout/PageWrapper';
6
6
  import { setCookie } from '../../../../lib';
@@ -11,7 +11,8 @@ const LoginContainer = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px]
11
11
  ' max-md:max-h-[800px] max-md:min-h-[1100px] ' +
12
12
  ' mb-[192px] mt-[128px] ' +
13
13
  ' max-lg:mt-[112px] ' +
14
- ' max-sm:mt-[100px] ', state }) => {
14
+ ' max-sm:mt-[100px] ', state, isTestLogin = false }) => {
15
+ const router = useRouter();
15
16
  const searchParam = useSearchParams();
16
17
  const pathName = usePathname();
17
18
  // const router = useRouter();
@@ -105,6 +106,13 @@ const LoginContainer = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px]
105
106
  <span>{`${item.name} 계정으로 로그인`}</span>
106
107
  </button>);
107
108
  })}
109
+ {isTestLogin && (<div>
110
+ <button type="button" onClick={() => {
111
+ router.push(`/api/auth/get-auth?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZHgiOjE3NCwiZW1haWwiOiJ0ZXN0Zm9yZGFlcnl1bkBnbWFpbC5jb20iLCJwcm92aWRlciI6Imdvb2dsZSIsImlzTmV3IjpmYWxzZSwiaWF0IjoxNzUwMjk1NDkyLCJleHAiOjE3ODE4NTMwOTJ9.nqXEF8oMuQpha1Athzb_282Y9J7O5VyvTo67pjeMmLg`);
112
+ }} className={`mb-10 flex items-center justify-center rounded-xl border-[1px] border-solid border-gray-200 bg-gray-300 p-2`}>
113
+ <span className={`font-bold`}>{`임시 로그인`}</span>
114
+ </button>
115
+ </div>)}
108
116
  </div>
109
117
  </PageWrapper>
110
118
  </section>);
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import React, { useEffect } from 'react';
4
- import { usePathname, useSearchParams } from 'next/navigation';
4
+ import { usePathname, useSearchParams, useRouter } from 'next/navigation';
5
5
  import Image from 'next/image';
6
6
  import PageWrapper from '../../../Layout/PageWrapper';
7
7
  import { setCookie } from '../../../../lib';
@@ -10,6 +10,7 @@ import LoginBreadCrumb from './LoginBreadCrumb';
10
10
  interface props {
11
11
  layoutClassName?: string; // 높이 및 마진값 조절
12
12
  state: string;
13
+ isTestLogin?: boolean;
13
14
  }
14
15
  const LoginContainer = ({
15
16
  layoutClassName = ' relative h-[100vh] max-h-[1200px] min-h-[1000px] w-full overflow-hidden bg-white font-[SUIT] ' +
@@ -19,8 +20,10 @@ const LoginContainer = ({
19
20
  ' mb-[192px] mt-[128px] ' +
20
21
  ' max-lg:mt-[112px] ' +
21
22
  ' max-sm:mt-[100px] ',
22
- state
23
+ state,
24
+ isTestLogin = false
23
25
  }: props) => {
26
+ const router = useRouter();
24
27
  const searchParam = useSearchParams();
25
28
  const pathName = usePathname();
26
29
  // const router = useRouter();
@@ -162,6 +165,21 @@ const LoginContainer = ({
162
165
  </button>
163
166
  );
164
167
  })}
168
+ {isTestLogin && (
169
+ <div>
170
+ <button
171
+ type="button"
172
+ onClick={() => {
173
+ router.push(
174
+ `/api/auth/get-auth?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZHgiOjE3NCwiZW1haWwiOiJ0ZXN0Zm9yZGFlcnl1bkBnbWFpbC5jb20iLCJwcm92aWRlciI6Imdvb2dsZSIsImlzTmV3IjpmYWxzZSwiaWF0IjoxNzUwMjk1NDkyLCJleHAiOjE3ODE4NTMwOTJ9.nqXEF8oMuQpha1Athzb_282Y9J7O5VyvTo67pjeMmLg`
175
+ );
176
+ }}
177
+ className={`mb-10 flex items-center justify-center rounded-xl border-[1px] border-solid border-gray-200 bg-gray-300 p-2`}
178
+ >
179
+ <span className={`font-bold`}>{`임시 로그인`}</span>
180
+ </button>
181
+ </div>
182
+ )}
165
183
  </div>
166
184
  </PageWrapper>
167
185
  </section>
@@ -180,17 +180,32 @@ const StepOne = () => {
180
180
  };
181
181
  const skipMutation = useMutation({
182
182
  mutationFn: (bodyData) => __awaiter(void 0, void 0, void 0, function* () {
183
- const response = yield fetch(`/api/lawfirm/app/user`, {
183
+ const marketingResponse = yield fetch(`/api/lawfirm/app/user/agree`, {
184
+ method: 'POST',
185
+ headers: { 'Content-Type': 'application/json' },
186
+ body: JSON.stringify({ marketing_agree: bodyData.marketing_agree })
187
+ });
188
+ if (!marketingResponse.ok) {
189
+ throw new Error('마케팅 동의 API 호출 실패');
190
+ }
191
+ const userResponse = yield fetch(`/api/lawfirm/app/user`, {
184
192
  method: 'PATCH',
185
193
  headers: {
186
194
  'Content-Type': 'application/json'
187
195
  },
188
- body: JSON.stringify(bodyData)
196
+ body: JSON.stringify({
197
+ name: bodyData.name,
198
+ phoneNumber: bodyData.phoneNumber,
199
+ uuid: bodyData.uuid
200
+ })
189
201
  });
190
- if (!response.ok) {
191
- throw new Error('API 호출 실패');
202
+ if (!userResponse.ok) {
203
+ throw new Error('사용자 정보 API 호출 실패');
192
204
  }
193
- return response.json();
205
+ return {
206
+ marketing: yield marketingResponse.json(),
207
+ user: yield userResponse.json()
208
+ };
194
209
  }),
195
210
  onSuccess: () => {
196
211
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
@@ -239,7 +254,8 @@ const StepOne = () => {
239
254
  skipMutation.mutate({
240
255
  name: loginData.name,
241
256
  phoneNumber: loginData.phoneNumber,
242
- uuid: loginData.uuid
257
+ uuid: loginData.uuid,
258
+ marketing_agree: loginData.marketing_agree
243
259
  });
244
260
  }
245
261
  catch (error) {
@@ -243,20 +243,37 @@ const StepOne = () => {
243
243
  };
244
244
 
245
245
  const skipMutation = useMutation({
246
- mutationFn: async (bodyData: { name: string; phoneNumber: string; uuid: string }) => {
247
- const response = await fetch(`/api/lawfirm/app/user`, {
246
+ mutationFn: async (bodyData: { name: string; phoneNumber: string; uuid: string; marketing_agree: number }) => {
247
+ const marketingResponse = await fetch(`/api/lawfirm/app/user/agree`, {
248
+ method: 'POST',
249
+ headers: { 'Content-Type': 'application/json' },
250
+ body: JSON.stringify({ marketing_agree: bodyData.marketing_agree })
251
+ });
252
+
253
+ if (!marketingResponse.ok) {
254
+ throw new Error('마케팅 동의 API 호출 실패');
255
+ }
256
+
257
+ const userResponse = await fetch(`/api/lawfirm/app/user`, {
248
258
  method: 'PATCH',
249
259
  headers: {
250
260
  'Content-Type': 'application/json'
251
261
  },
252
- body: JSON.stringify(bodyData)
262
+ body: JSON.stringify({
263
+ name: bodyData.name,
264
+ phoneNumber: bodyData.phoneNumber,
265
+ uuid: bodyData.uuid
266
+ })
253
267
  });
254
268
 
255
- if (!response.ok) {
256
- throw new Error('API 호출 실패');
269
+ if (!userResponse.ok) {
270
+ throw new Error('사용자 정보 API 호출 실패');
257
271
  }
258
272
 
259
- return response.json();
273
+ return {
274
+ marketing: await marketingResponse.json(),
275
+ user: await userResponse.json()
276
+ };
260
277
  },
261
278
  onSuccess: () => {
262
279
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
@@ -296,6 +313,7 @@ const StepOne = () => {
296
313
 
297
314
  window.location.href = '/login/sign/step_two';
298
315
  };
316
+
299
317
  const handleSkip = async () => {
300
318
  try {
301
319
  // session storage에서 login 정보 가져오기
@@ -318,7 +336,8 @@ const StepOne = () => {
318
336
  skipMutation.mutate({
319
337
  name: loginData.name,
320
338
  phoneNumber: loginData.phoneNumber,
321
- uuid: loginData.uuid
339
+ uuid: loginData.uuid,
340
+ marketing_agree: loginData.marketing_agree
322
341
  });
323
342
  } catch (error) {
324
343
  console.error('Session storage parsing error:', error);