@tap-payments/auth-jsconnect 2.10.11-development → 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.
- package/build/@types/app.d.ts +2 -2
- package/build/@types/app.js +0 -1
- package/build/@types/form.d.ts +4 -2
- package/build/@types/index.d.ts +0 -1
- package/build/@types/index.js +0 -1
- package/build/api/account.d.ts +2 -2
- package/build/api/account.js +7 -4
- package/build/api/auth.d.ts +2 -10
- package/build/api/auth.js +7 -3
- package/build/api/axios.d.ts +1 -1
- package/build/api/entity.d.ts +3 -0
- package/build/api/headers.d.ts +5 -0
- package/build/api/headers.js +3 -0
- package/build/api/index.d.ts +5 -11
- package/build/api/index.js +1 -3
- package/build/api/lead.d.ts +1 -0
- package/build/api/operator.d.ts +1 -1
- package/build/api/operator.js +5 -2
- package/build/app/rootReducer.d.ts +0 -1
- package/build/app/rootReducer.js +1 -3
- package/build/app/settings.js +1 -2
- package/build/app/store.d.ts +0 -2
- package/build/assets/currencies/AEDSymbol.js +1 -1
- package/build/assets/currencies/SARSymbol.js +1 -1
- package/build/assets/locales/ar.json +14 -5
- package/build/assets/locales/en.json +17 -7
- package/build/components/OTPTimer/OTPTimer.d.ts +1 -2
- package/build/components/OTPTimer/OTPTimer.js +4 -4
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/api.d.ts +2 -0
- package/build/constants/api.js +4 -0
- package/build/constants/app.d.ts +12 -12
- package/build/constants/app.js +98 -129
- package/build/constants/flows.d.ts +0 -15
- package/build/constants/flows.js +0 -15
- package/build/constants/validation.d.ts +1 -1
- package/build/constants/validation.js +1 -1
- package/build/features/app/auth/authStore.js +64 -54
- package/build/features/app/bank/bankStore.js +24 -20
- package/build/features/app/board/boardStore.js +11 -7
- package/build/features/app/brand/brandStore.js +22 -18
- package/build/features/app/business/businessStore.js +45 -36
- package/build/features/app/connect/connectStore.d.ts +6 -5
- package/build/features/app/connect/connectStore.js +48 -31
- package/build/features/app/connectExpress/connectExpressStore.d.ts +6 -5
- package/build/features/app/connectExpress/connectExpressStore.js +61 -20
- package/build/features/app/entity/entityStore.js +21 -17
- package/build/features/app/individual/individualStore.js +34 -28
- package/build/features/app/password/passwordStore.js +44 -46
- package/build/features/app/signIn/signInStore.js +12 -16
- package/build/features/app/tax/taxStore.js +20 -16
- package/build/features/auth/Auth.d.ts +1 -1
- package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +10 -7
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +6 -4
- package/build/features/auth/screens/AuthenticationList/EntityList.js +11 -3
- package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +1 -1
- package/build/features/business/screens/BusinessType/BusinessType.js +15 -5
- package/build/features/business/screens/BusinessType/EntityLicenseList.js +11 -5
- package/build/features/business/screens/BusinessType/LicenseList.js +20 -12
- package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +35 -0
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +84 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
- package/build/features/business/screens/BusinessType/validation.js +31 -10
- package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +10 -10
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +6 -4
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +11 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +27 -16
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +36 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +81 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +6 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +57 -21
- package/build/features/connectExpress/screens/Mobile/Mobile.js +7 -6
- package/build/features/entity/screens/EntityName/EntityName.js +16 -15
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +50 -48
- package/build/features/entity/screens/EntityName/validation.js +100 -85
- package/build/features/featuresScreens.d.ts +0 -1
- package/build/features/featuresScreens.js +55 -67
- package/build/features/shared/Button/Button.js +1 -1
- package/build/features/shared/Button/FlowsButtons.js +1 -1
- package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.js +9 -0
- package/build/features/shared/OTPVerifySecurityError/index.d.ts +2 -0
- package/build/features/shared/OTPVerifySecurityError/index.js +2 -0
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +1 -3
- package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
- package/build/hooks/useAppConfig.js +1 -1
- package/build/hooks/useAppDispatch.d.ts +0 -1
- package/build/index.d.ts +2 -3
- package/build/index.js +2 -4
- package/build/theme/palette.js +0 -12
- package/build/theme/typography.js +0 -4
- package/build/utils/common.d.ts +1 -1
- package/build/utils/common.js +14 -8
- package/build/utils/error.d.ts +2 -0
- package/build/utils/error.js +6 -0
- package/build/utils/string.d.ts +3 -3
- package/build/utils/string.js +5 -11
- package/build/utils/validation.js +1 -1
- package/package.json +3 -3
- package/build/@types/terminal.d.ts +0 -116
- package/build/@types/terminal.js +0 -1
- package/build/api/terminal.d.ts +0 -28
- package/build/api/terminal.js +0 -45
- package/build/components/DeviceCard/DeviceCard.d.ts +0 -18
- package/build/components/DeviceCard/DeviceCard.js +0 -103
- package/build/components/DeviceCard/index.d.ts +0 -3
- package/build/components/DeviceCard/index.js +0 -2
- package/build/features/app/terminal/terminalStore.d.ts +0 -109
- package/build/features/app/terminal/terminalStore.js +0 -673
- package/build/features/shared/PushNotification/PushNotification.d.ts +0 -11
- package/build/features/shared/PushNotification/PushNotification.js +0 -34
- package/build/features/shared/PushNotification/index.d.ts +0 -2
- package/build/features/shared/PushNotification/index.js +0 -2
- package/build/features/terminal/Terminal.d.ts +0 -14
- package/build/features/terminal/Terminal.js +0 -95
- package/build/features/terminal/index.d.ts +0 -1
- package/build/features/terminal/index.js +0 -1
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +0 -69
- package/build/features/terminal/screens/LinkNewTerminal/index.d.ts +0 -2
- package/build/features/terminal/screens/LinkNewTerminal/index.js +0 -2
- package/build/features/terminal/screens/LinkNewTerminal/styles.d.ts +0 -10
- package/build/features/terminal/screens/LinkNewTerminal/styles.js +0 -28
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.d.ts +0 -3
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +0 -51
- package/build/features/terminal/screens/LinkedSuccess/index.d.ts +0 -2
- package/build/features/terminal/screens/LinkedSuccess/index.js +0 -2
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.d.ts +0 -3
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +0 -50
- package/build/features/terminal/screens/LinkedTerminalInfo/index.d.ts +0 -2
- package/build/features/terminal/screens/LinkedTerminalInfo/index.js +0 -2
- package/build/features/terminal/screens/Loading/Loading.d.ts +0 -4
- package/build/features/terminal/screens/Loading/Loading.js +0 -10
- package/build/features/terminal/screens/Loading/index.d.ts +0 -2
- package/build/features/terminal/screens/Loading/index.js +0 -2
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.d.ts +0 -3
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +0 -56
- package/build/features/terminal/screens/NoTerminalDeviceLinked/index.d.ts +0 -2
- package/build/features/terminal/screens/NoTerminalDeviceLinked/index.js +0 -2
- package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.d.ts +0 -36
- package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.js +0 -34
- package/build/features/terminal/screens/OperatorError/OperatorError.d.ts +0 -5
- package/build/features/terminal/screens/OperatorError/OperatorError.js +0 -9
- package/build/features/terminal/screens/OperatorError/index.d.ts +0 -2
- package/build/features/terminal/screens/OperatorError/index.js +0 -2
- package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +0 -3
- package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +0 -21
- package/build/features/terminal/screens/ResetPasswordSuccess/index.d.ts +0 -2
- package/build/features/terminal/screens/ResetPasswordSuccess/index.js +0 -2
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +0 -3
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +0 -31
- package/build/features/terminal/screens/SuccessWithFlowButtons/index.d.ts +0 -2
- package/build/features/terminal/screens/SuccessWithFlowButtons/index.js +0 -2
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +0 -9
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +0 -20
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.d.ts +0 -3
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +0 -144
- package/build/features/terminal/screens/TerminalDeviceList/index.d.ts +0 -2
- package/build/features/terminal/screens/TerminalDeviceList/index.js +0 -2
- package/build/features/terminal/screens/TerminalDeviceList/styles.d.ts +0 -9
- package/build/features/terminal/screens/TerminalDeviceList/styles.js +0 -13
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.d.ts +0 -3
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +0 -42
- package/build/features/terminal/screens/TerminalListPage/index.d.ts +0 -2
- package/build/features/terminal/screens/TerminalListPage/index.js +0 -2
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.d.ts +0 -3
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +0 -53
- package/build/features/terminal/screens/UnlinkedSuccess/index.d.ts +0 -2
- package/build/features/terminal/screens/UnlinkedSuccess/index.js +0 -2
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.d.ts +0 -3
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +0 -98
- package/build/features/terminal/screens/UnlinkedTerminalInfo/index.d.ts +0 -2
- package/build/features/terminal/screens/UnlinkedTerminalInfo/index.js +0 -2
- package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.d.ts +0 -26
- package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.js +0 -30
- package/build/features/terminal/screens/Verify/OTPInput.d.ts +0 -7
- package/build/features/terminal/screens/Verify/OTPInput.js +0 -51
- package/build/features/terminal/screens/Verify/Verify.d.ts +0 -5
- package/build/features/terminal/screens/Verify/Verify.js +0 -85
- package/build/features/terminal/screens/Verify/index.d.ts +0 -2
- package/build/features/terminal/screens/Verify/index.js +0 -2
- package/build/features/terminal/screens/Verify/validation.d.ts +0 -8
- package/build/features/terminal/screens/Verify/validation.js +0 -4
- package/build/features/terminal/screens/shared/Header.d.ts +0 -10
- package/build/features/terminal/screens/shared/Header.js +0 -30
- package/build/features/terminal/screens/shared/TerminalList.d.ts +0 -11
- package/build/features/terminal/screens/shared/TerminalList.js +0 -25
- package/build/features/terminal/screens/shared/index.d.ts +0 -5
- package/build/features/terminal/screens/shared/index.js +0 -5
- package/build/features/terminal/screens/shared/styles.d.ts +0 -196
- package/build/features/terminal/screens/shared/styles.js +0 -155
- package/build/features/terminal/screens/shared/utils.d.ts +0 -7
- package/build/features/terminal/screens/shared/utils.js +0 -24
- /package/build/features/{terminal/screens/LinkNewTerminal/LinkNewTerminal.d.ts → shared/OTPVerifySecurityError/OTPVerifySecurityError.d.ts} +0 -0
|
@@ -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
|
|
149
|
-
return __generator(this, function (
|
|
150
|
-
switch (
|
|
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.
|
|
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 =
|
|
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 =
|
|
178
|
-
if (!((
|
|
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 =
|
|
185
|
-
|
|
186
|
+
entityData = _h.sent();
|
|
187
|
+
_h.label = 5;
|
|
186
188
|
case 5:
|
|
187
|
-
if (!countryIso2 && ((
|
|
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
|
-
(
|
|
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 =
|
|
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,
|
|
654
|
+
.addCase(verifyEntityLeadOTP.rejected, function (state, _a) {
|
|
655
|
+
var message = _a.error.message;
|
|
653
656
|
state.loading = false;
|
|
654
|
-
|
|
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
|
|
449
|
-
return __generator(this, function (
|
|
450
|
-
switch (
|
|
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.
|
|
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 =
|
|
468
|
+
data = _l.sent();
|
|
465
469
|
recipientData = undefined;
|
|
466
|
-
|
|
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 (!((
|
|
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 (!!((
|
|
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 = (
|
|
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
|
-
|
|
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 = (
|
|
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 =
|
|
495
|
-
|
|
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 =
|
|
506
|
-
|
|
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 = ((
|
|
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
|
-
|
|
516
|
-
|
|
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
|
-
|
|
521
|
+
_l.label = 13;
|
|
520
522
|
case 13:
|
|
521
|
-
(
|
|
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,
|
|
1015
|
+
.addCase(verifyLeadOTP.rejected, function (state, _a) {
|
|
1016
|
+
var message = _a.error.message;
|
|
1013
1017
|
state.loading = false;
|
|
1014
|
-
|
|
1018
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
1019
|
+
state.error = message;
|
|
1015
1020
|
})
|
|
1016
1021
|
.addCase(addDetailsAsync.pending, function (state) {
|
|
1017
1022
|
state.addOrRequestDetailLoading = true;
|
|
@@ -1181,6 +1186,7 @@ export var individualSlice = createSlice({
|
|
|
1181
1186
|
state.data.individualData.isAuthorized = is_authorized;
|
|
1182
1187
|
})
|
|
1183
1188
|
.addCase(retrieveIndividualInfo.rejected, function (state, action) {
|
|
1189
|
+
state.addOrRequestDetailLoading = false;
|
|
1184
1190
|
state.error = action.error.message;
|
|
1185
1191
|
})
|
|
1186
1192
|
.addCase(getIndividualList.pending, function (state) {
|
|
@@ -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
|
|
160
|
-
return __generator(this, function (
|
|
161
|
-
switch (
|
|
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.
|
|
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 =
|
|
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
|
-
(
|
|
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 = (
|
|
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 =
|
|
201
|
-
if ((
|
|
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
|
-
|
|
205
|
+
_g.label = 5;
|
|
204
206
|
case 5:
|
|
205
207
|
thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
|
|
206
|
-
|
|
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
|
|
300
|
-
return __generator(this, function (
|
|
301
|
-
switch (
|
|
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 =
|
|
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 = (
|
|
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 =
|
|
323
|
-
if ((
|
|
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
|
-
|
|
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 =
|
|
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
|
|
358
|
-
return __generator(this, function (
|
|
359
|
-
switch (
|
|
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 =
|
|
377
|
-
|
|
378
|
-
|
|
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,
|
|
514
|
+
.addCase(verifyPasswordLeadOTP.rejected, function (state, _a) {
|
|
515
|
+
var message = _a.error.message;
|
|
515
516
|
state.loading = false;
|
|
516
|
-
|
|
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,
|
|
628
|
-
|
|
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 =
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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 =
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
|
182
|
-
return __generator(this, function (
|
|
183
|
-
switch (
|
|
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.
|
|
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 =
|
|
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 =
|
|
211
|
-
if (!((
|
|
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 =
|
|
218
|
-
|
|
219
|
+
entityData = _h.sent();
|
|
220
|
+
_h.label = 5;
|
|
219
221
|
case 5:
|
|
220
|
-
if (!countryIso2 && ((
|
|
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
|
-
(
|
|
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,
|
|
431
|
+
.addCase(verifyTaxLeadOTP.rejected, function (state, _a) {
|
|
432
|
+
var message = _a.error.message;
|
|
430
433
|
state.loading = false;
|
|
431
|
-
|
|
434
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
435
|
+
state.error = message;
|
|
432
436
|
})
|
|
433
437
|
.addCase(updateTaxInfo.pending, function (state) {
|
|
434
438
|
state.loading = true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { LibConfig } from '../../@types';
|
|
3
|
-
export interface AuthLibProps extends Pick<LibConfig, 'open' | 'mode' | 'scope' | 'merchantDomain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'appInfo' | 'businessCountryCode' | 'language' | 'onFlowCompleted' | 'onError' | 'onStepCompleted' | 'onReady' | 'onClose' | 'onStepStarted'> {
|
|
3
|
+
export interface AuthLibProps extends Pick<LibConfig, 'open' | 'mode' | 'scope' | 'merchantDomain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'appInfo' | 'businessCountryCode' | 'language' | 'onFlowCompleted' | 'onError' | 'onStepCompleted' | 'onReady' | 'onClose' | 'onStepStarted' | 'region'> {
|
|
4
4
|
leadId?: string;
|
|
5
5
|
configToken?: string;
|
|
6
6
|
}
|
|
@@ -17,7 +17,7 @@ import Collapse from '@mui/material/Collapse';
|
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
|
-
import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
20
|
+
import { deepCopy, isSA, sendCustomEventToGTM } from '../../../../utils';
|
|
21
21
|
import Form from '../../../../components/Form';
|
|
22
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
23
|
import Button from '../../../shared/Button';
|
|
@@ -27,19 +27,22 @@ import BrandList from './BrandList';
|
|
|
27
27
|
import EntityList from './EntityList';
|
|
28
28
|
import EntityLegalName from './EntityLegalName';
|
|
29
29
|
import LicenseNumber from './LicenseNumber';
|
|
30
|
-
import
|
|
30
|
+
import EntityLicenseType from './EntityLicenseType';
|
|
31
31
|
var ListType;
|
|
32
32
|
(function (ListType) {
|
|
33
33
|
ListType["BrandList"] = "BrandList";
|
|
34
34
|
ListType["EntityList"] = "EntityList";
|
|
35
35
|
})(ListType || (ListType = {}));
|
|
36
36
|
var AuthenticationList = function (_a) {
|
|
37
|
+
var _b;
|
|
37
38
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var _c = useAppSelector(authSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
40
|
+
var _d = data.authenticationData, brandInfo = _d.brandInfo, entityInfo = _d.entityInfo;
|
|
41
|
+
var _e = React.useState(), listActive = _e[0], setListActive = _e[1];
|
|
41
42
|
var brandList = (data.responseData || {}).brandList;
|
|
42
|
-
var
|
|
43
|
+
var _f = React.useState(false), isAddEntity = _f[0], setIsAddEntity = _f[1];
|
|
44
|
+
var code = (_b = settingsData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2;
|
|
45
|
+
var isSACountry = React.useMemo(function () { return isSA(code); }, [code]);
|
|
43
46
|
React.useEffect(function () {
|
|
44
47
|
sendCustomEventToGTM({
|
|
45
48
|
event: 'Send Event',
|
|
@@ -91,6 +94,6 @@ var AuthenticationList = function (_a) {
|
|
|
91
94
|
};
|
|
92
95
|
var isBrandList = listActive === ListType.BrandList;
|
|
93
96
|
var isEntityList = listActive === ListType.EntityList;
|
|
94
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { list: brandList || [], show: !isAddEntity && !isEntityList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EntityList, { countryList: settingsData.countries || [], show: !isBrandList, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); }, handleAddEntity: function (flag) { return setIsAddEntity(flag); } }), _jsxs(Collapse, __assign({ in: isAddEntity && !isBrandList && !isEntityList }, { children: [_jsx(EntityLegalName, {}), _jsx(
|
|
97
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { list: brandList || [], show: !isAddEntity && !isEntityList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EntityList, { countryList: settingsData.countries || [], show: !isBrandList, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); }, handleAddEntity: function (flag) { return setIsAddEntity(flag); } }), _jsxs(Collapse, __assign({ in: isAddEntity && !isBrandList && !isEntityList }, { children: [_jsx(EntityLegalName, {}), _jsx(EntityLicenseType, { show: isSACountry }), _jsx(LicenseNumber, {})] })), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: isAddEntity ? t('create_new_entity') : t('next') })) }))] })) })) }));
|
|
95
98
|
};
|
|
96
99
|
export default React.memo(AuthenticationList);
|