@daeryun/dr_components 0.3.69 → 0.3.70
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.
- package/dist/components/page/Login/LoginComp/Sign/RequiredCheckBox.jsx +8 -8
- package/dist/components/page/Login/LoginComp/Sign/RequiredCheckBox.tsx +81 -81
- package/dist/components/page/Login/LoginComp/SignContainer.d.ts +0 -14
- package/dist/components/page/Login/LoginComp/SignContainer.jsx +53 -93
- package/dist/components/page/Login/LoginComp/SignContainer.tsx +61 -142
- package/dist/components/page/Login/Personal.d.ts +0 -6
- package/dist/components/page/Login/Personal.jsx +2 -122
- package/dist/components/page/Login/Personal.tsx +2 -179
- package/dist/components/page/Login/_types/termType.d.ts +16 -0
- package/dist/components/page/Login/_types/termType.js +1 -0
- package/dist/components/page/Login/_types/termType.ts +16 -0
- package/dist/styles/globals.css +0 -187
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/components/page/Login/LoginComp/Sign/OptionalCheckBox.d.ts +0 -14
- package/dist/components/page/Login/LoginComp/Sign/OptionalCheckBox.jsx +0 -61
- package/dist/components/page/Login/LoginComp/Sign/OptionalCheckBox.tsx +0 -160
- package/dist/components/page/Login/LoginComp/Update/MyPageOptionalCheckBox.d.ts +0 -14
- package/dist/components/page/Login/LoginComp/Update/MyPageOptionalCheckBox.jsx +0 -88
- package/dist/components/page/Login/LoginComp/Update/MyPageOptionalCheckBox.tsx +0 -223
|
@@ -13,18 +13,19 @@ import { deleteToken, getToken } from '../_api/token';
|
|
|
13
13
|
import { jwtDecode } from 'jwt-decode';
|
|
14
14
|
import { sendNumber } from '../_api/sendNumber';
|
|
15
15
|
import { confirmNumber } from '../_api/confirmNumber';
|
|
16
|
-
import { optionalTermAgree } from '../_api/optionalTermAgree';
|
|
17
16
|
import { completeUserSign } from '../_api/completeUser';
|
|
18
17
|
import PageWrapper from '../../../Layout/PageWrapper';
|
|
19
18
|
import LoginBreadCrumb from './LoginBreadCrumb';
|
|
20
19
|
import ConfirmModal from './Modal/ConfirmModal';
|
|
21
20
|
import TermModal from './Modal/TermModal';
|
|
22
|
-
import OptionalCheckBox from './Sign/OptionalCheckBox';
|
|
23
21
|
import RequiredCheckBox from './Sign/RequiredCheckBox';
|
|
24
22
|
import LButton from './LButton';
|
|
25
23
|
import LInput from './Linput';
|
|
26
24
|
import Image from 'next/image';
|
|
27
25
|
import { ILoginInfo } from '../_types/login';
|
|
26
|
+
import { useQuery } from '@tanstack/react-query';
|
|
27
|
+
import Loader from '../../../Loader/Loader';
|
|
28
|
+
import { ITermType } from '../_types/termType';
|
|
28
29
|
|
|
29
30
|
interface IUser {
|
|
30
31
|
name: string;
|
|
@@ -45,25 +46,10 @@ interface IRequiredCheckItem {
|
|
|
45
46
|
checked: boolean;
|
|
46
47
|
name: string;
|
|
47
48
|
isContent: boolean;
|
|
49
|
+
termCode: string;
|
|
48
50
|
isAll?: boolean;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
export interface IOptionalCheckItem {
|
|
52
|
-
title: string;
|
|
53
|
-
checked: boolean;
|
|
54
|
-
name: string;
|
|
55
|
-
isContent: boolean;
|
|
56
|
-
cautionTitle: string;
|
|
57
|
-
alarmTypeList: IOptionalCheckAlarm[];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface IOptionalCheckAlarm {
|
|
61
|
-
title: string;
|
|
62
|
-
checked: boolean;
|
|
63
|
-
name: string;
|
|
64
|
-
value: number;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
53
|
type props = {
|
|
68
54
|
layoutClassName?: string;
|
|
69
55
|
setUser: (user: ILoginInfo) => void;
|
|
@@ -74,6 +60,53 @@ const SignContainer = ({
|
|
|
74
60
|
setUser
|
|
75
61
|
}: props) => {
|
|
76
62
|
const session_key = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
|
|
63
|
+
const [termCode, setTermCode] = useState<string>('');
|
|
64
|
+
|
|
65
|
+
const [requiredTermItems, setRequiredTermItems] = useState<IRequiredCheckItem[]>([
|
|
66
|
+
{ title: '전체 동의', name: 'all', checked: false, isContent: false, isAll: true, termCode: '' },
|
|
67
|
+
{ title: '만 14세 이상 동의 (필수)', name: 'required', checked: false, isContent: false, termCode: '' },
|
|
68
|
+
{ title: '서비스 이용약관 동의 (필수)', name: 'required', checked: false, isContent: true, termCode: '' },
|
|
69
|
+
{ title: '개인정보 수집·이용 동의 (필수)', name: 'required', checked: false, isContent: true, termCode: '' },
|
|
70
|
+
{ title: '개인정보 제3자 제공 동의 (필수)', name: 'required', checked: false, isContent: true, termCode: '' }
|
|
71
|
+
]);
|
|
72
|
+
|
|
73
|
+
const { data: termList, status: termListStatus } = useQuery<ITermType[]>({
|
|
74
|
+
queryKey: ['term', 'list'],
|
|
75
|
+
queryFn: () => {
|
|
76
|
+
return fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/terms/latest`, {
|
|
77
|
+
method: 'GET'
|
|
78
|
+
})
|
|
79
|
+
.then(obj => obj.json())
|
|
80
|
+
.then(obj => obj.list);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const { data: termObj, status: termObjStatus } = useQuery<ITermType>({
|
|
85
|
+
queryKey: ['term', termCode],
|
|
86
|
+
queryFn: () => {
|
|
87
|
+
return fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/terms/latest/${termCode}`, {
|
|
88
|
+
method: 'GET'
|
|
89
|
+
})
|
|
90
|
+
.then(obj => obj.json())
|
|
91
|
+
.then(obj => obj.data);
|
|
92
|
+
},
|
|
93
|
+
enabled: !!termCode
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (termListStatus === 'success' && Array.isArray(termList)) {
|
|
98
|
+
setRequiredTermItems([
|
|
99
|
+
{ title: '전체 동의', name: 'all', checked: false, isContent: false, isAll: true, termCode: '' },
|
|
100
|
+
...(termList?.map(item => ({
|
|
101
|
+
title: `${item.code_name} (필수)`,
|
|
102
|
+
name: 'required',
|
|
103
|
+
checked: false,
|
|
104
|
+
isContent: !!item.contents,
|
|
105
|
+
termCode: item.terms_code || ''
|
|
106
|
+
})) ?? [])
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
}, [termList, termListStatus]);
|
|
77
110
|
|
|
78
111
|
const router = useRouter();
|
|
79
112
|
const imagePath: string = process.env.NEXT_PUBLIC_S3_URL + '';
|
|
@@ -88,43 +121,6 @@ const SignContainer = ({
|
|
|
88
121
|
|
|
89
122
|
const redirect = decodeURIComponent(getCookie('redirect')) || '/';
|
|
90
123
|
|
|
91
|
-
const [requiredTermItems, setRequiredTermItems] = useState<IRequiredCheckItem[]>([
|
|
92
|
-
{ title: '전체 동의', name: 'all', checked: false, isContent: false, isAll: true },
|
|
93
|
-
{ title: '만 14세 이상 동의 (필수)', name: 'required', checked: false, isContent: false },
|
|
94
|
-
{ title: '서비스 이용약관 동의 (필수)', name: 'required', checked: false, isContent: true },
|
|
95
|
-
{ title: '개인정보 수집·이용 동의 (필수)', name: 'required', checked: false, isContent: true },
|
|
96
|
-
{ title: '개인정보 제3자 제공 동의 (필수)', name: 'required', checked: false, isContent: true }
|
|
97
|
-
]);
|
|
98
|
-
|
|
99
|
-
const [optionalTermItems, setOptionalTermItems] = useState<IOptionalCheckItem[]>([
|
|
100
|
-
{
|
|
101
|
-
title: '사건관련 알림 수신 동의 (선택)',
|
|
102
|
-
checked: false,
|
|
103
|
-
isContent: true,
|
|
104
|
-
cautionTitle: '*사건관련 알림을 수신할 채널을 선택해 주세요.',
|
|
105
|
-
name: 'optionalMain',
|
|
106
|
-
alarmTypeList: [
|
|
107
|
-
{ title: '푸시알림', name: 'optionalSelect', checked: false, value: 1 },
|
|
108
|
-
{ title: '카카오알림톡', name: 'optionalSelect', checked: false, value: 2 },
|
|
109
|
-
{ title: 'SMS', name: 'optionalSelect', checked: false, value: 4 },
|
|
110
|
-
{ title: '이메일', name: 'optionalSelect', checked: false, value: 8 }
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
title: '마케팅 정보 수신 동의 (선택)',
|
|
115
|
-
checked: false,
|
|
116
|
-
isContent: true,
|
|
117
|
-
cautionTitle: '*마케팅 정보를 수신할 채널을 선택해 주세요.',
|
|
118
|
-
name: 'optionalMain',
|
|
119
|
-
alarmTypeList: [
|
|
120
|
-
{ title: '푸시알림', name: 'optionalSelect', checked: false, value: 1 },
|
|
121
|
-
{ title: '카카오알림톡', name: 'optionalSelect', checked: false, value: 2 },
|
|
122
|
-
{ title: 'SMS', name: 'optionalSelect', checked: false, value: 4 },
|
|
123
|
-
{ title: '이메일', name: 'optionalSelect', checked: false, value: 8 }
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
]);
|
|
127
|
-
|
|
128
124
|
// 회원가입 미완료 시 쿠키 삭제
|
|
129
125
|
useEffect(() => {
|
|
130
126
|
const handleUnload = async () => {
|
|
@@ -307,18 +303,11 @@ const SignContainer = ({
|
|
|
307
303
|
const index = Number(dataset.idx);
|
|
308
304
|
|
|
309
305
|
const newRequiredTermItems = [...requiredTermItems];
|
|
310
|
-
const newOptionalTermItems = [...optionalTermItems];
|
|
311
306
|
if (name === 'all') {
|
|
312
307
|
const reverseState = !newRequiredTermItems[index].checked;
|
|
313
308
|
newRequiredTermItems.forEach(item => {
|
|
314
309
|
item.checked = reverseState;
|
|
315
310
|
});
|
|
316
|
-
newOptionalTermItems.forEach(item => {
|
|
317
|
-
item.checked = reverseState;
|
|
318
|
-
item.alarmTypeList.forEach(alarmItem => {
|
|
319
|
-
alarmItem.checked = reverseState;
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
311
|
} else if (name === 'required') {
|
|
323
312
|
// 기본 체크
|
|
324
313
|
newRequiredTermItems[index].checked = !newRequiredTermItems[index].checked;
|
|
@@ -326,35 +315,8 @@ const SignContainer = ({
|
|
|
326
315
|
newRequiredTermItems[0].checked = check;
|
|
327
316
|
|
|
328
317
|
// 전부 올 체크인지
|
|
329
|
-
} else if (name === 'optionalMain') {
|
|
330
|
-
const checkedValue = !newOptionalTermItems[index].checked;
|
|
331
|
-
newOptionalTermItems[index].checked = checkedValue;
|
|
332
|
-
newOptionalTermItems[index].alarmTypeList.forEach(item => {
|
|
333
|
-
item.checked = checkedValue;
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
const check =
|
|
337
|
-
newOptionalTermItems.every(item => item.checked) &&
|
|
338
|
-
newRequiredTermItems.slice(1).every(item => item.checked);
|
|
339
|
-
newRequiredTermItems[0].checked = check;
|
|
340
|
-
} else if (name === 'optionalSelect') {
|
|
341
|
-
// 선택된 체크
|
|
342
|
-
newOptionalTermItems[parentIdx].alarmTypeList[index].checked =
|
|
343
|
-
!newOptionalTermItems[parentIdx].alarmTypeList[index].checked;
|
|
344
|
-
// 전부 체크인지 확인
|
|
345
|
-
newOptionalTermItems[parentIdx].checked = newOptionalTermItems[parentIdx].alarmTypeList.some(
|
|
346
|
-
item => item.checked
|
|
347
|
-
);
|
|
348
|
-
|
|
349
|
-
// 이제 전체동의 여부 확인
|
|
350
|
-
const check =
|
|
351
|
-
newOptionalTermItems.every(item => item.checked) &&
|
|
352
|
-
newRequiredTermItems.slice(1).every(item => item.checked);
|
|
353
|
-
newRequiredTermItems[0].checked = check;
|
|
354
318
|
}
|
|
355
|
-
|
|
356
319
|
setRequiredTermItems(newRequiredTermItems);
|
|
357
|
-
setOptionalTermItems(newOptionalTermItems);
|
|
358
320
|
};
|
|
359
321
|
|
|
360
322
|
const timeChange = useCallback(() => {
|
|
@@ -446,14 +408,9 @@ const SignContainer = ({
|
|
|
446
408
|
};
|
|
447
409
|
|
|
448
410
|
const completeUser = async ({
|
|
449
|
-
completeBodyData
|
|
450
|
-
termBodyData
|
|
411
|
+
completeBodyData
|
|
451
412
|
}: {
|
|
452
413
|
completeBodyData: { name: string; phoneNumber: string; uuid: string };
|
|
453
|
-
termBodyData: {
|
|
454
|
-
alert_agree: number;
|
|
455
|
-
marketing_agree: number;
|
|
456
|
-
};
|
|
457
414
|
}) => {
|
|
458
415
|
// 이름 설정
|
|
459
416
|
if (!userValidObj.nameValid) {
|
|
@@ -479,15 +436,6 @@ const SignContainer = ({
|
|
|
479
436
|
return;
|
|
480
437
|
}
|
|
481
438
|
|
|
482
|
-
// 약관 저장
|
|
483
|
-
const termResult = await optionalTermAgree({
|
|
484
|
-
bodyData: termBodyData
|
|
485
|
-
});
|
|
486
|
-
if (!termResult.result) {
|
|
487
|
-
// alert('회원가입 실패');
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
439
|
// 회원가입 완료
|
|
492
440
|
const result = await completeUserSign({
|
|
493
441
|
bodyData: completeBodyData
|
|
@@ -512,6 +460,10 @@ const SignContainer = ({
|
|
|
512
460
|
setModalObj({ title: '', subTitle: '', key: '' });
|
|
513
461
|
};
|
|
514
462
|
|
|
463
|
+
if (termListStatus !== 'success' || (termCode && termObjStatus !== 'success')) {
|
|
464
|
+
return <Loader fullScreen />;
|
|
465
|
+
}
|
|
466
|
+
|
|
515
467
|
return (
|
|
516
468
|
<Suspense>
|
|
517
469
|
<section className={layoutClassName}>
|
|
@@ -860,6 +812,7 @@ const SignContainer = ({
|
|
|
860
812
|
isContent={item.isContent}
|
|
861
813
|
setModal={() => {
|
|
862
814
|
setIsTermModal(true);
|
|
815
|
+
setTermCode(item.termCode);
|
|
863
816
|
}}
|
|
864
817
|
handleButton={handleCheckBox}
|
|
865
818
|
/>
|
|
@@ -867,32 +820,6 @@ const SignContainer = ({
|
|
|
867
820
|
})}
|
|
868
821
|
</div>
|
|
869
822
|
</div>
|
|
870
|
-
<div
|
|
871
|
-
className={
|
|
872
|
-
' mt-[37px] flex flex-col gap-[40px] ' +
|
|
873
|
-
' max-lg:mt-[32px] max-lg:gap-[32px] ' +
|
|
874
|
-
' max-sm:mt-[30px] max-sm:gap-[30px] '
|
|
875
|
-
}
|
|
876
|
-
>
|
|
877
|
-
{optionalTermItems.map((item: IOptionalCheckItem, index: number) => {
|
|
878
|
-
return (
|
|
879
|
-
<OptionalCheckBox
|
|
880
|
-
key={`option-${index}`}
|
|
881
|
-
name={item.name}
|
|
882
|
-
checked={item.checked}
|
|
883
|
-
title={item.title}
|
|
884
|
-
isContent={true}
|
|
885
|
-
setModal={() => {
|
|
886
|
-
setIsTermModal(true);
|
|
887
|
-
}}
|
|
888
|
-
cautionTitle={item.cautionTitle}
|
|
889
|
-
parentIndex={index}
|
|
890
|
-
optionalItemList={item.alarmTypeList}
|
|
891
|
-
handleButton={handleCheckBox}
|
|
892
|
-
/>
|
|
893
|
-
);
|
|
894
|
-
})}
|
|
895
|
-
</div>
|
|
896
823
|
<div
|
|
897
824
|
className={
|
|
898
825
|
' mt-[80px] flex items-center justify-center ' +
|
|
@@ -908,15 +835,6 @@ const SignContainer = ({
|
|
|
908
835
|
name: userObj.name,
|
|
909
836
|
phoneNumber: formatPhoneNumber(userObj.phoneNumber) || '',
|
|
910
837
|
uuid: userObj.uuid
|
|
911
|
-
},
|
|
912
|
-
termBodyData: {
|
|
913
|
-
alert_agree: optionalTermItems[0].alarmTypeList
|
|
914
|
-
.filter(item => item.checked)
|
|
915
|
-
.reduce((sum, item) => sum + item.value, 0), // checked된 항목들의 value 합산
|
|
916
|
-
|
|
917
|
-
marketing_agree: optionalTermItems[1].alarmTypeList
|
|
918
|
-
.filter(item => item.checked)
|
|
919
|
-
.reduce((sum, item) => sum + item.value, 0) // 마케팅 관련 동의 값 합산
|
|
920
838
|
}
|
|
921
839
|
});
|
|
922
840
|
}}
|
|
@@ -942,14 +860,15 @@ const SignContainer = ({
|
|
|
942
860
|
<TermModal
|
|
943
861
|
isOpen={isTermModal}
|
|
944
862
|
onClose={() => {
|
|
863
|
+
setTermCode('');
|
|
945
864
|
setIsTermModal(false);
|
|
946
865
|
}}
|
|
947
|
-
title={
|
|
948
|
-
content={''}
|
|
866
|
+
title={(termObj && `${termObj.code_name} (필수)`) || ''}
|
|
867
|
+
content={(termObj && termObj.contents) || ''}
|
|
949
868
|
/>
|
|
950
869
|
</section>
|
|
951
870
|
</Suspense>
|
|
952
871
|
);
|
|
953
872
|
};
|
|
954
873
|
|
|
955
|
-
export default SignContainer;
|
|
874
|
+
export default SignContainer;
|
|
@@ -16,7 +16,6 @@ import Image from 'next/image';
|
|
|
16
16
|
import { Loader } from '../../index';
|
|
17
17
|
import { QueryClient } from 'react-query';
|
|
18
18
|
import { formatPhoneNumber, formatTime, getNameValue, getPhoneValue, onlyNumberFilter } from '../../../lib';
|
|
19
|
-
import { optionalTermAgree } from './_api/optionalTermAgree';
|
|
20
19
|
import { updateUserInfo } from './_api/updateUserInfo';
|
|
21
20
|
import { confirmNumber } from './_api/confirmNumber';
|
|
22
21
|
import { sendNumber } from './_api/sendNumber';
|
|
@@ -28,9 +27,7 @@ import LInput from './LoginComp/Linput';
|
|
|
28
27
|
import LButton from './LoginComp/LButton';
|
|
29
28
|
import TermModal from './LoginComp/Modal/TermModal';
|
|
30
29
|
import ConfirmModal from './LoginComp/Modal/ConfirmModal';
|
|
31
|
-
import MyPageOptionalCheckBox from './LoginComp/Update/MyPageOptionalCheckBox';
|
|
32
30
|
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
|
-
var _a, _b;
|
|
34
31
|
const router = useRouter();
|
|
35
32
|
const imagePath = process.env.NEXT_PUBLIC_S3_URL + '';
|
|
36
33
|
const { data: userData, status: userDataStatus } = useQuery({
|
|
@@ -42,14 +39,6 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
42
39
|
},
|
|
43
40
|
staleTime: 1000 * 60 * 5
|
|
44
41
|
});
|
|
45
|
-
const { data: userAgree, status: userAgreeStatus } = useQuery({
|
|
46
|
-
queryKey: ['user'],
|
|
47
|
-
queryFn: () => {
|
|
48
|
-
return Fetch(`/api/lawfirm/app/user/agree`, {
|
|
49
|
-
method: 'GET'
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
42
|
const [userObj, setUserObj] = useState({
|
|
54
43
|
name: '',
|
|
55
44
|
phoneNumber: '',
|
|
@@ -71,34 +60,6 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
71
60
|
subTitle: '',
|
|
72
61
|
key: ''
|
|
73
62
|
});
|
|
74
|
-
const [optionalTermItems, setOptionalTermItems] = useState([
|
|
75
|
-
{
|
|
76
|
-
title: '사건관련 알림 수신 동의 (선택)',
|
|
77
|
-
checked: false,
|
|
78
|
-
isContent: true,
|
|
79
|
-
cautionTitle: '*사건관련 알림을 수신할 채널을 선택해 주세요.',
|
|
80
|
-
name: 'optionalMain',
|
|
81
|
-
alarmTypeList: [
|
|
82
|
-
{ title: '푸시알림', name: 'optionalSelect', checked: false, value: 1 },
|
|
83
|
-
{ title: '카카오알림톡', name: 'optionalSelect', checked: false, value: 2 },
|
|
84
|
-
{ title: 'SMS', name: 'optionalSelect', checked: false, value: 4 },
|
|
85
|
-
{ title: '이메일', name: 'optionalSelect', checked: false, value: 8 }
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
title: '마케팅 정보 수신 동의 (선택)',
|
|
90
|
-
checked: false,
|
|
91
|
-
isContent: true,
|
|
92
|
-
cautionTitle: '*마케팅 정보를 수신할 채널을 선택해 주세요.',
|
|
93
|
-
name: 'optionalMain',
|
|
94
|
-
alarmTypeList: [
|
|
95
|
-
{ title: '푸시알림', name: 'optionalSelect', checked: false, value: 1 },
|
|
96
|
-
{ title: '카카오알림톡', name: 'optionalSelect', checked: false, value: 2 },
|
|
97
|
-
{ title: 'SMS', name: 'optionalSelect', checked: false, value: 4 },
|
|
98
|
-
{ title: '이메일', name: 'optionalSelect', checked: false, value: 8 }
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
]);
|
|
102
63
|
const modalValueSetKey = {
|
|
103
64
|
nameError: 'nameError',
|
|
104
65
|
phoneNumberError: 'phoneNumberError',
|
|
@@ -158,22 +119,7 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
158
119
|
codeValid: false
|
|
159
120
|
});
|
|
160
121
|
// 이름이 바꼈거나 , 휴대전화 인증을 다시 완료했거나 , 약관 총합 값이 바꼈거나
|
|
161
|
-
const isAll = ((userData === null || userData === void 0 ? void 0 : userData.data.name) !== (userObj === null || userObj === void 0 ? void 0 : userObj.name) && (userValidObj === null || userValidObj === void 0 ? void 0 : userValidObj.nameValid)) ||
|
|
162
|
-
userValidObj.codeValid ||
|
|
163
|
-
((_a = userAgree === null || userAgree === void 0 ? void 0 : userAgree.data) === null || _a === void 0 ? void 0 : _a.alert_agree) !==
|
|
164
|
-
optionalTermItems[0].alarmTypeList
|
|
165
|
-
.filter(item => item.checked)
|
|
166
|
-
.reduce((sum, item) => sum + item.value, 0) ||
|
|
167
|
-
((_b = userAgree === null || userAgree === void 0 ? void 0 : userAgree.data) === null || _b === void 0 ? void 0 : _b.marketing_agree) !==
|
|
168
|
-
optionalTermItems[1].alarmTypeList.filter(item => item.checked).reduce((sum, item) => sum + item.value, 0);
|
|
169
|
-
const updateOptionalTermItems = (alertAgree, marketingAgree) => {
|
|
170
|
-
setOptionalTermItems(prevItems => prevItems.map((item, index) => {
|
|
171
|
-
// alertAgree는 첫 번째 항목, marketingAgree는 두 번째 항목을 업데이트
|
|
172
|
-
const agreeValue = index === 0 ? alertAgree : marketingAgree;
|
|
173
|
-
//15면 체크
|
|
174
|
-
return Object.assign(Object.assign({}, item), { checked: index === 0 ? alertAgree === 15 : marketingAgree === 15, alarmTypeList: item.alarmTypeList.map(alarm => (Object.assign(Object.assign({}, alarm), { checked: (agreeValue & alarm.value) !== 0 }))) });
|
|
175
|
-
}));
|
|
176
|
-
};
|
|
122
|
+
const isAll = ((userData === null || userData === void 0 ? void 0 : userData.data.name) !== (userObj === null || userObj === void 0 ? void 0 : userObj.name) && (userValidObj === null || userValidObj === void 0 ? void 0 : userValidObj.nameValid)) || userValidObj.codeValid;
|
|
177
123
|
useEffect(() => {
|
|
178
124
|
return () => {
|
|
179
125
|
if (timerRef.current) {
|
|
@@ -181,11 +127,6 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
181
127
|
}
|
|
182
128
|
};
|
|
183
129
|
}, []);
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
if (userAgree) {
|
|
186
|
-
updateOptionalTermItems(userAgree.data.alert_agree, userAgree.data.marketing_agree);
|
|
187
|
-
}
|
|
188
|
-
}, [userAgree]);
|
|
189
130
|
useEffect(() => {
|
|
190
131
|
if (userData) {
|
|
191
132
|
setUserObj(prev => (Object.assign(Object.assign({}, prev), { email: userData.data.email, name: userData.data.name, provider: userData.data.provider, phoneNumber: onlyNumberFilter(userData.data.phone_number) })));
|
|
@@ -265,32 +206,6 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
265
206
|
}
|
|
266
207
|
}
|
|
267
208
|
});
|
|
268
|
-
const handleCheckBox = (e) => {
|
|
269
|
-
const { name, dataset } = e.currentTarget;
|
|
270
|
-
const parentIdx = Number(dataset.parentidx);
|
|
271
|
-
const index = Number(dataset.idx);
|
|
272
|
-
const newOptionalTermItems = [...optionalTermItems];
|
|
273
|
-
if (name === 'all') {
|
|
274
|
-
newOptionalTermItems[index].checked = true;
|
|
275
|
-
newOptionalTermItems[index].alarmTypeList.forEach(item => {
|
|
276
|
-
item.checked = true;
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
else if (name === 'notall') {
|
|
280
|
-
newOptionalTermItems[index].checked = false;
|
|
281
|
-
newOptionalTermItems[index].alarmTypeList.forEach(item => {
|
|
282
|
-
item.checked = false;
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
else if (name === 'optionalSelect') {
|
|
286
|
-
// 선택된 체크
|
|
287
|
-
newOptionalTermItems[parentIdx].alarmTypeList[index].checked =
|
|
288
|
-
!newOptionalTermItems[parentIdx].alarmTypeList[index].checked;
|
|
289
|
-
// 전부 체크인지 확인
|
|
290
|
-
newOptionalTermItems[parentIdx].checked = newOptionalTermItems[parentIdx].alarmTypeList.some(item => item.checked);
|
|
291
|
-
}
|
|
292
|
-
setOptionalTermItems(newOptionalTermItems);
|
|
293
|
-
};
|
|
294
209
|
const verify = (code) => __awaiter(void 0, void 0, void 0, function* () {
|
|
295
210
|
if (!userValidObj.phoneSendValid) {
|
|
296
211
|
const { title, subTitle, key } = modalValueSet[modalValueSetKey.timeLeftError];
|
|
@@ -342,14 +257,6 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
342
257
|
}
|
|
343
258
|
const nameCheck = userData.data.name !== userObj.name && userValidObj.nameValid;
|
|
344
259
|
const phoneCheck = userValidObj.codeValid;
|
|
345
|
-
const termCheck = userAgree.data.alert_agree !==
|
|
346
|
-
optionalTermItems[0].alarmTypeList
|
|
347
|
-
.filter(item => item.checked)
|
|
348
|
-
.reduce((sum, item) => sum + item.value, 0) ||
|
|
349
|
-
userAgree.data.marketing_agree !==
|
|
350
|
-
optionalTermItems[1].alarmTypeList
|
|
351
|
-
.filter(item => item.checked)
|
|
352
|
-
.reduce((sum, item) => sum + item.value, 0);
|
|
353
260
|
let result = true;
|
|
354
261
|
if (nameCheck || phoneCheck) {
|
|
355
262
|
result = yield updateUserInfo({
|
|
@@ -357,18 +264,6 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
357
264
|
)
|
|
358
265
|
}).then(obj => obj.result);
|
|
359
266
|
}
|
|
360
|
-
if (termCheck) {
|
|
361
|
-
result = yield optionalTermAgree({
|
|
362
|
-
bodyData: {
|
|
363
|
-
alert_agree: optionalTermItems[0].alarmTypeList
|
|
364
|
-
.filter(item => item.checked)
|
|
365
|
-
.reduce((sum, item) => sum + item.value, 0), // checked된 항목들의 value 합산
|
|
366
|
-
marketing_agree: optionalTermItems[1].alarmTypeList
|
|
367
|
-
.filter(item => item.checked)
|
|
368
|
-
.reduce((sum, item) => sum + item.value, 0) // 마케팅 관련 동의 값 합산
|
|
369
|
-
}
|
|
370
|
-
}).then(obj => obj.result);
|
|
371
|
-
}
|
|
372
267
|
if (result) {
|
|
373
268
|
setIsModalUpdate(false);
|
|
374
269
|
const queryClient = new QueryClient();
|
|
@@ -380,7 +275,7 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
380
275
|
return;
|
|
381
276
|
}
|
|
382
277
|
});
|
|
383
|
-
if (userDataStatus !== 'success'
|
|
278
|
+
if (userDataStatus !== 'success') {
|
|
384
279
|
return <Loader fullScreen/>;
|
|
385
280
|
}
|
|
386
281
|
return (<section className={layoutClassName}>
|
|
@@ -539,21 +434,6 @@ const Personal = ({ layoutClassName = ` mt-[47px] py-[128px] max-lg:mt-[40px] m
|
|
|
539
434
|
</div>)}
|
|
540
435
|
</div>
|
|
541
436
|
</div>
|
|
542
|
-
|
|
543
|
-
<div className={' mt-[80px] ' + ' max-lg:mt-[60px] ' + ' max-sm:mt-[60px] '}>
|
|
544
|
-
<div className={' body_large1 text-[#000000] ' + ' max-lg:body_large1_tb ' + ' max-sm:body_large1_mo '}>
|
|
545
|
-
정보 수신 동의
|
|
546
|
-
</div>
|
|
547
|
-
<div className={' mt-[52px] flex flex-col gap-[59px] ' +
|
|
548
|
-
' max-lg:mt-[40px] max-lg:gap-[50px] ' +
|
|
549
|
-
' max-sm:mt-[32px] max-sm:gap-[40px] '}>
|
|
550
|
-
{optionalTermItems.map((item, index) => {
|
|
551
|
-
return (<MyPageOptionalCheckBox key={`option-${index}`} name={item.name} checked={item.checked} title={item.title} isContent={true} setModal={() => {
|
|
552
|
-
setIsTermModal(true);
|
|
553
|
-
}} cautionTitle={item.cautionTitle} parentIndex={index} optionalItemList={item.alarmTypeList} handleButton={handleCheckBox}/>);
|
|
554
|
-
})}
|
|
555
|
-
</div>
|
|
556
|
-
</div>
|
|
557
437
|
<div className={'mt-[80px] flex items-center justify-center' + ' max-lg:mt-[78px] ' + ' max-sm:mt-[40px] '}>
|
|
558
438
|
<button type={'button'} onClick={isAll
|
|
559
439
|
? () => {
|