@tap-payments/auth-jsconnect 1.0.70 → 1.0.71
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/features/app/business/businessStore.js +1 -1
- package/build/features/app/individual/individualStore.d.ts +7 -1
- package/build/features/app/individual/individualStore.js +41 -2
- package/build/features/bank/screens/Verify/Verify.js +3 -4
- package/build/features/business/screens/Activities/Activities.js +2 -3
- package/build/features/business/screens/Activities/ActivitiesList.js +2 -3
- package/build/features/business/screens/Activities/SalesChannels.js +2 -3
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -3
- package/build/features/business/screens/BusinessType/LicenseList.js +2 -3
- package/build/features/business/screens/Customers/CustomerLocations.js +2 -3
- package/build/features/business/screens/Customers/Customers.js +2 -3
- package/build/features/business/screens/Customers/ExpectedCustomers.js +2 -3
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +2 -3
- package/build/features/business/screens/IDBOD/DOB.js +6 -0
- package/build/features/business/screens/IDBOD/IDBOD.js +3 -8
- package/build/features/business/screens/OTP/OTP.js +3 -4
- package/build/features/business/screens/OTP/OTPInput.js +2 -3
- package/build/features/business/screens/Verify/Verify.js +3 -4
- package/build/features/connect/screens/Individual/Individual.js +2 -3
- package/build/features/connect/screens/Merchant/BrandName.js +2 -3
- package/build/features/connect/screens/Merchant/Merchant.js +2 -3
- package/build/features/connect/screens/Mobile/Mobile.js +3 -4
- package/build/features/connect/screens/Mobile/MobileNumber.js +4 -2
- package/build/features/connect/screens/NID/DOB.js +2 -3
- package/build/features/connect/screens/NID/NID.js +3 -4
- package/build/features/connect/screens/OTP/OTP.js +2 -3
- package/build/features/connect/screens/OTP/OTPInput.js +2 -3
- package/build/features/individual/Individual.js +4 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +8 -5
- package/build/features/individual/screens/AdditionalIndividualInfo/EmployerName.js +5 -8
- package/build/features/individual/screens/Verify/Verify.js +3 -4
- package/build/features/password/screens/Verify/Verify.js +3 -4
- package/build/features/shared/Footer/Footer.js +2 -3
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -3
- package/build/features/tax/screens/Verify/Verify.js +3 -4
- package/package.json +1 -1
|
@@ -529,7 +529,7 @@ export var businessSlice = createSlice({
|
|
|
529
529
|
var _a, _b;
|
|
530
530
|
if ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend)
|
|
531
531
|
state.customLoading = true;
|
|
532
|
-
if ((_b = action.meta.arg) === null || _b === void 0 ? void 0 : _b.isResend)
|
|
532
|
+
if (!((_b = action.meta.arg) === null || _b === void 0 ? void 0 : _b.isResend))
|
|
533
533
|
state.loading = true;
|
|
534
534
|
state.error = null;
|
|
535
535
|
})
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
2
|
+
import { CountryCode, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
|
+
export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
+
businessCountry: any;
|
|
5
|
+
countries: any;
|
|
6
|
+
}, void, {}>;
|
|
3
7
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
8
|
data: any;
|
|
5
9
|
leadData: any;
|
|
@@ -24,6 +28,8 @@ declare type VerifyData = {
|
|
|
24
28
|
token: string;
|
|
25
29
|
};
|
|
26
30
|
export interface IndividualData {
|
|
31
|
+
businessCountry: CountryCode;
|
|
32
|
+
countries: Array<CountryCode>;
|
|
27
33
|
verify: ResponseData & VerifyData;
|
|
28
34
|
otpData: OTPFormValues & ResponseData;
|
|
29
35
|
individualData: IndividualExtraFormValues & ResponseData;
|
|
@@ -50,7 +50,23 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { removeRequestHeaders } from '../../../utils';
|
|
52
52
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
53
|
-
import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
53
|
+
import { defaultCountry, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
54
|
+
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
+
var settings, countriesBody, businessCountry;
|
|
56
|
+
return __generator(this, function (_a) {
|
|
57
|
+
switch (_a.label) {
|
|
58
|
+
case 0:
|
|
59
|
+
settings = thunkApi.getState().settings;
|
|
60
|
+
return [4, API.countryService.getAllCountries()];
|
|
61
|
+
case 1:
|
|
62
|
+
countriesBody = (_a.sent()).data;
|
|
63
|
+
businessCountry = (countriesBody.list || []).find(function (country) {
|
|
64
|
+
return [country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
|
|
65
|
+
});
|
|
66
|
+
return [2, { businessCountry: businessCountry, countries: countriesBody.list }];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}); });
|
|
54
70
|
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
71
|
var payload, data, leadResponse;
|
|
56
72
|
return __generator(this, function (_a) {
|
|
@@ -177,8 +193,9 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
177
193
|
var initialState = {
|
|
178
194
|
error: null,
|
|
179
195
|
loading: false,
|
|
180
|
-
customLoading: false,
|
|
181
196
|
data: {
|
|
197
|
+
countries: [],
|
|
198
|
+
businessCountry: defaultCountry,
|
|
182
199
|
verify: {
|
|
183
200
|
token: ''
|
|
184
201
|
},
|
|
@@ -211,6 +228,23 @@ export var individualSlice = createSlice({
|
|
|
211
228
|
},
|
|
212
229
|
extraReducers: function (builder) {
|
|
213
230
|
builder
|
|
231
|
+
.addCase(getCountries.fulfilled, function (state, action) {
|
|
232
|
+
state.error = null;
|
|
233
|
+
state.customLoading = false;
|
|
234
|
+
var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
|
|
235
|
+
state.data.countries = countries
|
|
236
|
+
.slice()
|
|
237
|
+
.sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
|
|
238
|
+
state.data.businessCountry = businessCountry || defaultCountry;
|
|
239
|
+
})
|
|
240
|
+
.addCase(getCountries.pending, function (state) {
|
|
241
|
+
state.error = null;
|
|
242
|
+
state.customLoading = true;
|
|
243
|
+
})
|
|
244
|
+
.addCase(getCountries.rejected, function (state, action) {
|
|
245
|
+
state.error = action.error.message;
|
|
246
|
+
state.customLoading = false;
|
|
247
|
+
})
|
|
214
248
|
.addCase(verifyLeadToken.pending, function (state) {
|
|
215
249
|
state.error = null;
|
|
216
250
|
state.customLoading = true;
|
|
@@ -258,6 +292,7 @@ export var individualSlice = createSlice({
|
|
|
258
292
|
state.error = null;
|
|
259
293
|
})
|
|
260
294
|
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
295
|
+
var _a, _b;
|
|
261
296
|
state.loading = false;
|
|
262
297
|
state.error = null;
|
|
263
298
|
var sourceIncome = action.payload;
|
|
@@ -266,6 +301,10 @@ export var individualSlice = createSlice({
|
|
|
266
301
|
var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
|
|
267
302
|
if (!!selectedSourceIncome)
|
|
268
303
|
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
304
|
+
var location = (_b = (_a = state.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.entity) === null || _b === void 0 ? void 0 : _b.country;
|
|
305
|
+
if (!!location) {
|
|
306
|
+
state.data.individualData.employerLocation = state.data.countries.find(function (country) { return country.iso2 === location; });
|
|
307
|
+
}
|
|
269
308
|
})
|
|
270
309
|
.addCase(retrieveDataList.rejected, function (state, action) {
|
|
271
310
|
state.loading = false;
|
|
@@ -13,13 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useAppDispatch } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { useSelector } from 'react-redux';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
18
|
import Box from '@mui/material/Box/Box';
|
|
20
19
|
import { styled } from '@mui/material/styles';
|
|
21
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
|
-
import { useLanguage } from '../../../../hooks';
|
|
21
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
23
22
|
import { maskPhone } from '../../../../utils';
|
|
24
23
|
import Form from '../../../../components/Form';
|
|
25
24
|
import Text from '../../../../components/Text';
|
|
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var VerifyNumber = function (_a) {
|
|
51
50
|
var _b, _c, _d;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
|
-
var _e =
|
|
52
|
+
var _e = useAppSelector(bankSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
54
53
|
var methods = useForm({
|
|
55
54
|
resolver: yupResolver(OTPValidation),
|
|
56
55
|
defaultValues: data.otpData,
|
|
@@ -73,6 +72,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
72
|
};
|
|
74
73
|
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
75
74
|
var disabled = !methods.formState.isValid || !!error || !phone;
|
|
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 ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled,
|
|
75
|
+
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('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
76
|
};
|
|
78
77
|
export default React.memo(VerifyNumber);
|
|
@@ -11,11 +11,10 @@ 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 { useSelector } from 'react-redux';
|
|
15
14
|
import { styled } from '@mui/material/styles';
|
|
16
15
|
import ActivitiesList from './ActivitiesList';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
|
-
import { useAppDispatch, useLanguage } from '../../../../hooks';
|
|
17
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
19
18
|
import Form from '../../../../components/Form';
|
|
20
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
21
20
|
import { useTranslation } from 'react-i18next';
|
|
@@ -37,7 +36,7 @@ var Activities = function () {
|
|
|
37
36
|
var dispatch = useAppDispatch();
|
|
38
37
|
var isAr = useLanguage().isAr;
|
|
39
38
|
var t = useTranslation().t;
|
|
40
|
-
var _c =
|
|
39
|
+
var _c = useAppSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
41
40
|
var activitiesData = data.activitiesData;
|
|
42
41
|
var methods = useForm({
|
|
43
42
|
resolver: yupResolver(ActivitiesValidationSchema),
|
|
@@ -31,14 +31,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
31
31
|
};
|
|
32
32
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
33
33
|
import * as React from 'react';
|
|
34
|
-
import { useSelector } from 'react-redux';
|
|
35
34
|
import Box from '@mui/material/Box';
|
|
36
35
|
import { alpha, styled } from '@mui/material/styles';
|
|
37
36
|
import Text from '../../../../components/Text';
|
|
38
37
|
import Input from '../../../../components/Input';
|
|
39
38
|
import { useTranslation } from 'react-i18next';
|
|
40
39
|
import { useController, useFormContext } from 'react-hook-form';
|
|
41
|
-
import { useLanguage } from '../../../../hooks';
|
|
40
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
42
41
|
import { BusinessType } from '../../../../@types';
|
|
43
42
|
import Collapse from '../../../../components/Collapse';
|
|
44
43
|
import SimpleList from '../../../../components/SimpleList';
|
|
@@ -83,7 +82,7 @@ var ActivitiesList = function (_a) {
|
|
|
83
82
|
var t = useTranslation().t;
|
|
84
83
|
var isAr = useLanguage().isAr;
|
|
85
84
|
var control = useFormContext().control;
|
|
86
|
-
var data =
|
|
85
|
+
var data = useAppSelector(businessSelector).data;
|
|
87
86
|
var activitiesControl = useController({ name: 'activities', control: control });
|
|
88
87
|
var controlValue = activitiesControl.field.value;
|
|
89
88
|
var businessTypeData = data.businessTypeData;
|
|
@@ -20,12 +20,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
20
20
|
};
|
|
21
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
import * as React from 'react';
|
|
23
|
-
import { useSelector } from 'react-redux';
|
|
24
23
|
import Box from '@mui/material/Box';
|
|
25
24
|
import { alpha, styled } from '@mui/material/styles';
|
|
26
25
|
import { useTranslation } from 'react-i18next';
|
|
27
26
|
import { useController, useFormContext } from 'react-hook-form';
|
|
28
|
-
import { useLanguage } from '../../../../hooks';
|
|
27
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
29
28
|
import Text from '../../../../components/Text';
|
|
30
29
|
import { businessSelector } from '../../../app/business/businessStore';
|
|
31
30
|
import CheckBox from '../../../../components/CheckBox';
|
|
@@ -83,7 +82,7 @@ var SalesChannels = function () {
|
|
|
83
82
|
var channelsControl = useController({ name: 'salesChannels', control: control });
|
|
84
83
|
var channelsChecked = channelsControl.field.value;
|
|
85
84
|
var warningMessage = (_a = channelsControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
86
|
-
var data =
|
|
85
|
+
var data = useAppSelector(businessSelector).data;
|
|
87
86
|
var channelList = (data.businessTypeData.responseBody || {}).channelList;
|
|
88
87
|
React.useEffect(function () {
|
|
89
88
|
if ((channelList === null || channelList === void 0 ? void 0 : channelList.length) > 0) {
|
|
@@ -11,11 +11,10 @@ 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 { useSelector } from 'react-redux';
|
|
15
14
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
15
|
import { useTranslation } from 'react-i18next';
|
|
17
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
17
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
18
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
20
19
|
import Form from '../../../../components/Form';
|
|
21
20
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -26,7 +25,7 @@ import Button from '../../../shared/Button';
|
|
|
26
25
|
import { LicenseValidationSchema } from './validation';
|
|
27
26
|
import LicenseList from './LicenseList';
|
|
28
27
|
var BusinessType = function (_a) {
|
|
29
|
-
var _b =
|
|
28
|
+
var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
30
29
|
var t = useTranslation().t;
|
|
31
30
|
var isAr = useLanguage().isAr;
|
|
32
31
|
var dispatch = useAppDispatch();
|
|
@@ -22,12 +22,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import * as React from 'react';
|
|
25
|
-
import { useSelector } from 'react-redux';
|
|
26
25
|
import { useTranslation } from 'react-i18next';
|
|
27
26
|
import { useController, useFormContext } from 'react-hook-form';
|
|
28
27
|
import Box from '@mui/material/Box';
|
|
29
28
|
import { styled } from '@mui/material/styles';
|
|
30
|
-
import { useAppDispatch, useLanguage } from '../../../../hooks';
|
|
29
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
31
30
|
import { BusinessType } from '../../../../@types';
|
|
32
31
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
33
32
|
import Input from '../../../shared/Input';
|
|
@@ -56,7 +55,7 @@ var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return
|
|
|
56
55
|
});
|
|
57
56
|
var LicenseList = function (_a) {
|
|
58
57
|
var rest = __rest(_a, []);
|
|
59
|
-
var _b =
|
|
58
|
+
var _b = useAppSelector(businessSelector), data = _b.data, error = _b.error;
|
|
60
59
|
var businessTypeData = data.businessTypeData;
|
|
61
60
|
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
62
61
|
var t = useTranslation().t;
|
|
@@ -22,7 +22,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import * as React from 'react';
|
|
25
|
-
import { useSelector } from 'react-redux';
|
|
26
25
|
import Box from '@mui/material/Box';
|
|
27
26
|
import { useTranslation } from 'react-i18next';
|
|
28
27
|
import { useController, useFormContext } from 'react-hook-form';
|
|
@@ -34,7 +33,7 @@ import ExpandIcon from '../../../../components/ExpandIcon';
|
|
|
34
33
|
import Input from '../../../../components/Input';
|
|
35
34
|
import SimpleList from '../../../../components/SimpleList';
|
|
36
35
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
37
|
-
import { useLanguage } from '../../../../hooks';
|
|
36
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
38
37
|
import { businessSelector } from '../../../app/business/businessStore';
|
|
39
38
|
export var InputLabelStyled = styled(Text)(function (_a) {
|
|
40
39
|
var theme = _a.theme;
|
|
@@ -80,7 +79,7 @@ var customerLocations = function (_a) {
|
|
|
80
79
|
var isAr = useLanguage().isAr;
|
|
81
80
|
var control = useFormContext().control;
|
|
82
81
|
var customerLocationsControl = useController({ name: 'customerLocations', control: control });
|
|
83
|
-
var data =
|
|
82
|
+
var data = useAppSelector(businessSelector).data;
|
|
84
83
|
var activitiesData = data.activitiesData;
|
|
85
84
|
var response = activitiesData.responseBody;
|
|
86
85
|
var onOpenList = function (event) {
|
|
@@ -11,13 +11,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import Box from '@mui/material/Box/Box';
|
|
14
|
-
import { useSelector } from 'react-redux';
|
|
15
14
|
import { styled } from '@mui/material/styles';
|
|
16
15
|
import * as React from 'react';
|
|
17
16
|
import { useTranslation } from 'react-i18next';
|
|
18
17
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
19
18
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
21
|
import { CustomerInfoValidation } from './validation';
|
|
23
22
|
import Form from '../../../../components/Form';
|
|
@@ -44,7 +43,7 @@ var ListType;
|
|
|
44
43
|
var Customers = function (_a) {
|
|
45
44
|
var _b = React.useState(), listActive = _b[0], setListActive = _b[1];
|
|
46
45
|
var dispatch = useAppDispatch();
|
|
47
|
-
var _c =
|
|
46
|
+
var _c = useAppSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
48
47
|
var customerData = data.customersData;
|
|
49
48
|
var methods = useForm({
|
|
50
49
|
resolver: yupResolver(CustomerInfoValidation),
|
|
@@ -22,12 +22,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import * as React from 'react';
|
|
25
|
-
import { useSelector } from 'react-redux';
|
|
26
25
|
import Box from '@mui/material/Box';
|
|
27
26
|
import { styled } from '@mui/material/styles';
|
|
28
27
|
import { useTranslation } from 'react-i18next';
|
|
29
28
|
import { useController, useFormContext } from 'react-hook-form';
|
|
30
|
-
import { useLanguage } from '../../../../hooks';
|
|
29
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
31
30
|
import SimpleList from '../../../../components/SimpleList';
|
|
32
31
|
import Collapse from '../../../../components/Collapse';
|
|
33
32
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
@@ -52,7 +51,7 @@ var ExpectedCustomers = function (_a) {
|
|
|
52
51
|
var isAr = useLanguage().isAr;
|
|
53
52
|
var control = useFormContext().control;
|
|
54
53
|
var expectedCustomerControl = useController({ name: 'expectedCustomer', control: control });
|
|
55
|
-
var data =
|
|
54
|
+
var data = useAppSelector(businessSelector).data;
|
|
56
55
|
var activitiesData = data.activitiesData;
|
|
57
56
|
var response = activitiesData.responseBody;
|
|
58
57
|
var onOpenList = function (event) {
|
|
@@ -26,13 +26,12 @@ import Box from '@mui/material/Box';
|
|
|
26
26
|
import { styled } from '@mui/material/styles';
|
|
27
27
|
import { useTranslation } from 'react-i18next';
|
|
28
28
|
import { useController, useFormContext } from 'react-hook-form';
|
|
29
|
-
import { useLanguage } from '../../../../hooks';
|
|
29
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
30
30
|
import SimpleList from '../../../../components/SimpleList';
|
|
31
31
|
import Collapse from '../../../../components/Collapse';
|
|
32
32
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
33
33
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
34
34
|
import { InputLabelStyled, CheckIconStyled, InputStyled, NameContainer } from './CustomerLocations';
|
|
35
|
-
import { useSelector } from 'react-redux';
|
|
36
35
|
import { businessSelector } from '../../../../features/app/business/businessStore';
|
|
37
36
|
var ListItemContainer = styled(Box)(function () { return ({
|
|
38
37
|
display: 'flex'
|
|
@@ -48,7 +47,7 @@ var ExpectedSalesRange = function (_a) {
|
|
|
48
47
|
var isAr = useLanguage().isAr;
|
|
49
48
|
var control = useFormContext().control;
|
|
50
49
|
var expectedSalesRangeControl = useController({ name: 'expectedSalesRange', control: control });
|
|
51
|
-
var data =
|
|
50
|
+
var data = useAppSelector(businessSelector).data;
|
|
52
51
|
var activitiesData = data.activitiesData;
|
|
53
52
|
var response = activitiesData.responseBody;
|
|
54
53
|
var onOpenList = function (event) {
|
|
@@ -13,10 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
17
|
import { styled, alpha } from '@mui/material/styles';
|
|
17
18
|
import Text from '../../../../components/Text';
|
|
18
19
|
import DatePicker from '../../../../components/DatePicker';
|
|
19
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { businessSelector, clearError } from '../../../app/business/businessStore';
|
|
20
22
|
var InputLabelStyled = styled(Text)(function (_a) {
|
|
21
23
|
var theme = _a.theme;
|
|
22
24
|
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption), { cursor: 'pointer' }));
|
|
@@ -26,8 +28,12 @@ var BOD = function (_a) {
|
|
|
26
28
|
var onDateClicked = _a.onDateClicked;
|
|
27
29
|
var t = useTranslation().t;
|
|
28
30
|
var control = useFormContext().control;
|
|
31
|
+
var dispatch = useAppDispatch();
|
|
29
32
|
var dobControl = useController({ control: control, name: 'dob' });
|
|
33
|
+
var error = useAppSelector(businessSelector).error;
|
|
30
34
|
var handleBirthDateChange = function (data) {
|
|
35
|
+
if (error)
|
|
36
|
+
dispatch(clearError());
|
|
31
37
|
dobControl.field.onChange(data);
|
|
32
38
|
};
|
|
33
39
|
var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
@@ -11,13 +11,11 @@ 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 { useSelector } from 'react-redux';
|
|
15
14
|
import { useTranslation } from 'react-i18next';
|
|
16
15
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
16
|
import { styled } from '@mui/material/styles';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
|
-
import { useAppDispatch, useLanguage } from '../../../../hooks';
|
|
20
|
-
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
18
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
21
19
|
import Form from '../../../../components/Form';
|
|
22
20
|
import Button from '../../../shared/Button';
|
|
23
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -35,7 +33,7 @@ var IDBOD = function (_a) {
|
|
|
35
33
|
var isAr = useLanguage().isAr;
|
|
36
34
|
var dispatch = useAppDispatch();
|
|
37
35
|
var t = useTranslation().t;
|
|
38
|
-
var _c =
|
|
36
|
+
var _c = useAppSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
39
37
|
var methods = useForm({
|
|
40
38
|
resolver: yupResolver(NIDValidationSchema),
|
|
41
39
|
defaultValues: data.nidData,
|
|
@@ -51,10 +49,7 @@ var IDBOD = function (_a) {
|
|
|
51
49
|
var handleCollapseOpenClose = function (flag) {
|
|
52
50
|
setCollapse(flag);
|
|
53
51
|
};
|
|
54
|
-
var onBack = function () {
|
|
55
|
-
dispatch(handlePrevScreenStep());
|
|
56
|
-
};
|
|
57
52
|
var disabled = !methods.formState.isValid || !!error;
|
|
58
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ID, {}) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Button, __assign({ loading: loading, disableBack: true, isAr: isAr, disabled: disabled,
|
|
53
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ID, {}) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Button, __assign({ loading: loading, disableBack: true, isAr: isAr, disabled: disabled, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
59
54
|
};
|
|
60
55
|
export default React.memo(IDBOD);
|
|
@@ -11,8 +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 {
|
|
15
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
14
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
15
|
import { useTranslation } from 'react-i18next';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
@@ -48,7 +47,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
48
47
|
flexDirection: 'column'
|
|
49
48
|
}); });
|
|
50
49
|
var OTP = function (_a) {
|
|
51
|
-
var _b =
|
|
50
|
+
var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
52
|
var methods = useForm({
|
|
54
53
|
resolver: yupResolver(OTPValidation),
|
|
@@ -72,7 +71,7 @@ var OTP = function (_a) {
|
|
|
72
71
|
};
|
|
73
72
|
var disabled = !methods.formState.isValid || !!error;
|
|
74
73
|
var idNumber = data.nidData.nid;
|
|
75
|
-
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: "".concat(maskID(idNumber || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled,
|
|
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: "".concat(maskID(idNumber || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
76
75
|
};
|
|
77
76
|
OTP.defaultProps = {};
|
|
78
77
|
export default React.memo(OTP);
|
|
@@ -11,7 +11,6 @@ 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 { useSelector } from 'react-redux';
|
|
15
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
15
|
import { useTranslation } from 'react-i18next';
|
|
17
16
|
import Box from '@mui/material/Box/Box';
|
|
@@ -19,7 +18,7 @@ import { styled } from '@mui/material/styles';
|
|
|
19
18
|
import OTPField from '../../../shared/OTP';
|
|
20
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
21
20
|
import { businessSelector, updateLeadIdentity } from '../../../app/business/businessStore';
|
|
22
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
22
|
var BoxStyled = styled(Box)(function (_a) {
|
|
24
23
|
var theme = _a.theme;
|
|
25
24
|
return ({
|
|
@@ -33,7 +32,7 @@ var OTPInput = function (_a) {
|
|
|
33
32
|
var t = useTranslation().t;
|
|
34
33
|
var dispatch = useAppDispatch();
|
|
35
34
|
var otpControl = useController({ name: 'otp', control: control });
|
|
36
|
-
var data =
|
|
35
|
+
var data = useAppSelector(businessSelector).data;
|
|
37
36
|
var nidData = data.nidData;
|
|
38
37
|
var handleOnOTPChange = function (otp) {
|
|
39
38
|
otpControl.field.onChange(otp);
|
|
@@ -11,9 +11,8 @@ 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 } from '../../../../hooks';
|
|
14
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { useSelector } from 'react-redux';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
18
|
import Box from '@mui/material/Box/Box';
|
|
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var VerifyNumber = function (_a) {
|
|
51
50
|
var _b, _c, _d;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
|
-
var _e =
|
|
52
|
+
var _e = useAppSelector(businessSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
54
53
|
var methods = useForm({
|
|
55
54
|
resolver: yupResolver(OTPValidation),
|
|
56
55
|
defaultValues: data.otpData,
|
|
@@ -73,6 +72,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
72
|
};
|
|
74
73
|
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
75
74
|
var disabled = !methods.formState.isValid || !!error || !phone;
|
|
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 ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled,
|
|
75
|
+
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('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
76
|
};
|
|
78
77
|
export default React.memo(VerifyNumber);
|
|
@@ -10,7 +10,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useSelector } from 'react-redux';
|
|
14
13
|
import { styled } from '@mui/material/styles';
|
|
15
14
|
import Email from './Email';
|
|
16
15
|
import Name from './Name';
|
|
@@ -18,7 +17,7 @@ import * as React from 'react';
|
|
|
18
17
|
import { useTranslation } from 'react-i18next';
|
|
19
18
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
20
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
21
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
20
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
21
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
23
22
|
import { IndividualValidation, IndividualMobileValidation } from './validation';
|
|
24
23
|
import Form from '../../../../components/Form';
|
|
@@ -37,7 +36,7 @@ var Individual = function (_a) {
|
|
|
37
36
|
var _b, _c, _d;
|
|
38
37
|
var _e = React.useState(false), listActive = _e[0], setListActive = _e[1];
|
|
39
38
|
var _f = React.useState(false), emailChecking = _f[0], setEmailChecking = _f[1];
|
|
40
|
-
var _g =
|
|
39
|
+
var _g = useAppSelector(connectSelector), data = _g.data, loading = _g.loading, error = _g.error;
|
|
41
40
|
var dispatch = useAppDispatch();
|
|
42
41
|
var t = useTranslation().t;
|
|
43
42
|
var isAr = useLanguage().isAr;
|
|
@@ -47,7 +47,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
49
|
import * as React from 'react';
|
|
50
|
-
import { useSelector } from 'react-redux';
|
|
51
50
|
import { useTranslation } from 'react-i18next';
|
|
52
51
|
import { useController, useFormContext } from 'react-hook-form';
|
|
53
52
|
import Box from '@mui/material/Box';
|
|
@@ -65,7 +64,7 @@ import Collapse from '../../../../components/Collapse';
|
|
|
65
64
|
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
66
65
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
67
66
|
import { checkBrandNameAvailability, connectSelector } from '../../../app/connect/connectStore';
|
|
68
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
67
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
69
68
|
import { debounce } from 'lodash-es';
|
|
70
69
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
71
70
|
var theme = _a.theme;
|
|
@@ -108,7 +107,7 @@ var BrandName = function (_a) {
|
|
|
108
107
|
var brandControl = useController({ control: control, name: 'brandName' });
|
|
109
108
|
var brandNameValue = brandControl.field.value;
|
|
110
109
|
var error = (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
111
|
-
var data =
|
|
110
|
+
var data = useAppSelector(connectSelector).data;
|
|
112
111
|
var checkBrand = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
113
112
|
var onSuccess;
|
|
114
113
|
return __generator(this, function (_a) {
|
|
@@ -11,12 +11,11 @@ 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 { useSelector } from 'react-redux';
|
|
15
14
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
15
|
import { useTranslation } from 'react-i18next';
|
|
17
16
|
import Collapse from '@mui/material/Collapse';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
20
19
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
21
20
|
import Form from '../../../../components/Form';
|
|
22
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -33,7 +32,7 @@ var Merchant = function (_a) {
|
|
|
33
32
|
var _e = React.useState(false), brandNameChecking = _e[0], setBrandNameChecking = _e[1];
|
|
34
33
|
var _f = React.useState(ValidationOptions.NEW_USER), userType = _f[0], setUserType = _f[1];
|
|
35
34
|
var _g = React.useState(false), listActive = _g[0], setListActive = _g[1];
|
|
36
|
-
var _h =
|
|
35
|
+
var _h = useAppSelector(connectSelector), data = _h.data, loading = _h.loading, error = _h.error;
|
|
37
36
|
var isNewUser = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.new_user;
|
|
38
37
|
var isAbsher = data.otpData.isAbsher;
|
|
39
38
|
var brandList = ((_c = data.brandData.responseBody) === null || _c === void 0 ? void 0 : _c.brands) || [];
|
|
@@ -11,7 +11,6 @@ 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 { useSelector } from 'react-redux';
|
|
15
14
|
import Box from '@mui/material/Box';
|
|
16
15
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
@@ -20,7 +19,7 @@ import { styled, alpha } from '@mui/material/styles';
|
|
|
20
19
|
import Collapse from '../../../../components/Collapse';
|
|
21
20
|
import Form from '../../../../components/Form';
|
|
22
21
|
import Button, { AbsherButton } from '../../../shared/Button';
|
|
23
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
22
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
24
23
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
25
24
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
26
25
|
import { clearError, connectSelector, createMobileAuth } from '../../../app/connect/connectStore';
|
|
@@ -73,8 +72,8 @@ var ListType;
|
|
|
73
72
|
ListType["CountryCodeList"] = "CountryCodeList";
|
|
74
73
|
})(ListType || (ListType = {}));
|
|
75
74
|
var Mobile = function (_a) {
|
|
76
|
-
var settingsStore =
|
|
77
|
-
var _b =
|
|
75
|
+
var settingsStore = useAppSelector(settingsSelector);
|
|
76
|
+
var _b = useAppSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
78
77
|
var _c = React.useState(), listType = _c[0], setListType = _c[1];
|
|
79
78
|
var dispatch = useAppDispatch();
|
|
80
79
|
var methods = useForm({
|
|
@@ -31,11 +31,12 @@ import Collapse from '../../../../components/Collapse';
|
|
|
31
31
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
32
32
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
33
33
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
34
|
+
import { connectSelector } from '../../../app/connect/connectStore';
|
|
34
35
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
35
36
|
import Input from '../../../shared/Input';
|
|
36
37
|
import SimpleList from '../../../../components/SimpleList';
|
|
37
38
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
38
|
-
import { useLanguage } from '../../../../hooks';
|
|
39
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
39
40
|
import Search from '../../../shared/Search';
|
|
40
41
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
41
42
|
var theme = _a.theme;
|
|
@@ -80,6 +81,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
80
81
|
var t = useTranslation().t;
|
|
81
82
|
var isAr = useLanguage().isAr;
|
|
82
83
|
var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
|
|
84
|
+
var loading = useAppSelector(connectSelector).loading;
|
|
83
85
|
var phoneControl = useController({ name: 'mobile', control: control });
|
|
84
86
|
var countryCodeControl = useController({ name: 'countryCode', control: control });
|
|
85
87
|
var countryCodeValue = countryCodeControl.field.value;
|
|
@@ -130,7 +132,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
130
132
|
});
|
|
131
133
|
setCountries(filteredCountries);
|
|
132
134
|
};
|
|
133
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
135
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', required: true, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
134
136
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
135
137
|
} })] }))] })) })));
|
|
136
138
|
});
|
|
@@ -10,10 +10,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useSelector } from 'react-redux';
|
|
14
13
|
import { useTranslation } from 'react-i18next';
|
|
15
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
15
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
16
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
18
17
|
import DatePicker from '../../../../components/DatePicker';
|
|
19
18
|
import { alpha, styled } from '@mui/material/styles';
|
|
@@ -30,7 +29,7 @@ var DOB = function (_a) {
|
|
|
30
29
|
var control = useFormContext().control;
|
|
31
30
|
var dispatch = useAppDispatch();
|
|
32
31
|
var dobControl = useController({ control: control, name: 'dob' });
|
|
33
|
-
var error =
|
|
32
|
+
var error = useAppSelector(connectSelector).error;
|
|
34
33
|
var handleBirthDateChange = function (data) {
|
|
35
34
|
dobControl.field.onChange(data);
|
|
36
35
|
handleClearError();
|
|
@@ -11,13 +11,12 @@ 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 { useSelector } from 'react-redux';
|
|
15
14
|
import { useTranslation } from 'react-i18next';
|
|
16
15
|
import { alpha, styled } from '@mui/material/styles';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
18
|
import { NIDValidationSchema } from './validation';
|
|
20
|
-
import { useAppDispatch, useLanguage } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
21
20
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
22
21
|
import { clearError, connectSelector, createNIDAuth } from '../../../app/connect/connectStore';
|
|
23
22
|
import Form from '../../../../components/Form';
|
|
@@ -62,8 +61,8 @@ var NID = function (_a) {
|
|
|
62
61
|
var isAr = useLanguage().isAr;
|
|
63
62
|
var dispatch = useAppDispatch();
|
|
64
63
|
var t = useTranslation().t;
|
|
65
|
-
var _c =
|
|
66
|
-
var settingsStore =
|
|
64
|
+
var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
65
|
+
var settingsStore = useAppSelector(settingsSelector);
|
|
67
66
|
var methods = useForm({
|
|
68
67
|
resolver: yupResolver(NIDValidationSchema),
|
|
69
68
|
defaultValues: data.nidData,
|
|
@@ -10,7 +10,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useSelector } from 'react-redux';
|
|
14
13
|
import Box from '@mui/material/Box/Box';
|
|
15
14
|
import { styled } from '@mui/material/styles';
|
|
16
15
|
import * as React from 'react';
|
|
@@ -19,7 +18,7 @@ import Text from '../../../../components/Text';
|
|
|
19
18
|
import { clearError, connectSelector, resetOTPScreen, verifyAuth } from '../../../app/connect/connectStore';
|
|
20
19
|
import Button from '../../../shared/Button';
|
|
21
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
22
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
24
23
|
import { useLanguage } from '../../../../hooks';
|
|
25
24
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var OTP = function () {
|
|
51
50
|
var _a;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
|
-
var _b =
|
|
52
|
+
var _b = useAppSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
54
53
|
var methods = useForm({
|
|
55
54
|
resolver: yupResolver(OTPValidation),
|
|
56
55
|
defaultValues: data.otpData,
|
|
@@ -11,7 +11,6 @@ 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 { useSelector } from 'react-redux';
|
|
15
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
15
|
import { useTranslation } from 'react-i18next';
|
|
17
16
|
import Box from '@mui/material/Box/Box';
|
|
@@ -19,7 +18,7 @@ import { styled } from '@mui/material/styles';
|
|
|
19
18
|
import OTPField from '../../../shared/OTP';
|
|
20
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
21
20
|
import { connectSelector, createMobileAuth, createNIDAuth } from '../../../app/connect/connectStore';
|
|
22
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
22
|
var BoxStyled = styled(Box)(function (_a) {
|
|
24
23
|
var theme = _a.theme;
|
|
25
24
|
return ({
|
|
@@ -33,7 +32,7 @@ var OTPInput = function (_a) {
|
|
|
33
32
|
var t = useTranslation().t;
|
|
34
33
|
var dispatch = useAppDispatch();
|
|
35
34
|
var otpControl = useController({ name: 'otp', control: control });
|
|
36
|
-
var data =
|
|
35
|
+
var data = useAppSelector(connectSelector).data;
|
|
37
36
|
var mobileData = data.mobileData;
|
|
38
37
|
var nidData = data.nidData;
|
|
39
38
|
var isAbsher = data.otpData.isAbsher;
|
|
@@ -21,7 +21,7 @@ import { getParameterByName, reactElement } from '../../utils';
|
|
|
21
21
|
import { FeatureContainer } from '../shared/Containers';
|
|
22
22
|
import { INDIVIDUAL_SCREENS_NAVIGATION } from '../../constants';
|
|
23
23
|
import { individualFeatureScreens } from '../featuresScreens';
|
|
24
|
-
import { individualSelector, verifyLeadToken } from '../app/individual/individualStore';
|
|
24
|
+
import { getCountries, individualSelector, verifyLeadToken } from '../app/individual/individualStore';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
26
26
|
var Individual = memo(function (props) {
|
|
27
27
|
var open = React.useState(true)[0];
|
|
@@ -42,6 +42,9 @@ var Individual = memo(function (props) {
|
|
|
42
42
|
if (!loading)
|
|
43
43
|
verifyToken();
|
|
44
44
|
}, [loading]);
|
|
45
|
+
useEffect(function () {
|
|
46
|
+
dispatch(getCountries());
|
|
47
|
+
}, []);
|
|
45
48
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
|
|
46
49
|
var Element = _a.element, name = _a.name;
|
|
47
50
|
var isActive = activeScreen.name === name;
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -15,7 +15,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
15
15
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
16
|
import Box from '@mui/material/Box';
|
|
17
17
|
import { useTranslation } from 'react-i18next';
|
|
18
|
-
import { useAppDispatch } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
20
20
|
import { styled } from '@mui/material/styles';
|
|
21
21
|
import Form from '../../../../components/Form';
|
|
@@ -30,8 +30,6 @@ import MonthlyIncome from './MonthlyIncome';
|
|
|
30
30
|
import EmployerName from './EmployerName';
|
|
31
31
|
import EmployerLocation from './EmployerLocation';
|
|
32
32
|
import SourceOfIncome from './SourceOfIncome';
|
|
33
|
-
import { countriesCode } from '../../../../constants';
|
|
34
|
-
import { useSelector } from 'react-redux';
|
|
35
33
|
import { individualSelector, updateIndividualInfo } from '../../../app/individual/individualStore';
|
|
36
34
|
var InputsContainerStyled = styled(Box)(function (_a) {
|
|
37
35
|
var _b;
|
|
@@ -59,7 +57,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
59
57
|
var t = useTranslation().t;
|
|
60
58
|
var isAr = useLanguage().isAr;
|
|
61
59
|
var dispatch = useAppDispatch();
|
|
62
|
-
var _b =
|
|
60
|
+
var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
63
61
|
var methods = useForm({
|
|
64
62
|
resolver: yupResolver(IndividualInfoValidationSchema),
|
|
65
63
|
defaultValues: data.individualData,
|
|
@@ -75,13 +73,18 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
75
73
|
setEmployerFieldsActive(false);
|
|
76
74
|
}
|
|
77
75
|
}, [methods.watch('sourceIncome')]);
|
|
76
|
+
React.useEffect(function () {
|
|
77
|
+
if (data.individualData.employerLocation) {
|
|
78
|
+
methods.setValue('employerLocation', data.individualData.employerLocation);
|
|
79
|
+
}
|
|
80
|
+
}, [data.individualData.employerLocation]);
|
|
78
81
|
var onSubmit = function (data) {
|
|
79
82
|
dispatch(updateIndividualInfo(data));
|
|
80
83
|
};
|
|
81
84
|
var onBack = function () {
|
|
82
85
|
dispatch(handlePrevScreenStep());
|
|
83
86
|
};
|
|
84
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(SourceOfIncome, { show: !listActive }), _jsx(MonthlyIncome, { show: !listActive }), _jsx(EmployerName, { show: !listActive && employerFieldsActive }), _jsx(EmployerLocation, { show: employerFieldsActive, countries:
|
|
87
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(SourceOfIncome, { show: !listActive }), _jsx(MonthlyIncome, { show: !listActive }), _jsx(EmployerName, { show: !listActive && employerFieldsActive }), _jsx(EmployerLocation, { show: employerFieldsActive, countries: data.countries, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] })), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(ButtonStyled, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
85
88
|
};
|
|
86
89
|
export default React.memo(AdditionalIndividualInfo);
|
|
87
90
|
AdditionalIndividualInfo.defaultProps = {};
|
|
@@ -20,14 +20,11 @@ import CheckIcon from '../../../shared/CheckIcon';
|
|
|
20
20
|
import Collapse from '../../../../components/Collapse';
|
|
21
21
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
22
22
|
import { styled } from '@mui/material/styles';
|
|
23
|
-
var InputStyled = styled(Input)(function (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
23
|
+
var InputStyled = styled(Input)(function () { return ({
|
|
24
|
+
input: {
|
|
25
|
+
textTransform: 'capitalize'
|
|
26
|
+
}
|
|
27
|
+
}); });
|
|
31
28
|
var EmployerName = function (_a) {
|
|
32
29
|
var _b;
|
|
33
30
|
var show = _a.show;
|
|
@@ -13,13 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useAppDispatch } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { useSelector } from 'react-redux';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
18
|
import Box from '@mui/material/Box/Box';
|
|
20
19
|
import { styled } from '@mui/material/styles';
|
|
21
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
|
-
import { useLanguage } from '../../../../hooks';
|
|
21
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
23
22
|
import { maskPhone } from '../../../../utils';
|
|
24
23
|
import Form from '../../../../components/Form';
|
|
25
24
|
import Text from '../../../../components/Text';
|
|
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var VerifyNumber = function (_a) {
|
|
51
50
|
var _b, _c, _d;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
|
-
var _e =
|
|
52
|
+
var _e = useAppSelector(individualSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
54
53
|
var methods = useForm({
|
|
55
54
|
resolver: yupResolver(OTPValidation),
|
|
56
55
|
defaultValues: data.otpData,
|
|
@@ -73,6 +72,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
72
|
};
|
|
74
73
|
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
75
74
|
var disabled = !methods.formState.isValid || !!error || !phone;
|
|
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 ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled,
|
|
75
|
+
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('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
76
|
};
|
|
78
77
|
export default React.memo(VerifyNumber);
|
|
@@ -13,13 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useAppDispatch } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { useSelector } from 'react-redux';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
18
|
import Box from '@mui/material/Box/Box';
|
|
20
19
|
import { styled } from '@mui/material/styles';
|
|
21
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
|
-
import { useLanguage } from '../../../../hooks';
|
|
21
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
23
22
|
import { maskPhone } from '../../../../utils';
|
|
24
23
|
import Form from '../../../../components/Form';
|
|
25
24
|
import Text from '../../../../components/Text';
|
|
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var VerifyNumber = function (_a) {
|
|
51
50
|
var _b, _c, _d;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
|
-
var _e =
|
|
52
|
+
var _e = useAppSelector(passwordSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
54
53
|
var methods = useForm({
|
|
55
54
|
resolver: yupResolver(OTPValidation),
|
|
56
55
|
defaultValues: data.otpData,
|
|
@@ -73,6 +72,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
72
|
};
|
|
74
73
|
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
75
74
|
var disabled = !methods.formState.isValid || !!error || !phone;
|
|
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 ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled,
|
|
75
|
+
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('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
76
|
};
|
|
78
77
|
export default React.memo(VerifyNumber);
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { LanguageMode } from '../../../@types';
|
|
3
|
-
import { useAppDispatch, useLanguage } from '../../../hooks';
|
|
3
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../hooks';
|
|
4
4
|
import { handleLanguage } from '../../../app/settings';
|
|
5
5
|
import Footer from '../../../components/Footer';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { useSelector } from 'react-redux';
|
|
8
7
|
import { connectSelector } from '../../app/connect/connectStore';
|
|
9
8
|
export default function CustomFooter() {
|
|
10
9
|
var isEn = useLanguage().isEn;
|
|
11
10
|
var t = useTranslation().t;
|
|
12
11
|
var dispatch = useAppDispatch();
|
|
13
|
-
var _a =
|
|
12
|
+
var _a = useAppSelector(connectSelector), data = _a.data, loading = _a.loading, error = _a.error;
|
|
14
13
|
var handleChangeLanguage = function () {
|
|
15
14
|
var language = isEn ? LanguageMode.AR : LanguageMode.EN;
|
|
16
15
|
dispatch(handleLanguage(language));
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
14
14
|
import Button from '../../../shared/Button';
|
|
15
|
-
import { useAppDispatch, useLanguage } from '../../../../hooks';
|
|
15
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -21,14 +21,13 @@ import { Validation } from './validation';
|
|
|
21
21
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
22
22
|
import { taxSelector, updateTaxInfo } from '../../../app/tax/taxStore';
|
|
23
23
|
import VATId from './VATId';
|
|
24
|
-
import { useSelector } from 'react-redux';
|
|
25
24
|
var FormStyled = styled(Form)(function () { return ({
|
|
26
25
|
display: 'flex',
|
|
27
26
|
flexDirection: 'column'
|
|
28
27
|
}); });
|
|
29
28
|
var TaxDetails = function () {
|
|
30
29
|
var dispatch = useAppDispatch();
|
|
31
|
-
var _a =
|
|
30
|
+
var _a = useAppSelector(taxSelector), data = _a.data, loading = _a.loading, error = _a.error;
|
|
32
31
|
var methods = useForm({
|
|
33
32
|
resolver: yupResolver(Validation),
|
|
34
33
|
defaultValues: data.taxData,
|
|
@@ -13,13 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useAppDispatch } from '../../../../hooks';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { useSelector } from 'react-redux';
|
|
17
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
18
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
19
18
|
import Box from '@mui/material/Box/Box';
|
|
20
19
|
import { styled } from '@mui/material/styles';
|
|
21
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
|
-
import { useLanguage } from '../../../../hooks';
|
|
21
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
23
22
|
import { maskPhone } from '../../../../utils';
|
|
24
23
|
import Form from '../../../../components/Form';
|
|
25
24
|
import Text from '../../../../components/Text';
|
|
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
50
49
|
var VerifyNumber = function (_a) {
|
|
51
50
|
var _b, _c, _d;
|
|
52
51
|
var dispatch = useAppDispatch();
|
|
53
|
-
var _e =
|
|
52
|
+
var _e = useAppSelector(taxSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
54
53
|
var methods = useForm({
|
|
55
54
|
resolver: yupResolver(OTPValidation),
|
|
56
55
|
defaultValues: data.otpData,
|
|
@@ -73,6 +72,6 @@ var VerifyNumber = function (_a) {
|
|
|
73
72
|
};
|
|
74
73
|
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
75
74
|
var disabled = !methods.formState.isValid || !!error || !phone;
|
|
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 ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled,
|
|
75
|
+
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('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
76
|
};
|
|
78
77
|
export default React.memo(VerifyNumber);
|