[MobileSendPopUp] SHOPTIME-2875

- 국가별 번호 자릿 수 여부에 따라 sms 호출
- 자릿 수 맞지 않으면 알럿메세지 노출
This commit is contained in:
jiwon93.son
2024-07-26 16:06:03 +09:00
parent 462e94142f
commit f9e37e6fe3

View File

@@ -1,48 +1,67 @@
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 {
AsYouTypeFormatter,
PhoneNumberFormat,
PhoneNumberUtil,
} from "google-libphonenumber";
import { useDispatch, useSelector } from "react-redux";
} from 'google-libphonenumber';
import {
useDispatch,
useSelector,
} from 'react-redux';
import { off, on } from "@enact/core/dispatcher";
import spotlight, { Spotlight } from "@enact/spotlight";
import { SpotlightContainerDecorator } from "@enact/spotlight/SpotlightContainerDecorator";
import { Spottable } from "@enact/spotlight/Spottable";
import {
off,
on,
} from '@enact/core/dispatcher';
import spotlight, { 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 { types } from "../../actions/actionTypes";
import { clearSMS, sendSms } from "../../actions/appDataActions";
import defaultImage from '../../../assets/images/img-thumb-empty-144@3x.png';
import { types } from '../../actions/actionTypes';
import {
clearSMS,
sendSms,
} from '../../actions/appDataActions';
import {
changeLocalSettings,
setHidePopup,
setShowPopup,
} from "../../actions/commonActions";
} from '../../actions/commonActions';
import {
clearRegisterDeviceInfo,
getDeviceAdditionInfo,
registerDeviceInfo,
} from "../../actions/deviceActions";
} from '../../actions/deviceActions';
import {
clearCurationCoupon,
setEventIssueReq,
} from "../../actions/eventActions";
import { sendLogShopByMobile } from "../../actions/logActions";
import { ACTIVE_POPUP, LOG_TP_NO } from "../../utils/Config";
} from '../../actions/eventActions';
import { sendLogShopByMobile } from '../../actions/logActions';
import {
ACTIVE_POPUP,
LOG_TP_NO,
} from '../../utils/Config';
import {
$L,
decryptPhoneNumber,
encryptPhoneNumber,
} from "../../utils/helperMethods";
import CustomImage from "../CustomImage/CustomImage";
import TButton from "../TButton/TButton";
import TPopUp from "../TPopUp/TPopUp";
import HistoryPhoneNumber from "./HistoryPhoneNumber/HistoryPhoneNumber";
import css from "./MobileSendPopUp.module.less";
import SMSNumKeyPad from "./SMSNumKeyPad";
} from '../../utils/helperMethods';
import CustomImage from '../CustomImage/CustomImage';
import TButton from '../TButton/TButton';
import TPopUp from '../TPopUp/TPopUp';
import HistoryPhoneNumber from './HistoryPhoneNumber/HistoryPhoneNumber';
import css from './MobileSendPopUp.module.less';
import SMSNumKeyPad from './SMSNumKeyPad';
const SECRET_KEY = "fy7BTKuM9eeTQqEC9sF3Iw5qG43Aaip";
@@ -277,10 +296,13 @@ export default function MobileSendPopUp({
};
const handleAgreeSendClick = useCallback(() => {
if (!mobileNumber) return;
let naturalNumber = mobileNumber.replace(/\D/g, "");
if (!mobileNumber || naturalNumber.length < getMaxNum(deviceCountryCode)) {
setSmsRetCode(907);
return;
}
if (deviceCountryCode === "KR") {
naturalNumber = "82" + naturalNumber;
}
@@ -476,6 +498,8 @@ export default function MobileSendPopUp({
return SMS_ERROR_905;
case 906:
return SMS_ERROR_906;
case 907:
return SMS_ERROR_907;
default:
return SMS_ERROR_900;
}