@tap-payments/auth-jsconnect 2.1.97-test → 2.1.98-test
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/individual/individualStore.d.ts +9 -0
- package/build/features/app/individual/individualStore.js +35 -0
- package/build/features/individual/screens/IndividualList/CollectPhoneEmail.d.ts +2 -0
- package/build/features/individual/screens/IndividualList/CollectPhoneEmail.js +3 -2
- package/build/features/individual/screens/IndividualList/Email.d.ts +5 -1
- package/build/features/individual/screens/IndividualList/Email.js +73 -8
- package/build/features/individual/screens/IndividualList/UserList.js +28 -16
- package/build/features/individual/screens/IndividualList/validation.js +2 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
2
|
import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState, User, IndividualPersonalInfoFormValues, IndividualEmailMobileFormValues } from '../../../@types';
|
|
3
|
+
import { CancelToken } from 'axios';
|
|
3
4
|
interface VerifyLeadTokenProps {
|
|
4
5
|
token: string;
|
|
5
6
|
isInternally?: boolean;
|
|
@@ -88,6 +89,14 @@ export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk
|
|
|
88
89
|
data: any;
|
|
89
90
|
formData: IndividualExtraFormValues;
|
|
90
91
|
}, IndividualExtraFormValues, {}>;
|
|
92
|
+
export declare const checkEmailAvailability: import("@reduxjs/toolkit").AsyncThunk<{
|
|
93
|
+
response: any;
|
|
94
|
+
formData: string;
|
|
95
|
+
} | undefined, {
|
|
96
|
+
email: string;
|
|
97
|
+
cancelToken: CancelToken;
|
|
98
|
+
onSuccess?: (() => void) | undefined;
|
|
99
|
+
}, {}>;
|
|
91
100
|
export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
92
101
|
response: any;
|
|
93
102
|
formData: void;
|
|
@@ -650,6 +650,28 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
650
650
|
}
|
|
651
651
|
});
|
|
652
652
|
}); });
|
|
653
|
+
export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', function (_a) {
|
|
654
|
+
var email = _a.email, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
|
|
655
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
656
|
+
var requestBody, data;
|
|
657
|
+
return __generator(this, function (_b) {
|
|
658
|
+
switch (_b.label) {
|
|
659
|
+
case 0:
|
|
660
|
+
requestBody = {
|
|
661
|
+
email: email,
|
|
662
|
+
encryption_contract: ['email']
|
|
663
|
+
};
|
|
664
|
+
return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
|
|
665
|
+
case 1:
|
|
666
|
+
data = (_b.sent()).data;
|
|
667
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
668
|
+
if (!data.errors)
|
|
669
|
+
return [2, { response: data, formData: email }];
|
|
670
|
+
return [2];
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
});
|
|
653
675
|
export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
654
676
|
var _a, settings, individual, _b, id, infoId, payload, data, boardInfoStatus;
|
|
655
677
|
var _c, _d, _e, _f;
|
|
@@ -1031,6 +1053,19 @@ export var individualSlice = createSlice({
|
|
|
1031
1053
|
.addCase(retrieveBoardDetails.rejected, function (state, action) {
|
|
1032
1054
|
state.error = action.error.message;
|
|
1033
1055
|
state.loading = false;
|
|
1056
|
+
})
|
|
1057
|
+
.addCase(checkEmailAvailability.fulfilled, function (state, action) {
|
|
1058
|
+
var _a;
|
|
1059
|
+
state.error = null;
|
|
1060
|
+
state.data.individualCollectData.responseBody = __assign(__assign({}, state.data.individualCollectData.responseBody), (_a = action.payload) === null || _a === void 0 ? void 0 : _a.response);
|
|
1061
|
+
})
|
|
1062
|
+
.addCase(checkEmailAvailability.pending, function (state) {
|
|
1063
|
+
state.error = null;
|
|
1064
|
+
})
|
|
1065
|
+
.addCase(checkEmailAvailability.rejected, function (state, action) {
|
|
1066
|
+
if (action.error.message === 'Aborted')
|
|
1067
|
+
return;
|
|
1068
|
+
state.error = action.error.message;
|
|
1034
1069
|
})
|
|
1035
1070
|
.addCase(updateBoardSuccess.fulfilled, function (state, action) {
|
|
1036
1071
|
var _a;
|
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { User } from '../../../../@types';
|
|
3
3
|
export interface CollectPhoneEmailProps {
|
|
4
4
|
activeUser?: User;
|
|
5
|
+
emailChecking: boolean;
|
|
6
|
+
setEmailChecking: (flag: boolean) => void;
|
|
5
7
|
}
|
|
6
8
|
declare const _default: React.MemoExoticComponent<{
|
|
7
9
|
({ activeUser }: CollectPhoneEmailProps): JSX.Element;
|
|
@@ -23,9 +23,10 @@ var CollectPhoneEmail = function (_a) {
|
|
|
23
23
|
var countries = settingsData.countries;
|
|
24
24
|
var _b = (activeUser === null || activeUser === void 0 ? void 0 : activeUser.contact) || { email: '' }, email = _b.email, phone = _b.phone;
|
|
25
25
|
var isPhoneAvailable = (phone === null || phone === void 0 ? void 0 : phone.country_code) && (phone === null || phone === void 0 ? void 0 : phone.number);
|
|
26
|
+
var _c = React.useState(false), emailChecking = _c[0], setEmailChecking = _c[1];
|
|
26
27
|
var isEmailAvailable = isValidEmail(email);
|
|
27
|
-
var
|
|
28
|
-
return (_jsxs(Box, __assign({ sx: { mb: 0 } }, { children: [_jsx(MobileNumber, { sx: { mb: isEmailAvailable ? 0 : 3 }, show: !isPhoneAvailable, countries: countries, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(Email, { show: !listActive && !isEmailAvailable })] })));
|
|
28
|
+
var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
|
|
29
|
+
return (_jsxs(Box, __assign({ sx: { mb: 0 } }, { children: [_jsx(MobileNumber, { sx: { mb: isEmailAvailable ? 0 : 3 }, show: !isPhoneAvailable, countries: countries, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(Email, { show: !listActive && !isEmailAvailable, fetchingEmail: function (v) { return setEmailChecking(v); }, emailChecking: emailChecking })] })));
|
|
29
30
|
};
|
|
30
31
|
export default React.memo(CollectPhoneEmail);
|
|
31
32
|
CollectPhoneEmail.defaultProps = {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { User } from '../../../../@types';
|
|
2
3
|
export interface EmailProps {
|
|
3
4
|
show: boolean;
|
|
5
|
+
fetchingEmail: (flag: boolean) => void;
|
|
6
|
+
emailChecking: boolean;
|
|
7
|
+
activeUser?: User;
|
|
4
8
|
}
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({ show }: EmailProps) => JSX.Element>;
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ show, fetchingEmail, emailChecking, activeUser }: EmailProps) => JSX.Element>;
|
|
6
10
|
export default _default;
|
|
@@ -9,40 +9,105 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
12
48
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
49
|
import * as React from 'react';
|
|
50
|
+
import { debounce } from 'lodash-es';
|
|
51
|
+
import axios from 'axios';
|
|
14
52
|
import { useTranslation } from 'react-i18next';
|
|
15
53
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
54
|
import { styled } from '@mui/material/styles';
|
|
17
|
-
import
|
|
55
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
56
|
+
import { useAppDispatch } from '../../../../hooks';
|
|
57
|
+
import { isValidEmail } from '../../../../utils';
|
|
18
58
|
import Collapse from '../../../../components/Collapse';
|
|
19
59
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
60
|
import Input from '../../../shared/Input';
|
|
21
61
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
22
62
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
23
|
-
import {
|
|
63
|
+
import { checkEmailAvailability } from '../../../app/individual/individualStore';
|
|
24
64
|
var InputStyled = styled(Input)(function () { return ({
|
|
25
65
|
input: {
|
|
26
66
|
textTransform: 'lowercase'
|
|
27
67
|
}
|
|
28
68
|
}); });
|
|
69
|
+
var cancelToken = null;
|
|
29
70
|
var Email = function (_a) {
|
|
30
71
|
var _b;
|
|
31
|
-
var show = _a.show;
|
|
72
|
+
var show = _a.show, fetchingEmail = _a.fetchingEmail, emailChecking = _a.emailChecking, activeUser = _a.activeUser;
|
|
32
73
|
var t = useTranslation().t;
|
|
74
|
+
var dispatch = useAppDispatch();
|
|
75
|
+
var _c = React.useState(''), storedEmail = _c[0], setStoredEmail = _c[1];
|
|
33
76
|
var control = useFormContext().control;
|
|
34
77
|
var emailControl = useController({ name: 'email', control: control });
|
|
35
|
-
var data = useAppSelector(individualSelector).data;
|
|
36
78
|
var emailValue = emailControl.field.value;
|
|
37
79
|
var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
38
|
-
var
|
|
39
|
-
|
|
80
|
+
var checkEmail = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
|
+
var onSuccess;
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
if (cancelToken) {
|
|
84
|
+
cancelToken.cancel('Aborted');
|
|
85
|
+
}
|
|
86
|
+
cancelToken = axios.CancelToken.source();
|
|
87
|
+
onSuccess = function () { return fetchingEmail(false); };
|
|
88
|
+
dispatch(checkEmailAvailability({ email: value, cancelToken: cancelToken.token, onSuccess: onSuccess }));
|
|
89
|
+
return [2];
|
|
90
|
+
});
|
|
91
|
+
}); }, 500);
|
|
92
|
+
React.useEffect(function () {
|
|
93
|
+
var _a;
|
|
94
|
+
var email = (_a = activeUser === null || activeUser === void 0 ? void 0 : activeUser.contact) === null || _a === void 0 ? void 0 : _a.email;
|
|
95
|
+
if (!!email)
|
|
96
|
+
setStoredEmail(email);
|
|
97
|
+
}, [activeUser]);
|
|
98
|
+
React.useEffect(function () {
|
|
99
|
+
var isValid = isValidEmail(emailValue) && !error && emailValue.length > 3;
|
|
100
|
+
if (isValid && emailValue != storedEmail) {
|
|
101
|
+
fetchingEmail(true);
|
|
102
|
+
checkEmail(emailValue);
|
|
103
|
+
}
|
|
104
|
+
}, [emailValue, error]);
|
|
40
105
|
var handleEmailChange = function (event) {
|
|
41
106
|
emailControl.field.onChange(event.target.value);
|
|
42
107
|
};
|
|
43
|
-
var
|
|
108
|
+
var clearEmail = function () {
|
|
44
109
|
emailControl.field.onChange('');
|
|
45
110
|
};
|
|
46
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && emailValue ? _jsx(CheckIcon, {}) : emailValue && _jsx(ClearIcon, { onClick:
|
|
111
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, onEnterPressed: function (e) { return e.preventDefault(); }, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: emailChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && emailValue ? (_jsx(CheckIcon, {})) : (emailValue && _jsx(ClearIcon, { onClick: clearEmail })) }) }) })));
|
|
47
112
|
};
|
|
48
113
|
export default React.memo(Email);
|
|
@@ -73,17 +73,20 @@ var IndividualRequestType;
|
|
|
73
73
|
IndividualRequestType[IndividualRequestType["COLLECT_EMAIL_MOBILE"] = 2] = "COLLECT_EMAIL_MOBILE";
|
|
74
74
|
})(IndividualRequestType || (IndividualRequestType = {}));
|
|
75
75
|
var UserList = function (_a) {
|
|
76
|
-
var _b
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
var
|
|
80
|
-
var
|
|
76
|
+
var _b, _c;
|
|
77
|
+
var _d = React.useState([]), usersMenuList = _d[0], setUsersMenuList = _d[1];
|
|
78
|
+
var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
79
|
+
var _f = React.useState(false), showCollectForm = _f[0], setShowCollectForm = _f[1];
|
|
80
|
+
var _g = React.useState(), activeUser = _g[0], setActiveUser = _g[1];
|
|
81
|
+
var _h = React.useState(IndividualRequestType.ADD), type = _h[0], setType = _h[1];
|
|
81
82
|
var t = useTranslation().t;
|
|
82
83
|
var isAr = useLanguage().isAr;
|
|
83
84
|
var dispatch = useAppDispatch();
|
|
85
|
+
var _j = React.useState(false), emailChecking = _j[0], setEmailChecking = _j[1];
|
|
84
86
|
var theme = useTheme();
|
|
85
|
-
var
|
|
86
|
-
var
|
|
87
|
+
var _k = useAppSelector(individualSelector), data = _k.data, loading = _k.loading, error = _k.error;
|
|
88
|
+
var _l = data.individualCollectData, email = _l.email, mobile = _l.mobile, responseBody = _l.responseBody;
|
|
89
|
+
var is_available = (responseBody || {}).is_available;
|
|
87
90
|
var verify = data.verify;
|
|
88
91
|
var userList = (verify.responseBody || {}).userList;
|
|
89
92
|
var methods = useForm({
|
|
@@ -95,14 +98,17 @@ var UserList = function (_a) {
|
|
|
95
98
|
mode: 'onChange'
|
|
96
99
|
});
|
|
97
100
|
useSetFromDefaultValues(methods, data.individualCollectData);
|
|
101
|
+
var isUserEmailAvailable = isValidEmail(((_b = activeUser === null || activeUser === void 0 ? void 0 : activeUser.contact) === null || _b === void 0 ? void 0 : _b.email) || '');
|
|
102
|
+
var isEmailValid = typeof is_available === 'undefined' ? ((_c = activeUser === null || activeUser === void 0 ? void 0 : activeUser.contact) === null || _c === void 0 ? void 0 : _c.email) === methods.watch('email') : is_available;
|
|
103
|
+
var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email || !!error;
|
|
104
|
+
var disabled = !isUserEmailAvailable ? emailChecking || emailErrChecks || !isEmailValid : !methods.formState.isValid;
|
|
98
105
|
React.useEffect(function () {
|
|
99
106
|
if ((userList === null || userList === void 0 ? void 0 : userList.length) > 0) {
|
|
100
107
|
var list = __spreadArray([], userList, true);
|
|
101
108
|
setUsersMenuList(list);
|
|
102
109
|
var user = list.find(function (user) { return user.id === (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id); }) || list[0];
|
|
103
110
|
setActiveUser(user);
|
|
104
|
-
|
|
105
|
-
resetFormData();
|
|
111
|
+
resetFormData();
|
|
106
112
|
}
|
|
107
113
|
}, [userList]);
|
|
108
114
|
var onOpenUserAction = function (event) {
|
|
@@ -113,15 +119,16 @@ var UserList = function (_a) {
|
|
|
113
119
|
};
|
|
114
120
|
var resetFormData = function () {
|
|
115
121
|
if (showCollectForm) {
|
|
122
|
+
setEmailChecking(false);
|
|
116
123
|
methods.setValue('email', '', { shouldValidate: true });
|
|
117
124
|
methods.setValue('mobile', '', { shouldValidate: true });
|
|
118
125
|
setShowCollectForm(false);
|
|
119
126
|
}
|
|
120
127
|
};
|
|
121
128
|
var onClickUser = function (user, e) {
|
|
129
|
+
setActiveUser(user);
|
|
122
130
|
resetFormData();
|
|
123
131
|
setAnchorEl(null);
|
|
124
|
-
setActiveUser(user);
|
|
125
132
|
onOpenUserAction(e);
|
|
126
133
|
};
|
|
127
134
|
var onAddDetails = function () {
|
|
@@ -132,7 +139,7 @@ var UserList = function (_a) {
|
|
|
132
139
|
}
|
|
133
140
|
};
|
|
134
141
|
var onRequestEmail = function () {
|
|
135
|
-
if (!isPhoneAndEmailAvailable(activeUser) &&
|
|
142
|
+
if (!isPhoneAndEmailAvailable(activeUser) && disabled) {
|
|
136
143
|
setShowCollectForm(true);
|
|
137
144
|
return;
|
|
138
145
|
}
|
|
@@ -151,7 +158,7 @@ var UserList = function (_a) {
|
|
|
151
158
|
};
|
|
152
159
|
var isPhoneAndEmailAvailable = function (user) {
|
|
153
160
|
var _a = (user === null || user === void 0 ? void 0 : user.contact) || { email: '' }, resEmail = _a.email, phone = _a.phone;
|
|
154
|
-
return isValidEmail(resEmail) && (phone === null || phone === void 0 ? void 0 : phone.country_code) && (phone === null || phone === void 0 ? void 0 : phone.number);
|
|
161
|
+
return !!(isValidEmail(resEmail) && (phone === null || phone === void 0 ? void 0 : phone.country_code) && (phone === null || phone === void 0 ? void 0 : phone.number));
|
|
155
162
|
};
|
|
156
163
|
var getUserRole = function (user) {
|
|
157
164
|
var _a, _b, _c, _d, _e;
|
|
@@ -165,11 +172,16 @@ var UserList = function (_a) {
|
|
|
165
172
|
};
|
|
166
173
|
var getCollectForm = function (user) {
|
|
167
174
|
var show = showCollectForm && isActiveUser(user);
|
|
168
|
-
return (_jsx(CollapseStyled, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 1.5, mt: 0 } }, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsx(Form, { children: _jsx(CollectPhoneEmail, { activeUser: activeUser }) }) })) })) })));
|
|
175
|
+
return (_jsx(CollapseStyled, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 1.5, mt: 0 } }, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsx(Form, { children: _jsx(CollectPhoneEmail, { activeUser: activeUser, emailChecking: emailChecking, setEmailChecking: setEmailChecking }) }) })) })) })));
|
|
169
176
|
};
|
|
170
|
-
|
|
177
|
+
React.useEffect(function () {
|
|
178
|
+
if (is_available === false)
|
|
179
|
+
methods.setError('email', { message: 'tap_js_email_already_exist' });
|
|
180
|
+
}, [responseBody]);
|
|
171
181
|
return (_jsx(ScreenContainerStyled, { children: usersMenuList.map(function (user, index) {
|
|
172
|
-
return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({
|
|
182
|
+
return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ sx: {
|
|
183
|
+
cursor: emailChecking ? 'default' : 'pointer'
|
|
184
|
+
}, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsxs(TextStyled, { children: [getName(user) || '', _jsx(RoleTextStyled, { children: getUserRole(user) || '' })] }), (user === null || user === void 0 ? void 0 : user.isRequestedEmail) ? _jsx(CheckIcon, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl && isActiveUser(user) })] })), _jsx(Collapse, __assign({ in: !!anchorEl && isActiveUser(user), timeout: 300 }, { children: _jsx(ListButton, { isAr: isAr, addDetails: {
|
|
173
185
|
title: t('add_details'),
|
|
174
186
|
onClick: onAddDetails,
|
|
175
187
|
loading: isActiveUser(user) && loading && type === IndividualRequestType.ADD
|
|
@@ -177,7 +189,7 @@ var UserList = function (_a) {
|
|
|
177
189
|
children: getCollectForm(user),
|
|
178
190
|
title: t('request_details_by_email'),
|
|
179
191
|
isRequested: (user === null || user === void 0 ? void 0 : user.isRequestedEmail) || false,
|
|
180
|
-
disabled: disabled,
|
|
192
|
+
disabled: showCollectForm ? disabled : false,
|
|
181
193
|
onClick: onRequestEmail,
|
|
182
194
|
loading: isActiveUser(user) && loading && type === IndividualRequestType.REQUEST_EMAIL
|
|
183
195
|
} }) }))] }), index));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
+
import { isValidEmail } from '../../../../utils';
|
|
2
3
|
export var IndividualCollectInfoValidationSchema = function (activeUser) {
|
|
3
4
|
var _a = (activeUser === null || activeUser === void 0 ? void 0 : activeUser.contact) || {}, phone = _a.phone, email = _a.email;
|
|
4
5
|
var isPhoneAvailable = (phone === null || phone === void 0 ? void 0 : phone.number) && (phone === null || phone === void 0 ? void 0 : phone.country_code);
|
|
5
|
-
var isEmailAvailable =
|
|
6
|
+
var isEmailAvailable = isValidEmail(email || '');
|
|
6
7
|
return yup.object().shape({
|
|
7
8
|
mobile: isPhoneAvailable
|
|
8
9
|
? yup.string().optional()
|