@tap-payments/auth-jsconnect 1.0.38 → 1.0.43

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 (51) hide show
  1. package/build/@types/app.d.ts +14 -37
  2. package/build/api/data.d.ts +1 -0
  3. package/build/api/data.js +5 -1
  4. package/build/api/entity.d.ts +5 -6
  5. package/build/api/index.d.ts +2 -2
  6. package/build/api/lead.d.ts +1 -2
  7. package/build/api/lead.js +3 -7
  8. package/build/components/AnimationFlow/BottomSheet.js +2 -0
  9. package/build/components/Footer/Footer.d.ts +3 -1
  10. package/build/components/Footer/Footer.js +11 -47
  11. package/build/constants/api.d.ts +2 -2
  12. package/build/constants/api.js +5 -5
  13. package/build/constants/app.js +1 -1
  14. package/build/constants/dummy.d.ts +16 -38
  15. package/build/constants/dummy.js +35 -59
  16. package/build/features/app/business/businessStore.d.ts +12 -12
  17. package/build/features/app/business/businessStore.js +109 -67
  18. package/build/features/app/connect/connectStore.js +7 -5
  19. package/build/features/business/screens/Activities/Activities.js +16 -6
  20. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  21. package/build/features/business/screens/Activities/ActivitiesList.js +1 -1
  22. package/build/features/business/screens/Activities/OperationStartDate.js +1 -12
  23. package/build/features/business/screens/Activities/SalesChannels.js +1 -1
  24. package/build/features/business/screens/BusinessType/BusinessType.js +2 -3
  25. package/build/features/business/screens/BusinessType/CompanyLicense.d.ts +2 -2
  26. package/build/features/business/screens/BusinessType/CompanyLicense.js +9 -6
  27. package/build/features/business/screens/BusinessType/FreelanceLicense.d.ts +2 -2
  28. package/build/features/business/screens/BusinessType/FreelanceLicense.js +9 -9
  29. package/build/features/business/screens/Customers/CustomerLocations.d.ts +1 -1
  30. package/build/features/business/screens/Customers/CustomerLocations.js +14 -4
  31. package/build/features/business/screens/Customers/Customers.js +18 -11
  32. package/build/features/business/screens/Customers/ExpectedCustomers.js +14 -4
  33. package/build/features/business/screens/Customers/ExpectedSalesRange.js +14 -4
  34. package/build/features/business/screens/OTP/OTP.js +5 -2
  35. package/build/features/business/screens/Verify/Verify.js +4 -1
  36. package/build/features/connect/screens/Individual/Email.js +1 -1
  37. package/build/features/connect/screens/Merchant/BrandName.js +7 -3
  38. package/build/features/connect/screens/Mobile/Mobile.js +1 -2
  39. package/build/features/connect/screens/NID/NID.js +1 -2
  40. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
  41. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +1 -1
  42. package/build/features/shared/Button/Button.js +13 -3
  43. package/build/features/shared/Containers/FeatureContainer.js +1 -1
  44. package/build/features/shared/Containers/ScreenContainer.js +1 -1
  45. package/build/features/shared/Footer/Footer.js +7 -1
  46. package/build/features/shared/Input/Input.d.ts +1 -1
  47. package/build/hooks/index.d.ts +1 -0
  48. package/build/hooks/index.js +1 -0
  49. package/build/hooks/useElementSizeById.d.ts +6 -0
  50. package/build/hooks/useElementSizeById.js +12 -0
  51. package/package.json +126 -126
@@ -173,7 +173,7 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
173
173
  }
174
174
  });
175
175
  }); });
176
- export var retrieveCRInfos = createAsyncThunk('retrieveCRInfos', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
176
+ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
177
177
  var business, leadId, data;
178
178
  var _a;
179
179
  return __generator(this, function (_b) {
@@ -181,22 +181,7 @@ export var retrieveCRInfos = createAsyncThunk('retrieveCRInfos', function (param
181
181
  case 0:
182
182
  business = thunkApi.getState().business;
183
183
  leadId = (_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id;
184
- return [4, API.leadService.retrieveCRInfos(leadId)];
185
- case 1:
186
- data = (_b.sent()).data;
187
- return [2, { data: data }];
188
- }
189
- });
190
- }); });
191
- export var retrieveFLInfos = createAsyncThunk('retrieveFLInfos', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
192
- var business, leadId, data;
193
- var _a;
194
- return __generator(this, function (_b) {
195
- switch (_b.label) {
196
- case 0:
197
- business = thunkApi.getState().business;
198
- leadId = (_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id;
199
- return [4, API.leadService.retrieveFLInfos(leadId)];
184
+ return [4, API.leadService.retrieveEntityList(leadId)];
200
185
  case 1:
201
186
  data = (_b.sent()).data;
202
187
  return [2, { data: data }];
@@ -265,52 +250,86 @@ export var createAccount = createAsyncThunk('createAccount', function (params, t
265
250
  });
266
251
  }); });
267
252
  export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
268
- var _a, settings, business, requestBody, headers, data;
269
- var _b, _c, _d;
270
- return __generator(this, function (_e) {
271
- switch (_e.label) {
253
+ var _a, settings, business, channel, activities, requestBody, headers, data;
254
+ var _b, _c, _d, _e;
255
+ return __generator(this, function (_f) {
256
+ switch (_f.label) {
272
257
  case 0:
273
258
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
259
+ channel = params.salesChannels.map(function (_a) {
260
+ var value = _a.value;
261
+ return value;
262
+ });
263
+ activities = (_b = (params.activities || [])) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
264
+ var id = _a.id;
265
+ return id === null || id === void 0 ? void 0 : id.toString();
266
+ });
274
267
  requestBody = {
275
- activities: params.activities,
276
- channel_services: params.salesChannels,
268
+ activities: activities,
269
+ channel_services: channel,
277
270
  business_operation_start_at: params.operationStartDate,
278
271
  step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES
279
272
  };
280
- headers = { entity_id: (_b = business.data.businessInfo.responseBody) === null || _b === void 0 ? void 0 : _b.entity_id };
273
+ headers = { entity_id: (_c = business.data.businessInfo.responseBody) === null || _c === void 0 ? void 0 : _c.entity_id };
281
274
  return [4, API.entityService.updateEntityInfo(requestBody, { headers: headers })];
282
275
  case 1:
283
- data = (_e.sent()).data;
276
+ data = (_f.sent()).data;
284
277
  if (!data.errors) {
278
+ thunkApi.dispatch(retrieveDataList());
285
279
  thunkApi.dispatch(handleNextScreenStep());
286
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
280
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
287
281
  }
288
282
  return [2, { data: data, formData: __assign({}, params) }];
289
283
  }
290
284
  });
291
285
  }); });
286
+ export var retrieveDataList = createAsyncThunk('retrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
287
+ var customerBases, expectedSales, expectedCustomerSales;
288
+ return __generator(this, function (_a) {
289
+ switch (_a.label) {
290
+ case 0: return [4, API.dataService.getCustomerBases()];
291
+ case 1:
292
+ customerBases = _a.sent();
293
+ return [4, API.dataService.getExpectedSales()];
294
+ case 2:
295
+ expectedSales = _a.sent();
296
+ return [4, API.dataService.getExpectedCutomerSales()];
297
+ case 3:
298
+ expectedCustomerSales = _a.sent();
299
+ return [2, {
300
+ customerBasesData: customerBases === null || customerBases === void 0 ? void 0 : customerBases.data,
301
+ expectedSalesData: expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.data,
302
+ expectedCustomerSalesData: expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales.data
303
+ }];
304
+ }
305
+ });
306
+ }); });
292
307
  export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
293
- var _a, settings, business, requestBody, headers, data;
294
- var _b, _c, _d;
295
- return __generator(this, function (_e) {
296
- switch (_e.label) {
308
+ var _a, settings, business, customerBase, requestBody, headers, data;
309
+ var _b, _c, _d, _e, _f;
310
+ return __generator(this, function (_g) {
311
+ switch (_g.label) {
297
312
  case 0:
298
313
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
314
+ customerBase = params.customerLocations.map(function (_a) {
315
+ var value = _a.value;
316
+ return value;
317
+ });
299
318
  requestBody = {
300
- customers_base: params.customerLocations,
301
- customers_served_monthly: params.expectedCustomers,
302
- yearly_sales_range: params.expectedSalesRange,
319
+ customers_base: customerBase,
320
+ customers_served_monthly: ((_b = params.expectedCustomers) === null || _b === void 0 ? void 0 : _b.value) || '',
321
+ yearly_sales_range: ((_c = params.expectedCustomers) === null || _c === void 0 ? void 0 : _c.value) || '',
303
322
  agree_refund: params.refundPolicy,
304
323
  agree_chargeback: params.transactionPolicy,
305
324
  step_name: BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS
306
325
  };
307
- headers = { entity_id: (_b = business.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.id };
326
+ headers = { entity_id: (_d = business.data.otpData.responseBody) === null || _d === void 0 ? void 0 : _d.id };
308
327
  return [4, API.entityService.updateEntityInfo(requestBody, { headers: headers })];
309
328
  case 1:
310
- data = (_e.sent()).data;
311
- if (!data.errors && !params.isResend) {
329
+ data = (_g.sent()).data;
330
+ if (!data.errors) {
312
331
  thunkApi.dispatch(handleNextScreenStep());
313
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
332
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
314
333
  }
315
334
  return [2, { data: data, formData: __assign({}, params) }];
316
335
  }
@@ -393,6 +412,9 @@ export var businessSlice = createSlice({
393
412
  },
394
413
  stopLoader: function (state) {
395
414
  state.loading = false;
415
+ },
416
+ resetOTPScreen: function (state) {
417
+ state.data.otpData.otp = '';
396
418
  }
397
419
  },
398
420
  extraReducers: function (builder) {
@@ -449,8 +471,9 @@ export var businessSlice = createSlice({
449
471
  state.loading = false;
450
472
  state.error = action.error.message;
451
473
  })
452
- .addCase(updateLeadIdentity.pending, function (state) {
453
- state.loading = true;
474
+ .addCase(updateLeadIdentity.pending, function (state, action) {
475
+ var _a;
476
+ state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
454
477
  state.error = null;
455
478
  })
456
479
  .addCase(updateLeadIdentity.fulfilled, function (state, action) {
@@ -472,43 +495,29 @@ export var businessSlice = createSlice({
472
495
  state.loading = false;
473
496
  state.error = action.error.message;
474
497
  })
475
- .addCase(retrieveCRInfos.pending, function (state) {
498
+ .addCase(retrieveEntityList.pending, function (state) {
476
499
  state.loading = true;
477
500
  state.error = null;
478
501
  })
479
- .addCase(retrieveCRInfos.fulfilled, function (state, action) {
502
+ .addCase(retrieveEntityList.fulfilled, function (state, action) {
480
503
  var _a;
481
504
  state.loading = false;
482
505
  state.error = null;
483
506
  var data = action.payload.data;
484
507
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
485
508
  if (!description) {
486
- if (Array.isArray(data)) {
487
- state.data.crInfos = data;
509
+ var fl = data.fl, cr = data.cr;
510
+ if (Array.isArray(cr)) {
511
+ state.data.crInfos = cr;
488
512
  state.data.businessTypeData.businessType = BusinessType.CR;
489
513
  }
514
+ if (Array.isArray(fl)) {
515
+ state.data.flInfos = fl;
516
+ state.data.businessTypeData.businessType = BusinessType.FL;
517
+ }
490
518
  }
491
519
  })
492
- .addCase(retrieveCRInfos.rejected, function (state, action) {
493
- state.loading = false;
494
- state.error = action.error.message;
495
- })
496
- .addCase(retrieveFLInfos.pending, function (state) {
497
- state.loading = true;
498
- state.error = null;
499
- })
500
- .addCase(retrieveFLInfos.fulfilled, function (state, action) {
501
- var _a;
502
- state.loading = false;
503
- state.error = null;
504
- var data = action.payload.data;
505
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
506
- if (!description) {
507
- state.data.flInfos = data === null || data === void 0 ? void 0 : data.licenses;
508
- state.data.businessTypeData.businessType = BusinessType.FL;
509
- }
510
- })
511
- .addCase(retrieveFLInfos.rejected, function (state, action) {
520
+ .addCase(retrieveEntityList.rejected, function (state, action) {
512
521
  state.loading = false;
513
522
  state.error = action.error.message;
514
523
  })
@@ -558,9 +567,9 @@ export var businessSlice = createSlice({
558
567
  state.loading = false;
559
568
  state.error = null;
560
569
  var _c = action.payload, data = _c.data, channelsData = _c.channelsData;
561
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = channelsData === null || channelsData === void 0 ? void 0 : channelsData.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
562
- if (description) {
563
- state.error = description;
570
+ var message = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = channelsData === null || channelsData === void 0 ? void 0 : channelsData.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).message;
571
+ if (message) {
572
+ state.error = message;
564
573
  return;
565
574
  }
566
575
  if ((data === null || data === void 0 ? void 0 : data.status) === 'ALREADY_TAKEN') {
@@ -596,6 +605,39 @@ export var businessSlice = createSlice({
596
605
  .addCase(updateActivitiesInfo.rejected, function (state, action) {
597
606
  state.loading = false;
598
607
  state.error = action.error.message;
608
+ })
609
+ .addCase(retrieveDataList.pending, function (state) {
610
+ state.loading = true;
611
+ state.error = null;
612
+ })
613
+ .addCase(retrieveDataList.fulfilled, function (state, action) {
614
+ var _a, _b, _c;
615
+ state.loading = false;
616
+ state.error = null;
617
+ var _d = action.payload, customerBasesData = _d.customerBasesData, expectedSalesData = _d.expectedSalesData, expectedCustomerSalesData = _d.expectedCustomerSalesData;
618
+ var description = (((_a = customerBasesData === null || customerBasesData === void 0 ? void 0 : customerBasesData.errors) === null || _a === void 0 ? void 0 : _a[0]) ||
619
+ ((_b = expectedSalesData === null || expectedSalesData === void 0 ? void 0 : expectedSalesData.errors) === null || _b === void 0 ? void 0 : _b[0]) ||
620
+ ((_c = expectedCustomerSalesData === null || expectedCustomerSalesData === void 0 ? void 0 : expectedCustomerSalesData.errors) === null || _c === void 0 ? void 0 : _c[0]) ||
621
+ {}).description;
622
+ if (description) {
623
+ state.error = description;
624
+ return;
625
+ }
626
+ var data = state.data.activitiesData.responseBody;
627
+ state.data.activitiesData.responseBody = __assign(__assign({}, data), { customerBases: customerBasesData || [], expectedSales: expectedSalesData.data || [], expectedCustomerSales: expectedCustomerSalesData.data || [] });
628
+ var selectedCustomerBase = customerBasesData === null || customerBasesData === void 0 ? void 0 : customerBasesData[0];
629
+ if (!!selectedCustomerBase)
630
+ state.data.customersData.customerLocations = [selectedCustomerBase];
631
+ var selectedExpectedSale = expectedSalesData === null || expectedSalesData === void 0 ? void 0 : expectedSalesData[(expectedSalesData === null || expectedSalesData === void 0 ? void 0 : expectedSalesData.length) - 1];
632
+ if (!!selectedExpectedSale)
633
+ state.data.customersData.expectedSalesRange = selectedExpectedSale;
634
+ var selectedExpectedCustomerSale = expectedCustomerSalesData === null || expectedCustomerSalesData === void 0 ? void 0 : expectedCustomerSalesData[(expectedCustomerSalesData === null || expectedCustomerSalesData === void 0 ? void 0 : expectedCustomerSalesData.length) - 1];
635
+ if (!!selectedExpectedCustomerSale)
636
+ state.data.customersData.expectedCustomers = selectedExpectedCustomerSale;
637
+ })
638
+ .addCase(retrieveDataList.rejected, function (state, action) {
639
+ state.loading = false;
640
+ state.error = action.error.message;
599
641
  })
600
642
  .addCase(updateCustomersInfo.pending, function (state) {
601
643
  state.loading = true;
@@ -640,6 +682,6 @@ export var businessSlice = createSlice({
640
682
  });
641
683
  }
642
684
  });
643
- export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader;
685
+ export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
644
686
  export default businessSlice.reducer;
645
687
  export var businessSelector = function (state) { return state.business; };
@@ -486,8 +486,9 @@ export var connectSlice = createSlice({
486
486
  state.data.mobileData.responseBody = response;
487
487
  state.data.otpData.isAbsher = false;
488
488
  })
489
- .addCase(createMobileAuth.pending, function (state) {
490
- state.loading = true;
489
+ .addCase(createMobileAuth.pending, function (state, action) {
490
+ var _a;
491
+ state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
491
492
  state.error = null;
492
493
  })
493
494
  .addCase(createMobileAuth.rejected, function (state, action) {
@@ -508,8 +509,9 @@ export var connectSlice = createSlice({
508
509
  state.data.nidData.responseBody = response;
509
510
  state.data.otpData.isAbsher = true;
510
511
  })
511
- .addCase(createNIDAuth.pending, function (state) {
512
- state.loading = true;
512
+ .addCase(createNIDAuth.pending, function (state, action) {
513
+ var _a;
514
+ state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
513
515
  state.error = null;
514
516
  })
515
517
  .addCase(createNIDAuth.rejected, function (state, action) {
@@ -533,7 +535,7 @@ export var connectSlice = createSlice({
533
535
  var firstName = (name_1 === null || name_1 === void 0 ? void 0 : name_1.first) + ' ';
534
536
  var middleName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) ? (name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) + ' ' : '';
535
537
  var thirdName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.third) ? (name_1 === null || name_1 === void 0 ? void 0 : name_1.third) + ' ' : '';
536
- var lastName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.last) ? name_1 === null || name_1 === void 0 ? void 0 : name_1.middle : '';
538
+ var lastName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.last) ? name_1 === null || name_1 === void 0 ? void 0 : name_1.last : '';
537
539
  if (!!name_1) {
538
540
  var capitalizedName = capitalizeTheFirstLetterOfEachWord(firstName + middleName + thirdName + lastName);
539
541
  state.data.individualData.name = capitalizedName;
@@ -25,7 +25,7 @@ import SalesChannels from './SalesChannels';
25
25
  import { ScreenContainer } from '../../../shared/Containers';
26
26
  import Collapse from '../../../../components/Collapse';
27
27
  import OperationStartDate from './OperationStartDate';
28
- import { businessSelector, updateActivitiesInfo } from '../../../app/business/businessStore';
28
+ import { businessSelector, clearError, updateActivitiesInfo } from '../../../app/business/businessStore';
29
29
  import { ActivitiesValidationSchema } from './validation';
30
30
  var FormStyled = styled(Form)(function () { return ({
31
31
  display: 'flex',
@@ -38,11 +38,12 @@ var Activities = function () {
38
38
  var dispatch = useAppDispatch();
39
39
  var isAr = useLanguage().isAr;
40
40
  var t = useTranslation().t;
41
- var data = useSelector(businessSelector).data;
42
- var response = data.businessInfo.responseBody;
41
+ var _d = useSelector(businessSelector), data = _d.data, loading = _d.loading, error = _d.error;
42
+ var businessTypeResponse = data.businessTypeData.responseBody;
43
+ var activitiesData = data.activitiesData;
43
44
  var methods = useForm({
44
45
  resolver: yupResolver(ActivitiesValidationSchema),
45
- defaultValues: data.activitiesData,
46
+ defaultValues: activitiesData,
46
47
  mode: 'onChange'
47
48
  });
48
49
  var onSubmit = function (data) {
@@ -55,10 +56,19 @@ var Activities = function () {
55
56
  var onBack = function () {
56
57
  dispatch(handlePrevScreenStep());
57
58
  };
59
+ React.useEffect(function () {
60
+ var salesChannels = activitiesData.salesChannels;
61
+ methods.setValue('salesChannels', salesChannels);
62
+ }, [activitiesData.salesChannels]);
63
+ React.useEffect(function () {
64
+ if (error)
65
+ dispatch(clearError());
66
+ }, [methods.formState.isValid]);
58
67
  var handleMenuClick = function () {
59
68
  anchorEl ? setAnchorEl(false) : setAnchorEl(true);
60
69
  };
61
- var activities_list = ((_a = response === null || response === void 0 ? void 0 : response.activities) === null || _a === void 0 ? void 0 : _a.length) > 0;
62
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [!!activities_list && (_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid }, { children: t('next') })) }))] })) })) }));
70
+ var activities_list = ((_a = businessTypeResponse === null || businessTypeResponse === void 0 ? void 0 : businessTypeResponse.activities) === null || _a === void 0 ? void 0 : _a.length) > 0;
71
+ var disabled = !methods.formState.isValid || !!error;
72
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [!!activities_list && (_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
63
73
  };
64
74
  export default Activities;
@@ -12,7 +12,7 @@ export declare const InputLabelStyled: import("@emotion/styled").StyledComponent
12
12
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
13
13
  ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
14
14
  }, keyof import("@mui/material/OverridableComponent").CommonProps | ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
15
- export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick<import("../../../../components/Input").InputProps, "name" | "type" | "className" | "style" | "classes" | "color" | "margin" | "translate" | "slot" | "title" | "ref" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "size" | "disabled" | "error" | "components" | "componentsProps" | "value" | "autoFocus" | "fullWidth" | "required" | "rows" | "inputProps" | "inputRef" | "readOnly" | "autoComplete" | "disableInjectingGlobalStyles" | "endAdornment" | "inputComponent" | "multiline" | "renderSuffix" | "maxRows" | "minRows" | "startAdornment" | "disableUnderline" | "onEnterPressed" | "warningMessage"> & {
15
+ export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick<import("../../../../components/Input").InputProps, "name" | "type" | "className" | "style" | "classes" | "color" | "margin" | "translate" | "slot" | "title" | "ref" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "size" | "disabled" | "error" | "value" | "components" | "componentsProps" | "autoFocus" | "fullWidth" | "required" | "rows" | "inputProps" | "inputRef" | "readOnly" | "autoComplete" | "disableInjectingGlobalStyles" | "endAdornment" | "inputComponent" | "multiline" | "renderSuffix" | "maxRows" | "minRows" | "startAdornment" | "disableUnderline" | "onEnterPressed" | "warningMessage"> & {
16
16
  placeholder?: string | undefined;
17
17
  hide?: boolean | undefined;
18
18
  warningType?: "alert" | "error" | "hint" | undefined;
@@ -94,7 +94,7 @@ var ActivitiesList = function (_a) {
94
94
  if (((_a = response === null || response === void 0 ? void 0 : response.activities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
95
95
  setActivitiesMenuList(response === null || response === void 0 ? void 0 : response.activities);
96
96
  }
97
- }, [response === null || response === void 0 ? void 0 : response.activities]);
97
+ }, []);
98
98
  var onOpenList = function (event) {
99
99
  var _a;
100
100
  setAnchorEl(event.currentTarget);
@@ -1,14 +1,3 @@
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
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
2
  import { InputLabelStyled } from './ActivitiesList';
14
3
  import { useTranslation } from 'react-i18next';
@@ -26,6 +15,6 @@ var OperationStartDate = function (_a) {
26
15
  oDateControl.field.onChange(data);
27
16
  };
28
17
  var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
29
- return (_jsxs(ScreenContainer, __assign({ sx: { mb: 5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleOperationStartDateChange })] })));
18
+ return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleOperationStartDateChange })] }));
30
19
  };
31
20
  export default OperationStartDate;
@@ -105,6 +105,6 @@ var SalesChannels = function () {
105
105
  if (channelsChecked)
106
106
  return !!(channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (item === null || item === void 0 ? void 0 : item.id); }));
107
107
  };
108
- return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id.toString(), disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.name : channel.nameEn, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
108
+ return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id.toString(), disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.titleAr : channel.title, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
109
109
  };
110
110
  export default SalesChannels;
@@ -21,7 +21,7 @@ import Form from '../../../../components/Form';
21
21
  import Collapse from '../../../../components/Collapse';
22
22
  import { useLanguage } from '../../../../hooks';
23
23
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
24
- import { businessSelector, clearError, retrieveCRInfos, retrieveFLInfos, updateLeadBusinessType } from '../../../app/business/businessStore';
24
+ import { businessSelector, clearError, retrieveEntityList, updateLeadBusinessType } from '../../../app/business/businessStore';
25
25
  import { BusinessType as BusinessTypeEnum } from '../../../../@types';
26
26
  import Button from '../../../shared/Button';
27
27
  import { CRValidationSchema, FLValidationSchema } from './validation';
@@ -42,8 +42,7 @@ var BusinessType = function (_a) {
42
42
  mode: 'onChange'
43
43
  });
44
44
  React.useEffect(function () {
45
- dispatch(retrieveFLInfos());
46
- dispatch(retrieveCRInfos());
45
+ dispatch(retrieveEntityList());
47
46
  }, []);
48
47
  React.useEffect(function () {
49
48
  var businessType = businessTypeData.businessType;
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import { CRLicense } from '../../../../@types';
2
+ import { License } from '../../../../@types';
3
3
  interface CompanyLicenseProps {
4
4
  show: boolean;
5
- list: Array<CRLicense>;
5
+ list: Array<License>;
6
6
  onSelectLicense?: (number: string) => void;
7
7
  onListOpen?: () => void;
8
8
  onListClose?: () => void;
@@ -43,7 +43,7 @@ import SimpleList from '../../../../components/SimpleList';
43
43
  import Text from '../../../../components/Text';
44
44
  import ExpandIcon from '../../../../components/ExpandIcon';
45
45
  import Collapse from '../../../../components/Collapse';
46
- import { OTHER_CR_LICENSE } from '../../../../constants';
46
+ import { OTHER_LICENSE } from '../../../../constants';
47
47
  import CRNumber from './CRNumber';
48
48
  var InputStyled = styled(Input)(function (_a) {
49
49
  var theme = _a.theme;
@@ -88,19 +88,22 @@ var CompanyLicense = function (_a) {
88
88
  setSelectedLicense(first);
89
89
  setValue('crNumber', getLicenseNumber(first), { shouldValidate: true });
90
90
  if (!hasOther)
91
- array = __spreadArray(__spreadArray([], array, true), [OTHER_CR_LICENSE], false);
91
+ array = __spreadArray(__spreadArray([], array, true), [OTHER_LICENSE], false);
92
92
  setLicenseList(array);
93
93
  }
94
94
  }
95
95
  }, [show, list]);
96
96
  var getLicenseNumber = function (item) {
97
- return (item === null || item === void 0 ? void 0 : item.crNumber) || '';
97
+ var _a;
98
+ return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
98
99
  };
99
100
  var getLicenseName = function (item) {
100
- return (item === null || item === void 0 ? void 0 : item.crName) || '';
101
+ var _a, _b;
102
+ return (isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
101
103
  };
102
104
  var isOtherLicense = function (item) {
103
- return (item === null || item === void 0 ? void 0 : item.crName) === 'other';
105
+ var _a;
106
+ return ((_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.en) === 'other';
104
107
  };
105
108
  var onSelectItem = function (license) {
106
109
  setSelectedLicense(license);
@@ -112,7 +115,7 @@ var CompanyLicense = function (_a) {
112
115
  };
113
116
  var hasList = (licenseList === null || licenseList === void 0 ? void 0 : licenseList.length) > 0;
114
117
  var showCRNumber = !anchorEl;
115
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('enter_commercial_register_no'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: t(getLicenseName(selectedLicense)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'crNumber', list: licenseList, onSelectItem: onSelectItem, renderItem: function (item) {
118
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('enter_commercial_register_no'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: t(getLicenseName(selectedLicense)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList, onSelectItem: onSelectItem, renderItem: function (item) {
116
119
  return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selectedLicense) }, { children: isOtherLicense(item)
117
120
  ? t(getLicenseNumber(item))
118
121
  : isAr
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import { FLLicense } from '../../../../@types';
2
+ import { License } from '../../../../@types';
3
3
  interface FreelanceLicenseProps {
4
4
  show: boolean;
5
- list: Array<FLLicense>;
5
+ list: Array<License>;
6
6
  onSelectLicense?: (number: string) => void;
7
7
  onListOpen?: () => void;
8
8
  onListClose?: () => void;
@@ -42,7 +42,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
42
42
  import CheckIcon from '../../../shared/CheckIcon';
43
43
  import ExpandIcon from '../../../../components/ExpandIcon';
44
44
  import Input from '../../../shared/Input';
45
- import { OTHER_FL_LICENSE } from '../../../../constants';
45
+ import { OTHER_LICENSE } from '../../../../constants';
46
46
  import SimpleList from '../../../../components/SimpleList';
47
47
  import FLNumber from './FLNumber';
48
48
  var InputStyled = styled(Input)(function (_a) {
@@ -88,22 +88,22 @@ var FreelanceLicense = function (_a) {
88
88
  setSelectedLicense(first);
89
89
  setValue('flNumber', getLicenseNumber(first), { shouldValidate: true });
90
90
  if (!hasOther)
91
- array = __spreadArray(__spreadArray([], array, true), [OTHER_FL_LICENSE], false);
91
+ array = __spreadArray(__spreadArray([], array, true), [OTHER_LICENSE], false);
92
92
  setLicenseList(array);
93
93
  }
94
94
  }
95
95
  }, [show, list]);
96
96
  var getLicenseNumber = function (item) {
97
- return (item === null || item === void 0 ? void 0 : item.number) || '';
97
+ var _a;
98
+ return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
98
99
  };
99
100
  var isOtherLicense = function (item) {
100
- return (item === null || item === void 0 ? void 0 : item.number) === 'other';
101
+ var _a;
102
+ return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) === 'other';
101
103
  };
102
104
  var getLicenseName = function (item) {
103
- var _a, _b, _c, _d, _e, _f;
104
- return ((isAr
105
- ? (_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.license_specialities) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.speciality) === null || _c === void 0 ? void 0 : _c.name
106
- : (_f = (_e = (_d = item === null || item === void 0 ? void 0 : item.license_specialities) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.speciality) === null || _f === void 0 ? void 0 : _f.name_en) || '');
105
+ var _a, _b;
106
+ return (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) || '';
107
107
  };
108
108
  var onSelectItem = function (license) {
109
109
  setSelectedLicense(license);
@@ -115,7 +115,7 @@ var FreelanceLicense = function (_a) {
115
115
  };
116
116
  var hasList = (licenseList === null || licenseList === void 0 ? void 0 : licenseList.length) > 0;
117
117
  var showFLNumber = !anchorEl;
118
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('enter_freelance_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_fl'), value: t(getLicenseName(selectedLicense)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'license_specialities[0].speciality.name_en', list: licenseList, onSelectItem: onSelectItem, renderItem: function (item) {
118
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('enter_freelance_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_fl'), value: t(getLicenseName(selectedLicense)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList, onSelectItem: onSelectItem, renderItem: function (item) {
119
119
  return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selectedLicense) }, { children: isOtherLicense(item)
120
120
  ? t(getLicenseNumber(item))
121
121
  : isAr