contentoh-components-library 21.2.82 → 21.2.84

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.
@@ -0,0 +1,48 @@
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.StatusTagDefault = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
+
12
+ var _index = require("./index");
13
+
14
+ var _variables = require("../../../global-files/variables");
15
+
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+
18
+ var status = _variables.GlobalStatus;
19
+ var _default = {
20
+ title: "Components/atoms/StatusTag",
21
+ component: _index.StatusTag,
22
+ argTypes: {
23
+ statusType: {
24
+ options: status,
25
+ control: {
26
+ type: "select"
27
+ }
28
+ },
29
+ ovalForm: {
30
+ options: [true, false],
31
+ control: {
32
+ type: "boolean"
33
+ }
34
+ }
35
+ }
36
+ };
37
+ exports.default = _default;
38
+
39
+ var Template = function Template(args) {
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.StatusTag, (0, _objectSpread2.default)({}, args));
41
+ };
42
+
43
+ var StatusTagDefault = Template.bind({});
44
+ exports.StatusTagDefault = StatusTagDefault;
45
+ StatusTagDefault.args = {
46
+ statusType: "-",
47
+ ovalForm: false
48
+ };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StatusTag = void 0;
7
+
8
+ var _styles = require("./styles");
9
+
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+
12
+ var StatusTag = function StatusTag(_ref) {
13
+ var statusType = _ref.statusType,
14
+ ovalForm = _ref.ovalForm;
15
+
16
+ var getShortStatus = function getShortStatus(status) {
17
+ switch (status) {
18
+ case "COMPLETED":
19
+ return "C";
20
+
21
+ case "RECEPTION":
22
+ return "Pr";
23
+
24
+ case "NULL":
25
+ return "-";
26
+
27
+ case "RECEIVED":
28
+ return "Rc";
29
+
30
+ case "IN_PROGRESS":
31
+ return "P";
32
+
33
+ case "ASSIGNED":
34
+ return "As";
35
+
36
+ case "APPROVED":
37
+ return "Ap";
38
+
39
+ case "VALIDATING":
40
+ return "V";
41
+
42
+ case "PAID_OUT":
43
+ return "Po";
44
+
45
+ default:
46
+ return status;
47
+ }
48
+ };
49
+
50
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
51
+ className: "status-".concat(getShortStatus(statusType), " ").concat(ovalForm && "oval-form"),
52
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
53
+ children: getShortStatus(statusType)
54
+ })
55
+ });
56
+ };
57
+
58
+ exports.StatusTag = StatusTag;
@@ -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 width: fit-content;\n padding: 0 10px;\n height: 20px;\n background-color: ", ";\n border-radius: 3px;\n\n p {\n text-align: center;\n color: ", ";\n font-family: ", ";\n font-size: 12px;\n line-height: 20px;\n }\n\n &.status-As,\n &.status-P,\n &.status-IN_PROGRESS,\n &.status-QF {\n background-color: ", ";\n }\n\n &.status-Pr,\n &.status-Rr,\n &.status-Rc {\n background-color: ", ";\n }\n\n &.status-AA,\n &.status-AP,\n &.status-AC,\n &.status-AF {\n background-color: ", ";\n }\n\n &.status-RA,\n &.status-RF,\n &.status-RP,\n &.status-RC {\n background-color: ", ";\n }\n\n &.status-Dat,\n &.status-Dsc,\n &.status-Imgs {\n background-color: ", ";\n }\n\n &.status-Ex {\n background-color: ", ";\n }\n\n &.status-DDI {\n background-color: ", ";\n }\n\n &.status-GLD {\n background-color: ", ";\n }\n\n &.status-TAB {\n background-color: ", ";\n }\n\n &.status-Pt {\n background-color: ", ";\n color: ", ";\n }\n\n &.oval-form {\n border-radius: 10px;\n }\n"])), _variables.GlobalColors.s3, _variables.GlobalColors.white, _variables.FontFamily.Lato, _variables.GlobalColors.in_progress, _variables.GlobalColors.reception, _variables.GlobalColors.finished, _variables.GlobalColors.rejected_status, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.original_purpura, _variables.GlobalColors.in_progress, _variables.GlobalColors.deep_gray, _variables.GlobalColors.s2, _variables.GlobalColors.s4);
19
+
20
+ exports.Container = Container;
@@ -27,29 +27,30 @@ var DashboardDeafult = Template.bind({});
27
27
  exports.DashboardDeafult = DashboardDeafult;
28
28
  DashboardDeafult.args = {
29
29
  user: {
30
- id_user: 425,
31
- name: "Auditor QA",
32
- last_name: " ",
33
- email: "ladiboh785@mi166.com",
34
- position: "Tester",
35
- telephone: null,
36
- country: null,
37
- id_company: 254,
38
- id_cognito: "23a3f496-4e38-4e12-9bf5-7f90b77a2f35",
30
+ id_user: 1236,
31
+ name: "THD",
32
+ last_name: "Proveedor",
33
+ email: "thd@allfreemail.net",
34
+ position: "Prod test",
35
+ telephone: "+523111111111",
36
+ country: "México",
37
+ id_company: 816,
38
+ id_cognito: "d660ccca-f906-4970-892c-6d152e832e5d",
39
39
  birth_Date: null,
40
40
  about_me: null,
41
41
  zip_code: null,
42
42
  address: null,
43
43
  job: null,
44
44
  id_stripe: null,
45
- id_role: 6,
45
+ id_role: 0,
46
46
  active: 1,
47
47
  is_retailer: 0,
48
- email_notify: null,
48
+ email_notify: 1,
49
+ is_superadmin: 0,
49
50
  membership: {
50
- id: 750,
51
- start_date: "2022-01-07T21:32:54.000Z",
52
- end_date: "2023-01-07T21:32:54.000Z",
51
+ id: 797,
52
+ start_date: "2022-06-19T04:18:39.000Z",
53
+ end_date: "2023-06-19T04:18:39.000Z",
53
54
  planID: 6,
54
55
  plan: "prod_KvGd6YSTJyR3AP",
55
56
  name: "Plan Small",
@@ -57,7 +58,34 @@ DashboardDeafult.args = {
57
58
  products_limit: "1000",
58
59
  type: "Enterprise"
59
60
  },
60
- src: "https://content-management-profile-prod.s3.amazonaws.com/id-425/425.png?1666639556174"
61
+ src: "https://content-management-profile-prod.s3.amazonaws.com/id-1236/1236.png?1668676098688"
62
+ },
63
+ company: {
64
+ id_company: 816,
65
+ trade_name: "Prod Test",
66
+ company_name: "Prod Test",
67
+ rfc: "ASER12345",
68
+ adress: "Av. Insurgentes",
69
+ about_company: null,
70
+ telephone: null,
71
+ web_site: null,
72
+ zip_code: null,
73
+ email: null,
74
+ social_link: null,
75
+ is_retailer: 0,
76
+ financedRetailers: [{
77
+ id: 58,
78
+ name: "The Home Depot Golden",
79
+ country: "México",
80
+ id_region: 1,
81
+ active: 1
82
+ }, {
83
+ id: 59,
84
+ name: "The Home Depot Platinum",
85
+ country: "México",
86
+ id_region: 1,
87
+ active: 1
88
+ }]
61
89
  },
62
- jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bz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dLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImQ2NjBjY2NhLWY5MDYtNDk3MC04OTJjLTZkMTUyZTgzMmU1ZCIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiI2NzYzN2VlZi1iMjE3LTRiYWEtODM4MC05NDMzODZjYTU5OTIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY2ODY3NjA5OCwibmFtZSI6IlRIRCBQcm92ZWVkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIzMTExMTExMTExIiwiZXhwIjoxNjY4Njc5Njk3LCJpYXQiOjE2Njg2NzYwOTgsImVtYWlsIjoidGhkQGFsbGZyZWVtYWlsLm5ldCJ9.ghtkS2S6ipJgGDEkGVoEd2iaxD5iKkGL_HBQ6ay-Kp-nh0VWjYW9cUBQhv83Je6gBsYdywkRfAmW9bEeqW7IuOAV9-CcQtcg7NtARtPjm3XLwt-vZePHefNASS1GdkFjjb3wioSdHoxa5UR6Di-mCTvQPad7tUdDy5XZf--8HyuB2Ir-yGnBqQ5mcyUloIwKWA0U0kboKUb97j8wCxGGP4oArrNH9yuwlwCC5dW2eyF1MKBDb4zPAnKmKM3IR-iFuyl9kAuo88YAas8o8pJ3_oc49NJ6ti2yY2hUyDFiMYlhjo-nDGMK1hQqFqjTPvrCV71H7P2vVuFHkkln9G-MbQ"
63
91
  };
@@ -188,7 +188,7 @@ var Dashboard = function Dashboard(_ref) {
188
188
  while (1) {
189
189
  switch (_context2.prev = _context2.next) {
190
190
  case 0:
191
- isTHDUser = [657, 818, 819].includes(user.id_company);
191
+ isTHDUser = user.is_retailer && company.retailers;
192
192
  _context2.next = 3;
193
193
  return _axios.default.get("".concat(process.env.REACT_APP_RETAILER_ENDPOINT), {
194
194
  headers: {
@@ -219,32 +219,39 @@ var Dashboard = function Dashboard(_ref) {
219
219
 
220
220
  var loadProductsByStatus = /*#__PURE__*/function () {
221
221
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(orderByStatus, filter) {
222
- var _ref5, ordersBydate, ordersByStatus, _ordersByStatus$total, total, _ordersByStatus$R, R, _ordersByStatus$PA, PA, _ordersByStatus$Ex, Ex, inProcess, metricsArray;
222
+ var isTHDUser, isProvider, isCollaborator, _ref5, ordersBydate, ordersByStatus, _ordersByStatus$total, total, _ordersByStatus$R, R, _ordersByStatus$PA, PA, _ordersByStatus$Ex, Ex, _ordersByStatus$ACA, ACA, productsFinished, inProcess, metricsArray;
223
223
 
224
224
  return _regenerator.default.wrap(function _callee3$(_context3) {
225
225
  while (1) {
226
226
  switch (_context3.prev = _context3.next) {
227
227
  case 0:
228
- _context3.next = 2;
228
+ isTHDUser = user.is_retailer && company.retailers;
229
+ isProvider = !user.is_retailer && user.id_role === 0;
230
+ isCollaborator = user.id_role > 0;
231
+ _context3.next = 5;
229
232
  return loadProductVersions(orderByStatus);
230
233
 
231
- case 2:
234
+ case 5:
232
235
  _context3.t0 = _context3.sent;
233
236
 
234
237
  if (_context3.t0) {
235
- _context3.next = 5;
238
+ _context3.next = 8;
236
239
  break;
237
240
  }
238
241
 
239
242
  _context3.t0 = {};
240
243
 
241
- case 5:
244
+ case 8:
242
245
  _ref5 = _context3.t0;
243
246
  ordersBydate = _ref5.ordersBydate;
244
247
  ordersByStatus = _ref5.ordersByStatus;
245
- _ordersByStatus$total = ordersByStatus.total, total = _ordersByStatus$total === void 0 ? 0 : _ordersByStatus$total, _ordersByStatus$R = ordersByStatus.R, R = _ordersByStatus$R === void 0 ? 0 : _ordersByStatus$R, _ordersByStatus$PA = ordersByStatus.PA, PA = _ordersByStatus$PA === void 0 ? 0 : _ordersByStatus$PA, _ordersByStatus$Ex = ordersByStatus.Ex, Ex = _ordersByStatus$Ex === void 0 ? 0 : _ordersByStatus$Ex;
248
+ _ordersByStatus$total = ordersByStatus.total, total = _ordersByStatus$total === void 0 ? 0 : _ordersByStatus$total, _ordersByStatus$R = ordersByStatus.R, R = _ordersByStatus$R === void 0 ? 0 : _ordersByStatus$R, _ordersByStatus$PA = ordersByStatus.PA, PA = _ordersByStatus$PA === void 0 ? 0 : _ordersByStatus$PA, _ordersByStatus$Ex = ordersByStatus.Ex, Ex = _ordersByStatus$Ex === void 0 ? 0 : _ordersByStatus$Ex, _ordersByStatus$ACA = ordersByStatus.ACA, ACA = _ordersByStatus$ACA === void 0 ? 0 : _ordersByStatus$ACA;
249
+ productsFinished = 0;
250
+ if (isTHDUser) productsFinished = Ex;
251
+ if (isProvider) productsFinished = ACA;
252
+ if (isCollaborator) productsFinished = Ex + ACA;
246
253
  inProcess = Object.keys(ordersByStatus).reduce(function (prev, curr) {
247
- return !["total", "PA", "R", "Ex"].includes(curr) ? prev + ordersByStatus[curr] : prev;
254
+ return !["total", "PA", "R", "Ex", "ACA"].includes(curr) ? prev + ordersByStatus[curr] : prev;
248
255
  }, 0);
249
256
  metricsArray = [metricsData[0] ? metricsData[0] : {
250
257
  label: "Productos totales",
@@ -261,7 +268,7 @@ var Dashboard = function Dashboard(_ref) {
261
268
  value: inProcess
262
269
  }, {
263
270
  label: "Productos terminados",
264
- value: Ex
271
+ value: productsFinished
265
272
  });
266
273
  setMetricsData(metricsArray);
267
274
  setTotalCount(total);
@@ -269,7 +276,7 @@ var Dashboard = function Dashboard(_ref) {
269
276
  setRequiredProducts(ordersBydate);
270
277
  setProductsByStatus(ordersByStatus);
271
278
 
272
- case 17:
279
+ case 24:
273
280
  case "end":
274
281
  return _context3.stop();
275
282
  }
@@ -106,8 +106,7 @@ var _jsxRuntime = require("react/jsx-runtime");
106
106
  var reducerImages = function reducerImages(state, action) {
107
107
  var _action$init, _action$init$inputsBy;
108
108
 
109
- var _state$values = state.values,
110
- values = _state$values === void 0 ? [] : _state$values,
109
+ var values = state.values,
111
110
  attrForImgs = state.attrForImgs,
112
111
  inputsByRetailer = state.inputsByRetailer;
113
112
 
@@ -183,7 +182,7 @@ var reducerImages = function reducerImages(state, action) {
183
182
  inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
184
183
  return imageIdArray.includes(input.id);
185
184
  });
186
- if (orderedImages.length > 0) values = orderedImages;
185
+ values = orderedImages.length > 0 ? orderedImages : [];
187
186
  } catch (error) {
188
187
  console.log(error);
189
188
  }
@@ -0,0 +1,37 @@
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.RegistrationLoginFirstStepDefault = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
+
12
+ var _index = require("./index");
13
+
14
+ var _loginImage = _interopRequireDefault(require("../../../assets/images/carouselImagesLogin/loginImage.svg"));
15
+
16
+ var _login = _interopRequireDefault(require("../../../assets/images/carouselImagesLogin/login2.svg"));
17
+
18
+ var _login2 = _interopRequireDefault(require("../../../assets/images/carouselImagesLogin/login3.svg"));
19
+
20
+ var _jsxRuntime = require("react/jsx-runtime");
21
+
22
+ var _default = {
23
+ title: "Components/pages/RegistrationLoginFirstStep",
24
+ component: _index.RegistrationLoginFirstStep
25
+ };
26
+ exports.default = _default;
27
+
28
+ var Template = function Template(args) {
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.RegistrationLoginFirstStep, (0, _objectSpread2.default)({}, args));
30
+ };
31
+
32
+ var RegistrationLoginFirstStepDefault = Template.bind({});
33
+ exports.RegistrationLoginFirstStepDefault = RegistrationLoginFirstStepDefault;
34
+ RegistrationLoginFirstStepDefault.args = {
35
+ imageArrayCarousel: [_loginImage.default, _login.default, _login2.default],
36
+ textCarousel: "Elige la plataforma que conecta proovedores y retailers"
37
+ };
@@ -0,0 +1,269 @@
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.RegistrationLoginFirstStep = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
15
+
16
+ var _styles = require("./styles");
17
+
18
+ var _GradientPanel = require("../../atoms/GradientPanel");
19
+
20
+ var _CarouselImagesLogin = require("../../molecules/CarouselImagesLogin");
21
+
22
+ var _react = require("react");
23
+
24
+ var _LogoImage = require("../../atoms/LogoImage");
25
+
26
+ var _ScreenHeader = require("../../atoms/ScreenHeader");
27
+
28
+ var _variables = require("../../../global-files/variables");
29
+
30
+ var _TagAndInput = require("../../molecules/TagAndInput");
31
+
32
+ var _GeneralButton = require("../../atoms/GeneralButton");
33
+
34
+ var _GeneralInput = require("../../atoms/GeneralInput");
35
+
36
+ var _jsxRuntime = require("react/jsx-runtime");
37
+
38
+ var RegistrationLoginFirstStep = function RegistrationLoginFirstStep(_ref) {
39
+ var _ref$imageArrayCarous = _ref.imageArrayCarousel,
40
+ imageArrayCarousel = _ref$imageArrayCarous === void 0 ? [] : _ref$imageArrayCarous,
41
+ textCarousel = _ref.textCarousel,
42
+ backogroundColorCarousel = _ref.backogroundColorCarousel;
43
+
44
+ var _useState = (0, _react.useState)(false),
45
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
46
+ emptyName = _useState2[0],
47
+ setEmptyName = _useState2[1];
48
+
49
+ var _useState3 = (0, _react.useState)(false),
50
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
51
+ emptyLastName = _useState4[0],
52
+ setEmptyLastName = _useState4[1];
53
+
54
+ var _useState5 = (0, _react.useState)(false),
55
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
56
+ emptyEmail = _useState6[0],
57
+ setEmptyEmail = _useState6[1];
58
+
59
+ var _useState7 = (0, _react.useState)(false),
60
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
61
+ emptyJob = _useState8[0],
62
+ setEmptyJob = _useState8[1];
63
+
64
+ var _useState9 = (0, _react.useState)(false),
65
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
66
+ emptyPhone = _useState10[0],
67
+ setEmptyPhone = _useState10[1];
68
+
69
+ var _useState11 = (0, _react.useState)(false),
70
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
71
+ invalidEmail = _useState12[0],
72
+ setInvalidEmail = _useState12[1];
73
+
74
+ var validate = /*#__PURE__*/function () {
75
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
76
+ var name, lastName, email, job, phone;
77
+ return _regenerator.default.wrap(function _callee$(_context) {
78
+ while (1) {
79
+ switch (_context.prev = _context.next) {
80
+ case 0:
81
+ e.preventDefault();
82
+ name = document.querySelector("#nameInput").value;
83
+ lastName = document.querySelector("#lastNameInput").value;
84
+ email = document.querySelector("#emailInput").value;
85
+ job = document.querySelector("#jobInput").value;
86
+ phone = document.querySelector("#phoneInput").value;
87
+ name === "" ? setEmptyName(true) : setEmptyName(false);
88
+ lastName === "" ? setEmptyLastName(true) : setEmptyLastName(false);
89
+ email === "" ? setEmptyEmail(true) : setEmptyEmail(false);
90
+ job === "" ? setEmptyJob(true) : setEmptyJob(false);
91
+ phone === "" ? setEmptyPhone(true) : setEmptyPhone(false);
92
+ !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email) ? setInvalidEmail(true) : setInvalidEmail(false);
93
+
94
+ case 12:
95
+ case "end":
96
+ return _context.stop();
97
+ }
98
+ }
99
+ }, _callee);
100
+ }));
101
+
102
+ return function validate(_x) {
103
+ return _ref2.apply(this, arguments);
104
+ };
105
+ }();
106
+
107
+ var loginRight = [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LogoImage.LogoImage, {}, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
108
+ className: "credenciales",
109
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
110
+ fontFamily: _variables.FontFamily.AvenirNext,
111
+ color: _variables.GlobalColors.s5,
112
+ text: "Ingresa tus credenciales"
113
+ })
114
+ }, "2"), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
115
+ className: "user",
116
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
117
+ className: "name-registration-user",
118
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
119
+ inputType: "text",
120
+ inputId: "nameInput",
121
+ label: "Nombre",
122
+ inputPlaceHolder: "Nombre"
123
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
124
+ inputType: "text",
125
+ inputId: "lastNameInput",
126
+ label: "Apellido",
127
+ inputPlaceHolder: "Apellido"
128
+ })]
129
+ }), emptyName && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
130
+ children: "Ingrese su nombre"
131
+ }), emptyLastName && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
132
+ children: "Ingrese sus apellidos"
133
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
134
+ inputType: "text",
135
+ inputId: "emailInput",
136
+ label: "Correo electrónico",
137
+ inputPlaceHolder: "username@contentoh.com"
138
+ }), emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
139
+ children: "Ingrese su correo"
140
+ }), invalidEmail && !emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
141
+ children: "Ingrese un correo v\xE1lido"
142
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
143
+ inputType: "text",
144
+ inputId: "jobInput",
145
+ label: "Puesto laboral",
146
+ inputPlaceHolder: "Puesto dentro de la empresa"
147
+ }), emptyJob && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
148
+ children: "Ingrese su puesto"
149
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
150
+ text: "Teléfono",
151
+ headerType: "input-name-header"
152
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
153
+ className: "phone-registration-user",
154
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
155
+ name: "select",
156
+ className: "phone-options",
157
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
158
+ children: "+52"
159
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
160
+ children: "+54"
161
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
162
+ children: "+57"
163
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
164
+ children: "+506"
165
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
166
+ children: "+593"
167
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
168
+ children: "+503"
169
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
170
+ children: "+504"
171
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
172
+ children: "+507"
173
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
174
+ children: "+51"
175
+ })]
176
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralInput.GeneralInput, {
177
+ inputId: "phoneInput",
178
+ inputType: "text",
179
+ inputPlaceholder: "Teléfono"
180
+ })]
181
+ }), emptyPhone && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
182
+ children: "Ingrese su n\xFAmero de tel\xE9fono"
183
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
184
+ text: "País",
185
+ headerType: "input-name-header"
186
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
187
+ name: "select",
188
+ className: "country-options",
189
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
190
+ value: "value1",
191
+ selected: true,
192
+ children: "Selecciona tu pa\xEDs"
193
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
194
+ value: "value2",
195
+ children: "Argentina"
196
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
197
+ value: "value3",
198
+ children: "Colombia"
199
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
200
+ value: "value2",
201
+ children: "Ecuador"
202
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
203
+ value: "value3",
204
+ children: "El Salvador"
205
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
206
+ value: "value2",
207
+ children: "Honduras"
208
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
209
+ value: "value3",
210
+ children: "M\xE9xico"
211
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
212
+ value: "value2",
213
+ children: "Panam\xE1"
214
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
215
+ value: "value3",
216
+ children: "Per\xFA"
217
+ })]
218
+ }), emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
219
+ children: "Seleccione su pa\xEDs"
220
+ })]
221
+ }, "3"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
222
+ className: "button-end",
223
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
224
+ buttonType: "general-default-button",
225
+ label: "Enviar",
226
+ onClick: function onClick(e) {
227
+ return validate(e);
228
+ }
229
+ })
230
+ }, "4"), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
231
+ className: "progress-bar",
232
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
233
+ className: "progress-bar-first-step"
234
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
235
+ className: "progress-bar-registration"
236
+ })]
237
+ }, "5"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
238
+ text: "Paso 1",
239
+ headerType: "date-header",
240
+ color: _variables.GlobalColors.s4
241
+ }, "6"), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
242
+ className: "new-login",
243
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
244
+ className: "pre-registro",
245
+ children: ["\xBFYa tienes una cuenta?", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
246
+ children: " Inicia Sesi\xF3n"
247
+ })]
248
+ })
249
+ }, "7")];
250
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
251
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
252
+ className: "home-retailer",
253
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CarouselImagesLogin.CarouselImagesLogin, {
254
+ panelImg: imageArrayCarousel,
255
+ panelText: textCarousel,
256
+ panelColor: backogroundColorCarousel
257
+ })
258
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
259
+ className: "home-login-retailer",
260
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GradientPanel.GradientPanel, {
261
+ componentsArray: loginRight,
262
+ panelType: "home-login",
263
+ panelColor: _variables.GlobalColors.white
264
+ })
265
+ })]
266
+ });
267
+ };
268
+
269
+ exports.RegistrationLoginFirstStep = RegistrationLoginFirstStep;
@@ -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 width: 100%;\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 .home-login-retailer,\n .home-retailer {\n width: 50%;\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s4, _variables.GlobalColors.magenta_s2);
19
+
20
+ exports.Container = Container;
@@ -84,8 +84,7 @@ var _jsxRuntime = require("react/jsx-runtime");
84
84
  var reducerImages = function reducerImages(state, action) {
85
85
  var _action$init, _action$init$inputsBy;
86
86
 
87
- var _state$values = state.values,
88
- values = _state$values === void 0 ? [] : _state$values,
87
+ var values = state.values,
89
88
  attrForImgs = state.attrForImgs,
90
89
  inputsByRetailer = state.inputsByRetailer;
91
90
 
@@ -157,7 +156,11 @@ var reducerImages = function reducerImages(state, action) {
157
156
 
158
157
  var orderedImages = [];
159
158
  var imageIdArray = [];
160
- if (action !== null && action !== void 0 && action.retailerId && !_inputsByRetailer[action.retailerId]) _inputsByRetailer[action.retailerId] = [];
159
+
160
+ if (action !== null && action !== void 0 && action.retailerId && !_inputsByRetailer[action.retailerId]) {
161
+ _inputsByRetailer[action.retailerId] = [];
162
+ }
163
+
161
164
  action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
162
165
  imageIdArray.push(input.id_image);
163
166
  valuesInitial.forEach(function (value) {
@@ -167,7 +170,7 @@ var reducerImages = function reducerImages(state, action) {
167
170
  inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
168
171
  return imageIdArray.includes(input.id);
169
172
  });
170
- if (orderedImages.length > 0) values = orderedImages;
173
+ values = orderedImages.length > 0 ? orderedImages : [];
171
174
  } catch (error) {
172
175
  console.log(error);
173
176
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.2.82",
3
+ "version": "21.2.84",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -9,29 +9,30 @@ const Template = (args) => <Dashboard {...args} />;
9
9
  export const DashboardDeafult = Template.bind({});
10
10
  DashboardDeafult.args = {
11
11
  user: {
12
- id_user: 425,
13
- name: "Auditor QA",
14
- last_name: " ",
15
- email: "ladiboh785@mi166.com",
16
- position: "Tester",
17
- telephone: null,
18
- country: null,
19
- id_company: 254,
20
- id_cognito: "23a3f496-4e38-4e12-9bf5-7f90b77a2f35",
12
+ id_user: 1236,
13
+ name: "THD",
14
+ last_name: "Proveedor",
15
+ email: "thd@allfreemail.net",
16
+ position: "Prod test",
17
+ telephone: "+523111111111",
18
+ country: "México",
19
+ id_company: 816,
20
+ id_cognito: "d660ccca-f906-4970-892c-6d152e832e5d",
21
21
  birth_Date: null,
22
22
  about_me: null,
23
23
  zip_code: null,
24
24
  address: null,
25
25
  job: null,
26
26
  id_stripe: null,
27
- id_role: 6,
27
+ id_role: 0,
28
28
  active: 1,
29
29
  is_retailer: 0,
30
- email_notify: null,
30
+ email_notify: 1,
31
+ is_superadmin: 0,
31
32
  membership: {
32
- id: 750,
33
- start_date: "2022-01-07T21:32:54.000Z",
34
- end_date: "2023-01-07T21:32:54.000Z",
33
+ id: 797,
34
+ start_date: "2022-06-19T04:18:39.000Z",
35
+ end_date: "2023-06-19T04:18:39.000Z",
35
36
  planID: 6,
36
37
  plan: "prod_KvGd6YSTJyR3AP",
37
38
  name: "Plan Small",
@@ -39,7 +40,37 @@ DashboardDeafult.args = {
39
40
  products_limit: "1000",
40
41
  type: "Enterprise",
41
42
  },
42
- src: "https://content-management-profile-prod.s3.amazonaws.com/id-425/425.png?1666639556174",
43
+ src: "https://content-management-profile-prod.s3.amazonaws.com/id-1236/1236.png?1668676098688",
44
+ },
45
+ company: {
46
+ id_company: 816,
47
+ trade_name: "Prod Test",
48
+ company_name: "Prod Test",
49
+ rfc: "ASER12345",
50
+ adress: "Av. Insurgentes",
51
+ about_company: null,
52
+ telephone: null,
53
+ web_site: null,
54
+ zip_code: null,
55
+ email: null,
56
+ social_link: null,
57
+ is_retailer: 0,
58
+ financedRetailers: [
59
+ {
60
+ id: 58,
61
+ name: "The Home Depot Golden",
62
+ country: "México",
63
+ id_region: 1,
64
+ active: 1,
65
+ },
66
+ {
67
+ id: 59,
68
+ name: "The Home Depot Platinum",
69
+ country: "México",
70
+ id_region: 1,
71
+ active: 1,
72
+ },
73
+ ],
43
74
  },
44
- jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zW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IwKWA0U0kboKUb97j8wCxGGP4oArrNH9yuwlwCC5dW2eyF1MKBDb4zPAnKmKM3IR-iFuyl9kAuo88YAas8o8pJ3_oc49NJ6ti2yY2hUyDFiMYlhjo-nDGMK1hQqFqjTPvrCV71H7P2vVuFHkkln9G-MbQ",
45
76
  };
@@ -59,7 +59,7 @@ export const Dashboard = ({ jwt, user, company }) => {
59
59
  };
60
60
 
61
61
  const getRetailers = async () => {
62
- const isTHDUser = [657, 818, 819].includes(user.id_company);
62
+ const isTHDUser = user.is_retailer && company.retailers;
63
63
  const retailersResponse = await axios.get(
64
64
  `${process.env.REACT_APP_RETAILER_ENDPOINT}`,
65
65
  {
@@ -78,13 +78,21 @@ export const Dashboard = ({ jwt, user, company }) => {
78
78
  };
79
79
 
80
80
  const loadProductsByStatus = async (orderByStatus, filter) => {
81
+ const isTHDUser = user.is_retailer && company.retailers;
82
+ const isProvider = !user.is_retailer && user.id_role === 0;
83
+ const isCollaborator = user.id_role > 0;
81
84
  const { ordersBydate, ordersByStatus } =
82
85
  (await loadProductVersions(orderByStatus)) || {};
83
86
 
84
- const { total = 0, R = 0, PA = 0, Ex = 0 } = ordersByStatus;
87
+ const { total = 0, R = 0, PA = 0, Ex = 0, ACA = 0 } = ordersByStatus;
88
+ let productsFinished = 0;
89
+ if (isTHDUser) productsFinished = Ex;
90
+ if (isProvider) productsFinished = ACA;
91
+ if (isCollaborator) productsFinished = Ex + ACA;
92
+
85
93
  const inProcess = Object.keys(ordersByStatus).reduce(
86
94
  (prev, curr) =>
87
- !["total", "PA", "R", "Ex"].includes(curr)
95
+ !["total", "PA", "R", "Ex", "ACA"].includes(curr)
88
96
  ? prev + ordersByStatus[curr]
89
97
  : prev,
90
98
  0
@@ -94,11 +102,12 @@ export const Dashboard = ({ jwt, user, company }) => {
94
102
  ? metricsData[0]
95
103
  : { label: "Productos totales", value: total },
96
104
  ];
105
+
97
106
  metricsArray.push(
98
107
  { label: "Productos filtrados", value: total },
99
108
  { label: "Productos sin asignar", value: PA + R },
100
109
  { label: "Productos en proceso", value: inProcess },
101
- { label: "Productos terminados", value: Ex }
110
+ { label: "Productos terminados", value: productsFinished }
102
111
  );
103
112
  setMetricsData(metricsArray);
104
113
  setTotalCount(total);
@@ -45,7 +45,7 @@ import { useCloseModal } from "../../../global-files/customHooks";
45
45
  import { CreateVersion } from "../../organisms/CreateVersion";
46
46
 
47
47
  const reducerImages = (state, action) => {
48
- let { values = [], attrForImgs, inputsByRetailer } = state;
48
+ let { values, attrForImgs, inputsByRetailer } = state;
49
49
  switch (action.action) {
50
50
  case "init":
51
51
  const newInputsByRetailer = {};
@@ -100,7 +100,7 @@ const reducerImages = (state, action) => {
100
100
  imageIdArray.includes(input.id)
101
101
  );
102
102
 
103
- if (orderedImages.length > 0) values = orderedImages;
103
+ values = orderedImages.length > 0 ? orderedImages : [];
104
104
  } catch (error) {
105
105
  console.log(error);
106
106
  }
@@ -877,10 +877,11 @@ export const ProviderProductEdition = ({
877
877
  const newProductEdit = productEdit;
878
878
  newProductEdit.product[sectionStatusKey] = serviceStatus;
879
879
  setProductEdit(newProductEdit);
880
- const showSurveyByProvider = !user.is_retailer && orderStatus[orderId] === "AP";
881
- const showSurveyByRetailer = user.is_retailer && orderStatus[orderId] === "ACA";
882
- showSurvey &&
883
- showSurvey(showSurveyByProvider || showSurveyByRetailer);
880
+ const showSurveyByProvider =
881
+ !user.is_retailer && orderStatus[orderId] === "AP";
882
+ const showSurveyByRetailer =
883
+ user.is_retailer && orderStatus[orderId] === "ACA";
884
+ showSurvey && showSurvey(showSurveyByProvider || showSurveyByRetailer);
884
885
  } else {
885
886
  res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
886
887
  headers: {
@@ -35,7 +35,7 @@ import { useCloseModal } from "../../../global-files/customHooks";
35
35
  import { CreateVersion } from "../../organisms/CreateVersion";
36
36
 
37
37
  const reducerImages = (state, action) => {
38
- let { values = [], attrForImgs, inputsByRetailer } = state;
38
+ let { values, attrForImgs, inputsByRetailer } = state;
39
39
  switch (action.action) {
40
40
  case "init":
41
41
  const newInputsByRetailer = {};
@@ -80,8 +80,9 @@ const reducerImages = (state, action) => {
80
80
  try {
81
81
  const orderedImages = [];
82
82
  const imageIdArray = [];
83
- if (action?.retailerId && !inputsByRetailer[action.retailerId])
83
+ if (action?.retailerId && !inputsByRetailer[action.retailerId]) {
84
84
  inputsByRetailer[action.retailerId] = [];
85
+ }
85
86
  action.retailerId &&
86
87
  inputsByRetailer[action.retailerId]?.filter((input) => {
87
88
  imageIdArray.push(input.id_image);
@@ -89,12 +90,10 @@ const reducerImages = (state, action) => {
89
90
  if (value.image_id === input.id_image) orderedImages.push(value);
90
91
  });
91
92
  });
92
-
93
93
  inputs = inputsInitial?.filter((input) =>
94
94
  imageIdArray.includes(input.id)
95
95
  );
96
-
97
- if (orderedImages.length > 0) values = orderedImages;
96
+ values = orderedImages.length > 0 ? orderedImages : [];
98
97
  } catch (error) {
99
98
  console.log(error);
100
99
  }