@tap-payments/auth-jsconnect 2.1.75-test → 2.1.76-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.
- package/build/@types/app.d.ts +24 -0
- package/build/@types/app.js +13 -0
- package/build/@types/form.d.ts +15 -1
- package/build/@types/index.d.ts +1 -0
- package/build/@types/index.js +1 -0
- package/build/@types/user.d.ts +141 -0
- package/build/@types/user.js +1 -0
- package/build/api/board.d.ts +16 -0
- package/build/api/board.js +10 -1
- package/build/api/country.d.ts +4 -0
- package/build/api/country.js +9 -1
- package/build/api/index.d.ts +8 -3
- package/build/api/individual.d.ts +43 -1
- package/build/api/individual.js +9 -1
- package/build/api/user.d.ts +6 -0
- package/build/api/user.js +9 -1
- package/build/assets/locales/ar.json +22 -2
- package/build/assets/locales/en.json +22 -1
- package/build/components/SimpleList/SimpleList.d.ts +2 -0
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +3 -1
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +20 -7
- package/build/constants/assets.d.ts +4 -0
- package/build/constants/assets.js +4 -0
- package/build/features/app/bank/bankStore.d.ts +1 -0
- package/build/features/app/bank/bankStore.js +2 -1
- package/build/features/app/brand/brandStore.d.ts +2 -0
- package/build/features/app/brand/brandStore.js +3 -1
- package/build/features/app/business/businessStore.js +1 -1
- package/build/features/app/entity/entityStore.d.ts +2 -0
- package/build/features/app/entity/entityStore.js +3 -1
- package/build/features/app/individual/individualStore.d.ts +28 -3
- package/build/features/app/individual/individualStore.js +461 -118
- package/build/features/app/password/passwordStore.js +2 -2
- package/build/features/app/tax/taxStore.js +30 -29
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +3 -3
- package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +2 -2
- package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +3 -3
- package/build/features/business/screens/BusinessType/LicenseType.d.ts +2 -2
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +2 -2
- package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +3 -3
- package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +3 -3
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/featuresScreens.js +10 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +13 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +43 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +3 -13
- package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +9 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +11 -17
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +12 -16
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +9 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +6 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +35 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +6 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +41 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +9 -6
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +20 -17
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +18 -25
- package/build/features/individual/screens/IndividualList/IndividualList.d.ts +31 -0
- package/build/features/individual/screens/IndividualList/IndividualList.js +59 -0
- package/build/features/individual/screens/IndividualList/UserList.d.ts +5 -0
- package/build/features/individual/screens/IndividualList/UserList.js +138 -0
- package/build/features/individual/screens/IndividualList/index.d.ts +3 -0
- package/build/features/individual/screens/IndividualList/index.js +2 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +8 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +90 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.d.ts +10 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +82 -0
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +7 -0
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +46 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +6 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Email.js +50 -0
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +7 -0
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +49 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +34 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +81 -0
- package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +6 -0
- package/build/features/individual/screens/IndividualPersonalInfo/ID.js +48 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +21 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +126 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +10 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +88 -0
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +10 -0
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +145 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +6 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Name.js +52 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +10 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +88 -0
- package/build/features/individual/screens/IndividualPersonalInfo/index.d.ts +3 -0
- package/build/features/individual/screens/IndividualPersonalInfo/index.js +2 -0
- package/build/features/individual/screens/IndividualPersonalInfo/validation.d.ts +38 -0
- package/build/features/individual/screens/IndividualPersonalInfo/validation.js +68 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/shared/Address/Address.d.ts +6 -1
- package/build/features/shared/Address/Address.js +40 -30
- package/build/features/shared/Address/CountryList.d.ts +1 -1
- package/build/features/shared/Address/InputSelect.d.ts +1 -1
- package/build/features/shared/Address/InputText.d.ts +2 -1
- package/build/features/shared/Address/InputText.js +2 -2
- package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
- package/build/features/shared/Button/FlowsButtons.js +2 -2
- package/build/features/shared/Button/ListButton.d.ts +17 -0
- package/build/features/shared/Button/ListButton.js +107 -0
- package/build/features/shared/Button/index.d.ts +2 -1
- package/build/features/shared/Button/index.js +2 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +2 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +6 -4
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -1
- package/build/features/tax/screens/TaxDetails/VATId.js +8 -3
- package/build/features/tax/screens/TaxDetails/validation.d.ts +4 -4
- package/build/features/tax/screens/TaxDetails/validation.js +10 -5
- package/build/utils/string.d.ts +3 -2
- package/build/utils/string.js +16 -3
- package/package.json +1 -1
- package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.d.ts +0 -19
- package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.js +0 -52
- package/build/features/individual/screens/ShowIndividualInfo/index.d.ts +0 -3
- package/build/features/individual/screens/ShowIndividualInfo/index.js +0 -2
- package/build/features/individual/screens/ShowIndividualInfo/info.d.ts +0 -7
- package/build/features/individual/screens/ShowIndividualInfo/info.js +0 -28
|
@@ -45,19 +45,40 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
+
var t = {};
|
|
50
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
+
t[p] = s[p];
|
|
52
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
+
t[p[i]] = s[p[i]];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
};
|
|
59
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
60
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
61
|
+
if (ar || !(i in from)) {
|
|
62
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
63
|
+
ar[i] = from[i];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
67
|
+
};
|
|
48
68
|
var _a;
|
|
49
69
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
70
|
import API from '../../../api';
|
|
51
|
-
import { FlowsTypes } from '../../../@types';
|
|
71
|
+
import { FlowsTypes, IndividualGender, IndividualType, FieldType } from '../../../@types';
|
|
52
72
|
import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
|
-
import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
73
|
+
import { IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
74
|
+
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, getEighteenYearsAgo, getIndividualName, getUserName, sleep } from '../../../utils';
|
|
54
75
|
export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (_a, thunkApi) {
|
|
55
76
|
var token = _a.token, isInternally = _a.isInternally;
|
|
56
77
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
-
var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, info, hasIndividualCompleted;
|
|
58
|
-
var _c, _d, _e, _f;
|
|
59
|
-
return __generator(this, function (
|
|
60
|
-
switch (
|
|
78
|
+
var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, payload_1, info, hasIndividualCompleted;
|
|
79
|
+
var _c, _d, _e, _f, _g, _h, _j;
|
|
80
|
+
return __generator(this, function (_k) {
|
|
81
|
+
switch (_k.label) {
|
|
61
82
|
case 0:
|
|
62
83
|
payload = {
|
|
63
84
|
service_name: 'tap_email',
|
|
@@ -66,70 +87,82 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
66
87
|
settings = thunkApi.getState().settings;
|
|
67
88
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
68
89
|
case 1:
|
|
69
|
-
data = (
|
|
90
|
+
data = (_k.sent()).data;
|
|
70
91
|
boardInfoStatus = undefined;
|
|
71
92
|
countries = settings.data.countries;
|
|
72
|
-
if (
|
|
93
|
+
if (((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
94
|
+
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
73
95
|
if (isInternally)
|
|
74
96
|
data.step_name = INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO;
|
|
75
97
|
if (data === null || data === void 0 ? void 0 : data.country_code) {
|
|
76
98
|
countryCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
77
99
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
78
100
|
}
|
|
79
|
-
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3,
|
|
101
|
+
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 14];
|
|
80
102
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
81
103
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
82
104
|
if (!(board_id && board_info_id)) return [3, 4];
|
|
83
105
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
84
106
|
case 2:
|
|
85
|
-
boardInfoData =
|
|
107
|
+
boardInfoData = _k.sent();
|
|
86
108
|
notification = (boardInfoData || {}).notification;
|
|
87
109
|
_b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
|
|
88
110
|
if (!(id && type)) return [3, 4];
|
|
89
|
-
return [4,
|
|
111
|
+
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
|
|
90
112
|
case 3:
|
|
91
|
-
|
|
92
|
-
|
|
113
|
+
payload_1 = (_k.sent()).payload;
|
|
114
|
+
individualData = payload_1.data || {};
|
|
115
|
+
_k.label = 4;
|
|
93
116
|
case 4:
|
|
94
117
|
if (!board_id) return [3, 7];
|
|
95
118
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
96
119
|
case 5:
|
|
97
|
-
boardData =
|
|
120
|
+
boardData = _k.sent();
|
|
98
121
|
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
99
122
|
case 6:
|
|
100
|
-
boardInfoStatus =
|
|
101
|
-
|
|
123
|
+
boardInfoStatus = _k.sent();
|
|
124
|
+
_k.label = 7;
|
|
102
125
|
case 7:
|
|
103
126
|
if (!countryCode) {
|
|
104
|
-
countryCode = (
|
|
127
|
+
countryCode = (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.country;
|
|
105
128
|
if (countryCode)
|
|
106
129
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
107
130
|
}
|
|
108
131
|
info = (boardInfoStatus || {}).info;
|
|
109
|
-
hasIndividualCompleted = ((
|
|
132
|
+
hasIndividualCompleted = ((_e = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
|
|
110
133
|
if (!hasIndividualCompleted) return [3, 8];
|
|
111
134
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
112
|
-
return [3,
|
|
135
|
+
return [3, 14];
|
|
113
136
|
case 8:
|
|
114
|
-
if (!
|
|
115
|
-
return [
|
|
137
|
+
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
|
|
138
|
+
if (!((_f = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _f === void 0 ? void 0 : _f.id)) return [3, 10];
|
|
139
|
+
return [4, thunkApi.dispatch(getIndividualList((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id))];
|
|
116
140
|
case 9:
|
|
117
|
-
|
|
118
|
-
|
|
141
|
+
_k.sent();
|
|
142
|
+
_k.label = 10;
|
|
119
143
|
case 10:
|
|
120
|
-
thunkApi.dispatch(handleNextScreenStep('
|
|
121
|
-
|
|
122
|
-
case 11:
|
|
144
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
145
|
+
return [3, 14];
|
|
146
|
+
case 11:
|
|
147
|
+
if (!countryCode) return [3, 13];
|
|
148
|
+
return [4, thunkApi.dispatch(getCityList(countryCode))];
|
|
149
|
+
case 12:
|
|
150
|
+
_k.sent();
|
|
151
|
+
_k.label = 13;
|
|
152
|
+
case 13:
|
|
153
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
154
|
+
_k.label = 14;
|
|
155
|
+
case 14: return [2, {
|
|
123
156
|
data: data,
|
|
124
157
|
boardResponse: {
|
|
125
|
-
user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
|
|
126
158
|
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
127
159
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
128
160
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
129
161
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
130
162
|
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
131
|
-
name: (
|
|
132
|
-
contact: (
|
|
163
|
+
name: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.names,
|
|
164
|
+
contact: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.contact,
|
|
165
|
+
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
133
166
|
countries: countries,
|
|
134
167
|
countryCode: countryCode,
|
|
135
168
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
@@ -158,6 +191,109 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
|
|
|
158
191
|
}
|
|
159
192
|
});
|
|
160
193
|
}); });
|
|
194
|
+
export var addDetailsAsync = createAsyncThunk('individual/addDetailsAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
195
|
+
var settings, user, userList, id, type, countryCode;
|
|
196
|
+
return __generator(this, function (_a) {
|
|
197
|
+
switch (_a.label) {
|
|
198
|
+
case 0:
|
|
199
|
+
settings = thunkApi.getState().settings;
|
|
200
|
+
user = params.user, userList = params.userList;
|
|
201
|
+
id = user.id, type = user.type;
|
|
202
|
+
countryCode = settings.data.businessCountry.iso2;
|
|
203
|
+
if (!countryCode) return [3, 2];
|
|
204
|
+
return [4, thunkApi.dispatch(getCityList(countryCode))];
|
|
205
|
+
case 1:
|
|
206
|
+
_a.sent();
|
|
207
|
+
_a.label = 2;
|
|
208
|
+
case 2: return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type }))];
|
|
209
|
+
case 3:
|
|
210
|
+
_a.sent();
|
|
211
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
|
|
212
|
+
return [2, { userList: userList }];
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}); });
|
|
216
|
+
export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsByEmail', function (user, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
217
|
+
var individual, _a, merchant_id, board_id, id, type, payload, data;
|
|
218
|
+
return __generator(this, function (_b) {
|
|
219
|
+
switch (_b.label) {
|
|
220
|
+
case 0:
|
|
221
|
+
individual = thunkApi.getState().individual;
|
|
222
|
+
_a = individual.data.verify.responseBody || {}, merchant_id = _a.merchant_id, board_id = _a.board_id;
|
|
223
|
+
id = user.id, type = user.type;
|
|
224
|
+
payload = {
|
|
225
|
+
id: board_id,
|
|
226
|
+
merchant_id: merchant_id,
|
|
227
|
+
info: [
|
|
228
|
+
{
|
|
229
|
+
name: 'individual'
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
notification: {
|
|
233
|
+
recipient: {
|
|
234
|
+
id: id,
|
|
235
|
+
type: type
|
|
236
|
+
},
|
|
237
|
+
channel: ['email']
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
return [4, API.boardService.requestDetailsByEmail(payload)];
|
|
241
|
+
case 1:
|
|
242
|
+
data = _b.sent();
|
|
243
|
+
return [2, data];
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}); });
|
|
247
|
+
export var getIndividualList = createAsyncThunk('individual/getIndividualList', function (businessId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
248
|
+
var payload, _a, users, shareholders, board_members, userList, shareHolderList, boardMemberList, individualList;
|
|
249
|
+
return __generator(this, function (_b) {
|
|
250
|
+
switch (_b.label) {
|
|
251
|
+
case 0:
|
|
252
|
+
payload = {
|
|
253
|
+
page: 1,
|
|
254
|
+
limit: 10,
|
|
255
|
+
business_id: businessId
|
|
256
|
+
};
|
|
257
|
+
return [4, API.individualService.getIndividualList(payload)];
|
|
258
|
+
case 1:
|
|
259
|
+
_a = _b.sent(), users = _a.users, shareholders = _a.shareholders, board_members = _a.board_members;
|
|
260
|
+
userList = (users || []).map(function (user) { return (__assign(__assign({}, user), { type: IndividualType.USER })); });
|
|
261
|
+
shareHolderList = (shareholders || []).map(function (shareholder) { return (__assign(__assign({}, shareholder), { type: IndividualType.SHARE_HOLDER })); });
|
|
262
|
+
boardMemberList = (board_members || []).map(function (board_member) { return (__assign(__assign({}, board_member), { type: IndividualType.BOARD_MEMBER })); });
|
|
263
|
+
individualList = __spreadArray(__spreadArray(__spreadArray([], userList, true), shareHolderList, true), boardMemberList, true);
|
|
264
|
+
return [2, individualList];
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}); });
|
|
268
|
+
export var getCityList = createAsyncThunk('individual/getCityList', function (countryCode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
+
var cityBody, list;
|
|
270
|
+
return __generator(this, function (_a) {
|
|
271
|
+
switch (_a.label) {
|
|
272
|
+
case 0:
|
|
273
|
+
cityBody = {
|
|
274
|
+
country: [countryCode]
|
|
275
|
+
};
|
|
276
|
+
return [4, API.countryService.getCities(cityBody)];
|
|
277
|
+
case 1:
|
|
278
|
+
list = (_a.sent()).list;
|
|
279
|
+
return [2, list || []];
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}); });
|
|
283
|
+
export var retrieveIndividualInfo = createAsyncThunk('individual/retrieveIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
284
|
+
var id, type, countryCode, settings, data;
|
|
285
|
+
return __generator(this, function (_a) {
|
|
286
|
+
switch (_a.label) {
|
|
287
|
+
case 0:
|
|
288
|
+
id = params.id, type = params.type, countryCode = params.countryCode;
|
|
289
|
+
settings = thunkApi.getState().settings;
|
|
290
|
+
return [4, API.individualService.retrieveIndividual(id, type)];
|
|
291
|
+
case 1:
|
|
292
|
+
data = _a.sent();
|
|
293
|
+
return [2, { data: __assign(__assign({}, ((data === null || data === void 0 ? void 0 : data.user) || {})), { type: type }), countryCode: countryCode, countries: settings.data.countries }];
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}); });
|
|
161
297
|
export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
162
298
|
var monthlyIncomeBody, dataBody, _a, sourceIncome, monthlyIncome, occupation;
|
|
163
299
|
return __generator(this, function (_b) {
|
|
@@ -186,24 +322,24 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
|
|
|
186
322
|
});
|
|
187
323
|
}); });
|
|
188
324
|
export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
189
|
-
var data;
|
|
190
|
-
var
|
|
191
|
-
return __generator(this, function (
|
|
192
|
-
switch (
|
|
325
|
+
var _a, user, data;
|
|
326
|
+
var _b, _c;
|
|
327
|
+
return __generator(this, function (_d) {
|
|
328
|
+
switch (_d.label) {
|
|
193
329
|
case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
194
330
|
case 1:
|
|
195
|
-
|
|
331
|
+
_a = _d.sent(), user = _a.user, data = __rest(_a, ["user"]);
|
|
196
332
|
return [2, {
|
|
197
|
-
data: __assign(__assign({}, data), {
|
|
333
|
+
data: __assign(__assign({}, data), { 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: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.names, individuals: data === null || data === void 0 ? void 0 : data.individuals, contact: (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.contact })
|
|
198
334
|
}];
|
|
199
335
|
}
|
|
200
336
|
});
|
|
201
337
|
}); });
|
|
202
338
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
203
|
-
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, boardInfoStatus, notification, _c, id, type, info, hasIndividualCompleted;
|
|
204
|
-
var _d, _e, _f, _g, _h, _j, _k;
|
|
205
|
-
return __generator(this, function (
|
|
206
|
-
switch (
|
|
339
|
+
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, boardInfoStatus, notification, _c, id, type, payload_2, info, hasIndividualCompleted;
|
|
340
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
341
|
+
return __generator(this, function (_o) {
|
|
342
|
+
switch (_o.label) {
|
|
207
343
|
case 0:
|
|
208
344
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
209
345
|
responseBody = individual.data.verify.responseBody;
|
|
@@ -218,57 +354,68 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
218
354
|
};
|
|
219
355
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
220
356
|
case 1:
|
|
221
|
-
data = (
|
|
357
|
+
data = (_o.sent()).data;
|
|
222
358
|
boardInfoStatus = undefined;
|
|
223
|
-
if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3,
|
|
224
|
-
if (!
|
|
225
|
-
return [4, API.boardService.
|
|
359
|
+
if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 14];
|
|
360
|
+
if (!board_id) return [3, 4];
|
|
361
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
226
362
|
case 2:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
_c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
230
|
-
if (!(id && type)) return [3, 4];
|
|
231
|
-
return [4, API.individualService.retrieveIndividual(id, type)];
|
|
363
|
+
boardInfoStatus = _o.sent();
|
|
364
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
232
365
|
case 3:
|
|
233
|
-
|
|
234
|
-
|
|
366
|
+
boardData = _o.sent();
|
|
367
|
+
_o.label = 4;
|
|
235
368
|
case 4:
|
|
236
|
-
|
|
237
|
-
return [
|
|
369
|
+
countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
|
|
370
|
+
if (!(board_id && board_info_id)) return [3, 7];
|
|
371
|
+
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
238
372
|
case 5:
|
|
239
|
-
|
|
240
|
-
|
|
373
|
+
boardInfoData = _o.sent();
|
|
374
|
+
notification = (boardInfoData || {}).notification;
|
|
375
|
+
_c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
376
|
+
if (!(id && type)) return [3, 7];
|
|
377
|
+
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
|
|
241
378
|
case 6:
|
|
242
|
-
|
|
243
|
-
|
|
379
|
+
payload_2 = (_o.sent()).payload;
|
|
380
|
+
individualData = payload_2.data || {};
|
|
381
|
+
_o.label = 7;
|
|
244
382
|
case 7:
|
|
245
|
-
countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
|
|
246
383
|
info = (boardInfoStatus || {}).info;
|
|
247
384
|
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';
|
|
248
385
|
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
249
386
|
if (!hasIndividualCompleted) return [3, 8];
|
|
250
387
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
251
|
-
return [3,
|
|
388
|
+
return [3, 14];
|
|
252
389
|
case 8:
|
|
253
|
-
if (!
|
|
254
|
-
return [
|
|
390
|
+
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
|
|
391
|
+
if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 10];
|
|
392
|
+
return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id))];
|
|
255
393
|
case 9:
|
|
256
|
-
|
|
257
|
-
|
|
394
|
+
_o.sent();
|
|
395
|
+
_o.label = 10;
|
|
258
396
|
case 10:
|
|
259
|
-
thunkApi.dispatch(handleNextScreenStep('
|
|
260
|
-
|
|
261
|
-
case 11:
|
|
397
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
398
|
+
return [3, 14];
|
|
399
|
+
case 11:
|
|
400
|
+
if (!countryCode) return [3, 13];
|
|
401
|
+
return [4, thunkApi.dispatch(getCityList(countryCode))];
|
|
402
|
+
case 12:
|
|
403
|
+
_o.sent();
|
|
404
|
+
_o.label = 13;
|
|
405
|
+
case 13:
|
|
406
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
407
|
+
_o.label = 14;
|
|
408
|
+
case 14: return [2, {
|
|
262
409
|
data: data,
|
|
263
410
|
boardResponse: {
|
|
264
|
-
user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
|
|
265
411
|
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
266
412
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
267
413
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
268
414
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
269
415
|
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
270
|
-
name: (
|
|
271
|
-
contact: (
|
|
416
|
+
name: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.names,
|
|
417
|
+
contact: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.contact,
|
|
418
|
+
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
272
419
|
countries: countries,
|
|
273
420
|
countryCode: countryCode,
|
|
274
421
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
@@ -279,14 +426,85 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
279
426
|
}
|
|
280
427
|
});
|
|
281
428
|
}); });
|
|
429
|
+
export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
430
|
+
var _a, settings, individual, _b, notification, user, entity, _c, id, type, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isNameEditable, isEmailEditable, isMobileNumberEditable, isMobileCountryEditable, isNidEditable, isIssuedCountryEditable, isExpiryEditable, isIdTypeEditable, isNationalityEditable, requestBody, data;
|
|
431
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
432
|
+
return __generator(this, function (_s) {
|
|
433
|
+
switch (_s.label) {
|
|
434
|
+
case 0:
|
|
435
|
+
_a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
|
|
436
|
+
_b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user, entity = _b.entity;
|
|
437
|
+
_c = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
438
|
+
name = params.name, email = params.email, mobile = params.mobile, countryCode = params.countryCode, gender = params.gender, nid = params.nid, issuedCountry = params.issuedCountry, expiryDate = params.expiryDate, dob = params.dob, placeOfBirthCountry = params.placeOfBirthCountry, placeOfBirthCity = params.placeOfBirthCity, nationality = params.nationality;
|
|
439
|
+
code = entity === null || entity === void 0 ? void 0 : entity.country;
|
|
440
|
+
data_status = (user || {}).data_status;
|
|
441
|
+
userName = getIndividualName(name);
|
|
442
|
+
identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
443
|
+
isNameEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.name) === FieldType.EDITABLE;
|
|
444
|
+
isEmailEditable = ((_d = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _d === void 0 ? void 0 : _d.email) === FieldType.EDITABLE;
|
|
445
|
+
isMobileNumberEditable = ((_f = (_e = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _e === void 0 ? void 0 : _e.phone) === null || _f === void 0 ? void 0 : _f.number) === FieldType.EDITABLE;
|
|
446
|
+
isMobileCountryEditable = ((_h = (_g = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _g === void 0 ? void 0 : _g.phone) === null || _h === void 0 ? void 0 : _h.country_code) === FieldType.EDITABLE;
|
|
447
|
+
isNidEditable = ((_j = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _j === void 0 ? void 0 : _j.id) === FieldType.EDITABLE;
|
|
448
|
+
isIssuedCountryEditable = ((_k = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _k === void 0 ? void 0 : _k.issuer_country) === FieldType.EDITABLE;
|
|
449
|
+
isExpiryEditable = ((_l = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _l === void 0 ? void 0 : _l.expiry) === FieldType.EDITABLE;
|
|
450
|
+
isIdTypeEditable = ((_m = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _m === void 0 ? void 0 : _m.type) === FieldType.EDITABLE;
|
|
451
|
+
isNationalityEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.nationality) === FieldType.EDITABLE;
|
|
452
|
+
requestBody = {
|
|
453
|
+
id: id,
|
|
454
|
+
type: type,
|
|
455
|
+
names: isNameEditable
|
|
456
|
+
? {
|
|
457
|
+
en: userName,
|
|
458
|
+
ar: userName
|
|
459
|
+
}
|
|
460
|
+
: undefined,
|
|
461
|
+
gender: gender || '',
|
|
462
|
+
contact: {
|
|
463
|
+
email: isEmailEditable ? email : undefined,
|
|
464
|
+
phone: {
|
|
465
|
+
country_code: isMobileCountryEditable ? (_o = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _o === void 0 ? void 0 : _o.toString() : undefined,
|
|
466
|
+
number: isMobileNumberEditable ? mobile || '' : undefined
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
identification: {
|
|
470
|
+
id: isNidEditable ? nid : undefined,
|
|
471
|
+
issued_country_code: isIssuedCountryEditable ? issuedCountry === null || issuedCountry === void 0 ? void 0 : issuedCountry.iso2 : undefined,
|
|
472
|
+
type: isIdTypeEditable ? identification_id_type : undefined
|
|
473
|
+
},
|
|
474
|
+
date_of_birth: dob,
|
|
475
|
+
birth: {
|
|
476
|
+
city: (_p = placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.name) === null || _p === void 0 ? void 0 : _p.en,
|
|
477
|
+
country: placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2
|
|
478
|
+
},
|
|
479
|
+
nationality: isNationalityEditable ? nationality === null || nationality === void 0 ? void 0 : nationality.iso2 : undefined,
|
|
480
|
+
encryption_contract: [],
|
|
481
|
+
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO
|
|
482
|
+
};
|
|
483
|
+
return [4, API.individualService.updateIndividual(requestBody)];
|
|
484
|
+
case 1:
|
|
485
|
+
data = (_s.sent()).data;
|
|
486
|
+
return [4, thunkApi.dispatch(retrieveDataList(code))];
|
|
487
|
+
case 2:
|
|
488
|
+
_s.sent();
|
|
489
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
490
|
+
(_r = (_q = settings.data.appConfig).onStepCompleted) === null || _r === void 0 ? void 0 : _r.call(_q, settings.data.activeScreen.name, requestBody);
|
|
491
|
+
return [2, { data: data, formData: params }];
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
}); });
|
|
282
495
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
283
|
-
var _a, settings, individual, _b, id, type, civilID, signatureFileId, businessCountry, documentsList, requestBody, documentBody, data;
|
|
284
|
-
var
|
|
285
|
-
return __generator(this, function (
|
|
286
|
-
switch (
|
|
496
|
+
var _a, settings, individual, _b, notification, user, isOccupationEditable, isSourceIncomeEditable, isPEPEditable, isInfluencerEditable, _c, id, type, civilID, signatureFileId, businessCountry, documentsList, requestBody, documentBody, data;
|
|
497
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
498
|
+
return __generator(this, function (_p) {
|
|
499
|
+
switch (_p.label) {
|
|
287
500
|
case 0:
|
|
288
501
|
_a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
|
|
289
|
-
_b =
|
|
502
|
+
_b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user;
|
|
503
|
+
isOccupationEditable = ((_d = user === null || user === void 0 ? void 0 : user.data_status) === null || _d === void 0 ? void 0 : _d.occupation) === FieldType.EDITABLE;
|
|
504
|
+
isSourceIncomeEditable = ((_e = user === null || user === void 0 ? void 0 : user.data_status) === null || _e === void 0 ? void 0 : _e.source_of_income) === FieldType.EDITABLE;
|
|
505
|
+
isPEPEditable = ((_f = user === null || user === void 0 ? void 0 : user.data_status) === null || _f === void 0 ? void 0 : _f.is_relative_PEP) === FieldType.EDITABLE;
|
|
506
|
+
isInfluencerEditable = ((_g = user === null || user === void 0 ? void 0 : user.data_status) === null || _g === void 0 ? void 0 : _g.is_influencer) === FieldType.EDITABLE;
|
|
507
|
+
_c = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
290
508
|
civilID = params.civilID, signatureFileId = params.signatureFileId;
|
|
291
509
|
businessCountry = settings.data.businessCountry;
|
|
292
510
|
documentsList = [];
|
|
@@ -297,13 +515,13 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
297
515
|
requestBody = {
|
|
298
516
|
id: id,
|
|
299
517
|
type: type,
|
|
300
|
-
occupation: { id: (
|
|
518
|
+
occupation: isOccupationEditable ? { id: (_h = params.occupation) === null || _h === void 0 ? void 0 : _h.id } : undefined,
|
|
301
519
|
employer_name: params.employerName,
|
|
302
|
-
employer_country: (
|
|
303
|
-
source_income: [{ id: (
|
|
304
|
-
monthly_income: { id: (
|
|
305
|
-
is_relative_PEP: params.isPEP,
|
|
306
|
-
is_influencer: params.isInfluencer,
|
|
520
|
+
employer_country: (_j = params.employerLocation) === null || _j === void 0 ? void 0 : _j.iso2,
|
|
521
|
+
source_income: isSourceIncomeEditable ? [{ id: (_k = params.sourceIncome) === null || _k === void 0 ? void 0 : _k.id }] : undefined,
|
|
522
|
+
monthly_income: { id: (_l = params.monthlyIncome) === null || _l === void 0 ? void 0 : _l.id },
|
|
523
|
+
is_relative_PEP: isPEPEditable ? params.isPEP : undefined,
|
|
524
|
+
is_influencer: isInfluencerEditable ? params.isInfluencer : undefined,
|
|
307
525
|
encryption_contract: ['employer_name', 'employer_country'],
|
|
308
526
|
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
|
|
309
527
|
};
|
|
@@ -315,13 +533,13 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
315
533
|
if (!(documentsList.length > 0)) return [3, 2];
|
|
316
534
|
return [4, API.entityService.updateDocumentInfo(documentBody)];
|
|
317
535
|
case 1:
|
|
318
|
-
|
|
319
|
-
|
|
536
|
+
_p.sent();
|
|
537
|
+
_p.label = 2;
|
|
320
538
|
case 2: return [4, API.individualService.updateIndividual(requestBody)];
|
|
321
539
|
case 3:
|
|
322
|
-
data = (
|
|
540
|
+
data = (_p.sent()).data;
|
|
323
541
|
thunkApi.dispatch(handleNextScreenStep());
|
|
324
|
-
(
|
|
542
|
+
(_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, requestBody);
|
|
325
543
|
return [2, { data: data, formData: params }];
|
|
326
544
|
}
|
|
327
545
|
});
|
|
@@ -368,6 +586,20 @@ var initialState = {
|
|
|
368
586
|
otpData: {
|
|
369
587
|
otp: ''
|
|
370
588
|
},
|
|
589
|
+
individualPersonalData: {
|
|
590
|
+
name: '',
|
|
591
|
+
email: '',
|
|
592
|
+
mobile: '',
|
|
593
|
+
countryCode: undefined,
|
|
594
|
+
gender: IndividualGender.MALE,
|
|
595
|
+
nid: '',
|
|
596
|
+
issuedCountry: undefined,
|
|
597
|
+
expiryDate: '',
|
|
598
|
+
dob: getEighteenYearsAgo(),
|
|
599
|
+
placeOfBirthCountry: undefined,
|
|
600
|
+
placeOfBirthCity: undefined,
|
|
601
|
+
nationality: undefined
|
|
602
|
+
},
|
|
371
603
|
individualData: {
|
|
372
604
|
occupation: undefined,
|
|
373
605
|
sourceIncome: undefined,
|
|
@@ -406,38 +638,11 @@ export var individualSlice = createSlice({
|
|
|
406
638
|
state.customLoading = true;
|
|
407
639
|
})
|
|
408
640
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
409
|
-
var _a;
|
|
410
641
|
state.error = null;
|
|
411
642
|
state.customLoading = false;
|
|
412
|
-
var
|
|
413
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
414
|
-
if (description) {
|
|
415
|
-
state.error = description;
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
643
|
+
var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse;
|
|
418
644
|
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
|
|
419
645
|
state.data.verify.token = token;
|
|
420
|
-
var _c = boardResponse || {}, countries = _c.countries, user = _c.user, countryCode = _c.countryCode;
|
|
421
|
-
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;
|
|
422
|
-
var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
|
|
423
|
-
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
424
|
-
if (!!selectedSourceIncome)
|
|
425
|
-
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
426
|
-
var code = (user === null || user === void 0 ? void 0 : user.employer_country) || countryCode;
|
|
427
|
-
if (!!code) {
|
|
428
|
-
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
429
|
-
state.data.individualData.employerLocation = employerLocation;
|
|
430
|
-
}
|
|
431
|
-
var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
|
|
432
|
-
return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
|
|
433
|
-
});
|
|
434
|
-
var selectedOccupation = occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occup) {
|
|
435
|
-
return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
|
|
436
|
-
});
|
|
437
|
-
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
438
|
-
state.data.individualData.occupation = selectedOccupation;
|
|
439
|
-
state.data.individualData.isPEP = is_relative_PEP;
|
|
440
|
-
state.data.individualData.isInfluencer = is_influencer;
|
|
441
646
|
})
|
|
442
647
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
443
648
|
state.error = action.error.message;
|
|
@@ -477,13 +682,93 @@ export var individualSlice = createSlice({
|
|
|
477
682
|
state.data.otpData = formData;
|
|
478
683
|
state.data.otpData.responseBody = data;
|
|
479
684
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
685
|
+
})
|
|
686
|
+
.addCase(verifyLeadOTP.rejected, function (state, action) {
|
|
687
|
+
state.loading = false;
|
|
688
|
+
state.error = action.error.message;
|
|
689
|
+
})
|
|
690
|
+
.addCase(addDetailsAsync.pending, function (state) {
|
|
691
|
+
state.loading = true;
|
|
692
|
+
state.error = null;
|
|
693
|
+
})
|
|
694
|
+
.addCase(addDetailsAsync.fulfilled, function (state, action) {
|
|
695
|
+
state.loading = false;
|
|
696
|
+
state.error = null;
|
|
697
|
+
var userList = action.payload.userList;
|
|
698
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList });
|
|
699
|
+
})
|
|
700
|
+
.addCase(addDetailsAsync.rejected, function (state, action) {
|
|
701
|
+
state.loading = false;
|
|
702
|
+
state.error = action.error.message;
|
|
703
|
+
})
|
|
704
|
+
.addCase(requestDetailsByEmail.pending, function (state) {
|
|
705
|
+
state.loading = true;
|
|
706
|
+
state.error = null;
|
|
707
|
+
})
|
|
708
|
+
.addCase(requestDetailsByEmail.fulfilled, function (state, action) {
|
|
709
|
+
state.loading = false;
|
|
710
|
+
state.error = null;
|
|
711
|
+
var data = action.payload;
|
|
712
|
+
var userList = (state.data.verify.responseBody || {}).userList;
|
|
713
|
+
var list = userList || [];
|
|
714
|
+
list = list.map(function (user) { var _a, _b; return (user.id === ((_b = (_a = data === null || data === void 0 ? void 0 : data.notification) === null || _a === void 0 ? void 0 : _a.recipient) === null || _b === void 0 ? void 0 : _b.id) ? __assign(__assign({}, user), { isRequestedEmail: true }) : user); });
|
|
715
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { requestEmailData: data, userList: list });
|
|
716
|
+
})
|
|
717
|
+
.addCase(requestDetailsByEmail.rejected, function (state, action) {
|
|
718
|
+
state.loading = false;
|
|
719
|
+
state.error = action.error.message;
|
|
720
|
+
})
|
|
721
|
+
.addCase(retrieveIndividualInfo.pending, function (state) {
|
|
722
|
+
state.loading = true;
|
|
723
|
+
state.error = null;
|
|
724
|
+
})
|
|
725
|
+
.addCase(retrieveIndividualInfo.fulfilled, function (state, action) {
|
|
726
|
+
var _a, _b, _c, _d;
|
|
727
|
+
state.loading = false;
|
|
728
|
+
state.error = null;
|
|
729
|
+
var _e = action.payload, data = _e.data, countries = _e.countries, countryCode = _e.countryCode;
|
|
730
|
+
var user = (state.data.verify.responseBody || {}).user;
|
|
731
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { user: __assign(__assign({}, data), { is_authorized: data.is_authorized !== undefined ? data.is_authorized : user === null || user === void 0 ? void 0 : user.is_authorized }) });
|
|
732
|
+
var _f = data || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, employer_country = _f.employer_country;
|
|
733
|
+
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList, occupationList = _g.occupationList;
|
|
734
|
+
var cityList = (state.data.verify.responseBody || {}).cityList;
|
|
735
|
+
if (data)
|
|
736
|
+
state.data.individualPersonalData.name = getUserName(data, false);
|
|
737
|
+
if (contact === null || contact === void 0 ? void 0 : contact.email)
|
|
738
|
+
state.data.individualPersonalData.email = contact === null || contact === void 0 ? void 0 : contact.email;
|
|
739
|
+
if ((_a = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _a === void 0 ? void 0 : _a.number)
|
|
740
|
+
state.data.individualPersonalData.mobile = (_b = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _b === void 0 ? void 0 : _b.number;
|
|
741
|
+
if ((_c = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _c === void 0 ? void 0 : _c.country_code) {
|
|
742
|
+
state.data.individualPersonalData.countryCode = findCountryByIddPrefix(countries, (_d = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _d === void 0 ? void 0 : _d.country_code);
|
|
743
|
+
}
|
|
744
|
+
if (gender)
|
|
745
|
+
state.data.individualPersonalData.gender = gender.toLowerCase();
|
|
746
|
+
if (identification === null || identification === void 0 ? void 0 : identification.id)
|
|
747
|
+
state.data.individualPersonalData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
|
|
748
|
+
state.data.individualPersonalData.issuedCountry = identification === null || identification === void 0 ? void 0 : identification.issued_country_code;
|
|
749
|
+
if (identification === null || identification === void 0 ? void 0 : identification.issued_country_code) {
|
|
750
|
+
state.data.individualPersonalData.issuedCountry = findCountryByIso2(countries, identification === null || identification === void 0 ? void 0 : identification.issued_country_code);
|
|
751
|
+
}
|
|
752
|
+
var expiryDate = (identification === null || identification === void 0 ? void 0 : identification.expiry) || new Date().getTime();
|
|
753
|
+
state.data.individualPersonalData.expiryDate = convertNumbers2English(dateFormat(expiryDate));
|
|
754
|
+
if (birth === null || birth === void 0 ? void 0 : birth.date)
|
|
755
|
+
state.data.individualPersonalData.dob = convertNumbers2English(dateFormat(birth === null || birth === void 0 ? void 0 : birth.date));
|
|
756
|
+
if (birth === null || birth === void 0 ? void 0 : birth.country) {
|
|
757
|
+
state.data.individualPersonalData.placeOfBirthCountry = findCountryByIso2(countries, birth === null || birth === void 0 ? void 0 : birth.country);
|
|
758
|
+
}
|
|
759
|
+
if (birth === null || birth === void 0 ? void 0 : birth.city) {
|
|
760
|
+
var selectedCity = cityList === null || cityList === void 0 ? void 0 : cityList.find(function (city) {
|
|
761
|
+
return city.name.en === (birth === null || birth === void 0 ? void 0 : birth.city);
|
|
762
|
+
});
|
|
763
|
+
state.data.individualPersonalData.placeOfBirthCity = selectedCity;
|
|
764
|
+
}
|
|
765
|
+
if (nationality) {
|
|
766
|
+
state.data.individualPersonalData.nationality = findCountryByIso2(countries, nationality);
|
|
767
|
+
}
|
|
483
768
|
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
484
769
|
if (!!selectedSourceIncome)
|
|
485
770
|
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
486
|
-
var code =
|
|
771
|
+
var code = employer_country || countryCode;
|
|
487
772
|
if (!!code) {
|
|
488
773
|
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
489
774
|
state.data.individualData.employerLocation = employerLocation;
|
|
@@ -499,7 +784,20 @@ export var individualSlice = createSlice({
|
|
|
499
784
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
500
785
|
state.data.individualData.isInfluencer = is_influencer;
|
|
501
786
|
})
|
|
502
|
-
.addCase(
|
|
787
|
+
.addCase(retrieveIndividualInfo.rejected, function (state, action) {
|
|
788
|
+
state.loading = false;
|
|
789
|
+
state.error = action.error.message;
|
|
790
|
+
})
|
|
791
|
+
.addCase(getIndividualList.pending, function (state) {
|
|
792
|
+
state.loading = true;
|
|
793
|
+
state.error = null;
|
|
794
|
+
})
|
|
795
|
+
.addCase(getIndividualList.fulfilled, function (state, action) {
|
|
796
|
+
state.loading = false;
|
|
797
|
+
state.error = null;
|
|
798
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: action.payload });
|
|
799
|
+
})
|
|
800
|
+
.addCase(getIndividualList.rejected, function (state, action) {
|
|
503
801
|
state.loading = false;
|
|
504
802
|
state.error = action.error.message;
|
|
505
803
|
})
|
|
@@ -508,15 +806,60 @@ export var individualSlice = createSlice({
|
|
|
508
806
|
state.error = null;
|
|
509
807
|
})
|
|
510
808
|
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
809
|
+
var _a;
|
|
511
810
|
state.loading = false;
|
|
512
811
|
state.error = null;
|
|
513
|
-
var
|
|
812
|
+
var _b = action.payload, sourceIncome = _b.sourceIncome, monthlyIncome = _b.monthlyIncome, occupationData = _b.occupation;
|
|
514
813
|
var data = state.data.individualData.responseBody;
|
|
515
|
-
|
|
814
|
+
var sourceIncomeList = (sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.list) || [];
|
|
815
|
+
var monthlyIncomeList = (monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.list) || [];
|
|
816
|
+
var occupationList = (occupationData === null || occupationData === void 0 ? void 0 : occupationData.list) || [];
|
|
817
|
+
state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncomeList, monthlyIncomeList: monthlyIncomeList, occupationList: occupationList });
|
|
818
|
+
var _c = ((_a = state.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.user) || {}, source_income = _c.source_income, monthly_income = _c.monthly_income, occupation = _c.occupation;
|
|
819
|
+
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
820
|
+
if (!!selectedSourceIncome)
|
|
821
|
+
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
822
|
+
var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
|
|
823
|
+
return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
|
|
824
|
+
});
|
|
825
|
+
var selectedOccupation = occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occup) {
|
|
826
|
+
return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
|
|
827
|
+
});
|
|
828
|
+
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
829
|
+
state.data.individualData.occupation = selectedOccupation;
|
|
516
830
|
})
|
|
517
831
|
.addCase(retrieveDataList.rejected, function (state, action) {
|
|
518
832
|
state.loading = false;
|
|
519
833
|
state.error = action.error.message;
|
|
834
|
+
})
|
|
835
|
+
.addCase(getCityList.pending, function (state) {
|
|
836
|
+
state.loading = true;
|
|
837
|
+
state.error = null;
|
|
838
|
+
})
|
|
839
|
+
.addCase(getCityList.fulfilled, function (state, action) {
|
|
840
|
+
state.loading = false;
|
|
841
|
+
state.error = null;
|
|
842
|
+
var data = state.data.verify.responseBody;
|
|
843
|
+
state.data.verify.responseBody = __assign(__assign({}, data), { cityList: action.payload });
|
|
844
|
+
})
|
|
845
|
+
.addCase(getCityList.rejected, function (state, action) {
|
|
846
|
+
state.loading = false;
|
|
847
|
+
state.error = action.error.message;
|
|
848
|
+
})
|
|
849
|
+
.addCase(updateIndividualPersonalInfo.pending, function (state) {
|
|
850
|
+
state.loading = true;
|
|
851
|
+
state.error = null;
|
|
852
|
+
})
|
|
853
|
+
.addCase(updateIndividualPersonalInfo.fulfilled, function (state, action) {
|
|
854
|
+
state.loading = false;
|
|
855
|
+
state.error = null;
|
|
856
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
857
|
+
state.data.individualPersonalData = formData;
|
|
858
|
+
state.data.individualPersonalData.responseBody = data;
|
|
859
|
+
})
|
|
860
|
+
.addCase(updateIndividualPersonalInfo.rejected, function (state, action) {
|
|
861
|
+
state.loading = false;
|
|
862
|
+
state.error = action.error.message;
|
|
520
863
|
})
|
|
521
864
|
.addCase(updateIndividualInfo.pending, function (state) {
|
|
522
865
|
state.loading = true;
|