@tap-payments/auth-jsconnect 2.12.14-development → 2.12.16-development
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 +1 -0
- package/build/@types/app.js +1 -0
- package/build/@types/form.d.ts +1 -0
- package/build/api/document.d.ts +1 -1
- package/build/assets/locales/ar.json +1 -0
- package/build/assets/locales/en.json +1 -0
- package/build/features/app/entity/entityStore.js +56 -35
- package/build/features/bank/screens/BankDetails/BankDetails.js +1 -1
- package/build/features/entity/screens/EntityName/EntityDocumentUpload.d.ts +12 -0
- package/build/features/entity/screens/EntityName/{LicenseCertificate.js → EntityDocumentUpload.js} +10 -15
- package/build/features/entity/screens/EntityName/EntityName.js +10 -4
- package/build/features/entity/screens/EntityName/validation.d.ts +9 -0
- package/build/features/entity/screens/EntityName/validation.js +3 -0
- package/build/utils/array.d.ts +1 -1
- package/build/utils/array.js +3 -2
- package/package.json +1 -1
- package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +0 -9
package/build/@types/app.d.ts
CHANGED
|
@@ -421,6 +421,7 @@ export declare enum IndividualType {
|
|
|
421
421
|
}
|
|
422
422
|
export declare enum DocumentPurpose {
|
|
423
423
|
CR = "commercial_registration",
|
|
424
|
+
COMMERCIAL_REGISTRATION_EXTRACT = "commercial_registration_extract",
|
|
424
425
|
ARTICLE_ASSOCIATION = "article_of_association",
|
|
425
426
|
BANK_STATEMENT = "bank_statement",
|
|
426
427
|
BANK_CERTIFICATE = "bank_certificate",
|
package/build/@types/app.js
CHANGED
|
@@ -92,6 +92,7 @@ export var IndividualType;
|
|
|
92
92
|
export var DocumentPurpose;
|
|
93
93
|
(function (DocumentPurpose) {
|
|
94
94
|
DocumentPurpose["CR"] = "commercial_registration";
|
|
95
|
+
DocumentPurpose["COMMERCIAL_REGISTRATION_EXTRACT"] = "commercial_registration_extract";
|
|
95
96
|
DocumentPurpose["ARTICLE_ASSOCIATION"] = "article_of_association";
|
|
96
97
|
DocumentPurpose["BANK_STATEMENT"] = "bank_statement";
|
|
97
98
|
DocumentPurpose["BANK_CERTIFICATE"] = "bank_certificate";
|
package/build/@types/form.d.ts
CHANGED
|
@@ -140,6 +140,7 @@ export declare type EntityNameFormValues = {
|
|
|
140
140
|
expiryDate: string;
|
|
141
141
|
unifiedNumber: string;
|
|
142
142
|
certificateId?: Array<string>;
|
|
143
|
+
commercialRegistrationExtractId?: Array<string>;
|
|
143
144
|
articleId?: string;
|
|
144
145
|
};
|
|
145
146
|
export declare type EntityCapitalFormValues = {
|
package/build/api/document.d.ts
CHANGED
|
@@ -643,6 +643,7 @@
|
|
|
643
643
|
"title_brand_logo": "لوجو العلامة التجارية",
|
|
644
644
|
"title_civil_id": "صورة الهوية الوطنية",
|
|
645
645
|
"title_connect_flow": "استقبل المدفوعات من تاب",
|
|
646
|
+
"title_commercial_registration_extract": "مستخرج السجل التجاري",
|
|
646
647
|
"title_license_certificate": "السجل التجاري للمنشأة",
|
|
647
648
|
"title_signature_file": "صورة من التوقيع",
|
|
648
649
|
"title_tax_document": "وثيقة الضرائب",
|
|
@@ -668,6 +668,7 @@
|
|
|
668
668
|
"title_brand_logo": "Brand Logo",
|
|
669
669
|
"title_civil_id": "Civil ID Attachment",
|
|
670
670
|
"title_connect_flow": "Connect Tap",
|
|
671
|
+
"title_commercial_registration_extract": "Commercial registration extract",
|
|
671
672
|
"title_license_certificate": "License Certificate",
|
|
672
673
|
"title_signature_file": "Signature Attachment",
|
|
673
674
|
"title_tax_document": "Tax document",
|
|
@@ -304,18 +304,43 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
|
|
|
304
304
|
});
|
|
305
305
|
});
|
|
306
306
|
});
|
|
307
|
+
var uploadEntityDocumentByPurpose = function (documents, entityId, purpose, imageIds) { return __awaiter(void 0, void 0, void 0, function () {
|
|
308
|
+
var existingDocument, documentBody_1, documentBody;
|
|
309
|
+
return __generator(this, function (_a) {
|
|
310
|
+
if ((imageIds || []).length === 0)
|
|
311
|
+
return [2, undefined];
|
|
312
|
+
existingDocument = getRecentDocumentBasedOnPurpose(documents, purpose);
|
|
313
|
+
if (existingDocument === null || existingDocument === void 0 ? void 0 : existingDocument.id) {
|
|
314
|
+
documentBody_1 = {
|
|
315
|
+
id: existingDocument.id,
|
|
316
|
+
images: imageIds
|
|
317
|
+
};
|
|
318
|
+
return [2, API.documentService.addFilesToExistingDocument(documentBody_1)];
|
|
319
|
+
}
|
|
320
|
+
documentBody = {
|
|
321
|
+
entity_id: entityId,
|
|
322
|
+
documents: [
|
|
323
|
+
{
|
|
324
|
+
type: purpose,
|
|
325
|
+
images: imageIds
|
|
326
|
+
}
|
|
327
|
+
]
|
|
328
|
+
};
|
|
329
|
+
return [2, API.documentService.updateDocumentInfo(documentBody)];
|
|
330
|
+
});
|
|
331
|
+
}); };
|
|
307
332
|
export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (_a, thunkApi) {
|
|
308
333
|
var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
|
|
309
334
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
310
|
-
var _b, settings, entity, entityRes, _c, id, data_status, data_verification, documents, issuingDate, expiryDate, licenseType, licenseNumber, articleId, unifiedNumber, legalName, certificateId, entityType, issueDate, expDate, isFL, isLegalNameENNonEditable, isLegalNameARNonEditable, isLicenseTypeNonEditable, isEntityTypeNonEditable, isLicenseNumberNonEditable, isUnifiedNumberNonEditable, isIssuingDateNonEditable, isExpiryDateNonEditable, isDocumentsNonEditable, isAOAFileNonEditable, isEntityTypeVerified, isLicenseNonEditable, isLicenseAvailable, payload, entityData, documentData, activityList, entity_1, documentResponse,
|
|
311
|
-
var
|
|
312
|
-
return __generator(this, function (
|
|
313
|
-
switch (
|
|
335
|
+
var _b, settings, entity, entityRes, _c, id, data_status, data_verification, documents, issuingDate, expiryDate, licenseType, licenseNumber, articleId, unifiedNumber, legalName, certificateId, commercialRegistrationExtractId, entityType, issueDate, expDate, isFL, isLegalNameENNonEditable, isLegalNameARNonEditable, isLicenseTypeNonEditable, isEntityTypeNonEditable, isLicenseNumberNonEditable, isUnifiedNumberNonEditable, isIssuingDateNonEditable, isExpiryDateNonEditable, isDocumentsNonEditable, isAOAFileNonEditable, isEntityTypeVerified, isLicenseNonEditable, isLicenseAvailable, payload, entityData, documentData, activityList, entity_1, documentResponse, documentUploads, _i, documentUploads_1, _d, purpose, imageIds, response, entity_2, list;
|
|
336
|
+
var _e, _f;
|
|
337
|
+
return __generator(this, function (_g) {
|
|
338
|
+
switch (_g.label) {
|
|
314
339
|
case 0:
|
|
315
340
|
_b = thunkApi.getState(), settings = _b.settings, entity = _b.entity;
|
|
316
341
|
entityRes = (entity.data.verify.responseBody || {}).entity;
|
|
317
342
|
_c = entityRes || {}, id = _c.id, data_status = _c.data_status, data_verification = _c.data_verification, documents = _c.documents;
|
|
318
|
-
issuingDate = formData.issuingDate, expiryDate = formData.expiryDate, licenseType = formData.licenseType, licenseNumber = formData.licenseNumber, articleId = formData.articleId, unifiedNumber = formData.unifiedNumber, legalName = formData.legalName, certificateId = formData.certificateId, entityType = formData.entityType;
|
|
343
|
+
issuingDate = formData.issuingDate, expiryDate = formData.expiryDate, licenseType = formData.licenseType, licenseNumber = formData.licenseNumber, articleId = formData.articleId, unifiedNumber = formData.unifiedNumber, legalName = formData.legalName, certificateId = formData.certificateId, commercialRegistrationExtractId = formData.commercialRegistrationExtractId, entityType = formData.entityType;
|
|
319
344
|
issueDate = issuingDate && new Date(issuingDate).getTime();
|
|
320
345
|
expDate = expiryDate && new Date(expiryDate).getTime();
|
|
321
346
|
isFL = licenseType === BusinessType.FL;
|
|
@@ -358,48 +383,44 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
|
|
|
358
383
|
if (!isDirty) return [3, 2];
|
|
359
384
|
return [4, API.entityService.updateEntity(payload)];
|
|
360
385
|
case 1:
|
|
361
|
-
entity_1 = (
|
|
386
|
+
entity_1 = (_g.sent()).entity;
|
|
362
387
|
entityData = entity_1;
|
|
363
|
-
|
|
388
|
+
_g.label = 2;
|
|
364
389
|
case 2:
|
|
365
390
|
documentResponse = undefined;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
391
|
+
if (!!isDocumentsNonEditable) return [3, 6];
|
|
392
|
+
documentUploads = [
|
|
393
|
+
{ purpose: DocumentPurpose.CR, imageIds: certificateId },
|
|
394
|
+
{ purpose: DocumentPurpose.COMMERCIAL_REGISTRATION_EXTRACT, imageIds: commercialRegistrationExtractId }
|
|
395
|
+
];
|
|
396
|
+
_i = 0, documentUploads_1 = documentUploads;
|
|
397
|
+
_g.label = 3;
|
|
374
398
|
case 3:
|
|
375
|
-
|
|
376
|
-
|
|
399
|
+
if (!(_i < documentUploads_1.length)) return [3, 6];
|
|
400
|
+
_d = documentUploads_1[_i], purpose = _d.purpose, imageIds = _d.imageIds;
|
|
401
|
+
return [4, uploadEntityDocumentByPurpose(documents, id || '', purpose, imageIds)];
|
|
377
402
|
case 4:
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
type: DocumentPurpose.CR,
|
|
383
|
-
images: certificateId
|
|
384
|
-
}
|
|
385
|
-
]
|
|
386
|
-
};
|
|
387
|
-
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
403
|
+
response = _g.sent();
|
|
404
|
+
if (response)
|
|
405
|
+
documentResponse = response;
|
|
406
|
+
_g.label = 5;
|
|
388
407
|
case 5:
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
case 6:
|
|
408
|
+
_i++;
|
|
409
|
+
return [3, 3];
|
|
410
|
+
case 6:
|
|
411
|
+
if (!documentResponse) return [3, 8];
|
|
412
|
+
return [4, API.entityService.retrieveEntity(id)];
|
|
392
413
|
case 7:
|
|
393
|
-
entity_2 = (
|
|
414
|
+
entity_2 = (_g.sent()).entity;
|
|
394
415
|
entityData = entity_2;
|
|
395
416
|
documentData = documentResponse;
|
|
396
|
-
|
|
417
|
+
_g.label = 8;
|
|
397
418
|
case 8: return [4, API.dataService.getActivitiesIsIc()];
|
|
398
419
|
case 9:
|
|
399
|
-
list = (
|
|
420
|
+
list = (_g.sent()).list;
|
|
400
421
|
activityList = list;
|
|
401
422
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
402
|
-
(
|
|
423
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
|
|
403
424
|
return [2, { data: { entity: entityData, documentData: documentData, activityList: activityList }, formData: originalFormData }];
|
|
404
425
|
}
|
|
405
426
|
});
|
|
@@ -754,7 +775,7 @@ export var entitySlice = createSlice({
|
|
|
754
775
|
state.error = null;
|
|
755
776
|
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
756
777
|
var _b = data || {}, entity = _b.entity, activityList = _b.activityList, rest = __rest(_b, ["entity", "activityList"]);
|
|
757
|
-
state.data.entityNameData = __assign(__assign({}, formData), { certificateId: undefined });
|
|
778
|
+
state.data.entityNameData = __assign(__assign({}, formData), { certificateId: undefined, commercialRegistrationExtractId: undefined });
|
|
758
779
|
state.data.entityNameData.responseBody = __assign(__assign({}, state.data.entityNameData.responseBody), { rest: rest });
|
|
759
780
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: entity, activityList: activityList });
|
|
760
781
|
if (entity === null || entity === void 0 ? void 0 : entity.activities)
|
|
@@ -91,7 +91,7 @@ var BankDetails = function () {
|
|
|
91
91
|
var defaultBankFiles = React.useMemo(function () {
|
|
92
92
|
if (!document)
|
|
93
93
|
return [];
|
|
94
|
-
return getFileDetailsFromDocument([document],
|
|
94
|
+
return getFileDetailsFromDocument([document], [DocumentPurpose.BANK_STATEMENT, DocumentPurpose.BANK_CERTIFICATE]);
|
|
95
95
|
}, [document]);
|
|
96
96
|
var originalReadOnly = useFormReadOnly(methods, { bankStatementId: defaultBankFiles });
|
|
97
97
|
var noneEditable = useDataNoneEditable(data_status, [
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DocumentPurpose, FileDetails } from '../../../../@types';
|
|
3
|
+
interface EntityDocumentUploadProps {
|
|
4
|
+
name: string;
|
|
5
|
+
labelKey: string;
|
|
6
|
+
purpose: DocumentPurpose;
|
|
7
|
+
show: boolean;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
defaultFiles?: Array<FileDetails>;
|
|
10
|
+
}
|
|
11
|
+
declare const EntityDocumentUpload: ({ name, labelKey, purpose, show, readOnly, defaultFiles }: EntityDocumentUploadProps) => JSX.Element;
|
|
12
|
+
export default EntityDocumentUpload;
|
package/build/features/entity/screens/EntityName/{LicenseCertificate.js → EntityDocumentUpload.js}
RENAMED
|
@@ -15,9 +15,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import Collapse from '../../../../components/Collapse';
|
|
18
|
-
import { DocumentPurpose } from '../../../../@types';
|
|
19
18
|
import { FileType } from '../../../../constants';
|
|
20
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
21
20
|
import { hasVerifiedValue } from '../../../../utils';
|
|
22
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
22
|
import { clearError, entitySelector, uploadingStatus } from '../../../app/entity/entityStore';
|
|
@@ -28,27 +27,23 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
28
27
|
marginBlockStart: theme.spacing(3)
|
|
29
28
|
});
|
|
30
29
|
});
|
|
31
|
-
var
|
|
30
|
+
var EntityDocumentUpload = function (_a) {
|
|
32
31
|
var _b;
|
|
33
|
-
var show = _a.show, readOnly = _a.readOnly, defaultFiles = _a.defaultFiles;
|
|
32
|
+
var name = _a.name, labelKey = _a.labelKey, purpose = _a.purpose, show = _a.show, readOnly = _a.readOnly, defaultFiles = _a.defaultFiles;
|
|
34
33
|
var t = useTranslation().t;
|
|
34
|
+
var st = useSanitizedTranslation();
|
|
35
35
|
var control = useFormContext().control;
|
|
36
36
|
var dispatch = useAppDispatch();
|
|
37
|
-
var
|
|
37
|
+
var fieldControl = useController({ name: name, control: control });
|
|
38
38
|
var _c = useAppSelector(entitySelector), loading = _c.loading, error = _c.error, data = _c.data;
|
|
39
39
|
var data_verification = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) || {}).data_verification;
|
|
40
|
-
var uploadedIds =
|
|
40
|
+
var uploadedIds = fieldControl.field.value;
|
|
41
41
|
var isDocumentVerified = React.useMemo(function () { var _a; return !!((_a = defaultFiles === null || defaultFiles === void 0 ? void 0 : defaultFiles[0]) === null || _a === void 0 ? void 0 : _a.docId) && hasVerifiedValue(data_verification, "documents.".concat(defaultFiles[0].docId)); }, [data_verification]);
|
|
42
|
-
var
|
|
42
|
+
var handleChange = function (ids) {
|
|
43
43
|
if (error)
|
|
44
44
|
dispatch(clearError());
|
|
45
|
-
|
|
45
|
+
fieldControl.field.onChange(ids);
|
|
46
46
|
};
|
|
47
|
-
|
|
48
|
-
if (error)
|
|
49
|
-
dispatch(clearError());
|
|
50
|
-
certificateIdControl.field.onChange(ids);
|
|
51
|
-
};
|
|
52
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'certificateId', control: control, label: t('title_license_certificate'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_certificate'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleLicenseCertificateChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.CR, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES, isVerified: !(uploadedIds === null || uploadedIds === void 0 ? void 0 : uploadedIds.length) && isDocumentVerified }) }) })));
|
|
47
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: name, control: control, label: st(labelKey), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_certificate'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleChange, isSubmitting: loading, onDeleteFile: handleChange, maxLimit: 4, defaultFiles: defaultFiles, purpose: purpose, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES, isVerified: !(uploadedIds === null || uploadedIds === void 0 ? void 0 : uploadedIds.length) && isDocumentVerified }) }) })));
|
|
53
48
|
};
|
|
54
|
-
export default
|
|
49
|
+
export default EntityDocumentUpload;
|
|
@@ -31,8 +31,8 @@ import IssuingDate from './IssuingDate';
|
|
|
31
31
|
import ExpiryDate from './ExpiryDate';
|
|
32
32
|
import EntityTypeList from './EntityTypeList';
|
|
33
33
|
import UnifiedNumber from './UnifiedNumber';
|
|
34
|
-
import LicenseCertificate from './LicenseCertificate';
|
|
35
34
|
import Article from './Article';
|
|
35
|
+
import EntityDocumentUpload from './EntityDocumentUpload';
|
|
36
36
|
var FormStyled = styled(Form)(function () { return ({
|
|
37
37
|
display: 'flex',
|
|
38
38
|
flexDirection: 'column'
|
|
@@ -47,7 +47,7 @@ var EntityName = function (_a) {
|
|
|
47
47
|
var isAr = useLanguage().isAr;
|
|
48
48
|
var t = useTranslation().t;
|
|
49
49
|
var dispatch = useAppDispatch();
|
|
50
|
-
var _j = data.entityNameData, legalName = _j.legalName, licenseNumber = _j.licenseNumber, licenseType = _j.licenseType, entityType = _j.entityType, issuingDate = _j.issuingDate, expiryDate = _j.expiryDate, unifiedNumber = _j.unifiedNumber, certificateId = _j.certificateId, articleId = _j.articleId;
|
|
50
|
+
var _j = data.entityNameData, legalName = _j.legalName, licenseNumber = _j.licenseNumber, licenseType = _j.licenseType, entityType = _j.entityType, issuingDate = _j.issuingDate, expiryDate = _j.expiryDate, unifiedNumber = _j.unifiedNumber, certificateId = _j.certificateId, commercialRegistrationExtractId = _j.commercialRegistrationExtractId, articleId = _j.articleId;
|
|
51
51
|
var country_code = settingsData.businessCountry.iso2;
|
|
52
52
|
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
53
53
|
var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
|
|
@@ -83,6 +83,7 @@ var EntityName = function (_a) {
|
|
|
83
83
|
expiryDate: expiryDate,
|
|
84
84
|
unifiedNumber: unifiedNumber,
|
|
85
85
|
certificateId: certificateId,
|
|
86
|
+
commercialRegistrationExtractId: commercialRegistrationExtractId,
|
|
86
87
|
articleId: articleId
|
|
87
88
|
},
|
|
88
89
|
mode: 'onChange'
|
|
@@ -91,6 +92,7 @@ var EntityName = function (_a) {
|
|
|
91
92
|
var isEntityTypeFL = ((_b = watch('entityType')) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()) === BusinessType.FL;
|
|
92
93
|
useSetFromDefaultValues(methods, data.entityNameData, true);
|
|
93
94
|
var defaultCertificateFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.CR); }, [documents]);
|
|
95
|
+
var defaultCommercialRegistrationExtractFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.COMMERCIAL_REGISTRATION_EXTRACT); }, [documents]);
|
|
94
96
|
var defaultArticleFile = React.useMemo(function () { return AOA_file && __assign(__assign({}, AOA_file), { docId: id }); }, [AOA_file]);
|
|
95
97
|
var issueDateRes = (license === null || license === void 0 ? void 0 : license.issuing_date) && convertToEnglishDateFormat(new Date(license.issuing_date));
|
|
96
98
|
var expDateRes = (license === null || license === void 0 ? void 0 : license.expiry_date) && convertToEnglishDateFormat(new Date(license.expiry_date));
|
|
@@ -104,7 +106,11 @@ var EntityName = function (_a) {
|
|
|
104
106
|
unifiedNumber: (_c = license === null || license === void 0 ? void 0 : license.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number,
|
|
105
107
|
articleId: defaultArticleFile === null || defaultArticleFile === void 0 ? void 0 : defaultArticleFile.id
|
|
106
108
|
}).isDirty;
|
|
107
|
-
var originalReadOnly = useFormReadOnly(methods, {
|
|
109
|
+
var originalReadOnly = useFormReadOnly(methods, {
|
|
110
|
+
certificateId: defaultCertificateFiles,
|
|
111
|
+
commercialRegistrationExtractId: defaultCommercialRegistrationExtractFiles,
|
|
112
|
+
articleId: defaultArticleFile
|
|
113
|
+
});
|
|
108
114
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
109
115
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
110
116
|
var dataVerified = useDataVerified(data_verification, [
|
|
@@ -159,6 +165,6 @@ var EntityName = function (_a) {
|
|
|
159
165
|
var showExpiryDate = isSACountry ? !isCR : true;
|
|
160
166
|
var showUnifiedNumber = isSACountry ? !isEntityTypeFL : false;
|
|
161
167
|
var disableBack = settingsData.appConfig.mode === 'content';
|
|
162
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified }), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl && showExpiryDate }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(
|
|
168
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified }), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl && showExpiryDate }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(EntityDocumentUpload, { name: 'certificateId', labelKey: 'title_license_certificate', purpose: DocumentPurpose.CR, show: isSACountry ? false : !isKWCountry || isCR, readOnly: readOnly['certificateId'] || noneEditable['documents'], defaultFiles: defaultCertificateFiles }), _jsx(EntityDocumentUpload, { name: 'commercialRegistrationExtractId', labelKey: 'title_commercial_registration_extract', purpose: DocumentPurpose.COMMERCIAL_REGISTRATION_EXTRACT, show: isKWCountry, readOnly: readOnly['commercialRegistrationExtractId'] || noneEditable['documents'], defaultFiles: defaultCommercialRegistrationExtractFiles }), _jsx(Article, { defaultFile: defaultArticleFile, show: !isSACountry, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
163
169
|
};
|
|
164
170
|
export default EntityName;
|
|
@@ -9,6 +9,7 @@ export declare const EntityNameValidationSchema: (noneEditable: NonEditableMap)
|
|
|
9
9
|
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
10
10
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
11
11
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
12
|
+
commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
12
13
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | 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
|
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -19,6 +20,7 @@ export declare const EntityNameValidationSchema: (noneEditable: NonEditableMap)
|
|
|
19
20
|
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
20
21
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
21
22
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
23
|
+
commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
22
24
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
23
25
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
26
|
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -29,6 +31,7 @@ export declare const EntityNameValidationSchema: (noneEditable: NonEditableMap)
|
|
|
29
31
|
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
30
32
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
31
33
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
34
|
+
commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
32
35
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
33
36
|
}>>>;
|
|
34
37
|
export declare const EntityNameKWValidationSchema: (noneEditable: NonEditableMap) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -39,6 +42,7 @@ export declare const EntityNameKWValidationSchema: (noneEditable: NonEditableMap
|
|
|
39
42
|
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
40
43
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
41
44
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
45
|
+
commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
42
46
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
43
47
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
44
48
|
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -48,6 +52,7 @@ export declare const EntityNameKWValidationSchema: (noneEditable: NonEditableMap
|
|
|
48
52
|
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
49
53
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
50
54
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
55
|
+
commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
51
56
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
52
57
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
53
58
|
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -57,6 +62,7 @@ export declare const EntityNameKWValidationSchema: (noneEditable: NonEditableMap
|
|
|
57
62
|
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
58
63
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
59
64
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
65
|
+
commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
60
66
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
61
67
|
}>>>;
|
|
62
68
|
export declare const EntityNameOtherCountryValidationSchema: (noneEditable: NonEditableMap) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -67,6 +73,7 @@ export declare const EntityNameOtherCountryValidationSchema: (noneEditable: NonE
|
|
|
67
73
|
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
68
74
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
69
75
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
76
|
+
commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
70
77
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
71
78
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
72
79
|
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -76,6 +83,7 @@ export declare const EntityNameOtherCountryValidationSchema: (noneEditable: NonE
|
|
|
76
83
|
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
77
84
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
78
85
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
86
|
+
commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
79
87
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
80
88
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
81
89
|
legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -85,6 +93,7 @@ export declare const EntityNameOtherCountryValidationSchema: (noneEditable: NonE
|
|
|
85
93
|
issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
86
94
|
expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
87
95
|
certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
96
|
+
commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
88
97
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
89
98
|
}>>>;
|
|
90
99
|
export {};
|
|
@@ -43,6 +43,7 @@ export var EntityNameValidationSchema = function (noneEditable) {
|
|
|
43
43
|
issuingDate: noneEditable['license.issuing_date'] ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
|
|
44
44
|
expiryDate: yup.string().optional(),
|
|
45
45
|
certificateId: yup.array().optional(),
|
|
46
|
+
commercialRegistrationExtractId: yup.array().optional(),
|
|
46
47
|
articleId: yup.string().optional()
|
|
47
48
|
});
|
|
48
49
|
};
|
|
@@ -88,6 +89,7 @@ export var EntityNameKWValidationSchema = function (noneEditable) {
|
|
|
88
89
|
issuingDate: noneEditable['license.issuing_date'] ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
|
|
89
90
|
expiryDate: noneEditable['license.expiry_date'] ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
|
|
90
91
|
certificateId: yup.array().optional(),
|
|
92
|
+
commercialRegistrationExtractId: yup.array().optional(),
|
|
91
93
|
articleId: yup.string().optional()
|
|
92
94
|
});
|
|
93
95
|
};
|
|
@@ -130,6 +132,7 @@ export var EntityNameOtherCountryValidationSchema = function (noneEditable) {
|
|
|
130
132
|
issuingDate: noneEditable['license.issuing_date'] ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
|
|
131
133
|
expiryDate: noneEditable['license.expiry_date'] ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
|
|
132
134
|
certificateId: yup.array().optional(),
|
|
135
|
+
commercialRegistrationExtractId: yup.array().optional(),
|
|
133
136
|
articleId: yup.string().optional()
|
|
134
137
|
});
|
|
135
138
|
};
|
package/build/utils/array.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare const fixBrandList: (items: Array<{
|
|
|
62
62
|
}[];
|
|
63
63
|
export declare const findFirstId: (items: Array<SaleChannel>) => string;
|
|
64
64
|
export declare const sortActivitiesByName: (items: Array<ActivityParams>, path: string) => ActivityParams[];
|
|
65
|
-
export declare const getFileDetailsFromDocument: (documents: Array<any>, purpose: string) => any;
|
|
65
|
+
export declare const getFileDetailsFromDocument: (documents: Array<any>, purpose: string | Array<string>) => any;
|
|
66
66
|
export declare const getRecentDocumentBasedOnPurpose: (documents: Array<any>, purpose: string) => any;
|
|
67
67
|
export declare const findInArrayOrSubArray: (items: Array<any>, value: string | number) => null;
|
|
68
68
|
export declare const groupSectionWithSelectedActivitiesAtBeginning: (sections: Array<ActivitiesIsIc>, selectedActivities: Array<Activity>) => ActivitiesIsIc[];
|
package/build/utils/array.js
CHANGED
|
@@ -191,8 +191,9 @@ export var sortActivitiesByName = function (items, path) {
|
|
|
191
191
|
export var getFileDetailsFromDocument = function (documents, purpose) {
|
|
192
192
|
if ((documents || []).length === 0)
|
|
193
193
|
return [];
|
|
194
|
+
var purposes = Array.isArray(purpose) ? purpose : [purpose];
|
|
194
195
|
return documents.reduce(function (acc, document) {
|
|
195
|
-
var fileDetails = (document.file_details || []).filter(function (file) { return
|
|
196
|
+
var fileDetails = (document.file_details || []).filter(function (file) { return purposes.includes(file.purpose); });
|
|
196
197
|
return acc.concat(fileDetails.map(function (f) { return (__assign(__assign({}, f), { docId: document.id })); }));
|
|
197
198
|
}, []);
|
|
198
199
|
};
|
|
@@ -200,7 +201,7 @@ export var getRecentDocumentBasedOnPurpose = function (documents, purpose) {
|
|
|
200
201
|
if ((documents || []).length === 0)
|
|
201
202
|
return [];
|
|
202
203
|
var filteredByPurpose = documents.filter(function (doc) {
|
|
203
|
-
return
|
|
204
|
+
return doc.type === purpose;
|
|
204
205
|
});
|
|
205
206
|
if ((filteredByPurpose || []).length > 0) {
|
|
206
207
|
return filteredByPurpose.sort(function (a, b) { return b.created - a.created; })[0];
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { FileDetails } from '../../../../@types';
|
|
3
|
-
interface LicenseCertificateProps {
|
|
4
|
-
show: boolean;
|
|
5
|
-
readOnly?: boolean;
|
|
6
|
-
defaultFiles?: Array<FileDetails>;
|
|
7
|
-
}
|
|
8
|
-
declare const LicenseCertificate: ({ show, readOnly, defaultFiles }: LicenseCertificateProps) => JSX.Element;
|
|
9
|
-
export default LicenseCertificate;
|