contentoh-components-library 21.0.39 → 21.0.42

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.
Files changed (32) hide show
  1. package/dist/components/atoms/GeneralInput/index.js +2 -6
  2. package/dist/components/atoms/GradientPanel/styles.js +1 -1
  3. package/dist/components/atoms/Loading/index.js +5 -3
  4. package/dist/components/atoms/Loading/styles.js +1 -1
  5. package/dist/components/molecules/LoginPasswordStrength/index.js +2 -8
  6. package/dist/components/molecules/RegistrationFirstStep/index.js +78 -135
  7. package/dist/components/molecules/RegistrationFirstStep/styles.js +1 -1
  8. package/dist/components/molecules/RegistrationSecondStep/index.js +42 -110
  9. package/dist/components/molecules/RegistrationThirdStep/index.js +19 -33
  10. package/dist/components/molecules/SignInLogin/styles.js +1 -1
  11. package/dist/components/molecules/TagAndInput/index.js +2 -6
  12. package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +115 -9
  13. package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +2 -2
  14. package/dist/components/organisms/ChangePassword/index.js +13 -3
  15. package/dist/components/organisms/ChangePassword/styles.js +1 -1
  16. package/package.json +2 -2
  17. package/src/components/atoms/GeneralInput/index.js +0 -4
  18. package/src/components/atoms/GradientPanel/styles.js +1 -0
  19. package/src/components/atoms/Loading/index.js +2 -0
  20. package/src/components/atoms/Loading/styles.js +12 -3
  21. package/src/components/molecules/EmailResetPasswordLogin/index.js +0 -1
  22. package/src/components/molecules/LoginPasswordStrength/index.js +0 -5
  23. package/src/components/molecules/RegistrationFirstStep/index.js +91 -136
  24. package/src/components/molecules/RegistrationFirstStep/styles.js +4 -1
  25. package/src/components/molecules/RegistrationSecondStep/index.js +51 -86
  26. package/src/components/molecules/RegistrationThirdStep/index.js +14 -1
  27. package/src/components/molecules/SignInLogin/styles.js +1 -0
  28. package/src/components/molecules/TagAndInput/index.js +0 -4
  29. package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +103 -11
  30. package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +2 -4
  31. package/src/components/organisms/ChangePassword/index.js +16 -3
  32. package/src/components/organisms/ChangePassword/styles.js +1 -2
@@ -6,7 +6,6 @@ export const LoginPasswordStrength = ({
6
6
  emptyPassword,
7
7
  emptyConfirmPassword,
8
8
  matchPasswords,
9
- onChange,
10
9
  required,
11
10
  }) => {
12
11
  const [passwordStrength, setPasswordStrength] = useState(0);
@@ -40,8 +39,6 @@ export const LoginPasswordStrength = ({
40
39
  newValue.match(specialChar) &&
41
40
  setPasswordStrength((passwordStrength) => passwordStrength + 1);
42
41
  break;
43
- case "confirmPasswordInput":
44
- break;
45
42
  default:
46
43
  return;
47
44
  }
@@ -55,7 +52,6 @@ export const LoginPasswordStrength = ({
55
52
  inputId={"newPasswordInput"}
56
53
  label={"Ingrese su nueva contraseña"}
57
54
  required={required}
58
- onChange={onChange}
59
55
  />
60
56
  {emptyPassword && (
61
57
  <label>La contraseña debe ser minimo de 8 caracteres</label>
@@ -85,7 +81,6 @@ export const LoginPasswordStrength = ({
85
81
  inputId={"confirmPasswordInput"}
86
82
  label={"Confirme la nueva contraseña"}
87
83
  required={required}
88
- onChange={onChange}
89
84
  />
90
85
  {emptyConfirmPassword && !emptyPassword && (
91
86
  <label>Confirme la contraseña</label>
@@ -14,11 +14,10 @@ export const RegistrationFirstStep = (props) => {
14
14
  const [emptyEmail, setEmptyEmail] = useState(false);
15
15
  const [emptyJob, setEmptyJob] = useState(false);
16
16
  const [emptyPhone, setEmptyPhone] = useState(false);
17
- const [emptyCountry, setEmptyCountry] = useState(true);
18
- const [showErrors, setShowErrors] = useState(false);
19
- const [regError, setRegError] = useState(false);
17
+ const [emptyCountry, setEmptyCountry] = useState(false);
18
+ const [invalidEmail, setInvalidEmail] = useState(false);
20
19
  const [phoneFormatError, setPhoneFormatError] = useState(false);
21
- const [emailFormatError, setEmailFormatError] = useState(false);
20
+ const [regError, setRegError] = useState(false);
22
21
 
23
22
  useEffect(() => {
24
23
  JSON.parse(sessionStorage.getItem("nuevoRegistro")).name === "" &&
@@ -32,86 +31,75 @@ export const RegistrationFirstStep = (props) => {
32
31
  setEmptyCountry(false);
33
32
  setEmptyPhone(false);
34
33
  }
35
-
36
34
  sessionStorage.getItem("resetPasswordProcess") &&
37
35
  sessionStorage.getItem("resetPasswordProcess");
38
36
  }, []);
37
+ const validate = (evt) => {
38
+ let valid = true;
39
+ evt.preventDefault();
40
+ const name = document.querySelector("#nameInput").value;
41
+ const lastName = document.querySelector("#lastNameInput").value;
42
+ const email = document.querySelector("#emailInput").value;
43
+ const job = document.querySelector("#jobInput").value;
44
+ const phone = document.querySelector("#phoneInput").value;
45
+ const country = document.querySelector("#countrySelect").value;
46
+ name === "" ? setEmptyName(true) : setEmptyName(false);
47
+ lastName === "" ? setEmptyLastName(true) : setEmptyLastName(false);
48
+ email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
49
+ job === "" ? setEmptyJob(true) : setEmptyJob(false);
50
+ phone === "" ? setEmptyPhone(true) : setEmptyPhone(false);
51
+ !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
52
+ email
53
+ )
54
+ ? setInvalidEmail(true)
55
+ : setInvalidEmail(false);
56
+ let invalidPhone = true;
57
+ country === "value" ? setEmptyCountry(true) : setEmptyCountry(false);
58
+ Array.from(phone).forEach((digit, i) => {
59
+ phone.charCodeAt(i) < 48
60
+ ? setPhoneFormatError(true)
61
+ : (invalidPhone = false);
62
+ phone.charCodeAt(i) > 57
63
+ ? setPhoneFormatError(true)
64
+ : (invalidPhone = false);
65
+ });
66
+ if (
67
+ name === "" ||
68
+ lastName === "" ||
69
+ email === "" ||
70
+ job === "" ||
71
+ phone === "" ||
72
+ country === "value" ||
73
+ !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
74
+ email
75
+ ) ||
76
+ invalidPhone
77
+ ) {
78
+ valid = false;
79
+ } else valid = true;
39
80
 
40
- const updateInfo = (e, newValue) => {
81
+ return valid;
82
+ };
83
+ const validateForm = (evt, valid) => {
84
+ const countryCode = document.querySelector("#countryCodeSelect").value;
85
+ evt.preventDefault();
41
86
  let nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
42
- switch (e.target.id) {
43
- case "nameInput":
44
- nuevoUsuario.name = newValue;
45
- newValue === "" ? setEmptyName(true) : setEmptyName(false);
46
- break;
47
- case "lastNameInput":
48
- nuevoUsuario.lastName = newValue;
49
- newValue === "" ? setEmptyLastName(true) : setEmptyLastName(false);
50
- break;
51
- case "emailInput":
52
- nuevoUsuario.email = newValue;
53
- newValue === "" ? setEmptyEmail(true) : setEmptyEmail(false);
54
- if (
55
- !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
56
- newValue
57
- )
58
- ) {
59
- setEmailFormatError(true);
60
- } else {
61
- setEmailFormatError(false);
62
- }
63
- break;
64
- case "jobInput":
65
- nuevoUsuario.position = newValue;
66
- newValue === "" ? setEmptyJob(true) : setEmptyJob(false);
67
- break;
68
- case "phoneInput":
69
- Array.from(newValue).forEach((digit, i) => {
70
- newValue.charCodeAt(i) < 48
71
- ? setPhoneFormatError(true)
72
- : setPhoneFormatError(false);
73
- newValue.charCodeAt(i) > 57
74
- ? setPhoneFormatError(true)
75
- : setPhoneFormatError(false);
76
- });
77
- nuevoUsuario.phone = `${JSON.parse(
78
- sessionStorage.getItem("countryCodeSelect")
79
- )}${newValue}`;
80
- newValue === "" ? setEmptyPhone(true) : setEmptyPhone(false);
81
- break;
82
- case "countrySelect":
83
- nuevoUsuario.country = newValue;
84
- newValue === "" || newValue === "Selecciona tu país"
85
- ? setEmptyCountry(true)
86
- : setEmptyCountry(false);
87
- break;
88
- case "countryCodeSelect":
89
- sessionStorage.setItem("countryCode", JSON.stringify(newValue));
90
- nuevoUsuario.phone = `${JSON.parse(
91
- sessionStorage.getItem("countryCode")
92
- )}${document.querySelector("#phoneInput").value}`;
93
- break;
94
- default:
95
- return;
87
+ if (valid) {
88
+ sessionStorage.setItem("countryCode", JSON.stringify(countryCode));
89
+ nuevoUsuario.name = name;
90
+ nuevoUsuario.lastName = lastName;
91
+ nuevoUsuario.email = email;
92
+ nuevoUsuario.position = job;
93
+ nuevoUsuario.phone = `${JSON.parse(
94
+ sessionStorage.getItem("countryCode")
95
+ )}${phone}`;
96
+ nuevoUsuario.country = country;
97
+ sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
98
+ !regError && valid && props.setPaso((paso) => props.paso + 1);
99
+ regError && valid && props.setPaso(4);
96
100
  }
97
- sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
98
101
  };
99
102
 
100
- const validateForm = (evt) => {
101
- let valid = true;
102
- evt.preventDefault();
103
- setShowErrors(true);
104
- emptyName && (valid = false);
105
- emptyLastName && (valid = false);
106
- emptyEmail && (valid = false);
107
- emptyJob && (valid = false);
108
- emptyPhone && (valid = false);
109
- emptyCountry && (valid = false);
110
- phoneFormatError && (valid = false);
111
- emailFormatError && (valid = false);
112
- !regError && valid && props.setPaso((paso) => props.paso + 1);
113
- regError && valid && props.setPaso(4);
114
- };
115
103
  const loginRight = [
116
104
  <LogoImage key="1" />,
117
105
  <div className="credenciales" key={"2"}>
@@ -128,57 +116,40 @@ export const RegistrationFirstStep = (props) => {
128
116
  inputId={"nameInput"}
129
117
  label={"Nombre"}
130
118
  inputPlaceHolder={"Nombre"}
131
- defaultValue={
132
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).name
133
- }
134
119
  required={"required"}
135
- onInput={(e) => updateInfo(e, e.target.value)}
136
120
  />
137
121
  <TagAndInput
138
122
  inputType={"text"}
139
123
  inputId={"lastNameInput"}
140
124
  label={"Apellido"}
141
125
  inputPlaceHolder={"Apellido"}
142
- defaultValue={
143
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).lastName
144
- }
145
126
  required={"required"}
146
- onChange={(e) => updateInfo(e, e.target.value)}
147
127
  />
148
128
  </div>
149
- {emptyName && showErrors && <label>Ingrese su nombre</label>}
150
- {emptyLastName && showErrors && <label>Ingrese sus apellidos</label>}
129
+ {emptyName && <label>Ingrese su nombre</label>}
130
+ {emptyLastName && <label>Ingrese sus apellidos</label>}
151
131
  <TagAndInput
152
132
  inputType={"text"}
153
133
  inputId={"emailInput"}
154
134
  label={"Correo electrónico"}
155
135
  inputPlaceHolder={"username@contentoh.com"}
156
136
  required={"required"}
157
- defaultValue={JSON.parse(sessionStorage.getItem("nuevoRegistro")).email}
158
- id="emailInput"
159
- onChange={(e) => updateInfo(e, e.target.value)}
160
137
  />
161
138
  {regError &&
162
139
  JSON.parse(sessionStorage.getItem("registrationError")) ===
163
140
  "emailExists" && (
164
141
  <label>Ya existe una cuenta asociada a este correo</label>
165
142
  )}
166
- {emptyEmail && showErrors && <label>Ingrese su email</label>}
167
- {emailFormatError && showErrors && !emptyEmail && (
168
- <label>Ingrese un correo válido</label>
169
- )}
143
+ {emptyEmail && <label>Ingrese su email</label>}
144
+ {invalidEmail && !emptyEmail && <label>Ingrese un correo válido</label>}
170
145
  <TagAndInput
171
146
  inputType={"text"}
172
147
  inputId={"jobInput"}
173
148
  label={"Puesto laboral"}
174
149
  inputPlaceHolder={"Puesto dentro de la empresa"}
175
- defaultValue={
176
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).position
177
- }
178
150
  required={"required"}
179
- onChange={(e) => updateInfo(e, e.target.value)}
180
151
  />
181
- {emptyJob && showErrors && <label>Ingrese su puesto</label>}
152
+ {emptyJob && <label>Ingrese su puesto</label>}
182
153
  <ScreenHeader text={"Teléfono"} headerType={"input-name-header"} />
183
154
  <div className="phone-registration-user">
184
155
  <select name="select" className="phone-options" id="countryCodeSelect">
@@ -196,54 +167,40 @@ export const RegistrationFirstStep = (props) => {
196
167
  inputId={"phoneInput"}
197
168
  inputType={"text"}
198
169
  inputPlaceholder={"Teléfono"}
199
- defaultValue={
200
- //phone without countryCode
201
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).phone.substring(
202
- JSON.parse(sessionStorage.getItem("countryCode")).length,
203
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).phone.length -
204
- 1
205
- )
206
- }
207
170
  required={"required"}
208
- onChange={(e) => updateInfo(e, e.target.value)}
209
171
  />
210
172
  </div>
211
173
  {regError &&
212
174
  JSON.parse(sessionStorage.getItem("registrationError")) ===
213
175
  "phoneFormatError" && <label>Introduzca un número válido</label>}
214
- {emptyPhone && showErrors && <label>Ingrese su número de teléfono</label>}
215
- {phoneFormatError && showErrors && (
176
+ {emptyPhone && <label>Ingrese su número de teléfono</label>}
177
+ {phoneFormatError && (
216
178
  <label>Introduzca un número valido ( Solo numeros )</label>
217
179
  )}
218
180
  <ScreenHeader text={"País"} headerType={"input-name-header"} />
219
- <select
220
- name="select"
221
- className="country-options"
222
- id="countrySelect"
223
- defaultValue={
224
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).country
225
- }
226
- onChange={(e) => updateInfo(e, e.target.value)}
227
- >
228
- <option value="value1" selected>
181
+ <select name="select" className="country-options" id="countrySelect">
182
+ <option value="value" selected>
229
183
  Selecciona tu país
230
184
  </option>
231
- <option value="value2">Argentina</option>
232
- <option value="value3">Colombia</option>
233
- <option value="value2">Ecuador</option>
234
- <option value="value3">El Salvador</option>
235
- <option value="value2">Honduras</option>
236
- <option value="value3">México</option>
237
- <option value="value2">Panamá</option>
238
- <option value="value3">Perú</option>
185
+ <option value="Argentina">Argentina</option>
186
+ <option value="Colombia">Colombia</option>
187
+ <option value="Ecuador">Ecuador</option>
188
+ <option value="El Salvador">El Salvador</option>
189
+ <option value="Honduras">Honduras</option>
190
+ <option value="México">México</option>
191
+ <option value="Panamá">Panamá</option>
192
+ <option value="Perú">Perú</option>
239
193
  </select>
240
- {emptyEmail && showErrors && <label>Seleccione su país</label>}
194
+ {emptyCountry && <label>Seleccione su país</label>}
241
195
  </div>,
242
196
  <div className="button-end" key="4">
243
197
  <Button
244
198
  buttonType={"general-default-button"}
245
199
  label={"Enviar"}
246
- onClick={(e) => validateForm(e)}
200
+ onClick={(e) => {
201
+ let flag = validate(e);
202
+ validateForm(e, flag);
203
+ }}
247
204
  />
248
205
  </div>,
249
206
  <div className="progress-bar" key="5">
@@ -264,13 +221,11 @@ export const RegistrationFirstStep = (props) => {
264
221
  ];
265
222
  return (
266
223
  <Container>
267
- <div>
268
- <GradientPanel
269
- componentsArray={loginRight}
270
- panelType={"home-login"}
271
- panelColor={GlobalColors.white}
272
- />
273
- </div>
224
+ <GradientPanel
225
+ componentsArray={loginRight}
226
+ panelType={"home-login"}
227
+ panelColor={GlobalColors.white}
228
+ />
274
229
  </Container>
275
230
  );
276
231
  };
@@ -78,4 +78,7 @@ export const Container = styled.div`
78
78
  }
79
79
  }
80
80
  }
81
- `;
81
+ .pre-registro {
82
+ cursor: pointer;
83
+ }
84
+ `;
@@ -1,6 +1,6 @@
1
1
  import { Container } from "./styles";
2
2
  import { GradientPanel } from "../../atoms/GradientPanel";
3
- import { useState, useEffect } from "react";
3
+ import { useState } from "react";
4
4
  import { ScreenHeader } from "../../atoms/ScreenHeader";
5
5
  import { GlobalColors, FontFamily } from "../../../global-files/variables";
6
6
  import { Button } from "../../atoms/GeneralButton";
@@ -8,46 +8,27 @@ import { LoginPasswordStrength } from "../../molecules/LoginPasswordStrength";
8
8
  import { LogoImage } from "../../atoms/LogoImage";
9
9
 
10
10
  export const RegistrationSecondStep = (props) => {
11
- const [passwordStrength, setPasswordStrenght] = useState(0);
12
- const [passwordFinal, setPasswordFinal] = useState("");
13
- const [repeatedPassword, setRepeatedPassword] = useState("");
14
- const [passwordMatches, setPasswordMatches] = useState(false);
15
- const [passwordToShort, setPasswordToShort] = useState(true);
16
- const [showErrors, setShowErrors] = useState(false);
17
11
  const [privacyCheck, setPrivacyCheck] = useState(false);
18
12
  const [termsCheck, setTermsCheck] = useState(false);
19
-
20
13
  const [emptyPassword, setEmptyPassword] = useState(false);
21
14
  const [emptyConfirmPassword, setEmptyConfirmPassword] = useState(false);
22
15
  const [matchPasswords, setMatchPasswords] = useState(true);
23
-
24
16
  let nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
25
- let upperCaseLetters = /[A-Z]/g;
26
- let numbers = /[0-9]/g;
27
- let specialChar = /['!','@','#','$','%','^','&','*']/g;
28
-
29
- // on passwordFinal update
30
- useEffect(() => {
31
- passwordFinal === repeatedPassword
32
- ? setPasswordMatches(true)
33
- : setPasswordMatches(false);
34
- passwordFinal.length < 8
35
- ? setPasswordToShort(true)
36
- : setPasswordToShort(false);
37
- }, [passwordFinal, repeatedPassword]);
38
17
 
39
- // on repeatedPassword update
40
- useEffect(() => {
41
- passwordFinal === repeatedPassword
42
- ? setPasswordMatches(true)
43
- : setPasswordMatches(false);
44
- repeatedPassword === ""
45
- ? setEmptyConfirmPassword(true)
46
- : setEmptyConfirmPassword(false);
47
- }, [passwordFinal, repeatedPassword]);
48
-
49
- const updateInfo = (e, newValue) => {
18
+ const validateForm = (evt, valid) => {
19
+ evt.preventDefault();
20
+ const password = document.querySelector("#newPasswordInput").value;
21
+ if (valid) {
22
+ !termsCheck && (valid = false);
23
+ !privacyCheck && (valid = false);
24
+ nuevoUsuario.password = password;
25
+ sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
26
+ valid && props.setPaso(3);
27
+ }
28
+ };
29
+ const validate = (e) => {
50
30
  e.preventDefault();
31
+ let valid = true;
51
32
  const password = document.querySelector("#newPasswordInput").value;
52
33
  password.length < 8 ? setEmptyPassword(true) : setEmptyPassword(false);
53
34
  const confirmPassword = document.querySelector(
@@ -56,48 +37,18 @@ export const RegistrationSecondStep = (props) => {
56
37
  confirmPassword === ""
57
38
  ? setEmptyConfirmPassword(true)
58
39
  : setEmptyConfirmPassword(false);
59
- if (password === confirmPassword) {
60
- setMatchPasswords(true);
61
- } else {
62
- setMatchPasswords(false);
63
- }
64
- switch (e.target.id) {
65
- case "passwordInput":
66
- setPasswordStrenght(0);
67
- if (newValue.length > 8) {
68
- setPasswordStrenght((passwordStrenght) => passwordStrenght + 1);
69
- }
70
- //Verificar si la contraseña contiene mayuscula, numeros y un caracter especial
71
- newValue.match(upperCaseLetters) &&
72
- setPasswordStrenght((passwordStrenght) => passwordStrenght + 1);
73
- newValue.match(numbers) &&
74
- setPasswordStrenght((passwordStrenght) => passwordStrenght + 1);
75
- newValue.match(specialChar) &&
76
- setPasswordStrenght((passwordStrenght) => passwordStrenght + 1);
77
- //Actualizar value de la contraseña y guardar en sessionStorage
78
- setPasswordFinal(newValue);
79
- nuevoUsuario.password = newValue;
80
- sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
81
- break;
82
- case "confirmPasswordInput":
83
- setRepeatedPassword(newValue);
84
- break;
85
- default:
86
- return;
87
- }
40
+ password === confirmPassword
41
+ ? setMatchPasswords(true)
42
+ : setMatchPasswords(false);
43
+ if (
44
+ password.length < 8 ||
45
+ confirmPassword === "" ||
46
+ password !== confirmPassword
47
+ ) {
48
+ valid = false;
49
+ }
50
+ return valid;
88
51
  };
89
- const validateForm = (evt) => {
90
- evt.preventDefault();
91
- setShowErrors(true);
92
- let valid = true;
93
- passwordToShort && (valid = false);
94
- emptyConfirmPassword && (valid = false);
95
- !passwordMatches && (valid = false);
96
- !termsCheck && (valid = false);
97
- !privacyCheck && (valid = false);
98
- valid && props.setPaso(3);
99
- };
100
-
101
52
  const loginRight = [
102
53
  <LogoImage key="1" />,
103
54
  <div className="credenciales" key={"2"}>
@@ -113,12 +64,13 @@ export const RegistrationSecondStep = (props) => {
113
64
  emptyConfirmPassword={emptyConfirmPassword}
114
65
  matchPasswords={matchPasswords}
115
66
  textTittle={"Ingresa tus credenciales"}
116
- onChange={(e) => updateInfo(e, e.target.value)}
117
67
  required={"required"}
118
68
  />,
119
- <label className="label-terms" key={"4"}>Términos y condiciones</label>,
69
+ <label className="label-terms" key={"4"}>
70
+ Términos y condiciones
71
+ </label>,
120
72
  <div className="checkbox-terms" key={"5"}>
121
- <input type="checkbox" />
73
+ <input type="checkbox" onClick={(e) => setTermsCheck(e.target.checked)} />
122
74
  <ScreenHeader
123
75
  text={
124
76
  "Conoce nuestros termnios y condiciones de cada uno de nuestros servicios. Si tienes algunda duda o comentario escríbenos."
@@ -126,19 +78,32 @@ export const RegistrationSecondStep = (props) => {
126
78
  headerType={"date-header"}
127
79
  />
128
80
  </div>,
129
- <label className="label-terms" key={"6"}>Aviso de privacidad</label>,
81
+ <label className="label-terms" key={"6"}>
82
+ Aviso de privacidad
83
+ </label>,
130
84
  <div className="checkbox-terms" key={"7"}>
131
- <input type="checkbox" />
85
+ <input
86
+ type="checkbox"
87
+ onClick={(e) => setPrivacyCheck(e.target.checked)}
88
+ />
132
89
  <ScreenHeader
133
90
  text={"Todos los datos estan protegidos."}
134
91
  headerType={"date-header"}
135
92
  />
93
+ {!termsCheck && !!privacyCheck && (
94
+ <label>
95
+ Seleccione los terminos y condiciones y el Aviso de privacidad
96
+ </label>
97
+ )}
136
98
  </div>,
137
99
  <div className="button-end" key="8">
138
100
  <Button
139
101
  buttonType={"general-default-button"}
140
102
  label={"Enviar"}
141
- onClick={(e) => validate(e)}
103
+ onClick={(e) => {
104
+ let flag = validate(e);
105
+ validateForm(e, flag);
106
+ }}
142
107
  />
143
108
  </div>,
144
109
  <div className="progress-bar" key={"9"}>
@@ -160,11 +125,11 @@ export const RegistrationSecondStep = (props) => {
160
125
  ];
161
126
  return (
162
127
  <Container>
163
- <GradientPanel
164
- panelColor={GlobalColors.white}
165
- componentsArray={loginRight}
166
- panelType={"home-login"}
167
- ></GradientPanel>
128
+ <GradientPanel
129
+ panelColor={GlobalColors.white}
130
+ componentsArray={loginRight}
131
+ panelType={"home-login"}
132
+ ></GradientPanel>
168
133
  </Container>
169
134
  );
170
- };
135
+ };
@@ -12,8 +12,10 @@ export const RegistrationThirdStep = () => {
12
12
  const [emptyBussinesName, setEmptyBussinesName] = useState(false);
13
13
  const [emptyRFC, setEmptyRFC] = useState(false);
14
14
  const [emptyFiscalAddress, setEmptyFiscalAddress] = useState(false);
15
- const validate = async (e) => {
15
+
16
+ const validate = (e) => {
16
17
  e.preventDefault();
18
+ let valid = true;
17
19
  const commercialName = document.querySelector("#commercialNameInput").value;
18
20
  const bussinesName = document.querySelector("#bussinesNameInput").value;
19
21
  const RFC = document.querySelector("#rfcInput").value;
@@ -28,7 +30,18 @@ export const RegistrationThirdStep = () => {
28
30
  FiscalAddress === ""
29
31
  ? setEmptyFiscalAddress(true)
30
32
  : setEmptyFiscalAddress(false);
33
+ if (
34
+ commercialName === "" ||
35
+ bussinesName === "" ||
36
+ RFC === "" ||
37
+ FiscalAddress === ""
38
+ ) {
39
+ valid = false;
40
+ }
41
+ valid && sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoRegistro));
42
+ valid && props.setPaso(props.paso + 1);
31
43
  };
44
+
32
45
  const loginRight = [
33
46
  <LogoImage key="1" />,
34
47
  <div className="credenciales" key={"2"}>
@@ -65,6 +65,7 @@ export const Container = styled.div`
65
65
  font-size: 13px;
66
66
  line-height: 24px;
67
67
  color: ${GlobalColors.s5};
68
+ cursor: pointer;
68
69
  span {
69
70
  color: ${GlobalColors.secondary_magenta};
70
71
  }
@@ -9,8 +9,6 @@ export const TagAndInput = ({
9
9
  inputPlaceHolder,
10
10
  inputId,
11
11
  required,
12
- onChange,
13
- defaultValue,
14
12
  }) => {
15
13
  return (
16
14
  <Container
@@ -25,8 +23,6 @@ export const TagAndInput = ({
25
23
  inputValue={value}
26
24
  inputPlaceholder={inputPlaceHolder}
27
25
  required={required}
28
- onChange={onChange}
29
- defaultValue={defaultValue}
30
26
  />
31
27
  </Container>
32
28
  );