contentoh-components-library 21.0.52 → 21.0.56

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