@tap-payments/auth-jsconnect 2.3.26-test → 2.3.28-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/app.d.ts +12 -1
- package/build/@types/app.js +1 -0
- package/build/@types/form.d.ts +2 -1
- package/build/api/entity.d.ts +5 -5
- package/build/app/settings.d.ts +3 -1
- package/build/app/settings.js +5 -1
- package/build/assets/locales/ar.json +3 -1
- package/build/assets/locales/en.json +3 -1
- package/build/constants/app.d.ts +2 -1
- package/build/constants/app.js +1 -0
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/bank/bankStore.js +26 -30
- package/build/features/app/brand/brandStore.d.ts +5 -2
- package/build/features/app/brand/brandStore.js +49 -39
- package/build/features/app/entity/entityStore.js +58 -68
- package/build/features/app/individual/individualStore.js +59 -65
- package/build/features/app/tax/taxStore.js +23 -22
- package/build/features/bank/screens/BankDetails/BankDetails.js +20 -5
- package/build/features/bank/screens/BankDetails/BankName.d.ts +4 -1
- package/build/features/bank/screens/BankDetails/BankName.js +8 -7
- package/build/features/bank/screens/BankDetails/BankStatement.d.ts +4 -1
- package/build/features/bank/screens/BankDetails/BankStatement.js +3 -8
- package/build/features/bank/screens/BankDetails/Beneficiary.d.ts +2 -1
- package/build/features/bank/screens/BankDetails/Beneficiary.js +8 -7
- package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +4 -1
- package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +6 -3
- package/build/features/bank/screens/BankDetails/IBAN.d.ts +2 -1
- package/build/features/bank/screens/BankDetails/IBAN.js +2 -2
- package/build/features/bank/screens/BankDetails/validation.d.ts +14 -14
- package/build/features/bank/screens/BankDetails/validation.js +16 -21
- package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +3 -1
- package/build/features/brand/screens/BrandActivities/ActivitiesList.js +11 -6
- package/build/features/brand/screens/BrandActivities/BrandActivities.js +4 -3
- package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/CustomerBase.js +12 -9
- package/build/features/brand/screens/BrandActivities/ExpectedCustomers.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/ExpectedCustomers.js +10 -7
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +9 -6
- package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +4 -1
- package/build/features/brand/screens/BrandActivities/RefundPolicy.js +7 -4
- package/build/features/brand/screens/BrandActivities/TAC.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/TAC.js +3 -1
- package/build/features/brand/screens/BrandActivities/TransactionPolicy.d.ts +4 -1
- package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +7 -4
- package/build/features/brand/screens/BrandActivities/validation.d.ts +7 -7
- package/build/features/brand/screens/BrandActivities/validation.js +10 -19
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +14 -9
- package/build/features/brand/screens/BrandInfo/BrandLogo.d.ts +9 -0
- package/build/features/brand/screens/BrandInfo/BrandLogo.js +52 -0
- package/build/features/brand/screens/BrandInfo/BrandName.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/BrandName.js +2 -2
- package/build/features/brand/screens/BrandInfo/SalesChannels.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/SalesChannels.js +2 -1
- package/build/features/brand/screens/BrandInfo/Segments.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/Segments.js +3 -1
- package/build/features/brand/screens/BrandInfo/TeamSize.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/TeamSize.js +3 -1
- package/build/features/brand/screens/BrandInfo/validation.d.ts +6 -6
- package/build/features/brand/screens/BrandInfo/validation.js +31 -37
- package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/ActivityList.js +12 -22
- package/build/features/entity/screens/EntityCapital/CapitalPaid.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareCount.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +2 -1
- package/build/features/entity/screens/EntityCapital/EntityCapital.js +4 -2
- package/build/features/entity/screens/EntityCapital/validation.d.ts +10 -10
- package/build/features/entity/screens/EntityCapital/validation.js +4 -10
- package/build/features/entity/screens/EntityName/Article.d.ts +4 -1
- package/build/features/entity/screens/EntityName/Article.js +3 -4
- package/build/features/entity/screens/EntityName/EntityName.js +7 -4
- package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +2 -1
- package/build/features/entity/screens/EntityName/EntityTypeList.js +9 -19
- package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +2 -1
- package/build/features/entity/screens/EntityName/ExpiryDate.js +2 -2
- package/build/features/entity/screens/EntityName/IssuingDate.d.ts +2 -1
- package/build/features/entity/screens/EntityName/IssuingDate.js +2 -2
- package/build/features/entity/screens/EntityName/LegalName.d.ts +2 -1
- package/build/features/entity/screens/EntityName/LegalName.js +2 -1
- package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +4 -1
- package/build/features/entity/screens/EntityName/LicenseCertificate.js +3 -8
- package/build/features/entity/screens/EntityName/LicenseNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityName/LicenseNumber.js +2 -2
- package/build/features/entity/screens/EntityName/UnifiedNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +35 -35
- package/build/features/entity/screens/EntityName/validation.js +68 -93
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +6 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.d.ts +6 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +3 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +3 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +11 -22
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +12 -23
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +3 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.d.ts +4 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +3 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +12 -23
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +6 -11
- package/build/features/individual/screens/IndividualList/MobileNumber.js +0 -1
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +3 -1
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +3 -1
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +2 -2
- package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Email.js +2 -4
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +3 -4
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +3 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ID.js +2 -7
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +3 -3
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +4 -6
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +2 -4
- package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Name.js +2 -2
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +4 -6
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.d.ts +1 -0
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +6 -3
- package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +1 -1
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +2 -1
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +3 -3
- package/build/features/shared/SalesChannels/SalesChannel.d.ts +2 -1
- package/build/features/shared/SalesChannels/SalesChannel.js +3 -3
- package/build/features/shared/UploadFile/FileUpload.d.ts +3 -1
- package/build/features/shared/UploadFile/FileUpload.js +14 -10
- package/build/features/shared/UploadFile/UploadWrapper.d.ts +3 -1
- package/build/features/shared/UploadFile/UploadWrapper.js +3 -2
- package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +2 -1
- package/build/features/shared/UploadMultipleFile/UploadFile.js +9 -5
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +2 -1
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +3 -3
- package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +4 -1
- package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +6 -3
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +5 -3
- package/build/features/tax/screens/TaxDetails/TaxDocument.d.ts +4 -1
- package/build/features/tax/screens/TaxDetails/TaxDocument.js +3 -8
- package/build/features/tax/screens/TaxDetails/VATId.d.ts +4 -1
- package/build/features/tax/screens/TaxDetails/VATId.js +5 -7
- package/build/features/tax/screens/TaxDetails/validation.d.ts +4 -4
- package/build/features/tax/screens/TaxDetails/validation.js +2 -5
- package/build/hooks/index.d.ts +3 -0
- package/build/hooks/index.js +3 -0
- package/build/hooks/useAppConfig.d.ts +1 -1
- package/build/hooks/useAppConfig.js +4 -2
- package/build/hooks/useDataNoneEditable.d.ts +2 -0
- package/build/hooks/useDataNoneEditable.js +19 -0
- package/build/hooks/useFormErrorAndUpdateReadOnly.d.ts +6 -0
- package/build/hooks/useFormErrorAndUpdateReadOnly.js +48 -0
- package/build/hooks/useFormReadOnly.d.ts +6 -0
- package/build/hooks/useFormReadOnly.js +40 -0
- package/build/utils/string.js +7 -8
- package/package.json +1 -1
- package/build/features/brand/screens/BrandActivities/OperationStartDate.d.ts +0 -20
- package/build/features/brand/screens/BrandActivities/OperationStartDate.js +0 -45
|
@@ -63,7 +63,7 @@ import { BusinessType, DocumentPurpose, FlowsTypes } from '../../../@types';
|
|
|
63
63
|
import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
64
64
|
import { ENTITY_STEP_NAMES } from '../../../constants';
|
|
65
65
|
import moment from 'moment';
|
|
66
|
-
import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue } from '../../../utils';
|
|
66
|
+
import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue } from '../../../utils';
|
|
67
67
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
|
|
68
68
|
var token = _a.token, isInternally = _a.isInternally;
|
|
69
69
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -242,47 +242,39 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
|
|
|
242
242
|
});
|
|
243
243
|
}); });
|
|
244
244
|
export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
245
|
-
var _a, settings, entity,
|
|
246
|
-
var _c, _d;
|
|
247
|
-
return __generator(this, function (
|
|
248
|
-
switch (
|
|
245
|
+
var _a, settings, entity, _b, id, data_status, data_verification, documents, issuingDate, expiryDate, isFL, isLegalNameENNonEditable, isLegalNameARNonEditable, isLicenseTypeNonEditable, isEntityTypeNonEditable, isLicenseNumberNonEditable, isUnifiedNumberNonEditable, isIssuingDateNonEditable, isExpiryDateNonEditable, isDocumentsNonEditable, isEntityTypeVerified, isLicenseNonEditable, payload, data, documentResponse, document, documentBody, documentBody, list;
|
|
246
|
+
var _c, _d, _e;
|
|
247
|
+
return __generator(this, function (_f) {
|
|
248
|
+
switch (_f.label) {
|
|
249
249
|
case 0:
|
|
250
250
|
_a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
|
|
251
|
-
|
|
252
|
-
_b = entityData || {}, id = _b.id, data_status = _b.data_status, data_verification = _b.data_verification;
|
|
251
|
+
_b = ((_c = entity.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) || {}, id = _b.id, data_status = _b.data_status, data_verification = _b.data_verification, documents = _b.documents;
|
|
253
252
|
issuingDate = new Date(params.issuingDate).getTime();
|
|
254
253
|
expiryDate = new Date(params.expiryDate).getTime();
|
|
255
254
|
isFL = params.licenseType === BusinessType.FL;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
255
|
+
isLegalNameENNonEditable = hasNoneEditableValue(data_status, 'legal_name.en');
|
|
256
|
+
isLegalNameARNonEditable = hasNoneEditableValue(data_status, 'legal_name.ar');
|
|
257
|
+
isLicenseTypeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.license, 'type');
|
|
258
|
+
isEntityTypeNonEditable = hasNoneEditableValue(data_status, 'type');
|
|
259
|
+
isLicenseNumberNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.license, 'number');
|
|
260
|
+
isUnifiedNumberNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.license, 'additional_info');
|
|
261
|
+
isIssuingDateNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.license, 'issuing_date');
|
|
262
|
+
isExpiryDateNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.license, 'expiry_date');
|
|
263
|
+
isDocumentsNonEditable = hasNoneEditableValue(data_status, 'documents');
|
|
263
264
|
isEntityTypeVerified = hasVerifiedValue(data_verification, 'type');
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
type: isLicenseTypeEditable ? (isFL ? 'freelance' : 'commercial_registration') : undefined,
|
|
270
|
-
issuing_date: isIssuingDateEditable ? issuingDate === null || issuingDate === void 0 ? void 0 : issuingDate.toString() : undefined,
|
|
271
|
-
expiry_date: isExpiryDateEditable ? expiryDate === null || expiryDate === void 0 ? void 0 : expiryDate.toString() : undefined,
|
|
272
|
-
additional_info: isUnifiedNumberEditable && params.unifiedNumber
|
|
273
|
-
? {
|
|
274
|
-
unified_number: params.unifiedNumber
|
|
275
|
-
}
|
|
276
|
-
: undefined
|
|
277
|
-
},
|
|
278
|
-
type: !isEntityTypeVerified && isEntityTypeEditable && params.entityType ? params.entityType : undefined,
|
|
279
|
-
legal_name: isLegalNameEditable && params.legalName
|
|
280
|
-
? {
|
|
281
|
-
ar: params.legalName,
|
|
282
|
-
en: params.legalName
|
|
265
|
+
isLicenseNonEditable = isLicenseNumberNonEditable && isLicenseTypeNonEditable && isIssuingDateNonEditable && isExpiryDateNonEditable && isUnifiedNumberNonEditable;
|
|
266
|
+
payload = __assign(__assign(__assign(__assign({ id: id, AOA_file_id: params.articleId }, (!isLicenseNonEditable && {
|
|
267
|
+
license: __assign({ number: isLicenseNumberNonEditable || !params.licenseNumber ? undefined : params.licenseNumber, type: isLicenseTypeNonEditable ? undefined : isFL ? 'freelance' : 'commercial_registration', issuing_date: isIssuingDateNonEditable ? undefined : issuingDate === null || issuingDate === void 0 ? void 0 : issuingDate.toString(), expiry_date: isExpiryDateNonEditable ? undefined : expiryDate === null || expiryDate === void 0 ? void 0 : expiryDate.toString() }, (!(isUnifiedNumberNonEditable || !params.unifiedNumber) && {
|
|
268
|
+
additional_info: {
|
|
269
|
+
unified_number: params.unifiedNumber
|
|
283
270
|
}
|
|
284
|
-
|
|
285
|
-
|
|
271
|
+
}))
|
|
272
|
+
})), (!(isEntityTypeVerified || isEntityTypeNonEditable) && { type: params.entityType })), (!((isLegalNameENNonEditable && isLegalNameARNonEditable) || !params.legalName) && {
|
|
273
|
+
legal_name: {
|
|
274
|
+
ar: isLegalNameENNonEditable ? undefined : params.legalName,
|
|
275
|
+
en: isLegalNameARNonEditable ? undefined : params.legalName
|
|
276
|
+
}
|
|
277
|
+
})), { encryption_contract: [
|
|
286
278
|
'license.number',
|
|
287
279
|
'legal_name.ar',
|
|
288
280
|
'legal_name.en',
|
|
@@ -291,14 +283,13 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
291
283
|
'license.expiry_date',
|
|
292
284
|
'license.additional_info.unified_number',
|
|
293
285
|
'type'
|
|
294
|
-
]
|
|
295
|
-
};
|
|
286
|
+
] });
|
|
296
287
|
return [4, API.entityService.updateEntity(payload)];
|
|
297
288
|
case 1:
|
|
298
|
-
data =
|
|
289
|
+
data = _f.sent();
|
|
299
290
|
documentResponse = undefined;
|
|
300
|
-
document = getRecentDocumentBasedOnPurpose(
|
|
301
|
-
if (!((params.certificateId || []).length > 0)) return [3, 7];
|
|
291
|
+
document = getRecentDocumentBasedOnPurpose(documents, DocumentPurpose.CR);
|
|
292
|
+
if (!(!isDocumentsNonEditable && (params.certificateId || []).length > 0)) return [3, 7];
|
|
302
293
|
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
|
|
303
294
|
documentBody = {
|
|
304
295
|
id: document.id,
|
|
@@ -306,7 +297,7 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
306
297
|
};
|
|
307
298
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
308
299
|
case 2:
|
|
309
|
-
documentResponse =
|
|
300
|
+
documentResponse = _f.sent();
|
|
310
301
|
return [3, 5];
|
|
311
302
|
case 3:
|
|
312
303
|
documentBody = {
|
|
@@ -320,56 +311,55 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
320
311
|
};
|
|
321
312
|
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
322
313
|
case 4:
|
|
323
|
-
documentResponse =
|
|
324
|
-
|
|
314
|
+
documentResponse = _f.sent();
|
|
315
|
+
_f.label = 5;
|
|
325
316
|
case 5: return [4, API.entityService.retrieveEntity(id)];
|
|
326
317
|
case 6:
|
|
327
|
-
data =
|
|
318
|
+
data = _f.sent();
|
|
328
319
|
data.documentData = documentResponse;
|
|
329
|
-
|
|
320
|
+
_f.label = 7;
|
|
330
321
|
case 7: return [4, API.dataService.getActivities()];
|
|
331
322
|
case 8:
|
|
332
|
-
list = (
|
|
323
|
+
list = (_f.sent()).list;
|
|
333
324
|
data.activityList = list;
|
|
334
325
|
thunkApi.dispatch(handleNextScreenStep());
|
|
335
|
-
(
|
|
326
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, id);
|
|
336
327
|
return [2, { data: data, formData: params }];
|
|
337
328
|
}
|
|
338
329
|
});
|
|
339
330
|
}); });
|
|
340
331
|
export var updateEntityCapital = createAsyncThunk('entityUpdateEntityCapital', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
341
|
-
var _a, settings, entity,
|
|
342
|
-
var _c, _d, _e;
|
|
343
|
-
return __generator(this, function (
|
|
344
|
-
switch (
|
|
332
|
+
var _a, settings, entity, _b, id, data_status, isCapitalPaidNonEditable, isCapitalShareCountNonEditable, isCapitalShareValueNonEditable, isActivitiesNonEditable, hasCapitalShares, activities, payload, data;
|
|
333
|
+
var _c, _d, _e, _f;
|
|
334
|
+
return __generator(this, function (_g) {
|
|
335
|
+
switch (_g.label) {
|
|
345
336
|
case 0:
|
|
346
337
|
_a = thunkApi.getState(), settings = _a.settings, entity = _a.entity;
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
338
|
+
_b = ((_c = entity.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) || {}, id = _b.id, data_status = _b.data_status;
|
|
339
|
+
isCapitalPaidNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.capital, 'paid');
|
|
340
|
+
isCapitalShareCountNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.capital, 'shares.count');
|
|
341
|
+
isCapitalShareValueNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.capital, 'shares.value');
|
|
342
|
+
isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
|
|
343
|
+
hasCapitalShares = params.capitalShareCount || params.capitalShareValue;
|
|
344
|
+
activities = (_d = (params.activities || [])) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
|
|
352
345
|
var id = _a.id;
|
|
353
346
|
return ({ id: id, action: 'add' });
|
|
354
347
|
});
|
|
355
348
|
payload = {
|
|
356
349
|
id: id,
|
|
357
|
-
activities: (activities === null || activities === void 0 ? void 0 : activities.length)
|
|
358
|
-
capital: {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
?
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
: undefined
|
|
366
|
-
}
|
|
350
|
+
activities: isActivitiesNonEditable || (activities === null || activities === void 0 ? void 0 : activities.length) === 0 ? undefined : activities,
|
|
351
|
+
capital: __assign({ paid: isCapitalPaidNonEditable ? undefined : params.capitalPaid }, (!((isCapitalShareCountNonEditable && isCapitalShareValueNonEditable) || !hasCapitalShares) && {
|
|
352
|
+
shares: {
|
|
353
|
+
count: isCapitalShareCountNonEditable ? undefined : params.capitalShareCount,
|
|
354
|
+
value: isCapitalShareValueNonEditable ? undefined : params.capitalShareValue
|
|
355
|
+
}
|
|
356
|
+
}))
|
|
367
357
|
};
|
|
368
358
|
return [4, API.entityService.updateEntity(payload)];
|
|
369
359
|
case 1:
|
|
370
|
-
data =
|
|
360
|
+
data = _g.sent();
|
|
371
361
|
thunkApi.dispatch(handleNextScreenStep());
|
|
372
|
-
(
|
|
362
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
|
|
373
363
|
return [2, { data: data, formData: params }];
|
|
374
364
|
}
|
|
375
365
|
});
|
|
@@ -71,7 +71,7 @@ import API from '../../../api';
|
|
|
71
71
|
import { FlowsTypes, IndividualGender, IndividualType, DocumentPurpose } from '../../../@types';
|
|
72
72
|
import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
73
73
|
import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
74
|
-
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose } from '../../../utils';
|
|
74
|
+
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose } 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 () {
|
|
@@ -538,10 +538,10 @@ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', func
|
|
|
538
538
|
});
|
|
539
539
|
}); });
|
|
540
540
|
export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
541
|
-
var _a, settings, individual, _b, notification, user, entity, _c, id, type, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type,
|
|
542
|
-
var _d, _e, _f, _g;
|
|
543
|
-
return __generator(this, function (
|
|
544
|
-
switch (
|
|
541
|
+
var _a, settings, individual, _b, notification, user, entity, _c, id, type, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isNameNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, contact, requestBody, data;
|
|
542
|
+
var _d, _e, _f, _g, _h, _j;
|
|
543
|
+
return __generator(this, function (_k) {
|
|
544
|
+
switch (_k.label) {
|
|
545
545
|
case 0:
|
|
546
546
|
_a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
|
|
547
547
|
_b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user, entity = _b.entity;
|
|
@@ -551,57 +551,52 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
551
551
|
data_status = (user || {}).data_status;
|
|
552
552
|
userName = getUserNameObject(name);
|
|
553
553
|
identification_id_type = nid && (nid === null || nid === void 0 ? void 0 : nid.startsWith('1')) ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
554
|
+
isNameNonEditable = hasNoneEditableValue(data_status, 'name');
|
|
555
|
+
isEmailNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.contact, 'email');
|
|
556
|
+
isMobileNumberNonEditable = hasNoneEditableValue((_d = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _d === void 0 ? void 0 : _d.phone, 'number');
|
|
557
|
+
isMobileCountryNonEditable = hasNoneEditableValue((_e = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _e === void 0 ? void 0 : _e.phone, 'country_code');
|
|
558
|
+
isNidNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'id');
|
|
559
|
+
isIssuedCountryNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'issuer_country');
|
|
560
|
+
isExpiryNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'expiry');
|
|
561
|
+
isIdTypeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'type');
|
|
562
|
+
isNationalityNonEditable = hasNoneEditableValue(data_status, 'nationality');
|
|
563
|
+
isDOBNonEditable = hasNoneEditableValue(data_status, 'birth.date');
|
|
564
|
+
isBirthCityNonEditable = hasNoneEditableValue(data_status, 'birth.city');
|
|
565
|
+
isBirthCountryNonEditable = hasNoneEditableValue(data_status, 'birth.country');
|
|
563
566
|
hasContact = email || mobile || countryCode;
|
|
564
567
|
hasPhone = mobile && (countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix);
|
|
565
568
|
hasIdentification = nid || issuedCountry || identification_id_type || expiryDate;
|
|
566
569
|
hasBirth = placeOfBirthCity || placeOfBirthCountry;
|
|
567
|
-
|
|
568
|
-
? {
|
|
570
|
+
contact = hasContact && !(isEmailNonEditable && isMobileCountryNonEditable && isMobileNumberNonEditable)
|
|
571
|
+
? __assign({ email: isEmailNonEditable ? undefined : email }, (!((isMobileCountryNonEditable && isMobileNumberNonEditable) || !hasPhone) && {
|
|
572
|
+
phone: {
|
|
573
|
+
country_code: isMobileCountryNonEditable ? undefined : (_f = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _f === void 0 ? void 0 : _f.toString(),
|
|
574
|
+
number: isMobileNumberNonEditable || !mobile ? undefined : mobile
|
|
575
|
+
}
|
|
576
|
+
})) : undefined;
|
|
577
|
+
requestBody = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ id: id, type: type, gender: gender || undefined }, (!(isNameNonEditable || !userName.first) && {
|
|
578
|
+
names: {
|
|
569
579
|
en: userName,
|
|
570
580
|
ar: userName
|
|
571
581
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
number: isMobileNumberEditable ? mobile : undefined
|
|
580
|
-
}
|
|
581
|
-
: undefined
|
|
582
|
+
})), { contact: contact }), (hasIdentification &&
|
|
583
|
+
!(isNidNonEditable && isIssuedCountryNonEditable && isExpiryNonEditable && isIdTypeNonEditable) && {
|
|
584
|
+
identification: {
|
|
585
|
+
id: isNidNonEditable || !nid ? undefined : nid,
|
|
586
|
+
issued_country_code: isIssuedCountryNonEditable ? undefined : issuedCountry === null || issuedCountry === void 0 ? void 0 : issuedCountry.iso2,
|
|
587
|
+
expiry: isExpiryNonEditable || !expiryDate ? undefined : new Date(expiryDate).getTime(),
|
|
588
|
+
type: isIdTypeNonEditable || !identification_id_type ? undefined : identification_id_type
|
|
582
589
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
issued_country_code: isIssuedCountryEditable ? issuedCountry === null || issuedCountry === void 0 ? void 0 : issuedCountry.iso2 : undefined,
|
|
594
|
-
expiry: isExpiryEditable ? new Date(expiryDate).getTime() : undefined,
|
|
595
|
-
type: isIdTypeEditable ? identification_id_type : undefined
|
|
596
|
-
}
|
|
597
|
-
: undefined,
|
|
598
|
-
date_of_birth: dob,
|
|
599
|
-
birth: hasBirth && {
|
|
600
|
-
city: (_e = placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.name) === null || _e === void 0 ? void 0 : _e.en,
|
|
601
|
-
country: placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2
|
|
602
|
-
},
|
|
603
|
-
nationality: isNationalityEditable ? nationality === null || nationality === void 0 ? void 0 : nationality.iso2 : undefined,
|
|
604
|
-
encryption_contract: [
|
|
590
|
+
})), (!isDOBNonEditable && {
|
|
591
|
+
date_of_birth: nationality === null || nationality === void 0 ? void 0 : nationality.iso2
|
|
592
|
+
})), (!((isBirthCityNonEditable && isBirthCountryNonEditable) || !hasBirth) && {
|
|
593
|
+
birth: {
|
|
594
|
+
city: isBirthCityNonEditable ? undefined : (_g = placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.name) === null || _g === void 0 ? void 0 : _g.en,
|
|
595
|
+
country: isBirthCountryNonEditable ? undefined : placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2
|
|
596
|
+
}
|
|
597
|
+
})), (!isNationalityNonEditable && {
|
|
598
|
+
nationality: nationality === null || nationality === void 0 ? void 0 : nationality.iso2
|
|
599
|
+
})), { encryption_contract: [
|
|
605
600
|
'gender',
|
|
606
601
|
'contact.email',
|
|
607
602
|
'contact.phone.country_code',
|
|
@@ -614,26 +609,24 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
614
609
|
'birth.country',
|
|
615
610
|
'date_of_birth',
|
|
616
611
|
'nationality'
|
|
617
|
-
],
|
|
618
|
-
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO
|
|
619
|
-
};
|
|
612
|
+
], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO });
|
|
620
613
|
return [4, API.individualService.updateIndividual(requestBody)];
|
|
621
614
|
case 1:
|
|
622
|
-
data =
|
|
615
|
+
data = _k.sent();
|
|
623
616
|
if (!(type === IndividualType.USER || type === IndividualType.BUYER)) return [3, 3];
|
|
624
617
|
return [4, thunkApi.dispatch(retrieveDataList(code))];
|
|
625
618
|
case 2:
|
|
626
|
-
|
|
627
|
-
|
|
619
|
+
_k.sent();
|
|
620
|
+
_k.label = 3;
|
|
628
621
|
case 3:
|
|
629
622
|
thunkApi.dispatch(handleNextScreenStep());
|
|
630
|
-
(
|
|
623
|
+
(_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
|
|
631
624
|
return [2, { data: data, formData: params }];
|
|
632
625
|
}
|
|
633
626
|
});
|
|
634
627
|
}); });
|
|
635
628
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
636
|
-
var _a, settings, individual, _b, notification, user, _c, id, type, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue,
|
|
629
|
+
var _a, settings, individual, _b, notification, user, _c, id, type, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, payload, requestBody, data, civilID, signatureFileId, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody;
|
|
637
630
|
var _d, _e;
|
|
638
631
|
return __generator(this, function (_f) {
|
|
639
632
|
switch (_f.label) {
|
|
@@ -642,16 +635,17 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
642
635
|
_b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user;
|
|
643
636
|
_c = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
644
637
|
occupation = params.occupation, sourceIncome = params.sourceIncome, monthlyIncome = params.monthlyIncome, isPEP = params.isPEP, isInfluencer = params.isInfluencer, shareCount = params.shareCount, shareValue = params.shareValue;
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
638
|
+
isOccupationNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'occupation');
|
|
639
|
+
isSourceIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'source_of_income');
|
|
640
|
+
isPEPNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_relative_PEP');
|
|
641
|
+
isInfluencerNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_influencer');
|
|
642
|
+
isMonthlyIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'monthly_income');
|
|
649
643
|
isSharesAvailable = shareCount || shareValue;
|
|
650
|
-
pepInfo =
|
|
651
|
-
influencerInfo =
|
|
652
|
-
occupationInfo =
|
|
653
|
-
sourceIncomeInfo =
|
|
654
|
-
monthlyIncomeInfo = (monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.id)
|
|
644
|
+
pepInfo = isPEPNonEditable ? undefined : isPEP;
|
|
645
|
+
influencerInfo = isInfluencerNonEditable ? undefined : isInfluencer;
|
|
646
|
+
occupationInfo = isOccupationNonEditable || !(occupation === null || occupation === void 0 ? void 0 : occupation.id) ? undefined : { id: occupation.id };
|
|
647
|
+
sourceIncomeInfo = isSourceIncomeNonEditable || !(sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.id) ? undefined : [{ id: sourceIncome.id }];
|
|
648
|
+
monthlyIncomeInfo = isMonthlyIncomeNonEditable || !(monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.id) ? undefined : { id: monthlyIncome.id };
|
|
655
649
|
userPayload = {
|
|
656
650
|
occupation: occupationInfo,
|
|
657
651
|
source_income: sourceIncomeInfo,
|
|
@@ -51,7 +51,7 @@ import API from '../../../api';
|
|
|
51
51
|
import { DocumentPurpose, FlowsTypes } from '../../../@types';
|
|
52
52
|
import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
53
|
import { TAX_STEP_NAMES } from '../../../constants';
|
|
54
|
-
import { getRecentDocumentBasedOnPurpose } from '../../../utils';
|
|
54
|
+
import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue } from '../../../utils';
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
|
|
56
56
|
var token = _a.token, isInternally = _a.isInternally;
|
|
57
57
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -169,41 +169,42 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
|
|
|
169
169
|
});
|
|
170
170
|
}); });
|
|
171
171
|
export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
172
|
-
var _a, settings, tax,
|
|
173
|
-
var
|
|
174
|
-
return __generator(this, function (
|
|
175
|
-
switch (
|
|
172
|
+
var _a, settings, tax, _b, id, data_status, documents, isTaxNumberNonEditable, isConfirmPolicyNonEditable, isDocumentsNonEditable, document, requestBody, data, documentBody, _c, documentBody, _d;
|
|
173
|
+
var _e, _f, _g, _h;
|
|
174
|
+
return __generator(this, function (_j) {
|
|
175
|
+
switch (_j.label) {
|
|
176
176
|
case 0:
|
|
177
177
|
_a = thunkApi.getState(), settings = _a.settings, tax = _a.tax;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
_b = ((_e = tax.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.entity) || {}, id = _b.id, data_status = _b.data_status, documents = _b.documents;
|
|
179
|
+
isTaxNumberNonEditable = hasNoneEditableValue(data_status, 'tax_number');
|
|
180
|
+
isConfirmPolicyNonEditable = hasNoneEditableValue(data_status, 'is_vat_acknowledged');
|
|
181
|
+
isDocumentsNonEditable = hasNoneEditableValue(data_status, 'documents');
|
|
182
|
+
document = getRecentDocumentBasedOnPurpose(documents, DocumentPurpose.TAX_DOCUMENT);
|
|
182
183
|
requestBody = {
|
|
183
|
-
id:
|
|
184
|
-
vat_id:
|
|
184
|
+
id: id,
|
|
185
|
+
vat_id: isTaxNumberNonEditable ? undefined : params.vatId,
|
|
185
186
|
step_name: TAX_STEP_NAMES.TAX_INFO,
|
|
186
|
-
is_vat_acknowledged: params.confirmPolicy
|
|
187
|
+
is_vat_acknowledged: isConfirmPolicyNonEditable ? undefined : params.confirmPolicy
|
|
187
188
|
};
|
|
188
189
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
189
190
|
case 1:
|
|
190
|
-
data = (
|
|
191
|
-
if ((
|
|
191
|
+
data = (_j.sent()).data;
|
|
192
|
+
if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
|
|
192
193
|
throw new Error(data.errors[0].description);
|
|
193
|
-
if (!((params.documentId || []).length > 0)) return [3, 5];
|
|
194
|
+
if (!(!isDocumentsNonEditable && (params.documentId || []).length > 0)) return [3, 5];
|
|
194
195
|
if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
|
|
195
196
|
documentBody = {
|
|
196
197
|
id: document === null || document === void 0 ? void 0 : document.id,
|
|
197
198
|
images: params.documentId
|
|
198
199
|
};
|
|
199
|
-
|
|
200
|
+
_c = data;
|
|
200
201
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
201
202
|
case 2:
|
|
202
|
-
|
|
203
|
+
_c.documentData = _j.sent();
|
|
203
204
|
return [3, 5];
|
|
204
205
|
case 3:
|
|
205
206
|
documentBody = {
|
|
206
|
-
entity_id:
|
|
207
|
+
entity_id: id || '',
|
|
207
208
|
documents: [
|
|
208
209
|
{
|
|
209
210
|
type: DocumentPurpose.TAX_DOCUMENT,
|
|
@@ -211,14 +212,14 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, t
|
|
|
211
212
|
}
|
|
212
213
|
]
|
|
213
214
|
};
|
|
214
|
-
|
|
215
|
+
_d = data;
|
|
215
216
|
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
216
217
|
case 4:
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
_d.documentData = _j.sent();
|
|
219
|
+
_j.label = 5;
|
|
219
220
|
case 5:
|
|
220
221
|
thunkApi.dispatch(handleNextScreenStep());
|
|
221
|
-
(
|
|
222
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, requestBody);
|
|
222
223
|
return [2, { data: data, formData: params }];
|
|
223
224
|
}
|
|
224
225
|
});
|
|
@@ -16,20 +16,20 @@ import Beneficiary from './Beneficiary';
|
|
|
16
16
|
import IBAN from './IBAN';
|
|
17
17
|
import BankName from './BankName';
|
|
18
18
|
import Button from '../../../shared/Button';
|
|
19
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useAppSelector, useFormReadOnly, useSetFromDefaultValues, useDataNoneEditable, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
20
20
|
import { BankKWFLValidation, BankValidation } from './validation';
|
|
21
21
|
import { useTranslation } from 'react-i18next';
|
|
22
22
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
23
23
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
24
24
|
import { useLanguage } from '../../../../hooks';
|
|
25
25
|
import { styled } from '@mui/material/styles';
|
|
26
|
-
import { BusinessType } from '../../../../@types';
|
|
26
|
+
import { BusinessType, DocumentPurpose } from '../../../../@types';
|
|
27
27
|
import { bankSelector, clearError, createBankAccount } from '../../../app/bank/bankStore';
|
|
28
28
|
import Form from '../../../../components/Form';
|
|
29
29
|
import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
|
|
30
30
|
import ConfirmPolicy from './ConfirmPolicy';
|
|
31
31
|
import BankStatement from './BankStatement';
|
|
32
|
-
import { isKW } from '../../../../utils';
|
|
32
|
+
import { getFileDetailsFromDocument, isKW } from '../../../../utils';
|
|
33
33
|
var FormStyled = styled(Form)(function () { return ({
|
|
34
34
|
display: 'flex',
|
|
35
35
|
flexDirection: 'column',
|
|
@@ -54,7 +54,7 @@ var BankDetails = function () {
|
|
|
54
54
|
var isFL = ((_a = entity === null || entity === void 0 ? void 0 : entity.type) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === BusinessType.FL ? true : false;
|
|
55
55
|
var bankHasDocument = ((_c = (_b = bank_account === null || bank_account === void 0 ? void 0 : bank_account.document) === null || _b === void 0 ? void 0 : _b.file_details) === null || _c === void 0 ? void 0 : _c.length) > 0;
|
|
56
56
|
var methods = useForm({
|
|
57
|
-
resolver: yupResolver(isKWCountry && isFL && !bankHasDocument ? BankKWFLValidation(
|
|
57
|
+
resolver: yupResolver(isKWCountry && isFL && !bankHasDocument ? BankKWFLValidation() : BankValidation()),
|
|
58
58
|
defaultValues: {
|
|
59
59
|
iban: iban,
|
|
60
60
|
beneficiaryName: beneficiaryName,
|
|
@@ -79,6 +79,21 @@ var BankDetails = function () {
|
|
|
79
79
|
if (error)
|
|
80
80
|
dispatch(clearError());
|
|
81
81
|
}, [methods.formState.isValid, methods.watch('bankStatementId')]);
|
|
82
|
-
|
|
82
|
+
var defaultBankFiles = React.useMemo(function () {
|
|
83
|
+
if (!(bank_account === null || bank_account === void 0 ? void 0 : bank_account.document))
|
|
84
|
+
return [];
|
|
85
|
+
return getFileDetailsFromDocument([bank_account.document], DocumentPurpose.BANK_STATEMENT);
|
|
86
|
+
}, [bank_account === null || bank_account === void 0 ? void 0 : bank_account.document]);
|
|
87
|
+
var originalReadOnly = useFormReadOnly(methods, { bankStatementId: defaultBankFiles });
|
|
88
|
+
var noneEditable = useDataNoneEditable(bank_account === null || bank_account === void 0 ? void 0 : bank_account.data_status, [
|
|
89
|
+
'beneficiary_name',
|
|
90
|
+
'bank_name',
|
|
91
|
+
'iban',
|
|
92
|
+
'beneficiary_name',
|
|
93
|
+
'bank_statement_file_id',
|
|
94
|
+
'is_acknowledged'
|
|
95
|
+
]);
|
|
96
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
97
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Beneficiary, { readOnly: readOnly['beneficiaryName'] || noneEditable['beneficiary_name'] }), _jsx(IBAN, { fetchingIban: function (value) { return setIbanChecking(value); }, ibanChecking: ibanChecking, readOnly: readOnly['iban'] || noneEditable['iban'] }), _jsx(BankName, { readOnly: readOnly['bankName'] || noneEditable['bank_name'] }), _jsx(BankStatement, { required: isKWCountry && isFL && !bankHasDocument, defaultFiles: defaultBankFiles, readOnly: readOnly['bankStatementId'] || noneEditable['bank_statement_file_id'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['confirmPolicy'] || noneEditable['is_acknowledged'] }), _jsx(ButtonStyled, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, disableBack: true, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('confirm') }))] })) })) }));
|
|
83
98
|
};
|
|
84
99
|
export default BankDetails;
|
|
@@ -34,16 +34,17 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
34
34
|
cursor: 'default'
|
|
35
35
|
}
|
|
36
36
|
}); });
|
|
37
|
-
var BankName = function () {
|
|
38
|
-
var
|
|
37
|
+
var BankName = function (_a) {
|
|
38
|
+
var _b, _c, _d;
|
|
39
|
+
var readOnly = _a.readOnly;
|
|
39
40
|
var t = useTranslation().t;
|
|
40
|
-
var
|
|
41
|
+
var _e = useFormContext(), setValue = _e.setValue, control = _e.control;
|
|
41
42
|
var data = useAppSelector(bankSelector).data;
|
|
42
43
|
var bankNameControl = useController({ name: 'bankName', control: control });
|
|
43
44
|
var bankNameValue = bankNameControl.field.value;
|
|
44
|
-
var hasError = !!((
|
|
45
|
+
var hasError = !!((_b = bankNameControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
|
|
45
46
|
var bank_account = (data.verify.responseBody || {}).bank_account;
|
|
46
|
-
var isNonEditable = ((
|
|
47
|
+
var isNonEditable = ((_c = bank_account === null || bank_account === void 0 ? void 0 : bank_account.data_status) === null || _c === void 0 ? void 0 : _c.bank_name) === FieldType.NON_EDITABLE;
|
|
47
48
|
var clearValue = function () {
|
|
48
49
|
bankNameControl.field.onChange('');
|
|
49
50
|
};
|
|
@@ -52,12 +53,12 @@ var BankName = function () {
|
|
|
52
53
|
var bankName = (_a = data.bankData.responseBody) === null || _a === void 0 ? void 0 : _a.bank_name;
|
|
53
54
|
if (bankName && !bankNameValue)
|
|
54
55
|
setValue('bankName', bankName);
|
|
55
|
-
}, [(
|
|
56
|
+
}, [(_d = data.bankData.responseBody) === null || _d === void 0 ? void 0 : _d.bank_name]);
|
|
56
57
|
var handleBankChange = function (_a) {
|
|
57
58
|
var target = _a.target;
|
|
58
59
|
var value = removeAllOtherThanAlphabetAndSpace(target.value);
|
|
59
60
|
bankNameControl.field.onChange(value);
|
|
60
61
|
};
|
|
61
|
-
return (_jsx(Collapse, __assign({ in: !!bankNameValue }, { children: _jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), onChange: handleBankChange, value: bankNameValue, required: true, disabled: isNonEditable, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }) })));
|
|
62
|
+
return (_jsx(Collapse, __assign({ in: !!bankNameValue }, { children: _jsx(FeatureStyled, { children: _jsx(InputStyled, { readOnly: readOnly, label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), onChange: handleBankChange, value: bankNameValue, required: true, disabled: isNonEditable, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }) })));
|
|
62
63
|
};
|
|
63
64
|
export default BankName;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { FileDetails } from '../../../../@types';
|
|
2
3
|
declare type BankStatementProps = {
|
|
3
4
|
required: boolean;
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
defaultFiles?: Array<FileDetails>;
|
|
4
7
|
};
|
|
5
|
-
declare const BankStatement: ({ required }: BankStatementProps) => JSX.Element;
|
|
8
|
+
declare const BankStatement: ({ required, readOnly, defaultFiles }: BankStatementProps) => JSX.Element;
|
|
6
9
|
export default BankStatement;
|