@tap-payments/auth-jsconnect 2.1.98-test → 2.1.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/app.d.ts +1 -0
- package/build/@types/form.d.ts +4 -2
- package/build/components/Lottie/Lottie.d.ts +1 -2
- package/build/components/Lottie/Lottie.js +1 -1
- package/build/components/Lottie/index.d.ts +2 -2
- package/build/components/Lottie/index.js +2 -2
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +18 -1
- package/build/features/app/brand/brandStore.js +2 -12
- package/build/features/app/individual/individualStore.d.ts +9 -2
- package/build/features/app/individual/individualStore.js +162 -80
- package/build/features/featuresScreens.js +5 -0
- package/build/features/individual/screens/IndividualList/UserList.js +2 -2
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.d.ts +12 -0
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +143 -0
- package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.d.ts +5 -0
- package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +60 -0
- package/build/features/individual/screens/IndividualPhoneInfo/index.d.ts +3 -0
- package/build/features/individual/screens/IndividualPhoneInfo/index.js +2 -0
- package/build/features/individual/screens/IndividualPhoneInfo/validation.d.ts +8 -0
- package/build/features/individual/screens/IndividualPhoneInfo/validation.js +31 -0
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +11 -1
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
|
@@ -176,6 +176,7 @@ interface LibCallbacks {
|
|
|
176
176
|
onStepStarted?: (name: string) => void;
|
|
177
177
|
onBoardButtonClick?: (data: Record<string, any>) => void;
|
|
178
178
|
onCreated?: (res: Record<string, any>) => void;
|
|
179
|
+
onBoardCompleted?: () => void;
|
|
179
180
|
}
|
|
180
181
|
export interface LibConfig extends LibCallbacks {
|
|
181
182
|
publicKey: string;
|
package/build/@types/form.d.ts
CHANGED
|
@@ -77,11 +77,13 @@ export declare type TaxFormValues = {
|
|
|
77
77
|
confirmPolicy: false;
|
|
78
78
|
documentId?: Array<string>;
|
|
79
79
|
};
|
|
80
|
-
export interface
|
|
81
|
-
email: string;
|
|
80
|
+
export interface IndividualMobileFormValues {
|
|
82
81
|
mobile: string | null;
|
|
83
82
|
countryCode: CountryCode;
|
|
84
83
|
}
|
|
84
|
+
export interface IndividualEmailMobileFormValues extends IndividualMobileFormValues {
|
|
85
|
+
email: string;
|
|
86
|
+
}
|
|
85
87
|
export interface IndividualPersonalInfoFormValues extends IndividualEmailMobileFormValues {
|
|
86
88
|
name: string;
|
|
87
89
|
gender: string | null;
|
|
@@ -4193,9 +4193,8 @@ export declare const LottieAnimationFiles: {
|
|
|
4193
4193
|
markers: never[];
|
|
4194
4194
|
};
|
|
4195
4195
|
};
|
|
4196
|
-
export declare type LottieAnimationFiles = typeof LottieAnimationFiles[keyof typeof LottieAnimationFiles];
|
|
4197
4196
|
interface LottieFileProps extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
4198
|
-
file: LottieAnimationFiles;
|
|
4197
|
+
file: (typeof LottieAnimationFiles)[keyof typeof LottieAnimationFiles];
|
|
4199
4198
|
width?: number | string;
|
|
4200
4199
|
height?: number | string;
|
|
4201
4200
|
loop?: boolean;
|
|
@@ -58,7 +58,7 @@ var LottieFile = function (_a) {
|
|
|
58
58
|
return (_jsx(_Fragment, { children: _jsx("div", __assign({ ref: lottieContainer, style: {
|
|
59
59
|
width: width || '100%',
|
|
60
60
|
height: height || '100%'
|
|
61
|
-
}, className: "".concat(props.className
|
|
61
|
+
}, className: "".concat(props.className || '') }, props)) }));
|
|
62
62
|
};
|
|
63
63
|
LottieFile.defaultProps = {
|
|
64
64
|
file: LottieAnimationFiles.start_loading
|
package/build/constants/app.d.ts
CHANGED
package/build/constants/app.js
CHANGED
|
@@ -241,7 +241,23 @@ export var BUSINESS_SCREENS_NAVIGATION = [
|
|
|
241
241
|
export var INDIVIDUAL_SCREENS_NAVIGATION = [
|
|
242
242
|
{
|
|
243
243
|
name: 'INDIVIDUAL_VERIFY_STEP',
|
|
244
|
-
next: [
|
|
244
|
+
next: [
|
|
245
|
+
'INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP',
|
|
246
|
+
'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
247
|
+
'INDIVIDUAL_LIST_STEP',
|
|
248
|
+
'INDIVIDUAL_PHONE_INFO_STEP'
|
|
249
|
+
],
|
|
250
|
+
prev: '',
|
|
251
|
+
order: 1
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: 'INDIVIDUAL_PHONE_INFO_STEP',
|
|
255
|
+
next: [
|
|
256
|
+
'INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP',
|
|
257
|
+
'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
258
|
+
'INDIVIDUAL_LIST_STEP',
|
|
259
|
+
'INDIVIDUAL_VERIFY_STEP'
|
|
260
|
+
],
|
|
245
261
|
prev: '',
|
|
246
262
|
order: 1
|
|
247
263
|
},
|
|
@@ -626,6 +642,7 @@ export var TAX_STEP_NAMES = {
|
|
|
626
642
|
TAX_SUCCESS: 'tax_completed'
|
|
627
643
|
};
|
|
628
644
|
export var INDIVIDUAl_STEP_NAMES = {
|
|
645
|
+
PHONE_INFO: 'phone_info',
|
|
629
646
|
PHONE_AUTH: 'individual_phone_auth',
|
|
630
647
|
INDIVIDUAl_PERSONAL_INFO: 'individual_personal_info',
|
|
631
648
|
INDIVIDUAl_INFO: 'individual_info',
|
|
@@ -51,7 +51,7 @@ import API from '../../../api';
|
|
|
51
51
|
import { FieldType, FlowsTypes } from '../../../@types';
|
|
52
52
|
import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
53
|
import { BRAND_STEP_NAMES } from '../../../constants';
|
|
54
|
-
import { isKW,
|
|
54
|
+
import { isKW, isTwitter, isWebsite, sleep } from '../../../utils';
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
|
|
56
56
|
var token = _a.token, isInternally = _a.isInternally;
|
|
57
57
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -610,23 +610,13 @@ export var brandSlice = createSlice({
|
|
|
610
610
|
state.error = null;
|
|
611
611
|
})
|
|
612
612
|
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
613
|
-
var _a, _b;
|
|
614
613
|
state.loading = false;
|
|
615
614
|
state.error = null;
|
|
616
|
-
var
|
|
617
|
-
var regional = customerBases.at(1);
|
|
615
|
+
var _a = action.payload, customerBases = _a.customerBases, expectedSales = _a.expectedSales, expectedCustomerSales = _a.expectedCustomerSales, countryISO2 = _a.countryISO2;
|
|
618
616
|
var local = customerBases.at(0);
|
|
619
|
-
var expectedSale = (_b = (_a = expectedSales.at(0)) === null || _a === void 0 ? void 0 : _a.sub) === null || _b === void 0 ? void 0 : _b.at(4);
|
|
620
|
-
var expectedCustomerSale = expectedCustomerSales.at(3);
|
|
621
617
|
state.data.brandActivities.responseBody = __assign(__assign({}, state.data.brandActivities.responseBody), { customerBases: customerBases, expectedSales: expectedSales, expectedCustomerSales: expectedCustomerSales });
|
|
622
618
|
if (local && isKW(countryISO2))
|
|
623
619
|
state.data.brandActivities.customerLocations = [local];
|
|
624
|
-
if (regional && local && isSA(countryISO2))
|
|
625
|
-
state.data.brandActivities.customerLocations = [regional, local];
|
|
626
|
-
if (!!expectedSale)
|
|
627
|
-
state.data.brandActivities.expectedSale = expectedSale;
|
|
628
|
-
if (!!expectedCustomerSale)
|
|
629
|
-
state.data.brandActivities.expectedCustomer = expectedCustomerSale;
|
|
630
620
|
})
|
|
631
621
|
.addCase(retrieveDataList.rejected, function (state, action) {
|
|
632
622
|
state.loading = false;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState, User, IndividualPersonalInfoFormValues, IndividualEmailMobileFormValues } from '../../../@types';
|
|
2
|
+
import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState, User, IndividualPersonalInfoFormValues, IndividualEmailMobileFormValues, IndividualMobileFormValues } from '../../../@types';
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
4
|
interface VerifyLeadTokenProps {
|
|
5
5
|
token: string;
|
|
6
6
|
isInternally?: boolean;
|
|
7
|
+
isUpdatePhoneInfo?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare const
|
|
9
|
+
export declare const verifyToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
9
10
|
data: any;
|
|
10
11
|
boardResponse: {
|
|
11
12
|
brand: any;
|
|
@@ -23,6 +24,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
23
24
|
};
|
|
24
25
|
token: string;
|
|
25
26
|
}, VerifyLeadTokenProps, {}>;
|
|
27
|
+
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<void, VerifyLeadTokenProps, {}>;
|
|
26
28
|
export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
27
29
|
data: any;
|
|
28
30
|
}, void, {}>;
|
|
@@ -81,6 +83,10 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
81
83
|
otp: string;
|
|
82
84
|
};
|
|
83
85
|
}, OTPFormValues, {}>;
|
|
86
|
+
export declare const updatePhoneInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
87
|
+
data: any;
|
|
88
|
+
formData: IndividualMobileFormValues;
|
|
89
|
+
}, IndividualMobileFormValues, {}>;
|
|
84
90
|
export declare const updateIndividualPersonalInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
85
91
|
data: any;
|
|
86
92
|
formData: IndividualPersonalInfoFormValues;
|
|
@@ -107,6 +113,7 @@ declare type VerifyData = {
|
|
|
107
113
|
export interface IndividualData {
|
|
108
114
|
verify: ResponseData & VerifyData;
|
|
109
115
|
otpData: OTPFormValues & ResponseData;
|
|
116
|
+
individualPhoneInfo: IndividualMobileFormValues & ResponseData;
|
|
110
117
|
individualCollectData: IndividualEmailMobileFormValues & ResponseData;
|
|
111
118
|
individualPersonalData: IndividualPersonalInfoFormValues & ResponseData;
|
|
112
119
|
individualData: IndividualExtraFormValues & ResponseData;
|
|
@@ -72,8 +72,8 @@ import { FlowsTypes, IndividualGender, IndividualType, FieldType } from '../../.
|
|
|
72
72
|
import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
73
73
|
import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
74
74
|
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, getEighteenYearsAgo, getUserNameObject, getUserName, sleep, isValidEmail } from '../../../utils';
|
|
75
|
-
export var
|
|
76
|
-
var token = _a.token, isInternally = _a.isInternally;
|
|
75
|
+
export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
|
|
76
|
+
var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
|
|
77
77
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
78
78
|
var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, payload_1, info, hasIndividualCompleted, birthCountry;
|
|
79
79
|
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -98,31 +98,35 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
98
98
|
countryCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
99
99
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
100
100
|
}
|
|
101
|
-
if (!(data.step_name
|
|
101
|
+
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
|
|
102
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
|
|
103
|
+
return [3, 17];
|
|
104
|
+
case 2:
|
|
105
|
+
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 16];
|
|
102
106
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
103
107
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
104
|
-
if (!(board_id && board_info_id)) return [3,
|
|
108
|
+
if (!(board_id && board_info_id)) return [3, 5];
|
|
105
109
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
106
|
-
case
|
|
110
|
+
case 3:
|
|
107
111
|
boardInfoData = _l.sent();
|
|
108
112
|
notification = (boardInfoData || {}).notification;
|
|
109
113
|
_b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
|
|
110
|
-
if (!(id && type)) return [3,
|
|
114
|
+
if (!(id && type)) return [3, 5];
|
|
111
115
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
|
|
112
|
-
case
|
|
116
|
+
case 4:
|
|
113
117
|
payload_1 = (_l.sent()).payload;
|
|
114
118
|
individualData = payload_1.data || {};
|
|
115
|
-
_l.label =
|
|
116
|
-
case 4:
|
|
117
|
-
if (!board_id) return [3, 7];
|
|
118
|
-
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
119
|
+
_l.label = 5;
|
|
119
120
|
case 5:
|
|
121
|
+
if (!board_id) return [3, 8];
|
|
122
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
123
|
+
case 6:
|
|
120
124
|
boardData = _l.sent();
|
|
121
125
|
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
122
|
-
case 6:
|
|
123
|
-
boardInfoStatus = _l.sent();
|
|
124
|
-
_l.label = 7;
|
|
125
126
|
case 7:
|
|
127
|
+
boardInfoStatus = _l.sent();
|
|
128
|
+
_l.label = 8;
|
|
129
|
+
case 8:
|
|
126
130
|
if (!countryCode) {
|
|
127
131
|
countryCode = (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.country;
|
|
128
132
|
if (countryCode)
|
|
@@ -130,30 +134,36 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
130
134
|
}
|
|
131
135
|
info = (boardInfoStatus || {}).info;
|
|
132
136
|
hasIndividualCompleted = ((_e = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
|
|
133
|
-
if (!hasIndividualCompleted) return [3,
|
|
137
|
+
if (!hasIndividualCompleted) return [3, 9];
|
|
134
138
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
135
|
-
return [3,
|
|
136
|
-
case 8:
|
|
137
|
-
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
|
|
138
|
-
if (!((_f = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _f === void 0 ? void 0 : _f.id)) return [3, 10];
|
|
139
|
-
return [4, thunkApi.dispatch(getIndividualList((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id))];
|
|
139
|
+
return [3, 15];
|
|
140
140
|
case 9:
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 12];
|
|
142
|
+
if (!((_f = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _f === void 0 ? void 0 : _f.id)) return [3, 11];
|
|
143
|
+
return [4, thunkApi.dispatch(getIndividualList((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id))];
|
|
143
144
|
case 10:
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
_l.sent();
|
|
146
|
+
_l.label = 11;
|
|
146
147
|
case 11:
|
|
148
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
149
|
+
return [3, 15];
|
|
150
|
+
case 12:
|
|
147
151
|
birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
|
|
148
|
-
if (!birthCountry) return [3,
|
|
152
|
+
if (!birthCountry) return [3, 14];
|
|
149
153
|
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
150
|
-
case 12:
|
|
151
|
-
_l.sent();
|
|
152
|
-
_l.label = 13;
|
|
153
154
|
case 13:
|
|
154
|
-
|
|
155
|
+
_l.sent();
|
|
155
156
|
_l.label = 14;
|
|
156
|
-
case 14:
|
|
157
|
+
case 14:
|
|
158
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
159
|
+
_l.label = 15;
|
|
160
|
+
case 15: return [3, 17];
|
|
161
|
+
case 16:
|
|
162
|
+
if (isUpdatePhoneInfo) {
|
|
163
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
|
|
164
|
+
}
|
|
165
|
+
_l.label = 17;
|
|
166
|
+
case 17: return [2, {
|
|
157
167
|
data: data,
|
|
158
168
|
boardResponse: {
|
|
159
169
|
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
@@ -175,6 +185,19 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
175
185
|
});
|
|
176
186
|
});
|
|
177
187
|
});
|
|
188
|
+
export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (_a, thunkApi) {
|
|
189
|
+
var token = _a.token, isInternally = _a.isInternally;
|
|
190
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
191
|
+
return __generator(this, function (_b) {
|
|
192
|
+
switch (_b.label) {
|
|
193
|
+
case 0: return [4, thunkApi.dispatch(verifyToken({ token: token, isInternally: isInternally }))];
|
|
194
|
+
case 1:
|
|
195
|
+
_b.sent();
|
|
196
|
+
return [2];
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
});
|
|
178
201
|
export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
179
202
|
var individual, payload, data;
|
|
180
203
|
return __generator(this, function (_a) {
|
|
@@ -382,10 +405,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
|
|
|
382
405
|
});
|
|
383
406
|
}); });
|
|
384
407
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
385
|
-
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData,
|
|
386
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
387
|
-
return __generator(this, function (
|
|
388
|
-
switch (
|
|
408
|
+
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, boardInfoStatus, countryCode, notification, _c, id, type, payload_2, info, hasIndividualCompleted, birthCountry;
|
|
409
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
410
|
+
return __generator(this, function (_q) {
|
|
411
|
+
switch (_q.label) {
|
|
389
412
|
case 0:
|
|
390
413
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
391
414
|
responseBody = individual.data.verify.responseBody;
|
|
@@ -400,76 +423,110 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
400
423
|
};
|
|
401
424
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
402
425
|
case 1:
|
|
403
|
-
data = (
|
|
426
|
+
data = (_q.sent()).data;
|
|
404
427
|
boardInfoStatus = undefined;
|
|
405
|
-
if (
|
|
428
|
+
if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
|
|
429
|
+
throw new Error(data.errors[0].description);
|
|
406
430
|
if (!board_id) return [3, 4];
|
|
407
|
-
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
408
|
-
case 2:
|
|
409
|
-
boardInfoStatus = _p.sent();
|
|
410
431
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
432
|
+
case 2:
|
|
433
|
+
boardData = _q.sent();
|
|
434
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
411
435
|
case 3:
|
|
412
|
-
|
|
413
|
-
|
|
436
|
+
boardInfoStatus = _q.sent();
|
|
437
|
+
_q.label = 4;
|
|
414
438
|
case 4:
|
|
415
|
-
countryCode = (
|
|
439
|
+
countryCode = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
|
|
416
440
|
if (!(board_id && board_info_id)) return [3, 7];
|
|
417
441
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
418
442
|
case 5:
|
|
419
|
-
boardInfoData =
|
|
443
|
+
boardInfoData = _q.sent();
|
|
420
444
|
notification = (boardInfoData || {}).notification;
|
|
421
445
|
_c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
422
446
|
if (!(id && type)) return [3, 7];
|
|
423
447
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
|
|
424
448
|
case 6:
|
|
425
|
-
payload_2 = (
|
|
449
|
+
payload_2 = (_q.sent()).payload;
|
|
426
450
|
individualData = payload_2.data || {};
|
|
427
|
-
|
|
451
|
+
_q.label = 7;
|
|
428
452
|
case 7:
|
|
453
|
+
if (countryCode)
|
|
454
|
+
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
429
455
|
info = (boardInfoStatus || {}).info;
|
|
430
|
-
hasIndividualCompleted = ((
|
|
431
|
-
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
456
|
+
hasIndividualCompleted = ((_g = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _g === void 0 ? void 0 : _g.status) === 'completed';
|
|
432
457
|
if (!hasIndividualCompleted) return [3, 8];
|
|
433
458
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
434
459
|
return [3, 14];
|
|
435
460
|
case 8:
|
|
436
461
|
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
|
|
437
|
-
if (!((
|
|
438
|
-
return [4, thunkApi.dispatch(getIndividualList((
|
|
462
|
+
if (!((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id)) return [3, 10];
|
|
463
|
+
return [4, thunkApi.dispatch(getIndividualList((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id))];
|
|
439
464
|
case 9:
|
|
440
|
-
|
|
441
|
-
|
|
465
|
+
_q.sent();
|
|
466
|
+
_q.label = 10;
|
|
442
467
|
case 10:
|
|
443
468
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
444
469
|
return [3, 14];
|
|
445
470
|
case 11:
|
|
446
|
-
birthCountry = ((
|
|
471
|
+
birthCountry = ((_k = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _k === void 0 ? void 0 : _k.country) || countryCode;
|
|
447
472
|
if (!birthCountry) return [3, 13];
|
|
448
473
|
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
449
474
|
case 12:
|
|
450
|
-
|
|
451
|
-
|
|
475
|
+
_q.sent();
|
|
476
|
+
_q.label = 13;
|
|
452
477
|
case 13:
|
|
453
478
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
454
|
-
|
|
455
|
-
case 14:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
479
|
+
_q.label = 14;
|
|
480
|
+
case 14:
|
|
481
|
+
(_m = (_l = settings.data.appConfig).onStepCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, settings.data.activeScreen.name, { otp: params.otp });
|
|
482
|
+
return [2, {
|
|
483
|
+
data: data,
|
|
484
|
+
boardResponse: {
|
|
485
|
+
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
486
|
+
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
487
|
+
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
488
|
+
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
489
|
+
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
490
|
+
name: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.names,
|
|
491
|
+
contact: (_p = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _p === void 0 ? void 0 : _p.contact,
|
|
492
|
+
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
493
|
+
countries: countries,
|
|
494
|
+
countryCode: countryCode,
|
|
495
|
+
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
496
|
+
flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
|
|
497
|
+
},
|
|
498
|
+
formData: __assign({}, params)
|
|
499
|
+
}];
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
}); });
|
|
503
|
+
export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
504
|
+
var individual, _a, token, responseBody, _b, id, type, mobile, countryCode, requestBody, data;
|
|
505
|
+
var _c;
|
|
506
|
+
return __generator(this, function (_d) {
|
|
507
|
+
switch (_d.label) {
|
|
508
|
+
case 0:
|
|
509
|
+
individual = thunkApi.getState().individual;
|
|
510
|
+
_a = individual.data.verify, token = _a.token, responseBody = _a.responseBody;
|
|
511
|
+
_b = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.source) || {}, id = _b.id, type = _b.type;
|
|
512
|
+
mobile = params.mobile, countryCode = params.countryCode;
|
|
513
|
+
requestBody = {
|
|
514
|
+
id: id,
|
|
515
|
+
type: type,
|
|
516
|
+
contact: {
|
|
517
|
+
phone: {
|
|
518
|
+
country_code: (_c = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
519
|
+
number: mobile || ''
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
return [4, API.individualService.updateIndividual(requestBody)];
|
|
524
|
+
case 1:
|
|
525
|
+
data = _d.sent();
|
|
526
|
+
return [4, thunkApi.dispatch(verifyToken({ token: token, isUpdatePhoneInfo: true }))];
|
|
527
|
+
case 2:
|
|
528
|
+
_d.sent();
|
|
529
|
+
return [2, { data: data, formData: params }];
|
|
473
530
|
}
|
|
474
531
|
});
|
|
475
532
|
}); });
|
|
@@ -715,6 +772,10 @@ var initialState = {
|
|
|
715
772
|
otpData: {
|
|
716
773
|
otp: ''
|
|
717
774
|
},
|
|
775
|
+
individualPhoneInfo: {
|
|
776
|
+
mobile: '',
|
|
777
|
+
countryCode: defaultCountry
|
|
778
|
+
},
|
|
718
779
|
individualCollectData: {
|
|
719
780
|
email: '',
|
|
720
781
|
mobile: '',
|
|
@@ -773,16 +834,25 @@ export var individualSlice = createSlice({
|
|
|
773
834
|
},
|
|
774
835
|
extraReducers: function (builder) {
|
|
775
836
|
builder
|
|
776
|
-
.addCase(
|
|
837
|
+
.addCase(verifyToken.pending, function (state) {
|
|
777
838
|
state.error = null;
|
|
778
|
-
state.customLoading = true;
|
|
779
839
|
})
|
|
780
|
-
.addCase(
|
|
840
|
+
.addCase(verifyToken.fulfilled, function (state, action) {
|
|
781
841
|
state.error = null;
|
|
782
|
-
state.customLoading = false;
|
|
783
842
|
var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse;
|
|
784
843
|
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
|
|
785
844
|
state.data.verify.token = token;
|
|
845
|
+
})
|
|
846
|
+
.addCase(verifyToken.rejected, function (state, action) {
|
|
847
|
+
state.error = action.error.message;
|
|
848
|
+
})
|
|
849
|
+
.addCase(verifyLeadToken.pending, function (state) {
|
|
850
|
+
state.error = null;
|
|
851
|
+
state.customLoading = true;
|
|
852
|
+
})
|
|
853
|
+
.addCase(verifyLeadToken.fulfilled, function (state) {
|
|
854
|
+
state.error = null;
|
|
855
|
+
state.customLoading = false;
|
|
786
856
|
})
|
|
787
857
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
788
858
|
state.error = action.error.message;
|
|
@@ -863,12 +933,10 @@ export var individualSlice = createSlice({
|
|
|
863
933
|
state.error = action.error.message;
|
|
864
934
|
})
|
|
865
935
|
.addCase(retrieveIndividualInfo.pending, function (state) {
|
|
866
|
-
state.loading = true;
|
|
867
936
|
state.error = null;
|
|
868
937
|
})
|
|
869
938
|
.addCase(retrieveIndividualInfo.fulfilled, function (state, action) {
|
|
870
939
|
var _a, _b, _c, _d;
|
|
871
|
-
state.loading = false;
|
|
872
940
|
state.error = null;
|
|
873
941
|
var _e = action.payload, data = _e.data, countries = _e.countries, countryCode = _e.countryCode;
|
|
874
942
|
var user = (state.data.verify.responseBody || {}).user;
|
|
@@ -938,7 +1006,6 @@ export var individualSlice = createSlice({
|
|
|
938
1006
|
state.data.individualData.isInfluencer = is_influencer;
|
|
939
1007
|
})
|
|
940
1008
|
.addCase(retrieveIndividualInfo.rejected, function (state, action) {
|
|
941
|
-
state.loading = false;
|
|
942
1009
|
state.error = action.error.message;
|
|
943
1010
|
})
|
|
944
1011
|
.addCase(getIndividualList.pending, function (state) {
|
|
@@ -1008,6 +1075,21 @@ export var individualSlice = createSlice({
|
|
|
1008
1075
|
.addCase(getCityList.rejected, function (state, action) {
|
|
1009
1076
|
state.cityLoading = false;
|
|
1010
1077
|
state.error = action.error.message;
|
|
1078
|
+
})
|
|
1079
|
+
.addCase(updatePhoneInfo.pending, function (state) {
|
|
1080
|
+
state.loading = true;
|
|
1081
|
+
state.error = null;
|
|
1082
|
+
})
|
|
1083
|
+
.addCase(updatePhoneInfo.fulfilled, function (state, action) {
|
|
1084
|
+
state.loading = false;
|
|
1085
|
+
state.error = null;
|
|
1086
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
1087
|
+
state.data.individualPhoneInfo = formData;
|
|
1088
|
+
state.data.individualPhoneInfo.responseBody = data;
|
|
1089
|
+
})
|
|
1090
|
+
.addCase(updatePhoneInfo.rejected, function (state, action) {
|
|
1091
|
+
state.loading = false;
|
|
1092
|
+
state.error = action.error.message;
|
|
1011
1093
|
})
|
|
1012
1094
|
.addCase(updateIndividualPersonalInfo.pending, function (state) {
|
|
1013
1095
|
state.loading = true;
|
|
@@ -38,6 +38,7 @@ import SuccessPasswordPage from './password/screens/Success';
|
|
|
38
38
|
import PasswordSuccessWithFlowPage from './password/screens/SuccessWithFlowButtons';
|
|
39
39
|
import PasswordResetPasswordSuccessPage from './password/screens/ResetPasswordSuccess';
|
|
40
40
|
import IndividualVerifyPage from './individual/screens/Verify';
|
|
41
|
+
import IndividualPhoneInfoPage from './individual/screens/IndividualPhoneInfo';
|
|
41
42
|
import IndividualListPage from './individual/screens/IndividualList';
|
|
42
43
|
import IndividualPersonalInfo from './individual/screens/IndividualPersonalInfo';
|
|
43
44
|
import AdditionalIndividualInfoPage from './individual/screens/AdditionalIndividualInfo';
|
|
@@ -232,6 +233,10 @@ export var individualFeatureScreens = [
|
|
|
232
233
|
name: 'INDIVIDUAL_VERIFY_STEP',
|
|
233
234
|
element: IndividualVerifyPage
|
|
234
235
|
},
|
|
236
|
+
{
|
|
237
|
+
name: 'INDIVIDUAL_PHONE_INFO_STEP',
|
|
238
|
+
element: IndividualPhoneInfoPage
|
|
239
|
+
},
|
|
235
240
|
{
|
|
236
241
|
name: 'INDIVIDUAL_LOADING_DATA_STEP',
|
|
237
242
|
element: IndividualDataLoadingPage
|
|
@@ -57,7 +57,7 @@ var TextBoxStyled = styled(Box)(function (_a) {
|
|
|
57
57
|
});
|
|
58
58
|
var TextStyled = styled(Box)(function (_a) {
|
|
59
59
|
var theme = _a.theme;
|
|
60
|
-
return (__assign(__assign({}, theme.typography.subtitle2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default }));
|
|
60
|
+
return (__assign(__assign({}, theme.typography.subtitle2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default, display: 'inline-flex' }));
|
|
61
61
|
});
|
|
62
62
|
var RoleTextStyled = styled(Text)(function (_a) {
|
|
63
63
|
var theme = _a.theme;
|
|
@@ -181,7 +181,7 @@ var UserList = function (_a) {
|
|
|
181
181
|
return (_jsx(ScreenContainerStyled, { children: usersMenuList.map(function (user, index) {
|
|
182
182
|
return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ sx: {
|
|
183
183
|
cursor: emailChecking ? 'default' : 'pointer'
|
|
184
|
-
}, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsxs(TextStyled, { children: [getName(user) || '', _jsx(RoleTextStyled, { children: getUserRole(user) || '' })] }), (user === null || user === void 0 ? void 0 : user.isRequestedEmail) ? _jsx(CheckIcon, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl && isActiveUser(user) })] })), _jsx(Collapse, __assign({ in: !!anchorEl && isActiveUser(user), timeout: 300 }, { children: _jsx(ListButton, { isAr: isAr, addDetails: {
|
|
184
|
+
}, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsxs(TextStyled, { children: [_jsx("span", { children: getName(user) || '' }), _jsx(RoleTextStyled, { children: getUserRole(user) || '' })] }), (user === null || user === void 0 ? void 0 : user.isRequestedEmail) ? _jsx(CheckIcon, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl && isActiveUser(user) })] })), _jsx(Collapse, __assign({ in: !!anchorEl && isActiveUser(user), timeout: 300 }, { children: _jsx(ListButton, { isAr: isAr, addDetails: {
|
|
185
185
|
title: t('add_details'),
|
|
186
186
|
onClick: onAddDetails,
|
|
187
187
|
loading: isActiveUser(user) && loading && type === IndividualRequestType.ADD
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Theme, SxProps } from '@mui/material/styles';
|
|
3
|
+
import { CountryCode } from '../../../../@types';
|
|
4
|
+
interface MobileNumberProps {
|
|
5
|
+
countries: Array<CountryCode>;
|
|
6
|
+
show: boolean;
|
|
7
|
+
onListOpen?: () => void;
|
|
8
|
+
onListClose?: () => void;
|
|
9
|
+
sx?: SxProps<Theme>;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import { useTranslation } from 'react-i18next';
|
|
26
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
27
|
+
import Box from '@mui/material/Box';
|
|
28
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
29
|
+
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
30
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
31
|
+
import Text from '../../../../components/Text';
|
|
32
|
+
import Collapse from '../../../../components/Collapse';
|
|
33
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
34
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
35
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
36
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
37
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
38
|
+
import Input from '../../../shared/Input';
|
|
39
|
+
import { individualSelector } from '../../../app/individual/individualStore';
|
|
40
|
+
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
41
|
+
var theme = _a.theme;
|
|
42
|
+
return ({
|
|
43
|
+
display: 'flex',
|
|
44
|
+
justifyContent: 'space-between',
|
|
45
|
+
padding: theme.spacing(0, 2.5, 1.25, 2.5)
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var CountryItemContainer = styled(Box)(function () { return ({
|
|
49
|
+
display: 'flex'
|
|
50
|
+
}); });
|
|
51
|
+
var CountryCodeText = styled(Text, {
|
|
52
|
+
shouldForwardProp: function (prop) { return prop !== 'isSelected'; }
|
|
53
|
+
})(function (_a) {
|
|
54
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
55
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { width: theme.spacing(10), textAlign: 'start', fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
56
|
+
});
|
|
57
|
+
var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
58
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
59
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
60
|
+
});
|
|
61
|
+
var CountryCodeStyled = styled(Text)(function (_a) {
|
|
62
|
+
var theme = _a.theme;
|
|
63
|
+
return (__assign(__assign({ cursor: 'pointer' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightRegular, display: 'flex', alignItems: 'center', minWidth: theme.spacing(8.75) }));
|
|
64
|
+
});
|
|
65
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
66
|
+
var theme = _a.theme;
|
|
67
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
68
|
+
});
|
|
69
|
+
var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
|
|
70
|
+
var theme = _a.theme;
|
|
71
|
+
return ({
|
|
72
|
+
marginInlineStart: theme.spacing(1)
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
var InputStyled = styled(Input)(function () { return ({
|
|
76
|
+
direction: 'ltr',
|
|
77
|
+
'& .MuiInputBase-input': {
|
|
78
|
+
cursor: 'auto'
|
|
79
|
+
}
|
|
80
|
+
}); });
|
|
81
|
+
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
82
|
+
var _b, _c, _d;
|
|
83
|
+
var countries = _a.countries, sx = _a.sx, rest = __rest(_a, ["countries", "sx"]);
|
|
84
|
+
var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
|
|
85
|
+
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
86
|
+
var t = useTranslation().t;
|
|
87
|
+
var isAr = useLanguage().isAr;
|
|
88
|
+
var _g = useFormContext(), control = _g.control, setValue = _g.setValue;
|
|
89
|
+
var data = useAppSelector(individualSelector).data;
|
|
90
|
+
var phoneControl = useController({ name: 'mobile', control: control });
|
|
91
|
+
var countryCodeControl = useController({ name: 'countryCode', control: control });
|
|
92
|
+
var countryCodeValue = countryCodeControl.field.value;
|
|
93
|
+
var mobileValue = phoneControl.field.value;
|
|
94
|
+
var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
|
|
95
|
+
var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
|
|
96
|
+
var isSA = (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2) === 'SA';
|
|
97
|
+
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
98
|
+
var isStartsWith5 = mobileValue.startsWith('5');
|
|
99
|
+
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
100
|
+
var verify = data.verify;
|
|
101
|
+
var user = (verify.responseBody || {}).user;
|
|
102
|
+
React.useEffect(function () {
|
|
103
|
+
if (mobileValue)
|
|
104
|
+
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
105
|
+
}, []);
|
|
106
|
+
var onPhoneNumberChange = function (_a) {
|
|
107
|
+
var target = _a.target;
|
|
108
|
+
var value = removeAllCharsFromNumber(target.value);
|
|
109
|
+
phoneControl.field.onChange(value);
|
|
110
|
+
};
|
|
111
|
+
var clearMobileNumber = function () {
|
|
112
|
+
phoneControl.field.onChange('');
|
|
113
|
+
};
|
|
114
|
+
var onCloseCountryList = function () {
|
|
115
|
+
var _a;
|
|
116
|
+
if (anchorEl) {
|
|
117
|
+
setAnchorEl(null);
|
|
118
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
119
|
+
}
|
|
120
|
+
setCountries(countries);
|
|
121
|
+
};
|
|
122
|
+
var toggleCountryList = function () {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
if (anchorEl) {
|
|
125
|
+
setAnchorEl(null);
|
|
126
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
127
|
+
setCountries(countries);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
(_b = rest.onListOpen) === null || _b === void 0 ? void 0 : _b.call(rest);
|
|
131
|
+
setAnchorEl(true);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
var onSelectItem = function (country) {
|
|
135
|
+
onCloseCountryList();
|
|
136
|
+
setValue('mobile', '');
|
|
137
|
+
countryCodeControl.field.onChange(country);
|
|
138
|
+
};
|
|
139
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
140
|
+
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
141
|
+
} }) }))] })) })));
|
|
142
|
+
});
|
|
143
|
+
export default React.memo(MobileNumber);
|
|
@@ -0,0 +1,60 @@
|
|
|
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 { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
|
+
import { styled } from '@mui/material/styles';
|
|
18
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
19
|
+
import { useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
|
|
20
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
21
|
+
import Form from '../../../../components/Form';
|
|
22
|
+
import Collapse from '../../../../components/Collapse';
|
|
23
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
+
import { individualSelector, clearError, updatePhoneInfo } from '../../../app/individual/individualStore';
|
|
25
|
+
import Button from '../../../shared/Button';
|
|
26
|
+
import { IndividualPhoneInfoValidationSchema } from './validation';
|
|
27
|
+
import MobileNumber from './MobileNumber';
|
|
28
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column'
|
|
31
|
+
}); });
|
|
32
|
+
var PhoneInfo = function (_a) {
|
|
33
|
+
var dispatch = useAppDispatch();
|
|
34
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
35
|
+
var countries = settingsData.countries;
|
|
36
|
+
var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
37
|
+
var _c = data.individualPhoneInfo, mobile = _c.mobile, countryCode = _c.countryCode;
|
|
38
|
+
var methods = useForm({
|
|
39
|
+
resolver: yupResolver(IndividualPhoneInfoValidationSchema),
|
|
40
|
+
defaultValues: {
|
|
41
|
+
mobile: mobile,
|
|
42
|
+
countryCode: countryCode
|
|
43
|
+
},
|
|
44
|
+
mode: 'onChange'
|
|
45
|
+
});
|
|
46
|
+
useSetFromDefaultValues(methods, data.individualPhoneInfo);
|
|
47
|
+
var t = useTranslation().t;
|
|
48
|
+
var isAr = useLanguage().isAr;
|
|
49
|
+
var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
|
|
50
|
+
var onSubmit = function (formData) {
|
|
51
|
+
dispatch(updatePhoneInfo(formData));
|
|
52
|
+
};
|
|
53
|
+
React.useEffect(function () {
|
|
54
|
+
if (error && methods.formState.isValid)
|
|
55
|
+
dispatch(clearError());
|
|
56
|
+
}, [methods.formState.isValid]);
|
|
57
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
58
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(MobileNumber, { show: true, sx: { mb: 7.5 }, countries: countries, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
59
|
+
};
|
|
60
|
+
export default React.memo(PhoneInfo);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const IndividualPhoneInfoValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export var IndividualPhoneInfoValidationSchema = yup.object().shape({
|
|
3
|
+
mobile: yup
|
|
4
|
+
.string()
|
|
5
|
+
.test({
|
|
6
|
+
test: function (value) {
|
|
7
|
+
if (((value === null || value === void 0 ? void 0 : value.length) || 0) > 0) {
|
|
8
|
+
var countryCode = this.parent.countryCode;
|
|
9
|
+
var isSA = countryCode.iso2 === 'SA';
|
|
10
|
+
var digits = countryCode.digits;
|
|
11
|
+
var mobileValue = value || '';
|
|
12
|
+
var valueLen = mobileValue.length;
|
|
13
|
+
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
14
|
+
if (!isNumber)
|
|
15
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
16
|
+
var isStartWithZero = mobileValue.startsWith('05');
|
|
17
|
+
var isStartWith5 = mobileValue.startsWith('5');
|
|
18
|
+
var isSaudiNumber = isStartWith5 || isStartWithZero;
|
|
19
|
+
if (isSA) {
|
|
20
|
+
if (!isSaudiNumber)
|
|
21
|
+
return this.createError({ message: 'start_with_number' });
|
|
22
|
+
var requiredLen = isStartWith5 ? digits - 1 : digits;
|
|
23
|
+
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
24
|
+
}
|
|
25
|
+
return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
.required()
|
|
31
|
+
});
|
|
@@ -100,9 +100,19 @@ var SuccessFlowButtons = function (_a) {
|
|
|
100
100
|
});
|
|
101
101
|
setButtons(mappedFlows);
|
|
102
102
|
};
|
|
103
|
+
var checkIfFlowsAreCompletedExceptPassword = function (data) {
|
|
104
|
+
var isFlowsCompleted = data.every(function (flow) { return flow.status === 'completed' && flow.name !== 'password'; });
|
|
105
|
+
return isFlowsCompleted;
|
|
106
|
+
};
|
|
103
107
|
useEffect(function () {
|
|
104
|
-
|
|
108
|
+
var _a, _b;
|
|
109
|
+
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0) {
|
|
105
110
|
reMapFlowData(flows);
|
|
111
|
+
var isFlowsCompleted = checkIfFlowsAreCompletedExceptPassword(flows);
|
|
112
|
+
if (isFlowsCompleted) {
|
|
113
|
+
(_b = (_a = settings.data.appConfig).onBoardCompleted) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
106
116
|
}, [flows, isAr]);
|
|
107
117
|
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
|
|
108
118
|
flowName: flowName,
|