contentoh-components-library 21.2.84 → 21.2.85
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/.env.development +6 -1
- package/dist/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
- package/dist/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
- package/dist/assets/images/defaultImages/Spinner.gif +0 -0
- package/dist/assets/images/defaultImages/notFound.svg +124 -0
- package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +72 -0
- package/dist/components/atoms/ButtonFileChooser/index.js +116 -0
- package/dist/components/atoms/ButtonFileChooser/styles.js +20 -0
- package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +66 -0
- package/dist/components/atoms/ButtonV2/index.js +109 -0
- package/dist/components/atoms/ButtonV2/styles.js +53 -0
- package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +50 -0
- package/dist/components/atoms/CustomIcon/index.js +38 -0
- package/dist/components/atoms/CustomIcon/styles.js +33 -0
- package/dist/components/atoms/IconFile/IconFile.stories.js +48 -0
- package/dist/components/atoms/IconFile/index.js +251 -0
- package/dist/components/atoms/IconFile/styles.js +23 -0
- package/dist/components/atoms/Image/Image.stories.js +63 -0
- package/dist/components/atoms/Image/index.js +72 -0
- package/dist/components/atoms/Image/styles.js +40 -0
- package/dist/components/atoms/ImageLink/ImageLink.stories.js +63 -0
- package/dist/components/atoms/ImageLink/index.js +75 -0
- package/dist/components/atoms/ImageLink/styles.js +40 -0
- package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +70 -0
- package/dist/components/atoms/ImagePreview/index.js +220 -0
- package/dist/components/atoms/ImagePreview/styles.js +44 -0
- package/dist/components/atoms/InputText/InputText.stories.js +62 -0
- package/dist/components/atoms/InputText/index.js +64 -0
- package/dist/components/atoms/InputText/styles.js +32 -0
- package/dist/components/atoms/NotFound/NotFound.stories.js +36 -0
- package/dist/components/atoms/NotFound/index.js +73 -0
- package/dist/components/atoms/NotFound/styles.js +20 -0
- package/dist/components/atoms/Tooltip/Tooltip.stories.js +36 -6
- package/dist/components/atoms/Tooltip/index.js +41 -26
- package/dist/components/atoms/Tooltip/styles.js +3 -1
- package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +66 -0
- package/dist/components/molecules/ButtonDownloadFile/index.js +179 -0
- package/dist/components/molecules/ButtonDownloadFile/styles.js +23 -0
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
- package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
- package/dist/components/molecules/HeaderTop/index.js +12 -5
- package/dist/components/molecules/HeaderTop/styles.js +1 -1
- package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +72 -0
- package/dist/components/molecules/ImageTooltip/index.js +84 -0
- package/dist/components/molecules/ImageTooltip/styles.js +33 -0
- package/dist/components/organisms/Chat/Chat.stories.js +215 -0
- package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +83 -0
- package/dist/components/organisms/Chat/ChatLists/index.js +158 -0
- package/dist/components/organisms/Chat/ChatLists/styles.js +29 -0
- package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +176 -0
- package/dist/components/organisms/Chat/ContainerItems/index.js +570 -0
- package/dist/components/organisms/Chat/ContainerItems/styles.js +20 -0
- package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +142 -0
- package/dist/components/organisms/Chat/ContentChat/index.js +1422 -0
- package/dist/components/organisms/Chat/ContentChat/styles.js +20 -0
- package/dist/components/organisms/Chat/Footer/Footer.stories.js +43 -0
- package/dist/components/organisms/Chat/Footer/index.js +983 -0
- package/dist/components/organisms/Chat/Footer/styles.js +32 -0
- package/dist/components/organisms/Chat/Header/Header.stories.js +96 -0
- package/dist/components/organisms/Chat/Header/index.js +84 -0
- package/dist/components/organisms/Chat/Header/styles.js +20 -0
- package/dist/components/organisms/Chat/index.js +325 -0
- package/dist/components/organisms/Chat/styles.js +29 -0
- package/dist/components/organisms/Modal/Modal.stories.js +66 -0
- package/dist/components/organisms/Modal/index.js +95 -0
- package/dist/components/organisms/Modal/styles.js +20 -0
- package/dist/components/pages/Dashboard/Dashboard.stories.js +16 -44
- package/dist/components/pages/Dashboard/index.js +10 -17
- package/dist/components/pages/ProviderProductEdition/index.js +3 -2
- package/dist/components/pages/RetailerProductEdition/index.js +4 -7
- package/dist/global-files/fonts.css +18 -0
- package/dist/global-files/handle_http.js +383 -0
- package/dist/global-files/utils.js +472 -0
- package/dist/global-files/variables.js +3 -1
- package/package.json +13 -1
- package/src/assets/fonts/Roboto/Roboto-Medium.ttf +0 -0
- package/src/assets/fonts/Roboto/Roboto-Regular.ttf +0 -0
- package/src/assets/images/chatPopup/Spinner.gif +0 -0
- package/src/assets/images/chatPopup/close.svg +3 -0
- package/src/assets/images/chatPopup/defaultImage.png +0 -0
- package/src/assets/images/chatPopup/defaultProfile.png +0 -0
- package/src/assets/images/chatPopup/doc.svg +1 -0
- package/src/assets/images/chatPopup/document.svg +1 -0
- package/src/assets/images/chatPopup/iconChat.svg +19 -0
- package/src/assets/images/chatPopup/iconPlus.svg +3 -0
- package/src/assets/images/chatPopup/pdf.svg +75 -0
- package/src/assets/images/chatPopup/remove.svg +4 -0
- package/src/assets/images/chatPopup/send.svg +3 -0
- package/src/assets/images/chatPopup/svgIcon.svg +109 -0
- package/src/assets/images/chatPopup/upload_file.svg +3 -0
- package/src/assets/images/chatPopup/xls.svg +53 -0
- package/src/assets/images/customSelect/starIcon.svg +14 -0
- package/src/assets/images/defaultImages/Spinner.gif +0 -0
- package/src/assets/images/defaultImages/notFound.svg +124 -0
- package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
- package/src/components/atoms/ButtonFileChooser/index.js +70 -0
- package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
- package/src/components/atoms/ButtonV2/ButtonV2.stories.js +50 -0
- package/src/components/atoms/ButtonV2/index.js +74 -0
- package/src/components/atoms/ButtonV2/styles.js +187 -0
- package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
- package/src/components/atoms/CustomIcon/index.js +41 -0
- package/src/components/atoms/CustomIcon/styles.js +85 -0
- package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
- package/src/components/atoms/IconFile/index.js +120 -0
- package/src/components/atoms/IconFile/styles.js +67 -0
- package/src/components/atoms/Image/Image.stories.js +43 -0
- package/src/components/atoms/Image/index.js +54 -0
- package/src/components/atoms/Image/styles.js +25 -0
- package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
- package/src/components/atoms/ImageLink/index.js +58 -0
- package/src/components/atoms/ImageLink/styles.js +30 -0
- package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
- package/src/components/atoms/ImagePreview/index.js +192 -0
- package/src/components/atoms/ImagePreview/styles.js +77 -0
- package/src/components/atoms/InputText/InputText.stories.js +40 -0
- package/src/components/atoms/InputText/index.js +63 -0
- package/src/components/atoms/InputText/styles.js +89 -0
- package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
- package/src/components/atoms/NotFound/index.js +53 -0
- package/src/components/atoms/NotFound/styles.js +55 -0
- package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
- package/src/components/atoms/Tooltip/index.js +59 -0
- package/src/components/atoms/Tooltip/styles.js +42 -0
- package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
- package/src/components/molecules/ButtonDownloadFile/index.js +113 -0
- package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
- package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
- package/src/components/molecules/HeaderTop/index.js +11 -6
- package/src/components/molecules/HeaderTop/styles.js +4 -0
- package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +46 -0
- package/src/components/molecules/ImageTooltip/index.js +64 -0
- package/src/components/molecules/ImageTooltip/styles.js +18 -0
- package/src/components/organisms/Chat/Chat.stories.js +199 -0
- package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
- package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
- package/src/components/organisms/Chat/ChatLists/index.js +141 -0
- package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
- package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
- package/src/components/organisms/Chat/ContainerItems/index.js +551 -0
- package/src/components/organisms/Chat/ContainerItems/styles.js +336 -0
- package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
- package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
- package/src/components/organisms/Chat/ContentChat/index.js +900 -0
- package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
- package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
- package/src/components/organisms/Chat/Footer/index.js +669 -0
- package/src/components/organisms/Chat/Footer/styles.js +286 -0
- package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
- package/src/components/organisms/Chat/Header/index.js +94 -0
- package/src/components/organisms/Chat/Header/styles.js +49 -0
- package/src/components/organisms/Chat/index.js +295 -0
- package/src/components/organisms/Chat/styles.js +42 -0
- package/src/components/organisms/Modal/Modal.stories.js +55 -0
- package/src/components/organisms/Modal/index.js +97 -0
- package/src/components/organisms/Modal/styles.js +103 -0
- package/src/components/pages/Dashboard/Dashboard.stories.js +16 -47
- package/src/components/pages/Dashboard/index.js +4 -13
- package/src/components/pages/ProviderProductEdition/index.js +6 -7
- package/src/components/pages/RetailerProductEdition/index.js +5 -4
- package/src/global-files/fonts.css +18 -0
- package/src/global-files/handle_http.js +231 -0
- package/src/global-files/utils.js +300 -0
- package/src/global-files/variables.js +2 -0
- package/dist/components/atoms/ChatPopUp/ChatPopUp.stories.js +0 -28
- package/dist/components/atoms/ChatPopUp/index.js +0 -841
- package/dist/components/atoms/ChatPopUp/styles.js +0 -27
- package/dist/components/atoms/ChatPopUp/utils/handlersChat.js +0 -182
- package/dist/components/atoms/StatusTag/StatusTag.stories.js +0 -48
- package/dist/components/atoms/StatusTag/index.js +0 -58
- package/dist/components/atoms/StatusTag/styles.js +0 -20
- package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +0 -37
- package/dist/components/pages/RegistrationLoginFirstStep/index.js +0 -269
- package/dist/components/pages/RegistrationLoginFirstStep/styles.js +0 -20
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ContainerBtnPopUpChat,
|
|
3
|
+
ContainerFixed,
|
|
4
|
+
ContainerPopUp,
|
|
5
|
+
} from "./styles";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import PropTypes from "prop-types";
|
|
8
|
+
import ButtonV2 from "../../atoms/ButtonV2";
|
|
9
|
+
import { ContentChat } from "./ContentChat";
|
|
10
|
+
import { faComments as IconChat } from "@fortawesome/free-solid-svg-icons";
|
|
11
|
+
import { Slide } from "@mui/material";
|
|
12
|
+
import {
|
|
13
|
+
isStringEmpty,
|
|
14
|
+
isValidNaturalNumber,
|
|
15
|
+
} from "../../../global-files/utils";
|
|
16
|
+
|
|
17
|
+
export default function Chat(props) {
|
|
18
|
+
const {
|
|
19
|
+
chatType, // "merchant_product" | "order_product" | "ticket"
|
|
20
|
+
chatContainerType, // ("fixed") | ("popUp")
|
|
21
|
+
chatData, // {} => aqui poner los datos requeridos segun el tipo de chat
|
|
22
|
+
classNameContainerFixed, // clases CSS del envoltoria chat fixed
|
|
23
|
+
} = props;
|
|
24
|
+
const [showPopUpChat, setShowPopUpChat] = useState(false);
|
|
25
|
+
const [data, setData] = useState();
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
switch (chatType) {
|
|
29
|
+
case "merchant_product":
|
|
30
|
+
validateChatMerchantProduct();
|
|
31
|
+
break;
|
|
32
|
+
case "order_product":
|
|
33
|
+
validateChatOrderProduct();
|
|
34
|
+
break;
|
|
35
|
+
case "ticket":
|
|
36
|
+
validateChatTicket();
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
setData({
|
|
40
|
+
code: 404,
|
|
41
|
+
message: `El tipo de chat especificado "${chatType}" no es valido`,
|
|
42
|
+
errorDetail: "",
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, [chatType]);
|
|
46
|
+
|
|
47
|
+
// validar props que se requieren para el tipo de chat "order_product"
|
|
48
|
+
const validateChatOrderProduct = () => {
|
|
49
|
+
const {
|
|
50
|
+
userToken, // string
|
|
51
|
+
id, // number
|
|
52
|
+
orderId, // number
|
|
53
|
+
retailerId, // number
|
|
54
|
+
} = chatData;
|
|
55
|
+
|
|
56
|
+
// validar token del user
|
|
57
|
+
if (isStringEmpty(userToken)) {
|
|
58
|
+
setDataError("El token del usuario no es valido");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
// validar ID del producto
|
|
62
|
+
if (!isValidNaturalNumber(id)) {
|
|
63
|
+
setDataError("El ID del producto no es valido");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
// validar el ID de la OT en donde se encuentra el producto
|
|
67
|
+
if (!isValidNaturalNumber(orderId)) {
|
|
68
|
+
setDataError("El ID de la orden del producto no es valido");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// validar el ID de la cadena asociada al producto en la OT
|
|
72
|
+
if (!isValidNaturalNumber(retailerId)) {
|
|
73
|
+
setDataError("La cadena relacionada al producto no es valida");
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
setData({
|
|
77
|
+
userToken,
|
|
78
|
+
id,
|
|
79
|
+
orderId,
|
|
80
|
+
retailerId,
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// validar props que se requieren para el tipo de chat "merchants_product"
|
|
85
|
+
const validateChatMerchantProduct = () => {
|
|
86
|
+
const {
|
|
87
|
+
userToken, // string
|
|
88
|
+
id, // number
|
|
89
|
+
version, // number
|
|
90
|
+
} = chatData;
|
|
91
|
+
|
|
92
|
+
// validar token del user
|
|
93
|
+
if (isStringEmpty(userToken)) {
|
|
94
|
+
setDataError("El token del usuario no es valido");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// validar ID del producto
|
|
98
|
+
if (!isValidNaturalNumber(id)) {
|
|
99
|
+
setDataError("El ID del producto no es valido");
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
// validar la version del producto
|
|
103
|
+
if (!isValidNaturalNumber(version)) {
|
|
104
|
+
setDataError("La version del producto no es valida");
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
setData({
|
|
108
|
+
userToken,
|
|
109
|
+
id,
|
|
110
|
+
version,
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// validar props que se requieren para el tipo de chat "ticket"
|
|
115
|
+
const validateChatTicket = () => {
|
|
116
|
+
const {
|
|
117
|
+
currentUser /* {
|
|
118
|
+
id: number ,
|
|
119
|
+
companyId: number ,
|
|
120
|
+
isUserTech: boolean ,
|
|
121
|
+
} */,
|
|
122
|
+
id, // number
|
|
123
|
+
statusTicket, // (string) "IN_PROGRESS" | "PENDING" | "COMPLETED"
|
|
124
|
+
ticketOwnerUserId, // number
|
|
125
|
+
} = chatData;
|
|
126
|
+
|
|
127
|
+
// validar si ID del usuario conectado
|
|
128
|
+
if (!isValidNaturalNumber(currentUser?.id)) {
|
|
129
|
+
setDataError("Tu ID de usuario no fue especificado");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
// validar si ID de la compañia del usuario conectado
|
|
133
|
+
if (!isValidNaturalNumber(currentUser?.companyId)) {
|
|
134
|
+
setDataError("El ID de tu compañia no fue especificado");
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// validar si el usuario conectado es de tecnologia o no
|
|
138
|
+
if (
|
|
139
|
+
currentUser?.isUserTech === undefined ||
|
|
140
|
+
typeof currentUser.isUserTech !== "boolean"
|
|
141
|
+
) {
|
|
142
|
+
setDataError("Tu tipo de usuario no fue especificado");
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
// validar ID del ticket
|
|
146
|
+
if (!isValidNaturalNumber(id)) {
|
|
147
|
+
setDataError("El ID del ticket no es valido");
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
// validar ID del usuario que creó el ticket
|
|
151
|
+
if (!isValidNaturalNumber(ticketOwnerUserId)) {
|
|
152
|
+
setDataError(
|
|
153
|
+
"El ID del usuario al que le pertenece el ticket no es valido"
|
|
154
|
+
);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
// validar el status del chat
|
|
158
|
+
if (isStringEmpty(statusTicket)) {
|
|
159
|
+
setDataError("El estatus del ticket no es valido");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
let statusChat = "open";
|
|
163
|
+
if (statusTicket === "COMPLETED") statusChat = "closed";
|
|
164
|
+
|
|
165
|
+
// convertir user TECH a NORMAL si es el propietario del ticket
|
|
166
|
+
let isUserTech = currentUser.isUserTech;
|
|
167
|
+
if (isUserTech && currentUser.id == ticketOwnerUserId) {
|
|
168
|
+
isUserTech = false;
|
|
169
|
+
}
|
|
170
|
+
setData({
|
|
171
|
+
currentUser: {
|
|
172
|
+
...currentUser,
|
|
173
|
+
isUserTech,
|
|
174
|
+
},
|
|
175
|
+
id,
|
|
176
|
+
statusChat,
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const setDataError = (errorDetail) => {
|
|
181
|
+
setData({
|
|
182
|
+
code: 404,
|
|
183
|
+
message: `No se especificaron algunos datos requeridos para el tipo de chat "${chatType}"`,
|
|
184
|
+
errorDetail,
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/*
|
|
189
|
+
const createItem = async (valueType, valueInput) => {
|
|
190
|
+
clearTimeout(processUpdateID);
|
|
191
|
+
let currentItems = items.slice();
|
|
192
|
+
let paramsBody = {};
|
|
193
|
+
let paramsHeaders = {};
|
|
194
|
+
switch (chatType.toLowerCase()) {
|
|
195
|
+
case "order_product": //------------------------------------------
|
|
196
|
+
paramsBody = {
|
|
197
|
+
articleId: articleId,
|
|
198
|
+
valueType: valueType,
|
|
199
|
+
value: valueInput,
|
|
200
|
+
isOrderProduct: "1",
|
|
201
|
+
orderId: orderId,
|
|
202
|
+
retailerId: retailerId,
|
|
203
|
+
};
|
|
204
|
+
paramsHeaders = { Authorization: userToken };
|
|
205
|
+
break;
|
|
206
|
+
|
|
207
|
+
default:
|
|
208
|
+
// merchants_products--------------------------------------
|
|
209
|
+
paramsBody = {
|
|
210
|
+
articleId: articleId,
|
|
211
|
+
articleVersion: articleVersion,
|
|
212
|
+
valueType: valueType,
|
|
213
|
+
value: valueInput,
|
|
214
|
+
isOrderProduct: "0",
|
|
215
|
+
};
|
|
216
|
+
paramsHeaders = { Authorization: userToken };
|
|
217
|
+
}
|
|
218
|
+
const response = await fetchPOST(
|
|
219
|
+
process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT,
|
|
220
|
+
paramsBody,
|
|
221
|
+
paramsHeaders
|
|
222
|
+
);
|
|
223
|
+
if (!response.body) {
|
|
224
|
+
let itemType =
|
|
225
|
+
valueType === "txt"
|
|
226
|
+
? "el mensaje"
|
|
227
|
+
: valueType === "img"
|
|
228
|
+
? "la imagen"
|
|
229
|
+
: "el archivo";
|
|
230
|
+
showModalAlert(
|
|
231
|
+
`No fue posible agregar ${itemType} en el chat`,
|
|
232
|
+
response.errorDetail,
|
|
233
|
+
"error"
|
|
234
|
+
);
|
|
235
|
+
setItems(currentItems);
|
|
236
|
+
} else {
|
|
237
|
+
if (currentItems?.length == 0) {
|
|
238
|
+
// console.log("NUEVO ITEM <> NUEVO INITIAL");
|
|
239
|
+
await getInitial();
|
|
240
|
+
} else {
|
|
241
|
+
// console.log("NUEVO ITEM <> NUEVO UPDATE");
|
|
242
|
+
await getUpdate();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
return (
|
|
249
|
+
<>
|
|
250
|
+
{chatContainerType?.toLowerCase() === "fixed" ? (
|
|
251
|
+
<>
|
|
252
|
+
{/* chat tipo fixed */}
|
|
253
|
+
<ContainerFixed className={classNameContainerFixed}>
|
|
254
|
+
<ContentChat
|
|
255
|
+
chatType={chatType?.toLowerCase()}
|
|
256
|
+
chatContainerType={"fixed"}
|
|
257
|
+
dataChat={data}
|
|
258
|
+
showBtnClose={false}
|
|
259
|
+
/>
|
|
260
|
+
</ContainerFixed>
|
|
261
|
+
</>
|
|
262
|
+
) : (
|
|
263
|
+
<>
|
|
264
|
+
{/* chat tipo popUp */}
|
|
265
|
+
<ContainerBtnPopUpChat>
|
|
266
|
+
<ButtonV2
|
|
267
|
+
className={"container-btn-popUpChat"}
|
|
268
|
+
type={"whiteS2"}
|
|
269
|
+
size={14}
|
|
270
|
+
borderType={"circle"}
|
|
271
|
+
icon={IconChat}
|
|
272
|
+
onClick={async (event) => {
|
|
273
|
+
setShowPopUpChat(!showPopUpChat);
|
|
274
|
+
}}
|
|
275
|
+
/>
|
|
276
|
+
</ContainerBtnPopUpChat>
|
|
277
|
+
|
|
278
|
+
<Slide direction={"left"} in={showPopUpChat} timeout={400}>
|
|
279
|
+
<ContainerPopUp>
|
|
280
|
+
<ContentChat
|
|
281
|
+
chatType={chatType?.toLowerCase()}
|
|
282
|
+
chatContainerType={"popUp"}
|
|
283
|
+
dataChat={data}
|
|
284
|
+
showBtnClose={true}
|
|
285
|
+
onClickBtnClose={() => {
|
|
286
|
+
setShowPopUpChat(false);
|
|
287
|
+
}}
|
|
288
|
+
/>
|
|
289
|
+
</ContainerPopUp>
|
|
290
|
+
</Slide>
|
|
291
|
+
</>
|
|
292
|
+
)}
|
|
293
|
+
</>
|
|
294
|
+
);
|
|
295
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { GlobalColors, FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
// Container para chat fixed
|
|
5
|
+
export const ContainerFixed = styled.div`
|
|
6
|
+
width: auto;
|
|
7
|
+
max-width: 550px;
|
|
8
|
+
min-width: 325px;
|
|
9
|
+
height: 100%;
|
|
10
|
+
flex-grow: 2;
|
|
11
|
+
background-color: white;
|
|
12
|
+
border: 1px solid #f0f0f0;
|
|
13
|
+
z-index: 1000;
|
|
14
|
+
padding: 0px;
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
export const ContainerBtnPopUpChat = styled.div`
|
|
18
|
+
border-radius: 50%;
|
|
19
|
+
height: 34px;
|
|
20
|
+
width: 34px;
|
|
21
|
+
|
|
22
|
+
.container-btn-popUpChat {
|
|
23
|
+
height: inherit;
|
|
24
|
+
width: inherit;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const ContainerPopUp = styled.div`
|
|
30
|
+
position: fixed;
|
|
31
|
+
top: 20px;
|
|
32
|
+
right: 23px;
|
|
33
|
+
bottom: 20px;
|
|
34
|
+
box-shadow: 0px 2px 10px 0px #00000073;
|
|
35
|
+
z-index: 1000;
|
|
36
|
+
width: calc(100% - 50px);
|
|
37
|
+
max-width: 550px;
|
|
38
|
+
min-width: 325px;
|
|
39
|
+
border-radius: 10px;
|
|
40
|
+
background: white;
|
|
41
|
+
padding: 0px;
|
|
42
|
+
`;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import Modal from "./index";
|
|
2
|
+
import ButtonV2 from "../../atoms/ButtonV2";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/organisms/Modal",
|
|
6
|
+
component: Modal,
|
|
7
|
+
argTypes: {
|
|
8
|
+
icon: {
|
|
9
|
+
options: [undefined, "error", "warning", "success", "info"],
|
|
10
|
+
control: { type: "select" },
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Template = (args) => <Modal {...args} />;
|
|
16
|
+
|
|
17
|
+
export const modalDefault = Template.bind({});
|
|
18
|
+
modalDefault.args = {
|
|
19
|
+
show: false,
|
|
20
|
+
title: "Titulo del modal",
|
|
21
|
+
icon: undefined,
|
|
22
|
+
message: `descripcion amplia sobre el componente
|
|
23
|
+
modal white para saber como se ven varias lineas
|
|
24
|
+
de codigo`,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const modalWithButtons = Template.bind({});
|
|
28
|
+
modalWithButtons.args = {
|
|
29
|
+
show: false,
|
|
30
|
+
title: "Titulo del modal",
|
|
31
|
+
icon: undefined,
|
|
32
|
+
message: `descripcion amplia sobre el componente
|
|
33
|
+
modal white para saber como se ven varias lineas
|
|
34
|
+
de codigo`,
|
|
35
|
+
buttons: [
|
|
36
|
+
<ButtonV2
|
|
37
|
+
key={"btn-Cancelar"}
|
|
38
|
+
type={"white"}
|
|
39
|
+
label={"Cancelar"}
|
|
40
|
+
size={12}
|
|
41
|
+
onClick={(event) => {
|
|
42
|
+
alert("cancelar");
|
|
43
|
+
}}
|
|
44
|
+
/>,
|
|
45
|
+
<ButtonV2
|
|
46
|
+
key={"btn-Aceptar"}
|
|
47
|
+
type={"pink"}
|
|
48
|
+
label={"Aceptar"}
|
|
49
|
+
size={12}
|
|
50
|
+
onClick={(event) => {
|
|
51
|
+
alert("aceptar");
|
|
52
|
+
}}
|
|
53
|
+
/>,
|
|
54
|
+
],
|
|
55
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { ContainerModal } from "./styles";
|
|
3
|
+
import {
|
|
4
|
+
faClose as xIcon,
|
|
5
|
+
faExclamationTriangle as warningIcon,
|
|
6
|
+
faCheck as successIcon,
|
|
7
|
+
faExclamation as infoIcon,
|
|
8
|
+
} from "@fortawesome/free-solid-svg-icons";
|
|
9
|
+
import { FontAwesomeIcon as Icon } from "@fortawesome/react-fontawesome";
|
|
10
|
+
import { Fade, Grow, Zoom, Modal as ModalMUI, Backdrop } from "@mui/material";
|
|
11
|
+
import ButtonV2 from "../../atoms/ButtonV2";
|
|
12
|
+
import CustomIcon from "../../atoms/CustomIcon";
|
|
13
|
+
|
|
14
|
+
export default function Modal(props) {
|
|
15
|
+
const {
|
|
16
|
+
className, // clases CSS del componente raiz del modal
|
|
17
|
+
show, // boolean
|
|
18
|
+
title, // string
|
|
19
|
+
message, // string
|
|
20
|
+
icon, // "error" | "warning" | "success" | "info" | (por default no icon)
|
|
21
|
+
customComponent, // JSX
|
|
22
|
+
buttons, // array<JSX>
|
|
23
|
+
onClickModal, // (event) => {}
|
|
24
|
+
onClickBtnDefault, // (event) => {}
|
|
25
|
+
} = props;
|
|
26
|
+
const icons = {
|
|
27
|
+
error: xIcon,
|
|
28
|
+
warning: warningIcon,
|
|
29
|
+
info: infoIcon,
|
|
30
|
+
success: successIcon,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Backdrop
|
|
35
|
+
open={show}
|
|
36
|
+
className="container-backgroundModal"
|
|
37
|
+
timeout={400}
|
|
38
|
+
style={{
|
|
39
|
+
backgroundColor: "transparent",
|
|
40
|
+
zIndex: 10,
|
|
41
|
+
}}
|
|
42
|
+
onClick={(event) => onClickModal && onClickModal(event)}
|
|
43
|
+
>
|
|
44
|
+
<Fade in={show} timeout={400}>
|
|
45
|
+
<ContainerModal className={className ? className : ""}>
|
|
46
|
+
<div className="contentModal">
|
|
47
|
+
<header>
|
|
48
|
+
{/* titulo */}
|
|
49
|
+
{![null, undefined, ""].includes(title?.trim()) && (
|
|
50
|
+
<label className="label-title">{title.trim()}</label>
|
|
51
|
+
)}
|
|
52
|
+
</header>
|
|
53
|
+
|
|
54
|
+
{/* icono modal */}
|
|
55
|
+
{icons[icon?.toLowerCase()] && (
|
|
56
|
+
<CustomIcon
|
|
57
|
+
type={"white"}
|
|
58
|
+
className={"iconModal " + "iconModal-" + icon.toLowerCase()}
|
|
59
|
+
size={35}
|
|
60
|
+
borderType={"circle"}
|
|
61
|
+
icon={icons[icon.toLowerCase()]}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
|
|
65
|
+
{/* label message */}
|
|
66
|
+
{![null, undefined, ""].includes(message?.trim()) && (
|
|
67
|
+
<label className="label-message"> {message.trim()} </label>
|
|
68
|
+
)}
|
|
69
|
+
|
|
70
|
+
{/* custom component */}
|
|
71
|
+
{customComponent && (
|
|
72
|
+
<div className="container-customComponent">{customComponent}</div>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
{/* container buttons */}
|
|
76
|
+
<div className="container-buttons">
|
|
77
|
+
{buttons?.length ? (
|
|
78
|
+
buttons
|
|
79
|
+
) : (
|
|
80
|
+
<ButtonV2
|
|
81
|
+
key={"btn-Aceptar"}
|
|
82
|
+
type={"white"}
|
|
83
|
+
borderType={"oval"}
|
|
84
|
+
label={"Aceptar"}
|
|
85
|
+
size={12}
|
|
86
|
+
onClick={(event) =>
|
|
87
|
+
onClickBtnDefault && onClickBtnDefault(event)
|
|
88
|
+
}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</ContainerModal>
|
|
94
|
+
</Fade>
|
|
95
|
+
</Backdrop>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { FontFamily } from "../../../global-files/variables";
|
|
3
|
+
|
|
4
|
+
export const ContainerModal = styled.div`
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
overflow: auto;
|
|
8
|
+
display: grid;
|
|
9
|
+
place-items: center;
|
|
10
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
11
|
+
|
|
12
|
+
.contentModal {
|
|
13
|
+
width: fit-content;
|
|
14
|
+
max-width: 80%;
|
|
15
|
+
min-width: 80px;
|
|
16
|
+
height: fit-content;
|
|
17
|
+
max-height: 90%;
|
|
18
|
+
min-height: 120px;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
background-color: white;
|
|
23
|
+
border-radius: 10px;
|
|
24
|
+
padding: 25px 25px 20px 25px;
|
|
25
|
+
box-shadow: 0px 2px 4px 0px #00000040;
|
|
26
|
+
|
|
27
|
+
header {
|
|
28
|
+
width: 100%;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: flex-start;
|
|
33
|
+
gap: 6px;
|
|
34
|
+
margin-bottom: 20px;
|
|
35
|
+
|
|
36
|
+
.label-title {
|
|
37
|
+
width: 100%;
|
|
38
|
+
text-align: center;
|
|
39
|
+
font-family: ${FontFamily.RobotoMedium}, sans-serif;
|
|
40
|
+
font-size: 17px;
|
|
41
|
+
line-height: 1.2;
|
|
42
|
+
color: #262626;
|
|
43
|
+
white-space: pre-wrap;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.iconModal {
|
|
48
|
+
width: 50px;
|
|
49
|
+
height: 50px;
|
|
50
|
+
font-size: 30px;
|
|
51
|
+
border-width: 4px;
|
|
52
|
+
margin-bottom: 20px;
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
|
|
55
|
+
&.iconModal-error {
|
|
56
|
+
background-color: #953737;
|
|
57
|
+
border-color: #953737;
|
|
58
|
+
color: white;
|
|
59
|
+
}
|
|
60
|
+
&.iconModal-warning {
|
|
61
|
+
font-size: 27px;
|
|
62
|
+
padding-bottom: 8px;
|
|
63
|
+
color: #af9647;
|
|
64
|
+
border-color: #af9647;
|
|
65
|
+
}
|
|
66
|
+
&.iconModal-info {
|
|
67
|
+
border-color: #9e3e26;
|
|
68
|
+
color: #9e3e26;
|
|
69
|
+
}
|
|
70
|
+
&.iconModal-success {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.label-message {
|
|
75
|
+
width: 100%;
|
|
76
|
+
text-align: center;
|
|
77
|
+
font-family: ${FontFamily.RobotoRegular}, sans-serif;
|
|
78
|
+
font-size: 13px;
|
|
79
|
+
color: #707070;
|
|
80
|
+
white-space: pre-wrap;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.container-customComponent {
|
|
84
|
+
width: 100%;
|
|
85
|
+
max-height: 50vh;
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
margin-top: 20px;
|
|
89
|
+
padding: 0px 0px;
|
|
90
|
+
//border: 1px solid red;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.container-buttons {
|
|
94
|
+
width: 100%;
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: row;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
gap: 12px;
|
|
99
|
+
margin-top: 20px;
|
|
100
|
+
//border: 1px solid red;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
@@ -9,30 +9,29 @@ const Template = (args) => <Dashboard {...args} />;
|
|
|
9
9
|
export const DashboardDeafult = Template.bind({});
|
|
10
10
|
DashboardDeafult.args = {
|
|
11
11
|
user: {
|
|
12
|
-
id_user:
|
|
13
|
-
name: "
|
|
14
|
-
last_name: "
|
|
15
|
-
email: "
|
|
16
|
-
position: "
|
|
17
|
-
telephone:
|
|
18
|
-
country:
|
|
19
|
-
id_company:
|
|
20
|
-
id_cognito: "
|
|
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",
|
|
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:
|
|
27
|
+
id_role: 6,
|
|
28
28
|
active: 1,
|
|
29
29
|
is_retailer: 0,
|
|
30
|
-
email_notify:
|
|
31
|
-
is_superadmin: 0,
|
|
30
|
+
email_notify: null,
|
|
32
31
|
membership: {
|
|
33
|
-
id:
|
|
34
|
-
start_date: "2022-
|
|
35
|
-
end_date: "2023-
|
|
32
|
+
id: 750,
|
|
33
|
+
start_date: "2022-01-07T21:32:54.000Z",
|
|
34
|
+
end_date: "2023-01-07T21:32:54.000Z",
|
|
36
35
|
planID: 6,
|
|
37
36
|
plan: "prod_KvGd6YSTJyR3AP",
|
|
38
37
|
name: "Plan Small",
|
|
@@ -40,37 +39,7 @@ DashboardDeafult.args = {
|
|
|
40
39
|
products_limit: "1000",
|
|
41
40
|
type: "Enterprise",
|
|
42
41
|
},
|
|
43
|
-
src: "https://content-management-profile-prod.s3.amazonaws.com/id-
|
|
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
|
-
],
|
|
42
|
+
src: "https://content-management-profile-prod.s3.amazonaws.com/id-425/425.png?1666639556174",
|
|
74
43
|
},
|
|
75
|
-
jwt: "
|
|
44
|
+
jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJkYWVmODU5ZC00ODQyLTRkNDQtYTNiNC02ODZlNmJhNTVkMjgiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY2NzA3MjM5MCwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY2NzA3NTk5MCwiaWF0IjoxNjY3MDcyMzkwLCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.FbGtX1sC3b2c76hGcxkx-GSurEMKZSwNVEnuUOlV9Dhhqrre1VmtfjvodH_3Leipr4g38Sukb6Pr9lVgEy6DJ57MShpS63niXE7Y43FUJ4gVe4F6k8sYbXUaZYS2vw2_PibnycNsFrpD76fZ_ulTqlSuHNrnzf2mjcDFJ5Qlj8hcLlRnpu_DFVpIiXVyK9kvLE5jImHvo4oQZUSrnuIs-oUE7j8mX8-GH2e95Up2wnBMak6S6meMibKoUEFo2qdtDSFbS1JCMBq4vWw2DxToX-7AGXGp_CLxf-sjJ_UpLmFa0KyyxjhAE2cR9BGo8DM8LEUIqMvcz2KH-7e9QTgisA",
|
|
76
45
|
};
|