@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
|
@@ -59,7 +59,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
59
59
|
import API from '../../../api';
|
|
60
60
|
import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
|
|
61
61
|
import { BUSINESS_STEP_NAMES, COLLECT_DOB_INFO_NAFATH, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE, defaultCountry } from '../../../constants';
|
|
62
|
-
import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue, sendCustomEventToGTM, findCountryByIddPrefix, isNetworkError, isTimeoutError } from '../../../utils';
|
|
62
|
+
import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue, sendCustomEventToGTM, findCountryByIddPrefix, isNetworkError, isTimeoutError, isAuthenticationVerificationFailed } from '../../../utils';
|
|
63
63
|
import { handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
64
64
|
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
65
|
var payload, data, publicKey, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
|
|
@@ -198,9 +198,9 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
198
198
|
}); });
|
|
199
199
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
200
200
|
var _a, business, settings, isNID, responseBody, stepName, payload, data, publicKey, brandData, isicActivityList, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, boardResponse, list, list;
|
|
201
|
-
var _b, _c, _d, _e, _f, _g, _h
|
|
202
|
-
return __generator(this, function (
|
|
203
|
-
switch (
|
|
201
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
202
|
+
return __generator(this, function (_j) {
|
|
203
|
+
switch (_j.label) {
|
|
204
204
|
case 0:
|
|
205
205
|
_a = thunkApi.getState(), business = _a.business, settings = _a.settings;
|
|
206
206
|
isNID = business.data.otpData.isNID;
|
|
@@ -213,26 +213,28 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
213
213
|
step_name: stepName,
|
|
214
214
|
encryption_contract: ['data']
|
|
215
215
|
};
|
|
216
|
-
return [4, API.leadService.
|
|
216
|
+
return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
|
|
217
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
218
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
219
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
220
|
+
})];
|
|
217
221
|
case 1:
|
|
218
|
-
data =
|
|
219
|
-
|
|
220
|
-
throw new Error(data.errors[0].description);
|
|
221
|
-
publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
|
|
222
|
+
data = _j.sent();
|
|
223
|
+
publicKey = (_f = data === null || data === void 0 ? void 0 : data.config) === null || _f === void 0 ? void 0 : _f.public_key;
|
|
222
224
|
if (publicKey) {
|
|
223
225
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
224
226
|
}
|
|
225
227
|
isicActivityList = undefined;
|
|
226
228
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
227
229
|
case 2:
|
|
228
|
-
leadData = (
|
|
230
|
+
leadData = (_j.sent()).data;
|
|
229
231
|
thunkApi.dispatch(updateStepName(stepName));
|
|
230
232
|
brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id, business_id = leadData.business_id, entity = leadData.entity;
|
|
231
233
|
brandID = brand === null || brand === void 0 ? void 0 : brand.id;
|
|
232
234
|
countryIso2 = country_code;
|
|
233
235
|
if (countryIso2)
|
|
234
236
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
235
|
-
(
|
|
237
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
236
238
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
237
239
|
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
|
|
238
240
|
hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
|
|
@@ -241,14 +243,14 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
241
243
|
if (!(!isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 4];
|
|
242
244
|
return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
|
|
243
245
|
case 3:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
+
_j.sent();
|
|
247
|
+
_j.label = 4;
|
|
246
248
|
case 4:
|
|
247
249
|
if (!(isSA(countryIso2) && !isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 6];
|
|
248
250
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
249
251
|
case 5:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
+
_j.sent();
|
|
253
|
+
_j.label = 6;
|
|
252
254
|
case 6:
|
|
253
255
|
if (!isNID) return [3, 7];
|
|
254
256
|
thunkApi.dispatch(handleNextScreenStep());
|
|
@@ -262,12 +264,12 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
262
264
|
if (!board_id) return [3, 11];
|
|
263
265
|
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
264
266
|
case 9:
|
|
265
|
-
boardResponse =
|
|
267
|
+
boardResponse = _j.sent();
|
|
266
268
|
leadData = __assign(__assign({}, leadData), { flows: (boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || [] });
|
|
267
269
|
return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
268
270
|
case 10:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
+
_j.sent();
|
|
272
|
+
_j.label = 11;
|
|
271
273
|
case 11:
|
|
272
274
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP')); });
|
|
273
275
|
return [3, 23];
|
|
@@ -287,30 +289,30 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
287
289
|
if (!hasBusinessCRActivitiesCompleted) return [3, 19];
|
|
288
290
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
289
291
|
case 16:
|
|
290
|
-
list = (
|
|
292
|
+
list = (_j.sent()).list;
|
|
291
293
|
isicActivityList = list || [];
|
|
292
294
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
293
295
|
case 17:
|
|
294
|
-
|
|
296
|
+
_j.sent();
|
|
295
297
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
296
298
|
case 18:
|
|
297
|
-
brandData =
|
|
299
|
+
brandData = _j.sent();
|
|
298
300
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP')); });
|
|
299
301
|
return [3, 23];
|
|
300
302
|
case 19:
|
|
301
303
|
if (!hasBusinessCRInfoCompleted) return [3, 22];
|
|
302
304
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
303
305
|
case 20:
|
|
304
|
-
list = (
|
|
306
|
+
list = (_j.sent()).list;
|
|
305
307
|
isicActivityList = list || [];
|
|
306
308
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
307
309
|
case 21:
|
|
308
|
-
brandData =
|
|
310
|
+
brandData = _j.sent();
|
|
309
311
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP')); });
|
|
310
312
|
return [3, 23];
|
|
311
313
|
case 22:
|
|
312
314
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP')); });
|
|
313
|
-
|
|
315
|
+
_j.label = 23;
|
|
314
316
|
case 23: return [2, { data: data, verifyNextStepName: data.step_name, isicActivityList: isicActivityList, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
|
|
315
317
|
}
|
|
316
318
|
});
|
|
@@ -651,26 +653,26 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
|
|
|
651
653
|
});
|
|
652
654
|
}); });
|
|
653
655
|
export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
654
|
-
var _a, settings, business, isKWCountry, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, selectedEntityLicense, isFL, _b, lead_id, brand, stepName, payload, data, accountBody, accountData, documentData, entityData, brandData, data_1, brandRes, _c, message, error, list, entityId, documentBody, payload_1;
|
|
656
|
+
var _a, settings, business, isKWCountry, selectedLicense, licenseNumber, entityLegalName, certificateId, articleId, selectedEntityLicense, unifiedNumber, isFL, _b, lead_id, brand, stepName, payload, data, accountBody, accountData, documentData, entityData, brandData, data_1, brandRes, _c, message, error, list, entityId, documentBody, payload_1;
|
|
655
657
|
var _d, _e, _f;
|
|
656
658
|
return __generator(this, function (_g) {
|
|
657
659
|
switch (_g.label) {
|
|
658
660
|
case 0:
|
|
659
661
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
660
662
|
isKWCountry = isKW(settings.data.businessCountry.iso2);
|
|
661
|
-
selectedLicense = params.selectedLicense, licenseNumber = params.licenseNumber, entityLegalName = params.entityLegalName, certificateId = params.certificateId, articleId = params.articleId, selectedEntityLicense = params.selectedEntityLicense;
|
|
663
|
+
selectedLicense = params.selectedLicense, licenseNumber = params.licenseNumber, entityLegalName = params.entityLegalName, certificateId = params.certificateId, articleId = params.articleId, selectedEntityLicense = params.selectedEntityLicense, unifiedNumber = params.unifiedNumber;
|
|
662
664
|
isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
663
665
|
_b = business.data.verify.responseBody || {}, lead_id = _b.lead_id, brand = _b.brand;
|
|
664
666
|
stepName = 'BUSINESS_ACTIVITIES_STEP';
|
|
665
667
|
payload = __assign(__assign(__assign(__assign({ id: lead_id || '', entity: {
|
|
666
668
|
id: (selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) && (isKWCountry ? !isFL : true) ? selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id : ''
|
|
667
|
-
} }, (!(selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) && {
|
|
669
|
+
}, unified_number: unifiedNumber }, (!(selectedEntityLicense === null || selectedEntityLicense === void 0 ? void 0 : selectedEntityLicense.id) && {
|
|
668
670
|
license_number: isKWCountry && isFL ? '' : licenseNumber,
|
|
669
671
|
license_type: isFL ? LicenseType.FL : LicenseType.CR,
|
|
670
672
|
business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type
|
|
671
673
|
})), { step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_INFO }), (isKWCountry && {
|
|
672
674
|
business_name: isFL ? undefined : { ar: entityLegalName, en: entityLegalName }
|
|
673
|
-
})), { encryption_contract: ['license_number', 'business_type', 'license_type'] });
|
|
675
|
+
})), { encryption_contract: ['license_number', 'business_type', 'license_type', 'entity.unified_number'] });
|
|
674
676
|
return [4, API.leadService.updateLead(payload)];
|
|
675
677
|
case 1:
|
|
676
678
|
data = _g.sent();
|
|
@@ -988,6 +990,7 @@ var initialState = {
|
|
|
988
990
|
businessTypeData: {
|
|
989
991
|
licenseNumber: '',
|
|
990
992
|
entityLegalName: '',
|
|
993
|
+
unifiedNumber: '',
|
|
991
994
|
isPrevDob: false
|
|
992
995
|
},
|
|
993
996
|
activitiesData: {
|
|
@@ -1134,9 +1137,11 @@ export var businessSlice = createSlice({
|
|
|
1134
1137
|
var licenseList = [OTHER_CR_LICENSE, OTHER_FL_LICENSE];
|
|
1135
1138
|
state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList }), (!((_e = (_d = (_c = state.data.businessTypeData) === null || _c === void 0 ? void 0 : _c.responseBody) === null || _d === void 0 ? void 0 : _d.licenseList) === null || _e === void 0 ? void 0 : _e.length) && { licenseList: licenseList }));
|
|
1136
1139
|
})
|
|
1137
|
-
.addCase(verifyLeadOTP.rejected, function (state,
|
|
1140
|
+
.addCase(verifyLeadOTP.rejected, function (state, _a) {
|
|
1141
|
+
var message = _a.error.message;
|
|
1138
1142
|
state.loading = false;
|
|
1139
|
-
|
|
1143
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
1144
|
+
state.error = message;
|
|
1140
1145
|
})
|
|
1141
1146
|
.addCase(createCivilIdAuth.pending, function (state) {
|
|
1142
1147
|
state.loading = true;
|
|
@@ -1264,7 +1269,7 @@ export var businessSlice = createSlice({
|
|
|
1264
1269
|
state.loading = true;
|
|
1265
1270
|
})
|
|
1266
1271
|
.addCase(retrieveEntityList.fulfilled, function (state, action) {
|
|
1267
|
-
var _a, _b, _c, _d;
|
|
1272
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1268
1273
|
state.error = null;
|
|
1269
1274
|
state.loading = false;
|
|
1270
1275
|
var data = action.payload;
|
|
@@ -1285,7 +1290,7 @@ export var businessSlice = createSlice({
|
|
|
1285
1290
|
licenseList = __spreadArray(__spreadArray([], licenseList, true), mappedFL, true);
|
|
1286
1291
|
licenseList = licenseList.filter(function (_a) {
|
|
1287
1292
|
var license = _a.license;
|
|
1288
|
-
return !(entityLicenseList || []).some(function (e) { return e.license.number === license.number; });
|
|
1293
|
+
return !(entityLicenseList || []).some(function (e) { var _a, _b; return e.license.number === license.number || ((_a = e.license.additional_info) === null || _a === void 0 ? void 0 : _a.unified_number) === ((_b = license.additional_info) === null || _b === void 0 ? void 0 : _b.unified_number); });
|
|
1289
1294
|
});
|
|
1290
1295
|
}
|
|
1291
1296
|
}
|
|
@@ -1295,8 +1300,10 @@ export var businessSlice = createSlice({
|
|
|
1295
1300
|
var selectedLicense = licenseList === null || licenseList === void 0 ? void 0 : licenseList[0];
|
|
1296
1301
|
var isOtherLicense_1 = ((_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.number) === 'other_fl' || ((_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number) === 'other_cr';
|
|
1297
1302
|
state.data.businessTypeData.selectedLicense = selectedLicense;
|
|
1298
|
-
if (!isOtherLicense_1)
|
|
1303
|
+
if (!isOtherLicense_1) {
|
|
1299
1304
|
state.data.businessTypeData.licenseNumber = ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) || '';
|
|
1305
|
+
state.data.businessTypeData.unifiedNumber = ((_f = (_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.additional_info) === null || _f === void 0 ? void 0 : _f.unified_number) || '';
|
|
1306
|
+
}
|
|
1300
1307
|
}
|
|
1301
1308
|
})
|
|
1302
1309
|
.addCase(retrieveEntityList.rejected, function (state, action) {
|
|
@@ -1308,10 +1315,10 @@ export var businessSlice = createSlice({
|
|
|
1308
1315
|
state.loading = true;
|
|
1309
1316
|
})
|
|
1310
1317
|
.addCase(retrieveAllEntityList.fulfilled, function (state, action) {
|
|
1311
|
-
var _a;
|
|
1318
|
+
var _a, _b, _c;
|
|
1312
1319
|
state.error = null;
|
|
1313
1320
|
state.loading = false;
|
|
1314
|
-
var
|
|
1321
|
+
var _d = action.payload, data = _d.data, businessCountryCode = _d.businessCountryCode, entityId = _d.entityId;
|
|
1315
1322
|
var isKWCountry = isKW(businessCountryCode);
|
|
1316
1323
|
var list = (data === null || data === void 0 ? void 0 : data.entities_info) || [];
|
|
1317
1324
|
if (isKWCountry) {
|
|
@@ -1329,8 +1336,10 @@ export var businessSlice = createSlice({
|
|
|
1329
1336
|
var selectedLicense = findEntity ? findEntity : entityLicenseList[0];
|
|
1330
1337
|
state.data.businessTypeData.selectedEntityLicense = selectedLicense;
|
|
1331
1338
|
state.data.businessTypeData.selectedLicense = selectedLicense;
|
|
1332
|
-
if (!isOtherLicense(selectedLicense))
|
|
1339
|
+
if (!isOtherLicense(selectedLicense)) {
|
|
1333
1340
|
state.data.businessTypeData.licenseNumber = ((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
1341
|
+
state.data.businessTypeData.unifiedNumber = ((_c = (_b = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _b === void 0 ? void 0 : _b.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number) || '';
|
|
1342
|
+
}
|
|
1334
1343
|
}
|
|
1335
1344
|
})
|
|
1336
1345
|
.addCase(retrieveAllEntityList.rejected, function (state, action) {
|
|
@@ -82,14 +82,15 @@ export declare const updateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
82
82
|
export declare const skipUpdateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
83
83
|
leadResponse: any;
|
|
84
84
|
}, void, {}>;
|
|
85
|
+
interface EmailCheckProps {
|
|
86
|
+
email: string;
|
|
87
|
+
cancelToken: CancelToken;
|
|
88
|
+
onSuccess?: () => void;
|
|
89
|
+
}
|
|
85
90
|
export declare const checkEmailAvailability: import("@reduxjs/toolkit").AsyncThunk<{
|
|
86
91
|
response: any;
|
|
87
92
|
formData: string;
|
|
88
|
-
} | undefined, {
|
|
89
|
-
email: string;
|
|
90
|
-
cancelToken: CancelToken;
|
|
91
|
-
onSuccess?: (() => void) | undefined;
|
|
92
|
-
}, {}>;
|
|
93
|
+
} | undefined, EmailCheckProps, {}>;
|
|
93
94
|
export declare const checkBrandNameAvailability: import("@reduxjs/toolkit").AsyncThunk<{
|
|
94
95
|
response: any;
|
|
95
96
|
formData: {
|
|
@@ -71,7 +71,7 @@ import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2
|
|
|
71
71
|
import { COLLECT_DOB_INFO_NAFATH, CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_BRAND } from '../../../constants';
|
|
72
72
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
73
73
|
import { AuthForType, FlowsTypes } from '../../../@types';
|
|
74
|
-
import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData, isNetworkError, isTimeoutError } from '../../../utils';
|
|
74
|
+
import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } from '../../../utils';
|
|
75
75
|
export var updateBusinessCountry = createAsyncThunk('connect/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
76
|
var connect, payload, data;
|
|
77
77
|
return __generator(this, function (_a) {
|
|
@@ -209,9 +209,9 @@ export var createNafathAuth = createAsyncThunk('connect/createNafathAuth', funct
|
|
|
209
209
|
}); });
|
|
210
210
|
export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
211
211
|
var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, leadResponse, channels, brand, err_1, brands, err_2, countryCode, phone;
|
|
212
|
-
var _c, _d, _e
|
|
213
|
-
return __generator(this, function (
|
|
214
|
-
switch (
|
|
212
|
+
var _c, _d, _e;
|
|
213
|
+
return __generator(this, function (_f) {
|
|
214
|
+
switch (_f.label) {
|
|
215
215
|
case 0:
|
|
216
216
|
_a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
|
|
217
217
|
startWithNID = connect.data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
@@ -229,11 +229,13 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
|
|
|
229
229
|
step_name: stepName,
|
|
230
230
|
encryption_contract: ['data']
|
|
231
231
|
};
|
|
232
|
-
return [4, API.authService.verifyAuth(payload)
|
|
232
|
+
return [4, API.authService.verifyAuth(payload).catch(function (err) {
|
|
233
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
234
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
235
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
236
|
+
})];
|
|
233
237
|
case 1:
|
|
234
|
-
data =
|
|
235
|
-
if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
|
|
236
|
-
throw new Error(data.errors[0].description);
|
|
238
|
+
data = _f.sent();
|
|
237
239
|
sendCustomEventToGTM({
|
|
238
240
|
event: 'Send Event',
|
|
239
241
|
event_category: 'User Registration Flow',
|
|
@@ -244,41 +246,41 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
|
|
|
244
246
|
throw new Error('Lead id is missing');
|
|
245
247
|
return [4, API.leadService.retrieveLead(lead_id)];
|
|
246
248
|
case 2:
|
|
247
|
-
leadResponse = (
|
|
248
|
-
if ((
|
|
249
|
+
leadResponse = (_f.sent()).data;
|
|
250
|
+
if ((_c = leadResponse.errors) === null || _c === void 0 ? void 0 : _c.length)
|
|
249
251
|
throw new Error(leadResponse.errors[0].description);
|
|
250
252
|
return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
251
253
|
case 3:
|
|
252
|
-
channels = (
|
|
254
|
+
channels = (_f.sent()).list;
|
|
253
255
|
leadResponse.channel_list = channels;
|
|
254
|
-
|
|
256
|
+
_f.label = 4;
|
|
255
257
|
case 4:
|
|
256
|
-
|
|
258
|
+
_f.trys.push([4, 6, , 7]);
|
|
257
259
|
return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
|
|
258
260
|
case 5:
|
|
259
|
-
brand = (
|
|
261
|
+
brand = (_f.sent()).brand;
|
|
260
262
|
leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
|
|
261
263
|
return [3, 7];
|
|
262
264
|
case 6:
|
|
263
|
-
err_1 =
|
|
265
|
+
err_1 = _f.sent();
|
|
264
266
|
return [3, 7];
|
|
265
267
|
case 7:
|
|
266
|
-
|
|
268
|
+
_f.trys.push([7, 9, , 10]);
|
|
267
269
|
return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
|
|
268
270
|
case 8:
|
|
269
|
-
brands = (
|
|
271
|
+
brands = (_f.sent()).brands;
|
|
270
272
|
leadResponse.brand_list = fixBrandList(brands, channels);
|
|
271
273
|
return [3, 10];
|
|
272
274
|
case 9:
|
|
273
|
-
err_2 =
|
|
275
|
+
err_2 = _f.sent();
|
|
274
276
|
return [3, 10];
|
|
275
277
|
case 10:
|
|
276
278
|
countryCode = settings.data.businessCountry;
|
|
277
279
|
phone = (leadResponse.contact || {}).phone;
|
|
278
280
|
if (phone === null || phone === void 0 ? void 0 : phone.country_code)
|
|
279
281
|
countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
|
|
280
|
-
(
|
|
281
|
-
thunkApi.dispatch(handleNextScreenStep());
|
|
282
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
|
|
283
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
|
|
282
284
|
return [2, { authResponse: data, leadResponse: leadResponse, countryCode: countryCode }];
|
|
283
285
|
}
|
|
284
286
|
});
|
|
@@ -763,23 +765,36 @@ export var skipUpdateLeadMobile = createAsyncThunk('connect/skipUpdateLeadMobile
|
|
|
763
765
|
export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', function (_a, thunkApi) {
|
|
764
766
|
var email = _a.email, cancelToken = _a.cancelToken, onSuccess = _a.onSuccess;
|
|
765
767
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
766
|
-
var
|
|
767
|
-
var _b, _c;
|
|
768
|
-
return __generator(this, function (
|
|
769
|
-
switch (
|
|
768
|
+
var responseBody, requestBody, data, retryData;
|
|
769
|
+
var _b, _c, _d, _e;
|
|
770
|
+
return __generator(this, function (_f) {
|
|
771
|
+
switch (_f.label) {
|
|
770
772
|
case 0:
|
|
771
|
-
|
|
773
|
+
responseBody = thunkApi.getState().connect.data.otpData.responseBody;
|
|
772
774
|
requestBody = {
|
|
773
775
|
email: email,
|
|
774
|
-
country: (
|
|
776
|
+
country: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.leadData) === null || _b === void 0 ? void 0 : _b.country_code,
|
|
775
777
|
encryption_contract: ['email']
|
|
776
778
|
};
|
|
777
779
|
return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
|
|
778
780
|
case 1:
|
|
779
|
-
data = (
|
|
780
|
-
|
|
781
|
-
|
|
781
|
+
data = (_f.sent()).data;
|
|
782
|
+
if (!data.errors) {
|
|
783
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
782
784
|
return [2, { response: data, formData: email }];
|
|
785
|
+
}
|
|
786
|
+
if (!isInternalServerError((_d = (_c = data.errors) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.error)) {
|
|
787
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
788
|
+
return [2];
|
|
789
|
+
}
|
|
790
|
+
return [4, API.availabilityServices.checkEmail(requestBody, { cancelToken: cancelToken })];
|
|
791
|
+
case 2:
|
|
792
|
+
retryData = (_f.sent()).data;
|
|
793
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
794
|
+
if (!retryData.errors)
|
|
795
|
+
return [2, { response: retryData, formData: email }];
|
|
796
|
+
if (isInternalServerError((_e = retryData.errors) === null || _e === void 0 ? void 0 : _e[0].error))
|
|
797
|
+
return [2, { response: { is_available: true }, formData: email }];
|
|
783
798
|
return [2];
|
|
784
799
|
}
|
|
785
800
|
});
|
|
@@ -1122,9 +1137,11 @@ export var connectSlice = createSlice({
|
|
|
1122
1137
|
state.loading = true;
|
|
1123
1138
|
state.error = null;
|
|
1124
1139
|
})
|
|
1125
|
-
.addCase(verifyAuth.rejected, function (state,
|
|
1140
|
+
.addCase(verifyAuth.rejected, function (state, _a) {
|
|
1141
|
+
var message = _a.error.message;
|
|
1126
1142
|
state.loading = false;
|
|
1127
|
-
|
|
1143
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
1144
|
+
state.error = message;
|
|
1128
1145
|
})
|
|
1129
1146
|
.addCase(updateLeadDOB.fulfilled, function (state, action) {
|
|
1130
1147
|
state.loading = false;
|
|
@@ -82,14 +82,15 @@ export declare const verifyNafathIdentityAsync: import("@reduxjs/toolkit").Async
|
|
|
82
82
|
isNextScreenIsDob: boolean;
|
|
83
83
|
}, verifyPACIAsyncParams, {}>;
|
|
84
84
|
export declare const verifyPaciLeadIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<any, verifyPACIAsyncParams, {}>;
|
|
85
|
+
interface EmailCheckProps {
|
|
86
|
+
email: string;
|
|
87
|
+
cancelToken: CancelToken;
|
|
88
|
+
onSuccess?: () => void;
|
|
89
|
+
}
|
|
85
90
|
export declare const checkEmailAvailabilityAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
86
91
|
response: any;
|
|
87
92
|
formData: string;
|
|
88
|
-
} | undefined, {
|
|
89
|
-
email: string;
|
|
90
|
-
cancelToken: CancelToken;
|
|
91
|
-
onSuccess?: (() => void) | undefined;
|
|
92
|
-
}, {}>;
|
|
93
|
+
} | undefined, EmailCheckProps, {}>;
|
|
93
94
|
export declare const checkBrandNameAvailabilityAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
94
95
|
response: any;
|
|
95
96
|
formData: {
|
|
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } fro
|
|
|
61
61
|
import API from '../../../api';
|
|
62
62
|
import { ADD_NEW_ENTITY, COLLECT_DOB_INFO_NAFATH, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH, SCOPE_MERCHANT } from '../../../constants';
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
64
|
-
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError } 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({
|
|
@@ -838,23 +842,36 @@ export var verifyPaciLeadIdentityAsync = createAsyncThunk('connectExpress/verify
|
|
|
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
|
|
842
|
-
var _b, _c;
|
|
843
|
-
return __generator(this, function (
|
|
844
|
-
switch (
|
|
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
|
-
|
|
850
|
+
responseData = thunkApi.getState().connectExpress.data.responseData;
|
|
847
851
|
requestBody = {
|
|
848
852
|
email: email,
|
|
849
|
-
country: (
|
|
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 = (
|
|
855
|
-
|
|
856
|
-
|
|
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
|
});
|
|
@@ -1129,13 +1146,13 @@ export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLe
|
|
|
1129
1146
|
export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDataAsync ', function (_a, thunkApi) {
|
|
1130
1147
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
1131
1148
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1132
|
-
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;
|
|
1133
1150
|
var _d, _e;
|
|
1134
1151
|
return __generator(this, function (_f) {
|
|
1135
1152
|
switch (_f.label) {
|
|
1136
1153
|
case 0:
|
|
1137
1154
|
_b = thunkApi.getState(), settings = _b.settings, connectExpress = _b.connectExpress;
|
|
1138
|
-
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;
|
|
1139
1156
|
isKWCountry = isKW(settings.data.businessCountry.iso2);
|
|
1140
1157
|
isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
1141
1158
|
_c = connectExpress.data, responseData = _c.responseData, isLeadIdPassed = _c.isLeadIdPassed;
|
|
@@ -1153,6 +1170,7 @@ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDat
|
|
|
1153
1170
|
license_type: (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) ? (isFL ? LicenseType.FL : LicenseType.CR) : undefined,
|
|
1154
1171
|
business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type,
|
|
1155
1172
|
is_acknowledged: true,
|
|
1173
|
+
unified_number: unifiedNumber,
|
|
1156
1174
|
terms_conditions_accepted: !isLeadIdPassed ? termAndConditionChecked : undefined,
|
|
1157
1175
|
step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_BRAND_BUSINESS,
|
|
1158
1176
|
encryption_contract: []
|
|
@@ -1293,7 +1311,11 @@ export var verifyAuthMobileOtpAsync = createAsyncThunk('connectExpress/verifyAut
|
|
|
1293
1311
|
step_name: CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP,
|
|
1294
1312
|
encryption_contract: ['data']
|
|
1295
1313
|
};
|
|
1296
|
-
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
|
+
})];
|
|
1297
1319
|
case 1:
|
|
1298
1320
|
data = _e.sent();
|
|
1299
1321
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
@@ -1480,6 +1502,7 @@ var initialState = {
|
|
|
1480
1502
|
businessData: {
|
|
1481
1503
|
brandName: '',
|
|
1482
1504
|
licenseNumber: '',
|
|
1505
|
+
unifiedNumber: '',
|
|
1483
1506
|
termAndConditionChecked: false
|
|
1484
1507
|
},
|
|
1485
1508
|
authenticationData: {
|
|
@@ -1697,9 +1720,11 @@ export var connectSlice = createSlice({
|
|
|
1697
1720
|
state.loading = false;
|
|
1698
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) });
|
|
1699
1722
|
})
|
|
1700
|
-
.addCase(verifyMobileOtpAsync.rejected, function (state,
|
|
1723
|
+
.addCase(verifyMobileOtpAsync.rejected, function (state, _a) {
|
|
1724
|
+
var message = _a.error.message;
|
|
1701
1725
|
state.loading = false;
|
|
1702
|
-
|
|
1726
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
1727
|
+
state.error = message;
|
|
1703
1728
|
})
|
|
1704
1729
|
.addCase(verifyNafathAsync.pending, function (state) {
|
|
1705
1730
|
state.loading = true;
|
|
@@ -1776,7 +1801,7 @@ export var connectSlice = createSlice({
|
|
|
1776
1801
|
state.error = null;
|
|
1777
1802
|
})
|
|
1778
1803
|
.addCase(retrieveEntityListAsync.fulfilled, function (state, action) {
|
|
1779
|
-
var _a, _b;
|
|
1804
|
+
var _a, _b, _c, _d;
|
|
1780
1805
|
state.loading = false;
|
|
1781
1806
|
var data = action.payload;
|
|
1782
1807
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
@@ -1796,7 +1821,8 @@ export var connectSlice = createSlice({
|
|
|
1796
1821
|
}
|
|
1797
1822
|
}
|
|
1798
1823
|
licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
|
|
1799
|
-
var
|
|
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;
|
|
1800
1826
|
var selectedLicense = undefined;
|
|
1801
1827
|
if (license_number) {
|
|
1802
1828
|
var findLicense = licenseList.find(function (_a) {
|
|
@@ -1812,6 +1838,18 @@ export var connectSlice = createSlice({
|
|
|
1812
1838
|
selectedLicense = __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: license_number } });
|
|
1813
1839
|
state.data.businessData.licenseNumber = license_number;
|
|
1814
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
|
+
}
|
|
1815
1853
|
state.data.businessData.selectedLicense = selectedLicense;
|
|
1816
1854
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { licenseList: licenseList });
|
|
1817
1855
|
})
|
|
@@ -1914,6 +1952,7 @@ export var connectSlice = createSlice({
|
|
|
1914
1952
|
state.loading = false;
|
|
1915
1953
|
state.error = null;
|
|
1916
1954
|
state.data.individualData.mobile = action.payload.formData.mobile;
|
|
1955
|
+
state.data.individualData.countryCode = action.payload.formData.countryCode;
|
|
1917
1956
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse, verifyAuthMobile: action.payload.leadResponse });
|
|
1918
1957
|
state.data.verifyAuthOtpData.authFor = AuthForScreen.MOBILE_OWNERSHIP;
|
|
1919
1958
|
})
|
|
@@ -1949,9 +1988,11 @@ export var connectSlice = createSlice({
|
|
|
1949
1988
|
state.loading = true;
|
|
1950
1989
|
state.error = null;
|
|
1951
1990
|
})
|
|
1952
|
-
.addCase(verifyAuthMobileOtpAsync.rejected, function (state,
|
|
1991
|
+
.addCase(verifyAuthMobileOtpAsync.rejected, function (state, _a) {
|
|
1992
|
+
var message = _a.error.message;
|
|
1953
1993
|
state.loading = false;
|
|
1954
|
-
|
|
1994
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
1995
|
+
state.error = message;
|
|
1955
1996
|
})
|
|
1956
1997
|
.addCase(resendLeadMobileAuthOTP.pending, function (state) {
|
|
1957
1998
|
state.loading = true;
|