@tap-payments/auth-jsconnect 2.8.89-development → 2.8.91-development
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/build/@types/app.d.ts +1 -0
- package/build/constants/dummy.js +4 -0
- package/build/features/auth/screens/OTP/OTP.js +6 -5
- package/build/features/bank/screens/Verify/Verify.js +3 -2
- package/build/features/board/screens/Verify/Verify.js +3 -2
- package/build/features/brand/screens/Verify/Verify.js +3 -2
- package/build/features/business/screens/Verify/Verify.js +3 -2
- package/build/features/connect/screens/OTP/OTP.js +5 -5
- package/build/features/connectExpress/screens/OTP/OTP.js +3 -2
- package/build/features/entity/screens/Verify/Verify.js +3 -2
- package/build/features/individual/screens/Verify/Verify.js +3 -2
- package/build/features/password/screens/OTP/OTP.js +3 -3
- package/build/features/password/screens/Verify/Verify.js +3 -2
- package/build/features/shared/BusinessCountry/BusinessCountry.js +1 -1
- package/build/features/signIn/screens/OTP/OTP.js +4 -3
- package/build/features/tax/screens/Verify/Verify.js +3 -2
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useSanitizedTranslation.d.ts +1 -0
- package/build/hooks/useSanitizedTranslation.js +15 -0
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
package/build/constants/dummy.js
CHANGED
|
@@ -596,6 +596,7 @@ export var BUSINESS_COUNTRIES = [
|
|
|
596
596
|
{
|
|
597
597
|
id: 1,
|
|
598
598
|
title: 'Middle East',
|
|
599
|
+
title_ar: 'الشرق الأوسط',
|
|
599
600
|
countries: [
|
|
600
601
|
{
|
|
601
602
|
id: 1,
|
|
@@ -737,6 +738,7 @@ export var BUSINESS_COUNTRIES = [
|
|
|
737
738
|
{
|
|
738
739
|
id: 2,
|
|
739
740
|
title: 'Europe',
|
|
741
|
+
title_ar: 'أوروبا',
|
|
740
742
|
countries: [
|
|
741
743
|
{
|
|
742
744
|
id: 6,
|
|
@@ -848,6 +850,7 @@ export var BUSINESS_COUNTRIES = [
|
|
|
848
850
|
{
|
|
849
851
|
id: 6,
|
|
850
852
|
title: 'South Asia',
|
|
853
|
+
title_ar: 'جنوب آسيا',
|
|
851
854
|
countries: [
|
|
852
855
|
{
|
|
853
856
|
id: 15,
|
|
@@ -884,6 +887,7 @@ export var BUSINESS_COUNTRIES = [
|
|
|
884
887
|
{
|
|
885
888
|
id: 5,
|
|
886
889
|
title: 'South East Asia',
|
|
890
|
+
title_ar: 'جنوب شرق آسيا',
|
|
887
891
|
countries: [
|
|
888
892
|
{
|
|
889
893
|
id: 9,
|
|
@@ -19,7 +19,7 @@ import Text from '../../../../components/Text';
|
|
|
19
19
|
import { clearError, authSelector, verifyMobileOtp, resetOTPValue, verifyEmailOtp } from '../../../app/auth/authStore';
|
|
20
20
|
import Button from '../../../shared/Button';
|
|
21
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
|
-
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
22
|
+
import { useAppDispatch, useAppSelector, useLanguage, useSanitizedTranslation } from '../../../../hooks';
|
|
23
23
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
24
24
|
import { AuthForType, AuthTypeNumber } from '../../../../@types';
|
|
25
25
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
@@ -51,6 +51,7 @@ var OTP = function () {
|
|
|
51
51
|
var dispatch = useAppDispatch();
|
|
52
52
|
var _b = useAppSelector(authSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
53
53
|
var t = useTranslation().t;
|
|
54
|
+
var st = useSanitizedTranslation();
|
|
54
55
|
var isAr = useLanguage().isAr;
|
|
55
56
|
var _c = ((_a = data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse) || {}, auth_type = _c.auth_type, email = _c.email, mobile = _c.mobile;
|
|
56
57
|
var methods = useForm({
|
|
@@ -79,10 +80,10 @@ var OTP = function () {
|
|
|
79
80
|
return t('opt_nid_sent_title', { provider: 'ABSHER' });
|
|
80
81
|
if (isEmailAuth) {
|
|
81
82
|
if (auth_type === AuthTypeNumber.EMAIL_OTP)
|
|
82
|
-
return
|
|
83
|
-
return
|
|
83
|
+
return st('otp_email_sent_title');
|
|
84
|
+
return st('ide_opt_sent_title');
|
|
84
85
|
}
|
|
85
|
-
return
|
|
86
|
+
return st('ide_opt_sent_title');
|
|
86
87
|
};
|
|
87
88
|
React.useEffect(function () {
|
|
88
89
|
if (error)
|
|
@@ -112,6 +113,6 @@ var OTP = function () {
|
|
|
112
113
|
dispatch(handlePrevScreenStep(screen));
|
|
113
114
|
};
|
|
114
115
|
var disabled = !methods.formState.isValid;
|
|
115
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
116
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : getTitle(), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: getNumber() }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
116
117
|
};
|
|
117
118
|
export default React.memo(OTP);
|
|
@@ -17,7 +17,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import Box from '@mui/material/Box/Box';
|
|
19
19
|
import { styled } from '@mui/material/styles';
|
|
20
|
-
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
|
+
import { useLanguage, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
21
21
|
import { deepCopy, maskPhone } from '../../../../utils';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Text from '../../../../components/Text';
|
|
@@ -48,6 +48,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
48
48
|
var VerifyNumber = function (_a) {
|
|
49
49
|
var _b, _c;
|
|
50
50
|
var dispatch = useAppDispatch();
|
|
51
|
+
var st = useSanitizedTranslation();
|
|
51
52
|
var _d = useAppSelector(bankSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
52
53
|
var methods = useForm({
|
|
53
54
|
resolver: yupResolver(OTPValidation),
|
|
@@ -69,6 +70,6 @@ var VerifyNumber = function (_a) {
|
|
|
69
70
|
dispatch(verifyBankLeadOTP(deepCopy(formData)));
|
|
70
71
|
};
|
|
71
72
|
var disabled = !methods.formState.isValid || !phone || resendLoading;
|
|
72
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
73
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
73
74
|
};
|
|
74
75
|
export default React.memo(VerifyNumber);
|
|
@@ -17,7 +17,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import Box from '@mui/material/Box/Box';
|
|
19
19
|
import { styled } from '@mui/material/styles';
|
|
20
|
-
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
|
+
import { useLanguage, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
21
21
|
import { deepCopy, maskPhone } from '../../../../utils';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Text from '../../../../components/Text';
|
|
@@ -55,6 +55,7 @@ var VerifyNumber = function (_a) {
|
|
|
55
55
|
mode: 'onChange'
|
|
56
56
|
});
|
|
57
57
|
var t = useTranslation().t;
|
|
58
|
+
var st = useSanitizedTranslation();
|
|
58
59
|
var isAr = useLanguage().isAr;
|
|
59
60
|
var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
|
|
60
61
|
var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
|
|
@@ -69,6 +70,6 @@ var VerifyNumber = function (_a) {
|
|
|
69
70
|
dispatch(verifyBoardLeadOTP(deepCopy(formData)));
|
|
70
71
|
};
|
|
71
72
|
var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
|
|
72
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
73
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
73
74
|
};
|
|
74
75
|
export default React.memo(VerifyNumber);
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
|
|
14
|
+
import { useAppDispatch, useSetFromDefaultValues, useSanitizedTranslation } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
@@ -59,6 +59,7 @@ var VerifyNumber = function (_a) {
|
|
|
59
59
|
});
|
|
60
60
|
useSetFromDefaultValues(methods, data.otpData);
|
|
61
61
|
var t = useTranslation().t;
|
|
62
|
+
var st = useSanitizedTranslation();
|
|
62
63
|
var isAr = useLanguage().isAr;
|
|
63
64
|
var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
|
|
64
65
|
var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
|
|
@@ -73,6 +74,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
74
|
dispatch(verifyBrandLeadOTP(deepCopy(formData)));
|
|
74
75
|
};
|
|
75
76
|
var disabled = !methods.formState.isValid || !phone || resendLoading;
|
|
76
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
77
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
78
|
};
|
|
78
79
|
export default React.memo(VerifyNumber);
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
14
|
+
import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
@@ -49,6 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
49
49
|
var VerifyNumber = function (_a) {
|
|
50
50
|
var _b, _c;
|
|
51
51
|
var dispatch = useAppDispatch();
|
|
52
|
+
var st = useSanitizedTranslation();
|
|
52
53
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
53
54
|
var _d = useAppSelector(businessSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
54
55
|
var methods = useForm({
|
|
@@ -83,6 +84,6 @@ var VerifyNumber = function (_a) {
|
|
|
83
84
|
dispatch(handlePrevScreenStep());
|
|
84
85
|
};
|
|
85
86
|
var disabled = !methods.formState.isValid || !phone || resendLoading;
|
|
86
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
87
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
87
88
|
};
|
|
88
89
|
export default React.memo(VerifyNumber);
|
|
@@ -18,9 +18,8 @@ import Text from '../../../../components/Text';
|
|
|
18
18
|
import { clearError, connectSelector, resetOTPScreen, verifyAuth } from '../../../app/connect/connectStore';
|
|
19
19
|
import Button from '../../../shared/Button';
|
|
20
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
21
|
+
import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues, useSanitizedTranslation } from '../../../../hooks';
|
|
22
22
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
23
|
-
import { useLanguage } from '../../../../hooks';
|
|
24
23
|
import { AuthForType } from '../../../../@types';
|
|
25
24
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
26
25
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
@@ -50,6 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var OTP = function () {
|
|
51
50
|
var _a;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
52
|
+
var t = useTranslation().t;
|
|
53
53
|
var _b = useAppSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
54
54
|
var otp = data.otpData.otp;
|
|
55
55
|
var methods = useForm({
|
|
@@ -60,7 +60,7 @@ var OTP = function () {
|
|
|
60
60
|
mode: 'onChange'
|
|
61
61
|
});
|
|
62
62
|
useSetFromDefaultValues(methods, data.otpData);
|
|
63
|
-
var
|
|
63
|
+
var st = useSanitizedTranslation();
|
|
64
64
|
var isAr = useLanguage().isAr;
|
|
65
65
|
var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
66
66
|
React.useEffect(function () {
|
|
@@ -86,7 +86,7 @@ var OTP = function () {
|
|
|
86
86
|
var disabled = !methods.formState.isValid;
|
|
87
87
|
var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
|
|
88
88
|
var idNumber = data.nidData.nid;
|
|
89
|
-
var title = startWithNID ? t('opt_nid_sent_title', { provider: 'ABSHER' }) :
|
|
90
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
89
|
+
var title = startWithNID ? t('opt_nid_sent_title', { provider: 'ABSHER' }) : st('ide_opt_sent_title');
|
|
90
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: startWithNID ? maskID(idNumber) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
91
91
|
};
|
|
92
92
|
export default React.memo(OTP);
|
|
@@ -18,7 +18,7 @@ import Text from '../../../../components/Text';
|
|
|
18
18
|
import { clearError, connectExpressSelector, verifyMobileOtpAsync, resetOTPValue } from '../../../app/connectExpress/connectExpressStore';
|
|
19
19
|
import Button from '../../../shared/Button';
|
|
20
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
|
+
import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
22
22
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
23
23
|
import { useLanguage } from '../../../../hooks';
|
|
24
24
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -51,6 +51,7 @@ var OTP = function () {
|
|
|
51
51
|
var dispatch = useAppDispatch();
|
|
52
52
|
var _b = useAppSelector(connectExpressSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
53
53
|
var t = useTranslation().t;
|
|
54
|
+
var st = useSanitizedTranslation();
|
|
54
55
|
var isAr = useLanguage().isAr;
|
|
55
56
|
var methods = useForm({
|
|
56
57
|
resolver: yupResolver(OTPValidation),
|
|
@@ -80,6 +81,6 @@ var OTP = function () {
|
|
|
80
81
|
var disabled = !methods.formState.isValid;
|
|
81
82
|
var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
|
|
82
83
|
var title = t('ide_opt_sent_title');
|
|
83
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
84
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
84
85
|
};
|
|
85
86
|
export default React.memo(OTP);
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
|
|
14
|
+
import { useAppDispatch, useSetFromDefaultValues, useSanitizedTranslation } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
@@ -59,6 +59,7 @@ var VerifyNumber = function (_a) {
|
|
|
59
59
|
});
|
|
60
60
|
useSetFromDefaultValues(methods, data.otpData);
|
|
61
61
|
var t = useTranslation().t;
|
|
62
|
+
var st = useSanitizedTranslation();
|
|
62
63
|
var isAr = useLanguage().isAr;
|
|
63
64
|
var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
|
|
64
65
|
var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
|
|
@@ -73,6 +74,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
74
|
dispatch(verifyEntityLeadOTP(deepCopy(formData)));
|
|
74
75
|
};
|
|
75
76
|
var disabled = !methods.formState.isValid || !phone || resendLoading;
|
|
76
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
77
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
78
|
};
|
|
78
79
|
export default React.memo(VerifyNumber);
|
|
@@ -17,7 +17,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import Box from '@mui/material/Box/Box';
|
|
19
19
|
import { styled } from '@mui/material/styles';
|
|
20
|
-
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
|
+
import { useLanguage, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
21
21
|
import { deepCopy, maskPhone } from '../../../../utils';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Text from '../../../../components/Text';
|
|
@@ -59,6 +59,7 @@ var VerifyNumber = function (_a) {
|
|
|
59
59
|
});
|
|
60
60
|
useSetFromDefaultValues(methods, data.otpData);
|
|
61
61
|
var t = useTranslation().t;
|
|
62
|
+
var st = useSanitizedTranslation();
|
|
62
63
|
var isAr = useLanguage().isAr;
|
|
63
64
|
var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
|
|
64
65
|
var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
|
|
@@ -75,6 +76,6 @@ var VerifyNumber = function (_a) {
|
|
|
75
76
|
var disabled = !methods.formState.isValid || !phone || resendLoading;
|
|
76
77
|
var dataLoading = loading || cityLoading;
|
|
77
78
|
var showMobileNumber = !loading && !cityLoading && phone;
|
|
78
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [dataLoading ?
|
|
79
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [dataLoading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), showMobileNumber && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
79
80
|
};
|
|
80
81
|
export default React.memo(VerifyNumber);
|
|
@@ -22,14 +22,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import * as React from 'react';
|
|
25
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
25
|
+
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useSanitizedTranslation, useLanguage } from '../../../../hooks';
|
|
26
26
|
import { useTranslation } from 'react-i18next';
|
|
27
27
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
28
28
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
29
29
|
import Box from '@mui/material/Box/Box';
|
|
30
30
|
import { styled } from '@mui/material/styles';
|
|
31
31
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
32
|
-
import { useLanguage } from '../../../../hooks';
|
|
33
32
|
import Form from '../../../../components/Form';
|
|
34
33
|
import Text from '../../../../components/Text';
|
|
35
34
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -69,6 +68,7 @@ var OTP = function (_a) {
|
|
|
69
68
|
});
|
|
70
69
|
useSetFromDefaultValues(methods, defaultValues);
|
|
71
70
|
var t = useTranslation().t;
|
|
71
|
+
var st = useSanitizedTranslation();
|
|
72
72
|
var isAr = useLanguage().isAr;
|
|
73
73
|
React.useEffect(function () {
|
|
74
74
|
if (error)
|
|
@@ -85,7 +85,7 @@ var OTP = function (_a) {
|
|
|
85
85
|
};
|
|
86
86
|
var disabled = !methods.formState.isValid;
|
|
87
87
|
var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.auth_info) === null || _c === void 0 ? void 0 : _c.phone;
|
|
88
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
88
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: st('next') }))] })) })) }));
|
|
89
89
|
};
|
|
90
90
|
OTP.defaultProps = {};
|
|
91
91
|
export default React.memo(OTP);
|
|
@@ -17,7 +17,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import Box from '@mui/material/Box/Box';
|
|
19
19
|
import { styled } from '@mui/material/styles';
|
|
20
|
-
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
|
+
import { useLanguage, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
21
21
|
import { deepCopy, maskPhone } from '../../../../utils';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Text from '../../../../components/Text';
|
|
@@ -59,6 +59,7 @@ var VerifyNumber = function (_a) {
|
|
|
59
59
|
});
|
|
60
60
|
useSetFromDefaultValues(methods, data.otpData);
|
|
61
61
|
var t = useTranslation().t;
|
|
62
|
+
var st = useSanitizedTranslation();
|
|
62
63
|
var isAr = useLanguage().isAr;
|
|
63
64
|
var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
|
|
64
65
|
var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
|
|
@@ -73,6 +74,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
74
|
dispatch(verifyPasswordLeadOTP(deepCopy(formData)));
|
|
74
75
|
};
|
|
75
76
|
var disabled = !methods.formState.isValid || !phone || resendLoading;
|
|
76
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
77
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled || resendLoading, isAr: isAr, loading: loading, error: st(error || '') }, { children: st('next') }))] })) })) }));
|
|
77
78
|
};
|
|
78
79
|
export default React.memo(VerifyNumber);
|
|
@@ -163,7 +163,7 @@ var BusinessCountry = function (_a) {
|
|
|
163
163
|
handleOpenSubMenu(item.id.toString());
|
|
164
164
|
}, renderItem: function (item) {
|
|
165
165
|
var isSelected = !!item.countries.find(function (c) { var _a; return c.country.iso2.toLocaleLowerCase() === ((_a = countryValue === null || countryValue === void 0 ? void 0 : countryValue.country) === null || _a === void 0 ? void 0 : _a.iso2.toLocaleLowerCase()); });
|
|
166
|
-
return (_jsxs(ListItemContainer, { children: [_jsxs(ListItem, __assign({ sx: { width: 'unset' } }, { children: [_jsx(NameContainer, __assign({ sx: { padding: 0 }, isSelected: isSelected }, { children: item.title })), _jsx(ExpandIcon, { anchorEl: subIndex === item.id.toString() })] })), _jsx(Collapse, __assign({ in: item.id.toString() === subIndex || !!searchValue }, { children: _jsx(CountryListStyled, { sx: { pt: 0, pb: 0 }, list: item.countries || [], onSelectItem: function (i, e) {
|
|
166
|
+
return (_jsxs(ListItemContainer, { children: [_jsxs(ListItem, __assign({ sx: { width: 'unset' } }, { children: [_jsx(NameContainer, __assign({ sx: { padding: 0 }, isSelected: isSelected }, { children: isAr ? item.title_ar : item.title })), _jsx(ExpandIcon, { anchorEl: subIndex === item.id.toString() })] })), _jsx(Collapse, __assign({ in: item.id.toString() === subIndex || !!searchValue }, { children: _jsx(CountryListStyled, { sx: { pt: 0, pb: 0 }, list: item.countries || [], onSelectItem: function (i, e) {
|
|
167
167
|
e.stopPropagation();
|
|
168
168
|
onSelectItem(i);
|
|
169
169
|
}, listItemProps: { sx: { padding: 0, '&:last-child': { paddingBottom: 0 } } }, renderItem: function (item, idx) {
|
|
@@ -29,7 +29,7 @@ import Text from '../../../../components/Text';
|
|
|
29
29
|
import { clearError, signInSelector, resetOTPScreen, verifyAuthOTP } from '../../../app/signIn/signInStore';
|
|
30
30
|
import Button from '../../../shared/Button';
|
|
31
31
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
32
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
32
|
+
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useSanitizedTranslation } from '../../../../hooks';
|
|
33
33
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
34
34
|
import { useLanguage } from '../../../../hooks';
|
|
35
35
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -60,6 +60,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
60
60
|
var OTP = function () {
|
|
61
61
|
var _a;
|
|
62
62
|
var dispatch = useAppDispatch();
|
|
63
|
+
var st = useSanitizedTranslation();
|
|
63
64
|
var _b = useAppSelector(signInSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
64
65
|
var _c = data.otpData, responseBody = _c.responseBody, defaultValues = __rest(_c, ["responseBody"]);
|
|
65
66
|
var methods = useForm({
|
|
@@ -87,7 +88,7 @@ var OTP = function () {
|
|
|
87
88
|
var disabled = !methods.formState.isValid || !!error;
|
|
88
89
|
var phone = data.auth.mobile ? ((_a = data.auth.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.auth.mobile : '';
|
|
89
90
|
var email = data.auth.email || '';
|
|
90
|
-
var title =
|
|
91
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
91
|
+
var title = st('ide_opt_sent_title');
|
|
92
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: isEmail ? maskEmail(email) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: st('next') }))] })) })) }));
|
|
92
93
|
};
|
|
93
94
|
export default React.memo(OTP);
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import { useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
|
|
14
|
+
import { useAppDispatch, useSetFromDefaultValues, useSanitizedTranslation } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
@@ -49,6 +49,7 @@ var VerifyNumber = function (_a) {
|
|
|
49
49
|
var _b, _c;
|
|
50
50
|
var dispatch = useAppDispatch();
|
|
51
51
|
var _d = useAppSelector(taxSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
52
|
+
var st = useSanitizedTranslation();
|
|
52
53
|
var methods = useForm({
|
|
53
54
|
resolver: yupResolver(OTPValidation),
|
|
54
55
|
defaultValues: data.otpData,
|
|
@@ -70,6 +71,6 @@ var VerifyNumber = function (_a) {
|
|
|
70
71
|
dispatch(verifyTaxLeadOTP(deepCopy(formData)));
|
|
71
72
|
};
|
|
72
73
|
var disabled = !methods.formState.isValid || !phone || resendLoading;
|
|
73
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ?
|
|
74
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: st('next') }))] })) })) }));
|
|
74
75
|
};
|
|
75
76
|
export default React.memo(VerifyNumber);
|
package/build/hooks/index.d.ts
CHANGED
package/build/hooks/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useSanitizedTranslation: () => (key: string) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
export var useSanitizedTranslation = function () {
|
|
4
|
+
var t = useTranslation().t;
|
|
5
|
+
var sanitize = useCallback(function (key) {
|
|
6
|
+
if (!key)
|
|
7
|
+
return '';
|
|
8
|
+
return key.replace(/[$#[\].]/g, '');
|
|
9
|
+
}, []);
|
|
10
|
+
var sanitizedTranslate = useCallback(function (key) {
|
|
11
|
+
var sanitizedError = sanitize(key);
|
|
12
|
+
return t(sanitizedError);
|
|
13
|
+
}, [t, sanitize]);
|
|
14
|
+
return sanitizedTranslate;
|
|
15
|
+
};
|