@tap-payments/auth-jsconnect 2.6.92-test → 2.6.94-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 +1 -0
- package/build/constants/app.js +7 -1
- package/build/features/app/connectExpress/connectExpressStore.js +2 -4
- package/build/features/app/individual/individualStore.d.ts +2 -0
- package/build/features/app/individual/individualStore.js +47 -28
- package/build/features/connectExpress/screens/AccountCreatedLoader/AccountCreatedLoader.d.ts +5 -0
- package/build/features/connectExpress/screens/AccountCreatedLoader/AccountCreatedLoader.js +36 -0
- package/build/features/connectExpress/screens/AccountCreatedLoader/index.d.ts +2 -0
- package/build/features/connectExpress/screens/AccountCreatedLoader/index.js +2 -0
- package/build/features/featuresScreens.js +5 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +14 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.d.ts +36 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.js +76 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +4 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +3 -2
- package/build/features/shared/DataLoading/DataLoading.d.ts +3 -1
- package/build/features/shared/DataLoading/DataLoading.js +2 -2
- package/package.json +1 -1
package/build/@types/form.d.ts
CHANGED
|
@@ -109,6 +109,7 @@ export interface IndividualExtraFormValues extends IndividualAttachmentsFormValu
|
|
|
109
109
|
isInfluencer: boolean | null;
|
|
110
110
|
shareCount: string;
|
|
111
111
|
shareValue: string;
|
|
112
|
+
isAuthorized: boolean;
|
|
112
113
|
}
|
|
113
114
|
export type IndividualAttachmentsFormValues = {
|
|
114
115
|
civilID?: Array<string>;
|
package/build/constants/app.js
CHANGED
|
@@ -136,7 +136,7 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
name: 'CONNECT_EXPRESS_AUTHENTICATION_LIST_STEP',
|
|
139
|
-
next: 'CONNECT_EXPRESS_AUTH_MERCHANT_LIST_STEP',
|
|
139
|
+
next: ['CONNECT_EXPRESS_AUTH_MERCHANT_LIST_STEP', 'CONNECT_EXPRESS_AUTH_ACCOUNT_CREATED_STEP'],
|
|
140
140
|
prev: ['CONNECT_EXPRESS_MOBILE_STEP', 'CONNECT_EXPRESS_NID_STEP', 'CONNECT_EXPRESS_CIVIL_ID_STEP'],
|
|
141
141
|
order: 3
|
|
142
142
|
},
|
|
@@ -152,6 +152,12 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
152
152
|
prev: 'CONNECT_EXPRESS_MOBILE_STEP',
|
|
153
153
|
order: 3
|
|
154
154
|
},
|
|
155
|
+
{
|
|
156
|
+
name: 'CONNECT_EXPRESS_AUTH_ACCOUNT_CREATED_STEP',
|
|
157
|
+
next: '',
|
|
158
|
+
prev: 'CONNECT_EXPRESS_AUTHENTICATION_LIST_STEP',
|
|
159
|
+
order: 4
|
|
160
|
+
},
|
|
155
161
|
{
|
|
156
162
|
name: 'CONNECT_EXPRESS_AUTH_MERCHANT_LIST_STEP',
|
|
157
163
|
next: 'CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP',
|
|
@@ -232,12 +232,10 @@ export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantLi
|
|
|
232
232
|
merchants = (_b.sent()).merchants;
|
|
233
233
|
list = merchants || [];
|
|
234
234
|
if ((list === null || list === void 0 ? void 0 : list.length) > 1) {
|
|
235
|
-
thunkApi.dispatch(handleNextScreenStep());
|
|
235
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_AUTH_MERCHANT_LIST_STEP'));
|
|
236
236
|
return [2, { list: list, brandInfo: brandInfo, entityInfo: entityInfo }];
|
|
237
237
|
}
|
|
238
|
-
return
|
|
239
|
-
case 2:
|
|
240
|
-
_b.sent();
|
|
238
|
+
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_AUTH_ACCOUNT_CREATED_STEP')); });
|
|
241
239
|
return [2, { list: list, brandInfo: brandInfo, entityInfo: entityInfo }];
|
|
242
240
|
}
|
|
243
241
|
});
|
|
@@ -232,6 +232,8 @@ export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk
|
|
|
232
232
|
data: any;
|
|
233
233
|
formData: IndividualExtraFormValues;
|
|
234
234
|
individualData: User;
|
|
235
|
+
userList: any;
|
|
236
|
+
isKWOrSACountry: boolean;
|
|
235
237
|
}, AsyncThunkParams<IndividualExtraFormValues>, {
|
|
236
238
|
state?: unknown;
|
|
237
239
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -71,7 +71,7 @@ import API from '../../../api';
|
|
|
71
71
|
import { FlowsTypes, IndividualGender, DocumentPurpose } from '../../../@types';
|
|
72
72
|
import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
|
|
73
73
|
import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES, MONTHLY_INCOME_LIST } from '../../../constants';
|
|
74
|
-
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType, isOtherThanKWOrSA } from '../../../utils';
|
|
74
|
+
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType, isOtherThanKWOrSA, isKWOrSA } 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 () {
|
|
@@ -659,27 +659,30 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
659
659
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
|
|
660
660
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
661
661
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
662
|
-
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,
|
|
662
|
+
var _b, settings, individual, _c, notification, user, userList, business, id, _d, objects, ids, isKWOrSAValue, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isAuthorized, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isAuthorizedNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, isAuthorizedInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, requestBody, data, individualData, userListRes;
|
|
663
663
|
var _f, _g;
|
|
664
664
|
return __generator(this, function (_h) {
|
|
665
665
|
switch (_h.label) {
|
|
666
666
|
case 0:
|
|
667
667
|
_b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
|
|
668
|
-
_c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user;
|
|
668
|
+
_c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user, userList = _c.userList, business = _c.business;
|
|
669
669
|
id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}).id;
|
|
670
670
|
_d = user || {}, objects = _d.objects, ids = _d.ids;
|
|
671
|
-
|
|
671
|
+
isKWOrSAValue = isKWOrSA(settings.data.businessCountry.iso2);
|
|
672
|
+
occupation = formData.occupation, sourceIncome = formData.sourceIncome, monthlyIncome = formData.monthlyIncome, isPEP = formData.isPEP, isInfluencer = formData.isInfluencer, shareCount = formData.shareCount, shareValue = formData.shareValue, civilID = formData.civilID, signatureFileId = formData.signatureFileId, isAuthorized = formData.isAuthorized;
|
|
672
673
|
isOccupationNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'occupation');
|
|
673
674
|
isSourceIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'source_of_income');
|
|
674
675
|
isPEPNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_relative_PEP');
|
|
675
676
|
isInfluencerNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_influencer');
|
|
676
677
|
isMonthlyIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'monthly_income');
|
|
678
|
+
isAuthorizedNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_authorized');
|
|
677
679
|
isSharesAvailable = shareCount || shareValue;
|
|
678
680
|
pepInfo = isPEPNonEditable || isPEP === null ? undefined : isPEP;
|
|
679
681
|
influencerInfo = isInfluencerNonEditable || isInfluencer === null ? undefined : isInfluencer;
|
|
680
682
|
occupationInfo = isOccupationNonEditable || !(occupation === null || occupation === void 0 ? void 0 : occupation.id) ? undefined : { chapter: { id: occupation.id } };
|
|
681
683
|
sourceIncomeInfo = isSourceIncomeNonEditable || !(sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.id) ? undefined : [{ id: sourceIncome.id }];
|
|
682
684
|
monthlyIncomeInfo = isMonthlyIncomeNonEditable || !(monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.id) ? undefined : { id: monthlyIncome.id };
|
|
685
|
+
isAuthorizedInfo = isAuthorizedNonEditable || isKWOrSAValue ? undefined : { is_authorized: isAuthorized };
|
|
683
686
|
userPayload = {
|
|
684
687
|
occupation: occupationInfo,
|
|
685
688
|
source_income: sourceIncomeInfo,
|
|
@@ -708,58 +711,65 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
708
711
|
isUserORBuyerType = isUser || isBuyer;
|
|
709
712
|
payload = userPayload;
|
|
710
713
|
if (objects === null || objects === void 0 ? void 0 : objects.length) {
|
|
711
|
-
payload = __assign(__assign(__assign(__assign(__assign({}, (isUser && payload)), (isShareholder && shareHolderPayload)), (isBoardMember && boardMemberPayload)), (isBuyer && buyerMemberPayload)), (isCustomer && {}));
|
|
714
|
+
payload = __assign(__assign(__assign(__assign(__assign(__assign({}, (isUser && payload)), (isShareholder && shareHolderPayload)), (isBoardMember && boardMemberPayload)), (isBuyer && buyerMemberPayload)), (isCustomer && {})), (isAuthorizedInfo && isAuthorizedInfo));
|
|
712
715
|
}
|
|
713
|
-
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 });
|
|
714
|
-
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
715
|
-
case 1:
|
|
716
|
-
data = _h.sent();
|
|
717
716
|
businessCountry = settings.data.businessCountry;
|
|
718
717
|
hasCivilIdDocument = (civilID || []).length > 0;
|
|
719
718
|
hasSignatureDocument = (signatureFileId || []).length > 0;
|
|
720
|
-
isSendSignatureFile =
|
|
719
|
+
isSendSignatureFile = isAuthorized && isUserORBuyerType;
|
|
721
720
|
civilIdDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT);
|
|
722
721
|
signatureDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE);
|
|
723
|
-
if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3,
|
|
722
|
+
if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 2];
|
|
724
723
|
documentBody = {
|
|
725
724
|
id: civilIdDocument.id,
|
|
726
725
|
images: civilID
|
|
727
726
|
};
|
|
728
727
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
729
|
-
case
|
|
728
|
+
case 1:
|
|
730
729
|
_h.sent();
|
|
731
|
-
_h.label =
|
|
732
|
-
case
|
|
733
|
-
if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3,
|
|
730
|
+
_h.label = 2;
|
|
731
|
+
case 2:
|
|
732
|
+
if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 4];
|
|
734
733
|
documentBody = {
|
|
735
734
|
id: signatureDocument.id,
|
|
736
735
|
images: signatureFileId
|
|
737
736
|
};
|
|
738
737
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
739
|
-
case
|
|
738
|
+
case 3:
|
|
740
739
|
_h.sent();
|
|
741
|
-
_h.label =
|
|
742
|
-
case
|
|
740
|
+
_h.label = 4;
|
|
741
|
+
case 4:
|
|
743
742
|
documentsList = [];
|
|
744
743
|
if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
|
|
745
744
|
documentsList.push({ type: DocumentPurpose.IDENTITY_DOCUMENT, images: civilID });
|
|
746
745
|
if (isSendSignatureFile && hasSignatureDocument && !(signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id))
|
|
747
746
|
documentsList.push({ type: DocumentPurpose.CUSTOMER_SIGNATURE, images: signatureFileId });
|
|
748
|
-
if (!(documentsList.length > 0)) return [3,
|
|
747
|
+
if (!(documentsList.length > 0)) return [3, 6];
|
|
749
748
|
documentBody = {
|
|
750
749
|
individual_type_id: ((ids === null || ids === void 0 ? void 0 : ids.length) ? ids.find(function (i) { return i.includes('usr_'); }) : id) || '',
|
|
751
750
|
country: businessCountry.iso2,
|
|
752
751
|
documents: documentsList
|
|
753
752
|
};
|
|
754
753
|
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
755
|
-
case
|
|
754
|
+
case 5:
|
|
756
755
|
_h.sent();
|
|
757
|
-
_h.label =
|
|
756
|
+
_h.label = 6;
|
|
757
|
+
case 6:
|
|
758
|
+
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 });
|
|
759
|
+
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
758
760
|
case 7:
|
|
761
|
+
data = _h.sent();
|
|
759
762
|
individualData = (sortUserList(mapUserList(data === null || data === void 0 ? void 0 : data.individuals)) || [])[0];
|
|
763
|
+
userListRes = userList || [];
|
|
764
|
+
if (!((user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id) && !(user === null || user === void 0 ? void 0 : user.is_authorized) && isAuthorized && (business === null || business === void 0 ? void 0 : business.id))) return [3, 9];
|
|
765
|
+
return [4, thunkApi.dispatch(getIndividualList(business === null || business === void 0 ? void 0 : business.id)).unwrap()];
|
|
766
|
+
case 8:
|
|
767
|
+
userListRes = _h.sent();
|
|
768
|
+
_h.label = 9;
|
|
769
|
+
case 9:
|
|
760
770
|
thunkApi.dispatch(handleNextScreenStep());
|
|
761
771
|
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
|
|
762
|
-
return [2, { data: data, formData: originalFormData, individualData: individualData }];
|
|
772
|
+
return [2, { data: data, formData: originalFormData, individualData: individualData, userList: userListRes, isKWOrSACountry: isKWOrSAValue }];
|
|
763
773
|
}
|
|
764
774
|
});
|
|
765
775
|
});
|
|
@@ -888,7 +898,8 @@ var initialState = {
|
|
|
888
898
|
isPEP: null,
|
|
889
899
|
isInfluencer: null,
|
|
890
900
|
shareCount: '',
|
|
891
|
-
shareValue: ''
|
|
901
|
+
shareValue: '',
|
|
902
|
+
isAuthorized: false
|
|
892
903
|
}
|
|
893
904
|
}
|
|
894
905
|
};
|
|
@@ -994,7 +1005,7 @@ export var individualSlice = createSlice({
|
|
|
994
1005
|
var user = (userList || []).find(function (user) { return user.individual_id === individualId; });
|
|
995
1006
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList });
|
|
996
1007
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList, user: __assign(__assign({}, user), { is_authorized: (user === null || user === void 0 ? void 0 : user.is_authorized) !== undefined ? user === null || user === void 0 ? void 0 : user.is_authorized : primaryUser === null || primaryUser === void 0 ? void 0 : primaryUser.is_authorized }) });
|
|
997
|
-
var _f = user || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares;
|
|
1008
|
+
var _f = user || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares, is_authorized = _f.is_authorized;
|
|
998
1009
|
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList;
|
|
999
1010
|
var cityList = (state.data.verify.responseBody || {}).cityList;
|
|
1000
1011
|
if (user)
|
|
@@ -1052,6 +1063,8 @@ export var individualSlice = createSlice({
|
|
|
1052
1063
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
1053
1064
|
if (is_influencer !== undefined)
|
|
1054
1065
|
state.data.individualData.isInfluencer = is_influencer;
|
|
1066
|
+
if (is_authorized !== undefined)
|
|
1067
|
+
state.data.individualData.isAuthorized = is_authorized;
|
|
1055
1068
|
})
|
|
1056
1069
|
.addCase(addDetailsAsync.rejected, function (state, action) {
|
|
1057
1070
|
state.loading = false;
|
|
@@ -1087,7 +1100,7 @@ export var individualSlice = createSlice({
|
|
|
1087
1100
|
var _e = action.payload, data = _e.data, countries = _e.countries;
|
|
1088
1101
|
var user = (state.data.verify.responseBody || {}).user;
|
|
1089
1102
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { primaryUser: data, user: __assign(__assign({}, data), { is_authorized: data.is_authorized !== undefined ? data.is_authorized : user === null || user === void 0 ? void 0 : user.is_authorized }) });
|
|
1090
|
-
var _f = data || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares;
|
|
1103
|
+
var _f = data || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares, is_authorized = _f.is_authorized;
|
|
1091
1104
|
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList;
|
|
1092
1105
|
var cityList = (state.data.verify.responseBody || {}).cityList;
|
|
1093
1106
|
if (data)
|
|
@@ -1143,6 +1156,8 @@ export var individualSlice = createSlice({
|
|
|
1143
1156
|
state.data.individualData.occupation = selectedOccupation;
|
|
1144
1157
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
1145
1158
|
state.data.individualData.isInfluencer = is_influencer;
|
|
1159
|
+
if (is_authorized !== undefined)
|
|
1160
|
+
state.data.individualData.isAuthorized = is_authorized;
|
|
1146
1161
|
})
|
|
1147
1162
|
.addCase(retrieveIndividualInfo.rejected, function (state, action) {
|
|
1148
1163
|
state.error = action.error.message;
|
|
@@ -1253,16 +1268,20 @@ export var individualSlice = createSlice({
|
|
|
1253
1268
|
.addCase(updateIndividualInfo.fulfilled, function (state, action) {
|
|
1254
1269
|
state.loading = false;
|
|
1255
1270
|
state.error = null;
|
|
1256
|
-
var _a = action.payload, data = _a.data, formData = _a.formData, individualData = _a.individualData;
|
|
1271
|
+
var _a = action.payload, data = _a.data, formData = _a.formData, individualData = _a.individualData, userList = _a.userList, isKWOrSACountry = _a.isKWOrSACountry;
|
|
1257
1272
|
state.data.individualData = formData;
|
|
1258
1273
|
state.data.individualData.responseBody = data;
|
|
1259
|
-
var
|
|
1274
|
+
var user = (state.data.verify.responseBody || {}).user;
|
|
1275
|
+
var isSameUser = (user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id);
|
|
1276
|
+
var userInfo = __assign(__assign({}, user), (isSameUser && (individualData === null || individualData === void 0 ? void 0 : individualData.documents) && { documents: individualData === null || individualData === void 0 ? void 0 : individualData.documents }));
|
|
1277
|
+
if (isSameUser && !isKWOrSACountry)
|
|
1278
|
+
userInfo = __assign(__assign({}, user), { is_authorized: individualData.is_authorized });
|
|
1260
1279
|
var list = userList || [];
|
|
1261
1280
|
list = list.map(function (user) {
|
|
1262
1281
|
var userInfo = user.id === (individualData === null || individualData === void 0 ? void 0 : individualData.id) ? individualData : user;
|
|
1263
1282
|
return userInfo;
|
|
1264
1283
|
});
|
|
1265
|
-
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: list });
|
|
1284
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { user: userInfo, userList: list });
|
|
1266
1285
|
})
|
|
1267
1286
|
.addCase(updateIndividualInfo.rejected, function (state, action) {
|
|
1268
1287
|
state.loading = false;
|
|
@@ -0,0 +1,36 @@
|
|
|
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 * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { isNetworkError } from '../../../../utils';
|
|
16
|
+
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
17
|
+
import { confirmInfo, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
18
|
+
import Button from '../../../shared/Button';
|
|
19
|
+
import DataLoading from '../../../shared/DataLoading';
|
|
20
|
+
var AccountCreatedLoader = function (_a) {
|
|
21
|
+
var dispatch = useAppDispatch();
|
|
22
|
+
var isAr = useLanguage().isAr;
|
|
23
|
+
var t = useTranslation().t;
|
|
24
|
+
var _b = useAppSelector(connectExpressSelector), error = _b.error, loading = _b.loading, data = _b.data;
|
|
25
|
+
var _c = data.authenticationData, brandInfo = _c.brandInfo, entityInfo = _c.entityInfo;
|
|
26
|
+
var merchantInfo = data.authMerchantData.merchantInfo;
|
|
27
|
+
React.useEffect(function () {
|
|
28
|
+
dispatch(confirmInfo({ entityInfo: entityInfo, brandInfo: brandInfo, merchantInfo: merchantInfo }));
|
|
29
|
+
}, []);
|
|
30
|
+
var onReTry = function () {
|
|
31
|
+
dispatch(confirmInfo({ entityInfo: entityInfo, brandInfo: brandInfo, merchantInfo: merchantInfo }));
|
|
32
|
+
};
|
|
33
|
+
var isNE = React.useMemo(function () { return isNetworkError(error); }, [error]);
|
|
34
|
+
return (_jsx(DataLoading, __assign({ error: error, title: 'account_already_created', hideSubtitle: true }, { children: isNE && (_jsx(Button, __assign({ onClick: onReTry, disableBack: true, isAr: isAr, loading: loading }, { children: t('try_again') }))) })));
|
|
35
|
+
};
|
|
36
|
+
export default React.memo(AccountCreatedLoader);
|
|
@@ -26,6 +26,7 @@ import ConnectExpressSuccessFlowButtonsScreen from './connectExpress/screens/Suc
|
|
|
26
26
|
import ConnectExpressAccountAlreadyCreatedScreen from './connectExpress/screens/AccountAlreadyCreated';
|
|
27
27
|
import ConnectExpressAuthenticationListScreen from './connectExpress/screens/AuthenticationList';
|
|
28
28
|
import ConnectExpressAuthMerchantScreen from './connectExpress/screens/AuthMerchant';
|
|
29
|
+
import ConnectExpressAuthAccountCreatedLoaderScreen from './connectExpress/screens/AccountCreatedLoader';
|
|
29
30
|
import AuthBusinessCountry from './auth/screens/BusinessCountry/BusinessCountry';
|
|
30
31
|
import AuthMobileScreen from './auth/screens/Mobile';
|
|
31
32
|
import AuthNIDScreen from './auth/screens/NID';
|
|
@@ -210,6 +211,10 @@ export var connectExpressFeatureScreens = [
|
|
|
210
211
|
{
|
|
211
212
|
name: 'CONNECT_EXPRESS_AUTH_MERCHANT_LIST_STEP',
|
|
212
213
|
element: ConnectExpressAuthMerchantScreen
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'CONNECT_EXPRESS_AUTH_ACCOUNT_CREATED_STEP',
|
|
217
|
+
element: ConnectExpressAuthAccountCreatedLoaderScreen
|
|
213
218
|
}
|
|
214
219
|
];
|
|
215
220
|
export var authFeatureScreens = [
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -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 { deepCopy, getIndividualType, isKW } from '../../../../utils';
|
|
22
|
+
import { deepCopy, getIndividualType, isKW, isKWOrSA } from '../../../../utils';
|
|
23
23
|
import Form from '../../../../components/Form';
|
|
24
24
|
import Collapse from '../../../../components/Collapse';
|
|
25
25
|
import Text from '../../../../components/Text';
|
|
@@ -37,6 +37,7 @@ import SignatureFile from './SignatureFile';
|
|
|
37
37
|
import ShareCount from './ShareCount';
|
|
38
38
|
import ShareValue from './ShareValue';
|
|
39
39
|
import { getFileDetailsFromDocument } from '../../../../utils';
|
|
40
|
+
import IsAuthorizedSwitch from './IsAuthorizedSwitch';
|
|
40
41
|
var TextBoxStyled = styled(Box)(function (_a) {
|
|
41
42
|
var theme = _a.theme;
|
|
42
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 }));
|
|
@@ -60,11 +61,13 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
60
61
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
61
62
|
var verify = data.verify;
|
|
62
63
|
var user = (verify.responseBody || {}).user;
|
|
63
|
-
var _d = data.individualData, occupation = _d.occupation, sourceIncome = _d.sourceIncome, monthlyIncome = _d.monthlyIncome, employerName = _d.employerName, isPEP = _d.isPEP, isInfluencer = _d.isInfluencer, civilID = _d.civilID, signatureFileId = _d.signatureFileId, civilIDUploading = _d.civilIDUploading, signatureFileUploading = _d.signatureFileUploading, shareCount = _d.shareCount, shareValue = _d.shareValue;
|
|
64
|
+
var _d = data.individualData, occupation = _d.occupation, sourceIncome = _d.sourceIncome, monthlyIncome = _d.monthlyIncome, employerName = _d.employerName, isPEP = _d.isPEP, isInfluencer = _d.isInfluencer, civilID = _d.civilID, signatureFileId = _d.signatureFileId, civilIDUploading = _d.civilIDUploading, signatureFileUploading = _d.signatureFileUploading, shareCount = _d.shareCount, shareValue = _d.shareValue, isAuthorized = _d.isAuthorized;
|
|
64
65
|
var _e = user || {}, documents = _e.documents, is_authorized = _e.is_authorized, data_status = _e.data_status, data_verification = _e.data_verification, names = _e.names, role = _e.role, occupationRes = _e.occupation, is_relative_PEP = _e.is_relative_PEP, is_influencer = _e.is_influencer, objects = _e.objects;
|
|
65
66
|
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
67
|
+
var isOtherThanKWAndSa = React.useMemo(function () { return !isKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
68
|
+
var showIsAuthorized = isOtherThanKWAndSa;
|
|
66
69
|
var methods = useForm({
|
|
67
|
-
resolver: yupResolver(IndividualInfoValidationSchema(objects, isKWCountry)),
|
|
70
|
+
resolver: yupResolver(IndividualInfoValidationSchema(objects, isKWCountry, showIsAuthorized)),
|
|
68
71
|
defaultValues: {
|
|
69
72
|
occupation: occupation,
|
|
70
73
|
sourceIncome: sourceIncome,
|
|
@@ -77,7 +80,8 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
77
80
|
civilIDUploading: civilIDUploading,
|
|
78
81
|
signatureFileUploading: signatureFileUploading,
|
|
79
82
|
shareCount: shareCount,
|
|
80
|
-
shareValue: shareValue
|
|
83
|
+
shareValue: shareValue,
|
|
84
|
+
isAuthorized: isAuthorized
|
|
81
85
|
},
|
|
82
86
|
mode: 'onChange'
|
|
83
87
|
});
|
|
@@ -96,7 +100,8 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
96
100
|
'source_of_income',
|
|
97
101
|
'monthly_income',
|
|
98
102
|
'is_relative_PEP',
|
|
99
|
-
'is_influencer'
|
|
103
|
+
'is_influencer',
|
|
104
|
+
'is_authorized'
|
|
100
105
|
]);
|
|
101
106
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
102
107
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
@@ -104,9 +109,10 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
104
109
|
var isOccupationVerified = dataVerified['occupation'] && (occupationRes === null || occupationRes === void 0 ? void 0 : occupationRes.id) === ((_b = watch('occupation')) === null || _b === void 0 ? void 0 : _b.id);
|
|
105
110
|
var isPEPSwitchVerified = dataVerified['is_relative_PEP'] && is_relative_PEP === watch('isPEP');
|
|
106
111
|
var isInfluencerSwitchVerified = dataVerified['is_influencer'] && is_influencer === watch('isInfluencer');
|
|
112
|
+
var isAuthorizedSwitchVerified = dataVerified['is_authorized'] && is_authorized === watch('isAuthorized');
|
|
107
113
|
var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
|
|
108
114
|
var onSubmit = function (data) {
|
|
109
|
-
dispatch(updateIndividualInfo(deepCopy(getFelids(data))));
|
|
115
|
+
dispatch(updateIndividualInfo(deepCopy(getFelids(__assign(__assign({}, data), { signatureFileUploading: signatureFileUploading, civilIDUploading: civilIDUploading })))));
|
|
110
116
|
};
|
|
111
117
|
var onBack = function () {
|
|
112
118
|
dispatch(handleCurrentActiveScreen('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
@@ -134,6 +140,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
134
140
|
var _g = React.useMemo(function () { return getIndividualType(objects); }, [objects]), isUser = _g.isUser, isShareholder = _g.isShareholder, isBoardMember = _g.isBoardMember, isBuyer = _g.isBuyer;
|
|
135
141
|
var isUserORBuyerType = isUser || isBuyer;
|
|
136
142
|
var isUserORBoardMemberType = isUser || isBoardMember;
|
|
143
|
+
var isAuthorizedValue = watch('isAuthorized');
|
|
137
144
|
var showSignatureFile = isUserORBuyerType;
|
|
138
145
|
var showOccupationFile = isUserORBuyerType;
|
|
139
146
|
var showSourceOfIncome = isUserORBuyerType;
|
|
@@ -144,7 +151,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
144
151
|
var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
|
|
145
152
|
var isOccupationListActive = listActive === ListType.OccupationList;
|
|
146
153
|
var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
|
|
147
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!is_authorized, timeout: 500 }, { children: _jsx(TextBoxStyled, { children: getUserName() || '' }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { isVerified: isOccupationVerified, readOnly: readOnly['occupation'] || noneEditable['occupation'], onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { readOnly: readOnly['sourceIncome'] || noneEditable['source_of_income'], onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { readOnly: readOnly['monthlyIncome'] || noneEditable['monthly_income'], show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares, readOnly: readOnly['shareCount'] }), _jsx(ShareValue, { show: !listActive && showShares, readOnly: readOnly['shareValue'] }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, { show: isKWCountry, readOnly: readOnly['civilID'], defaultFiles: defaultCivilIdFiles }), _jsx(SignatureFile, { show:
|
|
154
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!is_authorized, timeout: 500 }, { children: _jsx(TextBoxStyled, { children: getUserName() || '' }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { isVerified: isOccupationVerified, readOnly: readOnly['occupation'] || noneEditable['occupation'], onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { readOnly: readOnly['sourceIncome'] || noneEditable['source_of_income'], onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { readOnly: readOnly['monthlyIncome'] || noneEditable['monthly_income'], show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares, readOnly: readOnly['shareCount'] }), _jsx(ShareValue, { show: !listActive && showShares, readOnly: readOnly['shareValue'] }), _jsx(IsAuthorizedSwitch, { show: !listActive && showIsAuthorized, readOnly: readOnly['isAuthorized'] || noneEditable['is_authorized'], isVerified: isAuthorizedSwitchVerified }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, { show: isKWCountry, readOnly: readOnly['civilID'], defaultFiles: defaultCivilIdFiles }), _jsx(SignatureFile, { show: isAuthorizedValue && showSignatureFile, readOnly: readOnly['signatureFileId'], defaultFiles: defaultSignatureFiles })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive, readOnly: readOnly['isPEP'] || noneEditable['is_relative_PEP'], isVerified: isPEPSwitchVerified }), _jsx(InfluencerSwitch, { show: showIsInfluencer && isKWCountry && !listActive, readOnly: readOnly['isInfluencer'] || noneEditable['is_influencer'], isVerified: isInfluencerSwitchVerified })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
|
|
148
155
|
};
|
|
149
156
|
export default React.memo(AdditionalIndividualInfo);
|
|
150
157
|
AdditionalIndividualInfo.defaultProps = {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const InfoIconStyled: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
5
|
+
color?: "inherit" | "disabled" | "error" | "info" | "success" | "action" | "primary" | "secondary" | "warning" | undefined;
|
|
6
|
+
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
7
|
+
htmlColor?: string | undefined;
|
|
8
|
+
inheritViewBox?: boolean | undefined;
|
|
9
|
+
shapeRendering?: string | undefined;
|
|
10
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
11
|
+
titleAccess?: string | undefined;
|
|
12
|
+
viewBox?: string | undefined;
|
|
13
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
|
|
14
|
+
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
15
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
16
|
+
export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
19
|
+
color?: "inherit" | "disabled" | "error" | "info" | "success" | "action" | "primary" | "secondary" | "warning" | undefined;
|
|
20
|
+
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
21
|
+
htmlColor?: string | undefined;
|
|
22
|
+
inheritViewBox?: boolean | undefined;
|
|
23
|
+
shapeRendering?: string | undefined;
|
|
24
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
25
|
+
titleAccess?: string | undefined;
|
|
26
|
+
viewBox?: string | undefined;
|
|
27
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
|
|
28
|
+
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
29
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
30
|
+
export interface IsAuthorizedSwitchProps {
|
|
31
|
+
show: boolean;
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
isVerified?: boolean;
|
|
34
|
+
}
|
|
35
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly, isVerified }: IsAuthorizedSwitchProps) => import("react/jsx-runtime").JSX.Element>;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useFormContext, useController } from 'react-hook-form';
|
|
16
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
17
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
18
|
+
import Box from '@mui/material/Box';
|
|
19
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
22
|
+
import Collapse from '../../../../components/Collapse';
|
|
23
|
+
import RadioGroup from '../../../../components/RadioGroup';
|
|
24
|
+
import RadioLabel from '../../../../components/RadioLabel';
|
|
25
|
+
import Text from '../../../../components/Text';
|
|
26
|
+
import Mandatory from '../../../shared/Mandatory';
|
|
27
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
28
|
+
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
29
|
+
var LabelTextStyled = styled(Text)(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
|
|
32
|
+
});
|
|
33
|
+
var RadioGroupStyled = styled(RadioGroup)(function (_a) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
return ({
|
|
36
|
+
marginInlineStart: theme.spacing(0.25)
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
export var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
40
|
+
var theme = _a.theme;
|
|
41
|
+
return ({
|
|
42
|
+
width: theme.spacing(2.75),
|
|
43
|
+
height: theme.spacing(2.125),
|
|
44
|
+
cursor: 'pointer',
|
|
45
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
49
|
+
var theme = _a.theme;
|
|
50
|
+
return ({
|
|
51
|
+
width: theme.spacing(2.75),
|
|
52
|
+
height: theme.spacing(2.125),
|
|
53
|
+
cursor: 'pointer',
|
|
54
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
var RadioLabelStyled = styled('span')(function () { return ({
|
|
58
|
+
display: 'flex'
|
|
59
|
+
}); });
|
|
60
|
+
var IsAuthorizedSwitch = function (_a) {
|
|
61
|
+
var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
62
|
+
var control = useFormContext().control;
|
|
63
|
+
var t = useTranslation().t;
|
|
64
|
+
var authorizedControl = useController({ name: 'isAuthorized', control: control });
|
|
65
|
+
var error = useAppSelector(individualSelector).error;
|
|
66
|
+
var dispatch = useAppDispatch();
|
|
67
|
+
var handleOnChange = function (_a) {
|
|
68
|
+
var target = _a.target;
|
|
69
|
+
if (error)
|
|
70
|
+
dispatch(clearError());
|
|
71
|
+
authorizedControl.field.onChange(target.value === 'yes');
|
|
72
|
+
};
|
|
73
|
+
var authorizedValue = authorizedControl.field.value;
|
|
74
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pt: 2.5, pl: 2.5, pr: 2.5 } }, { children: [_jsx(Box, __assign({ style: { display: 'flex', justifyContent: 'space-between' } }, { children: _jsxs(LabelTextStyled, { children: [t('is_authorized_user_label'), _jsx(Mandatory, {})] }) })), _jsxs(RadioGroupStyled, __assign({ readOnly: readOnly, value: authorizedValue ? 'yes' : 'no', onChange: readOnly ? undefined : handleOnChange }, { children: [_jsx(RadioLabel, { value: 'yes', label: _jsxs(RadioLabelStyled, { children: [t('yes'), authorizedValue && isVerified && _jsx(CheckIcon, { sx: { marginInlineStart: '5px' }, isVerified: isVerified })] }) }), _jsx(RadioLabel, { value: 'no', label: _jsxs(RadioLabelStyled, { children: [t('no'), authorizedValue === false && isVerified && _jsx(CheckIcon, { sx: { marginInlineStart: '5px' }, isVerified: isVerified })] }) })] }))] })) })));
|
|
75
|
+
};
|
|
76
|
+
export default React.memo(IsAuthorizedSwitch);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { IndividualType } from '../../../../@types';
|
|
3
|
-
export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>, isKWCountry: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>, isKWCountry: boolean, hasAuthorizedField: boolean) => 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>>;
|
|
@@ -10,6 +10,7 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
|
|
|
10
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
|
+
isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
13
14
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
14
15
|
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>>;
|
|
15
16
|
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>>;
|
|
@@ -20,6 +21,7 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
|
|
|
20
21
|
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
21
22
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
23
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
24
|
+
isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
23
25
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
26
|
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>>;
|
|
25
27
|
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>>;
|
|
@@ -30,4 +32,5 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
|
|
|
30
32
|
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
31
33
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
34
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
35
|
+
isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
33
36
|
}>>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { getIndividualType } from '../../../../utils';
|
|
3
|
-
export var IndividualInfoValidationSchema = function (objects, isKWCountry) {
|
|
3
|
+
export var IndividualInfoValidationSchema = function (objects, isKWCountry, hasAuthorizedField) {
|
|
4
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(),
|
|
@@ -11,6 +11,7 @@ export var IndividualInfoValidationSchema = function (objects, isKWCountry) {
|
|
|
11
11
|
isPEP: isUserType ? yup.boolean().required('please_choose_relative_pep') : yup.boolean().optional().nullable(),
|
|
12
12
|
isInfluencer: isUserType && isKWCountry ? yup.boolean().required('please_choose_are_you_influncer') : yup.boolean().optional().nullable(),
|
|
13
13
|
shareCount: yup.string().optional(),
|
|
14
|
-
shareValue: yup.string().optional()
|
|
14
|
+
shareValue: yup.string().optional(),
|
|
15
|
+
isAuthorized: hasAuthorizedField ? yup.boolean().required('please_choose_is_authorized') : yup.boolean().optional()
|
|
15
16
|
});
|
|
16
17
|
};
|
|
@@ -2,6 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
export interface DataLoadingProps {
|
|
3
3
|
error?: string | null;
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
+
title?: string;
|
|
6
|
+
hideSubtitle?: boolean;
|
|
5
7
|
}
|
|
6
|
-
declare const _default: React.MemoExoticComponent<({ error, children }: DataLoadingProps) => import("react/jsx-runtime").JSX.Element>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ error, children, title, hideSubtitle }: DataLoadingProps) => import("react/jsx-runtime").JSX.Element>;
|
|
7
9
|
export default _default;
|
|
@@ -51,8 +51,8 @@ var SubTitleStyled = styled(Text)(function (_a) {
|
|
|
51
51
|
return (__assign(__assign({}, theme.typography.body2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, lineHeight: '16.8px', textAlign: 'center' }));
|
|
52
52
|
});
|
|
53
53
|
var DataLoading = function (_a) {
|
|
54
|
-
var error = _a.error, children = _a.children;
|
|
54
|
+
var error = _a.error, children = _a.children, title = _a.title, hideSubtitle = _a.hideSubtitle;
|
|
55
55
|
var t = useTranslation().t;
|
|
56
|
-
return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(TitleContainerStyled, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(GenericError, { error: error || '', errorTitle: 'oops' }) })), _jsxs(Collapse, __assign({ in: !error }, { children: [_jsx(Container, { children: _jsx(LottieFile, { file: LottieAnimationFiles.account_creation, loop: true, height: '375px' }) }), _jsxs(_Fragment, { children: [_jsx(TitleStyled, { children: t('prepare_data_title') }), _jsx(SubTitleStyled, { children: t('prepare_data_description') })] })] }))] }), children] })));
|
|
56
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(TitleContainerStyled, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(GenericError, { error: error || '', errorTitle: 'oops' }) })), _jsxs(Collapse, __assign({ in: !error }, { children: [_jsx(Container, { children: _jsx(LottieFile, { file: LottieAnimationFiles.account_creation, loop: true, height: '375px' }) }), _jsxs(_Fragment, { children: [_jsx(TitleStyled, { children: t(title || 'prepare_data_title') }), !hideSubtitle && _jsx(SubTitleStyled, { children: t('prepare_data_description') })] })] }))] }), children] })));
|
|
57
57
|
};
|
|
58
58
|
export default React.memo(DataLoading);
|