@tap-payments/auth-jsconnect 2.6.10-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.
Files changed (58) hide show
  1. package/build/@types/app.d.ts +2 -1
  2. package/build/@types/app.js +1 -0
  3. package/build/api/country.d.ts +1 -0
  4. package/build/api/country.js +8 -1
  5. package/build/api/index.d.ts +1 -0
  6. package/build/app/settings.js +2 -5
  7. package/build/constants/api.d.ts +1 -0
  8. package/build/constants/api.js +3 -1
  9. package/build/constants/app.js +11 -5
  10. package/build/constants/dummy.d.ts +45 -0
  11. package/build/constants/dummy.js +330 -0
  12. package/build/features/app/brand/brandStore.d.ts +2 -0
  13. package/build/features/app/brand/brandStore.js +19 -12
  14. package/build/features/app/business/businessStore.d.ts +5 -0
  15. package/build/features/app/business/businessStore.js +107 -72
  16. package/build/features/app/connectExpress/connectExpressStore.js +27 -13
  17. package/build/features/app/entity/entityStore.d.ts +2 -0
  18. package/build/features/app/entity/entityStore.js +23 -16
  19. package/build/features/app/individual/individualStore.d.ts +2 -0
  20. package/build/features/app/individual/individualStore.js +19 -12
  21. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -3
  22. package/build/features/business/screens/BusinessType/BusinessType.js +13 -5
  23. package/build/features/business/screens/BusinessType/EntityName.js +3 -3
  24. package/build/features/business/screens/BusinessType/LicenseList.js +3 -3
  25. package/build/features/business/screens/BusinessType/LicenseNumber.js +9 -8
  26. package/build/features/business/screens/BusinessType/validation.d.ts +10 -0
  27. package/build/features/business/screens/BusinessType/validation.js +16 -0
  28. package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -3
  29. package/build/features/connect/Connect.js +3 -3
  30. package/build/features/connect/screens/Mobile/Mobile.js +7 -6
  31. package/build/features/connect/screens/Mobile/MobileNumber.js +9 -6
  32. package/build/features/connectExpress/ConnectExpress.js +3 -3
  33. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +12 -4
  34. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +6 -6
  35. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +8 -7
  36. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +13 -0
  37. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +67 -0
  38. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +4 -0
  39. package/build/features/connectExpress/screens/IdentityOTP/OTP.js +1 -1
  40. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +1 -1
  41. package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -2
  42. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +9 -6
  43. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +4 -6
  44. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +4 -6
  45. package/build/features/entity/screens/EntityName/EntityName.js +11 -4
  46. package/build/features/entity/screens/EntityName/LicenseNumber.js +5 -4
  47. package/build/features/entity/screens/EntityName/validation.d.ts +28 -0
  48. package/build/features/entity/screens/EntityName/validation.js +38 -0
  49. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -4
  50. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +2 -2
  51. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -5
  52. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +1 -1
  53. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -2
  54. package/build/hooks/useCountry.d.ts +1 -0
  55. package/build/hooks/useCountry.js +4 -3
  56. package/build/utils/string.d.ts +1 -0
  57. package/build/utils/string.js +3 -0
  58. package/package.json +1 -1
@@ -279,7 +279,7 @@ export var retrieveBoardDetails = createAsyncThunk('entityRetrieveEntityInfo', f
279
279
  export var updateEntityName = createAsyncThunk('entityUpdateEntityName', function (_a, thunkApi) {
280
280
  var formData = _a.formData, originalFormData = _a.originalFormData;
281
281
  return __awaiter(void 0, void 0, void 0, function () {
282
- var _b, settings, entity, _c, id, data_status, data_verification, documents, issuingDate, expiryDate, licenseType, licenseNumber, articleId, unifiedNumber, legalName, certificateId, entityType, issueDate, expDate, isFL, isLegalNameENNonEditable, isLegalNameARNonEditable, isLicenseTypeNonEditable, isEntityTypeNonEditable, isLicenseNumberNonEditable, isUnifiedNumberNonEditable, isIssuingDateNonEditable, isExpiryDateNonEditable, isDocumentsNonEditable, isAOAFileNonEditable, isEntityTypeVerified, isLicenseNonEditable, isLicenseAvailable, payload, data, documentResponse, document, documentBody, documentBody, list;
282
+ var _b, settings, entity, _c, id, data_status, data_verification, documents, issuingDate, expiryDate, licenseType, licenseNumber, articleId, unifiedNumber, legalName, certificateId, entityType, issueDate, expDate, isFL, isLegalNameENNonEditable, isLegalNameARNonEditable, isLicenseTypeNonEditable, isEntityTypeNonEditable, isLicenseNumberNonEditable, isUnifiedNumberNonEditable, isIssuingDateNonEditable, isExpiryDateNonEditable, isDocumentsNonEditable, isAOAFileNonEditable, isEntityTypeVerified, isLicenseNonEditable, isLicenseAvailable, payload, data, currencyData, documentResponse, document, documentBody, documentBody, list;
283
283
  var _d, _e, _f;
284
284
  return __generator(this, function (_g) {
285
285
  switch (_g.label) {
@@ -328,19 +328,22 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
328
328
  return [4, API.entityService.updateEntity(payload)];
329
329
  case 1:
330
330
  data = _g.sent();
331
+ return [4, API.countryService.getCurrency(settings.data.businessCountry.iso2)];
332
+ case 2:
333
+ currencyData = _g.sent();
331
334
  documentResponse = undefined;
332
335
  document = getRecentDocumentBasedOnPurpose(documents, DocumentPurpose.CR);
333
- if (!(!isDocumentsNonEditable && (certificateId || []).length > 0)) return [3, 7];
334
- if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 3];
336
+ if (!(!isDocumentsNonEditable && (certificateId || []).length > 0)) return [3, 8];
337
+ if (!(document === null || document === void 0 ? void 0 : document.id)) return [3, 4];
335
338
  documentBody = {
336
339
  id: document.id,
337
340
  images: certificateId
338
341
  };
339
342
  return [4, API.documentService.addFilesToExistingDocument(documentBody)];
340
- case 2:
341
- documentResponse = _g.sent();
342
- return [3, 5];
343
343
  case 3:
344
+ documentResponse = _g.sent();
345
+ return [3, 6];
346
+ case 4:
344
347
  documentBody = {
345
348
  entity_id: id || '',
346
349
  documents: [
@@ -351,21 +354,21 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
351
354
  ]
352
355
  };
353
356
  return [4, API.documentService.updateDocumentInfo(documentBody)];
354
- case 4:
357
+ case 5:
355
358
  documentResponse = _g.sent();
356
- _g.label = 5;
357
- case 5: return [4, API.entityService.retrieveEntity(id)];
358
- case 6:
359
+ _g.label = 6;
360
+ case 6: return [4, API.entityService.retrieveEntity(id)];
361
+ case 7:
359
362
  data = _g.sent();
360
363
  data.documentData = documentResponse;
361
- _g.label = 7;
362
- case 7: return [4, API.dataService.getActivitiesIsIc()];
363
- case 8:
364
+ _g.label = 8;
365
+ case 8: return [4, API.dataService.getActivitiesIsIc()];
366
+ case 9:
364
367
  list = (_g.sent()).list;
365
368
  data.activityList = list;
366
369
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
367
370
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
368
- return [2, { data: data, formData: originalFormData }];
371
+ return [2, { data: data, formData: originalFormData, currencyData: currencyData }];
369
372
  }
370
373
  });
371
374
  });
@@ -475,6 +478,7 @@ var initialState = {
475
478
  uploadingArticle: false,
476
479
  data: {
477
480
  flowName: FlowsTypes.ENTITY,
481
+ currency: '',
478
482
  verify: {
479
483
  token: ''
480
484
  },
@@ -673,10 +677,13 @@ export var entitySlice = createSlice({
673
677
  state.error = null;
674
678
  })
675
679
  .addCase(updateEntityName.fulfilled, function (state, action) {
680
+ var _a;
676
681
  state.loading = false;
677
682
  state.error = null;
678
- var _a = action.payload, data = _a.data, formData = _a.formData;
679
- var _b = data || {}, activityList = _b.activityList, rest = __rest(_b, ["activityList"]);
683
+ var _b = action.payload, data = _b.data, formData = _b.formData, currencyData = _b.currencyData;
684
+ var _c = data || {}, activityList = _c.activityList, rest = __rest(_c, ["activityList"]);
685
+ if ((_a = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _a === void 0 ? void 0 : _a.english)
686
+ state.data.currency = currencyData.code.english;
680
687
  state.data.entityNameData = __assign(__assign({}, formData), { certificateId: undefined });
681
688
  state.data.entityNameData.responseBody = __assign(__assign({}, state.data.entityNameData.responseBody), { rest: rest });
682
689
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { entity: data === null || data === void 0 ? void 0 : data.entity, activityList: activityList });
@@ -100,6 +100,7 @@ export declare const updatePhoneInfo: import("@reduxjs/toolkit").AsyncThunk<{
100
100
  export declare const updateIndividualPersonalInfo: import("@reduxjs/toolkit").AsyncThunk<{
101
101
  data: any;
102
102
  formData: IndividualPersonalInfoFormValues;
103
+ currencyData: any;
103
104
  }, AsyncThunkParams<IndividualPersonalInfoFormValues>, {}>;
104
105
  export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk<{
105
106
  data: any;
@@ -131,6 +132,7 @@ export interface IndividualData {
131
132
  individualPersonalData: IndividualPersonalInfoFormValues & ResponseData;
132
133
  individualData: IndividualExtraFormValues & ResponseData;
133
134
  flowName: FlowsTypes;
135
+ currency: string;
134
136
  }
135
137
  export interface IndividualState extends SharedState<IndividualData> {
136
138
  customLoading?: boolean;
@@ -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;
@@ -553,7 +553,7 @@ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', func
553
553
  export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (_a, thunkApi) {
554
554
  var formData = _a.formData, originalFormData = _a.originalFormData;
555
555
  return __awaiter(void 0, void 0, void 0, function () {
556
- var _b, settings, individual, _c, notification, user, entity, id, _d, objects, ids, countryCode, name, email, mobile, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, data, _e, isUser, isBuyer, isUserORBuyerType;
556
+ var _b, settings, individual, _c, notification, user, entity, id, _d, objects, ids, countryCode, name, email, mobile, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, data, currencyData, _e, isUser, isBuyer, isUserORBuyerType;
557
557
  var _f, _g, _h, _j, _k;
558
558
  return __generator(this, function (_l) {
559
559
  switch (_l.label) {
@@ -634,17 +634,20 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
634
634
  return [4, API.individualService.updateMultipleIndividual(requestBody)];
635
635
  case 1:
636
636
  data = _l.sent();
637
+ return [4, API.countryService.getCurrency(settings.data.businessCountry.iso2)];
638
+ case 2:
639
+ currencyData = _l.sent();
637
640
  _e = getIndividualType(objects), isUser = _e.isUser, isBuyer = _e.isBuyer;
638
641
  isUserORBuyerType = isUser || isBuyer;
639
- if (!isUserORBuyerType) return [3, 3];
642
+ if (!isUserORBuyerType) return [3, 4];
640
643
  return [4, thunkApi.dispatch(retrieveDataList(code))];
641
- case 2:
642
- _l.sent();
643
- _l.label = 3;
644
644
  case 3:
645
+ _l.sent();
646
+ _l.label = 4;
647
+ case 4:
645
648
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
646
649
  (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
647
- return [2, { data: data, formData: originalFormData }];
650
+ return [2, { data: data, formData: originalFormData, currencyData: currencyData }];
648
651
  }
649
652
  });
650
653
  });
@@ -841,6 +844,7 @@ var initialState = {
841
844
  cityLoading: false,
842
845
  data: {
843
846
  flowName: FlowsTypes.INDIVIDUAL,
847
+ currency: '',
844
848
  verify: {
845
849
  token: ''
846
850
  },
@@ -1155,16 +1159,16 @@ export var individualSlice = createSlice({
1155
1159
  state.error = null;
1156
1160
  })
1157
1161
  .addCase(retrieveDataList.fulfilled, function (state, action) {
1158
- var _a;
1162
+ var _a, _b;
1159
1163
  state.loading = false;
1160
1164
  state.error = null;
1161
- var _b = action.payload, sourceIncome = _b.sourceIncome, monthlyIncome = _b.monthlyIncome, occupationData = _b.occupation;
1165
+ var _c = action.payload, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome, occupationData = _c.occupation;
1162
1166
  var data = state.data.individualData.responseBody;
1163
1167
  var sourceIncomeList = (sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.list) || [];
1164
- 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;
1165
1169
  var occupationList = (occupationData === null || occupationData === void 0 ? void 0 : occupationData.list) || [];
1166
1170
  state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncomeList, monthlyIncomeList: monthlyIncomeList, occupationList: occupationList });
1167
- var _c = ((_a = state.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.user) || {}, source_income = _c.source_income, monthly_income = _c.monthly_income, occupation = _c.occupation;
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;
1168
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]);
1169
1173
  if (!!selectedSourceIncome)
1170
1174
  state.data.individualData.sourceIncome = selectedSourceIncome;
@@ -1223,11 +1227,14 @@ export var individualSlice = createSlice({
1223
1227
  state.error = null;
1224
1228
  })
1225
1229
  .addCase(updateIndividualPersonalInfo.fulfilled, function (state, action) {
1230
+ var _a;
1226
1231
  state.loading = false;
1227
1232
  state.error = null;
1228
- var _a = action.payload, data = _a.data, formData = _a.formData;
1233
+ var _b = action.payload, data = _b.data, formData = _b.formData, currencyData = _b.currencyData;
1229
1234
  state.data.individualPersonalData = formData;
1230
1235
  state.data.individualPersonalData.responseBody = data;
1236
+ if ((_a = currencyData === null || currencyData === void 0 ? void 0 : currencyData.code) === null || _a === void 0 ? void 0 : _a.english)
1237
+ state.data.currency = currencyData.code.english;
1231
1238
  })
1232
1239
  .addCase(updateIndividualPersonalInfo.rejected, function (state, action) {
1233
1240
  state.loading = false;
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import Box from '@mui/material/Box';
17
17
  import { styled } from '@mui/material/styles';
18
- import { findCurrencyByIso2, isExist } from '../../../../utils';
18
+ import { isExist } from '../../../../utils';
19
19
  import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
20
20
  import { settingsSelector } from '../../../../app/settings';
21
21
  import SimpleList from '../../../../components/SimpleList';
@@ -68,7 +68,7 @@ var ExpectedSalesRange = function (_a) {
68
68
  var expectedSaleControl = useController({ name: 'expectedSale', control: control });
69
69
  var _g = useAppSelector(brandSelector), data = _g.data, error = _g.error;
70
70
  var settingsData = useAppSelector(settingsSelector).data;
71
- var brandActivities = data.brandActivities;
71
+ var brandActivities = data.brandActivities, currency = data.currency;
72
72
  var expectedSales = (brandActivities.responseBody || {}).expectedSales;
73
73
  var expectedSalesRangeValue = expectedSaleControl.field.value;
74
74
  var countryCode = settingsData.businessCountry;
@@ -124,7 +124,7 @@ var ExpectedSalesRange = function (_a) {
124
124
  setSubIndex(item.id);
125
125
  }, [anchorEl, expectedSalesRangeValue]);
126
126
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('expected_sales_monthly', {
127
- currency: t(findCurrencyByIso2(countryCode.iso2))
127
+ currency: t(currency)
128
128
  }), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(InputStyled, { readOnly: readOnly, value: isAr ? (_b = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar) !== null && _b !== void 0 ? _b : '' : (_c = expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) !== null && _c !== void 0 ? _c : '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
129
129
  var isOnlyOneItem = !item.sub || item.sub.length === 1;
130
130
  if (isOnlyOneItem)
@@ -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(!isSACountry ? KWLicenseValidationSchema : LicenseValidationSchema),
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 && !isSACountry }), _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 && !isSACountry && isCR }), _jsx(LicenseNumber, { show: !isSACountry ? !isAnyListActive && isCR : !isAnyListActive }), _jsx(LicenseCertificate, { show: !isAnyListActive && !isSACountry && isCR }), _jsx(Article, { show: !isAnyListActive && !isSACountry && 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') })) }))] })) })) }));
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 { isSA, removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
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 isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
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: !isSACountry, endAdornment: _jsx(EndAdornment, { value: entityNameValue, error: error, onClear: clearEntityName }), placeholder: t('entity_legal_name_placeholder'), warningType: 'alert', warningMessage: error && t(error) }) }) })));
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 { isOtherLicense, isSA } from '../../../../utils';
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 isNonSA = !isSA(country_code);
94
- if (isNonSA) {
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, isSA, isOtherLicense } from '../../../../utils';
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 isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
34
- var selectedLicense = !isSACountry ? watch('selectedLicense') : getValues('selectedLicense');
35
- var selectedEntityLicense = !isSACountry ? watch('selectedEntityLicense') : getValues('selectedEntityLicense');
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 = !isSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_MAX_LENGTH : FL_NUMBER_MAX_LENGTH;
49
- var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : isCR ? CR_MIN_LICENSE_LENGTH : FL_MIN_LICENSE_LENGTH;
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 = !isSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
52
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: !isSACountry, 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 }) }) }) })));
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
+ });
@@ -21,7 +21,7 @@ import SimpleList from '../../../../components/SimpleList';
21
21
  import Collapse from '../../../../components/Collapse';
22
22
  import ExpandIcon from '../../../../components/ExpandIcon';
23
23
  import { businessSelector, clearError } from '../../../app/business/businessStore';
24
- import { findCurrencyByIso2, isExist } from '../../../../utils';
24
+ import { isExist } from '../../../../utils';
25
25
  import { ScreenContainer } from '../../../shared/Containers';
26
26
  import Search from '../../../shared/Search';
27
27
  import InputSelect from '../../../shared/InputSelect';
@@ -65,7 +65,7 @@ var ExpectedSalesRange = function (_a) {
65
65
  var expectedSaleControl = useController({ name: 'expectedSale', control: control });
66
66
  var _e = useAppSelector(businessSelector), data = _e.data, error = _e.error;
67
67
  var settingsData = useAppSelector(settingsSelector).data;
68
- var activitiesData = data.activitiesData;
68
+ var activitiesData = data.activitiesData, currency = data.currency;
69
69
  var expectedSales = (activitiesData.responseBody || {}).expectedSales;
70
70
  var expectedSalesRangeValue = expectedSaleControl.field.value;
71
71
  var countryCode = settingsData.businessCountry;
@@ -119,7 +119,7 @@ var ExpectedSalesRange = function (_a) {
119
119
  setSubIndex(item.id);
120
120
  }, [anchorEl, expectedSalesRangeValue]);
121
121
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_monthly', {
122
- currency: t(findCurrencyByIso2(countryCode.iso2))
122
+ currency: t(currency)
123
123
  }) }), _jsx(InputStyled, { value: (isAr ? expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.ar : expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.name.en) || '', onClick: !!anchorEl ? handleCloseMainMenu : handleOpenMainMenu, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { sx: { maxHeight: '350px', paddingTop: 0 }, list: expectedSalesRangeList, listItemProps: { sx: { padding: 0 } }, onSelectItem: function (item) {
124
124
  var isOnlyOneItem = !item.sub || item.sub.length === 1;
125
125
  if (isOnlyOneItem)
@@ -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 (isKW((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2))
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 _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
80
- var _d = React.useState(), listType = _d[0], setListType = _d[1];
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 _e = data.mobileData, mobile = _e.mobile, countryCode = _e.countryCode, termAndConditionChecked = _e.termAndConditionChecked;
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({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { 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
+ 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);
@@ -26,6 +26,7 @@ import Box from '@mui/material/Box';
26
26
  import { useTranslation } from 'react-i18next';
27
27
  import { useController, useFormContext } from 'react-hook-form';
28
28
  import { styled, alpha } from '@mui/material/styles';
29
+ import { settingsSelector } from '../../../../app/settings';
29
30
  import Text from '../../../../components/Text';
30
31
  import Collapse from '../../../../components/Collapse';
31
32
  import ClearIcon from '../../../shared/ClearIcon';
@@ -35,7 +36,7 @@ import { connectSelector } from '../../../app/connect/connectStore';
35
36
  import ExpandIcon from '../../../../components/ExpandIcon';
36
37
  import Input from '../../../shared/Input';
37
38
  import SimpleList from '../../../../components/SimpleList';
38
- import { removeAllCharsFromNumber, sendCustomEventToGTM } from '../../../../utils';
39
+ import { isOtherThanKWOrSA, removeAllCharsFromNumber, sendCustomEventToGTM } from '../../../../utils';
39
40
  import { useLanguage, useAppSelector } from '../../../../hooks';
40
41
  import Search from '../../../shared/Search';
41
42
  var LabelContainerStyled = styled(Box)(function (_a) {
@@ -80,14 +81,15 @@ var InputStyled = styled(Input)(function () { return ({
80
81
  }
81
82
  }); });
82
83
  var MobileNumber = React.forwardRef(function (_a, ref) {
83
- var _b, _c, _d;
84
+ var _b, _c, _d, _e;
84
85
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
85
- var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
86
- var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
86
+ var _f = React.useState(countries || []), countriesCode = _f[0], setCountries = _f[1];
87
+ var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
87
88
  var t = useTranslation().t;
88
89
  var isAr = useLanguage().isAr;
89
- var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
90
+ var _h = useFormContext(), control = _h.control, setValue = _h.setValue;
90
91
  var loading = useAppSelector(connectSelector).loading;
92
+ var settingsStore = useAppSelector(settingsSelector);
91
93
  var phoneControl = useController({ name: 'mobile', control: control });
92
94
  var countryCodeControl = useController({ name: 'countryCode', control: control });
93
95
  var countryCodeValue = countryCodeControl.field.value;
@@ -98,6 +100,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
98
100
  var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
99
101
  var isStartsWith5 = mobileValue.startsWith('5');
100
102
  var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
103
+ var isOtherThanKWOrSACountry = React.useMemo(function () { var _a; return isOtherThanKWOrSA((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_e = settingsStore.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2]);
101
104
  React.useEffect(function () {
102
105
  if (mobileValue)
103
106
  setValue('mobile', mobileValue, { shouldValidate: true });
@@ -151,7 +154,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
151
154
  });
152
155
  setCountries(filteredCountries);
153
156
  };
154
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
157
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : isOtherThanKWOrSACountry ? '117px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
155
158
  return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
156
159
  } })] }))] })) })));
157
160
  });
@@ -67,7 +67,7 @@ import { store } from '../../app/store';
67
67
  import { connectExpressSelector, setIsLeadIdPassed, setLeadId, retrieveLeadIdentityByIdAsync, setShowBoard } from '../app/connectExpress/connectExpressStore';
68
68
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
69
69
  import Collapse from '../../components/Collapse';
70
- import { isKW, findOrCreateElementAndInject, sendPageView } from '../../utils';
70
+ import { isKW, findOrCreateElementAndInject, sendPageView, isOtherThanKWOrSA } from '../../utils';
71
71
  import { CONNECT_EXPRESS_SCREENS_NAVIGATION } from '../../constants';
72
72
  import { connectExpressFeatureScreens } from '../featuresScreens';
73
73
  import Background from '../shared/Background';
@@ -118,8 +118,8 @@ var ConnectExpress = memo(function (_a) {
118
118
  }
119
119
  }, [data.isValidOperator, settingLoading]);
120
120
  React.useEffect(function () {
121
- var _a;
122
- if (!settingLoading && isKW((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2)) {
121
+ var _a, _b;
122
+ if (!settingLoading && (isKW((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2) || isOtherThanKWOrSA((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2))) {
123
123
  dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_MOBILE_STEP'));
124
124
  }
125
125
  }, [settingLoading]);