@tap-payments/auth-jsconnect 2.3.36-test → 2.3.37-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/features/app/connectExpress/connectExpressStore.js +6 -11
- package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.d.ts +2 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +5 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.d.ts +2 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +4 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.d.ts +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +2 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.js +3 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.d.ts +2 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +3 -1
- package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +9 -5
- package/build/features/connectExpress/screens/CollectIndividualInfo/Email.d.ts +2 -1
- package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +2 -2
- package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.d.ts +1 -0
- package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.js +6 -2
- package/build/features/connectExpress/screens/CollectIndividualInfo/Name.d.ts +2 -1
- package/build/features/connectExpress/screens/CollectIndividualInfo/Name.js +2 -2
- package/build/features/connectExpress/screens/Mobile/Mobile.js +4 -2
- package/build/features/connectExpress/screens/Mobile/MobileNumber.d.ts +1 -0
- package/build/features/connectExpress/screens/Mobile/MobileNumber.js +6 -2
- package/build/features/connectExpress/screens/Mobile/TAC.d.ts +2 -1
- package/build/features/connectExpress/screens/Mobile/TAC.js +3 -1
- package/build/features/connectExpress/screens/NID/DOB.d.ts +2 -1
- package/build/features/connectExpress/screens/NID/DOB.js +2 -2
- package/build/features/connectExpress/screens/NID/IDNumber.d.ts +1 -0
- package/build/features/connectExpress/screens/NID/IDNumber.js +2 -2
- package/build/features/connectExpress/screens/NID/NID.js +4 -2
- package/build/features/connectExpress/screens/NID/TAC.d.ts +2 -1
- package/build/features/connectExpress/screens/NID/TAC.js +3 -1
- package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +4 -2
- package/package.json +2 -2
|
@@ -1048,23 +1048,18 @@ export var connectSlice = createSlice({
|
|
|
1048
1048
|
}
|
|
1049
1049
|
licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
|
|
1050
1050
|
var _f = ((_b = state.data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) || {}, license_number = _f.license_number, license_type = _f.license_type;
|
|
1051
|
-
var selectedLicense = licenseList[0];
|
|
1052
1051
|
if (license_number) {
|
|
1053
1052
|
var findLicense = licenseList.find(function (_a) {
|
|
1054
1053
|
var license = _a.license;
|
|
1055
1054
|
return (license === null || license === void 0 ? void 0 : license.number) === license_number;
|
|
1056
1055
|
});
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1056
|
+
var selectedLicense = (findLicense !== null && findLicense !== void 0 ? findLicense : license_type === 'freelance')
|
|
1057
|
+
? __assign(__assign({}, OTHER_FL_LICENSE), { license: { number: license_number } }) : __assign(__assign({}, OTHER_CR_LICENSE), { license: { number: license_number } });
|
|
1058
|
+
state.data.businessData.selectedLicense = selectedLicense;
|
|
1059
|
+
var isOtherLicense = ((_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number) === 'other_fl' || ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) === 'other_cr';
|
|
1060
|
+
if (!isOtherLicense)
|
|
1061
|
+
state.data.businessData.licenseNumber = ((_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.number) || '';
|
|
1063
1062
|
}
|
|
1064
|
-
state.data.businessData.selectedLicense = selectedLicense;
|
|
1065
|
-
var isOtherLicense = ((_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number) === 'other_fl' || ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) === 'other_cr';
|
|
1066
|
-
if (!isOtherLicense)
|
|
1067
|
-
state.data.businessData.licenseNumber = ((_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.number) || '';
|
|
1068
1063
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { licenseList: licenseList });
|
|
1069
1064
|
})
|
|
1070
1065
|
.addCase(retrieveEntityListAsync.rejected, function (state, action) {
|
|
@@ -3,6 +3,7 @@ interface BrandNameProps {
|
|
|
3
3
|
show: boolean;
|
|
4
4
|
fetchingBrandName: (flag: boolean) => void;
|
|
5
5
|
brandNameChecking: boolean;
|
|
6
|
+
readOnly?: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const _default: React.MemoExoticComponent<({ show, brandNameChecking, fetchingBrandName }: BrandNameProps) => JSX.Element>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ show, brandNameChecking, fetchingBrandName, readOnly }: BrandNameProps) => JSX.Element>;
|
|
8
9
|
export default _default;
|
|
@@ -98,7 +98,7 @@ var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
|
98
98
|
var cancelToken = null;
|
|
99
99
|
var BrandName = function (_a) {
|
|
100
100
|
var _b;
|
|
101
|
-
var show = _a.show, brandNameChecking = _a.brandNameChecking, fetchingBrandName = _a.fetchingBrandName;
|
|
101
|
+
var show = _a.show, brandNameChecking = _a.brandNameChecking, fetchingBrandName = _a.fetchingBrandName, readOnly = _a.readOnly;
|
|
102
102
|
var dispatch = useAppDispatch();
|
|
103
103
|
var _c = React.useState(false), isHovered = _c[0], setIsHovered = _c[1];
|
|
104
104
|
var t = useTranslation().t;
|
|
@@ -135,6 +135,6 @@ var BrandName = function (_a) {
|
|
|
135
135
|
var clearBrandName = function () {
|
|
136
136
|
brandControl.field.onChange('');
|
|
137
137
|
};
|
|
138
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 2.5 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, value: brandNameValue || '', placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: brandNameChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && brandNameValue ? (_jsx(CheckIcon, {})) : (brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName })) })] })) })));
|
|
138
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 2.5 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, readOnly: readOnly, value: brandNameValue || '', placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: brandNameChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && brandNameValue ? (_jsx(CheckIcon, {})) : (brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName })) })] })) })));
|
|
139
139
|
};
|
|
140
140
|
export default React.memo(BrandName);
|
|
@@ -14,7 +14,7 @@ import * as React from 'react';
|
|
|
14
14
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage } from '../../../../hooks';
|
|
17
|
+
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
18
18
|
import { isSA } from '../../../../utils';
|
|
19
19
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
20
|
import Form from '../../../../components/Form';
|
|
@@ -69,12 +69,14 @@ var CollectBusinessInfo = function (_a) {
|
|
|
69
69
|
var onBack = function () {
|
|
70
70
|
dispatch(handlePrevScreenStep());
|
|
71
71
|
};
|
|
72
|
+
var originalReadOnly = useFormReadOnly(methods);
|
|
73
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
72
74
|
var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
|
|
73
75
|
var disabled = brandErrChecks || brandNameChecking || isBrandNameAvailable == false;
|
|
74
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { show: true, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(LicenseList, { onListOpen: function () {
|
|
76
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'], show: true, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(LicenseList, { readOnly: readOnly['selectedLicense'], onListOpen: function () {
|
|
75
77
|
setListActive(true);
|
|
76
78
|
}, onListClose: function () {
|
|
77
79
|
setListActive(false);
|
|
78
|
-
} }), _jsx(TAC, { show: !isLeadIdPassed }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
80
|
+
} }), _jsx(TAC, { show: !isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
79
81
|
};
|
|
80
82
|
export default React.memo(CollectBusinessInfo);
|
|
@@ -3,6 +3,7 @@ interface LicenseListProps {
|
|
|
3
3
|
onSelectLicense?: (number: string) => void;
|
|
4
4
|
onListOpen?: () => void;
|
|
5
5
|
onListClose?: () => void;
|
|
6
|
+
readOnly?: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const _default: React.MemoExoticComponent<({ ...rest }: LicenseListProps) => JSX.Element>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ readOnly, ...rest }: LicenseListProps) => JSX.Element>;
|
|
8
9
|
export default _default;
|
|
@@ -58,7 +58,7 @@ var LicenseNameText = styled(Text, { shouldForwardProp: function (prop) { return
|
|
|
58
58
|
return (__assign(__assign({ display: 'flex', color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
59
59
|
});
|
|
60
60
|
var LicenseList = function (_a) {
|
|
61
|
-
var rest = __rest(_a, []);
|
|
61
|
+
var readOnly = _a.readOnly, rest = __rest(_a, ["readOnly"]);
|
|
62
62
|
var _b = useAppSelector(connectExpressSelector), data = _b.data, error = _b.error;
|
|
63
63
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
64
64
|
var businessData = data.businessData, responseData = data.responseData;
|
|
@@ -73,6 +73,8 @@ var LicenseList = function (_a) {
|
|
|
73
73
|
var country_code = settingsData.businessCountry.iso2;
|
|
74
74
|
var onOpenLicenseList = function (event) {
|
|
75
75
|
var _a;
|
|
76
|
+
if (readOnly)
|
|
77
|
+
return;
|
|
76
78
|
setAnchorEl(event.currentTarget);
|
|
77
79
|
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
78
80
|
};
|
|
@@ -139,6 +141,6 @@ var LicenseList = function (_a) {
|
|
|
139
141
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
140
142
|
return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry }, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
141
143
|
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
|
|
142
|
-
} }) }))] })), _jsx(LicenseType, { show: show && !isSACountry }), _jsx(LicenseNumber, { show: !isSACountry ? isCR : show, readOnly: licenseReadonly })] }));
|
|
144
|
+
} }) }))] })), _jsx(LicenseType, { show: show && !isSACountry, readOnly: readOnly }), _jsx(LicenseNumber, { show: !isSACountry ? isCR : show, readOnly: licenseReadonly })] }));
|
|
143
145
|
};
|
|
144
146
|
export default React.memo(LicenseList);
|
|
@@ -47,6 +47,6 @@ var LicenseNumber = function (_a) {
|
|
|
47
47
|
var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : length;
|
|
48
48
|
var label = isCR ? 'cr_number' : 'fl_number';
|
|
49
49
|
var showCheckIcon = !isSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
|
|
50
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: !isSACountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
|
|
50
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: !isSACountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon || readOnly ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
|
|
51
51
|
};
|
|
52
52
|
export default React.memo(LicenseNumber);
|
|
@@ -29,6 +29,7 @@ export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledCom
|
|
|
29
29
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
30
30
|
declare type LicenseTypeProps = {
|
|
31
31
|
show: boolean;
|
|
32
|
+
readOnly?: boolean;
|
|
32
33
|
};
|
|
33
|
-
declare const LicenseType: ({ show }: LicenseTypeProps) => JSX.Element;
|
|
34
|
+
declare const LicenseType: ({ show, readOnly }: LicenseTypeProps) => JSX.Element;
|
|
34
35
|
export default LicenseType;
|
|
@@ -73,7 +73,7 @@ export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
var LicenseType = function (_a) {
|
|
76
|
-
var show = _a.show;
|
|
76
|
+
var show = _a.show, readOnly = _a.readOnly;
|
|
77
77
|
var t = useTranslation().t;
|
|
78
78
|
var control = useFormContext().control;
|
|
79
79
|
var error = useAppSelector(connectExpressSelector).error;
|
|
@@ -83,6 +83,8 @@ var LicenseType = function (_a) {
|
|
|
83
83
|
var dispatch = useAppDispatch();
|
|
84
84
|
var handleOnChange = function (_a) {
|
|
85
85
|
var target = _a.target;
|
|
86
|
+
if (readOnly)
|
|
87
|
+
return;
|
|
86
88
|
if (error)
|
|
87
89
|
dispatch(clearError());
|
|
88
90
|
selectedLicenseControl.field.onChange(target.value === BusinessType.FL ? OTHER_FL_LICENSE : OTHER_CR_LICENSE);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface TACProps {
|
|
3
3
|
show: boolean;
|
|
4
|
+
readOnly?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({ show }: TACProps) => JSX.Element>;
|
|
6
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly }: TACProps) => JSX.Element>;
|
|
6
7
|
export default _default;
|
|
@@ -66,7 +66,7 @@ var CollapseStyled = styled(Collapse)(function () { return ({
|
|
|
66
66
|
}); });
|
|
67
67
|
var TAC = function (_a) {
|
|
68
68
|
var _b;
|
|
69
|
-
var show = _a.show;
|
|
69
|
+
var show = _a.show, readOnly = _a.readOnly;
|
|
70
70
|
var t = useTranslation().t;
|
|
71
71
|
var isAr = useLanguage().isAr;
|
|
72
72
|
var control = useFormContext().control;
|
|
@@ -76,6 +76,8 @@ var TAC = function (_a) {
|
|
|
76
76
|
var warningMessage = (_b = tacControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
77
77
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
78
78
|
var handleTACCheckedChange = function (event, checked) {
|
|
79
|
+
if (readOnly)
|
|
80
|
+
return;
|
|
79
81
|
tacControl.field.onChange(checked);
|
|
80
82
|
};
|
|
81
83
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })) })));
|
package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js
CHANGED
|
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
18
|
+
import { useAppDispatch, useAppSelector, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
|
|
19
19
|
import { AuthForType } from '../../../../@types';
|
|
20
20
|
import { useLanguage } from '../../../../hooks';
|
|
21
21
|
import { isKW } from '../../../../utils';
|
|
@@ -37,10 +37,11 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
37
37
|
justifyContent: 'space-between'
|
|
38
38
|
}); });
|
|
39
39
|
var CollectIndividualInfo = function (_a) {
|
|
40
|
-
var _b
|
|
41
|
-
var _c = React.useState(false),
|
|
40
|
+
var _b;
|
|
41
|
+
var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
|
|
42
|
+
var _d = React.useState(false), emailChecking = _d[0], setEmailChecking = _d[1];
|
|
42
43
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
43
|
-
var
|
|
44
|
+
var _e = useAppSelector(connectExpressSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
44
45
|
var dispatch = useAppDispatch();
|
|
45
46
|
var t = useTranslation().t;
|
|
46
47
|
var isAr = useLanguage().isAr;
|
|
@@ -80,10 +81,13 @@ var CollectIndividualInfo = function (_a) {
|
|
|
80
81
|
if (isEmailAvailable === false)
|
|
81
82
|
methods.setError('email', { message: 'tap_js_email_already_exist' });
|
|
82
83
|
}, [responseData]);
|
|
84
|
+
var originalReadOnly = useFormReadOnly(methods);
|
|
85
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
83
86
|
var isLeadEmailAvailable = (contact === null || contact === void 0 ? void 0 : contact.email) === methods.watch('email');
|
|
84
87
|
var isEmailValid = typeof isEmailAvailable === 'undefined' ? isLeadEmailAvailable : isEmailAvailable;
|
|
85
88
|
var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email || !!error;
|
|
86
89
|
var disabled = emailErrChecks || emailChecking || !isEmailValid;
|
|
87
|
-
|
|
90
|
+
var emailReadOnly = readOnly['email'] && !((_b = methods.getFieldState('email').error) === null || _b === void 0 ? void 0 : _b.message) && !methods.getFieldState('email').isDirty;
|
|
91
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { readOnly: readOnly['name'], show: !listActive }), _jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: countriesCode }), _jsx(Email, { readOnly: emailReadOnly, show: !listActive, fetchingEmail: function (v) { return setEmailChecking(v); }, emailChecking: emailChecking }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
88
92
|
};
|
|
89
93
|
export default React.memo(CollectIndividualInfo);
|
|
@@ -3,6 +3,7 @@ export interface EmailProps {
|
|
|
3
3
|
show: boolean;
|
|
4
4
|
fetchingEmail: (flag: boolean) => void;
|
|
5
5
|
emailChecking: boolean;
|
|
6
|
+
readOnly?: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const _default: React.MemoExoticComponent<({ show, fetchingEmail, emailChecking }: EmailProps) => JSX.Element>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ show, fetchingEmail, emailChecking, readOnly }: EmailProps) => JSX.Element>;
|
|
8
9
|
export default _default;
|
|
@@ -68,7 +68,7 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
68
68
|
var cancelToken = null;
|
|
69
69
|
var Email = function (_a) {
|
|
70
70
|
var _b;
|
|
71
|
-
var show = _a.show, fetchingEmail = _a.fetchingEmail, emailChecking = _a.emailChecking;
|
|
71
|
+
var show = _a.show, fetchingEmail = _a.fetchingEmail, emailChecking = _a.emailChecking, readOnly = _a.readOnly;
|
|
72
72
|
var _c = React.useState(''), storedEmail = _c[0], setStoredEmail = _c[1];
|
|
73
73
|
var dispatch = useAppDispatch();
|
|
74
74
|
var data = useAppSelector(connectExpressSelector).data;
|
|
@@ -108,6 +108,6 @@ var Email = function (_a) {
|
|
|
108
108
|
var clearNumber = function () {
|
|
109
109
|
emailControl.field.onChange('');
|
|
110
110
|
};
|
|
111
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, onEnterPressed: function (e) { return e.preventDefault(); }, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: emailChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && emailValue ? (_jsx(CheckIcon, {})) : (emailValue && _jsx(ClearIcon, { onClick: clearNumber })) }) }) })));
|
|
111
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, readOnly: readOnly, onEnterPressed: function (e) { return e.preventDefault(); }, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: emailChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && emailValue ? (_jsx(CheckIcon, {})) : (emailValue && _jsx(ClearIcon, { onClick: clearNumber })) }) }) })));
|
|
112
112
|
};
|
|
113
113
|
export default React.memo(Email);
|
|
@@ -5,6 +5,7 @@ interface MobileNumberProps {
|
|
|
5
5
|
show: boolean;
|
|
6
6
|
onListOpen?: () => void;
|
|
7
7
|
onListClose?: () => void;
|
|
8
|
+
readOnly?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
|
|
10
11
|
export default _default;
|
|
@@ -80,7 +80,7 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
80
80
|
}); });
|
|
81
81
|
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
82
82
|
var _b, _c, _d;
|
|
83
|
-
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
83
|
+
var countries = _a.countries, readOnly = _a.readOnly, rest = __rest(_a, ["countries", "readOnly"]);
|
|
84
84
|
var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
|
|
85
85
|
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
86
86
|
var t = useTranslation().t;
|
|
@@ -142,7 +142,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
142
142
|
});
|
|
143
143
|
setCountries(filteredCountries);
|
|
144
144
|
};
|
|
145
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { 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 () {
|
|
145
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength: requiredLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
|
|
146
|
+
if (readOnly)
|
|
147
|
+
return;
|
|
148
|
+
toggleCountryList();
|
|
149
|
+
} }, { 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' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
146
150
|
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, {})] }));
|
|
147
151
|
} })] }))] })) })));
|
|
148
152
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export interface NameProps {
|
|
3
3
|
show: boolean;
|
|
4
|
+
readOnly?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({ show }: NameProps) => JSX.Element>;
|
|
6
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly }: NameProps) => JSX.Element>;
|
|
6
7
|
export default _default;
|
|
@@ -27,7 +27,7 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
27
27
|
}); });
|
|
28
28
|
var Name = function (_a) {
|
|
29
29
|
var _b;
|
|
30
|
-
var show = _a.show;
|
|
30
|
+
var show = _a.show, readOnly = _a.readOnly;
|
|
31
31
|
var t = useTranslation().t;
|
|
32
32
|
var control = useFormContext().control;
|
|
33
33
|
var nameControl = useController({ name: 'name', control: control });
|
|
@@ -40,6 +40,6 @@ var Name = function (_a) {
|
|
|
40
40
|
var clearNumber = function () {
|
|
41
41
|
nameControl.field.onChange('');
|
|
42
42
|
};
|
|
43
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(InputStyled, { label: t('signup_merchant_name_label'), value: nameValue, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && nameValue ? _jsx(CheckIcon, {}) : nameValue && _jsx(ClearIcon, { onClick: clearNumber }) }) })) })));
|
|
43
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(InputStyled, { label: t('signup_merchant_name_label'), value: nameValue, readOnly: readOnly, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && nameValue ? _jsx(CheckIcon, {}) : nameValue && _jsx(ClearIcon, { onClick: clearNumber }) }) })) })));
|
|
44
44
|
};
|
|
45
45
|
export default React.memo(Name);
|
|
@@ -19,7 +19,7 @@ import { styled, alpha } from '@mui/material/styles';
|
|
|
19
19
|
import Collapse from '../../../../components/Collapse';
|
|
20
20
|
import Form from '../../../../components/Form';
|
|
21
21
|
import Button, { AbsherButton, MobileButton } from '../../../shared/Button';
|
|
22
|
-
import { useAppDispatch, useAppSelector, useCountry } from '../../../../hooks';
|
|
22
|
+
import { useAppDispatch, useAppSelector, useCountry, useFormErrorAndUpdateReadOnly, useFormReadOnly } from '../../../../hooks';
|
|
23
23
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
24
24
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
25
25
|
import { clearError, resetStore, connectExpressSelector, createMobileAuthAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
@@ -104,7 +104,9 @@ var Mobile = function (_a) {
|
|
|
104
104
|
var handleCountryClose = function () {
|
|
105
105
|
setAnchor(false);
|
|
106
106
|
};
|
|
107
|
+
var originalReadOnly = useFormReadOnly(methods);
|
|
108
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
107
109
|
var disabled = !methods.formState.isValid || !!error;
|
|
108
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !anchor, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: true, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(TAC, { show: isLeadIdPassed }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: isLeadIdPassed ? !isLeadIdentityIdAvailable : !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKuwait ? (_jsx(MobileButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) }))] }));
|
|
110
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !anchor, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(TAC, { show: isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: isLeadIdPassed ? !isLeadIdentityIdAvailable : !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKuwait ? (_jsx(MobileButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) }))] }));
|
|
109
111
|
};
|
|
110
112
|
export default React.memo(Mobile);
|
|
@@ -7,6 +7,7 @@ interface MobileNumberProps {
|
|
|
7
7
|
onSwitchToIdNumber?: () => void;
|
|
8
8
|
onListOpen?: () => void;
|
|
9
9
|
onListClose?: () => void;
|
|
10
|
+
readOnly?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
|
|
12
13
|
export default _default;
|
|
@@ -81,7 +81,7 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
81
81
|
}); });
|
|
82
82
|
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
83
83
|
var _b, _c, _d;
|
|
84
|
-
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
84
|
+
var countries = _a.countries, readOnly = _a.readOnly, rest = __rest(_a, ["countries", "readOnly"]);
|
|
85
85
|
var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
|
|
86
86
|
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
87
87
|
var t = useTranslation().t;
|
|
@@ -144,7 +144,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
144
144
|
});
|
|
145
145
|
setCountries(filteredCountries);
|
|
146
146
|
};
|
|
147
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
|
|
147
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl || readOnly, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
|
|
148
|
+
if (readOnly)
|
|
149
|
+
return;
|
|
150
|
+
toggleCountryList();
|
|
151
|
+
} }, { 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: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
148
152
|
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, {})] }));
|
|
149
153
|
} })] }))] })) })));
|
|
150
154
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface TACProps {
|
|
3
3
|
show: boolean;
|
|
4
|
+
readOnly?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({ show }: TACProps) => JSX.Element>;
|
|
6
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly }: TACProps) => JSX.Element>;
|
|
6
7
|
export default _default;
|
|
@@ -66,7 +66,7 @@ var CollapseStyled = styled(Collapse)(function () { return ({
|
|
|
66
66
|
}); });
|
|
67
67
|
var TAC = function (_a) {
|
|
68
68
|
var _b;
|
|
69
|
-
var show = _a.show;
|
|
69
|
+
var show = _a.show, readOnly = _a.readOnly;
|
|
70
70
|
var t = useTranslation().t;
|
|
71
71
|
var isAr = useLanguage().isAr;
|
|
72
72
|
var control = useFormContext().control;
|
|
@@ -76,6 +76,8 @@ var TAC = function (_a) {
|
|
|
76
76
|
var warningMessage = (_b = tacControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
77
77
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
78
78
|
var handleTACCheckedChange = function (event, checked) {
|
|
79
|
+
if (readOnly)
|
|
80
|
+
return;
|
|
79
81
|
tacControl.field.onChange(checked);
|
|
80
82
|
};
|
|
81
83
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }) })));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface DOBProps {
|
|
3
3
|
onDateClicked?: (flag: boolean) => void;
|
|
4
|
+
readOnly?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const DOB: ({ onDateClicked }: DOBProps) => JSX.Element;
|
|
6
|
+
declare const DOB: ({ onDateClicked, readOnly }: DOBProps) => JSX.Element;
|
|
6
7
|
export default DOB;
|
|
@@ -24,7 +24,7 @@ var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
24
24
|
});
|
|
25
25
|
var DOB = function (_a) {
|
|
26
26
|
var _b;
|
|
27
|
-
var onDateClicked = _a.onDateClicked;
|
|
27
|
+
var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly;
|
|
28
28
|
var t = useTranslation().t;
|
|
29
29
|
var control = useFormContext().control;
|
|
30
30
|
var dispatch = useAppDispatch();
|
|
@@ -42,6 +42,6 @@ var DOB = function (_a) {
|
|
|
42
42
|
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
43
43
|
var spacing = _a.spacing;
|
|
44
44
|
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
45
|
-
} } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { defaultValue: dateValue ? new Date(dateValue) : new Date(), readOnly: true, dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange, onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); } })] }));
|
|
45
|
+
} } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { disabled: readOnly, defaultValue: dateValue ? new Date(dateValue) : new Date(), readOnly: true, dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange, onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); } })] }));
|
|
46
46
|
};
|
|
47
47
|
export default DOB;
|
|
@@ -39,7 +39,7 @@ var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
39
39
|
});
|
|
40
40
|
var IDNumber = React.forwardRef(function (_a, ref) {
|
|
41
41
|
var _b, _c, _d;
|
|
42
|
-
var show = _a.show;
|
|
42
|
+
var show = _a.show, readOnly = _a.readOnly;
|
|
43
43
|
var t = useTranslation().t;
|
|
44
44
|
var control = useFormContext().control;
|
|
45
45
|
var nidControl = useController({ control: control, name: 'nid' });
|
|
@@ -56,6 +56,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
|
|
|
56
56
|
var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
57
57
|
var isLeadIdPassed = data.isLeadIdPassed, responseData = data.responseData;
|
|
58
58
|
var isLeadIdentityIdAvailable = !!((_d = (_c = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.id);
|
|
59
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, disabled: isLeadIdPassed && isLeadIdentityIdAvailable, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
|
|
59
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { readOnly: readOnly, dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, disabled: isLeadIdPassed && isLeadIdentityIdAvailable, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
|
|
60
60
|
});
|
|
61
61
|
export default React.memo(IDNumber);
|
|
@@ -16,7 +16,7 @@ import { alpha, styled } from '@mui/material/styles';
|
|
|
16
16
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import { NIDValidationSchema } from './validation';
|
|
19
|
-
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector, useFormReadOnly, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
20
20
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
21
21
|
import { clearError, connectExpressSelector, createNIDAuthAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
@@ -85,8 +85,10 @@ var NID = function (_a) {
|
|
|
85
85
|
var onBack = function () {
|
|
86
86
|
dispatch(handlePrevScreenStep());
|
|
87
87
|
};
|
|
88
|
+
var originalReadOnly = useFormReadOnly(methods);
|
|
89
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
88
90
|
var disabled = !methods.formState.isValid || !!error;
|
|
89
91
|
var isLeadIdentityIdAvailable = (_c = (_b = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _b === void 0 ? void 0 : _b.identification) === null || _c === void 0 ? void 0 : _c.id;
|
|
90
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(TAC, { show: isLeadIdPassed }), _jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: isLeadIdPassed ? !isLeadIdentityIdAvailable && !methods.formState.isValid : !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading }, { children: t('mobile_button_label') }))] }))] }))] })) })) }));
|
|
92
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse, readOnly: readOnly['nid'] }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose, readOnly: readOnly['dob'] }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(TAC, { show: isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: isLeadIdPassed ? !isLeadIdentityIdAvailable && !methods.formState.isValid : !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading }, { children: t('mobile_button_label') }))] }))] }))] })) })) }));
|
|
91
93
|
};
|
|
92
94
|
export default React.memo(NID);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface TACProps {
|
|
3
3
|
show: boolean;
|
|
4
|
+
readOnly?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({ show }: TACProps) => JSX.Element>;
|
|
6
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly }: TACProps) => JSX.Element>;
|
|
6
7
|
export default _default;
|
|
@@ -66,7 +66,7 @@ var CollapseStyled = styled(Collapse)(function () { return ({
|
|
|
66
66
|
}); });
|
|
67
67
|
var TAC = function (_a) {
|
|
68
68
|
var _b;
|
|
69
|
-
var show = _a.show;
|
|
69
|
+
var show = _a.show, readOnly = _a.readOnly;
|
|
70
70
|
var t = useTranslation().t;
|
|
71
71
|
var isAr = useLanguage().isAr;
|
|
72
72
|
var control = useFormContext().control;
|
|
@@ -76,6 +76,8 @@ var TAC = function (_a) {
|
|
|
76
76
|
var warningMessage = (_b = tacControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
77
77
|
var countryCode = settingsData.businessCountry.iso2.toLowerCase();
|
|
78
78
|
var handleTACCheckedChange = function (event, checked) {
|
|
79
|
+
if (readOnly)
|
|
80
|
+
return;
|
|
79
81
|
tacControl.field.onChange(checked);
|
|
80
82
|
};
|
|
81
83
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_AR : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })) })));
|
|
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
16
16
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { settingsSelector } from '../../../../app/settings';
|
|
19
|
-
import { useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
|
|
19
|
+
import { useAppDispatch, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
|
|
20
20
|
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
21
21
|
import Form from '../../../../components/Form';
|
|
22
22
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -47,6 +47,8 @@ var PhoneInfo = function (_a) {
|
|
|
47
47
|
var t = useTranslation().t;
|
|
48
48
|
var isAr = useLanguage().isAr;
|
|
49
49
|
var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
|
|
50
|
+
var originalReadOnly = useFormReadOnly(methods);
|
|
51
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
50
52
|
var onSubmit = function (formData) {
|
|
51
53
|
dispatch(updatePhoneInfo(formData));
|
|
52
54
|
};
|
|
@@ -55,6 +57,6 @@ var PhoneInfo = function (_a) {
|
|
|
55
57
|
dispatch(clearError());
|
|
56
58
|
}, [methods.formState.isValid]);
|
|
57
59
|
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, { readOnly:
|
|
60
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(MobileNumber, { readOnly: readOnly['mobile'], 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
61
|
};
|
|
60
62
|
export default React.memo(PhoneInfo);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/auth-jsconnect",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.37-test",
|
|
4
4
|
"description": "connect library, auth",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
|
-
"
|
|
14
|
+
"preinstall": "npx husky install",
|
|
15
15
|
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
|
|
16
16
|
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
|
|
17
17
|
"lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
|