@tap-payments/auth-jsconnect 1.0.69 → 1.0.72

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 (67) hide show
  1. package/build/@types/app.d.ts +9 -1
  2. package/build/@types/form.d.ts +1 -1
  3. package/build/assets/locales/ar.json +10 -5
  4. package/build/assets/locales/en.json +15 -4
  5. package/build/components/SimpleList/SimpleList.js +5 -2
  6. package/build/constants/api.js +1 -1
  7. package/build/constants/assets.d.ts +2 -0
  8. package/build/constants/assets.js +2 -0
  9. package/build/features/app/business/businessStore.js +32 -23
  10. package/build/features/app/connect/connectStore.js +3 -1
  11. package/build/features/app/individual/individualStore.d.ts +7 -1
  12. package/build/features/app/individual/individualStore.js +41 -2
  13. package/build/features/bank/screens/BankDetails/BankName.js +18 -5
  14. package/build/features/bank/screens/BankDetails/IBAN.js +1 -8
  15. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -3
  16. package/build/features/bank/screens/BankDetails/validation.js +1 -1
  17. package/build/features/bank/screens/Success/Success.js +1 -1
  18. package/build/features/bank/screens/Verify/Verify.js +3 -4
  19. package/build/features/business/screens/Activities/Activities.js +2 -3
  20. package/build/features/business/screens/Activities/ActivitiesList.js +2 -3
  21. package/build/features/business/screens/Activities/SalesChannels.js +2 -3
  22. package/build/features/business/screens/BusinessType/BusinessType.js +2 -3
  23. package/build/features/business/screens/BusinessType/LicenseList.js +2 -3
  24. package/build/features/business/screens/Customers/CustomerLocations.d.ts +1 -1
  25. package/build/features/business/screens/Customers/CustomerLocations.js +2 -3
  26. package/build/features/business/screens/Customers/Customers.js +6 -7
  27. package/build/features/business/screens/Customers/ExpectedCustomers.js +2 -3
  28. package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +1 -1
  29. package/build/features/business/screens/Customers/ExpectedSalesRange.js +43 -35
  30. package/build/features/business/screens/IDBOD/DOB.js +6 -0
  31. package/build/features/business/screens/IDBOD/IDBOD.js +3 -8
  32. package/build/features/business/screens/OTP/OTP.js +3 -4
  33. package/build/features/business/screens/OTP/OTPInput.js +2 -3
  34. package/build/features/business/screens/Success/Success.js +1 -1
  35. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +10 -14
  36. package/build/features/business/screens/Verify/Verify.js +3 -4
  37. package/build/features/connect/screens/Individual/Individual.js +2 -3
  38. package/build/features/connect/screens/Individual/MobileNumber.js +22 -8
  39. package/build/features/connect/screens/Merchant/BrandName.js +2 -3
  40. package/build/features/connect/screens/Merchant/Merchant.js +2 -3
  41. package/build/features/connect/screens/Mobile/Mobile.js +3 -4
  42. package/build/features/connect/screens/Mobile/MobileNumber.js +25 -9
  43. package/build/features/connect/screens/NID/DOB.js +2 -3
  44. package/build/features/connect/screens/NID/NID.js +3 -4
  45. package/build/features/connect/screens/OTP/OTP.js +2 -3
  46. package/build/features/connect/screens/OTP/OTPInput.js +2 -3
  47. package/build/features/connect/screens/ThankYou/ThankYou.js +1 -1
  48. package/build/features/individual/Individual.js +4 -1
  49. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +8 -5
  50. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerName.js +5 -8
  51. package/build/features/individual/screens/Success/Success.js +1 -1
  52. package/build/features/individual/screens/Verify/Verify.js +3 -4
  53. package/build/features/password/screens/Success/Success.js +1 -1
  54. package/build/features/password/screens/Verify/Verify.js +3 -4
  55. package/build/features/shared/Footer/Footer.js +2 -3
  56. package/build/features/shared/Search/Search.d.ts +7 -0
  57. package/build/features/shared/Search/Search.js +25 -0
  58. package/build/features/shared/Search/index.d.ts +2 -0
  59. package/build/features/shared/Search/index.js +2 -0
  60. package/build/features/shared/SearchIcon/SearchIcon.d.ts +6 -0
  61. package/build/features/shared/SearchIcon/SearchIcon.js +26 -0
  62. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +2 -1
  63. package/build/features/shared/SuccessScreen/SuccessScreen.js +9 -20
  64. package/build/features/tax/screens/Success/Success.js +1 -1
  65. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -3
  66. package/build/features/tax/screens/Verify/Verify.js +3 -4
  67. package/package.json +1 -1
@@ -53,7 +53,15 @@ export interface CustomerLocation {
53
53
  }
54
54
  export interface ExpectedCustomer extends CustomerLocation {
55
55
  }
56
- export interface ExpectedSaleRange extends CustomerLocation {
56
+ export interface ExpectedSaleRange {
57
+ id: string;
58
+ name_ar: string;
59
+ name_en: string;
60
+ sub?: Array<{
61
+ id: string;
62
+ name_ar: string;
63
+ name_en: string;
64
+ }>;
57
65
  }
58
66
  export declare enum BusinessType {
59
67
  CR = "company",
@@ -41,7 +41,7 @@ export declare type ActivitiesFormValues = {
41
41
  export declare type CustomersFormValues = {
42
42
  customerLocations: Array<CustomerLocation>;
43
43
  expectedCustomer: ExpectedCustomer | undefined;
44
- expectedSalesRange: ExpectedSaleRange | undefined;
44
+ expectedSale: ExpectedSaleRange | undefined;
45
45
  refundPolicy: boolean;
46
46
  transactionPolicy: boolean;
47
47
  };
@@ -224,15 +224,20 @@
224
224
  "add_other_cr": "Add CR",
225
225
  "cr_number": "CR Number",
226
226
  "fl_number": "FL Number",
227
- "tax_flow_completed": "Tax",
228
- "individual_flow_completed": "Individual",
229
- "bank_flow_completed": "Bank",
227
+ "tax_flow_completed": "Tax {{tax_id}}",
228
+ "individual_flow_completed": "Individual {{individual_name}}",
229
+ "bank_flow_completed": "Bank {{iban}}",
230
230
  "password_flow_completed": "Password",
231
231
  "tax_flow_pending": "Tax",
232
232
  "individual_flow_pending": "Individual",
233
233
  "bank_flow_pending": "Bank",
234
234
  "password_flow_pending": "Password",
235
235
  "business_flow_pending": "Business",
236
- "business_flow_completed": "Business",
237
- "continue": "Continue"
236
+ "business_flow_completed": "{{business_type}} {{license_number}}",
237
+ "continue": "Continue",
238
+ "search_placeholder": "البحث...",
239
+ "individual_success_title": "Your personal details are updated",
240
+ "tax_success_title": "Your tax details are updated",
241
+ "bank_success_title": "Your bank details are updated",
242
+ "password_success_title": "Your password is set"
238
243
  }
@@ -238,15 +238,26 @@
238
238
  "add_other_cr": "Add CR",
239
239
  "cr_number": "CR Number",
240
240
  "fl_number": "FL Number",
241
- "tax_flow_completed": "Tax",
241
+ "tax_flow_completed": "Tax {{tax_id}}",
242
242
  "individual_flow_completed": "Individual {{individual_name}}",
243
- "bank_flow_completed": "Bank",
243
+ "bank_flow_completed": "{{bank_name}} {{iban}}",
244
244
  "password_flow_completed": "Password",
245
245
  "tax_flow_pending": "Tax",
246
246
  "individual_flow_pending": "Individual {{individual_name}}",
247
247
  "bank_flow_pending": "Bank",
248
248
  "password_flow_pending": "Password",
249
249
  "business_flow_pending": "Business",
250
- "business_flow_completed": "Business",
251
- "continue": "Continue"
250
+ "business_flow_completed": "{{business_type}} {{license_number}}",
251
+ "continue": "Continue",
252
+ "search_placeholder": "search..",
253
+ "connect_completed_title": "Congratulations",
254
+ "connect_completed_description": "You successfully signed up your brand with Tap. Check your email to activate your account.",
255
+ "business_completed_title": "Your account is active",
256
+ "business_completed_description": "That was easy! You’re all set to accept payments. One last thing, add your bank and tax info to start receiving your payouts.",
257
+ "business_completed_button": "Finish setting up my account",
258
+ "individual_success_title": "Your personal details are updated",
259
+ "tax_success_title": "Your tax details are updated",
260
+ "bank_success_title": "Your bank details are updated",
261
+ "password_success_title": "Your password is set",
262
+ "account_details": "Your account details"
252
263
  }
@@ -58,8 +58,8 @@ var ListItemStyled = styled(ListItem)(function (_a) {
58
58
  var theme = _a.theme;
59
59
  return ({
60
60
  display: 'flex',
61
- paddingLeft: theme.spacing(2.5),
62
- paddingRight: theme.spacing(2.5),
61
+ paddingInlineStart: theme.spacing(2.5),
62
+ paddingInlineEnd: theme.spacing(2.5),
63
63
  paddingTop: theme.spacing(1),
64
64
  paddingBottom: theme.spacing(1.875),
65
65
  cursor: 'pointer',
@@ -69,6 +69,9 @@ var ListItemStyled = styled(ListItem)(function (_a) {
69
69
  function SimpleList(_a) {
70
70
  var list = _a.list, listItemProps = _a.listItemProps, onSelectItem = _a.onSelectItem, renderItem = _a.renderItem, children = _a.children, searchKeyPath = _a.searchKeyPath, rest = __rest(_a, ["list", "listItemProps", "onSelectItem", "renderItem", "children", "searchKeyPath"]);
71
71
  var _b = React.useState(list), items = _b[0], setItems = _b[1];
72
+ React.useEffect(function () {
73
+ setItems(list);
74
+ }, [list]);
72
75
  var filterItems = function (arr, searchKey) {
73
76
  return arr.filter(function (item) {
74
77
  var searchValue = get(item, searchKeyPath || '') || '';
@@ -16,7 +16,7 @@ var CHECK_BRAND = 'lead/profile/profile_name';
16
16
  var CREATE_ACCOUNT_PATH = '/account/create';
17
17
  var CHANNEL_PATH = '/channel';
18
18
  var CUSTOMER_BASES_PATH = '/customerBases';
19
- var SALES_PATH = '/sales';
19
+ var SALES_PATH = '/v2/sales';
20
20
  var EXPECTED_CUSTOMERS_PATH = '/expectedCustomers';
21
21
  var SOURCE_INCOME_PATH = '/v2/sourceOfIncome';
22
22
  var FIREBASE_URL = 'https://goconnect-195cd-default-rtdb.asia-southeast1.firebasedatabase.app/sandbox/local.json';
@@ -35,6 +35,8 @@ export declare const ICONS_NAMES: {
35
35
  ABSHER_LOGO: string;
36
36
  EMAIL_ICON: string;
37
37
  MOBILE_ICON: string;
38
+ SEARCH_ICON: string;
39
+ SUCCESS_GIF: string;
38
40
  GMAIL_Filled_ICON: string;
39
41
  GMAIL_White_ICON: string;
40
42
  outlook_Filled_ICON: string;
@@ -35,6 +35,8 @@ export var ICONS_NAMES = {
35
35
  ABSHER_LOGO: 'https://dash.b-cdn.net/icons/menu/Absher.svg',
36
36
  EMAIL_ICON: 'https://dash.b-cdn.net/icons/menu/email.png',
37
37
  MOBILE_ICON: 'https://dash.b-cdn.net/icons/menu/mobile.svg',
38
+ SEARCH_ICON: 'https://dash.b-cdn.net/icons/menu/search-icon.svg',
39
+ SUCCESS_GIF: 'https://dash.b-cdn.net/icons/menu/success-icon.gif',
38
40
  GMAIL_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-filled.svg',
39
41
  GMAIL_White_ICON: 'https://dash.b-cdn.net/icons/menu/Gmail-white.svg',
40
42
  outlook_Filled_ICON: 'https://dash.b-cdn.net/icons/menu/Outlook-filled.svg',
@@ -334,7 +334,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
334
334
  customers_base: customerBase,
335
335
  id: id,
336
336
  customers_served_monthly: parseInt(((_c = params.expectedCustomer) === null || _c === void 0 ? void 0 : _c.id) || '0'),
337
- yearly_sales_range: ((_d = params.expectedSalesRange) === null || _d === void 0 ? void 0 : _d.title) || '',
337
+ yearly_sales_range: ((_d = params.expectedSale) === null || _d === void 0 ? void 0 : _d.id) || '',
338
338
  agree_refund: params.refundPolicy,
339
339
  agree_chargeback: params.transactionPolicy,
340
340
  step_name: stepName
@@ -443,7 +443,7 @@ var initialState = {
443
443
  customersData: {
444
444
  customerLocations: [],
445
445
  expectedCustomer: undefined,
446
- expectedSalesRange: undefined,
446
+ expectedSale: undefined,
447
447
  refundPolicy: false,
448
448
  transactionPolicy: false
449
449
  }
@@ -469,7 +469,9 @@ export var businessSlice = createSlice({
469
469
  state.error = null;
470
470
  state.customLoading = false;
471
471
  var _a = action.payload, businessCountry = _a.businessCountry, countries = _a.countries;
472
- state.data.countries = countries;
472
+ state.data.countries = countries
473
+ .slice()
474
+ .sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
473
475
  state.data.businessCountry = businessCountry || defaultCountry;
474
476
  })
475
477
  .addCase(getCountries.pending, function (state) {
@@ -527,7 +529,7 @@ export var businessSlice = createSlice({
527
529
  var _a, _b;
528
530
  if ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend)
529
531
  state.customLoading = true;
530
- if ((_b = action.meta.arg) === null || _b === void 0 ? void 0 : _b.isResend)
532
+ if (!((_b = action.meta.arg) === null || _b === void 0 ? void 0 : _b.isResend))
531
533
  state.loading = true;
532
534
  state.error = null;
533
535
  })
@@ -579,11 +581,14 @@ export var businessSlice = createSlice({
579
581
  }
580
582
  licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
581
583
  state.data.businessTypeData.responseBody = { licenseList: licenseList };
582
- var selectedLicense = ((_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (item) { var _a; return ((_a = item.license) === null || _a === void 0 ? void 0 : _a.number) === licenseNumber; })) || (licenseList === null || licenseList === void 0 ? void 0 : licenseList[0]);
583
- state.data.businessTypeData.selectedLicense = selectedLicense;
584
+ var selectedLicense = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
585
+ var license = _a.license;
586
+ return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber;
587
+ });
588
+ state.data.businessTypeData.selectedLicense = selectedLicense || (licenseList === null || licenseList === void 0 ? void 0 : licenseList[0]);
584
589
  var isOtherLicense = ((_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number) === 'other_fl' || ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) === 'other_cr';
585
590
  if (!isOtherLicense)
586
- state.data.businessTypeData.licenseNumber = (_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.number;
591
+ state.data.businessTypeData.licenseNumber = ((_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.number) || '';
587
592
  })
588
593
  .addCase(retrieveEntityList.rejected, function (state, action) {
589
594
  state.error = action.error.message;
@@ -594,10 +599,10 @@ export var businessSlice = createSlice({
594
599
  state.error = null;
595
600
  })
596
601
  .addCase(updateLeadBusinessType.fulfilled, function (state, action) {
597
- var _a, _b, _c, _d;
602
+ var _a, _b;
598
603
  state.loading = false;
599
604
  state.error = null;
600
- var _e = action.payload, data = _e.data, formData = _e.formData;
605
+ var _c = action.payload, data = _c.data, formData = _c.formData;
601
606
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
602
607
  if (description) {
603
608
  state.error = description;
@@ -605,8 +610,10 @@ export var businessSlice = createSlice({
605
610
  }
606
611
  state.data.businessTypeData = __assign(__assign({}, state.data.businessTypeData), formData);
607
612
  var entity = data.entity, entity_activities = data.entity_activities;
608
- if (!!((_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date)) {
609
- state.data.activitiesData.operationStartDate = convertNumbers2English(moment((_d = (_c = data === null || data === void 0 ? void 0 : data.entity) === null || _c === void 0 ? void 0 : _c.license) === null || _d === void 0 ? void 0 : _d.issuing_date).format('YYYY-MM-DD'));
613
+ var issuingDate = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
614
+ if (!!issuingDate) {
615
+ var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
616
+ state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
610
617
  }
611
618
  var activities = entity_activities || [];
612
619
  var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
@@ -674,18 +681,20 @@ export var businessSlice = createSlice({
674
681
  .addCase(retrieveDataList.fulfilled, function (state, action) {
675
682
  state.loading = false;
676
683
  state.error = null;
677
- var _a = action.payload, customerBases = _a.customerBases, expectedSales = _a.expectedSales, expectedCustomerSales = _a.expectedCustomerSales;
678
- var data = state.data.activitiesData.responseBody;
679
- state.data.activitiesData.responseBody = __assign(__assign({}, data), { customerBases: customerBases || [], expectedSales: expectedSales || [], expectedCustomerSales: expectedCustomerSales || [] });
680
- var selectedCustomerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases[0];
681
- if (!!selectedCustomerBase)
682
- state.data.customersData.customerLocations = [selectedCustomerBase];
683
- var selectedExpectedSale = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales[(expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.length) - 1];
684
- if (!!selectedExpectedSale)
685
- state.data.customersData.expectedSalesRange = selectedExpectedSale;
686
- var selectedExpectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[(expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales.length) - 1];
687
- if (!!selectedExpectedCustomerSale)
688
- state.data.customersData.expectedCustomer = selectedExpectedCustomerSale;
684
+ var payload = action.payload;
685
+ var customerBases = payload.customerBases || [];
686
+ var customerBase = customerBases === null || customerBases === void 0 ? void 0 : customerBases[0];
687
+ var expectedSales = payload.expectedSales || [];
688
+ var expectedSale = expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales[expectedSales.length - 1];
689
+ var expectedCustomerSales = payload.expectedCustomerSales || [];
690
+ var expectedCustomerSale = expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales[expectedCustomerSales.length - 1];
691
+ state.data.activitiesData.responseBody = __assign(__assign({}, state.data.activitiesData.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
692
+ if (!!customerBase)
693
+ state.data.customersData.customerLocations = [customerBase];
694
+ if (!!expectedSale)
695
+ state.data.customersData.expectedSale = expectedSale;
696
+ if (!!expectedCustomerSale)
697
+ state.data.customersData.expectedCustomer = expectedCustomerSale;
689
698
  })
690
699
  .addCase(retrieveDataList.rejected, function (state, action) {
691
700
  state.loading = false;
@@ -440,7 +440,9 @@ export var connectSlice = createSlice({
440
440
  state.error = null;
441
441
  state.customLoading = false;
442
442
  var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
443
- state.data.countries = countries;
443
+ state.data.countries = countries
444
+ .slice()
445
+ .sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
444
446
  state.data.businessCountry = businessCountry || defaultCountry;
445
447
  state.data.mobileData.countryCode = businessCountry || defaultCountry;
446
448
  })
@@ -1,5 +1,9 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { CountryCode, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
+ export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
4
+ businessCountry: any;
5
+ countries: any;
6
+ }, void, {}>;
3
7
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
8
  data: any;
5
9
  leadData: any;
@@ -24,6 +28,8 @@ declare type VerifyData = {
24
28
  token: string;
25
29
  };
26
30
  export interface IndividualData {
31
+ businessCountry: CountryCode;
32
+ countries: Array<CountryCode>;
27
33
  verify: ResponseData & VerifyData;
28
34
  otpData: OTPFormValues & ResponseData;
29
35
  individualData: IndividualExtraFormValues & ResponseData;
@@ -50,7 +50,23 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { removeRequestHeaders } from '../../../utils';
52
52
  import { handleNextScreenStep } from '../../../app/settings';
53
- import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
53
+ import { defaultCountry, INDIVIDUAl_STEP_NAMES } from '../../../constants';
54
+ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
+ var settings, countriesBody, businessCountry;
56
+ return __generator(this, function (_a) {
57
+ switch (_a.label) {
58
+ case 0:
59
+ settings = thunkApi.getState().settings;
60
+ return [4, API.countryService.getAllCountries()];
61
+ case 1:
62
+ countriesBody = (_a.sent()).data;
63
+ businessCountry = (countriesBody.list || []).find(function (country) {
64
+ return [country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
65
+ });
66
+ return [2, { businessCountry: businessCountry, countries: countriesBody.list }];
67
+ }
68
+ });
69
+ }); });
54
70
  export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
71
  var payload, data, leadResponse;
56
72
  return __generator(this, function (_a) {
@@ -177,8 +193,9 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
177
193
  var initialState = {
178
194
  error: null,
179
195
  loading: false,
180
- customLoading: false,
181
196
  data: {
197
+ countries: [],
198
+ businessCountry: defaultCountry,
182
199
  verify: {
183
200
  token: ''
184
201
  },
@@ -211,6 +228,23 @@ export var individualSlice = createSlice({
211
228
  },
212
229
  extraReducers: function (builder) {
213
230
  builder
231
+ .addCase(getCountries.fulfilled, function (state, action) {
232
+ state.error = null;
233
+ state.customLoading = false;
234
+ var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
235
+ state.data.countries = countries
236
+ .slice()
237
+ .sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
238
+ state.data.businessCountry = businessCountry || defaultCountry;
239
+ })
240
+ .addCase(getCountries.pending, function (state) {
241
+ state.error = null;
242
+ state.customLoading = true;
243
+ })
244
+ .addCase(getCountries.rejected, function (state, action) {
245
+ state.error = action.error.message;
246
+ state.customLoading = false;
247
+ })
214
248
  .addCase(verifyLeadToken.pending, function (state) {
215
249
  state.error = null;
216
250
  state.customLoading = true;
@@ -258,6 +292,7 @@ export var individualSlice = createSlice({
258
292
  state.error = null;
259
293
  })
260
294
  .addCase(retrieveDataList.fulfilled, function (state, action) {
295
+ var _a, _b;
261
296
  state.loading = false;
262
297
  state.error = null;
263
298
  var sourceIncome = action.payload;
@@ -266,6 +301,10 @@ export var individualSlice = createSlice({
266
301
  var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
267
302
  if (!!selectedSourceIncome)
268
303
  state.data.individualData.sourceIncome = selectedSourceIncome;
304
+ var location = (_b = (_a = state.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.entity) === null || _b === void 0 ? void 0 : _b.country;
305
+ if (!!location) {
306
+ state.data.individualData.employerLocation = state.data.countries.find(function (country) { return country.iso2 === location; });
307
+ }
269
308
  })
270
309
  .addCase(retrieveDataList.rejected, function (state, action) {
271
310
  state.loading = false;
@@ -1,3 +1,14 @@
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
+ };
1
12
  import { jsx as _jsx } from "react/jsx-runtime";
2
13
  import * as React from 'react';
3
14
  import { ScreenContainer } from '../../../shared/Containers';
@@ -10,10 +21,11 @@ import CheckIcon from '../../../shared/CheckIcon';
10
21
  import { bankSelector } from '../../../app/bank/bankStore';
11
22
  import { useAppSelector } from '../../../../hooks';
12
23
  import { removeAllOtherThanAlphabetAndSpace } from '../../../../utils';
24
+ import Collapse from '../../../../components/Collapse';
13
25
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
14
26
  var theme = _a.theme;
15
27
  return ({
16
- marginBlockEnd: theme.spacing(3)
28
+ marginBlockStart: theme.spacing(3)
17
29
  });
18
30
  });
19
31
  var InputStyled = styled(Input)(function () { return ({
@@ -25,22 +37,23 @@ var BankName = function () {
25
37
  var _a, _b;
26
38
  var t = useTranslation().t;
27
39
  var _c = useFormContext(), setValue = _c.setValue, control = _c.control;
28
- var _d = useAppSelector(bankSelector), data = _d.data, loading = _d.loading;
40
+ var data = useAppSelector(bankSelector).data;
29
41
  var bankNameControl = useController({ name: 'bankName', control: control });
30
42
  var bankNameValue = bankNameControl.field.value;
31
43
  var hasError = !!((_a = bankNameControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message);
32
- var bankName = (_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.bank_name;
33
44
  var clearValue = function () {
34
45
  bankNameControl.field.onChange('');
35
46
  };
36
47
  React.useEffect(function () {
48
+ var _a;
49
+ var bankName = (_a = data.bankData.responseBody) === null || _a === void 0 ? void 0 : _a.bank_name;
37
50
  setValue('bankName', bankName);
38
- }, []);
51
+ }, [(_b = data.bankData.responseBody) === null || _b === void 0 ? void 0 : _b.bank_name]);
39
52
  var handleBankChange = function (_a) {
40
53
  var target = _a.target;
41
54
  var value = removeAllOtherThanAlphabetAndSpace(target.value);
42
55
  bankNameControl.field.onChange(value);
43
56
  };
44
- return (_jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), onChange: handleBankChange, value: bankNameValue, required: true, disabled: !!bankName, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }));
57
+ return (_jsx(Collapse, __assign({ in: !!bankNameValue }, { children: _jsx(FeatureStyled, { children: _jsx(InputStyled, { label: t('enter_bank_name'), placeholder: t('enter_bank_name_placeholder'), onChange: handleBankChange, value: bankNameValue, required: true, readOnly: true, endAdornment: !hasError && bankNameValue ? _jsx(CheckIcon, {}) : bankNameValue && _jsx(ClearIcon, { onClick: clearValue }) }) }) })));
45
58
  };
46
59
  export default BankName;
@@ -40,7 +40,6 @@ import Input from '../../../shared/Input';
40
40
  import { useTranslation } from 'react-i18next';
41
41
  import { useController, useFormContext } from 'react-hook-form';
42
42
  import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
43
- import { styled } from '@mui/material';
44
43
  import { MAX_IBAN_VALUE } from '../../../../constants';
45
44
  import { ScreenContainer } from '../../../shared/Containers';
46
45
  import { debounce } from 'lodash-es';
@@ -50,12 +49,6 @@ import axios from 'axios';
50
49
  import ClearIcon from '../../../shared/ClearIcon';
51
50
  import CheckIcon from '../../../shared/CheckIcon';
52
51
  import CircularProgress from '@mui/material/CircularProgress';
53
- var FeatureStyled = styled(ScreenContainer)(function (_a) {
54
- var theme = _a.theme;
55
- return ({
56
- marginBlockEnd: theme.spacing(3)
57
- });
58
- });
59
52
  var cancelToken = null;
60
53
  var IBAN = function (_a) {
61
54
  var _b;
@@ -93,6 +86,6 @@ var IBAN = function (_a) {
93
86
  var clearValue = function () {
94
87
  ibanControl.field.onChange('');
95
88
  };
96
- return (_jsx(FeatureStyled, { children: _jsx(Input, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('enter_iban_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: ibanChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && ibanValue ? (_jsx(CheckIcon, {})) : (ibanValue && _jsx(ClearIcon, { onClick: clearValue })) }) }));
89
+ return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t('enter_iban'), inputProps: { maxLength: MAX_IBAN_VALUE }, onChange: handleIbanChange, value: ibanValue, placeholder: t('enter_iban_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true, endAdornment: ibanChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && ibanValue ? (_jsx(CheckIcon, {})) : (ibanValue && _jsx(ClearIcon, { onClick: clearValue })) }) }));
97
90
  };
98
91
  export default IBAN;
@@ -1,14 +1,14 @@
1
1
  import * as yup from 'yup';
2
2
  export declare const BankValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
3
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
- bankName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
5
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
6
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
7
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
- bankName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
9
9
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
10
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
11
  iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
- bankName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
+ bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
13
13
  beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
14
  }>>>;
@@ -7,7 +7,7 @@ export var BankValidation = yup.object().shape({
7
7
  .min(16, 'invalid_iban_format')
8
8
  .max(34, 'invalid_iban_format')
9
9
  .required('alert_iban'),
10
- bankName: yup.string().required('bank_name_required'),
10
+ bankName: yup.string().optional(),
11
11
  beneficiaryName: yup
12
12
  .string()
13
13
  .matches(REGEX_BENEFICIARY_NAME, 'beneficiary_name_invalid')
@@ -11,6 +11,6 @@ var Success = function (_a) {
11
11
  dispatch(updateLeadSuccess());
12
12
  }, []);
13
13
  var onSuccess = function () { };
14
- return _jsx(SuccessScreen, { title: t('ide_successfully_updated_message'), onSuccess: onSuccess, successTitle: 'continue' });
14
+ return _jsx(SuccessScreen, { title: t('bank_success_title'), onSuccess: onSuccess, successTitle: t('continue') });
15
15
  };
16
16
  export default React.memo(Success);
@@ -13,13 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { useAppDispatch } from '../../../../hooks';
15
15
  import { useTranslation } from 'react-i18next';
16
- import { useSelector } from 'react-redux';
17
16
  import { useForm, FormProvider } from 'react-hook-form';
18
17
  import { yupResolver } from '@hookform/resolvers/yup';
19
18
  import Box from '@mui/material/Box/Box';
20
19
  import { styled } from '@mui/material/styles';
21
20
  import { handlePrevScreenStep } from '../../../../app/settings';
22
- import { useLanguage } from '../../../../hooks';
21
+ import { useLanguage, useAppSelector } from '../../../../hooks';
23
22
  import { maskPhone } from '../../../../utils';
24
23
  import Form from '../../../../components/Form';
25
24
  import Text from '../../../../components/Text';
@@ -50,7 +49,7 @@ var FormStyled = styled(Form)(function () { return ({
50
49
  var VerifyNumber = function (_a) {
51
50
  var _b, _c, _d;
52
51
  var dispatch = useAppDispatch();
53
- var _e = useSelector(bankSelector), data = _e.data, loading = _e.loading, error = _e.error;
52
+ var _e = useAppSelector(bankSelector), data = _e.data, loading = _e.loading, error = _e.error;
54
53
  var methods = useForm({
55
54
  resolver: yupResolver(OTPValidation),
56
55
  defaultValues: data.otpData,
@@ -73,6 +72,6 @@ var VerifyNumber = function (_a) {
73
72
  };
74
73
  var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
75
74
  var disabled = !methods.formState.isValid || !!error || !phone;
76
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, type: 'submit', isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
75
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
77
76
  };
78
77
  export default React.memo(VerifyNumber);
@@ -11,11 +11,10 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
- import { useSelector } from 'react-redux';
15
14
  import { styled } from '@mui/material/styles';
16
15
  import ActivitiesList from './ActivitiesList';
17
16
  import { useForm, FormProvider } from 'react-hook-form';
18
- import { useAppDispatch, useLanguage } from '../../../../hooks';
17
+ import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
19
18
  import Form from '../../../../components/Form';
20
19
  import { yupResolver } from '@hookform/resolvers/yup';
21
20
  import { useTranslation } from 'react-i18next';
@@ -37,7 +36,7 @@ var Activities = function () {
37
36
  var dispatch = useAppDispatch();
38
37
  var isAr = useLanguage().isAr;
39
38
  var t = useTranslation().t;
40
- var _c = useSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
39
+ var _c = useAppSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
41
40
  var activitiesData = data.activitiesData;
42
41
  var methods = useForm({
43
42
  resolver: yupResolver(ActivitiesValidationSchema),
@@ -31,14 +31,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
31
31
  };
32
32
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
33
33
  import * as React from 'react';
34
- import { useSelector } from 'react-redux';
35
34
  import Box from '@mui/material/Box';
36
35
  import { alpha, styled } from '@mui/material/styles';
37
36
  import Text from '../../../../components/Text';
38
37
  import Input from '../../../../components/Input';
39
38
  import { useTranslation } from 'react-i18next';
40
39
  import { useController, useFormContext } from 'react-hook-form';
41
- import { useLanguage } from '../../../../hooks';
40
+ import { useLanguage, useAppSelector } from '../../../../hooks';
42
41
  import { BusinessType } from '../../../../@types';
43
42
  import Collapse from '../../../../components/Collapse';
44
43
  import SimpleList from '../../../../components/SimpleList';
@@ -83,7 +82,7 @@ var ActivitiesList = function (_a) {
83
82
  var t = useTranslation().t;
84
83
  var isAr = useLanguage().isAr;
85
84
  var control = useFormContext().control;
86
- var data = useSelector(businessSelector).data;
85
+ var data = useAppSelector(businessSelector).data;
87
86
  var activitiesControl = useController({ name: 'activities', control: control });
88
87
  var controlValue = activitiesControl.field.value;
89
88
  var businessTypeData = data.businessTypeData;
@@ -20,12 +20,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
20
20
  };
21
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
22
  import * as React from 'react';
23
- import { useSelector } from 'react-redux';
24
23
  import Box from '@mui/material/Box';
25
24
  import { alpha, styled } from '@mui/material/styles';
26
25
  import { useTranslation } from 'react-i18next';
27
26
  import { useController, useFormContext } from 'react-hook-form';
28
- import { useLanguage } from '../../../../hooks';
27
+ import { useLanguage, useAppSelector } from '../../../../hooks';
29
28
  import Text from '../../../../components/Text';
30
29
  import { businessSelector } from '../../../app/business/businessStore';
31
30
  import CheckBox from '../../../../components/CheckBox';
@@ -83,7 +82,7 @@ var SalesChannels = function () {
83
82
  var channelsControl = useController({ name: 'salesChannels', control: control });
84
83
  var channelsChecked = channelsControl.field.value;
85
84
  var warningMessage = (_a = channelsControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
86
- var data = useSelector(businessSelector).data;
85
+ var data = useAppSelector(businessSelector).data;
87
86
  var channelList = (data.businessTypeData.responseBody || {}).channelList;
88
87
  React.useEffect(function () {
89
88
  if ((channelList === null || channelList === void 0 ? void 0 : channelList.length) > 0) {
@@ -11,11 +11,10 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
- import { useSelector } from 'react-redux';
15
14
  import { useForm, FormProvider } from 'react-hook-form';
16
15
  import { useTranslation } from 'react-i18next';
17
16
  import { yupResolver } from '@hookform/resolvers/yup';
18
- import { useAppDispatch } from '../../../../hooks';
17
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
18
  import { handlePrevScreenStep } from '../../../../app/settings';
20
19
  import Form from '../../../../components/Form';
21
20
  import Collapse from '../../../../components/Collapse';
@@ -26,7 +25,7 @@ import Button from '../../../shared/Button';
26
25
  import { LicenseValidationSchema } from './validation';
27
26
  import LicenseList from './LicenseList';
28
27
  var BusinessType = function (_a) {
29
- var _b = useSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
28
+ var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
30
29
  var t = useTranslation().t;
31
30
  var isAr = useLanguage().isAr;
32
31
  var dispatch = useAppDispatch();