@tap-payments/auth-jsconnect 2.1.92-test → 2.1.93-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/form.d.ts +4 -2
- package/build/api/individual.d.ts +1 -1
- package/build/features/app/brand/brandStore.js +3 -2
- package/build/features/app/connectExpress/connectExpressStore.js +4 -5
- package/build/features/app/individual/individualStore.d.ts +10 -2
- package/build/features/app/individual/individualStore.js +63 -12
- package/build/features/brand/screens/BrandActivities/BrandActivities.js +10 -1
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +9 -2
- package/build/features/brand/screens/BrandInfo/SalesChannels.js +15 -7
- package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/individual/screens/IndividualList/CollectPhoneEmail.d.ts +10 -0
- package/build/features/individual/screens/IndividualList/CollectPhoneEmail.js +31 -0
- package/build/features/individual/screens/IndividualList/Email.d.ts +6 -0
- package/build/features/individual/screens/IndividualList/Email.js +48 -0
- package/build/features/individual/screens/IndividualList/MobileNumber.d.ts +12 -0
- package/build/features/individual/screens/IndividualList/MobileNumber.js +143 -0
- package/build/features/individual/screens/IndividualList/UserList.js +61 -15
- package/build/features/individual/screens/IndividualList/validation.d.ts +12 -0
- package/build/features/individual/screens/IndividualList/validation.js +39 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +9 -2
- package/build/features/shared/Button/ListButton.d.ts +2 -1
- package/build/features/shared/Button/ListButton.js +22 -4
- package/build/utils/string.d.ts +11 -0
- package/build/utils/string.js +7 -0
- package/build/utils/validation.d.ts +1 -0
- package/build/utils/validation.js +3 -0
- package/package.json +1 -1
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
|
-
name: string;
|
|
80
|
+
export interface IndividualEmailMobileFormValues {
|
|
82
81
|
email: string;
|
|
83
82
|
mobile: string | null;
|
|
84
83
|
countryCode: CountryCode;
|
|
84
|
+
}
|
|
85
|
+
export interface IndividualPersonalInfoFormValues extends IndividualEmailMobileFormValues {
|
|
86
|
+
name: string;
|
|
85
87
|
gender: string | null;
|
|
86
88
|
nid: string;
|
|
87
89
|
issuedCountry: CountryCode | undefined;
|
|
@@ -576,13 +576,14 @@ export var brandSlice = createSlice({
|
|
|
576
576
|
.addCase(updateBrand.fulfilled, function (state, action) {
|
|
577
577
|
state.loading = false;
|
|
578
578
|
state.error = null;
|
|
579
|
-
var
|
|
579
|
+
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
580
580
|
var brand = (state.data.verify.responseBody || {}).brand;
|
|
581
581
|
var activities = data.brand_activities;
|
|
582
582
|
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
583
583
|
var activities = (brand || {}).activities;
|
|
584
584
|
return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return activity.id === value.id; });
|
|
585
585
|
});
|
|
586
|
+
state.data.brandData = formData;
|
|
586
587
|
state.data.brandActivities.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
|
|
587
588
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { activities: data === null || data === void 0 ? void 0 : data.brand_activities });
|
|
588
589
|
})
|
|
@@ -594,7 +595,7 @@ export var brandSlice = createSlice({
|
|
|
594
595
|
state.loading = true;
|
|
595
596
|
state.error = null;
|
|
596
597
|
})
|
|
597
|
-
.addCase(updateBrandActivities.fulfilled, function (state
|
|
598
|
+
.addCase(updateBrandActivities.fulfilled, function (state) {
|
|
598
599
|
state.loading = false;
|
|
599
600
|
state.error = null;
|
|
600
601
|
})
|
|
@@ -63,7 +63,7 @@ import { CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHE
|
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
64
64
|
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, getEighteenYearsAgo, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA } from '../../../utils';
|
|
65
65
|
export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retrieveLeadIdentityByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
-
var _a, settings, connectExpress, countryCode, showBoard, data, phone, status, board_id, board_info_id, isRegistered, _b, boardInfo, boardData
|
|
66
|
+
var _a, settings, connectExpress, countryCode, showBoard, data, phone, status, board_id, board_info_id, isRegistered, _b, boardInfo, boardData;
|
|
67
67
|
var _c, _d;
|
|
68
68
|
return __generator(this, function (_e) {
|
|
69
69
|
switch (_e.label) {
|
|
@@ -95,13 +95,12 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
|
|
|
95
95
|
if (!(isRegistered && board_id && board_info_id)) return [3, 3];
|
|
96
96
|
return [4, Promise.all([
|
|
97
97
|
API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id }),
|
|
98
|
-
API.boardService.retrieveBoardDetails(board_id)
|
|
99
|
-
thunkApi.dispatch(getLeadByIdAsync(leadId)).unwrap()
|
|
98
|
+
API.boardService.retrieveBoardDetails(board_id)
|
|
100
99
|
])];
|
|
101
100
|
case 2:
|
|
102
|
-
_b = _e.sent(), boardInfo = _b[0], boardData = _b[1]
|
|
101
|
+
_b = _e.sent(), boardInfo = _b[0], boardData = _b[1];
|
|
103
102
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP'));
|
|
104
|
-
return [2, { data:
|
|
103
|
+
return [2, { data: data, countryCode: countryCode, boardInfo: boardInfo, boardData: boardData }];
|
|
105
104
|
case 3: return [2, { data: data, countryCode: countryCode }];
|
|
106
105
|
}
|
|
107
106
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState, User, IndividualPersonalInfoFormValues } from '../../../@types';
|
|
2
|
+
import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState, User, IndividualPersonalInfoFormValues, IndividualEmailMobileFormValues } from '../../../@types';
|
|
3
3
|
interface VerifyLeadTokenProps {
|
|
4
4
|
token: string;
|
|
5
5
|
isInternally?: boolean;
|
|
@@ -32,7 +32,14 @@ declare type AddDetailsParams = {
|
|
|
32
32
|
export declare const addDetailsAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
33
33
|
userList: User[];
|
|
34
34
|
}, AddDetailsParams, {}>;
|
|
35
|
-
|
|
35
|
+
declare type RequestEmail = {
|
|
36
|
+
user: User;
|
|
37
|
+
collectInfo: IndividualEmailMobileFormValues;
|
|
38
|
+
};
|
|
39
|
+
export declare const requestDetailsByEmail: import("@reduxjs/toolkit").AsyncThunk<{
|
|
40
|
+
data: any;
|
|
41
|
+
userData: any;
|
|
42
|
+
}, RequestEmail, {}>;
|
|
36
43
|
export declare const getIndividualList: import("@reduxjs/toolkit").AsyncThunk<any[], string, {}>;
|
|
37
44
|
export declare const getCityList: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
|
|
38
45
|
declare type RetrieveIndividualInfoParams = {
|
|
@@ -91,6 +98,7 @@ declare type VerifyData = {
|
|
|
91
98
|
export interface IndividualData {
|
|
92
99
|
verify: ResponseData & VerifyData;
|
|
93
100
|
otpData: OTPFormValues & ResponseData;
|
|
101
|
+
individualCollectData: IndividualEmailMobileFormValues & ResponseData;
|
|
94
102
|
individualPersonalData: IndividualPersonalInfoFormValues & ResponseData;
|
|
95
103
|
individualData: IndividualExtraFormValues & ResponseData;
|
|
96
104
|
flowName: FlowsTypes;
|
|
@@ -71,7 +71,7 @@ import API from '../../../api';
|
|
|
71
71
|
import { FlowsTypes, IndividualGender, IndividualType, FieldType } from '../../../@types';
|
|
72
72
|
import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
73
73
|
import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
74
|
-
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, getEighteenYearsAgo,
|
|
74
|
+
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, getEighteenYearsAgo, getUserNameObject, getUserName, sleep, isValidEmail } from '../../../utils';
|
|
75
75
|
export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (_a, thunkApi) {
|
|
76
76
|
var token = _a.token, isInternally = _a.isInternally;
|
|
77
77
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -214,14 +214,50 @@ export var addDetailsAsync = createAsyncThunk('individual/addDetailsAsync', func
|
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
216
|
}); });
|
|
217
|
-
export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsByEmail', function (
|
|
218
|
-
var individual, _a, merchant_id, board_id, id, type, payload, data;
|
|
219
|
-
|
|
220
|
-
|
|
217
|
+
export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsByEmail', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
218
|
+
var individual, _a, merchant_id, board_id, user, collectInfo, id, type, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody, data_1, payload, data;
|
|
219
|
+
var _c;
|
|
220
|
+
return __generator(this, function (_d) {
|
|
221
|
+
switch (_d.label) {
|
|
221
222
|
case 0:
|
|
222
223
|
individual = thunkApi.getState().individual;
|
|
223
224
|
_a = individual.data.verify.responseBody || {}, merchant_id = _a.merchant_id, board_id = _a.board_id;
|
|
225
|
+
user = params.user, collectInfo = params.collectInfo;
|
|
224
226
|
id = user.id, type = user.type;
|
|
227
|
+
_b = (user === null || user === void 0 ? void 0 : user.contact) || {}, resEmail = _b.email, resPhone = _b.phone;
|
|
228
|
+
isPhoneAndEmailAvailable = isValidEmail(resEmail) && (resPhone === null || resPhone === void 0 ? void 0 : resPhone.country_code) && (resPhone === null || resPhone === void 0 ? void 0 : resPhone.number);
|
|
229
|
+
email = collectInfo.email, mobile = collectInfo.mobile, countryCode = collectInfo.countryCode;
|
|
230
|
+
hasContact = !!email || !!mobile;
|
|
231
|
+
individualData = undefined;
|
|
232
|
+
if (!(!isPhoneAndEmailAvailable && hasContact)) return [3, 2];
|
|
233
|
+
hasPhone = mobile && (countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix);
|
|
234
|
+
requestBody = {
|
|
235
|
+
id: id,
|
|
236
|
+
type: type,
|
|
237
|
+
contact: {
|
|
238
|
+
email: email,
|
|
239
|
+
phone: hasPhone
|
|
240
|
+
? {
|
|
241
|
+
country_code: (_c = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
242
|
+
number: mobile
|
|
243
|
+
}
|
|
244
|
+
: undefined
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
return [4, API.individualService.updateIndividual(requestBody)];
|
|
248
|
+
case 1:
|
|
249
|
+
data_1 = _d.sent();
|
|
250
|
+
individualData = data_1 === null || data_1 === void 0 ? void 0 : data_1.user;
|
|
251
|
+
if (type === IndividualType.SHARE_HOLDER)
|
|
252
|
+
individualData = data_1 === null || data_1 === void 0 ? void 0 : data_1.shareholder;
|
|
253
|
+
else if (type === IndividualType.BOARD_MEMBER)
|
|
254
|
+
individualData = data_1 === null || data_1 === void 0 ? void 0 : data_1.board_member;
|
|
255
|
+
else if (type === IndividualType.BUYER)
|
|
256
|
+
individualData = data_1 === null || data_1 === void 0 ? void 0 : data_1.buyer;
|
|
257
|
+
else if (type === IndividualType.CUSTOMER)
|
|
258
|
+
individualData = data_1 === null || data_1 === void 0 ? void 0 : data_1.customer;
|
|
259
|
+
_d.label = 2;
|
|
260
|
+
case 2:
|
|
225
261
|
payload = {
|
|
226
262
|
id: board_id,
|
|
227
263
|
merchant_id: merchant_id,
|
|
@@ -239,9 +275,9 @@ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsBy
|
|
|
239
275
|
}
|
|
240
276
|
};
|
|
241
277
|
return [4, API.boardService.requestDetailsByEmail(payload)];
|
|
242
|
-
case
|
|
243
|
-
data =
|
|
244
|
-
return [2, data];
|
|
278
|
+
case 3:
|
|
279
|
+
data = _d.sent();
|
|
280
|
+
return [2, { data: data, userData: __assign(__assign({}, individualData), { type: type }) }];
|
|
245
281
|
}
|
|
246
282
|
});
|
|
247
283
|
}); });
|
|
@@ -296,6 +332,10 @@ export var retrieveIndividualInfo = createAsyncThunk('individual/retrieveIndivid
|
|
|
296
332
|
individualData = data === null || data === void 0 ? void 0 : data.shareholder;
|
|
297
333
|
else if (type === IndividualType.BOARD_MEMBER)
|
|
298
334
|
individualData = data === null || data === void 0 ? void 0 : data.board_member;
|
|
335
|
+
else if (type === IndividualType.BUYER)
|
|
336
|
+
individualData = data === null || data === void 0 ? void 0 : data.buyer;
|
|
337
|
+
else if (type === IndividualType.CUSTOMER)
|
|
338
|
+
individualData = data === null || data === void 0 ? void 0 : data.customer;
|
|
299
339
|
return [2, { data: __assign(__assign({}, (individualData || {})), { type: type }), countryCode: countryCode, countries: settings.data.countries }];
|
|
300
340
|
}
|
|
301
341
|
});
|
|
@@ -445,9 +485,9 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
445
485
|
name = params.name, email = params.email, mobile = params.mobile, countryCode = params.countryCode, gender = params.gender, nid = params.nid, issuedCountry = params.issuedCountry, expiryDate = params.expiryDate, dob = params.dob, placeOfBirthCountry = params.placeOfBirthCountry, placeOfBirthCity = params.placeOfBirthCity, nationality = params.nationality;
|
|
446
486
|
code = entity === null || entity === void 0 ? void 0 : entity.country;
|
|
447
487
|
data_status = (user || {}).data_status;
|
|
448
|
-
userName =
|
|
488
|
+
userName = getUserNameObject(name);
|
|
449
489
|
identification_id_type = nid && (nid === null || nid === void 0 ? void 0 : nid.startsWith('1')) ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
450
|
-
isNameEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.name) === FieldType.EDITABLE && userName;
|
|
490
|
+
isNameEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.name) === FieldType.EDITABLE && userName.first;
|
|
451
491
|
isEmailEditable = ((_d = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _d === void 0 ? void 0 : _d.email) === FieldType.EDITABLE;
|
|
452
492
|
isMobileNumberEditable = ((_f = (_e = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _e === void 0 ? void 0 : _e.phone) === null || _f === void 0 ? void 0 : _f.number) === FieldType.EDITABLE && mobile;
|
|
453
493
|
isMobileCountryEditable = ((_h = (_g = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _g === void 0 ? void 0 : _g.phone) === null || _h === void 0 ? void 0 : _h.country_code) === FieldType.EDITABLE;
|
|
@@ -598,6 +638,8 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
598
638
|
payload = boardMemberPayload;
|
|
599
639
|
if (type === IndividualType.BUYER)
|
|
600
640
|
payload = buyerMemberPayload;
|
|
641
|
+
if (type === IndividualType.CUSTOMER)
|
|
642
|
+
payload = {};
|
|
601
643
|
requestBody = __assign(__assign({ id: id, type: type }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
|
|
602
644
|
return [4, API.individualService.updateIndividual(requestBody)];
|
|
603
645
|
case 3:
|
|
@@ -651,6 +693,11 @@ var initialState = {
|
|
|
651
693
|
otpData: {
|
|
652
694
|
otp: ''
|
|
653
695
|
},
|
|
696
|
+
individualCollectData: {
|
|
697
|
+
email: '',
|
|
698
|
+
mobile: '',
|
|
699
|
+
countryCode: defaultCountry
|
|
700
|
+
},
|
|
654
701
|
individualPersonalData: {
|
|
655
702
|
name: '',
|
|
656
703
|
email: '',
|
|
@@ -779,10 +826,14 @@ export var individualSlice = createSlice({
|
|
|
779
826
|
.addCase(requestDetailsByEmail.fulfilled, function (state, action) {
|
|
780
827
|
state.loading = false;
|
|
781
828
|
state.error = null;
|
|
782
|
-
var
|
|
829
|
+
var _a = action.payload, data = _a.data, userData = _a.userData;
|
|
783
830
|
var userList = (state.data.verify.responseBody || {}).userList;
|
|
784
831
|
var list = userList || [];
|
|
785
|
-
list = list.map(function (user) {
|
|
832
|
+
list = list.map(function (user) {
|
|
833
|
+
var _a, _b;
|
|
834
|
+
var userInfo = user.id === (userData === null || userData === void 0 ? void 0 : userData.id) ? userData : user;
|
|
835
|
+
return user.id === ((_b = (_a = data === null || data === void 0 ? void 0 : data.notification) === null || _a === void 0 ? void 0 : _a.recipient) === null || _b === void 0 ? void 0 : _b.id) ? __assign(__assign({}, userInfo), { isRequestedEmail: true }) : userInfo;
|
|
836
|
+
});
|
|
786
837
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { requestEmailData: data, userList: list });
|
|
787
838
|
})
|
|
788
839
|
.addCase(requestDetailsByEmail.rejected, function (state, action) {
|
|
@@ -39,6 +39,7 @@ var BrandActivities = function (_a) {
|
|
|
39
39
|
var dispatch = useAppDispatch();
|
|
40
40
|
var _c = useAppSelector(brandSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
41
41
|
var brand = (data.verify.responseBody || {}).brand;
|
|
42
|
+
var _d = data.brandActivities, activities = _d.activities, customerLocations = _d.customerLocations, expectedCustomer = _d.expectedCustomer, expectedSale = _d.expectedSale, termAndConditionChecked = _d.termAndConditionChecked, refundPolicy = _d.refundPolicy, transactionPolicy = _d.transactionPolicy;
|
|
42
43
|
var ListType;
|
|
43
44
|
(function (ListType) {
|
|
44
45
|
ListType["ActivitiesList"] = "ActivitiesList";
|
|
@@ -48,7 +49,15 @@ var BrandActivities = function (_a) {
|
|
|
48
49
|
})(ListType || (ListType = {}));
|
|
49
50
|
var methods = useForm({
|
|
50
51
|
resolver: yupResolver(BrandActivitiesValidationSchema(brand)),
|
|
51
|
-
defaultValues:
|
|
52
|
+
defaultValues: {
|
|
53
|
+
activities: activities,
|
|
54
|
+
customerLocations: customerLocations,
|
|
55
|
+
expectedCustomer: expectedCustomer,
|
|
56
|
+
expectedSale: expectedSale,
|
|
57
|
+
termAndConditionChecked: termAndConditionChecked,
|
|
58
|
+
refundPolicy: refundPolicy,
|
|
59
|
+
transactionPolicy: transactionPolicy
|
|
60
|
+
},
|
|
52
61
|
mode: 'onChange'
|
|
53
62
|
});
|
|
54
63
|
useSetFromDefaultValues(methods, data.brandActivities, true);
|
|
@@ -35,10 +35,17 @@ var BrandInfo = function (_a) {
|
|
|
35
35
|
var _c = React.useState(false), brandNameChecking = _c[0], setBrandNameChecking = _c[1];
|
|
36
36
|
var dispatch = useAppDispatch();
|
|
37
37
|
var _d = useAppSelector(brandSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
38
|
-
var
|
|
38
|
+
var _e = data.brandData, brandName = _e.brandName, segment = _e.segment, teamSize = _e.teamSize, salesChannels = _e.salesChannels, termAndConditionChecked = _e.termAndConditionChecked, selectedBrandItem = _e.selectedBrandItem, responseBody = _e.responseBody;
|
|
39
39
|
var methods = useForm({
|
|
40
40
|
resolver: yupResolver(BrandValidationSchema((responseBody === null || responseBody === void 0 ? void 0 : responseBody.brand) || {})),
|
|
41
|
-
defaultValues:
|
|
41
|
+
defaultValues: {
|
|
42
|
+
brandName: brandName,
|
|
43
|
+
segment: segment,
|
|
44
|
+
teamSize: teamSize,
|
|
45
|
+
salesChannels: salesChannels,
|
|
46
|
+
termAndConditionChecked: termAndConditionChecked,
|
|
47
|
+
selectedBrandItem: selectedBrandItem
|
|
48
|
+
},
|
|
42
49
|
mode: 'onChange'
|
|
43
50
|
});
|
|
44
51
|
useSetFromDefaultValues(methods, data.brandData);
|
|
@@ -8,14 +8,22 @@ import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
|
8
8
|
import SalesChannel from '../../../shared/SalesChannels';
|
|
9
9
|
var SalesChannels = function (_a) {
|
|
10
10
|
var _b, _c;
|
|
11
|
-
var
|
|
11
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue, getValues = _d.getValues;
|
|
12
12
|
var dispatch = useAppDispatch();
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
13
|
+
var _e = useController({ control: control, name: 'salesChannels' }), fieldState = _e.fieldState, field = _e.field;
|
|
14
|
+
var _f = useAppSelector(brandSelector), data = _f.data, error = _f.error;
|
|
15
|
+
var verify = data.verify, brandData = data.brandData;
|
|
16
|
+
var selectedBrandItem = brandData.selectedBrandItem, defaultSalesChannels = brandData.salesChannels;
|
|
17
|
+
var _g = verify.responseBody || {}, channelList = _g.channel_list, brand = _g.brand;
|
|
18
18
|
var isNonEditable = ((_b = brand === null || brand === void 0 ? void 0 : brand.data_status) === null || _b === void 0 ? void 0 : _b.name) === FieldType.NON_EDITABLE;
|
|
19
|
+
var selectedBrandControl = getValues('selectedBrandItem');
|
|
20
|
+
React.useEffect(function () {
|
|
21
|
+
if (selectedBrandItem.id) {
|
|
22
|
+
setValue('selectedBrandItem', selectedBrandItem);
|
|
23
|
+
var sales = mapSalesChannel(selectedBrandItem.channel_services || []);
|
|
24
|
+
field.onChange(sales);
|
|
25
|
+
}
|
|
26
|
+
}, [selectedBrandItem]);
|
|
19
27
|
React.useEffect(function () {
|
|
20
28
|
if ((defaultSalesChannels === null || defaultSalesChannels === void 0 ? void 0 : defaultSalesChannels.length) > 0) {
|
|
21
29
|
var sales = mapSalesChannel(defaultSalesChannels);
|
|
@@ -28,6 +36,6 @@ var SalesChannels = function (_a) {
|
|
|
28
36
|
dispatch(clearError());
|
|
29
37
|
field.onChange(channels);
|
|
30
38
|
};
|
|
31
|
-
return (_jsx(SalesChannel, { disabled: isNonEditable, error: (_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
|
|
39
|
+
return (_jsx(SalesChannel, { disabled: isNonEditable, error: (_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message, list: channelList, selectFirstIconListener: selectedBrandControl === null || selectedBrandControl === void 0 ? void 0 : selectedBrandControl.id, onChange: onChange, defaultValue: selectedSalesChannels }));
|
|
32
40
|
};
|
|
33
41
|
export default SalesChannels;
|
package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js
CHANGED
|
@@ -18,8 +18,8 @@ import { FlowsTypes } from '../../../../@types';
|
|
|
18
18
|
var SuccessWithFlowButtons = function () {
|
|
19
19
|
var data = useAppSelector(connectExpressSelector).data;
|
|
20
20
|
var _a = data.responseData || {}, boardData = _a.boardData, leadData = _a.leadData, boardInfo = _a.boardInfo;
|
|
21
|
-
var
|
|
22
|
-
var
|
|
21
|
+
var name = (leadData || {}).name;
|
|
22
|
+
var _b = boardData || {}, business = _b.business, merchant = _b.merchant, bank = _b.bank_account, user = _b.user, individuals = _b.individuals, entity = _b.entity, brand = _b.brand;
|
|
23
23
|
var flows = (boardInfo || {}).info;
|
|
24
24
|
var boardInfoId = boardInfo === null || boardInfo === void 0 ? void 0 : boardInfo.id;
|
|
25
25
|
var boardId = boardData === null || boardData === void 0 ? void 0 : boardData.id;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { User } from '../../../../@types';
|
|
3
|
+
export interface CollectPhoneEmailProps {
|
|
4
|
+
activeUser?: User;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: React.MemoExoticComponent<{
|
|
7
|
+
({ activeUser }: CollectPhoneEmailProps): JSX.Element;
|
|
8
|
+
defaultProps: {};
|
|
9
|
+
}>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { settingsSelector } from '../../../../app/settings';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import { useAppSelector } from '../../../../hooks';
|
|
17
|
+
import { isValidEmail } from '../../../../utils';
|
|
18
|
+
import MobileNumber from './MobileNumber';
|
|
19
|
+
import Email from './Email';
|
|
20
|
+
var CollectPhoneEmail = function (_a) {
|
|
21
|
+
var activeUser = _a.activeUser;
|
|
22
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
23
|
+
var countries = settingsData.countries;
|
|
24
|
+
var _b = (activeUser === null || activeUser === void 0 ? void 0 : activeUser.contact) || { email: '' }, email = _b.email, phone = _b.phone;
|
|
25
|
+
var isPhoneAvailable = (phone === null || phone === void 0 ? void 0 : phone.country_code) && (phone === null || phone === void 0 ? void 0 : phone.number);
|
|
26
|
+
var isEmailAvailable = isValidEmail(email);
|
|
27
|
+
var _c = React.useState(), listActive = _c[0], setListActive = _c[1];
|
|
28
|
+
return (_jsxs(Box, __assign({ sx: { mb: 0 } }, { children: [_jsx(MobileNumber, { sx: { mb: isEmailAvailable ? 0 : 3 }, show: !isPhoneAvailable, countries: countries, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(Email, { show: !listActive && !isEmailAvailable })] })));
|
|
29
|
+
};
|
|
30
|
+
export default React.memo(CollectPhoneEmail);
|
|
31
|
+
CollectPhoneEmail.defaultProps = {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
17
|
+
import { useAppSelector } from '../../../../hooks';
|
|
18
|
+
import Collapse from '../../../../components/Collapse';
|
|
19
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
|
+
import Input from '../../../shared/Input';
|
|
21
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
22
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
23
|
+
import { individualSelector } from '../../../app/individual/individualStore';
|
|
24
|
+
var InputStyled = styled(Input)(function () { return ({
|
|
25
|
+
input: {
|
|
26
|
+
textTransform: 'lowercase'
|
|
27
|
+
}
|
|
28
|
+
}); });
|
|
29
|
+
var Email = function (_a) {
|
|
30
|
+
var _b;
|
|
31
|
+
var show = _a.show;
|
|
32
|
+
var t = useTranslation().t;
|
|
33
|
+
var control = useFormContext().control;
|
|
34
|
+
var emailControl = useController({ name: 'email', control: control });
|
|
35
|
+
var data = useAppSelector(individualSelector).data;
|
|
36
|
+
var emailValue = emailControl.field.value;
|
|
37
|
+
var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
38
|
+
var verify = data.verify;
|
|
39
|
+
var user = (verify.responseBody || {}).user;
|
|
40
|
+
var handleEmailChange = function (event) {
|
|
41
|
+
emailControl.field.onChange(event.target.value);
|
|
42
|
+
};
|
|
43
|
+
var clearNumber = function () {
|
|
44
|
+
emailControl.field.onChange('');
|
|
45
|
+
};
|
|
46
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && emailValue ? _jsx(CheckIcon, {}) : emailValue && _jsx(ClearIcon, { onClick: clearNumber }) }) }) })));
|
|
47
|
+
};
|
|
48
|
+
export default React.memo(Email);
|
|
@@ -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);
|
|
@@ -20,19 +20,24 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
20
20
|
};
|
|
21
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
import * as React from 'react';
|
|
23
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
23
24
|
import { useTranslation } from 'react-i18next';
|
|
25
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
24
26
|
import { alpha, styled, useTheme } from '@mui/material/styles';
|
|
25
27
|
import Box from '@mui/material/Box';
|
|
26
|
-
import { getUserName } from '../../../../utils';
|
|
27
|
-
import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
28
|
+
import { getUserName, isValidEmail } from '../../../../utils';
|
|
29
|
+
import { useLanguage, useAppSelector, useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
|
|
28
30
|
import { IndividualType } from '../../../../@types';
|
|
29
31
|
import Collapse from '../../../../components/Collapse';
|
|
30
32
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
33
|
+
import Form from '../../../../components/Form';
|
|
31
34
|
import Text from '../../../../components/Text';
|
|
32
35
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
33
36
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
34
37
|
import { addDetailsAsync, individualSelector, requestDetailsByEmail, resetIndividualData } from '../../../app/individual/individualStore';
|
|
35
38
|
import ListButton from '../../../shared/Button/ListButton';
|
|
39
|
+
import { IndividualCollectInfoValidationSchema } from './validation';
|
|
40
|
+
import CollectPhoneEmail from './CollectPhoneEmail';
|
|
36
41
|
var ScreenContainerStyled = styled(ScreenContainer)(function (_a) {
|
|
37
42
|
var theme = _a.theme;
|
|
38
43
|
return ({
|
|
@@ -58,29 +63,46 @@ var RoleTextStyled = styled(Text)(function (_a) {
|
|
|
58
63
|
var theme = _a.theme;
|
|
59
64
|
return (__assign(__assign({}, theme.typography.subtitle2), { display: 'inline', paddingInlineStart: theme.spacing(1.5), color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default }));
|
|
60
65
|
});
|
|
66
|
+
var CollapseStyled = styled(Collapse)(function () { return ({
|
|
67
|
+
width: '100%'
|
|
68
|
+
}); });
|
|
61
69
|
var IndividualRequestType;
|
|
62
70
|
(function (IndividualRequestType) {
|
|
63
71
|
IndividualRequestType[IndividualRequestType["ADD"] = 0] = "ADD";
|
|
64
72
|
IndividualRequestType[IndividualRequestType["REQUEST_EMAIL"] = 1] = "REQUEST_EMAIL";
|
|
73
|
+
IndividualRequestType[IndividualRequestType["COLLECT_EMAIL_MOBILE"] = 2] = "COLLECT_EMAIL_MOBILE";
|
|
65
74
|
})(IndividualRequestType || (IndividualRequestType = {}));
|
|
66
75
|
var UserList = function (_a) {
|
|
67
76
|
var _b = React.useState([]), usersMenuList = _b[0], setUsersMenuList = _b[1];
|
|
68
77
|
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
69
|
-
var _d = React.useState(),
|
|
70
|
-
var _e = React.useState(
|
|
78
|
+
var _d = React.useState(false), showCollectForm = _d[0], setShowCollectForm = _d[1];
|
|
79
|
+
var _e = React.useState(), activeUser = _e[0], setActiveUser = _e[1];
|
|
80
|
+
var _f = React.useState(IndividualRequestType.ADD), type = _f[0], setType = _f[1];
|
|
71
81
|
var t = useTranslation().t;
|
|
72
82
|
var isAr = useLanguage().isAr;
|
|
73
83
|
var dispatch = useAppDispatch();
|
|
74
84
|
var theme = useTheme();
|
|
75
|
-
var
|
|
85
|
+
var _g = useAppSelector(individualSelector), data = _g.data, loading = _g.loading;
|
|
86
|
+
var _h = data.individualCollectData, email = _h.email, mobile = _h.mobile;
|
|
76
87
|
var verify = data.verify;
|
|
77
88
|
var userList = (verify.responseBody || {}).userList;
|
|
89
|
+
var methods = useForm({
|
|
90
|
+
resolver: yupResolver(IndividualCollectInfoValidationSchema(activeUser)),
|
|
91
|
+
defaultValues: {
|
|
92
|
+
email: email,
|
|
93
|
+
mobile: mobile
|
|
94
|
+
},
|
|
95
|
+
mode: 'onChange'
|
|
96
|
+
});
|
|
97
|
+
useSetFromDefaultValues(methods, data.individualCollectData);
|
|
78
98
|
React.useEffect(function () {
|
|
79
99
|
if ((userList === null || userList === void 0 ? void 0 : userList.length) > 0) {
|
|
80
100
|
var list = __spreadArray([], userList, true);
|
|
81
101
|
setUsersMenuList(list);
|
|
82
|
-
|
|
83
|
-
|
|
102
|
+
var user = list.find(function (user) { return user.id === (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id); }) || list[0];
|
|
103
|
+
setActiveUser(user);
|
|
104
|
+
if (!isPhoneAndEmailAvailable(user))
|
|
105
|
+
resetFormData();
|
|
84
106
|
}
|
|
85
107
|
}, [userList]);
|
|
86
108
|
var onOpenUserAction = function (event) {
|
|
@@ -89,7 +111,15 @@ var UserList = function (_a) {
|
|
|
89
111
|
var onCloseUserAction = function () {
|
|
90
112
|
setAnchorEl(null);
|
|
91
113
|
};
|
|
114
|
+
var resetFormData = function () {
|
|
115
|
+
if (showCollectForm) {
|
|
116
|
+
methods.setValue('email', '', { shouldValidate: true });
|
|
117
|
+
methods.setValue('mobile', '', { shouldValidate: true });
|
|
118
|
+
setShowCollectForm(false);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
92
121
|
var onClickUser = function (user, e) {
|
|
122
|
+
resetFormData();
|
|
93
123
|
setAnchorEl(null);
|
|
94
124
|
setActiveUser(user);
|
|
95
125
|
onOpenUserAction(e);
|
|
@@ -102,16 +132,27 @@ var UserList = function (_a) {
|
|
|
102
132
|
}
|
|
103
133
|
};
|
|
104
134
|
var onRequestEmail = function () {
|
|
135
|
+
if (!isPhoneAndEmailAvailable(activeUser) && !methods.formState.isValid) {
|
|
136
|
+
setShowCollectForm(true);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
105
139
|
setType(IndividualRequestType.REQUEST_EMAIL);
|
|
106
140
|
if (activeUser) {
|
|
107
|
-
|
|
108
|
-
|
|
141
|
+
var values = methods.getValues();
|
|
142
|
+
dispatch(requestDetailsByEmail({ user: activeUser, collectInfo: __assign({}, values) }));
|
|
109
143
|
}
|
|
110
144
|
};
|
|
111
145
|
var getName = function (user) {
|
|
112
146
|
var name = getUserName(user, isAr);
|
|
113
147
|
return name;
|
|
114
148
|
};
|
|
149
|
+
var isActiveUser = function (user) {
|
|
150
|
+
return (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id;
|
|
151
|
+
};
|
|
152
|
+
var isPhoneAndEmailAvailable = function (user) {
|
|
153
|
+
var _a = (user === null || user === void 0 ? void 0 : user.contact) || { email: '' }, resEmail = _a.email, phone = _a.phone;
|
|
154
|
+
return isValidEmail(resEmail) && (phone === null || phone === void 0 ? void 0 : phone.country_code) && (phone === null || phone === void 0 ? void 0 : phone.number);
|
|
155
|
+
};
|
|
115
156
|
var getUserRole = function (user) {
|
|
116
157
|
var _a, _b, _c, _d, _e;
|
|
117
158
|
if ((((_a = user === null || user === void 0 ? void 0 : user.role) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0)
|
|
@@ -122,18 +163,23 @@ var UserList = function (_a) {
|
|
|
122
163
|
return t('type_board_member');
|
|
123
164
|
return t('type_user');
|
|
124
165
|
};
|
|
166
|
+
var getCollectForm = function (user) {
|
|
167
|
+
var show = showCollectForm && isActiveUser(user);
|
|
168
|
+
return (_jsx(CollapseStyled, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 1.5, mt: 0 } }, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsx(Form, { children: _jsx(CollectPhoneEmail, { activeUser: activeUser }) }) })) })) })));
|
|
169
|
+
};
|
|
170
|
+
var disabled = showCollectForm && !isPhoneAndEmailAvailable(activeUser) && !methods.formState.isValid;
|
|
125
171
|
return (_jsx(ScreenContainerStyled, { children: usersMenuList.map(function (user, index) {
|
|
126
|
-
return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ onClick: !!anchorEl && (
|
|
127
|
-
show: true,
|
|
172
|
+
return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ 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: {
|
|
128
173
|
title: t('add_details'),
|
|
129
174
|
onClick: onAddDetails,
|
|
130
|
-
loading: (
|
|
175
|
+
loading: isActiveUser(user) && loading && type === IndividualRequestType.ADD
|
|
131
176
|
}, requestEmail: {
|
|
132
|
-
|
|
177
|
+
children: getCollectForm(user),
|
|
133
178
|
title: t('request_details_by_email'),
|
|
134
179
|
isRequested: (user === null || user === void 0 ? void 0 : user.isRequestedEmail) || false,
|
|
135
|
-
|
|
136
|
-
|
|
180
|
+
disabled: disabled,
|
|
181
|
+
onClick: onRequestEmail,
|
|
182
|
+
loading: isActiveUser(user) && loading && type === IndividualRequestType.REQUEST_EMAIL
|
|
137
183
|
} }) }))] }), index));
|
|
138
184
|
}) }));
|
|
139
185
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
import { User } from '../../../../@types';
|
|
3
|
+
export declare const IndividualCollectInfoValidationSchema: (activeUser?: User) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
4
|
+
mobile: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
5
|
+
email: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
6
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
mobile: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
8
|
+
email: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
9
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
10
|
+
mobile: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
11
|
+
email: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
12
|
+
}>>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export var IndividualCollectInfoValidationSchema = function (activeUser) {
|
|
3
|
+
var _a = (activeUser === null || activeUser === void 0 ? void 0 : activeUser.contact) || {}, phone = _a.phone, email = _a.email;
|
|
4
|
+
var isPhoneAvailable = (phone === null || phone === void 0 ? void 0 : phone.number) && (phone === null || phone === void 0 ? void 0 : phone.country_code);
|
|
5
|
+
var isEmailAvailable = !!email;
|
|
6
|
+
return yup.object().shape({
|
|
7
|
+
mobile: isPhoneAvailable
|
|
8
|
+
? yup.string().optional()
|
|
9
|
+
: yup
|
|
10
|
+
.string()
|
|
11
|
+
.test({
|
|
12
|
+
test: function (value) {
|
|
13
|
+
if (((value === null || value === void 0 ? void 0 : value.length) || 0) > 0) {
|
|
14
|
+
var countryCode = this.parent.countryCode;
|
|
15
|
+
var isSA = countryCode.iso2 === 'SA';
|
|
16
|
+
var digits = countryCode.digits;
|
|
17
|
+
var mobileValue = value || '';
|
|
18
|
+
var valueLen = mobileValue.length;
|
|
19
|
+
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
20
|
+
if (!isNumber)
|
|
21
|
+
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
22
|
+
var isStartWithZero = mobileValue.startsWith('05');
|
|
23
|
+
var isStartWith5 = mobileValue.startsWith('5');
|
|
24
|
+
var isSaudiNumber = isStartWith5 || isStartWithZero;
|
|
25
|
+
if (isSA) {
|
|
26
|
+
if (!isSaudiNumber)
|
|
27
|
+
return this.createError({ message: 'start_with_number' });
|
|
28
|
+
var requiredLen = isStartWith5 ? digits - 1 : digits;
|
|
29
|
+
return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
30
|
+
}
|
|
31
|
+
return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.required(),
|
|
37
|
+
email: isEmailAvailable ? yup.string().optional() : yup.string().email('email_not_valid').required()
|
|
38
|
+
});
|
|
39
|
+
};
|
|
@@ -47,6 +47,7 @@ export var RoleTextStyled = styled(Text)(function (_a) {
|
|
|
47
47
|
});
|
|
48
48
|
var ListType;
|
|
49
49
|
(function (ListType) {
|
|
50
|
+
ListType["MobileCountryList"] = "MobileCountryList";
|
|
50
51
|
ListType["IssuedCountryList"] = "IssuedCountryList";
|
|
51
52
|
ListType["BirthCountryList"] = "BirthCountryList";
|
|
52
53
|
ListType["BirthCityList"] = "BirthCityList";
|
|
@@ -121,12 +122,18 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
121
122
|
return t('type_user');
|
|
122
123
|
};
|
|
123
124
|
var disabled = !methods.formState.isValid || cityLoading;
|
|
124
|
-
var
|
|
125
|
+
var isDateFieldActive = dobActive || expiryDateActive;
|
|
126
|
+
var showField = !listActive && !isDateFieldActive;
|
|
127
|
+
var isMobileCountryListActive = listActive === ListType.MobileCountryList;
|
|
125
128
|
var isIssuedCountryListActive = listActive === ListType.IssuedCountryList;
|
|
126
129
|
var isBirthCountryListActive = listActive === ListType.BirthCountryList;
|
|
127
130
|
var isBirthCityListActive = listActive === ListType.BirthCityList;
|
|
128
131
|
var isNationalityListActive = listActive === ListType.NationalityList;
|
|
129
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: showField && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserOccupation() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField }), _jsx(MobileNumber, { show:
|
|
132
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: showField && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserOccupation() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField }), _jsx(MobileNumber, { show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Email, { show: showField }), _jsx(Gender, { show: showField }), _jsx(ID, { show: showField }), _jsx(IssuedCountry, { show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpiryDate, { show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive }), _jsx(DOB, { show: !listActive && !expiryDateActive, onDateClicked: handleDobActive }), _jsx(BirthCountry, { show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BirthCity, { show: !isMobileCountryListActive &&
|
|
133
|
+
!isDateFieldActive &&
|
|
134
|
+
!isIssuedCountryListActive &&
|
|
135
|
+
!isBirthCountryListActive &&
|
|
136
|
+
!isNationalityListActive, onListOpen: function () { return handleMenuClick(ListType.BirthCityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Nationality, { show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isBirthCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.NationalityList); }, onListClose: function () { return handleMenuClick(); } })] }), _jsx(Collapse, __assign({ in: showField, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: !(user === null || user === void 0 ? void 0 : user.is_authorized), disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
|
|
130
137
|
};
|
|
131
138
|
export default React.memo(IndividualPersonalInfo);
|
|
132
139
|
IndividualPersonalInfo.defaultProps = {};
|
|
@@ -3,7 +3,8 @@ import { ButtonProps } from '../../../components/Button';
|
|
|
3
3
|
declare type buttonProps = {
|
|
4
4
|
title: string;
|
|
5
5
|
loading: boolean;
|
|
6
|
-
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
children?: React.ReactNode;
|
|
7
8
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
8
9
|
};
|
|
9
10
|
interface ListButtonProps extends ButtonProps {
|
|
@@ -79,16 +79,17 @@ export default function ListButton(_a) {
|
|
|
79
79
|
var t = useTranslation().t;
|
|
80
80
|
var theme = useTheme();
|
|
81
81
|
var requestEmailLoaderColor = requestEmail.isRequested && !requestEmail.loading ? theme.palette.success.main : theme.palette.primary.main;
|
|
82
|
-
return (_jsxs(ButtonBoxStyled, { children: [_jsxs(ButtonStyled, __assign({ isLoading: addDetails.loading, sx: { mb: 1.5 }, type: 'button', variant: 'outlined', onClick: addDetails.onClick, startIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(Image, { src: ICONS_NAMES.ADD_DETAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(ArrowIconStyled, { isAr: isAr, src: ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: addDetails.loading }, { children: _jsx(Loader, { style: {
|
|
82
|
+
return (_jsxs(ButtonBoxStyled, { children: [addDetails.children, _jsxs(ButtonStyled, __assign({ isLoading: addDetails.loading, sx: { mb: 1.5 }, type: 'button', variant: 'outlined', onClick: addDetails.onClick, startIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(Image, { src: ICONS_NAMES.ADD_DETAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(ArrowIconStyled, { isAr: isAr, src: ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: addDetails.loading }, { children: _jsx(Loader, { style: {
|
|
83
83
|
width: theme.spacing(3.75),
|
|
84
84
|
height: theme.spacing(3.75)
|
|
85
|
-
}, innerColor: theme.palette.primary.main, outerColor: theme.palette.primary.main, size: 15, toggleAnimation: addDetails.loading }) })), _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(TextStyled, { children: t(addDetails.title) }) }))] })), requestEmail.
|
|
85
|
+
}, innerColor: theme.palette.primary.main, outerColor: theme.palette.primary.main, size: 15, toggleAnimation: addDetails.loading }) })), _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(TextStyled, { children: t(addDetails.title) }) }))] })), requestEmail.children, _jsxs(ButtonStyled, __assign({ isLoading: requestEmail.loading, variant: 'outlined', type: 'button', sx: requestEmail.isRequested && !requestEmail.loading
|
|
86
86
|
? {
|
|
87
87
|
'&.MuiButton-outlined': {
|
|
88
88
|
backgroundColor: theme.palette.common.white,
|
|
89
89
|
border: "1px solid ".concat(theme.palette.success.main),
|
|
90
90
|
color: theme.palette.success.main,
|
|
91
91
|
'&:hover': {
|
|
92
|
+
cursor: 'pointer',
|
|
92
93
|
backgroundColor: theme.palette.success.main,
|
|
93
94
|
color: theme.palette.common.white,
|
|
94
95
|
img: {
|
|
@@ -100,8 +101,25 @@ export default function ListButton(_a) {
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
|
-
: {
|
|
104
|
+
: {
|
|
105
|
+
opacity: requestEmail.disabled ? 0.5 : 1,
|
|
106
|
+
'&.MuiButton-outlined': requestEmail.disabled
|
|
107
|
+
? {
|
|
108
|
+
'&:hover': {
|
|
109
|
+
cursor: 'default',
|
|
110
|
+
backgroundColor: theme.palette.common.white,
|
|
111
|
+
color: theme.palette.primary.main,
|
|
112
|
+
img: {
|
|
113
|
+
filter: 'none'
|
|
114
|
+
},
|
|
115
|
+
svg: {
|
|
116
|
+
filter: 'none'
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
: {}
|
|
121
|
+
}, onClick: requestEmail.onClick, startIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(Image, { src: requestEmail.isRequested && !requestEmail.loading ? ICONS_NAMES.REQUEST_EMAIL_GREEN : ICONS_NAMES.REQUEST_EMAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: requestEmail.isRequested && !requestEmail.loading ? _jsx(CheckIconStyled, {}) : _jsx(ArrowIconStyled, { isAr: isAr, src: ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: requestEmail.loading }, { children: _jsx(Loader, { style: {
|
|
104
122
|
width: theme.spacing(3.75),
|
|
105
123
|
height: theme.spacing(3.75)
|
|
106
|
-
}, innerColor: requestEmailLoaderColor, outerColor: requestEmailLoaderColor, size: 15, toggleAnimation: requestEmail.loading }) })), _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(TextStyled, { children: t(requestEmail.title) }) }))] }))
|
|
124
|
+
}, innerColor: requestEmailLoaderColor, outerColor: requestEmailLoaderColor, size: 15, toggleAnimation: requestEmail.loading }) })), _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(TextStyled, { children: t(requestEmail.title) }) }))] }))] }));
|
|
107
125
|
}
|
package/build/utils/string.d.ts
CHANGED
|
@@ -57,3 +57,14 @@ export declare const isPhysicalStore: (flag: string) => boolean;
|
|
|
57
57
|
export declare const isCallCenter: (flag: string) => boolean;
|
|
58
58
|
export declare const getChannelIcon: (channel: string) => string;
|
|
59
59
|
export declare const getUserName: (user: User, isAr: boolean) => string;
|
|
60
|
+
export declare const getUserNameObject: (name: string) => {
|
|
61
|
+
first?: undefined;
|
|
62
|
+
middle?: undefined;
|
|
63
|
+
third?: undefined;
|
|
64
|
+
last?: undefined;
|
|
65
|
+
} | {
|
|
66
|
+
first: string;
|
|
67
|
+
middle: string;
|
|
68
|
+
third: string;
|
|
69
|
+
last: string;
|
|
70
|
+
};
|
package/build/utils/string.js
CHANGED
|
@@ -271,3 +271,10 @@ export var getUserName = function (user, isAr) {
|
|
|
271
271
|
var name = isAr ? nameAR || nameEN : nameEN;
|
|
272
272
|
return name;
|
|
273
273
|
};
|
|
274
|
+
export var getUserNameObject = function (name) {
|
|
275
|
+
if (!name)
|
|
276
|
+
return {};
|
|
277
|
+
var _a = name.split(' '), first = _a[0], middle = _a[1], third = _a[2], rest = _a.slice(3);
|
|
278
|
+
var lastName = rest.join(' ') || '';
|
|
279
|
+
return { first: first, middle: middle || '', third: third || '', last: lastName };
|
|
280
|
+
};
|
|
@@ -15,3 +15,4 @@ export declare const keepLettersAndSpace: (str: string) => string;
|
|
|
15
15
|
export declare const isTapDomain: (domain: string) => boolean;
|
|
16
16
|
export declare const removeArabicWords: (str: string) => string;
|
|
17
17
|
export declare const removeAllOtherThanArabicWords: (str: string) => string;
|
|
18
|
+
export declare const isValidEmail: (email: string) => boolean;
|