[MobileSendPopUp] SHOPTIME-2631 : SBM popup open default focus
This commit is contained in:
@@ -1,43 +1,63 @@
|
|||||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
import React, {
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useState,
|
||||||
|
} from 'react';
|
||||||
|
|
||||||
import classNames from "classnames";
|
import classNames from 'classnames';
|
||||||
import {
|
import {
|
||||||
AsYouTypeFormatter,
|
AsYouTypeFormatter,
|
||||||
PhoneNumberFormat,
|
PhoneNumberFormat,
|
||||||
PhoneNumberUtil,
|
PhoneNumberUtil,
|
||||||
} from "google-libphonenumber";
|
} from 'google-libphonenumber';
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import {
|
||||||
|
useDispatch,
|
||||||
|
useSelector,
|
||||||
|
} from 'react-redux';
|
||||||
|
|
||||||
import { off, on } from "@enact/core/dispatcher";
|
import {
|
||||||
import { SpotlightContainerDecorator } from "@enact/spotlight/SpotlightContainerDecorator";
|
off,
|
||||||
import { Spottable } from "@enact/spotlight/Spottable";
|
on,
|
||||||
|
} from '@enact/core/dispatcher';
|
||||||
|
import { Spotlight } from '@enact/spotlight';
|
||||||
|
import {
|
||||||
|
SpotlightContainerDecorator,
|
||||||
|
} from '@enact/spotlight/SpotlightContainerDecorator';
|
||||||
|
import { Spottable } from '@enact/spotlight/Spottable';
|
||||||
|
|
||||||
import defaultImage from "../../../assets/images/img-thumb-empty-144@3x.png";
|
import defaultImage from '../../../assets/images/img-thumb-empty-144@3x.png';
|
||||||
import { types } from "../../actions/actionTypes";
|
import { types } from '../../actions/actionTypes';
|
||||||
import { clearSMS, sendSms } from "../../actions/appDataActions";
|
import {
|
||||||
|
clearSMS,
|
||||||
|
sendSms,
|
||||||
|
} from '../../actions/appDataActions';
|
||||||
import {
|
import {
|
||||||
changeLocalSettings,
|
changeLocalSettings,
|
||||||
setHidePopup,
|
setHidePopup,
|
||||||
setShowPopup,
|
setShowPopup,
|
||||||
} from "../../actions/commonActions";
|
} from '../../actions/commonActions';
|
||||||
import {
|
import {
|
||||||
clearRegisterDeviceInfo,
|
clearRegisterDeviceInfo,
|
||||||
getDeviceAdditionInfo,
|
getDeviceAdditionInfo,
|
||||||
registerDeviceInfo,
|
registerDeviceInfo,
|
||||||
} from "../../actions/deviceActions";
|
} from '../../actions/deviceActions';
|
||||||
import {
|
import {
|
||||||
clearCurationCoupon,
|
clearCurationCoupon,
|
||||||
setEventIssueReq,
|
setEventIssueReq,
|
||||||
} from "../../actions/eventActions";
|
} from '../../actions/eventActions';
|
||||||
import useLogService from "../../hooks/useLogService";
|
import useLogService from '../../hooks/useLogService';
|
||||||
import { ACTIVE_POPUP, LOG_TP_NO } from "../../utils/Config";
|
import {
|
||||||
import { $L } from "../../utils/helperMethods";
|
ACTIVE_POPUP,
|
||||||
import CustomImage from "../CustomImage/CustomImage";
|
LOG_TP_NO,
|
||||||
import TButton from "../TButton/TButton";
|
} from '../../utils/Config';
|
||||||
import TPopUp from "../TPopUp/TPopUp";
|
import { $L } from '../../utils/helperMethods';
|
||||||
import HistoryPhoneNumber from "./HistoryPhoneNumber/HistoryPhoneNumber";
|
import CustomImage from '../CustomImage/CustomImage';
|
||||||
import css from "./MobileSendPopUp.module.less";
|
import TButton from '../TButton/TButton';
|
||||||
import SMSNumKeyPad from "./SMSNumKeyPad";
|
import TPopUp from '../TPopUp/TPopUp';
|
||||||
|
import HistoryPhoneNumber from './HistoryPhoneNumber/HistoryPhoneNumber';
|
||||||
|
import css from './MobileSendPopUp.module.less';
|
||||||
|
import SMSNumKeyPad from './SMSNumKeyPad';
|
||||||
|
|
||||||
const Container = SpotlightContainerDecorator(
|
const Container = SpotlightContainerDecorator(
|
||||||
{ enterTo: "last-focused" },
|
{ enterTo: "last-focused" },
|
||||||
@@ -87,6 +107,7 @@ export default function MobileSendPopUp({
|
|||||||
const curationCouponSuccess = useSelector(
|
const curationCouponSuccess = useSelector(
|
||||||
(state) => state.event.curationCouponSuccess
|
(state) => state.event.curationCouponSuccess
|
||||||
);
|
);
|
||||||
|
const popupVisible = useSelector((state) => state.common.popup.popupVisible);
|
||||||
const deviceCountryCode = httpHeader["X-Device-Country"];
|
const deviceCountryCode = httpHeader["X-Device-Country"];
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
@@ -354,6 +375,8 @@ export default function MobileSendPopUp({
|
|||||||
}
|
}
|
||||||
onClose();
|
onClose();
|
||||||
dispatch(setShowPopup(ACTIVE_POPUP.smsPopup));
|
dispatch(setShowPopup(ACTIVE_POPUP.smsPopup));
|
||||||
|
|
||||||
|
setTimeout(() => Spotlight.focus("agreeAndSend"));
|
||||||
},
|
},
|
||||||
[dispatch, smsRetCode]
|
[dispatch, smsRetCode]
|
||||||
);
|
);
|
||||||
@@ -381,6 +404,8 @@ export default function MobileSendPopUp({
|
|||||||
|
|
||||||
sendLogShopByMobile(params);
|
sendLogShopByMobile(params);
|
||||||
shopByMobileLogRef.current = null;
|
shopByMobileLogRef.current = null;
|
||||||
|
|
||||||
|
Spotlight.focus();
|
||||||
}
|
}
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
@@ -459,9 +484,16 @@ export default function MobileSendPopUp({
|
|||||||
}
|
}
|
||||||
}, [curationCouponSuccess, mobileNumber]);
|
}, [curationCouponSuccess, mobileNumber]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
Spotlight.focus("agreeAndSend");
|
||||||
|
});
|
||||||
|
}, [dispatch]);
|
||||||
|
|
||||||
const retCodeError =
|
const retCodeError =
|
||||||
(smsRetCode !== undefined && smsRetCode !== 0) ||
|
(smsRetCode !== undefined && smsRetCode !== 0) ||
|
||||||
(curationCouponSuccess !== undefined && curationCouponSuccess !== 0);
|
(curationCouponSuccess !== undefined && curationCouponSuccess !== 0);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{smsRetCode === undefined &&
|
{smsRetCode === undefined &&
|
||||||
@@ -542,7 +574,10 @@ export default function MobileSendPopUp({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={css.btnContainer}>
|
<div className={css.btnContainer}>
|
||||||
<TButton onClick={handleAgreeSendClick}>
|
<TButton
|
||||||
|
onClick={handleAgreeSendClick}
|
||||||
|
spotlightId={"agreeAndSend"}
|
||||||
|
>
|
||||||
{$L("Agree and Send")}
|
{$L("Agree and Send")}
|
||||||
</TButton>
|
</TButton>
|
||||||
<TButton onClick={onClose}>{$L("Cancel")}</TButton>
|
<TButton onClick={onClose}>{$L("Cancel")}</TButton>
|
||||||
@@ -552,7 +587,7 @@ export default function MobileSendPopUp({
|
|||||||
{retCodeError && (
|
{retCodeError && (
|
||||||
<TPopUp
|
<TPopUp
|
||||||
kind="textPopup"
|
kind="textPopup"
|
||||||
open={true}
|
open={popupVisible}
|
||||||
hasText
|
hasText
|
||||||
text={smsTpCd ? getSmsErrorMsg : getEvntErrorMsg}
|
text={smsTpCd ? getSmsErrorMsg : getEvntErrorMsg}
|
||||||
onClick={_onClose}
|
onClick={_onClose}
|
||||||
@@ -563,7 +598,12 @@ export default function MobileSendPopUp({
|
|||||||
{(smsRetCode === 0 ||
|
{(smsRetCode === 0 ||
|
||||||
regDeviceInfoRetCode === 0 ||
|
regDeviceInfoRetCode === 0 ||
|
||||||
regDeviceInfoRetCode === 0) && (
|
regDeviceInfoRetCode === 0) && (
|
||||||
<TPopUp kind="textPopup" open={true} hasText text={MSG_SUCCESS_SENT} />
|
<TPopUp
|
||||||
|
kind="textPopup"
|
||||||
|
open={popupVisible}
|
||||||
|
hasText
|
||||||
|
text={MSG_SUCCESS_SENT}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user