@tap-payments/auth-jsconnect 1.0.93-test → 1.0.96-test
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 +7 -2
- package/build/@types/form.d.ts +2 -1
- package/build/api/auth.d.ts +22 -3
- package/build/api/axios.d.ts +2 -0
- package/build/api/axios.js +64 -0
- package/build/api/country.d.ts +1 -2
- package/build/api/country.js +7 -8
- package/build/api/data.d.ts +1 -0
- package/build/api/data.js +9 -2
- package/build/api/entity.d.ts +3 -1
- package/build/api/entity.js +11 -2
- package/build/api/firebase.d.ts +1 -1
- package/build/api/firebase.js +5 -2
- package/build/api/index.d.ts +10 -9
- package/build/api/ip.d.ts +1 -1
- package/build/api/ip.js +5 -2
- package/build/api/lead.d.ts +4 -1
- package/build/api/lead.js +14 -2
- package/build/api/operator.d.ts +1 -1
- package/build/api/operator.js +60 -4
- package/build/app/settings.d.ts +9 -12
- package/build/app/settings.js +87 -111
- package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
- package/build/components/AnimationFlow/AnimationFlow.js +2 -2
- package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
- package/build/components/AnimationFlow/BottomSheet.js +16 -4
- package/build/components/AnimationFlow/Loader.js +1 -1
- package/build/constants/api.d.ts +2 -1
- package/build/constants/api.js +5 -3
- package/build/constants/app.d.ts +6 -0
- package/build/constants/app.js +16 -4
- package/build/features/app/bank/bankStore.js +6 -4
- package/build/features/app/business/businessStore.d.ts +3 -11
- package/build/features/app/business/businessStore.js +69 -62
- package/build/features/app/connect/connectStore.d.ts +6 -17
- package/build/features/app/connect/connectStore.js +112 -61
- package/build/features/app/individual/individualStore.d.ts +3 -7
- package/build/features/app/individual/individualStore.js +28 -54
- package/build/features/app/password/passwordStore.d.ts +29 -1
- package/build/features/app/password/passwordStore.js +184 -8
- package/build/features/app/tax/taxStore.js +7 -5
- package/build/features/bank/Bank.js +4 -4
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -3
- package/build/features/business/Business.js +5 -8
- package/build/features/business/screens/IDBOD/IDBOD.js +1 -1
- package/build/features/business/screens/OTP/OTPInput.js +3 -9
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -5
- package/build/features/connect/Connect.js +4 -8
- package/build/features/connect/screens/Merchant/BrandName.js +3 -2
- package/build/features/connect/screens/Mobile/Mobile.js +2 -2
- package/build/features/connect/screens/NID/NID.js +1 -1
- package/build/features/connect/screens/OTP/OTPInput.js +3 -13
- package/build/features/featuresScreens.js +5 -0
- package/build/features/individual/Individual.js +5 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +10 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +10 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +89 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -3
- package/build/features/password/Password.js +12 -6
- package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
- package/build/features/password/screens/OTP/OTP.d.ts +8 -0
- package/build/features/password/screens/OTP/OTP.js +78 -0
- package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/password/screens/OTP/OTPInput.js +46 -0
- package/build/features/password/screens/OTP/index.d.ts +3 -0
- package/build/features/password/screens/OTP/index.js +2 -0
- package/build/features/password/screens/OTP/validation.d.ts +8 -0
- package/build/features/password/screens/OTP/validation.js +4 -0
- package/build/features/password/screens/Success/Success.js +8 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -4
- package/build/features/password/screens/Verify/OTPInput.d.ts +2 -2
- package/build/features/password/screens/Verify/OTPInput.js +1 -1
- package/build/features/shared/Background/Background.js +3 -2
- package/build/features/shared/Background/LogoBackground.d.ts +1 -4
- package/build/features/shared/Background/LogoBackground.js +4 -32
- package/build/features/shared/Button/FlowsButtons.d.ts +8 -2
- package/build/features/shared/Button/FlowsButtons.js +94 -6
- package/build/features/shared/Button/SuccessButton.js +17 -13
- package/build/features/shared/Footer/Footer.js +2 -3
- package/build/features/tax/Tax.js +3 -3
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -3
- package/build/hooks/useAppConfig.d.ts +1 -4
- package/build/hooks/useAppConfig.js +13 -110
- package/build/hooks/useAppTheme.js +3 -2
- package/build/theme/theme.d.ts +1 -1
- package/build/theme/theme.js +1 -2
- package/build/utils/array.d.ts +3 -0
- package/build/utils/array.js +10 -0
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +4 -0
- package/package.json +1 -1
|
@@ -59,26 +59,10 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
59
59
|
import moment from 'moment';
|
|
60
60
|
import API from '../../../api';
|
|
61
61
|
import { BusinessType, FlowsTypes } from '../../../@types';
|
|
62
|
-
import { BUSINESS_STEP_NAMES,
|
|
63
|
-
import { convertNumbers2English, getFlowUrl, hasKey
|
|
62
|
+
import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
63
|
+
import { convertNumbers2English, getFlowUrl, hasKey } from '../../../utils';
|
|
64
64
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
65
|
-
export var
|
|
66
|
-
var settings, countriesBody, businessCountry;
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
switch (_a.label) {
|
|
69
|
-
case 0:
|
|
70
|
-
settings = thunkApi.getState().settings;
|
|
71
|
-
return [4, API.countryService.getAllCountries()];
|
|
72
|
-
case 1:
|
|
73
|
-
countriesBody = (_a.sent()).data;
|
|
74
|
-
businessCountry = (countriesBody.list || []).find(function (country) {
|
|
75
|
-
return [country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
|
|
76
|
-
});
|
|
77
|
-
return [2, { businessCountry: businessCountry, countries: (countriesBody === null || countriesBody === void 0 ? void 0 : countriesBody.list) || [] }];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}); });
|
|
81
|
-
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
+
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
66
|
var payload, data, leadResponse;
|
|
83
67
|
return __generator(this, function (_a) {
|
|
84
68
|
switch (_a.label) {
|
|
@@ -175,38 +159,63 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
175
159
|
});
|
|
176
160
|
}); });
|
|
177
161
|
export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
178
|
-
var _a, settings, business, identification_id_type, stepName,
|
|
179
|
-
var _b, _c, _d
|
|
180
|
-
return __generator(this, function (
|
|
181
|
-
switch (
|
|
162
|
+
var _a, settings, business, identification_id_type, stepName, requestBody, data;
|
|
163
|
+
var _b, _c, _d;
|
|
164
|
+
return __generator(this, function (_e) {
|
|
165
|
+
switch (_e.label) {
|
|
182
166
|
case 0:
|
|
183
167
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
184
168
|
identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
185
169
|
stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
|
|
186
|
-
headers = {
|
|
187
|
-
lead_id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
|
|
188
|
-
device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
|
|
189
|
-
};
|
|
190
170
|
requestBody = {
|
|
171
|
+
id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
|
|
191
172
|
identification_id: params.nid,
|
|
192
173
|
identification_id_type: identification_id_type,
|
|
193
174
|
date_of_birth: params.dob,
|
|
194
|
-
country_code:
|
|
175
|
+
country_code: settings.data.businessCountry.iso2,
|
|
195
176
|
step_name: stepName,
|
|
196
177
|
encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
|
|
197
178
|
};
|
|
198
|
-
return [4, API.leadService.updateLeadIdentity(requestBody
|
|
179
|
+
return [4, API.leadService.updateLeadIdentity(requestBody)];
|
|
199
180
|
case 1:
|
|
200
|
-
data = (
|
|
201
|
-
if (!data.errors
|
|
181
|
+
data = (_e.sent()).data;
|
|
182
|
+
if (!data.errors) {
|
|
202
183
|
thunkApi.dispatch(updateStepName(stepName));
|
|
203
184
|
thunkApi.dispatch(handleNextScreenStep());
|
|
204
|
-
(
|
|
185
|
+
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
|
|
205
186
|
}
|
|
206
187
|
return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
|
|
207
188
|
}
|
|
208
189
|
});
|
|
209
190
|
}); });
|
|
191
|
+
export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
192
|
+
var _a, settings, business, _b, nid, dob, type, stepName, requestBody, data;
|
|
193
|
+
var _c;
|
|
194
|
+
return __generator(this, function (_d) {
|
|
195
|
+
switch (_d.label) {
|
|
196
|
+
case 0:
|
|
197
|
+
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
198
|
+
_b = business.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
|
|
199
|
+
stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
|
|
200
|
+
requestBody = {
|
|
201
|
+
id: ((_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
|
|
202
|
+
identification_id: nid,
|
|
203
|
+
identification_id_type: type,
|
|
204
|
+
date_of_birth: dob,
|
|
205
|
+
country_code: settings.data.businessCountry.iso2,
|
|
206
|
+
step_name: stepName,
|
|
207
|
+
encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
|
|
208
|
+
};
|
|
209
|
+
return [4, API.leadService.updateLeadIdentity(requestBody)];
|
|
210
|
+
case 1:
|
|
211
|
+
data = (_d.sent()).data;
|
|
212
|
+
if (!data.errors) {
|
|
213
|
+
thunkApi.dispatch(updateStepName(stepName));
|
|
214
|
+
}
|
|
215
|
+
return [2, data];
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}); });
|
|
210
219
|
export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
211
220
|
var data;
|
|
212
221
|
return __generator(this, function (_a) {
|
|
@@ -327,7 +336,7 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
|
|
|
327
336
|
}
|
|
328
337
|
});
|
|
329
338
|
}); });
|
|
330
|
-
export var retrieveDataList = createAsyncThunk('
|
|
339
|
+
export var retrieveDataList = createAsyncThunk('bankRetrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
331
340
|
var _a, customerBases, expectedSales, expectedCustomerSales;
|
|
332
341
|
return __generator(this, function (_b) {
|
|
333
342
|
switch (_b.label) {
|
|
@@ -367,7 +376,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
|
|
|
367
376
|
agree_refund: params.refundPolicy,
|
|
368
377
|
agree_chargeback: params.transactionPolicy,
|
|
369
378
|
step_name: stepName,
|
|
370
|
-
encryption_contract: ['
|
|
379
|
+
encryption_contract: ['customers_served_monthly', 'yearly_sales_range']
|
|
371
380
|
};
|
|
372
381
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
373
382
|
case 1:
|
|
@@ -381,7 +390,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
|
|
|
381
390
|
}
|
|
382
391
|
});
|
|
383
392
|
}); });
|
|
384
|
-
export var updateLeadSuccess = createAsyncThunk('
|
|
393
|
+
export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
385
394
|
var _a, settings, business, _b, steps, id, flowCompleted, payload, data;
|
|
386
395
|
var _c, _d, _e, _f, _g;
|
|
387
396
|
return __generator(this, function (_h) {
|
|
@@ -393,6 +402,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
393
402
|
if (flowCompleted || !id)
|
|
394
403
|
return [2];
|
|
395
404
|
payload = {
|
|
405
|
+
lang: settings.data.language,
|
|
396
406
|
step_name: BUSINESS_STEP_NAMES.BUSINESS_SUCCESS,
|
|
397
407
|
id: id,
|
|
398
408
|
flows: [
|
|
@@ -418,13 +428,15 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
418
428
|
return [4, API.leadService.updateLead(payload)];
|
|
419
429
|
case 1:
|
|
420
430
|
data = (_h.sent()).data;
|
|
431
|
+
if (!!data.errors) return [3, 3];
|
|
421
432
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
422
433
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
423
434
|
return [4, thunkApi.dispatch(retrieveEntityInfo((_g = data.entity) === null || _g === void 0 ? void 0 : _g.id))];
|
|
424
435
|
case 2:
|
|
425
436
|
_h.sent();
|
|
426
437
|
thunkApi.dispatch(handleNextScreenStep());
|
|
427
|
-
|
|
438
|
+
_h.label = 3;
|
|
439
|
+
case 3: return [2, { response: data, formData: params }];
|
|
428
440
|
}
|
|
429
441
|
});
|
|
430
442
|
}); });
|
|
@@ -453,8 +465,6 @@ var initialState = {
|
|
|
453
465
|
customLoading: false,
|
|
454
466
|
data: {
|
|
455
467
|
flowName: FlowsTypes.BUSINESS,
|
|
456
|
-
businessCountry: defaultCountry,
|
|
457
|
-
countries: [],
|
|
458
468
|
verify: {
|
|
459
469
|
token: ''
|
|
460
470
|
},
|
|
@@ -500,23 +510,6 @@ export var businessSlice = createSlice({
|
|
|
500
510
|
},
|
|
501
511
|
extraReducers: function (builder) {
|
|
502
512
|
builder
|
|
503
|
-
.addCase(getCountries.fulfilled, function (state, action) {
|
|
504
|
-
state.error = null;
|
|
505
|
-
state.customLoading = false;
|
|
506
|
-
var _a = action.payload, businessCountry = _a.businessCountry, countries = _a.countries;
|
|
507
|
-
state.data.countries = countries
|
|
508
|
-
.slice()
|
|
509
|
-
.sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
|
|
510
|
-
state.data.businessCountry = businessCountry || defaultCountry;
|
|
511
|
-
})
|
|
512
|
-
.addCase(getCountries.pending, function (state) {
|
|
513
|
-
state.error = null;
|
|
514
|
-
state.customLoading = true;
|
|
515
|
-
})
|
|
516
|
-
.addCase(getCountries.rejected, function (state, action) {
|
|
517
|
-
state.error = action.error.message;
|
|
518
|
-
state.customLoading = false;
|
|
519
|
-
})
|
|
520
513
|
.addCase(verifyLeadToken.pending, function (state) {
|
|
521
514
|
state.error = null;
|
|
522
515
|
state.customLoading = true;
|
|
@@ -577,16 +570,13 @@ export var businessSlice = createSlice({
|
|
|
577
570
|
state.loading = false;
|
|
578
571
|
state.error = action.error.message;
|
|
579
572
|
})
|
|
580
|
-
.addCase(updateLeadIdentity.pending, function (state
|
|
581
|
-
|
|
582
|
-
if (!((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend))
|
|
583
|
-
state.loading = true;
|
|
573
|
+
.addCase(updateLeadIdentity.pending, function (state) {
|
|
574
|
+
state.loading = true;
|
|
584
575
|
state.error = null;
|
|
585
576
|
})
|
|
586
577
|
.addCase(updateLeadIdentity.fulfilled, function (state, action) {
|
|
587
578
|
var _a;
|
|
588
579
|
state.loading = false;
|
|
589
|
-
state.customLoading = false;
|
|
590
580
|
state.error = null;
|
|
591
581
|
var _b = action.payload, data = _b.data, formData = _b.formData;
|
|
592
582
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
@@ -601,7 +591,25 @@ export var businessSlice = createSlice({
|
|
|
601
591
|
})
|
|
602
592
|
.addCase(updateLeadIdentity.rejected, function (state, action) {
|
|
603
593
|
state.loading = false;
|
|
604
|
-
state.
|
|
594
|
+
state.error = action.error.message;
|
|
595
|
+
})
|
|
596
|
+
.addCase(resendOTPLeadIdentity.pending, function (state) {
|
|
597
|
+
state.error = null;
|
|
598
|
+
})
|
|
599
|
+
.addCase(resendOTPLeadIdentity.fulfilled, function (state, action) {
|
|
600
|
+
var _a;
|
|
601
|
+
state.error = null;
|
|
602
|
+
var data = action.payload;
|
|
603
|
+
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
604
|
+
if (description) {
|
|
605
|
+
state.error = description;
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
state.data.nidData.responseBody = data;
|
|
609
|
+
state.data.otpData.otp = '';
|
|
610
|
+
state.data.otpData.isNID = true;
|
|
611
|
+
})
|
|
612
|
+
.addCase(resendOTPLeadIdentity.rejected, function (state, action) {
|
|
605
613
|
state.error = action.error.message;
|
|
606
614
|
})
|
|
607
615
|
.addCase(retrieveEntityList.pending, function (state) {
|
|
@@ -808,7 +816,6 @@ export var businessSlice = createSlice({
|
|
|
808
816
|
return;
|
|
809
817
|
}
|
|
810
818
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), response);
|
|
811
|
-
removeRequestHeaders();
|
|
812
819
|
})
|
|
813
820
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
814
821
|
state.loading = true;
|
|
@@ -1,29 +1,20 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ResponseData,
|
|
2
|
+
import { ResponseData, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues, FlowsTypes } from '../../../@types';
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
|
-
export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
|
|
5
|
-
businessCountry: any;
|
|
6
|
-
countries: any;
|
|
7
|
-
}, void, {}>;
|
|
8
4
|
export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
9
5
|
response: any;
|
|
10
|
-
formData: MobileFormValues
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, MobileFormValues & {
|
|
14
|
-
isResend: boolean;
|
|
15
|
-
}, {}>;
|
|
6
|
+
formData: MobileFormValues;
|
|
7
|
+
}, MobileFormValues, {}>;
|
|
8
|
+
export declare const resendOTPMobile: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
|
|
16
9
|
export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
17
10
|
response: any;
|
|
18
11
|
formData: {
|
|
19
12
|
type: string;
|
|
20
13
|
nid: string;
|
|
21
14
|
dob: string;
|
|
22
|
-
isResend: boolean;
|
|
23
15
|
};
|
|
24
|
-
}, NIDFormValues
|
|
25
|
-
|
|
26
|
-
}, {}>;
|
|
16
|
+
}, NIDFormValues, {}>;
|
|
17
|
+
export declare const resendOTPNID: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
|
|
27
18
|
export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
28
19
|
response: any;
|
|
29
20
|
formData: OTPFormValues;
|
|
@@ -80,8 +71,6 @@ export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
80
71
|
formData: void;
|
|
81
72
|
}, void, {}>;
|
|
82
73
|
export interface ConnectData {
|
|
83
|
-
countries: Array<CountryCode>;
|
|
84
|
-
businessCountry: CountryCode;
|
|
85
74
|
mobileData: (MobileFormValues | undefined) & ResponseData;
|
|
86
75
|
nidData: NIDFormValues & ResponseData & {
|
|
87
76
|
type: string;
|
|
@@ -61,23 +61,7 @@ import { FlowsTypes } from '../../../@types';
|
|
|
61
61
|
import API from '../../../api';
|
|
62
62
|
import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
64
|
-
import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord
|
|
65
|
-
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
-
var settings, countriesBody, businessCountry;
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
switch (_a.label) {
|
|
69
|
-
case 0:
|
|
70
|
-
settings = thunkApi.getState().settings;
|
|
71
|
-
return [4, API.countryService.getAllCountries()];
|
|
72
|
-
case 1:
|
|
73
|
-
countriesBody = (_a.sent()).data;
|
|
74
|
-
businessCountry = (countriesBody.list || []).find(function (country) {
|
|
75
|
-
return [country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
|
|
76
|
-
});
|
|
77
|
-
return [2, { businessCountry: businessCountry, countries: countriesBody.list }];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}); });
|
|
64
|
+
import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord } from '../../../utils';
|
|
81
65
|
export var createMobileAuth = createAsyncThunk('createMobileAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
66
|
var settings, requestBody, data;
|
|
83
67
|
var _a, _b;
|
|
@@ -86,6 +70,7 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
|
|
|
86
70
|
case 0:
|
|
87
71
|
settings = thunkApi.getState().settings;
|
|
88
72
|
requestBody = {
|
|
73
|
+
lang: settings.data.language,
|
|
89
74
|
user_credentail: {
|
|
90
75
|
phone: params.mobile || '',
|
|
91
76
|
code: params.countryCode.idd_prefix.toString()
|
|
@@ -97,7 +82,7 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
|
|
|
97
82
|
return [4, API.authService.createAuth(requestBody)];
|
|
98
83
|
case 1:
|
|
99
84
|
data = (_c.sent()).data;
|
|
100
|
-
if (!data.errors
|
|
85
|
+
if (!data.errors) {
|
|
101
86
|
thunkApi.dispatch(handleNextScreenStep());
|
|
102
87
|
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
103
88
|
}
|
|
@@ -105,20 +90,45 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
|
|
|
105
90
|
}
|
|
106
91
|
});
|
|
107
92
|
}); });
|
|
108
|
-
export var
|
|
109
|
-
var _a, settings, connect,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
switch (_d.label) {
|
|
93
|
+
export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
94
|
+
var _a, settings, connect, _b, mobile, countryCode, requestBody, data;
|
|
95
|
+
return __generator(this, function (_c) {
|
|
96
|
+
switch (_c.label) {
|
|
113
97
|
case 0:
|
|
114
98
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
99
|
+
_b = connect.data.mobileData, mobile = _b.mobile, countryCode = _b.countryCode;
|
|
100
|
+
requestBody = {
|
|
101
|
+
lang: settings.data.language,
|
|
102
|
+
user_credentail: {
|
|
103
|
+
phone: mobile || '',
|
|
104
|
+
code: countryCode.idd_prefix.toString()
|
|
105
|
+
},
|
|
106
|
+
sign_in: false,
|
|
107
|
+
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_MOBILE,
|
|
108
|
+
encryption_contract: ['user_credentail.phone', 'user_credentail.code']
|
|
109
|
+
};
|
|
110
|
+
return [4, API.authService.createAuth(requestBody)];
|
|
111
|
+
case 1:
|
|
112
|
+
data = (_c.sent()).data;
|
|
113
|
+
return [2, data];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}); });
|
|
117
|
+
export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
+
var settings, identification_id_type, requestBody, data;
|
|
119
|
+
var _a, _b;
|
|
120
|
+
return __generator(this, function (_c) {
|
|
121
|
+
switch (_c.label) {
|
|
122
|
+
case 0:
|
|
123
|
+
settings = thunkApi.getState().settings;
|
|
115
124
|
identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
116
125
|
requestBody = {
|
|
126
|
+
lang: settings.data.language,
|
|
117
127
|
user_credentail: {
|
|
118
128
|
identification_id: params.nid,
|
|
119
129
|
identification_id_type: identification_id_type,
|
|
120
130
|
date_of_birth: params.dob,
|
|
121
|
-
country_code:
|
|
131
|
+
country_code: settings.data.businessCountry.iso2
|
|
122
132
|
},
|
|
123
133
|
sign_in: false,
|
|
124
134
|
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
|
|
@@ -131,15 +141,46 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
|
|
|
131
141
|
};
|
|
132
142
|
return [4, API.authService.createAuth(requestBody)];
|
|
133
143
|
case 1:
|
|
134
|
-
data = (
|
|
135
|
-
if (!data.errors
|
|
144
|
+
data = (_c.sent()).data;
|
|
145
|
+
if (!data.errors) {
|
|
136
146
|
thunkApi.dispatch(handleNextScreenStep());
|
|
137
|
-
(
|
|
147
|
+
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
138
148
|
}
|
|
139
149
|
return [2, { response: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
|
|
140
150
|
}
|
|
141
151
|
});
|
|
142
152
|
}); });
|
|
153
|
+
export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
+
var _a, settings, connect, _b, nid, dob, type, requestBody, data;
|
|
155
|
+
return __generator(this, function (_c) {
|
|
156
|
+
switch (_c.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
159
|
+
_b = connect.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
|
|
160
|
+
requestBody = {
|
|
161
|
+
lang: settings.data.language,
|
|
162
|
+
user_credentail: {
|
|
163
|
+
identification_id: nid,
|
|
164
|
+
identification_id_type: type,
|
|
165
|
+
date_of_birth: dob,
|
|
166
|
+
country_code: settings.data.businessCountry.iso2
|
|
167
|
+
},
|
|
168
|
+
sign_in: false,
|
|
169
|
+
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
|
|
170
|
+
encryption_contract: [
|
|
171
|
+
'user_credentail.country_code',
|
|
172
|
+
'user_credentail.identification_id',
|
|
173
|
+
'user_credentail.identification_id_type',
|
|
174
|
+
'user_credentail.date_of_birth'
|
|
175
|
+
]
|
|
176
|
+
};
|
|
177
|
+
return [4, API.authService.createAuth(requestBody)];
|
|
178
|
+
case 1:
|
|
179
|
+
data = (_c.sent()).data;
|
|
180
|
+
return [2, data];
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}); });
|
|
143
184
|
export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
144
185
|
var _a, connect, settings, isAbsher, _b, mobileData, nidData, responseBody, payload, data, params_1, params_2;
|
|
145
186
|
var _c, _d;
|
|
@@ -200,12 +241,12 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
|
|
|
200
241
|
});
|
|
201
242
|
}); });
|
|
202
243
|
export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
203
|
-
var
|
|
244
|
+
var settings, businessCountry, payload, brandPayload, _a, brandResponse, data;
|
|
204
245
|
return __generator(this, function (_b) {
|
|
205
246
|
switch (_b.label) {
|
|
206
247
|
case 0:
|
|
207
|
-
|
|
208
|
-
businessCountry =
|
|
248
|
+
settings = thunkApi.getState().settings;
|
|
249
|
+
businessCountry = settings.data.businessCountry;
|
|
209
250
|
payload = {
|
|
210
251
|
individual_id: params.individualId,
|
|
211
252
|
country_code: businessCountry.iso2
|
|
@@ -370,6 +411,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
370
411
|
isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
|
|
371
412
|
leadId = isExistingUser ? (_c = brandData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id : (_d = otpData.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id;
|
|
372
413
|
payload = {
|
|
414
|
+
lang: settings.data.language,
|
|
373
415
|
step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
|
|
374
416
|
flows: [
|
|
375
417
|
{
|
|
@@ -395,8 +437,6 @@ var initialState = {
|
|
|
395
437
|
customLoading: false,
|
|
396
438
|
data: {
|
|
397
439
|
flowName: FlowsTypes.CONNECT,
|
|
398
|
-
businessCountry: defaultCountry,
|
|
399
|
-
countries: [],
|
|
400
440
|
mobileData: {
|
|
401
441
|
countryCode: defaultCountry,
|
|
402
442
|
mobile: null
|
|
@@ -456,28 +496,9 @@ export var connectSlice = createSlice({
|
|
|
456
496
|
},
|
|
457
497
|
extraReducers: function (builder) {
|
|
458
498
|
builder
|
|
459
|
-
.addCase(getCountries.fulfilled, function (state, action) {
|
|
460
|
-
state.error = null;
|
|
461
|
-
state.customLoading = false;
|
|
462
|
-
var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
|
|
463
|
-
state.data.countries = countries
|
|
464
|
-
.slice()
|
|
465
|
-
.sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
|
|
466
|
-
state.data.businessCountry = businessCountry || defaultCountry;
|
|
467
|
-
state.data.mobileData.countryCode = businessCountry || defaultCountry;
|
|
468
|
-
})
|
|
469
|
-
.addCase(getCountries.pending, function (state) {
|
|
470
|
-
state.error = null;
|
|
471
|
-
state.customLoading = true;
|
|
472
|
-
})
|
|
473
|
-
.addCase(getCountries.rejected, function (state, action) {
|
|
474
|
-
state.error = action.error.message;
|
|
475
|
-
state.customLoading = false;
|
|
476
|
-
})
|
|
477
499
|
.addCase(createMobileAuth.fulfilled, function (state, action) {
|
|
478
500
|
var _a;
|
|
479
501
|
state.loading = false;
|
|
480
|
-
state.customLoading = false;
|
|
481
502
|
state.error = null;
|
|
482
503
|
var _b = action.payload, formData = _b.formData, response = _b.response;
|
|
483
504
|
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
@@ -489,16 +510,30 @@ export var connectSlice = createSlice({
|
|
|
489
510
|
state.data.mobileData.responseBody = response;
|
|
490
511
|
state.data.otpData.isAbsher = false;
|
|
491
512
|
})
|
|
492
|
-
.addCase(createMobileAuth.pending, function (state
|
|
493
|
-
|
|
494
|
-
state.customLoading = true;
|
|
495
|
-
if (!action.meta.arg.isResend)
|
|
496
|
-
state.loading = true;
|
|
513
|
+
.addCase(createMobileAuth.pending, function (state) {
|
|
514
|
+
state.loading = true;
|
|
497
515
|
state.error = null;
|
|
498
516
|
})
|
|
499
517
|
.addCase(createMobileAuth.rejected, function (state, action) {
|
|
500
518
|
state.loading = false;
|
|
501
|
-
state.
|
|
519
|
+
state.error = action.error.message;
|
|
520
|
+
})
|
|
521
|
+
.addCase(resendOTPMobile.fulfilled, function (state, action) {
|
|
522
|
+
var _a;
|
|
523
|
+
state.error = null;
|
|
524
|
+
var response = action.payload;
|
|
525
|
+
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
526
|
+
if (description) {
|
|
527
|
+
state.error = description;
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
state.data.mobileData.responseBody = response;
|
|
531
|
+
state.data.otpData.isAbsher = false;
|
|
532
|
+
})
|
|
533
|
+
.addCase(resendOTPMobile.pending, function (state) {
|
|
534
|
+
state.error = null;
|
|
535
|
+
})
|
|
536
|
+
.addCase(resendOTPMobile.rejected, function (state, action) {
|
|
502
537
|
state.error = action.error.message;
|
|
503
538
|
})
|
|
504
539
|
.addCase(createNIDAuth.fulfilled, function (state, action) {
|
|
@@ -515,14 +550,31 @@ export var connectSlice = createSlice({
|
|
|
515
550
|
state.data.nidData.responseBody = response;
|
|
516
551
|
state.data.otpData.isAbsher = true;
|
|
517
552
|
})
|
|
518
|
-
.addCase(createNIDAuth.pending, function (state
|
|
519
|
-
|
|
520
|
-
state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
|
|
553
|
+
.addCase(createNIDAuth.pending, function (state) {
|
|
554
|
+
state.loading = true;
|
|
521
555
|
state.error = null;
|
|
522
556
|
})
|
|
523
557
|
.addCase(createNIDAuth.rejected, function (state, action) {
|
|
524
558
|
state.loading = false;
|
|
525
559
|
state.error = action.error.message;
|
|
560
|
+
})
|
|
561
|
+
.addCase(resendOTPNID.fulfilled, function (state, action) {
|
|
562
|
+
var _a;
|
|
563
|
+
state.error = null;
|
|
564
|
+
var response = action.payload;
|
|
565
|
+
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
566
|
+
if (description) {
|
|
567
|
+
state.error = description;
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
state.data.nidData.responseBody = response;
|
|
571
|
+
state.data.otpData.isAbsher = true;
|
|
572
|
+
})
|
|
573
|
+
.addCase(resendOTPNID.pending, function (state) {
|
|
574
|
+
state.error = null;
|
|
575
|
+
})
|
|
576
|
+
.addCase(resendOTPNID.rejected, function (state, action) {
|
|
577
|
+
state.error = action.error.message;
|
|
526
578
|
})
|
|
527
579
|
.addCase(verifyAuth.fulfilled, function (state, action) {
|
|
528
580
|
var _a;
|
|
@@ -680,7 +732,6 @@ export var connectSlice = createSlice({
|
|
|
680
732
|
state.error = description;
|
|
681
733
|
return;
|
|
682
734
|
}
|
|
683
|
-
removeRequestHeaders();
|
|
684
735
|
})
|
|
685
736
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
686
737
|
state.loading = true;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import {
|
|
3
|
-
export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
-
businessCountry: any;
|
|
5
|
-
countries: any;
|
|
6
|
-
}, void, {}>;
|
|
2
|
+
import { FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
7
3
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
8
4
|
data: any;
|
|
9
5
|
leadData: any;
|
|
@@ -16,6 +12,8 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
16
12
|
sourceIncome: any;
|
|
17
13
|
monthlyIncome: any;
|
|
18
14
|
countryCode: string;
|
|
15
|
+
occupation: any;
|
|
16
|
+
countries: import("../../../@types").CountryCode[];
|
|
19
17
|
}, string, {}>;
|
|
20
18
|
export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
21
19
|
data: any;
|
|
@@ -38,8 +36,6 @@ declare type VerifyData = {
|
|
|
38
36
|
token: string;
|
|
39
37
|
};
|
|
40
38
|
export interface IndividualData {
|
|
41
|
-
businessCountry: CountryCode;
|
|
42
|
-
countries: Array<CountryCode>;
|
|
43
39
|
verify: ResponseData & VerifyData;
|
|
44
40
|
otpData: OTPFormValues & ResponseData;
|
|
45
41
|
individualData: IndividualExtraFormValues & ResponseData;
|