contentoh-components-library 21.6.56 → 21.6.57
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/components/atoms/AsignationOption/index.js +1 -0
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/molecules/GalleryAssetElement/styles.js +1 -1
- package/dist/components/molecules/RetailerSelector/RetailerSelector.stories.js +23 -2
- package/dist/components/molecules/RetailerSelector/index.js +7 -2
- package/dist/components/molecules/RetailerSelectorv2/index.js +6 -2
- package/dist/components/organisms/DigitalAssetsTray/DigitalAssetsTray.stories.js +73 -9
- package/dist/components/organisms/DigitalAssetsTray/index.js +13 -5
- package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +905 -0
- package/dist/components/pages/CreatorsProductEdition/constants.js +19 -0
- package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +2967 -0
- package/dist/components/pages/CreatorsProductEdition/index.js +33 -0
- package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +537 -0
- package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +251 -0
- package/dist/components/pages/CreatorsProductEdition/sections/CommentBox.js +311 -0
- package/dist/components/pages/CreatorsProductEdition/sections/ImagePanel.js +421 -0
- package/dist/components/pages/CreatorsProductEdition/sections/ImagesSection.js +473 -0
- package/dist/components/pages/CreatorsProductEdition/sections/ProductHeader.js +379 -0
- package/dist/components/pages/CreatorsProductEdition/sections/ProductMedia.js +138 -0
- package/dist/components/pages/CreatorsProductEdition/sections/RetailerMenu.js +162 -0
- package/dist/components/pages/CreatorsProductEdition/sections/ServiceActions.js +542 -0
- package/dist/components/pages/CreatorsProductEdition/sections/StatusChip.js +50 -0
- package/dist/components/pages/CreatorsProductEdition/sections/TabsBar.js +247 -0
- package/dist/components/pages/CreatorsProductEdition/sections/VariantsPanel.js +389 -0
- package/dist/components/pages/CreatorsProductEdition/sections/tokens.js +90 -0
- package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +168 -0
- package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +74 -0
- package/dist/components/pages/CreatorsProductEdition/styles.js +46 -0
- package/dist/global-files/digital-assets/assetTypes.js +49 -12
- package/dist/global-files/digital-assets/uploadAssets.js +39 -16
- package/dist/global-files/digital-assets/useDigitalAssets.js +38 -25
- package/package.json +1 -1
- package/src/components/atoms/AsignationOption/index.js +1 -1
- package/src/components/atoms/AsignationOption/styles.js +9 -0
- package/src/components/molecules/GalleryAssetElement/styles.js +5 -1
- package/src/components/molecules/RetailerSelector/RetailerSelector.stories.js +15 -1
- package/src/components/molecules/RetailerSelector/index.js +8 -1
- package/src/components/molecules/RetailerSelectorv2/index.js +7 -1
- package/src/components/organisms/DigitalAssetsTray/DigitalAssetsTray.stories.js +67 -4
- package/src/components/organisms/DigitalAssetsTray/index.js +8 -4
- package/src/global-files/digital-assets/assetTypes.js +42 -10
- package/src/global-files/digital-assets/uploadAssets.js +38 -23
- package/src/global-files/digital-assets/useDigitalAssets.js +19 -8
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ProductHeader = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _react = require("react");
|
|
15
|
+
|
|
16
|
+
var _material = require("@mui/material");
|
|
17
|
+
|
|
18
|
+
var _LocalPolice = _interopRequireDefault(require("@mui/icons-material/LocalPolice"));
|
|
19
|
+
|
|
20
|
+
var _LocalPoliceOutlined = _interopRequireDefault(require("@mui/icons-material/LocalPoliceOutlined"));
|
|
21
|
+
|
|
22
|
+
var _acceptIcon = _interopRequireDefault(require("../../../../assets/images/generalButton/acceptIcon.svg"));
|
|
23
|
+
|
|
24
|
+
var _rejectIcon = _interopRequireDefault(require("../../../../assets/images/generalButton/rejectIcon.svg"));
|
|
25
|
+
|
|
26
|
+
var _nullIcon = _interopRequireDefault(require("../../../../assets/images/generalButton/nullIcon.svg"));
|
|
27
|
+
|
|
28
|
+
var _RetailerMenu = require("./RetailerMenu");
|
|
29
|
+
|
|
30
|
+
var _StatusChip = require("./StatusChip");
|
|
31
|
+
|
|
32
|
+
var _tokens = require("./tokens");
|
|
33
|
+
|
|
34
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
Cabecera del producto: nombre, estatus, completitud, fecha, datos (UPC, SKU,
|
|
38
|
+
categoría, proveedor), selector de cadena y botón de evaluación.
|
|
39
|
+
|
|
40
|
+
Reemplaza a `organisms/FullProductNameHeader` (y a sus hijos ProductNameHeader,
|
|
41
|
+
FeaturesBar, AvatarAndValidation, ValidationPanel) con los mismos props y el
|
|
42
|
+
mismo comportamiento, hecho con MUI y responsivo: en pantallas chicas las
|
|
43
|
+
filas se acomodan en varias líneas en vez de salirse.
|
|
44
|
+
*/
|
|
45
|
+
var getTime = function getTime(date) {
|
|
46
|
+
return date ? new Date(date).toLocaleDateString() : "";
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var FeatureTag = function FeatureTag(_ref) {
|
|
50
|
+
var feature = _ref.feature,
|
|
51
|
+
value = _ref.value;
|
|
52
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
53
|
+
component: "span",
|
|
54
|
+
sx: {
|
|
55
|
+
display: "inline-flex",
|
|
56
|
+
alignItems: "baseline",
|
|
57
|
+
gap: "5px",
|
|
58
|
+
maxWidth: "100%",
|
|
59
|
+
minHeight: 26,
|
|
60
|
+
px: "5px",
|
|
61
|
+
py: "4px",
|
|
62
|
+
boxSizing: "border-box",
|
|
63
|
+
bgcolor: _tokens.COLORS.s2,
|
|
64
|
+
borderRadius: "3px"
|
|
65
|
+
},
|
|
66
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
67
|
+
component: "span",
|
|
68
|
+
sx: {
|
|
69
|
+
fontFamily: _tokens.FONTS.Raleway_500,
|
|
70
|
+
fontSize: 14,
|
|
71
|
+
lineHeight: "18px",
|
|
72
|
+
color: _tokens.COLORS.original_magenta,
|
|
73
|
+
flexShrink: 0
|
|
74
|
+
},
|
|
75
|
+
children: feature
|
|
76
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
77
|
+
component: "span",
|
|
78
|
+
sx: {
|
|
79
|
+
fontFamily: _tokens.FONTS.AvenirNext,
|
|
80
|
+
fontSize: 12,
|
|
81
|
+
lineHeight: "16px",
|
|
82
|
+
letterSpacing: "-0.015em",
|
|
83
|
+
color: _tokens.COLORS.color_gray,
|
|
84
|
+
minWidth: 0,
|
|
85
|
+
overflowWrap: "anywhere"
|
|
86
|
+
},
|
|
87
|
+
children: value
|
|
88
|
+
})]
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var CompletenessBadges = function CompletenessBadges(_ref2) {
|
|
93
|
+
var percent = _ref2.percent;
|
|
94
|
+
var rounded = Math.round(percent !== null && percent !== void 0 ? percent : 0);
|
|
95
|
+
var complete = rounded >= 100;
|
|
96
|
+
var showPercent = percent || percent === 0;
|
|
97
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
98
|
+
children: [percent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
99
|
+
arrow: true,
|
|
100
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
101
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("b", {
|
|
102
|
+
children: "Campos requeridos"
|
|
103
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), "Este nuevo icono te indicar\xE1 cuando completes todos los campos requeridos"]
|
|
104
|
+
}),
|
|
105
|
+
children: complete ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_LocalPolice.default, {
|
|
106
|
+
sx: {
|
|
107
|
+
fontSize: 30,
|
|
108
|
+
color: _tokens.COLORS.color_pink,
|
|
109
|
+
cursor: "pointer"
|
|
110
|
+
}
|
|
111
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_LocalPoliceOutlined.default, {
|
|
112
|
+
sx: {
|
|
113
|
+
fontSize: 30,
|
|
114
|
+
color: _tokens.COLORS.s3,
|
|
115
|
+
cursor: "pointer"
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
}) : null, showPercent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
119
|
+
arrow: true,
|
|
120
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
121
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("b", {
|
|
122
|
+
children: "Porcentaje de requeridos"
|
|
123
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), "Este porcentaje indica la completitud de los atributos requeridos para todos los servicios."]
|
|
124
|
+
}),
|
|
125
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
126
|
+
component: "span",
|
|
127
|
+
sx: {
|
|
128
|
+
px: "6px",
|
|
129
|
+
height: 27,
|
|
130
|
+
lineHeight: "27px",
|
|
131
|
+
borderRadius: "15px",
|
|
132
|
+
bgcolor: complete ? _tokens.COLORS.color_pink : _tokens.COLORS.s3,
|
|
133
|
+
color: _tokens.COLORS.white,
|
|
134
|
+
fontFamily: _tokens.FONTS.AvenirNext,
|
|
135
|
+
fontWeight: 600,
|
|
136
|
+
fontSize: 14
|
|
137
|
+
},
|
|
138
|
+
children: [rounded, "%"]
|
|
139
|
+
})
|
|
140
|
+
})]
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
var EvaluationMenu = function EvaluationMenu(_ref3) {
|
|
145
|
+
var approve = _ref3.approve,
|
|
146
|
+
reject = _ref3.reject,
|
|
147
|
+
approveAll = _ref3.approveAll,
|
|
148
|
+
rejectAll = _ref3.rejectAll,
|
|
149
|
+
showApproveRejectAll = _ref3.showApproveRejectAll;
|
|
150
|
+
|
|
151
|
+
var _useState = (0, _react.useState)(null),
|
|
152
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
153
|
+
anchor = _useState2[0],
|
|
154
|
+
setAnchor = _useState2[1];
|
|
155
|
+
|
|
156
|
+
var close = function close() {
|
|
157
|
+
return setAnchor(null);
|
|
158
|
+
}; // Como en ValidationPanel: cada opción dispara su acción y el panel se cierra.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
var option = function option(icon, label, action) {
|
|
162
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
163
|
+
onClick: function onClick() {
|
|
164
|
+
close();
|
|
165
|
+
action && action();
|
|
166
|
+
},
|
|
167
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemIcon, {
|
|
168
|
+
sx: {
|
|
169
|
+
minWidth: 30
|
|
170
|
+
},
|
|
171
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
172
|
+
src: icon,
|
|
173
|
+
alt: "",
|
|
174
|
+
width: 20,
|
|
175
|
+
height: 20
|
|
176
|
+
})
|
|
177
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
178
|
+
primary: label,
|
|
179
|
+
primaryTypographyProps: {
|
|
180
|
+
sx: {
|
|
181
|
+
fontFamily: _tokens.FONTS.AvenirNext,
|
|
182
|
+
fontSize: 13,
|
|
183
|
+
color: _tokens.COLORS.s5,
|
|
184
|
+
whiteSpace: "normal"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
})]
|
|
188
|
+
}, label);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
192
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
193
|
+
title: "Evaluar",
|
|
194
|
+
arrow: true,
|
|
195
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
196
|
+
"aria-label": "Evaluar",
|
|
197
|
+
size: "small",
|
|
198
|
+
onClick: function onClick(e) {
|
|
199
|
+
return setAnchor(e.currentTarget);
|
|
200
|
+
},
|
|
201
|
+
sx: {
|
|
202
|
+
width: 25,
|
|
203
|
+
height: 25,
|
|
204
|
+
p: 0
|
|
205
|
+
},
|
|
206
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
207
|
+
src: _nullIcon.default,
|
|
208
|
+
alt: "",
|
|
209
|
+
width: 25,
|
|
210
|
+
height: 25
|
|
211
|
+
})
|
|
212
|
+
})
|
|
213
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Menu, {
|
|
214
|
+
anchorEl: anchor,
|
|
215
|
+
open: Boolean(anchor),
|
|
216
|
+
onClose: close,
|
|
217
|
+
anchorOrigin: {
|
|
218
|
+
vertical: "bottom",
|
|
219
|
+
horizontal: "right"
|
|
220
|
+
},
|
|
221
|
+
transformOrigin: {
|
|
222
|
+
vertical: "top",
|
|
223
|
+
horizontal: "right"
|
|
224
|
+
},
|
|
225
|
+
PaperProps: {
|
|
226
|
+
sx: {
|
|
227
|
+
mt: 1,
|
|
228
|
+
maxWidth: "calc(100vw - 24px)"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
children: [option(_acceptIcon.default, "Validado", approve), option(_rejectIcon.default, "Rechazado", reject), showApproveRejectAll && option(_acceptIcon.default, "Validar todo y enviar a evaluación", approveAll), showApproveRejectAll && option(_rejectIcon.default, "Rechazar todo y enviar a evaluación", rejectAll)]
|
|
232
|
+
})]
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
var ProductHeader = function ProductHeader(_ref4) {
|
|
237
|
+
var _headerData$article3, _headerData$article3$, _headerData$article3$2, _headerData$categoryR, _headerData$categoryR2, _headerData$categoryR3, _headerData$categoryR4, _headerData$article4, _headerData$article5, _headerData$article6, _headerData$article7, _headerData$article8;
|
|
238
|
+
|
|
239
|
+
var headerData = _ref4.headerData,
|
|
240
|
+
percent = _ref4.percent,
|
|
241
|
+
activeRetailer = _ref4.activeRetailer,
|
|
242
|
+
setActiveRetailer = _ref4.setActiveRetailer,
|
|
243
|
+
showValidationButtons = _ref4.showValidationButtons,
|
|
244
|
+
approve = _ref4.approve,
|
|
245
|
+
reject = _ref4.reject,
|
|
246
|
+
approveAll = _ref4.approveAll,
|
|
247
|
+
rejectAll = _ref4.rejectAll,
|
|
248
|
+
servicesData = _ref4.servicesData,
|
|
249
|
+
showApproveRejectAll = _ref4.showApproveRejectAll,
|
|
250
|
+
_ref4$showStatus = _ref4.showStatus,
|
|
251
|
+
showStatus = _ref4$showStatus === void 0 ? true : _ref4$showStatus;
|
|
252
|
+
|
|
253
|
+
// Misma fuente de cadenas que FullProductNameHeader: desde tareas llega el
|
|
254
|
+
// orden por cadena; si no, la relación categoría-cadena del artículo.
|
|
255
|
+
var _useState3 = (0, _react.useState)([]),
|
|
256
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
257
|
+
retailers = _useState4[0],
|
|
258
|
+
setRetailers = _useState4[1];
|
|
259
|
+
|
|
260
|
+
(0, _react.useEffect)(function () {
|
|
261
|
+
var _headerData$article, _ref5;
|
|
262
|
+
|
|
263
|
+
var fromTasks = Boolean(headerData.statusByRetailer);
|
|
264
|
+
var categoryRetailer = headerData.categoryRetailer || ((_headerData$article = headerData.article) === null || _headerData$article === void 0 ? void 0 : _headerData$article.categoryRetailer);
|
|
265
|
+
setRetailers((_ref5 = fromTasks ? headerData.categoryRetailerInOrder : categoryRetailer) !== null && _ref5 !== void 0 ? _ref5 : []);
|
|
266
|
+
}, [servicesData]);
|
|
267
|
+
var retailerIndex = (0, _react.useMemo)(function () {
|
|
268
|
+
var _headerData$article2, _source$findIndex;
|
|
269
|
+
|
|
270
|
+
var source = (headerData === null || headerData === void 0 ? void 0 : (_headerData$article2 = headerData.article) === null || _headerData$article2 === void 0 ? void 0 : _headerData$article2.categoryRetailer) || (headerData === null || headerData === void 0 ? void 0 : headerData.categoryRetailerInOrder) || (headerData === null || headerData === void 0 ? void 0 : headerData.categoryRetailer);
|
|
271
|
+
return (_source$findIndex = source === null || source === void 0 ? void 0 : source.findIndex(function (retailer) {
|
|
272
|
+
return (retailer === null || retailer === void 0 ? void 0 : retailer.id_retailer) === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
|
|
273
|
+
})) !== null && _source$findIndex !== void 0 ? _source$findIndex : -1;
|
|
274
|
+
}, [activeRetailer, headerData]);
|
|
275
|
+
var status = showStatus ? (headerData === null || headerData === void 0 ? void 0 : headerData.version_status) || (headerData === null || headerData === void 0 ? void 0 : headerData.status) || (headerData === null || headerData === void 0 ? void 0 : headerData.article_status) : null;
|
|
276
|
+
var category = ((headerData === null || headerData === void 0 ? void 0 : (_headerData$article3 = headerData.article) === null || _headerData$article3 === void 0 ? void 0 : (_headerData$article3$ = _headerData$article3.categoryRetailer) === null || _headerData$article3$ === void 0 ? void 0 : (_headerData$article3$2 = _headerData$article3$[retailerIndex]) === null || _headerData$article3$2 === void 0 ? void 0 : _headerData$article3$2.category_name) || (headerData === null || headerData === void 0 ? void 0 : (_headerData$categoryR = headerData.categoryRetailerInOrder) === null || _headerData$categoryR === void 0 ? void 0 : (_headerData$categoryR2 = _headerData$categoryR[retailerIndex]) === null || _headerData$categoryR2 === void 0 ? void 0 : _headerData$categoryR2.category) || (headerData === null || headerData === void 0 ? void 0 : (_headerData$categoryR3 = headerData.categoryRetailer) === null || _headerData$categoryR3 === void 0 ? void 0 : (_headerData$categoryR4 = _headerData$categoryR3[retailerIndex]) === null || _headerData$categoryR4 === void 0 ? void 0 : _headerData$categoryR4.category) || headerData.categoryName || "").replace(/\|/g, " | ");
|
|
277
|
+
var features = [{
|
|
278
|
+
feature: "UPC",
|
|
279
|
+
value: (headerData === null || headerData === void 0 ? void 0 : (_headerData$article4 = headerData.article) === null || _headerData$article4 === void 0 ? void 0 : _headerData$article4.upc) || (headerData === null || headerData === void 0 ? void 0 : headerData.upc)
|
|
280
|
+
}, {
|
|
281
|
+
feature: "SKU",
|
|
282
|
+
value: (headerData === null || headerData === void 0 ? void 0 : (_headerData$article5 = headerData.article) === null || _headerData$article5 === void 0 ? void 0 : _headerData$article5.sku) || (headerData === null || headerData === void 0 ? void 0 : headerData.sku)
|
|
283
|
+
}, {
|
|
284
|
+
feature: "Categoría",
|
|
285
|
+
value: category
|
|
286
|
+
}, {
|
|
287
|
+
feature: "Prov",
|
|
288
|
+
value: headerData === null || headerData === void 0 ? void 0 : (_headerData$article6 = headerData.article) === null || _headerData$article6 === void 0 ? void 0 : _headerData$article6.company_name
|
|
289
|
+
}].filter(function (item) {
|
|
290
|
+
return item.value;
|
|
291
|
+
});
|
|
292
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
293
|
+
component: "header",
|
|
294
|
+
sx: {
|
|
295
|
+
mb: "17px",
|
|
296
|
+
minWidth: 0
|
|
297
|
+
},
|
|
298
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
299
|
+
direction: "row",
|
|
300
|
+
alignItems: "center",
|
|
301
|
+
flexWrap: "wrap",
|
|
302
|
+
columnGap: "10px",
|
|
303
|
+
rowGap: 0.5,
|
|
304
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
305
|
+
component: "h2",
|
|
306
|
+
sx: {
|
|
307
|
+
fontFamily: _tokens.FONTS.Raleway,
|
|
308
|
+
fontWeight: 500,
|
|
309
|
+
fontSize: {
|
|
310
|
+
xs: 20,
|
|
311
|
+
sm: 24
|
|
312
|
+
},
|
|
313
|
+
lineHeight: {
|
|
314
|
+
xs: "28px",
|
|
315
|
+
sm: "36px"
|
|
316
|
+
},
|
|
317
|
+
letterSpacing: "-0.015em",
|
|
318
|
+
color: _tokens.COLORS.color_gray,
|
|
319
|
+
mt: "8px",
|
|
320
|
+
minWidth: 0,
|
|
321
|
+
overflowWrap: "anywhere"
|
|
322
|
+
},
|
|
323
|
+
children: (headerData === null || headerData === void 0 ? void 0 : (_headerData$article7 = headerData.article) === null || _headerData$article7 === void 0 ? void 0 : _headerData$article7.name) || (headerData === null || headerData === void 0 ? void 0 : headerData.name)
|
|
324
|
+
}), status && /*#__PURE__*/(0, _jsxRuntime.jsx)(_StatusChip.StatusChip, {
|
|
325
|
+
status: status
|
|
326
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CompletenessBadges, {
|
|
327
|
+
percent: percent
|
|
328
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
329
|
+
component: "span",
|
|
330
|
+
sx: {
|
|
331
|
+
fontFamily: _tokens.FONTS.AvenirNext,
|
|
332
|
+
fontSize: 13,
|
|
333
|
+
lineHeight: "18px",
|
|
334
|
+
color: _tokens.COLORS.s4
|
|
335
|
+
},
|
|
336
|
+
children: getTime((headerData === null || headerData === void 0 ? void 0 : (_headerData$article8 = headerData.article) === null || _headerData$article8 === void 0 ? void 0 : _headerData$article8.timestamp) || (headerData === null || headerData === void 0 ? void 0 : headerData.timestamp))
|
|
337
|
+
})]
|
|
338
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
339
|
+
direction: "row",
|
|
340
|
+
alignItems: "flex-start",
|
|
341
|
+
justifyContent: "space-between",
|
|
342
|
+
gap: 1,
|
|
343
|
+
sx: {
|
|
344
|
+
mt: 0.5
|
|
345
|
+
},
|
|
346
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
347
|
+
direction: "row",
|
|
348
|
+
flexWrap: "wrap",
|
|
349
|
+
gap: "8px",
|
|
350
|
+
sx: {
|
|
351
|
+
minWidth: 0
|
|
352
|
+
},
|
|
353
|
+
children: features.map(function (item) {
|
|
354
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FeatureTag, (0, _objectSpread2.default)({}, item), item.feature);
|
|
355
|
+
})
|
|
356
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
357
|
+
direction: "row",
|
|
358
|
+
alignItems: "center",
|
|
359
|
+
gap: 1,
|
|
360
|
+
sx: {
|
|
361
|
+
flexShrink: 0
|
|
362
|
+
},
|
|
363
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RetailerMenu.RetailerMenu, {
|
|
364
|
+
retailers: retailers,
|
|
365
|
+
activeRetailer: activeRetailer,
|
|
366
|
+
setActiveRetailer: setActiveRetailer
|
|
367
|
+
}), showValidationButtons && /*#__PURE__*/(0, _jsxRuntime.jsx)(EvaluationMenu, {
|
|
368
|
+
approve: approve,
|
|
369
|
+
reject: reject,
|
|
370
|
+
approveAll: approveAll,
|
|
371
|
+
rejectAll: rejectAll,
|
|
372
|
+
showApproveRejectAll: showApproveRejectAll
|
|
373
|
+
})]
|
|
374
|
+
})]
|
|
375
|
+
})]
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
exports.ProductHeader = ProductHeader;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ProductMedia = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _react = require("react");
|
|
15
|
+
|
|
16
|
+
var _material = require("@mui/material");
|
|
17
|
+
|
|
18
|
+
var _PlayCircleFilled = _interopRequireDefault(require("@mui/icons-material/PlayCircleFilled"));
|
|
19
|
+
|
|
20
|
+
var _assetTypes = require("../../../../global-files/digital-assets/assetTypes");
|
|
21
|
+
|
|
22
|
+
var _defaultProductImage = _interopRequireDefault(require("../../../../assets/images/defaultImages/defaultProductImage.png"));
|
|
23
|
+
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
Imagen o video de producto, con MUI. Hace lo mismo que `atoms/ProductImage`:
|
|
28
|
+
|
|
29
|
+
- El tipo se decide por `ext`; la URL no sirve porque apunta al
|
|
30
|
+
redimensionador de CloudFront y no conserva la extensión. El regex sobre la
|
|
31
|
+
URL queda de respaldo, igual que en el original.
|
|
32
|
+
- Una miniatura de video NO lleva controles (no caben y se tragan el clic):
|
|
33
|
+
se muestra el primer fotograma, un botón de play y la duración.
|
|
34
|
+
- Si la imagen no carga, se muestra la imagen por defecto.
|
|
35
|
+
*/
|
|
36
|
+
var isVideo = function isVideo(_ref) {
|
|
37
|
+
var src = _ref.src,
|
|
38
|
+
ext = _ref.ext;
|
|
39
|
+
return ext ? (0, _assetTypes.resolvePreviewKind)({
|
|
40
|
+
ext: ext
|
|
41
|
+
}) === _assetTypes.ASSET_PREVIEW.VIDEO : /\.mp4($|[?#])/i.test(src || "");
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var ProductMedia = function ProductMedia(_ref2) {
|
|
45
|
+
var src = _ref2.src,
|
|
46
|
+
ext = _ref2.ext,
|
|
47
|
+
_ref2$alt = _ref2.alt,
|
|
48
|
+
alt = _ref2$alt === void 0 ? "" : _ref2$alt,
|
|
49
|
+
_ref2$thumbnail = _ref2.thumbnail,
|
|
50
|
+
thumbnail = _ref2$thumbnail === void 0 ? false : _ref2$thumbnail,
|
|
51
|
+
sx = _ref2.sx;
|
|
52
|
+
|
|
53
|
+
var _useState = (0, _react.useState)(false),
|
|
54
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
55
|
+
failed = _useState2[0],
|
|
56
|
+
setFailed = _useState2[1];
|
|
57
|
+
|
|
58
|
+
var _useState3 = (0, _react.useState)(null),
|
|
59
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
60
|
+
duration = _useState4[0],
|
|
61
|
+
setDuration = _useState4[1];
|
|
62
|
+
|
|
63
|
+
var fill = {
|
|
64
|
+
width: "100%",
|
|
65
|
+
height: "100%",
|
|
66
|
+
objectFit: "contain",
|
|
67
|
+
display: "block"
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
if (isVideo({
|
|
71
|
+
src: src,
|
|
72
|
+
ext: ext
|
|
73
|
+
})) {
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
75
|
+
sx: (0, _objectSpread2.default)({
|
|
76
|
+
position: "relative",
|
|
77
|
+
width: "100%",
|
|
78
|
+
height: "100%"
|
|
79
|
+
}, sx),
|
|
80
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
81
|
+
component: "video",
|
|
82
|
+
src: thumbnail ? "".concat(src, "#t=0.5") : src,
|
|
83
|
+
controls: !thumbnail,
|
|
84
|
+
muted: thumbnail,
|
|
85
|
+
playsInline: true,
|
|
86
|
+
preload: "metadata",
|
|
87
|
+
onLoadedMetadata: function onLoadedMetadata(e) {
|
|
88
|
+
return setDuration(e.target.duration);
|
|
89
|
+
},
|
|
90
|
+
sx: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, fill), {}, {
|
|
91
|
+
bgcolor: "#000",
|
|
92
|
+
pointerEvents: thumbnail ? "none" : "auto"
|
|
93
|
+
})
|
|
94
|
+
}), thumbnail && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
95
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_PlayCircleFilled.default, {
|
|
96
|
+
"aria-hidden": true,
|
|
97
|
+
sx: {
|
|
98
|
+
position: "absolute",
|
|
99
|
+
top: "50%",
|
|
100
|
+
left: "50%",
|
|
101
|
+
transform: "translate(-50%, -50%)",
|
|
102
|
+
fontSize: 24,
|
|
103
|
+
color: "rgba(255,255,255,0.9)",
|
|
104
|
+
filter: "drop-shadow(0 0 2px rgba(0,0,0,0.6))",
|
|
105
|
+
pointerEvents: "none"
|
|
106
|
+
}
|
|
107
|
+
}), duration ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
108
|
+
component: "span",
|
|
109
|
+
sx: {
|
|
110
|
+
position: "absolute",
|
|
111
|
+
right: 3,
|
|
112
|
+
bottom: 3,
|
|
113
|
+
px: "4px",
|
|
114
|
+
borderRadius: "3px",
|
|
115
|
+
bgcolor: "rgba(0,0,0,0.75)",
|
|
116
|
+
color: "#fff",
|
|
117
|
+
fontSize: 9,
|
|
118
|
+
lineHeight: "13px",
|
|
119
|
+
pointerEvents: "none"
|
|
120
|
+
},
|
|
121
|
+
children: (0, _assetTypes.formatDuration)(duration)
|
|
122
|
+
}) : null]
|
|
123
|
+
})]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
128
|
+
component: "img",
|
|
129
|
+
src: failed || !src ? _defaultProductImage.default : src,
|
|
130
|
+
alt: alt,
|
|
131
|
+
onError: function onError() {
|
|
132
|
+
return setFailed(true);
|
|
133
|
+
},
|
|
134
|
+
sx: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, fill), sx)
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
exports.ProductMedia = ProductMedia;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.RetailerMenu = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
|
|
14
|
+
var _material = require("@mui/material");
|
|
15
|
+
|
|
16
|
+
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
17
|
+
|
|
18
|
+
var _ArrowDropUp = _interopRequireDefault(require("@mui/icons-material/ArrowDropUp"));
|
|
19
|
+
|
|
20
|
+
var _data = require("../../../../global-files/data");
|
|
21
|
+
|
|
22
|
+
var _StatusChip = require("./StatusChip");
|
|
23
|
+
|
|
24
|
+
var _tokens = require("./tokens");
|
|
25
|
+
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Selector de la cadena activa. Reemplaza a `molecules/RetailerSelector` con el
|
|
30
|
+
* mismo comportamiento:
|
|
31
|
+
* - el logo de la cadena activa abre la lista;
|
|
32
|
+
* - la activa se marca en rosa suave y con el círculo verde;
|
|
33
|
+
* - una cadena cuyo estatus de servicios es "NA" no se puede elegir.
|
|
34
|
+
*/
|
|
35
|
+
var RetailerMenu = function RetailerMenu(_ref) {
|
|
36
|
+
var _ref$retailers = _ref.retailers,
|
|
37
|
+
retailers = _ref$retailers === void 0 ? [] : _ref$retailers,
|
|
38
|
+
activeRetailer = _ref.activeRetailer,
|
|
39
|
+
setActiveRetailer = _ref.setActiveRetailer;
|
|
40
|
+
|
|
41
|
+
var _useState = (0, _react.useState)(null),
|
|
42
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
43
|
+
anchor = _useState2[0],
|
|
44
|
+
setAnchor = _useState2[1];
|
|
45
|
+
|
|
46
|
+
var activeId = (0, _tokens.retailerId)(activeRetailer);
|
|
47
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
48
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonBase, {
|
|
49
|
+
"aria-label": "Cambiar de cadena",
|
|
50
|
+
"aria-haspopup": "menu",
|
|
51
|
+
"aria-expanded": Boolean(anchor),
|
|
52
|
+
onClick: function onClick(e) {
|
|
53
|
+
return (retailers === null || retailers === void 0 ? void 0 : retailers.length) > 0 && setAnchor(e.currentTarget);
|
|
54
|
+
},
|
|
55
|
+
sx: {
|
|
56
|
+
borderRadius: "14px",
|
|
57
|
+
pr: 0.25
|
|
58
|
+
},
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
60
|
+
src: (0, _tokens.retailerImage)(activeRetailer),
|
|
61
|
+
alt: activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.name,
|
|
62
|
+
sx: {
|
|
63
|
+
width: 26,
|
|
64
|
+
height: 26,
|
|
65
|
+
bgcolor: _tokens.COLORS.s2
|
|
66
|
+
}
|
|
67
|
+
}), anchor ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropUp.default, {
|
|
68
|
+
sx: {
|
|
69
|
+
color: _tokens.COLORS.s4
|
|
70
|
+
}
|
|
71
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropDown.default, {
|
|
72
|
+
sx: {
|
|
73
|
+
color: _tokens.COLORS.s4
|
|
74
|
+
}
|
|
75
|
+
})]
|
|
76
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Menu, {
|
|
77
|
+
anchorEl: anchor,
|
|
78
|
+
open: Boolean(anchor),
|
|
79
|
+
onClose: function onClose() {
|
|
80
|
+
return setAnchor(null);
|
|
81
|
+
},
|
|
82
|
+
anchorOrigin: {
|
|
83
|
+
vertical: "bottom",
|
|
84
|
+
horizontal: "right"
|
|
85
|
+
},
|
|
86
|
+
transformOrigin: {
|
|
87
|
+
vertical: "top",
|
|
88
|
+
horizontal: "right"
|
|
89
|
+
},
|
|
90
|
+
PaperProps: {
|
|
91
|
+
sx: {
|
|
92
|
+
mt: 1,
|
|
93
|
+
bgcolor: _tokens.COLORS.s2,
|
|
94
|
+
border: "1px solid ".concat(_tokens.COLORS.s3),
|
|
95
|
+
maxWidth: "calc(100vw - 24px)"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
children: retailers.map(function (retailer, index) {
|
|
99
|
+
var isActive = (0, _tokens.retailerId)(retailer) != null && (0, _tokens.retailerId)(retailer) === activeId;
|
|
100
|
+
var status = retailer !== null && retailer !== void 0 && retailer.services ? (0, _data.getNewStatus)(retailer.services) : null;
|
|
101
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
102
|
+
selected: isActive,
|
|
103
|
+
onClick: function onClick() {
|
|
104
|
+
if (status === "NA") return;
|
|
105
|
+
setActiveRetailer(retailer);
|
|
106
|
+
setAnchor(null);
|
|
107
|
+
},
|
|
108
|
+
sx: {
|
|
109
|
+
gap: 1.25,
|
|
110
|
+
borderRadius: "3px",
|
|
111
|
+
mx: 0.75,
|
|
112
|
+
"&.Mui-selected, &.Mui-selected:hover": {
|
|
113
|
+
backgroundColor: "rgba(".concat(_tokens.COLORS.rgb_color_pink, ", 0.1)")
|
|
114
|
+
},
|
|
115
|
+
"&.Mui-selected:hover": {
|
|
116
|
+
backgroundColor: "rgba(".concat(_tokens.COLORS.rgb_color_pink, ", 0.18)")
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
120
|
+
sx: {
|
|
121
|
+
minWidth: 0
|
|
122
|
+
},
|
|
123
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
124
|
+
src: (0, _tokens.retailerImage)(retailer),
|
|
125
|
+
alt: retailer === null || retailer === void 0 ? void 0 : retailer.name,
|
|
126
|
+
sx: {
|
|
127
|
+
width: 26,
|
|
128
|
+
height: 26,
|
|
129
|
+
bgcolor: _tokens.COLORS.white
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
133
|
+
primary: retailer === null || retailer === void 0 ? void 0 : retailer.name,
|
|
134
|
+
secondary: retailer === null || retailer === void 0 ? void 0 : retailer.team,
|
|
135
|
+
primaryTypographyProps: {
|
|
136
|
+
sx: {
|
|
137
|
+
fontFamily: _tokens.FONTS.AvenirNext,
|
|
138
|
+
fontWeight: 500,
|
|
139
|
+
fontSize: 14,
|
|
140
|
+
color: _tokens.COLORS.s5,
|
|
141
|
+
whiteSpace: "normal"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}), status && /*#__PURE__*/(0, _jsxRuntime.jsx)(_StatusChip.StatusChip, {
|
|
145
|
+
status: status
|
|
146
|
+
}), isActive && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
147
|
+
"aria-label": "Cadena activa",
|
|
148
|
+
sx: {
|
|
149
|
+
width: 20,
|
|
150
|
+
height: 20,
|
|
151
|
+
flexShrink: 0,
|
|
152
|
+
borderRadius: "50%",
|
|
153
|
+
bgcolor: _tokens.COLORS.exported
|
|
154
|
+
}
|
|
155
|
+
})]
|
|
156
|
+
}, "".concat(index, "-").concat(retailer === null || retailer === void 0 ? void 0 : retailer.name));
|
|
157
|
+
})
|
|
158
|
+
})]
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
exports.RetailerMenu = RetailerMenu;
|