@tap-payments/auth-jsconnect 2.3.67-test → 2.3.69-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 (31) hide show
  1. package/build/@types/app.d.ts +13 -0
  2. package/build/@types/app.js +5 -0
  3. package/build/@types/form.d.ts +2 -1
  4. package/build/api/entity.d.ts +1 -0
  5. package/build/api/entity.js +8 -1
  6. package/build/api/index.d.ts +1 -0
  7. package/build/api/lead.d.ts +4 -1
  8. package/build/assets/locales/ar.json +4 -1
  9. package/build/assets/locales/en.json +4 -1
  10. package/build/constants/api.d.ts +1 -0
  11. package/build/constants/api.js +3 -1
  12. package/build/constants/app.d.ts +11 -0
  13. package/build/constants/app.js +11 -0
  14. package/build/features/app/business/businessStore.d.ts +8 -0
  15. package/build/features/app/business/businessStore.js +142 -137
  16. package/build/features/app/connectExpress/connectExpressStore.js +2 -2
  17. package/build/features/app/entity/entityStore.js +2 -2
  18. package/build/features/app/individual/individualStore.js +8 -9
  19. package/build/features/brand/screens/BrandActivities/ActivitiesList.js +2 -1
  20. package/build/features/business/screens/BusinessType/BusinessType.js +32 -8
  21. package/build/features/business/screens/BusinessType/EntityLicenseList.d.ts +9 -0
  22. package/build/features/business/screens/BusinessType/EntityLicenseList.js +132 -0
  23. package/build/features/business/screens/BusinessType/EntityName.js +6 -6
  24. package/build/features/business/screens/BusinessType/LicenseList.d.ts +1 -0
  25. package/build/features/business/screens/BusinessType/LicenseList.js +4 -16
  26. package/build/features/business/screens/BusinessType/LicenseNumber.d.ts +1 -2
  27. package/build/features/business/screens/BusinessType/LicenseNumber.js +4 -2
  28. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +1 -5
  29. package/build/utils/string.d.ts +2 -1
  30. package/build/utils/string.js +5 -0
  31. package/package.json +1 -1
@@ -93,6 +93,10 @@ export declare enum BusinessType {
93
93
  CR = "company",
94
94
  FL = "freelancer"
95
95
  }
96
+ export declare enum LicenseType {
97
+ CR = "commercial_registration",
98
+ FL = "freelance"
99
+ }
96
100
  export interface License {
97
101
  legal_name: {
98
102
  ar: string;
@@ -100,9 +104,18 @@ export interface License {
100
104
  };
101
105
  license: {
102
106
  number: string;
107
+ additional_info?: {
108
+ unified_number?: string;
109
+ };
110
+ expiry_date?: string;
111
+ issuing_date?: string;
112
+ type?: string;
103
113
  };
104
114
  type: string;
105
115
  }
116
+ export interface EntityLicense extends License {
117
+ id: string;
118
+ }
106
119
  export interface Activity {
107
120
  id: string;
108
121
  name: {
@@ -15,6 +15,11 @@ export var BusinessType;
15
15
  BusinessType["CR"] = "company";
16
16
  BusinessType["FL"] = "freelancer";
17
17
  })(BusinessType || (BusinessType = {}));
18
+ export var LicenseType;
19
+ (function (LicenseType) {
20
+ LicenseType["CR"] = "commercial_registration";
21
+ LicenseType["FL"] = "freelance";
22
+ })(LicenseType || (LicenseType = {}));
18
23
  export var FlowsTypes;
19
24
  (function (FlowsTypes) {
20
25
  FlowsTypes["CONNECT_EXPRESS"] = "connect_express";
@@ -1,4 +1,4 @@
1
- import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, MonthlyIncome, Occupation, SaleChannel, Segment, SourceOfIncome, TeamSize, City } from './app';
1
+ import { Activity, BrandInfo, CountryCode, CustomerLocation, ExpectedCustomer, ExpectedSaleRange, License, MonthlyIncome, Occupation, SaleChannel, Segment, SourceOfIncome, TeamSize, City, EntityLicense } from './app';
2
2
  export declare type MobileFormValues = {
3
3
  mobile: string;
4
4
  countryCode: CountryCode;
@@ -49,6 +49,7 @@ export declare type BrandActivitiesFormValues = {
49
49
  export declare type BusinessTypeFormValues = {
50
50
  licenseNumber: string;
51
51
  entityLegalName?: string;
52
+ selectedEntityLicense?: EntityLicense;
52
53
  selectedLicense?: License;
53
54
  certificateId?: Array<string>;
54
55
  articleId?: string;
@@ -119,5 +119,6 @@ declare const entityService: {
119
119
  retrieveEntityType: () => Promise<any>;
120
120
  updateEntityCapital: ({ id, ...data }: UpdateEntityCapitalBody) => Promise<any>;
121
121
  updateEntityAOAFile: ({ id, ...data }: UpdateEntityAOAFileBody) => Promise<any>;
122
+ retrieveAllEntities: (id: string) => Promise<any>;
122
123
  };
123
124
  export { entityService };
@@ -83,6 +83,12 @@ var retrieveEntityType = function () {
83
83
  url: "".concat(ENDPOINT_PATHS.ENTITY, "/types")
84
84
  });
85
85
  };
86
+ var retrieveAllEntities = function (id) {
87
+ return httpClient({
88
+ method: 'get',
89
+ url: "".concat(ENDPOINT_PATHS.BUSINESS, "/").concat(id)
90
+ });
91
+ };
86
92
  var entityService = {
87
93
  createEntityInfo: createEntityInfo,
88
94
  updateEntityInfo: updateEntityInfo,
@@ -95,6 +101,7 @@ var entityService = {
95
101
  updateEntityActivity: updateEntityActivity,
96
102
  retrieveEntityType: retrieveEntityType,
97
103
  updateEntityCapital: updateEntityCapital,
98
- updateEntityAOAFile: updateEntityAOAFile
104
+ updateEntityAOAFile: updateEntityAOAFile,
105
+ retrieveAllEntities: retrieveAllEntities
99
106
  };
100
107
  export { entityService };
@@ -63,6 +63,7 @@ declare const API: {
63
63
  retrieveEntityType: () => Promise<any>;
64
64
  updateEntityCapital: ({ id, ...data }: UpdateEntityCapitalBody) => Promise<any>;
65
65
  updateEntityAOAFile: ({ id, ...data }: UpdateEntityAOAFileBody) => Promise<any>;
66
+ retrieveAllEntities: (id: string) => Promise<any>;
66
67
  };
67
68
  availabilityServices: {
68
69
  checkEmail: (data: CheckEmailBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -39,10 +39,13 @@ export declare type UpdateLeadBody = {
39
39
  step_name?: string;
40
40
  id: string;
41
41
  encryption_contract?: Array<string>;
42
+ entity?: {
43
+ id: string;
44
+ };
42
45
  name?: Name;
43
46
  contact?: Contact;
44
47
  send_invite?: boolean;
45
- business?: BusinessName;
48
+ business_name?: BusinessName;
46
49
  business_type?: string;
47
50
  country_code?: string;
48
51
  brand?: BrandInfo;
@@ -393,5 +393,8 @@
393
393
  "file_download_error": "حدث خطأ ما في تحميل الملف. حاول مرة اخرى",
394
394
  "title_brand_logo": "لوجو العلامة التجارية",
395
395
  "description_brand_logo": "JPG or PNG files up to 4mb.",
396
- "powered_by": "بواسطة"
396
+ "powered_by": "بواسطة",
397
+ "add_other": "أخرى",
398
+ "choose_entity_license": "اختر ترخيص المنشأة",
399
+ "choose_license_entity": "- الرجاء الاختيار -"
397
400
  }
@@ -423,5 +423,8 @@
423
423
  "file_download_error": "Something went wrong with downloading file. Please try again",
424
424
  "title_brand_logo": "Brand Logo",
425
425
  "description_brand_logo": "JPG or PNG files up to 4mb.",
426
- "powered_by": "Powered by"
426
+ "powered_by": "Powered by",
427
+ "add_other": "Other",
428
+ "choose_entity_license": "Choose Entity License",
429
+ "choose_license_entity": "- Please select -"
427
430
  }
@@ -47,4 +47,5 @@ export declare const ENDPOINT_PATHS: {
47
47
  TEAM_SIZE_PATH: string;
48
48
  CITIES: string;
49
49
  INIT: string;
50
+ BUSINESS: string;
50
51
  };
@@ -47,6 +47,7 @@ var SEGMENTS_PATH = '/businessSegment/list';
47
47
  var TEAM_SIZE_PATH = '/businessSegment/team/list';
48
48
  var ADDRESS_PATH = '/address';
49
49
  var INIT_PATH = 'init';
50
+ var BUSINESS_PATH = '/business';
50
51
  export var ENDPOINT_PATHS = {
51
52
  CREATE_EXPRESS_AUTH_PATH: CREATE_EXPRESS_AUTH_PATH,
52
53
  Verify_Express_Auth_OTP_PATH: Verify_Express_Auth_OTP_PATH,
@@ -95,5 +96,6 @@ export var ENDPOINT_PATHS = {
95
96
  SEGMENTS_PATH: SEGMENTS_PATH,
96
97
  TEAM_SIZE_PATH: TEAM_SIZE_PATH,
97
98
  CITIES: CITIES_PATH,
98
- INIT: INIT_PATH
99
+ INIT: INIT_PATH,
100
+ BUSINESS: BUSINESS_PATH
99
101
  };
@@ -174,6 +174,17 @@ export declare const OTHER_FL_LICENSE: {
174
174
  };
175
175
  type: BusinessType;
176
176
  };
177
+ export declare const OTHER_ENTITY_LICENSE: {
178
+ id: string;
179
+ legal_name: {
180
+ ar: string;
181
+ en: string;
182
+ };
183
+ license: {
184
+ number: string;
185
+ };
186
+ type: BusinessType;
187
+ };
177
188
  export declare const OTHER_CR_LICENSE: {
178
189
  legal_name: {
179
190
  ar: string;
@@ -681,6 +681,17 @@ export var OTHER_FL_LICENSE = {
681
681
  },
682
682
  type: BusinessType.FL
683
683
  };
684
+ export var OTHER_ENTITY_LICENSE = {
685
+ id: '',
686
+ legal_name: {
687
+ ar: 'add_other',
688
+ en: 'add_other'
689
+ },
690
+ license: {
691
+ number: 'other_entity'
692
+ },
693
+ type: BusinessType.CR
694
+ };
684
695
  export var OTHER_CR_LICENSE = {
685
696
  legal_name: {
686
697
  ar: 'add_other_cr',
@@ -50,6 +50,14 @@ export declare const resendOTPLeadIdentity: import("@reduxjs/toolkit").AsyncThun
50
50
  export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<any, {
51
51
  leadId: string;
52
52
  }, {}>;
53
+ export declare const retrieveAllEntityList: import("@reduxjs/toolkit").AsyncThunk<{
54
+ data: any;
55
+ businessCountryCode: string;
56
+ entityId: string;
57
+ }, {
58
+ businessId: string;
59
+ entityId: string;
60
+ }, {}>;
53
61
  export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
54
62
  data: any;
55
63
  }, string, {}>;
@@ -57,12 +57,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
57
57
  var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import API from '../../../api';
60
- import { BusinessType, FlowsTypes, DocumentPurpose } from '../../../@types';
61
- import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
62
- import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat } from '../../../utils';
60
+ import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
61
+ import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
62
+ import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense } from '../../../utils';
63
63
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
- var payload, data, countryIso2, boardData, brandData, leadData, entity_activities, steps, brand, board_id, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, activityList;
65
+ var payload, data, countryIso2, boardData, brandData, leadData, entity_activities, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, activityList;
66
66
  var _a;
67
67
  return __generator(this, function (_b) {
68
68
  switch (_b.label) {
@@ -81,7 +81,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
81
81
  countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
82
82
  if (countryIso2)
83
83
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
84
- if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 19];
84
+ if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 20];
85
85
  boardData = undefined;
86
86
  brandData = undefined;
87
87
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
@@ -96,8 +96,8 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
96
96
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && !isKW(countryIso2)) {
97
97
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
98
98
  }
99
- if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 18];
100
- entity_activities = leadData.entity_activities, steps = leadData.steps, brand = leadData.brand, board_id = leadData.board_id;
99
+ if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 19];
100
+ entity_activities = leadData.entity_activities, steps = leadData.steps, brand = leadData.brand, board_id = leadData.board_id, business_id = leadData.business_id, entity = leadData.entity;
101
101
  brandID = brand === null || brand === void 0 ? void 0 : brand.id;
102
102
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
103
103
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
@@ -121,15 +121,15 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
121
121
  _b.label = 7;
122
122
  case 7:
123
123
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
124
- return [3, 18];
124
+ return [3, 19];
125
125
  case 8:
126
126
  if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 9];
127
127
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
128
- return [3, 18];
128
+ return [3, 19];
129
129
  case 9:
130
130
  if (!hasBusinessCustomersCompleted) return [3, 10];
131
131
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
132
- return [3, 18];
132
+ return [3, 19];
133
133
  case 10:
134
134
  if (!hasBusinessCRActivitiesCompleted) return [3, 13];
135
135
  return [4, thunkApi.dispatch(retrieveDataList())];
@@ -139,31 +139,33 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
139
139
  return [4, API.brandService.retrieveBrand(brandID)];
140
140
  case 12:
141
141
  brandData = _b.sent();
142
- return [3, 18];
142
+ return [3, 19];
143
143
  case 13:
144
144
  if (!hasBusinessCRInfoCompleted) return [3, 15];
145
145
  return [4, API.brandService.retrieveBrand(brandID)];
146
146
  case 14:
147
147
  brandData = _b.sent();
148
148
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
149
- return [3, 18];
150
- case 15:
151
- if (!isSA(countryIso2)) return [3, 17];
152
- return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
149
+ return [3, 19];
150
+ case 15: return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
153
151
  case 16:
154
152
  _b.sent();
155
- _b.label = 17;
153
+ if (!isSA(countryIso2)) return [3, 18];
154
+ return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
156
155
  case 17:
157
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
156
+ _b.sent();
158
157
  _b.label = 18;
159
- case 18: return [2, {
158
+ case 18:
159
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
160
+ _b.label = 19;
161
+ case 19: return [2, {
160
162
  data: data,
161
163
  leadData: __assign(__assign({}, leadData), { flows: (boardData === null || boardData === void 0 ? void 0 : boardData.info) || [] }),
162
164
  token: token,
163
165
  brandData: (brandData === null || brandData === void 0 ? void 0 : brandData.brand) || {},
164
166
  boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
165
167
  }];
166
- case 19: return [2, { data: data, isRequireOTP: true, token: token }];
168
+ case 20: return [2, { data: data, isRequireOTP: true, token: token }];
167
169
  }
168
170
  });
169
171
  }); });
@@ -185,7 +187,7 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
185
187
  });
186
188
  }); });
187
189
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
188
- var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, leadData, brand, country_code, steps, board_id, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, entity_activities, activityList, boardResponse;
190
+ var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, entity_activities, activityList, boardResponse;
189
191
  var _b, _c, _d, _e, _f, _g, _h;
190
192
  return __generator(this, function (_j) {
191
193
  switch (_j.label) {
@@ -211,7 +213,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
211
213
  case 2:
212
214
  leadData = (_j.sent()).data;
213
215
  thunkApi.dispatch(updateStepName(stepName));
214
- brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id;
216
+ brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id, business_id = leadData.business_id, entity = leadData.entity;
215
217
  brandID = brand === null || brand === void 0 ? void 0 : brand.id;
216
218
  countryIso2 = country_code;
217
219
  if (countryIso2)
@@ -222,70 +224,76 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
222
224
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
223
225
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
224
226
  isIdentityAuthStep = data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH;
225
- if (!(isSA(countryIso2) && !isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 4];
226
- return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
227
+ if (!(!isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 4];
228
+ return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
227
229
  case 3:
228
230
  _j.sent();
229
231
  _j.label = 4;
230
232
  case 4:
233
+ if (!(isSA(countryIso2) && !isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 6];
234
+ return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
235
+ case 5:
236
+ _j.sent();
237
+ _j.label = 6;
238
+ case 6:
231
239
  entity_activities = leadData.entity_activities;
232
- if (!(!entity_activities && hasBusinessCRInfoCompleted && !hasBusinessCompleted)) return [3, 6];
240
+ if (!(!entity_activities && hasBusinessCRInfoCompleted && !hasBusinessCompleted)) return [3, 8];
233
241
  return [4, API.dataService.getActivities()];
234
- case 5:
242
+ case 7:
235
243
  activityList = (_j.sent()).list;
236
244
  leadData = __assign(__assign({}, leadData), { entity_activities: activityList });
237
- _j.label = 6;
238
- case 6:
239
- if (!isNID) return [3, 7];
245
+ _j.label = 8;
246
+ case 8:
247
+ if (!isNID) return [3, 9];
240
248
  thunkApi.dispatch(handleNextScreenStep());
241
- return [3, 20];
242
- case 7:
243
- if (!(isIdentityAuthStep && isKW(countryIso2))) return [3, 8];
249
+ return [3, 22];
250
+ case 9:
251
+ if (!(isIdentityAuthStep && isKW(countryIso2))) return [3, 10];
244
252
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
245
- return [3, 20];
246
- case 8:
247
- if (!hasBusinessCompleted) return [3, 12];
248
- if (!board_id) return [3, 11];
253
+ return [3, 22];
254
+ case 10:
255
+ if (!hasBusinessCompleted) return [3, 14];
256
+ if (!board_id) return [3, 13];
249
257
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
250
- case 9:
258
+ case 11:
251
259
  boardResponse = _j.sent();
252
260
  leadData = __assign(__assign({}, leadData), { flows: (boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || [] });
253
261
  return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
254
- case 10:
262
+ case 12:
255
263
  _j.sent();
256
- _j.label = 11;
257
- case 11:
264
+ _j.label = 13;
265
+ case 13:
258
266
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
259
- return [3, 20];
260
- case 12:
261
- if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 13];
267
+ return [3, 22];
268
+ case 14:
269
+ if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 15];
262
270
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
263
- return [3, 20];
264
- case 13:
265
- if (!hasBusinessCustomersCompleted) return [3, 14];
271
+ return [3, 22];
272
+ case 15:
273
+ if (!hasBusinessCustomersCompleted) return [3, 16];
266
274
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
267
- return [3, 20];
268
- case 14:
269
- if (!hasBusinessCRActivitiesCompleted) return [3, 17];
275
+ return [3, 22];
276
+ case 16:
277
+ if (!hasBusinessCRActivitiesCompleted) return [3, 19];
270
278
  return [4, thunkApi.dispatch(retrieveDataList())];
271
- case 15:
279
+ case 17:
272
280
  _j.sent();
273
281
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
274
282
  return [4, API.brandService.retrieveBrand(brandID)];
275
- case 16:
283
+ case 18:
276
284
  brandData = _j.sent();
277
- return [3, 20];
278
- case 17:
279
- if (!hasBusinessCRInfoCompleted) return [3, 19];
285
+ return [3, 22];
286
+ case 19:
287
+ if (!hasBusinessCRInfoCompleted) return [3, 21];
280
288
  return [4, API.brandService.retrieveBrand(brandID)];
281
- case 18:
289
+ case 20:
282
290
  brandData = _j.sent();
283
291
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
284
- return [3, 20];
285
- case 19:
292
+ return [3, 22];
293
+ case 21:
286
294
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
287
- _j.label = 20;
288
- case 20: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
295
+ _j.label = 22;
296
+ case 22: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
289
297
  }
290
298
  });
291
299
  }); });
@@ -426,6 +434,19 @@ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function
426
434
  }
427
435
  });
428
436
  }); });
437
+ export var retrieveAllEntityList = createAsyncThunk('retrieveAllEntityList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
438
+ var settings, data;
439
+ return __generator(this, function (_a) {
440
+ switch (_a.label) {
441
+ case 0:
442
+ settings = thunkApi.getState().settings;
443
+ return [4, API.entityService.retrieveAllEntities(params.businessId)];
444
+ case 1:
445
+ data = _a.sent();
446
+ return [2, { data: data, businessCountryCode: settings.data.businessCountry.iso2, entityId: params.entityId }];
447
+ }
448
+ });
449
+ }); });
429
450
  export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', function (boardID) { return __awaiter(void 0, void 0, void 0, function () {
430
451
  var data;
431
452
  var _a, _b;
@@ -441,24 +462,25 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
441
462
  });
442
463
  }); });
443
464
  export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
444
- var _a, settings, business, isNonSA, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, isFL, payload, data, entity_activities, list, accountBody, accountData, documentData, entityData, entityId, documentBody, payload_1;
465
+ var _a, settings, business, isNonSA, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, selectedEntityLicense, isFL, payload, data, entity_activities, list, accountBody, accountData, documentData, entityData, entityId, documentBody, payload_1;
445
466
  var _b, _c, _d, _e;
446
467
  return __generator(this, function (_f) {
447
468
  switch (_f.label) {
448
469
  case 0:
449
470
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
450
471
  isNonSA = !isSA(settings.data.businessCountry.iso2);
451
- selectedLicense = params.selectedLicense, licenseNumber = params.licenseNumber, entityLegalName = params.entityLegalName, certificateId = params.certificateId, articleId = params.articleId;
472
+ selectedLicense = params.selectedLicense, licenseNumber = params.licenseNumber, entityLegalName = params.entityLegalName, certificateId = params.certificateId, articleId = params.articleId, selectedEntityLicense = params.selectedEntityLicense;
452
473
  isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
453
- payload = {
454
- id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
474
+ payload = __assign(__assign(__assign(__assign(__assign({ id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '' }, ((selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) &&
475
+ (isNonSA ? !isFL : true) && {
476
+ entity: { id: selectedEntityLicense.id }
477
+ })), (!(selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) && {
455
478
  license_number: isNonSA && isFL ? '' : licenseNumber,
456
- license_type: isFL ? 'freelance' : 'commercial_registration',
457
- business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type,
458
- step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO,
459
- business: isNonSA && isFL ? undefined : { ar: entityLegalName, en: entityLegalName },
460
- encryption_contract: ['license_number', 'business_type', 'license_type']
461
- };
479
+ license_type: isFL ? LicenseType.FL : LicenseType.CR,
480
+ business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type
481
+ })), { step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO }), (isNonSA && {
482
+ business_name: isFL ? undefined : { ar: entityLegalName, en: entityLegalName }
483
+ })), { encryption_contract: ['license_number', 'business_type', 'license_type'] });
462
484
  return [4, API.leadService.updateLead(payload)];
463
485
  case 1:
464
486
  data = _f.sent();
@@ -755,7 +777,9 @@ export var businessSlice = createSlice({
755
777
  state.data.otpData.isNID = false;
756
778
  if (isRequireOTP)
757
779
  return;
758
- var _d = state.data.verify.responseBody || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type;
780
+ var _d = state.data.verify.responseBody || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_name = _d.business_name;
781
+ if (business_name === null || business_name === void 0 ? void 0 : business_name.en)
782
+ state.data.businessTypeData.entityLegalName = business_name === null || business_name === void 0 ? void 0 : business_name.en;
759
783
  var issuingDate = ((_a = brandData === null || brandData === void 0 ? void 0 : brandData.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
760
784
  if (issuingDate)
761
785
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
@@ -766,37 +790,6 @@ export var businessSlice = createSlice({
766
790
  });
767
791
  state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
768
792
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
769
- var license = (entity || {}).license;
770
- if (license) {
771
- var number_1 = license.number;
772
- var _e = state.data.businessTypeData || {}, busResData = _e.responseBody, selectedLicense = _e.selectedLicense;
773
- var licenseList = (busResData === null || busResData === void 0 ? void 0 : busResData.licenseList) || [];
774
- var selectedLicenseData = selectedLicense;
775
- if (number_1) {
776
- var findLicense = licenseList.find(function (_a) {
777
- var license = _a.license;
778
- return license.number === number_1;
779
- });
780
- if (findLicense)
781
- selectedLicenseData = findLicense;
782
- else if (!findLicense && business_type === BusinessType.FL) {
783
- selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { legal_name: {
784
- ar: number_1,
785
- en: number_1
786
- }, license: { number: number_1 } });
787
- state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: __spreadArray([selectedLicenseData], licenseList, true) });
788
- }
789
- else {
790
- selectedLicenseData = __assign(__assign({}, OTHER_CR_LICENSE), { legal_name: {
791
- ar: number_1,
792
- en: number_1
793
- }, license: { number: number_1 } });
794
- state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: __spreadArray([selectedLicenseData], licenseList, true) });
795
- }
796
- state.data.businessTypeData.licenseNumber = number_1;
797
- }
798
- state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
799
- }
800
793
  })
801
794
  .addCase(verifyLeadToken.rejected, function (state, action) {
802
795
  state.error = action.error.message;
@@ -831,7 +824,9 @@ export var businessSlice = createSlice({
831
824
  state.data.otpData = formData;
832
825
  state.data.otpData.responseBody = data;
833
826
  state.data.verify.responseBody = __assign(__assign(__assign({}, leadData), state.data.verify.responseBody), { flows: (leadData === null || leadData === void 0 ? void 0 : leadData.flows) || [] });
834
- var _d = leadData || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_type = _d.business_type;
827
+ var _d = leadData || {}, entity = _d.entity, entity_activities = _d.entity_activities, business_name = _d.business_name;
828
+ if (business_name === null || business_name === void 0 ? void 0 : business_name.en)
829
+ state.data.businessTypeData.entityLegalName = business_name === null || business_name === void 0 ? void 0 : business_name.en;
835
830
  var issuingDate = ((_a = brand === null || brand === void 0 ? void 0 : brand.operations) === null || _a === void 0 ? void 0 : _a.start_date) || ((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date);
836
831
  if (issuingDate)
837
832
  state.data.activitiesData.operationStartDate = convertNumbers2English(dateFormat(issuingDate));
@@ -842,37 +837,6 @@ export var businessSlice = createSlice({
842
837
  });
843
838
  state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
844
839
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
845
- var license = (entity || {}).license;
846
- if (license) {
847
- var number_2 = license.number;
848
- var _e = state.data.businessTypeData || {}, busResData = _e.responseBody, selectedLicense = _e.selectedLicense;
849
- var licenseList = (busResData === null || busResData === void 0 ? void 0 : busResData.licenseList) || [];
850
- var selectedLicenseData = selectedLicense;
851
- if (number_2) {
852
- var findLicense = licenseList.find(function (_a) {
853
- var license = _a.license;
854
- return license.number === number_2;
855
- });
856
- if (findLicense)
857
- selectedLicenseData = findLicense;
858
- else if (!findLicense && business_type === BusinessType.FL) {
859
- selectedLicenseData = __assign(__assign({}, OTHER_FL_LICENSE), { legal_name: {
860
- ar: number_2,
861
- en: number_2
862
- }, license: { number: number_2 } });
863
- state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: __spreadArray([selectedLicenseData], licenseList, true) });
864
- }
865
- else {
866
- selectedLicenseData = __assign(__assign({}, OTHER_CR_LICENSE), { legal_name: {
867
- ar: number_2,
868
- en: number_2
869
- }, license: { number: number_2 } });
870
- state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: __spreadArray([selectedLicenseData], licenseList, true) });
871
- }
872
- state.data.businessTypeData.licenseNumber = number_2;
873
- }
874
- state.data.businessTypeData.selectedLicense = __assign(__assign({}, selectedLicenseData), { type: business_type });
875
- }
876
840
  })
877
841
  .addCase(verifyLeadOTP.rejected, function (state, action) {
878
842
  state.loading = false;
@@ -965,6 +929,7 @@ export var businessSlice = createSlice({
965
929
  state.error = null;
966
930
  state.loading = false;
967
931
  var data = action.payload;
932
+ var entityLicenseList = (state.data.businessTypeData.responseBody || {}).entityLicenseList;
968
933
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
969
934
  var licenseList = [];
970
935
  if (!description) {
@@ -979,19 +944,59 @@ export var businessSlice = createSlice({
979
944
  return __assign(__assign({}, item), { type: BusinessType.FL });
980
945
  });
981
946
  licenseList = __spreadArray(__spreadArray([], licenseList, true), mappedFL, true);
947
+ licenseList = licenseList.filter(function (_a) {
948
+ var license = _a.license;
949
+ return !(entityLicenseList || []).some(function (e) { return e.license.number === license.number; });
950
+ });
982
951
  }
983
952
  }
984
953
  licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
985
954
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: licenseList });
986
- var selectedLicense = licenseList === null || licenseList === void 0 ? void 0 : licenseList[0];
987
- var isOtherLicense = ((_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';
988
- state.data.businessTypeData.selectedLicense = selectedLicense;
989
- if (!isOtherLicense)
990
- state.data.businessTypeData.licenseNumber = ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) || '';
955
+ if (!(entityLicenseList === null || entityLicenseList === void 0 ? void 0 : entityLicenseList.length)) {
956
+ var selectedLicense = licenseList === null || licenseList === void 0 ? void 0 : licenseList[0];
957
+ 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';
958
+ state.data.businessTypeData.selectedLicense = selectedLicense;
959
+ if (!isOtherLicense_1)
960
+ state.data.businessTypeData.licenseNumber = ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) || '';
961
+ }
991
962
  })
992
963
  .addCase(retrieveEntityList.rejected, function (state, action) {
993
964
  state.error = action.error.message;
994
965
  state.loading = false;
966
+ })
967
+ .addCase(retrieveAllEntityList.pending, function (state) {
968
+ state.error = null;
969
+ state.loading = true;
970
+ })
971
+ .addCase(retrieveAllEntityList.fulfilled, function (state, action) {
972
+ var _a;
973
+ state.error = null;
974
+ state.loading = false;
975
+ var _b = action.payload, data = _b.data, businessCountryCode = _b.businessCountryCode, entityId = _b.entityId;
976
+ var isKWCountry = isKW(businessCountryCode);
977
+ var list = (data === null || data === void 0 ? void 0 : data.entities_info) || [];
978
+ if (isKWCountry) {
979
+ list = list.filter(function (l) { return l.license.type !== LicenseType.FL; });
980
+ }
981
+ var entityLicenseList = [];
982
+ if (list.length > 0) {
983
+ entityLicenseList = list.map(function (item) {
984
+ var _a;
985
+ return __assign(__assign({}, item), { type: ((_a = item.license) === null || _a === void 0 ? void 0 : _a.type) === LicenseType.FL ? BusinessType.FL : BusinessType.CR });
986
+ });
987
+ entityLicenseList = __spreadArray(__spreadArray([], entityLicenseList, true), [OTHER_ENTITY_LICENSE], false);
988
+ state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entityLicenseList: entityLicenseList });
989
+ var findEntity = entityLicenseList.find(function (e) { return e.id === entityId; });
990
+ var selectedLicense = findEntity ? findEntity : entityLicenseList[0];
991
+ state.data.businessTypeData.selectedEntityLicense = selectedLicense;
992
+ state.data.businessTypeData.selectedLicense = selectedLicense;
993
+ if (!isOtherLicense(selectedLicense))
994
+ state.data.businessTypeData.licenseNumber = ((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _a === void 0 ? void 0 : _a.number) || '';
995
+ }
996
+ })
997
+ .addCase(retrieveAllEntityList.rejected, function (state, action) {
998
+ state.error = action.error.message;
999
+ state.loading = false;
995
1000
  })
996
1001
  .addCase(retrieveBoardDetails.pending, function (state) {
997
1002
  state.error = null;
@@ -57,7 +57,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
57
57
  var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import { handleNextScreenStep, handleCurrentActiveScreen, handleOpen } from '../../../app/settings';
60
- import { FlowsTypes, AuthForType, BusinessType } from '../../../@types';
60
+ import { FlowsTypes, AuthForType, BusinessType, LicenseType } from '../../../@types';
61
61
  import API from '../../../api';
62
62
  import { CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
@@ -701,7 +701,7 @@ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDat
701
701
  id: id || '',
702
702
  brand: brandNameBody,
703
703
  license_number: isNonSA && isFL ? '' : params.licenseNumber,
704
- license_type: isFL ? 'freelance' : 'commercial_registration',
704
+ license_type: isFL ? LicenseType.FL : LicenseType.CR,
705
705
  business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
706
706
  is_acknowledged: true,
707
707
  terms_conditions_accepted: !isLeadIdPassed ? params.termAndConditionChecked : undefined,
@@ -59,7 +59,7 @@ var __rest = (this && this.__rest) || function (s, e) {
59
59
  var _a;
60
60
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
61
61
  import API from '../../../api';
62
- import { BusinessType, DocumentPurpose, FlowsTypes } from '../../../@types';
62
+ import { BusinessType, DocumentPurpose, FlowsTypes, LicenseType } from '../../../@types';
63
63
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  import { ENTITY_STEP_NAMES } from '../../../constants';
65
65
  import moment from 'moment';
@@ -247,7 +247,7 @@ export var updateEntityName = createAsyncThunk('entityUpdateEntityName', functio
247
247
  isEntityTypeVerified = hasVerifiedValue(data_verification, 'type');
248
248
  isLicenseNonEditable = isLicenseNumberNonEditable && isLicenseTypeNonEditable && isIssuingDateNonEditable && isExpiryDateNonEditable && isUnifiedNumberNonEditable;
249
249
  payload = __assign(__assign(__assign(__assign({ id: id, AOA_file_id: isAOAFileNonEditable ? undefined : params.articleId }, (!isLicenseNonEditable && {
250
- license: __assign({ number: isLicenseNumberNonEditable || !params.licenseNumber ? undefined : params.licenseNumber, type: isLicenseTypeNonEditable ? undefined : isFL ? 'freelance' : 'commercial_registration', issuing_date: isIssuingDateNonEditable ? undefined : issuingDate === null || issuingDate === void 0 ? void 0 : issuingDate.toString(), expiry_date: isExpiryDateNonEditable ? undefined : expiryDate === null || expiryDate === void 0 ? void 0 : expiryDate.toString() }, (!(isUnifiedNumberNonEditable || !params.unifiedNumber) && {
250
+ license: __assign({ number: isLicenseNumberNonEditable || !params.licenseNumber ? undefined : params.licenseNumber, type: isLicenseTypeNonEditable ? undefined : isFL ? LicenseType.FL : LicenseType.CR, issuing_date: isIssuingDateNonEditable ? undefined : issuingDate === null || issuingDate === void 0 ? void 0 : issuingDate.toString(), expiry_date: isExpiryDateNonEditable ? undefined : expiryDate === null || expiryDate === void 0 ? void 0 : expiryDate.toString() }, (!(isUnifiedNumberNonEditable || !params.unifiedNumber) && {
251
251
  additional_info: {
252
252
  unified_number: params.unifiedNumber
253
253
  }
@@ -525,9 +525,9 @@ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', func
525
525
  }); });
526
526
  export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
527
527
  var _a, settings, individual, _b, notification, user, entity, _c, id, type, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isNameNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, contact, requestBody, data;
528
- var _d, _e, _f, _g, _h, _j;
529
- return __generator(this, function (_k) {
530
- switch (_k.label) {
528
+ var _d, _e, _f, _g, _h;
529
+ return __generator(this, function (_j) {
530
+ switch (_j.label) {
531
531
  case 0:
532
532
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
533
533
  _b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user, entity = _b.entity;
@@ -577,7 +577,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
577
577
  date_of_birth: dob
578
578
  })), (!((isBirthCityNonEditable && isBirthCountryNonEditable) || !hasBirth) && {
579
579
  birth: {
580
- city: isBirthCityNonEditable ? undefined : (_g = placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.name) === null || _g === void 0 ? void 0 : _g.en,
580
+ city: isBirthCityNonEditable ? undefined : placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.id,
581
581
  country: isBirthCountryNonEditable ? undefined : placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2
582
582
  }
583
583
  })), (!isNationalityNonEditable && {
@@ -591,22 +591,21 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
591
591
  'identification.issued_country_code',
592
592
  'identification.expiry',
593
593
  'identification.type',
594
- 'birth.city',
595
594
  'birth.country',
596
595
  'date_of_birth',
597
596
  'nationality'
598
597
  ], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO });
599
598
  return [4, API.individualService.updateIndividual(requestBody)];
600
599
  case 1:
601
- data = _k.sent();
600
+ data = _j.sent();
602
601
  if (!(type === IndividualType.USER || type === IndividualType.BUYER)) return [3, 3];
603
602
  return [4, thunkApi.dispatch(retrieveDataList(code))];
604
603
  case 2:
605
- _k.sent();
606
- _k.label = 3;
604
+ _j.sent();
605
+ _j.label = 3;
607
606
  case 3:
608
607
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
609
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
608
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, requestBody);
610
609
  return [2, { data: data, formData: params }];
611
610
  }
612
611
  });
@@ -41,6 +41,7 @@ import Tooltip from '../../../../components/Tooltip';
41
41
  import { useTranslation } from 'react-i18next';
42
42
  import { useController, useFormContext } from 'react-hook-form';
43
43
  import { useLanguage, useAppSelector } from '../../../../hooks';
44
+ import { LicenseType } from '../../../../@types';
44
45
  import Collapse from '../../../../components/Collapse';
45
46
  import SimpleList from '../../../../components/SimpleList';
46
47
  import ExpandIcon from '../../../../components/ExpandIcon';
@@ -118,7 +119,7 @@ var ActivitiesList = function (_a) {
118
119
  var _g = React.useState(false), isHovered = _g[0], setIsHovered = _g[1];
119
120
  var verify = data.verify;
120
121
  var _h = verify.responseBody || {}, activities = _h.activities, brand = _h.brand;
121
- var isCR = ((_d = (_c = (_b = verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.license) === null || _d === void 0 ? void 0 : _d.type) === 'commercial_registration';
122
+ var isCR = ((_d = (_c = (_b = verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.license) === null || _d === void 0 ? void 0 : _d.type) === LicenseType.CR;
122
123
  var disabled = false;
123
124
  var setSelectedActivitiesBeginning = function (list) {
124
125
  var mapSelectedListFirst = __spreadArray(__spreadArray([], list.filter(function (a) { return (controlValue || []).some(function (c) { return a.id === c.id; }); }), true), list.filter(function (a) { return !(controlValue || []).some(function (c) { return a.id === c.id; }); }), true);
@@ -21,23 +21,41 @@ import Collapse from '../../../../components/Collapse';
21
21
  import { useLanguage } from '../../../../hooks';
22
22
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
23
  import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
24
+ import { BusinessType as Type } from '../../../../@types';
24
25
  import Button from '../../../shared/Button';
25
- import { isSA } from '../../../../utils';
26
+ import { isKW, isOtherLicense, isSA } from '../../../../utils';
26
27
  import { KWLicenseValidationSchema, LicenseValidationSchema } from './validation';
27
28
  import LicenseList from './LicenseList';
29
+ import LicenseCertificate from './LicenseCertificate';
30
+ import LicenseType from './LicenseType';
31
+ import Article from './Article';
32
+ import EntityLicenseList from './EntityLicenseList';
33
+ import LicenseNumber from './LicenseNumber';
34
+ import EntityName from './EntityName';
35
+ var ListType;
36
+ (function (ListType) {
37
+ ListType["LicenseList"] = "LicenseList";
38
+ ListType["EntityLicenseList"] = "EntityLicenseList";
39
+ })(ListType || (ListType = {}));
28
40
  var BusinessType = function (_a) {
29
41
  var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading, uploadingArticle = _b.uploadingArticle;
30
42
  var settingsData = useAppSelector(settingsSelector).data;
31
- var _c = data.businessTypeData, selectedLicense = _c.selectedLicense, licenseNumber = _c.licenseNumber, entityLegalName = _c.entityLegalName, certificateId = _c.certificateId, articleId = _c.articleId;
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;
44
+ var entityLicenseList = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.entityLicenseList) || [];
32
45
  var t = useTranslation().t;
33
46
  var isAr = useLanguage().isAr;
34
47
  var dispatch = useAppDispatch();
35
- var _d = React.useState(false), listActive = _d[0], setListActive = _d[1];
48
+ var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
49
+ var handleMenuClick = function (flag) {
50
+ setListActive(flag);
51
+ };
36
52
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
53
+ var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
37
54
  var methods = useForm({
38
55
  resolver: yupResolver(!isSACountry ? KWLicenseValidationSchema : LicenseValidationSchema),
39
56
  defaultValues: {
40
57
  selectedLicense: selectedLicense,
58
+ selectedEntityLicense: selectedEntityLicense,
41
59
  licenseNumber: licenseNumber,
42
60
  entityLegalName: entityLegalName,
43
61
  certificateId: certificateId,
@@ -53,6 +71,7 @@ var BusinessType = function (_a) {
53
71
  var onSubmit = function (data) {
54
72
  var dataValues = {
55
73
  selectedLicense: data.selectedLicense,
74
+ selectedEntityLicense: data.selectedEntityLicense,
56
75
  licenseNumber: data.licenseNumber,
57
76
  entityLegalName: data.entityLegalName,
58
77
  certificateId: data.certificateId,
@@ -63,12 +82,17 @@ var BusinessType = function (_a) {
63
82
  var onBack = function () {
64
83
  dispatch(handlePrevScreenStep());
65
84
  };
85
+ var isLicenseListActive = listActive === ListType.LicenseList;
86
+ var isEntityLicenseListActive = listActive === ListType.EntityLicenseList;
87
+ var isAnyListActive = isLicenseListActive || isEntityLicenseListActive;
88
+ var selected = methods.getValues('selectedLicense');
89
+ var selectedLicenseEntity = methods.getValues('selectedEntityLicense');
90
+ var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === Type.CR;
91
+ var hasEntityList = !!(entityLicenseList === null || entityLicenseList === void 0 ? void 0 : entityLicenseList.length);
92
+ var showLicenseList = hasEntityList ? isSACountry && isOtherLicense(selectedLicenseEntity) : isSACountry;
93
+ var showEntityList = isKWCountry ? hasEntityList && !isLicenseListActive && isCR : hasEntityList && !isLicenseListActive;
66
94
  var disabled = !methods.formState.isValid || !!error || uploading || uploadingArticle;
67
95
  var disableBack = !data.otpData.isNID;
68
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(LicenseList, { onListOpen: function () {
69
- setListActive(true);
70
- }, onListClose: function () {
71
- setListActive(false);
72
- } }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
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') })) }))] })) })) }));
73
97
  };
74
98
  export default React.memo(BusinessType);
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ interface EntityLicenseListProps {
3
+ show: boolean;
4
+ onSelectLicense?: (number: string) => void;
5
+ onListOpen?: () => void;
6
+ onListClose?: () => void;
7
+ }
8
+ declare const _default: React.MemoExoticComponent<({ ...rest }: EntityLicenseListProps) => JSX.Element>;
9
+ export default _default;
@@ -0,0 +1,132 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import * as React from 'react';
25
+ import { useTranslation } from 'react-i18next';
26
+ import { useController, useFormContext } from 'react-hook-form';
27
+ import Box from '@mui/material/Box';
28
+ import { styled } from '@mui/material/styles';
29
+ import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
30
+ import { BusinessType } from '../../../../@types';
31
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
32
+ import Input from '../../../shared/Input';
33
+ import CheckIcon from '../../../shared/CheckIcon';
34
+ import SimpleList from '../../../../components/SimpleList';
35
+ import { businessSelector, clearError } from '../../../app/business/businessStore';
36
+ import Text from '../../../../components/Text';
37
+ import ExpandIcon from '../../../../components/ExpandIcon';
38
+ import Collapse from '../../../../components/Collapse';
39
+ import { isKW, isOtherLicense } from '../../../../utils';
40
+ import { settingsSelector } from '../../../../app/settings';
41
+ import { OTHER_CR_LICENSE } from '../../../../constants';
42
+ var InputStyled = styled(Input)(function (_a) {
43
+ var theme = _a.theme;
44
+ return ({
45
+ marginBottom: theme.spacing(2.5),
46
+ '& .MuiInputBase-input': {
47
+ cursor: 'pointer'
48
+ }
49
+ });
50
+ });
51
+ var LicenseContainer = styled(Box)(function () { return ({
52
+ display: 'flex'
53
+ }); });
54
+ var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
55
+ var theme = _a.theme, isSelected = _a.isSelected;
56
+ return (__assign(__assign({ display: 'flex', color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
57
+ });
58
+ var EntityLicenseList = function (_a) {
59
+ var rest = __rest(_a, []);
60
+ var _b = useAppSelector(businessSelector), data = _b.data, error = _b.error;
61
+ var settingsData = useAppSelector(settingsSelector).data;
62
+ var businessTypeData = data.businessTypeData;
63
+ var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
64
+ var t = useTranslation().t;
65
+ var isAr = useLanguage().isAr;
66
+ var dispatch = useAppDispatch();
67
+ var _d = useFormContext(), setValue = _d.setValue, control = _d.control;
68
+ var selectedEntityLicenseControl = useController({ control: control, name: 'selectedEntityLicense' });
69
+ var responseBody = businessTypeData.responseBody, selectedEntityLicense = businessTypeData.selectedEntityLicense, licenseNumber = businessTypeData.licenseNumber;
70
+ var entityLicenseList = (responseBody || {}).entityLicenseList;
71
+ var country_code = settingsData.businessCountry.iso2;
72
+ var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
73
+ var onOpenLicenseList = function (event) {
74
+ var _a;
75
+ setAnchorEl(event.currentTarget);
76
+ (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
77
+ };
78
+ var onCloseLicenseList = function () {
79
+ var _a;
80
+ setAnchorEl(null);
81
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
82
+ };
83
+ React.useEffect(function () {
84
+ if ((entityLicenseList || []).length > 0)
85
+ setValue('entityLicenseList', entityLicenseList);
86
+ }, [entityLicenseList]);
87
+ React.useEffect(function () {
88
+ if ((entityLicenseList || []).length > 0) {
89
+ if (!!selectedEntityLicense) {
90
+ setValue('selectedEntityLicense', selectedEntityLicense, { shouldValidate: true });
91
+ setValue('licenseNumber', licenseNumber, { shouldValidate: true });
92
+ }
93
+ }
94
+ }, [entityLicenseList, selectedEntityLicense]);
95
+ var getLicenseNumber = function (item) {
96
+ var _a;
97
+ return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
98
+ };
99
+ var getLicenseName = function (item) {
100
+ var _a, _b;
101
+ if ((item === null || item === void 0 ? void 0 : item.type) === BusinessType.FL && !isOtherLicense(item))
102
+ return t('future_work');
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) || '');
104
+ };
105
+ var onSelectItem = function (license) {
106
+ if (error)
107
+ dispatch(clearError());
108
+ selectedEntityLicenseControl.field.onChange(license);
109
+ if (isOtherLicense(license)) {
110
+ var license_1 = isKWCountry ? OTHER_CR_LICENSE : {};
111
+ setValue('selectedLicense', license_1, { shouldValidate: true });
112
+ setValue('licenseNumber', '', { shouldValidate: true });
113
+ }
114
+ else {
115
+ setValue('selectedLicense', license, { shouldValidate: true });
116
+ setValue('licenseNumber', getLicenseNumber(license), { shouldValidate: true });
117
+ }
118
+ onCloseLicenseList();
119
+ };
120
+ var getLicenseFullName = function (item) {
121
+ if (isAr)
122
+ return _jsx("span", { children: "".concat(getLicenseName(item), " - ").concat(getLicenseNumber(item)) });
123
+ return _jsx("span", { children: "".concat(getLicenseNumber(item), " - ").concat(getLicenseName(item)) });
124
+ };
125
+ var selected = selectedEntityLicenseControl.field.value;
126
+ var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
127
+ var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
128
+ 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) {
129
+ 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, {})] }));
130
+ } }) }))] }) })));
131
+ };
132
+ export default React.memo(EntityLicenseList);
@@ -11,17 +11,17 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
- import ClearIcon from '../../../shared/ClearIcon';
15
- import CheckIcon from '../../../shared/CheckIcon';
16
- import Input from '../../../shared/Input';
17
- import Collapse from '../../../../components/Collapse';
18
14
  import { useTranslation } from 'react-i18next';
19
15
  import { useController, useFormContext } from 'react-hook-form';
20
- import { isSA, removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
21
16
  import { styled } from '@mui/material/styles';
22
17
  import Box from '@mui/material/Box';
23
- import { useAppSelector } from '../../../../hooks';
24
18
  import { settingsSelector } from '../../../../app/settings';
19
+ import { isSA, removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
20
+ import { useAppSelector } from '../../../../hooks';
21
+ import Collapse from '../../../../components/Collapse';
22
+ import ClearIcon from '../../../shared/ClearIcon';
23
+ import CheckIcon from '../../../shared/CheckIcon';
24
+ import Input from '../../../shared/Input';
25
25
  var BoxStyled = styled(Box)(function (_a) {
26
26
  var theme = _a.theme;
27
27
  return ({
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  interface LicenseListProps {
3
+ show: boolean;
3
4
  onSelectLicense?: (number: string) => void;
4
5
  onListOpen?: () => void;
5
6
  onListClose?: () => void;
@@ -36,14 +36,9 @@ 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 LicenseNumber from './LicenseNumber';
40
- import EntityName from '../../../business/screens/BusinessType/EntityName';
41
- import { isSA } from '../../../../utils';
42
- import LicenseType from './LicenseType';
39
+ import { isOtherLicense, isSA } from '../../../../utils';
43
40
  import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
44
- import LicenseCertificate from './LicenseCertificate';
45
41
  import { settingsSelector } from '../../../../app/settings';
46
- import Article from './Article';
47
42
  var InputStyled = styled(Input)(function (_a) {
48
43
  var theme = _a.theme;
49
44
  return ({
@@ -84,7 +79,6 @@ var LicenseList = function (_a) {
84
79
  setAnchorEl(null);
85
80
  (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
86
81
  };
87
- var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
88
82
  React.useEffect(function () {
89
83
  if ((licenseList || []).length > 0)
90
84
  setValue('licenseList', licenseList);
@@ -117,10 +111,6 @@ var LicenseList = function (_a) {
117
111
  return t('future_work');
118
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) || '');
119
113
  };
120
- var isOtherLicense = function (item) {
121
- var _a, _b;
122
- return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) === 'other_fl' || ((_b = item === null || item === void 0 ? void 0 : item.license) === null || _b === void 0 ? void 0 : _b.number) === 'other_cr';
123
- };
124
114
  var onSelectItem = function (license) {
125
115
  if (error)
126
116
  dispatch(clearError());
@@ -136,13 +126,11 @@ var LicenseList = function (_a) {
136
126
  return _jsx("span", { children: "".concat(getLicenseName(item), " - ").concat(getLicenseNumber(item)) });
137
127
  return _jsx("span", { children: "".concat(getLicenseNumber(item), " - ").concat(getLicenseName(item)) });
138
128
  };
139
- var show = !anchorEl;
140
129
  var selected = selectedLicenseControl.field.value;
141
- var licenseReadonly = !isOtherLicense(selected);
142
130
  var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
143
131
  var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
144
- return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry }, { 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) {
145
- 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, {})] }));
146
- } }) }))] })), _jsx(LicenseType, { show: show && !isSACountry }), _jsx(EntityName, { show: show && !isSACountry && isCR }), _jsx(LicenseNumber, { show: !isSACountry ? isCR : show, readOnly: licenseReadonly }), _jsx(LicenseCertificate, { show: show && !isSACountry && isCR }), _jsx(Article, { show: show && !isSACountry && isCR })] }));
132
+ 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) {
133
+ 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, {})] }));
134
+ } }) }))] }) })));
147
135
  };
148
136
  export default React.memo(LicenseList);
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
2
  interface LicenseNumberProps {
3
3
  show: boolean;
4
- readOnly: boolean;
5
4
  }
6
- declare const _default: React.MemoExoticComponent<({ show, readOnly }: LicenseNumberProps) => JSX.Element>;
5
+ declare const _default: React.MemoExoticComponent<({ show }: LicenseNumberProps) => JSX.Element>;
7
6
  export default _default;
@@ -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_NUMBER_LENGTH, FL_NUMBER_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
17
- import { removeAllOtherThanCharsAndNumber, isSA } from '../../../../utils';
17
+ import { removeAllOtherThanCharsAndNumber, isSA, isOtherLicense } from '../../../../utils';
18
18
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
19
  import ClearIcon from '../../../shared/ClearIcon';
20
20
  import CheckIcon from '../../../shared/CheckIcon';
@@ -25,14 +25,16 @@ import { useAppSelector } from '../../../../hooks';
25
25
  import { settingsSelector } from '../../../../app/settings';
26
26
  var LicenseNumber = function (_a) {
27
27
  var _b;
28
- var show = _a.show, readOnly = _a.readOnly;
28
+ var show = _a.show;
29
29
  var t = useTranslation().t;
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
33
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
34
34
  var selectedLicense = !isSACountry ? watch('selectedLicense') : getValues('selectedLicense');
35
+ var selectedEntityLicense = !isSACountry ? watch('selectedEntityLicense') : getValues('selectedEntityLicense');
35
36
  var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
37
+ var readOnly = !isOtherLicense(selectedLicense) || (selectedEntityLicense && !isOtherLicense(selectedEntityLicense));
36
38
  var handleFLNumberChange = function (_a) {
37
39
  var target = _a.target;
38
40
  var value = removeAllOtherThanCharsAndNumber(target.value);
@@ -28,7 +28,7 @@ import Box from '@mui/material/Box';
28
28
  import { styled } from '@mui/material/styles';
29
29
  import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
30
30
  import { BusinessType } from '../../../../@types';
31
- import { isSA } from '../../../../utils';
31
+ import { isOtherLicense, isSA } from '../../../../utils';
32
32
  import { settingsSelector } from '../../../../app/settings';
33
33
  import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
34
34
  import SimpleList from '../../../../components/SimpleList';
@@ -115,10 +115,6 @@ var LicenseList = function (_a) {
115
115
  return t('future_work');
116
116
  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) || '');
117
117
  };
118
- var isOtherLicense = function (item) {
119
- var _a, _b;
120
- return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) === 'other_fl' || ((_b = item === null || item === void 0 ? void 0 : item.license) === null || _b === void 0 ? void 0 : _b.number) === 'other_cr';
121
- };
122
118
  var onSelectItem = function (license) {
123
119
  if (error)
124
120
  dispatch(clearError());
@@ -1,4 +1,4 @@
1
- import { DeviceInfo, User } from '../@types';
1
+ import { DeviceInfo, License, User } from '../@types';
2
2
  export declare const maskPhone: (str?: string) => string;
3
3
  export declare const shortenString: (str: string, length: number) => string;
4
4
  export declare const maskID: (str: string) => string;
@@ -70,3 +70,4 @@ export declare const getUserNameObject: (name: string) => {
70
70
  };
71
71
  export declare const getFileType: (type: string) => "" | "image/jpeg" | "image/png" | "image/jpg" | "application/pdf";
72
72
  export declare const isStringMasked: (value: string) => boolean;
73
+ export declare const isOtherLicense: (item?: License) => boolean;
@@ -301,3 +301,8 @@ export var getFileType = function (type) {
301
301
  export var isStringMasked = function (value) {
302
302
  return value.includes('*') ? true : false;
303
303
  };
304
+ export var isOtherLicense = function (item) {
305
+ var _a;
306
+ var number = (_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number;
307
+ return number === 'other_fl' || number === 'other_cr' || number === 'other_entity';
308
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.67-test",
3
+ "version": "2.3.69-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",