@arquimedes.co/eureka-forms 3.0.48-test → 3.0.49-new-steps
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/dist/@Types/AvailabilityFormStep.d.ts +48 -0
- package/dist/@Types/AvailabilityFormStep.js +24 -0
- package/dist/@Types/BankAccountFormStep.d.ts +67 -0
- package/dist/@Types/BankAccountFormStep.js +14 -0
- package/dist/@Types/BookingFormStep.d.ts +156 -0
- package/dist/@Types/BookingFormStep.js +44 -0
- package/dist/@Types/CalendarFormStep.d.ts +192 -0
- package/dist/@Types/CalendarFormStep.js +48 -0
- package/dist/@Types/CommunicationChannelFormStep.d.ts +51 -0
- package/dist/@Types/CommunicationChannelFormStep.js +15 -0
- package/dist/@Types/Condition.d.ts +4 -6
- package/dist/@Types/ConsentFormStep.d.ts +36 -0
- package/dist/@Types/ConsentFormStep.js +8 -0
- package/dist/@Types/EntityFormFormStep.d.ts +66 -0
- package/dist/@Types/EntityFormFormStep.js +20 -0
- package/dist/@Types/EventFormStep.d.ts +52 -0
- package/dist/@Types/EventFormStep.js +13 -0
- package/dist/@Types/ExternalReferenceFormStep.d.ts +74 -0
- package/dist/@Types/ExternalReferenceFormStep.js +20 -0
- package/dist/@Types/Form.d.ts +0 -1
- package/dist/@Types/FormStep.d.ts +8 -10
- package/dist/@Types/FormStep.js +2 -1
- package/dist/@Types/LocationFormStep.d.ts +159 -0
- package/dist/@Types/LocationFormStep.js +46 -0
- package/dist/@Types/NumericFormSteps.d.ts +108 -0
- package/dist/@Types/NumericFormSteps.js +20 -0
- package/dist/@Types/PredefinedSelectorFormStep.d.ts +51 -0
- package/dist/@Types/PredefinedSelectorFormStep.js +39 -0
- package/dist/@Types/StepRef.d.ts +135 -0
- package/dist/@Types/StepRef.js +49 -0
- package/dist/App/App.js +1 -1
- package/dist/App/AppFunctions.js +3 -8
- package/dist/App/AppHooks.js +1 -20
- package/dist/Form/Form.js +2 -6
- package/dist/Form/Form.module.css +39 -48
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +4 -8
- package/dist/FormSteps/BookingStep/BookingStep.d.ts +17 -0
- package/dist/FormSteps/BookingStep/BookingStep.js +14 -0
- package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +3 -0
- package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +362 -0
- package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.module.css +174 -0
- package/dist/FormSteps/CBRStepMapper.js +1 -1
- package/dist/FormSteps/CalendarStep/CalendarStep.d.ts +7 -0
- package/dist/FormSteps/CalendarStep/CalendarStep.js +14 -0
- package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.d.ts +3 -0
- package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.js +269 -0
- package/dist/FormSteps/CalendarStep/MaterialCalendarStep/MaterialCalendarStep.module.css +531 -0
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +2 -2
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +4 -52
- package/dist/FormSteps/LocationStep/LocationStep.d.ts +10 -0
- package/dist/FormSteps/LocationStep/LocationStep.js +14 -0
- package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +3 -0
- package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +47 -0
- package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +18 -0
- package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +3 -0
- package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +168 -0
- package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +94 -0
- package/dist/FormSteps/NumberStep/NumberStep.d.ts +10 -0
- package/dist/FormSteps/NumberStep/NumberStep.js +14 -0
- package/dist/FormSteps/Step.js +16 -0
- package/dist/FormSteps/StepFunctions.js +23 -6
- package/dist/FormSteps/StepFunctions.test.js +57 -3
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +1 -2
- package/dist/Icons/@ErkIcon.d.ts +2 -2
- package/dist/Icons/@ErkIcon.js +2 -2
- package/dist/Icons/AddIcon.d.ts +3 -0
- package/dist/Icons/AddIcon.js +7 -0
- package/dist/Icons/EditIcon.d.ts +3 -0
- package/dist/Icons/{EmailIcon.js → EditIcon.js} +3 -3
- package/dist/Icons/RemoveIcon.d.ts +3 -0
- package/dist/Icons/RemoveIcon.js +7 -0
- package/dist/Icons/ViewDayIcon.d.ts +3 -0
- package/dist/Icons/ViewDayIcon.js +7 -0
- package/dist/Icons/ViewWeekIcon.d.ts +3 -0
- package/dist/Icons/ViewWeekIcon.js +7 -0
- package/dist/Services/DraftService.js +1 -4
- package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +19 -0
- package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +80 -0
- package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +82 -0
- package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +29 -0
- package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +139 -0
- package/dist/Shared/ErkDatePicker/ErkDatePicker.js +1 -3
- package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +2 -3
- package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +1 -2
- package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +23 -0
- package/dist/Shared/ErkLocationField/ErkLocationField.js +73 -0
- package/dist/Shared/ErkLocationField/ErkLocationField.module.css +29 -0
- package/dist/Shared/ErkLocationField/addressFields.d.ts +12 -0
- package/dist/Shared/ErkLocationField/addressFields.js +34 -0
- package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +6 -0
- package/dist/Shared/ErkLocationField/locationRestrictions.js +51 -0
- package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +15 -0
- package/dist/Shared/ErkLocationInput/ErkLocationInput.js +499 -0
- package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +115 -0
- package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +42 -0
- package/dist/Shared/ErkNumberField/ErkNumberField.js +170 -0
- package/dist/Shared/ErkSelect/ErkSelect.d.ts +2 -2
- package/dist/Shared/InputIcon/InputIcon.js +0 -6
- package/dist/Shared/Navbar/Navbar.d.ts +1 -2
- package/dist/Shared/Navbar/Navbar.js +3 -22
- package/dist/Shared/Navbar/Navbar.module.css +8 -22
- package/dist/Shared/SmartDraftRenderer/SmartDraftRenderer.js +2 -8
- package/dist/States/GlobalSlice.d.ts +1 -4
- package/dist/States/GlobalSlice.js +1 -8
- package/dist/constants/ErkIconTypes.d.ts +1 -3
- package/dist/constants/ErkIconTypes.js +0 -2
- package/dist/constants/FormStepTypes.d.ts +6 -3
- package/dist/constants/FormStepTypes.js +4 -1
- package/dist/hooks.d.ts +0 -3
- package/dist/hooks.js +1 -17
- package/package.json +3 -9
- package/dist/@Types/ErkValue.d.ts +0 -16
- package/dist/@Types/ErkValue.js +0 -1
- package/dist/@Types/User.d.ts +0 -13
- package/dist/@Types/User.js +0 -1
- package/dist/Icons/EmailIcon.d.ts +0 -3
- package/dist/Icons/Entities/SchoolIcon.d.ts +0 -3
- package/dist/Icons/Entities/SchoolIcon.js +0 -7
- package/dist/Icons/GroupIcon.d.ts +0 -3
- package/dist/Icons/GroupIcon.js +0 -7
- package/dist/Icons/LockedIcon.d.ts +0 -3
- package/dist/Icons/LockedIcon.js +0 -7
- package/dist/Login/Login.module.css +0 -135
- package/dist/Login/LoginLayout.module.css +0 -68
- package/dist/Login/LoginPage.d.ts +0 -10
- package/dist/Login/LoginPage.js +0 -101
- package/dist/Login/LoginTextField.d.ts +0 -14
- package/dist/Login/LoginTextField.js +0 -29
- package/dist/Services/ApiSelectorService.d.ts +0 -366
- package/dist/Services/ApiSelectorService.js +0 -173
- package/dist/Services/ApiSelectorService.test.d.ts +0 -1
- package/dist/Services/ApiSelectorService.test.js +0 -87
- package/dist/Services/IntegrationService.d.ts +0 -21
- package/dist/Services/IntegrationService.js +0 -22
- package/dist/Services/UserService.d.ts +0 -10
- package/dist/Services/UserService.js +0 -21
- package/dist/Shared/SmartDraftRenderer/LinkDecorator.d.ts +0 -14
- package/dist/Shared/SmartDraftRenderer/LinkDecorator.js +0 -48
- package/dist/constants/ErkValueTypes.d.ts +0 -6
- package/dist/constants/ErkValueTypes.js +0 -7
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
.rightPanel {
|
|
2
|
-
background-color: #3d5a7f;
|
|
3
|
-
display: flex;
|
|
4
|
-
border-radius: 0 20px 20px 0;
|
|
5
|
-
flex-grow: 0;
|
|
6
|
-
max-width: 41.666667%;
|
|
7
|
-
flex-basis: 41.666667%;
|
|
8
|
-
}
|
|
9
|
-
.rightPanelMessage {
|
|
10
|
-
margin: auto;
|
|
11
|
-
text-align: center;
|
|
12
|
-
padding: 0 30px 0 30px;
|
|
13
|
-
}
|
|
14
|
-
.rightPanelMessage h1 {
|
|
15
|
-
color: white;
|
|
16
|
-
font-size: 40px;
|
|
17
|
-
font-weight: 900;
|
|
18
|
-
}
|
|
19
|
-
.rightPanelMessage p {
|
|
20
|
-
color: white;
|
|
21
|
-
}
|
|
22
|
-
.leftPanel {
|
|
23
|
-
display: flex;
|
|
24
|
-
text-align: center;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
flex-grow: 1;
|
|
27
|
-
max-width: 100%;
|
|
28
|
-
min-height: fit-content;
|
|
29
|
-
flex-basis: 0;
|
|
30
|
-
position: relative;
|
|
31
|
-
justify-content: center;
|
|
32
|
-
}
|
|
33
|
-
.leftPanel h1 {
|
|
34
|
-
margin-left: auto;
|
|
35
|
-
margin-right: auto;
|
|
36
|
-
color: #3d5a7f;
|
|
37
|
-
font-size: 40px;
|
|
38
|
-
font-weight: 900;
|
|
39
|
-
margin-top: 40px;
|
|
40
|
-
padding-left: 20px;
|
|
41
|
-
padding-right: 20px;
|
|
42
|
-
margin-bottom: 40px;
|
|
43
|
-
}
|
|
44
|
-
.leftPanel a {
|
|
45
|
-
font-size: 22px;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
-moz-user-select: none;
|
|
48
|
-
-khtml-user-select: none;
|
|
49
|
-
-webkit-user-select: none;
|
|
50
|
-
-ms-user-select: none;
|
|
51
|
-
user-select: none;
|
|
52
|
-
padding-left: 20px;
|
|
53
|
-
padding-right: 20px;
|
|
54
|
-
margin: 0px auto 25px auto;
|
|
55
|
-
text-decoration: underline;
|
|
56
|
-
}
|
|
57
|
-
.loginButton {
|
|
58
|
-
background-color: #3d5a7f;
|
|
59
|
-
border-radius: 40px;
|
|
60
|
-
padding: 22px 50px;
|
|
61
|
-
margin: 0 auto 0 auto;
|
|
62
|
-
color: white;
|
|
63
|
-
font-weight: 800;
|
|
64
|
-
font-size: 22px;
|
|
65
|
-
cursor: pointer;
|
|
66
|
-
-moz-user-select: none;
|
|
67
|
-
-khtml-user-select: none;
|
|
68
|
-
-webkit-user-select: none;
|
|
69
|
-
-ms-user-select: none;
|
|
70
|
-
user-select: none;
|
|
71
|
-
width: fit-content;
|
|
72
|
-
max-width: calc(100% - 40px);
|
|
73
|
-
height: fit-content;
|
|
74
|
-
position: relative;
|
|
75
|
-
display: flex;
|
|
76
|
-
align-items: center;
|
|
77
|
-
justify-content: center;
|
|
78
|
-
}
|
|
79
|
-
.loginButton[disabled] {
|
|
80
|
-
pointer-events: none;
|
|
81
|
-
opacity: 0.5;
|
|
82
|
-
}
|
|
83
|
-
.loaderContainer {
|
|
84
|
-
position: absolute;
|
|
85
|
-
margin: auto;
|
|
86
|
-
height: 40px;
|
|
87
|
-
width: 40px;
|
|
88
|
-
}
|
|
89
|
-
.logo {
|
|
90
|
-
position: absolute;
|
|
91
|
-
display: flex;
|
|
92
|
-
flex-direction: row;
|
|
93
|
-
justify-content: center;
|
|
94
|
-
left: 40px;
|
|
95
|
-
top: 33px;
|
|
96
|
-
height: 65px;
|
|
97
|
-
margin-right: auto;
|
|
98
|
-
}
|
|
99
|
-
.loginInputsContainer {
|
|
100
|
-
width: 60%;
|
|
101
|
-
margin: 0 auto 0 auto;
|
|
102
|
-
}
|
|
103
|
-
.loginInput {
|
|
104
|
-
min-height: 80px;
|
|
105
|
-
}
|
|
106
|
-
@media screen and (max-width: 825px) {
|
|
107
|
-
.rightPanel {
|
|
108
|
-
display: none;
|
|
109
|
-
}
|
|
110
|
-
.loginInputsContainer {
|
|
111
|
-
width: 70%;
|
|
112
|
-
margin: 0 auto 0 auto;
|
|
113
|
-
}
|
|
114
|
-
.leftPanel h1 {
|
|
115
|
-
margin-top: 5%;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@media screen and (max-width: 678px) {
|
|
120
|
-
.logo {
|
|
121
|
-
display: none;
|
|
122
|
-
}
|
|
123
|
-
.loginInputsContainer {
|
|
124
|
-
width: 80%;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
@media screen and (max-height: 720px) {
|
|
129
|
-
.logo {
|
|
130
|
-
display: none;
|
|
131
|
-
}
|
|
132
|
-
.loginButton {
|
|
133
|
-
margin-bottom: 40px;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
.loginLayout {
|
|
2
|
-
height: 100vh;
|
|
3
|
-
display: flex;
|
|
4
|
-
width: 100vw;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
background-color: #f0f0f0;
|
|
7
|
-
|
|
8
|
-
position: relative;
|
|
9
|
-
}
|
|
10
|
-
.semiCircle {
|
|
11
|
-
margin-top: auto;
|
|
12
|
-
width: 30vmin;
|
|
13
|
-
height: 30vmin;
|
|
14
|
-
min-width: 100px;
|
|
15
|
-
min-height: 100px;
|
|
16
|
-
object-fit: contain;
|
|
17
|
-
background-color: #98c1d9;
|
|
18
|
-
border-top-left-radius: 0%;
|
|
19
|
-
border-top-right-radius: 100%;
|
|
20
|
-
border-bottom-left-radius: 0%;
|
|
21
|
-
border-bottom-right-radius: 0%;
|
|
22
|
-
}
|
|
23
|
-
.triangle {
|
|
24
|
-
width: 0;
|
|
25
|
-
height: 0;
|
|
26
|
-
border-bottom: 500px solid #ee6c4d;
|
|
27
|
-
border-left: 500px solid transparent;
|
|
28
|
-
margin-left: auto;
|
|
29
|
-
transform: translateY(-300px) translateX(150px) rotate(10deg);
|
|
30
|
-
}
|
|
31
|
-
.cardLayout {
|
|
32
|
-
height: 100%;
|
|
33
|
-
width: 100%;
|
|
34
|
-
display: flex;
|
|
35
|
-
position: absolute;
|
|
36
|
-
left: 0;
|
|
37
|
-
right: 0;
|
|
38
|
-
top: 0;
|
|
39
|
-
bottom: 0;
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
overflow-y: auto;
|
|
42
|
-
}
|
|
43
|
-
.loginCard {
|
|
44
|
-
margin: 7.5vh auto;
|
|
45
|
-
z-index: 2;
|
|
46
|
-
width: 85vw;
|
|
47
|
-
background-color: white;
|
|
48
|
-
border-radius: 20px;
|
|
49
|
-
min-height: 85vh;
|
|
50
|
-
height: fit-content;
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
}
|
|
54
|
-
.cardContainer {
|
|
55
|
-
display: flex;
|
|
56
|
-
flex-grow: 1;
|
|
57
|
-
flex-direction: row;
|
|
58
|
-
height: 100%;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@media screen and (max-width: 320px) {
|
|
62
|
-
.loginCard {
|
|
63
|
-
width: 100vw;
|
|
64
|
-
height: 100vh;
|
|
65
|
-
margin: 0px;
|
|
66
|
-
border-radius: 0px;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Form } from '../@Types';
|
|
2
|
-
interface LoginPageProps {
|
|
3
|
-
form: Form;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Displays the specific login component depending on the url
|
|
7
|
-
* @returns the respective component
|
|
8
|
-
*/
|
|
9
|
-
declare function LoginPage({ form }: LoginPageProps): JSX.Element;
|
|
10
|
-
export default LoginPage;
|
package/dist/Login/LoginPage.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import layoutStyles from './LoginLayout.module.css';
|
|
4
|
-
import styles from './Login.module.css';
|
|
5
|
-
import Loader from '../Shared/Loader/Loader';
|
|
6
|
-
import { Controller, useForm } from 'react-hook-form';
|
|
7
|
-
import axiosInstance from '../Utils/AxiosAPI';
|
|
8
|
-
import { useAppDispatch, useAppSelector } from '../hooks';
|
|
9
|
-
import { login } from '../Services/UserService';
|
|
10
|
-
import { setUser } from '../States/GlobalSlice';
|
|
11
|
-
import { jwtDecode } from 'jwt-decode';
|
|
12
|
-
import LoginTextField from './LoginTextField';
|
|
13
|
-
import MaterialProviders from '../Utils/MaterialProviders';
|
|
14
|
-
const EMAIL_REGEX =
|
|
15
|
-
// eslint-disable-next-line no-control-regex
|
|
16
|
-
/^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i;
|
|
17
|
-
/**
|
|
18
|
-
* Displays the specific login component depending on the url
|
|
19
|
-
* @returns the respective component
|
|
20
|
-
*/
|
|
21
|
-
function LoginPage({ form }) {
|
|
22
|
-
const dispatch = useAppDispatch();
|
|
23
|
-
const formStyle = useAppSelector((state) => state.global.formStyle);
|
|
24
|
-
/** If login has errors */
|
|
25
|
-
const [wrongLogin, setWrongLogin] = useState(false);
|
|
26
|
-
/** if waiting for response */
|
|
27
|
-
const [loading, setLoading] = useState(false);
|
|
28
|
-
const { getValues, clearErrors, formState: { errors }, setError, trigger, control, } = useForm({
|
|
29
|
-
mode: 'onTouched',
|
|
30
|
-
});
|
|
31
|
-
/**
|
|
32
|
-
* Handles login, redirects the user if the current subdomain is not valid
|
|
33
|
-
*/
|
|
34
|
-
const handleLogin = async () => {
|
|
35
|
-
const isValid = await trigger();
|
|
36
|
-
const values = getValues();
|
|
37
|
-
const isInternal = ['andres'].includes(values.email);
|
|
38
|
-
if ((isValid || isInternal) && form.apiKey) {
|
|
39
|
-
try {
|
|
40
|
-
setLoading(true);
|
|
41
|
-
const payload = values;
|
|
42
|
-
if (isInternal) {
|
|
43
|
-
payload.email = values.email + '@capta.co';
|
|
44
|
-
}
|
|
45
|
-
const token = await login(form.apiKey, payload);
|
|
46
|
-
localStorage.setItem('token', token);
|
|
47
|
-
const user = jwtDecode(token);
|
|
48
|
-
axiosInstance.defaults.headers.Authorization = 'Bearer ' + token;
|
|
49
|
-
dispatch(setUser(user));
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
setLoading(false);
|
|
53
|
-
if (err?.response?.status !== 400) {
|
|
54
|
-
console.error(err);
|
|
55
|
-
}
|
|
56
|
-
if (err?.response?.data === 'Invalid Organization') {
|
|
57
|
-
setError('password', {
|
|
58
|
-
type: 'pattern',
|
|
59
|
-
message: 'Organización inválida',
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
setError('password', {
|
|
64
|
-
type: 'pattern',
|
|
65
|
-
message: 'Correo o contraseña incorrecta',
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
setError('email', {
|
|
69
|
-
type: 'pattern',
|
|
70
|
-
message: '',
|
|
71
|
-
});
|
|
72
|
-
setWrongLogin(true);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Function that clears errors if there are any.
|
|
78
|
-
*/
|
|
79
|
-
const clearWrongLogin = () => {
|
|
80
|
-
if (wrongLogin) {
|
|
81
|
-
setWrongLogin(false);
|
|
82
|
-
clearErrors(['email', 'password']);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
return (_jsx(MaterialProviders, { formStyle: formStyle, children: _jsxs("div", { className: layoutStyles.loginLayout, children: [_jsx("div", { className: layoutStyles.semiCircle }), _jsx("div", { className: layoutStyles.triangle }), _jsx("div", { className: layoutStyles.cardLayout, children: _jsx("div", { className: layoutStyles.loginCard, children: _jsxs("div", { className: layoutStyles.cardContainer, children: [_jsxs("div", { className: styles.leftPanel, children: [_jsx("div", { className: styles.logo, children: _jsx("img", { alt: 'Capta', className: 'capta-logo', src: '/Capta.svg' }) }), _jsx("h1", { children: "Inicia sesi\u00F3n en Capta" }), _jsxs("div", { className: styles.loginInputsContainer, children: [_jsx("div", { className: styles.loginInput, children: _jsx(Controller, { name: "email", control: control, defaultValue: "", rules: {
|
|
86
|
-
required: 'El correo es obligatorio',
|
|
87
|
-
pattern: {
|
|
88
|
-
value: EMAIL_REGEX,
|
|
89
|
-
message: 'El correo no es válido',
|
|
90
|
-
},
|
|
91
|
-
}, render: ({ field }) => (_jsx(LoginTextField, { ...field, "data-testid": "login_email", handleEnter: handleLogin, handleChange: clearWrongLogin, email: true, name: "email", disabled: loading, placeholder: "Correo", error: !!errors.email, helperText: errors.email?.message ?? '' })) }) }), _jsx("div", { className: styles.loginInput, children: _jsx(Controller, { name: "password", control: control, defaultValue: "", rules: {
|
|
92
|
-
required: 'La contraseña es obligatoria',
|
|
93
|
-
}, render: ({ field }) => (_jsx(LoginTextField, { ...field, disabled: loading, "data-testid": "login_password", handleEnter: handleLogin, handleChange: clearWrongLogin, name: "password", placeholder: "Contrase\u00F1a", error: !!errors.password, helperText: errors.password?.message ?? '' })) }) })] }), _jsxs("button", { "data-testid": "login_submit", className: styles.loginButton, onClick: () => {
|
|
94
|
-
if (!loading) {
|
|
95
|
-
void handleLogin();
|
|
96
|
-
}
|
|
97
|
-
}, disabled: loading, children: [_jsx("label", { style: {
|
|
98
|
-
visibility: loading ? 'hidden' : 'visible',
|
|
99
|
-
}, children: "Inicia sesi\u00F3n" }), loading && (_jsx("div", { className: styles.loaderContainer, children: _jsx(Loader, { color: "white" }) }))] })] }), _jsx("div", { className: styles.rightPanel, children: _jsxs("div", { className: styles.rightPanelMessage, children: [_jsx("h1", { children: "\u00A1Bienvenid@!" }), _jsx("p", { children: "Ingresa tu correo y contrase\u00F1a para ingresar al formulario." })] }) })] }) }) })] }) }));
|
|
100
|
-
}
|
|
101
|
-
export default LoginPage;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface LoginTextFieldProps {
|
|
3
|
-
/** Function called on Enter */
|
|
4
|
-
handleEnter?: () => void | Promise<void>;
|
|
5
|
-
/** If the field is of type email (otherwise password) */
|
|
6
|
-
email?: boolean;
|
|
7
|
-
/** Native change handler forwarded from react-hook-form */
|
|
8
|
-
onChange?: React.ChangeEventHandler;
|
|
9
|
-
/** Extra handler called on every change (clears the wrong-login state) */
|
|
10
|
-
handleChange?: () => void;
|
|
11
|
-
[key: string]: unknown;
|
|
12
|
-
}
|
|
13
|
-
declare function LoginTextField({ handleEnter, email, onChange, handleChange, ...others }: LoginTextFieldProps): JSX.Element;
|
|
14
|
-
export default LoginTextField;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import TextField from '@mui/material/TextField';
|
|
3
|
-
import InputAdornment from '@mui/material/InputAdornment';
|
|
4
|
-
import EmailIcon from '../Icons/EmailIcon';
|
|
5
|
-
import LockedIcon from '../Icons/LockedIcon';
|
|
6
|
-
function LoginTextField({ handleEnter, email, onChange, handleChange, ...others }) {
|
|
7
|
-
return (_jsx(TextField, { ...others, variant: "outlined", size: "small", fullWidth: true, type: email ? 'email' : 'password', onChange: (event) => {
|
|
8
|
-
handleChange?.();
|
|
9
|
-
onChange?.(event);
|
|
10
|
-
}, slotProps: {
|
|
11
|
-
input: {
|
|
12
|
-
onKeyDown: (event) => {
|
|
13
|
-
if (handleEnter && event.key === 'Enter') {
|
|
14
|
-
void handleEnter();
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
startAdornment: (_jsx(InputAdornment, { position: "start", children: email ? _jsx(EmailIcon, {}) : _jsx(LockedIcon, {}) })),
|
|
18
|
-
sx: {
|
|
19
|
-
borderRadius: '10px',
|
|
20
|
-
backgroundColor: '#ebebeb',
|
|
21
|
-
paddingRight: '7px',
|
|
22
|
-
'& input': { padding: '6px 0px', fontWeight: 300, height: 40 },
|
|
23
|
-
'&.Mui-focused fieldset': { borderColor: '#3d5a7f' },
|
|
24
|
-
'&:hover fieldset': { borderColor: '#3d5a7f' },
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
}, sx: { '& label.Mui-focused': { color: '#3d5a7f' } } }));
|
|
28
|
-
}
|
|
29
|
-
export default LoginTextField;
|