@tap-payments/auth-jsconnect 2.8.18-test → 2.8.20-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/features/app/connectExpress/connectExpressStore.js +4 -3
- package/build/features/app/individual/individualStore.d.ts +17 -35
- package/build/features/app/individual/individualStore.js +189 -250
- package/build/features/individual/screens/IndividualList/IndividualList.js +11 -5
- package/build/features/individual/screens/IndividualList/UserList.js +6 -6
- package/package.json +1 -1
|
@@ -228,7 +228,7 @@ export var getMerchantListAsync = createAsyncThunk('connectExpress/getMerchantLi
|
|
|
228
228
|
case 0:
|
|
229
229
|
_b = thunkApi.getState(), settings = _b.settings, connectExpress = _b.connectExpress;
|
|
230
230
|
platforms = (_e = (_d = (_c = connectExpress.data.responseData) === null || _c === void 0 ? void 0 : _c.leadData) === null || _d === void 0 ? void 0 : _d.platforms) !== null && _e !== void 0 ? _e : settings.data.appConfig.platforms;
|
|
231
|
-
payment_provider = (_h = (_g = (_f = connectExpress.data.responseData) === null || _f === void 0 ? void 0 : _f.
|
|
231
|
+
payment_provider = (_h = (_g = (_f = connectExpress.data.responseData) === null || _f === void 0 ? void 0 : _f.leadData) === null || _g === void 0 ? void 0 : _g.payment_provider) !== null && _h !== void 0 ? _h : settings.data.appConfig.paymentProvider;
|
|
232
232
|
payload = {
|
|
233
233
|
business_entity_id: (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) || '',
|
|
234
234
|
brand_id: (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.id) || '',
|
|
@@ -880,7 +880,7 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
|
|
|
880
880
|
responseData = connectExpress.data.responseData;
|
|
881
881
|
_b = settings.data.appConfig, postURL = _b.postURL, scope = _b.scope, redirectUrl = _b.redirectUrl, mode = _b.mode, showBoard = _b.showBoard;
|
|
882
882
|
platforms = (_e = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _d === void 0 ? void 0 : _d.platforms) !== null && _e !== void 0 ? _e : settings.data.appConfig.platforms;
|
|
883
|
-
payment_provider = (_g = (_f = responseData === null || responseData === void 0 ? void 0 : responseData.
|
|
883
|
+
payment_provider = (_g = (_f = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _f === void 0 ? void 0 : _f.payment_provider) !== null && _g !== void 0 ? _g : settings.data.appConfig.paymentProvider;
|
|
884
884
|
authId = (_j = (_h = responseData === null || responseData === void 0 ? void 0 : responseData.authData) === null || _h === void 0 ? void 0 : _h.auth) === null || _j === void 0 ? void 0 : _j.id;
|
|
885
885
|
bi = settings.data.deviceInfo.browser.browser_id;
|
|
886
886
|
body = {
|
|
@@ -1183,7 +1183,8 @@ export var connectSlice = createSlice({
|
|
|
1183
1183
|
state.data.otpData.otp = '';
|
|
1184
1184
|
},
|
|
1185
1185
|
resetStore: function (state) {
|
|
1186
|
-
|
|
1186
|
+
var _a;
|
|
1187
|
+
state.data = __assign(__assign({}, state.data), { responseData: { leadData: (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.leadData } });
|
|
1187
1188
|
},
|
|
1188
1189
|
resetIndividualScreen: function (state) {
|
|
1189
1190
|
state.data.individualData = initialState.data.individualData;
|
|
@@ -8,21 +8,8 @@ interface VerifyLeadTokenProps {
|
|
|
8
8
|
}
|
|
9
9
|
export declare const verifyToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
10
10
|
data: any;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
bank_account: any;
|
|
14
|
-
entity: any;
|
|
15
|
-
merchant: any;
|
|
16
|
-
merchant_id: any;
|
|
17
|
-
name: any;
|
|
18
|
-
contact: any;
|
|
19
|
-
individuals: any;
|
|
20
|
-
countries: import("../../../@types").CountryCode[];
|
|
21
|
-
countryCode: any;
|
|
22
|
-
notification: any;
|
|
23
|
-
business: any;
|
|
24
|
-
flows: any;
|
|
25
|
-
};
|
|
11
|
+
countries: import("../../../@types").CountryCode[];
|
|
12
|
+
countryCode: any;
|
|
26
13
|
token: string;
|
|
27
14
|
userList: User[];
|
|
28
15
|
}, VerifyLeadTokenProps, {
|
|
@@ -160,9 +147,14 @@ export declare const retrieveBoardStatus: import("@reduxjs/toolkit").AsyncThunk<
|
|
|
160
147
|
fulfilledMeta?: unknown;
|
|
161
148
|
rejectedMeta?: unknown;
|
|
162
149
|
}>;
|
|
150
|
+
type RetrieveBoardProps = {
|
|
151
|
+
boardId: string;
|
|
152
|
+
individualId?: string;
|
|
153
|
+
individualType?: string;
|
|
154
|
+
};
|
|
163
155
|
export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
|
|
164
156
|
data: any;
|
|
165
|
-
},
|
|
157
|
+
}, RetrieveBoardProps, {
|
|
166
158
|
state?: unknown;
|
|
167
159
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
168
160
|
extra?: unknown;
|
|
@@ -174,21 +166,8 @@ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk
|
|
|
174
166
|
}>;
|
|
175
167
|
export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
176
168
|
data: any;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
bank_account: any;
|
|
180
|
-
entity: any;
|
|
181
|
-
merchant: any;
|
|
182
|
-
merchant_id: any;
|
|
183
|
-
name: any;
|
|
184
|
-
contact: any;
|
|
185
|
-
individuals: any;
|
|
186
|
-
countries: import("../../../@types").CountryCode[];
|
|
187
|
-
countryCode: any;
|
|
188
|
-
notification: any;
|
|
189
|
-
business: any;
|
|
190
|
-
flows: any;
|
|
191
|
-
};
|
|
169
|
+
countries: import("../../../@types").CountryCode[];
|
|
170
|
+
countryCode: any;
|
|
192
171
|
formData: {
|
|
193
172
|
otp: string;
|
|
194
173
|
};
|
|
@@ -265,11 +244,13 @@ export declare const checkEmailAvailability: import("@reduxjs/toolkit").AsyncThu
|
|
|
265
244
|
export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
266
245
|
response: any;
|
|
267
246
|
formData: void;
|
|
268
|
-
|
|
247
|
+
data?: undefined;
|
|
248
|
+
flows?: undefined;
|
|
269
249
|
} | {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
250
|
+
data: any;
|
|
251
|
+
flows: any;
|
|
252
|
+
response?: undefined;
|
|
253
|
+
formData?: undefined;
|
|
273
254
|
} | undefined, void, {
|
|
274
255
|
state?: unknown;
|
|
275
256
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -305,6 +286,7 @@ export interface IndividualData {
|
|
|
305
286
|
export interface IndividualState extends SharedState<IndividualData> {
|
|
306
287
|
customLoading?: boolean;
|
|
307
288
|
cityLoading?: boolean;
|
|
289
|
+
addOrRequestDetailLoading?: boolean;
|
|
308
290
|
}
|
|
309
291
|
export declare const individualSlice: import("@reduxjs/toolkit").Slice<IndividualState, {
|
|
310
292
|
clearError: (state: IndividualState) => void;
|
|
@@ -75,130 +75,96 @@ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountry
|
|
|
75
75
|
export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
|
|
76
76
|
var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
|
|
77
77
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
78
|
-
var
|
|
79
|
-
var _d, _e, _f, _g
|
|
80
|
-
return __generator(this, function (
|
|
81
|
-
switch (
|
|
78
|
+
var settings, payload, data, userList, recipientData, countries, countryCode, publicKey, _b, business_id, recipient, board_id, board_info_id, notification, _c, id_1, type, individualData, birthCountry;
|
|
79
|
+
var _d, _e, _f, _g;
|
|
80
|
+
return __generator(this, function (_h) {
|
|
81
|
+
switch (_h.label) {
|
|
82
82
|
case 0:
|
|
83
|
+
settings = thunkApi.getState().settings;
|
|
83
84
|
payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
|
|
84
85
|
notification: {
|
|
85
86
|
sms: false
|
|
86
87
|
}
|
|
87
88
|
}));
|
|
88
|
-
settings = thunkApi.getState().settings;
|
|
89
89
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
90
90
|
case 1:
|
|
91
|
-
data = (
|
|
92
|
-
|
|
93
|
-
boardInfoStatus = undefined;
|
|
91
|
+
data = (_h.sent()).data;
|
|
92
|
+
recipientData = undefined;
|
|
94
93
|
countries = settings.data.countries;
|
|
95
94
|
if (((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
96
95
|
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
97
96
|
if (isInternally)
|
|
98
97
|
data.step_name = INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO;
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
countryCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
99
|
+
if (data === null || data === void 0 ? void 0 : data.country_code)
|
|
101
100
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
102
|
-
}
|
|
103
101
|
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
104
|
-
if (publicKey)
|
|
102
|
+
if (publicKey)
|
|
105
103
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
106
|
-
}
|
|
107
104
|
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
|
|
108
105
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
|
|
109
|
-
return [3,
|
|
106
|
+
return [3, 16];
|
|
110
107
|
case 2:
|
|
111
|
-
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (
|
|
108
|
+
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 15];
|
|
109
|
+
_b = data || {}, business_id = _b.business_id, recipient = _b.recipient, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
110
|
+
recipientData = recipient;
|
|
111
|
+
if (!!((_f = data === null || data === void 0 ? void 0 : data.recipient) === null || _f === void 0 ? void 0 : _f.id)) return [3, 4];
|
|
112
|
+
if (!(board_id && board_info_id)) return [3, 4];
|
|
115
113
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
116
114
|
case 3:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
notification = (_h.sent()).notification;
|
|
116
|
+
recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
|
|
117
|
+
if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
|
|
118
|
+
throw new Error('individual_id_missing');
|
|
119
|
+
_h.label = 4;
|
|
122
120
|
case 4:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
_p.label = 5;
|
|
121
|
+
_c = recipientData || {}, id_1 = _c.id, type = _c.type;
|
|
122
|
+
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id_1, type: type, countryCode: countryCode })).unwrap()];
|
|
126
123
|
case 5:
|
|
127
|
-
|
|
128
|
-
return [
|
|
124
|
+
individualData = (_h.sent()).data;
|
|
125
|
+
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 8];
|
|
126
|
+
if (!business_id) return [3, 7];
|
|
127
|
+
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
129
128
|
case 6:
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
userList = _h.sent();
|
|
130
|
+
_h.label = 7;
|
|
132
131
|
case 7:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
137
|
-
}
|
|
138
|
-
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 11];
|
|
139
|
-
if (!((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id)) return [3, 9];
|
|
140
|
-
return [4, thunkApi.dispatch(getIndividualList((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id)).unwrap()];
|
|
132
|
+
userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id_1; });
|
|
133
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
134
|
+
return [3, 14];
|
|
141
135
|
case 8:
|
|
142
|
-
|
|
143
|
-
|
|
136
|
+
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
|
|
137
|
+
if (!business_id) return [3, 10];
|
|
138
|
+
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
144
139
|
case 9:
|
|
145
|
-
userList =
|
|
146
|
-
|
|
140
|
+
userList = _h.sent();
|
|
141
|
+
_h.label = 10;
|
|
147
142
|
case 10:
|
|
148
|
-
boardInfoStatus = _p.sent();
|
|
149
143
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
150
|
-
return [3,
|
|
144
|
+
return [3, 14];
|
|
151
145
|
case 11:
|
|
152
|
-
|
|
153
|
-
if (!
|
|
154
|
-
return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id)).unwrap()];
|
|
155
|
-
case 12:
|
|
156
|
-
userList = _p.sent();
|
|
157
|
-
_p.label = 13;
|
|
158
|
-
case 13: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
159
|
-
case 14:
|
|
160
|
-
boardInfoStatus = _p.sent();
|
|
161
|
-
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
162
|
-
return [3, 18];
|
|
163
|
-
case 15:
|
|
164
|
-
birthCountry = ((_l = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _l === void 0 ? void 0 : _l.country) || countryCode;
|
|
165
|
-
if (!birthCountry) return [3, 17];
|
|
146
|
+
birthCountry = ((_g = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _g === void 0 ? void 0 : _g.country) || countryCode;
|
|
147
|
+
if (!birthCountry) return [3, 13];
|
|
166
148
|
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
167
|
-
case
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
case
|
|
149
|
+
case 12:
|
|
150
|
+
_h.sent();
|
|
151
|
+
_h.label = 13;
|
|
152
|
+
case 13:
|
|
171
153
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
172
|
-
|
|
173
|
-
case
|
|
174
|
-
case
|
|
154
|
+
_h.label = 14;
|
|
155
|
+
case 14: return [3, 16];
|
|
156
|
+
case 15:
|
|
175
157
|
if (isUpdatePhoneInfo) {
|
|
176
158
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
|
|
177
159
|
}
|
|
178
|
-
|
|
179
|
-
case
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
187
|
-
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
188
|
-
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
189
|
-
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
190
|
-
name: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.names,
|
|
191
|
-
contact: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.contact,
|
|
192
|
-
individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
|
|
193
|
-
countries: countries,
|
|
194
|
-
countryCode: countryCode,
|
|
195
|
-
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
196
|
-
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
197
|
-
flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
|
|
198
|
-
},
|
|
199
|
-
token: token,
|
|
200
|
-
userList: userList || []
|
|
201
|
-
}];
|
|
160
|
+
_h.label = 16;
|
|
161
|
+
case 16: return [2, {
|
|
162
|
+
data: data,
|
|
163
|
+
countries: countries,
|
|
164
|
+
countryCode: countryCode,
|
|
165
|
+
token: token,
|
|
166
|
+
userList: userList || []
|
|
167
|
+
}];
|
|
202
168
|
}
|
|
203
169
|
});
|
|
204
170
|
});
|
|
@@ -259,7 +225,7 @@ export var addDetailsAsync = createAsyncThunk('individual/addDetailsAsync', func
|
|
|
259
225
|
});
|
|
260
226
|
}); });
|
|
261
227
|
export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsByEmail', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
262
|
-
var individual, _a, merchant_id, board_id, user, collectInfo, id, objects, ids, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody,
|
|
228
|
+
var individual, _a, merchant_id, board_id, user, collectInfo, id, objects, ids, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody, data_1, user_1, payload, data;
|
|
263
229
|
var _c;
|
|
264
230
|
return __generator(this, function (_d) {
|
|
265
231
|
switch (_d.label) {
|
|
@@ -289,8 +255,8 @@ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsBy
|
|
|
289
255
|
};
|
|
290
256
|
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
291
257
|
case 1:
|
|
292
|
-
|
|
293
|
-
user_1 = (sortUserList(mapUserList(
|
|
258
|
+
data_1 = _d.sent();
|
|
259
|
+
user_1 = (sortUserList(mapUserList(data_1 === null || data_1 === void 0 ? void 0 : data_1.individuals)) || [])[0];
|
|
294
260
|
individualData = user_1;
|
|
295
261
|
_d.label = 2;
|
|
296
262
|
case 2:
|
|
@@ -411,140 +377,139 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
|
|
|
411
377
|
});
|
|
412
378
|
}); });
|
|
413
379
|
export var retrieveBoardStatus = createAsyncThunk('individual/retrieveBoardStatus', function (parmas, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
414
|
-
var individual, board_id, data;
|
|
415
|
-
return __generator(this, function (
|
|
416
|
-
switch (
|
|
380
|
+
var individual, _a, board_id, board_info_id, data;
|
|
381
|
+
return __generator(this, function (_b) {
|
|
382
|
+
switch (_b.label) {
|
|
417
383
|
case 0:
|
|
418
384
|
individual = thunkApi.getState().individual;
|
|
419
|
-
|
|
385
|
+
_a = individual.data.verify.responseBody || {}, board_id = _a.board_id, board_info_id = _a.board_info_id;
|
|
386
|
+
if (!board_id || !board_info_id)
|
|
387
|
+
throw new Error('Internal server error');
|
|
420
388
|
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
421
389
|
case 1:
|
|
422
|
-
data =
|
|
390
|
+
data = _b.sent();
|
|
391
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id })).unwrap()];
|
|
392
|
+
case 2:
|
|
393
|
+
_b.sent();
|
|
423
394
|
thunkApi.dispatch(handlePrevScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
424
395
|
return [2, { flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
|
|
425
396
|
}
|
|
426
397
|
});
|
|
427
398
|
}); });
|
|
428
|
-
export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (
|
|
429
|
-
var _a,
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
399
|
+
export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (_a, thunkApi) {
|
|
400
|
+
var boardId = _a.boardId, id = _a.individualId, type = _a.individualType;
|
|
401
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
402
|
+
var _b, individual, settings, individualData, _c, user, data, data_2, data_state;
|
|
403
|
+
var _d, _e, _f;
|
|
404
|
+
return __generator(this, function (_g) {
|
|
405
|
+
switch (_g.label) {
|
|
406
|
+
case 0:
|
|
407
|
+
_b = thunkApi.getState(), individual = _b.individual, settings = _b.settings;
|
|
408
|
+
individualData = (_d = individual.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.user;
|
|
409
|
+
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
410
|
+
case 1:
|
|
411
|
+
_c = _g.sent(), user = _c.user, data = __rest(_c, ["user"]);
|
|
412
|
+
if (!((individualData === null || individualData === void 0 ? void 0 : individualData.id) === (user === null || user === void 0 ? void 0 : user.id))) return [3, 2];
|
|
413
|
+
individualData = user;
|
|
414
|
+
return [3, 4];
|
|
415
|
+
case 2:
|
|
416
|
+
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && id && type)) return [3, 4];
|
|
417
|
+
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: settings.data.businessCountry.iso2 })).unwrap()];
|
|
418
|
+
case 3:
|
|
419
|
+
data_2 = (_g.sent()).data;
|
|
420
|
+
individualData = data_2;
|
|
421
|
+
_g.label = 4;
|
|
422
|
+
case 4:
|
|
423
|
+
data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && (data === null || data === void 0 ? void 0 : data.individuals) ? data === null || data === void 0 ? void 0 : data.individuals : individualData) || {}).data_state;
|
|
424
|
+
return [2, {
|
|
425
|
+
data: __assign(__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: (_e = data === null || data === void 0 ? void 0 : data.user) === null || _e === void 0 ? void 0 : _e.names, individuals: data === null || data === void 0 ? void 0 : data.individuals, contact: (_f = data === null || data === void 0 ? void 0 : data.user) === null || _f === void 0 ? void 0 : _f.contact }), (data_state && {
|
|
426
|
+
individuals: __assign(__assign({}, data === null || data === void 0 ? void 0 : data.individuals), { data_state: data_state })
|
|
427
|
+
}))
|
|
428
|
+
}];
|
|
429
|
+
}
|
|
430
|
+
});
|
|
440
431
|
});
|
|
441
|
-
});
|
|
432
|
+
});
|
|
442
433
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
443
|
-
var _a, individual, settings, responseBody,
|
|
444
|
-
var _e, _f, _g, _h, _j, _k
|
|
445
|
-
return __generator(this, function (
|
|
446
|
-
switch (
|
|
434
|
+
var _a, individual, settings, responseBody, countries, payload, data, userList, recipientData, publicKey, countryCode, _b, business_id, recipient, board_id, board_info_id, notification, _c, id, type, individualData, birthCountry;
|
|
435
|
+
var _d, _e, _f, _g, _h, _j, _k;
|
|
436
|
+
return __generator(this, function (_l) {
|
|
437
|
+
switch (_l.label) {
|
|
447
438
|
case 0:
|
|
448
439
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
449
440
|
responseBody = individual.data.verify.responseBody;
|
|
450
|
-
_b = responseBody || {}, board_id = _b.board_id, board_info_id = _b.board_info_id;
|
|
451
441
|
countries = settings.data.countries;
|
|
452
442
|
payload = {
|
|
453
443
|
data: params.otp,
|
|
454
|
-
service_name: (
|
|
444
|
+
service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
|
|
455
445
|
verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
|
|
456
446
|
step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
|
|
457
447
|
encryption_contract: ['data']
|
|
458
448
|
};
|
|
459
449
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
460
450
|
case 1:
|
|
461
|
-
data = (
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
|
|
451
|
+
data = (_l.sent()).data;
|
|
452
|
+
recipientData = undefined;
|
|
453
|
+
if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
|
|
465
454
|
throw new Error(data.errors[0].description);
|
|
466
|
-
publicKey = (
|
|
467
|
-
if (publicKey)
|
|
455
|
+
publicKey = (_f = data === null || data === void 0 ? void 0 : data.config) === null || _f === void 0 ? void 0 : _f.public_key;
|
|
456
|
+
if (publicKey)
|
|
468
457
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
469
|
-
|
|
470
|
-
if (
|
|
471
|
-
|
|
458
|
+
countryCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
459
|
+
if (countryCode)
|
|
460
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
461
|
+
_b = data || {}, business_id = _b.business_id, recipient = _b.recipient, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
462
|
+
recipientData = recipient;
|
|
463
|
+
if (!!((_g = data === null || data === void 0 ? void 0 : data.recipient) === null || _g === void 0 ? void 0 : _g.id)) return [3, 3];
|
|
464
|
+
if (!(board_id && board_info_id)) return [3, 3];
|
|
465
|
+
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
472
466
|
case 2:
|
|
473
|
-
|
|
474
|
-
|
|
467
|
+
notification = (_l.sent()).notification;
|
|
468
|
+
recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
|
|
469
|
+
if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
|
|
470
|
+
throw new Error('individual_id_missing');
|
|
471
|
+
_l.label = 3;
|
|
475
472
|
case 3:
|
|
476
|
-
|
|
477
|
-
if (!(board_id && board_info_id)) return [3, 6];
|
|
478
|
-
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
479
|
-
case 4:
|
|
480
|
-
boardInfoData = _t.sent();
|
|
481
|
-
notification = (boardInfoData || {}).notification;
|
|
482
|
-
_c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
483
|
-
if (!(id && type)) return [3, 6];
|
|
473
|
+
_c = recipientData || {}, id = _c.id, type = _c.type;
|
|
484
474
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
|
|
475
|
+
case 4:
|
|
476
|
+
individualData = (_l.sent()).data;
|
|
477
|
+
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 7];
|
|
478
|
+
if (!business_id) return [3, 6];
|
|
479
|
+
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
485
480
|
case 5:
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
_t.label = 6;
|
|
481
|
+
userList = _l.sent();
|
|
482
|
+
_l.label = 6;
|
|
489
483
|
case 6:
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 8];
|
|
494
|
-
return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id)).unwrap()];
|
|
484
|
+
userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id; });
|
|
485
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
486
|
+
return [3, 13];
|
|
495
487
|
case 7:
|
|
496
|
-
|
|
497
|
-
|
|
488
|
+
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 10];
|
|
489
|
+
if (!business_id) return [3, 9];
|
|
490
|
+
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
498
491
|
case 8:
|
|
499
|
-
userList =
|
|
500
|
-
|
|
492
|
+
userList = _l.sent();
|
|
493
|
+
_l.label = 9;
|
|
501
494
|
case 9:
|
|
502
|
-
boardInfoStatus = _t.sent();
|
|
503
495
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
504
|
-
return [3,
|
|
496
|
+
return [3, 13];
|
|
505
497
|
case 10:
|
|
506
|
-
|
|
507
|
-
if (!
|
|
508
|
-
return [4, thunkApi.dispatch(getIndividualList((_m = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _m === void 0 ? void 0 : _m.id))];
|
|
509
|
-
case 11:
|
|
510
|
-
_t.sent();
|
|
511
|
-
_t.label = 12;
|
|
512
|
-
case 12: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
513
|
-
case 13:
|
|
514
|
-
boardInfoStatus = _t.sent();
|
|
515
|
-
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
516
|
-
return [3, 17];
|
|
517
|
-
case 14:
|
|
518
|
-
birthCountry = ((_o = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _o === void 0 ? void 0 : _o.country) || countryCode;
|
|
519
|
-
if (!birthCountry) return [3, 16];
|
|
498
|
+
birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
|
|
499
|
+
if (!birthCountry) return [3, 12];
|
|
520
500
|
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
521
|
-
case
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
case
|
|
501
|
+
case 11:
|
|
502
|
+
_l.sent();
|
|
503
|
+
_l.label = 12;
|
|
504
|
+
case 12:
|
|
525
505
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
|
|
526
|
-
|
|
527
|
-
case
|
|
528
|
-
(
|
|
529
|
-
individuals = (boardData || {}).individuals;
|
|
530
|
-
_d = individualData || {}, is_authorized = _d.is_authorized, data_state = _d.data_state;
|
|
506
|
+
_l.label = 13;
|
|
507
|
+
case 13:
|
|
508
|
+
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, { otp: params.otp });
|
|
531
509
|
return [2, {
|
|
532
510
|
data: data,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
536
|
-
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
537
|
-
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
538
|
-
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
539
|
-
name: (_r = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _r === void 0 ? void 0 : _r.names,
|
|
540
|
-
contact: (_s = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _s === void 0 ? void 0 : _s.contact,
|
|
541
|
-
individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
|
|
542
|
-
countries: countries,
|
|
543
|
-
countryCode: countryCode,
|
|
544
|
-
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
545
|
-
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
546
|
-
flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
|
|
547
|
-
},
|
|
511
|
+
countries: countries,
|
|
512
|
+
countryCode: countryCode,
|
|
548
513
|
formData: __assign({}, params),
|
|
549
514
|
userList: userList
|
|
550
515
|
}];
|
|
@@ -586,14 +551,14 @@ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', func
|
|
|
586
551
|
export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (_a, thunkApi) {
|
|
587
552
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
588
553
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
589
|
-
var _b, settings, individual, _c,
|
|
554
|
+
var _b, settings, individual, _c, recipient, user, entity, id, _d, objects, ids, countryCode, name, email, mobile, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, data, _e, isUser, isBuyer, isUserORBuyerType;
|
|
590
555
|
var _f, _g, _h, _j, _k;
|
|
591
556
|
return __generator(this, function (_l) {
|
|
592
557
|
switch (_l.label) {
|
|
593
558
|
case 0:
|
|
594
559
|
_b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
|
|
595
|
-
_c = individual.data.verify.responseBody || {},
|
|
596
|
-
id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user :
|
|
560
|
+
_c = individual.data.verify.responseBody || {}, recipient = _c.recipient, user = _c.user, entity = _c.entity;
|
|
561
|
+
id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : recipient) || {}).id;
|
|
597
562
|
_d = user || {}, objects = _d.objects, ids = _d.ids;
|
|
598
563
|
countryCode = (originalFormData || {}).countryCode;
|
|
599
564
|
name = formData.name, email = formData.email, mobile = formData.mobile, gender = formData.gender, nid = formData.nid, issuedCountry = formData.issuedCountry, expiryDate = formData.expiryDate, dob = formData.dob, placeOfBirthCountry = formData.placeOfBirthCountry, placeOfBirthCity = formData.placeOfBirthCity, nationality = formData.nationality;
|
|
@@ -688,14 +653,14 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
688
653
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
|
|
689
654
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
690
655
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
691
|
-
var _b, settings, individual, _c,
|
|
656
|
+
var _b, settings, individual, _c, recipient, user, userList, business, id, _d, objects, ids, isKWOrSAValue, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isAuthorized, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isAuthorizedNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, isAuthorizedInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, requestBody, data, individualData, userListRes;
|
|
692
657
|
var _f, _g;
|
|
693
658
|
return __generator(this, function (_h) {
|
|
694
659
|
switch (_h.label) {
|
|
695
660
|
case 0:
|
|
696
661
|
_b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
|
|
697
|
-
_c = individual.data.verify.responseBody || {},
|
|
698
|
-
id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user :
|
|
662
|
+
_c = individual.data.verify.responseBody || {}, recipient = _c.recipient, user = _c.user, userList = _c.userList, business = _c.business;
|
|
663
|
+
id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : recipient) || {}).id;
|
|
699
664
|
_d = user || {}, objects = _d.objects, ids = _d.ids;
|
|
700
665
|
isKWOrSAValue = isKWOrSA(settings.data.businessCountry.iso2);
|
|
701
666
|
occupation = formData.occupation, sourceIncome = formData.sourceIncome, monthlyIncome = formData.monthlyIncome, isPEP = formData.isPEP, isInfluencer = formData.isInfluencer, shareCount = formData.shareCount, shareValue = formData.shareValue, civilID = formData.civilID, signatureFileId = formData.signatureFileId, isAuthorized = formData.isAuthorized;
|
|
@@ -829,49 +794,39 @@ export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', f
|
|
|
829
794
|
});
|
|
830
795
|
});
|
|
831
796
|
export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
832
|
-
var _a, settings, individual, _b,
|
|
833
|
-
var _e, _f, _g, _h, _j, _k, _l, _m;
|
|
834
|
-
return __generator(this, function (
|
|
835
|
-
switch (
|
|
797
|
+
var _a, settings, individual, _b, board_id, infoId, _c, showBoard, mode, payload, data, _d, id, iType, boardInfoStatusData;
|
|
798
|
+
var _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
799
|
+
return __generator(this, function (_p) {
|
|
800
|
+
switch (_p.label) {
|
|
836
801
|
case 0:
|
|
837
802
|
_a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
|
|
838
|
-
_b = individual.data.verify.responseBody || {},
|
|
803
|
+
_b = individual.data.verify.responseBody || {}, board_id = _b.board_id, infoId = _b.board_info_id;
|
|
839
804
|
_c = settings.data.appConfig, showBoard = _c.showBoard, mode = _c.mode;
|
|
840
|
-
if (!
|
|
805
|
+
if (!board_id)
|
|
841
806
|
return [2];
|
|
842
807
|
payload = {
|
|
843
808
|
lang: settings.data.language,
|
|
844
|
-
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS
|
|
845
|
-
id: id
|
|
809
|
+
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS
|
|
846
810
|
};
|
|
847
|
-
return [4, API.boardService.updateBoardInfo(__assign({ id:
|
|
811
|
+
return [4, API.boardService.updateBoardInfo(__assign({ id: board_id, infoId: infoId }, payload))];
|
|
848
812
|
case 1:
|
|
849
|
-
data =
|
|
813
|
+
data = _p.sent();
|
|
850
814
|
if (!showBoard && mode === 'content') {
|
|
851
815
|
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
|
|
852
816
|
(_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
|
|
853
817
|
return [2, { response: __assign({}, data), formData: params }];
|
|
854
818
|
}
|
|
855
|
-
|
|
819
|
+
_d = ((_j = data === null || data === void 0 ? void 0 : data.notification) === null || _j === void 0 ? void 0 : _j.recipient) || {}, id = _d.id, iType = _d.type;
|
|
820
|
+
return [4, Promise.all([
|
|
821
|
+
API.boardService.retrieveBoardInfoStatus(board_id),
|
|
822
|
+
thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: iType })).unwrap()
|
|
823
|
+
])];
|
|
856
824
|
case 2:
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
_o.sent();
|
|
861
|
-
individualDataRes = undefined;
|
|
862
|
-
_d = primaryUser || {}, is_authorized = _d.is_authorized, userId = _d.id, type = _d.object;
|
|
863
|
-
if (!!is_authorized) return [3, 5];
|
|
864
|
-
return [4, thunkApi
|
|
865
|
-
.dispatch(retrieveIndividualInfo({ id: userId, type: type, countryCode: settings.data.businessCountry.iso2 }))
|
|
866
|
-
.unwrap()];
|
|
867
|
-
case 4:
|
|
868
|
-
individualDataRes = _o.sent();
|
|
869
|
-
_o.label = 5;
|
|
870
|
-
case 5:
|
|
871
|
-
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, {});
|
|
872
|
-
(_m = (_l = settings.data.appConfig).onFlowCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, { data: data });
|
|
825
|
+
boardInfoStatusData = (_p.sent())[0];
|
|
826
|
+
(_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, {});
|
|
827
|
+
(_o = (_m = settings.data.appConfig).onFlowCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, { data: data });
|
|
873
828
|
thunkApi.dispatch(handleNextScreenStep());
|
|
874
|
-
return [2, {
|
|
829
|
+
return [2, { data: data, flows: (boardInfoStatusData === null || boardInfoStatusData === void 0 ? void 0 : boardInfoStatusData.info) || [] }];
|
|
875
830
|
}
|
|
876
831
|
});
|
|
877
832
|
}); });
|
|
@@ -893,6 +848,7 @@ var initialState = {
|
|
|
893
848
|
error: null,
|
|
894
849
|
loading: false,
|
|
895
850
|
cityLoading: false,
|
|
851
|
+
addOrRequestDetailLoading: false,
|
|
896
852
|
data: {
|
|
897
853
|
flowName: FlowsTypes.INDIVIDUAL,
|
|
898
854
|
verify: {
|
|
@@ -968,8 +924,8 @@ export var individualSlice = createSlice({
|
|
|
968
924
|
})
|
|
969
925
|
.addCase(verifyToken.fulfilled, function (state, action) {
|
|
970
926
|
state.error = null;
|
|
971
|
-
var _a = action.payload, data = _a.data, token = _a.token,
|
|
972
|
-
state.data.verify.responseBody = __assign(__assign(__assign(
|
|
927
|
+
var _a = action.payload, data = _a.data, token = _a.token, countries = _a.countries, countryCode = _a.countryCode, userList = _a.userList;
|
|
928
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { countries: countries, countryCode: countryCode, board_id: data.id, userList: userList });
|
|
973
929
|
state.data.verify.token = token;
|
|
974
930
|
})
|
|
975
931
|
.addCase(verifyToken.rejected, function (state, action) {
|
|
@@ -1009,30 +965,24 @@ export var individualSlice = createSlice({
|
|
|
1009
965
|
state.error = null;
|
|
1010
966
|
})
|
|
1011
967
|
.addCase(verifyLeadOTP.fulfilled, function (state, action) {
|
|
1012
|
-
var _a;
|
|
1013
968
|
state.loading = false;
|
|
1014
969
|
state.error = null;
|
|
1015
|
-
var
|
|
1016
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
1017
|
-
if (description) {
|
|
1018
|
-
state.error = description;
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
970
|
+
var _a = action.payload, data = _a.data, countries = _a.countries, countryCode = _a.countryCode, userList = _a.userList, formData = _a.formData;
|
|
1021
971
|
state.data.otpData = formData;
|
|
1022
972
|
state.data.otpData.responseBody = data;
|
|
1023
|
-
state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody),
|
|
973
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { countries: countries, countryCode: countryCode, userList: userList });
|
|
1024
974
|
})
|
|
1025
975
|
.addCase(verifyLeadOTP.rejected, function (state, action) {
|
|
1026
976
|
state.loading = false;
|
|
1027
977
|
state.error = action.error.message;
|
|
1028
978
|
})
|
|
1029
979
|
.addCase(addDetailsAsync.pending, function (state) {
|
|
1030
|
-
state.
|
|
980
|
+
state.addOrRequestDetailLoading = true;
|
|
1031
981
|
state.error = null;
|
|
1032
982
|
})
|
|
1033
983
|
.addCase(addDetailsAsync.fulfilled, function (state, action) {
|
|
1034
984
|
var _a, _b, _c, _d;
|
|
1035
|
-
state.
|
|
985
|
+
state.addOrRequestDetailLoading = false;
|
|
1036
986
|
state.error = null;
|
|
1037
987
|
var _e = action.payload, userList = _e.userList, individualId = _e.individualId, countries = _e.countries;
|
|
1038
988
|
var primaryUser = (state.data.verify.responseBody || {}).user;
|
|
@@ -1101,15 +1051,15 @@ export var individualSlice = createSlice({
|
|
|
1101
1051
|
state.data.individualData.isAuthorized = is_authorized;
|
|
1102
1052
|
})
|
|
1103
1053
|
.addCase(addDetailsAsync.rejected, function (state, action) {
|
|
1104
|
-
state.
|
|
1054
|
+
state.addOrRequestDetailLoading = false;
|
|
1105
1055
|
state.error = action.error.message;
|
|
1106
1056
|
})
|
|
1107
1057
|
.addCase(requestDetailsByEmail.pending, function (state) {
|
|
1108
|
-
state.
|
|
1058
|
+
state.addOrRequestDetailLoading = true;
|
|
1109
1059
|
state.error = null;
|
|
1110
1060
|
})
|
|
1111
1061
|
.addCase(requestDetailsByEmail.fulfilled, function (state, action) {
|
|
1112
|
-
state.
|
|
1062
|
+
state.addOrRequestDetailLoading = false;
|
|
1113
1063
|
state.error = null;
|
|
1114
1064
|
var _a = action.payload, data = _a.data, individualData = _a.individualData;
|
|
1115
1065
|
var userList = (state.data.verify.responseBody || {}).userList;
|
|
@@ -1122,7 +1072,7 @@ export var individualSlice = createSlice({
|
|
|
1122
1072
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { requestEmailData: data, userList: list });
|
|
1123
1073
|
})
|
|
1124
1074
|
.addCase(requestDetailsByEmail.rejected, function (state, action) {
|
|
1125
|
-
state.
|
|
1075
|
+
state.addOrRequestDetailLoading = false;
|
|
1126
1076
|
state.error = action.error.message;
|
|
1127
1077
|
})
|
|
1128
1078
|
.addCase(retrieveIndividualInfo.pending, function (state) {
|
|
@@ -1361,21 +1311,10 @@ export var individualSlice = createSlice({
|
|
|
1361
1311
|
state.error = action.error.message;
|
|
1362
1312
|
})
|
|
1363
1313
|
.addCase(updateBoardSuccess.fulfilled, function (state, action) {
|
|
1364
|
-
var _a;
|
|
1365
1314
|
state.loading = false;
|
|
1366
1315
|
state.error = null;
|
|
1367
|
-
var
|
|
1368
|
-
|
|
1369
|
-
if (description) {
|
|
1370
|
-
state.error = description;
|
|
1371
|
-
return;
|
|
1372
|
-
}
|
|
1373
|
-
var flows = response.flows;
|
|
1374
|
-
var individuals = (state.data.verify.responseBody || {}).individuals;
|
|
1375
|
-
var data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) ? individuals : individualData) || {}).data_state;
|
|
1376
|
-
state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (data_state && {
|
|
1377
|
-
individuals: __assign(__assign({}, individuals), { data_state: data_state })
|
|
1378
|
-
}));
|
|
1316
|
+
var _a = action.payload || {}, flows = _a.flows, data = _a.data;
|
|
1317
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, notification: data === null || data === void 0 ? void 0 : data.notification });
|
|
1379
1318
|
})
|
|
1380
1319
|
.addCase(updateBoardSuccess.pending, function (state) {
|
|
1381
1320
|
state.loading = true;
|
|
@@ -16,11 +16,12 @@ import Box from '@mui/material/Box';
|
|
|
16
16
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
17
17
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
18
|
import Text from '../../../../components/Text';
|
|
19
|
-
import Button from '../../../../components/Button';
|
|
20
19
|
import Collapse from '../../../../components/Collapse';
|
|
21
20
|
import Warning from '../../../../components/Warning';
|
|
21
|
+
import Button from '../../../../components/Button';
|
|
22
|
+
import Loader from '../../../../components/Loader';
|
|
22
23
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
|
-
import { individualSelector } from '../../../app/individual/individualStore';
|
|
24
|
+
import { individualSelector, retrieveBoardStatus } from '../../../app/individual/individualStore';
|
|
24
25
|
import UserList from './UserList';
|
|
25
26
|
var BoxStyled = styled(Box)(function (_a) {
|
|
26
27
|
var theme = _a.theme;
|
|
@@ -49,12 +50,17 @@ export var SubTitleStyled = styled(Text)(function (_a) {
|
|
|
49
50
|
var IndividualList = function () {
|
|
50
51
|
var dispatch = useAppDispatch();
|
|
51
52
|
var t = useTranslation().t;
|
|
52
|
-
var
|
|
53
|
+
var _a = useAppSelector(individualSelector), error = _a.error, data = _a.data, loading = _a.loading;
|
|
53
54
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
55
|
+
var flows = (data.verify.responseBody || {}).flows;
|
|
54
56
|
var onBack = function () {
|
|
55
|
-
|
|
57
|
+
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
|
|
58
|
+
dispatch(handlePrevScreenStep());
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
dispatch(retrieveBoardStatus());
|
|
56
62
|
};
|
|
57
63
|
var hideBack = settingsData.appConfig.mode === 'content';
|
|
58
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(BoxStyled, { children: [_jsxs(ContentStyled, { children: [_jsx(TitleStyled, { children: t('company_individuals') }), _jsx(SubTitleStyled, { children: t('company_individuals_add_or_request_details') })] }), _jsx(UserList, {})] }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'error' }, { children: t(error || '') })) })), !hideBack && (_jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return onBack(); }, variant: 'text' }, { children: t('back') })))] }));
|
|
64
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(BoxStyled, { children: [_jsxs(ContentStyled, { children: [_jsx(TitleStyled, { children: t('company_individuals') }), _jsx(SubTitleStyled, { children: t('company_individuals_add_or_request_details') })] }), _jsx(UserList, {})] }), _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'error' }, { children: t(error || '') })) })), !hideBack && (_jsx(Button, __assign({ sx: { mb: 1.5, mt: 1.5 }, onClick: function () { return onBack(); }, variant: 'text' }, { children: loading ? _jsx(Loader, { innerColor: 'black', outerColor: 'black', size: 15, toggleAnimation: !!loading }) : t('back') })))] }));
|
|
59
65
|
};
|
|
60
66
|
export default IndividualList;
|
|
@@ -85,12 +85,12 @@ var UserList = function (_a) {
|
|
|
85
85
|
var dispatch = useAppDispatch();
|
|
86
86
|
var _j = React.useState(false), emailChecking = _j[0], setEmailChecking = _j[1];
|
|
87
87
|
var theme = useTheme();
|
|
88
|
-
var _k = useAppSelector(individualSelector), data = _k.data,
|
|
88
|
+
var _k = useAppSelector(individualSelector), data = _k.data, addOrRequestDetailLoading = _k.addOrRequestDetailLoading, error = _k.error;
|
|
89
89
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
90
90
|
var _l = data.individualCollectData, email = _l.email, mobile = _l.mobile, responseBody = _l.responseBody;
|
|
91
91
|
var is_available = (responseBody || {}).is_available;
|
|
92
92
|
var verify = data.verify;
|
|
93
|
-
var _m = verify.responseBody || {}, userList = _m.userList,
|
|
93
|
+
var _m = verify.responseBody || {}, userList = _m.userList, recipient = _m.recipient, userRes = _m.user;
|
|
94
94
|
var methods = useForm({
|
|
95
95
|
resolver: yupResolver(IndividualCollectInfoValidationSchema(activeUser)),
|
|
96
96
|
defaultValues: {
|
|
@@ -159,10 +159,10 @@ var UserList = function (_a) {
|
|
|
159
159
|
return (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id;
|
|
160
160
|
};
|
|
161
161
|
var isSameUserRequestedBefore = function (user) {
|
|
162
|
-
var _a
|
|
162
|
+
var _a;
|
|
163
163
|
if (!(userRes === null || userRes === void 0 ? void 0 : userRes.is_authorized) && !isKWOrSA(settingsData.businessCountry.iso2))
|
|
164
164
|
return false;
|
|
165
|
-
return (_a = user === null || user === void 0 ? void 0 : user.ids) === null || _a === void 0 ? void 0 : _a.includes(
|
|
165
|
+
return (_a = user === null || user === void 0 ? void 0 : user.ids) === null || _a === void 0 ? void 0 : _a.includes(recipient === null || recipient === void 0 ? void 0 : recipient.id);
|
|
166
166
|
};
|
|
167
167
|
var getUserStatus = function (user) {
|
|
168
168
|
return user === null || user === void 0 ? void 0 : user.individual_data_state;
|
|
@@ -196,7 +196,7 @@ var UserList = function (_a) {
|
|
|
196
196
|
status: getUserStatus(user),
|
|
197
197
|
title: t('add_details'),
|
|
198
198
|
onClick: onAddDetails,
|
|
199
|
-
loading: isActiveUser(user) &&
|
|
199
|
+
loading: isActiveUser(user) && !!addOrRequestDetailLoading && type === IndividualRequestType.ADD
|
|
200
200
|
}, requestEmail: {
|
|
201
201
|
children: getCollectForm(user),
|
|
202
202
|
title: t('request_details_by_email'),
|
|
@@ -204,7 +204,7 @@ var UserList = function (_a) {
|
|
|
204
204
|
disabled: showCollectForm ? disabled : false,
|
|
205
205
|
onClick: onRequestEmail,
|
|
206
206
|
show: !isSameUserRequestedBefore(user),
|
|
207
|
-
loading: isActiveUser(user) &&
|
|
207
|
+
loading: isActiveUser(user) && !!addOrRequestDetailLoading && type === IndividualRequestType.REQUEST_EMAIL
|
|
208
208
|
} }) }))] }), index));
|
|
209
209
|
}) }));
|
|
210
210
|
};
|