@tap-payments/auth-jsconnect 1.0.5 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/app.d.ts +61 -3
- package/build/@types/app.js +5 -0
- package/build/app/settings.d.ts +3 -3
- package/build/app/settings.js +26 -11
- package/build/assets/locales/ar.json +51 -3
- package/build/assets/locales/en.json +50 -2
- package/build/components/AnimationFlow/BottomSheet.js +1 -1
- package/build/components/AnimationFlow/Dialog.js +7 -22
- package/build/components/Footer/Footer.js +1 -1
- package/build/components/Loader/Loader.js +12 -11
- package/build/components/OTPField/OTPField.js +3 -23
- package/build/components/OTPTimer/OTPTimer.d.ts +4 -3
- package/build/components/OTPTimer/OTPTimer.js +19 -6
- package/build/components/Providers/ThemeProvider.js +3 -2
- package/build/components/SimpleList/SimpleList.d.ts +1 -1
- package/build/components/SimpleList/SimpleList.js +2 -5
- package/build/components/Warning/Warning.js +2 -18
- package/build/constants/app.d.ts +9 -0
- package/build/constants/app.js +112 -2
- package/build/constants/assets.d.ts +4 -0
- package/build/constants/assets.js +4 -0
- package/build/constants/dummy.d.ts +103 -0
- package/build/constants/dummy.js +219 -0
- package/build/constants/validation.d.ts +4 -0
- package/build/constants/validation.js +4 -0
- package/build/features/bank/Bank.d.ts +6 -0
- package/build/features/bank/Bank.js +48 -0
- package/build/features/bank/index.d.ts +1 -0
- package/build/features/bank/index.js +1 -0
- package/build/features/bank/screens/BankDetails/BankDetails.d.ts +5 -0
- package/build/features/bank/screens/BankDetails/BankDetails.js +57 -0
- package/build/features/bank/screens/BankDetails/BankName.d.ts +3 -0
- package/build/features/bank/screens/BankDetails/BankName.js +27 -0
- package/build/features/bank/screens/BankDetails/Beneficiary.d.ts +5 -0
- package/build/features/bank/screens/BankDetails/Beneficiary.js +34 -0
- package/build/features/bank/screens/BankDetails/IBAN.d.ts +5 -0
- package/build/features/bank/screens/BankDetails/IBAN.js +35 -0
- package/build/features/bank/screens/BankDetails/index.d.ts +3 -0
- package/build/features/bank/screens/BankDetails/index.js +2 -0
- package/build/features/bank/screens/BankDetails/validation.d.ts +14 -0
- package/build/features/bank/screens/BankDetails/validation.js +9 -0
- package/build/features/business/Business.d.ts +6 -0
- package/build/features/business/Business.js +61 -0
- package/build/features/business/index.d.ts +1 -0
- package/build/features/business/index.js +1 -1
- package/build/features/business/screens/Activities/Activities.d.ts +5 -0
- package/build/features/business/screens/Activities/Activities.js +83 -0
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +70 -0
- package/build/features/business/screens/Activities/ActivitiesList.js +136 -0
- package/build/features/business/screens/Activities/SalesChannels.d.ts +5 -0
- package/build/features/business/screens/Activities/SalesChannels.js +107 -0
- package/build/features/business/screens/Activities/index.d.ts +3 -0
- package/build/features/business/screens/Activities/index.js +2 -0
- package/build/features/business/screens/Activities/validation.d.ts +119 -0
- package/build/features/business/screens/Activities/validation.js +17 -0
- package/build/features/business/screens/BusinessType/BusinessType.d.ts +12 -0
- package/build/features/business/screens/BusinessType/BusinessType.js +85 -0
- package/build/features/business/screens/BusinessType/CRNumber.d.ts +6 -0
- package/build/features/business/screens/BusinessType/CRNumber.js +40 -0
- package/build/features/business/screens/BusinessType/CompanyLicense.d.ts +11 -0
- package/build/features/business/screens/BusinessType/CompanyLicense.js +109 -0
- package/build/features/business/screens/BusinessType/FLNumber.d.ts +6 -0
- package/build/features/business/screens/BusinessType/FLNumber.js +40 -0
- package/build/features/business/screens/BusinessType/FreelanceLicense.d.ts +11 -0
- package/build/features/business/screens/BusinessType/FreelanceLicense.js +112 -0
- package/build/features/business/screens/BusinessType/SelectType.d.ts +8 -0
- package/build/features/business/screens/BusinessType/SelectType.js +106 -0
- package/build/features/business/screens/BusinessType/Switch.d.ts +7 -0
- package/build/features/business/screens/BusinessType/Switch.js +35 -0
- package/build/features/business/screens/BusinessType/index.d.ts +3 -0
- package/build/features/business/screens/BusinessType/index.js +2 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +15 -0
- package/build/features/business/screens/BusinessType/validation.js +14 -0
- package/build/features/business/screens/Confirm/Confirm.d.ts +5 -0
- package/build/features/business/screens/Confirm/Confirm.js +53 -0
- package/build/features/business/screens/Confirm/index.d.ts +3 -0
- package/build/features/business/screens/Confirm/index.js +2 -0
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +92 -0
- package/build/features/business/screens/Customers/CustomerLocations.js +122 -0
- package/build/features/business/screens/Customers/Customers.d.ts +5 -0
- package/build/features/business/screens/Customers/Customers.js +92 -0
- package/build/features/business/screens/Customers/ExpectedCustomers.d.ts +7 -0
- package/build/features/business/screens/Customers/ExpectedCustomers.js +78 -0
- package/build/features/business/screens/Customers/ExpectedSalesRange.d.ts +7 -0
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +74 -0
- package/build/features/business/screens/Customers/RefundPolicy.d.ts +44 -0
- package/build/features/business/screens/Customers/RefundPolicy.js +86 -0
- package/build/features/business/screens/Customers/TransactionPolicy.d.ts +3 -0
- package/build/features/business/screens/Customers/TransactionPolicy.js +37 -0
- package/build/features/business/screens/Customers/index.d.ts +3 -0
- package/build/features/business/screens/Customers/index.js +2 -0
- package/build/features/business/screens/Customers/validation.d.ts +20 -0
- package/build/features/business/screens/Customers/validation.js +8 -0
- package/build/features/business/screens/IDBOD/DOB.js +8 -8
- package/build/features/business/screens/IDBOD/ID.js +8 -7
- package/build/features/business/screens/IDBOD/IDBOD.js +5 -6
- package/build/features/business/screens/OTP/OTP.d.ts +11 -0
- package/build/features/business/screens/OTP/OTP.js +112 -0
- package/build/features/business/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/business/screens/OTP/OTPInput.js +51 -0
- package/build/features/{connect → business}/screens/OTP/OTPTimer.d.ts +0 -0
- package/build/features/business/screens/OTP/OTPTimer.js +20 -0
- package/build/features/business/screens/OTP/index.d.ts +3 -0
- package/build/features/business/screens/OTP/index.js +2 -0
- package/build/features/business/screens/OTP/validation.d.ts +8 -0
- package/build/features/business/screens/OTP/validation.js +4 -0
- package/build/features/business/screens/Success/Success.d.ts +5 -0
- package/build/features/business/screens/Success/Success.js +15 -0
- package/build/features/business/screens/Success/index.d.ts +3 -0
- package/build/features/business/screens/Success/index.js +2 -0
- package/build/features/business/screens/VerifyNumber/OTPInput.d.ts +6 -0
- package/build/features/business/screens/VerifyNumber/OTPInput.js +68 -0
- package/build/features/business/screens/VerifyNumber/OTPTimer.d.ts +5 -0
- package/build/features/business/screens/VerifyNumber/OTPTimer.js +20 -0
- package/build/features/business/screens/VerifyNumber/VerifyNumber.d.ts +13 -0
- package/build/features/business/screens/VerifyNumber/VerifyNumber.js +119 -0
- package/build/features/business/screens/VerifyNumber/index.d.ts +3 -0
- package/build/features/business/screens/VerifyNumber/index.js +2 -0
- package/build/features/business/screens/VerifyNumber/validation.d.ts +8 -0
- package/build/features/business/screens/VerifyNumber/validation.js +4 -0
- package/build/features/connect/Connect.js +6 -18
- package/build/features/connect/screens/Individual/Email.d.ts +1 -1
- package/build/features/connect/screens/Individual/Email.js +6 -31
- package/build/features/connect/screens/Individual/Individual.js +7 -16
- package/build/features/connect/screens/Individual/Name.d.ts +1 -1
- package/build/features/connect/screens/Individual/Name.js +7 -34
- package/build/features/connect/screens/MID/BusinessCountry.js +5 -40
- package/build/features/connect/screens/MID/IDNumber.js +13 -28
- package/build/features/connect/screens/MID/MID.js +6 -43
- package/build/features/connect/screens/MID/MobileNumber.js +22 -41
- package/build/features/connect/screens/Merchant/BrandName.js +5 -31
- package/build/features/connect/screens/Merchant/Merchant.js +6 -50
- package/build/features/connect/screens/Merchant/SocialMedia.js +3 -11
- package/build/features/connect/screens/Merchant/TAC.js +4 -13
- package/build/features/connect/screens/OTP/OTP.js +17 -61
- package/build/features/connect/screens/OTP/OTPInput.js +8 -21
- package/build/features/connect/screens/Password/Password.js +12 -49
- package/build/features/connect/screens/Password/PasswordInput.js +16 -51
- package/build/features/connect/screens/ThankYou/ThankYou.js +4 -65
- package/build/features/featuresScreens.d.ts +5 -0
- package/build/features/featuresScreens.js +78 -7
- package/build/features/owner/Owner.d.ts +6 -0
- package/build/features/owner/Owner.js +50 -0
- package/build/features/owner/index.d.ts +1 -0
- package/build/features/owner/index.js +1 -0
- package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.d.ts +19 -0
- package/build/features/owner/screens/ShowOwnerInfo/ShowOwnerInfo.js +52 -0
- package/build/features/owner/screens/ShowOwnerInfo/index.d.ts +3 -0
- package/build/features/owner/screens/ShowOwnerInfo/index.js +2 -0
- package/build/features/owner/screens/ShowOwnerInfo/info.d.ts +7 -0
- package/build/features/owner/screens/ShowOwnerInfo/info.js +28 -0
- package/build/features/password/Password.d.ts +6 -0
- package/build/features/password/Password.js +50 -0
- package/build/features/password/index.d.ts +1 -0
- package/build/features/password/index.js +1 -0
- package/build/features/password/screens/CreatePassword/ConditionText.d.ts +7 -0
- package/build/features/password/screens/CreatePassword/ConditionText.js +23 -0
- package/build/features/password/screens/CreatePassword/ConfirmPassword.d.ts +5 -0
- package/build/features/password/screens/CreatePassword/ConfirmPassword.js +27 -0
- package/build/features/password/screens/CreatePassword/CreatePassword.d.ts +5 -0
- package/build/features/password/screens/CreatePassword/CreatePassword.js +51 -0
- package/build/features/password/screens/CreatePassword/Password.d.ts +5 -0
- package/build/features/password/screens/CreatePassword/Password.js +75 -0
- package/build/features/password/screens/CreatePassword/PasswordBar.d.ts +7 -0
- package/build/features/password/screens/CreatePassword/PasswordBar.js +29 -0
- package/build/features/password/screens/CreatePassword/index.d.ts +3 -0
- package/build/features/password/screens/CreatePassword/index.js +2 -0
- package/build/features/password/screens/CreatePassword/validation.d.ts +11 -0
- package/build/features/password/screens/CreatePassword/validation.js +8 -0
- package/build/features/shared/Button/Button.d.ts +8 -0
- package/build/features/shared/Button/Button.js +47 -0
- package/build/features/shared/Button/index.d.ts +2 -0
- package/build/features/shared/Button/index.js +2 -0
- package/build/features/shared/CheckIcon/CheckIcon.d.ts +2 -0
- package/build/features/shared/CheckIcon/CheckIcon.js +14 -0
- package/build/features/shared/CheckIcon/index.d.ts +2 -0
- package/build/features/shared/CheckIcon/index.js +2 -0
- package/build/features/shared/ClearIcon/ClearIcon.d.ts +6 -0
- package/build/features/shared/ClearIcon/ClearIcon.js +26 -0
- package/build/features/shared/ClearIcon/index.d.ts +2 -0
- package/build/features/shared/ClearIcon/index.js +2 -0
- package/build/features/shared/Containers/FeatureContainer.d.ts +4 -0
- package/build/features/shared/Containers/FeatureContainer.js +33 -0
- package/build/features/shared/Containers/ScreenContainer.d.ts +4 -0
- package/build/features/shared/Containers/ScreenContainer.js +28 -0
- package/build/features/shared/Containers/index.d.ts +3 -0
- package/build/features/shared/Containers/index.js +3 -0
- package/build/features/shared/ExpandIcon/ExpandIcon.d.ts +7 -0
- package/build/features/shared/ExpandIcon/ExpandIcon.js +24 -0
- package/build/features/shared/ExpandIcon/index.d.ts +2 -0
- package/build/features/shared/ExpandIcon/index.js +2 -0
- package/build/features/shared/Footer/Footer.d.ts +2 -0
- package/build/features/shared/Footer/Footer.js +16 -0
- package/build/features/shared/Footer/index.d.ts +2 -0
- package/build/features/shared/Footer/index.js +2 -0
- package/build/features/shared/Input/Input.d.ts +27 -0
- package/build/features/shared/Input/Input.js +59 -0
- package/build/features/shared/Input/index.d.ts +2 -0
- package/build/features/shared/Input/index.js +2 -0
- package/build/features/shared/OTP/OTP.d.ts +9 -0
- package/build/features/shared/OTP/OTP.js +85 -0
- package/build/features/shared/OTP/index.d.ts +2 -0
- package/build/features/shared/OTP/index.js +2 -0
- package/build/features/shared/PasswordIcon/PasswordIcon.d.ts +8 -0
- package/build/features/shared/PasswordIcon/PasswordIcon.js +37 -0
- package/build/features/shared/PasswordIcon/index.d.ts +2 -0
- package/build/features/shared/PasswordIcon/index.js +2 -0
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +7 -0
- package/build/features/shared/SuccessScreen/SuccessScreen.js +54 -0
- package/build/features/shared/SuccessScreen/index.d.ts +2 -0
- package/build/features/shared/SuccessScreen/index.js +2 -0
- package/build/features/tax/Tax.d.ts +6 -0
- package/build/features/tax/Tax.js +50 -0
- package/build/features/tax/index.d.ts +1 -0
- package/build/features/tax/index.js +1 -0
- package/build/features/tax/screens/TaxDetails/TaxDetails.d.ts +5 -0
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +45 -0
- package/build/features/tax/screens/TaxDetails/VATId.d.ts +3 -0
- package/build/features/tax/screens/TaxDetails/VATId.js +27 -0
- package/build/features/tax/screens/TaxDetails/index.d.ts +3 -0
- package/build/features/tax/screens/TaxDetails/index.js +2 -0
- package/build/features/tax/screens/TaxDetails/validation.d.ts +8 -0
- package/build/features/tax/screens/TaxDetails/validation.js +4 -0
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useContainerDimensions.d.ts +4 -0
- package/build/hooks/useContainerDimensions.js +21 -0
- package/build/index.css +1 -1
- package/build/index.d.ts +7 -2
- package/build/index.js +17 -2
- package/build/theme/palette.js +10 -4
- package/build/theme/typography.js +2 -2
- package/build/utils/array.d.ts +3 -1
- package/build/utils/array.js +7 -3
- package/build/utils/string.d.ts +2 -0
- package/build/utils/string.js +11 -0
- package/build/utils/validation.d.ts +6 -0
- package/build/utils/validation.js +19 -1
- package/package.json +1 -1
- package/build/features/connect/Footer.d.ts +0 -4
- package/build/features/connect/Footer.js +0 -16
- package/build/features/connect/screens/OTP/OTPTimer.js +0 -35
|
@@ -10,30 +10,18 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import React, {
|
|
14
|
-
import {
|
|
15
|
-
import Box from '@mui/material/Box';
|
|
16
|
-
import Footer from './Footer';
|
|
13
|
+
import React, { memo, useEffect } from 'react';
|
|
14
|
+
import { FeatureContainer } from '../shared/Containers';
|
|
17
15
|
import { useAppTheme, useAppDispatch, useAppSelector } from '../../hooks';
|
|
18
16
|
import { handleActiveFlowScreens, settingsSelector } from '../../app/settings';
|
|
19
17
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
20
18
|
import { store } from '../../app/store';
|
|
21
19
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
22
|
-
import
|
|
20
|
+
import Collapse from '../../components/Collapse';
|
|
23
21
|
import { reactElement } from '../../utils';
|
|
24
22
|
import { CONNECT_SCREENS_NAVIGATION } from '../../constants';
|
|
25
23
|
import { connectFeatureScreens } from '../featuresScreens';
|
|
26
|
-
|
|
27
|
-
var _b;
|
|
28
|
-
var theme = _a.theme;
|
|
29
|
-
return (_b = {
|
|
30
|
-
width: '100%'
|
|
31
|
-
},
|
|
32
|
-
_b[theme.transitions.create('height')] = {
|
|
33
|
-
duration: theme.transitions.duration.enteringScreen
|
|
34
|
-
},
|
|
35
|
-
_b);
|
|
36
|
-
});
|
|
24
|
+
import CustomFooter from '../shared/Footer';
|
|
37
25
|
var Connect = memo(function (props) {
|
|
38
26
|
var open = React.useState(true)[0];
|
|
39
27
|
var theme = useAppTheme().theme;
|
|
@@ -43,10 +31,10 @@ var Connect = memo(function (props) {
|
|
|
43
31
|
useEffect(function () {
|
|
44
32
|
dispatch(handleActiveFlowScreens(CONNECT_SCREENS_NAVIGATION));
|
|
45
33
|
}, []);
|
|
46
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(
|
|
34
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
|
|
47
35
|
var Element = _a.element, name = _a.name;
|
|
48
36
|
var isActive = activeScreen.name === name;
|
|
49
|
-
return (_jsx(
|
|
37
|
+
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 600, exit: 400, appear: 600 } }, { children: _jsx(Element, {}) }), index));
|
|
50
38
|
}) }) })) })));
|
|
51
39
|
});
|
|
52
40
|
export function ConnectLib(props) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export interface EmailProps {
|
|
3
3
|
}
|
|
4
|
-
declare const _default: React.MemoExoticComponent<
|
|
4
|
+
declare const _default: React.MemoExoticComponent<({}: EmailProps) => JSX.Element>;
|
|
5
5
|
export default _default;
|
|
@@ -9,39 +9,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx
|
|
13
|
-
import Box from '@mui/material/Box/Box';
|
|
14
|
-
import { alpha, styled } from '@mui/material/styles';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
13
|
import * as React from 'react';
|
|
16
14
|
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import
|
|
18
|
-
import Input from '
|
|
15
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
16
|
+
import Input from '../../../shared/Input';
|
|
19
17
|
import { keepEmailCharacters } from '../../../../utils';
|
|
20
18
|
import { useController, useFormContext } from 'react-hook-form';
|
|
21
|
-
var
|
|
22
|
-
var theme = _a.theme;
|
|
23
|
-
return ({
|
|
24
|
-
direction: theme.direction
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
28
|
-
var theme = _a.theme;
|
|
29
|
-
return ({
|
|
30
|
-
padding: theme.spacing(3, 2, 1.25, 2.5)
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
34
|
-
var theme = _a.theme;
|
|
35
|
-
return (__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
36
|
-
});
|
|
37
|
-
var InputStyled = styled(Input)(function (_a) {
|
|
38
|
-
var theme = _a.theme;
|
|
39
|
-
return ({
|
|
40
|
-
padding: theme.spacing(0, 2, 0, 0),
|
|
41
|
-
direction: theme.direction
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
var Email = React.forwardRef(function (_a, ref) {
|
|
19
|
+
var Email = function (_a) {
|
|
45
20
|
var _b;
|
|
46
21
|
var t = useTranslation().t;
|
|
47
22
|
var control = useFormContext().control;
|
|
@@ -51,6 +26,6 @@ var Email = React.forwardRef(function (_a, ref) {
|
|
|
51
26
|
emailControl.field.onChange(value);
|
|
52
27
|
};
|
|
53
28
|
var emailValue = emailControl.field.value;
|
|
54
|
-
return (
|
|
55
|
-
}
|
|
29
|
+
return (_jsx(ScreenContainer, __assign({ sx: { mb: 5 } }, { children: _jsx(Input, { label: t('signup_enter_email'), value: emailValue, onChange: handleEmailChange, type: 'email', placeholder: t('signin_email_placeholder'), warningType: 'alert', warningMessage: (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message }) })));
|
|
30
|
+
};
|
|
56
31
|
export default React.memo(Email);
|
|
@@ -19,22 +19,14 @@ import { useTranslation } from 'react-i18next';
|
|
|
19
19
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
20
20
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
21
21
|
import Icon from '../../../../components/Icon';
|
|
22
|
-
import { useAppDispatch
|
|
23
|
-
import { handleNextScreenStep
|
|
22
|
+
import { useAppDispatch } from '../../../../hooks';
|
|
23
|
+
import { handleNextScreenStep } from '../../../../app/settings';
|
|
24
24
|
import { IndividualValidation } from './validation';
|
|
25
25
|
import Form from '../../../../components/Form';
|
|
26
|
-
import Button from '
|
|
27
|
-
import {
|
|
26
|
+
import Button from '../../../shared/Button';
|
|
27
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
28
28
|
import Loader from '../../../../components/Loader';
|
|
29
29
|
import { useLanguage } from '../../../../hooks';
|
|
30
|
-
var BoxStyled = styled(Box)(function (_a) {
|
|
31
|
-
var theme = _a.theme;
|
|
32
|
-
return ({
|
|
33
|
-
padding: theme.spacing(2.5, 0, 2.5, 0),
|
|
34
|
-
overflow: 'hidden',
|
|
35
|
-
direction: theme.direction
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
30
|
var FormStyled = styled(Form)(function () { return ({
|
|
39
31
|
display: 'flex',
|
|
40
32
|
flexDirection: 'column'
|
|
@@ -42,7 +34,7 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
42
34
|
var ButtonContainer = styled(Box)(function (_a) {
|
|
43
35
|
var theme = _a.theme;
|
|
44
36
|
return ({
|
|
45
|
-
margin: theme.spacing(
|
|
37
|
+
margin: theme.spacing(5, 2.5, 0, 2.5)
|
|
46
38
|
});
|
|
47
39
|
});
|
|
48
40
|
var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
|
@@ -66,7 +58,6 @@ var LoaderStyled = styled(Loader)(function (_a) {
|
|
|
66
58
|
});
|
|
67
59
|
var Individual = function (_a) {
|
|
68
60
|
var dispatch = useAppDispatch();
|
|
69
|
-
var settingStore = useAppSelector(settingsSelector);
|
|
70
61
|
var methods = useForm({
|
|
71
62
|
resolver: yupResolver(IndividualValidation),
|
|
72
63
|
defaultValues: {
|
|
@@ -77,10 +68,10 @@ var Individual = function (_a) {
|
|
|
77
68
|
});
|
|
78
69
|
var onSubmit = function (data) {
|
|
79
70
|
console.log('data', data);
|
|
80
|
-
dispatch(handleNextScreenStep(
|
|
71
|
+
dispatch(handleNextScreenStep());
|
|
81
72
|
};
|
|
82
73
|
var t = useTranslation().t;
|
|
83
74
|
var isAr = useLanguage().isAr;
|
|
84
|
-
return (_jsx(
|
|
75
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, {}), _jsx(Email, {}), _jsx(Button, __assign({ isAr: isAr, loading: false, disabled: !methods.formState.isValid }, { children: t('next') }))] })) })) }));
|
|
85
76
|
};
|
|
86
77
|
export default React.memo(Individual);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export interface NameProps {
|
|
3
3
|
}
|
|
4
|
-
declare const _default: React.MemoExoticComponent<
|
|
4
|
+
declare const _default: React.MemoExoticComponent<({}: NameProps) => JSX.Element>;
|
|
5
5
|
export default _default;
|
|
@@ -9,43 +9,16 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx
|
|
13
|
-
import Box from '@mui/material/Box/Box';
|
|
14
|
-
import { alpha, styled } from '@mui/material/styles';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
13
|
import * as React from 'react';
|
|
16
14
|
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import
|
|
18
|
-
import Input from '
|
|
15
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
16
|
+
import Input from '../../../shared/Input';
|
|
19
17
|
import { removeAllNumberFromChars } from '../../../../utils';
|
|
20
18
|
import { useController, useFormContext } from 'react-hook-form';
|
|
21
|
-
var
|
|
22
|
-
var theme = _a.theme;
|
|
23
|
-
return ({
|
|
24
|
-
display: 'flex',
|
|
25
|
-
flexDirection: 'column'
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
29
|
-
var theme = _a.theme;
|
|
30
|
-
return ({
|
|
31
|
-
display: 'flex',
|
|
32
|
-
justifyContent: 'space-between',
|
|
33
|
-
padding: theme.spacing(3, 2, 1.25, 2.5)
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
37
|
-
var theme = _a.theme;
|
|
38
|
-
return (__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
39
|
-
});
|
|
40
|
-
var InputStyled = styled(Input)(function (_a) {
|
|
41
|
-
var theme = _a.theme;
|
|
42
|
-
return ({
|
|
43
|
-
padding: theme.spacing(0, 2, 0, 0)
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
var Name = React.forwardRef(function (_a, ref) {
|
|
19
|
+
var Name = function (_a) {
|
|
47
20
|
var _b;
|
|
48
|
-
var
|
|
21
|
+
var t = useTranslation().t;
|
|
49
22
|
var control = useFormContext().control;
|
|
50
23
|
var nameControl = useController({ name: 'name', control: control });
|
|
51
24
|
var handleNameChange = function (event) {
|
|
@@ -53,6 +26,6 @@ var Name = React.forwardRef(function (_a, ref) {
|
|
|
53
26
|
nameControl.field.onChange(value);
|
|
54
27
|
};
|
|
55
28
|
var nameValue = nameControl.field.value;
|
|
56
|
-
return (
|
|
57
|
-
}
|
|
29
|
+
return (_jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(Input, { label: t('signup_merchant_name_label'), value: nameValue, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), warningType: 'alert', warningMessage: (_b = nameControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message }) })));
|
|
30
|
+
};
|
|
58
31
|
export default React.memo(Name);
|
|
@@ -23,46 +23,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
24
|
import * as React from 'react';
|
|
25
25
|
import Box from '@mui/material/Box';
|
|
26
|
-
import {
|
|
26
|
+
import { styled } from '@mui/material/styles';
|
|
27
27
|
import { useTranslation } from 'react-i18next';
|
|
28
28
|
import { useController, useFormContext } from 'react-hook-form';
|
|
29
29
|
import Text from '../../../../components/Text';
|
|
30
30
|
import Collapse from '../../../../components/Collapse';
|
|
31
31
|
import CheckIcon from '@mui/icons-material/Check';
|
|
32
|
-
import
|
|
32
|
+
import ScreenContainer from '../../../../features/shared/Containers/ScreenContainer';
|
|
33
33
|
import Icon from '../../../../components/Icon';
|
|
34
|
-
import Input from '../../../../
|
|
34
|
+
import Input from '../../../../features/shared/Input';
|
|
35
|
+
import ExpandIcon from '../../../../features/shared/ExpandIcon';
|
|
35
36
|
import SimpleList from '../../../../components/SimpleList';
|
|
36
37
|
import { useLanguage } from '../../../../hooks';
|
|
37
|
-
var InputStyled = styled(Input)(function (_a) {
|
|
38
|
-
var theme = _a.theme;
|
|
39
|
-
return ({
|
|
40
|
-
padding: theme.spacing(0, 2.5, 0, 2.5),
|
|
41
|
-
'& .MuiInputBase-input': {
|
|
42
|
-
cursor: 'pointer'
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
var BoxStyled = styled(Box)(function (_a) {
|
|
47
|
-
var theme = _a.theme;
|
|
48
|
-
return ({
|
|
49
|
-
display: 'flex',
|
|
50
|
-
flexDirection: 'column',
|
|
51
|
-
padding: theme.spacing(0, 0, 2.5, 0)
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
55
|
-
var theme = _a.theme;
|
|
56
|
-
return ({
|
|
57
|
-
display: 'flex',
|
|
58
|
-
justifyContent: 'space-between',
|
|
59
|
-
padding: theme.spacing(0, 2, 1, 2.5)
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
63
|
-
var theme = _a.theme;
|
|
64
|
-
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption), { paddingBottom: theme.spacing(0.6) }));
|
|
65
|
-
});
|
|
66
38
|
var CountryItemContainer = styled(Box)(function () { return ({
|
|
67
39
|
display: 'flex'
|
|
68
40
|
}); });
|
|
@@ -89,13 +61,6 @@ var CountryIconStyled = styled(Icon)(function (_a) {
|
|
|
89
61
|
verticalAlign: 'middle'
|
|
90
62
|
});
|
|
91
63
|
});
|
|
92
|
-
var ExpandIcon = styled(ExpandMoreIcon, { shouldForwardProp: function (prop) { return prop !== 'anchorEl'; } })(function (_a) {
|
|
93
|
-
var _b;
|
|
94
|
-
var theme = _a.theme, anchorEl = _a.anchorEl;
|
|
95
|
-
return (__assign(__assign({}, theme.typography.h6), (_b = { display: 'flex', transform: !!anchorEl ? 'rotate(180deg)' : '' }, _b[theme.transitions.create(['transform'])] = {
|
|
96
|
-
duration: theme.transitions.duration.standard
|
|
97
|
-
}, _b)));
|
|
98
|
-
});
|
|
99
64
|
var BusinessCountry = React.forwardRef(function (_a, ref) {
|
|
100
65
|
var _b, _c;
|
|
101
66
|
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
@@ -120,7 +85,7 @@ var BusinessCountry = React.forwardRef(function (_a, ref) {
|
|
|
120
85
|
businessCountryControl.field.onChange(country);
|
|
121
86
|
};
|
|
122
87
|
var businessCountry = businessCountryControl.field.value;
|
|
123
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(
|
|
88
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { marginBottom: '25px' } }, { children: [_jsx(Input, { label: t('business_country_label'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, startAdornment: _jsx(CountrySpanStyled, { children: _jsx(CountryIconStyled, { src: (businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.logo) || '' }) }), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('business_country_placeholder'), value: (isAr ? (_b = businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.name) === null || _c === void 0 ? void 0 : _c.english) || '' }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: businessCountries, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
124
89
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsx(CountryIconStyled, { src: item.logo, alt: item.iso3 }), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.idd_prefix) && _jsx(CheckIconStyled, {})] }));
|
|
125
90
|
} }) }))] })) })));
|
|
126
91
|
});
|
|
@@ -18,45 +18,24 @@ import { styled, alpha } from '@mui/material/styles';
|
|
|
18
18
|
import Text from '../../../../components/Text';
|
|
19
19
|
import Tooltip from '@mui/material/Tooltip';
|
|
20
20
|
import Icon from '../../../../components/Icon';
|
|
21
|
-
import Input from '../../../../
|
|
22
|
-
import ClearIcon from '
|
|
21
|
+
import Input from '../../../../features/shared/Input';
|
|
22
|
+
import ClearIcon from '../../../../features/shared/ClearIcon';
|
|
23
23
|
import Collapse from '../../../../components/Collapse';
|
|
24
24
|
import DatePicker from '../../../../components/DatePicker';
|
|
25
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
25
26
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
26
27
|
import { ICONS_NAMES, ID_NUMBER_LENGTH } from '../../../../constants';
|
|
27
|
-
var BoxStyled = styled(Box)(function () { return ({
|
|
28
|
-
display: 'flex',
|
|
29
|
-
flexDirection: 'column'
|
|
30
|
-
}); });
|
|
31
28
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
32
29
|
var theme = _a.theme;
|
|
33
30
|
return ({
|
|
34
31
|
display: 'flex',
|
|
35
32
|
justifyContent: 'space-between',
|
|
36
|
-
padding: theme.spacing(0, 2.5, 1, 2.5)
|
|
33
|
+
padding: theme.spacing(0, 2.5, 1.25, 2.5)
|
|
37
34
|
});
|
|
38
35
|
});
|
|
39
36
|
var InputLabelStyled = styled(Text)(function (_a) {
|
|
40
37
|
var theme = _a.theme;
|
|
41
|
-
return ({
|
|
42
|
-
color: alpha(theme.palette.text.primary, 0.4),
|
|
43
|
-
fontSize: theme.spacing(1.5)
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
var InputStyled = styled(Input)(function (_a) {
|
|
47
|
-
var theme = _a.theme;
|
|
48
|
-
return ({
|
|
49
|
-
padding: theme.spacing(0, 2, 0, 0)
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
var ClearIconStyled = styled(ClearIcon)(function (_a) {
|
|
53
|
-
var theme = _a.theme;
|
|
54
|
-
return ({
|
|
55
|
-
width: theme.spacing(2),
|
|
56
|
-
height: theme.spacing(2),
|
|
57
|
-
cursor: 'pointer',
|
|
58
|
-
color: alpha(theme.palette.text.primary, 0.4)
|
|
59
|
-
});
|
|
38
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
60
39
|
});
|
|
61
40
|
var IconStyled = styled(Icon)(function (_a) {
|
|
62
41
|
var theme = _a.theme;
|
|
@@ -70,9 +49,15 @@ var IDNumber = React.forwardRef(function (_a, ref) {
|
|
|
70
49
|
var _b;
|
|
71
50
|
var onSwitchToMobileNumber = _a.onSwitchToMobileNumber, show = _a.show;
|
|
72
51
|
var t = useTranslation().t;
|
|
73
|
-
var
|
|
52
|
+
var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
|
|
74
53
|
var nidControl = useController({ control: control, name: 'nid' });
|
|
75
54
|
var dobControl = useController({ control: control, name: 'dob' });
|
|
55
|
+
React.useEffect(function () {
|
|
56
|
+
if (nidControl.field.value)
|
|
57
|
+
setValue('nid', nidControl.field.value, { shouldValidate: true });
|
|
58
|
+
if (dobControl.field.value)
|
|
59
|
+
setValue('dob', dobControl.field.value, { shouldValidate: true });
|
|
60
|
+
}, [show]);
|
|
76
61
|
var handleIdChange = function (_a) {
|
|
77
62
|
var target = _a.target;
|
|
78
63
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -85,7 +70,7 @@ var IDNumber = React.forwardRef(function (_a, ref) {
|
|
|
85
70
|
dobControl.field.onChange(data);
|
|
86
71
|
};
|
|
87
72
|
var nidValue = nidControl.field.value;
|
|
88
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(
|
|
73
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('id_number_label') }), _jsx(Tooltip, __assign({ title: t('switch_to_mobile') }, { children: _jsx(IconStyled, { onClick: onSwitchToMobileNumber, alt: 'switcher icon', src: ICONS_NAMES.MOBILE_IMAGE }) }))] }), _jsx(Input, { dir: 'ltr', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: '0000000000', warningType: 'alert', warningMessage: (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message }), _jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
89
74
|
var spacing = _a.spacing;
|
|
90
75
|
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
91
76
|
} } }, { children: t('date_of_birth') })), _jsx(DatePicker, { defaultValue: new Date('2000-01-01'), readOnly: true, dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange })] })) })));
|
|
@@ -18,13 +18,10 @@ import { useTranslation } from 'react-i18next';
|
|
|
18
18
|
import { styled } from '@mui/material/styles';
|
|
19
19
|
import Collapse from '../../../../components/Collapse';
|
|
20
20
|
import Form from '../../../../components/Form';
|
|
21
|
-
import Button from '../../../../
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import { handleNextScreenStep, settingsSelector } from '../../../../app/settings';
|
|
26
|
-
import Icon from '../../../../components/Icon';
|
|
27
|
-
import { ICONS_NAMES } from '../../../../constants/assets';
|
|
21
|
+
import Button from '../../../../features/shared/Button';
|
|
22
|
+
import { useAppDispatch } from '../../../../hooks';
|
|
23
|
+
import { handleNextScreenStep } from '../../../../app/settings';
|
|
24
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
28
25
|
import { useLanguage } from '../../../../hooks';
|
|
29
26
|
import MIDTitle from './MIDTitle';
|
|
30
27
|
import MobileNumber from './MobileNumber';
|
|
@@ -32,24 +29,10 @@ import IDNumber from './IDNumber';
|
|
|
32
29
|
import BusinessCountry from './BusinessCountry';
|
|
33
30
|
import { NIDValidationSchema, PhoneValidationSchema } from './validation';
|
|
34
31
|
import { countriesCode, defaultCountry, businessCountries } from '../../../../constants/dummy';
|
|
35
|
-
var BoxStyled = styled(Box)(function (_a) {
|
|
36
|
-
var theme = _a.theme;
|
|
37
|
-
return ({
|
|
38
|
-
padding: theme.spacing(2.5, 0, 2.5, 0),
|
|
39
|
-
overflow: 'hidden',
|
|
40
|
-
direction: theme.direction
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
32
|
var FormStyled = styled(Form)(function () { return ({
|
|
44
33
|
display: 'flex',
|
|
45
34
|
flexDirection: 'column'
|
|
46
35
|
}); });
|
|
47
|
-
var ButtonContainer = styled(Collapse)(function (_a) {
|
|
48
|
-
var theme = _a.theme;
|
|
49
|
-
return ({
|
|
50
|
-
margin: theme.spacing(0, 2.5, 0, 2.5)
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
36
|
var InputsContainerStyled = styled(Box)(function (_a) {
|
|
54
37
|
var _b;
|
|
55
38
|
var theme = _a.theme, listActive = _a.listActive;
|
|
@@ -61,25 +44,6 @@ var InputsContainerStyled = styled(Box)(function (_a) {
|
|
|
61
44
|
},
|
|
62
45
|
_b);
|
|
63
46
|
});
|
|
64
|
-
var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
|
65
|
-
var theme = _a.theme, isAr = _a.isAr;
|
|
66
|
-
return ({
|
|
67
|
-
width: theme.spacing(3),
|
|
68
|
-
height: theme.spacing(3),
|
|
69
|
-
paddingInlineStart: theme.spacing(1.5),
|
|
70
|
-
paddingInlineEnd: theme.spacing(0.5),
|
|
71
|
-
transform: isAr ? 'scaleX(-1)' : 'scaleX(1)'
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
var LoaderStyled = styled(Loader)(function (_a) {
|
|
75
|
-
var theme = _a.theme;
|
|
76
|
-
return ({
|
|
77
|
-
marginInlineStart: theme.spacing(-6.25),
|
|
78
|
-
'& .loader-box-container': {
|
|
79
|
-
marginInlineStart: theme.spacing(2.5)
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
47
|
var ListType;
|
|
84
48
|
(function (ListType) {
|
|
85
49
|
ListType["BusinessList"] = "BusinessList";
|
|
@@ -89,7 +53,6 @@ var MID = function (_a) {
|
|
|
89
53
|
var _b = React.useState(false), isNID = _b[0], setIsNID = _b[1];
|
|
90
54
|
var _c = React.useState(), listType = _c[0], setListType = _c[1];
|
|
91
55
|
var dispatch = useAppDispatch();
|
|
92
|
-
var settingStore = useAppSelector(settingsSelector);
|
|
93
56
|
var methods = useForm({
|
|
94
57
|
resolver: yupResolver(isNID ? NIDValidationSchema : PhoneValidationSchema),
|
|
95
58
|
defaultValues: {
|
|
@@ -108,11 +71,11 @@ var MID = function (_a) {
|
|
|
108
71
|
};
|
|
109
72
|
var onSubmit = function (data) {
|
|
110
73
|
console.log('data', data);
|
|
111
|
-
dispatch(handleNextScreenStep(
|
|
74
|
+
dispatch(handleNextScreenStep());
|
|
112
75
|
};
|
|
113
76
|
var isBusinessListActive = listType === ListType.BusinessList;
|
|
114
77
|
var isCountryListActive = listType === ListType.CountryCodeList;
|
|
115
78
|
var listActive = isBusinessListActive || isCountryListActive;
|
|
116
|
-
return (_jsxs(
|
|
79
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !listActive, title: t('Welcome to Tap Payments'), description: t('Help us to get your information to start collecting online payments') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(BusinessCountry, { show: !isCountryListActive, countries: businessCountries, onListOpen: function () { return handleMenuListClick(ListType.BusinessList); }, onListClose: function () { return handleMenuListClick(); } }), _jsx(Collapse, __assign({ in: !isNID }, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: countriesCode, onSwitchToIdNumber: function () { return setIsNID(true); }, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) })), _jsx(Collapse, __assign({ in: isNID }, { children: _jsx(IDNumber, { show: !listActive, onSwitchToMobileNumber: function () { return setIsNID(false); } }) }))] })), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ isAr: isAr, disabled: !methods.formState.isValid, loading: false }, { children: t('next') })) }))] })) }))] }));
|
|
117
80
|
};
|
|
118
81
|
export default React.memo(MID);
|
|
@@ -30,10 +30,11 @@ import Text from '../../../../components/Text';
|
|
|
30
30
|
import Collapse from '../../../../components/Collapse';
|
|
31
31
|
import Tooltip from '@mui/material/Tooltip';
|
|
32
32
|
import CheckIcon from '@mui/icons-material/Check';
|
|
33
|
-
import
|
|
34
|
-
import
|
|
33
|
+
import ExpandIcon from '../../../../features/shared/ExpandIcon';
|
|
34
|
+
import ClearIcon from '../../../../features/shared/ClearIcon';
|
|
35
|
+
import ScreenContainer from '../../../../features/shared/Containers/ScreenContainer';
|
|
35
36
|
import Icon from '../../../../components/Icon';
|
|
36
|
-
import Input from '../../../../
|
|
37
|
+
import Input from '../../../../features/shared/Input';
|
|
37
38
|
import SimpleList from '../../../../components/SimpleList';
|
|
38
39
|
import { ICONS_NAMES } from '../../../../constants';
|
|
39
40
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
@@ -46,41 +47,20 @@ var IconStyled = styled(Icon)(function (_a) {
|
|
|
46
47
|
cursor: 'pointer'
|
|
47
48
|
});
|
|
48
49
|
});
|
|
49
|
-
var InputStyled = styled(Input)(function (_a) {
|
|
50
|
-
var theme = _a.theme;
|
|
51
|
-
return ({
|
|
52
|
-
padding: theme.spacing(0, 2.5, 0, 2.5)
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
var BoxStyled = styled(Box)(function () { return ({
|
|
56
|
-
display: 'flex',
|
|
57
|
-
flexDirection: 'column'
|
|
58
|
-
}); });
|
|
59
50
|
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
60
51
|
var theme = _a.theme;
|
|
61
52
|
return ({
|
|
62
53
|
display: 'flex',
|
|
63
54
|
justifyContent: 'space-between',
|
|
64
|
-
padding: theme.spacing(0, 2, 1, 2.5)
|
|
55
|
+
padding: theme.spacing(0, 2.5, 1.25, 2.5)
|
|
65
56
|
});
|
|
66
57
|
});
|
|
67
|
-
var InputLabelStyled = styled(Text)(function (_a) {
|
|
68
|
-
var theme = _a.theme;
|
|
69
|
-
return (__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
70
|
-
});
|
|
71
58
|
var CountryItemContainer = styled(Box)(function () { return ({
|
|
72
59
|
display: 'flex'
|
|
73
60
|
}); });
|
|
74
61
|
var CountryCodeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
75
62
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
76
|
-
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
77
|
-
});
|
|
78
|
-
var ExpandIcon = styled(ExpandMoreIcon, { shouldForwardProp: function (prop) { return prop !== 'anchorEl'; } })(function (_a) {
|
|
79
|
-
var _b;
|
|
80
|
-
var theme = _a.theme, anchorEl = _a.anchorEl;
|
|
81
|
-
return (__assign(__assign({}, theme.typography.h6), (_b = { display: 'flex', transform: !!anchorEl ? 'rotate(180deg)' : '', paddingInlineStart: !!anchorEl ? theme.spacing(0) : theme.spacing(1), paddingInlineEnd: !!anchorEl ? theme.spacing(1) : theme.spacing(0) }, _b[theme.transitions.create(['transform'])] = {
|
|
82
|
-
duration: theme.transitions.duration.standard
|
|
83
|
-
}, _b)));
|
|
63
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { width: theme.spacing(10), fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
84
64
|
});
|
|
85
65
|
var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
86
66
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
@@ -94,19 +74,14 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
|
94
74
|
alignItems: 'flex-end'
|
|
95
75
|
});
|
|
96
76
|
});
|
|
97
|
-
var ClearIconStyled = styled(ClearIcon)(function (_a) {
|
|
98
|
-
var theme = _a.theme;
|
|
99
|
-
return ({
|
|
100
|
-
width: theme.spacing(2),
|
|
101
|
-
height: theme.spacing(2),
|
|
102
|
-
cursor: 'pointer',
|
|
103
|
-
color: alpha(theme.palette.text.primary, 0.4)
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
77
|
var CountryCodeStyled = styled(Text)(function (_a) {
|
|
107
78
|
var theme = _a.theme;
|
|
108
79
|
return (__assign(__assign({ cursor: 'pointer' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightRegular, display: 'flex', alignItems: 'center', minWidth: theme.spacing(8.75) }));
|
|
109
80
|
});
|
|
81
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
82
|
+
var theme = _a.theme;
|
|
83
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
84
|
+
});
|
|
110
85
|
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
111
86
|
var _b;
|
|
112
87
|
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
@@ -114,9 +89,17 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
114
89
|
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
115
90
|
var t = useTranslation().t;
|
|
116
91
|
var isAr = useLanguage().isAr;
|
|
117
|
-
var
|
|
92
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
118
93
|
var phoneControl = useController({ name: 'mobile', control: control });
|
|
119
94
|
var countryCodeControl = useController({ name: 'countryCode', control: control });
|
|
95
|
+
React.useEffect(function () {
|
|
96
|
+
if (phoneControl.field.value) {
|
|
97
|
+
setValue('mobile', phoneControl.field.value, { shouldValidate: true });
|
|
98
|
+
}
|
|
99
|
+
if (countryCodeControl.field.value) {
|
|
100
|
+
setValue('countryCode', countryCodeControl.field.value, { shouldValidate: true });
|
|
101
|
+
}
|
|
102
|
+
}, []);
|
|
120
103
|
var onPhoneNumberChange = function (_a) {
|
|
121
104
|
var target = _a.target;
|
|
122
105
|
var value = removeAllCharsFromNumber(target.value);
|
|
@@ -141,11 +124,9 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
141
124
|
};
|
|
142
125
|
var mobileValue = phoneControl.field.value;
|
|
143
126
|
var countryCodeValue = countryCodeControl.field.value;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return spacing(10);
|
|
148
|
-
} }, 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(CheckIconStyled, {})] }));
|
|
127
|
+
var error = (_b = phoneControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
128
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('mobile_number_label') }), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(Tooltip, __assign({ title: t('switch_to_id') }, { children: _jsx(IconStyled, { onClick: rest.onSwitchToIdNumber, alt: 'switcher icon', src: ICONS_NAMES.ID_IMAGE }) })) }))] }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits) || 10 }, onChange: onPhoneNumberChange, value: mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: onOpenCountryList }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), _jsx(ExpandIcon, { anchorEl: !!anchorEl })] })), endAdornment: mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber }), placeholder: "".concat((countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2) === 'SA' ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: (!anchorEl && error) || '' }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
129
|
+
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(CheckIconStyled, {})] }));
|
|
149
130
|
} }) }))] })) })));
|
|
150
131
|
});
|
|
151
132
|
export default React.memo(MobileNumber);
|