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
|
@@ -69,6 +69,7 @@ var AsignationOption = function AsignationOption(_ref) {
|
|
|
69
69
|
};
|
|
70
70
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
71
71
|
onClick: onClick,
|
|
72
|
+
className: active ? "active-option" : undefined,
|
|
72
73
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.Avatar, {
|
|
73
74
|
imageType: imageType,
|
|
74
75
|
image: profileImage,
|
|
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject;
|
|
17
17
|
|
|
18
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n cursor: pointer;\n border-radius: 3px;\n padding: 5px;\n\n .profile-image,\n .medium-image {\n & + * {\n margin-left: 15px;\n }\n }\n\n .labels-container {\n font-family: ", ";\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n\n .name-label,\n .team-label {\n inline-size: 100px;\n overflow: hidden;\n }\n\n .name-label {\n color: ", ";\n }\n\n .team-label {\n color: ", ";\n }\n\n & + * {\n margin-left: 11px;\n }\n }\n\n .status-container {\n & + * {\n margin-left: 10px;\n }\n }\n\n .green-circle {\n background-color: ", ";\n width: 20px;\n height: 20px;\n border-radius: 50%;\n }\n\n button {\n background-color: transparent;\n cursor: pointer;\n border: none;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n & + * {\n margin-top: 10px;\n }\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.s3);
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n cursor: pointer;\n border-radius: 3px;\n padding: 5px;\n\n .profile-image,\n .medium-image {\n & + * {\n margin-left: 15px;\n }\n }\n\n .labels-container {\n font-family: ", ";\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n\n .name-label,\n .team-label {\n inline-size: 100px;\n overflow: hidden;\n }\n\n .name-label {\n color: ", ";\n }\n\n .team-label {\n color: ", ";\n }\n\n & + * {\n margin-left: 11px;\n }\n }\n\n .status-container {\n & + * {\n margin-left: 10px;\n }\n }\n\n .green-circle {\n background-color: ", ";\n width: 20px;\n height: 20px;\n border-radius: 50%;\n }\n\n button {\n background-color: transparent;\n cursor: pointer;\n border: none;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n /* La opci\xF3n seleccionada (hoy: la cadena activa en el selector de cadenas). */\n &.active-option {\n background-color: rgba(", ", 0.1);\n\n &:hover {\n background-color: rgba(", ", 0.18);\n }\n }\n\n & + * {\n margin-top: 10px;\n }\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.s3, _variables.GlobalColors.rgb_color_pink, _variables.GlobalColors.rgb_color_pink);
|
|
19
19
|
|
|
20
20
|
exports.Container = Container;
|
|
@@ -21,6 +21,6 @@ var _templateObject;
|
|
|
21
21
|
cinco, porque un activo no tiene leyenda— y lo propio de un archivo que se
|
|
22
22
|
está subiendo: barra de progreso, mensaje de error y botón de quitar.
|
|
23
23
|
*/
|
|
24
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n\n &.grid-gallery {\n width: 179px;\n border-radius: 3px;\n overflow: hidden;\n\n .buttons-container {\n position: absolute;\n top: 5px;\n left: 5px;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .asset-container {\n border: 1px solid #f0eef2;\n\n .information-container {\n background-color: ", ";\n display: flex;\n justify-content: space-between;\n padding: 0 2px;\n\n p {\n font-family: ", ";\n color: ", ";\n font-size: 11px;\n line-height: 17px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n }\n }\n\n &.row-gallery {\n width: 100%;\n display: grid;\n grid-template-columns: 0.05fr 1fr;\n align-items: center;\n padding-right: 10px;\n\n .buttons-container {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .asset-container {\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n flex: 1;\n\n .information-container {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n align-items: center;\n\n p {\n font-family: ", ";\n color: ", ";\n font-size: 14px;\n line-height: 17px;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n & > * {\n flex: 1;\n padding: 5px;\n }\n }\n }\n }\n\n /* El nombre es el sitio donde uno intenta hacer clic para abrir un archivo. */\n .asset-link {\n cursor: pointer;\n text-decoration: underline;\n text-underline-offset: 2px;\n\n &:hover {\n color: ", ";\n }\n }\n\n &.asset-error {\n border: 1px solid ", ";\n border-radius: 3px;\n }\n\n /* Progreso de subida. Ocupa el borde inferior de la fila para no empujar el\n resto del contenido mientras aparece y desaparece. */\n .asset-progress {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 3px;\n background: ", ";\n border-radius: 2px;\n overflow: hidden;\n }\n\n .asset-progress-fill {\n height: 100%;\n background: ", ";\n transition: width 0.2s ease-out;\n }\n\n .asset-error-message {\n margin: 2px 0 0;\n padding: 0 8px;\n font-family: ", ";\n font-size: 11px;\n line-height: 15px;\n color: ", ";\n }\n\n .asset-remove {\n position: absolute;\n top: 4px;\n right: 6px;\n width: 18px;\n height: 18px;\n display: grid;\n place-items: center;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: ", ";\n color: ", ";\n font-size: 14px;\n line-height: 1;\n cursor: pointer;\n\n &:hover {\n background: ", ";\n }\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.Lato, _variables.GlobalColors.s4, _variables.FontFamily.Lato, _variables.GlobalColors.s4, _variables.GlobalColors.color_purple, _variables.GlobalColors.secondary_magenta, _variables.GlobalColors.s3, _variables.GlobalColors.color_purple, _variables.FontFamily.Lato, _variables.GlobalColors.secondary_magenta, _variables.GlobalColors.s2, _variables.GlobalColors.s5, _variables.GlobalColors.s3);
|
|
24
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n\n &.grid-gallery {\n width: 179px;\n border-radius: 3px;\n overflow: hidden;\n\n .buttons-container {\n position: absolute;\n top: 5px;\n left: 5px;\n z-index: 1;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .asset-container {\n border: 1px solid #f0eef2;\n\n .information-container {\n background-color: ", ";\n display: flex;\n justify-content: space-between;\n padding: 0 2px;\n\n p {\n font-family: ", ";\n color: ", ";\n font-size: 11px;\n line-height: 17px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n }\n }\n\n &.row-gallery {\n width: 100%;\n display: grid;\n grid-template-columns: 0.05fr 1fr;\n align-items: center;\n padding-right: 10px;\n\n .buttons-container {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .asset-container {\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n flex: 1;\n\n .information-container {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n align-items: center;\n\n p {\n font-family: ", ";\n color: ", ";\n font-size: 14px;\n line-height: 17px;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n & > * {\n flex: 1;\n padding: 5px;\n }\n }\n }\n }\n\n /* El nombre es el sitio donde uno intenta hacer clic para abrir un archivo. */\n .asset-link {\n cursor: pointer;\n text-decoration: underline;\n text-underline-offset: 2px;\n\n &:hover {\n color: ", ";\n }\n }\n\n &.asset-error {\n border: 1px solid ", ";\n border-radius: 3px;\n }\n\n /* Progreso de subida. Ocupa el borde inferior de la fila para no empujar el\n resto del contenido mientras aparece y desaparece. */\n .asset-progress {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 3px;\n background: ", ";\n border-radius: 2px;\n overflow: hidden;\n }\n\n .asset-progress-fill {\n height: 100%;\n background: ", ";\n transition: width 0.2s ease-out;\n }\n\n /* En la fila, que es una rejilla de dos columnas, el mensaje ocupa todo el\n ancho. Si no, cae en la columna del checkbox, la ensancha hasta su palabra\n m\xE1s larga y descuadra la fila contra las dem\xE1s. */\n .asset-error-message {\n grid-column: 1 / -1;\n margin: 2px 0 0;\n padding: 0 8px 6px;\n font-family: ", ";\n font-size: 11px;\n line-height: 15px;\n color: ", ";\n }\n\n .asset-remove {\n position: absolute;\n top: 4px;\n right: 6px;\n width: 18px;\n height: 18px;\n display: grid;\n place-items: center;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: ", ";\n color: ", ";\n font-size: 14px;\n line-height: 1;\n cursor: pointer;\n\n &:hover {\n background: ", ";\n }\n }\n"])), _variables.GlobalColors.s2, _variables.FontFamily.Lato, _variables.GlobalColors.s4, _variables.FontFamily.Lato, _variables.GlobalColors.s4, _variables.GlobalColors.color_purple, _variables.GlobalColors.secondary_magenta, _variables.GlobalColors.s3, _variables.GlobalColors.color_purple, _variables.FontFamily.Lato, _variables.GlobalColors.secondary_magenta, _variables.GlobalColors.s2, _variables.GlobalColors.s5, _variables.GlobalColors.s3);
|
|
25
25
|
|
|
26
26
|
exports.Container = Container;
|
|
@@ -9,6 +9,10 @@ exports.default = exports.RetailerSelectorDefault = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
11
|
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _react = require("react");
|
|
15
|
+
|
|
12
16
|
var _index = require("./index");
|
|
13
17
|
|
|
14
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -16,11 +20,28 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
16
20
|
var _default = {
|
|
17
21
|
title: "Components/molecules/RetailerSelector",
|
|
18
22
|
component: _index.RetailerSelector
|
|
19
|
-
};
|
|
23
|
+
}; // El panel se abre hacia la izquierda del avatar: sin margen quedaría fuera de
|
|
24
|
+
// la vista. La cadena activa vive en estado para que elegir otra se vea.
|
|
25
|
+
|
|
20
26
|
exports.default = _default;
|
|
21
27
|
|
|
22
28
|
var Template = function Template(args) {
|
|
23
|
-
|
|
29
|
+
var _useState = (0, _react.useState)(args.retailers[1]),
|
|
30
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
31
|
+
activeRetailer = _useState2[0],
|
|
32
|
+
setActiveRetailer = _useState2[1];
|
|
33
|
+
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
35
|
+
style: {
|
|
36
|
+
display: "flex",
|
|
37
|
+
justifyContent: "flex-end",
|
|
38
|
+
width: 420
|
|
39
|
+
},
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.RetailerSelector, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, args), {}, {
|
|
41
|
+
activeRetailer: activeRetailer,
|
|
42
|
+
setActiveRetailer: setActiveRetailer
|
|
43
|
+
}))
|
|
44
|
+
});
|
|
24
45
|
};
|
|
25
46
|
|
|
26
47
|
var RetailerSelectorDefault = Template.bind({});
|
|
@@ -111,6 +111,8 @@ var RetailerSelector = function RetailerSelector(_ref) {
|
|
|
111
111
|
}), retailersPanel && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
112
112
|
className: "retailers-panel",
|
|
113
113
|
children: retailers.map(function (retailer, index) {
|
|
114
|
+
var _retailer$id, _retailer$id2, _activeRetailer$id;
|
|
115
|
+
|
|
114
116
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AsignationOption.AsignationOption, {
|
|
115
117
|
profileImage: retailer === null || retailer === void 0 ? void 0 : retailer.image,
|
|
116
118
|
imageType: "medium-image",
|
|
@@ -124,8 +126,11 @@ var RetailerSelector = function RetailerSelector(_ref) {
|
|
|
124
126
|
setActiveRetailer(retailer);
|
|
125
127
|
document.removeEventListener("click", closeRetailersPanel, false);
|
|
126
128
|
setRetailersPanel(false);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
+
} // El id llega como `id` o como `id_retailer` según el origen
|
|
130
|
+
// (en RetailerProductEdition, `categoryRetailerInOrder` usa
|
|
131
|
+
// `id_retailer`); comparar solo `id` nunca marcaba la activa.
|
|
132
|
+
,
|
|
133
|
+
active: ((_retailer$id = retailer === null || retailer === void 0 ? void 0 : retailer.id) !== null && _retailer$id !== void 0 ? _retailer$id : retailer === null || retailer === void 0 ? void 0 : retailer.id_retailer) != null && ((_retailer$id2 = retailer === null || retailer === void 0 ? void 0 : retailer.id) !== null && _retailer$id2 !== void 0 ? _retailer$id2 : retailer === null || retailer === void 0 ? void 0 : retailer.id_retailer) === ((_activeRetailer$id = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) !== null && _activeRetailer$id !== void 0 ? _activeRetailer$id : activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id_retailer),
|
|
129
134
|
showStatus: showStatus
|
|
130
135
|
}, "".concat(index, "-").concat(retailer === null || retailer === void 0 ? void 0 : retailer.name));
|
|
131
136
|
})
|
|
@@ -86,6 +86,8 @@ var RetailerSelectorv2 = function RetailerSelectorv2(_ref) {
|
|
|
86
86
|
}), retailersPanel && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
87
87
|
className: "retailers-panel",
|
|
88
88
|
children: retailers.map(function (retailer, index) {
|
|
89
|
+
var _retailer$id, _retailer$id2, _activeRetailer$id;
|
|
90
|
+
|
|
89
91
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AsignationOption.AsignationOption, {
|
|
90
92
|
profileImage: retailer === null || retailer === void 0 ? void 0 : retailer.image,
|
|
91
93
|
imageType: "medium-image",
|
|
@@ -97,8 +99,10 @@ var RetailerSelectorv2 = function RetailerSelectorv2(_ref) {
|
|
|
97
99
|
setActiveRetailer(retailer);
|
|
98
100
|
document.removeEventListener("click", closeRetailersPanel, false);
|
|
99
101
|
setRetailersPanel(false);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
+
} // El id llega como `id` o como `id_retailer` según el origen;
|
|
103
|
+
// comparar solo `id` nunca marcaba la cadena activa.
|
|
104
|
+
,
|
|
105
|
+
active: ((_retailer$id = retailer === null || retailer === void 0 ? void 0 : retailer.id) !== null && _retailer$id !== void 0 ? _retailer$id : retailer === null || retailer === void 0 ? void 0 : retailer.id_retailer) != null && ((_retailer$id2 = retailer === null || retailer === void 0 ? void 0 : retailer.id) !== null && _retailer$id2 !== void 0 ? _retailer$id2 : retailer === null || retailer === void 0 ? void 0 : retailer.id_retailer) === ((_activeRetailer$id = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) !== null && _activeRetailer$id !== void 0 ? _activeRetailer$id : activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id_retailer),
|
|
102
106
|
showStatus: showStatus
|
|
103
107
|
}, "".concat(index, "-").concat(retailer === null || retailer === void 0 ? void 0 : retailer.name));
|
|
104
108
|
})
|
|
@@ -5,10 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.Vacia = exports.SoloLectura = exports.PayloadDeGuardado = exports.Cuadricula = exports.ConActivos = void 0;
|
|
8
|
+
exports.default = exports.Vacia = exports.SoloLectura = exports.PayloadDeGuardado = exports.ErroresDeSubida = exports.Cuadricula = exports.ConActivos = void 0;
|
|
9
9
|
|
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
11
|
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
13
|
+
|
|
12
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
13
15
|
|
|
14
16
|
var _react = require("react");
|
|
@@ -21,10 +23,13 @@ var _assets = require("../../../global-files/digital-assets/assets.reducer");
|
|
|
21
23
|
|
|
22
24
|
var _assets2 = require("../../../global-files/digital-assets/assets.adapter");
|
|
23
25
|
|
|
24
|
-
var _assets3 = require("../../../global-files/digital-assets/assets.
|
|
26
|
+
var _assets3 = require("../../../global-files/digital-assets/assets.actions");
|
|
27
|
+
|
|
28
|
+
var _assets4 = require("../../../global-files/digital-assets/assets.mock");
|
|
25
29
|
|
|
26
30
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
31
|
|
|
32
|
+
var _excluded = ["file"];
|
|
28
33
|
var _default = {
|
|
29
34
|
title: "Components/organisms/DigitalAssetsTray",
|
|
30
35
|
component: _index.DigitalAssetsTray
|
|
@@ -40,6 +45,8 @@ exports.default = _default;
|
|
|
40
45
|
var Demo = function Demo(_ref) {
|
|
41
46
|
var _ref$initialAssets = _ref.initialAssets,
|
|
42
47
|
initialAssets = _ref$initialAssets === void 0 ? [] : _ref$initialAssets,
|
|
48
|
+
_ref$localAssets = _ref.localAssets,
|
|
49
|
+
localAssets = _ref$localAssets === void 0 ? [] : _ref$localAssets,
|
|
43
50
|
_ref$gridLayout = _ref.gridLayout,
|
|
44
51
|
gridLayout = _ref$gridLayout === void 0 ? false : _ref$gridLayout,
|
|
45
52
|
_ref$readOnly = _ref.readOnly,
|
|
@@ -69,8 +76,21 @@ var Demo = function Demo(_ref) {
|
|
|
69
76
|
loaded = _useState4[0],
|
|
70
77
|
setLoaded = _useState4[1];
|
|
71
78
|
|
|
72
|
-
if (!loaded && initialAssets.length) {
|
|
73
|
-
tray.replaceAll(initialAssets);
|
|
79
|
+
if (!loaded && (initialAssets.length || localAssets.length)) {
|
|
80
|
+
if (initialAssets.length) tray.replaceAll(initialAssets); // Archivos locales ya en un estado de subida (subiendo, con error...), para
|
|
81
|
+
// ver cómo se pintan sin tener que provocar el fallo contra el backend.
|
|
82
|
+
|
|
83
|
+
if (localAssets.length) {
|
|
84
|
+
dispatch({
|
|
85
|
+
type: _assets3.ASSET_ACTIONS.ADD_ASSETS,
|
|
86
|
+
payload: localAssets.map(function (_ref2) {
|
|
87
|
+
var file = _ref2.file,
|
|
88
|
+
estado = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
89
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _assets2.fromFile)(file)), estado);
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
74
94
|
setLoaded(true);
|
|
75
95
|
}
|
|
76
96
|
|
|
@@ -130,7 +150,7 @@ exports.Vacia = Vacia;
|
|
|
130
150
|
|
|
131
151
|
var ConActivos = function ConActivos() {
|
|
132
152
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Demo, {
|
|
133
|
-
initialAssets:
|
|
153
|
+
initialAssets: _assets4.backendAssetsMock
|
|
134
154
|
});
|
|
135
155
|
};
|
|
136
156
|
|
|
@@ -138,7 +158,7 @@ exports.ConActivos = ConActivos;
|
|
|
138
158
|
|
|
139
159
|
var Cuadricula = function Cuadricula() {
|
|
140
160
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Demo, {
|
|
141
|
-
initialAssets:
|
|
161
|
+
initialAssets: _assets4.backendAssetsMock,
|
|
142
162
|
gridLayout: true
|
|
143
163
|
});
|
|
144
164
|
};
|
|
@@ -147,7 +167,7 @@ exports.Cuadricula = Cuadricula;
|
|
|
147
167
|
|
|
148
168
|
var SoloLectura = function SoloLectura() {
|
|
149
169
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Demo, {
|
|
150
|
-
initialAssets:
|
|
170
|
+
initialAssets: _assets4.backendAssetsMock,
|
|
151
171
|
readOnly: true
|
|
152
172
|
});
|
|
153
173
|
};
|
|
@@ -163,9 +183,53 @@ exports.SoloLectura = SoloLectura;
|
|
|
163
183
|
|
|
164
184
|
var PayloadDeGuardado = function PayloadDeGuardado() {
|
|
165
185
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Demo, {
|
|
166
|
-
initialAssets:
|
|
186
|
+
initialAssets: _assets4.backendAssetsMock,
|
|
167
187
|
showPayload: true
|
|
168
188
|
});
|
|
169
189
|
};
|
|
170
190
|
|
|
171
|
-
exports.PayloadDeGuardado = PayloadDeGuardado;
|
|
191
|
+
exports.PayloadDeGuardado = PayloadDeGuardado;
|
|
192
|
+
|
|
193
|
+
var archivo = function archivo(name, type) {
|
|
194
|
+
return new File(["x"], name, {
|
|
195
|
+
type: type
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Cómo se ve una subida que falla: el motivo aparece debajo del archivo y el
|
|
200
|
+
* resto sigue su curso. Los textos son los que producen de verdad
|
|
201
|
+
* `uploadAssets.js` (S3 y firma) y `presign-asset-upload` (rechazo del servidor).
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
var ErroresDeSubida = function ErroresDeSubida() {
|
|
206
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Demo, {
|
|
207
|
+
localAssets: [{
|
|
208
|
+
file: archivo("video-campana.mp4", "video/mp4"),
|
|
209
|
+
status: _assets2.ASSET_STATUS.UPLOADING,
|
|
210
|
+
progress: 45
|
|
211
|
+
}, {
|
|
212
|
+
file: archivo("manual-instalacion.pdf", "application/pdf"),
|
|
213
|
+
status: _assets2.ASSET_STATUS.ERROR,
|
|
214
|
+
error: "No se pudo subir el archivo. Avisa a soporte (permiso de almacenamiento)."
|
|
215
|
+
}, {
|
|
216
|
+
file: archivo("render-final.psd", ""),
|
|
217
|
+
status: _assets2.ASSET_STATUS.ERROR,
|
|
218
|
+
error: "El archivo supera el tamaño permitido."
|
|
219
|
+
}, {
|
|
220
|
+
file: archivo("tabla-tallas.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
|
|
221
|
+
status: _assets2.ASSET_STATUS.ERROR,
|
|
222
|
+
error: "No se pudo conectar para subir el archivo. Revisa tu conexión e inténtalo de nuevo."
|
|
223
|
+
}, {
|
|
224
|
+
file: archivo("foto-lifestyle.jpg", "image/jpeg"),
|
|
225
|
+
status: _assets2.ASSET_STATUS.ERROR,
|
|
226
|
+
error: "El archivo pesa más del máximo permitido para imagen"
|
|
227
|
+
}, {
|
|
228
|
+
file: archivo("catalogo.zip", "application/zip"),
|
|
229
|
+
status: _assets2.ASSET_STATUS.ERROR,
|
|
230
|
+
error: "No se pudo preparar la subida. Revisa tu conexión e inténtalo de nuevo."
|
|
231
|
+
}]
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
exports.ErroresDeSubida = ErroresDeSubida;
|
|
@@ -9,6 +9,8 @@ exports.DigitalAssetsTray = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
11
|
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
13
|
+
|
|
12
14
|
var _reactDropzone = require("react-dropzone");
|
|
13
15
|
|
|
14
16
|
var _styles = require("./styles");
|
|
@@ -73,8 +75,14 @@ var DigitalAssetsTray = function DigitalAssetsTray(_ref) {
|
|
|
73
75
|
multiple: true,
|
|
74
76
|
noClick: true,
|
|
75
77
|
disabled: readOnly,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
// Los rechazados también pasan: react-dropzone los descarta por `accept`
|
|
79
|
+
// antes que nuestra validación, y sin esto soltar un formato no permitido
|
|
80
|
+
// no hacía nada. `addFiles` los valida y avisa por qué no entran.
|
|
81
|
+
onDrop: function onDrop(acceptedFiles, fileRejections) {
|
|
82
|
+
return addFiles === null || addFiles === void 0 ? void 0 : addFiles([].concat((0, _toConsumableArray2.default)(acceptedFiles), (0, _toConsumableArray2.default)(fileRejections.map(function (_ref2) {
|
|
83
|
+
var file = _ref2.file;
|
|
84
|
+
return file;
|
|
85
|
+
}))));
|
|
78
86
|
}
|
|
79
87
|
}),
|
|
80
88
|
getRootProps = _useDropzone.getRootProps,
|
|
@@ -101,7 +109,7 @@ var DigitalAssetsTray = function DigitalAssetsTray(_ref) {
|
|
|
101
109
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
102
110
|
className: "tray-hint",
|
|
103
111
|
title: "Formatos permitidos: ".concat((0, _assetTypes.acceptedFormatsLabel)()),
|
|
104
|
-
children: ["Arrastra aqu\xED videos, 360, GIF, documentos, hojas de c\xE1lculo o archivos editables. Quedan ", remaining, " de ", _assetTypes.MAX_ASSETS_PER_PRODUCT, "."]
|
|
112
|
+
children: ["Arrastra aqu\xED im\xE1genes, videos, 360, GIF, documentos, hojas de c\xE1lculo o archivos editables. Quedan ", remaining, " de ", _assetTypes.MAX_ASSETS_PER_PRODUCT, "."]
|
|
105
113
|
}), !readOnly && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
106
114
|
label: "Agregar activos",
|
|
107
115
|
type: "pink",
|
|
@@ -187,8 +195,8 @@ var DigitalAssetsTray = function DigitalAssetsTray(_ref) {
|
|
|
187
195
|
selectedAssets: selectedAssets,
|
|
188
196
|
setSelectedAssets: setSelectedAssets,
|
|
189
197
|
setCheckAll: setCheckAll,
|
|
190
|
-
changeAsset: function changeAsset(
|
|
191
|
-
var value =
|
|
198
|
+
changeAsset: function changeAsset(_ref3) {
|
|
199
|
+
var value = _ref3.value;
|
|
192
200
|
return changeAssetType === null || changeAssetType === void 0 ? void 0 : changeAssetType(index, value);
|
|
193
201
|
},
|
|
194
202
|
onRemove: removeAsset,
|