@tap-payments/auth-jsconnect 2.8.32-test → 2.8.35-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/build/features/app/bank/bankStore.js +4 -3
  2. package/build/features/app/board/boardStore.js +17 -11
  3. package/build/features/app/brand/brandStore.js +5 -4
  4. package/build/features/app/entity/entityStore.js +4 -3
  5. package/build/features/app/individual/individualStore.js +4 -3
  6. package/build/features/app/password/passwordStore.d.ts +35 -22
  7. package/build/features/app/password/passwordStore.js +197 -203
  8. package/build/features/app/tax/taxStore.js +4 -3
  9. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +4 -26
  10. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  11. package/build/features/board/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -4
  12. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +8 -35
  13. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +3 -3
  14. package/build/features/brand/screens/BrandActivities/CustomerBase.js +1 -1
  15. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +5 -18
  16. package/build/features/brand/screens/BrandActivities/TAC.d.ts +2 -7
  17. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  18. package/build/features/business/screens/Activities/ActivitiesList.d.ts +2 -2
  19. package/build/features/business/screens/Activities/OperationStartDate.d.ts +1 -1
  20. package/build/features/business/screens/BrandDetails/SalesChannel.d.ts +1 -1
  21. package/build/features/business/screens/BusinessType/LicenseType.d.ts +4 -26
  22. package/build/features/business/screens/Customers/CustomerLocations.d.ts +9 -36
  23. package/build/features/business/screens/Customers/CustomerLocations.js +1 -1
  24. package/build/features/business/screens/Customers/RefundPolicy.d.ts +5 -18
  25. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  26. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +4 -26
  27. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +4 -26
  28. package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.d.ts +2 -7
  29. package/build/features/connectExpress/screens/NID/TAC.d.ts +2 -7
  30. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  31. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +2 -2
  32. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +8 -35
  33. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +1 -1
  34. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +1 -1
  35. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  36. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +1 -1
  37. package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.d.ts +4 -26
  38. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +4 -26
  39. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +2 -2
  40. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +4 -26
  41. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +1 -1
  42. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  43. package/build/features/password/Password.js +3 -1
  44. package/build/features/password/screens/CreatePassword/CreatePassword.js +8 -4
  45. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  46. package/build/features/password/screens/Verify/Verify.js +4 -4
  47. package/build/features/shared/Address/CountryList.d.ts +7 -23
  48. package/build/features/shared/Address/InputSelect.d.ts +7 -23
  49. package/build/features/shared/Button/FlowsButtons.js +1 -1
  50. package/build/features/shared/Input/Input.d.ts +2 -2
  51. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +5 -1
  52. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +3 -3
  53. package/build/features/shared/UploadFile/FileUpload.d.ts +2 -7
  54. package/build/features/shared/UploadFile/UploadFile.d.ts +2 -7
  55. package/build/features/shared/UploadFile/UploadWrapper.d.ts +2 -7
  56. package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +2 -7
  57. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +2 -7
  58. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  59. package/build/utils/string.d.ts +2 -2
  60. package/build/utils/string.js +8 -2
  61. package/package.json +1 -1
@@ -49,14 +49,14 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { handleCurrentActiveScreen, handleNextScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
52
+ import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
53
53
  import { PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
54
54
  import { retrieveIndividualData } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var payload, data, boardStatusData, boardInfoData, boardData, individualData, _a, board_id, board_info_id, config, publicKey, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2, info, hasPasswordCompleted;
57
- var _d, _e, _f, _g, _h;
58
- return __generator(this, function (_j) {
59
- switch (_j.label) {
56
+ var payload, data, _a, config, board_info_password_status, country_code, board_id, countryIso2, publicKey, data_1;
57
+ var _b, _c;
58
+ return __generator(this, function (_d) {
59
+ switch (_d.label) {
60
60
  case 0:
61
61
  payload = {
62
62
  service_name: 'tap_email',
@@ -64,56 +64,34 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
64
64
  };
65
65
  return [4, API.leadService.verifyLeadToken(payload)];
66
66
  case 1:
67
- data = (_j.sent()).data;
68
- individualData = undefined;
69
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
70
- _a = data || {}, board_id = _a.id, board_info_id = _a.board_info_id, config = _a.config;
67
+ data = (_d.sent()).data;
68
+ if (((_b = data === null || data === void 0 ? void 0 : data.errors) === null || _b === void 0 ? void 0 : _b.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
69
+ throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
70
+ _a = data || {}, config = _a.config, board_info_password_status = _a.board_info_password_status, country_code = _a.country_code, board_id = _a.board_id;
71
+ countryIso2 = country_code;
72
+ if (countryIso2)
73
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
71
74
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
72
- if (publicKey) {
75
+ if (publicKey)
73
76
  thunkApi.dispatch(handlePublicKey(publicKey));
74
- }
75
- if (!board_id) return [3, 7];
76
- if (!board_info_id) return [3, 3];
77
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
78
- case 2:
79
- boardInfoData = _j.sent();
80
- _j.label = 3;
81
- case 3: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
82
- case 4:
83
- boardStatusData = _j.sent();
77
+ if (!!country_code) return [3, 3];
84
78
  return [4, API.boardService.retrieveBoardDetails(board_id)];
85
- case 5:
86
- boardData = _j.sent();
87
- _b = ((_d = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id_1 = _b.id, type_1 = _b.type;
88
- serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
89
- return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
90
- case 6:
91
- _c = _j.sent(), boardRes = _c.boardRes, individualRes = _c.individualRes;
92
- boardData = boardRes;
93
- individualData = individualRes;
94
- _j.label = 7;
95
- case 7:
96
- countryIso2 = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
97
- if (countryIso2)
98
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
99
- info = (boardStatusData || {}).info;
100
- hasPasswordCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'password'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
79
+ case 2:
80
+ data_1 = _d.sent();
81
+ if ((_c = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _c === void 0 ? void 0 : _c.country)
82
+ thunkApi.dispatch(handleSetCountryByIso2(data_1.entity.country));
83
+ _d.label = 3;
84
+ case 3:
101
85
  if (data.step_name === PASSWORD_STEP_NAMES.PHONE_AUTH) {
102
86
  thunkApi.dispatch(handleCurrentActiveScreen('PASSWORD_VERIFY_STEP'));
103
87
  }
104
- else if (hasPasswordCompleted) {
88
+ else if (board_info_password_status === 'completed') {
105
89
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
106
90
  }
107
91
  else if (data.step_name === PASSWORD_STEP_NAMES.PASSWORD_INFO) {
108
92
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
109
93
  }
110
- _j.label = 8;
111
- case 8: return [2, {
112
- data: data,
113
- individualData: individualData,
114
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: (boardStatusData === null || boardStatusData === void 0 ? void 0 : boardStatusData.info) || [], user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names, contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
115
- token: token
116
- }];
94
+ return [2, { data: data, token: token }];
117
95
  }
118
96
  });
119
97
  }); });
@@ -134,54 +112,74 @@ export var resendOTP = createAsyncThunk('resendOTPPassword', function (params, t
134
112
  }
135
113
  });
136
114
  }); });
137
- export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
138
- var data;
139
- var _a, _b;
140
- return __generator(this, function (_c) {
141
- switch (_c.label) {
142
- case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
143
- case 1:
144
- data = _c.sent();
145
- return [2, {
146
- data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, individuals: data === null || data === void 0 ? void 0 : data.individuals, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
147
- }];
148
- }
115
+ export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails', function (_a) {
116
+ var boardId = _a.boardId, id = _a.individualId, type = _a.individualType;
117
+ return __awaiter(void 0, void 0, void 0, function () {
118
+ var data, individualData, boardData, serviceCallBack, _b, boardRes, individualRes;
119
+ var _c, _d, _e;
120
+ return __generator(this, function (_f) {
121
+ switch (_f.label) {
122
+ case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
123
+ case 1:
124
+ data = _f.sent();
125
+ individualData = data === null || data === void 0 ? void 0 : data.user;
126
+ boardData = data;
127
+ if (!(((_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.id) !== id && id)) return [3, 3];
128
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id, type); };
129
+ return [4, retrieveIndividualData(type, data, serviceCallBack)];
130
+ case 2:
131
+ _b = _f.sent(), boardRes = _b.boardRes, individualRes = _b.individualRes;
132
+ individualData = individualRes;
133
+ boardData = boardRes;
134
+ _f.label = 3;
135
+ case 3: return [2, __assign(__assign({}, boardData), { brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact, user: individualData })];
136
+ }
137
+ });
149
138
  });
150
- }); });
139
+ });
151
140
  export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
152
- var _a, password, settings, responseBody, payload, data, publicKey, flows, hasPasswordCompleted;
153
- var _b, _c, _d, _e, _f;
154
- return __generator(this, function (_g) {
155
- switch (_g.label) {
141
+ var _a, password, settings, responseBody, payload, data, _b, config, board_info_password_status, country_code, board_id, countryIso2, publicKey, data_2;
142
+ var _c, _d, _e, _f, _g;
143
+ return __generator(this, function (_h) {
144
+ switch (_h.label) {
156
145
  case 0:
157
146
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
158
147
  responseBody = password.data.verify.responseBody;
159
148
  payload = {
160
149
  data: params.otp,
161
- service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
150
+ service_name: (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _c === void 0 ? void 0 : _c.service_name,
162
151
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
163
152
  step_name: PASSWORD_STEP_NAMES.PHONE_AUTH,
164
153
  encryption_contract: ['data']
165
154
  };
166
155
  return [4, API.leadService.verifyLeadOTP(payload)];
167
156
  case 1:
168
- data = (_g.sent()).data;
169
- if (!data.errors) {
170
- publicKey = (_c = data === null || data === void 0 ? void 0 : data.config) === null || _c === void 0 ? void 0 : _c.public_key;
171
- if (publicKey) {
172
- thunkApi.dispatch(handlePublicKey(publicKey));
173
- }
174
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
175
- flows = (responseBody || {}).flows;
176
- hasPasswordCompleted = ((_f = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'password'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
177
- if (hasPasswordCompleted) {
178
- thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
179
- }
180
- else {
181
- thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
182
- }
183
- }
184
- return [2, { data: data, formData: __assign({}, params) }];
157
+ data = (_h.sent()).data;
158
+ if ((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length)
159
+ throw new Error(data.errors[0].description);
160
+ _b = data || {}, config = _b.config, board_info_password_status = _b.board_info_password_status, country_code = _b.country_code, board_id = _b.board_id;
161
+ countryIso2 = country_code;
162
+ if (countryIso2)
163
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
164
+ publicKey = config === null || config === void 0 ? void 0 : config.public_key;
165
+ if (publicKey)
166
+ thunkApi.dispatch(handlePublicKey(publicKey));
167
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
168
+ if (!(board_info_password_status === 'completed')) return [3, 2];
169
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
170
+ return [3, 5];
171
+ case 2:
172
+ if (!!country_code) return [3, 4];
173
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
174
+ case 3:
175
+ data_2 = _h.sent();
176
+ if ((_g = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _g === void 0 ? void 0 : _g.country)
177
+ thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
178
+ _h.label = 4;
179
+ case 4:
180
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
181
+ _h.label = 5;
182
+ case 5: return [2, { data: data, formData: __assign({}, params) }];
185
183
  }
186
184
  });
187
185
  }); });
@@ -208,89 +206,101 @@ export var createPassword = createAsyncThunk('createPassword', function (params,
208
206
  });
209
207
  }); });
210
208
  export var updateBoardSuccess = createAsyncThunk('passwordUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
211
- var _a, settings, password, _b, id, infoId, _c, showBoard, mode, payload, data, boardInfoData;
212
- var _d, _e, _f, _g, _h, _j, _k, _l;
213
- return __generator(this, function (_m) {
214
- switch (_m.label) {
209
+ var _a, settings, password, _b, board_id, infoId, _c, showBoard, mode, payload, data, _d, id, type, boardInfoStatusData;
210
+ var _e, _f, _g, _h, _j, _k, _l, _m, _o;
211
+ return __generator(this, function (_p) {
212
+ switch (_p.label) {
215
213
  case 0:
216
214
  _a = thunkApi.getState(), settings = _a.settings, password = _a.password;
217
- _b = password.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id;
215
+ _b = password.data.verify.responseBody || {}, board_id = _b.board_id, infoId = _b.board_info_id;
218
216
  _c = settings.data.appConfig, showBoard = _c.showBoard, mode = _c.mode;
219
- if (!id)
217
+ if (!board_id)
220
218
  return [2];
221
219
  payload = {
222
220
  lang: settings.data.language,
223
- step_name: PASSWORD_STEP_NAMES.PASSWORD_SUCCESS,
224
- id: id
221
+ step_name: PASSWORD_STEP_NAMES.PASSWORD_SUCCESS
225
222
  };
226
- return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
223
+ return [4, API.boardService.updateBoardInfo(__assign({ id: board_id, infoId: infoId }, payload))];
227
224
  case 1:
228
- data = _m.sent();
225
+ data = _p.sent();
229
226
  if (!showBoard && mode === 'content') {
230
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
231
- (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: data });
232
- return [2, { response: __assign({}, data), formData: params }];
227
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
228
+ (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
229
+ return [2, { data: data }];
233
230
  }
234
- return [4, API.boardService.retrieveBoardInfoStatus(id)];
231
+ _d = ((_j = data === null || data === void 0 ? void 0 : data.notification) === null || _j === void 0 ? void 0 : _j.recipient) || {}, id = _d.id, type = _d.type;
232
+ return [4, Promise.all([
233
+ API.boardService.retrieveBoardInfoStatus(board_id),
234
+ thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type })).unwrap()
235
+ ])];
235
236
  case 2:
236
- boardInfoData = _m.sent();
237
- return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
238
- case 3:
239
- _m.sent();
240
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, {});
241
- (_l = (_k = settings.data.appConfig).onFlowCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, { data: data });
237
+ boardInfoStatusData = (_p.sent())[0];
238
+ (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, {});
239
+ (_o = (_m = settings.data.appConfig).onFlowCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, { data: data });
242
240
  thunkApi.dispatch(handleNextScreenStep());
243
- return [2, { response: __assign(__assign({}, data), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [] }), formData: params }];
241
+ return [2, { data: data, flows: (boardInfoStatusData === null || boardInfoStatusData === void 0 ? void 0 : boardInfoStatusData.info) || [] }];
242
+ }
243
+ });
244
+ }); });
245
+ export var retrieveBoardStatus = createAsyncThunk('password/retrieveBoardStatus', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
246
+ var password, _a, board_id, board_info_id, recipient, _b, id, type, data;
247
+ return __generator(this, function (_c) {
248
+ switch (_c.label) {
249
+ case 0:
250
+ password = thunkApi.getState().password;
251
+ _a = password.data.verify.responseBody || {}, board_id = _a.board_id, board_info_id = _a.board_info_id, recipient = _a.recipient;
252
+ if (!board_id || !board_info_id)
253
+ throw new Error('Internal server error');
254
+ _b = recipient || {}, id = _b.id, type = _b.type;
255
+ return [4, Promise.all([
256
+ API.boardService.retrieveBoardInfoStatus(board_id),
257
+ thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type })).unwrap()
258
+ ])];
259
+ case 1:
260
+ data = (_c.sent())[0];
261
+ thunkApi.dispatch(handlePrevScreenStep());
262
+ return [2, { flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
244
263
  }
245
264
  });
246
265
  }); });
247
266
  export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
248
- var token, boardId, boardInfoId, boardInfoData, boardStatusData, individualData, boardData, payload, data, _a, id_2, type_2, serviceCallBack, _b, boardRes, individualRes;
249
- var _c, _d, _e;
250
- return __generator(this, function (_f) {
251
- switch (_f.label) {
267
+ var token, boardId, boardInfoId, userId, userType, payload, data, countryIso2, publicKey, data_3;
268
+ var _a, _b, _c;
269
+ return __generator(this, function (_d) {
270
+ switch (_d.label) {
252
271
  case 0:
253
- token = params.token, boardId = params.boardId, boardInfoId = params.boardInfoId;
254
- boardData = undefined;
272
+ token = params.token, boardId = params.boardId, boardInfoId = params.boardInfoId, userId = params.userId, userType = params.userType;
255
273
  payload = {
256
274
  auth_type: 7,
257
275
  auth_token: token
258
276
  };
259
277
  return [4, API.authService.verifyAuth(payload)];
260
278
  case 1:
261
- data = (_f.sent()).data;
262
- if (!boardId) return [3, 7];
263
- return [4, API.boardService.retrieveBoardInfoStatus(boardId)];
264
- case 2:
265
- boardStatusData = _f.sent();
279
+ data = (_d.sent()).data;
280
+ if ((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a.length)
281
+ throw new Error(data.errors[0].description);
282
+ countryIso2 = data === null || data === void 0 ? void 0 : data.country;
283
+ if (countryIso2)
284
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
285
+ publicKey = (_b = data === null || data === void 0 ? void 0 : data.config) === null || _b === void 0 ? void 0 : _b.public_key;
286
+ if (publicKey)
287
+ thunkApi.dispatch(handlePublicKey(publicKey));
288
+ if (!!(data === null || data === void 0 ? void 0 : data.country)) return [3, 3];
266
289
  return [4, API.boardService.retrieveBoardDetails(boardId)];
290
+ case 2:
291
+ data_3 = _d.sent();
292
+ if ((_c = data_3 === null || data_3 === void 0 ? void 0 : data_3.entity) === null || _c === void 0 ? void 0 : _c.country)
293
+ thunkApi.dispatch(handleSetCountryByIso2(data_3.entity.country));
294
+ _d.label = 3;
267
295
  case 3:
268
- boardData = _f.sent();
269
- if (!boardInfoId) return [3, 5];
270
- return [4, API.boardService.retrieveBoardInfo({ id: boardId, infoId: boardInfoId })];
271
- case 4:
272
- boardInfoData = _f.sent();
273
- _f.label = 5;
274
- case 5:
275
- _a = ((_c = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _c === void 0 ? void 0 : _c.recipient) || {}, id_2 = _a.id, type_2 = _a.type;
276
- serviceCallBack = function () { return API.individualService.retrieveIndividual(id_2, type_2); };
277
- return [4, retrieveIndividualData(type_2, boardData, serviceCallBack)];
278
- case 6:
279
- _b = _f.sent(), boardRes = _b.boardRes, individualRes = _b.individualRes;
280
- boardData = boardRes;
281
- individualData = individualRes;
282
- _f.label = 7;
283
- case 7:
284
296
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
285
- return [2, {
286
- data: data,
287
- token: token,
288
- boardId: boardId,
289
- boardInfoId: boardInfoId,
290
- individualData: individualData,
291
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names, contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
292
- flows: (boardStatusData === null || boardStatusData === void 0 ? void 0 : boardStatusData.info) || []
293
- }];
297
+ return [2, __assign({ data: data, token: token, boardId: boardId, boardInfoId: boardInfoId }, (userId &&
298
+ userType && {
299
+ recipient: {
300
+ id: userId,
301
+ type: userType
302
+ }
303
+ }))];
294
304
  }
295
305
  });
296
306
  }); });
@@ -313,9 +323,9 @@ export var resendOperationOTP = createAsyncThunk('resendOperationOTPPassword', f
313
323
  }); });
314
324
  export var resetPassword = createAsyncThunk('resetPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
315
325
  var _a, password, settings, responseBody, passwordData, payload, data;
316
- var _b, _c;
317
- return __generator(this, function (_d) {
318
- switch (_d.label) {
326
+ var _b, _c, _d;
327
+ return __generator(this, function (_e) {
328
+ switch (_e.label) {
319
329
  case 0:
320
330
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
321
331
  responseBody = password.data.verify.responseBody;
@@ -332,39 +342,42 @@ export var resetPassword = createAsyncThunk('resetPassword', function (params, t
332
342
  };
333
343
  return [4, API.authService.verifyAuth(payload)];
334
344
  case 1:
335
- data = (_d.sent()).data;
345
+ data = (_e.sent()).data;
346
+ if ((_b = data === null || data === void 0 ? void 0 : data.errors) === null || _b === void 0 ? void 0 : _b.length)
347
+ throw new Error(data.errors[0].description);
336
348
  if (!(data === null || data === void 0 ? void 0 : data.errors)) {
337
349
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP'));
338
- (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, payload);
350
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, payload);
339
351
  }
340
352
  return [2, { data: data, formData: __assign(__assign({}, params), passwordData) }];
341
353
  }
342
354
  });
343
355
  }); });
344
356
  export var retrieveBoardResetPasswordSuccess = createAsyncThunk('retrieveBoardResetPasswordSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
345
- var _a, password, settings, _b, id, boardResponse, _c, showBoard, mode, boardInfoData;
346
- var _d, _e, _f, _g, _h, _j, _k, _l;
347
- return __generator(this, function (_m) {
348
- switch (_m.label) {
357
+ var _a, password, settings, _b, board_id, boardResponse, recipient, _c, showBoard, mode, _d, id, type, data;
358
+ var _e, _f, _g, _h, _j, _k, _l, _m;
359
+ return __generator(this, function (_o) {
360
+ switch (_o.label) {
349
361
  case 0:
350
362
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
351
- _b = password.data.verify.responseBody || { board_id: '' }, id = _b.board_id, boardResponse = _b.boardResponse;
363
+ _b = password.data.verify.responseBody || { board_id: '' }, board_id = _b.board_id, boardResponse = _b.boardResponse, recipient = _b.recipient;
352
364
  _c = settings.data.appConfig, showBoard = _c.showBoard, mode = _c.mode;
353
365
  if (!showBoard && mode === 'content') {
354
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
355
- (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: boardResponse });
356
- return [2, { id: id, response: {} }];
366
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
367
+ (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: boardResponse });
368
+ return [2, { id: board_id, flows: [] }];
357
369
  }
358
- return [4, API.boardService.retrieveBoardInfoStatus(id)];
370
+ _d = recipient || {}, id = _d.id, type = _d.type;
371
+ return [4, Promise.all([
372
+ API.boardService.retrieveBoardInfoStatus(board_id),
373
+ thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: type })).unwrap()
374
+ ])];
359
375
  case 1:
360
- boardInfoData = _m.sent();
361
- return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
362
- case 2:
363
- _m.sent();
376
+ data = (_o.sent())[0];
364
377
  thunkApi.dispatch(handleNextScreenStep());
365
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { id: id });
366
- (_l = (_k = settings.data.appConfig).onFlowCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, id);
367
- return [2, { id: id, response: { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [] } }];
378
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, { id: id });
379
+ (_m = (_l = settings.data.appConfig).onFlowCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, board_id);
380
+ return [2, { id: board_id, flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
368
381
  }
369
382
  });
370
383
  }); });
@@ -419,17 +432,11 @@ export var passwordSlice = createSlice({
419
432
  extraReducers: function (builder) {
420
433
  builder
421
434
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
422
- var _a;
423
435
  state.data.verify.operationType = PASSWORD_OPERATION_TYPE.SET_PASSWORD;
424
436
  state.error = null;
425
437
  state.customLoading = false;
426
- var _b = action.payload, data = _b.data, token = _b.token, boardResponse = _b.boardResponse;
427
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
428
- if (description) {
429
- state.error = description;
430
- return;
431
- }
432
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
438
+ var _a = action.payload, data = _a.data, token = _a.token;
439
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: data.id });
433
440
  state.data.verify.token = token;
434
441
  })
435
442
  .addCase(verifyLeadToken.pending, function (state) {
@@ -462,17 +469,12 @@ export var passwordSlice = createSlice({
462
469
  state.error = null;
463
470
  })
464
471
  .addCase(verifyPasswordLeadOTP.fulfilled, function (state, action) {
465
- var _a;
466
472
  state.loading = false;
467
473
  state.error = null;
468
- var _b = action.payload, data = _b.data, formData = _b.formData;
469
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
470
- if (description) {
471
- state.error = description;
472
- return;
473
- }
474
+ var _a = action.payload, data = _a.data, formData = _a.formData;
474
475
  state.data.otpData = formData;
475
476
  state.data.otpData.responseBody = data;
477
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: data.id });
476
478
  })
477
479
  .addCase(verifyPasswordLeadOTP.rejected, function (state, action) {
478
480
  state.loading = false;
@@ -506,7 +508,7 @@ export var passwordSlice = createSlice({
506
508
  .addCase(retrieveBoardDetails.fulfilled, function (state, action) {
507
509
  state.error = null;
508
510
  state.loading = false;
509
- var data = (action.payload || {}).data;
511
+ var data = action.payload || {};
510
512
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
511
513
  })
512
514
  .addCase(retrieveBoardDetails.rejected, function (state, action) {
@@ -514,15 +516,11 @@ export var passwordSlice = createSlice({
514
516
  state.loading = false;
515
517
  })
516
518
  .addCase(updateBoardSuccess.fulfilled, function (state, action) {
519
+ var _a;
517
520
  state.loading = false;
518
521
  state.error = null;
519
- var response = (action.payload || {}).response;
520
- var flows = response.flows;
521
- var _a = state.data.verify.responseBody || {}, individuals = _a.individuals, individualData = _a.individualData;
522
- var data_state = (individualData || {}).data_state;
523
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { user: individualData })), (data_state && {
524
- individuals: __assign(__assign({}, individuals), { data_state: data_state })
525
- }));
522
+ var _b = action.payload || {}, flows = _b.flows, data = _b.data;
523
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, recipient: (_a = data === null || data === void 0 ? void 0 : data.notification) === null || _a === void 0 ? void 0 : _a.recipient });
526
524
  })
527
525
  .addCase(updateBoardSuccess.pending, function (state) {
528
526
  state.loading = true;
@@ -531,20 +529,27 @@ export var passwordSlice = createSlice({
531
529
  .addCase(updateBoardSuccess.rejected, function (state, action) {
532
530
  state.loading = false;
533
531
  state.error = action.error.message;
532
+ })
533
+ .addCase(retrieveBoardStatus.pending, function (state) {
534
+ state.error = null;
535
+ state.loading = true;
536
+ })
537
+ .addCase(retrieveBoardStatus.fulfilled, function (state, action) {
538
+ state.error = null;
539
+ state.loading = false;
540
+ var flows = (action.payload || {}).flows;
541
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
542
+ })
543
+ .addCase(retrieveBoardStatus.rejected, function (state, action) {
544
+ state.error = action.error.message;
545
+ state.loading = false;
534
546
  })
535
547
  .addCase(verifyOperationToken.fulfilled, function (state, action) {
536
- var _a;
537
548
  state.data.verify.operationType = PASSWORD_OPERATION_TYPE.RESET_PASSWORD;
538
549
  state.error = null;
539
550
  state.customLoading = false;
540
- var _b = action.payload, data = _b.data, token = _b.token, boardId = _b.boardId, flows = _b.flows, boardResponse = _b.boardResponse, boardInfoId = _b.boardInfoId;
541
- state.data.verify.responseBody = __assign(__assign(__assign({}, boardResponse), state.data.verify.responseBody), { board_id: boardId, board_info_id: boardInfoId, flows: flows });
542
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
543
- if (description) {
544
- state.error = description;
545
- return;
546
- }
547
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: boardId, board_info_id: boardInfoId, flows: flows });
551
+ var _a = action.payload, data = _a.data, token = _a.token, boardId = _a.boardId, boardInfoId = _a.boardInfoId, recipient = _a.recipient;
552
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), { board_id: boardId, board_info_id: boardInfoId }), (recipient && { recipient: recipient }));
548
553
  state.data.verify.token = token;
549
554
  })
550
555
  .addCase(verifyOperationToken.pending, function (state) {
@@ -573,16 +578,10 @@ export var passwordSlice = createSlice({
573
578
  state.error = action.error.message;
574
579
  })
575
580
  .addCase(resetPassword.fulfilled, function (state, action) {
576
- var _a;
577
581
  state.data.verify.operationType = PASSWORD_OPERATION_TYPE.RESET_PASSWORD;
578
582
  state.error = null;
579
583
  state.loading = false;
580
- var _b = action.payload, data = _b.data, formData = _b.formData;
581
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
582
- if (description) {
583
- state.error = description;
584
- return;
585
- }
584
+ var _a = action.payload, data = _a.data, formData = _a.formData;
586
585
  state.data.passwordData = formData;
587
586
  state.data.passwordData.responseBody = data;
588
587
  })
@@ -597,13 +596,8 @@ export var passwordSlice = createSlice({
597
596
  .addCase(retrieveBoardResetPasswordSuccess.fulfilled, function (state, action) {
598
597
  state.loading = false;
599
598
  state.error = null;
600
- var response = (action.payload || {}).response;
601
- var flows = response.flows;
602
- var _a = state.data.verify.responseBody || {}, individuals = _a.individuals, individualData = _a.individualData;
603
- var data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) ? individuals : individualData) || {}).data_state;
604
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { user: individualData })), (data_state && {
605
- individuals: __assign(__assign({}, individuals), { data_state: data_state })
606
- }));
599
+ var flows = (action.payload || {}).flows;
600
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
607
601
  })
608
602
  .addCase(retrieveBoardResetPasswordSuccess.pending, function (state) {
609
603
  state.loading = true;
@@ -99,7 +99,7 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
99
99
  case 6:
100
100
  if (!country_code && ((_e = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _e === void 0 ? void 0 : _e.country))
101
101
  thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
102
- thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
102
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP')); });
103
103
  _f.label = 7;
104
104
  case 7: return [2, {
105
105
  data: data,
@@ -469,10 +469,11 @@ export var taxSlice = createSlice({
469
469
  state.loading = false;
470
470
  })
471
471
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
472
+ var _a;
472
473
  state.loading = false;
473
474
  state.error = null;
474
- var _a = action.payload || {}, flows = _a.flows, data = _a.data;
475
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, notification: data === null || data === void 0 ? void 0 : data.notification, updateBoardSuccessLoading: false });
475
+ var _b = action.payload || {}, flows = _b.flows, data = _b.data;
476
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, recipient: (_a = data === null || data === void 0 ? void 0 : data.notification) === null || _a === void 0 ? void 0 : _a.recipient, updateBoardSuccessLoading: false });
476
477
  })
477
478
  .addCase(updateLeadSuccess.pending, function (state) {
478
479
  state.loading = true;