@tap-payments/auth-jsconnect 2.6.97-test → 2.6.100-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/form.d.ts +1 -1
- package/build/api/entity.d.ts +4 -1
- package/build/app/settings.d.ts +2 -1
- package/build/app/settings.js +5 -1
- package/build/constants/app.js +13 -1
- package/build/features/app/auth/authStore.d.ts +14 -9
- package/build/features/app/auth/authStore.js +99 -25
- package/build/features/app/connectExpress/connectExpressStore.d.ts +1 -1
- package/build/features/app/connectExpress/connectExpressStore.js +7 -5
- package/build/features/auth/screens/AccountCreatedLoader/AccountCreatedLoader.d.ts +5 -0
- package/build/features/auth/screens/AccountCreatedLoader/AccountCreatedLoader.js +36 -0
- package/build/features/auth/screens/AccountCreatedLoader/index.d.ts +2 -0
- package/build/features/auth/screens/AccountCreatedLoader/index.js +2 -0
- package/build/features/auth/screens/AuthMerchant/AuthMerchant.d.ts +5 -0
- package/build/features/auth/screens/AuthMerchant/AuthMerchant.js +73 -0
- package/build/features/auth/screens/{AuthenticationList → AuthMerchant}/MerchantList.d.ts +2 -1
- package/build/features/auth/screens/AuthMerchant/MerchantList.js +64 -0
- package/build/features/auth/screens/AuthMerchant/index.d.ts +2 -0
- package/build/features/auth/screens/AuthMerchant/index.js +2 -0
- package/build/features/auth/screens/AuthMerchant/validation.d.ts +8 -0
- package/build/features/auth/screens/AuthMerchant/validation.js +4 -0
- package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +28 -17
- package/build/features/auth/screens/AuthenticationList/EntityLegalName.d.ts +3 -0
- package/build/features/auth/screens/AuthenticationList/EntityLegalName.js +48 -0
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +31 -0
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +90 -0
- package/build/features/auth/screens/AuthenticationList/EntityList.d.ts +3 -3
- package/build/features/auth/screens/AuthenticationList/EntityList.js +51 -9
- package/build/features/auth/screens/AuthenticationList/LicenseNumber.d.ts +3 -0
- package/build/features/auth/screens/AuthenticationList/LicenseNumber.js +36 -0
- package/build/features/auth/screens/AuthenticationList/validation.d.ts +13 -7
- package/build/features/auth/screens/AuthenticationList/validation.js +66 -6
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +5 -2
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +31 -0
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +90 -0
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +6 -1
- package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +3 -0
- package/build/features/connectExpress/screens/AuthenticationList/validation.js +10 -0
- package/build/features/featuresScreens.js +10 -0
- package/build/utils/locale.js +2 -1
- package/package.json +1 -1
- package/build/features/auth/screens/AuthenticationList/MerchantList.js +0 -110
package/build/@types/form.d.ts
CHANGED
|
@@ -147,9 +147,9 @@ export declare type BusinessDataFormValues = {
|
|
|
147
147
|
export declare type AuthenticationListFormValues = {
|
|
148
148
|
brandInfo?: BrandInfo;
|
|
149
149
|
entityInfo?: EntityLicenseAuth;
|
|
150
|
-
merchantInfo?: AuthMerchantInfo;
|
|
151
150
|
licenseNumber?: string;
|
|
152
151
|
legalName?: string;
|
|
152
|
+
licenseType?: string;
|
|
153
153
|
};
|
|
154
154
|
export declare type AuthMerchantFormValues = {
|
|
155
155
|
merchantInfo?: AuthMerchantInfo;
|
package/build/api/entity.d.ts
CHANGED
package/build/app/settings.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from './store';
|
|
2
|
-
import { ActionState, LanguageMode, SharedState, ThemeMode, ScreenStepNavigation, DeviceInfo, LibConfig, CountryCode, MerchantInfo, ConfigExpressTokenParams, BusinessCountryInfo } from '../@types';
|
|
2
|
+
import { ActionState, LanguageMode, SharedState, ThemeMode, ScreenStepNavigation, DeviceInfo, LibConfig, CountryCode, MerchantInfo, ConfigExpressTokenParams, BusinessCountryInfo, LocalProps } from '../@types';
|
|
3
3
|
interface SettingParams {
|
|
4
4
|
disableCountries?: boolean;
|
|
5
5
|
disableLocale?: boolean;
|
|
@@ -33,6 +33,7 @@ export interface SettingsData {
|
|
|
33
33
|
authId?: string;
|
|
34
34
|
ipCountry: CountryCode;
|
|
35
35
|
businessCountries: Array<BusinessCountryInfo>;
|
|
36
|
+
locale?: LocalProps;
|
|
36
37
|
}
|
|
37
38
|
export interface SettingsState extends SharedState<SettingsData> {
|
|
38
39
|
internalLoading: boolean;
|
package/build/app/settings.js
CHANGED
|
@@ -325,8 +325,11 @@ export var settingsSlice = createSlice({
|
|
|
325
325
|
},
|
|
326
326
|
handleSetCountryByIso2: function (state, action) {
|
|
327
327
|
var country = findCountryByIso2(state.data.countries, action.payload);
|
|
328
|
-
if (country)
|
|
328
|
+
if (country) {
|
|
329
|
+
if (state.data.locale && country.iso2)
|
|
330
|
+
updateLocale(state.data.locale, country.iso2);
|
|
329
331
|
state.data.businessCountry = country;
|
|
332
|
+
}
|
|
330
333
|
}
|
|
331
334
|
},
|
|
332
335
|
extraReducers: function (builder) {
|
|
@@ -340,6 +343,7 @@ export var settingsSlice = createSlice({
|
|
|
340
343
|
state.data.countries = countries;
|
|
341
344
|
state.data.businessCountry = businessCountry;
|
|
342
345
|
state.data.ipCountry = ipCountry;
|
|
346
|
+
state.data.locale = locale;
|
|
343
347
|
state.data.deviceInfo = deviceInfo;
|
|
344
348
|
state.data.isValidOperator = isValidOperator;
|
|
345
349
|
if (merchant)
|
package/build/constants/app.js
CHANGED
|
@@ -264,9 +264,21 @@ export var AUTH_SCREENS_NAVIGATION = [
|
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
266
|
name: 'AUTH_AUTHENTICATION_LIST_STEP',
|
|
267
|
-
next: '',
|
|
267
|
+
next: ['AUTH_MERCHANT_LIST_STEP', 'AUTH_ACCOUNT_CREATED_STEP'],
|
|
268
268
|
prev: ['AUTH_MOBILE_STEP', 'AUTH_NID_STEP', 'AUTH_CIVIL_ID_STEP'],
|
|
269
269
|
order: 3
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: 'AUTH_ACCOUNT_CREATED_STEP',
|
|
273
|
+
next: '',
|
|
274
|
+
prev: 'AUTH_AUTHENTICATION_LIST_STEP',
|
|
275
|
+
order: 4
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: 'AUTH_MERCHANT_LIST_STEP',
|
|
279
|
+
next: '',
|
|
280
|
+
prev: 'AUTH_AUTHENTICATION_LIST_STEP',
|
|
281
|
+
order: 4
|
|
270
282
|
}
|
|
271
283
|
];
|
|
272
284
|
export var BUSINESS_SCREENS_NAVIGATION = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActionState, AuthForType, AuthenticationListFormValues, CivilFormValues, CountryCode, FlowsTypes, MobileFormValues, NIDFormValues, OTPFormValues, SharedState } from '../../../@types';
|
|
2
|
+
import { ActionState, AuthForType, AuthMerchantFormValues, AuthenticationListFormValues, CivilFormValues, CountryCode, FlowsTypes, MobileFormValues, NIDFormValues, OTPFormValues, SharedState } from '../../../@types';
|
|
3
3
|
export declare const updateBusinessCountry: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
|
|
4
4
|
export declare const retrieveLeadIdentityByIdAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
5
5
|
data: any;
|
|
@@ -35,11 +35,16 @@ export declare const checkAccountAvailability: import("@reduxjs/toolkit").AsyncT
|
|
|
35
35
|
brandList: any;
|
|
36
36
|
entityList: any;
|
|
37
37
|
}, void, {}>;
|
|
38
|
-
export declare const getMerchantList: import("@reduxjs/toolkit").AsyncThunk<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
export declare const getMerchantList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
39
|
+
list: any;
|
|
40
|
+
brandInfo: import("../../../@types").BrandInfo | undefined;
|
|
41
|
+
entityInfo: import("../../../@types").EntityLicenseAuth | undefined;
|
|
42
|
+
}, AuthenticationListFormValues, {}>;
|
|
43
|
+
export declare const createEntity: import("@reduxjs/toolkit").AsyncThunk<{
|
|
44
|
+
data: any;
|
|
45
|
+
formData: AuthenticationListFormValues;
|
|
46
|
+
}, AuthenticationListFormValues, {}>;
|
|
47
|
+
export declare const confirmInfo: import("@reduxjs/toolkit").AsyncThunk<void, AuthenticationListFormValues & AuthMerchantFormValues & {
|
|
43
48
|
authId?: string | undefined;
|
|
44
49
|
}, {}>;
|
|
45
50
|
export declare const onSignUp: import("@reduxjs/toolkit").AsyncThunk<void, void, {}>;
|
|
@@ -57,11 +62,10 @@ export interface authData {
|
|
|
57
62
|
isStartFromBusinessCountry?: boolean;
|
|
58
63
|
flowName: FlowsTypes;
|
|
59
64
|
authenticationData: AuthenticationListFormValues;
|
|
65
|
+
authMerchantData: AuthMerchantFormValues;
|
|
60
66
|
}
|
|
61
67
|
export interface AuthState extends SharedState<authData & ResponseData> {
|
|
62
68
|
customLoading?: boolean;
|
|
63
|
-
merchantLoading?: boolean;
|
|
64
|
-
terminalLoading?: boolean;
|
|
65
69
|
}
|
|
66
70
|
export declare const authSlice: import("@reduxjs/toolkit").Slice<AuthState, {
|
|
67
71
|
setLeadId(state: AuthState, action: ActionState<string>): void;
|
|
@@ -70,8 +74,9 @@ export declare const authSlice: import("@reduxjs/toolkit").Slice<AuthState, {
|
|
|
70
74
|
storeIsStartFromBusinessCountry: (state: AuthState, action: ActionState<boolean>) => void;
|
|
71
75
|
resetStore: (state: AuthState) => void;
|
|
72
76
|
resetOTPValue: (state: AuthState) => void;
|
|
77
|
+
resetAuthenticationScreen: (state: AuthState) => void;
|
|
73
78
|
}, "auth/store">;
|
|
74
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setMobileCountryCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, setLeadId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, resetOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, storeIsStartFromBusinessCountry: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
|
|
79
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setMobileCountryCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, setLeadId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, resetOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, storeIsStartFromBusinessCountry: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetAuthenticationScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
75
80
|
declare const _default: import("redux").Reducer<AuthState, import("redux").AnyAction>;
|
|
76
81
|
export default _default;
|
|
77
82
|
export declare const authSelector: (state: RootState) => AuthState;
|
|
@@ -45,10 +45,19 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
+
if (ar || !(i in from)) {
|
|
51
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
+
ar[i] = from[i];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
+
};
|
|
48
57
|
var _a;
|
|
49
58
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
59
|
import { AuthForType, FlowsTypes } from '../../../@types';
|
|
51
|
-
import { AUTH_STEP_NAMES, IDENTIFICATION_TYPE, defaultCountry } from '../../../constants';
|
|
60
|
+
import { ADD_NEW_ENTITY, AUTH_STEP_NAMES, IDENTIFICATION_TYPE, defaultCountry } from '../../../constants';
|
|
52
61
|
import API from '../../../api';
|
|
53
62
|
import { handleCurrentActiveScreen, handleNextScreenStep, handleOpen, handleSetCountryByIso2 } from '../../../app/settings';
|
|
54
63
|
import { findCountryByIddPrefix, isSA, openConnect, sleep } from '../../../utils';
|
|
@@ -437,22 +446,60 @@ export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailab
|
|
|
437
446
|
}
|
|
438
447
|
});
|
|
439
448
|
}); });
|
|
440
|
-
export var getMerchantList = createAsyncThunk('auth/getMerchantList', function (
|
|
441
|
-
var
|
|
442
|
-
return
|
|
443
|
-
|
|
449
|
+
export var getMerchantList = createAsyncThunk('auth/getMerchantList', function (_a, thunkApi) {
|
|
450
|
+
var brandInfo = _a.brandInfo, entityInfo = _a.entityInfo;
|
|
451
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
452
|
+
var settings, payload, merchants, list;
|
|
453
|
+
return __generator(this, function (_b) {
|
|
454
|
+
switch (_b.label) {
|
|
455
|
+
case 0:
|
|
456
|
+
settings = thunkApi.getState().settings;
|
|
457
|
+
payload = {
|
|
458
|
+
business_entity_id: (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) || '',
|
|
459
|
+
brand_id: (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.id) || '',
|
|
460
|
+
create_if_not_present: true,
|
|
461
|
+
platforms: settings.data.appConfig.platforms
|
|
462
|
+
};
|
|
463
|
+
return [4, API.entityService.getMerchantListUsingEntityId(payload)];
|
|
464
|
+
case 1:
|
|
465
|
+
merchants = (_b.sent()).merchants;
|
|
466
|
+
list = merchants || [];
|
|
467
|
+
if ((list === null || list === void 0 ? void 0 : list.length) > 1) {
|
|
468
|
+
thunkApi.dispatch(handleNextScreenStep('AUTH_MERCHANT_LIST_STEP'));
|
|
469
|
+
return [2, { list: list, brandInfo: brandInfo, entityInfo: entityInfo }];
|
|
470
|
+
}
|
|
471
|
+
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_ACCOUNT_CREATED_STEP')); });
|
|
472
|
+
return [2, { list: list, brandInfo: brandInfo, entityInfo: entityInfo }];
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
});
|
|
476
|
+
});
|
|
477
|
+
export var createEntity = createAsyncThunk('auth/createEntity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
478
|
+
var settings, brandInfo, legalName, licenseNumber, licenseType, body, data;
|
|
479
|
+
var _a;
|
|
480
|
+
return __generator(this, function (_b) {
|
|
481
|
+
switch (_b.label) {
|
|
444
482
|
case 0:
|
|
445
483
|
settings = thunkApi.getState().settings;
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
484
|
+
brandInfo = params.brandInfo, legalName = params.legalName, licenseNumber = params.licenseNumber, licenseType = params.licenseType;
|
|
485
|
+
body = {
|
|
486
|
+
business_id: (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) || '',
|
|
487
|
+
entity: {
|
|
488
|
+
legal_name: {
|
|
489
|
+
en: legalName || '',
|
|
490
|
+
ar: legalName || ''
|
|
491
|
+
},
|
|
492
|
+
license: {
|
|
493
|
+
number: licenseNumber || '',
|
|
494
|
+
type: licenseType || ''
|
|
495
|
+
},
|
|
496
|
+
country: (_a = settings.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2
|
|
497
|
+
}
|
|
451
498
|
};
|
|
452
|
-
return [4, API.entityService.
|
|
499
|
+
return [4, API.entityService.createEntity(body)];
|
|
453
500
|
case 1:
|
|
454
|
-
|
|
455
|
-
return [2,
|
|
501
|
+
data = _b.sent();
|
|
502
|
+
return [2, { data: data, formData: params }];
|
|
456
503
|
}
|
|
457
504
|
});
|
|
458
505
|
}); });
|
|
@@ -551,7 +598,9 @@ var initialState = {
|
|
|
551
598
|
},
|
|
552
599
|
authenticationData: {
|
|
553
600
|
brandInfo: undefined,
|
|
554
|
-
entityInfo: undefined
|
|
601
|
+
entityInfo: undefined
|
|
602
|
+
},
|
|
603
|
+
authMerchantData: {
|
|
555
604
|
merchantInfo: undefined
|
|
556
605
|
}
|
|
557
606
|
}
|
|
@@ -577,6 +626,9 @@ export var authSlice = createSlice({
|
|
|
577
626
|
},
|
|
578
627
|
resetOTPValue: function (state) {
|
|
579
628
|
state.data.otpData.otp = '';
|
|
629
|
+
},
|
|
630
|
+
resetAuthenticationScreen: function (state) {
|
|
631
|
+
state.data.authenticationData = __assign(__assign({}, state.data.authenticationData), initialState.data.authenticationData);
|
|
580
632
|
}
|
|
581
633
|
},
|
|
582
634
|
extraReducers: function (builder) {
|
|
@@ -732,33 +784,35 @@ export var authSlice = createSlice({
|
|
|
732
784
|
state.error = null;
|
|
733
785
|
})
|
|
734
786
|
.addCase(checkAccountAvailability.fulfilled, function (state, action) {
|
|
787
|
+
state.error = null;
|
|
735
788
|
state.loading = false;
|
|
736
789
|
var _a = action.payload, brandList = _a.brandList, entityList = _a.entityList;
|
|
790
|
+
var eList = __spreadArray(__spreadArray([], entityList, true), [ADD_NEW_ENTITY], false);
|
|
737
791
|
if (brandList === null || brandList === void 0 ? void 0 : brandList.length)
|
|
738
792
|
state.data.authenticationData.brandInfo = brandList[0];
|
|
739
|
-
|
|
740
|
-
state.data.authenticationData.entityInfo = entityList[0];
|
|
741
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { brandList: brandList, entityList: entityList });
|
|
793
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { brandList: brandList, entityList: eList });
|
|
742
794
|
})
|
|
743
795
|
.addCase(checkAccountAvailability.rejected, function (state, action) {
|
|
744
796
|
state.loading = false;
|
|
745
797
|
state.error = action.error.message;
|
|
746
798
|
})
|
|
747
799
|
.addCase(getMerchantList.pending, function (state) {
|
|
748
|
-
state.
|
|
800
|
+
state.loading = true;
|
|
749
801
|
state.error = null;
|
|
750
802
|
})
|
|
751
803
|
.addCase(getMerchantList.fulfilled, function (state, action) {
|
|
752
|
-
state.
|
|
804
|
+
state.loading = false;
|
|
753
805
|
state.error = null;
|
|
754
|
-
var
|
|
755
|
-
|
|
756
|
-
|
|
806
|
+
var _a = action.payload, list = _a.list, brandInfo = _a.brandInfo, entityInfo = _a.entityInfo;
|
|
807
|
+
state.data.authenticationData.brandInfo = brandInfo;
|
|
808
|
+
state.data.authenticationData.entityInfo = entityInfo;
|
|
809
|
+
if (list === null || list === void 0 ? void 0 : list.length) {
|
|
810
|
+
state.data.authMerchantData.merchantInfo = list[0];
|
|
757
811
|
}
|
|
758
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { merchantList:
|
|
812
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { merchantList: list });
|
|
759
813
|
})
|
|
760
814
|
.addCase(getMerchantList.rejected, function (state, action) {
|
|
761
|
-
state.
|
|
815
|
+
state.loading = false;
|
|
762
816
|
state.error = action.error.message;
|
|
763
817
|
})
|
|
764
818
|
.addCase(confirmInfo.pending, function (state) {
|
|
@@ -784,9 +838,29 @@ export var authSlice = createSlice({
|
|
|
784
838
|
.addCase(onSignUp.rejected, function (state, action) {
|
|
785
839
|
state.loading = false;
|
|
786
840
|
state.error = action.error.message;
|
|
841
|
+
})
|
|
842
|
+
.addCase(createEntity.pending, function (state) {
|
|
843
|
+
state.loading = true;
|
|
844
|
+
state.error = null;
|
|
845
|
+
})
|
|
846
|
+
.addCase(createEntity.rejected, function (state, action) {
|
|
847
|
+
state.loading = false;
|
|
848
|
+
state.error = action.error.message;
|
|
849
|
+
})
|
|
850
|
+
.addCase(createEntity.fulfilled, function (state, action) {
|
|
851
|
+
state.loading = false;
|
|
852
|
+
state.error = null;
|
|
853
|
+
var data = action.payload.data;
|
|
854
|
+
var entityList = (state.data.responseData || {}).entityList;
|
|
855
|
+
if (data === null || data === void 0 ? void 0 : data.entity) {
|
|
856
|
+
var entity = __assign(__assign({}, data.entity), { business_id: data === null || data === void 0 ? void 0 : data.business_id });
|
|
857
|
+
var list = __spreadArray([entity], entityList, true);
|
|
858
|
+
state.data.authenticationData.entityInfo = list[0];
|
|
859
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { entityData: data, entityList: list });
|
|
860
|
+
}
|
|
787
861
|
});
|
|
788
862
|
}
|
|
789
863
|
});
|
|
790
|
-
export var clearError = (_a = authSlice.actions, _a.clearError), resetStore = _a.resetStore, setMobileCountryCode = _a.setMobileCountryCode, setLeadId = _a.setLeadId, resetOTPValue = _a.resetOTPValue, storeIsStartFromBusinessCountry = _a.storeIsStartFromBusinessCountry;
|
|
864
|
+
export var clearError = (_a = authSlice.actions, _a.clearError), resetStore = _a.resetStore, setMobileCountryCode = _a.setMobileCountryCode, setLeadId = _a.setLeadId, resetOTPValue = _a.resetOTPValue, storeIsStartFromBusinessCountry = _a.storeIsStartFromBusinessCountry, resetAuthenticationScreen = _a.resetAuthenticationScreen;
|
|
791
865
|
export default authSlice.reducer;
|
|
792
866
|
export var authSelector = function (state) { return state.auth; };
|
|
@@ -108,7 +108,7 @@ export declare const updateLeadBusinessDataAsync: import("@reduxjs/toolkit").Asy
|
|
|
108
108
|
response: any;
|
|
109
109
|
formData: BusinessDataFormValues;
|
|
110
110
|
}, AsyncThunkParams<BusinessDataFormValues>, {}>;
|
|
111
|
-
export declare const confirmInfo: import("@reduxjs/toolkit").AsyncThunk<void, AuthenticationListFormValues, {}>;
|
|
111
|
+
export declare const confirmInfo: import("@reduxjs/toolkit").AsyncThunk<void, AuthenticationListFormValues & AuthMerchantFormValues, {}>;
|
|
112
112
|
export declare const onCloseCompleteAsync: import("@reduxjs/toolkit").AsyncThunk<void, void, {}>;
|
|
113
113
|
interface ResponseData {
|
|
114
114
|
responseData?: Record<string, any>;
|
|
@@ -899,13 +899,13 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
|
|
|
899
899
|
});
|
|
900
900
|
}); });
|
|
901
901
|
export var createEntity = createAsyncThunk('connectExpress/createEntity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
902
|
-
var settings, brandInfo, legalName, licenseNumber, body, data;
|
|
902
|
+
var settings, brandInfo, legalName, licenseNumber, licenseType, body, data;
|
|
903
903
|
var _a;
|
|
904
904
|
return __generator(this, function (_b) {
|
|
905
905
|
switch (_b.label) {
|
|
906
906
|
case 0:
|
|
907
907
|
settings = thunkApi.getState().settings;
|
|
908
|
-
brandInfo = params.brandInfo, legalName = params.legalName, licenseNumber = params.licenseNumber;
|
|
908
|
+
brandInfo = params.brandInfo, legalName = params.legalName, licenseNumber = params.licenseNumber, licenseType = params.licenseType;
|
|
909
909
|
body = {
|
|
910
910
|
business_id: (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) || '',
|
|
911
911
|
entity: {
|
|
@@ -913,9 +913,11 @@ export var createEntity = createAsyncThunk('connectExpress/createEntity', functi
|
|
|
913
913
|
en: legalName || '',
|
|
914
914
|
ar: legalName || ''
|
|
915
915
|
},
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
916
|
+
license: {
|
|
917
|
+
number: licenseNumber || '',
|
|
918
|
+
type: licenseType || ''
|
|
919
|
+
},
|
|
920
|
+
country: (_a = settings.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2
|
|
919
921
|
}
|
|
920
922
|
};
|
|
921
923
|
return [4, API.entityService.createEntity(body)];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { isNetworkError } from '../../../../utils';
|
|
16
|
+
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
17
|
+
import { confirmInfo, authSelector } from '../../../app/auth/authStore';
|
|
18
|
+
import Button from '../../../shared/Button';
|
|
19
|
+
import DataLoading from '../../../shared/DataLoading';
|
|
20
|
+
var AccountCreatedLoader = function (_a) {
|
|
21
|
+
var dispatch = useAppDispatch();
|
|
22
|
+
var isAr = useLanguage().isAr;
|
|
23
|
+
var t = useTranslation().t;
|
|
24
|
+
var _b = useAppSelector(authSelector), error = _b.error, loading = _b.loading, data = _b.data;
|
|
25
|
+
var _c = data.authenticationData, brandInfo = _c.brandInfo, entityInfo = _c.entityInfo;
|
|
26
|
+
var merchantInfo = data.authMerchantData.merchantInfo;
|
|
27
|
+
React.useEffect(function () {
|
|
28
|
+
dispatch(confirmInfo({ entityInfo: entityInfo, brandInfo: brandInfo, merchantInfo: merchantInfo }));
|
|
29
|
+
}, []);
|
|
30
|
+
var onReTry = function () {
|
|
31
|
+
dispatch(confirmInfo({ entityInfo: entityInfo, brandInfo: brandInfo, merchantInfo: merchantInfo }));
|
|
32
|
+
};
|
|
33
|
+
var isNE = React.useMemo(function () { return isNetworkError(error); }, [error]);
|
|
34
|
+
return (_jsx(DataLoading, __assign({ error: error, title: 'account_already_created', hideSubtitle: true }, { children: isNE && (_jsx(Button, __assign({ onClick: onReTry, disableBack: true, isAr: isAr, loading: loading }, { children: t('try_again') }))) })));
|
|
35
|
+
};
|
|
36
|
+
export default React.memo(AccountCreatedLoader);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import Collapse from '@mui/material/Collapse';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
20
|
+
import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
21
|
+
import Form from '../../../../components/Form';
|
|
22
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
|
+
import Button from '../../../shared/Button';
|
|
24
|
+
import { clearError, authSelector, confirmInfo } from '../../../app/auth/authStore';
|
|
25
|
+
import { useLanguage } from '../../../../hooks';
|
|
26
|
+
import { AuthMerchantValidationSchema } from './validation';
|
|
27
|
+
import MerchantList from './MerchantList';
|
|
28
|
+
var AuthMerchant = function (_a) {
|
|
29
|
+
var _b = useAppSelector(authSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
30
|
+
var _c = data.authenticationData, brandInfo = _c.brandInfo, entityInfo = _c.entityInfo;
|
|
31
|
+
var merchantInfo = data.authMerchantData.merchantInfo;
|
|
32
|
+
var _d = React.useState(false), listActive = _d[0], setListActive = _d[1];
|
|
33
|
+
var merchantList = (data.responseData || {}).merchantList;
|
|
34
|
+
React.useEffect(function () {
|
|
35
|
+
sendCustomEventToGTM({
|
|
36
|
+
event: 'Send Event',
|
|
37
|
+
event_category: 'User Authentication Flow',
|
|
38
|
+
event_action: 'Authentication Merchant List Step'
|
|
39
|
+
});
|
|
40
|
+
}, []);
|
|
41
|
+
var methods = useForm({
|
|
42
|
+
resolver: yupResolver(AuthMerchantValidationSchema),
|
|
43
|
+
defaultValues: {
|
|
44
|
+
merchantInfo: merchantInfo
|
|
45
|
+
},
|
|
46
|
+
mode: 'onChange'
|
|
47
|
+
});
|
|
48
|
+
var t = useTranslation().t;
|
|
49
|
+
var isAr = useLanguage().isAr;
|
|
50
|
+
var dispatch = useAppDispatch();
|
|
51
|
+
var onSubmit = function (formData) {
|
|
52
|
+
dispatch(confirmInfo(__assign({ brandInfo: brandInfo, entityInfo: entityInfo }, deepCopy(formData))));
|
|
53
|
+
};
|
|
54
|
+
var onBack = function () {
|
|
55
|
+
dispatch(handlePrevScreenStep());
|
|
56
|
+
};
|
|
57
|
+
React.useEffect(function () {
|
|
58
|
+
if (merchantInfo && !methods.getValues('merchantInfo'))
|
|
59
|
+
methods.setValue('merchantInfo', merchantInfo, { shouldValidate: true });
|
|
60
|
+
}, [merchantInfo]);
|
|
61
|
+
React.useEffect(function () {
|
|
62
|
+
if (error)
|
|
63
|
+
dispatch(clearError());
|
|
64
|
+
}, [methods.formState.isValid]);
|
|
65
|
+
var disabled = !methods.formState.isValid;
|
|
66
|
+
var handleMenuClick = function (flag) {
|
|
67
|
+
if (error)
|
|
68
|
+
dispatch(clearError());
|
|
69
|
+
setListActive(flag);
|
|
70
|
+
};
|
|
71
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(MerchantList, { list: merchantList || [], onListOpen: function () { return handleMenuClick(true); }, onListClose: function () { return handleMenuClick(false); } }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('confirm') })) }))] })) })) }));
|
|
72
|
+
};
|
|
73
|
+
export default React.memo(AuthMerchant);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
17
|
+
import Box from '@mui/material/Box';
|
|
18
|
+
import Collapse from '../../../../components/Collapse';
|
|
19
|
+
import Text from '../../../../components/Text';
|
|
20
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
21
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
22
|
+
import InputSelect from '../../../shared/InputSelect';
|
|
23
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
24
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
25
|
+
var MerchantContainer = styled(Box)(function () { return ({
|
|
26
|
+
display: 'flex'
|
|
27
|
+
}); });
|
|
28
|
+
var MerchantNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
29
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
30
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
31
|
+
});
|
|
32
|
+
var MerchantList = React.forwardRef(function (_a, ref) {
|
|
33
|
+
var _b;
|
|
34
|
+
var list = _a.list, onListOpen = _a.onListOpen, onListClose = _a.onListClose, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
35
|
+
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
36
|
+
var t = useTranslation().t;
|
|
37
|
+
var _d = useFormContext(), control = _d.control, getValues = _d.getValues;
|
|
38
|
+
var merchantInfoControl = useController({ control: control, name: 'merchantInfo' });
|
|
39
|
+
var merchantValue = merchantInfoControl.field.value;
|
|
40
|
+
var error = (_b = merchantInfoControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
41
|
+
var onOpenMerchantSelect = function (event) {
|
|
42
|
+
if (readOnly)
|
|
43
|
+
return;
|
|
44
|
+
setAnchorEl(event.currentTarget);
|
|
45
|
+
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
46
|
+
};
|
|
47
|
+
var onCloseMerchantSelect = function () {
|
|
48
|
+
setAnchorEl(null);
|
|
49
|
+
onListClose === null || onListClose === void 0 ? void 0 : onListClose();
|
|
50
|
+
};
|
|
51
|
+
var onSelectItem = function (merchant) {
|
|
52
|
+
onCloseMerchantSelect();
|
|
53
|
+
merchantInfoControl.field.onChange(merchant);
|
|
54
|
+
};
|
|
55
|
+
var getName = function (merchant) {
|
|
56
|
+
if (!merchant)
|
|
57
|
+
return '';
|
|
58
|
+
return merchant.display_name;
|
|
59
|
+
};
|
|
60
|
+
return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: { mt: 2.5, mb: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_merchant_label'), readOnly: readOnly, placeholder: t('select_merchant_placeholder'), value: getName(getValues('merchantInfo')) || '', warningMessage: error && t(error), onClick: !!anchorEl ? function () { return onCloseMerchantSelect(); } : onOpenMerchantSelect, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl, isVerified: isVerified }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { list: list || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
61
|
+
return (_jsxs(_Fragment, { children: [_jsx(MerchantContainer, { children: _jsx(MerchantNameText, __assign({ isSelected: item.id === (merchantValue === null || merchantValue === void 0 ? void 0 : merchantValue.id) }, { children: getName(item) })) }), item.id === (merchantValue === null || merchantValue === void 0 ? void 0 : merchantValue.id) && _jsx(CheckIcon, { isVerified: isVerified })] }));
|
|
62
|
+
} }) }))] })));
|
|
63
|
+
});
|
|
64
|
+
export default React.memo(MerchantList);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const AuthMerchantValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
merchantInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
8
|
+
}>>>;
|