contentoh-components-library 21.0.54 → 21.0.57

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 (33) hide show
  1. package/dist/components/atoms/Loading/index.js +1 -0
  2. package/dist/components/atoms/LogoImage/index.js +1 -0
  3. package/dist/components/atoms/SliderToolTip/SliderToolTip.stories.js +28 -0
  4. package/dist/components/atoms/SliderToolTip/index.js +144 -0
  5. package/dist/components/atoms/SliderToolTip/styles.js +24 -0
  6. package/dist/components/molecules/LogoLoading/Loading.stories.js +1 -1
  7. package/dist/components/molecules/LogoLoading/index.js +6 -11
  8. package/dist/components/molecules/LogoLoading/styles.js +1 -1
  9. package/dist/components/molecules/SignInLogin/index.js +13 -14
  10. package/dist/components/molecules/SignInLogin/styles.js +1 -1
  11. package/dist/components/molecules/SignInLoginCreationApp/index.js +17 -17
  12. package/dist/index.js +86 -60
  13. package/package.json +1 -1
  14. package/src/assets/images/sliderToolTip/infoIcon.svg +4 -0
  15. package/src/assets/images/sliderToolTip/slide1.svg +5 -0
  16. package/src/assets/images/sliderToolTip/slide2.svg +9 -0
  17. package/src/assets/images/sliderToolTip/slide3.svg +9 -0
  18. package/src/assets/images/sliderToolTip/slide4.svg +9 -0
  19. package/src/assets/images/sliderToolTip/slide5.svg +40 -0
  20. package/src/components/atoms/Loading/index.js +1 -1
  21. package/src/components/atoms/LogoImage/index.js +1 -1
  22. package/src/components/atoms/SliderToolTip/SliderToolTip.stories.js +12 -0
  23. package/src/components/atoms/SliderToolTip/index.js +115 -0
  24. package/src/components/atoms/SliderToolTip/styles.js +162 -0
  25. package/src/components/molecules/LogoLoading/Loading.stories.js +1 -1
  26. package/src/components/molecules/LogoLoading/index.js +5 -6
  27. package/src/components/molecules/LogoLoading/styles.js +9 -8
  28. package/src/components/molecules/SignInLogin/index.js +31 -31
  29. package/src/components/molecules/SignInLogin/styles.js +1 -1
  30. package/src/index.js +4 -2
  31. package/src/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +0 -11
  32. package/src/components/molecules/SignInLoginCreationApp/index.js +0 -182
  33. package/src/components/molecules/SignInLoginCreationApp/styles.js +0 -79
@@ -1,182 +0,0 @@
1
- import { Container } from "./styles";
2
- import { LogoImage } from "../../atoms/LogoImage/index";
3
- import { ScreenHeader } from "../../atoms/ScreenHeader/index";
4
- import { Button } from "../../atoms/GeneralButton/index";
5
- import { CheckBox } from "../../atoms/CheckBox/index";
6
- import { TagAndInput } from "../TagAndInput";
7
- import { FontFamily, GlobalColors } from "../../../global-files/variables";
8
- import { useState, useEffect } from "react";
9
- import { Loading } from "../../atoms/Loading";
10
- import { Redirect } from "react-router-dom";
11
- import axios from "axios";
12
-
13
- export const SignInLoginCreationApp = (props) => {
14
- const [emptyEmail, setEmptyEmail] = useState(false);
15
- const [invalidEmail, setInvalidEmail] = useState(false);
16
- const [emptyPassword, setEmptyPassword] = useState(false);
17
- const [showErrors, setShowErrors] = useState(true);
18
- const [signInError, setSignInError] = useState("");
19
- const [loading, setLoading] = useState(false);
20
- const [upgradePlanRedirect, setUpgradePlanRedirect] = useState(false);
21
-
22
- const validate = async (e) => {
23
- e.preventDefault();
24
- setSignInError("");
25
- setShowErrors(true);
26
- let valid = true;
27
- const email = document.querySelector("#emailInput").value.trim();
28
- const password = document.querySelector("#passwordInput").value;
29
- !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
30
- email
31
- )
32
- ? setInvalidEmail(true)
33
- : setInvalidEmail(false);
34
- if (email === "") {
35
- valid = false;
36
- setEmptyEmail(true);
37
- } else {
38
- setEmptyEmail(false);
39
- }
40
- if (password === "") {
41
- valid = false;
42
- setEmptyPassword(true);
43
- } else {
44
- setEmptyPassword(false);
45
- }
46
- if (valid) {
47
- try {
48
- setLoading(true);
49
- console.log("try")
50
- const session = await props.Auth.signIn(email, password);
51
- if (session.challengeName === "NEW_PASSWORD_REQUIRED") {
52
- props.setUser(session);
53
- props.setPaso(8);
54
- } else {
55
- const userGroup =
56
- session.signInUserSession.accessToken.payload["cognito:groups"];
57
- const response = await axios.get(
58
- process.env.REACT_APP_USER_ENDPOINT,
59
- {
60
- headers: {
61
- Authorization: session.signInUserSession.idToken.jwtToken,
62
- },
63
- }
64
- );
65
-
66
- const userGroupValue =
67
- typeof userGroup === "string" ? userGroup : userGroup[0];
68
- if (userGroupValue === "colaboradores_contentoh") {
69
- sessionStorage.setItem("auth", true);
70
- sessionStorage.setItem(
71
- "jwt",
72
- session.signInUserSession.idToken.jwtToken
73
- );
74
- const user = JSON.parse(response.data.body).data[0];
75
- const company = JSON.parse(response.data.body).data[1];
76
- // const picture = getProfilePicture(user.id_user, 83, 83);
77
- caches.keys().then((names) => {
78
- names.forEach((name) => {
79
- caches.delete(name);
80
- });
81
- });
82
- user.src = `https://${
83
- process.env.REACT_APP_IMAGES_PROFILE_BUCKET
84
- }.s3.amazonaws.com/id-${user.id_user}/${
85
- user.id_user
86
- }.png?${new Date().getTime()}`;
87
- sessionStorage.setItem("user", JSON.stringify(user));
88
- sessionStorage.setItem("company", JSON.stringify(company));
89
- setUpgradePlanRedirect(true);
90
- } else {
91
- setSignInError("NotAuthorizedException");
92
- setLoading(false);
93
- }
94
- }
95
- } catch (error) {
96
- console.log(error);
97
- setLoading(false);
98
- if (error.code === "NotAuthorizedException") {
99
- setSignInError("NotAuthorizedException");
100
- } else if (error.code === "UserNotConfirmedException") {
101
- sessionStorage.setItem(
102
- "email",
103
- JSON.stringify(document.querySelector("#usernameInput").value)
104
- );
105
- props.setPaso(5);
106
- } else {
107
- setSignInError("Error");
108
- }
109
- }
110
- }
111
- };
112
- useEffect(() => {
113
- sessionStorage.getItem("resetPasswordProcess") &&
114
- sessionStorage.removeItem("resetPasswordProcess");
115
- }, []);
116
- useEffect(() => {
117
- if (upgradePlanRedirect) setLoading(false);
118
- }, [upgradePlanRedirect]);
119
- return loading ? (
120
- <Loading />
121
- ) : (
122
- <>
123
- <Container className={"home-login"}>
124
- <div className="main-container">
125
- <LogoImage />
126
- <div className="credenciales">
127
- <ScreenHeader
128
- fontFamily={FontFamily.AvenirNext}
129
- color={GlobalColors.s5}
130
- text={"Ingresa tus credenciales"}
131
- />
132
- </div>
133
- <div className="user">
134
- <TagAndInput
135
- inputType={"text"}
136
- label={"Nombre de usuario"}
137
- inputPlaceHolder={"username@contentoh.com"}
138
- inputId={"emailInput"}
139
- />
140
- </div>
141
- {showErrors && emptyEmail && <label>Ingrese su correo</label>}
142
- {invalidEmail && !emptyEmail && (
143
- <label>Ingrese un correo válido</label>
144
- )}
145
- <div className="password">
146
- <TagAndInput
147
- inputType={"password"}
148
- label={"Contraseña"}
149
- inputPlaceHolder={"Escribe tu contraseña"}
150
- inputId={"passwordInput"}
151
- />
152
- </div>
153
- {showErrors && emptyPassword && <label>Ingrese su contraseña</label>}
154
- <div className="select">
155
- <CheckBox
156
- label={"Mantener sesión activada"}
157
- id={"chk-default"}
158
- className="active-left"
159
- />
160
- <p onClick={() => props.setPaso(10)} className="active-right">
161
- Olvide mi contraseña
162
- </p>
163
- </div>
164
- {showErrors && signInError === "NotAuthorizedException" && (
165
- <label>Correo o contraseña incorrectos</label>
166
- )}
167
- {showErrors && signInError === "Error" && (
168
- <label>Ha habido un problema al iniciar sesión</label>
169
- )}
170
- <div className="button-right">
171
- <Button
172
- buttonType={"general-default-button"}
173
- label={"Iniciar sesión"}
174
- onClick={(e) => validate(e)}
175
- />
176
- </div>
177
- </div>
178
- </Container>
179
- {upgradePlanRedirect && <Redirect to={{ pathname: "/dashboard" }} />}
180
- </>
181
- );
182
- };
@@ -1,79 +0,0 @@
1
- import styled from "styled-components";
2
- import { FontFamily, GlobalColors } from "../../../global-files/variables";
3
-
4
- export const Container = styled.div`
5
- background: "white";
6
- display: flex;
7
- height: 100vh;
8
- width: 50%;
9
- justify-content: center;
10
- align-items: center;
11
- label {
12
- color: red;
13
- margin-top: 3px;
14
- margin-left: 15px;
15
- font-family: ${FontFamily.Raleway_700};
16
- font-size: 11px;
17
- & + * {
18
- margin-top: 12px;
19
- }
20
- }
21
-
22
- &.home-login {
23
- .credenciales {
24
- & + * {
25
- margin-top: 30px;
26
- }
27
- }
28
- .user {
29
- & + * {
30
- margin-top: 20px;
31
- }
32
- }
33
- .password {
34
- & + * {
35
- margin-top: 20px;
36
- }
37
- }
38
- .select {
39
- display: flex;
40
- justify-content: space-between;
41
- .active-right {
42
- font-family: ${FontFamily.AvenirNext};
43
- font-weight: 500;
44
- font-size: 13px;
45
- line-height: 24px;
46
- letter-spacing: -0.015em;
47
- color: ${GlobalColors.s5};
48
- cursor: pointer;
49
- }
50
- & + * {
51
- margin-top: 50px;
52
- }
53
- }
54
- .button-right {
55
- text-align: right;
56
- & + * {
57
- margin-top: 55px;
58
- }
59
- }
60
- .new-login {
61
- p {
62
- font-family: ${FontFamily.AvenirNext};
63
- text-align: right;
64
- font-weight: 500;
65
- font-size: 13px;
66
- line-height: 24px;
67
- color: ${GlobalColors.s5};
68
- cursor: pointer;
69
- span {
70
- color: ${GlobalColors.secondary_magenta};
71
- }
72
- }
73
- }
74
- }
75
- .main-container {
76
- max-width: 80%;
77
- max-height: 80%;
78
- }
79
- `;