contentoh-components-library 21.6.57 → 21.6.59
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/.claude/settings.local.json +7 -0
- package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +90 -135
- package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +148 -162
- package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +16 -0
- package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +1 -0
- package/dist/components/pages/CreatorsProductEdition/sections/ImageGallery.js +433 -0
- package/dist/components/pages/CreatorsProductEdition/sections/NoticeDialog.js +155 -0
- package/dist/components/pages/CreatorsProductEdition/sections/RejectDialog.js +201 -0
- package/dist/components/pages/CreatorsProductEdition/sections/VersionDrawer.js +615 -0
- package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +3 -31
- package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +55 -30
- package/dist/components/pages/CreatorsProductEdition/stories/products.js +923 -0
- package/dist/components/pages/CreatorsProductEdition/styles.js +27 -7
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +2 -1
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +325 -10
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.reducer.js +12 -2
- package/dist/components/pages/ProviderProductEdition/index.js +486 -231
- package/dist/index.js +13 -0
- package/package.json +1 -1
- package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +777 -0
- package/src/components/pages/CreatorsProductEdition/constants.js +21 -0
- package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +2238 -0
- package/src/components/pages/CreatorsProductEdition/index.js +19 -0
- package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +357 -0
- package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +144 -0
- package/src/components/pages/CreatorsProductEdition/sections/CommentBox.jsx +183 -0
- package/src/components/pages/CreatorsProductEdition/sections/ImageGallery.jsx +269 -0
- package/src/components/pages/CreatorsProductEdition/sections/ImagePanel.jsx +332 -0
- package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +385 -0
- package/src/components/pages/CreatorsProductEdition/sections/NoticeDialog.jsx +111 -0
- package/src/components/pages/CreatorsProductEdition/sections/ProductHeader.jsx +305 -0
- package/src/components/pages/CreatorsProductEdition/sections/ProductMedia.jsx +101 -0
- package/src/components/pages/CreatorsProductEdition/sections/RejectDialog.jsx +125 -0
- package/src/components/pages/CreatorsProductEdition/sections/RetailerMenu.jsx +129 -0
- package/src/components/pages/CreatorsProductEdition/sections/ServiceActions.jsx +382 -0
- package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +37 -0
- package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +187 -0
- package/src/components/pages/CreatorsProductEdition/sections/VariantsPanel.jsx +311 -0
- package/src/components/pages/CreatorsProductEdition/sections/VersionDrawer.jsx +357 -0
- package/src/components/pages/CreatorsProductEdition/sections/tokens.js +63 -0
- package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +111 -0
- package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEditionAPI.stories.js +85 -0
- package/src/components/pages/CreatorsProductEdition/stories/products.js +966 -0
- package/src/components/pages/CreatorsProductEdition/styles.js +178 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +1 -0
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +201 -0
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.reducer.js +12 -0
- package/src/components/pages/ProviderProductEdition/index.js +228 -7
- package/src/index.js +1 -0
|
@@ -0,0 +1,615 @@
|
|
|
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.VersionDrawer = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
19
|
+
|
|
20
|
+
var _react = require("react");
|
|
21
|
+
|
|
22
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
23
|
+
|
|
24
|
+
var _material = require("@mui/material");
|
|
25
|
+
|
|
26
|
+
var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
27
|
+
|
|
28
|
+
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
29
|
+
|
|
30
|
+
var _nullIcon = _interopRequireDefault(require("../../../../assets/images/versionSelector/nullIcon.svg"));
|
|
31
|
+
|
|
32
|
+
var _acceptIcon = _interopRequireDefault(require("../../../../assets/images/versionSelector/acceptIcon.svg"));
|
|
33
|
+
|
|
34
|
+
var _versionSelected = _interopRequireDefault(require("../../../../assets/images/versionSelector/versionSelected.svg"));
|
|
35
|
+
|
|
36
|
+
var _createVersion = _interopRequireDefault(require("../../../../assets/images/versionSelector/createVersion.svg"));
|
|
37
|
+
|
|
38
|
+
var _genericModalWarning = _interopRequireDefault(require("../../../../assets/images/genericModal/genericModalWarning.svg"));
|
|
39
|
+
|
|
40
|
+
var _tokens = require("./tokens");
|
|
41
|
+
|
|
42
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
Versiones del producto: lista, cambio de versión y creación de una nueva.
|
|
46
|
+
|
|
47
|
+
Reemplaza a `organisms/VersionSelector` (+ VersionItem y CreateVersion) con
|
|
48
|
+
los mismos props, las mismas llamadas y el mismo diseño oscuro, hecho con el
|
|
49
|
+
Drawer y el Dialog de MUI. El original era un panel `absolute` de 300px que
|
|
50
|
+
en celular tapaba media pantalla sin poder cerrarse tocando fuera; aquí en
|
|
51
|
+
celular ocupa todo el ancho.
|
|
52
|
+
|
|
53
|
+
El diálogo de nueva versión va con `disablePortal` para quedar dentro del
|
|
54
|
+
panel en el DOM.
|
|
55
|
+
*/
|
|
56
|
+
var WHITE_BUTTON = {
|
|
57
|
+
textTransform: "none",
|
|
58
|
+
borderRadius: "20px",
|
|
59
|
+
minHeight: 40,
|
|
60
|
+
flex: "1 1 0",
|
|
61
|
+
fontFamily: _tokens.FONTS.Raleway_500,
|
|
62
|
+
color: _tokens.COLORS.white,
|
|
63
|
+
border: "1px solid ".concat(_tokens.COLORS.white),
|
|
64
|
+
"&:hover": {
|
|
65
|
+
bgcolor: "rgba(255,255,255,0.08)"
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var PINK_BUTTON = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, WHITE_BUTTON), {}, {
|
|
69
|
+
border: 0,
|
|
70
|
+
bgcolor: _tokens.COLORS.magenta_s2,
|
|
71
|
+
"&:hover": {
|
|
72
|
+
bgcolor: _tokens.COLORS.secondary_magenta
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
var exportedText = function exportedText(timestamp) {
|
|
77
|
+
return timestamp ? "\xDAltima vez exportado: ".concat(new Date(timestamp).toLocaleDateString()) : "";
|
|
78
|
+
}; // --- Una versión de la lista ----------------------------------------------
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
var VersionRow = function VersionRow(_ref) {
|
|
82
|
+
var item = _ref.item,
|
|
83
|
+
isCurrent = _ref.isCurrent,
|
|
84
|
+
companyName = _ref.companyName,
|
|
85
|
+
onSelect = _ref.onSelect;
|
|
86
|
+
var validated = Boolean(item.article_status);
|
|
87
|
+
var text = {
|
|
88
|
+
fontFamily: _tokens.FONTS.AvenirNext,
|
|
89
|
+
fontSize: 12,
|
|
90
|
+
color: _tokens.COLORS.s2
|
|
91
|
+
};
|
|
92
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
93
|
+
sx: {
|
|
94
|
+
pb: "5px",
|
|
95
|
+
borderBottom: "1px solid ".concat(_tokens.COLORS.s4)
|
|
96
|
+
},
|
|
97
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
98
|
+
direction: "row",
|
|
99
|
+
alignItems: "center",
|
|
100
|
+
justifyContent: "space-between",
|
|
101
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
102
|
+
title: isCurrent ? "Versión actual" : "Usar esta versión",
|
|
103
|
+
arrow: true,
|
|
104
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
105
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ButtonBase, {
|
|
106
|
+
"aria-label": "Usar la versi\xF3n ".concat(item.version),
|
|
107
|
+
disabled: isCurrent,
|
|
108
|
+
onClick: function onClick() {
|
|
109
|
+
return onSelect(item.version);
|
|
110
|
+
},
|
|
111
|
+
sx: {
|
|
112
|
+
borderRadius: "50%",
|
|
113
|
+
opacity: isCurrent ? 0.4 : 1
|
|
114
|
+
},
|
|
115
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
116
|
+
component: "img",
|
|
117
|
+
src: _versionSelected.default,
|
|
118
|
+
alt: "",
|
|
119
|
+
sx: {
|
|
120
|
+
width: 30,
|
|
121
|
+
height: 30
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
127
|
+
component: "img",
|
|
128
|
+
src: validated ? _acceptIcon.default : _nullIcon.default,
|
|
129
|
+
alt: validated ? "Versión validada" : "Versión sin validar"
|
|
130
|
+
})]
|
|
131
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
132
|
+
alignItems: "flex-end",
|
|
133
|
+
gap: "5px",
|
|
134
|
+
sx: {
|
|
135
|
+
textAlign: "right"
|
|
136
|
+
},
|
|
137
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
138
|
+
sx: {
|
|
139
|
+
fontFamily: _tokens.FONTS.Raleway_600,
|
|
140
|
+
fontSize: 16,
|
|
141
|
+
color: _tokens.COLORS.magenta_s2
|
|
142
|
+
},
|
|
143
|
+
children: ["Versi\xF3n ", item.version]
|
|
144
|
+
}), item.timestamp && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
145
|
+
sx: text,
|
|
146
|
+
children: exportedText(item.timestamp)
|
|
147
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
148
|
+
sx: text,
|
|
149
|
+
children: isCurrent ? "Versión actual" : validated ? "Edición Content-Oh!" : "Versi\xF3n de ".concat(companyName)
|
|
150
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
151
|
+
sx: text,
|
|
152
|
+
children: validated ? "Content-Oh! digital" : companyName
|
|
153
|
+
})]
|
|
154
|
+
})]
|
|
155
|
+
});
|
|
156
|
+
}; // --- Nueva versión -------------------------------------------------------
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
var CONTENT_SELECTS = [{
|
|
160
|
+
id: "datasheet",
|
|
161
|
+
label: "Ficha técnica"
|
|
162
|
+
}, {
|
|
163
|
+
id: "description",
|
|
164
|
+
label: "Descripción"
|
|
165
|
+
}, {
|
|
166
|
+
id: "image",
|
|
167
|
+
label: "Imágenes"
|
|
168
|
+
}];
|
|
169
|
+
|
|
170
|
+
var CreateVersionDialog = function CreateVersionDialog(_ref2) {
|
|
171
|
+
var open = _ref2.open,
|
|
172
|
+
onClose = _ref2.onClose,
|
|
173
|
+
articleId = _ref2.articleId,
|
|
174
|
+
currentVersion = _ref2.currentVersion,
|
|
175
|
+
versions = _ref2.versions,
|
|
176
|
+
jwt = _ref2.jwt,
|
|
177
|
+
onCreated = _ref2.onCreated;
|
|
178
|
+
|
|
179
|
+
var _useState = (0, _react.useState)("options"),
|
|
180
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
181
|
+
step = _useState2[0],
|
|
182
|
+
setStep = _useState2[1];
|
|
183
|
+
|
|
184
|
+
var _useState3 = (0, _react.useState)({}),
|
|
185
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
186
|
+
selected = _useState4[0],
|
|
187
|
+
setSelected = _useState4[1];
|
|
188
|
+
|
|
189
|
+
var _useState5 = (0, _react.useState)(false),
|
|
190
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
191
|
+
saving = _useState6[0],
|
|
192
|
+
setSaving = _useState6[1];
|
|
193
|
+
|
|
194
|
+
var isPhone = (0, _material.useMediaQuery)("(max-width:599.95px)");
|
|
195
|
+
(0, _react.useEffect)(function () {
|
|
196
|
+
if (open) {
|
|
197
|
+
setStep("options");
|
|
198
|
+
setSelected({
|
|
199
|
+
datasheet: currentVersion,
|
|
200
|
+
description: currentVersion,
|
|
201
|
+
image: currentVersion
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}, [open, currentVersion]); // Mismo POST que `CreateVersion`.
|
|
205
|
+
|
|
206
|
+
var createVersion = /*#__PURE__*/function () {
|
|
207
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(isEmpty) {
|
|
208
|
+
var data;
|
|
209
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
210
|
+
while (1) {
|
|
211
|
+
switch (_context.prev = _context.next) {
|
|
212
|
+
case 0:
|
|
213
|
+
setSaving(true);
|
|
214
|
+
_context.prev = 1;
|
|
215
|
+
data = {
|
|
216
|
+
articleId: articleId,
|
|
217
|
+
isEmpty: isEmpty
|
|
218
|
+
};
|
|
219
|
+
if (!isEmpty) data.version = selected;
|
|
220
|
+
_context.next = 6;
|
|
221
|
+
return _axios.default.post(process.env.REACT_APP_VERSIONS_ENDPOINT, data, {
|
|
222
|
+
headers: {
|
|
223
|
+
Authorization: jwt
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
case 6:
|
|
228
|
+
onClose();
|
|
229
|
+
onCreated();
|
|
230
|
+
_context.next = 13;
|
|
231
|
+
break;
|
|
232
|
+
|
|
233
|
+
case 10:
|
|
234
|
+
_context.prev = 10;
|
|
235
|
+
_context.t0 = _context["catch"](1);
|
|
236
|
+
console.error(_context.t0);
|
|
237
|
+
|
|
238
|
+
case 13:
|
|
239
|
+
_context.prev = 13;
|
|
240
|
+
setSaving(false);
|
|
241
|
+
return _context.finish(13);
|
|
242
|
+
|
|
243
|
+
case 16:
|
|
244
|
+
case "end":
|
|
245
|
+
return _context.stop();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}, _callee, null, [[1, 10, 13, 16]]);
|
|
249
|
+
}));
|
|
250
|
+
|
|
251
|
+
return function createVersion(_x) {
|
|
252
|
+
return _ref3.apply(this, arguments);
|
|
253
|
+
};
|
|
254
|
+
}();
|
|
255
|
+
|
|
256
|
+
var title = function title(text) {
|
|
257
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
258
|
+
sx: {
|
|
259
|
+
fontFamily: _tokens.FONTS.Raleway_500,
|
|
260
|
+
fontSize: 22,
|
|
261
|
+
lineHeight: 1.3
|
|
262
|
+
},
|
|
263
|
+
children: text
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
var subtitle = function subtitle(text) {
|
|
268
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
269
|
+
sx: {
|
|
270
|
+
fontFamily: _tokens.FONTS.Raleway,
|
|
271
|
+
fontSize: 16,
|
|
272
|
+
lineHeight: 1.4
|
|
273
|
+
},
|
|
274
|
+
children: text
|
|
275
|
+
});
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
var steps = {
|
|
279
|
+
options: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
280
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
281
|
+
component: "img",
|
|
282
|
+
src: _createVersion.default,
|
|
283
|
+
alt: "",
|
|
284
|
+
sx: {
|
|
285
|
+
mx: "auto"
|
|
286
|
+
}
|
|
287
|
+
}), title("Crea una nueva versión"), subtitle("Puedes elegir el contenido de versiones anteriores o crear una versión desde cero"), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
288
|
+
direction: {
|
|
289
|
+
xs: "column",
|
|
290
|
+
sm: "row"
|
|
291
|
+
},
|
|
292
|
+
gap: 2,
|
|
293
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
294
|
+
sx: WHITE_BUTTON,
|
|
295
|
+
onClick: function onClick() {
|
|
296
|
+
return setStep("empty");
|
|
297
|
+
},
|
|
298
|
+
children: "Versi\xF3n desde cero"
|
|
299
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
300
|
+
sx: PINK_BUTTON,
|
|
301
|
+
onClick: function onClick() {
|
|
302
|
+
return setStep("custom");
|
|
303
|
+
},
|
|
304
|
+
children: "Versi\xF3n personalizada"
|
|
305
|
+
})]
|
|
306
|
+
})]
|
|
307
|
+
}),
|
|
308
|
+
empty: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
309
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
310
|
+
component: "img",
|
|
311
|
+
src: _genericModalWarning.default,
|
|
312
|
+
alt: "",
|
|
313
|
+
sx: {
|
|
314
|
+
mx: "auto"
|
|
315
|
+
}
|
|
316
|
+
}), title("Si creas una versión desde cero perderás la información actual"), subtitle("¿Deseas continuar?"), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
317
|
+
direction: {
|
|
318
|
+
xs: "column",
|
|
319
|
+
sm: "row"
|
|
320
|
+
},
|
|
321
|
+
gap: 2,
|
|
322
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
323
|
+
sx: WHITE_BUTTON,
|
|
324
|
+
onClick: function onClick() {
|
|
325
|
+
return setStep("options");
|
|
326
|
+
},
|
|
327
|
+
children: "Atr\xE1s"
|
|
328
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
329
|
+
sx: PINK_BUTTON,
|
|
330
|
+
disabled: saving,
|
|
331
|
+
onClick: function onClick() {
|
|
332
|
+
return createVersion(true);
|
|
333
|
+
},
|
|
334
|
+
children: "Continuar"
|
|
335
|
+
})]
|
|
336
|
+
})]
|
|
337
|
+
}),
|
|
338
|
+
custom: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
339
|
+
children: [subtitle("Elige el contenido que deseas utilizar de versiones anteriores"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
340
|
+
gap: 2,
|
|
341
|
+
children: CONTENT_SELECTS.map(function (_ref4) {
|
|
342
|
+
var _selected$id;
|
|
343
|
+
|
|
344
|
+
var id = _ref4.id,
|
|
345
|
+
label = _ref4.label;
|
|
346
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
347
|
+
size: "small",
|
|
348
|
+
fullWidth: true,
|
|
349
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
350
|
+
id: "".concat(id, "-label"),
|
|
351
|
+
sx: {
|
|
352
|
+
color: _tokens.COLORS.s3,
|
|
353
|
+
"&.Mui-focused": {
|
|
354
|
+
color: _tokens.COLORS.white
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
children: label
|
|
358
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, {
|
|
359
|
+
labelId: "".concat(id, "-label"),
|
|
360
|
+
label: label,
|
|
361
|
+
value: (_selected$id = selected[id]) !== null && _selected$id !== void 0 ? _selected$id : "",
|
|
362
|
+
onChange: function onChange(e) {
|
|
363
|
+
return setSelected(function (prev) {
|
|
364
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, id, parseInt(e.target.value)));
|
|
365
|
+
});
|
|
366
|
+
},
|
|
367
|
+
MenuProps: {
|
|
368
|
+
disablePortal: true
|
|
369
|
+
},
|
|
370
|
+
sx: {
|
|
371
|
+
color: _tokens.COLORS.white,
|
|
372
|
+
textAlign: "left",
|
|
373
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
374
|
+
borderColor: _tokens.COLORS.s4
|
|
375
|
+
},
|
|
376
|
+
"&:hover .MuiOutlinedInput-notchedOutline": {
|
|
377
|
+
borderColor: _tokens.COLORS.s3
|
|
378
|
+
},
|
|
379
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
380
|
+
borderColor: _tokens.COLORS.magenta_s2
|
|
381
|
+
},
|
|
382
|
+
"& .MuiSvgIcon-root": {
|
|
383
|
+
color: _tokens.COLORS.white
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
children: versions.map(function (item) {
|
|
387
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
|
388
|
+
value: item.version,
|
|
389
|
+
children: ["Versi\xF3n ", item.version]
|
|
390
|
+
}, "".concat(id, "-").concat(item.version));
|
|
391
|
+
})
|
|
392
|
+
})]
|
|
393
|
+
}, id);
|
|
394
|
+
})
|
|
395
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
396
|
+
direction: {
|
|
397
|
+
xs: "column",
|
|
398
|
+
sm: "row"
|
|
399
|
+
},
|
|
400
|
+
gap: 2,
|
|
401
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
402
|
+
sx: WHITE_BUTTON,
|
|
403
|
+
onClick: function onClick() {
|
|
404
|
+
return setStep("options");
|
|
405
|
+
},
|
|
406
|
+
children: "Atr\xE1s"
|
|
407
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
408
|
+
sx: PINK_BUTTON,
|
|
409
|
+
disabled: saving,
|
|
410
|
+
onClick: function onClick() {
|
|
411
|
+
return createVersion(false);
|
|
412
|
+
},
|
|
413
|
+
children: "Continuar"
|
|
414
|
+
})]
|
|
415
|
+
})]
|
|
416
|
+
})
|
|
417
|
+
};
|
|
418
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Dialog, {
|
|
419
|
+
open: open,
|
|
420
|
+
onClose: onClose,
|
|
421
|
+
disablePortal: true,
|
|
422
|
+
fullScreen: isPhone,
|
|
423
|
+
maxWidth: false,
|
|
424
|
+
PaperProps: {
|
|
425
|
+
id: "create-version",
|
|
426
|
+
sx: {
|
|
427
|
+
width: {
|
|
428
|
+
sm: "min(600px, calc(100% - 64px))"
|
|
429
|
+
},
|
|
430
|
+
bgcolor: _tokens.COLORS.deep_gray,
|
|
431
|
+
color: _tokens.COLORS.white,
|
|
432
|
+
borderRadius: {
|
|
433
|
+
xs: 0,
|
|
434
|
+
sm: "39px"
|
|
435
|
+
},
|
|
436
|
+
p: {
|
|
437
|
+
xs: "56px 20px 24px",
|
|
438
|
+
sm: "40px"
|
|
439
|
+
},
|
|
440
|
+
justifyContent: {
|
|
441
|
+
xs: "center",
|
|
442
|
+
sm: "flex-start"
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
447
|
+
"aria-label": "Cerrar",
|
|
448
|
+
onClick: onClose,
|
|
449
|
+
sx: {
|
|
450
|
+
position: "absolute",
|
|
451
|
+
top: 16,
|
|
452
|
+
right: 16,
|
|
453
|
+
color: _tokens.COLORS.white
|
|
454
|
+
},
|
|
455
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {})
|
|
456
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
457
|
+
gap: 2.5,
|
|
458
|
+
sx: {
|
|
459
|
+
textAlign: "center"
|
|
460
|
+
},
|
|
461
|
+
children: steps[step]
|
|
462
|
+
})]
|
|
463
|
+
});
|
|
464
|
+
}; // --- Panel ---------------------------------------------------------------
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
var VersionDrawer = function VersionDrawer(_ref5) {
|
|
468
|
+
var open = _ref5.open,
|
|
469
|
+
_ref5$modalId = _ref5.modalId,
|
|
470
|
+
modalId = _ref5$modalId === void 0 ? "version-selector" : _ref5$modalId,
|
|
471
|
+
articleId = _ref5.articleId,
|
|
472
|
+
setVersion = _ref5.setVersion,
|
|
473
|
+
companyName = _ref5.companyName,
|
|
474
|
+
currentVersion = _ref5.currentVersion,
|
|
475
|
+
setShowVersionSelector = _ref5.setShowVersionSelector,
|
|
476
|
+
jwt = _ref5.jwt;
|
|
477
|
+
|
|
478
|
+
var _useState7 = (0, _react.useState)([]),
|
|
479
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
480
|
+
versions = _useState8[0],
|
|
481
|
+
setVersions = _useState8[1];
|
|
482
|
+
|
|
483
|
+
var _useState9 = (0, _react.useState)(false),
|
|
484
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
485
|
+
showCreate = _useState10[0],
|
|
486
|
+
setShowCreate = _useState10[1];
|
|
487
|
+
|
|
488
|
+
var _useState11 = (0, _react.useState)(0),
|
|
489
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
490
|
+
reload = _useState12[0],
|
|
491
|
+
setReload = _useState12[1]; // Misma llamada que `VersionSelector`.
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
(0, _react.useEffect)(function () {
|
|
495
|
+
if (!open) return undefined;
|
|
496
|
+
var active = true;
|
|
497
|
+
|
|
498
|
+
_axios.default.get("".concat(process.env.REACT_APP_VERSIONS_ENDPOINT, "?articleId=").concat(articleId, "&provider=true"), {
|
|
499
|
+
headers: {
|
|
500
|
+
Authorization: jwt
|
|
501
|
+
}
|
|
502
|
+
}).then(function (response) {
|
|
503
|
+
var _JSON$parse$data;
|
|
504
|
+
|
|
505
|
+
return active && setVersions((_JSON$parse$data = JSON.parse(response.data.body).data) !== null && _JSON$parse$data !== void 0 ? _JSON$parse$data : []);
|
|
506
|
+
}).catch(function (error) {
|
|
507
|
+
return console.error(error);
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
return function () {
|
|
511
|
+
active = false;
|
|
512
|
+
};
|
|
513
|
+
}, [open, articleId, jwt, reload]);
|
|
514
|
+
(0, _react.useEffect)(function () {
|
|
515
|
+
if (!open) setShowCreate(false);
|
|
516
|
+
}, [open]);
|
|
517
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Drawer, {
|
|
518
|
+
anchor: "right",
|
|
519
|
+
open: open,
|
|
520
|
+
onClose: function onClose() {
|
|
521
|
+
return setShowVersionSelector(false);
|
|
522
|
+
},
|
|
523
|
+
PaperProps: {
|
|
524
|
+
id: modalId,
|
|
525
|
+
sx: {
|
|
526
|
+
width: {
|
|
527
|
+
xs: "100%",
|
|
528
|
+
sm: 300
|
|
529
|
+
},
|
|
530
|
+
bgcolor: _tokens.COLORS.deep_gray,
|
|
531
|
+
color: _tokens.COLORS.white,
|
|
532
|
+
p: "15px"
|
|
533
|
+
}
|
|
534
|
+
},
|
|
535
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
536
|
+
direction: "row",
|
|
537
|
+
alignItems: "center",
|
|
538
|
+
justifyContent: "space-between",
|
|
539
|
+
sx: {
|
|
540
|
+
mb: 2
|
|
541
|
+
},
|
|
542
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
543
|
+
sx: {
|
|
544
|
+
fontFamily: _tokens.FONTS.Lato,
|
|
545
|
+
fontSize: 18
|
|
546
|
+
},
|
|
547
|
+
children: "Versi\xF3n del producto"
|
|
548
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
549
|
+
direction: "row",
|
|
550
|
+
gap: 1,
|
|
551
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
552
|
+
title: "Nueva versi\xF3n",
|
|
553
|
+
arrow: true,
|
|
554
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
555
|
+
id: "add-version",
|
|
556
|
+
"aria-label": "Nueva versi\xF3n",
|
|
557
|
+
onClick: function onClick() {
|
|
558
|
+
return setShowCreate(true);
|
|
559
|
+
},
|
|
560
|
+
sx: {
|
|
561
|
+
color: _tokens.COLORS.white,
|
|
562
|
+
border: "1px solid ".concat(_tokens.COLORS.s4),
|
|
563
|
+
width: 32,
|
|
564
|
+
height: 32
|
|
565
|
+
},
|
|
566
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {
|
|
567
|
+
fontSize: "small"
|
|
568
|
+
})
|
|
569
|
+
})
|
|
570
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
571
|
+
id: "close-button",
|
|
572
|
+
"aria-label": "Cerrar",
|
|
573
|
+
onClick: function onClick() {
|
|
574
|
+
return setShowVersionSelector(false);
|
|
575
|
+
},
|
|
576
|
+
sx: {
|
|
577
|
+
color: _tokens.COLORS.white,
|
|
578
|
+
border: "1px solid ".concat(_tokens.COLORS.s4),
|
|
579
|
+
width: 32,
|
|
580
|
+
height: 32
|
|
581
|
+
},
|
|
582
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {
|
|
583
|
+
fontSize: "small"
|
|
584
|
+
})
|
|
585
|
+
})]
|
|
586
|
+
})]
|
|
587
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
588
|
+
gap: "18px",
|
|
589
|
+
children: versions.map(function (item) {
|
|
590
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(VersionRow, {
|
|
591
|
+
item: item,
|
|
592
|
+
isCurrent: item.version === currentVersion,
|
|
593
|
+
companyName: companyName,
|
|
594
|
+
onSelect: setVersion
|
|
595
|
+
}, item.version);
|
|
596
|
+
})
|
|
597
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CreateVersionDialog, {
|
|
598
|
+
open: showCreate,
|
|
599
|
+
onClose: function onClose() {
|
|
600
|
+
return setShowCreate(false);
|
|
601
|
+
},
|
|
602
|
+
articleId: articleId,
|
|
603
|
+
currentVersion: currentVersion,
|
|
604
|
+
versions: versions,
|
|
605
|
+
jwt: jwt,
|
|
606
|
+
onCreated: function onCreated() {
|
|
607
|
+
return setReload(function (n) {
|
|
608
|
+
return n + 1;
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
})]
|
|
612
|
+
});
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
exports.VersionDrawer = VersionDrawer;
|
package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.SinImagenes = exports.HijoDeOtro = exports.EspecialistaTextosCelular = exports.EspecialistaTextos = exports.
|
|
8
|
+
exports.default = exports.SinImagenes = exports.HijoDeOtro = exports.EspecialistaTextosCelular = exports.EspecialistaTextos = exports.EspecialistaImagenesCelular = exports.EspecialistaImagenes = exports.ErrorAlCargar = exports.ConVariantes = exports.AuditorQACelular = exports.AuditorQA = exports.AuditorPorEvaluar = void 0;
|
|
9
9
|
|
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
11
|
|
|
@@ -68,11 +68,6 @@ var celular = {
|
|
|
68
68
|
viewport: {
|
|
69
69
|
defaultViewport: "mobile2"
|
|
70
70
|
}
|
|
71
|
-
};
|
|
72
|
-
var tablet = {
|
|
73
|
-
viewport: {
|
|
74
|
-
defaultViewport: "tablet"
|
|
75
|
-
}
|
|
76
71
|
}; // --- Especialista de edición (rol 8): pestaña de imágenes -------------------
|
|
77
72
|
|
|
78
73
|
var EspecialistaImagenes = Template.bind({});
|
|
@@ -81,10 +76,6 @@ EspecialistaImagenes.args = (0, _objectSpread2.default)((0, _objectSpread2.defau
|
|
|
81
76
|
tabsSections: _ImageEditor.ImageEditor.args.tabsSections,
|
|
82
77
|
user: _ImageEditor.ImageEditor.args.user
|
|
83
78
|
});
|
|
84
|
-
var EspecialistaImagenesTablet = Template.bind({});
|
|
85
|
-
exports.EspecialistaImagenesTablet = EspecialistaImagenesTablet;
|
|
86
|
-
EspecialistaImagenesTablet.args = EspecialistaImagenes.args;
|
|
87
|
-
EspecialistaImagenesTablet.parameters = tablet;
|
|
88
79
|
var EspecialistaImagenesCelular = Template.bind({});
|
|
89
80
|
exports.EspecialistaImagenesCelular = EspecialistaImagenesCelular;
|
|
90
81
|
EspecialistaImagenesCelular.args = EspecialistaImagenes.args;
|
|
@@ -107,10 +98,6 @@ AuditorQA.args = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, bas
|
|
|
107
98
|
tabsSections: TODAS_LAS_PESTAÑAS,
|
|
108
99
|
user: _Auditor.Auditor.args.user
|
|
109
100
|
});
|
|
110
|
-
var AuditorQATablet = Template.bind({});
|
|
111
|
-
exports.AuditorQATablet = AuditorQATablet;
|
|
112
|
-
AuditorQATablet.args = AuditorQA.args;
|
|
113
|
-
AuditorQATablet.parameters = tablet;
|
|
114
101
|
var AuditorQACelular = Template.bind({});
|
|
115
102
|
exports.AuditorQACelular = AuditorQACelular;
|
|
116
103
|
AuditorQACelular.args = AuditorQA.args;
|
|
@@ -121,14 +108,7 @@ exports.AuditorPorEvaluar = AuditorPorEvaluar;
|
|
|
121
108
|
AuditorPorEvaluar.args = AuditorQA.args;
|
|
122
109
|
AuditorPorEvaluar.decorators = [(0, _mockApi.withMockApi)({
|
|
123
110
|
delSolStatus: "AC"
|
|
124
|
-
})];
|
|
125
|
-
var AuditorPorEvaluarCelular = Template.bind({});
|
|
126
|
-
exports.AuditorPorEvaluarCelular = AuditorPorEvaluarCelular;
|
|
127
|
-
AuditorPorEvaluarCelular.args = AuditorQA.args;
|
|
128
|
-
AuditorPorEvaluarCelular.decorators = [(0, _mockApi.withMockApi)({
|
|
129
|
-
delSolStatus: "AC"
|
|
130
|
-
})];
|
|
131
|
-
AuditorPorEvaluarCelular.parameters = celular; // --- Variantes ---------------------------------------------------------------
|
|
111
|
+
})]; // --- Variantes ---------------------------------------------------------------
|
|
132
112
|
// Padre con dos hijos y en un grupo de variantes.
|
|
133
113
|
|
|
134
114
|
var ConVariantes = Template.bind({});
|
|
@@ -137,15 +117,7 @@ ConVariantes.args = EspecialistaTextos.args;
|
|
|
137
117
|
ConVariantes.decorators = [(0, _mockApi.withMockApi)({
|
|
138
118
|
familia: "padre",
|
|
139
119
|
grupo: true
|
|
140
|
-
})];
|
|
141
|
-
var ConVariantesCelular = Template.bind({});
|
|
142
|
-
exports.ConVariantesCelular = ConVariantesCelular;
|
|
143
|
-
ConVariantesCelular.args = EspecialistaTextos.args;
|
|
144
|
-
ConVariantesCelular.decorators = [(0, _mockApi.withMockApi)({
|
|
145
|
-
familia: "padre",
|
|
146
|
-
grupo: true
|
|
147
|
-
})];
|
|
148
|
-
ConVariantesCelular.parameters = celular; // Hijo de otro producto: no ofrece ligar ni agrupar.
|
|
120
|
+
})]; // Hijo de otro producto: no ofrece ligar ni agrupar.
|
|
149
121
|
|
|
150
122
|
var HijoDeOtro = Template.bind({});
|
|
151
123
|
exports.HijoDeOtro = HijoDeOtro;
|