@tap-payments/auth-jsconnect 2.10.11-beta → 2.10.11

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 (121) hide show
  1. package/README.md +2 -2
  2. package/build/@types/app.d.ts +3 -1
  3. package/build/@types/app.js +1 -0
  4. package/build/@types/form.d.ts +7 -2
  5. package/build/api/account.d.ts +2 -2
  6. package/build/api/account.js +7 -4
  7. package/build/api/auth.d.ts +2 -1
  8. package/build/api/auth.js +7 -3
  9. package/build/api/axios.d.ts +1 -1
  10. package/build/api/entity.d.ts +3 -0
  11. package/build/api/headers.d.ts +5 -0
  12. package/build/api/headers.js +3 -0
  13. package/build/api/index.d.ts +4 -4
  14. package/build/api/lead.d.ts +1 -0
  15. package/build/api/operator.d.ts +1 -1
  16. package/build/api/operator.js +5 -2
  17. package/build/app/settings.d.ts +1 -0
  18. package/build/app/settings.js +8 -5
  19. package/build/assets/currencies/AEDSymbol.d.ts +7 -0
  20. package/build/assets/currencies/AEDSymbol.js +28 -0
  21. package/build/assets/currencies/SARSymbol.d.ts +7 -0
  22. package/build/assets/currencies/SARSymbol.js +28 -0
  23. package/build/assets/currencies/index.d.ts +2 -0
  24. package/build/assets/currencies/index.js +2 -0
  25. package/build/assets/currencies/utils.d.ts +4 -0
  26. package/build/assets/currencies/utils.js +6 -0
  27. package/build/assets/locales/ar.json +53 -7
  28. package/build/assets/locales/en.json +58 -11
  29. package/build/components/TextWithCurrency/TextWithCurrency.d.ts +7 -0
  30. package/build/components/TextWithCurrency/TextWithCurrency.js +14 -0
  31. package/build/components/TextWithCurrency/index.d.ts +2 -0
  32. package/build/components/TextWithCurrency/index.js +2 -0
  33. package/build/constants/api.d.ts +1 -0
  34. package/build/constants/api.js +2 -0
  35. package/build/constants/app.d.ts +11 -0
  36. package/build/constants/app.js +110 -19
  37. package/build/constants/assets.d.ts +12 -3
  38. package/build/constants/assets.js +123 -105
  39. package/build/constants/dummy.js +27 -20
  40. package/build/constants/validation.d.ts +1 -0
  41. package/build/constants/validation.js +1 -0
  42. package/build/features/app/auth/authStore.d.ts +24 -5
  43. package/build/features/app/auth/authStore.js +188 -113
  44. package/build/features/app/bank/bankStore.js +24 -20
  45. package/build/features/app/board/boardStore.js +11 -7
  46. package/build/features/app/brand/brandStore.js +22 -18
  47. package/build/features/app/business/businessStore.js +45 -36
  48. package/build/features/app/connect/connectStore.d.ts +6 -5
  49. package/build/features/app/connect/connectStore.js +48 -31
  50. package/build/features/app/connectExpress/connectExpressStore.d.ts +6 -5
  51. package/build/features/app/connectExpress/connectExpressStore.js +99 -39
  52. package/build/features/app/entity/entityStore.js +21 -17
  53. package/build/features/app/individual/individualStore.js +33 -28
  54. package/build/features/app/password/passwordStore.js +44 -46
  55. package/build/features/app/signIn/signInStore.js +12 -16
  56. package/build/features/app/tax/taxStore.js +21 -17
  57. package/build/features/auth/Auth.d.ts +1 -1
  58. package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +10 -7
  59. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
  60. package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +6 -4
  61. package/build/features/auth/screens/AuthenticationList/EntityList.js +11 -3
  62. package/build/features/auth/screens/OTP/OTP.d.ts +13 -2
  63. package/build/features/auth/screens/OTP/OTP.js +15 -3
  64. package/build/features/auth/screens/OTP/index.d.ts +1 -2
  65. package/build/features/auth/screens/Passcode/Passcode.d.ts +16 -0
  66. package/build/features/auth/screens/Passcode/Passcode.js +82 -0
  67. package/build/features/auth/screens/Passcode/PasscodeInput.d.ts +6 -0
  68. package/build/features/auth/screens/Passcode/PasscodeInput.js +42 -0
  69. package/build/features/auth/screens/Passcode/index.d.ts +2 -0
  70. package/build/features/auth/screens/Passcode/index.js +2 -0
  71. package/build/features/auth/screens/Passcode/validation.d.ts +8 -0
  72. package/build/features/auth/screens/Passcode/validation.js +4 -0
  73. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -8
  74. package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +1 -1
  75. package/build/features/business/screens/BusinessType/BusinessType.js +15 -5
  76. package/build/features/business/screens/BusinessType/EntityLicenseList.js +11 -5
  77. package/build/features/business/screens/BusinessType/LicenseList.js +20 -12
  78. package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +35 -0
  79. package/build/features/business/screens/BusinessType/UnifiedNumber.js +84 -0
  80. package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
  81. package/build/features/business/screens/BusinessType/validation.js +31 -10
  82. package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -8
  83. package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
  84. package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +10 -10
  85. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
  86. package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +6 -4
  87. package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +11 -3
  88. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
  89. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +27 -16
  90. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
  91. package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
  92. package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +36 -0
  93. package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +81 -0
  94. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +6 -3
  95. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +57 -21
  96. package/build/features/connectExpress/screens/Mobile/Mobile.js +7 -6
  97. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +3 -7
  98. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +3 -7
  99. package/build/features/entity/screens/EntityName/EntityName.js +16 -15
  100. package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
  101. package/build/features/entity/screens/EntityName/validation.d.ts +50 -48
  102. package/build/features/entity/screens/EntityName/validation.js +100 -85
  103. package/build/features/featuresScreens.js +60 -0
  104. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +3 -8
  105. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
  106. package/build/features/shared/Background/LogoBackground.js +5 -17
  107. package/build/features/shared/Button/Button.js +1 -2
  108. package/build/features/shared/Input/Input.d.ts +1 -1
  109. package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.d.ts +3 -0
  110. package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.js +9 -0
  111. package/build/features/shared/OTPVerifySecurityError/index.d.ts +2 -0
  112. package/build/features/shared/OTPVerifySecurityError/index.js +2 -0
  113. package/build/hooks/useAppConfig.js +1 -1
  114. package/build/utils/common.d.ts +1 -1
  115. package/build/utils/common.js +14 -8
  116. package/build/utils/error.d.ts +2 -0
  117. package/build/utils/error.js +6 -0
  118. package/build/utils/string.d.ts +3 -2
  119. package/build/utils/string.js +4 -1
  120. package/build/utils/validation.js +1 -1
  121. package/package.json +3 -3
@@ -59,9 +59,9 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import { handleNextScreenStep, handleCurrentActiveScreen, handleOpen, handleSetCountryByIso2, onCloseComplete, storeAuthId } from '../../../app/settings';
60
60
  import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } from '../../../@types';
61
61
  import API from '../../../api';
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 } from '../../../constants';
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 } 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({
@@ -831,30 +835,43 @@ export var verifyPaciLeadIdentityAsync = createAsyncThunk('connectExpress/verify
831
835
  case 9:
832
836
  count++;
833
837
  return [3, 1];
834
- case 10: throw new Error('nafath_verification_failed');
838
+ case 10: throw new Error('paci_verification_failed');
835
839
  }
836
840
  });
837
841
  }); });
838
842
  export var checkEmailAvailabilityAsync = createAsyncThunk('connectExpress/CheckEmailAvailabilityAsync', function (_a, thunkApi) {
839
843
  var email = _a.email, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
840
844
  return __awaiter(void 0, void 0, void 0, function () {
841
- var connectExpress, requestBody, data;
842
- var _b, _c;
843
- return __generator(this, function (_d) {
844
- switch (_d.label) {
845
+ var responseData, requestBody, data, retryData;
846
+ var _b, _c, _d, _e, _f;
847
+ return __generator(this, function (_g) {
848
+ switch (_g.label) {
845
849
  case 0:
846
- connectExpress = thunkApi.getState().connectExpress;
850
+ responseData = thunkApi.getState().connectExpress.data.responseData;
847
851
  requestBody = {
848
852
  email: email,
849
- country: (_c = (_b = connectExpress.data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) === null || _c === void 0 ? void 0 : _c.country_code,
853
+ country: (_b = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _b === void 0 ? void 0 : _b.country_code,
850
854
  encryption_contract: ['email']
851
855
  };
852
856
  return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
853
857
  case 1:
854
- data = (_d.sent()).data;
855
- onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
856
- if (!data.errors)
858
+ data = (_g.sent()).data;
859
+ if (!data.errors) {
860
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
857
861
  return [2, { response: data, formData: email }];
862
+ }
863
+ if (!isInternalServerError((_d = (_c = data.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.error)) {
864
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
865
+ return [2];
866
+ }
867
+ return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
868
+ case 2:
869
+ retryData = (_g.sent()).data;
870
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
871
+ if (!retryData.errors)
872
+ return [2, { response: retryData, formData: email }];
873
+ if (isInternalServerError((_f = (_e = retryData.errors) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.error))
874
+ return [2, { response: { is_available: true }, formData: email }];
858
875
  return [2];
859
876
  }
860
877
  });
@@ -888,10 +905,10 @@ export var checkBrandNameAvailabilityAsync = createAsyncThunk('connectExpress/ch
888
905
  export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAsync', function (_a, thunkApi) {
889
906
  var isRetry = _a.isRetry;
890
907
  return __awaiter(void 0, void 0, void 0, function () {
891
- var _b, connectExpress, settings, responseData, _c, postURL, scope, redirectUrl, mode, showBoard, notification, platforms, payment_provider, leadId, authId, bi, leadData, accountData, data, body, data, urlQueryStart;
892
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
893
- return __generator(this, function (_v) {
894
- switch (_v.label) {
908
+ var _b, connectExpress, settings, responseData, _c, postURL, scope, redirectUrl, mode, showBoard, notification, platforms, payment_provider, leadId, authId, bi, leadData, accountData, data, body, data, data, urlQueryStart;
909
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
910
+ return __generator(this, function (_y) {
911
+ switch (_y.label) {
895
912
  case 0:
896
913
  _b = thunkApi.getState(), connectExpress = _b.connectExpress, settings = _b.settings;
897
914
  responseData = connectExpress.data.responseData;
@@ -905,12 +922,12 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
905
922
  if (!isRetry) return [3, 2];
906
923
  return [4, thunkApi.dispatch(getLeadByIdAsync(leadId)).unwrap()];
907
924
  case 1:
908
- data = (_v.sent()).data;
925
+ data = (_y.sent()).data;
909
926
  if (data === null || data === void 0 ? void 0 : data.board_id) {
910
927
  leadData = data;
911
928
  accountData = data;
912
929
  }
913
- _v.label = 2;
930
+ _y.label = 2;
914
931
  case 2:
915
932
  body = {
916
933
  lead_id: leadId,
@@ -922,8 +939,8 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
922
939
  if (!!(leadData === null || leadData === void 0 ? void 0 : leadData.board_id)) return [3, 4];
923
940
  return [4, API.accountService.expressCreateAccount(body)];
924
941
  case 3:
925
- accountData = _v.sent();
926
- _v.label = 4;
942
+ accountData = _y.sent();
943
+ _y.label = 4;
927
944
  case 4:
928
945
  sendCustomEventToGTM({
929
946
  event: 'Send Event',
@@ -939,22 +956,41 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
939
956
  (_m = (_l = settings.data.appConfig).onCreated) === null || _m === void 0 ? void 0 : _m.call(_l, accountData);
940
957
  (_p = (_o = settings.data.appConfig).onFlowCompleted) === null || _p === void 0 ? void 0 : _p.call(_o, accountData);
941
958
  (_r = (_q = settings.data.appConfig).onStepCompleted) === null || _r === void 0 ? void 0 : _r.call(_q, settings.data.activeScreen.name, accountData);
942
- if (showBoard) {
943
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
944
- return [2, { accountData: accountData }];
945
- }
946
- if (!(scope === SCOPE_AUTH)) return [3, 8];
959
+ if (!(scope === SCOPE_MERCHANT)) return [3, 8];
947
960
  if (!!(leadData === null || leadData === void 0 ? void 0 : leadData.board_id)) return [3, 6];
948
961
  return [4, thunkApi.dispatch(getLeadByIdAsync(leadId)).unwrap()];
949
962
  case 5:
950
- data = (_v.sent()).data;
963
+ data = (_y.sent()).data;
951
964
  leadData = data;
952
- _v.label = 6;
953
- case 6: return [4, thunkApi.dispatch(onCloseComplete({ merchantId: (_s = leadData === null || leadData === void 0 ? void 0 : leadData.merchant) === null || _s === void 0 ? void 0 : _s.id, brandId: (_t = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _t === void 0 ? void 0 : _t.id, entityId: (_u = leadData === null || leadData === void 0 ? void 0 : leadData.entity) === null || _u === void 0 ? void 0 : _u.id }))];
965
+ _y.label = 6;
966
+ case 6:
967
+ if (!postURL) return [3, 8];
968
+ return [4, thunkApi.dispatch(onCloseComplete({
969
+ merchantId: (_s = leadData === null || leadData === void 0 ? void 0 : leadData.merchant) === null || _s === void 0 ? void 0 : _s.id,
970
+ brandId: (_t = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _t === void 0 ? void 0 : _t.id,
971
+ entityId: (_u = leadData === null || leadData === void 0 ? void 0 : leadData.entity) === null || _u === void 0 ? void 0 : _u.id,
972
+ nextScreen: showBoard ? 'CONNECT_EXPRESS_PREPARING_DATA_STEP' : ''
973
+ }))];
954
974
  case 7:
955
- _v.sent();
975
+ _y.sent();
956
976
  return [2, { accountData: accountData }];
957
977
  case 8:
978
+ if (showBoard) {
979
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
980
+ return [2, { accountData: accountData }];
981
+ }
982
+ if (!(scope === SCOPE_AUTH)) return [3, 12];
983
+ if (!!(leadData === null || leadData === void 0 ? void 0 : leadData.board_id)) return [3, 10];
984
+ return [4, thunkApi.dispatch(getLeadByIdAsync(leadId)).unwrap()];
985
+ case 9:
986
+ data = (_y.sent()).data;
987
+ leadData = data;
988
+ _y.label = 10;
989
+ case 10: return [4, thunkApi.dispatch(onCloseComplete({ merchantId: (_v = leadData === null || leadData === void 0 ? void 0 : leadData.merchant) === null || _v === void 0 ? void 0 : _v.id, brandId: (_w = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _w === void 0 ? void 0 : _w.id, entityId: (_x = leadData === null || leadData === void 0 ? void 0 : leadData.entity) === null || _x === void 0 ? void 0 : _x.id }))];
990
+ case 11:
991
+ _y.sent();
992
+ return [2, { accountData: accountData }];
993
+ case 12:
958
994
  if (redirectUrl && mode === 'page') {
959
995
  urlQueryStart = redirectUrl.includes('?') ? '&' : '?';
960
996
  window.open("".concat(redirectUrl).concat(urlQueryStart, "authentication_id=").concat(authId, "&bi=").concat(bi), '_self');
@@ -1110,13 +1146,13 @@ export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLe
1110
1146
  export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDataAsync ', function (_a, thunkApi) {
1111
1147
  var formData = _a.formData, originalFormData = _a.originalFormData;
1112
1148
  return __awaiter(void 0, void 0, void 0, function () {
1113
- var _b, settings, connectExpress, selectedLicense, brandName, licenseNumber, termAndConditionChecked, isKWCountry, isFL, _c, responseData, isLeadIdPassed, id, brandNameBody, payload, data;
1149
+ var _b, settings, connectExpress, selectedLicense, brandName, licenseNumber, termAndConditionChecked, unifiedNumber, isKWCountry, isFL, _c, responseData, isLeadIdPassed, id, brandNameBody, payload, data;
1114
1150
  var _d, _e;
1115
1151
  return __generator(this, function (_f) {
1116
1152
  switch (_f.label) {
1117
1153
  case 0:
1118
1154
  _b = thunkApi.getState(), settings = _b.settings, connectExpress = _b.connectExpress;
1119
- selectedLicense = formData.selectedLicense, brandName = formData.brandName, licenseNumber = formData.licenseNumber, termAndConditionChecked = formData.termAndConditionChecked;
1155
+ selectedLicense = formData.selectedLicense, brandName = formData.brandName, licenseNumber = formData.licenseNumber, termAndConditionChecked = formData.termAndConditionChecked, unifiedNumber = formData.unifiedNumber;
1120
1156
  isKWCountry = isKW(settings.data.businessCountry.iso2);
1121
1157
  isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
1122
1158
  _c = connectExpress.data, responseData = _c.responseData, isLeadIdPassed = _c.isLeadIdPassed;
@@ -1134,6 +1170,7 @@ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDat
1134
1170
  license_type: (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) ? (isFL ? LicenseType.FL : LicenseType.CR) : undefined,
1135
1171
  business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type,
1136
1172
  is_acknowledged: true,
1173
+ unified_number: unifiedNumber,
1137
1174
  terms_conditions_accepted: !isLeadIdPassed ? termAndConditionChecked : undefined,
1138
1175
  step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_BRAND_BUSINESS,
1139
1176
  encryption_contract: []
@@ -1274,7 +1311,11 @@ export var verifyAuthMobileOtpAsync = createAsyncThunk('connectExpress/verifyAut
1274
1311
  step_name: CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP,
1275
1312
  encryption_contract: ['data']
1276
1313
  };
1277
- 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
+ })];
1278
1319
  case 1:
1279
1320
  data = _e.sent();
1280
1321
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
@@ -1461,6 +1502,7 @@ var initialState = {
1461
1502
  businessData: {
1462
1503
  brandName: '',
1463
1504
  licenseNumber: '',
1505
+ unifiedNumber: '',
1464
1506
  termAndConditionChecked: false
1465
1507
  },
1466
1508
  authenticationData: {
@@ -1678,9 +1720,11 @@ export var connectSlice = createSlice({
1678
1720
  state.loading = false;
1679
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) });
1680
1722
  })
1681
- .addCase(verifyMobileOtpAsync.rejected, function (state, action) {
1723
+ .addCase(verifyMobileOtpAsync.rejected, function (state, _a) {
1724
+ var message = _a.error.message;
1682
1725
  state.loading = false;
1683
- state.error = action.error.message;
1726
+ if (!isAuthenticationVerificationFailed(message))
1727
+ state.error = message;
1684
1728
  })
1685
1729
  .addCase(verifyNafathAsync.pending, function (state) {
1686
1730
  state.loading = true;
@@ -1757,7 +1801,7 @@ export var connectSlice = createSlice({
1757
1801
  state.error = null;
1758
1802
  })
1759
1803
  .addCase(retrieveEntityListAsync.fulfilled, function (state, action) {
1760
- var _a, _b;
1804
+ var _a, _b, _c, _d;
1761
1805
  state.loading = false;
1762
1806
  var data = action.payload;
1763
1807
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
@@ -1777,7 +1821,8 @@ export var connectSlice = createSlice({
1777
1821
  }
1778
1822
  }
1779
1823
  licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
1780
- var _c = ((_b = state.data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) || {}, license_number = _c.license_number, license_type = _c.license_type;
1824
+ var _e = ((_b = state.data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) || {}, license_number = _e.license_number, license_type = _e.license_type, entity = _e.entity;
1825
+ var unified_number = (_d = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.additional_info) === null || _d === void 0 ? void 0 : _d.unified_number;
1781
1826
  var selectedLicense = undefined;
1782
1827
  if (license_number) {
1783
1828
  var findLicense = licenseList.find(function (_a) {
@@ -1793,6 +1838,18 @@ export var connectSlice = createSlice({
1793
1838
  selectedLicense = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: license_number } });
1794
1839
  state.data.businessData.licenseNumber = license_number;
1795
1840
  }
1841
+ if (unified_number) {
1842
+ var findLicense = licenseList.find(function (_a) {
1843
+ var _b;
1844
+ var license = _a.license;
1845
+ return ((_b = license === null || license === void 0 ? void 0 : license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number) === unified_number;
1846
+ });
1847
+ if (findLicense)
1848
+ selectedLicense = findLicense;
1849
+ else
1850
+ selectedLicense = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: '', additional_info: { unified_number: unified_number } } });
1851
+ state.data.businessData.unifiedNumber = unified_number;
1852
+ }
1796
1853
  state.data.businessData.selectedLicense = selectedLicense;
1797
1854
  state.data.responseData = __assign(__assign({}, state.data.responseData), { licenseList: licenseList });
1798
1855
  })
@@ -1895,6 +1952,7 @@ export var connectSlice = createSlice({
1895
1952
  state.loading = false;
1896
1953
  state.error = null;
1897
1954
  state.data.individualData.mobile = action.payload.formData.mobile;
1955
+ state.data.individualData.countryCode = action.payload.formData.countryCode;
1898
1956
  state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse, verifyAuthMobile: action.payload.leadResponse });
1899
1957
  state.data.verifyAuthOtpData.authFor = AuthForScreen.MOBILE_OWNERSHIP;
1900
1958
  })
@@ -1930,9 +1988,11 @@ export var connectSlice = createSlice({
1930
1988
  state.loading = true;
1931
1989
  state.error = null;
1932
1990
  })
1933
- .addCase(verifyAuthMobileOtpAsync.rejected, function (state, action) {
1991
+ .addCase(verifyAuthMobileOtpAsync.rejected, function (state, _a) {
1992
+ var message = _a.error.message;
1934
1993
  state.loading = false;
1935
- state.error = action.error.message;
1994
+ if (!isAuthenticationVerificationFailed(message))
1995
+ state.error = message;
1936
1996
  })
1937
1997
  .addCase(resendLeadMobileAuthOTP.pending, function (state) {
1938
1998
  state.loading = true;
@@ -63,7 +63,7 @@ import { BusinessType, DocumentPurpose, FlowsTypes, LicenseType } from '../../..
63
63
  import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
64
64
  import { ENTITY_STEP_NAMES } from '../../../constants';
65
65
  import moment from 'moment';
66
- import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep, formatNumberAsCurrency, removeAllCharsFromNumber, retrieveIndividualData, sendCustomEventToGTM } from '../../../utils';
66
+ import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep, formatNumberAsCurrency, removeAllCharsFromNumber, retrieveIndividualData, sendCustomEventToGTM, isAuthenticationVerificationFailed } from '../../../utils';
67
67
  export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
68
68
  var token = _a.token, isInternally = _a.isInternally;
69
69
  return __awaiter(void 0, void 0, void 0, function () {
@@ -145,9 +145,9 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
145
145
  }); });
146
146
  export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
147
147
  var _a, entity, settings, responseBody, payload, data, _b, entity_id, config, boardId, country_code, entityData, publicKey, countryIso2, data_2, entityTypes;
148
- var _c, _d, _e, _f, _g, _h;
149
- return __generator(this, function (_j) {
150
- switch (_j.label) {
148
+ var _c, _d, _e, _f, _g;
149
+ return __generator(this, function (_h) {
150
+ switch (_h.label) {
151
151
  case 0:
152
152
  _a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
153
153
  responseBody = entity.data.verify.responseBody;
@@ -158,11 +158,13 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
158
158
  step_name: ENTITY_STEP_NAMES.PHONE_AUTH,
159
159
  encryption_contract: ['data']
160
160
  };
161
- return [4, API.leadService.verifyLeadOTP(payload)];
161
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
162
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
163
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_OTP_VERIFY_SECURITY_ERROR_STEP'));
164
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
165
+ })];
162
166
  case 1:
163
- data = (_j.sent()).data;
164
- if ((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length)
165
- throw new Error(data.errors[0].description);
167
+ data = _h.sent();
166
168
  _b = data || {}, entity_id = _b.entity_id, config = _b.config, boardId = _b.id, country_code = _b.country_code;
167
169
  entityData = undefined;
168
170
  publicKey = config === null || config === void 0 ? void 0 : config.public_key;
@@ -174,22 +176,22 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
174
176
  if (!!entity_id) return [3, 3];
175
177
  return [4, API.boardService.retrieveBoardDetails(boardId)];
176
178
  case 2:
177
- data_2 = _j.sent();
178
- if (!((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.id))
179
+ data_2 = _h.sent();
180
+ if (!((_d = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _d === void 0 ? void 0 : _d.id))
179
181
  throw new Error('entity_id_missing');
180
182
  entityData = data_2;
181
183
  return [3, 5];
182
184
  case 3: return [4, API.entityService.retrieveEntity(entity_id)];
183
185
  case 4:
184
- entityData = _j.sent();
185
- _j.label = 5;
186
+ entityData = _h.sent();
187
+ _h.label = 5;
186
188
  case 5:
187
- if (!countryIso2 && ((_f = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _f === void 0 ? void 0 : _f.country))
189
+ if (!countryIso2 && ((_e = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _e === void 0 ? void 0 : _e.country))
188
190
  thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
189
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
191
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, { otp: params.otp });
190
192
  return [4, API.entityService.retrieveEntityType()];
191
193
  case 6:
192
- entityTypes = _j.sent();
194
+ entityTypes = _h.sent();
193
195
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP')); });
194
196
  return [2, {
195
197
  data: data,
@@ -649,9 +651,11 @@ export var entitySlice = createSlice({
649
651
  state.data.entityCapitalData.capitalShareValue = formatNumberAsCurrency(shares === null || shares === void 0 ? void 0 : shares.value);
650
652
  state.data.entityNameData = __assign(__assign({}, state.data.entityNameData), { responseBody: __assign(__assign({}, state.data.entityNameData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id }) });
651
653
  })
652
- .addCase(verifyEntityLeadOTP.rejected, function (state, action) {
654
+ .addCase(verifyEntityLeadOTP.rejected, function (state, _a) {
655
+ var message = _a.error.message;
653
656
  state.loading = false;
654
- state.error = action.error.message;
657
+ if (!isAuthenticationVerificationFailed(message))
658
+ state.error = message;
655
659
  })
656
660
  .addCase(updateEntityName.pending, function (state) {
657
661
  state.loading = true;
@@ -71,7 +71,7 @@ import API from '../../../api';
71
71
  import { FlowsTypes, IndividualGender, DocumentPurpose } from '../../../@types';
72
72
  import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
73
73
  import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES, MONTHLY_INCOME_LIST } from '../../../constants';
74
- import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType, isOtherThanKWOrSA, isKWOrSA, sendCustomEventToGTM } from '../../../utils';
74
+ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType, isOtherThanKWOrSA, isKWOrSA, sendCustomEventToGTM, isAuthenticationVerificationFailed } from '../../../utils';
75
75
  export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
76
76
  var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
77
77
  return __awaiter(void 0, void 0, void 0, function () {
@@ -445,9 +445,9 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
445
445
  });
446
446
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
447
447
  var _a, individual, settings, responseBody, countries, payload, data, userList, recipientData, publicKey, countryCode, _b, business_id, recipient, board_id, board_info_id, notification, _c, id, type, individualData, birthCountry;
448
- var _d, _e, _f, _g, _h, _j, _k, _l;
449
- return __generator(this, function (_m) {
450
- switch (_m.label) {
448
+ var _d, _e, _f, _g, _h, _j, _k;
449
+ return __generator(this, function (_l) {
450
+ switch (_l.label) {
451
451
  case 0:
452
452
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
453
453
  responseBody = individual.data.verify.responseBody;
@@ -459,40 +459,42 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
459
459
  step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
460
460
  encryption_contract: ['data']
461
461
  };
462
- return [4, API.leadService.verifyLeadOTP(payload)];
462
+ return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
463
+ if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
464
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_OTP_VERIFY_SECURITY_ERROR_STEP'));
465
+ throw new Error(err === null || err === void 0 ? void 0 : err.message);
466
+ })];
463
467
  case 1:
464
- data = (_m.sent()).data;
468
+ data = _l.sent();
465
469
  recipientData = undefined;
466
- if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
467
- throw new Error(data.errors[0].description);
468
- publicKey = (_f = data === null || data === void 0 ? void 0 : data.config) === null || _f === void 0 ? void 0 : _f.public_key;
470
+ publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
469
471
  countryCode = data === null || data === void 0 ? void 0 : data.country_code;
470
472
  if (publicKey)
471
473
  thunkApi.dispatch(handlePublicKey(publicKey));
472
- if (!((_g = settings.data.businessCountry) === null || _g === void 0 ? void 0 : _g.iso2) && countryCode)
474
+ if (!((_f = settings.data.businessCountry) === null || _f === void 0 ? void 0 : _f.iso2) && countryCode)
473
475
  thunkApi.dispatch(handleSetCountryByIso2(countryCode));
474
476
  _b = data || {}, business_id = _b.business_id, recipient = _b.recipient, board_id = _b.id, board_info_id = _b.board_info_id;
475
477
  recipientData = recipient;
476
- if (!!((_h = data === null || data === void 0 ? void 0 : data.recipient) === null || _h === void 0 ? void 0 : _h.id)) return [3, 3];
478
+ if (!!((_g = data === null || data === void 0 ? void 0 : data.recipient) === null || _g === void 0 ? void 0 : _g.id)) return [3, 3];
477
479
  if (!(board_id && board_info_id)) return [3, 3];
478
480
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
479
481
  case 2:
480
- notification = (_m.sent()).notification;
482
+ notification = (_l.sent()).notification;
481
483
  recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
482
484
  if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
483
485
  throw new Error('individual_id_missing');
484
- _m.label = 3;
486
+ _l.label = 3;
485
487
  case 3:
486
488
  _c = recipientData || {}, id = _c.id, type = _c.type;
487
489
  return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
488
490
  case 4:
489
- individualData = (_m.sent()).data;
491
+ individualData = (_l.sent()).data;
490
492
  if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 7];
491
493
  if (!business_id) return [3, 6];
492
494
  return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
493
495
  case 5:
494
- userList = _m.sent();
495
- _m.label = 6;
496
+ userList = _l.sent();
497
+ _l.label = 6;
496
498
  case 6:
497
499
  userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id; });
498
500
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
@@ -502,23 +504,23 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
502
504
  if (!business_id) return [3, 9];
503
505
  return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
504
506
  case 8:
505
- userList = _m.sent();
506
- _m.label = 9;
507
+ userList = _l.sent();
508
+ _l.label = 9;
507
509
  case 9:
508
510
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
509
511
  return [3, 13];
510
512
  case 10:
511
- birthCountry = ((_j = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _j === void 0 ? void 0 : _j.country) || countryCode;
513
+ birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
512
514
  if (!birthCountry) return [3, 12];
513
515
  return [4, thunkApi.dispatch(getCityList(birthCountry))];
514
516
  case 11:
515
- _m.sent();
516
- _m.label = 12;
517
+ _l.sent();
518
+ _l.label = 12;
517
519
  case 12:
518
520
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
519
- _m.label = 13;
521
+ _l.label = 13;
520
522
  case 13:
521
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, { otp: params.otp });
523
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, { otp: params.otp });
522
524
  return [2, {
523
525
  data: data,
524
526
  countries: countries,
@@ -621,7 +623,8 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
621
623
  expiry: isExpiryNonEditable || !expiryDate ? undefined : new Date(expiryDate).getTime(),
622
624
  type: isIdTypeNonEditable || !identification_id_type ? undefined : identification_id_type
623
625
  }
624
- })), (!isDOBNonEditable && {
626
+ })), (!isDOBNonEditable &&
627
+ dob && {
625
628
  date_of_birth: dob
626
629
  })), (hasBirth &&
627
630
  !(isBirthCityNonEditable && isBirthCountryNonEditable) && {
@@ -911,8 +914,8 @@ var initialState = {
911
914
  gender: IndividualGender.MALE,
912
915
  nid: '',
913
916
  issuedCountry: undefined,
914
- expiryDate: '',
915
- dob: '',
917
+ expiryDate: undefined,
918
+ dob: undefined,
916
919
  placeOfBirthCountry: undefined,
917
920
  placeOfBirthCity: undefined,
918
921
  nationality: undefined
@@ -1009,9 +1012,11 @@ export var individualSlice = createSlice({
1009
1012
  state.data.otpData.responseBody = data;
1010
1013
  state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { countries: countries, countryCode: countryCode, userList: userList });
1011
1014
  })
1012
- .addCase(verifyLeadOTP.rejected, function (state, action) {
1015
+ .addCase(verifyLeadOTP.rejected, function (state, _a) {
1016
+ var message = _a.error.message;
1013
1017
  state.loading = false;
1014
- state.error = action.error.message;
1018
+ if (!isAuthenticationVerificationFailed(message))
1019
+ state.error = message;
1015
1020
  })
1016
1021
  .addCase(addDetailsAsync.pending, function (state) {
1017
1022
  state.addOrRequestDetailLoading = true;