@tap-payments/auth-jsconnect 2.8.65-development → 2.8.68-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/form.d.ts +1 -1
- package/build/api/auth.d.ts +13 -0
- package/build/api/index.d.ts +2 -2
- package/build/api/lead.d.ts +6 -0
- package/build/assets/locales/ar.json +10 -1
- package/build/assets/locales/en.json +10 -1
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +35 -12
- package/build/constants/assets.d.ts +2 -0
- package/build/constants/assets.js +2 -0
- package/build/features/app/auth/authStore.d.ts +5 -15
- package/build/features/app/auth/authStore.js +58 -113
- package/build/features/app/business/businessStore.d.ts +16 -11
- package/build/features/app/business/businessStore.js +58 -44
- package/build/features/app/connect/connectStore.d.ts +19 -12
- package/build/features/app/connect/connectStore.js +151 -82
- package/build/features/app/connectExpress/connectExpressStore.d.ts +10 -33
- package/build/features/app/connectExpress/connectExpressStore.js +156 -251
- package/build/features/app/individual/individualStore.js +4 -1
- package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +2 -2
- package/build/features/auth/screens/NID/IDNumber.js +1 -1
- package/build/features/auth/screens/NID/NID.js +4 -10
- package/build/features/auth/screens/NID/validation.d.ts +0 -3
- package/build/features/auth/screens/NID/validation.js +0 -1
- package/build/features/auth/screens/OTP/OTP.js +1 -5
- package/build/features/auth/screens/OTP/OTPInput.js +2 -13
- package/build/features/{connectExpress/screens/IdentityOTP/OTP.d.ts → auth/screens/VerifyNafath/VerifyNafath.d.ts} +2 -2
- package/build/features/auth/screens/VerifyNafath/VerifyNafath.js +34 -0
- package/build/features/auth/screens/VerifyNafath/index.d.ts +3 -0
- package/build/features/auth/screens/VerifyNafath/index.js +2 -0
- package/build/features/business/screens/VerifyNafath/VerifyNafath.d.ts +5 -0
- package/build/features/business/screens/VerifyNafath/VerifyNafath.js +34 -0
- package/build/features/business/screens/VerifyNafath/index.d.ts +3 -0
- package/build/features/business/screens/VerifyNafath/index.js +2 -0
- package/build/features/connect/screens/Mobile/Mobile.js +2 -2
- package/build/features/connect/screens/NID/IDNumber.d.ts +1 -0
- package/build/features/connect/screens/NID/IDNumber.js +2 -2
- package/build/features/connect/screens/NID/NID.js +5 -11
- package/build/features/connect/screens/NID/validation.d.ts +0 -3
- package/build/features/connect/screens/NID/validation.js +0 -1
- package/build/features/connect/screens/OTP/OTPInput.js +3 -11
- package/build/features/connect/screens/VerifyNafath/VerifyNafath.d.ts +5 -0
- package/build/features/connect/screens/VerifyNafath/VerifyNafath.js +34 -0
- package/build/features/connect/screens/VerifyNafath/index.d.ts +3 -0
- package/build/features/connect/screens/VerifyNafath/index.js +2 -0
- package/build/features/connectExpress/screens/IdentityVerifyNafath/IdentityVerifyNafath.d.ts +5 -0
- package/build/features/connectExpress/screens/IdentityVerifyNafath/IdentityVerifyNafath.js +34 -0
- package/build/features/connectExpress/screens/IdentityVerifyNafath/index.d.ts +3 -0
- package/build/features/connectExpress/screens/IdentityVerifyNafath/index.js +2 -0
- package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -2
- package/build/features/connectExpress/screens/NID/IDNumber.d.ts +1 -0
- package/build/features/connectExpress/screens/NID/IDNumber.js +2 -2
- package/build/features/connectExpress/screens/NID/NID.js +4 -9
- package/build/features/connectExpress/screens/NID/validation.d.ts +0 -3
- package/build/features/connectExpress/screens/NID/validation.js +0 -2
- package/build/features/connectExpress/screens/NIDMissed/NID.js +2 -2
- package/build/features/connectExpress/screens/OTP/OTP.js +5 -13
- package/build/features/connectExpress/screens/OTP/OTPInput.js +3 -11
- package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.d.ts +5 -0
- package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +34 -0
- package/build/features/connectExpress/screens/VerifyNafath/index.d.ts +3 -0
- package/build/features/connectExpress/screens/VerifyNafath/index.js +2 -0
- package/build/features/featuresScreens.js +21 -6
- package/build/features/shared/Button/NafathButton.d.ts +7 -0
- package/build/features/shared/Button/{AbsherButton.js → NafathButton.js} +13 -3
- package/build/features/shared/Button/index.d.ts +2 -2
- package/build/features/shared/Button/index.js +2 -2
- package/build/features/shared/NafathVerification/NafathVerification.d.ts +13 -0
- package/build/features/shared/NafathVerification/NafathVerification.js +92 -0
- package/build/features/shared/NafathVerification/VerifyNafathLoading.d.ts +8 -0
- package/build/features/shared/NafathVerification/VerifyNafathLoading.js +53 -0
- package/build/features/shared/NafathVerification/VerifyNafathSuccess.d.ts +5 -0
- package/build/features/shared/NafathVerification/VerifyNafathSuccess.js +8 -0
- package/build/features/shared/NafathVerification/index.d.ts +2 -0
- package/build/features/shared/NafathVerification/index.js +2 -0
- package/build/hooks/useAppTheme.js +4 -3
- package/build/theme/palette.js +2 -1
- package/build/theme/theme.d.ts +1 -1
- package/build/theme/theme.js +2 -2
- package/package.json +1 -1
- package/build/features/auth/screens/NID/DOB.d.ts +0 -6
- package/build/features/auth/screens/NID/DOB.js +0 -47
- package/build/features/business/screens/OTP/OTP.d.ts +0 -8
- package/build/features/business/screens/OTP/OTP.js +0 -90
- package/build/features/business/screens/OTP/OTPInput.d.ts +0 -5
- package/build/features/business/screens/OTP/OTPInput.js +0 -49
- package/build/features/business/screens/OTP/index.d.ts +0 -3
- package/build/features/business/screens/OTP/index.js +0 -2
- package/build/features/business/screens/OTP/validation.d.ts +0 -8
- package/build/features/business/screens/OTP/validation.js +0 -4
- package/build/features/connect/screens/NID/DOB.d.ts +0 -5
- package/build/features/connect/screens/NID/DOB.js +0 -47
- package/build/features/connectExpress/screens/IdentityOTP/OTP.js +0 -88
- package/build/features/connectExpress/screens/IdentityOTP/OTPInput.d.ts +0 -5
- package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +0 -56
- package/build/features/connectExpress/screens/IdentityOTP/index.d.ts +0 -3
- package/build/features/connectExpress/screens/IdentityOTP/index.js +0 -2
- package/build/features/connectExpress/screens/IdentityOTP/validation.d.ts +0 -8
- package/build/features/connectExpress/screens/IdentityOTP/validation.js +0 -4
- package/build/features/connectExpress/screens/NID/DOB.d.ts +0 -6
- package/build/features/connectExpress/screens/NID/DOB.js +0 -47
- package/build/features/shared/Button/AbsherButton.d.ts +0 -7
|
@@ -307,6 +307,51 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
}); });
|
|
310
|
+
export var verifyNafath = createAsyncThunk('business/verifyNafathParams', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
311
|
+
var _a, settings, business, responseBody, _b, business_id, entity, expiry, interval, maxCalls, count, data, isSuccess;
|
|
312
|
+
var _c, _d, _e, _f;
|
|
313
|
+
return __generator(this, function (_g) {
|
|
314
|
+
switch (_g.label) {
|
|
315
|
+
case 0:
|
|
316
|
+
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
317
|
+
responseBody = business.data.nidData.responseBody;
|
|
318
|
+
_b = business.data.verify.responseBody || {}, business_id = _b.business_id, entity = _b.entity;
|
|
319
|
+
expiry = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120;
|
|
320
|
+
interval = 5;
|
|
321
|
+
maxCalls = Math.floor(expiry / interval);
|
|
322
|
+
if (thunkApi.signal.aborted) {
|
|
323
|
+
return [2, { response: null }];
|
|
324
|
+
}
|
|
325
|
+
count = 1;
|
|
326
|
+
_g.label = 1;
|
|
327
|
+
case 1:
|
|
328
|
+
if (!(count <= maxCalls)) return [3, 8];
|
|
329
|
+
return [4, API.authService.getTokenVerify(responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token)];
|
|
330
|
+
case 2:
|
|
331
|
+
data = _g.sent();
|
|
332
|
+
isSuccess = ((_c = data.status) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'completed';
|
|
333
|
+
if (!isSuccess) return [3, 5];
|
|
334
|
+
return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
|
|
335
|
+
case 3:
|
|
336
|
+
_g.sent();
|
|
337
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, {});
|
|
338
|
+
(_f = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _f === void 0 ? void 0 : _f.call(params);
|
|
339
|
+
return [4, sleep(3000)];
|
|
340
|
+
case 4:
|
|
341
|
+
_g.sent();
|
|
342
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
343
|
+
return [2, { response: data }];
|
|
344
|
+
case 5: return [4, sleep(interval * 1000)];
|
|
345
|
+
case 6:
|
|
346
|
+
_g.sent();
|
|
347
|
+
_g.label = 7;
|
|
348
|
+
case 7:
|
|
349
|
+
count++;
|
|
350
|
+
return [3, 1];
|
|
351
|
+
case 8: throw new Error('nafath_verification_failed');
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}); });
|
|
310
355
|
export var verifyPACI = createAsyncThunk('businessVerifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
311
356
|
var _a, settings, business, responseBody, _b, business_id, entity, expiry, interval, maxCalls, count, data, isSuccess;
|
|
312
357
|
var _c, _d, _e, _f;
|
|
@@ -387,7 +432,7 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
387
432
|
switch (_d.label) {
|
|
388
433
|
case 0:
|
|
389
434
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
390
|
-
identification_id_type =
|
|
435
|
+
identification_id_type = IDENTIFICATION_TYPE.NAFATH;
|
|
391
436
|
stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
|
|
392
437
|
lead_id = (business.data.verify.responseBody || {}).lead_id;
|
|
393
438
|
countryIso2 = settings.data.businessCountry.iso2;
|
|
@@ -410,7 +455,7 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
410
455
|
case 1:
|
|
411
456
|
data = _d.sent();
|
|
412
457
|
business_id = data.business_id, entity = data.entity;
|
|
413
|
-
screen = '
|
|
458
|
+
screen = 'BUSINESS_VERIFY_NAFATH_STEP';
|
|
414
459
|
if (!isOtherThanKWOrSA(countryIso2)) return [3, 4];
|
|
415
460
|
screen = 'BUSINESS_BUSINESS_TYPE_STEP';
|
|
416
461
|
return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
|
|
@@ -428,34 +473,6 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
428
473
|
}
|
|
429
474
|
});
|
|
430
475
|
}); });
|
|
431
|
-
export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
432
|
-
var _a, settings, business, _b, nid, dob, type, stepName, lead_id, date_of_birth, requestBody, data;
|
|
433
|
-
return __generator(this, function (_c) {
|
|
434
|
-
switch (_c.label) {
|
|
435
|
-
case 0:
|
|
436
|
-
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
437
|
-
_b = business.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
|
|
438
|
-
stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
|
|
439
|
-
lead_id = (business.data.verify.responseBody || {}).lead_id;
|
|
440
|
-
date_of_birth = dateFormat(new Date(dob));
|
|
441
|
-
requestBody = {
|
|
442
|
-
id: lead_id || '',
|
|
443
|
-
identification: {
|
|
444
|
-
id: nid,
|
|
445
|
-
issued_country_code: settings.data.businessCountry.iso2,
|
|
446
|
-
type: type
|
|
447
|
-
},
|
|
448
|
-
date_of_birth: date_of_birth,
|
|
449
|
-
step_name: stepName,
|
|
450
|
-
encryption_contract: ['identification.issued_country_code', 'identification.id', 'identification.type', 'date_of_birth']
|
|
451
|
-
};
|
|
452
|
-
return [4, API.leadService.updateLead(requestBody)];
|
|
453
|
-
case 1:
|
|
454
|
-
data = _c.sent();
|
|
455
|
-
return [2, data];
|
|
456
|
-
}
|
|
457
|
-
});
|
|
458
|
-
}); });
|
|
459
476
|
export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
460
477
|
var data;
|
|
461
478
|
return __generator(this, function (_a) {
|
|
@@ -1032,24 +1049,21 @@ export var businessSlice = createSlice({
|
|
|
1032
1049
|
state.loading = false;
|
|
1033
1050
|
state.error = action.error.message;
|
|
1034
1051
|
})
|
|
1035
|
-
.addCase(
|
|
1052
|
+
.addCase(verifyNafath.pending, function (state) {
|
|
1053
|
+
state.loading = true;
|
|
1036
1054
|
state.error = null;
|
|
1037
1055
|
})
|
|
1038
|
-
.addCase(
|
|
1039
|
-
|
|
1056
|
+
.addCase(verifyNafath.fulfilled, function (state, action) {
|
|
1057
|
+
state.loading = false;
|
|
1040
1058
|
state.error = null;
|
|
1041
|
-
|
|
1042
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
1043
|
-
if (description) {
|
|
1044
|
-
state.error = description;
|
|
1045
|
-
return;
|
|
1046
|
-
}
|
|
1047
|
-
state.data.nidData.responseBody = data;
|
|
1048
|
-
state.data.otpData.otp = '';
|
|
1049
|
-
state.data.otpData.isNID = true;
|
|
1059
|
+
state.data.otpData.responseBody = action.payload.response;
|
|
1050
1060
|
})
|
|
1051
|
-
.addCase(
|
|
1052
|
-
state.
|
|
1061
|
+
.addCase(verifyNafath.rejected, function (state, action) {
|
|
1062
|
+
state.loading = false;
|
|
1063
|
+
var error = action.error.message;
|
|
1064
|
+
if (error !== 'Aborted') {
|
|
1065
|
+
state.error = error;
|
|
1066
|
+
}
|
|
1053
1067
|
})
|
|
1054
1068
|
.addCase(retrieveEntityList.pending, function (state) {
|
|
1055
1069
|
state.error = null;
|
|
@@ -47,22 +47,12 @@ export declare const resendOTPMobile: import("@reduxjs/toolkit").AsyncThunk<any,
|
|
|
47
47
|
fulfilledMeta?: unknown;
|
|
48
48
|
rejectedMeta?: unknown;
|
|
49
49
|
}>;
|
|
50
|
-
export declare const
|
|
51
|
-
state?: unknown;
|
|
52
|
-
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
53
|
-
extra?: unknown;
|
|
54
|
-
rejectValue?: unknown;
|
|
55
|
-
serializedErrorType?: unknown;
|
|
56
|
-
pendingMeta?: unknown;
|
|
57
|
-
fulfilledMeta?: unknown;
|
|
58
|
-
rejectedMeta?: unknown;
|
|
59
|
-
}>;
|
|
60
|
-
export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
50
|
+
export declare const createNafathAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
61
51
|
response: any;
|
|
62
52
|
formData: {
|
|
63
53
|
type: string;
|
|
64
54
|
nid: string;
|
|
65
|
-
dob
|
|
55
|
+
dob?: any;
|
|
66
56
|
termAndConditionChecked?: boolean | undefined;
|
|
67
57
|
};
|
|
68
58
|
}, NIDFormValues, {
|
|
@@ -106,6 +96,23 @@ export declare const verifyPACI: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
106
96
|
fulfilledMeta?: unknown;
|
|
107
97
|
rejectedMeta?: unknown;
|
|
108
98
|
}>;
|
|
99
|
+
interface verifyNafathParams {
|
|
100
|
+
onSuccess?: () => void;
|
|
101
|
+
}
|
|
102
|
+
export declare const verifyNafath: import("@reduxjs/toolkit").AsyncThunk<{
|
|
103
|
+
authResponse: any;
|
|
104
|
+
leadResponse: any;
|
|
105
|
+
countryCode: CountryCode;
|
|
106
|
+
}, verifyNafathParams, {
|
|
107
|
+
state?: unknown;
|
|
108
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
109
|
+
extra?: unknown;
|
|
110
|
+
rejectValue?: unknown;
|
|
111
|
+
serializedErrorType?: unknown;
|
|
112
|
+
pendingMeta?: unknown;
|
|
113
|
+
fulfilledMeta?: unknown;
|
|
114
|
+
rejectedMeta?: unknown;
|
|
115
|
+
}>;
|
|
109
116
|
export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk<{
|
|
110
117
|
leadResponse: any;
|
|
111
118
|
formData: IndividualFormValues;
|
|
@@ -173,75 +173,33 @@ export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (param
|
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
175
|
}); });
|
|
176
|
-
export var
|
|
177
|
-
var
|
|
178
|
-
return __generator(this, function (_c) {
|
|
179
|
-
switch (_c.label) {
|
|
180
|
-
case 0:
|
|
181
|
-
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
182
|
-
_b = connect.data.nidData, nid = _b.nid, dob = _b.dob;
|
|
183
|
-
identification_id_type = nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
184
|
-
requestBody = {
|
|
185
|
-
country: settings.data.businessCountry.iso2,
|
|
186
|
-
scope: settings.data.appConfig.scope,
|
|
187
|
-
lang: settings.data.language,
|
|
188
|
-
user_credentail: {
|
|
189
|
-
identification_id: nid,
|
|
190
|
-
identification_id_type: identification_id_type,
|
|
191
|
-
date_of_birth: dob,
|
|
192
|
-
country_code: settings.data.businessCountry.iso2
|
|
193
|
-
},
|
|
194
|
-
sign_in: false,
|
|
195
|
-
is_lead: true,
|
|
196
|
-
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
|
|
197
|
-
encryption_contract: [
|
|
198
|
-
'user_credentail.country_code',
|
|
199
|
-
'user_credentail.identification_id',
|
|
200
|
-
'user_credentail.identification_id_type',
|
|
201
|
-
'user_credentail.date_of_birth'
|
|
202
|
-
]
|
|
203
|
-
};
|
|
204
|
-
return [4, API.authService.createAuth(requestBody)];
|
|
205
|
-
case 1:
|
|
206
|
-
data = _c.sent();
|
|
207
|
-
return [2, data];
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
}); });
|
|
211
|
-
export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
212
|
-
var settings, identification_id_type, requestBody, data;
|
|
176
|
+
export var createNafathAuth = createAsyncThunk('connect/createNafathAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
177
|
+
var settings, requestBody, data;
|
|
213
178
|
var _a, _b;
|
|
214
179
|
return __generator(this, function (_c) {
|
|
215
180
|
switch (_c.label) {
|
|
216
181
|
case 0:
|
|
217
182
|
settings = thunkApi.getState().settings;
|
|
218
|
-
identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
219
183
|
requestBody = {
|
|
220
184
|
country: settings.data.businessCountry.iso2,
|
|
221
185
|
scope: settings.data.appConfig.scope,
|
|
222
186
|
lang: settings.data.language,
|
|
223
187
|
user_credentail: {
|
|
224
188
|
identification_id: params.nid,
|
|
225
|
-
identification_id_type:
|
|
226
|
-
date_of_birth: params.dob,
|
|
189
|
+
identification_id_type: IDENTIFICATION_TYPE.NAFATH,
|
|
227
190
|
country_code: settings.data.businessCountry.iso2
|
|
228
191
|
},
|
|
229
192
|
sign_in: false,
|
|
230
193
|
is_lead: true,
|
|
231
194
|
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
|
|
232
|
-
encryption_contract: [
|
|
233
|
-
'user_credentail.country_code',
|
|
234
|
-
'user_credentail.identification_id',
|
|
235
|
-
'user_credentail.identification_id_type',
|
|
236
|
-
'user_credentail.date_of_birth'
|
|
237
|
-
]
|
|
195
|
+
encryption_contract: ['user_credentail.country_code', 'user_credentail.identification_id', 'user_credentail.identification_id_type']
|
|
238
196
|
};
|
|
239
|
-
return [4, API.authService.
|
|
197
|
+
return [4, API.authService.createAuthKitNID(requestBody)];
|
|
240
198
|
case 1:
|
|
241
199
|
data = _c.sent();
|
|
242
200
|
thunkApi.dispatch(handleNextScreenStep());
|
|
243
|
-
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody
|
|
244
|
-
return [2, { response: data, formData: __assign(__assign({}, params), { type:
|
|
201
|
+
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody);
|
|
202
|
+
return [2, { response: data, formData: __assign(__assign({}, params), { type: IDENTIFICATION_TYPE.NAFATH }) }];
|
|
245
203
|
}
|
|
246
204
|
});
|
|
247
205
|
}); });
|
|
@@ -400,6 +358,85 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
|
|
|
400
358
|
}
|
|
401
359
|
});
|
|
402
360
|
}); });
|
|
361
|
+
export var verifyNafath = createAsyncThunk('connect/verifyNafath', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
362
|
+
var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, lead_id, leadResponse, countryCode, channels, brand, err_5, brands, err_6, phone;
|
|
363
|
+
var _b, _c, _d, _e, _f;
|
|
364
|
+
return __generator(this, function (_g) {
|
|
365
|
+
switch (_g.label) {
|
|
366
|
+
case 0:
|
|
367
|
+
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
368
|
+
responseBody = connect.data.nidData.responseBody;
|
|
369
|
+
expiry = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120;
|
|
370
|
+
interval = 3;
|
|
371
|
+
maxCalls = Math.floor(expiry / interval);
|
|
372
|
+
count = 1;
|
|
373
|
+
_g.label = 1;
|
|
374
|
+
case 1:
|
|
375
|
+
if (!(count <= maxCalls)) return [3, 16];
|
|
376
|
+
if (thunkApi.signal.aborted) {
|
|
377
|
+
return [3, 16];
|
|
378
|
+
}
|
|
379
|
+
return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
|
|
380
|
+
case 2:
|
|
381
|
+
authResponse = _g.sent();
|
|
382
|
+
isSuccess = ((_b = authResponse.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'completed';
|
|
383
|
+
if (!isSuccess) return [3, 13];
|
|
384
|
+
lead_id = authResponse.lead_id;
|
|
385
|
+
if (!lead_id)
|
|
386
|
+
throw new Error('Lead id is missing');
|
|
387
|
+
return [4, API.leadService.retrieveLead(lead_id)];
|
|
388
|
+
case 3:
|
|
389
|
+
leadResponse = (_g.sent()).data;
|
|
390
|
+
if ((_c = leadResponse.errors) === null || _c === void 0 ? void 0 : _c.length)
|
|
391
|
+
throw new Error(leadResponse.errors[0].description);
|
|
392
|
+
countryCode = settings.data.businessCountry;
|
|
393
|
+
return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
394
|
+
case 4:
|
|
395
|
+
channels = (_g.sent()).list;
|
|
396
|
+
leadResponse.channel_list = channels;
|
|
397
|
+
_g.label = 5;
|
|
398
|
+
case 5:
|
|
399
|
+
_g.trys.push([5, 7, , 8]);
|
|
400
|
+
return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
|
|
401
|
+
case 6:
|
|
402
|
+
brand = (_g.sent()).brand;
|
|
403
|
+
leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
|
|
404
|
+
return [3, 8];
|
|
405
|
+
case 7:
|
|
406
|
+
err_5 = _g.sent();
|
|
407
|
+
return [3, 8];
|
|
408
|
+
case 8:
|
|
409
|
+
_g.trys.push([8, 10, , 11]);
|
|
410
|
+
return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
|
|
411
|
+
case 9:
|
|
412
|
+
brands = (_g.sent()).brands;
|
|
413
|
+
leadResponse.brand_list = fixBrandList(brands, channels);
|
|
414
|
+
return [3, 11];
|
|
415
|
+
case 10:
|
|
416
|
+
err_6 = _g.sent();
|
|
417
|
+
return [3, 11];
|
|
418
|
+
case 11:
|
|
419
|
+
(_d = params.onSuccess) === null || _d === void 0 ? void 0 : _d.call(params);
|
|
420
|
+
return [4, sleep(3000)];
|
|
421
|
+
case 12:
|
|
422
|
+
_g.sent();
|
|
423
|
+
phone = (leadResponse.contact || {}).phone;
|
|
424
|
+
if (phone === null || phone === void 0 ? void 0 : phone.country_code)
|
|
425
|
+
countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
|
|
426
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
|
|
427
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
428
|
+
return [2, { authResponse: authResponse, leadResponse: leadResponse, countryCode: countryCode }];
|
|
429
|
+
case 13: return [4, sleep(interval * 1000)];
|
|
430
|
+
case 14:
|
|
431
|
+
_g.sent();
|
|
432
|
+
_g.label = 15;
|
|
433
|
+
case 15:
|
|
434
|
+
count++;
|
|
435
|
+
return [3, 1];
|
|
436
|
+
case 16: throw new Error('nafath_verification_failed');
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
}); });
|
|
403
440
|
export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
404
441
|
var _a, settings, connect, lead_id, brandData, phoneCountry, payload, leadResponse;
|
|
405
442
|
var _b, _c, _d, _e, _f;
|
|
@@ -463,7 +500,7 @@ export var retrieveLead = createAsyncThunk('connect/retrieveLead', function (par
|
|
|
463
500
|
});
|
|
464
501
|
}); });
|
|
465
502
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
466
|
-
var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, brandLogoId, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, team,
|
|
503
|
+
var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, brandLogoId, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, team, err_7, brandNameBody, payload, lead, brandReqBody, brand, team, err_8;
|
|
467
504
|
var _b, _c, _d, _e, _f;
|
|
468
505
|
return __generator(this, function (_g) {
|
|
469
506
|
switch (_g.label) {
|
|
@@ -522,7 +559,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
522
559
|
brand_1.team_size_list = (team === null || team === void 0 ? void 0 : team.list) || [];
|
|
523
560
|
return [3, 7];
|
|
524
561
|
case 6:
|
|
525
|
-
|
|
562
|
+
err_7 = _g.sent();
|
|
526
563
|
return [3, 7];
|
|
527
564
|
case 7:
|
|
528
565
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
@@ -568,7 +605,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
568
605
|
brand.team_size_list = (team === null || team === void 0 ? void 0 : team.list) || [];
|
|
569
606
|
return [3, 14];
|
|
570
607
|
case 13:
|
|
571
|
-
|
|
608
|
+
err_8 = _g.sent();
|
|
572
609
|
return [3, 14];
|
|
573
610
|
case 14:
|
|
574
611
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
@@ -691,7 +728,6 @@ var initialState = {
|
|
|
691
728
|
},
|
|
692
729
|
nidData: {
|
|
693
730
|
nid: '',
|
|
694
|
-
dob: '',
|
|
695
731
|
type: ''
|
|
696
732
|
},
|
|
697
733
|
civilIdData: {
|
|
@@ -859,7 +895,27 @@ export var connectSlice = createSlice({
|
|
|
859
895
|
state.error = error;
|
|
860
896
|
}
|
|
861
897
|
})
|
|
862
|
-
.addCase(
|
|
898
|
+
.addCase(createNafathAuth.fulfilled, function (state, action) {
|
|
899
|
+
state.loading = false;
|
|
900
|
+
state.error = null;
|
|
901
|
+
var _a = action.payload, formData = _a.formData, response = _a.response;
|
|
902
|
+
state.data.nidData = formData;
|
|
903
|
+
state.data.nidData.responseBody = response;
|
|
904
|
+
state.data.otpData.authFor = AuthForType.NATIONAL_ID;
|
|
905
|
+
})
|
|
906
|
+
.addCase(createNafathAuth.pending, function (state) {
|
|
907
|
+
state.loading = true;
|
|
908
|
+
state.error = null;
|
|
909
|
+
})
|
|
910
|
+
.addCase(createNafathAuth.rejected, function (state, action) {
|
|
911
|
+
state.loading = false;
|
|
912
|
+
state.error = action.error.message;
|
|
913
|
+
})
|
|
914
|
+
.addCase(verifyNafath.pending, function (state) {
|
|
915
|
+
state.loading = true;
|
|
916
|
+
state.error = null;
|
|
917
|
+
})
|
|
918
|
+
.addCase(verifyNafath.fulfilled, function (state, action) {
|
|
863
919
|
var _a;
|
|
864
920
|
state.loading = false;
|
|
865
921
|
state.error = null;
|
|
@@ -895,41 +951,56 @@ export var connectSlice = createSlice({
|
|
|
895
951
|
};
|
|
896
952
|
state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact, leadData: leadResponse });
|
|
897
953
|
})
|
|
898
|
-
.addCase(
|
|
899
|
-
state.loading = true;
|
|
900
|
-
state.error = null;
|
|
901
|
-
})
|
|
902
|
-
.addCase(verifyAuth.rejected, function (state, action) {
|
|
954
|
+
.addCase(verifyNafath.rejected, function (state, action) {
|
|
903
955
|
state.loading = false;
|
|
904
|
-
|
|
956
|
+
var error = action.error.message;
|
|
957
|
+
if (error !== 'Aborted') {
|
|
958
|
+
state.error = error;
|
|
959
|
+
}
|
|
905
960
|
})
|
|
906
|
-
.addCase(
|
|
961
|
+
.addCase(verifyAuth.fulfilled, function (state, action) {
|
|
962
|
+
var _a;
|
|
907
963
|
state.loading = false;
|
|
908
964
|
state.error = null;
|
|
909
|
-
var
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
965
|
+
var _b = action.payload, authResponse = _b.authResponse, leadResponse = _b.leadResponse, countryCode = _b.countryCode;
|
|
966
|
+
var name = leadResponse.name, contact = leadResponse.contact, brand = leadResponse.brand, brand_list = leadResponse.brand_list, channel_list = leadResponse.channel_list, is_new_individual = leadResponse.is_new_individual, id = leadResponse.id;
|
|
967
|
+
var _c = contact || {}, email = _c.email, phone = _c.phone;
|
|
968
|
+
var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
|
|
969
|
+
if (!!fullName) {
|
|
970
|
+
var capitalizedName = capitalizeTheFirstLetterOfEachWord(fullName);
|
|
971
|
+
state.data.individualData.name = capitalizedName;
|
|
972
|
+
}
|
|
973
|
+
if (email)
|
|
974
|
+
state.data.individualData.email = email;
|
|
975
|
+
if (phone === null || phone === void 0 ? void 0 : phone.number)
|
|
976
|
+
state.data.individualData.mobile = phone.number;
|
|
977
|
+
if (!!countryCode)
|
|
978
|
+
state.data.individualData.countryCode = countryCode;
|
|
979
|
+
if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
|
|
980
|
+
state.data.brandData.brandName = brand.name.en;
|
|
981
|
+
var brandList = [];
|
|
982
|
+
if ((brand_list === null || brand_list === void 0 ? void 0 : brand_list.length) > 0) {
|
|
983
|
+
var isBrandExist = brand_list.find(function (item) { return item.id === (brand === null || brand === void 0 ? void 0 : brand.id); });
|
|
984
|
+
brandList = __spreadArray([], brand_list, true);
|
|
985
|
+
if (!isBrandExist && brand)
|
|
986
|
+
brandList = __spreadArray(__spreadArray([], brandList, true), [__assign(__assign({}, brand), { channel_services: (brand === null || brand === void 0 ? void 0 : brand.channel_services) || [] })], false);
|
|
987
|
+
brandList = __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false);
|
|
988
|
+
state.data.brandData.selectedBrandItem = brandList[0];
|
|
989
|
+
}
|
|
990
|
+
state.data.brandData.responseBody = {
|
|
991
|
+
brand_list: brandList,
|
|
992
|
+
channel_list: channel_list,
|
|
993
|
+
brandData: brand
|
|
994
|
+
};
|
|
995
|
+
state.data.otpData.responseBody = __assign(__assign({}, authResponse), { is_new_individual: is_new_individual, lead_id: id, brand_id: brand === null || brand === void 0 ? void 0 : brand.id, name: name, contact: contact, leadData: leadResponse });
|
|
913
996
|
})
|
|
914
|
-
.addCase(
|
|
997
|
+
.addCase(verifyAuth.pending, function (state) {
|
|
915
998
|
state.loading = true;
|
|
916
999
|
state.error = null;
|
|
917
1000
|
})
|
|
918
|
-
.addCase(
|
|
1001
|
+
.addCase(verifyAuth.rejected, function (state, action) {
|
|
919
1002
|
state.loading = false;
|
|
920
1003
|
state.error = action.error.message;
|
|
921
|
-
})
|
|
922
|
-
.addCase(resendOTPNID.fulfilled, function (state, action) {
|
|
923
|
-
state.error = null;
|
|
924
|
-
var response = action.payload;
|
|
925
|
-
state.data.nidData.responseBody = response;
|
|
926
|
-
state.data.otpData.authFor = AuthForType.NATIONAL_ID;
|
|
927
|
-
})
|
|
928
|
-
.addCase(resendOTPNID.pending, function (state) {
|
|
929
|
-
state.error = null;
|
|
930
|
-
})
|
|
931
|
-
.addCase(resendOTPNID.rejected, function (state, action) {
|
|
932
|
-
state.error = action.error.message;
|
|
933
1004
|
})
|
|
934
1005
|
.addCase(updateLeadIndividual.fulfilled, function (state, action) {
|
|
935
1006
|
var _a, _b, _c;
|
|
@@ -1046,7 +1117,7 @@ export var connectSlice = createSlice({
|
|
|
1046
1117
|
state.customLoading = false;
|
|
1047
1118
|
state.error = null;
|
|
1048
1119
|
var _b = action.payload, data = _b.data, countryCode = _b.countryCode;
|
|
1049
|
-
var _c = data || {}, name = _c.name, contact = _c.contact, brand = _c.brand, identification = _c.identification
|
|
1120
|
+
var _c = data || {}, name = _c.name, contact = _c.contact, brand = _c.brand, identification = _c.identification;
|
|
1050
1121
|
var _d = contact || {}, email = _d.email, phone = _d.phone;
|
|
1051
1122
|
var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
|
|
1052
1123
|
if (!!fullName) {
|
|
@@ -1067,8 +1138,6 @@ export var connectSlice = createSlice({
|
|
|
1067
1138
|
state.data.brandData.brandName = brand.name.en;
|
|
1068
1139
|
if (identification === null || identification === void 0 ? void 0 : identification.id)
|
|
1069
1140
|
state.data.nidData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
|
|
1070
|
-
if (date_of_birth)
|
|
1071
|
-
state.data.nidData.dob = date_of_birth;
|
|
1072
1141
|
})
|
|
1073
1142
|
.addCase(retrieveLead.pending, function (state) {
|
|
1074
1143
|
state.customLoading = true;
|
|
@@ -109,9 +109,14 @@ export declare const resendMobileAuthOTP: import("@reduxjs/toolkit").AsyncThunk<
|
|
|
109
109
|
fulfilledMeta?: unknown;
|
|
110
110
|
rejectedMeta?: unknown;
|
|
111
111
|
}>;
|
|
112
|
-
export declare const
|
|
112
|
+
export declare const createNafathAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
113
113
|
response: any;
|
|
114
|
-
formData:
|
|
114
|
+
formData: {
|
|
115
|
+
type: string;
|
|
116
|
+
nid: string;
|
|
117
|
+
dob?: any;
|
|
118
|
+
termAndConditionChecked?: boolean | undefined;
|
|
119
|
+
};
|
|
115
120
|
}, NIDFormValues, {
|
|
116
121
|
state?: unknown;
|
|
117
122
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -122,10 +127,7 @@ export declare const createNIDAuthAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
122
127
|
fulfilledMeta?: unknown;
|
|
123
128
|
rejectedMeta?: unknown;
|
|
124
129
|
}>;
|
|
125
|
-
export declare const
|
|
126
|
-
response: any;
|
|
127
|
-
formData: NIDFormValues;
|
|
128
|
-
}, NIDFormValues, {
|
|
130
|
+
export declare const verifyNafathAsync: import("@reduxjs/toolkit").AsyncThunk<any, verifyPACIAsyncParams, {
|
|
129
131
|
state?: unknown;
|
|
130
132
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
131
133
|
extra?: unknown;
|
|
@@ -158,16 +160,6 @@ export declare const verifyMobileOtpAsync: import("@reduxjs/toolkit").AsyncThunk
|
|
|
158
160
|
fulfilledMeta?: unknown;
|
|
159
161
|
rejectedMeta?: unknown;
|
|
160
162
|
}>;
|
|
161
|
-
export declare const verifyNIDOtpAsync: import("@reduxjs/toolkit").AsyncThunk<any, OTPFormValues, {
|
|
162
|
-
state?: unknown;
|
|
163
|
-
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
164
|
-
extra?: unknown;
|
|
165
|
-
rejectValue?: unknown;
|
|
166
|
-
serializedErrorType?: unknown;
|
|
167
|
-
pendingMeta?: unknown;
|
|
168
|
-
fulfilledMeta?: unknown;
|
|
169
|
-
rejectedMeta?: unknown;
|
|
170
|
-
}>;
|
|
171
163
|
export declare const verifyPACIAsync: import("@reduxjs/toolkit").AsyncThunk<any, verifyPACIAsyncParams, {
|
|
172
164
|
state?: unknown;
|
|
173
165
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -191,22 +183,7 @@ export declare const createCivilIDAuthIdentityAsync: import("@reduxjs/toolkit").
|
|
|
191
183
|
fulfilledMeta?: unknown;
|
|
192
184
|
rejectedMeta?: unknown;
|
|
193
185
|
}>;
|
|
194
|
-
export declare const
|
|
195
|
-
response: {
|
|
196
|
-
verify_token: any;
|
|
197
|
-
};
|
|
198
|
-
formData: NIDFormValues;
|
|
199
|
-
}, NIDFormValues, {
|
|
200
|
-
state?: unknown;
|
|
201
|
-
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
202
|
-
extra?: unknown;
|
|
203
|
-
rejectValue?: unknown;
|
|
204
|
-
serializedErrorType?: unknown;
|
|
205
|
-
pendingMeta?: unknown;
|
|
206
|
-
fulfilledMeta?: unknown;
|
|
207
|
-
rejectedMeta?: unknown;
|
|
208
|
-
}>;
|
|
209
|
-
export declare const resendNIDAuthIdentityOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
186
|
+
export declare const createNIDNafathAuthIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
210
187
|
response: {
|
|
211
188
|
verify_token: any;
|
|
212
189
|
};
|
|
@@ -221,7 +198,7 @@ export declare const resendNIDAuthIdentityOTP: import("@reduxjs/toolkit").AsyncT
|
|
|
221
198
|
fulfilledMeta?: unknown;
|
|
222
199
|
rejectedMeta?: unknown;
|
|
223
200
|
}>;
|
|
224
|
-
export declare const
|
|
201
|
+
export declare const verifyNafathIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<any, verifyPACIAsyncParams, {
|
|
225
202
|
state?: unknown;
|
|
226
203
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
227
204
|
extra?: unknown;
|