@tap-payments/auth-jsconnect 1.0.50 → 1.0.53
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 +3 -3
- package/build/@types/form.d.ts +22 -2
- package/build/api/entity.d.ts +5 -2
- package/build/api/index.d.ts +3 -3
- package/build/api/lead.d.ts +1 -1
- package/build/app/rootReducer.d.ts +4 -0
- package/build/app/rootReducer.js +9 -1
- package/build/app/store.d.ts +8 -0
- package/build/assets/locales/ar.json +2 -1
- package/build/assets/locales/en.json +3 -2
- package/build/components/AnimationFlow/AnimationFlow.d.ts +3 -1
- package/build/components/AnimationFlow/AnimationFlow.js +5 -1
- package/build/components/AnimationFlow/Loader.d.ts +2 -0
- package/build/components/AnimationFlow/Loader.js +14 -0
- package/build/components/Loader/Loader.d.ts +1 -0
- package/build/components/Loader/Loader.js +1 -1
- package/build/components/SimpleList/SimpleList.js +1 -0
- package/build/constants/app.d.ts +24 -0
- package/build/constants/app.js +61 -19
- package/build/constants/dummy.d.ts +2 -0
- package/build/constants/dummy.js +12 -6
- package/build/features/app/bank/bankStore.d.ts +36 -0
- package/build/features/app/bank/bankStore.js +218 -0
- package/build/features/app/business/businessStore.d.ts +1 -2
- package/build/features/app/business/businessStore.js +56 -56
- package/build/features/app/connect/connectStore.js +31 -30
- package/build/features/app/individual/individualStore.d.ts +36 -0
- package/build/features/app/individual/individualStore.js +222 -0
- package/build/features/app/password/passwordStore.d.ts +36 -0
- package/build/features/app/password/passwordStore.js +218 -0
- package/build/features/app/tax/taxStore.d.ts +36 -0
- package/build/features/app/tax/taxStore.js +217 -0
- package/build/features/bank/Bank.d.ts +2 -1
- package/build/features/bank/Bank.js +15 -5
- package/build/features/bank/screens/BankDetails/BankDetails.js +1 -2
- package/build/features/bank/screens/Verify/OTPInput.d.ts +5 -0
- package/build/features/bank/screens/Verify/OTPInput.js +42 -0
- package/build/features/bank/screens/Verify/Verify.d.ts +5 -0
- package/build/features/bank/screens/Verify/Verify.js +78 -0
- package/build/features/bank/screens/Verify/index.d.ts +2 -0
- package/build/features/bank/screens/Verify/index.js +2 -0
- package/build/features/bank/screens/Verify/validation.d.ts +8 -0
- package/build/features/bank/screens/Verify/validation.js +4 -0
- package/build/features/business/screens/Activities/Activities.js +8 -8
- package/build/features/business/screens/Activities/ActivitiesList.js +7 -7
- package/build/features/business/screens/Activities/SalesChannels.js +1 -1
- package/build/features/business/screens/BusinessType/CRNumber.d.ts +2 -1
- package/build/features/business/screens/BusinessType/CRNumber.js +2 -2
- package/build/features/business/screens/BusinessType/CompanyLicense.js +2 -1
- package/build/features/business/screens/BusinessType/FLNumber.d.ts +2 -1
- package/build/features/business/screens/BusinessType/FLNumber.js +2 -2
- package/build/features/business/screens/BusinessType/FreelanceLicense.js +2 -1
- package/build/features/business/screens/Confirm/Confirm.js +1 -1
- package/build/features/connect/Connect.js +2 -2
- package/build/features/connect/screens/Individual/MobileNumber.js +1 -1
- package/build/features/connect/screens/Individual/validation.js +1 -1
- package/build/features/connect/screens/Merchant/BrandList.d.ts +0 -2
- package/build/features/connect/screens/Merchant/BrandList.js +16 -40
- package/build/features/connect/screens/Merchant/Merchant.js +42 -23
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +2 -1
- package/build/features/connect/screens/Merchant/SocialMedia.js +30 -3
- package/build/features/connect/screens/Merchant/validation.d.ts +6 -1
- package/build/features/connect/screens/Merchant/validation.js +67 -7
- package/build/features/connect/screens/Mobile/MobileNumber.js +1 -1
- package/build/features/connect/screens/Mobile/validation.js +1 -1
- package/build/features/featuresScreens.js +20 -10
- package/build/features/individual/Individual.d.ts +2 -1
- package/build/features/individual/Individual.js +15 -7
- package/build/features/individual/screens/Verify/OTPInput.d.ts +5 -0
- package/build/features/individual/screens/Verify/OTPInput.js +42 -0
- package/build/features/individual/screens/Verify/Verify.d.ts +5 -0
- package/build/features/individual/screens/Verify/Verify.js +78 -0
- package/build/features/individual/screens/Verify/index.d.ts +2 -0
- package/build/features/individual/screens/Verify/index.js +2 -0
- package/build/features/individual/screens/Verify/validation.d.ts +8 -0
- package/build/features/individual/screens/Verify/validation.js +4 -0
- package/build/features/password/Password.d.ts +2 -1
- package/build/features/password/Password.js +15 -7
- package/build/features/password/screens/Verify/OTPInput.d.ts +5 -0
- package/build/features/password/screens/Verify/OTPInput.js +42 -0
- package/build/features/password/screens/Verify/Verify.d.ts +5 -0
- package/build/features/password/screens/Verify/Verify.js +78 -0
- package/build/features/password/screens/Verify/index.d.ts +2 -0
- package/build/features/password/screens/Verify/index.js +2 -0
- package/build/features/password/screens/Verify/validation.d.ts +8 -0
- package/build/features/password/screens/Verify/validation.js +4 -0
- package/build/features/tax/Tax.d.ts +2 -1
- package/build/features/tax/Tax.js +15 -7
- package/build/features/tax/screens/Verify/OTPInput.d.ts +5 -0
- package/build/features/tax/screens/Verify/OTPInput.js +42 -0
- package/build/features/tax/screens/Verify/Verify.d.ts +5 -0
- package/build/features/tax/screens/Verify/Verify.js +78 -0
- package/build/features/tax/screens/Verify/index.d.ts +2 -0
- package/build/features/tax/screens/Verify/index.js +2 -0
- package/build/features/tax/screens/Verify/validation.d.ts +8 -0
- package/build/features/tax/screens/Verify/validation.js +4 -0
- package/build/hooks/useAppDispatch.d.ts +4 -0
- package/build/utils/string.js +0 -1
- package/package.json +1 -1
|
@@ -51,6 +51,6 @@ var Confirm = function () {
|
|
|
51
51
|
dispatch(handlePrevScreenStep());
|
|
52
52
|
};
|
|
53
53
|
var disabled = !methods.formState.isValid || !!error;
|
|
54
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputStyled, { label: t(isCR ? 'signup_business_cr_info_title' : 'signup_business_fl_info_title'), value: licenseNumber, disabled: true }), _jsx(InputStyled, { label: t('signup_brand_name_label'), value: brandName, disabled: true }), _jsx(InputStyled, { sx: { marginBlockEnd: 0 }, label: t('signup_legal_name_label'), value: legalName, disabled: true }), _jsx(Button, __assign({ disabled: disabled, loading: loading, error: t(error || ''), onBackClicked: function () { return onBack(); }, isAr: isAr }, { children: t('confirm') }))] })) })) }));
|
|
54
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputStyled, { label: t(isCR ? 'signup_business_cr_info_title' : 'signup_business_fl_info_title'), value: licenseNumber, disabled: true }), _jsx(InputStyled, { label: t('signup_brand_name_label'), placeholder: t('signup_brand_name_label'), value: brandName, disabled: true }), _jsx(InputStyled, { sx: { marginBlockEnd: 0 }, label: t('signup_legal_name_label'), placeholder: t('signup_legal_name_label'), value: legalName, disabled: true }), _jsx(Button, __assign({ disabled: disabled, loading: loading, error: t(error || ''), onBackClicked: function () { return onBack(); }, isAr: isAr }, { children: t('confirm') }))] })) })) }));
|
|
55
55
|
};
|
|
56
56
|
export default React.memo(Confirm);
|
|
@@ -27,14 +27,14 @@ var Connect = memo(function (props) {
|
|
|
27
27
|
var open = React.useState(true)[0];
|
|
28
28
|
var theme = useAppTheme().theme;
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
|
-
var
|
|
30
|
+
var _a = useAppSelector(settingsSelector), data = _a.data, loading = _a.loading;
|
|
31
31
|
useAppConfig(__assign({ navigation: CONNECT_SCREENS_NAVIGATION }, props));
|
|
32
32
|
useErrorListener();
|
|
33
33
|
var activeScreen = data.activeScreen;
|
|
34
34
|
useEffect(function () {
|
|
35
35
|
dispatch(getCountries());
|
|
36
36
|
}, []);
|
|
37
|
-
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) {
|
|
37
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: false, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
|
|
38
38
|
var Element = _a.element, name = _a.name;
|
|
39
39
|
var isActive = activeScreen.name === name;
|
|
40
40
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -116,7 +116,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
116
116
|
setValue('mobile', '');
|
|
117
117
|
countryCodeControl.field.onChange(country);
|
|
118
118
|
};
|
|
119
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '
|
|
119
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
120
120
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
121
121
|
} }) }))] })) })));
|
|
122
122
|
});
|
|
@@ -25,7 +25,7 @@ export var IndividualMobileValidation = yup.object().shape({
|
|
|
25
25
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
26
26
|
if (!isNumber)
|
|
27
27
|
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
28
|
-
var isStartWithZero = mobileValue.startsWith('
|
|
28
|
+
var isStartWithZero = mobileValue.startsWith('05');
|
|
29
29
|
var isStartWith5 = mobileValue.startsWith('5');
|
|
30
30
|
var isSaudiNumber = isStartWith5 || isStartWithZero;
|
|
31
31
|
if (isSA) {
|
|
@@ -5,8 +5,6 @@ interface BrandListProps {
|
|
|
5
5
|
list: Array<BrandInfo>;
|
|
6
6
|
onListOpen?: () => void;
|
|
7
7
|
onListClose?: () => void;
|
|
8
|
-
showTerms?: () => void;
|
|
9
|
-
hideTerms?: () => void;
|
|
10
8
|
}
|
|
11
9
|
declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: BrandListProps) => JSX.Element>;
|
|
12
10
|
export default _default;
|
|
@@ -20,18 +20,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
-
if (ar || !(i in from)) {
|
|
26
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
-
ar[i] = from[i];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
-
};
|
|
32
23
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
24
|
import * as React from 'react';
|
|
34
25
|
import { useTranslation } from 'react-i18next';
|
|
26
|
+
import { useFormContext, useController } from 'react-hook-form';
|
|
35
27
|
import Box from '@mui/material/Box';
|
|
36
28
|
import { styled } from '@mui/material/styles';
|
|
37
29
|
import { useLanguage } from '../../../../hooks';
|
|
@@ -42,7 +34,6 @@ import SimpleList from '../../../../components/SimpleList';
|
|
|
42
34
|
import Text from '../../../../components/Text';
|
|
43
35
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
44
36
|
import Collapse from '../../../../components/Collapse';
|
|
45
|
-
import { OTHER_BRAND } from '../../../../constants';
|
|
46
37
|
var InputStyled = styled(Input)(function () { return ({
|
|
47
38
|
'& .MuiInputBase-input': {
|
|
48
39
|
cursor: 'pointer'
|
|
@@ -57,11 +48,14 @@ var BrandNameText = styled(Text, { shouldForwardProp: function (prop) { return p
|
|
|
57
48
|
});
|
|
58
49
|
var BrandList = function (_a) {
|
|
59
50
|
var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
|
|
60
|
-
var _b = React.useState(
|
|
61
|
-
var _c = React.useState(), selectedBrand = _c[0], setSelectedBrand = _c[1];
|
|
62
|
-
var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
51
|
+
var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
63
52
|
var t = useTranslation().t;
|
|
64
53
|
var isAr = useLanguage().isAr;
|
|
54
|
+
var _c = useFormContext(), setValue = _c.setValue, control = _c.control;
|
|
55
|
+
var linksControl = useController({ control: control, name: 'links' });
|
|
56
|
+
var selectedBrandControl = useController({ control: control, name: 'selectedBrandItem' });
|
|
57
|
+
var links = linksControl.field.value;
|
|
58
|
+
var selectedBrand = selectedBrandControl.field.value;
|
|
65
59
|
var onOpenBrandList = function (event) {
|
|
66
60
|
var _a;
|
|
67
61
|
setAnchorEl(event.currentTarget);
|
|
@@ -72,42 +66,24 @@ var BrandList = function (_a) {
|
|
|
72
66
|
setAnchorEl(null);
|
|
73
67
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
74
68
|
};
|
|
75
|
-
React.useEffect(function () {
|
|
76
|
-
var array = list;
|
|
77
|
-
if ((array === null || array === void 0 ? void 0 : array.length) > 0) {
|
|
78
|
-
var hasOther = array === null || array === void 0 ? void 0 : array.find(function (item) { return isOtherLicense(item); });
|
|
79
|
-
var first = array[0];
|
|
80
|
-
if (first) {
|
|
81
|
-
setSelectedBrand(first);
|
|
82
|
-
if (!hasOther)
|
|
83
|
-
array = __spreadArray(__spreadArray([], array, true), [OTHER_BRAND], false);
|
|
84
|
-
setBrandList(array);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}, [show, list]);
|
|
88
69
|
var getBrandName = function (item) {
|
|
89
70
|
var _a, _b;
|
|
90
|
-
return (isAr ? (_a = item
|
|
71
|
+
return (isAr ? (_a = item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item.name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
91
72
|
};
|
|
92
73
|
var getBrandId = function (item) {
|
|
93
|
-
return
|
|
74
|
+
return item.id || '';
|
|
94
75
|
};
|
|
95
76
|
var isOtherLicense = function (item) {
|
|
96
|
-
return
|
|
77
|
+
return item.id === 'other';
|
|
97
78
|
};
|
|
98
79
|
var onSelectItem = function (brand) {
|
|
99
|
-
|
|
100
|
-
setSelectedBrand(brand);
|
|
80
|
+
selectedBrandControl.field.onChange(brand);
|
|
101
81
|
onCloseBrandList();
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
(_b = rest.hideTerms) === null || _b === void 0 ? void 0 : _b.call(rest);
|
|
82
|
+
var website = brand.website;
|
|
83
|
+
setValue('links', __assign(__assign({}, links), { website: website }), { shouldValidate: true });
|
|
107
84
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
} }) }))] })) }) })));
|
|
85
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputStyled, { label: t('select_brand_label'), readOnly: true, onClick: !!anchorEl ? onCloseBrandList : onOpenBrandList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_brand'), value: t(getBrandName(selectedBrand)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', list: list, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
86
|
+
return (_jsxs(_Fragment, { children: [_jsx(BrandContainer, { children: _jsx(BrandNameText, __assign({ isSelected: getBrandId(item) === getBrandId(selectedBrand) }, { children: isOtherLicense(item) ? t(getBrandName(item)) : getBrandName(item) })) }), getBrandId(item) === getBrandId(selectedBrand) && _jsx(CheckIcon, {})] }));
|
|
87
|
+
} }) }))] }) })));
|
|
112
88
|
};
|
|
113
89
|
export default React.memo(BrandList);
|
|
@@ -23,27 +23,34 @@ import { ScreenContainer } from '../../../shared/Containers';
|
|
|
23
23
|
import Button from '../../../shared/Button';
|
|
24
24
|
import { clearError, connectSelector, updateLeadBrand } from '../../../app/connect/connectStore';
|
|
25
25
|
import { useLanguage } from '../../../../hooks';
|
|
26
|
-
import { MerchantValidationSchema } from './validation';
|
|
26
|
+
import { MerchantValidationSchema, ValidationOptions } from './validation';
|
|
27
27
|
import BrandName from './BrandName';
|
|
28
28
|
import SocialMedia from './SocialMedia';
|
|
29
29
|
import TAC from './TAC';
|
|
30
30
|
import BrandList from './BrandList';
|
|
31
31
|
var Merchant = function (_a) {
|
|
32
|
-
var _b, _c, _d
|
|
33
|
-
var
|
|
34
|
-
var
|
|
32
|
+
var _b, _c, _d;
|
|
33
|
+
var _e = React.useState(false), brandNameChecking = _e[0], setBrandNameChecking = _e[1];
|
|
34
|
+
var _f = React.useState(ValidationOptions.NEW_USER), userType = _f[0], setUserType = _f[1];
|
|
35
|
+
var _g = React.useState(false), listActive = _g[0], setListActive = _g[1];
|
|
36
|
+
var _h = useSelector(connectSelector), data = _h.data, loading = _h.loading, error = _h.error;
|
|
35
37
|
var isNewUser = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.new_user;
|
|
36
|
-
var
|
|
38
|
+
var isAbsher = data.otpData.isAbsher;
|
|
39
|
+
var brandList = ((_c = data.brandData.responseBody) === null || _c === void 0 ? void 0 : _c.brands) || [];
|
|
40
|
+
var _j = data.brandData, brandName = _j.brandName, links = _j.links, selectedBrandItem = _j.selectedBrandItem, termAndConditionChecked = _j.termAndConditionChecked, responseBody = _j.responseBody;
|
|
37
41
|
var methods = useForm({
|
|
38
|
-
resolver: yupResolver(MerchantValidationSchema(
|
|
39
|
-
defaultValues:
|
|
42
|
+
resolver: yupResolver(MerchantValidationSchema(userType)),
|
|
43
|
+
defaultValues: {
|
|
44
|
+
brandName: brandName,
|
|
45
|
+
links: links,
|
|
46
|
+
selectedBrandItem: selectedBrandItem,
|
|
47
|
+
termAndConditionChecked: termAndConditionChecked
|
|
48
|
+
},
|
|
40
49
|
mode: 'onChange'
|
|
41
50
|
});
|
|
42
51
|
var t = useTranslation().t;
|
|
43
52
|
var isAr = useLanguage().isAr;
|
|
44
53
|
var dispatch = useAppDispatch();
|
|
45
|
-
var isAbsher = data.otpData.isAbsher;
|
|
46
|
-
var _m = React.useState(false), listActive = _m[0], setListActive = _m[1];
|
|
47
54
|
var onSubmit = function (formData) {
|
|
48
55
|
dispatch(updateLeadBrand(formData));
|
|
49
56
|
};
|
|
@@ -54,26 +61,38 @@ var Merchant = function (_a) {
|
|
|
54
61
|
}
|
|
55
62
|
dispatch(handlePrevScreenStep(isAbsher ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
|
|
56
63
|
};
|
|
57
|
-
React.useEffect(function () {
|
|
58
|
-
if (!isNewUser) {
|
|
59
|
-
methods.setValue('brandName', '', { shouldValidate: true });
|
|
60
|
-
methods.setValue('termAndConditionChecked', false, {
|
|
61
|
-
shouldValidate: true
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}, [isOther]);
|
|
65
64
|
React.useEffect(function () {
|
|
66
65
|
if (error)
|
|
67
66
|
dispatch(clearError());
|
|
68
67
|
}, [methods.formState.isValid]);
|
|
69
68
|
React.useEffect(function () {
|
|
70
|
-
|
|
71
|
-
if (((_b = (_a = data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.response_code) === '5')
|
|
69
|
+
if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.response_code) === '5')
|
|
72
70
|
methods.setError('brandName', { message: 'Profile Name already exists' });
|
|
73
|
-
}, [
|
|
71
|
+
}, [responseBody]);
|
|
72
|
+
React.useEffect(function () {
|
|
73
|
+
if (isNewUser === true) {
|
|
74
|
+
setUserType(ValidationOptions.NEW_USER);
|
|
75
|
+
}
|
|
76
|
+
if (isNewUser === false && methods.getValues('selectedBrandItem').id === 'other') {
|
|
77
|
+
setUserType(ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND);
|
|
78
|
+
methods.clearErrors();
|
|
79
|
+
setTimeout(function () { return methods.setValue('brandName', '', { shouldValidate: true }); }, 100);
|
|
80
|
+
}
|
|
81
|
+
if (isNewUser === false && methods.getValues('selectedBrandItem').id !== 'other') {
|
|
82
|
+
setUserType(ValidationOptions.EXISTING_USER_WITH_EXIST_BRAND);
|
|
83
|
+
methods.clearErrors();
|
|
84
|
+
var sites_1 = __assign(__assign({}, links), { website: selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.website });
|
|
85
|
+
setTimeout(function () { return methods.setValue('links', sites_1, { shouldValidate: true }); }, 100);
|
|
86
|
+
}
|
|
87
|
+
}, [methods.getValues('selectedBrandItem'), isNewUser]);
|
|
88
|
+
React.useEffect(function () {
|
|
89
|
+
if (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id)
|
|
90
|
+
methods.setValue('selectedBrandItem', selectedBrandItem, { shouldValidate: true });
|
|
91
|
+
}, [selectedBrandItem]);
|
|
74
92
|
var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
|
|
75
|
-
var disabled = brandErrChecks || brandNameChecking || ((
|
|
76
|
-
var
|
|
77
|
-
|
|
93
|
+
var disabled = brandErrChecks || brandNameChecking || ((_d = data.brandData.responseBody) === null || _d === void 0 ? void 0 : _d.response_code) === '5';
|
|
94
|
+
var isBrandListAvailable = userType !== ValidationOptions.NEW_USER && brandList.length > 0;
|
|
95
|
+
var askingForBrandInfo = userType === ValidationOptions.NEW_USER || userType === ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND;
|
|
96
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: isBrandListAvailable, list: brandList, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(BrandName, { show: !listActive && askingForBrandInfo, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(SocialMedia, { show: !listActive, isNewUser: isNewUser }), _jsx(TAC, { show: !listActive && askingForBrandInfo }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
|
|
78
97
|
};
|
|
79
98
|
export default React.memo(Merchant);
|
|
@@ -3,6 +3,7 @@ import { Theme, SxProps } from '@mui/material/styles';
|
|
|
3
3
|
interface SocialMediaProps {
|
|
4
4
|
show: boolean;
|
|
5
5
|
sx?: SxProps<Theme>;
|
|
6
|
+
isNewUser: boolean;
|
|
6
7
|
}
|
|
7
|
-
declare const _default: React.MemoExoticComponent<({ show, sx }: SocialMediaProps) => JSX.Element>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ show, sx, isNewUser }: SocialMediaProps) => JSX.Element>;
|
|
8
9
|
export default _default;
|
|
@@ -57,12 +57,13 @@ var ClearIconStyled = styled(ClearIcon)(function (_a) {
|
|
|
57
57
|
});
|
|
58
58
|
var SocialMedia = function (_a) {
|
|
59
59
|
var _b, _c, _d;
|
|
60
|
-
var show = _a.show, sx = _a.sx;
|
|
60
|
+
var show = _a.show, sx = _a.sx, isNewUser = _a.isNewUser;
|
|
61
61
|
var _e = React.useState(SocialMediaTypes.WEB), socialMediaType = _e[0], setSocialMediaType = _e[1];
|
|
62
62
|
var t = useTranslation().t;
|
|
63
|
-
var
|
|
63
|
+
var _f = useFormContext(), control = _f.control, setValue = _f.setValue, watch = _f.watch;
|
|
64
64
|
var linksControl = useController({ control: control, name: 'links' });
|
|
65
65
|
var links = linksControl.field.value;
|
|
66
|
+
var brandName = watch('brandName');
|
|
66
67
|
var handleChange = function (_a) {
|
|
67
68
|
var _b;
|
|
68
69
|
var target = _a.target;
|
|
@@ -72,6 +73,32 @@ var SocialMedia = function (_a) {
|
|
|
72
73
|
var _a;
|
|
73
74
|
linksControl.field.onChange(__assign(__assign({}, links), (_a = {}, _a[socialMediaType] = '', _a)));
|
|
74
75
|
};
|
|
76
|
+
var handleBlueWebsite = function () {
|
|
77
|
+
if (!!links.website) {
|
|
78
|
+
var website = links.website;
|
|
79
|
+
var isWebHasPrefix = !!website.includes('www.');
|
|
80
|
+
var isWebHasSuffix = !!website.includes('.com');
|
|
81
|
+
if (!isWebHasPrefix)
|
|
82
|
+
website = "www.".concat(website);
|
|
83
|
+
if (!isWebHasSuffix)
|
|
84
|
+
website = "".concat(website, ".com");
|
|
85
|
+
setValue('links', __assign(__assign({}, links), { website: website }), { shouldValidate: true });
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
React.useEffect(function () {
|
|
89
|
+
if (!!brandName) {
|
|
90
|
+
var website = "www.".concat(brandName.replace(' ', '-'), ".com");
|
|
91
|
+
setValue('links', __assign(__assign({}, links), { website: website }), { shouldValidate: true });
|
|
92
|
+
}
|
|
93
|
+
if (!brandName && isNewUser === false) {
|
|
94
|
+
var website = "other.com";
|
|
95
|
+
setValue('links', __assign(__assign({}, links), { website: website }), { shouldValidate: true });
|
|
96
|
+
}
|
|
97
|
+
if (!brandName && isNewUser === true) {
|
|
98
|
+
var website = '';
|
|
99
|
+
setValue('links', __assign(__assign({}, links), { website: website }));
|
|
100
|
+
}
|
|
101
|
+
}, [brandName]);
|
|
75
102
|
var websiteValue = links.website || '';
|
|
76
103
|
var twitterValue = links.twitter || '';
|
|
77
104
|
var instagramValue = links.instagram || '';
|
|
@@ -81,6 +108,6 @@ var SocialMedia = function (_a) {
|
|
|
81
108
|
var instagramError = (_d = errors === null || errors === void 0 ? void 0 : errors.instagram) === null || _d === void 0 ? void 0 : _d.message;
|
|
82
109
|
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: __assign({ mt: 3, mb: 3, direction: 'ltr' }, sx) }, { children: [_jsx(SocialMediaGroupStyled, { defaultValue: socialMediaType, exclusive: true, onChange: function (e, value) {
|
|
83
110
|
setSocialMediaType(value);
|
|
84
|
-
} }), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.WEB, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: websiteValue, startAdornment: _jsx(TextStyled, { children: "https://" }), placeholder: t('signup_website_placeholder'), warningType: 'alert', warningMessage: websiteError && t(websiteError), endAdornment: !websiteError && websiteValue ? _jsx(CheckIcon, {}) : websiteValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.TWITTER, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: twitterValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_twitter_placeholder'), warningType: 'alert', warningMessage: twitterError && t(twitterError), endAdornment: !twitterError && twitterValue ? _jsx(CheckIcon, {}) : twitterValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.INSTAGRAM, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: instagramValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_instagram_placeholder'), warningType: 'alert', warningMessage: instagramError && t(instagramError), endAdornment: !instagramError && instagramValue ? (_jsx(CheckIcon, {})) : (instagramValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) }))] })) })));
|
|
111
|
+
} }), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.WEB, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: websiteValue, onBlur: function () { return handleBlueWebsite(); }, startAdornment: _jsx(TextStyled, { children: "https://" }), placeholder: t('signup_website_placeholder'), warningType: 'alert', warningMessage: websiteError && t(websiteError), endAdornment: !websiteError && websiteValue ? _jsx(CheckIcon, {}) : websiteValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.TWITTER, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: twitterValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_twitter_placeholder'), warningType: 'alert', warningMessage: twitterError && t(twitterError), endAdornment: !twitterError && twitterValue ? _jsx(CheckIcon, {}) : twitterValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.INSTAGRAM, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: instagramValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_instagram_placeholder'), warningType: 'alert', warningMessage: instagramError && t(instagramError), endAdornment: !instagramError && instagramValue ? (_jsx(CheckIcon, {})) : (instagramValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) }))] })) })));
|
|
85
112
|
};
|
|
86
113
|
export default React.memo(SocialMedia);
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
export declare
|
|
2
|
+
export declare enum ValidationOptions {
|
|
3
|
+
NEW_USER = "NEW_USER",
|
|
4
|
+
EXISTING_USER_WITH_EXIST_BRAND = "EXISTING_USER_WITH_EXIST_BRAND",
|
|
5
|
+
EXISTING_USER_WITH_OTHER_BRAND = "EXISTING_USER_WITH_OTHER_BRAND"
|
|
6
|
+
}
|
|
7
|
+
export declare const MerchantValidationSchema: (userType: ValidationOptions) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
8
|
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
4
9
|
termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
5
10
|
links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -1,15 +1,75 @@
|
|
|
1
1
|
import { REGEX_WEBSITE } from '../../../../constants';
|
|
2
2
|
import * as yup from 'yup';
|
|
3
|
-
export var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export var ValidationOptions;
|
|
4
|
+
(function (ValidationOptions) {
|
|
5
|
+
ValidationOptions["NEW_USER"] = "NEW_USER";
|
|
6
|
+
ValidationOptions["EXISTING_USER_WITH_EXIST_BRAND"] = "EXISTING_USER_WITH_EXIST_BRAND";
|
|
7
|
+
ValidationOptions["EXISTING_USER_WITH_OTHER_BRAND"] = "EXISTING_USER_WITH_OTHER_BRAND";
|
|
8
|
+
})(ValidationOptions || (ValidationOptions = {}));
|
|
9
|
+
export var MerchantValidationSchema = function (userType) {
|
|
10
|
+
var askingForBrandInfo = userType === ValidationOptions.NEW_USER || userType === ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND;
|
|
11
|
+
if (askingForBrandInfo) {
|
|
12
|
+
return yup.object().shape({
|
|
13
|
+
brandName: yup
|
|
7
14
|
.string()
|
|
8
15
|
.min(3, 'enter_brand_name_english_chars_numbers_space')
|
|
9
16
|
.max(250, 'enter_brand_name_english_chars_numbers_space')
|
|
10
|
-
.required('enter_valid_brand_name')
|
|
11
|
-
: yup.
|
|
12
|
-
|
|
17
|
+
.required('enter_valid_brand_name'),
|
|
18
|
+
termAndConditionChecked: yup.boolean().required().isTrue('check_terms_cond'),
|
|
19
|
+
links: yup.object().shape({
|
|
20
|
+
website: yup.string().when(['instagram', 'twitter'], function (instagram, twitter) {
|
|
21
|
+
if (!instagram && !twitter) {
|
|
22
|
+
return yup
|
|
23
|
+
.string()
|
|
24
|
+
.matches(REGEX_WEBSITE, 'ide_not_valid_url')
|
|
25
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
26
|
+
.nullable()
|
|
27
|
+
.required('enter_at_least_one');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return yup
|
|
31
|
+
.string()
|
|
32
|
+
.matches(REGEX_WEBSITE, 'ide_not_valid_url')
|
|
33
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
34
|
+
.nullable()
|
|
35
|
+
.optional();
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
instagram: yup
|
|
39
|
+
.string()
|
|
40
|
+
.nullable()
|
|
41
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
42
|
+
.when(['twitter', 'website'], function (twitter, website) {
|
|
43
|
+
if (!website && !twitter) {
|
|
44
|
+
return yup.string().min(2, 'enter_at_least_one').required('enter_at_least_one');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return yup.string().optional();
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
twitter: yup
|
|
51
|
+
.string()
|
|
52
|
+
.nullable()
|
|
53
|
+
.transform(function (value) { return (!!value ? value : null); })
|
|
54
|
+
.min(2, 'enter_at_least_one')
|
|
55
|
+
.when(['website', 'instagram'], function (website, instagram) {
|
|
56
|
+
if (!website && !instagram) {
|
|
57
|
+
return yup.string().min(2, 'enter_at_least_one').required('enter_at_least_one');
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return yup.string().optional();
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
}, [
|
|
64
|
+
['instagram', 'website'],
|
|
65
|
+
['twitter', 'website'],
|
|
66
|
+
['instagram', 'twitter']
|
|
67
|
+
])
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return yup.object().shape({
|
|
71
|
+
brandName: yup.string().optional(),
|
|
72
|
+
termAndConditionChecked: yup.boolean().optional(),
|
|
13
73
|
links: yup.object().shape({
|
|
14
74
|
website: yup.string().when(['instagram', 'twitter'], function (instagram, twitter) {
|
|
15
75
|
if (!instagram && !twitter) {
|
|
@@ -116,7 +116,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
116
116
|
setValue('mobile', '');
|
|
117
117
|
countryCodeControl.field.onChange(country);
|
|
118
118
|
};
|
|
119
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '
|
|
119
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
120
120
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
121
121
|
} }) }))] })) })));
|
|
122
122
|
});
|
|
@@ -12,7 +12,7 @@ export var PhoneValidationSchema = yup.object().shape({
|
|
|
12
12
|
var isNumber = mobileValue.match(/^[0-9]/g);
|
|
13
13
|
if (!isNumber)
|
|
14
14
|
return this.createError({ message: 'enter_valid_mobile_number' });
|
|
15
|
-
var isStartWithZero = mobileValue.startsWith('
|
|
15
|
+
var isStartWithZero = mobileValue.startsWith('05');
|
|
16
16
|
var isStartWith5 = mobileValue.startsWith('5');
|
|
17
17
|
var isSaudiNumber = isStartWith5 || isStartWithZero;
|
|
18
18
|
if (isSA) {
|
|
@@ -4,7 +4,6 @@ import IndividualScreen from './connect/screens/Individual';
|
|
|
4
4
|
import MerchantInfoScreen from './connect/screens/Merchant';
|
|
5
5
|
import ConnectOTPScreen from './connect/screens/OTP';
|
|
6
6
|
import ThankYouScreen from './connect/screens/ThankYou';
|
|
7
|
-
import PasswordScreen from './connect/screens/Password';
|
|
8
7
|
import CustomersPage from './business/screens/Customers';
|
|
9
8
|
import IDBODPage from './business/screens/IDBOD';
|
|
10
9
|
import BusinessVerifyPage from './business/screens/Verify';
|
|
@@ -12,14 +11,17 @@ import BusinessOTPPage from './business/screens/OTP';
|
|
|
12
11
|
import BusinessTypePage from './business/screens/BusinessType';
|
|
13
12
|
import ActivitiesPage from './business/screens/Activities';
|
|
14
13
|
import SuccessPage from './business/screens/Success';
|
|
15
|
-
import
|
|
14
|
+
import PasswordVerifyPage from './password/screens/Verify';
|
|
16
15
|
import CreatePasswordPage from './password/screens/CreatePassword';
|
|
17
16
|
import SuccessPasswordPage from './password/screens/Success';
|
|
17
|
+
import IndividualVerifyPage from './individual/screens/Verify';
|
|
18
18
|
import ShowIndividualInfoPage from './individual/screens/ShowIndividualInfo';
|
|
19
19
|
import AdditionalIndividualInfoPage from './individual/screens/AdditionalIndividualInfo';
|
|
20
20
|
import SuccessOwnerPage from './individual/screens/Success';
|
|
21
|
+
import BankVerifyPage from './bank/screens/Verify';
|
|
21
22
|
import BankDetailsPage from './bank/screens/BankDetails';
|
|
22
23
|
import BankSuccessPage from './bank/screens/Success';
|
|
24
|
+
import TaxVerifyPage from './tax/screens/Verify';
|
|
23
25
|
import TaxDetailsPage from './tax/screens/TaxDetails';
|
|
24
26
|
import TaxSuccessPage from './tax/screens/Success';
|
|
25
27
|
export var connectFeatureScreens = [
|
|
@@ -39,10 +41,6 @@ export var connectFeatureScreens = [
|
|
|
39
41
|
name: 'CONNECT_INDIVIDUAL_STEP',
|
|
40
42
|
element: IndividualScreen
|
|
41
43
|
},
|
|
42
|
-
{
|
|
43
|
-
name: 'CONNECT_PASSWORD_STEP',
|
|
44
|
-
element: PasswordScreen
|
|
45
|
-
},
|
|
46
44
|
{
|
|
47
45
|
name: 'CONNECT_MERCHANT_INFO_STEP',
|
|
48
46
|
element: MerchantInfoScreen
|
|
@@ -69,10 +67,6 @@ export var businessFeatureScreens = [
|
|
|
69
67
|
name: 'BUSINESS_BUSINESS_TYPE_STEP',
|
|
70
68
|
element: BusinessTypePage
|
|
71
69
|
},
|
|
72
|
-
{
|
|
73
|
-
name: 'BUSINESS_CONFIRM_STEP',
|
|
74
|
-
element: ConfirmPage
|
|
75
|
-
},
|
|
76
70
|
{
|
|
77
71
|
name: 'BUSINESS_ACTIVITIES_STEP',
|
|
78
72
|
element: ActivitiesPage
|
|
@@ -84,6 +78,10 @@ export var businessFeatureScreens = [
|
|
|
84
78
|
{ name: 'BUSINESS_SUCCESS_STEP', element: SuccessPage }
|
|
85
79
|
];
|
|
86
80
|
export var passwordFeatureScreens = [
|
|
81
|
+
{
|
|
82
|
+
name: 'PASSWORD_VERIFY_STEP',
|
|
83
|
+
element: PasswordVerifyPage
|
|
84
|
+
},
|
|
87
85
|
{
|
|
88
86
|
name: 'PASSWORD_CREATE_PASSWORD_STEP',
|
|
89
87
|
element: CreatePasswordPage
|
|
@@ -94,6 +92,10 @@ export var passwordFeatureScreens = [
|
|
|
94
92
|
}
|
|
95
93
|
];
|
|
96
94
|
export var individualFeatureScreens = [
|
|
95
|
+
{
|
|
96
|
+
name: 'INDIVIDUAL_VERIFY_STEP',
|
|
97
|
+
element: IndividualVerifyPage
|
|
98
|
+
},
|
|
97
99
|
{
|
|
98
100
|
name: 'INDIVIDUAL_SHOW_INDIVIDUAL_INFO_STEP',
|
|
99
101
|
element: ShowIndividualInfoPage
|
|
@@ -108,6 +110,10 @@ export var individualFeatureScreens = [
|
|
|
108
110
|
}
|
|
109
111
|
];
|
|
110
112
|
export var bankFeatureScreens = [
|
|
113
|
+
{
|
|
114
|
+
name: 'BANK_VERIFY_STEP',
|
|
115
|
+
element: BankVerifyPage
|
|
116
|
+
},
|
|
111
117
|
{
|
|
112
118
|
name: 'BANK_BANK_DETAILS_STEP',
|
|
113
119
|
element: BankDetailsPage
|
|
@@ -118,6 +124,10 @@ export var bankFeatureScreens = [
|
|
|
118
124
|
}
|
|
119
125
|
];
|
|
120
126
|
export var taxFeatureScreens = [
|
|
127
|
+
{
|
|
128
|
+
name: 'TAX_VERIFY_STEP',
|
|
129
|
+
element: TaxVerifyPage
|
|
130
|
+
},
|
|
121
131
|
{
|
|
122
132
|
name: 'TAX_TAX_DETAILS_STEP',
|
|
123
133
|
element: TaxDetailsPage
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { LibConfig } from '../../@types';
|
|
3
|
+
export interface IndividualLibProps extends LibConfig {
|
|
3
4
|
}
|
|
4
5
|
export declare function IndividualLib(props: IndividualLibProps): JSX.Element;
|
|
5
6
|
export declare function renderIndividualLib(config: IndividualLibProps, elementId: string): void;
|
|
@@ -11,28 +11,36 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import React, { memo, useEffect } from 'react';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { handleActiveFlowScreens, settingsSelector } from '../../app/settings';
|
|
14
|
+
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
|
|
15
|
+
import { settingsSelector } from '../../app/settings';
|
|
17
16
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
18
17
|
import { store } from '../../app/store';
|
|
19
18
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
20
19
|
import Collapse from '../../components/Collapse';
|
|
21
|
-
import { reactElement } from '../../utils';
|
|
20
|
+
import { getParameterByName, reactElement } from '../../utils';
|
|
22
21
|
import { FeatureContainer } from '../shared/Containers';
|
|
23
22
|
import { INDIVIDUAL_SCREENS_NAVIGATION } from '../../constants';
|
|
24
23
|
import { individualFeatureScreens } from '../featuresScreens';
|
|
24
|
+
import { verifyLeadToken } from '../app/individual/individualStore';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
26
26
|
var Individual = memo(function (props) {
|
|
27
27
|
var open = React.useState(true)[0];
|
|
28
|
-
var t = useTranslation().t;
|
|
29
28
|
var theme = useAppTheme().theme;
|
|
30
29
|
var dispatch = useAppDispatch();
|
|
31
30
|
var data = useAppSelector(settingsSelector).data;
|
|
31
|
+
var loading = useAppConfig(__assign({ navigation: INDIVIDUAL_SCREENS_NAVIGATION }, props)).loading;
|
|
32
|
+
useErrorListener();
|
|
32
33
|
var activeScreen = data.activeScreen;
|
|
34
|
+
var verifyToken = function () {
|
|
35
|
+
var token = getParameterByName('token');
|
|
36
|
+
if (!token)
|
|
37
|
+
throw new Error('Auth token is not found!');
|
|
38
|
+
dispatch(verifyLeadToken(token));
|
|
39
|
+
};
|
|
33
40
|
useEffect(function () {
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
if (!loading)
|
|
42
|
+
verifyToken();
|
|
43
|
+
}, [loading]);
|
|
36
44
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
|
|
37
45
|
var Element = _a.element, name = _a.name;
|
|
38
46
|
var isActive = activeScreen.name === name;
|