@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
|
@@ -24,9 +24,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
24
24
|
import * as React from 'react';
|
|
25
25
|
import Box from '@mui/material/Box';
|
|
26
26
|
import { useTranslation } from 'react-i18next';
|
|
27
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
27
28
|
import { styled, alpha } from '@mui/material/styles';
|
|
28
29
|
import Text from '../../../../components/Text';
|
|
29
|
-
import Collapse from '
|
|
30
|
+
import Collapse from '../../../../components/Collapse';
|
|
30
31
|
import Tooltip from '@mui/material/Tooltip';
|
|
31
32
|
import CheckIcon from '@mui/icons-material/Check';
|
|
32
33
|
import ClearIcon from '@mui/icons-material/Clear';
|
|
@@ -34,8 +35,9 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
|
34
35
|
import Icon from '../../../../components/Icon';
|
|
35
36
|
import Input from '../../../../components/Input';
|
|
36
37
|
import SimpleList from '../../../../components/SimpleList';
|
|
37
|
-
import { ICONS_NAMES
|
|
38
|
+
import { ICONS_NAMES } from '../../../../constants';
|
|
38
39
|
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
40
|
+
import { useLanguage } from '../../../../hooks';
|
|
39
41
|
var IconStyled = styled(Icon)(function (_a) {
|
|
40
42
|
var theme = _a.theme;
|
|
41
43
|
return ({
|
|
@@ -106,71 +108,44 @@ var CountryCodeStyled = styled(Text)(function (_a) {
|
|
|
106
108
|
return (__assign(__assign({ cursor: 'pointer' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightRegular, display: 'flex', alignItems: 'center', minWidth: theme.spacing(8.75) }));
|
|
107
109
|
});
|
|
108
110
|
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
109
|
-
var
|
|
110
|
-
var
|
|
111
|
-
var
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
var
|
|
115
|
-
var
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}, []);
|
|
119
|
-
React.useEffect(function () {
|
|
120
|
-
if (defaultCountry)
|
|
121
|
-
setSelected(defaultCountry);
|
|
122
|
-
}, [defaultCountry]);
|
|
111
|
+
var _b;
|
|
112
|
+
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
113
|
+
var countriesCode = React.useState(countries)[0];
|
|
114
|
+
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
115
|
+
var t = useTranslation().t;
|
|
116
|
+
var isAr = useLanguage().isAr;
|
|
117
|
+
var control = useFormContext().control;
|
|
118
|
+
var phoneControl = useController({ name: 'mobile', control: control });
|
|
119
|
+
var countryCodeControl = useController({ name: 'countryCode', control: control });
|
|
123
120
|
var onPhoneNumberChange = function (_a) {
|
|
124
|
-
var _b;
|
|
125
121
|
var target = _a.target;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
setMobileValue(target.value);
|
|
122
|
+
var value = removeAllCharsFromNumber(target.value);
|
|
123
|
+
phoneControl.field.onChange(value);
|
|
129
124
|
};
|
|
130
125
|
var clearMobileNumber = function () {
|
|
131
|
-
|
|
132
|
-
setMobileValue('');
|
|
133
|
-
(_a = rest.onMobileChange) === null || _a === void 0 ? void 0 : _a.call(rest, '');
|
|
134
|
-
};
|
|
135
|
-
var onCountryCodeSearch = function (e) {
|
|
136
|
-
if (e === null || e === void 0 ? void 0 : e.code) {
|
|
137
|
-
var searchList = getCountryCodeSearch(countriesCode, e.code);
|
|
138
|
-
if (searchList.length === 0 || e.code === 'Backspace')
|
|
139
|
-
setCountriesCode(countriesCode);
|
|
140
|
-
else
|
|
141
|
-
setCountriesCode(searchList);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
var getCountryCodeSearch = function (originalList, searchKey) {
|
|
145
|
-
var _a;
|
|
146
|
-
return (_a = (originalList || [])) === null || _a === void 0 ? void 0 : _a.filter(function (item) {
|
|
147
|
-
return item.name.english.charAt(0).toLowerCase() === searchKey.charAt(searchKey.length - 1).toLowerCase();
|
|
148
|
-
});
|
|
126
|
+
phoneControl.field.onChange('');
|
|
149
127
|
};
|
|
150
128
|
var onOpenCountryList = function (event) {
|
|
151
129
|
var _a;
|
|
152
130
|
setAnchorEl(event.currentTarget);
|
|
153
|
-
|
|
154
|
-
setCountriesCode(countries);
|
|
155
|
-
(_a = rest.onOpenCountryList) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
131
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
156
132
|
};
|
|
157
133
|
var onCloseCountryList = function () {
|
|
158
134
|
var _a;
|
|
159
135
|
setAnchorEl(null);
|
|
160
|
-
|
|
161
|
-
setCountriesCode(countries);
|
|
162
|
-
(_a = rest.onCloseCountryList) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
136
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
163
137
|
};
|
|
164
138
|
var onSelectItem = function (country) {
|
|
165
|
-
setSelected(country);
|
|
166
|
-
onSelect && onSelect(country);
|
|
167
139
|
onCloseCountryList();
|
|
140
|
+
countryCodeControl.field.onChange(country);
|
|
168
141
|
};
|
|
169
|
-
|
|
142
|
+
var mobileValue = phoneControl.field.value;
|
|
143
|
+
var countryCodeValue = countryCodeControl.field.value;
|
|
144
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(BoxStyled, __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(InputStyled, { dir: '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(ClearIconStyled, { onClick: clearMobileNumber }), placeholder: "".concat((countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.iso2) === 'SA' ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: (_b = phoneControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
170
145
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ sx: { width: function (_a) {
|
|
171
146
|
var spacing = _a.spacing;
|
|
172
147
|
return spacing(10);
|
|
173
|
-
} }, isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (
|
|
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, {})] }));
|
|
174
149
|
} }) }))] })) })));
|
|
175
150
|
});
|
|
176
151
|
export default React.memo(MobileNumber);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
nid: 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
|
+
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
7
|
+
nid: 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
|
+
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
10
|
+
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
|
+
}>>>;
|
|
12
|
+
export declare const PhoneValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
13
|
+
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
14
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
15
|
+
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
16
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
17
|
+
mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
18
|
+
}>>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export var NIDValidationSchema = yup.object().shape({
|
|
3
|
+
dob: yup.string().min(5).required('DOB is required'),
|
|
4
|
+
nid: yup.string().min(8).max(10).required('NID is required')
|
|
5
|
+
});
|
|
6
|
+
export var PhoneValidationSchema = yup.object().shape({
|
|
7
|
+
mobile: yup.string().min(5).required('Phone number is required')
|
|
8
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
19
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
20
|
+
import Text from '../../../../components/Text';
|
|
21
|
+
import Input from '../../../../components/Input';
|
|
22
|
+
import ClearIcon from '@mui/icons-material/Clear';
|
|
23
|
+
import Tooltip from '../../../../components/Tooltip';
|
|
24
|
+
import { removeAllOtherThanAlphabet } from '../../../../utils';
|
|
25
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
26
|
+
var theme = _a.theme;
|
|
27
|
+
return ({
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexDirection: 'column',
|
|
30
|
+
padding: theme.spacing(0, 0, 3, 0),
|
|
31
|
+
direction: theme.direction
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return ({
|
|
37
|
+
display: 'flex',
|
|
38
|
+
justifyContent: 'space-between',
|
|
39
|
+
padding: theme.spacing(0, 2.5, 1, 2.5)
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
43
|
+
var theme = _a.theme;
|
|
44
|
+
return ({
|
|
45
|
+
color: alpha(theme.palette.text.primary, 0.4),
|
|
46
|
+
fontSize: theme.spacing(1.5)
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
var InputStyled = styled(Input)(function (_a) {
|
|
50
|
+
var theme = _a.theme;
|
|
51
|
+
return ({
|
|
52
|
+
padding: theme.spacing(0, 2, 0, 0)
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
var ClearIconStyled = styled(ClearIcon)(function (_a) {
|
|
56
|
+
var theme = _a.theme;
|
|
57
|
+
return ({
|
|
58
|
+
width: theme.spacing(2),
|
|
59
|
+
height: theme.spacing(2),
|
|
60
|
+
cursor: 'pointer',
|
|
61
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
65
|
+
var theme = _a.theme;
|
|
66
|
+
return ({
|
|
67
|
+
width: theme.spacing(2.75),
|
|
68
|
+
height: theme.spacing(2.125),
|
|
69
|
+
cursor: 'pointer',
|
|
70
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
74
|
+
var theme = _a.theme;
|
|
75
|
+
return ({
|
|
76
|
+
width: theme.spacing(2.75),
|
|
77
|
+
height: theme.spacing(2.125),
|
|
78
|
+
cursor: 'pointer',
|
|
79
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
var BrandName = function (_a) {
|
|
83
|
+
var _b;
|
|
84
|
+
var _c = React.useState(false), isHovered = _c[0], setIsHovered = _c[1];
|
|
85
|
+
var t = useTranslation().t;
|
|
86
|
+
var control = useFormContext().control;
|
|
87
|
+
var brandControl = useController({ control: control, name: 'brandName' });
|
|
88
|
+
var handleBrandNameChange = function (_a) {
|
|
89
|
+
var target = _a.target;
|
|
90
|
+
var value = removeAllOtherThanAlphabet(target.value);
|
|
91
|
+
brandControl.field.onChange(value);
|
|
92
|
+
};
|
|
93
|
+
var clearBrandName = function () {
|
|
94
|
+
brandControl.field.onChange('');
|
|
95
|
+
};
|
|
96
|
+
var brandNameValue = brandControl.field.value;
|
|
97
|
+
return (_jsxs(BoxStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_description'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(InputStyled, { onChange: handleBrandNameChange, value: brandNameValue, endAdornment: brandNameValue && _jsx(ClearIconStyled, { onClick: clearBrandName }), placeholder: t('brand_name_placeholder'), warningType: 'alert', warningMessage: (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message })] }));
|
|
98
|
+
};
|
|
99
|
+
export default React.memo(BrandName);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
17
|
+
import Box from '@mui/material/Box';
|
|
18
|
+
import { styled } from '@mui/material/styles';
|
|
19
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
20
|
+
import { handleNextScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
|
+
import Form from '../../../../components/Form';
|
|
22
|
+
import Loader from '../../../../components/Loader';
|
|
23
|
+
import Icon from '../../../../components/Icon';
|
|
24
|
+
import Button from '../../../../components/Button';
|
|
25
|
+
import { useLanguage } from '../../../../hooks';
|
|
26
|
+
import { ICONS_NAMES } from '../../../../constants';
|
|
27
|
+
import { MerchantValidationSchema } from './validation';
|
|
28
|
+
import BrandName from './BrandName';
|
|
29
|
+
import SocialMedia from './SocialMedia';
|
|
30
|
+
import TAC from './TAC';
|
|
31
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
32
|
+
var theme = _a.theme;
|
|
33
|
+
return ({
|
|
34
|
+
padding: theme.spacing(2.5, 0, 2.5, 0),
|
|
35
|
+
overflow: 'hidden',
|
|
36
|
+
direction: theme.direction
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var ButtonContainer = styled(Box)(function (_a) {
|
|
40
|
+
var theme = _a.theme;
|
|
41
|
+
return ({
|
|
42
|
+
margin: theme.spacing(0, 2.5, 0, 2.5)
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
var InputsContainerStyled = styled(Box)(function (_a) {
|
|
46
|
+
var theme = _a.theme;
|
|
47
|
+
return ({
|
|
48
|
+
paddingBottom: theme.spacing(5)
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
var IconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
|
52
|
+
var theme = _a.theme, isAr = _a.isAr;
|
|
53
|
+
return ({
|
|
54
|
+
width: theme.spacing(3),
|
|
55
|
+
height: theme.spacing(3),
|
|
56
|
+
paddingInlineStart: theme.spacing(1.5),
|
|
57
|
+
paddingInlineEnd: theme.spacing(0.5),
|
|
58
|
+
transform: isAr ? 'scaleX(-1)' : 'scaleX(1)'
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var LoaderStyled = styled(Loader)(function (_a) {
|
|
62
|
+
var theme = _a.theme;
|
|
63
|
+
return ({
|
|
64
|
+
marginInlineStart: theme.spacing(-6.25),
|
|
65
|
+
'& .loader-box-container': {
|
|
66
|
+
marginInlineStart: theme.spacing(2.5)
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
var Merchant = function (_a) {
|
|
71
|
+
var methods = useForm({
|
|
72
|
+
resolver: yupResolver(MerchantValidationSchema),
|
|
73
|
+
defaultValues: {
|
|
74
|
+
brandName: '',
|
|
75
|
+
termAndConditionChecked: false,
|
|
76
|
+
links: {
|
|
77
|
+
website: '',
|
|
78
|
+
twitter: '',
|
|
79
|
+
instagram: ''
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
mode: 'onChange'
|
|
83
|
+
});
|
|
84
|
+
var t = useTranslation().t;
|
|
85
|
+
var isAr = useLanguage().isAr;
|
|
86
|
+
var dispatch = useAppDispatch();
|
|
87
|
+
var settingStore = useAppSelector(settingsSelector);
|
|
88
|
+
var onSubmit = function (data) {
|
|
89
|
+
console.log('data', data);
|
|
90
|
+
dispatch(handleNextScreenStep(settingStore.data.activeScreen));
|
|
91
|
+
};
|
|
92
|
+
return (_jsx(BoxStyled, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, { children: [_jsx(BrandName, {}), _jsx(SocialMedia, {}), _jsx(TAC, {})] }), _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') })) })] })) })) }));
|
|
93
|
+
};
|
|
94
|
+
export default React.memo(Merchant);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
+
import ClearIcon from '@mui/icons-material/Clear';
|
|
19
|
+
import { SocialMediaTypes } from '../../../../@types';
|
|
20
|
+
import Input from '../../../../components/Input';
|
|
21
|
+
import Text from '../../../../components/Text';
|
|
22
|
+
import Collapse from '../../../../components/Collapse';
|
|
23
|
+
import SocialMediaGroup from '../../../../components/SocialMediaGroup';
|
|
24
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
25
|
+
var theme = _a.theme;
|
|
26
|
+
return ({
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
direction: theme.direction
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
var SocialMediaGroupStyled = styled(SocialMediaGroup)(function (_a) {
|
|
33
|
+
var theme = _a.theme, defaultValue = _a.defaultValue;
|
|
34
|
+
return ({
|
|
35
|
+
borderTop: "1px solid ".concat(alpha(theme.palette.divider, 0.8)),
|
|
36
|
+
borderBottom: !defaultValue ? "1px solid ".concat(alpha(theme.palette.divider, 0.8)) : ''
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var InputStyled = styled(Input)(function (_a) {
|
|
40
|
+
var theme = _a.theme;
|
|
41
|
+
return ({
|
|
42
|
+
padding: theme.spacing(0, 2, 0, 0),
|
|
43
|
+
input: {
|
|
44
|
+
paddingInlineStart: theme.spacing(0)
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var TextStyled = styled(Text)(function (_a) {
|
|
49
|
+
var theme = _a.theme;
|
|
50
|
+
return ({
|
|
51
|
+
padding: theme.spacing(0, 0, 0, 1.5)
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
var ClearIconStyled = styled(ClearIcon)(function (_a) {
|
|
55
|
+
var theme = _a.theme;
|
|
56
|
+
return ({
|
|
57
|
+
width: theme.spacing(2),
|
|
58
|
+
height: theme.spacing(2),
|
|
59
|
+
cursor: 'pointer',
|
|
60
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
var SocialMedia = function (_a) {
|
|
64
|
+
var _b, _c, _d;
|
|
65
|
+
var _e = React.useState(SocialMediaTypes.WEB), socialMediaType = _e[0], setSocialMediaType = _e[1];
|
|
66
|
+
var t = useTranslation().t;
|
|
67
|
+
var control = useFormContext().control;
|
|
68
|
+
var linksControl = useController({ control: control, name: 'links' });
|
|
69
|
+
var links = linksControl.field.value;
|
|
70
|
+
var handleChange = function (_a) {
|
|
71
|
+
var _b;
|
|
72
|
+
var target = _a.target;
|
|
73
|
+
linksControl.field.onChange(__assign(__assign({}, links), (_b = {}, _b[socialMediaType] = target.value, _b)));
|
|
74
|
+
};
|
|
75
|
+
var handleClear = function () {
|
|
76
|
+
var _a;
|
|
77
|
+
linksControl.field.onChange(__assign(__assign({}, links), (_a = {}, _a[socialMediaType] = '', _a)));
|
|
78
|
+
};
|
|
79
|
+
var websiteValue = links.website || '';
|
|
80
|
+
var twitterValue = links.twitter || '';
|
|
81
|
+
var instagramValue = links.instagram || '';
|
|
82
|
+
var errors = linksControl.fieldState.error;
|
|
83
|
+
return (_jsxs(BoxStyled, { children: [_jsx(SocialMediaGroupStyled, { defaultValue: socialMediaType, exclusive: true, onChange: function (e, value) {
|
|
84
|
+
setSocialMediaType(value);
|
|
85
|
+
} }), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.WEB, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: websiteValue, startAdornment: _jsx(TextStyled, { children: "https://" }), endAdornment: websiteValue && _jsx(ClearIconStyled, { onClick: handleClear }), placeholder: t('website_placeholder'), warningType: 'alert', warningMessage: (_b = errors === null || errors === void 0 ? void 0 : errors.website) === null || _b === void 0 ? void 0 : _b.message }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.TWITTER, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: twitterValue, startAdornment: _jsx(TextStyled, { children: "@" }), endAdornment: twitterValue && _jsx(ClearIconStyled, { onClick: handleClear }), placeholder: t('twitter_placeholder'), warningType: 'alert', warningMessage: (_c = errors === null || errors === void 0 ? void 0 : errors.twitter) === null || _c === void 0 ? void 0 : _c.message }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.INSTAGRAM, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: instagramValue, startAdornment: _jsx(TextStyled, { children: "@" }), endAdornment: instagramValue && _jsx(ClearIconStyled, { onClick: handleClear }), placeholder: t('instagram_placeholder'), warningType: 'alert', warningMessage: (_d = errors === null || errors === void 0 ? void 0 : errors.instagram) === null || _d === void 0 ? void 0 : _d.message }) }))] }));
|
|
86
|
+
};
|
|
87
|
+
export default React.memo(SocialMedia);
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
+
import Link from '@mui/material/Link';
|
|
19
|
+
import CheckBox from '../../../../components/CheckBox';
|
|
20
|
+
import Text from '../../../../components/Text';
|
|
21
|
+
import Warning from '../../../../components/Warning';
|
|
22
|
+
import { useLanguage } from '../../../../hooks';
|
|
23
|
+
import Collapse from '../../../../components/Collapse';
|
|
24
|
+
import { EXTERNAL_LINKS } from '../../../../constants';
|
|
25
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
26
|
+
var theme = _a.theme;
|
|
27
|
+
return ({
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexDirection: 'column',
|
|
30
|
+
padding: theme.spacing(3, 0, 0, 0),
|
|
31
|
+
alignItems: 'start',
|
|
32
|
+
width: '100%'
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
var TACContainerStyled = styled(Box)(function (_a) {
|
|
36
|
+
var theme = _a.theme;
|
|
37
|
+
return ({
|
|
38
|
+
display: 'flex',
|
|
39
|
+
flexDirection: 'row',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
padding: theme.spacing(0, 2.5, 1.5, 2.5)
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
var TextStyled = styled(Text)(function (_a) {
|
|
45
|
+
var theme = _a.theme;
|
|
46
|
+
return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre' }, theme.typography.body2));
|
|
47
|
+
});
|
|
48
|
+
var LinkStyled = styled(Link)(function (_a) {
|
|
49
|
+
var theme = _a.theme;
|
|
50
|
+
return ({
|
|
51
|
+
color: theme.palette.primary.main,
|
|
52
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
53
|
+
letterSpacing: theme.spacing(0)
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
var CheckboxStyled = styled(CheckBox)(function (_a) {
|
|
57
|
+
var theme = _a.theme;
|
|
58
|
+
return ({
|
|
59
|
+
margin: theme.spacing(0),
|
|
60
|
+
padding: theme.spacing(0),
|
|
61
|
+
marginInlineEnd: theme.spacing(1.5),
|
|
62
|
+
color: theme.palette.primary.main,
|
|
63
|
+
'& .MuiSvgIcon-root': {
|
|
64
|
+
fontSize: 30
|
|
65
|
+
},
|
|
66
|
+
'&.Mui-checked': {
|
|
67
|
+
color: theme.palette.text.primary,
|
|
68
|
+
borderRadius: theme.spacing(2.5)
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var CollapseStyled = styled(Collapse)(function () { return ({
|
|
73
|
+
width: '100%'
|
|
74
|
+
}); });
|
|
75
|
+
var TAC = function (_a) {
|
|
76
|
+
var _b;
|
|
77
|
+
var t = useTranslation().t;
|
|
78
|
+
var isAr = useLanguage().isAr;
|
|
79
|
+
var control = useFormContext().control;
|
|
80
|
+
var tacControl = useController({ control: control, name: 'termAndConditionChecked' });
|
|
81
|
+
var tacChecked = tacControl.field.value;
|
|
82
|
+
var warningMessage = (_b = tacControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
83
|
+
var handleTACCheckedChange = function (event, checked) {
|
|
84
|
+
tacControl.field.onChange(checked);
|
|
85
|
+
};
|
|
86
|
+
return (_jsxs(BoxStyled, { 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 ? EXTERNAL_LINKS.TOS_AR : 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 })) }))] }));
|
|
87
|
+
};
|
|
88
|
+
export default React.memo(TAC);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const MerchantValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
5
|
+
links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
6
|
+
website: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
7
|
+
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
8
|
+
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
9
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
10
|
+
website: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
|
+
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
12
|
+
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
13
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
14
|
+
website: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
15
|
+
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
16
|
+
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
17
|
+
}>>>;
|
|
18
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
19
|
+
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
20
|
+
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
21
|
+
links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
22
|
+
website: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
|
+
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
24
|
+
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
25
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
26
|
+
website: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
27
|
+
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
28
|
+
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
29
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
30
|
+
website: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
31
|
+
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
32
|
+
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
33
|
+
}>>>;
|
|
34
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
35
|
+
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
36
|
+
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
37
|
+
links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
38
|
+
website: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
39
|
+
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
40
|
+
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
41
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
42
|
+
website: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
43
|
+
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
44
|
+
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
45
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
46
|
+
website: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
47
|
+
instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
48
|
+
twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
|
|
49
|
+
}>>>;
|
|
50
|
+
}>>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export var MerchantValidationSchema = yup.object().shape({
|
|
3
|
+
brandName: yup.string().min(3, 'Please enter valid brand name').required('Brand Name is required'),
|
|
4
|
+
termAndConditionChecked: yup.boolean().required().isTrue('Please accept the terms and conditions'),
|
|
5
|
+
links: yup.object().shape({
|
|
6
|
+
website: yup
|
|
7
|
+
.string()
|
|
8
|
+
.matches(/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/, 'Please enter valid url')
|
|
9
|
+
.required('Website is required'),
|
|
10
|
+
instagram: yup
|
|
11
|
+
.string()
|
|
12
|
+
.notRequired()
|
|
13
|
+
.nullable()
|
|
14
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
15
|
+
.min(2, 'Invalid instagram username'),
|
|
16
|
+
twitter: yup
|
|
17
|
+
.string()
|
|
18
|
+
.notRequired()
|
|
19
|
+
.nullable()
|
|
20
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
21
|
+
.min(2, 'Invalid instagram username')
|
|
22
|
+
})
|
|
23
|
+
});
|