@tap-payments/auth-jsconnect 2.12.13-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 +2 -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/connectExpress/connectExpressStore.js +19 -16
- package/build/features/app/entity/entityStore.js +56 -35
- package/build/features/bank/screens/BankDetails/BankDetails.js +1 -1
- package/build/features/connectExpress/ConnectExpress.js +4 -4
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +9 -9
- package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +7 -6
- package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +8 -8
- package/build/features/connectExpress/screens/NIDMissed/NID.js +5 -6
- package/build/features/connectExpress/screens/OTP/OTP.js +7 -8
- package/build/features/connectExpress/screens/OTP/OTPInput.js +5 -8
- 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/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useAppConfig.js +1 -1
- package/build/hooks/useIsEmailAuth.d.ts +1 -0
- package/build/hooks/useIsEmailAuth.js +11 -0
- package/build/utils/array.d.ts +1 -1
- package/build/utils/array.js +3 -2
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +3 -0
- package/package.json +1 -1
- package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +0 -9
package/build/@types/app.d.ts
CHANGED
|
@@ -236,6 +236,7 @@ export interface LibConfig extends LibCallbacks {
|
|
|
236
236
|
closeButton?: boolean;
|
|
237
237
|
disableNafath?: boolean;
|
|
238
238
|
disablePaci?: boolean;
|
|
239
|
+
emailAuth?: boolean;
|
|
239
240
|
dialogStartTransition?: 'left' | 'right' | 'up' | 'down';
|
|
240
241
|
dialogEndTransition?: 'left' | 'right' | 'up' | 'down';
|
|
241
242
|
};
|
|
@@ -420,6 +421,7 @@ export declare enum IndividualType {
|
|
|
420
421
|
}
|
|
421
422
|
export declare enum DocumentPurpose {
|
|
422
423
|
CR = "commercial_registration",
|
|
424
|
+
COMMERCIAL_REGISTRATION_EXTRACT = "commercial_registration_extract",
|
|
423
425
|
ARTICLE_ASSOCIATION = "article_of_association",
|
|
424
426
|
BANK_STATEMENT = "bank_statement",
|
|
425
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",
|
|
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } fro
|
|
|
61
61
|
import API, { setAuthSessionToGlobalHeaders } from '../../../api';
|
|
62
62
|
import { ADD_NEW_ENTITY, COLLECT_DOB_INFO_NAFATH, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH, SCOPE_MERCHANT } from '../../../constants';
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
64
|
-
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW,
|
|
64
|
+
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isEmailAuthEnabled, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } from '../../../utils';
|
|
65
65
|
export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateBusinessCountryAsync', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
66
|
var connectExpress, payload, data;
|
|
67
67
|
return __generator(this, function (_a) {
|
|
@@ -81,17 +81,17 @@ export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateB
|
|
|
81
81
|
});
|
|
82
82
|
}); });
|
|
83
83
|
export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retrieveLeadIdentityByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
84
|
-
var settings, countryCode, showBoard, data, _a, country_code, contact, phone, status, board_id, board_info_id, isRegistered, screen_1, screen_2, _b, boardInfo, boardData, error_1;
|
|
85
|
-
var _c, _d, _e, _f, _g, _h;
|
|
86
|
-
return __generator(this, function (
|
|
87
|
-
switch (
|
|
84
|
+
var settings, countryCode, showBoard, data, _a, country_code, contact, phone, status, board_id, board_info_id, emailAuth, isRegistered, screen_1, screen_2, _b, boardInfo, boardData, error_1;
|
|
85
|
+
var _c, _d, _e, _f, _g, _h, _j;
|
|
86
|
+
return __generator(this, function (_k) {
|
|
87
|
+
switch (_k.label) {
|
|
88
88
|
case 0:
|
|
89
89
|
settings = thunkApi.getState().settings;
|
|
90
90
|
countryCode = settings.data.businessCountry;
|
|
91
91
|
showBoard = settings.data.appConfig.showBoard;
|
|
92
92
|
return [4, API.leadService.retrieveLeadIdentity(leadId)];
|
|
93
93
|
case 1:
|
|
94
|
-
data =
|
|
94
|
+
data = _k.sent();
|
|
95
95
|
_a = data || {}, country_code = _a.country_code, contact = _a.contact;
|
|
96
96
|
if (country_code)
|
|
97
97
|
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
@@ -103,20 +103,23 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
|
|
|
103
103
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_BUSINESS_COUNTRY_STEP'));
|
|
104
104
|
return [2, { data: data, countryCode: countryCode }];
|
|
105
105
|
}
|
|
106
|
+
emailAuth = (_d = settings.data.appConfig.features) === null || _d === void 0 ? void 0 : _d.emailAuth;
|
|
106
107
|
isRegistered = (status === null || status === void 0 ? void 0 : status.toLowerCase()) === 'registered';
|
|
107
108
|
if (!isRegistered && !(data === null || data === void 0 ? void 0 : data.identification) && phone) {
|
|
108
|
-
screen_1 =
|
|
109
|
+
screen_1 = isEmailAuthEnabled(emailAuth, country_code || ((_e = settings.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2))
|
|
110
|
+
? 'CONNECT_EXPRESS_EMAIL_STEP'
|
|
111
|
+
: 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
109
112
|
thunkApi.dispatch(handleCurrentActiveScreen(screen_1));
|
|
110
113
|
return [2, { data: data, countryCode: countryCode }];
|
|
111
114
|
}
|
|
112
115
|
if (!isRegistered && country_code) {
|
|
113
116
|
screen_2 = 'CONNECT_EXPRESS_NID_STEP';
|
|
114
117
|
if (!isSA(data.country_code))
|
|
115
|
-
screen_2 =
|
|
118
|
+
screen_2 = isEmailAuthEnabled(emailAuth, data.country_code) ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
116
119
|
thunkApi.dispatch(handleCurrentActiveScreen(screen_2));
|
|
117
120
|
return [2, { data: data, countryCode: countryCode }];
|
|
118
121
|
}
|
|
119
|
-
if (!isRegistered &&
|
|
122
|
+
if (!isRegistered && isEmailAuthEnabled(emailAuth, settings.data.businessCountry.iso2)) {
|
|
120
123
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_EMAIL_STEP'));
|
|
121
124
|
return [2, { data: data, countryCode: countryCode }];
|
|
122
125
|
}
|
|
@@ -128,11 +131,11 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
|
|
|
128
131
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_NID_STEP'));
|
|
129
132
|
return [2, { data: data, countryCode: countryCode }];
|
|
130
133
|
}
|
|
131
|
-
if ((
|
|
132
|
-
thunkApi.dispatch(storeAuthId((
|
|
134
|
+
if ((_f = data === null || data === void 0 ? void 0 : data.identification) === null || _f === void 0 ? void 0 : _f.authentication_id) {
|
|
135
|
+
thunkApi.dispatch(storeAuthId((_g = data === null || data === void 0 ? void 0 : data.identification) === null || _g === void 0 ? void 0 : _g.authentication_id));
|
|
133
136
|
}
|
|
134
137
|
if (isRegistered && !showBoard) {
|
|
135
|
-
(
|
|
138
|
+
(_j = (_h = settings.data.appConfig).onFlowCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, data);
|
|
136
139
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP'));
|
|
137
140
|
return [2, { data: data, countryCode: countryCode }];
|
|
138
141
|
}
|
|
@@ -141,19 +144,19 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
|
|
|
141
144
|
return [2, { data: data, countryCode: countryCode }];
|
|
142
145
|
}
|
|
143
146
|
if (!(isRegistered && board_id && board_info_id)) return [3, 5];
|
|
144
|
-
|
|
147
|
+
_k.label = 2;
|
|
145
148
|
case 2:
|
|
146
|
-
|
|
149
|
+
_k.trys.push([2, 4, , 5]);
|
|
147
150
|
return [4, Promise.all([
|
|
148
151
|
API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id }),
|
|
149
152
|
API.boardService.retrieveBoardDetails(board_id)
|
|
150
153
|
])];
|
|
151
154
|
case 3:
|
|
152
|
-
_b =
|
|
155
|
+
_b = _k.sent(), boardInfo = _b[0], boardData = _b[1];
|
|
153
156
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP'));
|
|
154
157
|
return [2, { data: data, countryCode: countryCode, boardInfo: boardInfo, boardData: boardData }];
|
|
155
158
|
case 4:
|
|
156
|
-
error_1 =
|
|
159
|
+
error_1 = _k.sent();
|
|
157
160
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP'));
|
|
158
161
|
return [2, { data: data, countryCode: countryCode }];
|
|
159
162
|
case 5: return [2, { data: data, countryCode: countryCode }];
|
|
@@ -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, [
|
|
@@ -67,7 +67,7 @@ import { store } from '../../app/store';
|
|
|
67
67
|
import { connectExpressSelector, setIsLeadIdPassed, setLeadId, retrieveLeadIdentityByIdAsync, setDefaultCountryCode, clearError, createAuthSessionExpiredAsync } from '../app/connectExpress/connectExpressStore';
|
|
68
68
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
69
69
|
import Collapse from '../../components/Collapse';
|
|
70
|
-
import { isKW,
|
|
70
|
+
import { isKW, isEmailAuthEnabled, findOrCreateElementAndInject, sendPageView, isOtherThanKWOrSA, initializeGTM, sendCustomEventToGTM, sendCustomDimension } from '../../utils';
|
|
71
71
|
import { CONNECT_EXPRESS_SCREENS_NAVIGATION } from '../../constants';
|
|
72
72
|
import { connectExpressFeatureScreens } from '../featuresScreens';
|
|
73
73
|
import Background from '../shared/Background';
|
|
@@ -123,7 +123,7 @@ var ConnectExpress = memo(function (_a) {
|
|
|
123
123
|
}
|
|
124
124
|
}, [data.businessCountry]);
|
|
125
125
|
React.useEffect(function () {
|
|
126
|
-
var _a, _b, _c;
|
|
126
|
+
var _a, _b, _c, _d;
|
|
127
127
|
if (settingLoading || !props.open)
|
|
128
128
|
return;
|
|
129
129
|
if (!data.isValidOperator) {
|
|
@@ -146,10 +146,10 @@ var ConnectExpress = memo(function (_a) {
|
|
|
146
146
|
dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_BUSINESS_COUNTRY_STEP'));
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
if (((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2) &&
|
|
149
|
+
if (((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2) && isEmailAuthEnabled((_c = appConfig.features) === null || _c === void 0 ? void 0 : _c.emailAuth, data.businessCountry.iso2)) {
|
|
150
150
|
dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_EMAIL_STEP'));
|
|
151
151
|
}
|
|
152
|
-
else if (((
|
|
152
|
+
else if (((_d = data.businessCountry) === null || _d === void 0 ? void 0 : _d.iso2) && (isKW(data.businessCountry.iso2) || isOtherThanKWOrSA(data.businessCountry.iso2))) {
|
|
153
153
|
dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_MOBILE_STEP'));
|
|
154
154
|
}
|
|
155
155
|
}, [data.isValidOperator, settingLoading]);
|
|
@@ -15,9 +15,9 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import Collapse from '@mui/material/Collapse';
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useIsEmailAuth } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
|
-
import { deepCopy, isKW, isSA,
|
|
20
|
+
import { deepCopy, isKW, isSA, sendCustomEventToGTM } from '../../../../utils';
|
|
21
21
|
import { AuthForType } from '../../../../@types';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -36,16 +36,16 @@ var ListType;
|
|
|
36
36
|
ListType["EntityList"] = "EntityList";
|
|
37
37
|
})(ListType || (ListType = {}));
|
|
38
38
|
var AuthenticationList = function (_a) {
|
|
39
|
-
var _b, _c
|
|
39
|
+
var _b, _c;
|
|
40
40
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
41
|
+
var _d = useAppSelector(connectExpressSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
42
|
+
var _e = data.authenticationData, brandInfo = _e.brandInfo, entityInfo = _e.entityInfo;
|
|
43
|
+
var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
|
|
44
44
|
var brandList = (((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}).brandList;
|
|
45
|
-
var
|
|
45
|
+
var _g = React.useState(false), isAddEntity = _g[0], setIsAddEntity = _g[1];
|
|
46
46
|
var otpData = data.otpData;
|
|
47
47
|
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
48
|
-
var startWithEmail =
|
|
48
|
+
var startWithEmail = useIsEmailAuth();
|
|
49
49
|
React.useEffect(function () {
|
|
50
50
|
sendCustomEventToGTM({
|
|
51
51
|
event: 'Send Event',
|
|
@@ -64,7 +64,7 @@ var AuthenticationList = function (_a) {
|
|
|
64
64
|
var t = useTranslation().t;
|
|
65
65
|
var isAr = useLanguage().isAr;
|
|
66
66
|
var dispatch = useAppDispatch();
|
|
67
|
-
var code = (
|
|
67
|
+
var code = (_c = settingsData.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2;
|
|
68
68
|
var isSACountry = React.useMemo(function () { return isSA(code); }, [code]);
|
|
69
69
|
var onSubmit = function (formData) {
|
|
70
70
|
if (isAddEntity) {
|
|
@@ -53,7 +53,7 @@ import { ScreenContainer } from '../../../shared/Containers';
|
|
|
53
53
|
import BusinessCountry from '../../../shared/BusinessCountry';
|
|
54
54
|
import Button from '../../../shared/Button';
|
|
55
55
|
import Collapse from '../../../../components/Collapse';
|
|
56
|
-
import { findCountryByIso2, isKW,
|
|
56
|
+
import { findCountryByIso2, isKW, isEmailAuthEnabled, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
|
|
57
57
|
import { handleNextScreenStep, handleSetCountryByIso2, settingsSelector } from '../../../../app/settings';
|
|
58
58
|
import { clearError, connectExpressSelector, setDefaultCountryCode, storeIsStartFromBusinessCountry, updateBusinessCountryAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
59
59
|
var BusinessCountryScreen = function (_a) {
|
|
@@ -74,8 +74,9 @@ var BusinessCountryScreen = function (_a) {
|
|
|
74
74
|
}, [settingsData.businessCountry, settingsData.ipCountry]);
|
|
75
75
|
var onSelectCountry = function (iso2) { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
76
|
var countryCode;
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
var _a;
|
|
78
|
+
return __generator(this, function (_b) {
|
|
79
|
+
switch (_b.label) {
|
|
79
80
|
case 0:
|
|
80
81
|
if (!iso2)
|
|
81
82
|
return [2];
|
|
@@ -90,12 +91,12 @@ var BusinessCountryScreen = function (_a) {
|
|
|
90
91
|
if (!data.leadId) return [3, 2];
|
|
91
92
|
return [4, dispatch(updateBusinessCountryAsync(iso2))];
|
|
92
93
|
case 1:
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
_b.sent();
|
|
95
|
+
_b.label = 2;
|
|
95
96
|
case 2:
|
|
96
97
|
if (countryCode)
|
|
97
98
|
dispatch(setDefaultCountryCode(countryCode));
|
|
98
|
-
if (
|
|
99
|
+
if (isEmailAuthEnabled((_a = settingsData.appConfig.features) === null || _a === void 0 ? void 0 : _a.emailAuth, iso2)) {
|
|
99
100
|
dispatch(handleNextScreenStep('CONNECT_EXPRESS_EMAIL_STEP'));
|
|
100
101
|
return [2];
|
|
101
102
|
}
|
package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js
CHANGED
|
@@ -17,8 +17,8 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { useAppDispatch, useAppSelector, useExcludeReadOnlyFelids, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
|
|
19
19
|
import { AuthForType } from '../../../../@types';
|
|
20
|
-
import { useLanguage } from '../../../../hooks';
|
|
21
|
-
import { deepCopy, isKW,
|
|
20
|
+
import { useLanguage, useIsEmailAuth } from '../../../../hooks';
|
|
21
|
+
import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
|
|
22
22
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
23
23
|
import Form from '../../../../components/Form';
|
|
24
24
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -36,16 +36,16 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
36
36
|
justifyContent: 'space-between'
|
|
37
37
|
}); });
|
|
38
38
|
var CollectIndividualInfo = function (_a) {
|
|
39
|
-
var _b
|
|
40
|
-
var
|
|
41
|
-
var
|
|
39
|
+
var _b;
|
|
40
|
+
var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
|
|
41
|
+
var _d = React.useState(false), emailChecking = _d[0], setEmailChecking = _d[1];
|
|
42
42
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
43
|
-
var
|
|
43
|
+
var _e = useAppSelector(connectExpressSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
44
44
|
var dispatch = useAppDispatch();
|
|
45
45
|
var t = useTranslation().t;
|
|
46
46
|
var isAr = useLanguage().isAr;
|
|
47
47
|
var individualData = data.individualData, otpData = data.otpData, responseData = data.responseData;
|
|
48
|
-
var startWithEmail =
|
|
48
|
+
var startWithEmail = useIsEmailAuth();
|
|
49
49
|
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
50
50
|
var startWithNIDMissed = otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
|
|
51
51
|
var contact = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).contact;
|
|
@@ -119,7 +119,7 @@ var CollectIndividualInfo = function (_a) {
|
|
|
119
119
|
var isEmailValid = typeof isEmailAvailable === 'undefined' ? isLeadEmailAvailable : isEmailAvailable;
|
|
120
120
|
var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email;
|
|
121
121
|
var disabled = emailErrChecks || emailChecking || !isEmailValid;
|
|
122
|
-
var emailReadOnly = readOnly['email'] && !((
|
|
122
|
+
var emailReadOnly = readOnly['email'] && !((_b = methods.getFieldState('email').error) === null || _b === void 0 ? void 0 : _b.message) && !methods.getFieldState('email').isDirty;
|
|
123
123
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { readOnly: readOnly['name'], show: !listActive }), _jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: settingsData.countries }), _jsx(Email, { readOnly: emailReadOnly, show: !listActive, fetchingEmail: function (v) { return setEmailChecking(v); }, emailChecking: emailChecking }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
124
124
|
};
|
|
125
125
|
export default React.memo(CollectIndividualInfo);
|
|
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
|
|
|
16
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import { NIDOtherCountryValidationSchema, NIDValidationSchema } from './validation';
|
|
19
|
-
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector, useIsEmailAuth } from '../../../../hooks';
|
|
20
20
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
21
|
import { clearError, connectExpressSelector, createNIDNafathAuthIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
@@ -25,21 +25,20 @@ import { ScreenContainer } from '../../../shared/Containers';
|
|
|
25
25
|
import Collapse from '../../../../components/Collapse';
|
|
26
26
|
import IDNumber from './IDNumber';
|
|
27
27
|
import DOB from './DOB';
|
|
28
|
-
import { deepCopy, isOtherThanKWOrSA
|
|
28
|
+
import { deepCopy, isOtherThanKWOrSA } from '../../../../utils';
|
|
29
29
|
var FormStyled = styled(Form)(function () { return ({
|
|
30
30
|
display: 'flex',
|
|
31
31
|
flexDirection: 'column'
|
|
32
32
|
}); });
|
|
33
33
|
var NID = function (_a) {
|
|
34
|
-
var _b;
|
|
35
|
-
var _c = React.useState(false), collapse = _c[0], setCollapse = _c[1];
|
|
34
|
+
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
36
35
|
var isAr = useLanguage().isAr;
|
|
37
36
|
var dispatch = useAppDispatch();
|
|
38
37
|
var t = useTranslation().t;
|
|
39
38
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
40
|
-
var
|
|
39
|
+
var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
41
40
|
var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
42
|
-
var startWithEmail =
|
|
41
|
+
var startWithEmail = useIsEmailAuth();
|
|
43
42
|
var methods = useForm({
|
|
44
43
|
resolver: yupResolver(isOtherCountry ? NIDOtherCountryValidationSchema : NIDValidationSchema),
|
|
45
44
|
defaultValues: data.nidData,
|
|
@@ -17,13 +17,13 @@ import Text from '../../../../components/Text';
|
|
|
17
17
|
import { clearError, connectExpressSelector, verifyMobileOtpAsync, verifyEmailOtpAsync, resetOTPValue } from '../../../app/connectExpress/connectExpressStore';
|
|
18
18
|
import Button from '../../../shared/Button';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
|
-
import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
21
|
-
import { handlePrevScreenStep
|
|
20
|
+
import { useAppDispatch, useAppSelector, useSanitizedTranslation, useIsEmailAuth } from '../../../../hooks';
|
|
21
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
22
|
import { useLanguage } from '../../../../hooks';
|
|
23
23
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
24
24
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
25
25
|
import Form from '../../../../components/Form';
|
|
26
|
-
import { maskPhone, deepCopy, sendCustomEventToGTM, maskEmail
|
|
26
|
+
import { maskPhone, deepCopy, sendCustomEventToGTM, maskEmail } from '../../../../utils';
|
|
27
27
|
import { OTPValidation } from './validation';
|
|
28
28
|
import OTPInput from './OTPInput';
|
|
29
29
|
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
@@ -46,13 +46,12 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
46
46
|
flexDirection: 'column'
|
|
47
47
|
}); });
|
|
48
48
|
var OTP = function () {
|
|
49
|
-
var _a
|
|
49
|
+
var _a;
|
|
50
50
|
var dispatch = useAppDispatch();
|
|
51
|
-
var
|
|
52
|
-
var settingsData = useAppSelector(settingsSelector).data;
|
|
51
|
+
var _b = useAppSelector(connectExpressSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
53
52
|
var st = useSanitizedTranslation();
|
|
54
53
|
var isAr = useLanguage().isAr;
|
|
55
|
-
var isEmailFlow =
|
|
54
|
+
var isEmailFlow = useIsEmailAuth();
|
|
56
55
|
var methods = useForm({
|
|
57
56
|
resolver: yupResolver(OTPValidation),
|
|
58
57
|
defaultValues: data.otpData,
|
|
@@ -85,7 +84,7 @@ var OTP = function () {
|
|
|
85
84
|
dispatch(handlePrevScreenStep(screen));
|
|
86
85
|
};
|
|
87
86
|
var disabled = !methods.formState.isValid;
|
|
88
|
-
var phone = data.mobileData.mobile ? ((
|
|
87
|
+
var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
|
|
89
88
|
var contactInfo = isEmailFlow ? maskEmail(data.emailData.email) : maskPhone(phone);
|
|
90
89
|
var title = isEmailFlow ? st('otp_email_sent_title') : st('ide_opt_sent_title');
|
|
91
90
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: contactInfo }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: st('next') }))] })) })) }));
|
|
@@ -18,9 +18,8 @@ import { styled } from '@mui/material/styles';
|
|
|
18
18
|
import OTPField from '../../../shared/OTP';
|
|
19
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
20
|
import { resendMobileAuthOTP, resendEmailAuthOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
|
|
21
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
|
-
import { sendCustomEventToGTM
|
|
23
|
-
import { settingsSelector } from '../../../../app/settings';
|
|
21
|
+
import { useAppDispatch, useAppSelector, useIsEmailAuth } from '../../../../hooks';
|
|
22
|
+
import { sendCustomEventToGTM } from '../../../../utils';
|
|
24
23
|
var BoxStyled = styled(Box)(function (_a) {
|
|
25
24
|
var theme = _a.theme;
|
|
26
25
|
return ({
|
|
@@ -30,15 +29,13 @@ var BoxStyled = styled(Box)(function (_a) {
|
|
|
30
29
|
});
|
|
31
30
|
});
|
|
32
31
|
var OTPInput = function (_a) {
|
|
33
|
-
var _b;
|
|
34
|
-
var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
|
|
32
|
+
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
35
33
|
var t = useTranslation().t;
|
|
36
34
|
var dispatch = useAppDispatch();
|
|
37
35
|
var otpControl = useController({ name: 'otp', control: control });
|
|
38
|
-
var
|
|
39
|
-
var settingsData = useAppSelector(settingsSelector).data;
|
|
36
|
+
var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
|
|
40
37
|
var mobileData = data.mobileData, emailData = data.emailData;
|
|
41
|
-
var isEmailFlow =
|
|
38
|
+
var isEmailFlow = useIsEmailAuth();
|
|
42
39
|
var sendEventAskAnotherOTP = function () {
|
|
43
40
|
sendCustomEventToGTM({
|
|
44
41
|
event: 'Send Event',
|
|
@@ -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/hooks/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './useSetFromDefaultValues';
|
|
|
15
15
|
export * from './useCountUp';
|
|
16
16
|
export * from './useCountDown';
|
|
17
17
|
export * from './useCountry';
|
|
18
|
+
export * from './useIsEmailAuth';
|
|
18
19
|
export * from './useVerifyToken';
|
|
19
20
|
export * from './useFormReadOnly';
|
|
20
21
|
export * from './useDataNoneEditable';
|
package/build/hooks/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export * from './useSetFromDefaultValues';
|
|
|
15
15
|
export * from './useCountUp';
|
|
16
16
|
export * from './useCountDown';
|
|
17
17
|
export * from './useCountry';
|
|
18
|
+
export * from './useIsEmailAuth';
|
|
18
19
|
export * from './useVerifyToken';
|
|
19
20
|
export * from './useFormReadOnly';
|
|
20
21
|
export * from './useDataNoneEditable';
|
|
@@ -31,7 +31,7 @@ export var useAppConfig = function (_a) {
|
|
|
31
31
|
var data = useAppSelector(settingsSelector).data;
|
|
32
32
|
var setAppConfig = function () {
|
|
33
33
|
if (!disableSettingFetching) {
|
|
34
|
-
dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey, scope: scope === null || scope === void 0 ? void 0 : scope.toLowerCase(), mode: mode !== null && mode !== void 0 ? mode : 'page', showBoard: showBoard !== null && showBoard !== void 0 ? showBoard : true, features: __assign({ merchantLogo: true, switchLanguage: true, overlay: true, loaderOverlay: true }, features) }, rest)));
|
|
34
|
+
dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey, scope: scope === null || scope === void 0 ? void 0 : scope.toLowerCase(), mode: mode !== null && mode !== void 0 ? mode : 'page', showBoard: showBoard !== null && showBoard !== void 0 ? showBoard : true, features: __assign({ merchantLogo: true, switchLanguage: true, overlay: true, loaderOverlay: true, emailAuth: true }, features) }, rest)));
|
|
35
35
|
}
|
|
36
36
|
dispatch(handleActiveFlowScreens(navigation));
|
|
37
37
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useIsEmailAuth: () => boolean | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useAppSelector } from './useAppSelector';
|
|
3
|
+
import { settingsSelector } from '../app/settings';
|
|
4
|
+
import { isEmailAuthEnabled } from '../utils';
|
|
5
|
+
export var useIsEmailAuth = function () {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
8
|
+
var emailAuth = (_a = settingsData.appConfig.features) === null || _a === void 0 ? void 0 : _a.emailAuth;
|
|
9
|
+
var countryIso2 = (_b = settingsData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2;
|
|
10
|
+
return useMemo(function () { return isEmailAuthEnabled(emailAuth, countryIso2); }, [emailAuth, countryIso2]);
|
|
11
|
+
};
|
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/build/utils/string.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare const isKW: (flag: string) => boolean;
|
|
|
49
49
|
export declare const isSA: (flag: string | undefined) => boolean;
|
|
50
50
|
export declare const isOtherThanKWOrSA: (flag: string) => boolean;
|
|
51
51
|
export declare const isQA: (flag: string | undefined) => boolean;
|
|
52
|
+
export declare const isEmailAuthEnabled: (emailAuth: boolean | undefined, countryIso2: string | undefined) => boolean | undefined;
|
|
52
53
|
export declare const isKWOrSA: (flag: string) => boolean;
|
|
53
54
|
export declare const isLinkedIn: (flag: string) => boolean;
|
|
54
55
|
export declare const isTwitter: (flag: string) => boolean;
|
package/build/utils/string.js
CHANGED
|
@@ -229,6 +229,9 @@ export var isQA = function (flag) {
|
|
|
229
229
|
return false;
|
|
230
230
|
return ['qa', 'qat'].includes(flag.toLowerCase());
|
|
231
231
|
};
|
|
232
|
+
export var isEmailAuthEnabled = function (emailAuth, countryIso2) {
|
|
233
|
+
return emailAuth && isQA(countryIso2);
|
|
234
|
+
};
|
|
232
235
|
export var isKWOrSA = function (flag) {
|
|
233
236
|
return isKW(flag) || isSA(flag);
|
|
234
237
|
};
|
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;
|