@tap-payments/auth-jsconnect 2.4.21-test → 2.4.25-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/@types/form.d.ts +0 -1
- package/build/@types/user.d.ts +21 -2
- package/build/api/index.d.ts +4 -3
- package/build/api/individual.d.ts +9 -3
- package/build/api/individual.js +9 -1
- package/build/constants/assets.d.ts +2 -0
- package/build/constants/assets.js +2 -0
- package/build/features/app/individual/individualStore.d.ts +7 -4
- package/build/features/app/individual/individualStore.js +147 -99
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +20 -16
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +7 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +7 -6
- package/build/features/individual/screens/IndividualList/UserList.js +10 -6
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +6 -26
- package/build/features/shared/Button/FlowsButtons.js +2 -14
- package/build/features/shared/Button/IndividualActionButtons.d.ts +3 -1
- package/build/features/shared/Button/IndividualActionButtons.js +26 -2
- package/build/features/shared/Dot/Dot.d.ts +8 -0
- package/build/features/shared/Dot/Dot.js +29 -0
- package/build/features/shared/Dot/index.d.ts +2 -0
- package/build/features/shared/Dot/index.js +2 -0
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
- package/build/utils/array.d.ts +8 -0
- package/build/utils/array.js +33 -0
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { IndividualType } from '../../../../@types';
|
|
3
|
-
export declare const IndividualInfoValidationSchema: (
|
|
3
|
+
export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
4
4
|
occupation: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
5
5
|
sourceIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
6
6
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
7
7
|
civilID: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
8
8
|
signatureFileId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
9
|
-
isPEP: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
10
|
-
isInfluencer: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
9
|
+
isPEP: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
10
|
+
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
11
11
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
12
12
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
13
13
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -16,8 +16,8 @@ export declare const IndividualInfoValidationSchema: (type: IndividualType) => y
|
|
|
16
16
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
17
17
|
civilID: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
18
18
|
signatureFileId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
19
|
-
isPEP: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
20
|
-
isInfluencer: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
19
|
+
isPEP: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
20
|
+
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
21
21
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
22
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
23
23
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -26,8 +26,8 @@ export declare const IndividualInfoValidationSchema: (type: IndividualType) => y
|
|
|
26
26
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
27
27
|
civilID: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
28
28
|
signatureFileId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
29
|
-
isPEP: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
30
|
-
isInfluencer: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
29
|
+
isPEP: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
30
|
+
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
31
31
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
32
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
33
33
|
}>>>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import {
|
|
3
|
-
export var IndividualInfoValidationSchema = function (
|
|
2
|
+
import { getIndividualType } from '../../../../utils';
|
|
3
|
+
export var IndividualInfoValidationSchema = function (objects) {
|
|
4
|
+
var isUserType = getIndividualType(objects).isUser;
|
|
4
5
|
return yup.object().shape({
|
|
5
|
-
occupation:
|
|
6
|
-
sourceIncome:
|
|
6
|
+
occupation: isUserType ? yup.object().required('alert_choose_occupation') : yup.object().optional(),
|
|
7
|
+
sourceIncome: isUserType ? yup.object().required('choose_any_source_of_income') : yup.object().optional(),
|
|
7
8
|
monthlyIncome: yup.object().optional(),
|
|
8
9
|
civilID: yup.array().optional(),
|
|
9
10
|
signatureFileId: yup.array().optional(),
|
|
10
|
-
isPEP:
|
|
11
|
-
isInfluencer:
|
|
11
|
+
isPEP: isUserType ? yup.boolean().required('please_choose_relative_pep') : yup.boolean().optional().nullable(),
|
|
12
|
+
isInfluencer: isUserType ? yup.boolean().required('please_choose_are_you_influncer') : yup.boolean().optional().nullable(),
|
|
12
13
|
shareCount: yup.string().optional(),
|
|
13
14
|
shareValue: yup.string().optional()
|
|
14
15
|
});
|
|
@@ -157,20 +157,23 @@ var UserList = function (_a) {
|
|
|
157
157
|
return (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id;
|
|
158
158
|
};
|
|
159
159
|
var isSameUserRequestedBefore = function (user) {
|
|
160
|
-
var _a;
|
|
161
|
-
return (user === null || user === void 0 ? void 0 : user.
|
|
160
|
+
var _a, _b;
|
|
161
|
+
return (_a = user === null || user === void 0 ? void 0 : user.ids) === null || _a === void 0 ? void 0 : _a.includes((_b = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _b === void 0 ? void 0 : _b.id);
|
|
162
|
+
};
|
|
163
|
+
var getUserStatus = function (user) {
|
|
164
|
+
return user === null || user === void 0 ? void 0 : user.individual_data_state;
|
|
162
165
|
};
|
|
163
166
|
var isPhoneAndEmailAvailable = function (user) {
|
|
164
167
|
var _a = (user === null || user === void 0 ? void 0 : user.contact) || { email: '' }, resEmail = _a.email, phone = _a.phone;
|
|
165
168
|
return !!(isValidEmail(resEmail) && (phone === null || phone === void 0 ? void 0 : phone.country_code) && (phone === null || phone === void 0 ? void 0 : phone.number));
|
|
166
169
|
};
|
|
167
170
|
var getUserRole = function (user) {
|
|
168
|
-
var _a, _b, _c, _d, _e;
|
|
171
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
169
172
|
if ((((_a = user === null || user === void 0 ? void 0 : user.role) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0)
|
|
170
173
|
return isAr ? (_c = (_b = user.role[0]) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.ar : (_e = (_d = user.role[0]) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.en;
|
|
171
|
-
if ((user === null || user === void 0 ? void 0 : user.
|
|
174
|
+
if ((_f = user === null || user === void 0 ? void 0 : user.objects) === null || _f === void 0 ? void 0 : _f.includes(IndividualType.SHARE_HOLDER))
|
|
172
175
|
return t('type_share_holder');
|
|
173
|
-
if ((user === null || user === void 0 ? void 0 : user.
|
|
176
|
+
if ((_g = user === null || user === void 0 ? void 0 : user.objects) === null || _g === void 0 ? void 0 : _g.includes(IndividualType.BOARD_MEMBER))
|
|
174
177
|
return t('type_board_member');
|
|
175
178
|
return t('type_user');
|
|
176
179
|
};
|
|
@@ -185,7 +188,8 @@ var UserList = function (_a) {
|
|
|
185
188
|
return (_jsx(ScreenContainerStyled, { children: usersMenuList.map(function (user, index) {
|
|
186
189
|
return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ sx: {
|
|
187
190
|
cursor: emailChecking ? 'default' : 'pointer'
|
|
188
|
-
}, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [
|
|
191
|
+
}, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsx(TextStyled, { children: _jsx("span", { children: getName(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(IndividualActionButtons, { isAr: isAr, addDetails: {
|
|
192
|
+
status: getUserStatus(user),
|
|
189
193
|
title: t('add_details'),
|
|
190
194
|
onClick: onAddDetails,
|
|
191
195
|
loading: isActiveUser(user) && loading && type === IndividualRequestType.ADD
|
|
@@ -18,7 +18,6 @@ import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } fro
|
|
|
18
18
|
import Box from '@mui/material/Box';
|
|
19
19
|
import { alpha, styled } from '@mui/material/styles';
|
|
20
20
|
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
21
|
-
import { IndividualType } from '../../../../@types';
|
|
22
21
|
import { convertToEnglishDateFormat, getUserName } from '../../../../utils';
|
|
23
22
|
import Form from '../../../../components/Form';
|
|
24
23
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -38,10 +37,6 @@ import ExpiryDate from './ExpiryDate';
|
|
|
38
37
|
import BirthCountry from './BirthCountry';
|
|
39
38
|
import Nationality from './Nationality';
|
|
40
39
|
import BirthCity from './BirthCity';
|
|
41
|
-
var TextBoxStyled = styled(Box)(function (_a) {
|
|
42
|
-
var theme = _a.theme;
|
|
43
|
-
return (__assign(__assign({ display: 'flex', justifyContent: 'center', flexDirection: 'row', padding: theme.spacing(1.8, 2.5, 1.8, 2.5) }, theme.typography.body1), { lineHeight: theme.spacing(2.5), color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium }));
|
|
44
|
-
});
|
|
45
40
|
export var RoleTextStyled = styled(Text)(function (_a) {
|
|
46
41
|
var theme = _a.theme;
|
|
47
42
|
return (__assign(__assign({}, theme.typography.body1), { display: 'inline', paddingInlineStart: theme.spacing(1.5), color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }));
|
|
@@ -65,7 +60,7 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
65
60
|
var verify = data.verify, individualPersonalData = data.individualPersonalData;
|
|
66
61
|
var _m = verify.responseBody || {}, user = _m.user, flows = _m.flows;
|
|
67
62
|
var name = individualPersonalData.name, email = individualPersonalData.email, mobile = individualPersonalData.mobile, countryCode = individualPersonalData.countryCode, gender = individualPersonalData.gender, nid = individualPersonalData.nid, issuedCountry = individualPersonalData.issuedCountry, expiryDate = individualPersonalData.expiryDate, dob = individualPersonalData.dob, placeOfBirthCountry = individualPersonalData.placeOfBirthCountry, placeOfBirthCity = individualPersonalData.placeOfBirthCity, nationality = individualPersonalData.nationality;
|
|
68
|
-
var _o = user || {}, data_status = _o.data_status, is_authorized = _o.is_authorized, data_verification = _o.data_verification,
|
|
63
|
+
var _o = user || {}, data_status = _o.data_status, is_authorized = _o.is_authorized, data_verification = _o.data_verification, contact = _o.contact, genderRes = _o.gender, identification = _o.identification, birth = _o.birth, nationalityRes = _o.nationality;
|
|
69
64
|
var methods = useForm({
|
|
70
65
|
resolver: yupResolver(IndividualInfoValidationSchema),
|
|
71
66
|
defaultValues: {
|
|
@@ -169,21 +164,6 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
169
164
|
var handleExpiryDateActive = function (flag) {
|
|
170
165
|
setExpiryDateActive(flag);
|
|
171
166
|
};
|
|
172
|
-
var getName = function () {
|
|
173
|
-
var _a, _b;
|
|
174
|
-
var name = isAr ? (_a = names === null || names === void 0 ? void 0 : names.ar) === null || _a === void 0 ? void 0 : _a.first : (_b = names === null || names === void 0 ? void 0 : names.en) === null || _b === void 0 ? void 0 : _b.first;
|
|
175
|
-
return name;
|
|
176
|
-
};
|
|
177
|
-
var getUserOccupation = function () {
|
|
178
|
-
var _a, _b, _c, _d;
|
|
179
|
-
if (((role === null || role === void 0 ? void 0 : role.length) || 0) > 0)
|
|
180
|
-
return isAr ? (_b = (_a = user.role[0]) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.ar : (_d = (_c = user.role[0]) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.en;
|
|
181
|
-
if (type === IndividualType.SHARE_HOLDER)
|
|
182
|
-
return t('type_share_holder');
|
|
183
|
-
if (type === IndividualType.BOARD_MEMBER)
|
|
184
|
-
return t('type_board_member');
|
|
185
|
-
return t('type_user');
|
|
186
|
-
};
|
|
187
167
|
var disabled = !methods.formState.isValid || cityLoading;
|
|
188
168
|
var isDateFieldActive = dobActive || expiryDateActive;
|
|
189
169
|
var showField = !listActive && !isDateFieldActive;
|
|
@@ -192,11 +172,11 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
192
172
|
var isBirthCountryListActive = listActive === ListType.BirthCountryList;
|
|
193
173
|
var isBirthCityListActive = listActive === ListType.BirthCityList;
|
|
194
174
|
var isNationalityListActive = listActive === ListType.NationalityList;
|
|
195
|
-
return (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
175
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField, readOnly: readOnly['name'] || (noneEditable['name.en'] && noneEditable['name.ar']), isVerified: isNameVerified }), _jsx(MobileNumber, { readOnly: readOnly['mobile'] || noneEditable['contact.phone.number'] || noneEditable['contact.phone.country_code'], show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive && !isIssuedCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isPhoneNumberVerified }), _jsx(Email, { show: showField, readOnly: readOnly['email'] || noneEditable['contact.email'], isVerified: isEmailVerified }), _jsx(Gender, { show: showField, readOnly: readOnly['gender'] || noneEditable['gender'], isVerified: isGenderVerified }), _jsx(ID, { show: showField, readOnly: readOnly['nid'] || noneEditable['identification.id'], isVerified: isIDVerified }), _jsx(IssuedCountry, { readOnly: readOnly['issuedCountry'] || noneEditable['identification.issuer_country'], show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isIssuedCountryVerified }), _jsx(ExpiryDate, { show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive, readOnly: readOnly['expiryDate'] || noneEditable['identification.expiry'], isVerified: isExpiryDateVerified }), _jsx(DOB, { show: !listActive && !expiryDateActive, onDateClicked: handleDobActive, readOnly: readOnly['dob'] || noneEditable['birth.date'], isVerified: isDOBVerified }), _jsx(BirthCountry, { readOnly: readOnly['placeOfBirthCountry'] || noneEditable['birth.country'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isBirthCountryVerified }), _jsx(BirthCity, { readOnly: readOnly['placeOfBirthCity'] || noneEditable['birth.city'], show: !isMobileCountryListActive &&
|
|
176
|
+
!isDateFieldActive &&
|
|
177
|
+
!isIssuedCountryListActive &&
|
|
178
|
+
!isBirthCountryListActive &&
|
|
179
|
+
!isNationalityListActive, onListOpen: function () { return handleMenuClick(ListType.BirthCityList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isBirthCityVerified }), _jsx(Nationality, { readOnly: readOnly['nationality'] || noneEditable['nationality'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isBirthCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.NationalityList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isNationalityVerified })] }), _jsx(Collapse, __assign({ in: showField, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
200
180
|
};
|
|
201
181
|
IndividualPersonalInfo.defaultProps = {};
|
|
202
182
|
export default React.memo(IndividualPersonalInfo);
|
|
@@ -58,6 +58,7 @@ import { handleOpen, handleCurrentActiveScreen, handleNextScreenStep, settingsSe
|
|
|
58
58
|
import { dangerousMessage, getScreenNameBasedOnFlow } from '../../../utils';
|
|
59
59
|
import API from '../../../api';
|
|
60
60
|
import Text from '../../../components/Text';
|
|
61
|
+
import Dot from '../Dot';
|
|
61
62
|
var Image = styled('img')(function (_a) {
|
|
62
63
|
var theme = _a.theme;
|
|
63
64
|
return ({
|
|
@@ -145,19 +146,6 @@ var BrandNameStyled = styled(Text)(function (_a) {
|
|
|
145
146
|
fontWeight: 800
|
|
146
147
|
});
|
|
147
148
|
});
|
|
148
|
-
var Dot = styled('span', {
|
|
149
|
-
shouldForwardProp: function (prop) { return prop !== 'completed'; }
|
|
150
|
-
})(function (_a) {
|
|
151
|
-
var theme = _a.theme, completed = _a.completed;
|
|
152
|
-
return ({
|
|
153
|
-
height: theme.spacing(1),
|
|
154
|
-
width: theme.spacing(1),
|
|
155
|
-
backgroundColor: completed ? theme.palette.primary.main : theme.palette.text.secondary,
|
|
156
|
-
borderRadius: '50%',
|
|
157
|
-
marginInlineStart: theme.spacing(1),
|
|
158
|
-
marginInlineEnd: theme.spacing(-0.5)
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
149
|
export default function FlowsButtons(_a) {
|
|
162
150
|
var _this = this;
|
|
163
151
|
var buttons = _a.buttons, data = _a.data;
|
|
@@ -235,6 +223,6 @@ export default function FlowsButtons(_a) {
|
|
|
235
223
|
onResetPassword();
|
|
236
224
|
else
|
|
237
225
|
onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted, name: name, status: status, token: token });
|
|
238
|
-
} }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, hasUrl: !!href, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [_jsx(Dot, { completed: status === 'completed' || status === '
|
|
226
|
+
} }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, hasUrl: !!href, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [_jsx(Dot, { completed: status === 'completed' || status === 'reviewed' }), _jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)', marginInlineStart: 0 }, src: ICONS_NAMES.Arrow_filled_right_icon })] }))), startIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isBrand(name) ? (_jsx(_Fragment, { children: _jsx(BrandImage, { children: _jsx(BrandNameStyled, { children: brandName }) }) })) : (_jsx(Image, { src: src, alt: title })), type: 'button' }, { children: title })) }), idx));
|
|
239
227
|
}) }));
|
|
240
228
|
}
|
|
@@ -13,7 +13,9 @@ interface IndividualActionButtonsProps extends ButtonProps {
|
|
|
13
13
|
show: boolean;
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
};
|
|
16
|
-
addDetails: buttonProps
|
|
16
|
+
addDetails: buttonProps & {
|
|
17
|
+
status: string;
|
|
18
|
+
};
|
|
17
19
|
}
|
|
18
20
|
export default function IndividualActionButtons({ isAr, requestEmail, addDetails }: IndividualActionButtonsProps): JSX.Element;
|
|
19
21
|
export {};
|
|
@@ -17,8 +17,9 @@ import { ICONS_NAMES } from '../../../constants';
|
|
|
17
17
|
import Loader from '../../../components/Loader';
|
|
18
18
|
import Button from '../../../components/Button';
|
|
19
19
|
import Icon from '../../../components/Icon';
|
|
20
|
-
import CheckIcon from '../CheckIcon';
|
|
21
20
|
import Collapse from '../../../components/Collapse';
|
|
21
|
+
import CheckIcon from '../CheckIcon';
|
|
22
|
+
import Dot from '../Dot';
|
|
22
23
|
var ArrowIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
|
23
24
|
var theme = _a.theme, isAr = _a.isAr;
|
|
24
25
|
return ({
|
|
@@ -81,6 +82,29 @@ var LoaderStyled = styled(Loader)(function (_a) {
|
|
|
81
82
|
height: theme.spacing(3.75)
|
|
82
83
|
});
|
|
83
84
|
});
|
|
85
|
+
var AddDetailsButtonStyled = styled(ButtonStyled, {
|
|
86
|
+
shouldForwardProp: function (prop) { return prop !== 'isCompleted'; }
|
|
87
|
+
})(function (_a) {
|
|
88
|
+
var theme = _a.theme, isCompleted = _a.isCompleted;
|
|
89
|
+
return (__assign({}, (isCompleted && {
|
|
90
|
+
'&.MuiButton-outlined': {
|
|
91
|
+
backgroundColor: theme.palette.common.white,
|
|
92
|
+
border: "1px solid ".concat(theme.palette.success.main),
|
|
93
|
+
color: theme.palette.success.main,
|
|
94
|
+
'&:hover': {
|
|
95
|
+
cursor: 'pointer',
|
|
96
|
+
backgroundColor: theme.palette.success.main,
|
|
97
|
+
color: theme.palette.common.white,
|
|
98
|
+
img: {
|
|
99
|
+
filter: 'brightness(0) invert(1)'
|
|
100
|
+
},
|
|
101
|
+
svg: {
|
|
102
|
+
filter: 'brightness(0) invert(1)'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
})));
|
|
107
|
+
});
|
|
84
108
|
var RequestEmailButtonStyled = styled(ButtonStyled, {
|
|
85
109
|
shouldForwardProp: function (prop) { return prop !== 'isRequested' && prop !== 'disabled'; }
|
|
86
110
|
})(function (_a) {
|
|
@@ -128,5 +152,5 @@ export default function IndividualActionButtons(_a) {
|
|
|
128
152
|
var theme = useTheme();
|
|
129
153
|
var isRequestedAndNotLoading = requestEmail.isRequested && !requestEmail.loading;
|
|
130
154
|
var requestEmailLoaderColor = isRequestedAndNotLoading ? theme.palette.success.main : theme.palette.primary.main;
|
|
131
|
-
return (_jsxs(ButtonBoxStyled, { children: [_jsxs(
|
|
155
|
+
return (_jsxs(ButtonBoxStyled, { children: [_jsxs(AddDetailsButtonStyled, __assign({ isCompleted: addDetails.status === 'verified', isLoading: addDetails.loading, type: 'button', variant: 'outlined', onClick: addDetails.onClick, startIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(Image, { src: addDetails.status === 'verified' ? ICONS_NAMES.ADD_DETAIL_GREEN : ICONS_NAMES.ADD_DETAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [addDetails.status !== 'verified' && _jsx(Dot, { sx: { margin: 0 }, completed: addDetails.status === 'reviewed' }), _jsx(ArrowIconStyled, { isAr: isAr, src: addDetails.status === 'verified' ? ICONS_NAMES.GREEN_ARROW : ICONS_NAMES.BLUE_ARROW })] })) })) }, { children: [_jsx(Collapse, __assign({ in: addDetails.loading }, { children: _jsx(LoaderStyled, { innerColor: addDetails.status === 'verified' ? theme.palette.success.main : theme.palette.primary.main, outerColor: addDetails.status === 'verified' ? theme.palette.success.main : theme.palette.primary.main, size: 15, toggleAnimation: addDetails.loading }) })), _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(TextStyled, { children: t(addDetails.title) }) }))] })), requestEmail.show && (_jsxs(_Fragment, { children: [requestEmail.children, _jsxs(RequestEmailButtonStyled, __assign({ isRequested: requestEmail.isRequested, isLoading: requestEmail.loading, variant: 'outlined', disabled: requestEmail.disabled, type: 'button', onClick: requestEmail.onClick, startIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(Image, { src: isRequestedAndNotLoading ? ICONS_NAMES.REQUEST_EMAIL_GREEN : ICONS_NAMES.REQUEST_EMAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: isRequestedAndNotLoading ? _jsx(CheckIconStyled, {}) : _jsx(ArrowIconStyled, { isAr: isAr, src: ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: requestEmail.loading }, { children: _jsx(LoaderStyled, { innerColor: requestEmailLoaderColor, outerColor: requestEmailLoaderColor, size: 15, toggleAnimation: requestEmail.loading }) })), _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(TextStyled, { children: t(requestEmail.title) }) }))] }))] }))] }));
|
|
132
156
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { styled } from '@mui/material/styles';
|
|
14
|
+
var DotStyled = styled('span', {
|
|
15
|
+
shouldForwardProp: function (prop) { return prop !== 'completed'; }
|
|
16
|
+
})(function (_a) {
|
|
17
|
+
var theme = _a.theme, completed = _a.completed;
|
|
18
|
+
return ({
|
|
19
|
+
height: theme.spacing(1),
|
|
20
|
+
width: theme.spacing(1),
|
|
21
|
+
backgroundColor: completed ? theme.palette.primary.main : theme.palette.text.secondary,
|
|
22
|
+
borderRadius: '50%',
|
|
23
|
+
marginInlineStart: theme.spacing(1),
|
|
24
|
+
marginInlineEnd: theme.spacing(-0.5)
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
export default function Dot(props) {
|
|
28
|
+
return _jsx(DotStyled, __assign({}, props));
|
|
29
|
+
}
|
|
@@ -81,7 +81,7 @@ var SuccessFlowButtons = function (_a) {
|
|
|
81
81
|
var _b;
|
|
82
82
|
var name = _a.name, url = _a.url, flowStatus = _a.status, token = _a.token;
|
|
83
83
|
var status = name === 'password' ? flowStatus : (_b = flowsDetails.find(function (flow) { return flow.name === name; })) === null || _b === void 0 ? void 0 : _b.status;
|
|
84
|
-
var type = status === '
|
|
84
|
+
var type = status === 'reviewed' || status === 'completed' ? 'completed' : 'pending';
|
|
85
85
|
var title = t("".concat(name, "_flow_").concat(type), {
|
|
86
86
|
individual_name: (is_authorized && count > 1 ? t('company_individuals_details', { count: count }) : username.toLowerCase() + maskedId) || t('individual'),
|
|
87
87
|
brand: brandName,
|
|
@@ -110,7 +110,7 @@ var SuccessFlowButtons = function (_a) {
|
|
|
110
110
|
setButtons(mappedFlows);
|
|
111
111
|
};
|
|
112
112
|
var checkIfFlowsAreCompletedExceptPassword = function (data) {
|
|
113
|
-
var isFlowsCompleted = data.every(function (flow) { return flow.status === '
|
|
113
|
+
var isFlowsCompleted = data.every(function (flow) { return flow.status === 'reviewed' && flow.name !== 'password'; });
|
|
114
114
|
return isFlowsCompleted;
|
|
115
115
|
};
|
|
116
116
|
useEffect(function () {
|
package/build/utils/array.d.ts
CHANGED
|
@@ -67,3 +67,11 @@ export declare const getRecentDocumentBasedOnPurpose: (documents: Array<any>, pu
|
|
|
67
67
|
export declare const findInArrayOrSubArray: (items: Array<any>, value: string | number) => null;
|
|
68
68
|
export declare const groupSectionWithSelectedActivitiesAtBeginning: (sections: Array<ActivitiesIsIc>, selectedActivities: Array<Activity>) => ActivitiesIsIc[];
|
|
69
69
|
export declare const filterActivitiesByName: (activityList: Array<ActivitiesIsIc>, value: string) => ActivityParams[];
|
|
70
|
+
export declare const mapUserList: (individuals: any) => any;
|
|
71
|
+
export declare const getIndividualType: (objects: Array<string>) => {
|
|
72
|
+
isUser: boolean;
|
|
73
|
+
isShareholder: boolean;
|
|
74
|
+
isBoardMember: boolean;
|
|
75
|
+
isBuyer: boolean;
|
|
76
|
+
isCustomer: boolean;
|
|
77
|
+
};
|
package/build/utils/array.js
CHANGED
|
@@ -19,6 +19,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
19
19
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
20
|
};
|
|
21
21
|
import get from 'lodash-es/get';
|
|
22
|
+
import { IndividualType } from '../@types';
|
|
22
23
|
export var isArray = function (value) { return Array.isArray(value); };
|
|
23
24
|
export var joinArray = function (items, joiner) {
|
|
24
25
|
if (joiner === void 0) { joiner = '__'; }
|
|
@@ -260,3 +261,35 @@ export var filterActivitiesByName = function (activityList, value) {
|
|
|
260
261
|
return ((_b = (_a = a === null || a === void 0 ? void 0 : a.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(value.toLowerCase())) || ((_d = (_c = a === null || a === void 0 ? void 0 : a.name) === null || _c === void 0 ? void 0 : _c.ar) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes(value.toLowerCase()));
|
|
261
262
|
});
|
|
262
263
|
};
|
|
264
|
+
export var mapUserList = function (individuals) {
|
|
265
|
+
return (individuals || []).map(function (_a) {
|
|
266
|
+
var list = _a.list, data_state = _a.data_state;
|
|
267
|
+
return list.reduce(function (acc, obj) {
|
|
268
|
+
var objects = acc.object ? [acc.object] : [];
|
|
269
|
+
var ids = acc.id ? [acc.id] : [];
|
|
270
|
+
if (obj.object) {
|
|
271
|
+
objects.push(obj.object);
|
|
272
|
+
}
|
|
273
|
+
if (obj.id) {
|
|
274
|
+
ids.push(obj.id);
|
|
275
|
+
}
|
|
276
|
+
return __assign(__assign(__assign({}, acc), obj), { individual_data_state: data_state, objects: objects, ids: ids });
|
|
277
|
+
}, {});
|
|
278
|
+
});
|
|
279
|
+
};
|
|
280
|
+
export var getIndividualType = function (objects) {
|
|
281
|
+
var isUser = false, isShareholder = false, isBoardMember = false, isBuyer = false, isCustomer = false;
|
|
282
|
+
objects === null || objects === void 0 ? void 0 : objects.forEach(function (type) {
|
|
283
|
+
if (type === IndividualType.USER)
|
|
284
|
+
isUser = true;
|
|
285
|
+
else if (type === IndividualType.SHARE_HOLDER)
|
|
286
|
+
isShareholder = true;
|
|
287
|
+
else if (type === IndividualType.BOARD_MEMBER)
|
|
288
|
+
isBoardMember = true;
|
|
289
|
+
else if (type === IndividualType.BUYER)
|
|
290
|
+
isBuyer = true;
|
|
291
|
+
else if (type === IndividualType.CUSTOMER)
|
|
292
|
+
isCustomer = true;
|
|
293
|
+
});
|
|
294
|
+
return { isUser: isUser, isShareholder: isShareholder, isBoardMember: isBoardMember, isBuyer: isBuyer, isCustomer: isCustomer };
|
|
295
|
+
};
|