@tap-payments/auth-jsconnect 2.0.100-test → 2.0.102-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/build/api/index.d.ts +4 -2
  2. package/build/api/individual.d.ts +21 -0
  3. package/build/api/individual.js +28 -1
  4. package/build/assets/locales/ar.json +3 -1
  5. package/build/assets/locales/en.json +3 -1
  6. package/build/features/app/bank/bankStore.js +2 -2
  7. package/build/features/app/business/businessStore.js +14 -12
  8. package/build/features/app/connect/connectStore.js +18 -3
  9. package/build/features/app/individual/individualStore.d.ts +17 -0
  10. package/build/features/app/individual/individualStore.js +144 -69
  11. package/build/features/app/password/passwordStore.js +1 -1
  12. package/build/features/app/tax/taxStore.js +2 -2
  13. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +8 -5
  14. package/build/features/business/screens/Activities/ActivitiesList.d.ts +36 -0
  15. package/build/features/business/screens/Activities/ActivitiesList.js +32 -2
  16. package/build/features/business/screens/Activities/OperationStartDate.d.ts +13 -0
  17. package/build/features/business/screens/Activities/OperationStartDate.js +5 -1
  18. package/build/features/business/screens/Customers/CustomerLocations.d.ts +13 -0
  19. package/build/features/business/screens/Customers/CustomerLocations.js +9 -2
  20. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -3
  21. package/build/features/business/screens/Verify/Verify.js +2 -1
  22. package/build/features/connect/screens/Merchant/SocialMedia.js +6 -2
  23. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -6
  24. package/build/features/individual/screens/Verify/Verify.js +4 -4
  25. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +8 -5
  26. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +7 -4
  27. package/package.json +1 -1
@@ -6,7 +6,7 @@ import { CheckEmailBody, CheckBrandBody } from './availabilityServices';
6
6
  import { EntityInfoBody, EntityBankUpdateBody, UploadFileBody, DocumentUpdateBody, DocumentInfo } from './entity';
7
7
  import { CreateAccountBody } from './account';
8
8
  import { DataElementBody } from './data';
9
- import { BrandListBody, UpdateBrandBody } from './individual';
9
+ import { BrandListBody, UpdateBrandBody, UpdateIndividualBody } from './individual';
10
10
  import { UpdateBoardBody } from './board';
11
11
  declare const API: {
12
12
  ipService: {
@@ -85,6 +85,8 @@ declare const API: {
85
85
  };
86
86
  individualService: {
87
87
  retrieveIndividualInfo: (id: string) => Promise<any>;
88
+ retrieveIndividual: (id: string, type: string) => Promise<any>;
89
+ updateIndividual: ({ id, type, ...data }: UpdateIndividualBody) => Promise<any>;
88
90
  };
89
91
  boardService: {
90
92
  retrieveBoard: (id: string) => Promise<any>;
@@ -103,6 +105,6 @@ declare const API: {
103
105
  updateBrandSales: ({ id, ...data }: import("./individual").UpdateSalesChannels) => void;
104
106
  };
105
107
  };
106
- export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, DocumentUpdateBody, DocumentInfo, VerifyAuthKitOTPBody };
108
+ export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, DocumentUpdateBody, DocumentInfo, VerifyAuthKitOTPBody, UpdateIndividualBody };
107
109
  export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
108
110
  export default API;
@@ -62,7 +62,28 @@ export declare type UpdateSalesChannels = {
62
62
  address: string;
63
63
  }>;
64
64
  };
65
+ export declare type UpdateIndividualBody = {
66
+ id: string;
67
+ type: string;
68
+ employer_name?: string;
69
+ employer_country?: string | null;
70
+ source_income?: Array<{
71
+ id?: string;
72
+ }>;
73
+ monthly_income?: {
74
+ id?: string;
75
+ };
76
+ is_relative_PEP?: boolean | null;
77
+ is_influencer?: boolean | null;
78
+ occupation?: {
79
+ id?: string;
80
+ };
81
+ step_name: string;
82
+ encryption_contract?: Array<string>;
83
+ };
65
84
  declare const individualService: {
66
85
  retrieveIndividualInfo: (id: string) => Promise<any>;
86
+ retrieveIndividual: (id: string, type: string) => Promise<any>;
87
+ updateIndividual: ({ id, type, ...data }: UpdateIndividualBody) => Promise<any>;
67
88
  };
68
89
  export { individualService };
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { ENDPOINT_PATHS } from '../constants';
2
13
  import { httpClient } from './axios';
3
14
  var retrieveIndividualInfo = function (id) {
@@ -6,7 +17,23 @@ var retrieveIndividualInfo = function (id) {
6
17
  url: "".concat(ENDPOINT_PATHS.USER, "/").concat(id, "/info")
7
18
  });
8
19
  };
20
+ var retrieveIndividual = function (id, type) {
21
+ return httpClient({
22
+ method: 'get',
23
+ url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(type, "/").concat(id)
24
+ });
25
+ };
26
+ var updateIndividual = function (_a) {
27
+ var id = _a.id, type = _a.type, data = __rest(_a, ["id", "type"]);
28
+ return httpClient({
29
+ method: 'put',
30
+ url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(type, "/").concat(id),
31
+ data: data
32
+ });
33
+ };
9
34
  var individualService = {
10
- retrieveIndividualInfo: retrieveIndividualInfo
35
+ retrieveIndividualInfo: retrieveIndividualInfo,
36
+ retrieveIndividual: retrieveIndividual,
37
+ updateIndividual: updateIndividual
11
38
  };
12
39
  export { individualService };
@@ -319,5 +319,7 @@
319
319
  "invalid_physical_store_location": "يرجى التحقق من موقع عنوان المتجر ",
320
320
  "invalid_ios_app": "يرجى التحقق من اسم تطبيق iOS",
321
321
  "invalid_android_app": "يرجى التحقق من اسم تطبيق Android",
322
- "invalid_call_center_number": "يرجى التحقق من رقم مركز الاتصال"
322
+ "invalid_call_center_number": "يرجى التحقق من رقم مركز الاتصال",
323
+ "activities_name_hint": "activities_name_hint",
324
+ "customer_base_name_hint": "customer_base_name_hint"
323
325
  }
@@ -346,5 +346,7 @@
346
346
  "invalid_physical_store_location": "May you please verify the entered physical store location.",
347
347
  "invalid_ios_app": "May you please verify the entered iOS application name.",
348
348
  "invalid_android_app": "May you please verify the entered Android application name.",
349
- "invalid_call_center_number": "May you please verify the entered call center number."
349
+ "invalid_call_center_number": "May you please verify the entered call center number.",
350
+ "activities_name_hint": "activities_name_hint",
351
+ "customer_base_name_hint": "customer_base_name_hint"
350
352
  }
@@ -96,7 +96,7 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (t
96
96
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
97
97
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
98
98
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
99
- name: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _b === void 0 ? void 0 : _b.name,
99
+ name: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _b === void 0 ? void 0 : _b.names,
100
100
  contact: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.contact,
101
101
  business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
102
102
  flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
@@ -165,7 +165,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBankEntityInfo', fun
165
165
  case 1:
166
166
  data = _c.sent();
167
167
  return [2, {
168
- data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.name, business: data === null || data === void 0 ? void 0 : data.business, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
168
+ data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, business: data === null || data === void 0 ? void 0 : data.business, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
169
169
  }];
170
170
  }
171
171
  });
@@ -441,7 +441,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
441
441
  case 1:
442
442
  data = _c.sent();
443
443
  return [2, {
444
- data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.name, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
444
+ data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
445
445
  }];
446
446
  }
447
447
  });
@@ -655,7 +655,9 @@ export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', fun
655
655
  case 2:
656
656
  boardResponse = _g.sent();
657
657
  _g.label = 3;
658
- case 3:
658
+ case 3: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
659
+ case 4:
660
+ _g.sent();
659
661
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
660
662
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
661
663
  thunkApi.dispatch(handleNextScreenStep());
@@ -818,10 +820,10 @@ export var businessSlice = createSlice({
818
820
  state.error = null;
819
821
  })
820
822
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
821
- var _a, _b, _c, _d;
823
+ var _a, _b, _c, _d, _e;
822
824
  state.loading = false;
823
825
  state.error = null;
824
- var _e = action.payload, data = _e.data, formData = _e.formData, brandInfo = _e.brandInfo, leadData = _e.leadData;
826
+ var _f = action.payload, data = _f.data, formData = _f.formData, brandInfo = _f.brandInfo, leadData = _f.leadData;
825
827
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
826
828
  if (description) {
827
829
  state.error = description;
@@ -829,11 +831,11 @@ export var businessSlice = createSlice({
829
831
  }
830
832
  state.data.otpData = formData;
831
833
  state.data.otpData.responseBody = data;
832
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), leadData);
833
- var _f = leadData || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type, business_name = _f.business_name;
834
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), leadData), { name: (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.name });
835
+ var _g = leadData || {}, entity = _g.entity, entity_activities = _g.entity_activities, business_type = _g.business_type, business_name = _g.business_name;
834
836
  var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
835
837
  ? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
836
- : (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
838
+ : (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.issuing_date;
837
839
  if (!!issuingDate) {
838
840
  var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
839
841
  state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
@@ -847,13 +849,13 @@ export var businessSlice = createSlice({
847
849
  state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
848
850
  state.data.businessTypeData.entityLegalName = (business_name === null || business_name === void 0 ? void 0 : business_name.en) || '';
849
851
  if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
850
- var licenseNumber_2 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
851
- var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
852
+ var licenseNumber_2 = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
853
+ var _h = state.data.businessTypeData || {}, responseBody = _h.responseBody, selectedLicense = _h.selectedLicense;
852
854
  var licenseList = (responseBody || {}).licenseList;
853
855
  var selectedLicenseData = selectedLicense;
854
856
  if (!!licenseNumber_2) {
855
857
  selectedLicenseData =
856
- ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
858
+ ((_e = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _e === void 0 ? void 0 : _e.call(licenseList, function (_a) {
857
859
  var license = _a.license;
858
860
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
859
861
  })) ||
@@ -1103,7 +1105,7 @@ export var businessSlice = createSlice({
1103
1105
  state.error = action.error.message;
1104
1106
  })
1105
1107
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
1106
- var _a;
1108
+ var _a, _b;
1107
1109
  state.loading = false;
1108
1110
  state.error = null;
1109
1111
  var response = (action.payload || {}).response;
@@ -1112,7 +1114,7 @@ export var businessSlice = createSlice({
1112
1114
  state.error = description;
1113
1115
  return;
1114
1116
  }
1115
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), response);
1117
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), response), { name: (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.name });
1116
1118
  })
1117
1119
  .addCase(updateLeadSuccess.pending, function (state) {
1118
1120
  state.loading = true;
@@ -425,7 +425,7 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
425
425
  });
426
426
  }); });
427
427
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
428
- var _a, settings, connect, responseBody, isNewBrand, brandName, salesChannels, selectedBrandItem, channel_services, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
428
+ var _a, settings, connect, responseBody, isNewBrand, brandName, salesChannels, selectedBrandItem, isTwitterChannel, isWebsiteChannel, getAddress, channel_services, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
429
429
  var _b, _c, _d, _e, _f;
430
430
  return __generator(this, function (_g) {
431
431
  switch (_g.label) {
@@ -433,12 +433,27 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
433
433
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
434
434
  responseBody = connect.data.otpData.responseBody;
435
435
  isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem;
436
+ isTwitterChannel = function (value) { return value === 'twitter'; };
437
+ isWebsiteChannel = function (value) { return value === 'website'; };
438
+ getAddress = function (value, isTwitter, isWeb) {
439
+ if (isTwitter)
440
+ return '@' + value;
441
+ if (isWeb)
442
+ return 'https://' + value;
443
+ return value;
444
+ };
436
445
  channel_services = salesChannels.map(function (channel) {
437
446
  var _a;
447
+ var isTwitter = isTwitterChannel(channel.code);
448
+ var isWebsite = isWebsiteChannel(channel.code);
438
449
  return {
439
450
  id: channel.id,
440
- address: channel.address,
441
- sub: (_a = channel.sub) === null || _a === void 0 ? void 0 : _a.map(function (sub) { return ({ id: sub.id, address: sub.address }); })
451
+ address: getAddress(channel.address || '', isTwitter, isWebsite),
452
+ sub: (_a = channel.sub) === null || _a === void 0 ? void 0 : _a.map(function (sub) {
453
+ var isSubTwitter = isTwitterChannel(sub.code);
454
+ var isSubWebsite = isWebsiteChannel(sub.code);
455
+ return { id: sub.id, address: getAddress(sub.address || '', isSubTwitter, isSubWebsite) };
456
+ })
442
457
  };
443
458
  });
444
459
  if (!!isNewBrand) return [3, 2];
@@ -12,6 +12,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
12
12
  contact: any;
13
13
  countries: CountryCode[];
14
14
  countryCode: any;
15
+ notification: any;
15
16
  flows: {
16
17
  name: string;
17
18
  status: string;
@@ -33,6 +34,22 @@ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk
33
34
  }, string, {}>;
34
35
  export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
35
36
  data: any;
37
+ boardResponse: {
38
+ user: any;
39
+ brand: any;
40
+ bank_account: any;
41
+ entity: any;
42
+ merchant: any;
43
+ name: any;
44
+ contact: any;
45
+ countries: CountryCode[];
46
+ notification: any;
47
+ flows: {
48
+ name: string;
49
+ status: string;
50
+ url: string;
51
+ }[];
52
+ };
36
53
  formData: {
37
54
  otp: string;
38
55
  };
@@ -49,13 +49,13 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
52
+ import { handleNextScreenStep } from '../../../app/settings';
53
53
  import { BUSINESS_FLOW_SUCCESS, INDIVIDUAl_STEP_NAMES } from '../../../constants';
54
54
  export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
- var payload, settings, data, boardData, countryCode, boardInfoData, countries, board_id, board_info_id, entity, info, hasIndividualCompleted;
56
- var _a, _b, _c;
57
- return __generator(this, function (_d) {
58
- switch (_d.label) {
55
+ var payload, settings, data, boardData, individualData, countryCode, boardInfoData, countries, board_id, board_info_id, notification, _a, id, type, info, hasIndividualCompleted;
56
+ var _b, _c, _d, _e;
57
+ return __generator(this, function (_f) {
58
+ switch (_f.label) {
59
59
  case 0:
60
60
  payload = {
61
61
  service_name: 'tap_email',
@@ -64,49 +64,59 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
64
64
  settings = thunkApi.getState().settings;
65
65
  return [4, API.leadService.verifyLeadToken(payload)];
66
66
  case 1:
67
- data = (_d.sent()).data;
67
+ data = (_f.sent()).data;
68
68
  boardInfoData = undefined;
69
69
  countries = settings.data.countries;
70
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 6];
70
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 10];
71
+ if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 10];
71
72
  board_id = data === null || data === void 0 ? void 0 : data.id;
72
73
  board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
73
- if (!(!!board_id && !!board_info_id)) return [3, 3];
74
+ if (!(board_id && board_info_id)) return [3, 4];
74
75
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
75
76
  case 2:
76
- boardInfoData = _d.sent();
77
- _d.label = 3;
78
- case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
77
+ boardInfoData = _f.sent();
78
+ notification = (boardInfoData || {}).notification;
79
+ _a = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _a.id, type = _a.type;
80
+ if (!(id && type)) return [3, 4];
81
+ return [4, API.individualService.retrieveIndividual(id, type)];
82
+ case 3:
83
+ individualData = _f.sent();
84
+ _f.label = 4;
79
85
  case 4:
80
- boardData = _d.sent();
81
- entity = ((boardData === null || boardData === void 0 ? void 0 : boardData.business) || {}).entity;
82
- countryCode = entity === null || entity === void 0 ? void 0 : entity.country;
86
+ countryCode = (_b = individualData === null || individualData === void 0 ? void 0 : individualData.user) === null || _b === void 0 ? void 0 : _b.nationality;
83
87
  info = boardInfoData.info;
84
- hasIndividualCompleted = ((_a = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _a === void 0 ? void 0 : _a.status) === 'completed';
85
- return [4, thunkApi.dispatch(retrieveDataList(entity === null || entity === void 0 ? void 0 : entity.country))];
88
+ hasIndividualCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
89
+ if (!hasIndividualCompleted) return [3, 7];
90
+ if (!board_id) return [3, 6];
91
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
86
92
  case 5:
87
- _d.sent();
88
- if (data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_AUTH) {
89
- thunkApi.dispatch(handleCurrentActiveScreen('INDIVIDUAL_VERIFY_STEP'));
90
- }
91
- else if (hasIndividualCompleted) {
92
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
93
- }
94
- else if (data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO) {
95
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
96
- }
97
- _d.label = 6;
98
- case 6: return [2, {
93
+ boardData = _f.sent();
94
+ _f.label = 6;
95
+ case 6:
96
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
97
+ return [3, 10];
98
+ case 7:
99
+ if (!countryCode) return [3, 9];
100
+ return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
101
+ case 8:
102
+ _f.sent();
103
+ _f.label = 9;
104
+ case 9:
105
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
106
+ _f.label = 10;
107
+ case 10: return [2, {
99
108
  data: data,
100
109
  boardResponse: {
101
- user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
110
+ user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
102
111
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
103
112
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
104
113
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
105
114
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
106
- name: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _b === void 0 ? void 0 : _b.name,
107
- contact: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.contact,
115
+ name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
116
+ contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
108
117
  countries: countries,
109
118
  countryCode: countryCode,
119
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
110
120
  flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
111
121
  },
112
122
  token: token
@@ -167,69 +177,113 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
167
177
  case 1:
168
178
  data = _c.sent();
169
179
  return [2, {
170
- data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.name, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
180
+ data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
171
181
  }];
172
182
  }
173
183
  });
174
184
  }); });
175
185
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
176
- var _a, individual, settings, responseBody, payload, data, flows, hasIndividualCompleted;
177
- var _b, _c, _d, _e;
178
- return __generator(this, function (_f) {
179
- switch (_f.label) {
186
+ var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, notification, _c, id, type, info, hasIndividualCompleted;
187
+ var _d, _e, _f, _g, _h, _j, _k;
188
+ return __generator(this, function (_l) {
189
+ switch (_l.label) {
180
190
  case 0:
181
191
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
182
192
  responseBody = individual.data.verify.responseBody;
193
+ _b = responseBody || {}, board_id = _b.board_id, board_info_id = _b.board_info_id;
194
+ countries = settings.data.countries;
183
195
  payload = {
184
196
  data: params.otp,
185
- service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
197
+ service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
186
198
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
187
199
  step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
188
200
  encryption_contract: ['data']
189
201
  };
190
202
  return [4, API.leadService.verifyLeadOTP(payload)];
191
203
  case 1:
192
- data = (_f.sent()).data;
193
- if (!(data === null || data === void 0 ? void 0 : data.errors)) {
194
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
195
- flows = (responseBody || {}).flows;
196
- hasIndividualCompleted = ((_e = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'individual'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
197
- if (hasIndividualCompleted) {
198
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
199
- }
200
- else {
201
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
202
- }
203
- }
204
- return [2, { data: data, formData: __assign({}, params) }];
204
+ data = (_l.sent()).data;
205
+ countryCode = undefined;
206
+ if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 10];
207
+ if (!(board_id && board_info_id)) return [3, 4];
208
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
209
+ case 2:
210
+ boardInfoData = _l.sent();
211
+ notification = (boardInfoData || {}).notification;
212
+ _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
213
+ if (!(id && type)) return [3, 4];
214
+ return [4, API.individualService.retrieveIndividual(id, type)];
215
+ case 3:
216
+ individualData = _l.sent();
217
+ _l.label = 4;
218
+ case 4:
219
+ countryCode = (_e = individualData === null || individualData === void 0 ? void 0 : individualData.user) === null || _e === void 0 ? void 0 : _e.nationality;
220
+ info = boardInfoData.info;
221
+ hasIndividualCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
222
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
223
+ if (!hasIndividualCompleted) return [3, 7];
224
+ if (!board_id) return [3, 6];
225
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
226
+ case 5:
227
+ boardData = _l.sent();
228
+ _l.label = 6;
229
+ case 6:
230
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
231
+ return [3, 10];
232
+ case 7:
233
+ if (!countryCode) return [3, 9];
234
+ return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
235
+ case 8:
236
+ _l.sent();
237
+ _l.label = 9;
238
+ case 9:
239
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
240
+ _l.label = 10;
241
+ case 10: return [2, {
242
+ data: data,
243
+ boardResponse: {
244
+ user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
245
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
246
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
247
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
248
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
249
+ name: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.names,
250
+ contact: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.contact,
251
+ countries: countries,
252
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
253
+ flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
254
+ },
255
+ formData: __assign({}, params)
256
+ }];
205
257
  }
206
258
  });
207
259
  }); });
208
260
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
209
- var _a, settings, individual, requestBody, data;
210
- var _b, _c, _d, _e, _f, _g, _h, _j;
211
- return __generator(this, function (_k) {
212
- switch (_k.label) {
261
+ var _a, settings, individual, _b, id, type, requestBody, data;
262
+ var _c, _d, _e, _f, _g, _h, _j, _k;
263
+ return __generator(this, function (_l) {
264
+ switch (_l.label) {
213
265
  case 0:
214
266
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
267
+ _b = ((_d = (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id = _b.id, type = _b.type;
215
268
  requestBody = {
216
- id: (_c = (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.user) === null || _c === void 0 ? void 0 : _c.id,
217
- occupation: { id: (_d = params.occupation) === null || _d === void 0 ? void 0 : _d.id },
269
+ id: id,
270
+ type: type,
271
+ occupation: { id: (_e = params.occupation) === null || _e === void 0 ? void 0 : _e.id },
218
272
  employer_name: params.employerName,
219
- employer_country: (_e = params.employerLocation) === null || _e === void 0 ? void 0 : _e.iso2,
220
- source_income: [{ id: (_f = params.sourceIncome) === null || _f === void 0 ? void 0 : _f.id }],
221
- monthly_income: { id: (_g = params.monthlyIncome) === null || _g === void 0 ? void 0 : _g.id },
273
+ employer_country: (_f = params.employerLocation) === null || _f === void 0 ? void 0 : _f.iso2,
274
+ source_income: [{ id: (_g = params.sourceIncome) === null || _g === void 0 ? void 0 : _g.id }],
275
+ monthly_income: { id: (_h = params.monthlyIncome) === null || _h === void 0 ? void 0 : _h.id },
222
276
  is_relative_PEP: params.isPEP,
223
277
  is_influencer: params.isInfluencer,
224
278
  encryption_contract: ['employer_name', 'employer_country'],
225
279
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
226
280
  };
227
- return [4, API.entityService.updateIndividualInfo(requestBody)];
281
+ return [4, API.individualService.updateIndividual(requestBody)];
228
282
  case 1:
229
- data = (_k.sent()).data;
283
+ data = (_l.sent()).data;
230
284
  if (!(data === null || data === void 0 ? void 0 : data.errors)) {
231
285
  thunkApi.dispatch(handleNextScreenStep());
232
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
286
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
233
287
  }
234
288
  return [2, { data: data, formData: params }];
235
289
  }
@@ -315,9 +369,9 @@ export var individualSlice = createSlice({
315
369
  state.error = description;
316
370
  return;
317
371
  }
318
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
372
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
319
373
  state.data.verify.token = token;
320
- var _c = boardResponse || {}, countries = _c.countries, countryCode = _c.countryCode, user = _c.user;
374
+ var _c = boardResponse || {}, countries = _c.countries, user = _c.user;
321
375
  var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
322
376
  var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
323
377
  var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) ||
@@ -328,7 +382,7 @@ export var individualSlice = createSlice({
328
382
  (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
329
383
  if (!!selectedMonthlyIncome)
330
384
  state.data.individualData.monthlyIncome = selectedMonthlyIncome;
331
- var code = (data === null || data === void 0 ? void 0 : data.employer_country) || countryCode;
385
+ var code = user === null || user === void 0 ? void 0 : user.employer_country;
332
386
  if (!!code) {
333
387
  var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
334
388
  state.data.individualData.employerLocation = employerLocation;
@@ -368,7 +422,7 @@ export var individualSlice = createSlice({
368
422
  var _a;
369
423
  state.loading = false;
370
424
  state.error = null;
371
- var _b = action.payload, data = _b.data, formData = _b.formData;
425
+ var _b = action.payload, data = _b.data, formData = _b.formData, boardResponse = _b.boardResponse;
372
426
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
373
427
  if (description) {
374
428
  state.error = description;
@@ -376,7 +430,28 @@ export var individualSlice = createSlice({
376
430
  }
377
431
  state.data.otpData = formData;
378
432
  state.data.otpData.responseBody = data;
379
- state.data.individualData = __assign({}, state.data.individualData);
433
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
434
+ var _c = boardResponse || {}, countries = _c.countries, user = _c.user;
435
+ var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
436
+ var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
437
+ var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) ||
438
+ (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
439
+ if (!!selectedSourceIncome)
440
+ state.data.individualData.sourceIncome = selectedSourceIncome;
441
+ var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { return (income === null || income === void 0 ? void 0 : income.id) === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id); })) ||
442
+ (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
443
+ if (!!selectedMonthlyIncome)
444
+ state.data.individualData.monthlyIncome = selectedMonthlyIncome;
445
+ var code = user === null || user === void 0 ? void 0 : user.employer_country;
446
+ if (!!code) {
447
+ var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
448
+ state.data.individualData.employerLocation = employerLocation;
449
+ }
450
+ var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { return (o === null || o === void 0 ? void 0 : o.id) === (occupation === null || occupation === void 0 ? void 0 : occupation.id); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
451
+ if (!!selectedOccupation)
452
+ state.data.individualData.occupation = selectedOccupation;
453
+ state.data.individualData.isPEP = is_relative_PEP;
454
+ state.data.individualData.isInfluencer = is_influencer;
380
455
  })
381
456
  .addCase(verifyLeadOTP.rejected, function (state, action) {
382
457
  state.loading = false;
@@ -426,8 +501,8 @@ export var individualSlice = createSlice({
426
501
  state.error = null;
427
502
  state.loading = false;
428
503
  var data = (action.payload || {}).data;
429
- var _a = data || {}, entity = _a.entity, user = _a.user;
430
- state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), data), { entity: entity, name: user === null || user === void 0 ? void 0 : user.name });
504
+ var entity = (data || {}).entity;
505
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), data), { entity: entity });
431
506
  })
432
507
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
433
508
  state.error = action.error.message;