contentoh-components-library 21.3.47 → 21.3.49
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 +0 -2
- package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +11 -68
- package/dist/components/organisms/Chat/Chat.stories.js +1 -21
- package/dist/components/organisms/Chat/ContainerItems/index.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +191 -343
- package/dist/components/organisms/Chat/Footer/index.js +39 -48
- package/dist/components/organisms/Chat/index.js +3 -48
- package/dist/components/organisms/OrderDetail/OrderDetail.stories.js +1 -1
- package/dist/components/organisms/OrderDetail/utils/Table/styles.js +1 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +83 -112
- package/dist/components/pages/ProviderProductEdition/index.js +9 -2
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +70 -85
- package/dist/components/pages/RetailerProductEdition/index.js +2 -4
- package/package.json +1 -1
- package/src/components/molecules/AvatarAndValidation/index.js +1 -1
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +6 -52
- package/src/components/organisms/Chat/Chat.stories.js +0 -21
- package/src/components/organisms/Chat/ContainerItems/index.js +1 -4
- package/src/components/organisms/Chat/ContentChat/index.js +6 -81
- package/src/components/organisms/Chat/Footer/index.js +0 -11
- package/src/components/organisms/Chat/index.js +3 -47
- package/src/components/organisms/OrderDetail/OrderDetail.stories.js +1 -1
- package/src/components/organisms/OrderDetail/utils/Table/styles.js +2 -3
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +83 -120
- package/src/components/pages/ProviderProductEdition/index.js +3 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +75 -89
- package/src/components/pages/RetailerProductEdition/index.js +0 -2
|
@@ -31,102 +31,87 @@ R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TIPMxhCs85K5JIn1efY4yZ5TAvzaBbLItby8W7HdLnNjK4Cv39mTCprrk0yjmKhOGIA1gyVeXcm18n5LqSLmOyz85uwTRwZ91s2on49rX3cO9FZp5S3tg4MseNKePBBetwycXttVm_aJZOLGvt2XoAfdxXHTUk2uDu7IphAdz746qrgXxSFyq_cWX9SdWrYhAn_XjHbNOqOuvcmbD7FquvUq-RYWqTAyeT9qeZUjA8oJvENkpohybxc6OoKaPOcdxWvZsvNcFxpEzjHQja3dAQnlA-Pc9_iJf9S4fzf3d3aqXIIDQuozJiixnT6-kK29p4MVbEJ2r4Pd2Ox2A",
|
|
35
35
|
productSelected: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
"
|
|
36
|
+
orderId: 15104,
|
|
37
|
+
article_status: "AP",
|
|
38
|
+
datasheet_status: "AC",
|
|
39
|
+
description_status: "AC",
|
|
40
|
+
images_status: "AC",
|
|
41
|
+
prio: "none",
|
|
42
|
+
version: 3,
|
|
43
|
+
brand: null,
|
|
44
|
+
article: {
|
|
45
|
+
category: "Juguetes|Juguetes|Juguetes",
|
|
46
|
+
company_name: "Financiado Bodega",
|
|
47
|
+
id_company: 912,
|
|
48
|
+
country: "México",
|
|
49
|
+
id_category: "4208",
|
|
50
|
+
id_article: 37569,
|
|
51
|
+
name: "BB HORA DEL BANO SET MENTA",
|
|
52
|
+
upc: "93905444796"
|
|
49
53
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"images": 1
|
|
54
|
-
},
|
|
55
|
-
"article": {
|
|
56
|
-
"category": "Puertas y Ventanas|Molduras|Molduras Madera Blanda",
|
|
57
|
-
"company_name": "Demo",
|
|
58
|
-
"country": "México",
|
|
59
|
-
"id_category": "2366",
|
|
60
|
-
"id_datasheet_especialist": null,
|
|
61
|
-
"id_datasheet_facilitator": null,
|
|
62
|
-
"id_description_especialist": null,
|
|
63
|
-
"id_description_facilitator": null,
|
|
64
|
-
"id_images_especialist": null,
|
|
65
|
-
"id_images_facilitator": null,
|
|
66
|
-
"id_order": 15160,
|
|
67
|
-
"id_article": 39290,
|
|
68
|
-
"id_auditor": 37,
|
|
69
|
-
"name": "MOLDURA MARCO MODER 11X4X244 CM",
|
|
70
|
-
"timestamp": "2023-04-19T21:36:02.000Z",
|
|
71
|
-
"upc": "100030"
|
|
72
|
-
},
|
|
73
|
-
"retailers": [{
|
|
74
|
-
"id": 58,
|
|
75
|
-
"name": "The Home Depot Golden"
|
|
76
|
-
}, {
|
|
77
|
-
"id": 68,
|
|
78
|
-
"name": "The Home Depot Merchants"
|
|
54
|
+
retailers: [{
|
|
55
|
+
id: 70,
|
|
56
|
+
name: "Bodega Aurrera"
|
|
79
57
|
}],
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
58
|
+
services: {
|
|
59
|
+
datasheets: 1,
|
|
60
|
+
descriptions: 1,
|
|
61
|
+
images: 1
|
|
62
|
+
},
|
|
63
|
+
statusByRetailer: {
|
|
64
|
+
70: {
|
|
65
|
+
datasheet: "AP",
|
|
66
|
+
description: "AP",
|
|
67
|
+
images: "AP"
|
|
85
68
|
}
|
|
86
|
-
}
|
|
69
|
+
},
|
|
70
|
+
retailersWithService: ["70"],
|
|
71
|
+
id_article: 37569,
|
|
72
|
+
retailersAvailable: [{
|
|
73
|
+
id: 70,
|
|
74
|
+
name: "Bodega Aurrera"
|
|
75
|
+
}]
|
|
87
76
|
},
|
|
88
77
|
location: {
|
|
89
78
|
product: {
|
|
90
|
-
articleId:
|
|
79
|
+
articleId: 37569,
|
|
91
80
|
versionId: 3
|
|
92
|
-
},
|
|
93
|
-
state: {
|
|
94
|
-
withChat: true,
|
|
95
|
-
chatType: "product_status"
|
|
96
81
|
}
|
|
97
82
|
},
|
|
98
83
|
user: {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
84
|
+
id_user: 132,
|
|
85
|
+
name: "Bodega",
|
|
86
|
+
last_name: "Aurrera",
|
|
87
|
+
email: "cadenabodega@allfreemail.net",
|
|
88
|
+
position: "TI",
|
|
89
|
+
telephone: "+529999999999",
|
|
90
|
+
country: "México",
|
|
91
|
+
id_company: 912,
|
|
92
|
+
id_cognito: "fb2304ef-e1a2-4c2b-8874-eb754e4f6332",
|
|
93
|
+
birth_Date: null,
|
|
94
|
+
about_me: null,
|
|
95
|
+
zip_code: null,
|
|
96
|
+
address: null,
|
|
97
|
+
job: null,
|
|
98
|
+
id_stripe: null,
|
|
99
|
+
id_role: 0,
|
|
100
|
+
active: 1,
|
|
101
|
+
is_retailer: 1,
|
|
102
|
+
email_notify: 1,
|
|
103
|
+
is_user_tech: null,
|
|
104
|
+
membership: {
|
|
105
|
+
id: 101,
|
|
106
|
+
start_date: "2022-12-22T19:16:53.000Z",
|
|
107
|
+
end_date: "2023-12-22T19:16:53.000Z",
|
|
108
|
+
planID: 8,
|
|
109
|
+
plan: "prod_KtlhECVSFG2iro",
|
|
110
|
+
name: "Plan Pro",
|
|
111
|
+
user_limit: "20",
|
|
112
|
+
products_limit: "5000",
|
|
113
|
+
type: "Enterprise"
|
|
129
114
|
},
|
|
130
|
-
|
|
115
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-132/132.png?1683919912271"
|
|
131
116
|
}
|
|
132
117
|
};
|
|
@@ -202,7 +202,7 @@ var myBucket = new _awsSdk.default.S3({
|
|
|
202
202
|
});
|
|
203
203
|
|
|
204
204
|
var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
205
|
-
var _product$retailers, _location$state,
|
|
205
|
+
var _product$retailers, _location$state, _product$services2, _datasheets$, _datasheets$$data, _product$article18, _comment$message;
|
|
206
206
|
|
|
207
207
|
var tabsSections = _ref.tabsSections,
|
|
208
208
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -1900,10 +1900,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1900
1900
|
setCompare: setCompare,
|
|
1901
1901
|
isAuditor: [1, 6].includes(user.id_role),
|
|
1902
1902
|
withChat: location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.withChat,
|
|
1903
|
-
chatType: location === null || location === void 0 ? void 0 : (_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.chatType,
|
|
1904
1903
|
productSelected: productSelected,
|
|
1905
|
-
token: token
|
|
1906
|
-
activeRetailer: activeRetailer
|
|
1904
|
+
token: token
|
|
1907
1905
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1908
1906
|
className: "data-container",
|
|
1909
1907
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ export const CarouselImagesLogin = ({
|
|
|
27
27
|
img2.src = images[i];
|
|
28
28
|
const circulo_actual = Array.from(circulos).find((el) => el.id === i);
|
|
29
29
|
Array.from(circulos).forEach((cir) => cir.classList.remove("resaltado"));
|
|
30
|
-
circulo_actual
|
|
30
|
+
circulo_actual.classList.add("resaltado");
|
|
31
31
|
img1.classList.add("right");
|
|
32
32
|
img2.classList.add("active");
|
|
33
33
|
i++;
|
|
@@ -4,13 +4,10 @@ import { Button } from "../../atoms/GeneralButton/index";
|
|
|
4
4
|
import { useEffect, useRef } from "react";
|
|
5
5
|
import { Chat } from "../../organisms/Chat";
|
|
6
6
|
import auditIcon from "../../../../src/assets/images/generalButton/Icono AB.svg";
|
|
7
|
-
import { useState } from "react";
|
|
8
|
-
import { render } from "@testing-library/react";
|
|
9
7
|
|
|
10
8
|
export const HeaderTop = ({
|
|
11
9
|
setHeaderTop,
|
|
12
10
|
withChat,
|
|
13
|
-
chatType,
|
|
14
11
|
productSelected,
|
|
15
12
|
token,
|
|
16
13
|
auditableVersion,
|
|
@@ -19,51 +16,16 @@ export const HeaderTop = ({
|
|
|
19
16
|
activeRetailer,
|
|
20
17
|
}) => {
|
|
21
18
|
const headerTop = useRef();
|
|
22
|
-
const [chat, setChat] = useState(null);
|
|
23
|
-
const [chatData, setChatData] = useState(null);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (activeRetailer.id && productSelected && token.length) {
|
|
27
|
-
setChatData({
|
|
28
|
-
id: productSelected?.article?.id_article || productSelected?.id_article,
|
|
29
|
-
version: productSelected?.version,
|
|
30
|
-
retailerId: activeRetailer?.id,
|
|
31
|
-
status: productSelected?.status,
|
|
32
|
-
userToken: token,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}, [activeRetailer, productSelected, token]);
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (chatType) renderChat(chatType);
|
|
39
|
-
}, [chatData, chatType]);
|
|
40
19
|
|
|
41
20
|
useEffect(() => {
|
|
42
21
|
setHeaderTop && setHeaderTop(headerTop.current.clientHeight);
|
|
43
22
|
}, []);
|
|
44
23
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<Chat
|
|
51
|
-
chatType="product_status"
|
|
52
|
-
chatContainerType="popUp"
|
|
53
|
-
chatData={{
|
|
54
|
-
id: chatData?.id,
|
|
55
|
-
version: chatData?.version,
|
|
56
|
-
retailerId: chatData?.retailerId,
|
|
57
|
-
status: chatData?.status,
|
|
58
|
-
userToken: chatData?.userToken,
|
|
59
|
-
}}
|
|
60
|
-
size={18}
|
|
61
|
-
activeRetailer={activeRetailer}
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
setChat(
|
|
24
|
+
return (
|
|
25
|
+
<Container ref={headerTop}>
|
|
26
|
+
<ScreenHeader text="Edición de producto" />
|
|
27
|
+
<div className="buttons-container">
|
|
28
|
+
{withChat && (
|
|
67
29
|
<Chat
|
|
68
30
|
chatType="merchant_product"
|
|
69
31
|
chatContainerType="popUp"
|
|
@@ -75,16 +37,8 @@ export const HeaderTop = ({
|
|
|
75
37
|
size={18}
|
|
76
38
|
activeRetailer={activeRetailer}
|
|
77
39
|
/>
|
|
78
|
-
)
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
40
|
+
)}
|
|
82
41
|
|
|
83
|
-
return (
|
|
84
|
-
<Container ref={headerTop}>
|
|
85
|
-
<ScreenHeader text="Edición de producto" />
|
|
86
|
-
<div className="buttons-container">
|
|
87
|
-
{withChat && chat}
|
|
88
42
|
{isAuditor && auditableVersion && (
|
|
89
43
|
<Button
|
|
90
44
|
buttonType="general-white-button circular-button"
|
|
@@ -162,24 +162,3 @@ chatTicket_userTECH.args = {
|
|
|
162
162
|
},
|
|
163
163
|
classNameContainerFixed: "chatTicket",
|
|
164
164
|
};
|
|
165
|
-
|
|
166
|
-
// ejemplo del chat para los cambios de status del producto.
|
|
167
|
-
export const chatProduct_status = Template.bind({});
|
|
168
|
-
chatProduct_status.args = {
|
|
169
|
-
chatType: "product_status",
|
|
170
|
-
chatContainerType: "popUp",
|
|
171
|
-
chatData: {
|
|
172
|
-
id: 37414,
|
|
173
|
-
version: 7,
|
|
174
|
-
retailerId: 70,
|
|
175
|
-
status: "AA",
|
|
176
|
-
orderId: 15189,
|
|
177
|
-
userToken:
|
|
178
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlV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cxgkrskywZJp9FW5VgYXuDcC5NpvomMMRy_v95UV897JzCHl__sK2Z9ahm0eczVN3tAc0GbKnlN96ZrGTQ_nmNHbuMDPQBPXH5HXZQ",
|
|
179
|
-
currentUser: {
|
|
180
|
-
id: 37,
|
|
181
|
-
companyId: 2,
|
|
182
|
-
isUserTech: false,
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
};
|
|
@@ -55,10 +55,7 @@ export const ContainerItems = (props) => {
|
|
|
55
55
|
|
|
56
56
|
useEffect(() => {
|
|
57
57
|
if (!items) return;
|
|
58
|
-
if (
|
|
59
|
-
["merchant_product", "order_product", "product_status"].includes(chatType)
|
|
60
|
-
)
|
|
61
|
-
renderItems();
|
|
58
|
+
if (["merchant_product", "order_product"].includes(chatType)) renderItems();
|
|
62
59
|
else if (chatType === "ticket") renderItemsTicket();
|
|
63
60
|
else setCustomItems([]);
|
|
64
61
|
}, [items]);
|
|
@@ -100,7 +100,6 @@ export const ContentChat = (props) => {
|
|
|
100
100
|
}
|
|
101
101
|
if (chatType === "merchant_product") getInitialMerchantProduct();
|
|
102
102
|
else if (chatType === "order_product") getInitialOrderProduct();
|
|
103
|
-
else if (chatType === "product_status") getInitialProductStatus();
|
|
104
103
|
else getInitialTicket();
|
|
105
104
|
}
|
|
106
105
|
if (!showPopUpChat) {
|
|
@@ -127,8 +126,6 @@ export const ContentChat = (props) => {
|
|
|
127
126
|
} else if (chatType === "order_product") {
|
|
128
127
|
if (companies) getUpdateLatestOrderProduct(true);
|
|
129
128
|
else getInitialOrderProduct();
|
|
130
|
-
} else if (chatType === "product_status") {
|
|
131
|
-
getInitialProductStatus();
|
|
132
129
|
} else {
|
|
133
130
|
if (singleChat.items) getUpdateLatestTicket(true);
|
|
134
131
|
else getInitialTicket();
|
|
@@ -138,47 +135,6 @@ export const ContentChat = (props) => {
|
|
|
138
135
|
/*=======================================================================
|
|
139
136
|
PETICION GET INICIAL SEGUN EL TIPO DE CHAT
|
|
140
137
|
======================================================================= */
|
|
141
|
-
const getInitialProductStatus = async () => {
|
|
142
|
-
const paramsQuery = {
|
|
143
|
-
articleData: {
|
|
144
|
-
articleId: JSON.stringify(dataChat.id),
|
|
145
|
-
version: JSON.stringify(dataChat.version),
|
|
146
|
-
retailerId: JSON.stringify(dataChat.retailerId),
|
|
147
|
-
status: dataChat.status,
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
151
|
-
const response = await fetchGET(
|
|
152
|
-
process.env.REACT_APP_READ_MESSAGES,
|
|
153
|
-
paramsQuery,
|
|
154
|
-
paramsHeaders
|
|
155
|
-
);
|
|
156
|
-
if (!response.body) {
|
|
157
|
-
setErrorChat({
|
|
158
|
-
existError: true,
|
|
159
|
-
code: 400,
|
|
160
|
-
message: response.message,
|
|
161
|
-
errorDetail: response.errorDetail,
|
|
162
|
-
});
|
|
163
|
-
setIsLoading(false);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
// success
|
|
167
|
-
setStartUpdate((prev) => prev + 1);
|
|
168
|
-
setCurrentUser({
|
|
169
|
-
id: response.body.data.currentUserId,
|
|
170
|
-
companyId: response.body.data.currentCompanyId,
|
|
171
|
-
});
|
|
172
|
-
setLastUpdateDate(response.body.data.lastUpdateDate);
|
|
173
|
-
setAllUsers(response.body.users);
|
|
174
|
-
setSingleChat({
|
|
175
|
-
items: response.body.items,
|
|
176
|
-
enabledLoadMore: response.body.items.length === 50,
|
|
177
|
-
});
|
|
178
|
-
setErrorChat({ existError: false });
|
|
179
|
-
setIsLoading(false);
|
|
180
|
-
};
|
|
181
|
-
|
|
182
138
|
const getInitialMerchantProduct = async () => {
|
|
183
139
|
const paramsQuery = {
|
|
184
140
|
getType: "initial",
|
|
@@ -653,14 +609,12 @@ export const ContentChat = (props) => {
|
|
|
653
609
|
// enviar items a la BD
|
|
654
610
|
if (chatType === "merchant_product") {
|
|
655
611
|
errorCreate = await createItemsMerchantProduct(items);
|
|
656
|
-
} else if (chatType === "product_status") {
|
|
657
|
-
errorCreate = await createItemsProductStatus(items);
|
|
658
612
|
} else if (chatType === "order_product") {
|
|
659
613
|
errorCreate = await createItemsOrderProduct(items);
|
|
660
614
|
} else errorCreate = await createItemsTicket(items);
|
|
661
615
|
|
|
662
616
|
// actualizar chat para que aparezcan los items enviados
|
|
663
|
-
if (
|
|
617
|
+
if (chatType === "merchant_product") {
|
|
664
618
|
await getUpdateLatestMerchantProduct();
|
|
665
619
|
} else if (chatType === "order_product") {
|
|
666
620
|
await getUpdateLatestOrderProduct();
|
|
@@ -673,10 +627,9 @@ export const ContentChat = (props) => {
|
|
|
673
627
|
};
|
|
674
628
|
|
|
675
629
|
const createItemsMerchantProduct = async (items = []) => {
|
|
676
|
-
const { id, version
|
|
630
|
+
const { id, version } = dataChat;
|
|
677
631
|
const { id: retailerId } = activeRetailer;
|
|
678
632
|
const paramsBody = { id, version, items, retailerId };
|
|
679
|
-
if (chatType === "product_status") paramsBody["orderId"] = orderId;
|
|
680
633
|
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
681
634
|
const response = await fetchPOST(
|
|
682
635
|
process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT,
|
|
@@ -690,23 +643,6 @@ export const ContentChat = (props) => {
|
|
|
690
643
|
};
|
|
691
644
|
}
|
|
692
645
|
};
|
|
693
|
-
const createItemsProductStatus = async (items = []) => {
|
|
694
|
-
const { id, version, orderId, status } = dataChat;
|
|
695
|
-
const { id: retailerId } = activeRetailer;
|
|
696
|
-
const paramsBody = { id, version, items, retailerId, orderId, status };
|
|
697
|
-
const paramsHeaders = { Authorization: dataChat.userToken };
|
|
698
|
-
const response = await fetchPOST(
|
|
699
|
-
process.env.REACT_APP_CREATE_MESSAGES,
|
|
700
|
-
paramsBody,
|
|
701
|
-
paramsHeaders
|
|
702
|
-
);
|
|
703
|
-
if (!response.body) {
|
|
704
|
-
return {
|
|
705
|
-
message: response.message,
|
|
706
|
-
errorDetail: response.errorDetail,
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
};
|
|
710
646
|
|
|
711
647
|
const createItemsOrderProduct = async (items = []) => {
|
|
712
648
|
const paramsBody = {
|
|
@@ -754,11 +690,7 @@ export const ContentChat = (props) => {
|
|
|
754
690
|
SECCION DE FUNCIONES
|
|
755
691
|
======================================================================= */
|
|
756
692
|
const isSingleChat = () => {
|
|
757
|
-
if (
|
|
758
|
-
chatType === "merchant_product" ||
|
|
759
|
-
chatType === "ticket" ||
|
|
760
|
-
chatType === "product_status"
|
|
761
|
-
) {
|
|
693
|
+
if (chatType === "merchant_product" || chatType === "ticket") {
|
|
762
694
|
return true;
|
|
763
695
|
}
|
|
764
696
|
if (companies && Object.keys(companies).length < 2) return true;
|
|
@@ -869,7 +801,7 @@ export const ContentChat = (props) => {
|
|
|
869
801
|
// mostrar chat?
|
|
870
802
|
let items;
|
|
871
803
|
let enabledLoadMore;
|
|
872
|
-
if (["merchant_product", "ticket"
|
|
804
|
+
if (["merchant_product", "ticket"].includes(chatType)) {
|
|
873
805
|
items = singleChat.items;
|
|
874
806
|
enabledLoadMore = singleChat.enabledLoadMore;
|
|
875
807
|
}
|
|
@@ -911,9 +843,7 @@ export const ContentChat = (props) => {
|
|
|
911
843
|
activeCompanyId={activeCompanyId}
|
|
912
844
|
ticketCompany={ticketCompany}
|
|
913
845
|
currentUser={
|
|
914
|
-
["merchant_product", "order_product"
|
|
915
|
-
chatType
|
|
916
|
-
)
|
|
846
|
+
["merchant_product", "order_product"].includes(chatType)
|
|
917
847
|
? currentUser
|
|
918
848
|
: dataChat.currentUser
|
|
919
849
|
}
|
|
@@ -952,12 +882,6 @@ export const ContentChat = (props) => {
|
|
|
952
882
|
? { id: dataChat.id, version: currentArticle.version }
|
|
953
883
|
: chatType === "ticket"
|
|
954
884
|
? { id: dataChat.id }
|
|
955
|
-
: chatType === "product_status"
|
|
956
|
-
? {
|
|
957
|
-
id: dataChat.id,
|
|
958
|
-
version: dataChat.version,
|
|
959
|
-
retailerId: dataChat.retailerId,
|
|
960
|
-
}
|
|
961
885
|
: undefined
|
|
962
886
|
}
|
|
963
887
|
chatCompany={getChatCompany()}
|
|
@@ -1000,6 +924,7 @@ export const ContentChat = (props) => {
|
|
|
1000
924
|
}}
|
|
1001
925
|
/>
|
|
1002
926
|
)}
|
|
927
|
+
|
|
1003
928
|
{/* body */}
|
|
1004
929
|
{renderBodyChat()}
|
|
1005
930
|
</Container>
|
|
@@ -169,17 +169,6 @@ 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;
|
|
183
172
|
|
|
184
173
|
default:
|
|
185
174
|
errorMessage =
|
|
@@ -24,7 +24,7 @@ export const Chat = (props) => {
|
|
|
24
24
|
const [showPopUpChat, setShowPopUpChat] = useState(false);
|
|
25
25
|
const [data, setData] = useState();
|
|
26
26
|
|
|
27
|
-
const { ticketCompany
|
|
27
|
+
const { ticketCompany } = chatData || {};
|
|
28
28
|
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
switch (chatType) {
|
|
@@ -37,9 +37,6 @@ export const Chat = (props) => {
|
|
|
37
37
|
case "ticket":
|
|
38
38
|
validateChatTicket();
|
|
39
39
|
break;
|
|
40
|
-
case "product_status":
|
|
41
|
-
validateProductStatus();
|
|
42
|
-
break;
|
|
43
40
|
default:
|
|
44
41
|
setData({
|
|
45
42
|
code: 404,
|
|
@@ -49,45 +46,6 @@ export const Chat = (props) => {
|
|
|
49
46
|
}
|
|
50
47
|
}, [chatType]);
|
|
51
48
|
|
|
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
|
-
|
|
91
49
|
const isValidGeneral = (userToken, id) => {
|
|
92
50
|
// validar token del user
|
|
93
51
|
if (isStringEmpty(userToken)) {
|
|
@@ -111,8 +69,6 @@ export const Chat = (props) => {
|
|
|
111
69
|
retailerId, // number
|
|
112
70
|
} = chatData;
|
|
113
71
|
|
|
114
|
-
console.log(chatData, "chatData");
|
|
115
|
-
|
|
116
72
|
if (!isValidGeneral(userToken, id)) return;
|
|
117
73
|
|
|
118
74
|
// validar el ID de la OT en donde se encuentra el producto
|
|
@@ -241,7 +197,7 @@ export const Chat = (props) => {
|
|
|
241
197
|
dataChat={data}
|
|
242
198
|
showBtnClose={false}
|
|
243
199
|
ticketCompany={ticketCompany}
|
|
244
|
-
activeRetailer={props.activeRetailer
|
|
200
|
+
activeRetailer={props.activeRetailer}
|
|
245
201
|
/>
|
|
246
202
|
</ContainerFixed>
|
|
247
203
|
);
|
|
@@ -274,7 +230,7 @@ export const Chat = (props) => {
|
|
|
274
230
|
onClickBtnClose={() => {
|
|
275
231
|
setShowPopUpChat(false);
|
|
276
232
|
}}
|
|
277
|
-
activeRetailer={props.activeRetailer
|
|
233
|
+
activeRetailer={props.activeRetailer}
|
|
278
234
|
/>
|
|
279
235
|
</ContainerPopUp>
|
|
280
236
|
</Slide>
|
|
@@ -33,10 +33,9 @@ export const Column = styled.div`
|
|
|
33
33
|
.center {
|
|
34
34
|
margin: auto;
|
|
35
35
|
}
|
|
36
|
-
&:nth-child(2) {
|
|
36
|
+
&:nth-child(-n + 2) {
|
|
37
37
|
overflow: hidden;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
39
|
.tooltip {
|
|
41
40
|
position: relative;
|
|
42
41
|
display: inline-block;
|
|
@@ -49,7 +48,7 @@ export const Column = styled.div`
|
|
|
49
48
|
text-align: center;
|
|
50
49
|
padding: 5px 0;
|
|
51
50
|
border-radius: 3px;
|
|
52
|
-
|
|
51
|
+
|
|
53
52
|
position: absolute;
|
|
54
53
|
z-index: 1;
|
|
55
54
|
top: -8px;
|