@tap-payments/auth-jsconnect 2.11.0-sandbox → 2.11.1-sandbox
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/form.d.ts +2 -0
- package/build/api/entity.d.ts +3 -0
- package/build/api/lead.d.ts +1 -0
- package/build/assets/locales/ar.json +9 -6
- package/build/assets/locales/en.json +9 -6
- package/build/constants/app.d.ts +9 -0
- package/build/constants/app.js +6 -3
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/business/businessStore.js +15 -10
- package/build/features/app/connectExpress/connectExpressStore.js +19 -4
- package/build/features/app/terminal/terminalStore.d.ts +2 -1
- package/build/features/app/terminal/terminalStore.js +5 -2
- package/build/features/auth/screens/AuthenticationList/EntityList.js +2 -2
- package/build/features/business/screens/BusinessType/BusinessType.js +13 -2
- package/build/features/business/screens/BusinessType/EntityLicenseList.js +11 -5
- package/build/features/business/screens/BusinessType/LicenseList.js +15 -7
- package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +35 -0
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +84 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
- package/build/features/business/screens/BusinessType/validation.js +31 -10
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +23 -7
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +36 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +81 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +6 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +57 -21
- package/build/features/entity/screens/EntityName/EntityName.js +2 -1
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +3 -3
- package/build/features/entity/screens/EntityName/validation.js +14 -3
- package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
- package/build/features/shared/Button/FlowsButtons.js +1 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +2 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +3 -2
- package/build/features/terminal/screens/LinkNewTerminal/styles.js +2 -2
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +8 -3
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +3 -1
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -5
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +19 -10
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +7 -2
- package/build/features/terminal/screens/shared/TerminalList.js +3 -3
- package/build/utils/string.d.ts +1 -1
- package/build/utils/string.js +2 -2
- package/package.json +1 -1
package/build/@types/form.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export declare type BrandActivitiesFormValues = {
|
|
|
61
61
|
};
|
|
62
62
|
export declare type BusinessTypeFormValues = {
|
|
63
63
|
licenseNumber: string;
|
|
64
|
+
unifiedNumber: string;
|
|
64
65
|
entityLegalName?: string;
|
|
65
66
|
selectedEntityLicense?: EntityLicense;
|
|
66
67
|
selectedLicense?: License;
|
|
@@ -150,6 +151,7 @@ export declare type EntityCapitalFormValues = {
|
|
|
150
151
|
export declare type BusinessDataFormValues = {
|
|
151
152
|
brandName: string;
|
|
152
153
|
licenseNumber: string;
|
|
154
|
+
unifiedNumber: string;
|
|
153
155
|
selectedLicense?: License;
|
|
154
156
|
termAndConditionChecked?: boolean;
|
|
155
157
|
};
|
package/build/api/entity.d.ts
CHANGED
package/build/api/lead.d.ts
CHANGED
|
@@ -393,6 +393,7 @@
|
|
|
393
393
|
"loading": "تحميل...",
|
|
394
394
|
"loading_bank_statement": "تحميل.......",
|
|
395
395
|
"login_to_dashboard": "تسجيل الدخول لادارة الحساب",
|
|
396
|
+
"login_with_passcode": "تسجيل الدخول باستخدام رمز المرور",
|
|
396
397
|
"mail_btn_open_title": "افتح البريد الإلكتروني",
|
|
397
398
|
"marital_status": "الحالة الزوجية",
|
|
398
399
|
"masking_symbols": "•••",
|
|
@@ -459,6 +460,8 @@
|
|
|
459
460
|
"paci_verify_loading": "إحضار التفاصيل",
|
|
460
461
|
"paci_verify_loading_desc": "الرجاء التحلي بالصبر حتى التحقق من التفاصيل",
|
|
461
462
|
"paci_waiting_title": "Please wait we are verifying",
|
|
463
|
+
"passcode_required": "الرجاء إدخال رمز المرور المطلوب",
|
|
464
|
+
"passcode_title": "الرجاء إدخال رمز المرور الخاص بك",
|
|
462
465
|
"password_flow_completed": "إعادة تعيين كلمة المرور",
|
|
463
466
|
"password_flow_pending": "إعداد كلمة المرور",
|
|
464
467
|
"password_flow_title": "إعداد كلمة المرور",
|
|
@@ -535,7 +538,7 @@
|
|
|
535
538
|
"share_value_hint": "0000",
|
|
536
539
|
"share_value_input_label": "قيمة السهم",
|
|
537
540
|
"share_value_label": "قيمة السهم ({{currency}})",
|
|
538
|
-
"
|
|
541
|
+
"sign_in_with_otp": "تسجيل الدخول باستخدام رمز التحقق (OTP)",
|
|
539
542
|
"sign_up": "Sign up",
|
|
540
543
|
"signed_up": "تسجيل الدخول",
|
|
541
544
|
"signin_email_label": "البريد الألكتروني",
|
|
@@ -659,6 +662,10 @@
|
|
|
659
662
|
"update_later": "سأقوم بالتحديث لاحقاً",
|
|
660
663
|
"update_mobile_number": "تحديث رقم الجوال",
|
|
661
664
|
"uploaded_file": "file",
|
|
665
|
+
"v1_add_unified_number": "أضف الرقم الموحد",
|
|
666
|
+
"v1_company_unified_number_description": "يمكنك العثور على الرقم الموحد لشركتك في الزاوية العلوية اليسرى من شهادة تسجيل الشركة.",
|
|
667
|
+
"v1_company_unified_number_hint": "700xxxxxxx",
|
|
668
|
+
"v1_company_unified_number_label": "الرقم الموحد للشركة",
|
|
662
669
|
"vat_id": "رقم الضريبي المميز",
|
|
663
670
|
"vat_id_placeholder": "00000000",
|
|
664
671
|
"verification_brand_name": "الاسم التجاري",
|
|
@@ -676,9 +683,5 @@
|
|
|
676
683
|
"year": "السنة",
|
|
677
684
|
"yes": "نعم",
|
|
678
685
|
"your_brand_details": "تفاصيل علامتك التجارية",
|
|
679
|
-
"يرجى التحقق من اسم تطبيق ابل": ""
|
|
680
|
-
"passcode_title": "الرجاء إدخال رمز المرور الخاص بك",
|
|
681
|
-
"sign_in_with_otp": "تسجيل الدخول باستخدام رمز التحقق (OTP)",
|
|
682
|
-
"passcode_required": "الرجاء إدخال رمز المرور المطلوب",
|
|
683
|
-
"login_with_passcode": "تسجيل الدخول باستخدام رمز المرور"
|
|
686
|
+
"يرجى التحقق من اسم تطبيق ابل": ""
|
|
684
687
|
}
|
|
@@ -408,6 +408,7 @@
|
|
|
408
408
|
"loading": "Loading...",
|
|
409
409
|
"loading_bank_statement": "loading....",
|
|
410
410
|
"login_to_dashboard": "Login to dashboard",
|
|
411
|
+
"login_with_passcode": "Login with Passcode",
|
|
411
412
|
"mail_btn_open_title": "Open Mail",
|
|
412
413
|
"marital_status": "Marital status",
|
|
413
414
|
"masking_symbols": "•••",
|
|
@@ -475,6 +476,8 @@
|
|
|
475
476
|
"paci_verify_loading": "Fetching Details",
|
|
476
477
|
"paci_verify_loading_desc": "Please be patient until verify details",
|
|
477
478
|
"paci_waiting_title": "Please wait we are verifying",
|
|
479
|
+
"passcode_required": "Please enter the required Passcode",
|
|
480
|
+
"passcode_title": "Please enter your passcode",
|
|
478
481
|
"password_flow_completed": "Reset my password",
|
|
479
482
|
"password_flow_pending": "Setup my password",
|
|
480
483
|
"password_flow_title": "Setup your password",
|
|
@@ -557,7 +560,7 @@
|
|
|
557
560
|
"share_value_hint": "0000",
|
|
558
561
|
"share_value_input_label": "Share Value",
|
|
559
562
|
"share_value_label": "Share Value ({{currency}})",
|
|
560
|
-
"
|
|
563
|
+
"sign_in_with_otp": "Sign in with OTP",
|
|
561
564
|
"sign_up": "Sign up",
|
|
562
565
|
"signed_up": "Signed up",
|
|
563
566
|
"signin_email_label": "Email address",
|
|
@@ -687,6 +690,10 @@
|
|
|
687
690
|
"upload_bank_statement": "Please upload the bank statement",
|
|
688
691
|
"upload_file": "Select a file from your computer",
|
|
689
692
|
"uploaded_file": "file",
|
|
693
|
+
"v1_add_unified_number": "Add a Unified Number",
|
|
694
|
+
"v1_company_unified_number_description": "You can find your Company Unified Number in the top-left corner of your Company Registration Certificate.",
|
|
695
|
+
"v1_company_unified_number_hint": "700xxxxxxx",
|
|
696
|
+
"v1_company_unified_number_label": "Company unified number",
|
|
690
697
|
"vat_id": "Tax Identification Number (TIN)",
|
|
691
698
|
"vat_id_placeholder": "000000000",
|
|
692
699
|
"verification_brand_name": "Brand name",
|
|
@@ -703,9 +710,5 @@
|
|
|
703
710
|
"website_label": "Website",
|
|
704
711
|
"year": "Year",
|
|
705
712
|
"yes": "Yes",
|
|
706
|
-
"your_brand_details": "Your brand details"
|
|
707
|
-
"passcode_title": "Please enter your passcode",
|
|
708
|
-
"sign_in_with_otp": "Sign in with OTP",
|
|
709
|
-
"passcode_required": "Please enter the required Passcode",
|
|
710
|
-
"login_with_passcode": "Login with Passcode"
|
|
713
|
+
"your_brand_details": "Your brand details"
|
|
711
714
|
}
|
package/build/constants/app.d.ts
CHANGED
|
@@ -235,6 +235,9 @@ export declare const OTHER_FL_LICENSE: {
|
|
|
235
235
|
};
|
|
236
236
|
license: {
|
|
237
237
|
number: string;
|
|
238
|
+
additional_info: {
|
|
239
|
+
unified_number: string;
|
|
240
|
+
};
|
|
238
241
|
};
|
|
239
242
|
type: BusinessType;
|
|
240
243
|
};
|
|
@@ -246,6 +249,9 @@ export declare const OTHER_ENTITY_LICENSE: {
|
|
|
246
249
|
};
|
|
247
250
|
license: {
|
|
248
251
|
number: string;
|
|
252
|
+
additional_info: {
|
|
253
|
+
unified_number: string;
|
|
254
|
+
};
|
|
249
255
|
};
|
|
250
256
|
type: BusinessType;
|
|
251
257
|
};
|
|
@@ -256,6 +262,9 @@ export declare const OTHER_CR_LICENSE: {
|
|
|
256
262
|
};
|
|
257
263
|
license: {
|
|
258
264
|
number: string;
|
|
265
|
+
additional_info: {
|
|
266
|
+
unified_number: string;
|
|
267
|
+
};
|
|
259
268
|
};
|
|
260
269
|
type: BusinessType;
|
|
261
270
|
};
|
package/build/constants/app.js
CHANGED
|
@@ -1242,7 +1242,8 @@ export var OTHER_FL_LICENSE = {
|
|
|
1242
1242
|
en: 'add_other_fl'
|
|
1243
1243
|
},
|
|
1244
1244
|
license: {
|
|
1245
|
-
number: 'other_fl'
|
|
1245
|
+
number: 'other_fl',
|
|
1246
|
+
additional_info: { unified_number: 'other_fl' }
|
|
1246
1247
|
},
|
|
1247
1248
|
type: BusinessType.FL
|
|
1248
1249
|
};
|
|
@@ -1253,7 +1254,8 @@ export var OTHER_ENTITY_LICENSE = {
|
|
|
1253
1254
|
en: 'add_other'
|
|
1254
1255
|
},
|
|
1255
1256
|
license: {
|
|
1256
|
-
number: 'other_entity'
|
|
1257
|
+
number: 'other_entity',
|
|
1258
|
+
additional_info: { unified_number: 'other_entity' }
|
|
1257
1259
|
},
|
|
1258
1260
|
type: BusinessType.CR
|
|
1259
1261
|
};
|
|
@@ -1263,7 +1265,8 @@ export var OTHER_CR_LICENSE = {
|
|
|
1263
1265
|
en: 'add_other_cr'
|
|
1264
1266
|
},
|
|
1265
1267
|
license: {
|
|
1266
|
-
number: 'other_cr'
|
|
1268
|
+
number: 'other_cr',
|
|
1269
|
+
additional_info: { unified_number: 'other_cr' }
|
|
1267
1270
|
},
|
|
1268
1271
|
type: BusinessType.CR
|
|
1269
1272
|
};
|
|
@@ -10,6 +10,7 @@ export declare const LICENSE_NUMBER_MIN_LENGTH = 5;
|
|
|
10
10
|
export declare const FL_NUMBER_ENTITY_LENGTH = 50;
|
|
11
11
|
export declare const FL_MIN_LICENSE_LENGTH = 5;
|
|
12
12
|
export declare const CR_MIN_LICENSE_LENGTH = 5;
|
|
13
|
+
export declare const UNIFIED_NUMBER_MIN_LENGTH = 2;
|
|
13
14
|
export declare const MAX_EMAIL_LENGTH = 50;
|
|
14
15
|
export declare const BRAND_NAME_MAX_LENGTH = 99;
|
|
15
16
|
export declare const KW_MIN_LICENSE_LENGTH = 3;
|
|
@@ -10,6 +10,7 @@ export var LICENSE_NUMBER_MIN_LENGTH = 5;
|
|
|
10
10
|
export var FL_NUMBER_ENTITY_LENGTH = 50;
|
|
11
11
|
export var FL_MIN_LICENSE_LENGTH = 5;
|
|
12
12
|
export var CR_MIN_LICENSE_LENGTH = 5;
|
|
13
|
+
export var UNIFIED_NUMBER_MIN_LENGTH = 2;
|
|
13
14
|
export var MAX_EMAIL_LENGTH = 50;
|
|
14
15
|
export var BRAND_NAME_MAX_LENGTH = 99;
|
|
15
16
|
export var KW_MIN_LICENSE_LENGTH = 3;
|
|
@@ -651,26 +651,26 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
|
|
|
651
651
|
});
|
|
652
652
|
}); });
|
|
653
653
|
export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
654
|
-
var _a, settings, business, isKWCountry, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, selectedEntityLicense, isFL, _b, lead_id, brand, stepName, payload, data, accountBody, accountData, documentData, entityData, brandData, data_1, brandRes, _c, message, error, list, entityId, documentBody, payload_1;
|
|
654
|
+
var _a, settings, business, isKWCountry, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, selectedEntityLicense, unifiedNumber, isFL, _b, lead_id, brand, stepName, payload, data, accountBody, accountData, documentData, entityData, brandData, data_1, brandRes, _c, message, error, list, entityId, documentBody, payload_1;
|
|
655
655
|
var _d, _e, _f;
|
|
656
656
|
return __generator(this, function (_g) {
|
|
657
657
|
switch (_g.label) {
|
|
658
658
|
case 0:
|
|
659
659
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
660
660
|
isKWCountry = isKW(settings.data.businessCountry.iso2);
|
|
661
|
-
selectedLicense = params.selectedLicense, licenseNumber = params.licenseNumber, entityLegalName = params.entityLegalName, certificateId = params.certificateId, articleId = params.articleId, selectedEntityLicense = params.selectedEntityLicense;
|
|
661
|
+
selectedLicense = params.selectedLicense, licenseNumber = params.licenseNumber, entityLegalName = params.entityLegalName, certificateId = params.certificateId, articleId = params.articleId, selectedEntityLicense = params.selectedEntityLicense, unifiedNumber = params.unifiedNumber;
|
|
662
662
|
isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
663
663
|
_b = business.data.verify.responseBody || {}, lead_id = _b.lead_id, brand = _b.brand;
|
|
664
664
|
stepName = 'BUSINESS_ACTIVITIES_STEP';
|
|
665
665
|
payload = __assign(__assign(__assign(__assign({ id: lead_id || '', entity: {
|
|
666
666
|
id: (selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) && (isKWCountry ? !isFL : true) ? selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id : ''
|
|
667
|
-
} }, (!(selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) && {
|
|
667
|
+
}, unified_number: unifiedNumber }, (!(selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) && {
|
|
668
668
|
license_number: isKWCountry && isFL ? '' : licenseNumber,
|
|
669
669
|
license_type: isFL ? LicenseType.FL : LicenseType.CR,
|
|
670
670
|
business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type
|
|
671
671
|
})), { step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO }), (isKWCountry && {
|
|
672
672
|
business_name: isFL ? undefined : { ar: entityLegalName, en: entityLegalName }
|
|
673
|
-
})), { encryption_contract: ['license_number', 'business_type', 'license_type'] });
|
|
673
|
+
})), { encryption_contract: ['license_number', 'business_type', 'license_type', 'entity.unified_number'] });
|
|
674
674
|
return [4, API.leadService.updateLead(payload)];
|
|
675
675
|
case 1:
|
|
676
676
|
data = _g.sent();
|
|
@@ -988,6 +988,7 @@ var initialState = {
|
|
|
988
988
|
businessTypeData: {
|
|
989
989
|
licenseNumber: '',
|
|
990
990
|
entityLegalName: '',
|
|
991
|
+
unifiedNumber: '',
|
|
991
992
|
isPrevDob: false
|
|
992
993
|
},
|
|
993
994
|
activitiesData: {
|
|
@@ -1264,7 +1265,7 @@ export var businessSlice = createSlice({
|
|
|
1264
1265
|
state.loading = true;
|
|
1265
1266
|
})
|
|
1266
1267
|
.addCase(retrieveEntityList.fulfilled, function (state, action) {
|
|
1267
|
-
var _a, _b, _c, _d;
|
|
1268
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1268
1269
|
state.error = null;
|
|
1269
1270
|
state.loading = false;
|
|
1270
1271
|
var data = action.payload;
|
|
@@ -1285,7 +1286,7 @@ export var businessSlice = createSlice({
|
|
|
1285
1286
|
licenseList = __spreadArray(__spreadArray([], licenseList, true), mappedFL, true);
|
|
1286
1287
|
licenseList = licenseList.filter(function (_a) {
|
|
1287
1288
|
var license = _a.license;
|
|
1288
|
-
return !(entityLicenseList || []).some(function (e) { return e.license.number === license.number; });
|
|
1289
|
+
return !(entityLicenseList || []).some(function (e) { var _a, _b; return e.license.number === license.number || ((_a = e.license.additional_info) === null || _a === void 0 ? void 0 : _a.unified_number) === ((_b = license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number); });
|
|
1289
1290
|
});
|
|
1290
1291
|
}
|
|
1291
1292
|
}
|
|
@@ -1295,8 +1296,10 @@ export var businessSlice = createSlice({
|
|
|
1295
1296
|
var selectedLicense = licenseList === null || licenseList === void 0 ? void 0 : licenseList[0];
|
|
1296
1297
|
var isOtherLicense_1 = ((_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.number) === 'other_fl' || ((_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number) === 'other_cr';
|
|
1297
1298
|
state.data.businessTypeData.selectedLicense = selectedLicense;
|
|
1298
|
-
if (!isOtherLicense_1)
|
|
1299
|
+
if (!isOtherLicense_1) {
|
|
1299
1300
|
state.data.businessTypeData.licenseNumber = ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) || '';
|
|
1301
|
+
state.data.businessTypeData.unifiedNumber = ((_f = (_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.additional_info) === null || _f === void 0 ? void 0 : _f.unified_number) || '';
|
|
1302
|
+
}
|
|
1300
1303
|
}
|
|
1301
1304
|
})
|
|
1302
1305
|
.addCase(retrieveEntityList.rejected, function (state, action) {
|
|
@@ -1308,10 +1311,10 @@ export var businessSlice = createSlice({
|
|
|
1308
1311
|
state.loading = true;
|
|
1309
1312
|
})
|
|
1310
1313
|
.addCase(retrieveAllEntityList.fulfilled, function (state, action) {
|
|
1311
|
-
var _a;
|
|
1314
|
+
var _a, _b, _c;
|
|
1312
1315
|
state.error = null;
|
|
1313
1316
|
state.loading = false;
|
|
1314
|
-
var
|
|
1317
|
+
var _d = action.payload, data = _d.data, businessCountryCode = _d.businessCountryCode, entityId = _d.entityId;
|
|
1315
1318
|
var isKWCountry = isKW(businessCountryCode);
|
|
1316
1319
|
var list = (data === null || data === void 0 ? void 0 : data.entities_info) || [];
|
|
1317
1320
|
if (isKWCountry) {
|
|
@@ -1329,8 +1332,10 @@ export var businessSlice = createSlice({
|
|
|
1329
1332
|
var selectedLicense = findEntity ? findEntity : entityLicenseList[0];
|
|
1330
1333
|
state.data.businessTypeData.selectedEntityLicense = selectedLicense;
|
|
1331
1334
|
state.data.businessTypeData.selectedLicense = selectedLicense;
|
|
1332
|
-
if (!isOtherLicense(selectedLicense))
|
|
1335
|
+
if (!isOtherLicense(selectedLicense)) {
|
|
1333
1336
|
state.data.businessTypeData.licenseNumber = ((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
1337
|
+
state.data.businessTypeData.unifiedNumber = ((_c = (_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '';
|
|
1338
|
+
}
|
|
1334
1339
|
}
|
|
1335
1340
|
})
|
|
1336
1341
|
.addCase(retrieveAllEntityList.rejected, function (state, action) {
|
|
@@ -1129,13 +1129,13 @@ export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLe
|
|
|
1129
1129
|
export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDataAsync ', function (_a, thunkApi) {
|
|
1130
1130
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
1131
1131
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1132
|
-
var _b, settings, connectExpress, selectedLicense, brandName, licenseNumber, termAndConditionChecked, isKWCountry, isFL, _c, responseData, isLeadIdPassed, id, brandNameBody, payload, data;
|
|
1132
|
+
var _b, settings, connectExpress, selectedLicense, brandName, licenseNumber, termAndConditionChecked, unifiedNumber, isKWCountry, isFL, _c, responseData, isLeadIdPassed, id, brandNameBody, payload, data;
|
|
1133
1133
|
var _d, _e;
|
|
1134
1134
|
return __generator(this, function (_f) {
|
|
1135
1135
|
switch (_f.label) {
|
|
1136
1136
|
case 0:
|
|
1137
1137
|
_b = thunkApi.getState(), settings = _b.settings, connectExpress = _b.connectExpress;
|
|
1138
|
-
selectedLicense = formData.selectedLicense, brandName = formData.brandName, licenseNumber = formData.licenseNumber, termAndConditionChecked = formData.termAndConditionChecked;
|
|
1138
|
+
selectedLicense = formData.selectedLicense, brandName = formData.brandName, licenseNumber = formData.licenseNumber, termAndConditionChecked = formData.termAndConditionChecked, unifiedNumber = formData.unifiedNumber;
|
|
1139
1139
|
isKWCountry = isKW(settings.data.businessCountry.iso2);
|
|
1140
1140
|
isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
1141
1141
|
_c = connectExpress.data, responseData = _c.responseData, isLeadIdPassed = _c.isLeadIdPassed;
|
|
@@ -1153,6 +1153,7 @@ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDat
|
|
|
1153
1153
|
license_type: (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) ? (isFL ? LicenseType.FL : LicenseType.CR) : undefined,
|
|
1154
1154
|
business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type,
|
|
1155
1155
|
is_acknowledged: true,
|
|
1156
|
+
unified_number: unifiedNumber,
|
|
1156
1157
|
terms_conditions_accepted: !isLeadIdPassed ? termAndConditionChecked : undefined,
|
|
1157
1158
|
step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_BRAND_BUSINESS,
|
|
1158
1159
|
encryption_contract: []
|
|
@@ -1480,6 +1481,7 @@ var initialState = {
|
|
|
1480
1481
|
businessData: {
|
|
1481
1482
|
brandName: '',
|
|
1482
1483
|
licenseNumber: '',
|
|
1484
|
+
unifiedNumber: '',
|
|
1483
1485
|
termAndConditionChecked: false
|
|
1484
1486
|
},
|
|
1485
1487
|
authenticationData: {
|
|
@@ -1776,7 +1778,7 @@ export var connectSlice = createSlice({
|
|
|
1776
1778
|
state.error = null;
|
|
1777
1779
|
})
|
|
1778
1780
|
.addCase(retrieveEntityListAsync.fulfilled, function (state, action) {
|
|
1779
|
-
var _a, _b;
|
|
1781
|
+
var _a, _b, _c, _d;
|
|
1780
1782
|
state.loading = false;
|
|
1781
1783
|
var data = action.payload;
|
|
1782
1784
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
@@ -1796,7 +1798,8 @@ export var connectSlice = createSlice({
|
|
|
1796
1798
|
}
|
|
1797
1799
|
}
|
|
1798
1800
|
licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
|
|
1799
|
-
var
|
|
1801
|
+
var _e = ((_b = state.data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) || {}, license_number = _e.license_number, license_type = _e.license_type, entity = _e.entity;
|
|
1802
|
+
var unified_number = (_d = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.additional_info) === null || _d === void 0 ? void 0 : _d.unified_number;
|
|
1800
1803
|
var selectedLicense = undefined;
|
|
1801
1804
|
if (license_number) {
|
|
1802
1805
|
var findLicense = licenseList.find(function (_a) {
|
|
@@ -1812,6 +1815,18 @@ export var connectSlice = createSlice({
|
|
|
1812
1815
|
selectedLicense = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: license_number } });
|
|
1813
1816
|
state.data.businessData.licenseNumber = license_number;
|
|
1814
1817
|
}
|
|
1818
|
+
if (unified_number) {
|
|
1819
|
+
var findLicense = licenseList.find(function (_a) {
|
|
1820
|
+
var _b;
|
|
1821
|
+
var license = _a.license;
|
|
1822
|
+
return ((_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) === unified_number;
|
|
1823
|
+
});
|
|
1824
|
+
if (findLicense)
|
|
1825
|
+
selectedLicense = findLicense;
|
|
1826
|
+
else
|
|
1827
|
+
selectedLicense = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: '', additional_info: { unified_number: unified_number } } });
|
|
1828
|
+
state.data.businessData.unifiedNumber = unified_number;
|
|
1829
|
+
}
|
|
1815
1830
|
state.data.businessData.selectedLicense = selectedLicense;
|
|
1816
1831
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { licenseList: licenseList });
|
|
1817
1832
|
})
|
|
@@ -102,8 +102,9 @@ export declare const terminalSlice: import("@reduxjs/toolkit").Slice<TerminalDat
|
|
|
102
102
|
resetOTPScreen: (state: TerminalDataState) => void;
|
|
103
103
|
storeSelectedTerminalDevice: (state: TerminalDataState, action: ActionState<TerminalDeviceInfo>) => void;
|
|
104
104
|
storeSelectedTerminal: (state: TerminalDataState, action: ActionState<TerminalInfo>) => void;
|
|
105
|
+
resetTerminalLinkResponse: (state: TerminalDataState) => void;
|
|
105
106
|
}, "terminal/store">;
|
|
106
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, storeSelectedTerminalDevice: import("@reduxjs/toolkit").ActionCreatorWithPayload<TerminalDeviceInfo, string>, storeSelectedTerminal: import("@reduxjs/toolkit").ActionCreatorWithPayload<TerminalInfo, string>;
|
|
107
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, storeSelectedTerminalDevice: import("@reduxjs/toolkit").ActionCreatorWithPayload<TerminalDeviceInfo, string>, storeSelectedTerminal: import("@reduxjs/toolkit").ActionCreatorWithPayload<TerminalInfo, string>, resetTerminalLinkResponse: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
107
108
|
declare const _default: import("redux").Reducer<TerminalDataState, import("redux").AnyAction>;
|
|
108
109
|
export default _default;
|
|
109
110
|
export declare const terminalSelector: (state: RootState) => TerminalDataState;
|
|
@@ -431,7 +431,7 @@ export var onCloseCompleteTerminal = createAsyncThunk('terminal/onCloseCompleteT
|
|
|
431
431
|
});
|
|
432
432
|
}); });
|
|
433
433
|
var initialState = {
|
|
434
|
-
error:
|
|
434
|
+
error: null,
|
|
435
435
|
loading: false,
|
|
436
436
|
customLoading: false,
|
|
437
437
|
terminalListLoading: false,
|
|
@@ -470,6 +470,9 @@ export var terminalSlice = createSlice({
|
|
|
470
470
|
},
|
|
471
471
|
storeSelectedTerminal: function (state, action) {
|
|
472
472
|
state.data.terminalInfo.selectedTerminal = action.payload;
|
|
473
|
+
},
|
|
474
|
+
resetTerminalLinkResponse: function (state) {
|
|
475
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { linkTerminalDeviceData: undefined, pushNotificationLinkedNewTerminalData: undefined, linkNewTerminalData: undefined });
|
|
473
476
|
}
|
|
474
477
|
},
|
|
475
478
|
extraReducers: function (builder) {
|
|
@@ -668,6 +671,6 @@ export var terminalSlice = createSlice({
|
|
|
668
671
|
});
|
|
669
672
|
}
|
|
670
673
|
});
|
|
671
|
-
export var clearError = (_a = terminalSlice.actions, _a.clearError), setError = _a.setError, stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, storeSelectedTerminalDevice = _a.storeSelectedTerminalDevice, storeSelectedTerminal = _a.storeSelectedTerminal;
|
|
674
|
+
export var clearError = (_a = terminalSlice.actions, _a.clearError), setError = _a.setError, stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen, storeSelectedTerminalDevice = _a.storeSelectedTerminalDevice, storeSelectedTerminal = _a.storeSelectedTerminal, resetTerminalLinkResponse = _a.resetTerminalLinkResponse;
|
|
672
675
|
export default terminalSlice.reducer;
|
|
673
676
|
export var terminalSelector = function (state) { return state.terminal; };
|
|
@@ -76,8 +76,8 @@ var EntityList = function (_a) {
|
|
|
76
76
|
var selectedEntity = selectedEntityControl.field.value;
|
|
77
77
|
React.useEffect(function () {
|
|
78
78
|
if (entityList.length > 0) {
|
|
79
|
-
var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; });
|
|
80
|
-
var list_1 = __spreadArray(__spreadArray([], filteredEntityList, true), [entityList[entityList.length - 1]], false)
|
|
79
|
+
var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; }) || [];
|
|
80
|
+
var list_1 = __spreadArray(__spreadArray([], filteredEntityList, true), [entityList[entityList.length - 1]], false);
|
|
81
81
|
setList(list_1);
|
|
82
82
|
if (filteredEntityList.length) {
|
|
83
83
|
setValue('entityInfo', filteredEntityList[0], { shouldValidate: true });
|
|
@@ -32,6 +32,7 @@ import Article from './Article';
|
|
|
32
32
|
import EntityLicenseList from './EntityLicenseList';
|
|
33
33
|
import LicenseNumber from './LicenseNumber';
|
|
34
34
|
import EntityName from './EntityName';
|
|
35
|
+
import UnifiedNumber from './UnifiedNumber';
|
|
35
36
|
var ListType;
|
|
36
37
|
(function (ListType) {
|
|
37
38
|
ListType["LicenseList"] = "LicenseList";
|
|
@@ -40,7 +41,7 @@ var ListType;
|
|
|
40
41
|
var BusinessType = function (_a) {
|
|
41
42
|
var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading, uploadingArticle = _b.uploadingArticle;
|
|
42
43
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
43
|
-
var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId, articleId = _c.articleId, selectedEntityLicense = _c.selectedEntityLicense, responseBody = _c.responseBody, isPrevDob = _c.isPrevDob;
|
|
44
|
+
var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId, articleId = _c.articleId, selectedEntityLicense = _c.selectedEntityLicense, responseBody = _c.responseBody, isPrevDob = _c.isPrevDob, unifiedNumber = _c.unifiedNumber;
|
|
44
45
|
var entityLicenseList = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.entityLicenseList) || [];
|
|
45
46
|
var t = useTranslation().t;
|
|
46
47
|
var isAr = useLanguage().isAr;
|
|
@@ -73,6 +74,7 @@ var BusinessType = function (_a) {
|
|
|
73
74
|
selectedLicense: selectedLicense,
|
|
74
75
|
selectedEntityLicense: selectedEntityLicense,
|
|
75
76
|
licenseNumber: licenseNumber,
|
|
77
|
+
unifiedNumber: unifiedNumber,
|
|
76
78
|
entityLegalName: entityLegalName,
|
|
77
79
|
certificateId: certificateId,
|
|
78
80
|
articleId: articleId
|
|
@@ -89,6 +91,7 @@ var BusinessType = function (_a) {
|
|
|
89
91
|
selectedLicense: data.selectedLicense,
|
|
90
92
|
selectedEntityLicense: data.selectedEntityLicense,
|
|
91
93
|
licenseNumber: data.licenseNumber,
|
|
94
|
+
unifiedNumber: data.unifiedNumber,
|
|
92
95
|
entityLegalName: data.entityLegalName,
|
|
93
96
|
certificateId: data.certificateId,
|
|
94
97
|
articleId: data.articleId
|
|
@@ -98,17 +101,25 @@ var BusinessType = function (_a) {
|
|
|
98
101
|
var onBack = function () {
|
|
99
102
|
dispatch(handlePrevScreenStep(isPrevDob ? 'BUSINESS_DOB_STEP' : 'BUSINESS_IDBOD_STEP'));
|
|
100
103
|
};
|
|
104
|
+
var showLicenseNumber = function () {
|
|
105
|
+
if (isKWCountry)
|
|
106
|
+
return !isAnyListActive && isCR;
|
|
107
|
+
if (isSACountry)
|
|
108
|
+
return !isAnyListActive && isFL;
|
|
109
|
+
return !isAnyListActive;
|
|
110
|
+
};
|
|
101
111
|
var isLicenseListActive = listActive === ListType.LicenseList;
|
|
102
112
|
var isEntityLicenseListActive = listActive === ListType.EntityLicenseList;
|
|
103
113
|
var isAnyListActive = isLicenseListActive || isEntityLicenseListActive;
|
|
104
114
|
var selected = methods.getValues('selectedLicense');
|
|
105
115
|
var selectedLicenseEntity = methods.getValues('selectedEntityLicense');
|
|
106
116
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === Type.CR;
|
|
117
|
+
var isFL = (selected === null || selected === void 0 ? void 0 : selected.type) === Type.FL;
|
|
107
118
|
var hasEntityList = !!(entityLicenseList === null || entityLicenseList === void 0 ? void 0 : entityLicenseList.length);
|
|
108
119
|
var showLicenseList = hasEntityList ? (isSACountry || isOtherCountry) && isOtherLicense(selectedLicenseEntity) : isSACountry || isOtherCountry;
|
|
109
120
|
var showEntityList = isKWCountry ? hasEntityList && !isLicenseListActive && isCR : hasEntityList && !isLicenseListActive;
|
|
110
121
|
var disabled = !methods.formState.isValid || uploading || uploadingArticle;
|
|
111
122
|
var disableBack = !data.otpData.isNID;
|
|
112
|
-
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:
|
|
123
|
+
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: showLicenseNumber() }), _jsx(UnifiedNumber, { show: isSACountry && 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') })) }))] })) })) }));
|
|
113
124
|
};
|
|
114
125
|
export default React.memo(BusinessType);
|
|
@@ -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 { isKW, isOtherLicense } from '../../../../utils';
|
|
39
|
+
import { isKW, isOtherLicense, isSA } from '../../../../utils';
|
|
40
40
|
import { settingsSelector } from '../../../../app/settings';
|
|
41
41
|
import { OTHER_CR_LICENSE } from '../../../../constants';
|
|
42
42
|
var InputStyled = styled(InputSelect)(function (_a) {
|
|
@@ -67,6 +67,7 @@ var EntityLicenseList = function (_a) {
|
|
|
67
67
|
var entityLicenseList = (responseBody || {}).entityLicenseList;
|
|
68
68
|
var country_code = settingsData.businessCountry.iso2;
|
|
69
69
|
var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
|
|
70
|
+
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
70
71
|
var onOpenLicenseList = function (event) {
|
|
71
72
|
var _a;
|
|
72
73
|
setAnchorEl(event.currentTarget);
|
|
@@ -90,8 +91,10 @@ var EntityLicenseList = function (_a) {
|
|
|
90
91
|
}
|
|
91
92
|
}, [entityLicenseList, selectedEntityLicense]);
|
|
92
93
|
var getLicenseNumber = function (item) {
|
|
93
|
-
var _a;
|
|
94
|
-
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.CR && isSACountry)
|
|
96
|
+
return ((_b = (_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) || '';
|
|
97
|
+
return ((_c = item === null || item === void 0 ? void 0 : item.license) === null || _c === void 0 ? void 0 : _c.number) || '';
|
|
95
98
|
};
|
|
96
99
|
var getLicenseName = function (item) {
|
|
97
100
|
var _a, _b;
|
|
@@ -100,6 +103,7 @@ var EntityLicenseList = function (_a) {
|
|
|
100
103
|
return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
|
|
101
104
|
};
|
|
102
105
|
var onSelectItem = function (license) {
|
|
106
|
+
var _a, _b, _c;
|
|
103
107
|
if (error)
|
|
104
108
|
dispatch(clearError());
|
|
105
109
|
selectedEntityLicenseControl.field.onChange(license);
|
|
@@ -107,10 +111,12 @@ var EntityLicenseList = function (_a) {
|
|
|
107
111
|
var license_1 = isKWCountry ? OTHER_CR_LICENSE : {};
|
|
108
112
|
setValue('selectedLicense', license_1, { shouldValidate: true });
|
|
109
113
|
setValue('licenseNumber', '', { shouldValidate: true });
|
|
114
|
+
setValue('unifiedNumber', '', { shouldValidate: true });
|
|
110
115
|
}
|
|
111
116
|
else {
|
|
112
117
|
setValue('selectedLicense', license, { shouldValidate: true });
|
|
113
|
-
setValue('licenseNumber',
|
|
118
|
+
setValue('licenseNumber', ((_a = license === null || license === void 0 ? void 0 : license.license) === null || _a === void 0 ? void 0 : _a.number) || '', { shouldValidate: true });
|
|
119
|
+
setValue('unifiedNumber', ((_c = (_b = license === null || license === void 0 ? void 0 : license.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '', { shouldValidate: true });
|
|
114
120
|
}
|
|
115
121
|
onCloseLicenseList();
|
|
116
122
|
};
|
|
@@ -122,7 +128,7 @@ var EntityLicenseList = function (_a) {
|
|
|
122
128
|
var selected = selectedEntityLicenseControl.field.value;
|
|
123
129
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
124
130
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
125
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_entity_license'), onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_entity'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: entityLicenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
131
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_entity_license'), onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_entity'), value: (isCR ? t(getLicenseName(selected)) : flValue) || '' }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: entityLicenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
126
132
|
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
|
|
127
133
|
} }) }))] }) })));
|
|
128
134
|
};
|
|
@@ -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 { isKW, isOtherLicense } from '../../../../utils';
|
|
39
|
+
import { isKW, isOtherLicense, isSA } 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) {
|
|
@@ -66,6 +66,7 @@ var LicenseList = function (_a) {
|
|
|
66
66
|
var responseBody = businessTypeData.responseBody, selectedLicense = businessTypeData.selectedLicense, licenseNumber = businessTypeData.licenseNumber, entityLegalName = businessTypeData.entityLegalName;
|
|
67
67
|
var licenseList = (responseBody || { licenseList: [] }).licenseList;
|
|
68
68
|
var country_code = settingsData.businessCountry.iso2;
|
|
69
|
+
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
69
70
|
var onOpenLicenseList = function (event) {
|
|
70
71
|
var _a;
|
|
71
72
|
setAnchorEl(event.currentTarget);
|
|
@@ -99,8 +100,10 @@ var LicenseList = function (_a) {
|
|
|
99
100
|
}
|
|
100
101
|
}, [country_code]);
|
|
101
102
|
var getLicenseNumber = function (item) {
|
|
102
|
-
var _a;
|
|
103
|
-
|
|
103
|
+
var _a, _b, _c;
|
|
104
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.CR && isSACountry)
|
|
105
|
+
return ((_b = (_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) || '';
|
|
106
|
+
return ((_c = item === null || item === void 0 ? void 0 : item.license) === null || _c === void 0 ? void 0 : _c.number) || '';
|
|
104
107
|
};
|
|
105
108
|
var getLicenseName = function (item) {
|
|
106
109
|
var _a, _b;
|
|
@@ -109,13 +112,18 @@ var LicenseList = function (_a) {
|
|
|
109
112
|
return t((isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '');
|
|
110
113
|
};
|
|
111
114
|
var onSelectItem = function (license) {
|
|
115
|
+
var _a, _b, _c;
|
|
112
116
|
if (error)
|
|
113
117
|
dispatch(clearError());
|
|
114
118
|
selectedLicenseControl.field.onChange(license);
|
|
115
|
-
if (isOtherLicense(license))
|
|
119
|
+
if (isOtherLicense(license)) {
|
|
116
120
|
setValue('licenseNumber', '', { shouldValidate: true });
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
setValue('unifiedNumber', '', { shouldValidate: true });
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
setValue('licenseNumber', ((_a = license === null || license === void 0 ? void 0 : license.license) === null || _a === void 0 ? void 0 : _a.number) || '', { shouldValidate: true });
|
|
125
|
+
setValue('unifiedNumber', ((_c = (_b = license === null || license === void 0 ? void 0 : license.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '', { shouldValidate: true });
|
|
126
|
+
}
|
|
119
127
|
onCloseLicenseList();
|
|
120
128
|
};
|
|
121
129
|
var getLicenseFullName = function (item) {
|
|
@@ -126,7 +134,7 @@ var LicenseList = function (_a) {
|
|
|
126
134
|
var selected = selectedLicenseControl.field.value;
|
|
127
135
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
128
136
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
129
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
137
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('choose_any_license'), onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: (isCR ? t(getLicenseName(selected)) : flValue) || '' }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
130
138
|
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
|
|
131
139
|
} }) }))] }) })));
|
|
132
140
|
};
|