@tap-payments/auth-jsconnect 2.4.23-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.
@@ -71,7 +71,7 @@ import API from '../../../api';
71
71
  import { FlowsTypes, IndividualGender, IndividualType, DocumentPurpose } from '../../../@types';
72
72
  import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
73
73
  import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
74
- import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList } from '../../../utils';
74
+ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, getIndividualType } from '../../../utils';
75
75
  export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
76
76
  var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
77
77
  return __awaiter(void 0, void 0, void 0, function () {
@@ -534,10 +534,10 @@ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', func
534
534
  export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (_a, thunkApi) {
535
535
  var formData = _a.formData, originalFormData = _a.originalFormData;
536
536
  return __awaiter(void 0, void 0, void 0, function () {
537
- var _b, settings, individual, _c, notification, user, entity, id, _d, objects, ids, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, data;
538
- var _e, _f, _g, _h, _j;
539
- return __generator(this, function (_k) {
540
- switch (_k.label) {
537
+ var _b, settings, individual, _c, notification, user, entity, id, _d, objects, ids, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, data, _e, isUser, isBuyer, isUserORBuyerType;
538
+ var _f, _g, _h, _j, _k;
539
+ return __generator(this, function (_l) {
540
+ switch (_l.label) {
541
541
  case 0:
542
542
  _b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
543
543
  _c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user, entity = _c.entity;
@@ -552,8 +552,8 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
552
552
  isNameENNonEditable = hasNoneEditableValue(data_status, 'name.en');
553
553
  isNameARNonEditable = hasNoneEditableValue(data_status, 'name.ar');
554
554
  isEmailNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.contact, 'email');
555
- isMobileNumberNonEditable = hasNoneEditableValue((_e = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _e === void 0 ? void 0 : _e.phone, 'number');
556
- isMobileCountryNonEditable = hasNoneEditableValue((_f = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _f === void 0 ? void 0 : _f.phone, 'country_code');
555
+ isMobileNumberNonEditable = hasNoneEditableValue((_f = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _f === void 0 ? void 0 : _f.phone, 'number');
556
+ isMobileCountryNonEditable = hasNoneEditableValue((_g = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _g === void 0 ? void 0 : _g.phone, 'country_code');
557
557
  isNidNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'id');
558
558
  isIssuedCountryNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'issuer_country');
559
559
  isExpiryNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'expiry');
@@ -570,7 +570,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
570
570
  contact = hasContact && !(isEmailNonEditable && isMobileCountryNonEditable && isMobileNumberNonEditable)
571
571
  ? __assign({ email: isEmailNonEditable ? undefined : email }, (!((isMobileCountryNonEditable && isMobileNumberNonEditable) || !hasPhone) && {
572
572
  phone: {
573
- country_code: isMobileCountryNonEditable ? undefined : (_g = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _g === void 0 ? void 0 : _g.toString(),
573
+ country_code: isMobileCountryNonEditable ? undefined : (_h = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _h === void 0 ? void 0 : _h.toString(),
574
574
  number: isMobileNumberNonEditable || !mobile ? undefined : mobile
575
575
  }
576
576
  })) : undefined;
@@ -612,15 +612,17 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
612
612
  ], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO });
613
613
  return [4, API.individualService.updateMultipleIndividual(requestBody)];
614
614
  case 1:
615
- data = _k.sent();
616
- if (!(objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BUYER))) return [3, 3];
615
+ data = _l.sent();
616
+ _e = getIndividualType(objects), isUser = _e.isUser, isBuyer = _e.isBuyer;
617
+ isUserORBuyerType = isUser || isBuyer;
618
+ if (!isUserORBuyerType) return [3, 3];
617
619
  return [4, thunkApi.dispatch(retrieveDataList(code))];
618
620
  case 2:
619
- _k.sent();
620
- _k.label = 3;
621
+ _l.sent();
622
+ _l.label = 3;
621
623
  case 3:
622
624
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
623
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
625
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
624
626
  return [2, { data: data, formData: originalFormData }];
625
627
  }
626
628
  });
@@ -629,10 +631,10 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
629
631
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
630
632
  var formData = _a.formData, originalFormData = _a.originalFormData;
631
633
  return __awaiter(void 0, void 0, void 0, function () {
632
- var _b, settings, individual, _c, notification, user, id, _d, objects, ids, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, payload, requestBody, data, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody;
633
- var _e, _f;
634
- return __generator(this, function (_g) {
635
- switch (_g.label) {
634
+ var _b, settings, individual, _c, notification, user, id, _d, objects, ids, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, requestBody, data, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody;
635
+ var _f, _g;
636
+ return __generator(this, function (_h) {
637
+ switch (_h.label) {
636
638
  case 0:
637
639
  _b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
638
640
  _c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user;
@@ -674,18 +676,20 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
674
676
  source_income: sourceIncomeInfo,
675
677
  monthly_income: monthlyIncomeInfo
676
678
  };
679
+ _e = getIndividualType(objects), isUser = _e.isUser, isShareholder = _e.isShareholder, isBoardMember = _e.isBoardMember, isBuyer = _e.isBuyer, isCustomer = _e.isCustomer;
680
+ isUserORBuyerType = isUser || isBuyer;
677
681
  payload = userPayload;
678
682
  if (objects === null || objects === void 0 ? void 0 : objects.length) {
679
- payload = __assign(__assign(__assign(__assign(__assign({}, (objects.includes(IndividualType.USER) && payload)), (objects.includes(IndividualType.SHARE_HOLDER) && shareHolderPayload)), (objects.includes(IndividualType.BOARD_MEMBER) && boardMemberPayload)), (objects.includes(IndividualType.BUYER) && buyerMemberPayload)), (objects.includes(IndividualType.CUSTOMER) && {}));
683
+ payload = __assign(__assign(__assign(__assign(__assign({}, (isUser && payload)), (isShareholder && shareHolderPayload)), (isBoardMember && boardMemberPayload)), (isBuyer && buyerMemberPayload)), (isCustomer && {}));
680
684
  }
681
685
  requestBody = __assign(__assign({ ids: (ids === null || ids === void 0 ? void 0 : ids.length) ? ids : [id] }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
682
686
  return [4, API.individualService.updateMultipleIndividual(requestBody)];
683
687
  case 1:
684
- data = _g.sent();
688
+ data = _h.sent();
685
689
  businessCountry = settings.data.businessCountry;
686
690
  hasCivilIdDocument = (civilID || []).length > 0;
687
691
  hasSignatureDocument = (signatureFileId || []).length > 0;
688
- isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && (objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BUYER));
692
+ isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && isUserORBuyerType;
689
693
  civilIdDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT);
690
694
  signatureDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE);
691
695
  if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 3];
@@ -695,8 +699,8 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
695
699
  };
696
700
  return [4, API.documentService.addFilesToExistingDocument(documentBody)];
697
701
  case 2:
698
- _g.sent();
699
- _g.label = 3;
702
+ _h.sent();
703
+ _h.label = 3;
700
704
  case 3:
701
705
  if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 5];
702
706
  documentBody = {
@@ -705,8 +709,8 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
705
709
  };
706
710
  return [4, API.documentService.addFilesToExistingDocument(documentBody)];
707
711
  case 4:
708
- _g.sent();
709
- _g.label = 5;
712
+ _h.sent();
713
+ _h.label = 5;
710
714
  case 5:
711
715
  documentsList = [];
712
716
  if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
@@ -721,11 +725,11 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
721
725
  };
722
726
  return [4, API.documentService.updateDocumentInfo(documentBody)];
723
727
  case 6:
724
- _g.sent();
725
- _g.label = 7;
728
+ _h.sent();
729
+ _h.label = 7;
726
730
  case 7:
727
731
  thunkApi.dispatch(handleNextScreenStep());
728
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
732
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
729
733
  return [2, { data: data, formData: originalFormData }];
730
734
  }
731
735
  });
@@ -19,7 +19,7 @@ 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
21
  import { DocumentPurpose, IndividualType } from '../../../../@types';
22
- import { isSA } from '../../../../utils';
22
+ import { getIndividualType, isSA } from '../../../../utils';
23
23
  import Form from '../../../../components/Form';
24
24
  import Collapse from '../../../../components/Collapse';
25
25
  import Text from '../../../../components/Text';
@@ -131,12 +131,15 @@ var AdditionalIndividualInfo = function (_a) {
131
131
  return t('type_board_member');
132
132
  return t('type_user');
133
133
  };
134
- var showSignatureFile = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BUYER);
135
- var showOccupationFile = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BUYER);
136
- var showSourceOfIncome = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BUYER);
137
- var showIsPEP = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BOARD_MEMBER);
138
- var showIsInfluencer = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BOARD_MEMBER);
139
- var showShares = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.SHARE_HOLDER);
134
+ var _g = React.useMemo(function () { return getIndividualType(objects); }, [objects]), isUser = _g.isUser, isShareholder = _g.isShareholder, isBoardMember = _g.isBoardMember, isBuyer = _g.isBuyer;
135
+ var isUserORBuyerType = isUser || isBuyer;
136
+ var isUserORBoardMemberType = isUser || isBoardMember;
137
+ var showSignatureFile = isUserORBuyerType;
138
+ var showOccupationFile = isUserORBuyerType;
139
+ var showSourceOfIncome = isUserORBuyerType;
140
+ var showIsPEP = isUserORBoardMemberType;
141
+ var showIsInfluencer = isUserORBoardMemberType;
142
+ var showShares = isShareholder;
140
143
  var isSourceOfIncomeListActive = listActive === ListType.SourceOfIncomeList;
141
144
  var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
142
145
  var isOccupationListActive = listActive === ListType.OccupationList;
@@ -1,7 +1,7 @@
1
1
  import * as yup from 'yup';
2
- import { IndividualType } from '../../../../@types';
2
+ import { getIndividualType } from '../../../../utils';
3
3
  export var IndividualInfoValidationSchema = function (objects) {
4
- var isUserType = !!(objects === null || objects === void 0 ? void 0 : objects.find(function (type) { return type === IndividualType.USER; }));
4
+ var isUserType = getIndividualType(objects).isUser;
5
5
  return yup.object().shape({
6
6
  occupation: isUserType ? yup.object().required('alert_choose_occupation') : yup.object().optional(),
7
7
  sourceIncome: isUserType ? yup.object().required('choose_any_source_of_income') : yup.object().optional(),
@@ -223,6 +223,6 @@ export default function FlowsButtons(_a) {
223
223
  onResetPassword();
224
224
  else
225
225
  onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted, name: name, status: status, token: token });
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 === 'complete' }), _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));
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));
227
227
  }) }));
228
228
  }
@@ -152,5 +152,5 @@ export default function IndividualActionButtons(_a) {
152
152
  var theme = useTheme();
153
153
  var isRequestedAndNotLoading = requestEmail.isRequested && !requestEmail.loading;
154
154
  var requestEmailLoaderColor = isRequestedAndNotLoading ? theme.palette.success.main : theme.palette.primary.main;
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 === 'complete' }), _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) }) }))] }))] }))] }));
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) }) }))] }))] }))] }));
156
156
  }
@@ -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 === 'complete' || status === 'completed' ? 'completed' : 'pending';
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 === 'complete' && flow.name !== 'password'; });
113
+ var isFlowsCompleted = data.every(function (flow) { return flow.status === 'reviewed' && flow.name !== 'password'; });
114
114
  return isFlowsCompleted;
115
115
  };
116
116
  useEffect(function () {
@@ -68,3 +68,10 @@ export declare const findInArrayOrSubArray: (items: Array<any>, value: string |
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
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
+ };
@@ -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 = '__'; }
@@ -276,3 +277,19 @@ export var mapUserList = function (individuals) {
276
277
  }, {});
277
278
  });
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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.4.23-test",
3
+ "version": "2.4.25-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",