[SHOPTIME-3960] 운영 EMP 약관 타이틀과 내용이 중복되어 조치 필요

[수정내용] 시나리오 문제로 termsTypeName 데이터가 노출되지 않도록 수정
This commit is contained in:
고동영
2025-02-05 14:10:04 +09:00
parent 9a7bc7924d
commit 83dd0a5b3e

View File

@@ -1,4 +1,10 @@
import React, { useCallback, useEffect, useRef, useState } from "react";
import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import { useDispatch, useSelector } from "react-redux";
@@ -70,7 +76,6 @@ export default function TermsOfService({ title, cbScrollTo }) {
newTabList.push(term.termsTypeName);
tempList.push({
termsName: term.termsTypeName,
termsContents: term.termContent,
termsId: term.termsID,
trmsTpCd: term.trmsTpCd,
@@ -149,6 +154,18 @@ export default function TermsOfService({ title, cbScrollTo }) {
dispatch(setHidePopup());
}, [dispatch]);
const termsAriaLabel = useMemo(() => {
if (!termsList || !termsList[selectedTab]) return "";
const termsName = termsList[selectedTab]?.termsName || "";
const termsContents = termsList[selectedTab]?.termsContents || "";
const cleanTermsName = termsName.replace(/(<([^>]+)>)/gi, "");
const cleanTermsContents = termsContents.replace(/(<([^>]+)>)/gi, "");
return cleanTermsName + cleanTermsContents;
}, [termsList, selectedTab]);
return (
<>
<THeader title={title} ariaLabel="TERMS OF SERVICE, heading 1" />
@@ -166,26 +183,7 @@ export default function TermsOfService({ title, cbScrollTo }) {
width={scaleW(1680)}
resetScrollPosition={resetScroll}
>
<div
className={css.textBox}
aria-label={
termsList &&
termsList[selectedTab]?.termsName.replace(
/(<([^>]+)>)/gi,
""
) + termsList &&
termsList[selectedTab]?.termsContents.replace(
/(<([^>]+)>)/gi,
""
)
}
>
<div
className={css.subTitle}
dangerouslySetInnerHTML={{
__html: termsList && termsList[selectedTab]?.termsName,
}}
/>
<div className={css.textBox} aria-label={termsAriaLabel}>
<div
className={css.text}
dangerouslySetInnerHTML={{