@tap-payments/auth-jsconnect 2.4.25-test → 2.4.27-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.
@@ -102,6 +102,7 @@ export declare const updateIndividualPersonalInfo: import("@reduxjs/toolkit").As
102
102
  export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk<{
103
103
  data: any;
104
104
  formData: IndividualExtraFormValues;
105
+ individualData: any;
105
106
  }, AsyncThunkParams<IndividualExtraFormValues>, {}>;
106
107
  export declare const checkEmailAvailability: import("@reduxjs/toolkit").AsyncThunk<{
107
108
  response: any;
@@ -114,6 +115,7 @@ export declare const checkEmailAvailability: import("@reduxjs/toolkit").AsyncThu
114
115
  export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
115
116
  response: any;
116
117
  formData: void;
118
+ individualData: any;
117
119
  } | undefined, void, {}>;
118
120
  declare type VerifyData = {
119
121
  token: string;
@@ -346,7 +346,7 @@ export var retrieveIndividualInfo = createAsyncThunk('individual/retrieveIndivid
346
346
  else if (type === IndividualType.CUSTOMER)
347
347
  individualData = data === null || data === void 0 ? void 0 : data.customer;
348
348
  return [2, {
349
- data: __assign(__assign({}, (individualData || {})), { objects: [type], individual_data_state: individualData === null || individualData === void 0 ? void 0 : individualData.data_state }),
349
+ data: __assign(__assign({}, (individualData || {})), { objects: [type], individual_data_state: individualData === null || individualData === void 0 ? void 0 : individualData.data_state, object: type }),
350
350
  countryCode: countryCode,
351
351
  countries: settings.data.countries
352
352
  }];
@@ -631,7 +631,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
631
631
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
632
632
  var formData = _a.formData, originalFormData = _a.originalFormData;
633
633
  return __awaiter(void 0, void 0, void 0, function () {
634
- var _b, settings, individual, _c, notification, user, id, _d, objects, ids, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, requestBody, data, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody;
634
+ var _b, settings, individual, _c, notification, user, id, _d, objects, ids, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, requestBody, data, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, list, individualData;
635
635
  var _f, _g;
636
636
  return __generator(this, function (_h) {
637
637
  switch (_h.label) {
@@ -728,9 +728,11 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
728
728
  _h.sent();
729
729
  _h.label = 7;
730
730
  case 7:
731
+ list = mapUserList(data === null || data === void 0 ? void 0 : data.individuals);
732
+ individualData = (list === null || list === void 0 ? void 0 : list[0]) && __assign({}, list[0]);
731
733
  thunkApi.dispatch(handleNextScreenStep());
732
734
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
733
- return [2, { data: data, formData: originalFormData }];
735
+ return [2, { data: data, formData: originalFormData, individualData: individualData }];
734
736
  }
735
737
  });
736
738
  });
@@ -758,13 +760,13 @@ export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', f
758
760
  });
759
761
  });
760
762
  export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
761
- var _a, settings, individual, _b, id, infoId, payload, data, boardInfoStatus;
762
- var _c, _d, _e, _f;
763
- return __generator(this, function (_g) {
764
- switch (_g.label) {
763
+ var _a, settings, individual, _b, id, infoId, primaryUser, payload, data, boardInfoStatus, individualDataRes, _c, is_authorized, userId, type;
764
+ var _d, _e, _f, _g;
765
+ return __generator(this, function (_h) {
766
+ switch (_h.label) {
765
767
  case 0:
766
768
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
767
- _b = individual.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id;
769
+ _b = individual.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id, primaryUser = _b.primaryUser;
768
770
  if (!id)
769
771
  return [2];
770
772
  payload = {
@@ -774,17 +776,27 @@ export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess',
774
776
  };
775
777
  return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
776
778
  case 1:
777
- data = _g.sent();
779
+ data = _h.sent();
778
780
  return [4, API.boardService.retrieveBoardInfoStatus(id)];
779
781
  case 2:
780
- boardInfoStatus = _g.sent();
782
+ boardInfoStatus = _h.sent();
781
783
  return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
782
784
  case 3:
783
- _g.sent();
784
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, {});
785
- (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
785
+ _h.sent();
786
+ individualDataRes = undefined;
787
+ _c = primaryUser || {}, is_authorized = _c.is_authorized, userId = _c.id, type = _c.object;
788
+ if (!!is_authorized) return [3, 5];
789
+ return [4, thunkApi
790
+ .dispatch(retrieveIndividualInfo({ id: userId, type: type, countryCode: settings.data.businessCountry.iso2 }))
791
+ .unwrap()];
792
+ case 4:
793
+ individualDataRes = _h.sent();
794
+ _h.label = 5;
795
+ case 5:
796
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
797
+ (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: data });
786
798
  thunkApi.dispatch(handleNextScreenStep());
787
- return [2, { response: __assign(__assign({}, data), { flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || [] }), formData: params }];
799
+ return [2, { response: __assign(__assign({}, data), { flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || [] }), formData: params, individualData: individualDataRes === null || individualDataRes === void 0 ? void 0 : individualDataRes.data }];
788
800
  }
789
801
  });
790
802
  }); });
@@ -1031,7 +1043,7 @@ export var individualSlice = createSlice({
1031
1043
  state.error = null;
1032
1044
  var _e = action.payload, data = _e.data, countries = _e.countries;
1033
1045
  var user = (state.data.verify.responseBody || {}).user;
1034
- 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 }) });
1046
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { primaryUser: data, user: __assign(__assign({}, data), { is_authorized: data.is_authorized !== undefined ? data.is_authorized : user === null || user === void 0 ? void 0 : user.is_authorized }) });
1035
1047
  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, shares = _f.shares;
1036
1048
  var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList, occupationList = _g.occupationList;
1037
1049
  var cityList = (state.data.verify.responseBody || {}).cityList;
@@ -1199,9 +1211,16 @@ export var individualSlice = createSlice({
1199
1211
  .addCase(updateIndividualInfo.fulfilled, function (state, action) {
1200
1212
  state.loading = false;
1201
1213
  state.error = null;
1202
- var _a = action.payload, data = _a.data, formData = _a.formData;
1214
+ var _a = action.payload, data = _a.data, formData = _a.formData, individualData = _a.individualData;
1203
1215
  state.data.individualData = formData;
1204
1216
  state.data.individualData.responseBody = data;
1217
+ var userList = (state.data.verify.responseBody || {}).userList;
1218
+ var list = userList || [];
1219
+ list = list.map(function (user) {
1220
+ var userInfo = user.id === (individualData === null || individualData === void 0 ? void 0 : individualData.id) ? individualData : user;
1221
+ return userInfo;
1222
+ });
1223
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: list });
1205
1224
  })
1206
1225
  .addCase(updateIndividualInfo.rejected, function (state, action) {
1207
1226
  state.loading = false;
@@ -1253,14 +1272,15 @@ export var individualSlice = createSlice({
1253
1272
  var _a;
1254
1273
  state.loading = false;
1255
1274
  state.error = null;
1256
- var response = (action.payload || {}).response;
1275
+ var _b = action.payload || {}, response = _b.response, individualData = _b.individualData;
1257
1276
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
1258
1277
  if (description) {
1259
1278
  state.error = description;
1260
1279
  return;
1261
1280
  }
1262
1281
  var flows = response.flows;
1263
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
1282
+ var individuals = (state.data.verify.responseBody || {}).individuals;
1283
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { individuals: __assign(__assign({}, individuals), { data_state: individualData === null || individualData === void 0 ? void 0 : individualData.data_state }) }));
1264
1284
  })
1265
1285
  .addCase(updateBoardSuccess.pending, function (state) {
1266
1286
  state.loading = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.4.25-test",
3
+ "version": "2.4.27-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",