contentoh-components-library 21.4.74 → 21.4.77
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.
- package/dist/assets/images/Icons/addv2.svg +8 -0
- package/dist/assets/images/Icons/checkv2.svg +8 -0
- package/dist/assets/images/Icons/options.svg +3 -0
- package/dist/assets/images/Icons/trash.svg +8 -0
- package/dist/assets/images/Icons/undo.svg +8 -0
- package/dist/assets/images/Icons/warningv2.svg +3 -0
- package/dist/assets/images/checkBox/checkrosa.svg +3 -0
- package/dist/assets/images/checkBox/checkverde.svg +3 -0
- package/dist/components/atoms/Avatar/index.js +3 -2
- package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +1 -1
- package/dist/components/atoms/ButtonV2/index.js +1 -1
- package/dist/components/atoms/ButtonV2/styles.js +1 -1
- package/dist/components/atoms/CheckBox/CheckBox.stories.js +8 -1
- package/dist/components/atoms/CheckBox/index.js +8 -0
- package/dist/components/atoms/CheckBox/styles.js +8 -1
- package/dist/components/atoms/GeneralButton/styles.js +6 -2
- package/dist/components/atoms/InputFormatter/styles.js +3 -3
- package/dist/components/atoms/ObservationFlag/ObservationFlag.stories.js +38 -0
- package/dist/components/atoms/ObservationFlag/index.js +52 -0
- package/dist/components/atoms/ObservationFlag/styles.js +18 -0
- package/dist/components/atoms/SliderToolTip/styles.js +1 -1
- package/dist/components/molecules/BoxAttribute/index.js +3 -3
- package/dist/components/molecules/BoxAttribute/styles.js +1 -1
- package/dist/components/molecules/BoxButtons/index.js +0 -1
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/GroupSelect/GroupSelect.stories.js +53 -0
- package/dist/components/molecules/GroupSelect/SelectItem.js +142 -0
- package/dist/components/molecules/GroupSelect/index.js +254 -0
- package/dist/components/molecules/GroupSelect/styles.js +25 -0
- package/dist/components/molecules/HeaderTop/index.js +68 -11
- package/dist/components/molecules/Phase/index.js +205 -43
- package/dist/components/molecules/Phase/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +8 -3
- package/dist/components/molecules/SignInLogin/index.js +36 -28
- package/dist/components/molecules/StripeCardSelector/CardSelector.stories.js +1 -2
- package/dist/components/organisms/Chat/Chat.stories.js +27 -8
- package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +350 -197
- package/dist/components/organisms/Chat/Footer/index.js +48 -39
- package/dist/components/organisms/Chat/index.js +49 -4
- package/dist/components/organisms/Chat/styles.js +1 -1
- package/dist/components/organisms/DashboardMetric/index.js +12 -6
- package/dist/components/organisms/DragAndDropPhases/DragAndDropPhases.stories.js +26 -1
- package/dist/components/organisms/DragAndDropPhases/index.js +262 -32
- package/dist/components/organisms/DragAndDropPhases/styles.js +8 -4
- package/dist/components/organisms/EditGroup/EditGroup.stories.js +39 -0
- package/dist/components/organisms/EditGroup/index.js +242 -0
- package/dist/components/organisms/EditGroup/styles.js +36 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +5 -3
- package/dist/components/organisms/InputGroup/index.js +1 -10
- package/dist/components/organisms/Modal/Modal.stories.js +2 -1
- package/dist/components/organisms/Modal/index.js +6 -1
- package/dist/components/organisms/Modal/styles.js +1 -1
- package/dist/components/organisms/VersionSelector/index.js +101 -169
- package/dist/components/pages/Dashboard/Dashboard.stories.js +33 -36
- package/dist/components/pages/Dashboard/index.js +37 -9
- package/dist/components/pages/ProviderProductEdition/index.js +120 -144
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +4 -0
- package/dist/components/pages/RetailerProductEdition/index.js +322 -406
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
- package/dist/global-files/data.js +11 -3
- package/dist/global-files/variables.js +7 -1
- package/dist/index.js +201 -58
- package/package.json +3 -1
- package/src/assets/images/Icons/addv2.svg +8 -0
- package/src/assets/images/Icons/checkv2.svg +8 -0
- package/src/assets/images/Icons/infoNR.svg +8 -0
- package/src/assets/images/Icons/options.svg +3 -0
- package/src/assets/images/Icons/trash.svg +8 -0
- package/src/assets/images/Icons/undo.svg +8 -0
- package/src/assets/images/Icons/warningv2.svg +3 -0
- package/src/assets/images/checkBox/checkrosa.svg +3 -0
- package/src/assets/images/checkBox/checkverde.svg +3 -0
- package/src/assets/images/flagsv2/highPriority.svg +3 -0
- package/src/assets/images/flagsv2/lowPriority.svg +3 -0
- package/src/assets/images/flagsv2/mediumPriority.svg +3 -0
- package/src/assets/images/flagsv2/noPriority.svg +3 -0
- package/src/assets/images/generalButton/closeIconWhite.svg +4 -0
- package/src/assets/images/generalButton/closeIconv2.svg +4 -0
- package/src/components/atoms/Avatar/index.js +8 -2
- package/src/components/atoms/ButtonV2/ButtonV2.stories.js +1 -0
- package/src/components/atoms/ButtonV2/index.js +1 -0
- package/src/components/atoms/ButtonV2/styles.js +16 -0
- package/src/components/atoms/CharsMissing/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/CharsMissing/index.js +60 -0
- package/src/components/atoms/CharsMissing/styles.js +44 -0
- package/src/components/atoms/CheckBox/CheckBox.stories.js +5 -0
- package/src/components/atoms/CheckBox/index.js +5 -1
- package/src/components/atoms/CheckBox/styles.js +9 -3
- package/src/components/atoms/FeatureTagv2/FeatureTagv2.stories.js +16 -0
- package/src/components/atoms/FeatureTagv2/index.js +10 -0
- package/src/components/atoms/FeatureTagv2/styles.js +56 -0
- package/src/components/atoms/GeneralButton/styles.js +46 -0
- package/src/components/atoms/GeneralInputv2/GeneralInputv2.stories.js +33 -0
- package/src/components/atoms/GeneralInputv2/index.js +155 -0
- package/src/components/atoms/GeneralInputv2/styles.js +67 -0
- package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +76 -0
- package/src/components/atoms/ImageCarousel/index.js +103 -0
- package/src/components/atoms/ImageCarousel/styles.js +79 -0
- package/src/components/atoms/InputFormatter/styles.js +9 -4
- package/src/components/atoms/InputFormatterv2/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/InputFormatterv2/index.js +148 -0
- package/src/components/atoms/InputFormatterv2/styles.js +39 -0
- package/src/components/atoms/InputImages/InputImages.stories.js +19 -0
- package/src/components/atoms/InputImages/index.js +25 -0
- package/src/components/atoms/InputImages/styles.js +17 -0
- package/src/components/atoms/NumberMandatory/NumberMandatory.stories.js +19 -0
- package/src/components/atoms/NumberMandatory/index.js +16 -0
- package/src/components/atoms/NumberMandatory/styles.js +11 -0
- package/src/components/atoms/ObservationFlag/ObservationFlag.stories.js +20 -0
- package/src/components/atoms/ObservationFlag/index.js +33 -0
- package/src/components/atoms/ObservationFlag/styles.js +3 -0
- package/src/components/atoms/PercentTag/PercentTag.stories.js +7 -0
- package/src/components/atoms/PercentTag/index.js +9 -0
- package/src/components/atoms/PercentTag/styles.js +69 -0
- package/src/components/atoms/PriorityFlagv2/PriorityFlagv2.stories.js +20 -0
- package/src/components/atoms/PriorityFlagv2/index.js +20 -0
- package/src/components/atoms/PriorityFlagv2/styles.js +6 -0
- package/src/components/atoms/ProductImagev2/ProductImagev2.stories.js +28 -0
- package/src/components/atoms/ProductImagev2/index.js +16 -0
- package/src/components/atoms/ProductImagev2/styles.js +62 -0
- package/src/components/atoms/Progress/Progress.stories.js +25 -0
- package/src/components/atoms/Progress/index.js +74 -0
- package/src/components/atoms/Progress/styles.js +98 -0
- package/src/components/atoms/RatingStars/RatingStars.stories.js +10 -0
- package/src/components/atoms/RatingStars/index.js +31 -0
- package/src/components/atoms/RatingStars/styles.js +28 -0
- package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +36 -0
- package/src/components/atoms/RetailerCatalog/index.js +49 -0
- package/src/components/atoms/RetailerCatalog/styles.js +30 -0
- package/src/components/atoms/RetailerOption/RetailerOption.stories.js +15 -0
- package/src/components/atoms/RetailerOption/index.js +53 -0
- package/src/components/atoms/RetailerOption/styles.js +41 -0
- package/src/components/atoms/RetailersList/RetailersList.stories.js +33 -0
- package/src/components/atoms/RetailersList/index.js +20 -0
- package/src/components/atoms/RetailersList/styles.js +19 -0
- package/src/components/atoms/ScreenHeaderv2/ScreenHeaderv2.stories.js +53 -0
- package/src/components/atoms/ScreenHeaderv2/index.js +134 -0
- package/src/components/atoms/ScreenHeaderv2/styles.js +103 -0
- package/src/components/atoms/Selectv2/VersionSelect.js +27 -0
- package/src/components/atoms/Selectv2/index.js +35 -0
- package/src/components/atoms/Selectv2/style.js +93 -0
- package/src/components/atoms/SliderToolTip/styles.js +1 -1
- package/src/components/atoms/TabSection/index.js +1 -1
- package/src/components/atoms/TabSection/styles.js +1 -1
- package/src/components/atoms/TabSectionv2/TabSection.stories.js +25 -0
- package/src/components/atoms/TabSectionv2/index.js +9 -0
- package/src/components/atoms/TabSectionv2/styles.js +20 -0
- package/src/components/atoms/TooltipLight/Tooltip.stories.js +20 -0
- package/src/components/atoms/TooltipLight/index.js +46 -0
- package/src/components/atoms/TooltipLight/styles.js +65 -0
- package/src/components/atoms/UserCatalog/UserCatalog.stories.js +67 -0
- package/src/components/atoms/UserCatalog/index.js +100 -0
- package/src/components/atoms/UserCatalog/styles.js +24 -0
- package/src/components/atoms/UserOption/UserOption.stories.js +25 -0
- package/src/components/atoms/UserOption/index.js +95 -0
- package/src/components/atoms/UserOption/styles.js +61 -0
- package/src/components/atoms/UserSelector/UserSelector.stories.js +25 -0
- package/src/components/atoms/UserSelector/index.js +86 -0
- package/src/components/atoms/UserSelector/styles.js +55 -0
- package/src/components/atoms/WordsMissing/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/WordsMissing/index.js +60 -0
- package/src/components/atoms/WordsMissing/styles.js +10 -0
- package/src/components/molecules/AsignationInfo/AsignationInfo.stories.js +17 -0
- package/src/components/molecules/AsignationInfo/index.js +108 -0
- package/src/components/molecules/AsignationInfo/styles.js +86 -0
- package/src/components/molecules/BoxAttribute/index.js +32 -25
- package/src/components/molecules/BoxAttribute/styles.js +1 -1
- package/src/components/molecules/BoxButtons/index.js +23 -22
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/EditionActiveImagev2/EditionActiveImagev2.stories.js +12 -0
- package/src/components/molecules/EditionActiveImagev2/index.js +15 -0
- package/src/components/molecules/EditionActiveImagev2/styles.js +7 -0
- package/src/components/molecules/FeaturesBarv2/FeaturesBarv2.stories.js +20 -0
- package/src/components/molecules/FeaturesBarv2/index.js +32 -0
- package/src/components/molecules/FeaturesBarv2/styles.js +17 -0
- package/src/components/molecules/GalleryElementv2/GalleryElementv2.stories.js +30 -0
- package/src/components/molecules/GalleryElementv2/index.js +142 -0
- package/src/components/molecules/GalleryElementv2/styles.js +119 -0
- package/src/components/molecules/GalleryHeaderv2/GalleryHeaderv2.stories.js +10 -0
- package/src/components/molecules/GalleryHeaderv2/index.js +25 -0
- package/src/components/molecules/GalleryHeaderv2/styles.js +47 -0
- package/src/components/molecules/GridItem/GridItem.stories.js +126 -0
- package/src/components/molecules/GridItem/index.js +105 -0
- package/src/components/molecules/GridItem/styles.js +104 -0
- package/src/components/molecules/GroupSelect/GroupSelect.stories.js +35 -0
- package/src/components/molecules/GroupSelect/SelectItem.js +105 -0
- package/src/components/molecules/GroupSelect/index.js +190 -0
- package/src/components/molecules/GroupSelect/styles.js +124 -0
- package/src/components/molecules/HeaderItem/ColumnItem.js +9 -0
- package/src/components/molecules/HeaderItem/HeaderItem.stories.js +24 -0
- package/src/components/molecules/HeaderItem/index.js +26 -0
- package/src/components/molecules/HeaderItem/styles.js +27 -0
- package/src/components/molecules/HeaderTop/index.js +52 -6
- package/src/components/molecules/HeaderTopv2/HeaderTopv2.stories.js +10 -0
- package/src/components/molecules/HeaderTopv2/index.js +100 -0
- package/src/components/molecules/HeaderTopv2/styles.js +33 -0
- package/src/components/molecules/ImageSelectorv2/ImageSelectorv2.stories.js +46 -0
- package/src/components/molecules/ImageSelectorv2/index.js +22 -0
- package/src/components/molecules/ImageSelectorv2/styles.js +15 -0
- package/src/components/molecules/Phase/Phase.stories.js +37 -0
- package/src/components/molecules/Phase/index.js +185 -0
- package/src/components/molecules/Phase/styles.js +91 -0
- package/src/components/molecules/ProductNameHeader/index.js +5 -1
- package/src/components/molecules/ProductNameHeaderv2/ProductNameHeaderv2.stories.js +37 -0
- package/src/components/molecules/ProductNameHeaderv2/index.js +12 -0
- package/src/components/molecules/ProductNameHeaderv2/styles.js +10 -0
- package/src/components/molecules/ProductSkuStatus/ProductSkuStatus.stories.js +37 -0
- package/src/components/molecules/ProductSkuStatus/index.js +26 -0
- package/src/components/molecules/ProductSkuStatus/styles.js +7 -0
- package/src/components/molecules/RetailerSelectorv2/RetailerSelectorv2.stories.js +35 -0
- package/src/components/molecules/RetailerSelectorv2/index.js +80 -0
- package/src/components/molecules/RetailerSelectorv2/styles.js +21 -0
- package/src/components/molecules/RowItem/ColumnItem.js +9 -0
- package/src/components/molecules/RowItem/RowItem.stories.js +5660 -0
- package/src/components/molecules/RowItem/index.js +45 -0
- package/src/components/molecules/RowItem/styles.js +40 -0
- package/src/components/molecules/ServiceDataValidator/ServiceDataValidator.stories.js +90 -0
- package/src/components/molecules/ServiceDataValidator/index.js +49 -0
- package/src/components/molecules/ServiceDataValidator/styles.js +36 -0
- package/src/components/molecules/SignInLogin/index.js +11 -11
- package/src/components/molecules/StatusRetailer/StatusAsignationInfo.stories.js +17 -0
- package/src/components/molecules/StatusRetailer/index.js +55 -0
- package/src/components/molecules/StatusRetailer/styles.js +85 -0
- package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +1 -2
- package/src/components/molecules/TabsMenuv2/TabsMenuv2.stories.js +19 -0
- package/src/components/molecules/TabsMenuv2/index.js +112 -0
- package/src/components/molecules/TabsMenuv2/styles.js +19 -0
- package/src/components/molecules/TagAndInput/index.js +6 -5
- package/src/components/molecules/TagAndInputv2/TagAndInputv2.stories.js +24 -0
- package/src/components/molecules/TagAndInputv2/index.js +86 -0
- package/src/components/molecules/TagAndInputv2/styles.js +35 -0
- package/src/components/molecules/Validation/Validation.stories.js +12 -0
- package/src/components/molecules/Validation/index.js +77 -0
- package/src/components/molecules/Validation/styles.js +19 -0
- package/src/components/molecules/VersionItemv2/VersionItemv2.stories.js +14 -0
- package/src/components/molecules/VersionItemv2/index.js +59 -0
- package/src/components/molecules/VersionItemv2/styles.js +47 -0
- package/src/components/organisms/BarButtons/BarButtons.stories.js +13 -0
- package/src/components/organisms/BarButtons/index.js +150 -0
- package/src/components/organisms/BarButtons/styles.js +54 -0
- package/src/components/organisms/Chat/Chat.stories.js +27 -7
- package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
- package/src/components/organisms/Chat/ContainerItems/styles.js +14 -2
- package/src/components/organisms/Chat/ContentChat/index.js +88 -12
- package/src/components/organisms/Chat/Footer/index.js +11 -0
- package/src/components/organisms/Chat/index.js +46 -4
- package/src/components/organisms/Chat/styles.js +4 -0
- package/src/components/organisms/Chatv2/ChatLists/ChatLists.stories.js +65 -0
- package/src/components/organisms/Chatv2/ChatLists/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chatv2/ChatLists/THD.png +0 -0
- package/src/components/organisms/Chatv2/ChatLists/index.js +141 -0
- package/src/components/organisms/Chatv2/ChatLists/styles.js +162 -0
- package/src/components/organisms/Chatv2/Chatv2.stories.js +184 -0
- package/src/components/organisms/Chatv2/ContainerItems/ContainerItems.stories.js +142 -0
- package/src/components/organisms/Chatv2/ContainerItems/index.js +538 -0
- package/src/components/organisms/Chatv2/ContainerItems/styles.js +360 -0
- package/src/components/organisms/Chatv2/ContentChat/ContentChat.stories.js +102 -0
- package/src/components/organisms/Chatv2/ContentChat/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chatv2/ContentChat/THD.png +0 -0
- package/src/components/organisms/Chatv2/ContentChat/index.js +1016 -0
- package/src/components/organisms/Chatv2/ContentChat/styles.js +44 -0
- package/src/components/organisms/Chatv2/Footer/Footer.stories.js +22 -0
- package/src/components/organisms/Chatv2/Footer/index.js +668 -0
- package/src/components/organisms/Chatv2/Footer/styles.js +290 -0
- package/src/components/organisms/Chatv2/Header/Header.stories.js +66 -0
- package/src/components/organisms/Chatv2/Header/index.js +93 -0
- package/src/components/organisms/Chatv2/Header/styles.js +49 -0
- package/src/components/organisms/Chatv2/index.js +281 -0
- package/src/components/organisms/Chatv2/styles.js +85 -0
- package/src/components/organisms/CompleteServices/CompleteServices.stories.js +91 -0
- package/src/components/organisms/CompleteServices/index.js +82 -0
- package/src/components/organisms/CompleteServices/styles.js +35 -0
- package/src/components/organisms/DashboardMetric/index.js +6 -3
- package/src/components/organisms/DragAndDropPhases/DragAndDropPhases.stories.js +40 -0
- package/src/components/organisms/DragAndDropPhases/index.js +236 -0
- package/src/components/organisms/DragAndDropPhases/styles.js +69 -0
- package/src/components/organisms/DragPrueba/DragPrueba.stories.js +12 -0
- package/src/components/organisms/DragPrueba/index.js +57 -0
- package/src/components/organisms/DragPrueba/styles.js +8 -0
- package/src/components/organisms/EditGroup/EditGroup.stories.js +18 -0
- package/src/components/organisms/EditGroup/index.js +168 -0
- package/src/components/organisms/EditGroup/styles.js +115 -0
- package/src/components/organisms/FullProductNameHeader/index.js +3 -1
- package/src/components/organisms/FullProductNamev2/FullProductNamev2.stories.js +28 -0
- package/src/components/organisms/FullProductNamev2/index.js +101 -0
- package/src/components/organisms/FullProductNamev2/styles.js +49 -0
- package/src/components/organisms/FullTabsMenuv2/FullTabsMenuv2.stories.js +22 -0
- package/src/components/organisms/FullTabsMenuv2/index.js +142 -0
- package/src/components/organisms/FullTabsMenuv2/styles.js +47 -0
- package/src/components/organisms/GridProducts/GridProducts.stories.js +5485 -0
- package/src/components/organisms/GridProducts/index.js +50 -0
- package/src/components/organisms/GridProducts/styles.js +14 -0
- package/src/components/organisms/GridProducts/utils.js +111 -0
- package/src/components/organisms/ImageDataTablev2/ImageDataTablev2.stories.js +24 -0
- package/src/components/organisms/ImageDataTablev2/index.js +124 -0
- package/src/components/organisms/ImageDataTablev2/styles.js +18 -0
- package/src/components/organisms/ImagePreviewerv2/ImagePreviewerv2.stories.js +38 -0
- package/src/components/organisms/ImagePreviewerv2/index.js +22 -0
- package/src/components/organisms/ImagePreviewerv2/styles.js +7 -0
- package/src/components/organisms/InputGroup/index.js +131 -119
- package/src/components/organisms/InputGroupv2/InputGroupv2.stories.js +31 -0
- package/src/components/organisms/InputGroupv2/index.js +296 -0
- package/src/components/organisms/InputGroupv2/styles.js +90 -0
- package/src/components/organisms/MandatoryBar/MandatoryBar.stories.js +18 -0
- package/src/components/organisms/MandatoryBar/index.js +31 -0
- package/src/components/organisms/MandatoryBar/styles.js +12 -0
- package/src/components/organisms/Modal/Modal.stories.js +2 -1
- package/src/components/organisms/Modal/index.js +8 -1
- package/src/components/organisms/Modal/styles.js +8 -1
- package/src/components/organisms/OrderDetail/utils/Table/utils.js +6 -16
- package/src/components/organisms/ProductImageModalv2/ProductImageModalv2.stories.js +90 -0
- package/src/components/organisms/ProductImageModalv2/index.js +105 -0
- package/src/components/organisms/ProductImageModalv2/styles.js +71 -0
- package/src/components/organisms/RenameImagesBar/RenameImagesBar.stories.js +18 -0
- package/src/components/organisms/RenameImagesBar/index.js +30 -0
- package/src/components/organisms/RenameImagesBar/styles.js +12 -0
- package/src/components/organisms/VersionSelector/index.js +100 -100
- package/src/components/organisms/VersionSelectorv2/VersionSelectorv2.stories.js +15 -0
- package/src/components/organisms/VersionSelectorv2/index.js +105 -0
- package/src/components/organisms/VersionSelectorv2/styles.js +45 -0
- package/src/components/pages/Dashboard/Dashboard.stories.js +33 -38
- package/src/components/pages/Dashboard/index.js +36 -7
- package/src/components/pages/ProductEditionv2/ProductEditionv2.stories.js +213 -0
- package/src/components/pages/ProductEditionv2/index.js +1758 -0
- package/src/components/pages/ProductEditionv2/styles.js +154 -0
- package/src/components/pages/ProviderProductEdition/index.js +100 -131
- package/src/components/pages/ProviderProductEdition/styles.js +5 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +4 -0
- package/src/components/pages/RetailerProductEdition/index.js +124 -278
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/components/pages/RetailerProductEdition/utils.js +37 -0
- package/src/global-files/data.js +6 -10
- package/src/global-files/variables.js +6 -0
- package/src/index.js +11 -0
- package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
|
@@ -22,6 +22,7 @@ import { Tooltip } from "../../../atoms/Tooltip";
|
|
|
22
22
|
import { Slide, Zoom } from "@mui/material";
|
|
23
23
|
import { useRef } from "react";
|
|
24
24
|
import { ImagePreview } from "../../../atoms/ImagePreview";
|
|
25
|
+
import { Status } from "../../../atoms/Status";
|
|
25
26
|
import { isUserTech } from "../../../../global-files/handle_userTech";
|
|
26
27
|
import { container } from "aws-amplify";
|
|
27
28
|
|
|
@@ -55,7 +56,10 @@ export const ContainerItems = (props) => {
|
|
|
55
56
|
|
|
56
57
|
useEffect(() => {
|
|
57
58
|
if (!items) return;
|
|
58
|
-
if (
|
|
59
|
+
if (
|
|
60
|
+
["merchant_product", "order_product", "product_status"].includes(chatType)
|
|
61
|
+
)
|
|
62
|
+
renderItems();
|
|
59
63
|
else if (chatType === "ticket") renderItemsTicket();
|
|
60
64
|
else setCustomItems([]);
|
|
61
65
|
}, [items]);
|
|
@@ -130,6 +134,16 @@ export const ContainerItems = (props) => {
|
|
|
130
134
|
return <label className="item-statusTicket">{item.value}</label>;
|
|
131
135
|
};
|
|
132
136
|
|
|
137
|
+
const renderStatusItem = (item) => {
|
|
138
|
+
const splitText = item.value.split("|");
|
|
139
|
+
let message = [];
|
|
140
|
+
splitText.forEach((text, i) => {
|
|
141
|
+
if (i === 1 || i === 3) message.push(<Status statusType={text} />);
|
|
142
|
+
else message.push(text);
|
|
143
|
+
});
|
|
144
|
+
return <label className="item-statusItem">{message}</label>;
|
|
145
|
+
};
|
|
146
|
+
|
|
133
147
|
const renderStatusTicketNeutral = (item) => {
|
|
134
148
|
return (
|
|
135
149
|
<Tooltip
|
|
@@ -304,7 +318,7 @@ export const ContainerItems = (props) => {
|
|
|
304
318
|
>
|
|
305
319
|
<li
|
|
306
320
|
className={
|
|
307
|
-
(ownMessage ? "own-message " : "") +
|
|
321
|
+
(ownMessage && item.type !== "status" ? "own-message " : "") +
|
|
308
322
|
(lastUserId === item.userId ? "sameUser" : "")
|
|
309
323
|
}
|
|
310
324
|
>
|
|
@@ -339,6 +353,8 @@ export const ContainerItems = (props) => {
|
|
|
339
353
|
? renderComment(item)
|
|
340
354
|
: item.type === "img"
|
|
341
355
|
? renderImg(item)
|
|
356
|
+
: item.type === "status"
|
|
357
|
+
? renderStatusItem(item)
|
|
342
358
|
: item.type === "file"
|
|
343
359
|
? renderFile(item, ownMessage)
|
|
344
360
|
: item.type === "statusTicket" &&
|
|
@@ -36,6 +36,10 @@ export const Container = styled.div`
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
@media (max-width: 768px) {
|
|
40
|
+
width: 90%;
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
// lista de items
|
|
40
44
|
> ul {
|
|
41
45
|
--marginUserValue: 10px;
|
|
@@ -158,7 +162,8 @@ export const Container = styled.div`
|
|
|
158
162
|
.item-message,
|
|
159
163
|
.item-comment,
|
|
160
164
|
.item-file,
|
|
161
|
-
.item-statusTicket
|
|
165
|
+
.item-statusTicket,
|
|
166
|
+
.item-statusItem {
|
|
162
167
|
border-radius: 10px;
|
|
163
168
|
padding: 10px;
|
|
164
169
|
font-family: ${FontFamily.RobotoRegular}, sans-serif;
|
|
@@ -173,10 +178,17 @@ export const Container = styled.div`
|
|
|
173
178
|
.item-file {
|
|
174
179
|
background-color: #8386ee;
|
|
175
180
|
}
|
|
176
|
-
.item-statusTicket
|
|
181
|
+
.item-statusTicket,
|
|
182
|
+
.item-statusItem {
|
|
177
183
|
background-color: #85bc5b;
|
|
178
184
|
}
|
|
179
185
|
|
|
186
|
+
.item-statusItem {
|
|
187
|
+
display: flex;
|
|
188
|
+
gap: 3px;
|
|
189
|
+
align-items: center;
|
|
190
|
+
}
|
|
191
|
+
|
|
180
192
|
.item-message {
|
|
181
193
|
&.different-company {
|
|
182
194
|
border: 1px solid #e33aa9;
|
|
@@ -86,7 +86,8 @@ export const ContentChat = (props) => {
|
|
|
86
86
|
|
|
87
87
|
// al cargar el componente
|
|
88
88
|
useEffect(() => {
|
|
89
|
-
if (dataChat && showPopUpChat) {
|
|
89
|
+
//if (dataChat && showPopUpChat) {
|
|
90
|
+
if (Object.keys(dataChat || {}).length) {
|
|
90
91
|
stopUpdate();
|
|
91
92
|
if (dataChat.code) {
|
|
92
93
|
setErrorChat({
|
|
@@ -100,6 +101,7 @@ export const ContentChat = (props) => {
|
|
|
100
101
|
}
|
|
101
102
|
if (chatType === "merchant_product") getInitialMerchantProduct();
|
|
102
103
|
else if (chatType === "order_product") getInitialOrderProduct();
|
|
104
|
+
else if (chatType === "product_status") getInitialProductStatus();
|
|
103
105
|
else getInitialTicket();
|
|
104
106
|
}
|
|
105
107
|
if (!showPopUpChat) {
|
|
@@ -126,6 +128,8 @@ export const ContentChat = (props) => {
|
|
|
126
128
|
} else if (chatType === "order_product") {
|
|
127
129
|
if (companies) getUpdateLatestOrderProduct(true);
|
|
128
130
|
else getInitialOrderProduct();
|
|
131
|
+
} else if (chatType === "product_status") {
|
|
132
|
+
getInitialProductStatus();
|
|
129
133
|
} else {
|
|
130
134
|
if (singleChat.items) getUpdateLatestTicket(true);
|
|
131
135
|
else getInitialTicket();
|
|
@@ -135,6 +139,47 @@ export const ContentChat = (props) => {
|
|
|
135
139
|
/*=======================================================================
|
|
136
140
|
PETICION GET INICIAL SEGUN EL TIPO DE CHAT
|
|
137
141
|
======================================================================= */
|
|
142
|
+
const getInitialProductStatus = async () => {
|
|
143
|
+
const paramsQuery = {
|
|
144
|
+
articleData: JSON.stringify({
|
|
145
|
+
articleId: JSON.stringify(dataChat.id),
|
|
146
|
+
version: JSON.stringify(dataChat.version),
|
|
147
|
+
retailerId: JSON.stringify(dataChat.retailerId),
|
|
148
|
+
status: dataChat.status,
|
|
149
|
+
})
|
|
150
|
+
};
|
|
151
|
+
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
152
|
+
const response = await fetchGET(
|
|
153
|
+
process.env.REACT_APP_READ_MESSAGES,
|
|
154
|
+
paramsQuery,
|
|
155
|
+
paramsHeaders
|
|
156
|
+
);
|
|
157
|
+
if (!response.body) {
|
|
158
|
+
setErrorChat({
|
|
159
|
+
existError: true,
|
|
160
|
+
code: 400,
|
|
161
|
+
message: response.message,
|
|
162
|
+
errorDetail: response.errorDetail,
|
|
163
|
+
});
|
|
164
|
+
setIsLoading(false);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
// success
|
|
168
|
+
setStartUpdate((prev) => prev + 1);
|
|
169
|
+
setCurrentUser({
|
|
170
|
+
id: response.body.data.currentUserId,
|
|
171
|
+
companyId: response.body.data.currentCompanyId,
|
|
172
|
+
});
|
|
173
|
+
setLastUpdateDate(response.body.data.lastUpdateDate);
|
|
174
|
+
setAllUsers(response.body.users);
|
|
175
|
+
setSingleChat({
|
|
176
|
+
items: response.body.items,
|
|
177
|
+
enabledLoadMore: response.body.items.length === 50,
|
|
178
|
+
});
|
|
179
|
+
setErrorChat({ existError: false });
|
|
180
|
+
setIsLoading(false);
|
|
181
|
+
};
|
|
182
|
+
|
|
138
183
|
const getInitialMerchantProduct = async () => {
|
|
139
184
|
const paramsQuery = {
|
|
140
185
|
getType: "initial",
|
|
@@ -568,14 +613,14 @@ export const ContentChat = (props) => {
|
|
|
568
613
|
};
|
|
569
614
|
|
|
570
615
|
/*=======================================================================
|
|
571
|
-
FUNCION QUE EJECUTA EL MICROSERVICIO CREATE-ITEM
|
|
616
|
+
FUNCION QUE EJECUTA EL MICROSERVICIO CREATE-ITEM
|
|
572
617
|
Este metodo recibe los items que queremos agregar al chat.
|
|
573
618
|
requiere:
|
|
574
|
-
=> items: [ { type , value } , ... ]
|
|
619
|
+
=> items: [ { type , value } , ... ]
|
|
575
620
|
NOTA: si se quiere agregar un mensaje mandar un array con un object
|
|
576
|
-
example: [ {
|
|
577
|
-
type: "message" ,
|
|
578
|
-
value: "mi mensaje"
|
|
621
|
+
example: [ {
|
|
622
|
+
type: "message" ,
|
|
623
|
+
value: "mi mensaje"
|
|
579
624
|
} ]
|
|
580
625
|
======================================================================= */
|
|
581
626
|
const createItemsChat = async (items = []) => {
|
|
@@ -611,12 +656,14 @@ export const ContentChat = (props) => {
|
|
|
611
656
|
// enviar items a la BD
|
|
612
657
|
if (chatType === "merchant_product") {
|
|
613
658
|
errorCreate = await createItemsMerchantProduct(items);
|
|
659
|
+
} else if (chatType === "product_status") {
|
|
660
|
+
errorCreate = await createItemsProductStatus(items);
|
|
614
661
|
} else if (chatType === "order_product") {
|
|
615
662
|
errorCreate = await createItemsOrderProduct(items);
|
|
616
663
|
} else errorCreate = await createItemsTicket(items);
|
|
617
664
|
|
|
618
665
|
// actualizar chat para que aparezcan los items enviados
|
|
619
|
-
if (
|
|
666
|
+
if (["merchant_product", "product_status"].includes(chatType)) {
|
|
620
667
|
await getUpdateLatestMerchantProduct();
|
|
621
668
|
} else if (chatType === "order_product") {
|
|
622
669
|
await getUpdateLatestOrderProduct();
|
|
@@ -629,9 +676,10 @@ export const ContentChat = (props) => {
|
|
|
629
676
|
};
|
|
630
677
|
|
|
631
678
|
const createItemsMerchantProduct = async (items = []) => {
|
|
632
|
-
const { id, version } = dataChat;
|
|
679
|
+
const { id, version, orderId } = dataChat;
|
|
633
680
|
const { id: retailerId } = activeRetailer;
|
|
634
681
|
const paramsBody = { id, version, items, retailerId };
|
|
682
|
+
if (chatType === "product_status") paramsBody["orderId"] = orderId;
|
|
635
683
|
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
636
684
|
const response = await fetchPOST(
|
|
637
685
|
process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT,
|
|
@@ -645,6 +693,23 @@ export const ContentChat = (props) => {
|
|
|
645
693
|
};
|
|
646
694
|
}
|
|
647
695
|
};
|
|
696
|
+
const createItemsProductStatus = async (items = []) => {
|
|
697
|
+
const { id, version, orderId, status } = dataChat;
|
|
698
|
+
const { id: retailerId } = activeRetailer;
|
|
699
|
+
const paramsBody = { id, version, items, retailerId, orderId, status };
|
|
700
|
+
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
701
|
+
const response = await fetchPOST(
|
|
702
|
+
process.env.REACT_APP_CREATE_MESSAGES,
|
|
703
|
+
paramsBody,
|
|
704
|
+
paramsHeaders
|
|
705
|
+
);
|
|
706
|
+
if (!response.body) {
|
|
707
|
+
return {
|
|
708
|
+
message: response.message,
|
|
709
|
+
errorDetail: response.errorDetail,
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
};
|
|
648
713
|
|
|
649
714
|
const createItemsOrderProduct = async (items = []) => {
|
|
650
715
|
const paramsBody = {
|
|
@@ -692,7 +757,11 @@ export const ContentChat = (props) => {
|
|
|
692
757
|
SECCION DE FUNCIONES
|
|
693
758
|
======================================================================= */
|
|
694
759
|
const isSingleChat = () => {
|
|
695
|
-
if (
|
|
760
|
+
if (
|
|
761
|
+
chatType === "merchant_product" ||
|
|
762
|
+
chatType === "ticket" ||
|
|
763
|
+
chatType === "product_status"
|
|
764
|
+
) {
|
|
696
765
|
return true;
|
|
697
766
|
}
|
|
698
767
|
if (companies && Object.keys(companies).length < 2) return true;
|
|
@@ -807,7 +876,7 @@ export const ContentChat = (props) => {
|
|
|
807
876
|
// mostrar chat?
|
|
808
877
|
let items;
|
|
809
878
|
let enabledLoadMore;
|
|
810
|
-
if (["merchant_product", "ticket"].includes(chatType)) {
|
|
879
|
+
if (["merchant_product", "ticket", "product_status"].includes(chatType)) {
|
|
811
880
|
items = singleChat.items;
|
|
812
881
|
enabledLoadMore = singleChat.enabledLoadMore;
|
|
813
882
|
}
|
|
@@ -849,7 +918,9 @@ export const ContentChat = (props) => {
|
|
|
849
918
|
activeCompanyId={activeCompanyId}
|
|
850
919
|
ticketCompany={ticketCompany}
|
|
851
920
|
currentUser={
|
|
852
|
-
["merchant_product", "order_product"].includes(
|
|
921
|
+
["merchant_product", "order_product", "product_status"].includes(
|
|
922
|
+
chatType
|
|
923
|
+
)
|
|
853
924
|
? currentUser
|
|
854
925
|
: dataChat.currentUser
|
|
855
926
|
}
|
|
@@ -888,6 +959,12 @@ export const ContentChat = (props) => {
|
|
|
888
959
|
? { id: dataChat.id, version: currentArticle.version }
|
|
889
960
|
: chatType === "ticket"
|
|
890
961
|
? { id: dataChat.id }
|
|
962
|
+
: chatType === "product_status"
|
|
963
|
+
? {
|
|
964
|
+
id: dataChat.id,
|
|
965
|
+
version: dataChat.version,
|
|
966
|
+
retailerId: dataChat.retailerId,
|
|
967
|
+
}
|
|
891
968
|
: undefined
|
|
892
969
|
}
|
|
893
970
|
chatCompany={getChatCompany()}
|
|
@@ -930,7 +1007,6 @@ export const ContentChat = (props) => {
|
|
|
930
1007
|
}}
|
|
931
1008
|
/>
|
|
932
1009
|
)}
|
|
933
|
-
|
|
934
1010
|
{/* body */}
|
|
935
1011
|
{renderBodyChat()}
|
|
936
1012
|
</Container>
|
|
@@ -169,6 +169,17 @@ export const Footer = (props) => {
|
|
|
169
169
|
errorMessage = "El ID del ticket no es valido";
|
|
170
170
|
}
|
|
171
171
|
break;
|
|
172
|
+
case "product_status":
|
|
173
|
+
if (
|
|
174
|
+
isValidNaturalNumber(dataChat?.id) &&
|
|
175
|
+
isValidNaturalNumber(dataChat?.version) &&
|
|
176
|
+
isValidNaturalNumber(dataChat?.retailerId)
|
|
177
|
+
) {
|
|
178
|
+
fileKey += `productStatus/${dataChat.id}-${dataChat?.version}-${dataChat?.retailerId}/`;
|
|
179
|
+
} else {
|
|
180
|
+
errorMessage = "El ID del ticket no es valido";
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
172
183
|
|
|
173
184
|
default:
|
|
174
185
|
errorMessage =
|
|
@@ -17,14 +17,14 @@ export const Chat = (props) => {
|
|
|
17
17
|
const {
|
|
18
18
|
chatType, // "merchant_product" | "order_product" | "ticket"
|
|
19
19
|
chatContainerType, // ("fixed") | ("popUp")
|
|
20
|
-
chatData, // {} => aqui poner los datos requeridos segun el tipo de chat
|
|
20
|
+
chatData = {}, // {} => aqui poner los datos requeridos segun el tipo de chat
|
|
21
21
|
classNameContainerFixed, // clases CSS del envoltoria chat fixed
|
|
22
22
|
size = 14, // tamaño del icono
|
|
23
23
|
} = props;
|
|
24
24
|
const [showPopUpChat, setShowPopUpChat] = useState(false);
|
|
25
25
|
const [data, setData] = useState();
|
|
26
26
|
|
|
27
|
-
const { ticketCompany } = chatData || {};
|
|
27
|
+
const { ticketCompany, retailerId } = chatData || {};
|
|
28
28
|
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
switch (chatType) {
|
|
@@ -37,6 +37,9 @@ export const Chat = (props) => {
|
|
|
37
37
|
case "ticket":
|
|
38
38
|
validateChatTicket();
|
|
39
39
|
break;
|
|
40
|
+
case "product_status":
|
|
41
|
+
validateProductStatus();
|
|
42
|
+
break;
|
|
40
43
|
default:
|
|
41
44
|
setData({
|
|
42
45
|
code: 404,
|
|
@@ -46,6 +49,45 @@ export const Chat = (props) => {
|
|
|
46
49
|
}
|
|
47
50
|
}, [chatType]);
|
|
48
51
|
|
|
52
|
+
const validateProductStatus = () => {
|
|
53
|
+
const {
|
|
54
|
+
userToken, // string
|
|
55
|
+
id, // number
|
|
56
|
+
version,
|
|
57
|
+
retailerId, // number
|
|
58
|
+
status,
|
|
59
|
+
orderId,
|
|
60
|
+
} = chatData;
|
|
61
|
+
|
|
62
|
+
if (!isValidGeneral(userToken, id)) return;
|
|
63
|
+
|
|
64
|
+
// validar el ID de la cadena asociada al producto en la OT
|
|
65
|
+
if (!isValidNaturalNumber(retailerId)) {
|
|
66
|
+
setDataError("La cadena relacionada al producto no es válida");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// validar el ID de la version asociada al producto en la OT
|
|
71
|
+
if (!isValidNaturalNumber(version)) {
|
|
72
|
+
setDataError("La versión del producto no es válida");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (orderId && !isValidNaturalNumber(orderId)) {
|
|
77
|
+
setDataError("La orden del producto no es válida");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setData({
|
|
82
|
+
userToken,
|
|
83
|
+
id,
|
|
84
|
+
version,
|
|
85
|
+
retailerId,
|
|
86
|
+
orderId,
|
|
87
|
+
status,
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
49
91
|
const isValidGeneral = (userToken, id) => {
|
|
50
92
|
// validar token del user
|
|
51
93
|
if (isStringEmpty(userToken)) {
|
|
@@ -197,7 +239,7 @@ export const Chat = (props) => {
|
|
|
197
239
|
dataChat={data}
|
|
198
240
|
showBtnClose={false}
|
|
199
241
|
ticketCompany={ticketCompany}
|
|
200
|
-
activeRetailer={props.activeRetailer}
|
|
242
|
+
activeRetailer={props.activeRetailer || { id: retailerId }}
|
|
201
243
|
/>
|
|
202
244
|
</ContainerFixed>
|
|
203
245
|
);
|
|
@@ -230,7 +272,7 @@ export const Chat = (props) => {
|
|
|
230
272
|
onClickBtnClose={() => {
|
|
231
273
|
setShowPopUpChat(false);
|
|
232
274
|
}}
|
|
233
|
-
activeRetailer={props.activeRetailer}
|
|
275
|
+
activeRetailer={props.activeRetailer || { id: retailerId }}
|
|
234
276
|
/>
|
|
235
277
|
</ContainerPopUp>
|
|
236
278
|
</Slide>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ChatLists } from "./index";
|
|
2
|
+
import THD from "./THD.png";
|
|
3
|
+
import Rotoplas from "./Rotoplas.jpeg";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/organisms/Chat/ChatLists",
|
|
7
|
+
component: ChatLists,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = (args) => <ChatLists {...args} />;
|
|
11
|
+
|
|
12
|
+
// companies de prueba
|
|
13
|
+
const companies = {
|
|
14
|
+
200: {
|
|
15
|
+
name: "The Home Depot",
|
|
16
|
+
src: THD,
|
|
17
|
+
lastChatDate: "2022-11-4 21:01:00",
|
|
18
|
+
statusChat: "disabled",
|
|
19
|
+
},
|
|
20
|
+
300: {
|
|
21
|
+
name: "Rotoplas",
|
|
22
|
+
src: Rotoplas,
|
|
23
|
+
lastChatDate: "2022-11-03 21:01:00",
|
|
24
|
+
statusChat: "enabled",
|
|
25
|
+
},
|
|
26
|
+
100: {
|
|
27
|
+
name: "Content-oh!",
|
|
28
|
+
src: "",
|
|
29
|
+
lastChatDate: "2022-11-02 21:01:00",
|
|
30
|
+
statusChat: "current",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
// companies de prueba sin chats cerrados
|
|
34
|
+
const companies2 = {
|
|
35
|
+
300: {
|
|
36
|
+
name: "Rotoplas",
|
|
37
|
+
src: Rotoplas,
|
|
38
|
+
lastChatDate: "2022-10-27 21:01:00",
|
|
39
|
+
statusChat: "enabled",
|
|
40
|
+
},
|
|
41
|
+
100: {
|
|
42
|
+
name: "Content-oh!",
|
|
43
|
+
src: "",
|
|
44
|
+
lastChatDate: "2022-9-27 21:01:00",
|
|
45
|
+
statusChat: "current",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const exampleChatLists = Template.bind({});
|
|
50
|
+
exampleChatLists.args = {
|
|
51
|
+
companies,
|
|
52
|
+
currentCompanyId: 100,
|
|
53
|
+
onClickCompany: (companyId) => {
|
|
54
|
+
console.log("click en company:", companyId);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const onlyOpenChatLists = Template.bind({});
|
|
59
|
+
onlyOpenChatLists.args = {
|
|
60
|
+
companies: companies2,
|
|
61
|
+
currentCompanyId: 100,
|
|
62
|
+
onClickCompany: (companyId) => {
|
|
63
|
+
console.log("click en company:", companyId);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Container, ContainerItemChat, ContainerTooltip } from "./styles";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { getCustomDate } from "../../../../global-files/utils";
|
|
4
|
+
import { faImage as IconImage } from "@fortawesome/free-solid-svg-icons";
|
|
5
|
+
import { CustomIcon } from "../../../atoms/CustomIcon";
|
|
6
|
+
import { Image } from "../../../atoms/Image";
|
|
7
|
+
import { Tooltip } from "../../../atoms/Tooltip";
|
|
8
|
+
|
|
9
|
+
export const ChatLists = (props) => {
|
|
10
|
+
const {
|
|
11
|
+
companies /* {
|
|
12
|
+
id: { name , src , statusChat , items } ,
|
|
13
|
+
...
|
|
14
|
+
} */,
|
|
15
|
+
currentCompanyId, // number
|
|
16
|
+
onClickCompany, // (id) => {}
|
|
17
|
+
} = props;
|
|
18
|
+
const [openChats, setOpenChats] = useState([]);
|
|
19
|
+
const [closedChats, setClosedChats] = useState([]);
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
renderChats();
|
|
23
|
+
}, [companies]);
|
|
24
|
+
|
|
25
|
+
const renderChats = () => {
|
|
26
|
+
let jsxOpenChats = [];
|
|
27
|
+
let jsxClosedChats = [];
|
|
28
|
+
|
|
29
|
+
for (const companyId of Object.keys(companies)) {
|
|
30
|
+
const company = companies[companyId];
|
|
31
|
+
// crear el item chat
|
|
32
|
+
const itemChat = (
|
|
33
|
+
<ContainerItemChat
|
|
34
|
+
key={"itemChat-" + companyId}
|
|
35
|
+
onClick={(event) => {
|
|
36
|
+
onClickCompany && onClickCompany(companyId);
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
{/* logo de la compañia */}
|
|
40
|
+
<Image
|
|
41
|
+
className="img-logoCompany"
|
|
42
|
+
width={"34px"}
|
|
43
|
+
sizeLoading={24}
|
|
44
|
+
colorLoading={undefined}
|
|
45
|
+
src={company.src}
|
|
46
|
+
componentDefault={
|
|
47
|
+
<CustomIcon
|
|
48
|
+
className="icon-logoCompany"
|
|
49
|
+
type={"white"}
|
|
50
|
+
borderType={"circle"}
|
|
51
|
+
size={15}
|
|
52
|
+
icon={IconImage}
|
|
53
|
+
/>
|
|
54
|
+
}
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
{/* name y date */}
|
|
58
|
+
<div className="container-info">
|
|
59
|
+
<label className="label-name"> {company.name} </label>
|
|
60
|
+
<label className="label-lastDate">
|
|
61
|
+
{getCustomDate(
|
|
62
|
+
new Date(
|
|
63
|
+
company.items.length ? company.items[0].date : undefined
|
|
64
|
+
)
|
|
65
|
+
)}
|
|
66
|
+
</label>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
{/* label interno */}
|
|
70
|
+
<div className="container-indicators">
|
|
71
|
+
{currentCompanyId === companyId && (
|
|
72
|
+
<div className="label-ownCompany">Interno</div>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
</ContainerItemChat>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
// checar si es chat abierto
|
|
79
|
+
if (company.statusChat === "closed") jsxClosedChats.push(itemChat);
|
|
80
|
+
else jsxOpenChats.push(itemChat);
|
|
81
|
+
}
|
|
82
|
+
setOpenChats(jsxOpenChats);
|
|
83
|
+
setClosedChats(jsxClosedChats);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<>
|
|
88
|
+
<Container>
|
|
89
|
+
{openChats.length !== 0 && (
|
|
90
|
+
<section>
|
|
91
|
+
<div className="container-headerChats">
|
|
92
|
+
<Tooltip
|
|
93
|
+
className={"tooltip-title"}
|
|
94
|
+
position={"topCenter"}
|
|
95
|
+
addArrow={false}
|
|
96
|
+
transitionType={"zoom"}
|
|
97
|
+
followCursor={false}
|
|
98
|
+
componentTooltip={
|
|
99
|
+
<ContainerTooltip>
|
|
100
|
+
<label className="label-title"> Chats abiertos </label>
|
|
101
|
+
<label className="label-message">{`De acuerdo al estatus
|
|
102
|
+
actual del producto, puedes establecer una conversación
|
|
103
|
+
con estas compañias`}</label>
|
|
104
|
+
</ContainerTooltip>
|
|
105
|
+
}
|
|
106
|
+
>
|
|
107
|
+
<label> Chats abiertos </label>
|
|
108
|
+
</Tooltip>
|
|
109
|
+
</div>
|
|
110
|
+
<div className="container-bodyChats">{openChats}</div>
|
|
111
|
+
</section>
|
|
112
|
+
)}
|
|
113
|
+
|
|
114
|
+
{closedChats.length !== 0 && (
|
|
115
|
+
<section>
|
|
116
|
+
<div className="container-headerChats">
|
|
117
|
+
<Tooltip
|
|
118
|
+
className={"tooltip-title"}
|
|
119
|
+
position={"topCenter"}
|
|
120
|
+
addArrow={false}
|
|
121
|
+
transitionType={"zoom"}
|
|
122
|
+
followCursor={false}
|
|
123
|
+
componentTooltip={
|
|
124
|
+
<ContainerTooltip>
|
|
125
|
+
<label className="label-title"> Chats cerrados </label>
|
|
126
|
+
<label className="label-message">{`Las conversaciones
|
|
127
|
+
con estas compañias han finalizado debido al cambio de
|
|
128
|
+
estatus, sigue el flujo de trabajo con tus chats abiertos`}</label>
|
|
129
|
+
</ContainerTooltip>
|
|
130
|
+
}
|
|
131
|
+
>
|
|
132
|
+
<label> Chats cerrados </label>
|
|
133
|
+
</Tooltip>
|
|
134
|
+
</div>
|
|
135
|
+
<div className="container-bodyChats">{closedChats}</div>
|
|
136
|
+
</section>
|
|
137
|
+
)}
|
|
138
|
+
</Container>
|
|
139
|
+
</>
|
|
140
|
+
);
|
|
141
|
+
};
|