contentoh-components-library 21.5.88 → 21.5.89

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.
@@ -228,39 +228,75 @@ RetailerProductEditionDefault.args = {
228
228
  // },
229
229
  // "src": "https://content-management-profile.s3.amazonaws.com/id-442/442.png?1760636567736"
230
230
  // },
231
+ // user: {
232
+ // id_user: 426,
233
+ // name: "Especialista Textos",
234
+ // last_name: null,
235
+ // email: "karafe3218@mom2kid.com",
236
+ // position: "Tester",
237
+ // telephone: null,
238
+ // country: null,
239
+ // id_company: 254,
240
+ // id_cognito: "8d010214-5bfa-43c3-96fb-c556dc05774b",
241
+ // birth_Date: null,
242
+ // about_me: null,
243
+ // zip_code: null,
244
+ // address: null,
245
+ // job: null,
246
+ // id_stripe: null,
247
+ // id_role: 7,
248
+ // active: 1,
249
+ // is_retailer: 0,
250
+ // email_notify: null,
251
+ // is_user_tech: null,
252
+ // is_onboarding: 0,
253
+ // membership: {
254
+ // id: 750,
255
+ // start_date: "2022-01-07T21:32:54.000Z",
256
+ // end_date: "2023-01-07T21:32:54.000Z",
257
+ // planID: 6,
258
+ // plan: "prod_KvGd6YSTJyR3AP",
259
+ // name: "Plan Small",
260
+ // user_limit: "10",
261
+ // products_limit: "1000",
262
+ // type: "Enterprise",
263
+ // },
264
+ // src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1768253179478",
265
+ // },
266
+ // AUDITORES
231
267
  user: {
232
- id_user: 426,
233
- name: "Especialista Textos",
234
- last_name: null,
235
- email: "karafe3218@mom2kid.com",
236
- position: "Tester",
237
- telephone: null,
238
- country: null,
239
- id_company: 254,
240
- id_cognito: "8d010214-5bfa-43c3-96fb-c556dc05774b",
241
- birth_Date: null,
242
- about_me: null,
243
- zip_code: null,
244
- address: null,
245
- job: null,
246
- id_stripe: null,
247
- id_role: 7,
248
- active: 1,
249
- is_retailer: 0,
250
- email_notify: null,
251
- is_user_tech: null,
252
- is_onboarding: 0,
253
- membership: {
254
- id: 750,
255
- start_date: "2022-01-07T21:32:54.000Z",
256
- end_date: "2023-01-07T21:32:54.000Z",
257
- planID: 6,
258
- plan: "prod_KvGd6YSTJyR3AP",
259
- name: "Plan Small",
260
- user_limit: "10",
261
- products_limit: "1000",
262
- type: "Enterprise"
268
+ "id_user": 423,
269
+ "name": "Facilitador Textos",
270
+ "last_name": null,
271
+ "email": "bayadi1538@mnqlm.com",
272
+ "position": "Tester",
273
+ "telephone": null,
274
+ "country": null,
275
+ "id_company": 254,
276
+ "id_cognito": "0b66a4a9-7790-4034-a30a-c00808962867",
277
+ "birth_Date": null,
278
+ "about_me": null,
279
+ "zip_code": null,
280
+ "address": null,
281
+ "job": null,
282
+ "id_stripe": null,
283
+ "id_role": 4,
284
+ "active": 1,
285
+ "is_retailer": 0,
286
+ "email_notify": null,
287
+ "is_user_tech": null,
288
+ "is_onboarding": 0,
289
+ "membership": {
290
+ "id": 750,
291
+ "start_date": "2022-01-07T21:32:54.000Z",
292
+ "end_date": "2023-01-07T21:32:54.000Z",
293
+ "planID": 6,
294
+ "plan": "prod_KvGd6YSTJyR3AP",
295
+ "name": "Plan Small",
296
+ "user_limit": "10",
297
+ "products_limit": "1000",
298
+ "type": "Enterprise"
263
299
  },
264
- src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1768253179478"
300
+ "src": "https://content-management-profile-prod.s3.amazonaws.com/id-423/423.png?1778003423713"
265
301
  }
266
302
  };
@@ -96,7 +96,7 @@ var _material = require("@mui/material");
96
96
  var _jsxRuntime = require("react/jsx-runtime");
97
97
 
98
98
  var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
99
- var _location$state, _location$state2, _state$active_retaile4, _state$active_retaile5, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product6, _state$active_retaile6, _state$active_retaile7, _state$active_retaile8, _state$active_retaile9, _state$product7, _state$product8, _state$product9, _state$datasheets_inp, _state$datasheets_inp2, _state$product10, _state$images_values12, _state$comment;
99
+ var _location$state, _location$state2, _state$active_retaile4, _state$active_retaile5, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product8, _state$active_retaile6, _state$active_retaile7, _state$active_retaile8, _state$active_retaile9, _state$product9, _state$product10, _state$product11, _state$datasheets_inp, _state$datasheets_inp2, _state$product12, _state$images_values12, _state$comment;
100
100
 
101
101
  var tabsSections = _ref.tabsSections,
102
102
  _ref$productSelected = _ref.productSelected,
@@ -757,10 +757,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
757
757
  };
758
758
 
759
759
  var isAuditorAssigned = function isAuditorAssigned() {
760
- return state.product.id_auditor === user.id_user;
760
+ var _state$product5;
761
+
762
+ return ((_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.id_auditor) === (user === null || user === void 0 ? void 0 : user.id_user);
761
763
  };
762
764
 
763
765
  var isUserAssignedToService = function isUserAssignedToService(tab, rol) {
766
+ var _state$product6;
767
+
764
768
  var concept = (0, _utils.getConceptByTab)(state.active_tab);
765
769
  var allowedRoles = [1, 4, 5, 6, 7, 8];
766
770
  var validUser = allowedRoles.includes(user === null || user === void 0 ? void 0 : user.id_role); // Determinar rol por defecto si no se pasa
@@ -774,16 +778,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
774
778
  }
775
779
 
776
780
  var isAdmin = user.id_role === 1;
777
- var idUserAssigned = state.product["id_".concat(concept, "_").concat(rol)];
781
+ var idUserAssigned = (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6["id_".concat(concept, "_").concat(rol)];
778
782
  var isAssigned = idUserAssigned === user.id_user;
779
783
  return isAdmin || isAssigned && validUser;
780
784
  };
781
785
 
782
786
  var canShowSingleEvaluationButtons = function canShowSingleEvaluationButtons(action) {
783
- var _state$services_data$, _state$services_data$2;
787
+ var _state$services_data, _state$services_data$, _state$services_data$2;
784
788
 
785
789
  var concept = (0, _utils.getConceptByTab)(action || state.active_tab);
786
- var retailerStatus = (_state$services_data$ = state.services_data.find(function (srv) {
790
+ var retailerStatus = (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : (_state$services_data$ = _state$services_data.find(function (srv) {
787
791
  var _state$active_retaile2;
788
792
 
789
793
  return srv.id_retailer === ((_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id_retailer) && srv.service === concept;
@@ -826,9 +830,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
826
830
  };
827
831
 
828
832
  var handleOnClickSaveImages = function handleOnClickSaveImages() {
829
- var _state$product5, _state$product5$servi;
833
+ var _state$product7, _state$product7$servi;
830
834
 
831
- if (((_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : (_state$product5$servi = _state$product5.services) === null || _state$product5$servi === void 0 ? void 0 : _state$product5$servi.images) === 1) {
835
+ if (((_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : (_state$product7$servi = _state$product7.services) === null || _state$product7$servi === void 0 ? void 0 : _state$product7$servi.images) === 1) {
832
836
  saveImageAttrs(token);
833
837
  }
834
838
  };
@@ -985,7 +989,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
985
989
  var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
986
990
  var _state$product$id_ord, _state$active_retaile3;
987
991
 
988
- var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
992
+ var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
989
993
 
990
994
  return _regenerator.default.wrap(function _callee7$(_context7) {
991
995
  while (1) {
@@ -1121,7 +1125,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1121
1125
  return item;
1122
1126
  })), _objectSpread2)); //Actualizamos el services_data en el servicio específico del retailer actual
1123
1127
 
1124
- updatedServicesData = (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : _state$services_data.map(function (service) {
1128
+ updatedServicesData = (_state$services_data2 = state.services_data) === null || _state$services_data2 === void 0 ? void 0 : _state$services_data2.map(function (service) {
1125
1129
  return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, service), {}, {
1126
1130
  status: (service === null || service === void 0 ? void 0 : service.id_retailer) === retailerId && (service === null || service === void 0 ? void 0 : service.service) === concept ? newStatus : service === null || service === void 0 ? void 0 : service.status
1127
1131
  });
@@ -1231,7 +1235,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1231
1235
 
1232
1236
  var sendBulkEvaluation = /*#__PURE__*/function () {
1233
1237
  var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
1234
- var _state$services_data2, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, productInSession, updatedProductInSession;
1238
+ var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, productInSession, updatedProductInSession;
1235
1239
 
1236
1240
  return _regenerator.default.wrap(function _callee9$(_context9) {
1237
1241
  while (1) {
@@ -1245,7 +1249,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1245
1249
  evaluationArray = [];
1246
1250
  conceptArray = (0, _utils.getConceptsByRole)(user.id_role); // Crear todas las evaluaciones para cada servicio y retailer
1247
1251
 
1248
- (_state$services_data2 = state.services_data) === null || _state$services_data2 === void 0 ? void 0 : _state$services_data2.forEach(function (ret) {
1252
+ (_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret) {
1249
1253
  var service = ret.service,
1250
1254
  id_retailer = ret.id_retailer,
1251
1255
  status = ret.status;
@@ -1886,7 +1890,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1886
1890
  lists: state.images_values || [],
1887
1891
  activeImage: (_state$images_values10 = state.images_values) !== null && _state$images_values10 !== void 0 && _state$images_values10.values ? (_state$images_values11 = state.images_values) === null || _state$images_values11 === void 0 ? void 0 : _state$images_values11.values[state.current_image] : {},
1888
1892
  assignationsImages: state.collaborator_assignations["Imágenes"],
1889
- imagesStatus: ((_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.images_status) || "-",
1893
+ imagesStatus: ((_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.images_status) || "-",
1890
1894
  retailerSelected: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
1891
1895
  isRetailer: isRetailer,
1892
1896
  version: state.product.version,
@@ -1958,11 +1962,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1958
1962
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1959
1963
  className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
1960
1964
  children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1961
- children: [state.active_tab === "Descripción" && (((_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1965
+ children: [state.active_tab === "Descripción" && (((_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1962
1966
  activeSection: state.active_tab,
1963
1967
  inputGroup: state.descriptions_inputs[0],
1964
1968
  updatedDescriptions: state.updated_descriptions_inputs,
1965
- articleId: (_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.id_article,
1969
+ articleId: (_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.id_article,
1966
1970
  version: state.product.version,
1967
1971
  auditInputGroup: auditDescriptions[0],
1968
1972
  setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
@@ -1971,7 +1975,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1971
1975
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1972
1976
  text: "No cuentas con este servicio",
1973
1977
  headerType: "input-name-header"
1974
- })), state.active_tab === "Ficha técnica" && (((_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1978
+ })), state.active_tab === "Ficha técnica" && (((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1975
1979
  children: (_state$datasheets_inp = state.datasheets_inputs[0]) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp.data) === null || _state$datasheets_inp2 === void 0 ? void 0 : _state$datasheets_inp2.map(function (dataGroup, index) {
1976
1980
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1977
1981
  articleId: state.product.id_article,
@@ -1988,7 +1992,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1988
1992
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1989
1993
  text: "No cuentas con este servicio",
1990
1994
  headerType: "input-name-header"
1991
- })), state.active_tab === "Imágenes" && (((_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1995
+ })), state.active_tab === "Imágenes" && (((_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1992
1996
  children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1993
1997
  checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
1994
1998
  ,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.5.88",
3
+ "version": "21.5.89",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -238,39 +238,78 @@ RetailerProductEditionDefault.args = {
238
238
  // "src": "https://content-management-profile.s3.amazonaws.com/id-442/442.png?1760636567736"
239
239
  // },
240
240
 
241
+ // user: {
242
+ // id_user: 426,
243
+ // name: "Especialista Textos",
244
+ // last_name: null,
245
+ // email: "karafe3218@mom2kid.com",
246
+ // position: "Tester",
247
+ // telephone: null,
248
+ // country: null,
249
+ // id_company: 254,
250
+ // id_cognito: "8d010214-5bfa-43c3-96fb-c556dc05774b",
251
+ // birth_Date: null,
252
+ // about_me: null,
253
+ // zip_code: null,
254
+ // address: null,
255
+ // job: null,
256
+ // id_stripe: null,
257
+ // id_role: 7,
258
+ // active: 1,
259
+ // is_retailer: 0,
260
+ // email_notify: null,
261
+ // is_user_tech: null,
262
+ // is_onboarding: 0,
263
+ // membership: {
264
+ // id: 750,
265
+ // start_date: "2022-01-07T21:32:54.000Z",
266
+ // end_date: "2023-01-07T21:32:54.000Z",
267
+ // planID: 6,
268
+ // plan: "prod_KvGd6YSTJyR3AP",
269
+ // name: "Plan Small",
270
+ // user_limit: "10",
271
+ // products_limit: "1000",
272
+ // type: "Enterprise",
273
+ // },
274
+ // src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1768253179478",
275
+ // },
276
+
277
+ // AUDITORES
278
+
241
279
  user: {
242
- id_user: 426,
243
- name: "Especialista Textos",
244
- last_name: null,
245
- email: "karafe3218@mom2kid.com",
246
- position: "Tester",
247
- telephone: null,
248
- country: null,
249
- id_company: 254,
250
- id_cognito: "8d010214-5bfa-43c3-96fb-c556dc05774b",
251
- birth_Date: null,
252
- about_me: null,
253
- zip_code: null,
254
- address: null,
255
- job: null,
256
- id_stripe: null,
257
- id_role: 7,
258
- active: 1,
259
- is_retailer: 0,
260
- email_notify: null,
261
- is_user_tech: null,
262
- is_onboarding: 0,
263
- membership: {
264
- id: 750,
265
- start_date: "2022-01-07T21:32:54.000Z",
266
- end_date: "2023-01-07T21:32:54.000Z",
267
- planID: 6,
268
- plan: "prod_KvGd6YSTJyR3AP",
269
- name: "Plan Small",
270
- user_limit: "10",
271
- products_limit: "1000",
272
- type: "Enterprise",
280
+ "id_user": 423,
281
+ "name": "Facilitador Textos",
282
+ "last_name": null,
283
+ "email": "bayadi1538@mnqlm.com",
284
+ "position": "Tester",
285
+ "telephone": null,
286
+ "country": null,
287
+ "id_company": 254,
288
+ "id_cognito": "0b66a4a9-7790-4034-a30a-c00808962867",
289
+ "birth_Date": null,
290
+ "about_me": null,
291
+ "zip_code": null,
292
+ "address": null,
293
+ "job": null,
294
+ "id_stripe": null,
295
+ "id_role": 4,
296
+ "active": 1,
297
+ "is_retailer": 0,
298
+ "email_notify": null,
299
+ "is_user_tech": null,
300
+ "is_onboarding": 0,
301
+ "membership": {
302
+ "id": 750,
303
+ "start_date": "2022-01-07T21:32:54.000Z",
304
+ "end_date": "2023-01-07T21:32:54.000Z",
305
+ "planID": 6,
306
+ "plan": "prod_KvGd6YSTJyR3AP",
307
+ "name": "Plan Small",
308
+ "user_limit": "10",
309
+ "products_limit": "1000",
310
+ "type": "Enterprise"
273
311
  },
274
- src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1768253179478",
275
- },
312
+ "src": "https://content-management-profile-prod.s3.amazonaws.com/id-423/423.png?1778003423713"
313
+ }
314
+
276
315
  };
@@ -526,7 +526,7 @@ const RetailerProductEditionView = ({
526
526
  };
527
527
 
528
528
  const isAuditorAssigned = () => {
529
- return state.product.id_auditor === user.id_user;
529
+ return state.product?.id_auditor === user?.id_user;
530
530
  };
531
531
 
532
532
  const isUserAssignedToService = (tab, rol) => {
@@ -545,7 +545,7 @@ const RetailerProductEditionView = ({
545
545
  }
546
546
 
547
547
  const isAdmin = user.id_role === 1;
548
- const idUserAssigned = state.product[`id_${concept}_${rol}`];
548
+ const idUserAssigned = state.product?.[`id_${concept}_${rol}`];
549
549
  const isAssigned = idUserAssigned === user.id_user;
550
550
 
551
551
  return isAdmin || (isAssigned && validUser);
@@ -555,7 +555,7 @@ const RetailerProductEditionView = ({
555
555
  let concept = getConceptByTab(action || state.active_tab);
556
556
 
557
557
  const retailerStatus = state.services_data
558
- .find(
558
+ ?.find(
559
559
  (srv) =>
560
560
  srv.id_retailer === state.active_retailer?.id_retailer &&
561
561
  srv.service === concept,
@@ -567,6 +567,7 @@ const RetailerProductEditionView = ({
567
567
  const adminAuditorCanEvaluate =
568
568
  ["AC", "RP", "RCA", "SAC"].includes(retailerStatus) &&
569
569
  [1, 6].includes(user.id_role);
570
+
570
571
  return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
571
572
  };
572
573