@tap-payments/auth-jsconnect 2.6.12-test → 2.6.13-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/app.d.ts +2 -1
- package/build/@types/app.js +1 -0
- package/build/app/settings.js +2 -5
- package/build/constants/app.js +11 -5
- package/build/constants/dummy.d.ts +45 -0
- package/build/constants/dummy.js +330 -0
- package/build/features/app/brand/brandStore.js +2 -2
- package/build/features/app/business/businessStore.d.ts +9 -2
- package/build/features/app/business/businessStore.js +38 -22
- package/build/features/app/connectExpress/connectExpressStore.js +27 -13
- package/build/features/app/individual/individualStore.js +5 -5
- package/build/features/business/screens/BusinessType/BusinessType.js +13 -5
- package/build/features/business/screens/BusinessType/EntityName.js +3 -3
- package/build/features/business/screens/BusinessType/LicenseList.js +3 -3
- package/build/features/business/screens/BusinessType/LicenseNumber.js +9 -8
- package/build/features/business/screens/BusinessType/validation.d.ts +10 -0
- package/build/features/business/screens/BusinessType/validation.js +16 -0
- package/build/features/connect/Connect.js +3 -3
- package/build/features/connect/screens/Mobile/Mobile.js +7 -6
- package/build/features/connect/screens/Mobile/MobileNumber.js +9 -6
- package/build/features/connectExpress/ConnectExpress.js +3 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +12 -4
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +6 -6
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +8 -7
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +13 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +67 -0
- package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +4 -0
- package/build/features/connectExpress/screens/IdentityOTP/OTP.js +1 -1
- package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +1 -1
- package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -2
- package/build/features/connectExpress/screens/Mobile/MobileNumber.js +9 -6
- package/build/features/entity/screens/EntityName/EntityName.js +11 -4
- package/build/features/entity/screens/EntityName/LicenseNumber.js +5 -4
- package/build/features/entity/screens/EntityName/validation.d.ts +28 -0
- package/build/features/entity/screens/EntityName/validation.js +38 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +1 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -2
- package/build/hooks/useCountry.d.ts +1 -0
- package/build/hooks/useCountry.js +4 -3
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +3 -0
- package/package.json +1 -1
|
@@ -58,8 +58,8 @@ var _a;
|
|
|
58
58
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
59
59
|
import API from '../../../api';
|
|
60
60
|
import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
|
|
61
|
-
import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
62
|
-
import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense } from '../../../utils';
|
|
61
|
+
import { BUSINESS_STEP_NAMES, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
62
|
+
import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA } from '../../../utils';
|
|
63
63
|
import { handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
64
64
|
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
65
|
var settings, payload, data, publicKey, countryIso2, boardData, brandData, currencyData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
|
|
@@ -98,7 +98,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
98
98
|
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && isKW(countryIso2)) {
|
|
99
99
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
|
|
100
100
|
}
|
|
101
|
-
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH &&
|
|
101
|
+
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && (isSA(countryIso2) || isOtherThanKWOrSA(countryIso2))) {
|
|
102
102
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
103
103
|
}
|
|
104
104
|
if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 20];
|
|
@@ -389,7 +389,7 @@ export var createCivilIdAuth = createAsyncThunk('createCivilIdAuth', function (p
|
|
|
389
389
|
});
|
|
390
390
|
}); });
|
|
391
391
|
export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
392
|
-
var _a, settings, business, identification_id_type, stepName, lead_id, requestBody, data;
|
|
392
|
+
var _a, settings, business, identification_id_type, stepName, lead_id, requestBody, data, business_id, entity, countryIso2, screen;
|
|
393
393
|
var _b, _c;
|
|
394
394
|
return __generator(this, function (_d) {
|
|
395
395
|
switch (_d.label) {
|
|
@@ -412,7 +412,21 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
412
412
|
return [4, API.leadService.updateLead(requestBody)];
|
|
413
413
|
case 1:
|
|
414
414
|
data = _d.sent();
|
|
415
|
-
|
|
415
|
+
business_id = data.business_id, entity = data.entity;
|
|
416
|
+
countryIso2 = settings.data.businessCountry.iso2;
|
|
417
|
+
screen = 'BUSINESS_OTP_STEP';
|
|
418
|
+
if (!isOtherThanKWOrSA(countryIso2)) return [3, 4];
|
|
419
|
+
screen = 'BUSINESS_BUSINESS_TYPE_STEP';
|
|
420
|
+
return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
|
|
421
|
+
case 2:
|
|
422
|
+
_d.sent();
|
|
423
|
+
if (!isSA(countryIso2)) return [3, 4];
|
|
424
|
+
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
425
|
+
case 3:
|
|
426
|
+
_d.sent();
|
|
427
|
+
_d.label = 4;
|
|
428
|
+
case 4:
|
|
429
|
+
thunkApi.dispatch(handleNextScreenStep(screen));
|
|
416
430
|
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody);
|
|
417
431
|
return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
|
|
418
432
|
}
|
|
@@ -484,24 +498,24 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
|
|
|
484
498
|
});
|
|
485
499
|
}); });
|
|
486
500
|
export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
487
|
-
var _a, settings, business,
|
|
501
|
+
var _a, settings, business, isKWCountry, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, selectedEntityLicense, isFL, _b, lead_id, brand, stepName, payload, data, accountBody, accountData, brandData, brandRes, _c, message, error, list, documentData, entityData, entityId, documentBody, payload_1;
|
|
488
502
|
var _d, _e;
|
|
489
503
|
return __generator(this, function (_f) {
|
|
490
504
|
switch (_f.label) {
|
|
491
505
|
case 0:
|
|
492
506
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
493
|
-
|
|
507
|
+
isKWCountry = isKW(settings.data.businessCountry.iso2);
|
|
494
508
|
selectedLicense = params.selectedLicense, licenseNumber = params.licenseNumber, entityLegalName = params.entityLegalName, certificateId = params.certificateId, articleId = params.articleId, selectedEntityLicense = params.selectedEntityLicense;
|
|
495
509
|
isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
496
510
|
_b = business.data.verify.responseBody || {}, lead_id = _b.lead_id, brand = _b.brand;
|
|
497
511
|
stepName = 'BUSINESS_ACTIVITIES_STEP';
|
|
498
512
|
payload = __assign(__assign(__assign(__assign({ id: lead_id || '', entity: {
|
|
499
|
-
id: (selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) && (
|
|
513
|
+
id: (selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) && (isKWCountry ? !isFL : true) ? selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id : ''
|
|
500
514
|
} }, (!(selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) && {
|
|
501
|
-
license_number:
|
|
515
|
+
license_number: isKWCountry && isFL ? '' : licenseNumber,
|
|
502
516
|
license_type: isFL ? LicenseType.FL : LicenseType.CR,
|
|
503
517
|
business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type
|
|
504
|
-
})), { step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO }), (
|
|
518
|
+
})), { step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO }), (isKWCountry && {
|
|
505
519
|
business_name: isFL ? undefined : { ar: entityLegalName, en: entityLegalName }
|
|
506
520
|
})), { encryption_contract: ['license_number', 'business_type', 'license_type'] });
|
|
507
521
|
return [4, API.leadService.updateLead(payload)];
|
|
@@ -630,7 +644,7 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
|
|
|
630
644
|
thunkApi.dispatch(updateStepName(stepName));
|
|
631
645
|
thunkApi.dispatch(handleNextScreenStep());
|
|
632
646
|
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
|
|
633
|
-
return [2,
|
|
647
|
+
return [2, { data: data === null || data === void 0 ? void 0 : data.brand, formData: __assign({}, params), currencyData: currencyData }];
|
|
634
648
|
}
|
|
635
649
|
});
|
|
636
650
|
}); });
|
|
@@ -657,7 +671,7 @@ export var retrieveDataList = createAsyncThunk('businessRetrieveDataList', funct
|
|
|
657
671
|
_a = _b.sent(), customerBases = _a[0].list, expectedSales = _a[1].list, expectedCustomerSales = _a[2].list;
|
|
658
672
|
return [2, {
|
|
659
673
|
customerBases: customerBases,
|
|
660
|
-
expectedSales: expectedSales,
|
|
674
|
+
expectedSales: (expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.length) ? expectedSales : EXPECTED_SALES_LIST,
|
|
661
675
|
expectedCustomerSales: expectedCustomerSales,
|
|
662
676
|
countryISO2: countryISO2
|
|
663
677
|
}];
|
|
@@ -830,10 +844,10 @@ export var businessSlice = createSlice({
|
|
|
830
844
|
state.customLoading = true;
|
|
831
845
|
})
|
|
832
846
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
833
|
-
var _a, _b, _c;
|
|
847
|
+
var _a, _b, _c, _d, _e, _f;
|
|
834
848
|
state.error = null;
|
|
835
849
|
state.customLoading = false;
|
|
836
|
-
var
|
|
850
|
+
var _g = action.payload, data = _g.data, boardId = _g.boardId, brandData = _g.brandData, leadData = _g.leadData, token = _g.token, isRequireOTP = _g.isRequireOTP, isicActivityList = _g.isicActivityList, currencyData = _g.currencyData;
|
|
837
851
|
var responseBody = state.data.verify.responseBody;
|
|
838
852
|
state.data.verify.responseBody = __assign(__assign(__assign(__assign(__assign({}, data), leadData), responseBody), { board_id: boardId, lead_id: data === null || data === void 0 ? void 0 : data.id }), (brandData && { brand: brandData }));
|
|
839
853
|
if (token)
|
|
@@ -841,13 +855,13 @@ export var businessSlice = createSlice({
|
|
|
841
855
|
state.data.otpData.isNID = false;
|
|
842
856
|
if (isRequireOTP)
|
|
843
857
|
return;
|
|
844
|
-
var
|
|
858
|
+
var _h = state.data.verify.responseBody || {}, entity = _h.entity, entity_activities = _h.entity_activities, business_name = _h.business_name;
|
|
845
859
|
if (business_name === null || business_name === void 0 ? void 0 : business_name.en)
|
|
846
860
|
state.data.businessTypeData.entityLegalName = business_name === null || business_name === void 0 ? void 0 : business_name.en;
|
|
847
861
|
var issuingDate = ((_a = brandData === null || brandData === void 0 ? void 0 : brandData.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
|
|
848
862
|
if (issuingDate)
|
|
849
863
|
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
850
|
-
var
|
|
864
|
+
var _j = brandData || {}, terms = _j.terms, activities = _j.activities;
|
|
851
865
|
var entityActivities = (entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
|
|
852
866
|
return !(activities === null || activities === void 0 ? void 0 : activities.some(function (value) { return value.id === activity.id; }));
|
|
853
867
|
})) || [];
|
|
@@ -861,7 +875,8 @@ export var businessSlice = createSlice({
|
|
|
861
875
|
if ((_c = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _c === void 0 ? void 0 : _c.english)
|
|
862
876
|
state.data.currency = currencyData.code.english;
|
|
863
877
|
state.data.activitiesData.activities = selectedActivity;
|
|
864
|
-
|
|
878
|
+
var licenseList = [OTHER_CR_LICENSE, OTHER_FL_LICENSE];
|
|
879
|
+
state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList }), (!((_f = (_e = (_d = state.data.businessTypeData) === null || _d === void 0 ? void 0 : _d.responseBody) === null || _e === void 0 ? void 0 : _e.licenseList) === null || _f === void 0 ? void 0 : _f.length) && { licenseList: licenseList }));
|
|
865
880
|
})
|
|
866
881
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
867
882
|
state.error = action.error.message;
|
|
@@ -889,22 +904,22 @@ export var businessSlice = createSlice({
|
|
|
889
904
|
state.error = null;
|
|
890
905
|
})
|
|
891
906
|
.addCase(verifyLeadOTP.fulfilled, function (state, action) {
|
|
892
|
-
var _a, _b, _c;
|
|
907
|
+
var _a, _b, _c, _d, _e, _f;
|
|
893
908
|
state.loading = false;
|
|
894
909
|
state.error = null;
|
|
895
|
-
var
|
|
910
|
+
var _g = action.payload, data = _g.data, formData = _g.formData, brand = _g.brand, leadData = _g.leadData, isicActivityList = _g.isicActivityList, currencyData = _g.currencyData;
|
|
896
911
|
state.data.otpData = formData;
|
|
897
912
|
state.data.otpData.responseBody = data;
|
|
898
913
|
if ((_a = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _a === void 0 ? void 0 : _a.english)
|
|
899
914
|
state.data.currency = currencyData.code.english;
|
|
900
915
|
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, leadData), state.data.verify.responseBody), (brand && { brand: brand })), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
|
|
901
|
-
var
|
|
916
|
+
var _h = leadData || {}, entity = _h.entity, entity_activities = _h.entity_activities, business_name = _h.business_name;
|
|
902
917
|
if (business_name === null || business_name === void 0 ? void 0 : business_name.en)
|
|
903
918
|
state.data.businessTypeData.entityLegalName = business_name === null || business_name === void 0 ? void 0 : business_name.en;
|
|
904
919
|
var issuingDate = ((_b = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _b === void 0 ? void 0 : _b.start_date) || ((_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date);
|
|
905
920
|
if (issuingDate)
|
|
906
921
|
state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
|
|
907
|
-
var
|
|
922
|
+
var _j = brand || {}, terms = _j.terms, activities = _j.activities;
|
|
908
923
|
var entityActivities = (entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
|
|
909
924
|
return !(activities === null || activities === void 0 ? void 0 : activities.some(function (value) { return value.id === activity.id; }));
|
|
910
925
|
})) || [];
|
|
@@ -916,7 +931,8 @@ export var businessSlice = createSlice({
|
|
|
916
931
|
}
|
|
917
932
|
});
|
|
918
933
|
state.data.activitiesData.activities = selectedActivity;
|
|
919
|
-
|
|
934
|
+
var licenseList = [OTHER_CR_LICENSE, OTHER_FL_LICENSE];
|
|
935
|
+
state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList }), (!((_f = (_e = (_d = state.data.businessTypeData) === null || _d === void 0 ? void 0 : _d.responseBody) === null || _e === void 0 ? void 0 : _e.licenseList) === null || _f === void 0 ? void 0 : _f.length) && { licenseList: licenseList }));
|
|
920
936
|
})
|
|
921
937
|
.addCase(verifyLeadOTP.rejected, function (state, action) {
|
|
922
938
|
state.loading = false;
|
|
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType } from '../../../@ty
|
|
|
61
61
|
import API from '../../../api';
|
|
62
62
|
import { CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH } from '../../../constants';
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
64
|
-
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA } from '../../../utils';
|
|
64
|
+
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA } from '../../../utils';
|
|
65
65
|
export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retrieveLeadIdentityByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
66
|
var _a, settings, connectExpress, countryCode, showBoard, data, _b, country_code, contact, phone, status, board_id, board_info_id, isRegistered, _c, boardInfo, boardData, error_1;
|
|
67
67
|
var _d, _e, _f, _g;
|
|
@@ -370,7 +370,7 @@ export var createCivilIdAuthAsync = createAsyncThunk('connectExpress/createCivil
|
|
|
370
370
|
});
|
|
371
371
|
}); });
|
|
372
372
|
export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileOtpAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
373
|
-
var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, mobileData, _c, auth_token, device_token, service_name, _d, scope, redirectUrl, authData, isScopeAuthentication, bi, isDataHasOperator, payload, data, authId, urlQueryStart, _e, brandList, entityList,
|
|
373
|
+
var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, mobileData, _c, auth_token, device_token, service_name, _d, scope, redirectUrl, authData, isScopeAuthentication, bi, isDataHasOperator, payload, data, authId, urlQueryStart, _e, brandList, entityList, isKuwait, next;
|
|
374
374
|
var _f, _g;
|
|
375
375
|
return __generator(this, function (_h) {
|
|
376
376
|
switch (_h.label) {
|
|
@@ -426,8 +426,10 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
|
|
|
426
426
|
case 3: return [4, thunkApi.dispatch(getLeadByIdAsync(data.lead_id)).unwrap()];
|
|
427
427
|
case 4:
|
|
428
428
|
_h.sent();
|
|
429
|
-
|
|
430
|
-
next =
|
|
429
|
+
isKuwait = isKW(settings.data.businessCountry.iso2);
|
|
430
|
+
next = 'CONNECT_EXPRESS_NID_MISSED_STEP';
|
|
431
|
+
if (isKuwait)
|
|
432
|
+
next = 'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP';
|
|
431
433
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep(next)); });
|
|
432
434
|
return [2, data];
|
|
433
435
|
}
|
|
@@ -562,7 +564,17 @@ export var createNIDAuthIdentityAsync = createAsyncThunk('connectExpress/createN
|
|
|
562
564
|
return [4, API.leadService.updateLead(requestBody)];
|
|
563
565
|
case 1:
|
|
564
566
|
data = _e.sent();
|
|
565
|
-
|
|
567
|
+
if (!((data === null || data === void 0 ? void 0 : data.verify_token) !== 'null')) return [3, 2];
|
|
568
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_OTP_IDENTITY_STEP'));
|
|
569
|
+
return [3, 4];
|
|
570
|
+
case 2:
|
|
571
|
+
if (!isOtherThanKWOrSA(countryCode)) return [3, 4];
|
|
572
|
+
return [4, thunkApi.dispatch(getLeadByIdAsync(data.id)).unwrap()];
|
|
573
|
+
case 3:
|
|
574
|
+
_e.sent();
|
|
575
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP'));
|
|
576
|
+
_e.label = 4;
|
|
577
|
+
case 4:
|
|
566
578
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody.identification);
|
|
567
579
|
return [2, { response: { verify_token: data.verify_token }, formData: params }];
|
|
568
580
|
}
|
|
@@ -800,14 +812,14 @@ export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLe
|
|
|
800
812
|
export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDataAsync ', function (_a, thunkApi) {
|
|
801
813
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
802
814
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
803
|
-
var _b, settings, connectExpress, selectedLicense, brandName, licenseNumber, termAndConditionChecked,
|
|
815
|
+
var _b, settings, connectExpress, selectedLicense, brandName, licenseNumber, termAndConditionChecked, isKWCountry, isFL, _c, responseData, isLeadIdPassed, id, brandNameBody, payload, data;
|
|
804
816
|
var _d, _e;
|
|
805
817
|
return __generator(this, function (_f) {
|
|
806
818
|
switch (_f.label) {
|
|
807
819
|
case 0:
|
|
808
820
|
_b = thunkApi.getState(), settings = _b.settings, connectExpress = _b.connectExpress;
|
|
809
821
|
selectedLicense = formData.selectedLicense, brandName = formData.brandName, licenseNumber = formData.licenseNumber, termAndConditionChecked = formData.termAndConditionChecked;
|
|
810
|
-
|
|
822
|
+
isKWCountry = isKW(settings.data.businessCountry.iso2);
|
|
811
823
|
isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
812
824
|
_c = connectExpress.data, responseData = _c.responseData, isLeadIdPassed = _c.isLeadIdPassed;
|
|
813
825
|
id = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).id;
|
|
@@ -820,13 +832,13 @@ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDat
|
|
|
820
832
|
payload = {
|
|
821
833
|
id: id || '',
|
|
822
834
|
brand: brandNameBody,
|
|
823
|
-
license_number:
|
|
835
|
+
license_number: isKWCountry && isFL ? '' : licenseNumber,
|
|
824
836
|
license_type: (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) ? (isFL ? LicenseType.FL : LicenseType.CR) : undefined,
|
|
825
837
|
business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type,
|
|
826
838
|
is_acknowledged: true,
|
|
827
839
|
terms_conditions_accepted: !isLeadIdPassed ? termAndConditionChecked : undefined,
|
|
828
840
|
step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_BRAND_BUSINESS,
|
|
829
|
-
encryption_contract: [
|
|
841
|
+
encryption_contract: []
|
|
830
842
|
};
|
|
831
843
|
return [4, API.leadService.updateLeadExpress(payload)];
|
|
832
844
|
case 1:
|
|
@@ -1115,7 +1127,7 @@ export var connectSlice = createSlice({
|
|
|
1115
1127
|
var _a;
|
|
1116
1128
|
state.loading = false;
|
|
1117
1129
|
state.data.civilIdData = action.payload.formData;
|
|
1118
|
-
state.data.otpData.authFor = AuthForType.
|
|
1130
|
+
state.data.otpData.authFor = AuthForType.NATIONAL_ID_MISSED;
|
|
1119
1131
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authData), action.payload.response) });
|
|
1120
1132
|
})
|
|
1121
1133
|
.addCase(createCivilIDAuthIdentityAsync.rejected, function (state, action) {
|
|
@@ -1130,7 +1142,7 @@ export var connectSlice = createSlice({
|
|
|
1130
1142
|
var _a;
|
|
1131
1143
|
state.loading = false;
|
|
1132
1144
|
state.data.nidData = action.payload.formData;
|
|
1133
|
-
state.data.otpData.authFor = AuthForType.
|
|
1145
|
+
state.data.otpData.authFor = AuthForType.NATIONAL_ID_MISSED;
|
|
1134
1146
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authData), action.payload.response) });
|
|
1135
1147
|
})
|
|
1136
1148
|
.addCase(createNIDAuthIdentityAsync.rejected, function (state, action) {
|
|
@@ -1143,7 +1155,7 @@ export var connectSlice = createSlice({
|
|
|
1143
1155
|
.addCase(resendNIDAuthIdentityOTP.fulfilled, function (state, action) {
|
|
1144
1156
|
var _a;
|
|
1145
1157
|
state.data.nidData = action.payload.formData;
|
|
1146
|
-
state.data.otpData.authFor = AuthForType.
|
|
1158
|
+
state.data.otpData.authFor = AuthForType.NATIONAL_ID_MISSED;
|
|
1147
1159
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authData), action.payload.response) });
|
|
1148
1160
|
})
|
|
1149
1161
|
.addCase(resendNIDAuthIdentityOTP.rejected, function (state, action) {
|
|
@@ -1294,10 +1306,12 @@ export var connectSlice = createSlice({
|
|
|
1294
1306
|
state.error = action.error.message;
|
|
1295
1307
|
})
|
|
1296
1308
|
.addCase(updateLeadIndividualAsync.fulfilled, function (state, action) {
|
|
1309
|
+
var _a, _b;
|
|
1297
1310
|
state.loading = false;
|
|
1298
1311
|
state.error = null;
|
|
1312
|
+
var licenseList = [OTHER_CR_LICENSE, OTHER_FL_LICENSE];
|
|
1299
1313
|
state.data.individualData = action.payload.formData;
|
|
1300
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.response });
|
|
1314
|
+
state.data.responseData = __assign(__assign(__assign({}, state.data.responseData), { individualData: action.payload.response }), (!((_b = (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.licenseList) === null || _b === void 0 ? void 0 : _b.length) && { licenseList: licenseList }));
|
|
1301
1315
|
})
|
|
1302
1316
|
.addCase(updateLeadIndividualAsync.pending, function (state) {
|
|
1303
1317
|
state.loading = true;
|
|
@@ -70,7 +70,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
70
70
|
import API from '../../../api';
|
|
71
71
|
import { FlowsTypes, IndividualGender, DocumentPurpose } from '../../../@types';
|
|
72
72
|
import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
|
|
73
|
-
import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
73
|
+
import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES, MONTHLY_INCOME_LIST } from '../../../constants';
|
|
74
74
|
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType } from '../../../utils';
|
|
75
75
|
export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
|
|
76
76
|
var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
|
|
@@ -1159,16 +1159,16 @@ export var individualSlice = createSlice({
|
|
|
1159
1159
|
state.error = null;
|
|
1160
1160
|
})
|
|
1161
1161
|
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
1162
|
-
var _a;
|
|
1162
|
+
var _a, _b;
|
|
1163
1163
|
state.loading = false;
|
|
1164
1164
|
state.error = null;
|
|
1165
|
-
var
|
|
1165
|
+
var _c = action.payload, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome, occupationData = _c.occupation;
|
|
1166
1166
|
var data = state.data.individualData.responseBody;
|
|
1167
1167
|
var sourceIncomeList = (sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.list) || [];
|
|
1168
|
-
var monthlyIncomeList = (monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.list) ||
|
|
1168
|
+
var monthlyIncomeList = ((_a = monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.list) === null || _a === void 0 ? void 0 : _a.length) ? monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.list : MONTHLY_INCOME_LIST;
|
|
1169
1169
|
var occupationList = (occupationData === null || occupationData === void 0 ? void 0 : occupationData.list) || [];
|
|
1170
1170
|
state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncomeList, monthlyIncomeList: monthlyIncomeList, occupationList: occupationList });
|
|
1171
|
-
var
|
|
1171
|
+
var _d = ((_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.user) || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation;
|
|
1172
1172
|
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
1173
1173
|
if (!!selectedSourceIncome)
|
|
1174
1174
|
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
@@ -23,8 +23,8 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
|
23
23
|
import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
|
|
24
24
|
import { BusinessType as Type } from '../../../../@types';
|
|
25
25
|
import Button from '../../../shared/Button';
|
|
26
|
-
import { deepCopy, isKW, isOtherLicense, isSA } from '../../../../utils';
|
|
27
|
-
import { KWLicenseValidationSchema, LicenseValidationSchema } from './validation';
|
|
26
|
+
import { deepCopy, isKW, isOtherLicense, isOtherThanKWOrSA, isSA } from '../../../../utils';
|
|
27
|
+
import { KWLicenseValidationSchema, LicenseValidationSchema, OtherCountryLicenseValidationSchema } from './validation';
|
|
28
28
|
import LicenseList from './LicenseList';
|
|
29
29
|
import LicenseCertificate from './LicenseCertificate';
|
|
30
30
|
import LicenseType from './LicenseType';
|
|
@@ -51,8 +51,16 @@ var BusinessType = function (_a) {
|
|
|
51
51
|
};
|
|
52
52
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
53
53
|
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
54
|
+
var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
55
|
+
var getSchema = function () {
|
|
56
|
+
if (isSACountry)
|
|
57
|
+
return LicenseValidationSchema;
|
|
58
|
+
if (isKWCountry)
|
|
59
|
+
return KWLicenseValidationSchema;
|
|
60
|
+
return OtherCountryLicenseValidationSchema;
|
|
61
|
+
};
|
|
54
62
|
var methods = useForm({
|
|
55
|
-
resolver: yupResolver(
|
|
63
|
+
resolver: yupResolver(getSchema()),
|
|
56
64
|
defaultValues: {
|
|
57
65
|
selectedLicense: selectedLicense,
|
|
58
66
|
selectedEntityLicense: selectedEntityLicense,
|
|
@@ -89,10 +97,10 @@ var BusinessType = function (_a) {
|
|
|
89
97
|
var selectedLicenseEntity = methods.getValues('selectedEntityLicense');
|
|
90
98
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === Type.CR;
|
|
91
99
|
var hasEntityList = !!(entityLicenseList === null || entityLicenseList === void 0 ? void 0 : entityLicenseList.length);
|
|
92
|
-
var showLicenseList = hasEntityList ? isSACountry && isOtherLicense(selectedLicenseEntity) : isSACountry;
|
|
100
|
+
var showLicenseList = hasEntityList ? (isSACountry || isOtherCountry) && isOtherLicense(selectedLicenseEntity) : isSACountry || isOtherCountry;
|
|
93
101
|
var showEntityList = isKWCountry ? hasEntityList && !isLicenseListActive && isCR : hasEntityList && !isLicenseListActive;
|
|
94
102
|
var disabled = !methods.formState.isValid || !!error || uploading || uploadingArticle;
|
|
95
103
|
var disableBack = !data.otpData.isNID;
|
|
96
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(LicenseType, { show: !listActive &&
|
|
104
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(LicenseType, { show: !listActive && isKWCountry }), _jsx(EntityLicenseList, { show: showEntityList, onListOpen: function () { return handleMenuClick(ListType.EntityLicenseList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(LicenseList, { show: showLicenseList && !isEntityLicenseListActive, onListOpen: function () { return handleMenuClick(ListType.LicenseList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EntityName, { show: !isAnyListActive && isKWCountry && isCR }), _jsx(LicenseNumber, { show: isKWCountry ? !isAnyListActive && isCR : !isAnyListActive }), _jsx(LicenseCertificate, { show: !isAnyListActive && isKWCountry && isCR }), _jsx(Article, { show: !isAnyListActive && isKWCountry && isCR }), _jsx(Collapse, __assign({ in: !isAnyListActive, timeout: 500 }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
97
105
|
};
|
|
98
106
|
export default React.memo(BusinessType);
|
|
@@ -16,7 +16,7 @@ import { useController, useFormContext } from 'react-hook-form';
|
|
|
16
16
|
import { styled } from '@mui/material/styles';
|
|
17
17
|
import Box from '@mui/material/Box';
|
|
18
18
|
import { settingsSelector } from '../../../../app/settings';
|
|
19
|
-
import {
|
|
19
|
+
import { isKW, removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
20
20
|
import { useAppSelector } from '../../../../hooks';
|
|
21
21
|
import Collapse from '../../../../components/Collapse';
|
|
22
22
|
import Input from '../../../shared/Input';
|
|
@@ -41,7 +41,7 @@ var EntityName = function (_a) {
|
|
|
41
41
|
var entityNameValue = entityNameControl.field.value;
|
|
42
42
|
var error = (_b = entityNameControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
43
43
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
44
|
-
var
|
|
44
|
+
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
45
45
|
var handleChange = function (_a) {
|
|
46
46
|
var target = _a.target;
|
|
47
47
|
var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
|
|
@@ -50,6 +50,6 @@ var EntityName = function (_a) {
|
|
|
50
50
|
var clearEntityName = function () {
|
|
51
51
|
entityNameControl.field.onChange('');
|
|
52
52
|
};
|
|
53
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(BoxStyled, { children: _jsx(Input, { label: t('entity_legal_name_title'), onChange: handleChange, value: entityNameValue, required:
|
|
53
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(BoxStyled, { children: _jsx(Input, { label: t('entity_legal_name_title'), onChange: handleChange, value: entityNameValue, required: isKWCountry, endAdornment: _jsx(EndAdornment, { value: entityNameValue, error: error, onClear: clearEntityName }), placeholder: t('entity_legal_name_placeholder'), warningType: 'alert', warningMessage: error && t(error) }) }) })));
|
|
54
54
|
};
|
|
55
55
|
export default EntityName;
|
|
@@ -36,7 +36,7 @@ import { businessSelector, clearError } from '../../../app/business/businessStor
|
|
|
36
36
|
import Text from '../../../../components/Text';
|
|
37
37
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
38
38
|
import Collapse from '../../../../components/Collapse';
|
|
39
|
-
import {
|
|
39
|
+
import { isKW, isOtherLicense } from '../../../../utils';
|
|
40
40
|
import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
|
|
41
41
|
import { settingsSelector } from '../../../../app/settings';
|
|
42
42
|
var InputStyled = styled(InputSelect)(function (_a) {
|
|
@@ -90,8 +90,8 @@ var LicenseList = function (_a) {
|
|
|
90
90
|
}, [licenseList, selectedLicense]);
|
|
91
91
|
React.useEffect(function () {
|
|
92
92
|
if (!!country_code) {
|
|
93
|
-
var
|
|
94
|
-
if (
|
|
93
|
+
var isKWCountry = isKW(country_code);
|
|
94
|
+
if (isKWCountry) {
|
|
95
95
|
var license = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR ? OTHER_CR_LICENSE : OTHER_FL_LICENSE;
|
|
96
96
|
setValue('selectedLicense', license, { shouldValidate: true });
|
|
97
97
|
setValue('entityLegalName', entityLegalName, { shouldValidate: true });
|
|
@@ -14,7 +14,7 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { CR_MIN_LICENSE_LENGTH, CR_NUMBER_MAX_LENGTH, FL_MIN_LICENSE_LENGTH, FL_NUMBER_MAX_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
|
|
17
|
-
import { removeAllOtherThanCharsAndNumber,
|
|
17
|
+
import { removeAllOtherThanCharsAndNumber, isOtherLicense, isKW, isOtherThanKWOrSA } from '../../../../utils';
|
|
18
18
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
19
19
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
20
20
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
@@ -30,9 +30,10 @@ var LicenseNumber = function (_a) {
|
|
|
30
30
|
var _c = useFormContext(), control = _c.control, watch = _c.watch, getValues = _c.getValues;
|
|
31
31
|
var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
|
|
32
32
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
33
|
+
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
34
|
+
var isOtherThanKWOrSACountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
35
|
+
var selectedLicense = isKWCountry ? watch('selectedLicense') : getValues('selectedLicense');
|
|
36
|
+
var selectedEntityLicense = isKWCountry ? watch('selectedEntityLicense') : getValues('selectedEntityLicense');
|
|
36
37
|
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
37
38
|
var readOnly = !isOtherLicense(selectedLicense) || (selectedEntityLicense && !isOtherLicense(selectedEntityLicense));
|
|
38
39
|
var handleFLNumberChange = function (_a) {
|
|
@@ -45,10 +46,10 @@ var LicenseNumber = function (_a) {
|
|
|
45
46
|
};
|
|
46
47
|
var licenseNumberValue = licenseNumberControl.field.value;
|
|
47
48
|
var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
48
|
-
var length =
|
|
49
|
-
var minLength =
|
|
49
|
+
var length = isKWCountry || isOtherThanKWOrSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_MAX_LENGTH;
|
|
50
|
+
var minLength = isKWCountry || isOtherThanKWOrSACountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
|
|
50
51
|
var label = isCR ? 'cr_number' : 'fl_number';
|
|
51
|
-
var showCheckIcon =
|
|
52
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required:
|
|
52
|
+
var showCheckIcon = isKWCountry || isOtherThanKWOrSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
|
|
53
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: isKWCountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
|
|
53
54
|
};
|
|
54
55
|
export default React.memo(LicenseNumber);
|
|
@@ -31,3 +31,13 @@ export declare const KWLicenseValidationSchema: yup.ObjectSchema<import("yup/lib
|
|
|
31
31
|
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
32
|
articleFile: any;
|
|
33
33
|
}>>>;
|
|
34
|
+
export declare const OtherCountryLicenseValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
35
|
+
selectedLicense: any;
|
|
36
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
37
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
38
|
+
selectedLicense: any;
|
|
39
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
40
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
41
|
+
selectedLicense: any;
|
|
42
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
43
|
+
}>>>;
|
|
@@ -87,3 +87,19 @@ export var KWLicenseValidationSchema = yup.object().shape({
|
|
|
87
87
|
})
|
|
88
88
|
.optional()
|
|
89
89
|
});
|
|
90
|
+
export var OtherCountryLicenseValidationSchema = yup.object().shape({
|
|
91
|
+
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
92
|
+
licenseNumber: yup
|
|
93
|
+
.string()
|
|
94
|
+
.test({
|
|
95
|
+
test: function (value) {
|
|
96
|
+
var selectedLicense = this.parent.selectedLicense;
|
|
97
|
+
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
98
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
99
|
+
if (length === 0)
|
|
100
|
+
return true;
|
|
101
|
+
return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: isCR ? 'cr_kw_max_length' : 'fl_max_length' });
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
.required('')
|
|
105
|
+
});
|
|
@@ -56,7 +56,7 @@ import { store } from '../../app/store';
|
|
|
56
56
|
import { connectSelector, retrieveLead, setDefaultCountryCode } from '../app/connect/connectStore';
|
|
57
57
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
58
58
|
import Collapse from '../../components/Collapse';
|
|
59
|
-
import { isKW, findOrCreateElementAndInject, initializeGTM, sendCustomEventToGTM, sendCustomDimension, sendPageView } from '../../utils';
|
|
59
|
+
import { isKW, findOrCreateElementAndInject, initializeGTM, sendCustomEventToGTM, sendCustomDimension, sendPageView, isOtherThanKWOrSA } from '../../utils';
|
|
60
60
|
import { CONNECT_SCREENS_NAVIGATION } from '../../constants';
|
|
61
61
|
import { connectFeatureScreens } from '../featuresScreens';
|
|
62
62
|
import Background from '../shared/Background';
|
|
@@ -93,9 +93,9 @@ var Connect = memo(function (props) {
|
|
|
93
93
|
initializeGTM();
|
|
94
94
|
}, []);
|
|
95
95
|
React.useEffect(function () {
|
|
96
|
-
var _a;
|
|
96
|
+
var _a, _b;
|
|
97
97
|
if (!settingLoading) {
|
|
98
|
-
if (
|
|
98
|
+
if (isOtherThanKWOrSA((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2) || isKW((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2))
|
|
99
99
|
dispatch(handleCurrentActiveScreen('CONNECT_MOBILE_STEP'));
|
|
100
100
|
if (leadId && !configToken) {
|
|
101
101
|
dispatch(retrieveLead(leadId));
|
|
@@ -25,7 +25,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
|
25
25
|
import { clearError, connectSelector, createMobileAuth, resetNIDScreen, resetCivilScreen, resetOTPScreen, resetStore } from '../../../app/connect/connectStore';
|
|
26
26
|
import { useLanguage } from '../../../../hooks';
|
|
27
27
|
import Divider from '@mui/material/Divider';
|
|
28
|
-
import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
|
|
28
|
+
import { deepCopy, isKW, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
|
|
29
29
|
import Text from '../../../../components/Text';
|
|
30
30
|
import MIDTitle from './Title';
|
|
31
31
|
import MobileNumber from './MobileNumber';
|
|
@@ -74,12 +74,12 @@ var ListType;
|
|
|
74
74
|
ListType["CountryCodeList"] = "CountryCodeList";
|
|
75
75
|
})(ListType || (ListType = {}));
|
|
76
76
|
var Mobile = function (_a) {
|
|
77
|
-
var _b;
|
|
77
|
+
var _b, _c;
|
|
78
78
|
var settingsStore = useAppSelector(settingsSelector);
|
|
79
|
-
var
|
|
80
|
-
var
|
|
79
|
+
var _d = useAppSelector(connectSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
80
|
+
var _e = React.useState(), listType = _e[0], setListType = _e[1];
|
|
81
81
|
var dispatch = useAppDispatch();
|
|
82
|
-
var
|
|
82
|
+
var _f = data.mobileData, mobile = _f.mobile, countryCode = _f.countryCode, termAndConditionChecked = _f.termAndConditionChecked;
|
|
83
83
|
var methods = useForm({
|
|
84
84
|
resolver: yupResolver(PhoneValidationSchema),
|
|
85
85
|
defaultValues: {
|
|
@@ -108,6 +108,7 @@ var Mobile = function (_a) {
|
|
|
108
108
|
dispatch(resetCivilScreen());
|
|
109
109
|
};
|
|
110
110
|
var isKWCountry = React.useMemo(function () { var _a; return isKW((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_b = settingsStore.data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2]);
|
|
111
|
+
var isOtherThanKWOrSACountry = React.useMemo(function () { var _a; return isOtherThanKWOrSA((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_c = settingsStore.data.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2]);
|
|
111
112
|
var onBack = function () {
|
|
112
113
|
sendCustomEventToGTM({
|
|
113
114
|
event: 'Send Event',
|
|
@@ -125,6 +126,6 @@ var Mobile = function (_a) {
|
|
|
125
126
|
var disabled = !methods.formState.isValid || !!error;
|
|
126
127
|
var title = t('join_our_community');
|
|
127
128
|
var subTitle = t('ide_terms_and_conditions_description');
|
|
128
|
-
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({
|
|
129
|
+
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid && !isOtherThanKWOrSACountry }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKWCountry ? (_jsx(MobileButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) }))] }));
|
|
129
130
|
};
|
|
130
131
|
export default React.memo(Mobile);
|