@daeryun/dr_components 0.3.69 → 0.3.71
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/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- 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/components/page/MyCase/_fetchers/addMyCaseQuestion.js +1 -1
- package/dist/components/page/MyCase/_fetchers/addMyCaseQuestion.ts +1 -1
- package/dist/components/page/MyCase/_fetchers/getCaseList.js +1 -1
- package/dist/components/page/MyCase/_fetchers/getCaseList.ts +1 -1
- package/dist/components/page/MyCase/_fetchers/getCourtFileList.js +1 -1
- package/dist/components/page/MyCase/_fetchers/getCourtFileList.ts +1 -1
- package/dist/components/page/MyCase/_fetchers/getMyCaseQuestion.js +1 -1
- package/dist/components/page/MyCase/_fetchers/getMyCaseQuestion.ts +1 -1
- package/dist/components/page/MyCase/_fetchers/getMyFileList.js +1 -1
- package/dist/components/page/MyCase/_fetchers/getMyFileList.ts +1 -1
- package/dist/components/page/MyCase/_fetchers/getTimeLine.js +1 -1
- package/dist/components/page/MyCase/_fetchers/getTimeLine.ts +1 -1
- 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
|
@@ -15,19 +15,63 @@ import { deleteToken, getToken } from '../_api/token';
|
|
|
15
15
|
import { jwtDecode } from 'jwt-decode';
|
|
16
16
|
import { sendNumber } from '../_api/sendNumber';
|
|
17
17
|
import { confirmNumber } from '../_api/confirmNumber';
|
|
18
|
-
import { optionalTermAgree } from '../_api/optionalTermAgree';
|
|
19
18
|
import { completeUserSign } from '../_api/completeUser';
|
|
20
19
|
import PageWrapper from '../../../Layout/PageWrapper';
|
|
21
20
|
import LoginBreadCrumb from './LoginBreadCrumb';
|
|
22
21
|
import ConfirmModal from './Modal/ConfirmModal';
|
|
23
22
|
import TermModal from './Modal/TermModal';
|
|
24
|
-
import OptionalCheckBox from './Sign/OptionalCheckBox';
|
|
25
23
|
import RequiredCheckBox from './Sign/RequiredCheckBox';
|
|
26
24
|
import LButton from './LButton';
|
|
27
25
|
import LInput from './Linput';
|
|
28
26
|
import Image from 'next/image';
|
|
27
|
+
import { useQuery } from '@tanstack/react-query';
|
|
28
|
+
import Loader from '../../../Loader/Loader';
|
|
29
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
30
|
const session_key = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
|
|
31
|
+
const [termCode, setTermCode] = useState('');
|
|
32
|
+
const [requiredTermItems, setRequiredTermItems] = useState([
|
|
33
|
+
{ title: '전체 동의', name: 'all', checked: false, isContent: false, isAll: true, termCode: '' },
|
|
34
|
+
{ title: '만 14세 이상 동의 (필수)', name: 'required', checked: false, isContent: false, termCode: '' },
|
|
35
|
+
{ title: '서비스 이용약관 동의 (필수)', name: 'required', checked: false, isContent: true, termCode: '' },
|
|
36
|
+
{ title: '개인정보 수집·이용 동의 (필수)', name: 'required', checked: false, isContent: true, termCode: '' },
|
|
37
|
+
{ title: '개인정보 제3자 제공 동의 (필수)', name: 'required', checked: false, isContent: true, termCode: '' }
|
|
38
|
+
]);
|
|
39
|
+
const { data: termList, status: termListStatus } = useQuery({
|
|
40
|
+
queryKey: ['term', 'list'],
|
|
41
|
+
queryFn: () => {
|
|
42
|
+
return fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/terms/latest`, {
|
|
43
|
+
method: 'GET'
|
|
44
|
+
})
|
|
45
|
+
.then(obj => obj.json())
|
|
46
|
+
.then(obj => obj.list);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const { data: termObj, status: termObjStatus } = useQuery({
|
|
50
|
+
queryKey: ['term', termCode],
|
|
51
|
+
queryFn: () => {
|
|
52
|
+
return fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/terms/latest/${termCode}`, {
|
|
53
|
+
method: 'GET'
|
|
54
|
+
})
|
|
55
|
+
.then(obj => obj.json())
|
|
56
|
+
.then(obj => obj.data);
|
|
57
|
+
},
|
|
58
|
+
enabled: !!termCode
|
|
59
|
+
});
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
var _a;
|
|
62
|
+
if (termListStatus === 'success' && Array.isArray(termList)) {
|
|
63
|
+
setRequiredTermItems([
|
|
64
|
+
{ title: '전체 동의', name: 'all', checked: false, isContent: false, isAll: true, termCode: '' },
|
|
65
|
+
...((_a = termList === null || termList === void 0 ? void 0 : termList.map(item => ({
|
|
66
|
+
title: `${item.code_name} (필수)`,
|
|
67
|
+
name: 'required',
|
|
68
|
+
checked: false,
|
|
69
|
+
isContent: !!item.contents,
|
|
70
|
+
termCode: item.terms_code || ''
|
|
71
|
+
}))) !== null && _a !== void 0 ? _a : [])
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
}, [termList, termListStatus]);
|
|
31
75
|
const router = useRouter();
|
|
32
76
|
const imagePath = process.env.NEXT_PUBLIC_S3_URL + '';
|
|
33
77
|
// 쿠키
|
|
@@ -36,41 +80,6 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
36
80
|
provider: ''
|
|
37
81
|
});
|
|
38
82
|
const redirect = decodeURIComponent(getCookie('redirect')) || '/';
|
|
39
|
-
const [requiredTermItems, setRequiredTermItems] = useState([
|
|
40
|
-
{ title: '전체 동의', name: 'all', checked: false, isContent: false, isAll: true },
|
|
41
|
-
{ title: '만 14세 이상 동의 (필수)', name: 'required', checked: false, isContent: false },
|
|
42
|
-
{ title: '서비스 이용약관 동의 (필수)', name: 'required', checked: false, isContent: true },
|
|
43
|
-
{ title: '개인정보 수집·이용 동의 (필수)', name: 'required', checked: false, isContent: true },
|
|
44
|
-
{ title: '개인정보 제3자 제공 동의 (필수)', name: 'required', checked: false, isContent: true }
|
|
45
|
-
]);
|
|
46
|
-
const [optionalTermItems, setOptionalTermItems] = useState([
|
|
47
|
-
{
|
|
48
|
-
title: '사건관련 알림 수신 동의 (선택)',
|
|
49
|
-
checked: false,
|
|
50
|
-
isContent: true,
|
|
51
|
-
cautionTitle: '*사건관련 알림을 수신할 채널을 선택해 주세요.',
|
|
52
|
-
name: 'optionalMain',
|
|
53
|
-
alarmTypeList: [
|
|
54
|
-
{ title: '푸시알림', name: 'optionalSelect', checked: false, value: 1 },
|
|
55
|
-
{ title: '카카오알림톡', name: 'optionalSelect', checked: false, value: 2 },
|
|
56
|
-
{ title: 'SMS', name: 'optionalSelect', checked: false, value: 4 },
|
|
57
|
-
{ title: '이메일', name: 'optionalSelect', checked: false, value: 8 }
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
title: '마케팅 정보 수신 동의 (선택)',
|
|
62
|
-
checked: false,
|
|
63
|
-
isContent: true,
|
|
64
|
-
cautionTitle: '*마케팅 정보를 수신할 채널을 선택해 주세요.',
|
|
65
|
-
name: 'optionalMain',
|
|
66
|
-
alarmTypeList: [
|
|
67
|
-
{ title: '푸시알림', name: 'optionalSelect', checked: false, value: 1 },
|
|
68
|
-
{ title: '카카오알림톡', name: 'optionalSelect', checked: false, value: 2 },
|
|
69
|
-
{ title: 'SMS', name: 'optionalSelect', checked: false, value: 4 },
|
|
70
|
-
{ title: '이메일', name: 'optionalSelect', checked: false, value: 8 }
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
]);
|
|
74
83
|
// 회원가입 미완료 시 쿠키 삭제
|
|
75
84
|
useEffect(() => {
|
|
76
85
|
const handleUnload = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -224,18 +233,11 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
224
233
|
const parentIdx = Number(dataset.parentidx);
|
|
225
234
|
const index = Number(dataset.idx);
|
|
226
235
|
const newRequiredTermItems = [...requiredTermItems];
|
|
227
|
-
const newOptionalTermItems = [...optionalTermItems];
|
|
228
236
|
if (name === 'all') {
|
|
229
237
|
const reverseState = !newRequiredTermItems[index].checked;
|
|
230
238
|
newRequiredTermItems.forEach(item => {
|
|
231
239
|
item.checked = reverseState;
|
|
232
240
|
});
|
|
233
|
-
newOptionalTermItems.forEach(item => {
|
|
234
|
-
item.checked = reverseState;
|
|
235
|
-
item.alarmTypeList.forEach(alarmItem => {
|
|
236
|
-
alarmItem.checked = reverseState;
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
241
|
}
|
|
240
242
|
else if (name === 'required') {
|
|
241
243
|
// 기본 체크
|
|
@@ -244,29 +246,7 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
244
246
|
newRequiredTermItems[0].checked = check;
|
|
245
247
|
// 전부 올 체크인지
|
|
246
248
|
}
|
|
247
|
-
else if (name === 'optionalMain') {
|
|
248
|
-
const checkedValue = !newOptionalTermItems[index].checked;
|
|
249
|
-
newOptionalTermItems[index].checked = checkedValue;
|
|
250
|
-
newOptionalTermItems[index].alarmTypeList.forEach(item => {
|
|
251
|
-
item.checked = checkedValue;
|
|
252
|
-
});
|
|
253
|
-
const check = newOptionalTermItems.every(item => item.checked) &&
|
|
254
|
-
newRequiredTermItems.slice(1).every(item => item.checked);
|
|
255
|
-
newRequiredTermItems[0].checked = check;
|
|
256
|
-
}
|
|
257
|
-
else if (name === 'optionalSelect') {
|
|
258
|
-
// 선택된 체크
|
|
259
|
-
newOptionalTermItems[parentIdx].alarmTypeList[index].checked =
|
|
260
|
-
!newOptionalTermItems[parentIdx].alarmTypeList[index].checked;
|
|
261
|
-
// 전부 체크인지 확인
|
|
262
|
-
newOptionalTermItems[parentIdx].checked = newOptionalTermItems[parentIdx].alarmTypeList.some(item => item.checked);
|
|
263
|
-
// 이제 전체동의 여부 확인
|
|
264
|
-
const check = newOptionalTermItems.every(item => item.checked) &&
|
|
265
|
-
newRequiredTermItems.slice(1).every(item => item.checked);
|
|
266
|
-
newRequiredTermItems[0].checked = check;
|
|
267
|
-
}
|
|
268
249
|
setRequiredTermItems(newRequiredTermItems);
|
|
269
|
-
setOptionalTermItems(newOptionalTermItems);
|
|
270
250
|
};
|
|
271
251
|
const timeChange = useCallback(() => {
|
|
272
252
|
setTimeLeft(210); // 초기화
|
|
@@ -349,7 +329,7 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
349
329
|
setIsModal(true);
|
|
350
330
|
}
|
|
351
331
|
});
|
|
352
|
-
const completeUser = (_a) => __awaiter(void 0, [_a], void 0, function* ({ completeBodyData
|
|
332
|
+
const completeUser = (_a) => __awaiter(void 0, [_a], void 0, function* ({ completeBodyData }) {
|
|
353
333
|
// 이름 설정
|
|
354
334
|
if (!userValidObj.nameValid) {
|
|
355
335
|
const { title, subTitle, key } = modalValueSet[modalValueSetKey.nameError];
|
|
@@ -371,14 +351,6 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
371
351
|
setIsModal(true);
|
|
372
352
|
return;
|
|
373
353
|
}
|
|
374
|
-
// 약관 저장
|
|
375
|
-
const termResult = yield optionalTermAgree({
|
|
376
|
-
bodyData: termBodyData
|
|
377
|
-
});
|
|
378
|
-
if (!termResult.result) {
|
|
379
|
-
// alert('회원가입 실패');
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
354
|
// 회원가입 완료
|
|
383
355
|
const result = yield completeUserSign({
|
|
384
356
|
bodyData: completeBodyData
|
|
@@ -402,6 +374,9 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
402
374
|
setIsModal(false);
|
|
403
375
|
setModalObj({ title: '', subTitle: '', key: '' });
|
|
404
376
|
};
|
|
377
|
+
if (termListStatus !== 'success' || (termCode && termObjStatus !== 'success')) {
|
|
378
|
+
return <Loader fullScreen/>;
|
|
379
|
+
}
|
|
405
380
|
return (<Suspense>
|
|
406
381
|
<section className={layoutClassName}>
|
|
407
382
|
<PageWrapper>
|
|
@@ -569,19 +544,11 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
569
544
|
var _a;
|
|
570
545
|
return (<RequiredCheckBox isAll={(_a = item.isAll) !== null && _a !== void 0 ? _a : false} checked={item.checked} index={index} name={item.name} key={index} title={item.title} isContent={item.isContent} setModal={() => {
|
|
571
546
|
setIsTermModal(true);
|
|
547
|
+
setTermCode(item.termCode);
|
|
572
548
|
}} handleButton={handleCheckBox}/>);
|
|
573
549
|
})}
|
|
574
550
|
</div>
|
|
575
551
|
</div>
|
|
576
|
-
<div className={' mt-[37px] flex flex-col gap-[40px] ' +
|
|
577
|
-
' max-lg:mt-[32px] max-lg:gap-[32px] ' +
|
|
578
|
-
' max-sm:mt-[30px] max-sm:gap-[30px] '}>
|
|
579
|
-
{optionalTermItems.map((item, index) => {
|
|
580
|
-
return (<OptionalCheckBox key={`option-${index}`} name={item.name} checked={item.checked} title={item.title} isContent={true} setModal={() => {
|
|
581
|
-
setIsTermModal(true);
|
|
582
|
-
}} cautionTitle={item.cautionTitle} parentIndex={index} optionalItemList={item.alarmTypeList} handleButton={handleCheckBox}/>);
|
|
583
|
-
})}
|
|
584
|
-
</div>
|
|
585
552
|
<div className={' mt-[80px] flex items-center justify-center ' +
|
|
586
553
|
' max-lg:mt-[72px] ' +
|
|
587
554
|
' max-sm:mt-[40px] '}>
|
|
@@ -591,14 +558,6 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
591
558
|
name: userObj.name,
|
|
592
559
|
phoneNumber: formatPhoneNumber(userObj.phoneNumber) || '',
|
|
593
560
|
uuid: userObj.uuid
|
|
594
|
-
},
|
|
595
|
-
termBodyData: {
|
|
596
|
-
alert_agree: optionalTermItems[0].alarmTypeList
|
|
597
|
-
.filter(item => item.checked)
|
|
598
|
-
.reduce((sum, item) => sum + item.value, 0), // checked된 항목들의 value 합산
|
|
599
|
-
marketing_agree: optionalTermItems[1].alarmTypeList
|
|
600
|
-
.filter(item => item.checked)
|
|
601
|
-
.reduce((sum, item) => sum + item.value, 0) // 마케팅 관련 동의 값 합산
|
|
602
561
|
}
|
|
603
562
|
});
|
|
604
563
|
})} className={` ${checkAll ? ' bg-[#AE0E36] text-white ' : ' bg-[#EDEDED] text-[#909090] '} ` +
|
|
@@ -612,8 +571,9 @@ const SignContainer = ({ layoutClassName = `mt-[47px] py-[128px] max-lg:mt-[40px
|
|
|
612
571
|
</PageWrapper>
|
|
613
572
|
<ConfirmModal isOpen={isModal} handleClick={modalHandleClose} onClose={modalHandleClose} title={modalObj.title} subTitle={modalObj.subTitle}/>
|
|
614
573
|
<TermModal isOpen={isTermModal} onClose={() => {
|
|
574
|
+
setTermCode('');
|
|
615
575
|
setIsTermModal(false);
|
|
616
|
-
}} title={
|
|
576
|
+
}} title={(termObj && `${termObj.code_name} (필수)`) || ''} content={(termObj && termObj.contents) || ''}/>
|
|
617
577
|
</section>
|
|
618
578
|
</Suspense>);
|
|
619
579
|
};
|
|
@@ -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;
|