@tap-payments/auth-jsconnect 2.0.35-test → 2.0.35
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 +52 -21
- package/build/@types/app.js +10 -3
- package/build/@types/form.d.ts +18 -10
- package/build/api/auth.d.ts +24 -2
- package/build/api/auth.js +36 -1
- package/build/api/axios.js +2 -2
- package/build/api/brand.d.ts +2 -1
- package/build/api/brand.js +10 -1
- package/build/api/country.d.ts +3 -1
- package/build/api/country.js +3 -1
- package/build/api/data.d.ts +38 -7
- package/build/api/data.js +57 -17
- package/build/api/entity.d.ts +53 -5
- package/build/api/entity.js +39 -9
- package/build/api/firebase.d.ts +1 -1
- package/build/api/firebase.js +3 -1
- package/build/api/index.d.ts +44 -14
- package/build/api/individual.d.ts +76 -19
- package/build/api/individual.js +29 -2
- package/build/api/lead.d.ts +9 -6
- package/build/api/lead.js +8 -1
- package/build/app/rootReducer.d.ts +1 -1
- package/build/app/rootReducer.js +2 -2
- package/build/app/settings.d.ts +8 -2
- package/build/app/settings.js +29 -12
- package/build/app/store.d.ts +3 -3
- package/build/assets/locales/ar.json +258 -183
- package/build/assets/locales/en.json +190 -108
- package/build/components/AnimationFlow/AnimationFlow.d.ts +5 -1
- package/build/components/AnimationFlow/AnimationFlow.js +6 -8
- package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
- package/build/components/AnimationFlow/BottomSheet.js +4 -3
- package/build/components/AnimationFlow/Dialog.d.ts +5 -1
- package/build/components/AnimationFlow/Dialog.js +11 -5
- package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +13 -0
- package/build/components/ArabicDatePicker/ArabicDatePicker.js +94 -0
- package/build/components/ArabicDatePicker/index.d.ts +2 -0
- package/build/components/ArabicDatePicker/index.js +2 -0
- package/build/components/ArabicDatePicker/style.css +24 -0
- package/build/components/FileInput/DragAndDrop.d.ts +10 -1
- package/build/components/FileInput/DragAndDrop.js +108 -8
- package/build/components/Lottie/Lottie.d.ts +878 -0
- package/build/components/Lottie/Lottie.js +58 -0
- package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
- package/build/components/Lottie/files/success.json +425 -0
- package/build/components/Lottie/index.d.ts +3 -0
- package/build/components/Lottie/index.js +3 -0
- package/build/components/OTPField/OTPField.d.ts +2 -1
- package/build/components/OTPField/OTPField.js +2 -2
- package/build/components/OTPTimer/OTPTimer.js +1 -1
- package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
- package/build/components/ProgressBar/CircularProgressBar.js +48 -0
- package/build/components/ProgressBar/index.d.ts +2 -0
- package/build/components/ProgressBar/index.js +2 -0
- package/build/components/RadioLabel/RadioLabel.d.ts +2 -1
- package/build/components/RadioLabel/RadioLabel.js +2 -2
- package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -6
- package/build/components/SocialMediaGroup/SocialMediaGroup.js +4 -49
- package/build/constants/api.d.ts +6 -0
- package/build/constants/api.js +14 -1
- package/build/constants/app.d.ts +7 -5
- package/build/constants/app.js +56 -23
- package/build/constants/assets.d.ts +14 -0
- package/build/constants/assets.js +16 -2
- package/build/constants/dummy.d.ts +1 -1
- package/build/constants/dummy.js +2 -2
- package/build/constants/validation.d.ts +8 -0
- package/build/constants/validation.js +9 -1
- package/build/features/app/auth/authStore.d.ts +47 -0
- package/build/features/app/auth/authStore.js +260 -0
- package/build/features/app/bank/bankStore.d.ts +16 -0
- package/build/features/app/bank/bankStore.js +86 -39
- package/build/features/app/business/businessStore.d.ts +22 -3
- package/build/features/app/business/businessStore.js +432 -291
- package/build/features/app/connect/connectStore.d.ts +33 -31
- package/build/features/app/connect/connectStore.js +394 -308
- package/build/features/app/entity/entityStore.d.ts +30 -5
- package/build/features/app/entity/entityStore.js +258 -47
- package/build/features/app/individual/individualStore.d.ts +17 -0
- package/build/features/app/individual/individualStore.js +170 -84
- package/build/features/app/password/passwordStore.js +1 -1
- package/build/features/app/tax/taxStore.js +18 -14
- package/build/features/auth/Auth.d.ts +10 -0
- package/build/features/auth/Auth.js +87 -0
- package/build/features/auth/index.d.ts +1 -0
- package/build/features/auth/index.js +1 -0
- package/build/features/auth/screens/NID/DOB.d.ts +7 -0
- package/build/features/auth/screens/NID/DOB.js +47 -0
- package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
- package/build/features/auth/screens/NID/IDNumber.js +64 -0
- package/build/features/auth/screens/NID/NID.d.ts +5 -0
- package/build/features/auth/screens/NID/NID.js +68 -0
- package/build/features/auth/screens/NID/TAC.d.ts +3 -0
- package/build/features/auth/screens/NID/TAC.js +87 -0
- package/build/features/auth/screens/NID/index.d.ts +3 -0
- package/build/features/auth/screens/NID/index.js +2 -0
- package/build/features/auth/screens/NID/validation.d.ts +27 -0
- package/build/features/auth/screens/NID/validation.js +19 -0
- package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
- package/build/features/auth/screens/OTP/OTP.js +76 -0
- package/build/features/{otp/screens/OTPVerify/Verify.d.ts → auth/screens/OTP/OTPInput.d.ts} +0 -0
- package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/OTPInput.js +11 -7
- package/build/features/auth/screens/OTP/index.d.ts +3 -0
- package/build/features/auth/screens/OTP/index.js +2 -0
- package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.d.ts +0 -0
- package/build/features/{otp/screens/OTPVerify → auth/screens/OTP}/validation.js +0 -0
- package/build/features/bank/Bank.js +12 -6
- package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
- package/build/features/bank/screens/BankDetails/BankName.js +2 -1
- package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
- package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
- package/build/features/bank/screens/BankDetails/validation.js +2 -2
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
- package/build/features/business/Business.d.ts +1 -1
- package/build/features/business/Business.js +14 -7
- package/build/features/business/screens/Activities/Activities.js +16 -17
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
- package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
- package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
- package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
- package/build/features/business/screens/Activities/validation.d.ts +0 -51
- package/build/features/business/screens/Activities/validation.js +0 -9
- package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
- package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
- package/build/features/business/screens/BusinessType/EntityName.js +56 -0
- package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
- package/build/features/business/screens/BusinessType/LicenseList.js +24 -7
- package/build/features/business/screens/BusinessType/LicenseNumber.js +14 -8
- package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
- package/build/features/business/screens/BusinessType/LicenseType.js +67 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
- package/build/features/business/screens/BusinessType/validation.js +50 -1
- package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/business/screens/CivilID/CivilID.js +67 -0
- package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/business/screens/CivilID/IDNumber.js +59 -0
- package/build/features/business/screens/CivilID/index.d.ts +3 -0
- package/build/features/business/screens/CivilID/index.js +2 -0
- package/build/features/business/screens/CivilID/validation.d.ts +8 -0
- package/build/features/business/screens/CivilID/validation.js +4 -0
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
- package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
- package/build/features/business/screens/Customers/Customers.js +15 -9
- package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
- package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
- package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
- package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
- package/build/features/business/screens/OTP/OTP.js +15 -2
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -7
- package/build/features/business/screens/Verify/Verify.js +4 -4
- package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
- package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/business/screens/VerifyPACI/index.js +2 -0
- package/build/features/connect/Connect.d.ts +2 -1
- package/build/features/connect/Connect.js +47 -12
- package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/connect/screens/CivilID/CivilID.js +99 -0
- package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
- package/build/features/connect/screens/CivilID/index.d.ts +3 -0
- package/build/features/connect/screens/CivilID/index.js +2 -0
- package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
- package/build/features/connect/screens/CivilID/validation.js +4 -0
- package/build/features/connect/screens/Individual/Email.js +11 -3
- package/build/features/connect/screens/Individual/Individual.js +41 -27
- package/build/features/connect/screens/Merchant/BrandList.js +15 -7
- package/build/features/connect/screens/Merchant/BrandName.js +7 -4
- package/build/features/connect/screens/Merchant/Merchant.js +41 -64
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +3 -1
- package/build/features/connect/screens/Merchant/SalesChannels.js +30 -31
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
- package/build/features/connect/screens/Merchant/SocialMedia.js +129 -109
- package/build/features/connect/screens/Merchant/TAC.js +8 -2
- package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
- package/build/features/connect/screens/Merchant/validation.js +108 -173
- package/build/features/connect/screens/Mobile/Mobile.js +30 -12
- package/build/features/connect/screens/NID/NID.js +2 -1
- package/build/features/connect/screens/OTP/OTP.js +20 -6
- package/build/features/connect/screens/OTP/OTPInput.js +3 -2
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
- package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/connect/screens/VerifyPACI/index.js +2 -0
- package/build/features/entity/Entity.d.ts +1 -1
- package/build/features/entity/Entity.js +16 -9
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +55 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +149 -0
- package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
- package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +71 -2
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +32 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +49 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +33 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +68 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +24 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
- package/build/features/entity/screens/Verify/Verify.js +18 -5
- package/build/features/featuresScreens.d.ts +1 -1
- package/build/features/featuresScreens.js +31 -6
- package/build/features/individual/Individual.d.ts +1 -1
- package/build/features/individual/Individual.js +14 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -8
- package/build/features/individual/screens/Verify/Verify.js +18 -5
- package/build/features/password/Password.d.ts +1 -1
- package/build/features/password/Password.js +14 -7
- package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
- package/build/features/password/screens/OTP/OTP.js +15 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +12 -9
- package/build/features/password/screens/Verify/Verify.js +16 -3
- package/build/features/shared/Background/Background.d.ts +6 -5
- package/build/features/shared/Background/Background.js +16 -5
- package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
- package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
- package/build/features/shared/Button/MobileButton.d.ts +2 -1
- package/build/features/shared/Button/MobileButton.js +2 -2
- package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
- package/build/features/shared/Dialog/CloseDialog.js +71 -0
- package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
- package/build/features/shared/Dialog/DialogContainer.js +56 -0
- package/build/features/shared/Dialog/index.d.ts +4 -0
- package/build/features/shared/Dialog/index.js +4 -0
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/Input/Input.js +2 -2
- package/build/features/shared/SuccessScreen/SuccessScreen.js +1 -1
- package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
- package/build/features/shared/UploadFile/UploadFile.js +24 -9
- package/build/features/signIn/SignIn.d.ts +1 -1
- package/build/features/signIn/SignIn.js +14 -6
- package/build/features/signIn/screens/Email/Email.js +4 -2
- package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
- package/build/features/signIn/screens/OTP/OTP.js +14 -1
- package/build/features/signIn/screens/Password/Password.js +15 -2
- package/build/features/tax/Tax.d.ts +1 -1
- package/build/features/tax/Tax.js +16 -8
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +11 -7
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
- package/build/features/tax/screens/Verify/Verify.js +16 -3
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/useAppConfig.d.ts +3 -1
- package/build/hooks/useAppConfig.js +4 -2
- package/build/hooks/useAppDispatch.d.ts +1 -1
- package/build/hooks/useErrorListener.js +0 -6
- package/build/hooks/useScreen.d.ts +3 -0
- package/build/hooks/useScreen.js +14 -0
- package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
- package/build/hooks/useSetFromDefaultValues.js +24 -0
- package/build/index.d.ts +3 -3
- package/build/index.js +5 -5
- package/build/utils/array.d.ts +13 -1
- package/build/utils/array.js +26 -0
- package/build/utils/common.d.ts +1 -0
- package/build/utils/common.js +3 -0
- package/build/utils/device.d.ts +1 -0
- package/build/utils/device.js +13 -0
- package/build/utils/html.d.ts +1 -0
- package/build/utils/html.js +6 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/locale.js +1 -1
- package/build/utils/object.d.ts +1 -0
- package/build/utils/object.js +12 -0
- package/build/utils/rsa.d.ts +2 -2
- package/build/utils/rsa.js +1 -1
- package/build/utils/string.d.ts +33 -20
- package/build/utils/string.js +71 -1
- package/build/utils/validation.d.ts +2 -0
- package/build/utils/validation.js +6 -0
- package/package.json +5 -4
- package/build/features/app/otp/otpStore.d.ts +0 -28
- package/build/features/app/otp/otpStore.js +0 -153
- package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
- package/build/features/business/screens/Activities/SalesChannels.js +0 -112
- package/build/features/otp/OTP.d.ts +0 -7
- package/build/features/otp/OTP.js +0 -58
- package/build/features/otp/index.d.ts +0 -0
- package/build/features/otp/index.js +0 -1
- package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
- package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
- package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
- package/build/features/otp/screens/OTPVerify/index.js +0 -2
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
17
|
+
import DatePicker from '../../../../components/DatePicker';
|
|
18
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
19
|
+
import { clearError, authSelector } from '../../../app/auth/authStore';
|
|
20
|
+
import Text from '../../../../components/Text';
|
|
21
|
+
import Collapse from '../../../../components/Collapse';
|
|
22
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
23
|
+
var theme = _a.theme;
|
|
24
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
25
|
+
});
|
|
26
|
+
var DOB = function (_a) {
|
|
27
|
+
var show = _a.show, onDateClicked = _a.onDateClicked;
|
|
28
|
+
var t = useTranslation().t;
|
|
29
|
+
var control = useFormContext().control;
|
|
30
|
+
var dispatch = useAppDispatch();
|
|
31
|
+
var dobControl = useController({ control: control, name: 'dob' });
|
|
32
|
+
var error = useAppSelector(authSelector).error;
|
|
33
|
+
var handleBirthDateChange = function (data) {
|
|
34
|
+
dobControl.field.onChange(data);
|
|
35
|
+
handleClearError();
|
|
36
|
+
};
|
|
37
|
+
var handleClearError = function () {
|
|
38
|
+
if (error)
|
|
39
|
+
dispatch(clearError());
|
|
40
|
+
};
|
|
41
|
+
var dateValue = dobControl.field.value;
|
|
42
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
43
|
+
var spacing = _a.spacing;
|
|
44
|
+
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
45
|
+
} } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange, onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); } })] }) })));
|
|
46
|
+
};
|
|
47
|
+
export default DOB;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useAppSelector } from '../../../../hooks';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import { useTranslation } from 'react-i18next';
|
|
17
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
18
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
19
|
+
import Text from '../../../../components/Text';
|
|
20
|
+
import Input from '../../../shared/Input';
|
|
21
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
22
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
23
|
+
import { ID_NUMBER_LENGTH } from '../../../../constants';
|
|
24
|
+
import { authSelector } from '../../../app/auth/authStore';
|
|
25
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
26
|
+
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
27
|
+
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
28
|
+
var theme = _a.theme;
|
|
29
|
+
return ({
|
|
30
|
+
display: 'flex',
|
|
31
|
+
justifyContent: 'space-between',
|
|
32
|
+
padding: theme.spacing(0, 2.5, 1.25, 2.5)
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
36
|
+
var theme = _a.theme;
|
|
37
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
38
|
+
});
|
|
39
|
+
var IDNumber = React.forwardRef(function (_a, ref) {
|
|
40
|
+
var _b, _c;
|
|
41
|
+
var t = useTranslation().t;
|
|
42
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
43
|
+
var nidControl = useController({ control: control, name: 'nid' });
|
|
44
|
+
var data = useAppSelector(authSelector).data;
|
|
45
|
+
var responseBody = data.responseBody;
|
|
46
|
+
var defaultNid = (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.identification) === null || _b === void 0 ? void 0 : _b.id;
|
|
47
|
+
React.useEffect(function () {
|
|
48
|
+
if (nidControl.field.value)
|
|
49
|
+
setValue('nid', nidControl.field.value, { shouldValidate: true });
|
|
50
|
+
}, []);
|
|
51
|
+
var handleIdChange = function (_a) {
|
|
52
|
+
var target = _a.target;
|
|
53
|
+
var value = removeAllCharsFromNumber(target.value);
|
|
54
|
+
nidControl.field.onChange(value);
|
|
55
|
+
};
|
|
56
|
+
var clearIdNumber = function () {
|
|
57
|
+
nidControl.field.onChange('');
|
|
58
|
+
};
|
|
59
|
+
var nidValue = nidControl.field.value;
|
|
60
|
+
var error = (_c = nidControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
61
|
+
var readOnly = !!defaultNid;
|
|
62
|
+
return (_jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', readOnly: readOnly, inputProps: { maxLength: ID_NUMBER_LENGTH }, value: nidValue, onChange: handleIdChange, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : readOnly ? _jsx(_Fragment, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })));
|
|
63
|
+
});
|
|
64
|
+
export default React.memo(IDNumber);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import { NIDValidationSchema, NIDDOBValidationSchema } from './validation';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
20
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
21
|
+
import { clearError, authSelector, createAuth } from '../../../app/auth/authStore';
|
|
22
|
+
import Form from '../../../../components/Form';
|
|
23
|
+
import Button from '../../../shared/Button';
|
|
24
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
+
import Collapse from '../../../../components/Collapse';
|
|
26
|
+
import IDNumber from './IDNumber';
|
|
27
|
+
import TAC from './TAC';
|
|
28
|
+
import DOB from './DOB';
|
|
29
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'column'
|
|
32
|
+
}); });
|
|
33
|
+
var NID = function (_a) {
|
|
34
|
+
var isAr = useLanguage().isAr;
|
|
35
|
+
var dispatch = useAppDispatch();
|
|
36
|
+
var t = useTranslation().t;
|
|
37
|
+
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
38
|
+
var _c = useAppSelector(authSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
39
|
+
var settingsStore = useAppSelector(settingsSelector);
|
|
40
|
+
var nid = data.nid, dob = data.dob, termAndConditionChecked = data.termAndConditionChecked, responseBody = data.responseBody;
|
|
41
|
+
var defaultDob = responseBody === null || responseBody === void 0 ? void 0 : responseBody.date_of_birth;
|
|
42
|
+
var methods = useForm({
|
|
43
|
+
resolver: yupResolver(!defaultDob ? NIDDOBValidationSchema : NIDValidationSchema),
|
|
44
|
+
defaultValues: {
|
|
45
|
+
nid: nid,
|
|
46
|
+
dob: dob,
|
|
47
|
+
termAndConditionChecked: termAndConditionChecked
|
|
48
|
+
},
|
|
49
|
+
mode: 'onChange'
|
|
50
|
+
});
|
|
51
|
+
useSetFromDefaultValues(methods, { nid: nid, dob: dob, termAndConditionChecked: termAndConditionChecked });
|
|
52
|
+
React.useEffect(function () {
|
|
53
|
+
handleClearError();
|
|
54
|
+
}, [methods.formState.isValid]);
|
|
55
|
+
var onSubmit = function (data) {
|
|
56
|
+
dispatch(createAuth(data));
|
|
57
|
+
};
|
|
58
|
+
var handleCollapseOpenClose = function (flag) {
|
|
59
|
+
setCollapse(flag);
|
|
60
|
+
};
|
|
61
|
+
var handleClearError = function () {
|
|
62
|
+
if (error)
|
|
63
|
+
dispatch(clearError());
|
|
64
|
+
};
|
|
65
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
66
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, {}) })), _jsx(DOB, { show: !defaultDob, onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(TAC, {}), _jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') }))] }))] })) })) }));
|
|
67
|
+
};
|
|
68
|
+
export default React.memo(NID);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
+
import Link from '@mui/material/Link';
|
|
19
|
+
import CheckBox from '../../../../components/CheckBox';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import Text from '../../../../components/Text';
|
|
22
|
+
import Warning from '../../../../components/Warning';
|
|
23
|
+
import { useLanguage } from '../../../../hooks';
|
|
24
|
+
import Collapse from '../../../../components/Collapse';
|
|
25
|
+
import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
|
|
26
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
27
|
+
import { useAppSelector } from '../../../../hooks';
|
|
28
|
+
import { authSelector } from '../../../../features/app/auth/authStore';
|
|
29
|
+
var TACContainerStyled = styled(Box)(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return ({
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
paddingInlineStart: theme.spacing(2.5)
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
var TextStyled = styled(Text)(function (_a) {
|
|
39
|
+
var theme = _a.theme;
|
|
40
|
+
return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre-line', height: 'fit-content' }, theme.typography.body2));
|
|
41
|
+
});
|
|
42
|
+
var LinkStyled = styled(Link)(function (_a) {
|
|
43
|
+
var theme = _a.theme;
|
|
44
|
+
return ({
|
|
45
|
+
color: theme.palette.primary.main,
|
|
46
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
47
|
+
letterSpacing: theme.spacing(0)
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var CheckboxStyled = styled(CheckBox)(function (_a) {
|
|
51
|
+
var theme = _a.theme;
|
|
52
|
+
return ({
|
|
53
|
+
margin: theme.spacing(0),
|
|
54
|
+
padding: theme.spacing(0),
|
|
55
|
+
marginInlineEnd: theme.spacing(1.5),
|
|
56
|
+
color: theme.palette.primary.main,
|
|
57
|
+
'& .MuiSvgIcon-root': {
|
|
58
|
+
fontSize: theme.spacing(3.75)
|
|
59
|
+
},
|
|
60
|
+
'&.Mui-checked': {
|
|
61
|
+
color: theme.palette.text.primary,
|
|
62
|
+
borderRadius: theme.spacing(2.5)
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
var CollapseStyled = styled(Collapse)(function () { return ({
|
|
67
|
+
width: '100%'
|
|
68
|
+
}); });
|
|
69
|
+
var TAC = function () {
|
|
70
|
+
var _a, _b;
|
|
71
|
+
var t = useTranslation().t;
|
|
72
|
+
var isAr = useLanguage().isAr;
|
|
73
|
+
var control = useFormContext().control;
|
|
74
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
75
|
+
var data = useAppSelector(authSelector).data;
|
|
76
|
+
var tacControl = useController({ control: control, name: 'termAndConditionChecked' });
|
|
77
|
+
var tacChecked = tacControl.field.value;
|
|
78
|
+
var warningMessage = (_a = tacControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
79
|
+
var countryCode = ((_b = data.countryISOCode) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || settingsData.businessCountry.iso2.toLowerCase();
|
|
80
|
+
var handleTACCheckedChange = function (event, checked) {
|
|
81
|
+
tacControl.field.onChange(checked);
|
|
82
|
+
};
|
|
83
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { mt: 3, mb: 1.625 } }, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr
|
|
84
|
+
? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR
|
|
85
|
+
: TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })));
|
|
86
|
+
};
|
|
87
|
+
export default React.memo(TAC);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
dob: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
5
|
+
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
6
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
dob: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
9
|
+
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
10
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
11
|
+
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
12
|
+
dob: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
13
|
+
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
14
|
+
}>>>;
|
|
15
|
+
export declare const NIDDOBValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
16
|
+
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
17
|
+
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
18
|
+
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
19
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
20
|
+
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
21
|
+
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
22
|
+
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
23
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
|
+
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
25
|
+
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
26
|
+
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
27
|
+
}>>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export var NIDValidationSchema = yup.object().shape({
|
|
3
|
+
nid: yup
|
|
4
|
+
.string()
|
|
5
|
+
.matches(/^(1|2)([0-9]{1,})$/g, 'signup_invalid_national_id_format')
|
|
6
|
+
.min(10, 'signup_invalid_national_id')
|
|
7
|
+
.required('signup_invalid_national_id'),
|
|
8
|
+
dob: yup.string().optional(),
|
|
9
|
+
termAndConditionChecked: yup.boolean().required().isTrue('check_terms_cond')
|
|
10
|
+
});
|
|
11
|
+
export var NIDDOBValidationSchema = yup.object().shape({
|
|
12
|
+
nid: yup
|
|
13
|
+
.string()
|
|
14
|
+
.matches(/^(1|2)([0-9]{1,})$/g, 'signup_invalid_national_id_format')
|
|
15
|
+
.min(10, 'signup_invalid_national_id')
|
|
16
|
+
.required('signup_invalid_national_id'),
|
|
17
|
+
dob: yup.string().min(5).required('enter_valid_birth_date'),
|
|
18
|
+
termAndConditionChecked: yup.boolean().required().isTrue('check_terms_cond')
|
|
19
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import Box from '@mui/material/Box/Box';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { useTranslation } from 'react-i18next';
|
|
17
|
+
import Text from '../../../../components/Text';
|
|
18
|
+
import { clearError, authSelector, resetOTPScreen, verifyAuthOTP } from '../../../app/auth/authStore';
|
|
19
|
+
import Button from '../../../shared/Button';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
|
+
import { useLanguage } from '../../../../hooks';
|
|
23
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
24
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
25
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
26
|
+
import Form from '../../../../components/Form';
|
|
27
|
+
import { maskPhone } from '../../../../utils';
|
|
28
|
+
import { OTPValidation } from './validation';
|
|
29
|
+
import OTPInput from './OTPInput';
|
|
30
|
+
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
31
|
+
var theme = _a.theme;
|
|
32
|
+
return ({
|
|
33
|
+
background: theme.palette.common.white,
|
|
34
|
+
border: '1px solid',
|
|
35
|
+
borderColor: theme.palette.divider,
|
|
36
|
+
direction: theme.direction,
|
|
37
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
38
|
+
marginBottom: theme.spacing(5.75)
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
var OTPTitleStyled = styled(Text)(function (_a) {
|
|
42
|
+
var theme = _a.theme;
|
|
43
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
|
|
44
|
+
});
|
|
45
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexDirection: 'column'
|
|
48
|
+
}); });
|
|
49
|
+
var OTP = function () {
|
|
50
|
+
var dispatch = useAppDispatch();
|
|
51
|
+
var _a = useAppSelector(authSelector), data = _a.data, loading = _a.loading, error = _a.error;
|
|
52
|
+
var methods = useForm({
|
|
53
|
+
resolver: yupResolver(OTPValidation),
|
|
54
|
+
defaultValues: { otp: '' },
|
|
55
|
+
mode: 'onChange'
|
|
56
|
+
});
|
|
57
|
+
var t = useTranslation().t;
|
|
58
|
+
var isAr = useLanguage().isAr;
|
|
59
|
+
React.useEffect(function () {
|
|
60
|
+
if (error)
|
|
61
|
+
dispatch(clearError());
|
|
62
|
+
return function () {
|
|
63
|
+
dispatch(resetOTPScreen());
|
|
64
|
+
};
|
|
65
|
+
}, [methods.formState.isValid]);
|
|
66
|
+
var onSubmit = function (formData) {
|
|
67
|
+
dispatch(verifyAuthOTP(formData));
|
|
68
|
+
};
|
|
69
|
+
var onBack = function () {
|
|
70
|
+
dispatch(handlePrevScreenStep());
|
|
71
|
+
};
|
|
72
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
73
|
+
var phone = data.nid;
|
|
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 ? t('ide_otp_waiting_title') : t('opt_nid_sent_title', { provider: 'ABSHER' }), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disabled: disabled, isAr: isAr, loading: loading, error: t(error || ''), onBackClicked: function () { return onBack(); } }, { children: t('confirm') }))] })) })) }));
|
|
75
|
+
};
|
|
76
|
+
export default React.memo(OTP);
|
|
File without changes
|
|
@@ -11,14 +11,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
14
16
|
import Box from '@mui/material/Box/Box';
|
|
15
17
|
import { styled } from '@mui/material/styles';
|
|
16
18
|
import OTPField from '../../../shared/OTP';
|
|
17
|
-
import {
|
|
18
|
-
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import { authSelector, clearError, resendOTP } from '../../../app/auth/authStore';
|
|
19
20
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
-
import { resendOTP } from '../../../app/otp/otpStore';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
22
|
var BoxStyled = styled(Box)(function (_a) {
|
|
23
23
|
var theme = _a.theme;
|
|
24
24
|
return ({
|
|
@@ -28,20 +28,24 @@ var BoxStyled = styled(Box)(function (_a) {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
var OTPInput = function (_a) {
|
|
31
|
-
var loading = _a.loading;
|
|
32
31
|
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
33
32
|
var t = useTranslation().t;
|
|
34
|
-
var otpControl = useController({ name: 'otp', control: control });
|
|
35
33
|
var dispatch = useAppDispatch();
|
|
34
|
+
var otpControl = useController({ name: 'otp', control: control });
|
|
35
|
+
var _c = useAppSelector(authSelector), error = _c.error, loading = _c.loading;
|
|
36
36
|
var handleOnOTPChange = function (otp) {
|
|
37
|
+
if (!!error)
|
|
38
|
+
dispatch(clearError());
|
|
37
39
|
otpControl.field.onChange(otp);
|
|
38
40
|
};
|
|
39
41
|
var handleOnResendOTP = function () {
|
|
42
|
+
if (!!error)
|
|
43
|
+
dispatch(clearError());
|
|
40
44
|
if (otpControl.field.value)
|
|
41
45
|
setValue('otp', '', { shouldValidate: true });
|
|
42
46
|
dispatch(resendOTP());
|
|
43
47
|
};
|
|
44
48
|
var otpValue = otpControl.field.value;
|
|
45
|
-
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, {
|
|
49
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: loading ? undefined : handleOnResendOTP, value: otpValue, disabled: loading, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
46
50
|
};
|
|
47
51
|
export default React.memo(OTPInput);
|
|
File without changes
|
|
File without changes
|
|
@@ -17,9 +17,9 @@ import AnimationFlow from '../../components/AnimationFlow';
|
|
|
17
17
|
import { store } from '../../app/store';
|
|
18
18
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
19
19
|
import Collapse from '../../components/Collapse';
|
|
20
|
-
import { getParameterByName, reactElement } from '../../utils';
|
|
20
|
+
import { getParameterByName, reactElement, removeElement } from '../../utils';
|
|
21
21
|
import { FeatureContainer } from '../shared/Containers';
|
|
22
|
-
import { BANK_SCREENS_NAVIGATION } from '../../constants';
|
|
22
|
+
import { BANK_SCREENS_NAVIGATION, DIALOG_ID } from '../../constants';
|
|
23
23
|
import { bankFeatureScreens } from '../featuresScreens';
|
|
24
24
|
import CustomFooter from '../shared/Footer';
|
|
25
25
|
import { bankSelector, verifyLeadToken } from '../app/bank/bankStore';
|
|
@@ -28,7 +28,7 @@ var Bank = memo(function (props) {
|
|
|
28
28
|
var theme = useAppTheme().theme;
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
30
|
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
31
|
-
var _b = useAppSelector(bankSelector), customLoading = _b.customLoading, bankError = _b.error;
|
|
31
|
+
var _b = useAppSelector(bankSelector), customLoading = _b.customLoading, loading = _b.loading, bankError = _b.error;
|
|
32
32
|
useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props));
|
|
33
33
|
useErrorListener(bankError || error);
|
|
34
34
|
useStepStartedListener();
|
|
@@ -43,10 +43,10 @@ var Bank = memo(function (props) {
|
|
|
43
43
|
dispatch(verifyLeadToken(token));
|
|
44
44
|
};
|
|
45
45
|
useEffect(function () {
|
|
46
|
-
if (!settingLoading)
|
|
46
|
+
if (!settingLoading && open)
|
|
47
47
|
verifyToken();
|
|
48
48
|
}, [settingLoading]);
|
|
49
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
|
|
49
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
|
|
50
50
|
var Element = _a.element, name = _a.name;
|
|
51
51
|
var isActive = activeScreen.name === name;
|
|
52
52
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -59,5 +59,11 @@ export function renderBankLib(config, elementId) {
|
|
|
59
59
|
reactElement(elementId).render(_jsx(BankLib, __assign({}, config)));
|
|
60
60
|
}
|
|
61
61
|
export function unmountBankLib(elementId) {
|
|
62
|
-
|
|
62
|
+
var element = document.getElementById(elementId);
|
|
63
|
+
setTimeout(function () {
|
|
64
|
+
var _a;
|
|
65
|
+
((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
|
|
66
|
+
removeElement(DIALOG_ID);
|
|
67
|
+
elementId && reactElement(elementId).unmount();
|
|
68
|
+
}, 1000);
|
|
63
69
|
}
|
|
@@ -9,6 +9,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
12
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
24
|
import * as React from 'react';
|
|
14
25
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -16,7 +27,7 @@ import Beneficiary from './Beneficiary';
|
|
|
16
27
|
import IBAN from './IBAN';
|
|
17
28
|
import BankName from './BankName';
|
|
18
29
|
import Button from '../../../shared/Button';
|
|
19
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
30
|
+
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
20
31
|
import { BankValidation } from './validation';
|
|
21
32
|
import { useTranslation } from 'react-i18next';
|
|
22
33
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -42,12 +53,14 @@ var ButtonStyled = styled(Button)(function (_a) {
|
|
|
42
53
|
var BankDetails = function () {
|
|
43
54
|
var _a = React.useState(false), ibanChecking = _a[0], setIbanChecking = _a[1];
|
|
44
55
|
var dispatch = useAppDispatch();
|
|
45
|
-
var _b = useAppSelector(bankSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
56
|
+
var _b = useAppSelector(bankSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading;
|
|
57
|
+
var _c = data.bankData, responseBody = _c.responseBody, defaultValues = __rest(_c, ["responseBody"]);
|
|
46
58
|
var methods = useForm({
|
|
47
59
|
resolver: yupResolver(BankValidation),
|
|
48
|
-
defaultValues:
|
|
60
|
+
defaultValues: defaultValues,
|
|
49
61
|
mode: 'onChange'
|
|
50
62
|
});
|
|
63
|
+
useSetFromDefaultValues(methods, defaultValues);
|
|
51
64
|
var onSubmit = function (data) {
|
|
52
65
|
dispatch(createBankAccount(data));
|
|
53
66
|
};
|
|
@@ -56,11 +69,11 @@ var BankDetails = function () {
|
|
|
56
69
|
var onBack = function () {
|
|
57
70
|
dispatch(handleCurrentActiveScreen('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
58
71
|
};
|
|
59
|
-
var disabled = ibanChecking || !methods.formState.isValid || !!error;
|
|
72
|
+
var disabled = ibanChecking || !methods.formState.isValid || !!error || uploading;
|
|
60
73
|
React.useEffect(function () {
|
|
61
74
|
if (error)
|
|
62
75
|
dispatch(clearError());
|
|
63
76
|
}, [methods.formState.isValid, methods.watch('bankStatementFile')]);
|
|
64
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(BankStatement, {}), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
|
|
77
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, {}), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking }), _jsx(BankName, {}), _jsx(BankStatement, {}), _jsx(ConfirmPolicy, {}), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, disableBack: true, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
|
|
65
78
|
};
|
|
66
79
|
export default BankDetails;
|
|
@@ -47,7 +47,8 @@ var BankName = function () {
|
|
|
47
47
|
React.useEffect(function () {
|
|
48
48
|
var _a;
|
|
49
49
|
var bankName = (_a = data.bankData.responseBody) === null || _a === void 0 ? void 0 : _a.bank_name;
|
|
50
|
-
|
|
50
|
+
if (bankName && !bankNameValue)
|
|
51
|
+
setValue('bankName', bankName);
|
|
51
52
|
}, [(_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.bank_name]);
|
|
52
53
|
var handleBankChange = function (_a) {
|
|
53
54
|
var target = _a.target;
|