@tap-payments/auth-jsconnect 2.11.17-development → 2.11.19-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 (36) hide show
  1. package/build/api/account.d.ts +2 -2
  2. package/build/api/account.js +7 -4
  3. package/build/api/auth.d.ts +1 -1
  4. package/build/api/auth.js +7 -3
  5. package/build/api/headers.d.ts +5 -0
  6. package/build/api/headers.js +3 -0
  7. package/build/api/index.d.ts +4 -4
  8. package/build/api/operator.d.ts +1 -1
  9. package/build/api/operator.js +5 -2
  10. package/build/assets/locales/ar.json +1 -0
  11. package/build/assets/locales/en.json +3 -2
  12. package/build/constants/app.js +101 -15
  13. package/build/constants/flows.d.ts +1 -0
  14. package/build/constants/flows.js +2 -1
  15. package/build/features/app/auth/authStore.js +64 -54
  16. package/build/features/app/bank/bankStore.js +24 -20
  17. package/build/features/app/board/boardStore.js +11 -7
  18. package/build/features/app/brand/brandStore.js +22 -18
  19. package/build/features/app/business/businessStore.js +30 -26
  20. package/build/features/app/connect/connectStore.js +26 -22
  21. package/build/features/app/connectExpress/connectExpressStore.js +19 -7
  22. package/build/features/app/entity/entityStore.js +21 -17
  23. package/build/features/app/individual/individualStore.js +29 -25
  24. package/build/features/app/password/passwordStore.js +44 -46
  25. package/build/features/app/signIn/signInStore.js +12 -16
  26. package/build/features/app/tax/taxStore.js +20 -16
  27. package/build/features/app/terminal/terminalStore.js +5 -3
  28. package/build/features/featuresScreens.js +60 -0
  29. package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.d.ts +3 -0
  30. package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.js +9 -0
  31. package/build/features/shared/OTPVerifySecurityError/index.d.ts +2 -0
  32. package/build/features/shared/OTPVerifySecurityError/index.js +2 -0
  33. package/build/features/terminal/screens/Verify/Verify.js +6 -2
  34. package/build/utils/error.d.ts +1 -0
  35. package/build/utils/error.js +3 -0
  36. package/package.json +1 -1
@@ -51,7 +51,7 @@ import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
53
53
  import { PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
54
- import { retrieveIndividualData, sendCustomEventToGTM, sleep } from '../../../utils';
54
+ import { isAuthenticationVerificationFailed, retrieveIndividualData, sendCustomEventToGTM, sleep } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
@@ -156,9 +156,9 @@ export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails
156
156
  });
157
157
  export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
158
158
  var _a, password, settings, responseBody, payload, data, _b, config, board_info_password_status, country_code, board_id, recipient, countryIso2, publicKey, flows, data_3, data_4;
159
- var _c, _d, _e, _f, _g;
160
- return __generator(this, function (_h) {
161
- switch (_h.label) {
159
+ var _c, _d, _e, _f;
160
+ return __generator(this, function (_g) {
161
+ switch (_g.label) {
162
162
  case 0:
163
163
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
164
164
  responseBody = password.data.verify.responseBody;
@@ -169,11 +169,13 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
169
169
  step_name: PASSWORD_STEP_NAMES.PHONE_AUTH,
170
170
  encryption_contract: ['data']
171
171
  };
172
- return [4, API.leadService.verifyLeadOTP(payload)];
172
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
173
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
174
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_OTP_VERIFY_SECURITY_ERROR_STEP'));
175
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
176
+ })];
173
177
  case 1:
174
- data = (_h.sent()).data;
175
- if ((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length)
176
- throw new Error(data.errors[0].description);
178
+ data = _g.sent();
177
179
  _b = data || {}, config = _b.config, board_info_password_status = _b.board_info_password_status, country_code = _b.country_code, board_id = _b.id, recipient = _b.recipient;
178
180
  countryIso2 = country_code;
179
181
  if (countryIso2)
@@ -181,7 +183,7 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
181
183
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
182
184
  if (publicKey)
183
185
  thunkApi.dispatch(handlePublicKey(publicKey));
184
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
186
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
185
187
  flows = [];
186
188
  if (!(board_info_password_status === 'completed')) return [3, 3];
187
189
  return [4, Promise.all([
@@ -189,7 +191,7 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
189
191
  thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: recipient === null || recipient === void 0 ? void 0 : recipient.id, individualType: recipient === null || recipient === void 0 ? void 0 : recipient.type })).unwrap()
190
192
  ])];
191
193
  case 2:
192
- data_3 = (_h.sent())[0];
194
+ data_3 = (_g.sent())[0];
193
195
  flows = (data_3 === null || data_3 === void 0 ? void 0 : data_3.info) || [];
194
196
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
195
197
  return [3, 6];
@@ -197,13 +199,13 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
197
199
  if (!!country_code) return [3, 5];
198
200
  return [4, API.boardService.retrieveBoardDetails(board_id)];
199
201
  case 4:
200
- data_4 = _h.sent();
201
- if ((_g = data_4 === null || data_4 === void 0 ? void 0 : data_4.entity) === null || _g === void 0 ? void 0 : _g.country)
202
+ data_4 = _g.sent();
203
+ if ((_f = data_4 === null || data_4 === void 0 ? void 0 : data_4.entity) === null || _f === void 0 ? void 0 : _f.country)
202
204
  thunkApi.dispatch(handleSetCountryByIso2(data_4.entity.country));
203
- _h.label = 5;
205
+ _g.label = 5;
204
206
  case 5:
205
207
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
206
- _h.label = 6;
208
+ _g.label = 6;
207
209
  case 6: return [2, { data: data, formData: __assign({}, params), flows: flows }];
208
210
  }
209
211
  });
@@ -296,9 +298,9 @@ export var retrieveBoardStatus = createAsyncThunk('password/retrieveBoardStatus'
296
298
  }); });
297
299
  export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
298
300
  var token, boardId, boardInfoId, userId, userType, payload, data, countryIso2, publicKey, data_5;
299
- var _a, _b, _c;
300
- return __generator(this, function (_d) {
301
- switch (_d.label) {
301
+ var _a, _b;
302
+ return __generator(this, function (_c) {
303
+ switch (_c.label) {
302
304
  case 0:
303
305
  token = params.token, boardId = params.boardId, boardInfoId = params.boardInfoId, userId = params.userId, userType = params.userType;
304
306
  payload = {
@@ -307,22 +309,20 @@ export var verifyOperationToken = createAsyncThunk('verifyOperationToken', funct
307
309
  };
308
310
  return [4, API.authService.verifyAuth(payload)];
309
311
  case 1:
310
- data = (_d.sent()).data;
311
- if ((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a.length)
312
- throw new Error(data.errors[0].description);
312
+ data = _c.sent();
313
313
  countryIso2 = data === null || data === void 0 ? void 0 : data.country;
314
314
  if (countryIso2)
315
315
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
316
- publicKey = (_b = data === null || data === void 0 ? void 0 : data.config) === null || _b === void 0 ? void 0 : _b.public_key;
316
+ publicKey = (_a = data === null || data === void 0 ? void 0 : data.config) === null || _a === void 0 ? void 0 : _a.public_key;
317
317
  if (publicKey)
318
318
  thunkApi.dispatch(handlePublicKey(publicKey));
319
319
  if (!!(data === null || data === void 0 ? void 0 : data.country)) return [3, 3];
320
320
  return [4, API.boardService.retrieveBoardDetails(boardId)];
321
321
  case 2:
322
- data_5 = _d.sent();
323
- if ((_c = data_5 === null || data_5 === void 0 ? void 0 : data_5.entity) === null || _c === void 0 ? void 0 : _c.country)
322
+ data_5 = _c.sent();
323
+ if ((_b = data_5 === null || data_5 === void 0 ? void 0 : data_5.entity) === null || _b === void 0 ? void 0 : _b.country)
324
324
  thunkApi.dispatch(handleSetCountryByIso2(data_5.entity.country));
325
- _d.label = 3;
325
+ _c.label = 3;
326
326
  case 3:
327
327
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
328
328
  return [2, __assign({ data: data, token: token, boardId: boardId, boardInfoId: boardInfoId }, (userId &&
@@ -347,16 +347,16 @@ export var resendOperationOTP = createAsyncThunk('resendOperationOTPPassword', f
347
347
  };
348
348
  return [4, API.authService.verifyAuth(payload)];
349
349
  case 1:
350
- data = (_a.sent()).data;
350
+ data = _a.sent();
351
351
  return [2, { data: data }];
352
352
  }
353
353
  });
354
354
  }); });
355
355
  export var resetPassword = createAsyncThunk('resetPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
356
356
  var _a, password, settings, responseBody, passwordData, payload, data;
357
- var _b, _c, _d;
358
- return __generator(this, function (_e) {
359
- switch (_e.label) {
357
+ var _b, _c;
358
+ return __generator(this, function (_d) {
359
+ switch (_d.label) {
360
360
  case 0:
361
361
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
362
362
  responseBody = password.data.verify.responseBody;
@@ -371,15 +371,15 @@ export var resetPassword = createAsyncThunk('resetPassword', function (params, t
371
371
  },
372
372
  encryption_contract: ['user_credentail.otp', 'user_credentail.new_password']
373
373
  };
374
- return [4, API.authService.verifyAuth(payload)];
374
+ return [4, API.authService.verifyAuth(payload).catch(function (err) {
375
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
376
+ thunkApi.dispatch(handleNextScreenStep('PASSWORD_OTP_VERIFY_SECURITY_ERROR_STEP'));
377
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
378
+ })];
375
379
  case 1:
376
- data = (_e.sent()).data;
377
- if ((_b = data === null || data === void 0 ? void 0 : data.errors) === null || _b === void 0 ? void 0 : _b.length)
378
- throw new Error(data.errors[0].description);
379
- if (!(data === null || data === void 0 ? void 0 : data.errors)) {
380
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP')); });
381
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, payload);
382
- }
380
+ data = _d.sent();
381
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_STEP')); });
382
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, payload);
383
383
  return [2, { data: data, formData: __assign(__assign({}, params), passwordData) }];
384
384
  }
385
385
  });
@@ -511,9 +511,11 @@ export var passwordSlice = createSlice({
511
511
  flows: flows
512
512
  }));
513
513
  })
514
- .addCase(verifyPasswordLeadOTP.rejected, function (state, action) {
514
+ .addCase(verifyPasswordLeadOTP.rejected, function (state, _a) {
515
+ var message = _a.error.message;
515
516
  state.loading = false;
516
- state.error = action.error.message;
517
+ if (!isAuthenticationVerificationFailed(message))
518
+ state.error = message;
517
519
  })
518
520
  .addCase(createPassword.pending, function (state) {
519
521
  state.loading = true;
@@ -599,14 +601,8 @@ export var passwordSlice = createSlice({
599
601
  state.error = null;
600
602
  })
601
603
  .addCase(resendOperationOTP.fulfilled, function (state, action) {
602
- var _a;
603
604
  state.error = null;
604
605
  var data = action.payload.data;
605
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
606
- if (description) {
607
- state.error = description;
608
- return;
609
- }
610
606
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
611
607
  })
612
608
  .addCase(resendOperationOTP.rejected, function (state, action) {
@@ -624,8 +620,10 @@ export var passwordSlice = createSlice({
624
620
  state.loading = true;
625
621
  state.error = null;
626
622
  })
627
- .addCase(resetPassword.rejected, function (state, action) {
628
- state.error = action.error.message;
623
+ .addCase(resetPassword.rejected, function (state, _a) {
624
+ var message = _a.error.message;
625
+ if (!isAuthenticationVerificationFailed(message))
626
+ state.error = message;
629
627
  state.loading = false;
630
628
  })
631
629
  .addCase(retrieveBoardResetPasswordSuccess.fulfilled, function (state, action) {
@@ -189,12 +189,10 @@ export var verifyAuthOTP = createAsyncThunk('signIn/verifyAuthOTP', function (pa
189
189
  };
190
190
  return [4, API.authService.verifyAuth(requestBody)];
191
191
  case 1:
192
- data = (_f.sent()).data;
193
- if (!data.errors) {
194
- (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { otp: params.otp });
195
- thunkApi.dispatch(handleOpen(false));
196
- (_e = (_d = settings.data.appConfig).onFlowCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, data);
197
- }
192
+ data = _f.sent();
193
+ (_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, { otp: params.otp });
194
+ thunkApi.dispatch(handleOpen(false));
195
+ (_e = (_d = settings.data.appConfig).onFlowCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, data);
198
196
  return [2, { data: data, formData: params }];
199
197
  }
200
198
  });
@@ -221,16 +219,14 @@ export var verifyAuthPassword = createAsyncThunk('signIn/verifyAuthPassword', fu
221
219
  };
222
220
  return [4, API.authService.verifyAuth(requestBody)];
223
221
  case 1:
224
- data = (_g.sent()).data;
225
- if (!data.errors) {
226
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.password });
227
- if ((data === null || data === void 0 ? void 0 : data.status) === 'pending') {
228
- thunkApi.dispatch(handleNextScreenStep('SIGIN_OTP_STEP'));
229
- }
230
- else {
231
- thunkApi.dispatch(handleOpen(false));
232
- (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, data);
233
- }
222
+ data = _g.sent();
223
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.password });
224
+ if ((data === null || data === void 0 ? void 0 : data.status) === 'pending') {
225
+ thunkApi.dispatch(handleNextScreenStep('SIGIN_OTP_STEP'));
226
+ }
227
+ else {
228
+ thunkApi.dispatch(handleOpen(false));
229
+ (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, data);
234
230
  }
235
231
  return [2, data];
236
232
  }
@@ -51,7 +51,7 @@ import API from '../../../api';
51
51
  import { DocumentPurpose, FlowsTypes } from '../../../@types';
52
52
  import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2, handlePrevScreenStep, handlePublicKey, onCloseComplete } from '../../../app/settings';
53
53
  import { TAX_STEP_NAMES } from '../../../constants';
54
- import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, retrieveIndividualData, sleep } from '../../../utils';
54
+ import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, isAuthenticationVerificationFailed, retrieveIndividualData, sleep } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
@@ -178,9 +178,9 @@ export var retrieveBoardDetails = createAsyncThunk('tax/retrieveBrandInfo', func
178
178
  });
179
179
  export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
180
180
  var _a, tax, settings, responseBody, payload, data, _b, config, entity_id, boardId, country_code, entityData, publicKey, countryIso2, data_2;
181
- var _c, _d, _e, _f, _g, _h;
182
- return __generator(this, function (_j) {
183
- switch (_j.label) {
181
+ var _c, _d, _e, _f, _g;
182
+ return __generator(this, function (_h) {
183
+ switch (_h.label) {
184
184
  case 0:
185
185
  _a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
186
186
  responseBody = tax.data.verify.responseBody;
@@ -191,11 +191,13 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
191
191
  step_name: TAX_STEP_NAMES.PHONE_AUTH,
192
192
  encryption_contract: ['data']
193
193
  };
194
- return [4, API.leadService.verifyLeadOTP(payload)];
194
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
195
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
196
+ thunkApi.dispatch(handleNextScreenStep('TAX_OTP_VERIFY_SECURITY_ERROR_STEP'));
197
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
198
+ })];
195
199
  case 1:
196
- data = (_j.sent()).data;
197
- if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
198
- throw new Error(data.errors[0].description);
200
+ data = _h.sent();
199
201
  _b = data || {}, config = _b.config, entity_id = _b.entity_id, boardId = _b.id, country_code = _b.country_code;
200
202
  entityData = undefined;
201
203
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
@@ -207,19 +209,19 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
207
209
  if (!!entity_id) return [3, 3];
208
210
  return [4, API.boardService.retrieveBoardDetails(boardId)];
209
211
  case 2:
210
- data_2 = _j.sent();
211
- if (!((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.id))
212
+ data_2 = _h.sent();
213
+ if (!((_d = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _d === void 0 ? void 0 : _d.id))
212
214
  throw new Error('entity_id_missing');
213
215
  entityData = data_2;
214
216
  return [3, 5];
215
217
  case 3: return [4, API.entityService.retrieveEntity(entity_id)];
216
218
  case 4:
217
- entityData = _j.sent();
218
- _j.label = 5;
219
+ entityData = _h.sent();
220
+ _h.label = 5;
219
221
  case 5:
220
- if (!countryIso2 && ((_f = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _f === void 0 ? void 0 : _f.country))
222
+ if (!countryIso2 && ((_e = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _e === void 0 ? void 0 : _e.country))
221
223
  thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
222
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
224
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, { otp: params.otp });
223
225
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP')); });
224
226
  return [2, { data: data, entityData: entityData === null || entityData === void 0 ? void 0 : entityData.entity, formData: params }];
225
227
  }
@@ -426,9 +428,11 @@ export var taxSlice = createSlice({
426
428
  if (is_vat_acknowledged)
427
429
  state.data.taxData.confirmPolicy = is_vat_acknowledged;
428
430
  })
429
- .addCase(verifyTaxLeadOTP.rejected, function (state, action) {
431
+ .addCase(verifyTaxLeadOTP.rejected, function (state, _a) {
432
+ var message = _a.error.message;
430
433
  state.loading = false;
431
- state.error = action.error.message;
434
+ if (!isAuthenticationVerificationFailed(message))
435
+ state.error = message;
432
436
  })
433
437
  .addCase(updateTaxInfo.pending, function (state) {
434
438
  state.loading = true;
@@ -51,7 +51,7 @@ import { handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { CONNECT_FLOWS, NAFATH_PACI_TIMEOUT_DURATION, SELECTED_POS_DEFAULT_INFO, SELECTED_TERMINAL_DEFAULT_INFO, TERMINAL_PUSH_NOTIFICATION_DURATION, TERMINAL_PUSH_NOTIFICATION_FAILED, TERMINAL_STEP_NAMES } from '../../../constants';
53
53
  import API from '../../../api';
54
- import { isNetworkError, isTimeoutError, retrieveIndividualData, sleep } from '../../../utils';
54
+ import { isAuthenticationVerificationFailed, isNetworkError, isTimeoutError, retrieveIndividualData, sleep } from '../../../utils';
55
55
  export var verifyToken = createAsyncThunk('terminal/verifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
@@ -514,9 +514,11 @@ export var terminalSlice = createSlice({
514
514
  state.data.otpData = formData;
515
515
  state.data.responseData = { authData: data, boardData: { id: data === null || data === void 0 ? void 0 : data.id, board_info_id: data === null || data === void 0 ? void 0 : data.board_info_id }, terminalData: terminalData };
516
516
  })
517
- .addCase(verifyTokenOTP.rejected, function (state, action) {
517
+ .addCase(verifyTokenOTP.rejected, function (state, _a) {
518
+ var message = _a.error.message;
518
519
  state.loading = false;
519
- state.error = action.error.message;
520
+ if (!isAuthenticationVerificationFailed(message))
521
+ state.error = message;
520
522
  })
521
523
  .addCase(linkNewTerminal.pending, function (state) {
522
524
  state.loading = true;
@@ -13,6 +13,7 @@ import ConnectOTPScreen from './connect/screens/OTP';
13
13
  import ThankYouScreen from './connect/screens/ThankYou';
14
14
  import OperatorError from './connect/screens/OperatorError';
15
15
  import CollectMobileOwnership from './connect/screens/MobileOwnership';
16
+ import OTPVerifySecurityError from './shared/OTPVerifySecurityError';
16
17
  import ConnectExpressBusinessCountry from './connectExpress/screens/BusinessCountry/BusinessCountry';
17
18
  import ConnectExpressMobileScreen from './connectExpress/screens/Mobile';
18
19
  import ConnectExpressNIDScreen from './connectExpress/screens/NID';
@@ -37,6 +38,7 @@ import ConnectExpressAuthMerchantScreen from './connectExpress/screens/AuthMerch
37
38
  import ConnectExpressAuthAccountCreatedLoaderScreen from './connectExpress/screens/AccountCreatedLoader';
38
39
  import ConnectExpressOperatorError from './connectExpress/screens/OperatorError';
39
40
  import ConnectExpressCollectMobileOwnership from './connectExpress/screens/MobileOwnership';
41
+ import ConnectExpressOTPVerifySecurityError from './shared/OTPVerifySecurityError';
40
42
  import AuthBusinessCountry from './auth/screens/BusinessCountry/BusinessCountry';
41
43
  import AuthSwitchScreen from './auth/screens/AuthSwitch';
42
44
  import AuthMobileScreen from './auth/screens/Mobile';
@@ -58,6 +60,7 @@ import AuthEmailSentScreen from './auth/screens/EmailSent';
58
60
  import AuthMigratingDataScreen from './auth/screens/MigratingData';
59
61
  import AuthOperatorError from './auth/screens/OperatorError';
60
62
  import AuthPasscodeScreen from './auth/screens/Passcode';
63
+ import AuthOTPVerifySecurityError from './shared/OTPVerifySecurityError';
61
64
  import CustomersPage from './business/screens/Customers';
62
65
  import IDBODPage from './business/screens/IDBOD';
63
66
  import BusinessVerifyPage from './business/screens/Verify';
@@ -73,6 +76,7 @@ import BusVerifyPACIScreen from './business/screens/VerifyPACI';
73
76
  import BrandVerifyScreen from './business/screens/BrandDetails';
74
77
  import BusinessOperatorError from './business/screens/OperatorError';
75
78
  import BusinessCollectMobileOwnership from './business/screens/MobileOwnership';
79
+ import BusinessOTPVerifySecurityError from './shared/OTPVerifySecurityError';
76
80
  import PasswordVerifyPage from './password/screens/Verify';
77
81
  import CreatePasswordPage from './password/screens/CreatePassword';
78
82
  import PasswordDataLoadingPage from './password/screens/PrepareDataLoading';
@@ -81,6 +85,7 @@ import SuccessPasswordPage from './password/screens/Success';
81
85
  import PasswordSuccessWithFlowPage from './password/screens/SuccessWithFlowButtons';
82
86
  import PasswordResetPasswordSuccessPage from './password/screens/ResetPasswordSuccess';
83
87
  import PasswordOperatorError from './password/screens/OperatorError';
88
+ import PasswordOTPVerifySecurityError from './shared/OTPVerifySecurityError';
84
89
  import IndividualVerifyPage from './individual/screens/Verify';
85
90
  import IndividualPhoneInfoPage from './individual/screens/IndividualPhoneInfo';
86
91
  import IndividualListPage from './individual/screens/IndividualList';
@@ -91,6 +96,7 @@ import IndividualSuccessWithFlowPage from './individual/screens/SuccessWithFlowB
91
96
  import IndividualResetPasswordSuccessPage from './individual/screens/ResetPasswordSuccess';
92
97
  import IndividualDataLoadingPage from './individual/screens/PrepareDataLoading';
93
98
  import IndividualOperatorError from './individual/screens/OperatorError';
99
+ import IndividualOTPVerifySecurityError from './shared/OTPVerifySecurityError';
94
100
  import BankVerifyPage from './bank/screens/Verify';
95
101
  import BankDetailsPage from './bank/screens/BankDetails';
96
102
  import BankSuccessPage from './bank/screens/Success';
@@ -98,6 +104,7 @@ import BankSuccessWithFlowPage from './bank/screens/SuccessWithFlowButtons';
98
104
  import BankResetPasswordSuccessPage from './bank/screens/ResetPasswordSuccess';
99
105
  import BankDataLoadingPage from './bank/screens/PrepareDataLoading';
100
106
  import BankOperatorError from './bank/screens/OperatorError';
107
+ import BankOTPVerifySecurityError from './shared/OTPVerifySecurityError';
101
108
  import TaxVerifyPage from './tax/screens/Verify';
102
109
  import TaxDetailsPage from './tax/screens/TaxDetails';
103
110
  import TaxSuccessPage from './tax/screens/Success';
@@ -105,6 +112,7 @@ import TaxSuccessWithFlowPage from './tax/screens/SuccessWithFlowButtons';
105
112
  import TaxResetPasswordSuccessPage from './tax/screens/ResetPasswordSuccess';
106
113
  import TaxDataLoadingPage from './tax/screens/PrepareDataLoading';
107
114
  import TaxOperatorError from './tax/screens/OperatorError';
115
+ import TaxOTPVerifySecurityError from './shared/OTPVerifySecurityError';
108
116
  import SignInMobilePage from './signIn/screens/Mobile';
109
117
  import SignInEmailPage from './signIn/screens/Email';
110
118
  import SignInOTPPage from './signIn/screens/OTP';
@@ -118,6 +126,7 @@ import EntitySuccessWithFlowPage from './entity/screens/SuccessWithFlowButtons';
118
126
  import EntityResetPasswordSuccessPage from './entity/screens/ResetPasswordSuccess';
119
127
  import EntityDataLoadingPage from './entity/screens/PrepareDataLoading';
120
128
  import EntityOperatorError from './entity/screens/OperatorError';
129
+ import EntityOTPVerifySecurityError from './shared/OTPVerifySecurityError';
121
130
  import BrandVerifyPage from './brand/screens/Verify';
122
131
  import BrandInfoPage from './brand/screens/BrandInfo';
123
132
  import BrandSegmentPage from './brand/screens/BrandSegmentInfo';
@@ -127,11 +136,13 @@ import BrandSuccessWithFlowPage from './brand/screens/SuccessWithFlowButtons';
127
136
  import BrandResetPasswordSuccessPage from './brand/screens/ResetPasswordSuccess';
128
137
  import BrandDataLoadingPage from './brand/screens/PrepareDataLoading';
129
138
  import BrandOperatorError from './brand/screens/OperatorError';
139
+ import BrandOTPVerifySecurityError from './shared/OTPVerifySecurityError';
130
140
  import BoardVerifyPage from './board/screens/Verify';
131
141
  import BoardSuccessWithFlowPage from './board/screens/SuccessWithFlowButtons';
132
142
  import BoardResetPasswordSuccessPage from './board/screens/ResetPasswordSuccess';
133
143
  import BoardDataLoadingPage from './board/screens/PrepareDataLoading';
134
144
  import BoardOperatorError from './board/screens/OperatorError';
145
+ import BoardOTPVerifySecurityError from './shared/OTPVerifySecurityError';
135
146
  import KycLoadingPage from './kyc/screens/Loading';
136
147
  import KycTokenErrorPage from './kyc/screens/TokenError';
137
148
  import KycAlreadySubmittedPage from './kyc/screens/AlreadySubmitted';
@@ -154,6 +165,7 @@ import LinkedSuccessPage from './terminal/screens/LinkedSuccess';
154
165
  import UnlinkedSuccessPage from './terminal/screens/UnlinkedSuccess';
155
166
  import TerminalBoardPage from './terminal/screens/SuccessWithFlowButtons';
156
167
  import TerminalResetPasswordSuccessPage from './terminal/screens/ResetPasswordSuccess';
168
+ import TerminalOTPVerifySecurityError from './shared/OTPVerifySecurityError';
157
169
  export var connectFeatureScreens = [
158
170
  {
159
171
  name: 'CONNECT_BUSINESS_COUNTRY_STEP',
@@ -210,6 +222,10 @@ export var connectFeatureScreens = [
210
222
  {
211
223
  name: 'CONNECT_MOBILE_OWNERSHIP',
212
224
  element: CollectMobileOwnership
225
+ },
226
+ {
227
+ name: 'CONNECT_OTP_VERIFY_SECURITY_ERROR_STEP',
228
+ element: OTPVerifySecurityError
213
229
  }
214
230
  ];
215
231
  export var connectExpressFeatureScreens = [
@@ -308,6 +324,10 @@ export var connectExpressFeatureScreens = [
308
324
  {
309
325
  name: 'COLLECT_MOBILE_OWNERSHIP',
310
326
  element: ConnectExpressCollectMobileOwnership
327
+ },
328
+ {
329
+ name: 'CONNECT_EXPRESS_OTP_VERIFY_SECURITY_ERROR_STEP',
330
+ element: ConnectExpressOTPVerifySecurityError
311
331
  }
312
332
  ];
313
333
  export var authFeatureScreens = [
@@ -394,6 +414,10 @@ export var authFeatureScreens = [
394
414
  {
395
415
  name: 'AUTH_OPERATOR_ERROR_STEP',
396
416
  element: AuthOperatorError
417
+ },
418
+ {
419
+ name: 'AUTH_OTP_VERIFY_SECURITY_ERROR_STEP',
420
+ element: AuthOTPVerifySecurityError
397
421
  }
398
422
  ];
399
423
  export var businessFeatureScreens = [
@@ -444,6 +468,10 @@ export var businessFeatureScreens = [
444
468
  {
445
469
  name: 'BUSINESS_MOBILE_OWNERSHIP',
446
470
  element: BusinessCollectMobileOwnership
471
+ },
472
+ {
473
+ name: 'BUSINESS_OTP_VERIFY_SECURITY_ERROR_STEP',
474
+ element: BusinessOTPVerifySecurityError
447
475
  }
448
476
  ];
449
477
  export var passwordFeatureScreens = [
@@ -475,6 +503,10 @@ export var passwordFeatureScreens = [
475
503
  {
476
504
  name: 'PASSWORD_OPERATOR_ERROR_STEP',
477
505
  element: PasswordOperatorError
506
+ },
507
+ {
508
+ name: 'PASSWORD_OTP_VERIFY_SECURITY_ERROR_STEP',
509
+ element: PasswordOTPVerifySecurityError
478
510
  }
479
511
  ];
480
512
  export var individualFeatureScreens = [
@@ -514,6 +546,10 @@ export var individualFeatureScreens = [
514
546
  {
515
547
  name: 'INDIVIDUAL_OPERATOR_ERROR_STEP',
516
548
  element: IndividualOperatorError
549
+ },
550
+ {
551
+ name: 'INDIVIDUAL_OTP_VERIFY_SECURITY_ERROR_STEP',
552
+ element: IndividualOTPVerifySecurityError
517
553
  }
518
554
  ];
519
555
  export var bankFeatureScreens = [
@@ -541,6 +577,10 @@ export var bankFeatureScreens = [
541
577
  {
542
578
  name: 'BANK_OPERATOR_ERROR_STEP',
543
579
  element: BankOperatorError
580
+ },
581
+ {
582
+ name: 'BANK_OTP_VERIFY_SECURITY_ERROR_STEP',
583
+ element: BankOTPVerifySecurityError
544
584
  }
545
585
  ];
546
586
  export var taxFeatureScreens = [
@@ -568,6 +608,10 @@ export var taxFeatureScreens = [
568
608
  {
569
609
  name: 'TAX_OPERATOR_ERROR_STEP',
570
610
  element: TaxOperatorError
611
+ },
612
+ {
613
+ name: 'TAX_OTP_VERIFY_SECURITY_ERROR_STEP',
614
+ element: TaxOTPVerifySecurityError
571
615
  }
572
616
  ];
573
617
  export var signInFeatureScreens = [
@@ -621,6 +665,10 @@ export var entityFeatureScreens = [
621
665
  {
622
666
  name: 'ENTITY_OPERATOR_ERROR_STEP',
623
667
  element: EntityOperatorError
668
+ },
669
+ {
670
+ name: 'ENTITY_OTP_VERIFY_SECURITY_ERROR_STEP',
671
+ element: EntityOTPVerifySecurityError
624
672
  }
625
673
  ];
626
674
  export var brandFeatureScreens = [
@@ -656,6 +704,10 @@ export var brandFeatureScreens = [
656
704
  {
657
705
  name: 'BRAND_OPERATOR_ERROR_STEP',
658
706
  element: BrandOperatorError
707
+ },
708
+ {
709
+ name: 'BRAND_OTP_VERIFY_SECURITY_ERROR_STEP',
710
+ element: BrandOTPVerifySecurityError
659
711
  }
660
712
  ];
661
713
  export var boardFeatureScreens = [
@@ -678,6 +730,10 @@ export var boardFeatureScreens = [
678
730
  {
679
731
  name: 'BOARD_OPERATOR_ERROR_STEP',
680
732
  element: BoardOperatorError
733
+ },
734
+ {
735
+ name: 'BOARD_OTP_VERIFY_SECURITY_ERROR_STEP',
736
+ element: BoardOTPVerifySecurityError
681
737
  }
682
738
  ];
683
739
  export var kycFeatureScreens = [
@@ -770,5 +826,9 @@ export var terminalFeatureScreens = [
770
826
  {
771
827
  name: CONNECT_FLOWS.terminal.resetPassword,
772
828
  element: TerminalResetPasswordSuccessPage
829
+ },
830
+ {
831
+ name: CONNECT_FLOWS.terminal.otpVerifySecurityError,
832
+ element: TerminalOTPVerifySecurityError
773
833
  }
774
834
  ];
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import GenericError from '../../shared/GenericError';
5
+ var OTPVerifySecurityError = function () {
6
+ var t = useTranslation().t;
7
+ return _jsx(GenericError, { error: t('something_went_wrong'), errorTitle: t('oops') });
8
+ };
9
+ export default React.memo(OTPVerifySecurityError);
@@ -0,0 +1,2 @@
1
+ import OTPVerifySecurityError from './OTPVerifySecurityError';
2
+ export default OTPVerifySecurityError;
@@ -0,0 +1,2 @@
1
+ import OTPVerifySecurityError from './OTPVerifySecurityError';
2
+ export default OTPVerifySecurityError;
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import Box from '@mui/material/Box/Box';
19
19
  import { styled } from '@mui/material/styles';
20
20
  import { handleNextScreenStep } from '../../../../app/settings';
21
- import { deepCopy, maskPhone } from '../../../../utils';
21
+ import { deepCopy, isAuthenticationVerificationFailed, maskPhone } from '../../../../utils';
22
22
  import Form from '../../../../components/Form';
23
23
  import Text from '../../../../components/Text';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
@@ -26,6 +26,7 @@ import { terminalSelector, clearError, resetOTPScreen, verifyTokenOTP } from '..
26
26
  import Button from '../../../shared/Button';
27
27
  import { OTPValidation } from './validation';
28
28
  import OTPInput from './OTPInput';
29
+ import { CONNECT_FLOWS } from '../../../../constants';
29
30
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
30
31
  var theme = _a.theme;
31
32
  return ({
@@ -77,7 +78,10 @@ var VerifyNumber = function (_a) {
77
78
  var nextScreen = _a.nextScreen;
78
79
  dispatch(handleNextScreenStep(nextScreen));
79
80
  })
80
- .catch(function () { });
81
+ .catch(function (err) {
82
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
83
+ dispatch(handleNextScreenStep(CONNECT_FLOWS.terminal.otpVerifySecurityError));
84
+ });
81
85
  };
82
86
  var disabled = !methods.formState.isValid || !phone || resendLoading;
83
87
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : st('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
@@ -2,3 +2,4 @@ export declare const isNetworkError: (error: string | null) => boolean;
2
2
  export declare const isTokenExpired: (error: string | null) => boolean;
3
3
  export declare const isTimeoutError: (error: string | null) => boolean;
4
4
  export declare const isInternalServerError: (error: string | null) => boolean;
5
+ export declare const isAuthenticationVerificationFailed: (error: string | null) => boolean;
@@ -10,3 +10,6 @@ export var isTimeoutError = function (error) {
10
10
  export var isInternalServerError = function (error) {
11
11
  return ['internal_server_error'].includes((error || '').trim().toLowerCase());
12
12
  };
13
+ export var isAuthenticationVerificationFailed = function (error) {
14
+ return ['failed to verify the auth'].includes((error || '').trim().toLowerCase());
15
+ };