contentoh-components-library 21.6.57 → 21.6.59

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 (49) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +90 -135
  3. package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +148 -162
  4. package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +16 -0
  5. package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +1 -0
  6. package/dist/components/pages/CreatorsProductEdition/sections/ImageGallery.js +433 -0
  7. package/dist/components/pages/CreatorsProductEdition/sections/NoticeDialog.js +155 -0
  8. package/dist/components/pages/CreatorsProductEdition/sections/RejectDialog.js +201 -0
  9. package/dist/components/pages/CreatorsProductEdition/sections/VersionDrawer.js +615 -0
  10. package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +3 -31
  11. package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +55 -30
  12. package/dist/components/pages/CreatorsProductEdition/stories/products.js +923 -0
  13. package/dist/components/pages/CreatorsProductEdition/styles.js +27 -7
  14. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +2 -1
  15. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +325 -10
  16. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.reducer.js +12 -2
  17. package/dist/components/pages/ProviderProductEdition/index.js +486 -231
  18. package/dist/index.js +13 -0
  19. package/package.json +1 -1
  20. package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +777 -0
  21. package/src/components/pages/CreatorsProductEdition/constants.js +21 -0
  22. package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +2238 -0
  23. package/src/components/pages/CreatorsProductEdition/index.js +19 -0
  24. package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +357 -0
  25. package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +144 -0
  26. package/src/components/pages/CreatorsProductEdition/sections/CommentBox.jsx +183 -0
  27. package/src/components/pages/CreatorsProductEdition/sections/ImageGallery.jsx +269 -0
  28. package/src/components/pages/CreatorsProductEdition/sections/ImagePanel.jsx +332 -0
  29. package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +385 -0
  30. package/src/components/pages/CreatorsProductEdition/sections/NoticeDialog.jsx +111 -0
  31. package/src/components/pages/CreatorsProductEdition/sections/ProductHeader.jsx +305 -0
  32. package/src/components/pages/CreatorsProductEdition/sections/ProductMedia.jsx +101 -0
  33. package/src/components/pages/CreatorsProductEdition/sections/RejectDialog.jsx +125 -0
  34. package/src/components/pages/CreatorsProductEdition/sections/RetailerMenu.jsx +129 -0
  35. package/src/components/pages/CreatorsProductEdition/sections/ServiceActions.jsx +382 -0
  36. package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +37 -0
  37. package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +187 -0
  38. package/src/components/pages/CreatorsProductEdition/sections/VariantsPanel.jsx +311 -0
  39. package/src/components/pages/CreatorsProductEdition/sections/VersionDrawer.jsx +357 -0
  40. package/src/components/pages/CreatorsProductEdition/sections/tokens.js +63 -0
  41. package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +111 -0
  42. package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +85 -0
  43. package/src/components/pages/CreatorsProductEdition/stories/products.js +966 -0
  44. package/src/components/pages/CreatorsProductEdition/styles.js +178 -0
  45. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +1 -0
  46. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +201 -0
  47. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.reducer.js +12 -0
  48. package/src/components/pages/ProviderProductEdition/index.js +228 -7
  49. package/src/index.js +1 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm test *)"
5
+ ]
6
+ }
7
+ }
@@ -21,30 +21,12 @@ var _utils = require("../RetailerProductEdition/utils");
21
21
 
22
22
  var _assets = require("../../../global-files/digital-assets/assets.reducer");
23
23
 
24
- var _GeneralButton = require("../../atoms/GeneralButton");
25
-
26
- var _GenericModal = require("../../atoms/GenericModal");
27
-
28
- var _Loading = require("../../atoms/Loading");
29
-
30
- var _ScreenHeader = require("../../atoms/ScreenHeader");
31
-
32
- var _ButtonV = require("../../atoms/ButtonV2");
33
-
34
24
  var _GalleryTrayTabs = require("../../molecules/GalleryTrayTabs");
35
25
 
36
26
  var _HeaderTop = require("../../molecules/HeaderTop");
37
27
 
38
- var _index = require("../../molecules/TagAndInput/index");
39
-
40
28
  var _InputGroup = require("../../organisms/InputGroup");
41
29
 
42
- var _ProductImageModal = require("../../organisms/ProductImageModal");
43
-
44
- var _VersionSelector = require("../../organisms/VersionSelector");
45
-
46
- var _Modal = require("../../organisms/Modal");
47
-
48
30
  var _LinkVariantsModal = require("../../organisms/LinkVariantsModal");
49
31
 
50
32
  var _UnlinkVariantModal = require("../../organisms/UnlinkVariantModal");
@@ -77,10 +59,33 @@ var _VariantsPanel = require("./sections/VariantsPanel");
77
59
 
78
60
  var _CommentBox = require("./sections/CommentBox");
79
61
 
62
+ var _NoticeDialog = require("./sections/NoticeDialog");
63
+
64
+ var _RejectDialog = require("./sections/RejectDialog");
65
+
66
+ var _ImageGallery = require("./sections/ImageGallery");
67
+
68
+ var _VersionDrawer = require("./sections/VersionDrawer");
69
+
70
+ var _tokens = require("./sections/tokens");
71
+
80
72
  var _jsxRuntime = require("react/jsx-runtime");
81
73
 
82
74
  var _excluded = ["attributes"];
83
75
 
76
+ // Aviso cuando el producto no tiene contratado el servicio de la pestaña.
77
+ var NoService = function NoService() {
78
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
79
+ sx: {
80
+ fontFamily: _tokens.FONTS.Raleway,
81
+ fontSize: 14,
82
+ color: _tokens.COLORS.s5,
83
+ py: 1
84
+ },
85
+ children: "No cuentas con este servicio"
86
+ });
87
+ };
88
+
84
89
  var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
85
90
  var _state$errors, _pendingPropagation$k, _family$variants, _variantGroup$members, _variantGroup$group, _state$product, _state$product2, _state$product3, _state$active_retaile, _state$product4, _state$product5, _state$product6, _variantGroup$group2, _location$state, _location$state2, _state$active_retaile2, _state$active_retaile3, _state$images_values$, _state$images_values, _state$images_values$2, _state$product7, _state$active_retaile4, _state$active_percent, _state$active_percent2, _state$active_percent3, _state$active_retaile5, _state$active_retaile6, _state$active_retaile7, _state$product8, _state$services, _state$services$datas, _state$product9, _state$product10, _state$datasheets_inp, _state$datasheets_inp2, _state$product11;
86
91
 
@@ -436,19 +441,34 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
436
441
  alt: "error",
437
442
  width: 64,
438
443
  height: 64
439
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
440
- text: "No pudimos cargar el producto",
441
- headerType: "input-name-header"
442
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
443
- style: {
444
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
445
+ sx: {
446
+ fontFamily: _tokens.FONTS.Raleway,
447
+ fontSize: 16,
448
+ color: _tokens.COLORS.s5
449
+ },
450
+ children: "No pudimos cargar el producto"
451
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
452
+ sx: {
444
453
  color: "#666",
445
- maxWidth: 420
454
+ maxWidth: 420,
455
+ fontSize: 14
446
456
  },
447
457
  children: state.errors[0] || "Ocurrió un error al cargar la información del producto."
448
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
449
- buttonType: "general-button-default",
450
- label: "Reintentar",
451
- onClick: handleRetryLoad
458
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
459
+ variant: "contained",
460
+ disableElevation: true,
461
+ onClick: handleRetryLoad,
462
+ sx: {
463
+ textTransform: "none",
464
+ borderRadius: "20px",
465
+ px: 4,
466
+ bgcolor: _tokens.COLORS.magenta_s2,
467
+ "&:hover": {
468
+ bgcolor: _tokens.COLORS.secondary_magenta
469
+ }
470
+ },
471
+ children: "Reintentar"
452
472
  })]
453
473
  })
454
474
  });
@@ -544,110 +564,40 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
544
564
  return setPorDesvincular(null);
545
565
  },
546
566
  onUnlinked: handleOnUnlinked
547
- })), showRejectModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
548
- title: rejectAll ? "Agregar mensaje para rechazar todo" : "Agregar mensaje de rechazo",
549
- show: showRejectModal,
550
- customComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
551
- inputType: "textarea",
552
- inputId: "modal-message-box",
553
- index: 0,
554
- color: "white"
555
- }),
556
- buttons: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
557
- type: "white",
558
- label: "Cancelar",
559
- size: 12,
560
- onClick: function onClick() {
561
- setShowRejectModal(false);
562
- }
563
- }, "btn-Cancelar"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
564
- type: "pink",
565
- label: "Aceptar",
566
- size: 12,
567
- onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
568
- var elements, isMessageEmpty, container, existingAlert, alert, fullMessage;
567
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RejectDialog.RejectDialog, {
568
+ open: showRejectModal,
569
+ rejectAll: rejectAll,
570
+ onCancel: function onCancel() {
571
+ return setShowRejectModal(false);
572
+ },
573
+ onConfirm: /*#__PURE__*/function () {
574
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(message) {
569
575
  return _regenerator.default.wrap(function _callee$(_context) {
570
576
  while (1) {
571
577
  switch (_context.prev = _context.next) {
572
578
  case 0:
573
- elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
574
-
575
- if (!(!elements || elements.length === 0)) {
576
- _context.next = 4;
577
- break;
578
- }
579
-
580
- console.error("Elemento no encontrado");
581
- return _context.abrupt("return");
582
-
583
- case 4:
584
- isMessageEmpty = Array.from(elements).every(function (el) {
585
- var body = el.innerHTML;
586
- return !body || body.replace(/<.*?\/?>/gm, "").trim() === "";
587
- });
588
-
589
- if (!isMessageEmpty) {
590
- _context.next = 10;
591
- break;
592
- }
593
-
594
- container = document.querySelector(".container-customComponent");
595
- existingAlert = container.querySelector(".alert-error");
596
-
597
- if (!existingAlert) {
598
- alert = document.createElement("div");
599
- alert.className = "alert-error";
600
- alert.style.cssText = "\n color: #d32f2f;\n background-color: #ffebee;\n border: 1px solid #ef5350;\n border-radius: 4px;\n padding: 12px 16px;\n margin-top: 10px;\n font-size: 14px;\n display: flex;\n align-items: center;\n gap: 8px;\n font-family: 'Roboto', sans-serif;\n text-align: center;\n ";
601
- alert.innerHTML = "<span>El mensaje no puede estar vac\xEDo.</span>";
602
- container.appendChild(alert);
603
- }
579
+ _context.next = 2;
580
+ return createComment(message, token);
604
581
 
605
- return _context.abrupt("return");
606
-
607
- case 10:
608
- fullMessage = Array.from(elements).map(function (element) {
609
- return element.innerHTML;
610
- }).join("").replace(/<br\s*\/?>/gi, "\n");
611
- _context.next = 13;
612
- return createComment(fullMessage, token);
613
-
614
- case 13:
582
+ case 2:
615
583
  rejectAll ? sendBulkEvaluation("R") : sendSingleEvaluation("R");
616
584
  setShowRejectModal(false);
617
585
 
618
- case 15:
586
+ case 4:
619
587
  case "end":
620
588
  return _context.stop();
621
589
  }
622
590
  }
623
591
  }, _callee);
624
- }))
625
- }, "btn-Aceptar")]
626
- }), state.modal.show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
627
- componentsArray: [state.modal.image && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
628
- src: state.modal.image,
629
- alt: "modal icon"
630
- }, "1"), state.modal.title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
631
- headerType: "retailer-name-header",
632
- text: state.modal.title,
633
- color: "white"
634
- }, "2"), state.modal.message && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
635
- headerType: "retailer-name-header",
636
- text: state.modal.message,
637
- color: "white"
638
- }, "3"), state.modal.buttons && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
639
- style: {
640
- marginTop: "16px"
641
- },
642
- children: state.modal.buttons.map(function (button, index) {
643
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
644
- buttonType: button.buttonType,
645
- label: button.text,
646
- onClick: button.action
647
- }, index);
648
- })
649
- }, "4")].filter(Boolean),
650
- onClick: function onClick() {
592
+ }));
593
+
594
+ return function (_x) {
595
+ return _ref2.apply(this, arguments);
596
+ };
597
+ }()
598
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_NoticeDialog.NoticeDialog, {
599
+ modal: state.modal,
600
+ onClose: function onClose() {
651
601
  return dispatch({
652
602
  type: "SET_MODAL",
653
603
  payload: {
@@ -658,12 +608,14 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
658
608
  }
659
609
  });
660
610
  }
661
- }), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
611
+ }), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageGallery.ImageGallery, {
662
612
  images: state.images_values,
613
+ initialIndex: state.current_image,
663
614
  setShowModal: setShowModal,
664
615
  approveRejectButtons: canShowSingleEvaluationButtons(),
665
616
  sendToFacilitator: handleOnSendEvaluationToFacilitator
666
- }), showVersionSelector && /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionSelector.VersionSelector, {
617
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionDrawer.VersionDrawer, {
618
+ open: showVersionSelector,
667
619
  modalId: "version-selector",
668
620
  articleId: state.product.id_article,
669
621
  setVersion: handleOnChangeProductVersion,
@@ -794,7 +746,19 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
794
746
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
795
747
  className: "services-information-container",
796
748
  id: "services-information-container",
797
- children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
749
+ children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
750
+ alignItems: "center",
751
+ justifyContent: "center",
752
+ sx: {
753
+ py: 6
754
+ },
755
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
756
+ size: 32,
757
+ sx: {
758
+ color: _tokens.COLORS.magenta_s2
759
+ }
760
+ })
761
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
798
762
  children: [state.active_tab === "Descripción" && (((_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
799
763
  activeSection: state.active_tab,
800
764
  inputGroup: state.descriptions_inputs[0],
@@ -810,10 +774,7 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
810
774
  setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
811
775
  dinamicHeight: true,
812
776
  compare: compare
813
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
814
- text: "No cuentas con este servicio",
815
- headerType: "input-name-header"
816
- })), state.active_tab === "Ficha técnica" && (((_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
777
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(NoService, {})), state.active_tab === "Ficha técnica" && (((_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
817
778
  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) {
818
779
  var _state$services2, _state$services2$data;
819
780
 
@@ -831,10 +792,7 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
831
792
  compare: compare
832
793
  }, index + "-" + state.active_retailer.retailer);
833
794
  })
834
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
835
- text: "No cuentas con este servicio",
836
- headerType: "input-name-header"
837
- })), state.active_tab === "Imágenes" && (((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagesSection.ImagesSection, {
795
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(NoService, {})), state.active_tab === "Imágenes" && (((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagesSection.ImagesSection, {
838
796
  imagesValues: state.images_values,
839
797
  selectedImages: state.selected_images,
840
798
  imageLayout: imageLayout,
@@ -866,10 +824,7 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
866
824
  getInputProps: getInputProps,
867
825
  isDragActive: isDragActive,
868
826
  openFilePicker: open
869
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
870
- text: "No cuentas con este servicio",
871
- headerType: "input-name-header"
872
- }))]
827
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(NoService, {}))]
873
828
  })
874
829
  }), (isUserAssignedToService(state.active_tab) || isAuditorAssigned()) && state.product["".concat((0, _utils.getConceptByTab)(state.active_tab), "_status")] !== "NS" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CommentBox.CommentBox, {
875
830
  comment: state.comment,
@@ -890,7 +845,7 @@ var CreatorsProductEditionView = function CreatorsProductEditionView(_ref) {
890
845
  })]
891
846
  })]
892
847
  })]
893
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChangeStatusModal.default, {
848
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ReusedModalsStyles, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChangeStatusModal.default, {
894
849
  state: state,
895
850
  open: openChangeStatusModal,
896
851
  onClose: function onClose() {