contentoh-components-library 21.0.37 → 21.0.40

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 (25) hide show
  1. package/dist/components/atoms/GeneralInput/index.js +8 -2
  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/EmailResetPasswordLogin/index.js +1 -3
  6. package/dist/components/molecules/LoginPasswordStrength/index.js +9 -3
  7. package/dist/components/molecules/RegistrationFirstStep/index.js +68 -99
  8. package/dist/components/molecules/RegistrationFirstStep/styles.js +1 -1
  9. package/dist/components/molecules/RegistrationSecondStep/index.js +130 -47
  10. package/dist/components/molecules/SignInLogin/styles.js +1 -1
  11. package/dist/components/molecules/TagAndInput/index.js +8 -2
  12. package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +114 -9
  13. package/package.json +1 -1
  14. package/src/components/atoms/GeneralInput/index.js +6 -0
  15. package/src/components/atoms/GradientPanel/styles.js +1 -0
  16. package/src/components/atoms/Loading/index.js +2 -0
  17. package/src/components/atoms/Loading/styles.js +14 -5
  18. package/src/components/molecules/EmailResetPasswordLogin/index.js +2 -2
  19. package/src/components/molecules/LoginPasswordStrength/index.js +11 -1
  20. package/src/components/molecules/RegistrationFirstStep/index.js +85 -103
  21. package/src/components/molecules/RegistrationFirstStep/styles.js +4 -1
  22. package/src/components/molecules/RegistrationSecondStep/index.js +76 -3
  23. package/src/components/molecules/SignInLogin/styles.js +1 -0
  24. package/src/components/molecules/TagAndInput/index.js +6 -0
  25. package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +100 -10
@@ -7,6 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.VerificationCodeResetPasswordLogin = void 0;
9
9
 
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
13
+
10
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
11
15
 
12
16
  var _styles = require("./styles");
@@ -29,18 +33,92 @@ var _utils = require("./utils");
29
33
 
30
34
  var _jsxRuntime = require("react/jsx-runtime");
31
35
 
32
- var VerificationCodeResetPasswordLogin = function VerificationCodeResetPasswordLogin() {
36
+ var VerificationCodeResetPasswordLogin = function VerificationCodeResetPasswordLogin(props) {
33
37
  var _useState = (0, _react.useState)(false),
34
38
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
35
- emptyVerificationCode = _useState2[0],
36
- setEmptyVerificationCode = _useState2[1];
39
+ resend = _useState2[0],
40
+ setResend = _useState2[1];
37
41
 
38
- var _useState3 = (0, _react.useState)(),
42
+ var _useState3 = (0, _react.useState)(""),
39
43
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
40
- inputCodeVerificationAll = _useState4[0],
41
- setInputCodeVerificationAll = _useState4[1];
44
+ awsError = _useState4[0],
45
+ setAwsError = _useState4[1];
46
+
47
+ var _useState5 = (0, _react.useState)(false),
48
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
49
+ emptyVerificationCode = _useState6[0],
50
+ setEmptyVerificationCode = _useState6[1];
51
+
52
+ var _useState7 = (0, _react.useState)(),
53
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
54
+ inputCodeVerificationAll = _useState8[0],
55
+ setInputCodeVerificationAll = _useState8[1];
42
56
 
43
57
  var inputPositions = [1, 2, 3, 4, 5, 6];
58
+ (0, _react.useEffect)(function () {
59
+ props.confirmationError !== "" && setEmptyVerificationCode(false);
60
+ }, [props.confirmationError]);
61
+
62
+ var checkCode = function checkCode(e) {
63
+ var valid = true;
64
+ e.preventDefault();
65
+ var code = "";
66
+
67
+ if (awsError === "" && !emptyVerificationCode) {
68
+ inputPositions.map(function (position) {
69
+ return code = code + document.querySelector("#verificationCodeInput".concat(position)).value;
70
+ });
71
+
72
+ if (sessionStorage.getItem("resetError")) {
73
+ JSON.parse(sessionStorage.getItem("confirmationCode")) === code && (valid = false);
74
+ }
75
+
76
+ sessionStorage.setItem("confirmationCode", JSON.stringify(code));
77
+ setEmptyVerificationCode(false);
78
+ valid && !sessionStorage.getItem("resetPasswordProcess") && props.setPaso(6);
79
+ valid && sessionStorage.getItem("resetPasswordProcess") && props.setPaso(8);
80
+ }
81
+ };
82
+
83
+ var validateResend = /*#__PURE__*/function () {
84
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
85
+ return _regenerator.default.wrap(function _callee$(_context) {
86
+ while (1) {
87
+ switch (_context.prev = _context.next) {
88
+ case 0:
89
+ e.preventDefault(); //const email = JSON.parse(sessionStorage.getItem("email"));
90
+
91
+ _context.prev = 1;
92
+ _context.next = 4;
93
+ return props.Auth.forgotPassword(email);
94
+
95
+ case 4:
96
+ sessionStorage.setItem("email", JSON.stringify(email));
97
+ sessionStorage.setItem("resetPasswordProcess", JSON.stringify("true"));
98
+ props.setPaso(5);
99
+ setResend(true);
100
+ _context.next = 14;
101
+ break;
102
+
103
+ case 10:
104
+ _context.prev = 10;
105
+ _context.t0 = _context["catch"](1);
106
+ setAwsError(_context.t0.code);
107
+ console.log(_context.t0.message);
108
+
109
+ case 14:
110
+ case "end":
111
+ return _context.stop();
112
+ }
113
+ }
114
+ }, _callee, null, [[1, 10]]);
115
+ }));
116
+
117
+ return function validateResend(_x) {
118
+ return _ref.apply(this, arguments);
119
+ };
120
+ }();
121
+
44
122
  (0, _react.useEffect)(function () {
45
123
  setInputCodeVerificationAll(document.querySelectorAll("[id^='verificationCodeInput']"));
46
124
  }, []);
@@ -53,8 +131,11 @@ var VerificationCodeResetPasswordLogin = function VerificationCodeResetPasswordL
53
131
  })
54
132
  }, "2"), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
55
133
  className: "user",
56
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
57
- text: "Ingresa el código de verificación enviado a:",
134
+ children: [sessionStorage.getItem("email") && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
135
+ text: "Ingrese el c\xF3digo de verificaci\xF3n enviado a: ".concat(JSON.parse(sessionStorage.getItem("email"))),
136
+ headerType: "input-name-header"
137
+ }), !sessionStorage.getItem("email") && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
138
+ text: "Ingrese c\xF3digo de verificaci\xF3n enviado a: ".concat(JSON.parse(sessionStorage.getItem("nuevoRegistro")).email),
58
139
  headerType: "input-name-header"
59
140
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
60
141
  className: "verification-code",
@@ -71,10 +152,30 @@ var VerificationCodeResetPasswordLogin = function VerificationCodeResetPasswordL
71
152
  })
72
153
  }), emptyVerificationCode && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
73
154
  children: "Ingrese su c\xF3digo de verificaci\xF3n"
155
+ }), sessionStorage.getItem("resetError") && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
156
+ children: "C\xF3digo de verifiaci\xF3n incorrecto"
157
+ }), props.confirmationError === "LimitExceededException" && !emptyVerificationCode && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
158
+ children: "Haz realizado demasiados intentos, intentalo m\xE1s tarde"
159
+ }), props.confirmationError === "CodeMismatchException" && !emptyVerificationCode && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
160
+ children: "C\xF3digo de verificaci\xF3n incorrecto"
161
+ }), props.confirmationError === "ExpiredCodeException" && !emptyVerificationCode && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
162
+ children: "El c\xF3digo ingresado est\xE1 expirado"
163
+ }), props.confirmationError === "InternalErrorException" && !emptyVerificationCode && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
164
+ children: "Algo sali\xF3 mal, porfavor vuelva a intentarlo"
165
+ }), awsError === "LimitExceededException" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
166
+ children: "Haz realizado demasiados intentos, intentalo m\xE1s tarde"
167
+ }), awsError === "InternalErrorException" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
168
+ children: "Algo sali\xF3 mal, porfavor vuelva a intentarlo"
169
+ }), resend && awsError === "" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
170
+ className: "resendTrue",
171
+ children: "Se reenvi\xF3 el c\xF3digo de verificaci\xF3n correctamente"
74
172
  })]
75
173
  }, "3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
76
174
  className: "resend-code",
77
175
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
176
+ onClick: function onClick(e) {
177
+ return validateResend(e);
178
+ },
78
179
  children: "Reenviar c\xF3digo de verificaci\xF3n"
79
180
  })
80
181
  }, "4"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -83,12 +184,16 @@ var VerificationCodeResetPasswordLogin = function VerificationCodeResetPasswordL
83
184
  buttonType: "general-default-button",
84
185
  label: "Enviar",
85
186
  onClick: function onClick(e) {
86
- return (0, _utils.validate)(inputCodeVerificationAll, setEmptyVerificationCode);
187
+ (0, _utils.validate)(inputCodeVerificationAll, setEmptyVerificationCode);
188
+ checkCode(e);
87
189
  }
88
190
  })
89
191
  }, "5"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
90
192
  className: "reset-password",
91
193
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
194
+ onClick: function onClick() {
195
+ return props.setPaso(10);
196
+ },
92
197
  children: "Regresar..."
93
198
  })
94
199
  }, "6")];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.37",
3
+ "version": "21.0.40",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -14,6 +14,9 @@ export const GeneralInput = ({
14
14
  inputsArray,
15
15
  maxLength,
16
16
  inputSize,
17
+ onChange,
18
+ required,
19
+ defaultValue,
17
20
  }) => {
18
21
  const [textValue, setTextValue] = useState({ value: inputValue ?? "" });
19
22
 
@@ -42,6 +45,9 @@ export const GeneralInput = ({
42
45
  value={textValue.value}
43
46
  onInput={(e) => onHandleChange(e)}
44
47
  maxLength={maxLength && maxLength}
48
+ onChange={onChange}
49
+ required={required}
50
+ defaultValue={defaultValue}
45
51
  />
46
52
  ) : (
47
53
  <textarea
@@ -37,6 +37,7 @@ export const Container = styled.div`
37
37
  }
38
38
 
39
39
  &.home-login {
40
+ width: 100%;
40
41
  .credenciales {
41
42
  & + * {
42
43
  margin-top: 30px;
@@ -1,8 +1,10 @@
1
1
  import { Container } from "./styles";
2
+ import { LogoImage } from "../LogoImage";
2
3
 
3
4
  export const Loading = () => {
4
5
  return (
5
6
  <Container >
7
+ <LogoImage/>
6
8
  <div className="loader">
7
9
  <span className="first"></span>
8
10
  <span className="second"></span>
@@ -1,17 +1,26 @@
1
1
  import styled from "styled-components";
2
2
 
3
3
  export const Container = styled.div`
4
- display: flex;
5
4
  justify-content: center;
6
5
  align-items: center;
7
- height: 100%;
8
- width: 100%;
6
+ height: 100vh;
7
+ width: 50%;
8
+ position: relative;
9
+ img {
10
+ width: 80%;
11
+ position: absolute;
12
+ bottom: 55%;
13
+ left: 10%;
14
+ }
9
15
  .loader {
10
16
  display: flex;
11
17
  justify-content: center;
12
18
  align-items: center;
13
- height: 100%;
14
- width: 100%;
19
+ height: 10%;
20
+ width: 50%;
21
+ position: absolute;
22
+ bottom: 45%;
23
+ left:25%;
15
24
  span {
16
25
  display: inline-block;
17
26
  border-radius: 100%;
@@ -6,13 +6,13 @@ import { ScreenHeader } from "../../atoms/ScreenHeader";
6
6
  import { GlobalColors, FontFamily } from "../../../global-files/variables";
7
7
  import { TagAndInput } from "../../molecules/TagAndInput";
8
8
  import { Button } from "../../atoms/GeneralButton";
9
- import { Auth } from "aws-amplify";
10
9
 
11
10
  export const EmailResetPasswordLogin = (props) => {
12
11
  const [emptyEmail, setEmptyEmail] = useState(false);
13
12
  const [invalidEmail, setInvalidEmail] = useState(false);
14
13
  const [showErrors, setShowErrors] = useState(false);
15
14
  const [awsError, setAwsError] = useState("");
15
+
16
16
  const validate = async (e) => {
17
17
  let valid = true;
18
18
  setShowErrors(true);
@@ -29,7 +29,7 @@ export const EmailResetPasswordLogin = (props) => {
29
29
 
30
30
  if (valid) {
31
31
  try {
32
- await Auth.forgotPassword(email);
32
+ await props.Auth.forgotPassword(email);
33
33
  sessionStorage.setItem("email", JSON.stringify(email));
34
34
  sessionStorage.setItem("resetPasswordProcess", JSON.stringify("true"));
35
35
  props.setPaso(5);
@@ -1,15 +1,19 @@
1
1
  import { Container, ItemPasswordStrength, Password } from "./styles";
2
2
  import { useEffect, useState } from "react";
3
3
  import { TagAndInput } from "../TagAndInput";
4
+
4
5
  export const LoginPasswordStrength = ({
5
6
  emptyPassword,
6
7
  emptyConfirmPassword,
7
8
  matchPasswords,
9
+ onChange,
10
+ required,
8
11
  }) => {
9
12
  const [passwordStrength, setPasswordStrength] = useState(0);
10
13
  let upperCaseLetters = /[A-Z]/g;
11
14
  let numbers = /[0-9]/g;
12
15
  let specialChar = /[‘!’,‘@’,‘#’,‘$’,‘%’,‘^’,‘&’,‘*’]/g;
16
+
13
17
  useEffect(() => {
14
18
  const inputValue = document.getElementById("newPasswordInput");
15
19
  inputValue.addEventListener(
@@ -20,6 +24,7 @@ export const LoginPasswordStrength = ({
20
24
  false
21
25
  );
22
26
  }, []);
27
+
23
28
  const updateInfo = (e, newValue) => {
24
29
  switch (e.target.id) {
25
30
  case "newPasswordInput":
@@ -41,6 +46,7 @@ export const LoginPasswordStrength = ({
41
46
  return;
42
47
  }
43
48
  };
49
+
44
50
  return (
45
51
  <Container>
46
52
  <div className="user" key={"3"}>
@@ -48,6 +54,8 @@ export const LoginPasswordStrength = ({
48
54
  inputType={"password"}
49
55
  inputId={"newPasswordInput"}
50
56
  label={"Ingrese su nueva contraseña"}
57
+ required={required}
58
+ onChange={onChange}
51
59
  />
52
60
  {emptyPassword && (
53
61
  <label>La contraseña debe ser minimo de 8 caracteres</label>
@@ -76,6 +84,8 @@ export const LoginPasswordStrength = ({
76
84
  inputType={"password"}
77
85
  inputId={"confirmPasswordInput"}
78
86
  label={"Confirme la nueva contraseña"}
87
+ required={required}
88
+ onChange={onChange}
79
89
  />
80
90
  {emptyConfirmPassword && !emptyPassword && (
81
91
  <label>Confirme la contraseña</label>
@@ -86,4 +96,4 @@ export const LoginPasswordStrength = ({
86
96
  </div>
87
97
  </Container>
88
98
  );
89
- };
99
+ };
@@ -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,97 +31,71 @@ 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
  }, []);
39
37
 
40
- let paisesEsp = [
41
- "Argentina",
42
- "Colombia",
43
- "Costa Rica",
44
- "Ecuador",
45
- "El Salvador",
46
- "Honduras",
47
- "México",
48
- "Panamá",
49
- "Perú",
50
- ];
51
- const updateInfo = (e, newValue) => {
52
- let nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
53
- switch (e.target.id) {
54
- case "nameInput":
55
- nuevoUsuario.name = newValue;
56
- newValue === "" ? setEmptyName(true) : setEmptyName(false);
57
- break;
58
- case "lastNameInput":
59
- nuevoUsuario.lastName = newValue;
60
- newValue === "" ? setEmptyLastName(true) : setEmptyLastName(false);
61
- break;
62
- case "emailInput":
63
- nuevoUsuario.email = newValue;
64
- newValue === "" ? setEmptyEmail(true) : setEmptyEmail(false);
65
- if (
66
- !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
67
- newValue
68
- )
69
- ) {
70
- setEmailFormatError(true);
71
- } else {
72
- setEmailFormatError(false);
73
- }
74
- break;
75
- case "jobInput":
76
- nuevoUsuario.position = newValue;
77
- newValue === "" ? setEmptyJob(true) : setEmptyJob(false);
78
- break;
79
- case "phoneInput":
80
- Array.from(newValue).forEach((digit, i) => {
81
- newValue.charCodeAt(i) < 48
82
- ? setPhoneFormatError(true)
83
- : setPhoneFormatError(false);
84
- newValue.charCodeAt(i) > 57
85
- ? setPhoneFormatError(true)
86
- : setPhoneFormatError(false);
87
- });
88
- nuevoUsuario.phone = `${JSON.parse(
89
- sessionStorage.getItem("countryCodeSelect")
90
- )}${newValue}`;
91
- newValue === "" ? setEmptyPhone(true) : setEmptyPhone(false);
92
- break;
93
- case "countrySelect":
94
- nuevoUsuario.country = newValue;
95
- newValue === "" || newValue === "Selecciona tu país"
96
- ? setEmptyCountry(true)
97
- : setEmptyCountry(false);
98
- break;
99
- case "countryCodeSelect":
100
- sessionStorage.setItem("countryCode", JSON.stringify(newValue));
101
- nuevoUsuario.phone = `${JSON.parse(
102
- sessionStorage.getItem("countryCode")
103
- )}${document.querySelector("#phoneInput").value}`;
104
- break;
105
- default:
106
- return;
107
- }
108
- sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
109
- };
110
-
111
38
  const validateForm = (evt) => {
112
39
  let valid = true;
113
40
  evt.preventDefault();
114
- setShowErrors(true);
115
- emptyName && (valid = false);
116
- emptyLastName && (valid = false);
117
- emptyEmail && (valid = false);
118
- emptyJob && (valid = false);
119
- emptyPhone && (valid = false);
120
- emptyCountry && (valid = false);
121
- phoneFormatError && (valid = false);
122
- emailFormatError && (valid = false);
123
- !regError && valid && props.setPaso((paso) => props.paso + 1);
124
- regError && valid && props.setPaso(4);
41
+ const name = document.querySelector("#nameInput").value;
42
+ const lastName = document.querySelector("#lastNameInput").value;
43
+ const email = document.querySelector("#emailInput").value;
44
+ const job = document.querySelector("#jobInput").value;
45
+ const phone = document.querySelector("#phoneInput").value;
46
+ const country = document.querySelector("#countrySelect").value;
47
+ const countryCode = document.querySelector("#countryCodeSelect").value;
48
+ name === "" ? setEmptyName(true) : setEmptyName(false);
49
+ lastName === "" ? setEmptyLastName(true) : setEmptyLastName(false);
50
+ email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
51
+ job === "" ? setEmptyJob(true) : setEmptyJob(false);
52
+ phone === "" ? setEmptyPhone(true) : setEmptyPhone(false);
53
+ !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
54
+ email
55
+ )
56
+ ? setInvalidEmail(true)
57
+ : setInvalidEmail(false);
58
+ country === "" || country === "+ tu país"
59
+ ? setEmptyCountry(true)
60
+ : setEmptyCountry(false);
61
+ Array.from(phone).forEach((digit, i) => {
62
+ phone.charCodeAt(i) < 48
63
+ ? setPhoneFormatError(true)
64
+ : setPhoneFormatError(false);
65
+ phone.charCodeAt(i) > 57
66
+ ? setPhoneFormatError(true)
67
+ : setPhoneFormatError(false);
68
+ });
69
+ let nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
70
+ if (
71
+ !emptyName ||
72
+ !emptyLastName ||
73
+ !emptyEmail ||
74
+ !emptyJob ||
75
+ !emptyPhone ||
76
+ !emptyCountry ||
77
+ !invalidEmail ||
78
+ !phoneFormatError
79
+ ) {
80
+ sessionStorage.setItem("countryCode", JSON.stringify(countryCode));
81
+ nuevoUsuario.name = name;
82
+ nuevoUsuario.lastName = lastName;
83
+ nuevoUsuario.email = email;
84
+ nuevoUsuario.position = job;
85
+ nuevoUsuario.phone = `${JSON.parse(
86
+ sessionStorage.getItem("countryCode")
87
+ )}${phone}`;
88
+ nuevoUsuario.country = country;
89
+ sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
90
+ !regError && valid && props.setPaso((paso) => props.paso + 1);
91
+ regError && valid && props.setPaso(4);
92
+ console.log("rediring");
93
+ } else {
94
+ valid = false;
95
+ console.log("code");
96
+ }
125
97
  };
98
+
126
99
  const loginRight = [
127
100
  <LogoImage key="1" />,
128
101
  <div className="credenciales" key={"2"}>
@@ -139,17 +112,14 @@ export const RegistrationFirstStep = (props) => {
139
112
  inputId={"nameInput"}
140
113
  label={"Nombre"}
141
114
  inputPlaceHolder={"Nombre"}
142
- defaultValue={
143
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).name
144
- }
145
- required
146
- onInput={(e) => updateInfo(e, e.target.value)}
115
+ required={"required"}
147
116
  />
148
117
  <TagAndInput
149
118
  inputType={"text"}
150
119
  inputId={"lastNameInput"}
151
120
  label={"Apellido"}
152
121
  inputPlaceHolder={"Apellido"}
122
+ required={"required"}
153
123
  />
154
124
  </div>
155
125
  {emptyName && <label>Ingrese su nombre</label>}
@@ -159,14 +129,21 @@ export const RegistrationFirstStep = (props) => {
159
129
  inputId={"emailInput"}
160
130
  label={"Correo electrónico"}
161
131
  inputPlaceHolder={"username@contentoh.com"}
132
+ required={"required"}
162
133
  />
163
- {emptyEmail && <label>Ingrese su correo</label>}
134
+ {regError &&
135
+ JSON.parse(sessionStorage.getItem("registrationError")) ===
136
+ "emailExists" && (
137
+ <label>Ya existe una cuenta asociada a este correo</label>
138
+ )}
139
+ {emptyEmail && <label>Ingrese su email</label>}
164
140
  {invalidEmail && !emptyEmail && <label>Ingrese un correo válido</label>}
165
141
  <TagAndInput
166
142
  inputType={"text"}
167
143
  inputId={"jobInput"}
168
144
  label={"Puesto laboral"}
169
145
  inputPlaceHolder={"Puesto dentro de la empresa"}
146
+ required={"required"}
170
147
  />
171
148
  {emptyJob && <label>Ingrese su puesto</label>}
172
149
  <ScreenHeader text={"Teléfono"} headerType={"input-name-header"} />
@@ -186,9 +163,16 @@ export const RegistrationFirstStep = (props) => {
186
163
  inputId={"phoneInput"}
187
164
  inputType={"text"}
188
165
  inputPlaceholder={"Teléfono"}
166
+ required={"required"}
189
167
  />
190
168
  </div>
169
+ {regError &&
170
+ JSON.parse(sessionStorage.getItem("registrationError")) ===
171
+ "phoneFormatError" && <label>Introduzca un número válido</label>}
191
172
  {emptyPhone && <label>Ingrese su número de teléfono</label>}
173
+ {phoneFormatError && (
174
+ <label>Introduzca un número valido ( Solo numeros )</label>
175
+ )}
192
176
  <ScreenHeader text={"País"} headerType={"input-name-header"} />
193
177
  <select name="select" className="country-options" id="countrySelect">
194
178
  <option value="value1" selected>
@@ -209,7 +193,7 @@ export const RegistrationFirstStep = (props) => {
209
193
  <Button
210
194
  buttonType={"general-default-button"}
211
195
  label={"Enviar"}
212
- onClick={(e) => validate(e)}
196
+ onClick={(e) => validateForm(e)}
213
197
  />
214
198
  </div>,
215
199
  <div className="progress-bar" key="5">
@@ -223,20 +207,18 @@ export const RegistrationFirstStep = (props) => {
223
207
  key="6"
224
208
  />,
225
209
  <div className="new-login" key="7">
226
- <p className="pre-registro">
210
+ <p className="pre-registro" onClick={() => props.setPaso(7)}>
227
211
  ¿Ya tienes una cuenta?<span> Inicia Sesión</span>
228
212
  </p>
229
213
  </div>,
230
214
  ];
231
215
  return (
232
216
  <Container>
233
- <div>
234
- <GradientPanel
235
- componentsArray={loginRight}
236
- panelType={"home-login"}
237
- panelColor={GlobalColors.white}
238
- />
239
- </div>
217
+ <GradientPanel
218
+ componentsArray={loginRight}
219
+ panelType={"home-login"}
220
+ panelColor={GlobalColors.white}
221
+ />
240
222
  </Container>
241
223
  );
242
- };
224
+ };
@@ -75,7 +75,10 @@ export const Container = styled.div`
75
75
  .new-login {
76
76
  & + * {
77
77
  margin-top: 20px;
78
+ p {
79
+ cursor: pointer;
80
+ }
78
81
  }
79
82
  }
80
83
  }
81
- `;
84
+ `;