@tap-payments/auth-jsconnect 2.11.17-development → 2.11.18-development

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 (30) hide show
  1. package/build/api/auth.d.ts +1 -1
  2. package/build/api/auth.js +7 -3
  3. package/build/api/index.d.ts +1 -1
  4. package/build/assets/locales/ar.json +1 -0
  5. package/build/assets/locales/en.json +3 -2
  6. package/build/constants/app.js +101 -15
  7. package/build/constants/flows.d.ts +1 -0
  8. package/build/constants/flows.js +2 -1
  9. package/build/features/app/auth/authStore.js +50 -40
  10. package/build/features/app/bank/bankStore.js +24 -20
  11. package/build/features/app/board/boardStore.js +11 -7
  12. package/build/features/app/brand/brandStore.js +22 -18
  13. package/build/features/app/business/businessStore.js +30 -26
  14. package/build/features/app/connect/connectStore.js +26 -22
  15. package/build/features/app/connectExpress/connectExpressStore.js +19 -7
  16. package/build/features/app/entity/entityStore.js +21 -17
  17. package/build/features/app/individual/individualStore.js +29 -25
  18. package/build/features/app/password/passwordStore.js +44 -46
  19. package/build/features/app/signIn/signInStore.js +12 -16
  20. package/build/features/app/tax/taxStore.js +20 -16
  21. package/build/features/app/terminal/terminalStore.js +5 -3
  22. package/build/features/featuresScreens.js +60 -0
  23. package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.d.ts +3 -0
  24. package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.js +9 -0
  25. package/build/features/shared/OTPVerifySecurityError/index.d.ts +2 -0
  26. package/build/features/shared/OTPVerifySecurityError/index.js +2 -0
  27. package/build/features/terminal/screens/Verify/Verify.js +6 -2
  28. package/build/utils/error.d.ts +1 -0
  29. package/build/utils/error.js +3 -0
  30. package/package.json +1 -1
@@ -51,7 +51,7 @@ import API from '../../../api';
51
51
  import { DocumentPurpose, FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
53
53
  import { BANK_STEP_NAMES } from '../../../constants';
54
- import { hasNoneEditableValue, isStringHasOneAsterisk, retrieveIndividualData, sendCustomEventToGTM, sleep } from '../../../utils';
54
+ import { hasNoneEditableValue, isAuthenticationVerificationFailed, isStringHasOneAsterisk, retrieveIndividualData, sendCustomEventToGTM, sleep } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
@@ -103,9 +103,9 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
103
103
  _j.label = 6;
104
104
  case 6:
105
105
  if (isInternally)
106
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
106
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP')); });
107
107
  else
108
- thunkApi.dispatch(handleNextScreenStep());
108
+ thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
109
109
  _j.label = 7;
110
110
  case 7: return [2, {
111
111
  data: data,
@@ -135,9 +135,9 @@ export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunk
135
135
  }); });
136
136
  export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
137
137
  var _a, bank, settings, responseBody, payload, data, countryIso2, publicKey, _b, bank_account_id, wallet_id, boardId, bankData, data_2;
138
- var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
139
- return __generator(this, function (_o) {
140
- switch (_o.label) {
138
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l;
139
+ return __generator(this, function (_m) {
140
+ switch (_m.label) {
141
141
  case 0:
142
142
  _a = thunkApi.getState(), bank = _a.bank, settings = _a.settings;
143
143
  responseBody = bank.data.verify.responseBody;
@@ -148,13 +148,15 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
148
148
  step_name: BANK_STEP_NAMES.PHONE_AUTH,
149
149
  encryption_contract: ['data']
150
150
  };
151
- return [4, API.leadService.verifyLeadOTP(payload)];
151
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
152
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
153
+ thunkApi.dispatch(handleNextScreenStep('BANK_OTP_VERIFY_SECURITY_ERROR_STEP'));
154
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
155
+ })];
152
156
  case 1:
153
- data = (_o.sent()).data;
154
- if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
155
- throw new Error(data.errors[0].description);
157
+ data = _m.sent();
156
158
  countryIso2 = (data === null || data === void 0 ? void 0 : data.country_code) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
157
- publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
159
+ publicKey = (_d = data === null || data === void 0 ? void 0 : data.config) === null || _d === void 0 ? void 0 : _d.public_key;
158
160
  if (countryIso2)
159
161
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
160
162
  if (publicKey)
@@ -164,10 +166,10 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
164
166
  if (!(!wallet_id || !countryIso2)) return [3, 3];
165
167
  return [4, API.boardService.retrieveBoardDetails(boardId)];
166
168
  case 2:
167
- data_2 = _o.sent();
168
- if (!countryIso2 && ((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _f === void 0 ? void 0 : _f.country))
169
+ data_2 = _m.sent();
170
+ if (!countryIso2 && ((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.country))
169
171
  thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
170
- if (!((_k = (_j = (_h = (_g = data_2 === null || data_2 === void 0 ? void 0 : data_2.business) === null || _g === void 0 ? void 0 : _g.entity) === null || _h === void 0 ? void 0 : _h.merchant) === null || _j === void 0 ? void 0 : _j.wallet) === null || _k === void 0 ? void 0 : _k.id))
172
+ if (!((_j = (_h = (_g = (_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.business) === null || _f === void 0 ? void 0 : _f.entity) === null || _g === void 0 ? void 0 : _g.merchant) === null || _h === void 0 ? void 0 : _h.wallet) === null || _j === void 0 ? void 0 : _j.id))
171
173
  throw new Error('wallet_id_missing');
172
174
  if (data_2 === null || data_2 === void 0 ? void 0 : data_2.bank_account)
173
175
  bankData = data_2.bank_account;
@@ -176,11 +178,11 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
176
178
  if (!bank_account_id) return [3, 5];
177
179
  return [4, API.entityService.retrieveBankAccount(bank_account_id)];
178
180
  case 4:
179
- bankData = _o.sent();
180
- _o.label = 5;
181
+ bankData = _m.sent();
182
+ _m.label = 5;
181
183
  case 5:
182
- (_m = (_l = settings.data.appConfig).onStepCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, settings.data.activeScreen.name, { otp: params.otp });
183
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
184
+ (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, { otp: params.otp });
185
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP')); });
184
186
  return [2, {
185
187
  data: data,
186
188
  bankData: bankData,
@@ -469,9 +471,11 @@ export var bankSlice = createSlice({
469
471
  state.data.bankData.confirmPolicy = is_acknowledged;
470
472
  state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { bank_account: bank_account, board_id: data.id });
471
473
  })
472
- .addCase(verifyBankLeadOTP.rejected, function (state, action) {
474
+ .addCase(verifyBankLeadOTP.rejected, function (state, _a) {
475
+ var message = _a.error.message;
473
476
  state.loading = false;
474
- state.error = action.error.message;
477
+ if (!isAuthenticationVerificationFailed(message))
478
+ state.error = message;
475
479
  })
476
480
  .addCase(retrieveBoardDetails.pending, function (state) {
477
481
  state.error = null;
@@ -51,7 +51,7 @@ import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BOARD_STEP_STEPS } from '../../../constants';
54
- import { retrieveIndividualData, sleep } from '../../../utils';
54
+ import { isAuthenticationVerificationFailed, retrieveIndividualData, sleep } from '../../../utils';
55
55
  export var createVerifyTokenBy = createAsyncThunk('board/createVerifyTokenByBoardId', function (_a, thunkApi) {
56
56
  var boardId = _a.boardId, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
@@ -129,17 +129,19 @@ export var verifyBoardLeadOTP = createAsyncThunk('board/verifyBoardLeadOTP', fun
129
129
  step_name: BOARD_STEP_STEPS.PHONE_AUTH,
130
130
  encryption_contract: ['data']
131
131
  };
132
- return [4, API.leadService.verifyLeadOTP(payload)];
132
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
133
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
134
+ thunkApi.dispatch(handleNextScreenStep('BOARD_OTP_VERIFY_SECURITY_ERROR_STEP'));
135
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
136
+ })];
133
137
  case 1:
134
- data = (_j.sent()).data;
138
+ data = _j.sent();
135
139
  _b = data || {}, country_code = _b.country_code, config = _b.config;
136
140
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
137
141
  if (country_code)
138
142
  thunkApi.dispatch(handleSetCountryByIso2(country_code));
139
143
  if (publicKey)
140
144
  thunkApi.dispatch(handlePublicKey(publicKey));
141
- if (data.errors)
142
- throw new Error(data.errors[0].description);
143
145
  return [4, thunkApi.dispatch(retrieveBoardDetails({ boardId: data.id, boardInfoId: data.board_info_id })).unwrap()];
144
146
  case 2:
145
147
  boardData = (_j.sent()).data;
@@ -249,9 +251,11 @@ export var boardSlice = createSlice({
249
251
  state.data.otpData = formData;
250
252
  state.data.otpData.responseBody = data;
251
253
  })
252
- .addCase(verifyBoardLeadOTP.rejected, function (state, action) {
254
+ .addCase(verifyBoardLeadOTP.rejected, function (state, _a) {
255
+ var message = _a.error.message;
253
256
  state.loading = false;
254
- state.error = action.error.message;
257
+ if (!isAuthenticationVerificationFailed(message))
258
+ state.error = message;
255
259
  })
256
260
  .addCase(retrieveBoardDetails.pending, function (state) {
257
261
  state.error = null;
@@ -62,7 +62,7 @@ import API from '../../../api';
62
62
  import { FlowsTypes } from '../../../@types';
63
63
  import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
64
64
  import { BRAND_STEP_NAMES, EXPECTED_SALES_LIST } from '../../../constants';
65
- import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retrieveIndividualData, sendCustomEventToGTM, sleep } from '../../../utils';
65
+ import { hasNoneEditableValue, isAuthenticationVerificationFailed, isKW, isTwitter, isWebsite, mapSalesChannel, retrieveIndividualData, sendCustomEventToGTM, sleep } from '../../../utils';
66
66
  export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', function (_a, thunkApi) {
67
67
  var token = _a.token, isInternally = _a.isInternally;
68
68
  return __awaiter(void 0, void 0, void 0, function () {
@@ -143,9 +143,9 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
143
143
  }); });
144
144
  export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
145
145
  var _a, brand, settings, responseBody, payload, data, publicKey, countryIso2, _b, brand_id, entity_id, boardId, brandData, data_2, salesChannels;
146
- var _c, _d, _e, _f, _g, _h, _j;
147
- return __generator(this, function (_k) {
148
- switch (_k.label) {
146
+ var _c, _d, _e, _f, _g, _h;
147
+ return __generator(this, function (_j) {
148
+ switch (_j.label) {
149
149
  case 0:
150
150
  _a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
151
151
  responseBody = brand.data.verify.responseBody;
@@ -156,12 +156,14 @@ export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function
156
156
  step_name: BRAND_STEP_NAMES.PHONE_AUTH,
157
157
  encryption_contract: ['data']
158
158
  };
159
- return [4, API.leadService.verifyLeadOTP(payload)];
159
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
160
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
161
+ thunkApi.dispatch(handleNextScreenStep('BRAND_OTP_VERIFY_SECURITY_ERROR_STEP'));
162
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
163
+ })];
160
164
  case 1:
161
- data = (_k.sent()).data;
162
- if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
163
- throw new Error(data.errors[0].description);
164
- publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
165
+ data = _j.sent();
166
+ publicKey = (_d = data === null || data === void 0 ? void 0 : data.config) === null || _d === void 0 ? void 0 : _d.public_key;
165
167
  countryIso2 = (data === null || data === void 0 ? void 0 : data.country_code) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
166
168
  if (publicKey)
167
169
  thunkApi.dispatch(handlePublicKey(publicKey));
@@ -172,21 +174,21 @@ export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function
172
174
  if (!(!brand_id || !countryIso2)) return [3, 3];
173
175
  return [4, API.boardService.retrieveBoardDetails(boardId)];
174
176
  case 2:
175
- data_2 = _k.sent();
176
- if (!countryIso2 && ((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _f === void 0 ? void 0 : _f.country))
177
+ data_2 = _j.sent();
178
+ if (!countryIso2 && ((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.country))
177
179
  thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
178
- if (!((_g = data_2 === null || data_2 === void 0 ? void 0 : data_2.brand) === null || _g === void 0 ? void 0 : _g.id))
180
+ if (!((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.brand) === null || _f === void 0 ? void 0 : _f.id))
179
181
  throw new Error('brand_id_missing');
180
182
  brandData = data_2;
181
183
  return [3, 5];
182
184
  case 3: return [4, API.brandService.retrieveBrand(brand_id)];
183
185
  case 4:
184
- brandData = _k.sent();
185
- _k.label = 5;
186
+ brandData = _j.sent();
187
+ _j.label = 5;
186
188
  case 5: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
187
189
  case 6:
188
- salesChannels = _k.sent();
189
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
190
+ salesChannels = _j.sent();
191
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
190
192
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
191
193
  return [2, {
192
194
  data: data,
@@ -682,9 +684,11 @@ export var brandSlice = createSlice({
682
684
  state.data.brandActivities.refundPolicy = termFlag;
683
685
  state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { brand: brand, board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], salesChannels: mappedSalesChannels, entityInfoId: entityInfoId });
684
686
  })
685
- .addCase(verifyBrandLeadOTP.rejected, function (state, action) {
687
+ .addCase(verifyBrandLeadOTP.rejected, function (state, _a) {
688
+ var message = _a.error.message;
686
689
  state.loading = false;
687
- state.error = action.error.message;
690
+ if (!isAuthenticationVerificationFailed(message))
691
+ state.error = message;
688
692
  })
689
693
  .addCase(checkBrandNameAvailability.fulfilled, function (state, action) {
690
694
  var _a;
@@ -59,7 +59,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import API from '../../../api';
60
60
  import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
61
61
  import { BUSINESS_STEP_NAMES, COLLECT_DOB_INFO_NAFATH, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE, defaultCountry } from '../../../constants';
62
- import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue, sendCustomEventToGTM, findCountryByIddPrefix, isNetworkError, isTimeoutError } from '../../../utils';
62
+ import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue, sendCustomEventToGTM, findCountryByIddPrefix, isNetworkError, isTimeoutError, isAuthenticationVerificationFailed } from '../../../utils';
63
63
  import { handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
65
65
  var payload, data, publicKey, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
@@ -198,9 +198,9 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
198
198
  }); });
199
199
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
200
200
  var _a, business, settings, isNID, responseBody, stepName, payload, data, publicKey, brandData, isicActivityList, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, boardResponse, list, list;
201
- var _b, _c, _d, _e, _f, _g, _h, _j;
202
- return __generator(this, function (_k) {
203
- switch (_k.label) {
201
+ var _b, _c, _d, _e, _f, _g, _h;
202
+ return __generator(this, function (_j) {
203
+ switch (_j.label) {
204
204
  case 0:
205
205
  _a = thunkApi.getState(), business = _a.business, settings = _a.settings;
206
206
  isNID = business.data.otpData.isNID;
@@ -213,26 +213,28 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
213
213
  step_name: stepName,
214
214
  encryption_contract: ['data']
215
215
  };
216
- return [4, API.leadService.verifyLeadOTP(payload)];
216
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
217
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
218
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_OTP_VERIFY_SECURITY_ERROR_STEP'));
219
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
220
+ })];
217
221
  case 1:
218
- data = (_k.sent()).data;
219
- if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
220
- throw new Error(data.errors[0].description);
221
- publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
222
+ data = _j.sent();
223
+ publicKey = (_f = data === null || data === void 0 ? void 0 : data.config) === null || _f === void 0 ? void 0 : _f.public_key;
222
224
  if (publicKey) {
223
225
  thunkApi.dispatch(handlePublicKey(publicKey));
224
226
  }
225
227
  isicActivityList = undefined;
226
228
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
227
229
  case 2:
228
- leadData = (_k.sent()).data;
230
+ leadData = (_j.sent()).data;
229
231
  thunkApi.dispatch(updateStepName(stepName));
230
232
  brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id, business_id = leadData.business_id, entity = leadData.entity;
231
233
  brandID = brand === null || brand === void 0 ? void 0 : brand.id;
232
234
  countryIso2 = country_code;
233
235
  if (countryIso2)
234
236
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
235
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
237
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
236
238
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
237
239
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
238
240
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
@@ -241,14 +243,14 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
241
243
  if (!(!isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 4];
242
244
  return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
243
245
  case 3:
244
- _k.sent();
245
- _k.label = 4;
246
+ _j.sent();
247
+ _j.label = 4;
246
248
  case 4:
247
249
  if (!(isSA(countryIso2) && !isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 6];
248
250
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
249
251
  case 5:
250
- _k.sent();
251
- _k.label = 6;
252
+ _j.sent();
253
+ _j.label = 6;
252
254
  case 6:
253
255
  if (!isNID) return [3, 7];
254
256
  thunkApi.dispatch(handleNextScreenStep());
@@ -262,12 +264,12 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
262
264
  if (!board_id) return [3, 11];
263
265
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
264
266
  case 9:
265
- boardResponse = _k.sent();
267
+ boardResponse = _j.sent();
266
268
  leadData = __assign(__assign({}, leadData), { flows: (boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || [] });
267
269
  return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
268
270
  case 10:
269
- _k.sent();
270
- _k.label = 11;
271
+ _j.sent();
272
+ _j.label = 11;
271
273
  case 11:
272
274
  sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP')); });
273
275
  return [3, 23];
@@ -287,30 +289,30 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
287
289
  if (!hasBusinessCRActivitiesCompleted) return [3, 19];
288
290
  return [4, API.dataService.getActivitiesIsIc()];
289
291
  case 16:
290
- list = (_k.sent()).list;
292
+ list = (_j.sent()).list;
291
293
  isicActivityList = list || [];
292
294
  return [4, thunkApi.dispatch(retrieveDataList())];
293
295
  case 17:
294
- _k.sent();
296
+ _j.sent();
295
297
  return [4, API.brandService.retrieveBrand(brandID)];
296
298
  case 18:
297
- brandData = _k.sent();
299
+ brandData = _j.sent();
298
300
  sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP')); });
299
301
  return [3, 23];
300
302
  case 19:
301
303
  if (!hasBusinessCRInfoCompleted) return [3, 22];
302
304
  return [4, API.dataService.getActivitiesIsIc()];
303
305
  case 20:
304
- list = (_k.sent()).list;
306
+ list = (_j.sent()).list;
305
307
  isicActivityList = list || [];
306
308
  return [4, API.brandService.retrieveBrand(brandID)];
307
309
  case 21:
308
- brandData = _k.sent();
310
+ brandData = _j.sent();
309
311
  sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP')); });
310
312
  return [3, 23];
311
313
  case 22:
312
314
  sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP')); });
313
- _k.label = 23;
315
+ _j.label = 23;
314
316
  case 23: return [2, { data: data, verifyNextStepName: data.step_name, isicActivityList: isicActivityList, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
315
317
  }
316
318
  });
@@ -1135,9 +1137,11 @@ export var businessSlice = createSlice({
1135
1137
  var licenseList = [OTHER_CR_LICENSE, OTHER_FL_LICENSE];
1136
1138
  state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList }), (!((_e = (_d = (_c = state.data.businessTypeData) === null || _c === void 0 ? void 0 : _c.responseBody) === null || _d === void 0 ? void 0 : _d.licenseList) === null || _e === void 0 ? void 0 : _e.length) && { licenseList: licenseList }));
1137
1139
  })
1138
- .addCase(verifyLeadOTP.rejected, function (state, action) {
1140
+ .addCase(verifyLeadOTP.rejected, function (state, _a) {
1141
+ var message = _a.error.message;
1139
1142
  state.loading = false;
1140
- state.error = action.error.message;
1143
+ if (!isAuthenticationVerificationFailed(message))
1144
+ state.error = message;
1141
1145
  })
1142
1146
  .addCase(createCivilIdAuth.pending, function (state) {
1143
1147
  state.loading = true;
@@ -71,7 +71,7 @@ import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2
71
71
  import { COLLECT_DOB_INFO_NAFATH, CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_BRAND } from '../../../constants';
72
72
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
73
73
  import { AuthForType, FlowsTypes } from '../../../@types';
74
- import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData, isNetworkError, isTimeoutError, isInternalServerError } from '../../../utils';
74
+ import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } from '../../../utils';
75
75
  export var updateBusinessCountry = createAsyncThunk('connect/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
76
76
  var connect, payload, data;
77
77
  return __generator(this, function (_a) {
@@ -209,9 +209,9 @@ export var createNafathAuth = createAsyncThunk('connect/createNafathAuth', funct
209
209
  }); });
210
210
  export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
211
211
  var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, leadResponse, channels, brand, err_1, brands, err_2, countryCode, phone;
212
- var _c, _d, _e, _f;
213
- return __generator(this, function (_g) {
214
- switch (_g.label) {
212
+ var _c, _d, _e;
213
+ return __generator(this, function (_f) {
214
+ switch (_f.label) {
215
215
  case 0:
216
216
  _a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
217
217
  startWithNID = connect.data.otpData.authFor === AuthForType.NATIONAL_ID;
@@ -229,11 +229,13 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
229
229
  step_name: stepName,
230
230
  encryption_contract: ['data']
231
231
  };
232
- return [4, API.authService.verifyAuth(payload)];
232
+ return [4, API.authService.verifyAuth(payload).catch(function (err) {
233
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
234
+ thunkApi.dispatch(handleNextScreenStep('CONNECT_OTP_VERIFY_SECURITY_ERROR_STEP'));
235
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
236
+ })];
233
237
  case 1:
234
- data = (_g.sent()).data;
235
- if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
236
- throw new Error(data.errors[0].description);
238
+ data = _f.sent();
237
239
  sendCustomEventToGTM({
238
240
  event: 'Send Event',
239
241
  event_category: 'User Registration Flow',
@@ -244,41 +246,41 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
244
246
  throw new Error('Lead id is missing');
245
247
  return [4, API.leadService.retrieveLead(lead_id)];
246
248
  case 2:
247
- leadResponse = (_g.sent()).data;
248
- if ((_d = leadResponse.errors) === null || _d === void 0 ? void 0 : _d.length)
249
+ leadResponse = (_f.sent()).data;
250
+ if ((_c = leadResponse.errors) === null || _c === void 0 ? void 0 : _c.length)
249
251
  throw new Error(leadResponse.errors[0].description);
250
252
  return [4, API.dataService.getChannelsOfServices({ page: 0 })];
251
253
  case 3:
252
- channels = (_g.sent()).list;
254
+ channels = (_f.sent()).list;
253
255
  leadResponse.channel_list = channels;
254
- _g.label = 4;
256
+ _f.label = 4;
255
257
  case 4:
256
- _g.trys.push([4, 6, , 7]);
258
+ _f.trys.push([4, 6, , 7]);
257
259
  return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
258
260
  case 5:
259
- brand = (_g.sent()).brand;
261
+ brand = (_f.sent()).brand;
260
262
  leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
261
263
  return [3, 7];
262
264
  case 6:
263
- err_1 = _g.sent();
265
+ err_1 = _f.sent();
264
266
  return [3, 7];
265
267
  case 7:
266
- _g.trys.push([7, 9, , 10]);
268
+ _f.trys.push([7, 9, , 10]);
267
269
  return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
268
270
  case 8:
269
- brands = (_g.sent()).brands;
271
+ brands = (_f.sent()).brands;
270
272
  leadResponse.brand_list = fixBrandList(brands, channels);
271
273
  return [3, 10];
272
274
  case 9:
273
- err_2 = _g.sent();
275
+ err_2 = _f.sent();
274
276
  return [3, 10];
275
277
  case 10:
276
278
  countryCode = settings.data.businessCountry;
277
279
  phone = (leadResponse.contact || {}).phone;
278
280
  if (phone === null || phone === void 0 ? void 0 : phone.country_code)
279
281
  countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
280
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
281
- thunkApi.dispatch(handleNextScreenStep());
282
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
283
+ thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
282
284
  return [2, { authResponse: data, leadResponse: leadResponse, countryCode: countryCode }];
283
285
  }
284
286
  });
@@ -1135,9 +1137,11 @@ export var connectSlice = createSlice({
1135
1137
  state.loading = true;
1136
1138
  state.error = null;
1137
1139
  })
1138
- .addCase(verifyAuth.rejected, function (state, action) {
1140
+ .addCase(verifyAuth.rejected, function (state, _a) {
1141
+ var message = _a.error.message;
1139
1142
  state.loading = false;
1140
- state.error = action.error.message;
1143
+ if (!isAuthenticationVerificationFailed(message))
1144
+ state.error = message;
1141
1145
  })
1142
1146
  .addCase(updateLeadDOB.fulfilled, function (state, action) {
1143
1147
  state.loading = false;
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } fro
61
61
  import API from '../../../api';
62
62
  import { ADD_NEW_ENTITY, COLLECT_DOB_INFO_NAFATH, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH, SCOPE_MERCHANT } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
64
- import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError } from '../../../utils';
64
+ import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } from '../../../utils';
65
65
  export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateBusinessCountryAsync', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
66
  var connectExpress, payload, data;
67
67
  return __generator(this, function (_a) {
@@ -499,7 +499,11 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
499
499
  step_name: CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE,
500
500
  encryption_contract: ['data']
501
501
  };
502
- return [4, API.authService.verifyExpressAuth(payload)];
502
+ return [4, API.authService.verifyExpressAuth(payload).catch(function (err) {
503
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
504
+ thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_OTP_VERIFY_SECURITY_ERROR_STEP'));
505
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
506
+ })];
503
507
  case 1:
504
508
  data = _h.sent();
505
509
  sendCustomEventToGTM({
@@ -1307,7 +1311,11 @@ export var verifyAuthMobileOtpAsync = createAsyncThunk('connectExpress/verifyAut
1307
1311
  step_name: CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP,
1308
1312
  encryption_contract: ['data']
1309
1313
  };
1310
- return [4, API.authService.verifyExpressLeadIdentity(payload)];
1314
+ return [4, API.authService.verifyExpressLeadIdentity(payload).catch(function (err) {
1315
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
1316
+ thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_OTP_VERIFY_SECURITY_ERROR_STEP'));
1317
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
1318
+ })];
1311
1319
  case 1:
1312
1320
  data = _e.sent();
1313
1321
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
@@ -1712,9 +1720,11 @@ export var connectSlice = createSlice({
1712
1720
  state.loading = false;
1713
1721
  state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authData), action.payload) });
1714
1722
  })
1715
- .addCase(verifyMobileOtpAsync.rejected, function (state, action) {
1723
+ .addCase(verifyMobileOtpAsync.rejected, function (state, _a) {
1724
+ var message = _a.error.message;
1716
1725
  state.loading = false;
1717
- state.error = action.error.message;
1726
+ if (!isAuthenticationVerificationFailed(message))
1727
+ state.error = message;
1718
1728
  })
1719
1729
  .addCase(verifyNafathAsync.pending, function (state) {
1720
1730
  state.loading = true;
@@ -1978,9 +1988,11 @@ export var connectSlice = createSlice({
1978
1988
  state.loading = true;
1979
1989
  state.error = null;
1980
1990
  })
1981
- .addCase(verifyAuthMobileOtpAsync.rejected, function (state, action) {
1991
+ .addCase(verifyAuthMobileOtpAsync.rejected, function (state, _a) {
1992
+ var message = _a.error.message;
1982
1993
  state.loading = false;
1983
- state.error = action.error.message;
1994
+ if (!isAuthenticationVerificationFailed(message))
1995
+ state.error = message;
1984
1996
  })
1985
1997
  .addCase(resendLeadMobileAuthOTP.pending, function (state) {
1986
1998
  state.loading = true;