contentoh-components-library 21.0.39 → 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.
@@ -15,7 +15,7 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n display: flex;\n height: 100%;\n justify-content: center;\n align-items: center;\n label {\n color: red;\n margin-top: 3px;\n margin-left: 15px;\n font-family: ", ";\n font-size: 11px;\n }\n &.home-panel {\n text-align: center;\n h2 {\n & + * {\n margin-top: 20px;\n }\n }\n p {\n font-family: ", ";\n color: ", ";\n font-size: 18px;\n line-height: 21px;\n letter-spacing: -0.015em;\n & + * {\n margin-top: 20px;\n }\n }\n }\n\n &.home-login {\n .credenciales {\n & + * {\n margin-top: 30px;\n }\n }\n .user {\n & + * {\n margin-top: 20px;\n }\n }\n .password {\n & + * {\n margin-top: 20px;\n }\n }\n .select {\n display: flex;\n justify-content: space-between;\n .active-right {\n font-family: ", ";\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n letter-spacing: -0.015em;\n color: ", ";\n }\n & + * {\n margin-top: 50px;\n }\n }\n .button-right {\n text-align: right;\n & + * {\n margin-top: 55px;\n }\n }\n .new-login {\n p {\n font-family: ", ";\n text-align: right;\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n color: ", ";\n span {\n color: ", ";\n }\n }\n }\n }\n &.home-card {\n position: relative;\n .plan {\n text-align: center;\n & + * {\n margin-top: 40px;\n }\n }\n .arrowimage {\n position: absolute;\n top: 50px;\n left: 40px;\n }\n .general-text {\n font-family: ", ";\n font-size: 14px;\n line-height: 19px;\n text-align: center;\n letter-spacing: -0.015em;\n & + * {\n margin-top: 50px;\n }\n }\n .payment-register {\n & + * {\n margin-top: 50px;\n }\n }\n .button-continuar {\n text-align: center;\n & + * {\n margin-top: 35px;\n }\n }\n .continue {\n text-align: center;\n font-family: ", ";\n font-size: 14px;\n line-height: 19px;\n letter-spacing: -0.015em;\n text-decoration-line: underline;\n color: ", ";\n }\n }\n .main-container{\n max-width: 80%;\n max-height: 80%;\n }\n"])), function (_ref) {
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n display: flex;\n height: 100%;\n justify-content: center;\n align-items: center;\n label {\n color: red;\n margin-top: 3px;\n margin-left: 15px;\n font-family: ", ";\n font-size: 11px;\n }\n &.home-panel {\n text-align: center;\n h2 {\n & + * {\n margin-top: 20px;\n }\n }\n p {\n font-family: ", ";\n color: ", ";\n font-size: 18px;\n line-height: 21px;\n letter-spacing: -0.015em;\n & + * {\n margin-top: 20px;\n }\n }\n }\n\n &.home-login {\n width: 100%;\n .credenciales {\n & + * {\n margin-top: 30px;\n }\n }\n .user {\n & + * {\n margin-top: 20px;\n }\n }\n .password {\n & + * {\n margin-top: 20px;\n }\n }\n .select {\n display: flex;\n justify-content: space-between;\n .active-right {\n font-family: ", ";\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n letter-spacing: -0.015em;\n color: ", ";\n }\n & + * {\n margin-top: 50px;\n }\n }\n .button-right {\n text-align: right;\n & + * {\n margin-top: 55px;\n }\n }\n .new-login {\n p {\n font-family: ", ";\n text-align: right;\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n color: ", ";\n span {\n color: ", ";\n }\n }\n }\n }\n &.home-card {\n position: relative;\n .plan {\n text-align: center;\n & + * {\n margin-top: 40px;\n }\n }\n .arrowimage {\n position: absolute;\n top: 50px;\n left: 40px;\n }\n .general-text {\n font-family: ", ";\n font-size: 14px;\n line-height: 19px;\n text-align: center;\n letter-spacing: -0.015em;\n & + * {\n margin-top: 50px;\n }\n }\n .payment-register {\n & + * {\n margin-top: 50px;\n }\n }\n .button-continuar {\n text-align: center;\n & + * {\n margin-top: 35px;\n }\n }\n .continue {\n text-align: center;\n font-family: ", ";\n font-size: 14px;\n line-height: 19px;\n letter-spacing: -0.015em;\n text-decoration-line: underline;\n color: ", ";\n }\n }\n .main-container{\n max-width: 80%;\n max-height: 80%;\n }\n"])), function (_ref) {
19
19
  var panelColor = _ref.panelColor;
20
20
  return panelColor ? panelColor : "linear-gradient(180deg, #E33AA9 0%, #3B1366 100%)";
21
21
  }, _variables.FontFamily.Raleway_700, _variables.FontFamily.AvenirNext, function (_ref2) {
@@ -7,11 +7,13 @@ exports.Loading = void 0;
7
7
 
8
8
  var _styles = require("./styles");
9
9
 
10
+ var _LogoImage = require("../LogoImage");
11
+
10
12
  var _jsxRuntime = require("react/jsx-runtime");
11
13
 
12
14
  var Loading = function Loading() {
13
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
14
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
15
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
16
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LogoImage.LogoImage, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
15
17
  className: "loader",
16
18
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
17
19
  className: "first"
@@ -20,7 +22,7 @@ var Loading = function Loading() {
20
22
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
21
23
  className: "third"
22
24
  })]
23
- })
25
+ })]
24
26
  });
25
27
  };
26
28
 
@@ -13,6 +13,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
14
  var _templateObject;
15
15
 
16
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 50%;\n .loader {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 50%;\n span {\n display: inline-block;\n border-radius: 100%;\n margin-left: 5px;\n opacity: 1;\n }\n .first {\n background-color: #ff75cf;\n }\n .second {\n background-color: #e33aa9;\n }\n .third {\n background-color: #b12d84;\n }\n span:nth-child(1) {\n width: 16px;\n height: 16px;\n animation: opacitychange 1s ease-in-out infinite;\n }\n span:nth-child(2) {\n width: 18px;\n height: 18px;\n\n animation: opacitychange 1s ease-in-out 0.33s infinite;\n }\n span:nth-child(3) {\n width: 20px;\n height: 20px;\n\n animation: opacitychange 1s ease-in-out 0.66s infinite;\n }\n @keyframes opacitychange {\n 0%,\n 100% {\n opacity: 0;\n }\n 60% {\n opacity: 1;\n }\n }\n }\n"])));
16
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n justify-content: center;\n align-items: center;\n height: 100vh;\n width: 50%;\n position: relative;\n img {\n width: 80%;\n position: absolute;\n bottom: 55%;\n left: 10%;\n }\n .loader {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 10%;\n width: 50%;\n position: absolute;\n bottom: 45%;\n left:25%;\n span {\n display: inline-block;\n border-radius: 100%;\n margin-left: 5px;\n opacity: 1;\n }\n .first {\n background-color: #ff75cf;\n }\n .second {\n background-color: #e33aa9;\n }\n .third {\n background-color: #b12d84;\n }\n span:nth-child(1) {\n width: 16px;\n height: 16px;\n animation: opacitychange 1s ease-in-out infinite;\n }\n span:nth-child(2) {\n width: 18px;\n height: 18px;\n\n animation: opacitychange 1s ease-in-out 0.33s infinite;\n }\n span:nth-child(3) {\n width: 20px;\n height: 20px;\n\n animation: opacitychange 1s ease-in-out 0.66s infinite;\n }\n @keyframes opacitychange {\n 0%,\n 100% {\n opacity: 0;\n }\n 60% {\n opacity: 1;\n }\n }\n }\n"])));
17
17
 
18
18
  exports.Container = Container;
@@ -55,30 +55,25 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
55
55
  emptyPhone = _useState10[0],
56
56
  setEmptyPhone = _useState10[1];
57
57
 
58
- var _useState11 = (0, _react.useState)(true),
58
+ var _useState11 = (0, _react.useState)(false),
59
59
  _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
60
60
  emptyCountry = _useState12[0],
61
61
  setEmptyCountry = _useState12[1];
62
62
 
63
63
  var _useState13 = (0, _react.useState)(false),
64
64
  _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
65
- showErrors = _useState14[0],
66
- setShowErrors = _useState14[1];
65
+ invalidEmail = _useState14[0],
66
+ setInvalidEmail = _useState14[1];
67
67
 
68
68
  var _useState15 = (0, _react.useState)(false),
69
69
  _useState16 = (0, _slicedToArray2.default)(_useState15, 2),
70
- regError = _useState16[0],
71
- setRegError = _useState16[1];
70
+ phoneFormatError = _useState16[0],
71
+ setPhoneFormatError = _useState16[1];
72
72
 
73
73
  var _useState17 = (0, _react.useState)(false),
74
74
  _useState18 = (0, _slicedToArray2.default)(_useState17, 2),
75
- phoneFormatError = _useState18[0],
76
- setPhoneFormatError = _useState18[1];
77
-
78
- var _useState19 = (0, _react.useState)(false),
79
- _useState20 = (0, _slicedToArray2.default)(_useState19, 2),
80
- emailFormatError = _useState20[0],
81
- setEmailFormatError = _useState20[1];
75
+ regError = _useState18[0],
76
+ setRegError = _useState18[1];
82
77
 
83
78
  (0, _react.useEffect)(function () {
84
79
  JSON.parse(sessionStorage.getItem("nuevoRegistro")).name === "" && sessionStorage.removeItem("registrationError");
@@ -96,79 +91,47 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
96
91
  sessionStorage.getItem("resetPasswordProcess") && sessionStorage.getItem("resetPasswordProcess");
97
92
  }, []);
98
93
 
99
- var updateInfo = function updateInfo(e, newValue) {
100
- var nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
101
-
102
- switch (e.target.id) {
103
- case "nameInput":
104
- nuevoUsuario.name = newValue;
105
- newValue === "" ? setEmptyName(true) : setEmptyName(false);
106
- break;
107
-
108
- case "lastNameInput":
109
- nuevoUsuario.lastName = newValue;
110
- newValue === "" ? setEmptyLastName(true) : setEmptyLastName(false);
111
- break;
112
-
113
- case "emailInput":
114
- nuevoUsuario.email = newValue;
115
- newValue === "" ? setEmptyEmail(true) : setEmptyEmail(false);
116
-
117
- if (!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(newValue)) {
118
- setEmailFormatError(true);
119
- } else {
120
- setEmailFormatError(false);
121
- }
122
-
123
- break;
124
-
125
- case "jobInput":
126
- nuevoUsuario.position = newValue;
127
- newValue === "" ? setEmptyJob(true) : setEmptyJob(false);
128
- break;
129
-
130
- case "phoneInput":
131
- Array.from(newValue).forEach(function (digit, i) {
132
- newValue.charCodeAt(i) < 48 ? setPhoneFormatError(true) : setPhoneFormatError(false);
133
- newValue.charCodeAt(i) > 57 ? setPhoneFormatError(true) : setPhoneFormatError(false);
134
- });
135
- nuevoUsuario.phone = "".concat(JSON.parse(sessionStorage.getItem("countryCodeSelect"))).concat(newValue);
136
- newValue === "" ? setEmptyPhone(true) : setEmptyPhone(false);
137
- break;
138
-
139
- case "countrySelect":
140
- nuevoUsuario.country = newValue;
141
- newValue === "" || newValue === "Selecciona tu país" ? setEmptyCountry(true) : setEmptyCountry(false);
142
- break;
143
-
144
- case "countryCodeSelect":
145
- sessionStorage.setItem("countryCode", JSON.stringify(newValue));
146
- nuevoUsuario.phone = "".concat(JSON.parse(sessionStorage.getItem("countryCode"))).concat(document.querySelector("#phoneInput").value);
147
- break;
148
-
149
- default:
150
- return;
151
- }
152
-
153
- sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
154
- };
155
-
156
94
  var validateForm = function validateForm(evt) {
157
95
  var valid = true;
158
96
  evt.preventDefault();
159
- setShowErrors(true);
160
- emptyName && (valid = false);
161
- emptyLastName && (valid = false);
162
- emptyEmail && (valid = false);
163
- emptyJob && (valid = false);
164
- emptyPhone && (valid = false);
165
- emptyCountry && (valid = false);
166
- phoneFormatError && (valid = false);
167
- emailFormatError && (valid = false);
168
- !regError && valid && props.setPaso(function (paso) {
169
- return props.paso + 1;
97
+ var name = document.querySelector("#nameInput").value;
98
+ var lastName = document.querySelector("#lastNameInput").value;
99
+ var email = document.querySelector("#emailInput").value;
100
+ var job = document.querySelector("#jobInput").value;
101
+ var phone = document.querySelector("#phoneInput").value;
102
+ var country = document.querySelector("#countrySelect").value;
103
+ var countryCode = document.querySelector("#countryCodeSelect").value;
104
+ name === "" ? setEmptyName(true) : setEmptyName(false);
105
+ lastName === "" ? setEmptyLastName(true) : setEmptyLastName(false);
106
+ email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
107
+ job === "" ? setEmptyJob(true) : setEmptyJob(false);
108
+ phone === "" ? setEmptyPhone(true) : setEmptyPhone(false);
109
+ !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email) ? setInvalidEmail(true) : setInvalidEmail(false);
110
+ country === "" || country === "+ tu país" ? setEmptyCountry(true) : setEmptyCountry(false);
111
+ Array.from(phone).forEach(function (digit, i) {
112
+ phone.charCodeAt(i) < 48 ? setPhoneFormatError(true) : setPhoneFormatError(false);
113
+ phone.charCodeAt(i) > 57 ? setPhoneFormatError(true) : setPhoneFormatError(false);
170
114
  });
171
- regError && valid && props.setPaso(4);
115
+ var nuevoUsuario = JSON.parse(sessionStorage.getItem("nuevoRegistro"));
116
+
117
+ if (!emptyName || !emptyLastName || !emptyEmail || !emptyJob || !emptyPhone || !emptyCountry || !invalidEmail || !phoneFormatError) {
118
+ sessionStorage.setItem("countryCode", JSON.stringify(countryCode));
119
+ nuevoUsuario.name = name;
120
+ nuevoUsuario.lastName = lastName;
121
+ nuevoUsuario.email = email;
122
+ nuevoUsuario.position = job;
123
+ nuevoUsuario.phone = "".concat(JSON.parse(sessionStorage.getItem("countryCode"))).concat(phone);
124
+ nuevoUsuario.country = country;
125
+ sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
126
+ !regError && valid && props.setPaso(function (paso) {
127
+ return props.paso + 1;
128
+ });
129
+ regError && valid && props.setPaso(4);
130
+ console.log("rediring");
131
+ } else {
132
+ valid = false;
133
+ console.log("code");
134
+ }
172
135
  };
173
136
 
174
137
  var loginRight = [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LogoImage.LogoImage, {}, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -187,54 +150,37 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
187
150
  inputId: "nameInput",
188
151
  label: "Nombre",
189
152
  inputPlaceHolder: "Nombre",
190
- defaultValue: JSON.parse(sessionStorage.getItem("nuevoRegistro")).name,
191
- required: "required",
192
- onInput: function onInput(e) {
193
- return updateInfo(e, e.target.value);
194
- }
153
+ required: "required"
195
154
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
196
155
  inputType: "text",
197
156
  inputId: "lastNameInput",
198
157
  label: "Apellido",
199
158
  inputPlaceHolder: "Apellido",
200
- defaultValue: JSON.parse(sessionStorage.getItem("nuevoRegistro")).lastName,
201
- required: "required",
202
- onChange: function onChange(e) {
203
- return updateInfo(e, e.target.value);
204
- }
159
+ required: "required"
205
160
  })]
206
- }), emptyName && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
161
+ }), emptyName && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
207
162
  children: "Ingrese su nombre"
208
- }), emptyLastName && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
163
+ }), emptyLastName && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
209
164
  children: "Ingrese sus apellidos"
210
165
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
211
166
  inputType: "text",
212
167
  inputId: "emailInput",
213
168
  label: "Correo electrónico",
214
169
  inputPlaceHolder: "username@contentoh.com",
215
- required: "required",
216
- defaultValue: JSON.parse(sessionStorage.getItem("nuevoRegistro")).email,
217
- id: "emailInput",
218
- onChange: function onChange(e) {
219
- return updateInfo(e, e.target.value);
220
- }
170
+ required: "required"
221
171
  }), regError && JSON.parse(sessionStorage.getItem("registrationError")) === "emailExists" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
222
172
  children: "Ya existe una cuenta asociada a este correo"
223
- }), emptyEmail && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
173
+ }), emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
224
174
  children: "Ingrese su email"
225
- }), emailFormatError && showErrors && !emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
175
+ }), invalidEmail && !emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
226
176
  children: "Ingrese un correo v\xE1lido"
227
177
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
228
178
  inputType: "text",
229
179
  inputId: "jobInput",
230
180
  label: "Puesto laboral",
231
181
  inputPlaceHolder: "Puesto dentro de la empresa",
232
- defaultValue: JSON.parse(sessionStorage.getItem("nuevoRegistro")).position,
233
- required: "required",
234
- onChange: function onChange(e) {
235
- return updateInfo(e, e.target.value);
236
- }
237
- }), emptyJob && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
182
+ required: "required"
183
+ }), emptyJob && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
238
184
  children: "Ingrese su puesto"
239
185
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
240
186
  text: "Teléfono",
@@ -268,18 +214,13 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
268
214
  inputId: "phoneInput",
269
215
  inputType: "text",
270
216
  inputPlaceholder: "Teléfono",
271
- defaultValue: //phone without countryCode
272
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).phone.substring(JSON.parse(sessionStorage.getItem("countryCode")).length, JSON.parse(sessionStorage.getItem("nuevoRegistro")).phone.length - 1),
273
- required: "required",
274
- onChange: function onChange(e) {
275
- return updateInfo(e, e.target.value);
276
- }
217
+ required: "required"
277
218
  })]
278
219
  }), regError && JSON.parse(sessionStorage.getItem("registrationError")) === "phoneFormatError" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
279
220
  children: "Introduzca un n\xFAmero v\xE1lido"
280
- }), emptyPhone && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
221
+ }), emptyPhone && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
281
222
  children: "Ingrese su n\xFAmero de tel\xE9fono"
282
- }), phoneFormatError && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
223
+ }), phoneFormatError && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
283
224
  children: "Introduzca un n\xFAmero valido ( Solo numeros )"
284
225
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
285
226
  text: "País",
@@ -288,10 +229,6 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
288
229
  name: "select",
289
230
  className: "country-options",
290
231
  id: "countrySelect",
291
- defaultValue: JSON.parse(sessionStorage.getItem("nuevoRegistro")).country,
292
- onChange: function onChange(e) {
293
- return updateInfo(e, e.target.value);
294
- },
295
232
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
296
233
  value: "value1",
297
234
  selected: true,
@@ -321,7 +258,7 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
321
258
  value: "value3",
322
259
  children: "Per\xFA"
323
260
  })]
324
- }), emptyEmail && showErrors && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
261
+ }), emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
325
262
  children: "Seleccione su pa\xEDs"
326
263
  })]
327
264
  }, "3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -357,12 +294,10 @@ var RegistrationFirstStep = function RegistrationFirstStep(props) {
357
294
  })
358
295
  }, "7")];
359
296
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
360
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
361
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GradientPanel.GradientPanel, {
362
- componentsArray: loginRight,
363
- panelType: "home-login",
364
- panelColor: _variables.GlobalColors.white
365
- })
297
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GradientPanel.GradientPanel, {
298
+ componentsArray: loginRight,
299
+ panelType: "home-login",
300
+ panelColor: _variables.GlobalColors.white
366
301
  })
367
302
  });
368
303
  };
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n width: 50%;\n height: 100vh;\n .user {\n .name-registration-user {\n display: flex;\n justify-content: space-between;\n input {\n width: 160px;\n }\n }\n .input-name-header {\n margin-bottom: 4px;\n margin-top: 12px;\n }\n .phone-registration-user {\n display: flex;\n justify-content: space-between;\n .phone-options {\n width: 80px;\n }\n input {\n width: 100%;\n }\n & + * {\n margin-top: 10px;\n }\n }\n .country-options,\n .phone-options {\n width: 100%;\n border: 1px solid ", ";\n font-family: ", ";\n color: ", ";\n font-weight: normal;\n font-size: 12px;\n line-height: 15px;\n padding: 10px;\n outline: none;\n border-radius: 2px;\n resize: none;\n &:focus {\n border: 1px solid ", ";\n }\n }\n }\n .button-end {\n text-align: end;\n .general-default-button {\n width: 160px;\n }\n & + * {\n margin-top: 10px;\n }\n }\n .progress-bar {\n width: 100%;\n height: 8px;\n display: flex;\n justify-content: space-between;\n .progress-bar-first-step {\n width: 33.33%;\n background-color: rgb(196, 196, 196);\n }\n .progress-bar-registration {\n background-color: rgb(226, 226, 226);\n width: 66.66%;\n }\n }\n .date-header {\n .new-login {\n & + * {\n margin-top: 20px;\n }\n }\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s4, _variables.GlobalColors.magenta_s2);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n width: 50%;\n height: 100vh;\n .user {\n .name-registration-user {\n display: flex;\n justify-content: space-between;\n input {\n width: 160px;\n }\n }\n .input-name-header {\n margin-bottom: 4px;\n margin-top: 12px;\n }\n .phone-registration-user {\n display: flex;\n justify-content: space-between;\n .phone-options {\n width: 80px;\n }\n input {\n width: 100%;\n }\n & + * {\n margin-top: 10px;\n }\n }\n .country-options,\n .phone-options {\n width: 100%;\n border: 1px solid ", ";\n font-family: ", ";\n color: ", ";\n font-weight: normal;\n font-size: 12px;\n line-height: 15px;\n padding: 10px;\n outline: none;\n border-radius: 2px;\n resize: none;\n &:focus {\n border: 1px solid ", ";\n }\n }\n }\n .button-end {\n text-align: end;\n .general-default-button {\n width: 160px;\n }\n & + * {\n margin-top: 10px;\n }\n }\n .progress-bar {\n width: 100%;\n height: 8px;\n display: flex;\n justify-content: space-between;\n .progress-bar-first-step {\n width: 33.33%;\n background-color: rgb(196, 196, 196);\n }\n .progress-bar-registration {\n background-color: rgb(226, 226, 226);\n width: 66.66%;\n }\n }\n .date-header {\n .new-login {\n & + * {\n margin-top: 20px;\n p {\n cursor: pointer;\n }\n }\n }\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s4, _variables.GlobalColors.magenta_s2);
19
19
 
20
20
  exports.Container = Container;
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: \"white\";\n display: flex;\n height: 100%;\n width: 50%;\n justify-content: center;\n align-items: center;\n label {\n color: red;\n margin-top: 3px;\n margin-left: 15px;\n font-family: ", ";\n font-size: 11px;\n & + * {\n margin-top: 12px;\n }\n }\n\n &.home-login {\n .credenciales {\n & + * {\n margin-top: 30px;\n }\n }\n .user {\n & + * {\n margin-top: 20px;\n }\n }\n .password {\n & + * {\n margin-top: 20px;\n }\n }\n .select {\n display: flex;\n justify-content: space-between;\n .active-right {\n font-family: ", ";\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n letter-spacing: -0.015em;\n color: ", ";\n cursor: pointer;\n }\n & + * {\n margin-top: 50px;\n }\n }\n .button-right {\n text-align: right;\n & + * {\n margin-top: 55px;\n }\n }\n .new-login {\n p {\n font-family: ", ";\n text-align: right;\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n color: ", ";\n span {\n color: ", ";\n }\n }\n }\n }\n .main-container {\n max-width: 80%;\n max-height: 80%;\n }\n"])), _variables.FontFamily.Raleway_700, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.secondary_magenta);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: \"white\";\n display: flex;\n height: 100%;\n width: 50%;\n justify-content: center;\n align-items: center;\n label {\n color: red;\n margin-top: 3px;\n margin-left: 15px;\n font-family: ", ";\n font-size: 11px;\n & + * {\n margin-top: 12px;\n }\n }\n\n &.home-login {\n .credenciales {\n & + * {\n margin-top: 30px;\n }\n }\n .user {\n & + * {\n margin-top: 20px;\n }\n }\n .password {\n & + * {\n margin-top: 20px;\n }\n }\n .select {\n display: flex;\n justify-content: space-between;\n .active-right {\n font-family: ", ";\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n letter-spacing: -0.015em;\n color: ", ";\n cursor: pointer;\n }\n & + * {\n margin-top: 50px;\n }\n }\n .button-right {\n text-align: right;\n & + * {\n margin-top: 55px;\n }\n }\n .new-login {\n p {\n font-family: ", ";\n text-align: right;\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n color: ", ";\n cursor: pointer;\n span {\n color: ", ";\n }\n }\n }\n }\n .main-container {\n max-width: 80%;\n max-height: 80%;\n }\n"])), _variables.FontFamily.Raleway_700, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.secondary_magenta);
19
19
 
20
20
  exports.Container = Container;
@@ -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.39",
3
+ "version": "21.0.40",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -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%;
6
+ height: 100vh;
8
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%;
19
+ height: 10%;
14
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%;
@@ -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,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
- const updateInfo = (e, newValue) => {
41
- 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;
96
- }
97
- sessionStorage.setItem("nuevoRegistro", JSON.stringify(nuevoUsuario));
98
- };
99
-
100
38
  const validateForm = (evt) => {
101
39
  let valid = true;
102
40
  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);
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
+ }
114
97
  };
98
+
115
99
  const loginRight = [
116
100
  <LogoImage key="1" />,
117
101
  <div className="credenciales" key={"2"}>
@@ -128,57 +112,40 @@ export const RegistrationFirstStep = (props) => {
128
112
  inputId={"nameInput"}
129
113
  label={"Nombre"}
130
114
  inputPlaceHolder={"Nombre"}
131
- defaultValue={
132
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).name
133
- }
134
115
  required={"required"}
135
- onInput={(e) => updateInfo(e, e.target.value)}
136
116
  />
137
117
  <TagAndInput
138
118
  inputType={"text"}
139
119
  inputId={"lastNameInput"}
140
120
  label={"Apellido"}
141
121
  inputPlaceHolder={"Apellido"}
142
- defaultValue={
143
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).lastName
144
- }
145
122
  required={"required"}
146
- onChange={(e) => updateInfo(e, e.target.value)}
147
123
  />
148
124
  </div>
149
- {emptyName && showErrors && <label>Ingrese su nombre</label>}
150
- {emptyLastName && showErrors && <label>Ingrese sus apellidos</label>}
125
+ {emptyName && <label>Ingrese su nombre</label>}
126
+ {emptyLastName && <label>Ingrese sus apellidos</label>}
151
127
  <TagAndInput
152
128
  inputType={"text"}
153
129
  inputId={"emailInput"}
154
130
  label={"Correo electrónico"}
155
131
  inputPlaceHolder={"username@contentoh.com"}
156
132
  required={"required"}
157
- defaultValue={JSON.parse(sessionStorage.getItem("nuevoRegistro")).email}
158
- id="emailInput"
159
- onChange={(e) => updateInfo(e, e.target.value)}
160
133
  />
161
134
  {regError &&
162
135
  JSON.parse(sessionStorage.getItem("registrationError")) ===
163
136
  "emailExists" && (
164
137
  <label>Ya existe una cuenta asociada a este correo</label>
165
138
  )}
166
- {emptyEmail && showErrors && <label>Ingrese su email</label>}
167
- {emailFormatError && showErrors && !emptyEmail && (
168
- <label>Ingrese un correo válido</label>
169
- )}
139
+ {emptyEmail && <label>Ingrese su email</label>}
140
+ {invalidEmail && !emptyEmail && <label>Ingrese un correo válido</label>}
170
141
  <TagAndInput
171
142
  inputType={"text"}
172
143
  inputId={"jobInput"}
173
144
  label={"Puesto laboral"}
174
145
  inputPlaceHolder={"Puesto dentro de la empresa"}
175
- defaultValue={
176
- JSON.parse(sessionStorage.getItem("nuevoRegistro")).position
177
- }
178
146
  required={"required"}
179
- onChange={(e) => updateInfo(e, e.target.value)}
180
147
  />
181
- {emptyJob && showErrors && <label>Ingrese su puesto</label>}
148
+ {emptyJob && <label>Ingrese su puesto</label>}
182
149
  <ScreenHeader text={"Teléfono"} headerType={"input-name-header"} />
183
150
  <div className="phone-registration-user">
184
151
  <select name="select" className="phone-options" id="countryCodeSelect">
@@ -196,35 +163,18 @@ export const RegistrationFirstStep = (props) => {
196
163
  inputId={"phoneInput"}
197
164
  inputType={"text"}
198
165
  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
166
  required={"required"}
208
- onChange={(e) => updateInfo(e, e.target.value)}
209
167
  />
210
168
  </div>
211
169
  {regError &&
212
170
  JSON.parse(sessionStorage.getItem("registrationError")) ===
213
171
  "phoneFormatError" && <label>Introduzca un número válido</label>}
214
- {emptyPhone && showErrors && <label>Ingrese su número de teléfono</label>}
215
- {phoneFormatError && showErrors && (
172
+ {emptyPhone && <label>Ingrese su número de teléfono</label>}
173
+ {phoneFormatError && (
216
174
  <label>Introduzca un número valido ( Solo numeros )</label>
217
175
  )}
218
176
  <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
- >
177
+ <select name="select" className="country-options" id="countrySelect">
228
178
  <option value="value1" selected>
229
179
  Selecciona tu país
230
180
  </option>
@@ -237,7 +187,7 @@ export const RegistrationFirstStep = (props) => {
237
187
  <option value="value2">Panamá</option>
238
188
  <option value="value3">Perú</option>
239
189
  </select>
240
- {emptyEmail && showErrors && <label>Seleccione su país</label>}
190
+ {emptyEmail && <label>Seleccione su país</label>}
241
191
  </div>,
242
192
  <div className="button-end" key="4">
243
193
  <Button
@@ -264,13 +214,11 @@ export const RegistrationFirstStep = (props) => {
264
214
  ];
265
215
  return (
266
216
  <Container>
267
- <div>
268
- <GradientPanel
269
- componentsArray={loginRight}
270
- panelType={"home-login"}
271
- panelColor={GlobalColors.white}
272
- />
273
- </div>
217
+ <GradientPanel
218
+ componentsArray={loginRight}
219
+ panelType={"home-login"}
220
+ panelColor={GlobalColors.white}
221
+ />
274
222
  </Container>
275
223
  );
276
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
+ `;
@@ -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
  }
@@ -8,11 +8,58 @@ import { GeneralInput } from "../../atoms/GeneralInput";
8
8
  import { Button } from "../../atoms/GeneralButton";
9
9
  import { validateInput, validate } from "./utils";
10
10
 
11
- export const VerificationCodeResetPasswordLogin = () => {
11
+ export const VerificationCodeResetPasswordLogin = (props) => {
12
+ const [resend, setResend] = useState(false);
13
+ const [awsError, setAwsError] = useState("");
12
14
  const [emptyVerificationCode, setEmptyVerificationCode] = useState(false);
13
15
  const [inputCodeVerificationAll, setInputCodeVerificationAll] = useState();
14
16
  const inputPositions = [1, 2, 3, 4, 5, 6];
15
17
 
18
+ useEffect(() => {
19
+ props.confirmationError !== "" && setEmptyVerificationCode(false);
20
+ }, [props.confirmationError]);
21
+
22
+ const checkCode = (e) => {
23
+ let valid = true;
24
+ e.preventDefault();
25
+ let code = "";
26
+ if (awsError === "" && !emptyVerificationCode) {
27
+ inputPositions.map(
28
+ (position) =>
29
+ (code =
30
+ code +
31
+ document.querySelector(`#verificationCodeInput${position}`).value)
32
+ );
33
+ if (sessionStorage.getItem("resetError")) {
34
+ JSON.parse(sessionStorage.getItem("confirmationCode")) === code &&
35
+ (valid = false);
36
+ }
37
+ sessionStorage.setItem("confirmationCode", JSON.stringify(code));
38
+ setEmptyVerificationCode(false);
39
+ valid &&
40
+ !sessionStorage.getItem("resetPasswordProcess") &&
41
+ props.setPaso(6);
42
+ valid &&
43
+ sessionStorage.getItem("resetPasswordProcess") &&
44
+ props.setPaso(8);
45
+ }
46
+ };
47
+
48
+ const validateResend = async (e) => {
49
+ e.preventDefault();
50
+ //const email = JSON.parse(sessionStorage.getItem("email"));
51
+ try {
52
+ await props.Auth.forgotPassword(email);
53
+ sessionStorage.setItem("email", JSON.stringify(email));
54
+ sessionStorage.setItem("resetPasswordProcess", JSON.stringify("true"));
55
+ props.setPaso(5);
56
+ setResend(true);
57
+ } catch (err) {
58
+ setAwsError(err.code);
59
+ console.log(err.message);
60
+ }
61
+ };
62
+
16
63
  useEffect(() => {
17
64
  setInputCodeVerificationAll(
18
65
  document.querySelectorAll("[id^='verificationCodeInput']")
@@ -29,10 +76,22 @@ export const VerificationCodeResetPasswordLogin = () => {
29
76
  />
30
77
  </div>,
31
78
  <div className="user" key="3">
32
- <ScreenHeader
33
- text={"Ingresa el código de verificación enviado a:"}
34
- headerType={"input-name-header"}
35
- />
79
+ {sessionStorage.getItem("email") && (
80
+ <ScreenHeader
81
+ text={`Ingrese el código de verificación enviado a: ${JSON.parse(
82
+ sessionStorage.getItem("email")
83
+ )}`}
84
+ headerType={"input-name-header"}
85
+ />
86
+ )}
87
+ {!sessionStorage.getItem("email") && (
88
+ <ScreenHeader
89
+ text={`Ingrese código de verificación enviado a: ${
90
+ JSON.parse(sessionStorage.getItem("nuevoRegistro")).email
91
+ }`}
92
+ headerType={"input-name-header"}
93
+ />
94
+ )}
36
95
  <div className="verification-code">
37
96
  {inputPositions.map((position) => (
38
97
  <GeneralInput
@@ -49,21 +108,52 @@ export const VerificationCodeResetPasswordLogin = () => {
49
108
  {emptyVerificationCode && (
50
109
  <label>Ingrese su código de verificación</label>
51
110
  )}
111
+ {sessionStorage.getItem("resetError") && (
112
+ <label>Código de verifiación incorrecto</label>
113
+ )}
114
+ {props.confirmationError === "LimitExceededException" &&
115
+ !emptyVerificationCode && (
116
+ <label>Haz realizado demasiados intentos, intentalo más tarde</label>
117
+ )}
118
+ {props.confirmationError === "CodeMismatchException" &&
119
+ !emptyVerificationCode && (
120
+ <label>Código de verificación incorrecto</label>
121
+ )}
122
+ {props.confirmationError === "ExpiredCodeException" &&
123
+ !emptyVerificationCode && (
124
+ <label>El código ingresado está expirado</label>
125
+ )}
126
+ {props.confirmationError === "InternalErrorException" &&
127
+ !emptyVerificationCode && (
128
+ <label>Algo salió mal, porfavor vuelva a intentarlo</label>
129
+ )}
130
+ {awsError === "LimitExceededException" && (
131
+ <label>Haz realizado demasiados intentos, intentalo más tarde</label>
132
+ )}
133
+ {awsError === "InternalErrorException" && (
134
+ <label>Algo salió mal, porfavor vuelva a intentarlo</label>
135
+ )}
136
+ {resend && awsError === "" && (
137
+ <label className="resendTrue">
138
+ Se reenvió el código de verificación correctamente
139
+ </label>
140
+ )}
52
141
  </div>,
53
142
  <div className="resend-code" key="4">
54
- <p>Reenviar código de verificación</p>
143
+ <p onClick={(e) => validateResend(e)}>Reenviar código de verificación</p>
55
144
  </div>,
56
145
  <div className="button-center" key="5">
57
146
  <Button
58
147
  buttonType={"general-default-button"}
59
148
  label={"Enviar"}
60
- onClick={(e) =>
61
- validate(inputCodeVerificationAll, setEmptyVerificationCode)
62
- }
149
+ onClick={(e) => {
150
+ validate(inputCodeVerificationAll, setEmptyVerificationCode);
151
+ checkCode(e);
152
+ }}
63
153
  />
64
154
  </div>,
65
155
  <div className="reset-password" key="6">
66
- <p>Regresar...</p>
156
+ <p onClick={() => props.setPaso(10)}>Regresar...</p>
67
157
  </div>,
68
158
  ];
69
159
  return (