@tap-payments/auth-jsconnect 1.0.4 → 1.0.5
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 +16 -0
- package/build/@types/app.js +6 -1
- package/build/@types/theme.d.ts +12 -3
- package/build/@types/theme.js +15 -1
- package/build/app/rootReducer.d.ts +1 -1
- package/build/app/rootReducer.js +1 -1
- package/build/app/settings.d.ts +7 -2
- package/build/app/settings.js +21 -6
- package/build/app/store.d.ts +2 -2
- package/build/assets/locales/ar.json +22 -3
- package/build/assets/locales/en.json +20 -1
- package/build/components/AnimationFlow/BottomSheet.d.ts +3 -2
- package/build/components/AnimationFlow/BottomSheet.js +30 -3
- package/build/components/AnimationFlow/Dialog.d.ts +3 -2
- package/build/components/AnimationFlow/Dialog.js +32 -9
- package/build/components/Button/Button.d.ts +7 -3
- package/build/components/Button/Button.js +20 -2
- package/build/components/Collapse/Collapse.d.ts +5 -0
- package/build/components/Collapse/Collapse.js +28 -0
- package/build/components/Collapse/index.d.ts +3 -0
- package/build/components/Collapse/index.js +2 -0
- package/build/components/DatePicker/DatePicker.js +3 -3
- package/build/components/Input/Input.d.ts +4 -1
- package/build/components/Input/Input.js +7 -5
- package/build/components/Loader/Loader.d.ts +10 -8
- package/build/components/Loader/Loader.js +14 -35
- package/build/components/OTPTimer/OTPTimer.d.ts +2 -1
- package/build/components/OTPTimer/OTPTimer.js +4 -5
- package/build/components/Providers/ThemeProvider.js +6 -9
- package/build/components/SimpleList/SimpleList.d.ts +10 -2
- package/build/components/SimpleList/SimpleList.js +53 -21
- package/build/components/Slide/Slide.d.ts +6 -0
- package/build/components/Slide/Slide.js +30 -0
- package/build/components/Slide/index.d.ts +3 -0
- package/build/components/Slide/index.js +2 -0
- package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +14 -0
- package/build/components/SocialMediaGroup/SocialMediaGroup.js +86 -0
- package/build/components/SocialMediaGroup/index.d.ts +3 -0
- package/build/components/SocialMediaGroup/index.js +2 -0
- package/build/components/ToggleButton/ToggleButton.d.ts +5 -0
- package/build/components/ToggleButton/ToggleButton.js +44 -0
- package/build/components/ToggleButton/index.d.ts +3 -0
- package/build/components/ToggleButton/index.js +2 -0
- package/build/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +5 -0
- package/build/components/ToggleButtonGroup/ToggleButtonGroup.js +37 -0
- package/build/components/ToggleButtonGroup/index.d.ts +3 -0
- package/build/components/ToggleButtonGroup/index.js +2 -0
- package/build/components/Tooltip/Tooltip.d.ts +10 -0
- package/build/components/Tooltip/Tooltip.js +44 -0
- package/build/components/Tooltip/index.d.ts +3 -0
- package/build/components/Tooltip/index.js +2 -0
- package/build/components/Warning/Warning.d.ts +2 -1
- package/build/components/Warning/Warning.js +2 -1
- package/build/constants/app.d.ts +5 -4
- package/build/constants/app.js +35 -4
- package/build/constants/assets.d.ts +7 -0
- package/build/constants/assets.js +8 -1
- package/build/constants/index.d.ts +1 -0
- package/build/constants/index.js +1 -0
- package/build/constants/validation.d.ts +2 -0
- package/build/constants/validation.js +2 -0
- package/build/features/app/{midStore.d.ts → business/midStore.d.ts} +2 -2
- package/build/features/app/{midStore.js → business/midStore.js} +0 -0
- package/build/features/app/connect/midStore.d.ts +10 -0
- package/build/features/app/connect/midStore.js +18 -0
- package/build/features/business/index.d.ts +0 -0
- package/build/features/business/index.js +1 -0
- package/build/features/business/screens/IDBOD/DOB.d.ts +5 -0
- package/build/features/business/screens/IDBOD/DOB.js +44 -0
- package/build/features/business/screens/IDBOD/ID.d.ts +5 -0
- package/build/features/business/screens/IDBOD/ID.js +68 -0
- package/build/features/business/screens/IDBOD/IDBOD.d.ts +5 -0
- package/build/features/business/screens/IDBOD/IDBOD.js +86 -0
- package/build/features/business/screens/IDBOD/index.d.ts +3 -0
- package/build/features/business/screens/IDBOD/index.js +2 -0
- package/build/features/business/screens/IDBOD/validation.d.ts +11 -0
- package/build/features/business/screens/IDBOD/validation.js +5 -0
- package/build/features/connect/Connect.js +28 -18
- package/build/features/connect/Footer.d.ts +4 -0
- package/build/features/connect/Footer.js +16 -0
- package/build/features/connect/screens/Individual/Email.d.ts +5 -0
- package/build/features/connect/screens/Individual/Email.js +56 -0
- package/build/features/connect/screens/Individual/Individual.d.ts +5 -0
- package/build/features/connect/screens/Individual/Individual.js +86 -0
- package/build/features/connect/screens/Individual/Name.d.ts +5 -0
- package/build/features/connect/screens/Individual/Name.js +58 -0
- package/build/features/connect/screens/Individual/index.d.ts +3 -0
- package/build/features/connect/screens/Individual/index.js +2 -0
- package/build/features/connect/screens/Individual/validation.d.ts +11 -0
- package/build/features/connect/screens/Individual/validation.js +5 -0
- package/build/features/connect/screens/MID/BusinessCountry.d.ts +2 -6
- package/build/features/connect/screens/MID/BusinessCountry.js +16 -40
- package/build/features/connect/screens/MID/IDNumber.d.ts +0 -4
- package/build/features/connect/screens/MID/IDNumber.js +13 -10
- package/build/features/connect/screens/MID/MID.js +73 -19
- package/build/features/connect/screens/MID/MIDTitle.js +2 -2
- package/build/features/connect/screens/MID/MobileNumber.d.ts +2 -7
- package/build/features/connect/screens/MID/MobileNumber.js +23 -48
- package/build/features/connect/screens/MID/validation.d.ts +18 -0
- package/build/features/connect/screens/MID/validation.js +8 -0
- package/build/features/connect/screens/Merchant/BrandName.d.ts +5 -0
- package/build/features/connect/screens/Merchant/BrandName.js +99 -0
- package/build/features/connect/screens/Merchant/Merchant.d.ts +5 -0
- package/build/features/connect/screens/Merchant/Merchant.js +94 -0
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +5 -0
- package/build/features/connect/screens/Merchant/SocialMedia.js +87 -0
- package/build/features/connect/screens/Merchant/TAC.d.ts +5 -0
- package/build/features/connect/screens/Merchant/TAC.js +88 -0
- package/build/features/connect/screens/Merchant/index.d.ts +3 -0
- package/build/features/connect/screens/Merchant/index.js +2 -0
- package/build/features/connect/screens/Merchant/validation.d.ts +50 -0
- package/build/features/connect/screens/Merchant/validation.js +23 -0
- package/build/features/connect/screens/OTP/OTP.d.ts +6 -2
- package/build/features/connect/screens/OTP/OTP.js +64 -25
- package/build/features/connect/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/connect/screens/OTP/OTPInput.js +51 -0
- package/build/features/connect/screens/OTP/OTPTimer.d.ts +5 -0
- package/build/features/connect/screens/OTP/OTPTimer.js +35 -0
- package/build/features/connect/screens/OTP/validation.d.ts +8 -0
- package/build/features/connect/screens/OTP/validation.js +4 -0
- package/build/features/connect/screens/Password/Password.d.ts +5 -0
- package/build/features/connect/screens/Password/Password.js +86 -0
- package/build/features/connect/screens/Password/PasswordInput.d.ts +5 -0
- package/build/features/connect/screens/Password/PasswordInput.js +73 -0
- package/build/features/connect/screens/Password/index.d.ts +3 -0
- package/build/features/connect/screens/Password/index.js +2 -0
- package/build/features/connect/screens/Password/validation.d.ts +8 -0
- package/build/features/connect/screens/Password/validation.js +4 -0
- package/build/features/connect/screens/ThankYou/ThankYou.d.ts +5 -0
- package/build/features/connect/screens/ThankYou/ThankYou.js +76 -0
- package/build/features/connect/screens/ThankYou/index.d.ts +3 -0
- package/build/features/connect/screens/ThankYou/index.js +2 -0
- package/build/features/featuresScreens.d.ts +2 -0
- package/build/features/featuresScreens.js +28 -0
- package/build/hooks/index.d.ts +4 -0
- package/build/hooks/index.js +4 -0
- package/build/hooks/useAppDispatch.d.ts +4 -0
- package/build/hooks/useAppDispatch.js +2 -0
- package/build/hooks/useAppSelector.d.ts +3 -0
- package/build/hooks/useAppSelector.js +2 -0
- package/build/hooks/useAppTheme.js +3 -2
- package/build/hooks/useEventListener.d.ts +5 -0
- package/build/hooks/useEventListener.js +20 -0
- package/build/hooks/useLanguage.d.ts +4 -0
- package/build/hooks/useLanguage.js +8 -0
- package/build/index.css +5 -0
- package/build/theme/palette.js +1 -0
- package/build/theme/theme.d.ts +1 -1
- package/build/theme/theme.js +0 -1
- package/build/utils/string.d.ts +1 -1
- package/build/utils/string.js +1 -3
- package/build/utils/validation.d.ts +4 -0
- package/build/utils/validation.js +12 -0
- package/package.json +120 -116
- package/build/app/hooks.d.ts +0 -7
- package/build/app/hooks.js +0 -3
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import Box from '@mui/material/Box/Box';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import Email from './Email';
|
|
16
|
+
import Name from './Name';
|
|
17
|
+
import * as React from 'react';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
20
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
21
|
+
import Icon from '../../../../components/Icon';
|
|
22
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
|
+
import { handleNextScreenStep, settingsSelector } from '../../../../app/settings';
|
|
24
|
+
import { IndividualValidation } from './validation';
|
|
25
|
+
import Form from '../../../../components/Form';
|
|
26
|
+
import Button from '../../../../components/Button';
|
|
27
|
+
import { ICONS_NAMES } from '../../../../constants/assets';
|
|
28
|
+
import Loader from '../../../../components/Loader';
|
|
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
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexDirection: 'column'
|
|
41
|
+
}); });
|
|
42
|
+
var ButtonContainer = styled(Box)(function (_a) {
|
|
43
|
+
var theme = _a.theme;
|
|
44
|
+
return ({
|
|
45
|
+
margin: theme.spacing(2.5, 2.5, 0, 2.5)
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
|
49
|
+
var theme = _a.theme, isAr = _a.isAr;
|
|
50
|
+
return ({
|
|
51
|
+
width: theme.spacing(3),
|
|
52
|
+
height: theme.spacing(3),
|
|
53
|
+
paddingInlineStart: theme.spacing(1.5),
|
|
54
|
+
paddingInlineEnd: theme.spacing(0.5),
|
|
55
|
+
transform: isAr ? 'scaleX(-1)' : 'scaleX(1)'
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
var LoaderStyled = styled(Loader)(function (_a) {
|
|
59
|
+
var theme = _a.theme;
|
|
60
|
+
return ({
|
|
61
|
+
marginInlineStart: theme.spacing(-6.25),
|
|
62
|
+
'& .loader-box-container': {
|
|
63
|
+
marginInlineStart: theme.spacing(2.5)
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
var Individual = function (_a) {
|
|
68
|
+
var dispatch = useAppDispatch();
|
|
69
|
+
var settingStore = useAppSelector(settingsSelector);
|
|
70
|
+
var methods = useForm({
|
|
71
|
+
resolver: yupResolver(IndividualValidation),
|
|
72
|
+
defaultValues: {
|
|
73
|
+
name: '',
|
|
74
|
+
email: ''
|
|
75
|
+
},
|
|
76
|
+
mode: 'onChange'
|
|
77
|
+
});
|
|
78
|
+
var onSubmit = function (data) {
|
|
79
|
+
console.log('data', data);
|
|
80
|
+
dispatch(handleNextScreenStep(settingStore.data.activeScreen));
|
|
81
|
+
};
|
|
82
|
+
var t = useTranslation().t;
|
|
83
|
+
var isAr = useLanguage().isAr;
|
|
84
|
+
return (_jsx(BoxStyled, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, {}), _jsx(Email, {}), _jsx(ButtonContainer, { children: _jsx(Button, __assign({ disabled: !methods.formState.isValid, type: 'submit', startIcon: _jsx(LoaderStyled, { innerColor: 'white', outerColor: 'white', size: 30, toggleAnimation: false }), endIcon: _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, { children: t('next') })) })] })) })) }));
|
|
85
|
+
};
|
|
86
|
+
export default React.memo(Individual);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import Box from '@mui/material/Box/Box';
|
|
14
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { useTranslation } from 'react-i18next';
|
|
17
|
+
import Text from '../../../../components/Text';
|
|
18
|
+
import Input from '../../../../components/Input';
|
|
19
|
+
import { removeAllNumberFromChars } from '../../../../utils';
|
|
20
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
21
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
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) {
|
|
47
|
+
var _b;
|
|
48
|
+
var _c = useTranslation(), t = _c.t, i18n = _c.i18n;
|
|
49
|
+
var control = useFormContext().control;
|
|
50
|
+
var nameControl = useController({ name: 'name', control: control });
|
|
51
|
+
var handleNameChange = function (event) {
|
|
52
|
+
var value = removeAllNumberFromChars(event.target.value);
|
|
53
|
+
nameControl.field.onChange(value);
|
|
54
|
+
};
|
|
55
|
+
var nameValue = nameControl.field.value;
|
|
56
|
+
return (_jsxs(BoxStyled, __assign({ ref: ref, dir: i18n.dir() }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_merchant_name_label') }) }), _jsx(InputStyled, { value: nameValue, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), dir: i18n.dir(), warningType: 'alert', warningMessage: (_b = nameControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message })] })));
|
|
57
|
+
});
|
|
58
|
+
export default React.memo(Name);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const IndividualValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
name: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
email: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
5
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
6
|
+
name: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
7
|
+
email: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
9
|
+
name: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
10
|
+
email: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
|
+
}>>>;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Control } from 'react-hook-form';
|
|
3
2
|
import { CountryCode } from '../../../../@types';
|
|
4
3
|
interface BusinessCountryProps {
|
|
5
4
|
countries: Array<CountryCode>;
|
|
6
5
|
show: boolean;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
onOpenBusinessCountryList?: () => void;
|
|
10
|
-
onCloseBusinessCountryList?: () => void;
|
|
11
|
-
control?: Control<any, any>;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
12
8
|
}
|
|
13
9
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<BusinessCountryProps & React.RefAttributes<unknown>>>;
|
|
14
10
|
export default _default;
|
|
@@ -25,14 +25,15 @@ import * as React from 'react';
|
|
|
25
25
|
import Box from '@mui/material/Box';
|
|
26
26
|
import { alpha, styled } from '@mui/material/styles';
|
|
27
27
|
import { useTranslation } from 'react-i18next';
|
|
28
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
28
29
|
import Text from '../../../../components/Text';
|
|
29
|
-
import Collapse from '
|
|
30
|
+
import Collapse from '../../../../components/Collapse';
|
|
30
31
|
import CheckIcon from '@mui/icons-material/Check';
|
|
31
32
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
32
33
|
import Icon from '../../../../components/Icon';
|
|
33
34
|
import Input from '../../../../components/Input';
|
|
34
35
|
import SimpleList from '../../../../components/SimpleList';
|
|
35
|
-
import {
|
|
36
|
+
import { useLanguage } from '../../../../hooks';
|
|
36
37
|
var InputStyled = styled(Input)(function (_a) {
|
|
37
38
|
var theme = _a.theme;
|
|
38
39
|
return ({
|
|
@@ -97,55 +98,30 @@ var ExpandIcon = styled(ExpandMoreIcon, { shouldForwardProp: function (prop) { r
|
|
|
97
98
|
});
|
|
98
99
|
var BusinessCountry = React.forwardRef(function (_a, ref) {
|
|
99
100
|
var _b, _c;
|
|
100
|
-
var countries = _a.countries,
|
|
101
|
-
var
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
setBusinessCountries(countries);
|
|
108
|
-
}, []);
|
|
109
|
-
React.useEffect(function () {
|
|
110
|
-
if (defaultCountry)
|
|
111
|
-
setSelected(defaultCountry);
|
|
112
|
-
}, [defaultCountry]);
|
|
113
|
-
var onCountrySearch = function (e) {
|
|
114
|
-
if (e === null || e === void 0 ? void 0 : e.code) {
|
|
115
|
-
var searchList = getCountrySearch(businessCountries, e.code);
|
|
116
|
-
if (searchList.length === 0 || e.code === 'Backspace')
|
|
117
|
-
setBusinessCountries(businessCountries);
|
|
118
|
-
else
|
|
119
|
-
setBusinessCountries(searchList);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
var getCountrySearch = function (originalList, searchKey) {
|
|
123
|
-
var _a;
|
|
124
|
-
return (_a = (originalList || [])) === null || _a === void 0 ? void 0 : _a.filter(function (item) {
|
|
125
|
-
return item.name.english.charAt(0).toLowerCase() === searchKey.charAt(searchKey.length - 1).toLowerCase();
|
|
126
|
-
});
|
|
127
|
-
};
|
|
101
|
+
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
102
|
+
var businessCountries = React.useState(countries)[0];
|
|
103
|
+
var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
104
|
+
var t = useTranslation().t;
|
|
105
|
+
var isAr = useLanguage().isAr;
|
|
106
|
+
var control = useFormContext().control;
|
|
107
|
+
var businessCountryControl = useController({ control: control, name: 'businessCountry' });
|
|
128
108
|
var onOpenCountrySelect = function (event) {
|
|
129
109
|
var _a;
|
|
130
110
|
setAnchorEl(event.currentTarget);
|
|
131
|
-
|
|
132
|
-
setBusinessCountries(countries);
|
|
133
|
-
(_a = rest.onOpenBusinessCountryList) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
111
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
134
112
|
};
|
|
135
113
|
var onCloseCountrySelect = function () {
|
|
136
114
|
var _a;
|
|
137
115
|
setAnchorEl(null);
|
|
138
|
-
|
|
139
|
-
setBusinessCountries(countries);
|
|
140
|
-
(_a = rest.onCloseBusinessCountryList) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
116
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
141
117
|
};
|
|
142
118
|
var onSelectItem = function (country) {
|
|
143
|
-
setSelected(country);
|
|
144
|
-
onSelect && onSelect(country);
|
|
145
119
|
onCloseCountrySelect();
|
|
120
|
+
businessCountryControl.field.onChange(country);
|
|
146
121
|
};
|
|
147
|
-
|
|
148
|
-
|
|
122
|
+
var businessCountry = businessCountryControl.field.value;
|
|
123
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(BoxStyled, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('business_country_label') }) }), _jsx(InputStyled, { 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, timeout: 300 }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: businessCountries, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
124
|
+
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, {})] }));
|
|
149
125
|
} }) }))] })) })));
|
|
150
126
|
});
|
|
151
127
|
export default React.memo(BusinessCountry);
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Control } from 'react-hook-form';
|
|
3
2
|
interface IDNumberProps {
|
|
4
3
|
show: boolean;
|
|
5
4
|
onSwitchToMobileNumber?: () => void;
|
|
6
|
-
onIdChange?: (id: string) => void;
|
|
7
|
-
onBirthDateChange?: (data: string) => void;
|
|
8
|
-
control?: Control<any, any>;
|
|
9
5
|
}
|
|
10
6
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
|
|
11
7
|
export default _default;
|
|
@@ -13,13 +13,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import Box from '@mui/material/Box';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
17
|
import { styled, alpha } from '@mui/material/styles';
|
|
17
18
|
import Text from '../../../../components/Text';
|
|
18
19
|
import Tooltip from '@mui/material/Tooltip';
|
|
19
20
|
import Icon from '../../../../components/Icon';
|
|
20
21
|
import Input from '../../../../components/Input';
|
|
21
22
|
import ClearIcon from '@mui/icons-material/Clear';
|
|
22
|
-
import Collapse from '
|
|
23
|
+
import Collapse from '../../../../components/Collapse';
|
|
23
24
|
import DatePicker from '../../../../components/DatePicker';
|
|
24
25
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
25
26
|
import { ICONS_NAMES, ID_NUMBER_LENGTH } from '../../../../constants';
|
|
@@ -66,23 +67,25 @@ var IconStyled = styled(Icon)(function (_a) {
|
|
|
66
67
|
});
|
|
67
68
|
});
|
|
68
69
|
var IDNumber = React.forwardRef(function (_a, ref) {
|
|
69
|
-
var
|
|
70
|
-
var
|
|
70
|
+
var _b;
|
|
71
|
+
var onSwitchToMobileNumber = _a.onSwitchToMobileNumber, show = _a.show;
|
|
71
72
|
var t = useTranslation().t;
|
|
73
|
+
var control = useFormContext().control;
|
|
74
|
+
var nidControl = useController({ control: control, name: 'nid' });
|
|
75
|
+
var dobControl = useController({ control: control, name: 'dob' });
|
|
72
76
|
var handleIdChange = function (_a) {
|
|
73
77
|
var target = _a.target;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
onIdChange === null || onIdChange === void 0 ? void 0 : onIdChange(target.value);
|
|
78
|
+
var value = removeAllCharsFromNumber(target.value);
|
|
79
|
+
nidControl.field.onChange(value);
|
|
77
80
|
};
|
|
78
81
|
var clearIdNumber = function () {
|
|
79
|
-
|
|
80
|
-
onIdChange === null || onIdChange === void 0 ? void 0 : onIdChange('');
|
|
82
|
+
nidControl.field.onChange('');
|
|
81
83
|
};
|
|
82
84
|
var handleBirthDateChange = function (data) {
|
|
83
|
-
|
|
85
|
+
dobControl.field.onChange(data);
|
|
84
86
|
};
|
|
85
|
-
|
|
87
|
+
var nidValue = nidControl.field.value;
|
|
88
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(BoxStyled, __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(InputStyled, { dir: 'ltr', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: nidValue && _jsx(ClearIconStyled, { 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) {
|
|
86
89
|
var spacing = _a.spacing;
|
|
87
90
|
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
88
91
|
} } }, { children: t('date_of_birth') })), _jsx(DatePicker, { defaultValue: new Date('2000-01-01'), readOnly: true, dir: 'ltr', locale: 'en', onDateChange: handleBirthDateChange })] })) })));
|
|
@@ -12,21 +12,72 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import Box from '@mui/material/Box';
|
|
15
|
-
import { useForm } from 'react-hook-form';
|
|
15
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
16
17
|
import { useTranslation } from 'react-i18next';
|
|
17
18
|
import { styled } from '@mui/material/styles';
|
|
18
|
-
import
|
|
19
|
+
import Collapse from '../../../../components/Collapse';
|
|
19
20
|
import Form from '../../../../components/Form';
|
|
21
|
+
import Button from '../../../../components/Button';
|
|
22
|
+
import Loader from '../../../../components/Loader';
|
|
23
|
+
import Slide from '../../../../components/Slide';
|
|
24
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
25
|
+
import { handleNextScreenStep, settingsSelector } from '../../../../app/settings';
|
|
26
|
+
import Icon from '../../../../components/Icon';
|
|
27
|
+
import { ICONS_NAMES } from '../../../../constants/assets';
|
|
28
|
+
import { useLanguage } from '../../../../hooks';
|
|
20
29
|
import MIDTitle from './MIDTitle';
|
|
21
30
|
import MobileNumber from './MobileNumber';
|
|
22
31
|
import IDNumber from './IDNumber';
|
|
23
32
|
import BusinessCountry from './BusinessCountry';
|
|
33
|
+
import { NIDValidationSchema, PhoneValidationSchema } from './validation';
|
|
24
34
|
import { countriesCode, defaultCountry, businessCountries } from '../../../../constants/dummy';
|
|
25
35
|
var BoxStyled = styled(Box)(function (_a) {
|
|
26
36
|
var theme = _a.theme;
|
|
27
37
|
return ({
|
|
28
38
|
padding: theme.spacing(2.5, 0, 2.5, 0),
|
|
29
|
-
overflow: 'hidden'
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
direction: theme.direction
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'column'
|
|
46
|
+
}); });
|
|
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
|
+
var InputsContainerStyled = styled(Box)(function (_a) {
|
|
54
|
+
var _b;
|
|
55
|
+
var theme = _a.theme, listActive = _a.listActive;
|
|
56
|
+
return (_b = {
|
|
57
|
+
paddingBottom: theme.spacing(listActive ? 0 : 5)
|
|
58
|
+
},
|
|
59
|
+
_b[theme.transitions.create(['padding-bottom'])] = {
|
|
60
|
+
duration: theme.transitions.duration.standard
|
|
61
|
+
},
|
|
62
|
+
_b);
|
|
63
|
+
});
|
|
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
|
+
}
|
|
30
81
|
});
|
|
31
82
|
});
|
|
32
83
|
var ListType;
|
|
@@ -37,28 +88,31 @@ var ListType;
|
|
|
37
88
|
var MID = function (_a) {
|
|
38
89
|
var _b = React.useState(false), isNID = _b[0], setIsNID = _b[1];
|
|
39
90
|
var _c = React.useState(), listType = _c[0], setListType = _c[1];
|
|
40
|
-
var
|
|
91
|
+
var dispatch = useAppDispatch();
|
|
92
|
+
var settingStore = useAppSelector(settingsSelector);
|
|
93
|
+
var methods = useForm({
|
|
94
|
+
resolver: yupResolver(isNID ? NIDValidationSchema : PhoneValidationSchema),
|
|
95
|
+
defaultValues: {
|
|
96
|
+
countryCode: defaultCountry,
|
|
97
|
+
businessCountry: defaultCountry,
|
|
98
|
+
nid: '',
|
|
99
|
+
dob: '',
|
|
100
|
+
mobile: ''
|
|
101
|
+
},
|
|
102
|
+
mode: 'onChange'
|
|
103
|
+
});
|
|
41
104
|
var t = useTranslation().t;
|
|
105
|
+
var isAr = useLanguage().isAr;
|
|
42
106
|
var handleMenuListClick = function (flag) {
|
|
43
107
|
setListType(flag);
|
|
44
108
|
};
|
|
45
|
-
var
|
|
46
|
-
console.log(
|
|
47
|
-
|
|
48
|
-
var onMobileChange = function (mobile) {
|
|
49
|
-
console.log(mobile);
|
|
50
|
-
};
|
|
51
|
-
var onBirthDateChange = function (data) {
|
|
52
|
-
console.log(data);
|
|
53
|
-
};
|
|
54
|
-
var onSelectCountryCode = function (country) {
|
|
55
|
-
console.log(country);
|
|
56
|
-
};
|
|
57
|
-
var onSelectBusinessCountry = function (country) {
|
|
58
|
-
console.log(country);
|
|
109
|
+
var onSubmit = function (data) {
|
|
110
|
+
console.log('data', data);
|
|
111
|
+
dispatch(handleNextScreenStep(settingStore.data.activeScreen));
|
|
59
112
|
};
|
|
60
113
|
var isBusinessListActive = listType === ListType.BusinessList;
|
|
61
114
|
var isCountryListActive = listType === ListType.CountryCodeList;
|
|
62
|
-
|
|
115
|
+
var listActive = isBusinessListActive || isCountryListActive;
|
|
116
|
+
return (_jsxs(BoxStyled, { 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(Slide, __assign({ direction: 'right', 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(Slide, __assign({ direction: 'left', in: isNID }, { children: _jsx(IDNumber, { show: !listActive, onSwitchToMobileNumber: function () { return setIsNID(false); } }) }))] })), _jsx(ButtonContainer, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ disabled: !methods.formState.isValid, type: 'submit', startIcon: _jsx(LoaderStyled, { innerColor: 'white', outerColor: 'white', size: 30 }), endIcon: _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, { children: t('next') })) }))] })) }))] }));
|
|
63
117
|
};
|
|
64
118
|
export default React.memo(MID);
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { styled, alpha } from '@mui/material/styles';
|
|
15
|
-
import Collapse from '
|
|
15
|
+
import Collapse from '../../../../components/Collapse';
|
|
16
16
|
import Text from '../../../../components/Text';
|
|
17
17
|
var TitleStyled = styled(Text)(function (_a) {
|
|
18
18
|
var theme = _a.theme;
|
|
@@ -24,6 +24,6 @@ var DescriptionStyled = styled(Text)(function (_a) {
|
|
|
24
24
|
});
|
|
25
25
|
var MIDTitle = function (_a) {
|
|
26
26
|
var description = _a.description, show = _a.show, title = _a.title;
|
|
27
|
-
return (_jsxs(Collapse, __assign({ in: show
|
|
27
|
+
return (_jsxs(Collapse, __assign({ in: show }, { children: [_jsx(TitleStyled, { children: title }), _jsx(DescriptionStyled, { children: description })] })));
|
|
28
28
|
};
|
|
29
29
|
export default React.memo(MIDTitle);
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Control } from 'react-hook-form';
|
|
3
2
|
import { CountryCode } from '../../../../@types';
|
|
4
3
|
interface MobileNumberProps {
|
|
5
4
|
countries: Array<CountryCode>;
|
|
6
5
|
show: boolean;
|
|
7
|
-
onSelect?: (country: CountryCode) => void;
|
|
8
|
-
defaultCountry?: CountryCode;
|
|
9
6
|
onSwitchToIdNumber?: () => void;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
onCloseCountryList?: () => void;
|
|
13
|
-
control?: Control<any, any>;
|
|
7
|
+
onListOpen?: () => void;
|
|
8
|
+
onListClose?: () => void;
|
|
14
9
|
}
|
|
15
10
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
|
|
16
11
|
export default _default;
|