@tap-payments/auth-jsconnect 1.0.93-test → 2.0.1
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/README.md +2 -2
- package/build/@types/app.d.ts +2 -2
- package/build/api/auth.d.ts +2 -0
- package/build/api/axios.d.ts +2 -0
- package/build/api/axios.js +65 -0
- package/build/api/country.d.ts +1 -2
- package/build/api/country.js +7 -8
- package/build/api/firebase.d.ts +1 -1
- package/build/api/firebase.js +5 -2
- package/build/api/index.d.ts +4 -5
- package/build/api/ip.d.ts +1 -1
- package/build/api/ip.js +5 -2
- package/build/api/lead.d.ts +2 -0
- 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/Loader.js +1 -1
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +1 -0
- package/build/features/app/bank/bankStore.js +2 -2
- package/build/features/app/business/businessStore.d.ts +1 -7
- package/build/features/app/business/businessStore.js +5 -42
- package/build/features/app/connect/connectStore.d.ts +1 -7
- package/build/features/app/connect/connectStore.js +12 -53
- package/build/features/app/individual/individualStore.d.ts +1 -6
- package/build/features/app/individual/individualStore.js +16 -47
- package/build/features/app/password/passwordStore.js +2 -2
- package/build/features/app/tax/taxStore.js +2 -2
- package/build/features/bank/Bank.js +3 -3
- package/build/features/business/Business.js +4 -7
- package/build/features/connect/Connect.js +3 -7
- package/build/features/connect/screens/Merchant/BrandName.js +3 -2
- package/build/features/connect/screens/Mobile/Mobile.js +1 -1
- package/build/features/individual/Individual.js +4 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +4 -2
- package/build/features/password/Password.js +3 -3
- 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.js +3 -2
- package/build/features/shared/Footer/Footer.js +2 -3
- package/build/features/tax/Tax.js +3 -3
- package/build/hooks/useAppConfig.d.ts +1 -4
- package/build/hooks/useAppConfig.js +13 -110
- package/build/utils/array.d.ts +3 -0
- package/build/utils/array.js +10 -0
- package/package.json +1 -1
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues,
|
|
3
|
-
export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
-
businessCountry: any;
|
|
5
|
-
countries: any;
|
|
6
|
-
}, void, {}>;
|
|
2
|
+
import { ActivitiesFormValues, CustomersFormValues, BusinessTypeFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState, FlowsTypes } from '../../../@types';
|
|
7
3
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
8
4
|
data: any;
|
|
9
5
|
leadData: any;
|
|
@@ -73,8 +69,6 @@ declare type VerifyData = {
|
|
|
73
69
|
};
|
|
74
70
|
export interface BusinessData {
|
|
75
71
|
verify: ResponseData & VerifyData;
|
|
76
|
-
businessCountry: CountryCode;
|
|
77
|
-
countries: CountryCode[];
|
|
78
72
|
otpData: OTPFormValues & ResponseData & {
|
|
79
73
|
isNID: boolean;
|
|
80
74
|
};
|
|
@@ -59,25 +59,9 @@ 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 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 === null || countriesBody === void 0 ? void 0 : countriesBody.list) || [] }];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}); });
|
|
81
65
|
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', 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) {
|
|
@@ -191,7 +175,7 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
191
175
|
identification_id: params.nid,
|
|
192
176
|
identification_id_type: identification_id_type,
|
|
193
177
|
date_of_birth: params.dob,
|
|
194
|
-
country_code:
|
|
178
|
+
country_code: settings.data.businessCountry.iso2,
|
|
195
179
|
step_name: stepName,
|
|
196
180
|
encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
|
|
197
181
|
};
|
|
@@ -367,7 +351,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
|
|
|
367
351
|
agree_refund: params.refundPolicy,
|
|
368
352
|
agree_chargeback: params.transactionPolicy,
|
|
369
353
|
step_name: stepName,
|
|
370
|
-
encryption_contract: ['
|
|
354
|
+
encryption_contract: ['customers_served_monthly', 'yearly_sales_range']
|
|
371
355
|
};
|
|
372
356
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
373
357
|
case 1:
|
|
@@ -393,6 +377,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
393
377
|
if (flowCompleted || !id)
|
|
394
378
|
return [2];
|
|
395
379
|
payload = {
|
|
380
|
+
lang: settings.data.language,
|
|
396
381
|
step_name: BUSINESS_STEP_NAMES.BUSINESS_SUCCESS,
|
|
397
382
|
id: id,
|
|
398
383
|
flows: [
|
|
@@ -453,8 +438,6 @@ var initialState = {
|
|
|
453
438
|
customLoading: false,
|
|
454
439
|
data: {
|
|
455
440
|
flowName: FlowsTypes.BUSINESS,
|
|
456
|
-
businessCountry: defaultCountry,
|
|
457
|
-
countries: [],
|
|
458
441
|
verify: {
|
|
459
442
|
token: ''
|
|
460
443
|
},
|
|
@@ -500,23 +483,6 @@ export var businessSlice = createSlice({
|
|
|
500
483
|
},
|
|
501
484
|
extraReducers: function (builder) {
|
|
502
485
|
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
486
|
.addCase(verifyLeadToken.pending, function (state) {
|
|
521
487
|
state.error = null;
|
|
522
488
|
state.customLoading = true;
|
|
@@ -586,7 +552,6 @@ export var businessSlice = createSlice({
|
|
|
586
552
|
.addCase(updateLeadIdentity.fulfilled, function (state, action) {
|
|
587
553
|
var _a;
|
|
588
554
|
state.loading = false;
|
|
589
|
-
state.customLoading = false;
|
|
590
555
|
state.error = null;
|
|
591
556
|
var _b = action.payload, data = _b.data, formData = _b.formData;
|
|
592
557
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
@@ -601,7 +566,6 @@ export var businessSlice = createSlice({
|
|
|
601
566
|
})
|
|
602
567
|
.addCase(updateLeadIdentity.rejected, function (state, action) {
|
|
603
568
|
state.loading = false;
|
|
604
|
-
state.customLoading = false;
|
|
605
569
|
state.error = action.error.message;
|
|
606
570
|
})
|
|
607
571
|
.addCase(retrieveEntityList.pending, function (state) {
|
|
@@ -808,7 +772,6 @@ export var businessSlice = createSlice({
|
|
|
808
772
|
return;
|
|
809
773
|
}
|
|
810
774
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), response);
|
|
811
|
-
removeRequestHeaders();
|
|
812
775
|
})
|
|
813
776
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
814
777
|
state.loading = true;
|
|
@@ -1,10 +1,6 @@
|
|
|
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
6
|
formData: MobileFormValues & {
|
|
@@ -80,8 +76,6 @@ export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
80
76
|
formData: void;
|
|
81
77
|
}, void, {}>;
|
|
82
78
|
export interface ConnectData {
|
|
83
|
-
countries: Array<CountryCode>;
|
|
84
|
-
businessCountry: CountryCode;
|
|
85
79
|
mobileData: (MobileFormValues | undefined) & ResponseData;
|
|
86
80
|
nidData: NIDFormValues & ResponseData & {
|
|
87
81
|
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()
|
|
@@ -114,11 +99,12 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
|
|
|
114
99
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
115
100
|
identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
116
101
|
requestBody = {
|
|
102
|
+
lang: settings.data.language,
|
|
117
103
|
user_credentail: {
|
|
118
104
|
identification_id: params.nid,
|
|
119
105
|
identification_id_type: identification_id_type,
|
|
120
106
|
date_of_birth: params.dob,
|
|
121
|
-
country_code:
|
|
107
|
+
country_code: settings.data.businessCountry.iso2
|
|
122
108
|
},
|
|
123
109
|
sign_in: false,
|
|
124
110
|
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
|
|
@@ -200,12 +186,12 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
|
|
|
200
186
|
});
|
|
201
187
|
}); });
|
|
202
188
|
export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
203
|
-
var connect, businessCountry, payload, brandPayload,
|
|
204
|
-
return __generator(this, function (
|
|
205
|
-
switch (
|
|
189
|
+
var _a, connect, settings, businessCountry, payload, brandPayload, _b, brandResponse, data;
|
|
190
|
+
return __generator(this, function (_c) {
|
|
191
|
+
switch (_c.label) {
|
|
206
192
|
case 0:
|
|
207
|
-
|
|
208
|
-
businessCountry =
|
|
193
|
+
_a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
|
|
194
|
+
businessCountry = settings.data.businessCountry;
|
|
209
195
|
payload = {
|
|
210
196
|
individual_id: params.individualId,
|
|
211
197
|
country_code: businessCountry.iso2
|
|
@@ -218,7 +204,7 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
|
|
|
218
204
|
API.leadService.createLead(payload)
|
|
219
205
|
])];
|
|
220
206
|
case 1:
|
|
221
|
-
|
|
207
|
+
_b = _c.sent(), brandResponse = _b[0].data, data = _b[1].data;
|
|
222
208
|
if (!data.errors) {
|
|
223
209
|
thunkApi.dispatch(handleNextScreenStep(params.stepName));
|
|
224
210
|
}
|
|
@@ -293,14 +279,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
293
279
|
id: (isExistingUser ? (_h = brandData.responseBody) === null || _h === void 0 ? void 0 : _h.lead_id : (_j = otpData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id) || '',
|
|
294
280
|
terms_conditions_accepted: params.termAndConditionChecked,
|
|
295
281
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
|
|
296
|
-
encryption_contract: [
|
|
297
|
-
'brand.name.en',
|
|
298
|
-
'brand.name.ar',
|
|
299
|
-
'brand.name.zh',
|
|
300
|
-
'brand.website',
|
|
301
|
-
'brand.social[0]',
|
|
302
|
-
'brand.social[1]'
|
|
303
|
-
]
|
|
282
|
+
encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh', 'brand.website']
|
|
304
283
|
};
|
|
305
284
|
return [4, API.leadService.updateLead(payload)];
|
|
306
285
|
case 1:
|
|
@@ -370,6 +349,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
370
349
|
isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
|
|
371
350
|
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
351
|
payload = {
|
|
352
|
+
lang: settings.data.language,
|
|
373
353
|
step_name: CONNECT_STEP_NAMES.CONNECT_SUCCESS,
|
|
374
354
|
flows: [
|
|
375
355
|
{
|
|
@@ -395,8 +375,6 @@ var initialState = {
|
|
|
395
375
|
customLoading: false,
|
|
396
376
|
data: {
|
|
397
377
|
flowName: FlowsTypes.CONNECT,
|
|
398
|
-
businessCountry: defaultCountry,
|
|
399
|
-
countries: [],
|
|
400
378
|
mobileData: {
|
|
401
379
|
countryCode: defaultCountry,
|
|
402
380
|
mobile: null
|
|
@@ -456,24 +434,6 @@ export var connectSlice = createSlice({
|
|
|
456
434
|
},
|
|
457
435
|
extraReducers: function (builder) {
|
|
458
436
|
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
437
|
.addCase(createMobileAuth.fulfilled, function (state, action) {
|
|
478
438
|
var _a;
|
|
479
439
|
state.loading = false;
|
|
@@ -680,7 +640,6 @@ export var connectSlice = createSlice({
|
|
|
680
640
|
state.error = description;
|
|
681
641
|
return;
|
|
682
642
|
}
|
|
683
|
-
removeRequestHeaders();
|
|
684
643
|
})
|
|
685
644
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
686
645
|
state.loading = true;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
2
|
import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
|
-
export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
-
businessCountry: any;
|
|
5
|
-
countries: any;
|
|
6
|
-
}, void, {}>;
|
|
7
3
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
8
4
|
data: any;
|
|
9
5
|
leadData: any;
|
|
@@ -16,6 +12,7 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
16
12
|
sourceIncome: any;
|
|
17
13
|
monthlyIncome: any;
|
|
18
14
|
countryCode: string;
|
|
15
|
+
countries: CountryCode[];
|
|
19
16
|
}, string, {}>;
|
|
20
17
|
export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
21
18
|
data: any;
|
|
@@ -38,8 +35,6 @@ declare type VerifyData = {
|
|
|
38
35
|
token: string;
|
|
39
36
|
};
|
|
40
37
|
export interface IndividualData {
|
|
41
|
-
businessCountry: CountryCode;
|
|
42
|
-
countries: Array<CountryCode>;
|
|
43
38
|
verify: ResponseData & VerifyData;
|
|
44
39
|
otpData: OTPFormValues & ResponseData;
|
|
45
40
|
individualData: IndividualExtraFormValues & ResponseData;
|
|
@@ -49,25 +49,9 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import { hasKey
|
|
52
|
+
import { hasKey } from '../../../utils';
|
|
53
53
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
54
|
-
import {
|
|
55
|
-
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var settings, countriesBody, businessCountry;
|
|
57
|
-
return __generator(this, function (_a) {
|
|
58
|
-
switch (_a.label) {
|
|
59
|
-
case 0:
|
|
60
|
-
settings = thunkApi.getState().settings;
|
|
61
|
-
return [4, API.countryService.getAllCountries()];
|
|
62
|
-
case 1:
|
|
63
|
-
countriesBody = (_a.sent()).data;
|
|
64
|
-
businessCountry = (countriesBody.list || []).find(function (country) {
|
|
65
|
-
return [country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase());
|
|
66
|
-
});
|
|
67
|
-
return [2, { businessCountry: businessCountry, countries: countriesBody.list }];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}); });
|
|
54
|
+
import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
71
55
|
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
56
|
var payload, data, leadResponse, _a, steps, entity, hasTaxCompleted;
|
|
73
57
|
var _b, _c;
|
|
@@ -123,19 +107,23 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
|
|
|
123
107
|
});
|
|
124
108
|
}); });
|
|
125
109
|
export var retrieveDataList = createAsyncThunk('retrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
126
|
-
var _a, sourceIncome, monthlyIncome;
|
|
110
|
+
var settings, _a, sourceIncome, monthlyIncome, countries;
|
|
127
111
|
return __generator(this, function (_b) {
|
|
128
112
|
switch (_b.label) {
|
|
129
|
-
case 0:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
113
|
+
case 0:
|
|
114
|
+
settings = thunkApi.getState().settings;
|
|
115
|
+
return [4, Promise.all([
|
|
116
|
+
API.dataService.getSourceOfIncome(),
|
|
117
|
+
API.dataService.getMonthlyIncome(countryCode)
|
|
118
|
+
])];
|
|
133
119
|
case 1:
|
|
134
120
|
_a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data;
|
|
121
|
+
countries = settings.data.countries;
|
|
135
122
|
return [2, {
|
|
136
123
|
sourceIncome: sourceIncome,
|
|
137
124
|
monthlyIncome: monthlyIncome,
|
|
138
|
-
countryCode: countryCode
|
|
125
|
+
countryCode: countryCode,
|
|
126
|
+
countries: countries
|
|
139
127
|
}];
|
|
140
128
|
}
|
|
141
129
|
});
|
|
@@ -203,7 +191,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
203
191
|
actual_income: (_f = params.monthlyIncome) === null || _f === void 0 ? void 0 : _f.id,
|
|
204
192
|
is_relative_PEP: params.isPEP,
|
|
205
193
|
is_influencer: params.isInfluencer,
|
|
206
|
-
encryption_contract: ['employer_name', 'employer_city', 'actual_income'
|
|
194
|
+
encryption_contract: ['employer_name', 'employer_city', 'actual_income'],
|
|
207
195
|
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
|
|
208
196
|
};
|
|
209
197
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
@@ -228,6 +216,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
228
216
|
if (!id)
|
|
229
217
|
return [2];
|
|
230
218
|
payload = {
|
|
219
|
+
lang: settings.data.language,
|
|
231
220
|
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS,
|
|
232
221
|
id: id,
|
|
233
222
|
encryption_contract: []
|
|
@@ -250,8 +239,6 @@ var initialState = {
|
|
|
250
239
|
loading: false,
|
|
251
240
|
data: {
|
|
252
241
|
flowName: FlowsTypes.INDIVIDUAL,
|
|
253
|
-
countries: [],
|
|
254
|
-
businessCountry: defaultCountry,
|
|
255
242
|
verify: {
|
|
256
243
|
token: ''
|
|
257
244
|
},
|
|
@@ -284,23 +271,6 @@ export var individualSlice = createSlice({
|
|
|
284
271
|
},
|
|
285
272
|
extraReducers: function (builder) {
|
|
286
273
|
builder
|
|
287
|
-
.addCase(getCountries.fulfilled, function (state, action) {
|
|
288
|
-
state.error = null;
|
|
289
|
-
state.customLoading = false;
|
|
290
|
-
var _a = action.payload, countries = _a.countries, businessCountry = _a.businessCountry;
|
|
291
|
-
state.data.countries = countries
|
|
292
|
-
.slice()
|
|
293
|
-
.sort(function (cOne, cTwo) { return cOne.name.english.localeCompare(cTwo.name.english); });
|
|
294
|
-
state.data.businessCountry = businessCountry || defaultCountry;
|
|
295
|
-
})
|
|
296
|
-
.addCase(getCountries.pending, function (state) {
|
|
297
|
-
state.error = null;
|
|
298
|
-
state.customLoading = true;
|
|
299
|
-
})
|
|
300
|
-
.addCase(getCountries.rejected, function (state, action) {
|
|
301
|
-
state.error = action.error.message;
|
|
302
|
-
state.customLoading = false;
|
|
303
|
-
})
|
|
304
274
|
.addCase(verifyLeadToken.pending, function (state) {
|
|
305
275
|
state.error = null;
|
|
306
276
|
state.customLoading = true;
|
|
@@ -367,7 +337,7 @@ export var individualSlice = createSlice({
|
|
|
367
337
|
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
368
338
|
state.loading = false;
|
|
369
339
|
state.error = null;
|
|
370
|
-
var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode;
|
|
340
|
+
var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode, countries = _a.countries;
|
|
371
341
|
var data = state.data.individualData.responseBody;
|
|
372
342
|
state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [] });
|
|
373
343
|
var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
|
|
@@ -377,7 +347,7 @@ export var individualSlice = createSlice({
|
|
|
377
347
|
if (!!selectedMonthlyIncome)
|
|
378
348
|
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
379
349
|
if (!!countryCode) {
|
|
380
|
-
var employerLocation =
|
|
350
|
+
var employerLocation = countries.find(function (country) { return country.iso2 === countryCode; });
|
|
381
351
|
state.data.individualData.employerLocation = employerLocation;
|
|
382
352
|
}
|
|
383
353
|
})
|
|
@@ -438,7 +408,6 @@ export var individualSlice = createSlice({
|
|
|
438
408
|
}
|
|
439
409
|
var flows = response.flows, steps = response.steps;
|
|
440
410
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
|
|
441
|
-
removeRequestHeaders();
|
|
442
411
|
})
|
|
443
412
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
444
413
|
state.loading = true;
|
|
@@ -49,7 +49,7 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import { hasKey
|
|
52
|
+
import { hasKey } from '../../../utils';
|
|
53
53
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
54
54
|
import { PASSWORD_STEP_NAMES } from '../../../constants';
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -184,6 +184,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
184
184
|
if (!id)
|
|
185
185
|
return [2];
|
|
186
186
|
payload = {
|
|
187
|
+
lang: settings.data.language,
|
|
187
188
|
step_name: PASSWORD_STEP_NAMES.PASSWORD_SUCCESS,
|
|
188
189
|
id: id,
|
|
189
190
|
encryption_contract: []
|
|
@@ -346,7 +347,6 @@ export var passwordSlice = createSlice({
|
|
|
346
347
|
}
|
|
347
348
|
var flows = response.flows, steps = response.steps;
|
|
348
349
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
|
|
349
|
-
removeRequestHeaders();
|
|
350
350
|
})
|
|
351
351
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
352
352
|
state.loading = true;
|
|
@@ -49,7 +49,7 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import { hasKey
|
|
52
|
+
import { hasKey } from '../../../utils';
|
|
53
53
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
54
54
|
import { TAX_STEP_NAMES } from '../../../constants';
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -183,6 +183,7 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
183
183
|
if (!id)
|
|
184
184
|
return [2];
|
|
185
185
|
payload = {
|
|
186
|
+
lang: settings.data.language,
|
|
186
187
|
step_name: TAX_STEP_NAMES.TAX_SUCCESS,
|
|
187
188
|
id: id,
|
|
188
189
|
encryption_contract: []
|
|
@@ -345,7 +346,6 @@ export var taxSlice = createSlice({
|
|
|
345
346
|
}
|
|
346
347
|
var flows = response.flows, steps = response.steps;
|
|
347
348
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps });
|
|
348
|
-
removeRequestHeaders();
|
|
349
349
|
})
|
|
350
350
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
351
351
|
state.loading = true;
|
|
@@ -29,7 +29,7 @@ var Bank = memo(function (props) {
|
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
30
|
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
31
31
|
var _b = useAppSelector(bankSelector), customLoading = _b.customLoading, bankError = _b.error;
|
|
32
|
-
|
|
32
|
+
useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props));
|
|
33
33
|
useErrorListener(bankError || error);
|
|
34
34
|
useStepStartedListener();
|
|
35
35
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
@@ -44,9 +44,9 @@ var Bank = memo(function (props) {
|
|
|
44
44
|
dispatch(verifyLeadToken(token));
|
|
45
45
|
};
|
|
46
46
|
useEffect(function () {
|
|
47
|
-
if (!
|
|
47
|
+
if (!settingLoading)
|
|
48
48
|
verifyToken();
|
|
49
|
-
}, [
|
|
49
|
+
}, [settingLoading]);
|
|
50
50
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.map(function (_a, index) {
|
|
51
51
|
var Element = _a.element, name = _a.name;
|
|
52
52
|
var isActive = activeScreen.name === name;
|
|
@@ -14,7 +14,7 @@ import { memo, useEffect } from 'react';
|
|
|
14
14
|
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
|
|
15
15
|
import { handleLanguage, settingsSelector } from '../../app/settings';
|
|
16
16
|
import { FeatureContainer } from '../shared/Containers';
|
|
17
|
-
import { businessSelector,
|
|
17
|
+
import { businessSelector, verifyLeadToken } from '../app/business/businessStore';
|
|
18
18
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
19
19
|
import { store } from '../../app/store';
|
|
20
20
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
@@ -29,7 +29,7 @@ var Business = memo(function (props) {
|
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
30
|
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
31
31
|
var _b = useAppSelector(businessSelector), customLoading = _b.customLoading, businessError = _b.error;
|
|
32
|
-
|
|
32
|
+
useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props));
|
|
33
33
|
useErrorListener(businessError || error);
|
|
34
34
|
useStepStartedListener();
|
|
35
35
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
@@ -44,12 +44,9 @@ var Business = memo(function (props) {
|
|
|
44
44
|
dispatch(verifyLeadToken(token));
|
|
45
45
|
};
|
|
46
46
|
useEffect(function () {
|
|
47
|
-
if (!
|
|
47
|
+
if (!settingLoading)
|
|
48
48
|
verifyToken();
|
|
49
|
-
}, [
|
|
50
|
-
useEffect(function () {
|
|
51
|
-
dispatch(getCountries());
|
|
52
|
-
}, []);
|
|
49
|
+
}, [settingLoading]);
|
|
53
50
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: businessFeatureScreens.map(function (_a, index) {
|
|
54
51
|
var Element = _a.element, name = _a.name;
|
|
55
52
|
var isActive = activeScreen.name === name;
|
|
@@ -10,13 +10,13 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { memo
|
|
13
|
+
import { memo } from 'react';
|
|
14
14
|
import { FeatureContainer } from '../shared/Containers';
|
|
15
|
-
import { useAppTheme,
|
|
15
|
+
import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
|
|
16
16
|
import { settingsSelector } from '../../app/settings';
|
|
17
17
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
18
18
|
import { store } from '../../app/store';
|
|
19
|
-
import { connectSelector
|
|
19
|
+
import { connectSelector } from '../app/connect/connectStore';
|
|
20
20
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
21
21
|
import Collapse from '../../components/Collapse';
|
|
22
22
|
import { reactElement } from '../../utils';
|
|
@@ -26,16 +26,12 @@ import CustomFooter from '../shared/Footer';
|
|
|
26
26
|
import Background from '../shared/Background';
|
|
27
27
|
var Connect = memo(function (props) {
|
|
28
28
|
var theme = useAppTheme().theme;
|
|
29
|
-
var dispatch = useAppDispatch();
|
|
30
29
|
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
31
30
|
var connectError = useAppSelector(connectSelector).error;
|
|
32
31
|
useAppConfig(__assign({ navigation: CONNECT_SCREENS_NAVIGATION }, props));
|
|
33
32
|
useErrorListener(connectError || error);
|
|
34
33
|
useStepStartedListener();
|
|
35
34
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
36
|
-
useEffect(function () {
|
|
37
|
-
dispatch(getCountries());
|
|
38
|
-
}, []);
|
|
39
35
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
|
|
40
36
|
var Element = _a.element, name = _a.name;
|
|
41
37
|
var isActive = activeScreen.name === name;
|
|
@@ -63,9 +63,10 @@ import Tooltip from '../../../../components/Tooltip';
|
|
|
63
63
|
import Collapse from '../../../../components/Collapse';
|
|
64
64
|
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
65
65
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
66
|
-
import { checkBrandNameAvailability
|
|
66
|
+
import { checkBrandNameAvailability } from '../../../app/connect/connectStore';
|
|
67
67
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
68
68
|
import { debounce } from 'lodash-es';
|
|
69
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
69
70
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
70
71
|
var theme = _a.theme;
|
|
71
72
|
return ({
|
|
@@ -107,7 +108,7 @@ var BrandName = function (_a) {
|
|
|
107
108
|
var brandControl = useController({ control: control, name: 'brandName' });
|
|
108
109
|
var brandNameValue = brandControl.field.value;
|
|
109
110
|
var error = (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
110
|
-
var data = useAppSelector(
|
|
111
|
+
var data = useAppSelector(settingsSelector).data;
|
|
111
112
|
var checkBrand = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
|
|
112
113
|
var onSuccess;
|
|
113
114
|
return __generator(this, function (_a) {
|
|
@@ -107,6 +107,6 @@ var Mobile = function (_a) {
|
|
|
107
107
|
var disabled = !methods.formState.isValid || !!error;
|
|
108
108
|
var title = t('join_our_community');
|
|
109
109
|
var subTitle = t('ide_terms_and_conditions_description');
|
|
110
|
-
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') }))] }))] })) }))] }));
|
|
110
|
+
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') }))] }))] })) }))] }));
|
|
111
111
|
};
|
|
112
112
|
export default React.memo(Mobile);
|