contentoh-components-library 21.0.26 → 21.0.29

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 (51) hide show
  1. package/dist/components/atoms/Loading/Loading.stories.js +28 -0
  2. package/dist/components/atoms/Loading/index.js +27 -0
  3. package/dist/components/atoms/Loading/styles.js +18 -0
  4. package/dist/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +28 -0
  5. package/dist/components/molecules/EmailResetPasswordLogin/index.js +155 -0
  6. package/dist/components/molecules/EmailResetPasswordLogin/styles.js +20 -0
  7. package/dist/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +28 -0
  8. package/dist/components/molecules/RegistrationFirstStep/index.js +336 -0
  9. package/dist/components/molecules/RegistrationFirstStep/styles.js +20 -0
  10. package/dist/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +28 -0
  11. package/dist/components/molecules/RegistrationSecondStep/index.js +156 -0
  12. package/dist/components/molecules/RegistrationSecondStep/styles.js +20 -0
  13. package/dist/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +28 -0
  14. package/dist/components/molecules/RegistrationThirdStep/index.js +161 -0
  15. package/dist/components/molecules/RegistrationThirdStep/styles.js +20 -0
  16. package/dist/components/molecules/SignInLogin/index.js +217 -67
  17. package/dist/components/molecules/SignInLogin/styles.js +1 -1
  18. package/dist/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +28 -0
  19. package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +104 -0
  20. package/dist/components/molecules/VerificationCodeResetPasswordLogin/styles.js +20 -0
  21. package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +69 -0
  22. package/dist/components/organisms/ChangePassword/ChangePassword.stories.js +28 -0
  23. package/dist/components/organisms/ChangePassword/index.js +113 -0
  24. package/dist/components/organisms/ChangePassword/styles.js +18 -0
  25. package/dist/index.js +138 -47
  26. package/package.json +5 -2
  27. package/src/components/atoms/Loading/Loading.stories.js +10 -0
  28. package/src/components/atoms/Loading/index.js +13 -0
  29. package/src/components/atoms/Loading/styles.js +57 -0
  30. package/src/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +11 -0
  31. package/src/components/molecules/EmailResetPasswordLogin/index.js +86 -0
  32. package/src/components/molecules/EmailResetPasswordLogin/styles.js +23 -0
  33. package/src/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +11 -0
  34. package/src/components/molecules/RegistrationFirstStep/index.js +242 -0
  35. package/src/components/molecules/RegistrationFirstStep/styles.js +81 -0
  36. package/src/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +11 -0
  37. package/src/components/molecules/RegistrationSecondStep/index.js +97 -0
  38. package/src/components/molecules/RegistrationSecondStep/styles.js +59 -0
  39. package/src/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +11 -0
  40. package/src/components/molecules/RegistrationThirdStep/index.js +109 -0
  41. package/src/components/molecules/RegistrationThirdStep/styles.js +44 -0
  42. package/src/components/molecules/SignInLogin/index.js +181 -55
  43. package/src/components/molecules/SignInLogin/styles.js +1 -0
  44. package/src/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +11 -0
  45. package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +78 -0
  46. package/src/components/molecules/VerificationCodeResetPasswordLogin/styles.js +49 -0
  47. package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +56 -0
  48. package/src/components/organisms/ChangePassword/ChangePassword.stories.js +11 -0
  49. package/src/components/organisms/ChangePassword/index.js +63 -0
  50. package/src/components/organisms/ChangePassword/styles.js +16 -0
  51. package/src/index.js +7 -0
@@ -29,9 +29,17 @@ var _variables = require("../../../global-files/variables");
29
29
 
30
30
  var _react = require("react");
31
31
 
32
+ var _Loading = require("../../atoms/Loading");
33
+
34
+ var _reactRouterDom = require("react-router-dom");
35
+
36
+ var _awsAmplify = require("aws-amplify");
37
+
38
+ var _axios = _interopRequireDefault(require("axios"));
39
+
32
40
  var _jsxRuntime = require("react/jsx-runtime");
33
41
 
34
- var SignInLogin = function SignInLogin() {
42
+ var SignInLogin = function SignInLogin(props) {
35
43
  var _useState = (0, _react.useState)(false),
36
44
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
37
45
  emptyEmail = _useState2[0],
@@ -47,26 +55,136 @@ var SignInLogin = function SignInLogin() {
47
55
  emptyPassword = _useState6[0],
48
56
  setEmptyPassword = _useState6[1];
49
57
 
58
+ var _useState7 = (0, _react.useState)(true),
59
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
60
+ showErrors = _useState8[0],
61
+ setShowErrors = _useState8[1];
62
+
63
+ var _useState9 = (0, _react.useState)(""),
64
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
65
+ signInError = _useState10[0],
66
+ setSignInError = _useState10[1];
67
+
68
+ var _useState11 = (0, _react.useState)(false),
69
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
70
+ loading = _useState12[0],
71
+ setLoading = _useState12[1];
72
+
73
+ var _useState13 = (0, _react.useState)(false),
74
+ _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
75
+ upgradePlanRedirect = _useState14[0],
76
+ setUpgradePlanRedirect = _useState14[1];
77
+
50
78
  var validate = /*#__PURE__*/function () {
51
79
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
52
- var email, password;
80
+ var valid, email, password, session, userGroup, response, userGroupValue, user, company;
53
81
  return _regenerator.default.wrap(function _callee$(_context) {
54
82
  while (1) {
55
83
  switch (_context.prev = _context.next) {
56
84
  case 0:
85
+ setSignInError("");
86
+ setShowErrors(true);
57
87
  e.preventDefault();
88
+ valid = true;
58
89
  email = document.querySelector("#emailInput").value;
59
90
  password = document.querySelector("#passwordInput").value;
60
- email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
61
- password === "" ? setEmptyPassword(true) : setEmptyPassword(false);
62
91
  !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email) ? setInvalidEmail(true) : setInvalidEmail(false);
63
92
 
64
- case 6:
93
+ if (email === "") {
94
+ valid = false;
95
+ setEmptyEmail(true);
96
+ } else {
97
+ setEmptyEmail(false);
98
+ }
99
+
100
+ if (password === "") {
101
+ valid = false;
102
+ setEmptyPassword(true);
103
+ } else {
104
+ setEmptyPassword(false);
105
+ }
106
+
107
+ if (!valid) {
108
+ _context.next = 33;
109
+ break;
110
+ }
111
+
112
+ _context.prev = 10;
113
+ setLoading(true);
114
+ _context.next = 14;
115
+ return props.Auth.signIn(email, password);
116
+
117
+ case 14:
118
+ session = _context.sent;
119
+
120
+ if (!(session.challengeName === "NEW_PASSWORD_REQUIRED")) {
121
+ _context.next = 20;
122
+ break;
123
+ }
124
+
125
+ props.setUser(session);
126
+ props.setPaso(8);
127
+ _context.next = 26;
128
+ break;
129
+
130
+ case 20:
131
+ userGroup = session.signInUserSession.accessToken.payload["cognito:groups"];
132
+ _context.next = 23;
133
+ return _axios.default.get(process.env.REACT_APP_USER_ENDPOINT, {
134
+ headers: {
135
+ Authorization: session.signInUserSession.idToken.jwtToken
136
+ }
137
+ });
138
+
139
+ case 23:
140
+ response = _context.sent;
141
+ userGroupValue = typeof userGroup === "string" ? userGroup : userGroup[0];
142
+
143
+ if (userGroupValue === "usuario_contentoh") {
144
+ sessionStorage.setItem("auth", true);
145
+ sessionStorage.setItem("jwt", session.signInUserSession.idToken.jwtToken);
146
+ user = JSON.parse(response.data.body).data[0];
147
+ company = JSON.parse(response.data.body).data[1];
148
+ caches.keys().then(function (names) {
149
+ names.forEach(function (name) {
150
+ caches.delete(name);
151
+ });
152
+ });
153
+ user.src = "https://".concat(process.env.REACT_APP_IMAGES_PROFILE_BUCKET, ".s3.amazonaws.com/id-").concat(user.id_user, "/").concat(user.id_user, ".png?").concat(new Date().getTime());
154
+ sessionStorage.setItem("user", JSON.stringify(user));
155
+ sessionStorage.setItem("company", JSON.stringify(company));
156
+ setUpgradePlanRedirect(true);
157
+ } else {
158
+ setSignInError("NotAuthorizedException");
159
+ setLoading(false);
160
+ }
161
+
162
+ case 26:
163
+ _context.next = 33;
164
+ break;
165
+
166
+ case 28:
167
+ _context.prev = 28;
168
+ _context.t0 = _context["catch"](10);
169
+ console.log(_context.t0);
170
+ setLoading(false);
171
+
172
+ if (_context.t0.code === "NotAuthorizedException") {
173
+ setSignInError("NotAuthorizedException");
174
+ } else if (_context.t0.code === "UserNotConfirmedException") {
175
+ sessionStorage.setItem("email", JSON.stringify(document.querySelector("#usernameInput").value.trim()));
176
+ sessionStorage.setItem("email", JSON.stringify(email));
177
+ props.setPaso(5);
178
+ } else {
179
+ setSignInError("Error");
180
+ }
181
+
182
+ case 33:
65
183
  case "end":
66
184
  return _context.stop();
67
185
  }
68
186
  }
69
- }, _callee);
187
+ }, _callee, null, [[10, 28]]);
70
188
  }));
71
189
 
72
190
  return function validate(_x) {
@@ -74,68 +192,100 @@ var SignInLogin = function SignInLogin() {
74
192
  };
75
193
  }();
76
194
 
77
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
78
- className: "home-login",
79
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
80
- className: "main-container",
81
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.LogoImage, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
82
- className: "credenciales",
83
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.ScreenHeader, {
84
- fontFamily: _variables.FontFamily.AvenirNext,
85
- color: _variables.GlobalColors.s5,
86
- text: "Ingresa tus credenciales"
87
- })
88
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
89
- className: "user",
90
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
91
- inputType: "text",
92
- label: "Nombre de usuario",
93
- inputPlaceHolder: "username@contentoh.com",
94
- inputId: "emailInput"
95
- })
96
- }), emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
97
- children: "Ingrese su correo"
98
- }), invalidEmail && !emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
99
- children: "Ingrese un correo v\xE1lido"
100
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
101
- className: "password",
102
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
103
- inputType: "text",
104
- label: "Contraseña",
105
- inputPlaceHolder: "Escribe tu contraseña",
106
- inputId: "passwordInput"
107
- })
108
- }), emptyPassword && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
109
- children: "Ingrese su contrase\xF1a"
110
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
111
- className: "select",
112
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index4.CheckBox, {
113
- label: "Mantener sesión activada",
114
- id: "chk-default",
115
- className: "active-left"
116
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
117
- className: "active-right",
118
- children: "Olvide mi contrase\xF1a"
119
- })]
120
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
121
- className: "button-right",
122
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Button, {
123
- buttonType: "general-default-button",
124
- label: "Iniciar sesión",
125
- onClick: function onClick(e) {
126
- return validate(e);
127
- }
128
- })
129
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
130
- className: "new-login",
131
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
132
- className: "pre-registro",
133
- children: ["\xBFA\xFAn no tienes cuenta?", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
134
- children: " Reg\xEDstrate"
195
+ (0, _react.useEffect)(function () {
196
+ sessionStorage.getItem("resetPasswordProcess") && sessionStorage.removeItem("resetPasswordProcess");
197
+ }, []);
198
+ return loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
199
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
200
+ className: "home-login",
201
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
202
+ className: "main-container",
203
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.LogoImage, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
204
+ className: "credenciales",
205
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.ScreenHeader, {
206
+ fontFamily: _variables.FontFamily.AvenirNext,
207
+ color: _variables.GlobalColors.s5,
208
+ text: "Ingresa tus credenciales"
209
+ })
210
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
211
+ className: "user",
212
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
213
+ inputType: "text",
214
+ label: "Nombre de usuario",
215
+ inputPlaceHolder: "username@contentoh.com",
216
+ inputId: "emailInput"
217
+ })
218
+ }), showErrors && emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
219
+ children: "Ingrese su correo"
220
+ }), invalidEmail && !emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
221
+ children: "Ingrese un correo v\xE1lido"
222
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
223
+ className: "password",
224
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
225
+ inputType: "password",
226
+ label: "Contraseña",
227
+ inputPlaceHolder: "Escribe tu contraseña",
228
+ inputId: "passwordInput"
229
+ })
230
+ }), showErrors && emptyPassword && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
231
+ children: "Ingrese su contrase\xF1a"
232
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
233
+ className: "select",
234
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index4.CheckBox, {
235
+ label: "Mantener sesión activada",
236
+ id: "chk-default",
237
+ className: "active-left"
238
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
239
+ onClick: function onClick() {
240
+ return props.setPaso(10);
241
+ },
242
+ className: "active-right",
243
+ children: "Olvide mi contrase\xF1a"
135
244
  })]
136
- })
137
- })]
138
- })
245
+ }), showErrors && signInError === "NotAuthorizedException" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
246
+ children: "Correo o contrase\xF1a incorrectos"
247
+ }), showErrors && signInError === "Error" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
248
+ children: "Ha habido un problema al iniciar sesi\xF3n"
249
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
250
+ className: "button-right",
251
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Button, {
252
+ buttonType: "general-default-button",
253
+ label: "Iniciar sesión",
254
+ onClick: function onClick(e) {
255
+ return validate(e);
256
+ }
257
+ })
258
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
259
+ className: "new-login",
260
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
261
+ className: "pre-registro",
262
+ onClick: function onClick() {
263
+ props.setPaso(1);
264
+ sessionStorage.setItem("nuevoRegistro", JSON.stringify({
265
+ name: "",
266
+ lastName: "",
267
+ email: "",
268
+ position: "",
269
+ country: "",
270
+ phone: "",
271
+ commercialName: "",
272
+ companyName: "",
273
+ rfc: "",
274
+ adress: ""
275
+ }));
276
+ sessionStorage.setItem("countryCode", JSON.stringify("+52"));
277
+ },
278
+ children: ["\xBFA\xFAn no tienes cuenta?", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
279
+ children: " Reg\xEDstrate"
280
+ })]
281
+ })
282
+ })]
283
+ })
284
+ }), upgradePlanRedirect && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Redirect, {
285
+ to: {
286
+ pathname: "/dashboard"
287
+ }
288
+ })]
139
289
  });
140
290
  };
141
291
 
@@ -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 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 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;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.VerificationCodeResetPasswordLoginDefault = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
+
12
+ var _index = require("./index");
13
+
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+
16
+ var _default = {
17
+ title: "Components/molecules/VerificationCodeResetPasswordLogin",
18
+ component: _index.VerificationCodeResetPasswordLogin
19
+ };
20
+ exports.default = _default;
21
+
22
+ var Template = function Template(args) {
23
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.VerificationCodeResetPasswordLogin, (0, _objectSpread2.default)({}, args));
24
+ };
25
+
26
+ var VerificationCodeResetPasswordLoginDefault = Template.bind({});
27
+ exports.VerificationCodeResetPasswordLoginDefault = VerificationCodeResetPasswordLoginDefault;
28
+ VerificationCodeResetPasswordLoginDefault.args = {};
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.VerificationCodeResetPasswordLogin = void 0;
9
+
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
11
+
12
+ var _styles = require("./styles");
13
+
14
+ var _GradientPanel = require("../../atoms/GradientPanel");
15
+
16
+ var _react = require("react");
17
+
18
+ var _LogoImage = require("../../atoms/LogoImage");
19
+
20
+ var _ScreenHeader = require("../../atoms/ScreenHeader");
21
+
22
+ var _variables = require("../../../global-files/variables");
23
+
24
+ var _GeneralInput = require("../../atoms/GeneralInput");
25
+
26
+ var _GeneralButton = require("../../atoms/GeneralButton");
27
+
28
+ var _utils = require("./utils");
29
+
30
+ var _jsxRuntime = require("react/jsx-runtime");
31
+
32
+ var VerificationCodeResetPasswordLogin = function VerificationCodeResetPasswordLogin() {
33
+ var _useState = (0, _react.useState)(false),
34
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
35
+ emptyVerificationCode = _useState2[0],
36
+ setEmptyVerificationCode = _useState2[1];
37
+
38
+ var _useState3 = (0, _react.useState)(),
39
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
40
+ inputCodeVerificationAll = _useState4[0],
41
+ setInputCodeVerificationAll = _useState4[1];
42
+
43
+ var inputPositions = [1, 2, 3, 4, 5, 6];
44
+ (0, _react.useEffect)(function () {
45
+ setInputCodeVerificationAll(document.querySelectorAll("[id^='verificationCodeInput']"));
46
+ }, []);
47
+ var loginRight = [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LogoImage.LogoImage, {}, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
48
+ className: "credenciales",
49
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
50
+ fontFamily: _variables.FontFamily.AvenirNext,
51
+ color: _variables.GlobalColors.s5,
52
+ text: "Ingresa tus credenciales"
53
+ })
54
+ }, "2"), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
55
+ className: "user",
56
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
57
+ text: "Ingresa el código de verificación enviado a:",
58
+ headerType: "input-name-header"
59
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
60
+ className: "verification-code",
61
+ children: inputPositions.map(function (position) {
62
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralInput.GeneralInput, {
63
+ inputId: "verificationCodeInput".concat(position),
64
+ inputType: "text",
65
+ inputPlaceholder: "X",
66
+ validateInput: _utils.validateInput,
67
+ inputsArray: inputCodeVerificationAll,
68
+ position: position,
69
+ maxLength: "1"
70
+ });
71
+ })
72
+ }), emptyVerificationCode && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
73
+ children: "Ingrese su c\xF3digo de verificaci\xF3n"
74
+ })]
75
+ }, "3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
76
+ className: "resend-code",
77
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
78
+ children: "Reenviar c\xF3digo de verificaci\xF3n"
79
+ })
80
+ }, "4"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
81
+ className: "button-center",
82
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
83
+ buttonType: "general-default-button",
84
+ label: "Enviar",
85
+ onClick: function onClick(e) {
86
+ return (0, _utils.validate)(inputCodeVerificationAll, setEmptyVerificationCode);
87
+ }
88
+ })
89
+ }, "5"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
90
+ className: "reset-password",
91
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
92
+ children: "Regresar..."
93
+ })
94
+ }, "6")];
95
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
96
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GradientPanel.GradientPanel, {
97
+ componentsArray: loginRight,
98
+ panelType: "home-login",
99
+ panelColor: _variables.GlobalColors.white
100
+ })
101
+ });
102
+ };
103
+
104
+ exports.VerificationCodeResetPasswordLogin = VerificationCodeResetPasswordLogin;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Container = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
+
12
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
+
14
+ var _variables = require("../../../global-files/variables");
15
+
16
+ var _templateObject;
17
+
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n height: 100%;\n width: 50%;\n .button-center {\n text-align: center;\n .general-default-button {\n width: 160px;\n }\n }\n .reset-password {\n text-align: center;\n margin: 15px !important;\n color: ", ";\n cursor: pointer;\n font-weight: bold;\n font-family: ", ";\n font-size: 13px;\n }\n .resend-code {\n margin-top: 8px !important;\n color: ", ";\n font-family: ", ";\n font-size: 11px;\n text-decoration: underline rgb(228, 81, 172);\n cursor: pointer;\n & + * {\n margin-top: 30px;\n }\n }\n .verification-code {\n display: flex;\n text-align: center;\n margin: auto;\n margin-top: 10px;\n input[type=\"number\"]::-webkit-inner-spin-button,\n input[type=\"number\"]::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n input {\n width: 70%;\n text-align: center;\n }\n }\n"])), _variables.GlobalColors.secondary_magenta, _variables.FontFamily.Raleway, _variables.GlobalColors.magenta_s2, _variables.FontFamily.AvenirNext);
19
+
20
+ exports.Container = Container;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.validateInput = exports.validate = void 0;
7
+
8
+ /**
9
+ *
10
+ * @param {event} e event received triggered by verification code input
11
+ * @param {number} index index position from the verification code(VC) input array (i.e. digit 1,2,3 etc...)
12
+ * @param {array<html nodes>} inputsArray array which contains every VC digit input (used to change focus on input change)
13
+ */
14
+ var validateInput = function validateInput(e, index, inputsArray) {
15
+ var isValid = false;
16
+ var inputNotEmpty = e.target.value.length > 0;
17
+
18
+ if (inputNotEmpty) {
19
+ if (validateInputNumber(e) !== null) {
20
+ isValid = true;
21
+ nextInputFocus(inputsArray, index++);
22
+ }
23
+ }
24
+
25
+ return isValid ? e.target.value : "";
26
+ };
27
+ /**
28
+ *
29
+ * @param {event} e event received triggered by verification code input
30
+ * @returns {boolean} if digit is a number
31
+ */
32
+
33
+
34
+ exports.validateInput = validateInput;
35
+
36
+ var validateInputNumber = function validateInputNumber(e) {
37
+ return (e.target.value || String.fromCharCode(e.keyCode)).match(/[0-9]{1}/);
38
+ };
39
+ /**
40
+ *
41
+ * @param {array<html nodes>} inputsArray array which contains every VC digit input (used to change focus on input change)
42
+ * @param {number} index index position from the verification code(VC) input array (i.e. digit 1,2,3 etc...)
43
+ * changes focus to next input if digit typed is a number and there wasn't any before
44
+ */
45
+
46
+
47
+ var nextInputFocus = function nextInputFocus(inputsArray, index) {
48
+ var _inputsArray$index;
49
+
50
+ var button = document.getElementsByClassName("general-default-button");
51
+ inputsArray !== null && inputsArray !== void 0 && inputsArray.length && index === (inputsArray === null || inputsArray === void 0 ? void 0 : inputsArray.length) ? button[0].focus() : (_inputsArray$index = inputsArray[index]) === null || _inputsArray$index === void 0 ? void 0 : _inputsArray$index.focus();
52
+ };
53
+ /**
54
+ *
55
+ * @param {array<html nodes>} inputsArray array which contains every VC digit input (used to check if there's any empty)
56
+ * @param {function} setEmptyVerificationCode function to update flag which handles if there's an empty char
57
+ * updates emptyVerificationFlag from father component
58
+ */
59
+
60
+
61
+ var validate = function validate(inputsArray, setEmptyVerificationCode) {
62
+ var contInputEmpty = 0;
63
+ inputsArray.forEach(function (element) {
64
+ element.value === "" ? 0 : contInputEmpty++;
65
+ });
66
+ contInputEmpty === inputsArray.length ? setEmptyVerificationCode(false) : setEmptyVerificationCode(true);
67
+ };
68
+
69
+ exports.validate = validate;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.ChangePasswordDefault = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
+
12
+ var _index = require("./index");
13
+
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+
16
+ var _default = {
17
+ title: "Components/organisms/ChangePassword",
18
+ component: _index.ChangePassword
19
+ };
20
+ exports.default = _default;
21
+
22
+ var Template = function Template(args) {
23
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ChangePassword, (0, _objectSpread2.default)({}, args));
24
+ };
25
+
26
+ var ChangePasswordDefault = Template.bind({});
27
+ exports.ChangePasswordDefault = ChangePasswordDefault;
28
+ ChangePasswordDefault.args = {};