SHOPTIME-1933 [Shoptime 고도화] TV 앱 테스트 (시스템 운영팀) / [SHOPTIME-3323] SBM / 빈 전화번호 히스토리 발생

1. MobileSendPopup.jsx
2. HistoryPhoneNumber.jsx
- 원인: 재현 경로 알 수 없음
- 대책: 방어 logic 추가 (rendering 조건 수정, 히스토리 배열 filtering)
This commit is contained in:
younghoon100.park
2024-10-25 16:53:56 +09:00
parent 69a6d38d60
commit f909690533
2 changed files with 53 additions and 31 deletions

View File

@@ -86,11 +86,8 @@ export default function MobileSendPopUp({
shopByMobileLogRef,
spotlightId,
}) {
const dispatch = useDispatch();
const deviceInfo = useSelector((state) => state.device.deviceInfo);
const [mobileNumber, setMobileNumber] = useState("");
const [recentSentNumber, setRecentSentNumber] = useState([]);
const [keyPadOff, setKeyPadOff] = useState(false);
const [smsRetCode, setSmsRetCode] = useState(undefined);
const { httpHeader } = useSelector((state) => state.common);
const regDeviceInfoRetCode = useSelector(
(state) => state.device?.regDeviceInfoData?.retCode
@@ -106,11 +103,23 @@ export default function MobileSendPopUp({
);
const popupVisible = useSelector((state) => state.common.popup.popupVisible);
const nowMenu = useSelector((state) => state.common.menu.nowMenu);
const deviceCountryCode = httpHeader["X-Device-Country"];
const dispatch = useDispatch();
const [inputDisabled, setInputDisabled] = useState(true);
const [mobileNumber, setMobileNumber] = useState("");
const [recentSentNumber, setRecentSentNumber] = useState([]);
const [keyPadOff, setKeyPadOff] = useState(false);
const [smsRetCode, setSmsRetCode] = useState(undefined);
const agreeBtnClickedRef = useRef(false);
const deviceCountryCode = httpHeader["X-Device-Country"];
const mobileSendPopUpSpotlightId = useMemo(() => {
return !keyPadOff && recentSentNumber.length <= 0
? "keypad-number-1"
: "agreeAndSend";
}, [keyPadOff, recentSentNumber]);
const getMaxNum = useCallback((_deviceCountryCode) => {
if (_deviceCountryCode === "DE" || _deviceCountryCode === "GB") {
return 11;
@@ -236,16 +245,22 @@ export default function MobileSendPopUp({
}
}, [deviceInfo, dispatch]);
useEffect(() => {
const timer = setTimeout(() =>
setInputDisabled(mobileSendPopUpSpotlightId === "keypad-number-1")
);
return () => clearTimeout(timer);
}, [mobileSendPopUpSpotlightId]);
useEffect(() => {
if (!agreeBtnClickedRef.current && recentSentNumber) {
if (recentSentNumber.length > 0) {
setKeyPadOff(true);
setMobileNumber(recentSentNumber[0]);
setTimeout(() => Spotlight.focus("agreeAndSend"));
} else {
setKeyPadOff(false);
setMobileNumber("");
setTimeout(() => Spotlight.focus("keypad-number-1"));
}
}
}, [recentSentNumber]);
@@ -279,9 +294,6 @@ export default function MobileSendPopUp({
},
})
);
setTimeout(() => {
spotlight.focus("history-container");
});
}
};
@@ -531,6 +543,7 @@ export default function MobileSendPopUp({
open={open}
onClose={onClose}
hasText
spotlightId={mobileSendPopUpSpotlightId}
>
<div className={css.header}>
{productImg && (
@@ -570,7 +583,7 @@ export default function MobileSendPopUp({
<SpottableComponent
className={css.inputNum}
onClick={handleInputClick}
spotlightDisabled
spotlightDisabled={inputDisabled}
>
{deviceCountryCode && deviceCountryCode === "RU" && (
<span className={css.rucInput}>{"+7 "}</span>
@@ -578,19 +591,18 @@ export default function MobileSendPopUp({
<span>{mobileNumber}</span>
</SpottableComponent>
</InputContainer>
{keyPadOff ? (
<Container spotlightId="history-container">
<Container>
{keyPadOff && recentSentNumber.length > 0 ? (
<HistoryPhoneNumber
handleClickSelect={handleClickSelect}
handleDelete={handleDelete}
recentSentNumber={recentSentNumber}
/>
</Container>
) : (
<Container>
) : (
<SMSNumKeyPad onKeyDown={numKeypadClicked} />
</Container>
)}
)}
</Container>
</div>
<div className={css.instruction}>
{deviceCountryCode && (