contentoh-components-library 21.0.54 → 21.0.55

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.
@@ -11,6 +11,7 @@ var _jsxRuntime = require("react/jsx-runtime");
11
11
 
12
12
  var Loading = function Loading() {
13
13
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
14
+ className: "loading",
14
15
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Loader, {
15
16
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
16
17
  className: "first"
@@ -15,6 +15,7 @@ var _jsxRuntime = require("react/jsx-runtime");
15
15
 
16
16
  var LogoImage = function LogoImage() {
17
17
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
18
+ className: "logo",
18
19
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
19
20
  src: _logoLogin.default,
20
21
  alt: "logo"
@@ -14,7 +14,7 @@ var _index = require("./index");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
 
16
16
  var _default = {
17
- title: "Components/atoms/LogoLoading",
17
+ title: "Components/molecules/LogoLoading",
18
18
  component: _index.LogoLoading
19
19
  };
20
20
  exports.default = _default;
@@ -7,20 +7,15 @@ exports.LogoLoading = void 0;
7
7
 
8
8
  var _styles = require("./styles");
9
9
 
10
+ var _Loading = require("../../atoms/Loading");
11
+
12
+ var _LogoImage = require("../../atoms/LogoImage");
13
+
10
14
  var _jsxRuntime = require("react/jsx-runtime");
11
15
 
12
16
  var LogoLoading = function LogoLoading() {
13
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
14
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
15
- className: "loader",
16
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
17
- className: "first"
18
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
19
- className: "second"
20
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
21
- className: "third"
22
- })]
23
- })
17
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
18
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LogoImage.LogoImage, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {})]
24
19
  });
25
20
  };
26
21
 
@@ -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 justify-content: center;\n align-items: center;\n height: 100vh;\n width: 50%;\n position: relative;\n img {\n width: 75%;\n position: absolute;\n bottom: 55%;\n left: 10%;\n }\n"])));
16
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: 100vh;\n width: 50%;\n padding-top: 25%;\n .logo {\n text-align: center;\n img {\n width: 65%;\n }\n }\n .loading {\n height: 10%;\n }\n"])));
17
17
 
18
18
  exports.Container = Container;
@@ -103,7 +103,7 @@ var SignInLogin = function SignInLogin(props) {
103
103
  }
104
104
 
105
105
  if (!valid) {
106
- _context.next = 34;
106
+ _context.next = 36;
107
107
  break;
108
108
  }
109
109
 
@@ -122,7 +122,7 @@ var SignInLogin = function SignInLogin(props) {
122
122
 
123
123
  props.setUser(session);
124
124
  props.setPaso(8);
125
- _context.next = 26;
125
+ _context.next = 28;
126
126
  break;
127
127
 
128
128
  case 20:
@@ -136,6 +136,8 @@ var SignInLogin = function SignInLogin(props) {
136
136
 
137
137
  case 23:
138
138
  response = _context.sent;
139
+ console.log(userGroup);
140
+ console.log(userGroup[0]);
139
141
  userGroupValue = typeof userGroup === "string" ? userGroup : userGroup[0];
140
142
 
141
143
  if (userGroupValue === "usuario_contentoh") {
@@ -157,12 +159,12 @@ var SignInLogin = function SignInLogin(props) {
157
159
  setLoading(false);
158
160
  }
159
161
 
160
- case 26:
161
- _context.next = 34;
162
+ case 28:
163
+ _context.next = 36;
162
164
  break;
163
165
 
164
- case 28:
165
- _context.prev = 28;
166
+ case 30:
167
+ _context.prev = 30;
166
168
  _context.t0 = _context["catch"](10);
167
169
  console.log(_context.t0);
168
170
  setLoading(false);
@@ -179,12 +181,12 @@ var SignInLogin = function SignInLogin(props) {
179
181
  console.log("error 2");
180
182
  }
181
183
 
182
- case 34:
184
+ case 36:
183
185
  case "end":
184
186
  return _context.stop();
185
187
  }
186
188
  }
187
- }, _callee, null, [[10, 28]]);
189
+ }, _callee, null, [[10, 30]]);
188
190
  }));
189
191
 
190
192
  return function validate(_x) {
@@ -258,7 +260,7 @@ var SignInLogin = function SignInLogin(props) {
258
260
  return validate(e);
259
261
  }
260
262
  })
261
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
263
+ }), props.registration && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
262
264
  className: "new-login",
263
265
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
264
266
  className: "pre-registro",
@@ -103,48 +103,48 @@ var SignInLoginCreationApp = function SignInLoginCreationApp(props) {
103
103
  }
104
104
 
105
105
  if (!valid) {
106
- _context.next = 34;
106
+ _context.next = 35;
107
107
  break;
108
108
  }
109
109
 
110
110
  _context.prev = 10;
111
111
  setLoading(true);
112
- console.log("try");
113
- _context.next = 15;
112
+ _context.next = 14;
114
113
  return props.Auth.signIn(email, password);
115
114
 
116
- case 15:
115
+ case 14:
117
116
  session = _context.sent;
118
117
 
119
118
  if (!(session.challengeName === "NEW_PASSWORD_REQUIRED")) {
120
- _context.next = 21;
119
+ _context.next = 20;
121
120
  break;
122
121
  }
123
122
 
124
123
  props.setUser(session);
125
124
  props.setPaso(8);
126
- _context.next = 27;
125
+ _context.next = 28;
127
126
  break;
128
127
 
129
- case 21:
128
+ case 20:
130
129
  userGroup = session.signInUserSession.accessToken.payload["cognito:groups"];
131
- _context.next = 24;
130
+ _context.next = 23;
132
131
  return _axios.default.get(process.env.REACT_APP_USER_ENDPOINT, {
133
132
  headers: {
134
133
  Authorization: session.signInUserSession.idToken.jwtToken
135
134
  }
136
135
  });
137
136
 
138
- case 24:
137
+ case 23:
139
138
  response = _context.sent;
139
+ console.log(userGroup);
140
+ console.log(userGroup[0]);
140
141
  userGroupValue = typeof userGroup === "string" ? userGroup : userGroup[0];
141
142
 
142
143
  if (userGroupValue === "colaboradores_contentoh") {
143
144
  sessionStorage.setItem("auth", true);
144
145
  sessionStorage.setItem("jwt", session.signInUserSession.idToken.jwtToken);
145
146
  user = JSON.parse(response.data.body).data[0];
146
- company = JSON.parse(response.data.body).data[1]; // const picture = getProfilePicture(user.id_user, 83, 83);
147
-
147
+ company = JSON.parse(response.data.body).data[1];
148
148
  caches.keys().then(function (names) {
149
149
  names.forEach(function (name) {
150
150
  caches.delete(name);
@@ -159,12 +159,12 @@ var SignInLoginCreationApp = function SignInLoginCreationApp(props) {
159
159
  setLoading(false);
160
160
  }
161
161
 
162
- case 27:
163
- _context.next = 34;
162
+ case 28:
163
+ _context.next = 35;
164
164
  break;
165
165
 
166
- case 29:
167
- _context.prev = 29;
166
+ case 30:
167
+ _context.prev = 30;
168
168
  _context.t0 = _context["catch"](10);
169
169
  console.log(_context.t0);
170
170
  setLoading(false);
@@ -178,12 +178,12 @@ var SignInLoginCreationApp = function SignInLoginCreationApp(props) {
178
178
  setSignInError("Error");
179
179
  }
180
180
 
181
- case 34:
181
+ case 35:
182
182
  case "end":
183
183
  return _context.stop();
184
184
  }
185
185
  }
186
- }, _callee, null, [[10, 29]]);
186
+ }, _callee, null, [[10, 30]]);
187
187
  }));
188
188
 
189
189
  return function validate(_x) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.54",
3
+ "version": "21.0.55",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -2,7 +2,7 @@ import { Container,Loader } from "./styles";
2
2
 
3
3
  export const Loading = () => {
4
4
  return (
5
- <Container >
5
+ <Container className="loading">
6
6
  <Loader>
7
7
  <span className="first"></span>
8
8
  <span className="second"></span>
@@ -3,7 +3,7 @@ import logoLogin from "../../../assets/images/logo/logoLogin.svg";
3
3
 
4
4
  export const LogoImage = () => {
5
5
  return (
6
- <Container key={`logo`}>
6
+ <Container key={`logo`} className="logo">
7
7
  <img src={logoLogin} alt={"logo"} />
8
8
  </Container>
9
9
  );
@@ -1,7 +1,7 @@
1
1
  import { LogoLoading } from "./index";
2
2
 
3
3
  export default {
4
- title: "Components/atoms/LogoLoading",
4
+ title: "Components/molecules/LogoLoading",
5
5
  component: LogoLoading,
6
6
  };
7
7
  const Template = (args) => <LogoLoading {...args} />;
@@ -1,13 +1,12 @@
1
1
  import { Container } from "./styles";
2
+ import { Loading } from "../../atoms/Loading";
3
+ import { LogoImage } from "../../atoms/LogoImage";
2
4
 
3
5
  export const LogoLoading = () => {
4
6
  return (
5
- <Container >
6
- <div className="loader">
7
- <span className="first"></span>
8
- <span className="second"></span>
9
- <span className="third"></span>
10
- </div>
7
+ <Container>
8
+ <LogoImage/>
9
+ <Loading/>
11
10
  </Container>
12
11
  );
13
12
  };
@@ -1,15 +1,16 @@
1
1
  import styled from "styled-components";
2
2
 
3
3
  export const Container = styled.div`
4
- justify-content: center;
5
- align-items: center;
6
4
  height: 100vh;
7
5
  width: 50%;
8
- position: relative;
9
- img {
10
- width: 75%;
11
- position: absolute;
12
- bottom: 55%;
13
- left: 10%;
6
+ padding-top: 25%;
7
+ .logo {
8
+ text-align: center;
9
+ img {
10
+ width: 65%;
11
+ }
12
+ }
13
+ .loading {
14
+ height: 10%;
14
15
  }
15
16
  `;
@@ -60,6 +60,8 @@ export const SignInLogin = (props) => {
60
60
  },
61
61
  }
62
62
  );
63
+ console.log(userGroup);
64
+ console.log(userGroup[0]);
63
65
  const userGroupValue =
64
66
  typeof userGroup === "string" ? userGroup : userGroup[0];
65
67
  if (userGroupValue === "usuario_contentoh") {
@@ -175,32 +177,34 @@ export const SignInLogin = (props) => {
175
177
  onClick={(e) => validate(e)}
176
178
  />
177
179
  </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>
180
+ {props.registration && (
181
+ <div className="new-login">
182
+ <p
183
+ className="pre-registro"
184
+ onClick={() => {
185
+ props.setPaso(1);
186
+ sessionStorage.setItem(
187
+ "nuevoRegistro",
188
+ JSON.stringify({
189
+ name: "",
190
+ lastName: "",
191
+ email: "",
192
+ position: "",
193
+ country: "",
194
+ phone: "",
195
+ commercialName: "",
196
+ companyName: "",
197
+ rfc: "",
198
+ adress: "",
199
+ })
200
+ );
201
+ sessionStorage.setItem("countryCode", JSON.stringify("+52"));
202
+ }}
203
+ >
204
+ ¿Aún no tienes cuenta?<span> Regístrate</span>
205
+ </p>
206
+ </div>
207
+ )}
204
208
  </div>
205
209
  </Container>
206
210
  {upgradePlanRedirect && <Redirect to={{ pathname: "/dashboard" }} />}
@@ -46,7 +46,6 @@ export const SignInLoginCreationApp = (props) => {
46
46
  if (valid) {
47
47
  try {
48
48
  setLoading(true);
49
- console.log("try")
50
49
  const session = await props.Auth.signIn(email, password);
51
50
  if (session.challengeName === "NEW_PASSWORD_REQUIRED") {
52
51
  props.setUser(session);
@@ -62,7 +61,8 @@ export const SignInLoginCreationApp = (props) => {
62
61
  },
63
62
  }
64
63
  );
65
-
64
+ console.log(userGroup);
65
+ console.log(userGroup[0]);
66
66
  const userGroupValue =
67
67
  typeof userGroup === "string" ? userGroup : userGroup[0];
68
68
  if (userGroupValue === "colaboradores_contentoh") {
@@ -73,7 +73,7 @@ export const SignInLoginCreationApp = (props) => {
73
73
  );
74
74
  const user = JSON.parse(response.data.body).data[0];
75
75
  const company = JSON.parse(response.data.body).data[1];
76
- // const picture = getProfilePicture(user.id_user, 83, 83);
76
+
77
77
  caches.keys().then((names) => {
78
78
  names.forEach((name) => {
79
79
  caches.delete(name);