@tap-payments/auth-jsconnect 1.0.36 → 1.0.40
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 +4 -4
- package/build/components/AnimationFlow/BottomSheet.js +26 -2
- package/build/components/OTPTimer/OTPTimer.js +4 -2
- package/build/constants/app.js +2 -2
- package/build/constants/dummy.d.ts +2 -2
- package/build/constants/dummy.js +6 -6
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/business/businessStore.d.ts +4 -6
- package/build/features/app/business/businessStore.js +43 -30
- package/build/features/app/connect/connectStore.d.ts +1 -1
- package/build/features/app/connect/connectStore.js +23 -15
- package/build/features/business/screens/Activities/Activities.js +10 -5
- package/build/features/business/screens/Activities/ActivitiesList.js +1 -1
- package/build/features/business/screens/Activities/OperationStartDate.js +1 -12
- package/build/features/business/screens/Activities/SalesChannels.js +1 -1
- package/build/features/business/screens/BusinessType/BusinessType.js +16 -23
- package/build/features/business/screens/BusinessType/CompanyLicense.js +23 -9
- package/build/features/business/screens/BusinessType/FreelanceLicense.js +23 -9
- package/build/features/business/screens/Confirm/Confirm.js +4 -3
- package/build/features/business/screens/Customers/Customers.js +1 -1
- package/build/features/business/screens/OTP/OTP.js +5 -2
- package/build/features/business/screens/OTP/OTPInput.js +1 -2
- package/build/features/business/screens/Verify/OTPInput.js +1 -2
- package/build/features/business/screens/Verify/Verify.js +7 -4
- package/build/features/connect/screens/Individual/Email.js +10 -1
- package/build/features/connect/screens/Individual/Individual.js +8 -10
- package/build/features/connect/screens/Individual/MobileNumber.js +3 -16
- package/build/features/connect/screens/Merchant/BrandName.js +6 -2
- package/build/features/connect/screens/Merchant/Merchant.js +11 -11
- package/build/features/connect/screens/Merchant/SocialMedia.js +2 -1
- package/build/features/connect/screens/Merchant/TAC.js +1 -1
- package/build/features/connect/screens/Merchant/validation.js +3 -2
- package/build/features/connect/screens/Mobile/BusinessCountry.js +1 -1
- package/build/features/connect/screens/Mobile/Mobile.js +1 -9
- package/build/features/connect/screens/Mobile/MobileNumber.js +3 -16
- package/build/features/connect/screens/NID/IDNumber.d.ts +0 -1
- package/build/features/connect/screens/NID/IDNumber.js +2 -2
- package/build/features/connect/screens/NID/NID.js +1 -6
- package/build/features/connect/screens/OTP/OTP.js +2 -4
- package/build/features/connect/screens/Password/Password.js +1 -6
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +1 -1
- package/build/features/shared/Button/Button.js +13 -3
- package/build/features/shared/SuccessScreen/SuccessScreen.js +10 -5
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useWindowSize.d.ts +6 -0
- package/build/hooks/useWindowSize.js +19 -0
- package/package.json +126 -126
- package/build/features/app/business/midStore.d.ts +0 -10
- package/build/features/app/business/midStore.js +0 -18
- package/build/features/app/connect/midStore.d.ts +0 -10
- package/build/features/app/connect/midStore.js +0 -18
- package/build/features/business/screens/VerifyNumber/OTPInput.d.ts +0 -5
- package/build/features/business/screens/VerifyNumber/OTPInput.js +0 -39
- package/build/features/business/screens/VerifyNumber/VerifyNumber.d.ts +0 -13
- package/build/features/business/screens/VerifyNumber/VerifyNumber.js +0 -76
- package/build/features/business/screens/VerifyNumber/index.d.ts +0 -3
- package/build/features/business/screens/VerifyNumber/index.js +0 -2
- package/build/features/business/screens/VerifyNumber/validation.d.ts +0 -8
- package/build/features/business/screens/VerifyNumber/validation.js +0 -4
- package/build/features/connect/screens/MID/BusinessCountry.d.ts +0 -11
- package/build/features/connect/screens/MID/BusinessCountry.js +0 -92
- package/build/features/connect/screens/MID/DOB.d.ts +0 -6
- package/build/features/connect/screens/MID/DOB.js +0 -38
- package/build/features/connect/screens/MID/IDNumber.d.ts +0 -7
- package/build/features/connect/screens/MID/IDNumber.js +0 -70
- package/build/features/connect/screens/MID/MID.d.ts +0 -5
- package/build/features/connect/screens/MID/MID.js +0 -87
- package/build/features/connect/screens/MID/MIDTitle.d.ts +0 -8
- package/build/features/connect/screens/MID/MIDTitle.js +0 -29
- package/build/features/connect/screens/MID/MobileNumber.d.ts +0 -12
- package/build/features/connect/screens/MID/MobileNumber.js +0 -148
- package/build/features/connect/screens/MID/index.d.ts +0 -3
- package/build/features/connect/screens/MID/index.js +0 -2
- package/build/features/connect/screens/MID/validation.d.ts +0 -18
- package/build/features/connect/screens/MID/validation.js +0 -15
- package/build/features/owner/Owner.d.ts +0 -6
- package/build/features/owner/Owner.js +0 -50
- package/build/features/owner/index.d.ts +0 -1
- package/build/features/owner/index.js +0 -1
- package/build/features/owner/screens/AdditionalOwnerInfo/AdditionalOwnerInfo.d.ts +0 -8
- package/build/features/owner/screens/AdditionalOwnerInfo/AdditionalOwnerInfo.js +0 -77
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerLocation.d.ts +0 -10
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerLocation.js +0 -80
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerName.d.ts +0 -6
- package/build/features/owner/screens/AdditionalOwnerInfo/EmployerName.js +0 -40
- package/build/features/owner/screens/AdditionalOwnerInfo/InfluencerSwitch.d.ts +0 -6
- package/build/features/owner/screens/AdditionalOwnerInfo/InfluencerSwitch.js +0 -45
- package/build/features/owner/screens/AdditionalOwnerInfo/MonthlyIncome.d.ts +0 -6
- package/build/features/owner/screens/AdditionalOwnerInfo/MonthlyIncome.js +0 -35
- package/build/features/owner/screens/AdditionalOwnerInfo/PEPSwitch.d.ts +0 -6
- package/build/features/owner/screens/AdditionalOwnerInfo/PEPSwitch.js +0 -45
- package/build/features/owner/screens/AdditionalOwnerInfo/SourceOfIncome.d.ts +0 -9
- package/build/features/owner/screens/AdditionalOwnerInfo/SourceOfIncome.js +0 -85
- package/build/features/owner/screens/AdditionalOwnerInfo/index.d.ts +0 -3
- package/build/features/owner/screens/AdditionalOwnerInfo/index.js +0 -2
- package/build/features/owner/screens/AdditionalOwnerInfo/validation.d.ts +0 -25
- package/build/features/owner/screens/AdditionalOwnerInfo/validation.js +0 -35
- package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.d.ts +0 -19
- package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.js +0 -52
- package/build/features/owner/screens/ShowOwnerInfo/index.d.ts +0 -3
- package/build/features/owner/screens/ShowOwnerInfo/index.js +0 -2
- package/build/features/owner/screens/ShowOwnerInfo/info.d.ts +0 -7
- package/build/features/owner/screens/ShowOwnerInfo/info.js +0 -28
- package/build/features/owner/screens/Success/Success.d.ts +0 -5
- package/build/features/owner/screens/Success/Success.js +0 -14
- package/build/features/owner/screens/Success/index.d.ts +0 -3
- package/build/features/owner/screens/Success/index.js +0 -2
- package/build/features/shared/ExpandIcon/ExpandIcon.d.ts +0 -7
- package/build/features/shared/ExpandIcon/ExpandIcon.js +0 -24
- package/build/features/shared/ExpandIcon/index.d.ts +0 -2
- package/build/features/shared/ExpandIcon/index.js +0 -2
package/build/@types/app.d.ts
CHANGED
|
@@ -99,13 +99,13 @@ export interface Activity {
|
|
|
99
99
|
}
|
|
100
100
|
export interface SalesChannel {
|
|
101
101
|
id: number;
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
titleAr: string;
|
|
103
|
+
title: string;
|
|
104
104
|
}
|
|
105
105
|
export interface SourceOfIncome {
|
|
106
106
|
id: number;
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
titleAr: string;
|
|
108
|
+
title: string;
|
|
109
109
|
}
|
|
110
110
|
export interface AppInfo {
|
|
111
111
|
name: string;
|
|
@@ -24,12 +24,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
24
24
|
import * as React from 'react';
|
|
25
25
|
import { BottomSheet } from 'react-spring-bottom-sheet';
|
|
26
26
|
import { styled } from '@mui/material/styles';
|
|
27
|
+
import { useWindowSize } from '../../hooks';
|
|
27
28
|
import 'react-spring-bottom-sheet/dist/style.css';
|
|
28
29
|
var BottomSheetStyled = styled(BottomSheet)(function (_a) {
|
|
29
30
|
var theme = _a.theme;
|
|
30
31
|
return ({
|
|
31
32
|
'[data-rsbs-header]:before': {
|
|
32
|
-
width: '
|
|
33
|
+
width: '75px',
|
|
34
|
+
height: '5px'
|
|
33
35
|
},
|
|
34
36
|
'[data-rsbs-overlay]': {
|
|
35
37
|
backgroundColor: theme.palette.background.paper
|
|
@@ -51,9 +53,31 @@ var BottomSheetStyled = styled(BottomSheet)(function (_a) {
|
|
|
51
53
|
});
|
|
52
54
|
var BottomSheetComponent = function (_a) {
|
|
53
55
|
var open = _a.open, children = _a.children, rest = __rest(_a, ["open", "children"]);
|
|
56
|
+
var height = useWindowSize().height;
|
|
57
|
+
var getMinHeight = function (maxHeight) {
|
|
58
|
+
if (height < 500)
|
|
59
|
+
return maxHeight * 0.95;
|
|
60
|
+
if (height >= 500 && height < 550)
|
|
61
|
+
return maxHeight * 0.93;
|
|
62
|
+
if (height >= 550 && height < 600)
|
|
63
|
+
return maxHeight * 0.87;
|
|
64
|
+
if (height >= 600 && height < 650)
|
|
65
|
+
return maxHeight * 0.8;
|
|
66
|
+
if (height >= 650 && height < 700)
|
|
67
|
+
return maxHeight * 0.75;
|
|
68
|
+
if (height >= 700 && height < 750)
|
|
69
|
+
return maxHeight * 0.7;
|
|
70
|
+
if (height >= 750 && height < 800)
|
|
71
|
+
return maxHeight * 0.65;
|
|
72
|
+
if (height >= 800 && height < 850)
|
|
73
|
+
return maxHeight * 0.6;
|
|
74
|
+
if (height >= 850 && height < 900)
|
|
75
|
+
return maxHeight * 0.57;
|
|
76
|
+
return maxHeight * 0.5;
|
|
77
|
+
};
|
|
54
78
|
return (_jsx(BottomSheetStyled, __assign({ open: open, snapPoints: function (_a) {
|
|
55
79
|
var maxHeight = _a.maxHeight;
|
|
56
|
-
return [maxHeight
|
|
80
|
+
return [getMinHeight(maxHeight), maxHeight * 0.95];
|
|
57
81
|
} }, rest, { children: children })));
|
|
58
82
|
};
|
|
59
83
|
export default React.memo(BottomSheetComponent);
|
|
@@ -30,7 +30,9 @@ var OTPTimerStyled = styled(Box)(function (_a) {
|
|
|
30
30
|
return ({
|
|
31
31
|
display: 'flex',
|
|
32
32
|
paddingInline: theme.spacing(2.5),
|
|
33
|
-
justifyContent: 'flex-end'
|
|
33
|
+
justifyContent: 'flex-end',
|
|
34
|
+
maxWidth: 'fit-content',
|
|
35
|
+
marginLeft: 'auto'
|
|
34
36
|
});
|
|
35
37
|
});
|
|
36
38
|
var OTPTimerTextStyled = styled(Text)(function (_a) {
|
|
@@ -53,7 +55,7 @@ var OTPTimerComponent = function (_a) {
|
|
|
53
55
|
return function () { return clearInterval(interval); };
|
|
54
56
|
}, [timeValue]);
|
|
55
57
|
var resetTimer = function () {
|
|
56
|
-
if (onResetClick) {
|
|
58
|
+
if (onResetClick && timeValue == 0) {
|
|
57
59
|
onResetClick();
|
|
58
60
|
seTimeValue(timeInSeconds || 60);
|
|
59
61
|
}
|
package/build/constants/app.js
CHANGED
|
@@ -45,7 +45,7 @@ export var CONNECT_SCREENS_NAVIGATION = [
|
|
|
45
45
|
{
|
|
46
46
|
name: 'CONNECT_MERCHANT_INFO_STEP',
|
|
47
47
|
next: 'CONNECT_THANK_YOU_STEP',
|
|
48
|
-
prev: 'CONNECT_INDIVIDUAL_STEP',
|
|
48
|
+
prev: ['CONNECT_INDIVIDUAL_STEP', 'CONNECT_PASSWORD_STEP'],
|
|
49
49
|
order: 4
|
|
50
50
|
},
|
|
51
51
|
{
|
|
@@ -77,7 +77,7 @@ export var BUSINESS_SCREENS_NAVIGATION = [
|
|
|
77
77
|
{
|
|
78
78
|
name: 'BUSINESS_BUSINESS_TYPE_STEP',
|
|
79
79
|
next: 'BUSINESS_CONFIRM_STEP',
|
|
80
|
-
prev: '
|
|
80
|
+
prev: 'BUSINESS_IDBOD_STEP',
|
|
81
81
|
order: 2
|
|
82
82
|
},
|
|
83
83
|
{
|
package/build/constants/dummy.js
CHANGED
|
@@ -6425,10 +6425,10 @@ export var SALES_CHANNELS = [
|
|
|
6425
6425
|
{ id: 5, nameEn: 'Call Center', name: 'مركز اتصال' }
|
|
6426
6426
|
];
|
|
6427
6427
|
export var SOURCE_OF_INCOME = [
|
|
6428
|
-
{ id: 1,
|
|
6429
|
-
{ id: 2,
|
|
6430
|
-
{ id: 3,
|
|
6431
|
-
{ id: 4,
|
|
6432
|
-
{ id: 5,
|
|
6433
|
-
{ id: 6,
|
|
6428
|
+
{ id: 1, titleAr: 'راتب', title: 'Salary' },
|
|
6429
|
+
{ id: 2, titleAr: 'تمويل', title: 'Investment' },
|
|
6430
|
+
{ id: 3, titleAr: 'ورث', title: 'Inheritance / inherit' },
|
|
6431
|
+
{ id: 4, titleAr: 'اسهم', title: 'Stocks' },
|
|
6432
|
+
{ id: 5, titleAr: 'تجارة', title: 'Trading' },
|
|
6433
|
+
{ id: 6, titleAr: 'غير ذلك', title: 'Other' }
|
|
6434
6434
|
];
|
|
@@ -6,3 +6,4 @@ export var FL_NUMBER_LENGTH = 8;
|
|
|
6
6
|
export var CR_NUMBER_LENGTH = 10;
|
|
7
7
|
export var SAUDI_NUMBER_LENGTH = 9;
|
|
8
8
|
export var REGEX_FULL_NAME = /^([a-zA-Z]{2,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,}|[a-zA-Z]+\s{1}[a-zA-Z.-]{1,}\s{1}[a-zA-Z]{1,})$/g;
|
|
9
|
+
export var REGEX_WEBSITE = /^[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,63}(:[0-9]{1,5})?(\/.*)?$/;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
2
|
import { ActivitiesFormValues, BusinessInfoFormValues, CustomersFormValues, BusinessTypeFormValues, CountryCode, CRLicense, FLLicense, NIDFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
3
|
export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
-
businessCountry:
|
|
4
|
+
businessCountry: undefined;
|
|
5
5
|
countries: any;
|
|
6
6
|
}, void, {}>;
|
|
7
7
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -57,11 +57,8 @@ export declare const updateCustomersInfo: import("@reduxjs/toolkit").AsyncThunk<
|
|
|
57
57
|
expectedSalesRange: import("../../../@types").ExpectedSaleRange | undefined;
|
|
58
58
|
refundPolicy: boolean;
|
|
59
59
|
transactionPolicy: boolean;
|
|
60
|
-
isResend: boolean;
|
|
61
60
|
};
|
|
62
|
-
}, CustomersFormValues
|
|
63
|
-
isResend: boolean;
|
|
64
|
-
}, {}>;
|
|
61
|
+
}, CustomersFormValues, {}>;
|
|
65
62
|
export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
66
63
|
response: any;
|
|
67
64
|
formData: void;
|
|
@@ -91,8 +88,9 @@ export interface BusinessState extends SharedState<BusinessData> {
|
|
|
91
88
|
export declare const businessSlice: import("@reduxjs/toolkit").Slice<BusinessState, {
|
|
92
89
|
clearError: (state: BusinessState) => void;
|
|
93
90
|
stopLoader: (state: BusinessState) => void;
|
|
91
|
+
resetOTPScreen: (state: BusinessState) => void;
|
|
94
92
|
}, "business/store">;
|
|
95
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
93
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
96
94
|
declare const _default: import("redux").Reducer<BusinessState, import("redux").AnyAction>;
|
|
97
95
|
export default _default;
|
|
98
96
|
export declare const businessSelector: (state: RootState) => BusinessState;
|
|
@@ -55,7 +55,7 @@ import i18n from '../../../i18n';
|
|
|
55
55
|
import { convertNumbers2English, removeRequestHeaders } from '../../../utils';
|
|
56
56
|
import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
|
|
57
57
|
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var settings, countriesBody,
|
|
58
|
+
var settings, countriesBody, businessCountry, list;
|
|
59
59
|
return __generator(this, function (_a) {
|
|
60
60
|
switch (_a.label) {
|
|
61
61
|
case 0:
|
|
@@ -63,11 +63,17 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
|
|
|
63
63
|
return [4, API.countryService.getAllCountries()];
|
|
64
64
|
case 1:
|
|
65
65
|
countriesBody = (_a.sent()).data;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
businessCountry = undefined;
|
|
67
|
+
list = (countriesBody.list || []).map(function (country) {
|
|
68
|
+
if ([country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase())) {
|
|
69
|
+
businessCountry = country;
|
|
70
|
+
}
|
|
71
|
+
if (country.iso2 === 'SA') {
|
|
72
|
+
country.digits = 9;
|
|
73
|
+
}
|
|
74
|
+
return country;
|
|
69
75
|
});
|
|
70
|
-
return [2, { businessCountry: businessCountry, countries: list
|
|
76
|
+
return [2, { businessCountry: businessCountry, countries: list }];
|
|
71
77
|
}
|
|
72
78
|
});
|
|
73
79
|
}); });
|
|
@@ -121,8 +127,6 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
121
127
|
if (!data.errors) {
|
|
122
128
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
123
129
|
if (isNID) {
|
|
124
|
-
thunkApi.dispatch(retrieveFLInfos());
|
|
125
|
-
thunkApi.dispatch(retrieveCRInfos());
|
|
126
130
|
thunkApi.dispatch(handleNextScreenStep());
|
|
127
131
|
}
|
|
128
132
|
else {
|
|
@@ -147,7 +151,7 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
147
151
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
148
152
|
identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
149
153
|
headers = {
|
|
150
|
-
lead_id: ((_b = business.data.
|
|
154
|
+
lead_id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
|
|
151
155
|
device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
|
|
152
156
|
};
|
|
153
157
|
requestBody = {
|
|
@@ -169,32 +173,32 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
169
173
|
}
|
|
170
174
|
});
|
|
171
175
|
}); });
|
|
172
|
-
export var retrieveCRInfos = createAsyncThunk('retrieveCRInfos', function (
|
|
176
|
+
export var retrieveCRInfos = createAsyncThunk('retrieveCRInfos', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
173
177
|
var business, leadId, data;
|
|
174
|
-
var
|
|
175
|
-
return __generator(this, function (
|
|
176
|
-
switch (
|
|
178
|
+
var _a;
|
|
179
|
+
return __generator(this, function (_b) {
|
|
180
|
+
switch (_b.label) {
|
|
177
181
|
case 0:
|
|
178
182
|
business = thunkApi.getState().business;
|
|
179
|
-
leadId = (
|
|
183
|
+
leadId = (_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id;
|
|
180
184
|
return [4, API.leadService.retrieveCRInfos(leadId)];
|
|
181
185
|
case 1:
|
|
182
|
-
data = (
|
|
186
|
+
data = (_b.sent()).data;
|
|
183
187
|
return [2, { data: data }];
|
|
184
188
|
}
|
|
185
189
|
});
|
|
186
190
|
}); });
|
|
187
|
-
export var retrieveFLInfos = createAsyncThunk('retrieveFLInfos', function (
|
|
191
|
+
export var retrieveFLInfos = createAsyncThunk('retrieveFLInfos', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
188
192
|
var business, leadId, data;
|
|
189
|
-
var
|
|
190
|
-
return __generator(this, function (
|
|
191
|
-
switch (
|
|
193
|
+
var _a;
|
|
194
|
+
return __generator(this, function (_b) {
|
|
195
|
+
switch (_b.label) {
|
|
192
196
|
case 0:
|
|
193
197
|
business = thunkApi.getState().business;
|
|
194
|
-
leadId = (
|
|
198
|
+
leadId = (_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id;
|
|
195
199
|
return [4, API.leadService.retrieveFLInfos(leadId)];
|
|
196
200
|
case 1:
|
|
197
|
-
data = (
|
|
201
|
+
data = (_b.sent()).data;
|
|
198
202
|
return [2, { data: data }];
|
|
199
203
|
}
|
|
200
204
|
});
|
|
@@ -304,7 +308,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
|
|
|
304
308
|
return [4, API.entityService.updateEntityInfo(requestBody, { headers: headers })];
|
|
305
309
|
case 1:
|
|
306
310
|
data = (_e.sent()).data;
|
|
307
|
-
if (!data.errors
|
|
311
|
+
if (!data.errors) {
|
|
308
312
|
thunkApi.dispatch(handleNextScreenStep());
|
|
309
313
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
|
|
310
314
|
}
|
|
@@ -389,6 +393,9 @@ export var businessSlice = createSlice({
|
|
|
389
393
|
},
|
|
390
394
|
stopLoader: function (state) {
|
|
391
395
|
state.loading = false;
|
|
396
|
+
},
|
|
397
|
+
resetOTPScreen: function (state) {
|
|
398
|
+
state.data.otpData.otp = '';
|
|
392
399
|
}
|
|
393
400
|
},
|
|
394
401
|
extraReducers: function (builder) {
|
|
@@ -445,8 +452,9 @@ export var businessSlice = createSlice({
|
|
|
445
452
|
state.loading = false;
|
|
446
453
|
state.error = action.error.message;
|
|
447
454
|
})
|
|
448
|
-
.addCase(updateLeadIdentity.pending, function (state) {
|
|
449
|
-
|
|
455
|
+
.addCase(updateLeadIdentity.pending, function (state, action) {
|
|
456
|
+
var _a;
|
|
457
|
+
state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
|
|
450
458
|
state.error = null;
|
|
451
459
|
})
|
|
452
460
|
.addCase(updateLeadIdentity.fulfilled, function (state, action) {
|
|
@@ -479,8 +487,10 @@ export var businessSlice = createSlice({
|
|
|
479
487
|
var data = action.payload.data;
|
|
480
488
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
481
489
|
if (!description) {
|
|
482
|
-
|
|
483
|
-
|
|
490
|
+
if (Array.isArray(data)) {
|
|
491
|
+
state.data.crInfos = data;
|
|
492
|
+
state.data.businessTypeData.businessType = BusinessType.CR;
|
|
493
|
+
}
|
|
484
494
|
}
|
|
485
495
|
})
|
|
486
496
|
.addCase(retrieveCRInfos.rejected, function (state, action) {
|
|
@@ -522,8 +532,9 @@ export var businessSlice = createSlice({
|
|
|
522
532
|
}
|
|
523
533
|
state.data.businessTypeData = formData;
|
|
524
534
|
state.data.businessInfo.brandName = i18n.dir() === 'rtl' ? (_c = (_b = data === null || data === void 0 ? void 0 : data.brand) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.ar : (_e = (_d = data === null || data === void 0 ? void 0 : data.brand) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.en;
|
|
525
|
-
state.data.businessInfo.licenseNumber =
|
|
535
|
+
state.data.businessInfo.licenseNumber = data === null || data === void 0 ? void 0 : data.freelancer_number;
|
|
526
536
|
if (formData.businessType === BusinessType.CR) {
|
|
537
|
+
state.data.businessInfo.licenseNumber = data === null || data === void 0 ? void 0 : data.cr_number;
|
|
527
538
|
state.data.businessInfo.legalName = (_f = data === null || data === void 0 ? void 0 : data.license) === null || _f === void 0 ? void 0 : _f.crName;
|
|
528
539
|
state.data.activitiesData.operationStartDate = convertNumbers2English(moment((_g = data === null || data === void 0 ? void 0 : data.license) === null || _g === void 0 ? void 0 : _g.issueDate, 'iYYYY/iMM/iDD').format('YYYY-MM-DD'));
|
|
529
540
|
var activities = (_j = (_h = data === null || data === void 0 ? void 0 : data.license) === null || _h === void 0 ? void 0 : _h.activities) === null || _j === void 0 ? void 0 : _j.isic;
|
|
@@ -548,11 +559,12 @@ export var businessSlice = createSlice({
|
|
|
548
559
|
})
|
|
549
560
|
.addCase(createAccount.fulfilled, function (state, action) {
|
|
550
561
|
var _a, _b;
|
|
562
|
+
state.loading = false;
|
|
551
563
|
state.error = null;
|
|
552
564
|
var _c = action.payload, data = _c.data, channelsData = _c.channelsData;
|
|
553
|
-
var
|
|
554
|
-
if (
|
|
555
|
-
state.error =
|
|
565
|
+
var message = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = channelsData === null || channelsData === void 0 ? void 0 : channelsData.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).message;
|
|
566
|
+
if (message) {
|
|
567
|
+
state.error = message;
|
|
556
568
|
return;
|
|
557
569
|
}
|
|
558
570
|
if ((data === null || data === void 0 ? void 0 : data.status) === 'ALREADY_TAKEN') {
|
|
@@ -574,6 +586,7 @@ export var businessSlice = createSlice({
|
|
|
574
586
|
})
|
|
575
587
|
.addCase(updateActivitiesInfo.fulfilled, function (state, action) {
|
|
576
588
|
var _a;
|
|
589
|
+
state.loading = false;
|
|
577
590
|
state.error = null;
|
|
578
591
|
var _b = action.payload, data = _b.data, formData = _b.formData;
|
|
579
592
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
@@ -631,6 +644,6 @@ export var businessSlice = createSlice({
|
|
|
631
644
|
});
|
|
632
645
|
}
|
|
633
646
|
});
|
|
634
|
-
export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader;
|
|
647
|
+
export var clearError = (_a = businessSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetOTPScreen = _a.resetOTPScreen;
|
|
635
648
|
export default businessSlice.reducer;
|
|
636
649
|
export var businessSelector = function (state) { return state.business; };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
2
|
import { ResponseData, CountryCode, MobileFormValues, NIDFormValues, OTPFormValues, IndividualFormValues, SharedState, BrandFormValues, PasswordFormValues } from '../../../@types';
|
|
3
3
|
export declare const getCountries: import("@reduxjs/toolkit").AsyncThunk<{
|
|
4
|
-
businessCountry:
|
|
4
|
+
businessCountry: undefined;
|
|
5
5
|
countries: any;
|
|
6
6
|
}, void, {}>;
|
|
7
7
|
export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -53,7 +53,7 @@ import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE } from '../../../constants';
|
|
|
53
53
|
import { defaultCountry } from '../../../constants';
|
|
54
54
|
import { getIndividualName, getClientEmailUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
|
|
55
55
|
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var settings, countriesBody,
|
|
56
|
+
var settings, countriesBody, businessCountry, list;
|
|
57
57
|
return __generator(this, function (_a) {
|
|
58
58
|
switch (_a.label) {
|
|
59
59
|
case 0:
|
|
@@ -61,11 +61,17 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
|
|
|
61
61
|
return [4, API.countryService.getAllCountries()];
|
|
62
62
|
case 1:
|
|
63
63
|
countriesBody = (_a.sent()).data;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
businessCountry = undefined;
|
|
65
|
+
list = (countriesBody.list || []).map(function (country) {
|
|
66
|
+
if ([country.iso2, country.iso3].includes(settings.data.appConfig.businessCountryCode.toUpperCase())) {
|
|
67
|
+
businessCountry = country;
|
|
68
|
+
}
|
|
69
|
+
if (country.iso2 === 'SA') {
|
|
70
|
+
country.digits = 9;
|
|
71
|
+
}
|
|
72
|
+
return country;
|
|
67
73
|
});
|
|
68
|
-
return [2, { businessCountry: businessCountry, countries: list
|
|
74
|
+
return [2, { businessCountry: businessCountry, countries: list }];
|
|
69
75
|
}
|
|
70
76
|
});
|
|
71
77
|
}); });
|
|
@@ -437,22 +443,18 @@ export var connectSlice = createSlice({
|
|
|
437
443
|
state.loading = false;
|
|
438
444
|
},
|
|
439
445
|
resetMobileScreen: function (state) {
|
|
440
|
-
state.data.mobileData = __assign(__assign({}, state.data.mobileData), initialState.data.mobileData);
|
|
441
446
|
},
|
|
442
447
|
resetNIDScreen: function (state) {
|
|
443
|
-
state.data.nidData = __assign(__assign({}, state.data.nidData), initialState.data.nidData);
|
|
444
448
|
},
|
|
445
449
|
resetOTPScreen: function (state) {
|
|
446
|
-
state.data.otpData =
|
|
450
|
+
state.data.otpData.otp = '';
|
|
447
451
|
},
|
|
448
452
|
resetPasswordScreen: function (state) {
|
|
449
|
-
state.data.passwordData = initialState.data.passwordData;
|
|
450
453
|
},
|
|
451
454
|
resetIndividualScreen: function (state) {
|
|
452
455
|
state.data.individualData = initialState.data.individualData;
|
|
453
456
|
},
|
|
454
457
|
resetMerchantScreen: function (state) {
|
|
455
|
-
state.data.brandData = initialState.data.brandData;
|
|
456
458
|
}
|
|
457
459
|
},
|
|
458
460
|
extraReducers: function (builder) {
|
|
@@ -484,8 +486,9 @@ export var connectSlice = createSlice({
|
|
|
484
486
|
state.data.mobileData.responseBody = response;
|
|
485
487
|
state.data.otpData.isAbsher = false;
|
|
486
488
|
})
|
|
487
|
-
.addCase(createMobileAuth.pending, function (state) {
|
|
488
|
-
|
|
489
|
+
.addCase(createMobileAuth.pending, function (state, action) {
|
|
490
|
+
var _a;
|
|
491
|
+
state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
|
|
489
492
|
state.error = null;
|
|
490
493
|
})
|
|
491
494
|
.addCase(createMobileAuth.rejected, function (state, action) {
|
|
@@ -506,8 +509,9 @@ export var connectSlice = createSlice({
|
|
|
506
509
|
state.data.nidData.responseBody = response;
|
|
507
510
|
state.data.otpData.isAbsher = true;
|
|
508
511
|
})
|
|
509
|
-
.addCase(createNIDAuth.pending, function (state) {
|
|
510
|
-
|
|
512
|
+
.addCase(createNIDAuth.pending, function (state, action) {
|
|
513
|
+
var _a;
|
|
514
|
+
state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
|
|
511
515
|
state.error = null;
|
|
512
516
|
})
|
|
513
517
|
.addCase(createNIDAuth.rejected, function (state, action) {
|
|
@@ -528,8 +532,12 @@ export var connectSlice = createSlice({
|
|
|
528
532
|
if (!!leadResponse && !leadError) {
|
|
529
533
|
var name_1 = leadResponse.name, contact = leadResponse.contact;
|
|
530
534
|
var email = (contact || {}).email;
|
|
535
|
+
var firstName = (name_1 === null || name_1 === void 0 ? void 0 : name_1.first) + ' ';
|
|
536
|
+
var middleName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) ? (name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) + ' ' : '';
|
|
537
|
+
var thirdName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.third) ? (name_1 === null || name_1 === void 0 ? void 0 : name_1.third) + ' ' : '';
|
|
538
|
+
var lastName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.last) ? name_1 === null || name_1 === void 0 ? void 0 : name_1.middle : '';
|
|
531
539
|
if (!!name_1) {
|
|
532
|
-
var capitalizedName = capitalizeTheFirstLetterOfEachWord(
|
|
540
|
+
var capitalizedName = capitalizeTheFirstLetterOfEachWord(firstName + middleName + thirdName + lastName);
|
|
533
541
|
state.data.individualData.name = capitalizedName;
|
|
534
542
|
}
|
|
535
543
|
if (!!email)
|
|
@@ -25,7 +25,7 @@ import SalesChannels from './SalesChannels';
|
|
|
25
25
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
26
26
|
import Collapse from '../../../../components/Collapse';
|
|
27
27
|
import OperationStartDate from './OperationStartDate';
|
|
28
|
-
import { businessSelector, updateActivitiesInfo } from '../../../app/business/businessStore';
|
|
28
|
+
import { businessSelector, clearError, updateActivitiesInfo } from '../../../app/business/businessStore';
|
|
29
29
|
import { ActivitiesValidationSchema } from './validation';
|
|
30
30
|
var FormStyled = styled(Form)(function () { return ({
|
|
31
31
|
display: 'flex',
|
|
@@ -38,8 +38,8 @@ var Activities = function () {
|
|
|
38
38
|
var dispatch = useAppDispatch();
|
|
39
39
|
var isAr = useLanguage().isAr;
|
|
40
40
|
var t = useTranslation().t;
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var _d = useSelector(businessSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
42
|
+
var businessTypeResponse = data.businessTypeData.responseBody;
|
|
43
43
|
var methods = useForm({
|
|
44
44
|
resolver: yupResolver(ActivitiesValidationSchema),
|
|
45
45
|
defaultValues: data.activitiesData,
|
|
@@ -55,10 +55,15 @@ var Activities = function () {
|
|
|
55
55
|
var onBack = function () {
|
|
56
56
|
dispatch(handlePrevScreenStep());
|
|
57
57
|
};
|
|
58
|
+
React.useEffect(function () {
|
|
59
|
+
if (error)
|
|
60
|
+
dispatch(clearError());
|
|
61
|
+
}, [methods.formState.isValid]);
|
|
58
62
|
var handleMenuClick = function () {
|
|
59
63
|
anchorEl ? setAnchorEl(false) : setAnchorEl(true);
|
|
60
64
|
};
|
|
61
|
-
var activities_list = ((_a =
|
|
62
|
-
|
|
65
|
+
var activities_list = ((_a = businessTypeResponse === null || businessTypeResponse === void 0 ? void 0 : businessTypeResponse.activities) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
66
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
67
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [!!activities_list && (_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
63
68
|
};
|
|
64
69
|
export default Activities;
|
|
@@ -94,7 +94,7 @@ var ActivitiesList = function (_a) {
|
|
|
94
94
|
if (((_a = response === null || response === void 0 ? void 0 : response.activities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
95
95
|
setActivitiesMenuList(response === null || response === void 0 ? void 0 : response.activities);
|
|
96
96
|
}
|
|
97
|
-
}, [
|
|
97
|
+
}, []);
|
|
98
98
|
var onOpenList = function (event) {
|
|
99
99
|
var _a;
|
|
100
100
|
setAnchorEl(event.currentTarget);
|
|
@@ -1,14 +1,3 @@
|
|
|
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
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import { InputLabelStyled } from './ActivitiesList';
|
|
14
3
|
import { useTranslation } from 'react-i18next';
|
|
@@ -26,6 +15,6 @@ var OperationStartDate = function (_a) {
|
|
|
26
15
|
oDateControl.field.onChange(data);
|
|
27
16
|
};
|
|
28
17
|
var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
29
|
-
return (_jsxs(ScreenContainer,
|
|
18
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleOperationStartDateChange })] }));
|
|
30
19
|
};
|
|
31
20
|
export default OperationStartDate;
|
|
@@ -105,6 +105,6 @@ var SalesChannels = function () {
|
|
|
105
105
|
if (channelsChecked)
|
|
106
106
|
return !!(channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (item === null || item === void 0 ? void 0 : item.id); }));
|
|
107
107
|
};
|
|
108
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id.toString(), disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.
|
|
108
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), channelsMenuList.map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id.toString(), disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.titleAr : channel.title, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
|
|
109
109
|
};
|
|
110
110
|
export default SalesChannels;
|
|
@@ -15,32 +15,19 @@ import { useSelector } from 'react-redux';
|
|
|
15
15
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
-
import Box from '@mui/material/Box';
|
|
19
|
-
import { styled } from '@mui/material/styles';
|
|
20
18
|
import { useAppDispatch } from '../../../../hooks';
|
|
21
19
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
22
20
|
import Form from '../../../../components/Form';
|
|
23
21
|
import Collapse from '../../../../components/Collapse';
|
|
24
22
|
import { useLanguage } from '../../../../hooks';
|
|
25
23
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
26
|
-
import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
|
|
24
|
+
import { businessSelector, clearError, retrieveCRInfos, retrieveFLInfos, updateLeadBusinessType } from '../../../app/business/businessStore';
|
|
27
25
|
import { BusinessType as BusinessTypeEnum } from '../../../../@types';
|
|
28
26
|
import Button from '../../../shared/Button';
|
|
29
27
|
import { CRValidationSchema, FLValidationSchema } from './validation';
|
|
30
28
|
import SelectType from './SelectType';
|
|
31
29
|
import FreelanceLicense from './FreelanceLicense';
|
|
32
30
|
import CompanyLicense from './CompanyLicense';
|
|
33
|
-
var InputsContainerStyled = styled(Box)(function (_a) {
|
|
34
|
-
var _b;
|
|
35
|
-
var theme = _a.theme, listActive = _a.listActive;
|
|
36
|
-
return (_b = {
|
|
37
|
-
paddingBottom: theme.spacing(listActive ? 0 : 5)
|
|
38
|
-
},
|
|
39
|
-
_b[theme.transitions.create(['padding-bottom'])] = {
|
|
40
|
-
duration: theme.transitions.duration.standard
|
|
41
|
-
},
|
|
42
|
-
_b);
|
|
43
|
-
});
|
|
44
31
|
var BusinessType = function (_a) {
|
|
45
32
|
var _b = React.useState(false), isCR = _b[0], setIsCR = _b[1];
|
|
46
33
|
var _c = useSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
@@ -54,8 +41,13 @@ var BusinessType = function (_a) {
|
|
|
54
41
|
defaultValues: data.businessTypeData,
|
|
55
42
|
mode: 'onChange'
|
|
56
43
|
});
|
|
44
|
+
React.useEffect(function () {
|
|
45
|
+
dispatch(retrieveFLInfos());
|
|
46
|
+
dispatch(retrieveCRInfos());
|
|
47
|
+
}, []);
|
|
57
48
|
React.useEffect(function () {
|
|
58
49
|
var businessType = businessTypeData.businessType;
|
|
50
|
+
methods.setValue('businessType', businessType);
|
|
59
51
|
if (businessType === BusinessTypeEnum.CR)
|
|
60
52
|
setIsCR(true);
|
|
61
53
|
}, [businessTypeData.businessType]);
|
|
@@ -73,14 +65,15 @@ var BusinessType = function (_a) {
|
|
|
73
65
|
dispatch(handlePrevScreenStep());
|
|
74
66
|
};
|
|
75
67
|
var disabled = !methods.formState.isValid || !!error;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
var disableBack = !data.otpData.isNID;
|
|
69
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(SelectType, { show: !listActive, onSwitchToCR: function () { return setIsCR(true); }, onSwitchToFL: function () { return setIsCR(false); } }), _jsx(CompanyLicense, { show: isCR, list: data.crInfos, onListOpen: function () {
|
|
70
|
+
setListActive(true);
|
|
71
|
+
}, onListClose: function () {
|
|
72
|
+
setListActive(false);
|
|
73
|
+
} }), _jsx(FreelanceLicense, { show: !isCR, list: data.flInfos, onListOpen: function () {
|
|
74
|
+
setListActive(true);
|
|
75
|
+
}, onListClose: function () {
|
|
76
|
+
setListActive(false);
|
|
77
|
+
} }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
85
78
|
};
|
|
86
79
|
export default React.memo(BusinessType);
|