@tap-payments/auth-jsconnect 2.10.13-beta → 2.10.13-development
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/README.md +2 -2
- package/build/@types/app.d.ts +4 -2
- package/build/@types/app.js +2 -0
- package/build/@types/form.d.ts +6 -0
- package/build/@types/index.d.ts +1 -0
- package/build/@types/index.js +1 -0
- package/build/@types/terminal.d.ts +116 -0
- package/build/@types/terminal.js +1 -0
- package/build/api/auth.d.ts +10 -1
- package/build/api/entity.d.ts +3 -0
- package/build/api/index.d.ts +7 -1
- package/build/api/index.js +3 -1
- package/build/api/lead.d.ts +2 -1
- package/build/api/terminal.d.ts +28 -0
- package/build/api/terminal.js +45 -0
- package/build/app/rootReducer.d.ts +1 -0
- package/build/app/rootReducer.js +3 -1
- package/build/app/store.d.ts +2 -0
- package/build/assets/currencies/AEDSymbol.d.ts +7 -0
- package/build/assets/currencies/AEDSymbol.js +28 -0
- package/build/assets/currencies/SARSymbol.d.ts +7 -0
- package/build/assets/currencies/SARSymbol.js +28 -0
- package/build/assets/currencies/index.d.ts +2 -0
- package/build/assets/currencies/index.js +2 -0
- package/build/assets/currencies/utils.d.ts +4 -0
- package/build/assets/currencies/utils.js +6 -0
- package/build/assets/locales/ar.json +43 -6
- package/build/assets/locales/en.json +49 -9
- package/build/components/DeviceCard/DeviceCard.d.ts +18 -0
- package/build/components/DeviceCard/DeviceCard.js +103 -0
- package/build/components/DeviceCard/index.d.ts +3 -0
- package/build/components/DeviceCard/index.js +2 -0
- package/build/components/OTPTimer/OTPTimer.d.ts +2 -1
- package/build/components/OTPTimer/OTPTimer.js +4 -4
- package/build/components/TextWithCurrency/TextWithCurrency.d.ts +7 -0
- package/build/components/TextWithCurrency/TextWithCurrency.js +14 -0
- package/build/components/TextWithCurrency/index.d.ts +2 -0
- package/build/components/TextWithCurrency/index.js +2 -0
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/api.d.ts +0 -1
- package/build/constants/api.js +0 -2
- package/build/constants/app.d.ts +13 -3
- package/build/constants/app.js +127 -6
- package/build/constants/assets.d.ts +11 -6
- package/build/constants/assets.js +118 -107
- package/build/constants/dummy.js +27 -20
- package/build/constants/flows.d.ts +15 -0
- package/build/constants/flows.js +15 -0
- package/build/constants/validation.d.ts +2 -0
- package/build/constants/validation.js +2 -0
- package/build/features/app/auth/authStore.d.ts +24 -5
- package/build/features/app/auth/authStore.js +143 -77
- package/build/features/app/business/businessStore.js +6 -4
- package/build/features/app/connectExpress/connectExpressStore.js +16 -10
- package/build/features/app/individual/individualStore.js +0 -1
- package/build/features/app/tax/taxStore.js +1 -1
- package/build/features/app/terminal/terminalStore.d.ts +110 -0
- package/build/features/app/terminal/terminalStore.js +676 -0
- package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +14 -8
- package/build/features/auth/screens/AuthenticationList/UnifiedNumber.d.ts +35 -0
- package/build/features/auth/screens/AuthenticationList/UnifiedNumber.js +80 -0
- package/build/features/auth/screens/AuthenticationList/validation.d.ts +22 -0
- package/build/features/auth/screens/AuthenticationList/validation.js +77 -1
- package/build/features/auth/screens/OTP/OTP.d.ts +13 -2
- package/build/features/auth/screens/OTP/OTP.js +15 -3
- package/build/features/auth/screens/OTP/index.d.ts +1 -2
- package/build/features/auth/screens/Passcode/Passcode.d.ts +16 -0
- package/build/features/auth/screens/Passcode/Passcode.js +82 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.d.ts +6 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.js +42 -0
- package/build/features/auth/screens/Passcode/index.d.ts +2 -0
- package/build/features/auth/screens/Passcode/index.js +2 -0
- package/build/features/auth/screens/Passcode/validation.d.ts +8 -0
- package/build/features/auth/screens/Passcode/validation.js +4 -0
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -8
- package/build/features/business/screens/BusinessType/BusinessType.js +12 -2
- package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +35 -0
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +84 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
- package/build/features/business/screens/BusinessType/validation.js +31 -7
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -8
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +14 -9
- package/build/features/connectExpress/screens/AuthenticationList/UnifiedNumber.d.ts +35 -0
- package/build/features/connectExpress/screens/AuthenticationList/UnifiedNumber.js +80 -0
- package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +22 -0
- package/build/features/connectExpress/screens/AuthenticationList/validation.js +77 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +10 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +36 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +81 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +21 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +44 -13
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +3 -7
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +3 -7
- package/build/features/entity/screens/EntityName/EntityName.js +2 -1
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +3 -3
- package/build/features/entity/screens/EntityName/validation.js +14 -3
- package/build/features/featuresScreens.d.ts +1 -0
- package/build/features/featuresScreens.js +72 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +3 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
- package/build/features/shared/Button/Button.js +2 -3
- package/build/features/shared/Button/FlowsButtons.js +1 -1
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/PushNotification/PushNotification.d.ts +11 -0
- package/build/features/shared/PushNotification/PushNotification.js +34 -0
- package/build/features/shared/PushNotification/index.d.ts +2 -0
- package/build/features/shared/PushNotification/index.js +2 -0
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +3 -1
- package/build/features/shared/SuccessScreen/SuccessScreen.js +2 -2
- package/build/features/terminal/Terminal.d.ts +14 -0
- package/build/features/terminal/Terminal.js +95 -0
- package/build/features/terminal/index.d.ts +1 -0
- package/build/features/terminal/index.js +1 -0
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.d.ts +3 -0
- package/build/features/terminal/screens/LinkNewTerminal/LinkNewTerminal.js +69 -0
- package/build/features/terminal/screens/LinkNewTerminal/index.d.ts +2 -0
- package/build/features/terminal/screens/LinkNewTerminal/index.js +2 -0
- package/build/features/terminal/screens/LinkNewTerminal/styles.d.ts +10 -0
- package/build/features/terminal/screens/LinkNewTerminal/styles.js +28 -0
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.d.ts +3 -0
- package/build/features/terminal/screens/LinkedSuccess/LinkedSuccess.js +51 -0
- package/build/features/terminal/screens/LinkedSuccess/index.d.ts +2 -0
- package/build/features/terminal/screens/LinkedSuccess/index.js +2 -0
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.d.ts +3 -0
- package/build/features/terminal/screens/LinkedTerminalInfo/LinkedTerminalInfo.js +55 -0
- package/build/features/terminal/screens/LinkedTerminalInfo/index.d.ts +2 -0
- package/build/features/terminal/screens/LinkedTerminalInfo/index.js +2 -0
- package/build/features/terminal/screens/Loading/Loading.d.ts +4 -0
- package/build/features/terminal/screens/Loading/Loading.js +10 -0
- package/build/features/terminal/screens/Loading/index.d.ts +2 -0
- package/build/features/terminal/screens/Loading/index.js +2 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.d.ts +3 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/NoTerminalDeviceLinked.js +56 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/index.d.ts +2 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/index.js +2 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.d.ts +36 -0
- package/build/features/terminal/screens/NoTerminalDeviceLinked/styles.js +34 -0
- package/build/features/terminal/screens/OperatorError/OperatorError.d.ts +5 -0
- package/build/features/terminal/screens/OperatorError/OperatorError.js +9 -0
- package/build/features/terminal/screens/OperatorError/index.d.ts +2 -0
- package/build/features/terminal/screens/OperatorError/index.js +2 -0
- package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +3 -0
- package/build/features/terminal/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +21 -0
- package/build/features/terminal/screens/ResetPasswordSuccess/index.d.ts +2 -0
- package/build/features/terminal/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +31 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/terminal/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.d.ts +9 -0
- package/build/features/terminal/screens/TerminalDeviceList/DeviceList.js +20 -0
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.d.ts +3 -0
- package/build/features/terminal/screens/TerminalDeviceList/TerminalDeviceList.js +153 -0
- package/build/features/terminal/screens/TerminalDeviceList/index.d.ts +2 -0
- package/build/features/terminal/screens/TerminalDeviceList/index.js +2 -0
- package/build/features/terminal/screens/TerminalDeviceList/styles.d.ts +9 -0
- package/build/features/terminal/screens/TerminalDeviceList/styles.js +13 -0
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.d.ts +3 -0
- package/build/features/terminal/screens/TerminalListPage/TerminalListPage.js +47 -0
- package/build/features/terminal/screens/TerminalListPage/index.d.ts +2 -0
- package/build/features/terminal/screens/TerminalListPage/index.js +2 -0
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.d.ts +3 -0
- package/build/features/terminal/screens/UnlinkedSuccess/UnlinkedSuccess.js +53 -0
- package/build/features/terminal/screens/UnlinkedSuccess/index.d.ts +2 -0
- package/build/features/terminal/screens/UnlinkedSuccess/index.js +2 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.d.ts +3 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/UnlinkedTerminalInfo.js +98 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/index.d.ts +2 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/index.js +2 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.d.ts +26 -0
- package/build/features/terminal/screens/UnlinkedTerminalInfo/styles.js +30 -0
- package/build/features/terminal/screens/Verify/OTPInput.d.ts +7 -0
- package/build/features/terminal/screens/Verify/OTPInput.js +51 -0
- package/build/features/terminal/screens/Verify/Verify.d.ts +5 -0
- package/build/features/terminal/screens/Verify/Verify.js +85 -0
- package/build/features/terminal/screens/Verify/index.d.ts +2 -0
- package/build/features/terminal/screens/Verify/index.js +2 -0
- package/build/features/terminal/screens/Verify/validation.d.ts +8 -0
- package/build/features/terminal/screens/Verify/validation.js +4 -0
- package/build/features/terminal/screens/shared/Header.d.ts +10 -0
- package/build/features/terminal/screens/shared/Header.js +30 -0
- package/build/features/terminal/screens/shared/TerminalList.d.ts +11 -0
- package/build/features/terminal/screens/shared/TerminalList.js +25 -0
- package/build/features/terminal/screens/shared/index.d.ts +5 -0
- package/build/features/terminal/screens/shared/index.js +5 -0
- package/build/features/terminal/screens/shared/styles.d.ts +196 -0
- package/build/features/terminal/screens/shared/styles.js +155 -0
- package/build/features/terminal/screens/shared/utils.d.ts +7 -0
- package/build/features/terminal/screens/shared/utils.js +24 -0
- package/build/hooks/useAppDispatch.d.ts +1 -0
- package/build/index.d.ts +3 -2
- package/build/index.js +4 -2
- package/build/theme/palette.js +12 -0
- package/build/theme/typography.js +4 -0
- package/build/utils/common.js +4 -4
- package/build/utils/string.d.ts +3 -2
- package/build/utils/string.js +10 -1
- package/package.json +2 -2
|
@@ -0,0 +1,80 @@
|
|
|
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 { alpha, styled } from '@mui/material/styles';
|
|
17
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
18
|
+
import Box from '@mui/material/Box';
|
|
19
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
20
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
|
+
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
22
|
+
import Tooltip from '../../../../components/Tooltip';
|
|
23
|
+
import Text from '../../../../components/Text';
|
|
24
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
+
import Input from '../../../shared/Input';
|
|
26
|
+
import { clearError, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
27
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
28
|
+
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
29
|
+
var theme = _a.theme;
|
|
30
|
+
return ({
|
|
31
|
+
display: 'flex',
|
|
32
|
+
justifyContent: 'space-between',
|
|
33
|
+
padding: theme.spacing(0, 2.5, 1, 2.5)
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
37
|
+
var theme = _a.theme;
|
|
38
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
39
|
+
});
|
|
40
|
+
export var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
41
|
+
var theme = _a.theme;
|
|
42
|
+
return ({
|
|
43
|
+
width: theme.spacing(2.75),
|
|
44
|
+
height: theme.spacing(2.125),
|
|
45
|
+
cursor: 'pointer',
|
|
46
|
+
color: alpha(theme.palette.text.primary, 0.4),
|
|
47
|
+
display: 'inline-flex'
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
51
|
+
var theme = _a.theme;
|
|
52
|
+
return ({
|
|
53
|
+
width: theme.spacing(2.75),
|
|
54
|
+
height: theme.spacing(2.125),
|
|
55
|
+
cursor: 'pointer',
|
|
56
|
+
color: alpha(theme.palette.text.primary, 0.4),
|
|
57
|
+
display: 'inline-flex'
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
var UnifiedNumber = function (_a) {
|
|
61
|
+
var _b;
|
|
62
|
+
var readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
63
|
+
var t = useTranslation().t;
|
|
64
|
+
var bckError = useAppSelector(connectExpressSelector).error;
|
|
65
|
+
var control = useFormContext().control;
|
|
66
|
+
var dispatch = useAppDispatch();
|
|
67
|
+
var _c = React.useState(false), hovered = _c[0], setHovered = _c[1];
|
|
68
|
+
var handleChange = function (_a) {
|
|
69
|
+
var target = _a.target;
|
|
70
|
+
if (bckError)
|
|
71
|
+
dispatch(clearError());
|
|
72
|
+
var value = removeAllCharsFromNumber(target.value);
|
|
73
|
+
unifiedNumberControl.field.onChange(value);
|
|
74
|
+
};
|
|
75
|
+
var unifiedNumberControl = useController({ control: control, name: 'unifiedNumber' });
|
|
76
|
+
var unifiedNumberValue = unifiedNumberControl.field.value;
|
|
77
|
+
var error = (_b = unifiedNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
78
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('v1_company_unified_number_label') }), _jsx(Tooltip, __assign({ title: t('v1_company_unified_number_description'), onMouseOver: function () { return setHovered(true); }, onMouseLeave: function () { return setHovered(false); }, onTouchStartCapture: function () { return setHovered(true); } }, { children: hovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { readOnly: readOnly, onChange: handleChange, value: unifiedNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('v1_company_unified_number_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: unifiedNumberValue, isVerified: isVerified }) })] })));
|
|
79
|
+
};
|
|
80
|
+
export default React.memo(UnifiedNumber);
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
+
export declare const AuthenticationListSAValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
4
|
+
entityInfo: any;
|
|
5
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
6
|
+
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
7
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
9
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
10
|
+
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
11
|
+
entityInfo: any;
|
|
12
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
13
|
+
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
14
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
15
|
+
legalName: 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
|
+
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
18
|
+
entityInfo: any;
|
|
19
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
20
|
+
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
21
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
22
|
+
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
|
+
}>>>;
|
|
2
24
|
export declare const AuthenticationListValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
25
|
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
4
26
|
entityInfo: any;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { ADD_ENTITY, LICENSE_NUMBER_MIN_LENGTH, REGEX_LEGAL_NAME } from '../../../../constants';
|
|
2
|
+
import { ADD_ENTITY, LICENSE_NUMBER_MIN_LENGTH, REGEX_LEGAL_NAME, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
3
|
+
import { LicenseType } from '../../../../@types';
|
|
3
4
|
var objectElements = {
|
|
4
5
|
id: yup.string().required(),
|
|
5
6
|
business_id: yup.string(),
|
|
@@ -11,6 +12,81 @@ var objectElements = {
|
|
|
11
12
|
number: yup.string()
|
|
12
13
|
})
|
|
13
14
|
};
|
|
15
|
+
export var AuthenticationListSAValidationSchema = yup.object().shape({
|
|
16
|
+
brandInfo: yup.object().required('auth_brand_required'),
|
|
17
|
+
entityInfo: yup.object().shape(objectElements).required('auth_entity_required'),
|
|
18
|
+
licenseNumber: yup.string().when('entityInfo', function (entityInfo) {
|
|
19
|
+
var isAddEntity = (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) === ADD_ENTITY;
|
|
20
|
+
if (!isAddEntity) {
|
|
21
|
+
return yup.string().optional();
|
|
22
|
+
}
|
|
23
|
+
return yup.string().test({
|
|
24
|
+
name: 'licenseNumber',
|
|
25
|
+
message: 'enter_license_number',
|
|
26
|
+
test: function (value) {
|
|
27
|
+
var type = this.parent.licenseType;
|
|
28
|
+
var isCR = type === LicenseType.CR;
|
|
29
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
30
|
+
if (!type)
|
|
31
|
+
return false;
|
|
32
|
+
if (isCR)
|
|
33
|
+
return true;
|
|
34
|
+
return length >= LICENSE_NUMBER_MIN_LENGTH;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}),
|
|
38
|
+
unifiedNumber: yup.string().when('entityInfo', function (entityInfo) {
|
|
39
|
+
var isAddEntity = (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) === ADD_ENTITY;
|
|
40
|
+
if (!isAddEntity) {
|
|
41
|
+
return yup.string().optional();
|
|
42
|
+
}
|
|
43
|
+
return yup.string().test({
|
|
44
|
+
name: 'unifiedNumber',
|
|
45
|
+
message: 'unified_number_required',
|
|
46
|
+
test: function (value) {
|
|
47
|
+
var type = this.parent.licenseType;
|
|
48
|
+
var isFL = type === LicenseType.FL;
|
|
49
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
50
|
+
if (!type)
|
|
51
|
+
return false;
|
|
52
|
+
if (isFL)
|
|
53
|
+
return true;
|
|
54
|
+
return length >= UNIFIED_NUMBER_MIN_LENGTH;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}),
|
|
58
|
+
licenseType: yup
|
|
59
|
+
.string()
|
|
60
|
+
.when('entityInfo', function (entityInfo) {
|
|
61
|
+
var isAddEntity = (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) === ADD_ENTITY;
|
|
62
|
+
if (!isAddEntity) {
|
|
63
|
+
return yup.string().optional();
|
|
64
|
+
}
|
|
65
|
+
return yup.string().required('choose_license_type');
|
|
66
|
+
})
|
|
67
|
+
.required(''),
|
|
68
|
+
legalName: yup
|
|
69
|
+
.string()
|
|
70
|
+
.when('entityInfo', function (entityInfo) {
|
|
71
|
+
var isAddEntity = (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) === ADD_ENTITY;
|
|
72
|
+
if (!isAddEntity) {
|
|
73
|
+
return yup.string().optional();
|
|
74
|
+
}
|
|
75
|
+
return yup
|
|
76
|
+
.string()
|
|
77
|
+
.required('')
|
|
78
|
+
.test({
|
|
79
|
+
test: function (value) {
|
|
80
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
81
|
+
if (length === 0)
|
|
82
|
+
return true;
|
|
83
|
+
return (value === null || value === void 0 ? void 0 : value.match(REGEX_LEGAL_NAME)) && length >= 3 ? true : this.createError({ message: 'enter_valid_legal_name' });
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
.required('');
|
|
87
|
+
})
|
|
88
|
+
.required('')
|
|
89
|
+
});
|
|
14
90
|
export var AuthenticationListValidationSchema = yup.object().shape({
|
|
15
91
|
brandInfo: yup.object().required('auth_brand_required'),
|
|
16
92
|
entityInfo: yup.object().shape(objectElements).required('auth_entity_required'),
|
|
@@ -78,6 +78,7 @@ var CollectBusinessInfo = function (_a) {
|
|
|
78
78
|
var onSubmit = function (data) {
|
|
79
79
|
var dataValues = {
|
|
80
80
|
brandName: data.brandName,
|
|
81
|
+
unifiedNumber: data.unifiedNumber,
|
|
81
82
|
selectedLicense: data.selectedLicense,
|
|
82
83
|
licenseNumber: data.licenseNumber,
|
|
83
84
|
termAndConditionChecked: data.termAndConditionChecked
|
|
@@ -41,6 +41,7 @@ import CheckIcon from '../../../shared/CheckIcon';
|
|
|
41
41
|
import { connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
|
|
42
42
|
import LicenseNumber from './LicenseNumber';
|
|
43
43
|
import LicenseType from './LicenseType';
|
|
44
|
+
import UnifiedNumber from './UnifiedNumber';
|
|
44
45
|
var InputStyled = styled(InputSelect)(function (_a) {
|
|
45
46
|
var theme = _a.theme;
|
|
46
47
|
return ({
|
|
@@ -128,13 +129,21 @@ var LicenseList = function (_a) {
|
|
|
128
129
|
return _jsx("span", { children: "".concat(getLicenseName(item), " - ").concat(getLicenseNumber(item)) });
|
|
129
130
|
return _jsx("span", { children: "".concat(getLicenseNumber(item), " - ").concat(getLicenseName(item)) });
|
|
130
131
|
};
|
|
132
|
+
var showLicenseNumber = function () {
|
|
133
|
+
if (isKWCountry)
|
|
134
|
+
return show && isCR;
|
|
135
|
+
if (isSACountry)
|
|
136
|
+
return show && isFL;
|
|
137
|
+
return show;
|
|
138
|
+
};
|
|
131
139
|
var show = !anchorEl;
|
|
132
140
|
var selected = selectedLicenseControl.field.value;
|
|
133
141
|
var licenseReadonly = !isOtherLicense(selected);
|
|
134
142
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
143
|
+
var isFL = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.FL;
|
|
135
144
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
136
145
|
return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry || isOtherThanKWOrSACountry }, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
137
146
|
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
|
|
138
|
-
} }) }))] })), _jsx(LicenseType, { show: show && isKWCountry, readOnly: readOnly }), _jsx(LicenseNumber, { show:
|
|
147
|
+
} }) }))] })), _jsx(LicenseType, { show: show && isKWCountry, readOnly: readOnly }), _jsx(LicenseNumber, { show: showLicenseNumber(), readOnly: licenseReadonly }), _jsx(UnifiedNumber, { show: isSACountry && isCR && show, readOnly: licenseReadonly })] }));
|
|
139
148
|
};
|
|
140
149
|
export default React.memo(LicenseList);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const InfoIconStyled: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
5
|
+
color?: "inherit" | "disabled" | "error" | "info" | "success" | "action" | "primary" | "secondary" | "warning" | undefined;
|
|
6
|
+
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
7
|
+
htmlColor?: string | undefined;
|
|
8
|
+
inheritViewBox?: boolean | undefined;
|
|
9
|
+
shapeRendering?: string | undefined;
|
|
10
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
11
|
+
titleAccess?: string | undefined;
|
|
12
|
+
viewBox?: string | undefined;
|
|
13
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.SVGProps<SVGSVGElement>, "string" | "name" | "type" | "version" | "fr" | "in" | "className" | "style" | "display" | "overflow" | "visibility" | "order" | "color" | "width" | "height" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "clipPath" | "cursor" | "direction" | "filter" | "fontSizeAdjust" | "fontStretch" | "fontVariant" | "imageRendering" | "opacity" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "wordSpacing" | "writingMode" | "mask" | "offset" | "textDecoration" | "azimuth" | "clip" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fill" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "path" | "children" | "key" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "mode" | "end" | "values" | "local" | "x" | "y" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "origin" | "method" | "operator" | "spacing" | "elevation" | "max" | "href" | "orientation" | "media" | "target" | "min" | "viewBox" | "crossOrigin" | "accentHeight" | "accumulate" | "additive" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "numOctaves" | "orient" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan"> & {
|
|
14
|
+
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
15
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
16
|
+
export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
19
|
+
color?: "inherit" | "disabled" | "error" | "info" | "success" | "action" | "primary" | "secondary" | "warning" | undefined;
|
|
20
|
+
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
21
|
+
htmlColor?: string | undefined;
|
|
22
|
+
inheritViewBox?: boolean | undefined;
|
|
23
|
+
shapeRendering?: string | undefined;
|
|
24
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
25
|
+
titleAccess?: string | undefined;
|
|
26
|
+
viewBox?: string | undefined;
|
|
27
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.SVGProps<SVGSVGElement>, "string" | "name" | "type" | "version" | "fr" | "in" | "className" | "style" | "display" | "overflow" | "visibility" | "order" | "color" | "width" | "height" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "clipPath" | "cursor" | "direction" | "filter" | "fontSizeAdjust" | "fontStretch" | "fontVariant" | "imageRendering" | "opacity" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "wordSpacing" | "writingMode" | "mask" | "offset" | "textDecoration" | "azimuth" | "clip" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fill" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "path" | "children" | "key" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "mode" | "end" | "values" | "local" | "x" | "y" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "origin" | "method" | "operator" | "spacing" | "elevation" | "max" | "href" | "orientation" | "media" | "target" | "min" | "viewBox" | "crossOrigin" | "accentHeight" | "accumulate" | "additive" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "numOctaves" | "orient" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan"> & {
|
|
28
|
+
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
29
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
30
|
+
interface UnifiedNumberProps {
|
|
31
|
+
show: boolean;
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
isVerified?: boolean;
|
|
34
|
+
}
|
|
35
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly, isVerified }: UnifiedNumberProps) => JSX.Element>;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,81 @@
|
|
|
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 { alpha, styled } from '@mui/material/styles';
|
|
17
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
18
|
+
import Box from '@mui/material/Box';
|
|
19
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
20
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
21
|
+
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
22
|
+
import Collapse from '../../../../components/Collapse';
|
|
23
|
+
import Tooltip from '../../../../components/Tooltip';
|
|
24
|
+
import Text from '../../../../components/Text';
|
|
25
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
26
|
+
import Input from '../../../shared/Input';
|
|
27
|
+
import { clearError, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
28
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
29
|
+
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return ({
|
|
32
|
+
display: 'flex',
|
|
33
|
+
justifyContent: 'space-between',
|
|
34
|
+
padding: theme.spacing(0, 2.5, 1, 2.5)
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
38
|
+
var theme = _a.theme;
|
|
39
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
40
|
+
});
|
|
41
|
+
export var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
42
|
+
var theme = _a.theme;
|
|
43
|
+
return ({
|
|
44
|
+
width: theme.spacing(2.75),
|
|
45
|
+
height: theme.spacing(2.125),
|
|
46
|
+
cursor: 'pointer',
|
|
47
|
+
color: alpha(theme.palette.text.primary, 0.4),
|
|
48
|
+
display: 'inline-flex'
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
52
|
+
var theme = _a.theme;
|
|
53
|
+
return ({
|
|
54
|
+
width: theme.spacing(2.75),
|
|
55
|
+
height: theme.spacing(2.125),
|
|
56
|
+
cursor: 'pointer',
|
|
57
|
+
color: alpha(theme.palette.text.primary, 0.4),
|
|
58
|
+
display: 'inline-flex'
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var UnifiedNumber = function (_a) {
|
|
62
|
+
var _b;
|
|
63
|
+
var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
64
|
+
var t = useTranslation().t;
|
|
65
|
+
var bckError = useAppSelector(connectExpressSelector).error;
|
|
66
|
+
var control = useFormContext().control;
|
|
67
|
+
var dispatch = useAppDispatch();
|
|
68
|
+
var _c = React.useState(false), hovered = _c[0], setHovered = _c[1];
|
|
69
|
+
var handleChange = function (_a) {
|
|
70
|
+
var target = _a.target;
|
|
71
|
+
if (bckError)
|
|
72
|
+
dispatch(clearError());
|
|
73
|
+
var value = removeAllCharsFromNumber(target.value);
|
|
74
|
+
unifiedNumberControl.field.onChange(value);
|
|
75
|
+
};
|
|
76
|
+
var unifiedNumberControl = useController({ control: control, name: 'unifiedNumber' });
|
|
77
|
+
var unifiedNumberValue = unifiedNumberControl.field.value;
|
|
78
|
+
var error = (_b = unifiedNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
79
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('v1_company_unified_number_label') }), _jsx(Tooltip, __assign({ title: t('v1_company_unified_number_description'), onMouseOver: function () { return setHovered(true); }, onMouseLeave: function () { return setHovered(false); }, onTouchStartCapture: function () { return setHovered(true); } }, { children: hovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { readOnly: readOnly, onChange: handleChange, value: unifiedNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('v1_company_unified_number_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: unifiedNumberValue, isVerified: isVerified }) })] })) })));
|
|
80
|
+
};
|
|
81
|
+
export default React.memo(UnifiedNumber);
|
|
@@ -15,14 +15,35 @@ export declare const OtherThanKWOrSABusinessDataSchema: (isLeadIdPassed: boolean
|
|
|
15
15
|
export declare const BusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
16
16
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
17
17
|
selectedLicense: any;
|
|
18
|
+
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
19
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
20
|
+
termAndConditionChecked: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
21
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
22
|
+
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
|
+
selectedLicense: any;
|
|
24
|
+
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
25
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
26
|
+
termAndConditionChecked: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
27
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
28
|
+
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
29
|
+
selectedLicense: any;
|
|
30
|
+
unifiedNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
31
|
+
licenseNumber: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
|
+
termAndConditionChecked: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
33
|
+
}>>> | yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
34
|
+
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
35
|
+
selectedLicense: any;
|
|
36
|
+
unifiedNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
18
37
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
19
38
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
20
39
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
21
40
|
selectedLicense: any;
|
|
41
|
+
unifiedNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
22
42
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
43
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
44
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
25
45
|
selectedLicense: any;
|
|
46
|
+
unifiedNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
26
47
|
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
27
48
|
}>>>;
|
|
28
49
|
export declare const KWBusinessDataSchema: (isLeadIdPassed: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH,
|
|
2
|
+
import { KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH, BRAND_NAME_MAX_LENGTH, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
3
3
|
import { BusinessType } from '../../../../@types';
|
|
4
4
|
var objectElements = {
|
|
5
5
|
legal_name: yup.object().shape({
|
|
@@ -94,22 +94,40 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
|
|
|
94
94
|
})
|
|
95
95
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
96
96
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
unifiedNumber: yup.string().test({
|
|
98
|
+
name: 'unifiedNumber',
|
|
99
|
+
message: '',
|
|
100
100
|
test: function (value) {
|
|
101
|
+
var _a;
|
|
101
102
|
var selectedLicense = this.parent.selectedLicense;
|
|
102
|
-
var
|
|
103
|
+
var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
103
104
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
105
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
106
|
+
return false;
|
|
107
|
+
if (isFL || length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
108
|
+
return true;
|
|
104
109
|
if (length === 0)
|
|
110
|
+
return this.createError({ message: '' });
|
|
111
|
+
return this.createError({ message: 'unified_number_required' });
|
|
112
|
+
}
|
|
113
|
+
}),
|
|
114
|
+
licenseNumber: yup.string().test({
|
|
115
|
+
name: 'licenseNumber',
|
|
116
|
+
message: '',
|
|
117
|
+
test: function (value) {
|
|
118
|
+
var _a;
|
|
119
|
+
var selectedLicense = this.parent.selectedLicense;
|
|
120
|
+
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
121
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
122
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
123
|
+
return false;
|
|
124
|
+
if (isCR || length >= FL_MIN_LICENSE_LENGTH)
|
|
105
125
|
return true;
|
|
106
|
-
if (
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
126
|
+
if (length === 0)
|
|
127
|
+
return this.createError({ message: '' });
|
|
128
|
+
return this.createError({ message: 'fl_max_length' });
|
|
110
129
|
}
|
|
111
|
-
})
|
|
112
|
-
.required(''),
|
|
130
|
+
}),
|
|
113
131
|
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond')
|
|
114
132
|
});
|
|
115
133
|
}
|
|
@@ -127,7 +145,7 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
|
|
|
127
145
|
})
|
|
128
146
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
129
147
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
130
|
-
|
|
148
|
+
unifiedNumber: yup
|
|
131
149
|
.string()
|
|
132
150
|
.test({
|
|
133
151
|
test: function (value) {
|
|
@@ -137,8 +155,21 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
|
|
|
137
155
|
if (length === 0)
|
|
138
156
|
return true;
|
|
139
157
|
if (isCR) {
|
|
140
|
-
return length >=
|
|
158
|
+
return length >= 2 ? true : this.createError({ message: '' });
|
|
141
159
|
}
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
.required(''),
|
|
164
|
+
licenseNumber: yup
|
|
165
|
+
.string()
|
|
166
|
+
.test({
|
|
167
|
+
test: function (value) {
|
|
168
|
+
var selectedLicense = this.parent.selectedLicense;
|
|
169
|
+
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
170
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
171
|
+
if (length === 0 || isCR)
|
|
172
|
+
return true;
|
|
142
173
|
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
143
174
|
}
|
|
144
175
|
})
|
|
@@ -15,11 +15,12 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
17
|
import { settingsSelector } from '../../../../app/settings';
|
|
18
|
-
import { formatNumberAsCurrency,
|
|
18
|
+
import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import Input from '../../../shared/Input';
|
|
21
21
|
import { clearError } from '../../../app/entity/entityStore';
|
|
22
22
|
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
23
|
+
import TextWithCurrency from '../../../../components/TextWithCurrency';
|
|
23
24
|
var CapitalPaid = function (_a) {
|
|
24
25
|
var _b;
|
|
25
26
|
var readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
@@ -34,14 +35,9 @@ var CapitalPaid = function (_a) {
|
|
|
34
35
|
var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
|
|
35
36
|
capitalPaidControl.field.onChange(value);
|
|
36
37
|
};
|
|
37
|
-
var getCurrency = React.useMemo(function () {
|
|
38
|
-
return t(getCurrencyByCountryIso2(settingsData.businessCountry.iso2));
|
|
39
|
-
}, [settingsData.businessCountry.iso2]);
|
|
40
38
|
var capitalPaidControl = useController({ control: control, name: 'capitalPaid' });
|
|
41
39
|
var capitalPaidValue = capitalPaidControl.field.value;
|
|
42
40
|
var error = (_b = capitalPaidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
43
|
-
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('
|
|
44
|
-
currency: getCurrency
|
|
45
|
-
}), required: true, onChange: handleChange, value: capitalPaidValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_paid_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalPaidValue, isVerified: isVerified }) }) })));
|
|
41
|
+
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: _jsx(TextWithCurrency, { text: t('capital_paid_input_label'), countryCode: settingsData.businessCountry.iso2 }), required: true, onChange: handleChange, value: capitalPaidValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_paid_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalPaidValue, isVerified: isVerified }) }) })));
|
|
46
42
|
};
|
|
47
43
|
export default React.memo(CapitalPaid);
|
|
@@ -13,13 +13,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
-
import { formatNumberAsCurrency,
|
|
16
|
+
import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
|
|
17
17
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
18
|
import { settingsSelector } from '../../../../app/settings';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import Input from '../../../shared/Input';
|
|
21
21
|
import { clearError } from '../../../app/entity/entityStore';
|
|
22
22
|
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
23
|
+
import TextWithCurrency from '../../../../components/TextWithCurrency';
|
|
23
24
|
var CapitalShareValue = function (_a) {
|
|
24
25
|
var _b;
|
|
25
26
|
var readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
@@ -34,14 +35,9 @@ var CapitalShareValue = function (_a) {
|
|
|
34
35
|
var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
|
|
35
36
|
capitalShareValueControl.field.onChange(value);
|
|
36
37
|
};
|
|
37
|
-
var getCurrency = React.useMemo(function () {
|
|
38
|
-
return t(getCurrencyByCountryIso2(settingsData.businessCountry.iso2));
|
|
39
|
-
}, [settingsData.businessCountry.iso2]);
|
|
40
38
|
var capitalShareValueControl = useController({ control: control, name: 'capitalShareValue' });
|
|
41
39
|
var capitalShareValueValue = capitalShareValueControl.field.value;
|
|
42
40
|
var error = (_b = capitalShareValueControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
43
|
-
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('
|
|
44
|
-
currency: getCurrency
|
|
45
|
-
}), required: true, onChange: handleChange, value: capitalShareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalShareValueValue, isVerified: isVerified }) }) })));
|
|
41
|
+
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: _jsx(TextWithCurrency, { text: t('capital_share_value_input_label'), countryCode: settingsData.businessCountry.iso2 }), required: true, onChange: handleChange, value: capitalShareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalShareValueValue, isVerified: isVerified }) }) })));
|
|
46
42
|
};
|
|
47
43
|
export default React.memo(CapitalShareValue);
|