contentoh-components-library 21.6.61 → 21.6.62

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.
Files changed (88) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/dist/ai/prompts/attribute.prompt.js +28 -0
  3. package/dist/ai/prompts/description.prompt.js +33 -0
  4. package/dist/ai/schemas/attribute.schema.js +35 -0
  5. package/dist/ai/schemas/description.schema.js +27 -0
  6. package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +11 -5
  7. package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +58 -31
  8. package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +5 -1
  9. package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +3 -40
  10. package/dist/components/pages/CreatorsProductEdition/sections/ImagesSection.js +18 -3
  11. package/dist/components/pages/CreatorsProductEdition/sections/StatusChip.js +4 -13
  12. package/dist/components/pages/CreatorsProductEdition/sections/TabsBar.js +10 -0
  13. package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +10 -2
  14. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -15
  15. package/dist/components/pages/RetailerProductEdition/index.js +40 -57
  16. package/dist/components/pages/RetailerProductEdition/utils.js +2 -6
  17. package/dist/index.js +0 -13
  18. package/package.json +1 -1
  19. package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +22 -3
  20. package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +36 -1
  21. package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +15 -3
  22. package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +8 -18
  23. package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +24 -2
  24. package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +4 -8
  25. package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +9 -0
  26. package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +6 -0
  27. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +0 -12
  28. package/src/components/pages/RetailerProductEdition/index.js +3 -28
  29. package/src/components/pages/RetailerProductEdition/utils.js +0 -5
  30. package/src/index.js +0 -1
  31. package/dist/components/organisms/ServicesNavigation/ServiceToolbar.js +0 -210
  32. package/dist/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +0 -138
  33. package/dist/components/organisms/ServicesNavigation/ServicesRail.js +0 -705
  34. package/dist/components/organisms/ServicesNavigation/catalog.js +0 -505
  35. package/dist/components/organisms/ServicesNavigation/index.js +0 -337
  36. package/dist/components/organisms/ServicesNavigation/model.js +0 -167
  37. package/dist/components/organisms/ServicesNavigation/ui.js +0 -371
  38. package/dist/components/organisms/ServicesNavigation/views.js +0 -1237
  39. package/dist/components/organisms/ServicesWorkspace/AssigneePicker.js +0 -459
  40. package/dist/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +0 -119
  41. package/dist/components/organisms/ServicesWorkspace/demo.js +0 -137
  42. package/dist/components/organisms/ServicesWorkspace/index.js +0 -813
  43. package/dist/components/organisms/ServicesWorkspace/servicesModel.js +0 -351
  44. package/dist/components/organisms/ServicesWorkspace/tooltipStyles.js +0 -37
  45. package/dist/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +0 -387
  46. package/dist/components/pages/ProductEdition/ProductEdition.stories.js +0 -148
  47. package/dist/components/pages/ProductEdition/ProductEditionView.js +0 -1355
  48. package/dist/components/pages/ProductEdition/ServiceHeader.js +0 -142
  49. package/dist/components/pages/ProductEdition/api.js +0 -256
  50. package/dist/components/pages/ProductEdition/index.js +0 -37
  51. package/dist/components/pages/ProductEdition/permissions.js +0 -200
  52. package/dist/components/pages/ProductEdition/permissions.test.js +0 -320
  53. package/dist/components/pages/ProductEdition/sections/CatalogServicePanel.js +0 -237
  54. package/dist/components/pages/ProductEdition/sections/EditionTopBar.js +0 -174
  55. package/dist/components/pages/ProductEdition/sections/ImagePanel.js +0 -440
  56. package/dist/components/pages/ProductEdition/sections/ServiceTeam.js +0 -275
  57. package/dist/components/pages/ProductEdition/sections/ServiceTools.js +0 -186
  58. package/dist/components/pages/ProductEdition/services.js +0 -233
  59. package/dist/components/pages/ProductEdition/services.test.js +0 -195
  60. package/src/components/organisms/ServicesNavigation/ServiceToolbar.jsx +0 -143
  61. package/src/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +0 -101
  62. package/src/components/organisms/ServicesNavigation/ServicesRail.jsx +0 -591
  63. package/src/components/organisms/ServicesNavigation/catalog.js +0 -180
  64. package/src/components/organisms/ServicesNavigation/index.jsx +0 -232
  65. package/src/components/organisms/ServicesNavigation/model.js +0 -85
  66. package/src/components/organisms/ServicesNavigation/ui.jsx +0 -229
  67. package/src/components/organisms/ServicesNavigation/views.jsx +0 -705
  68. package/src/components/organisms/ServicesWorkspace/AssigneePicker.js +0 -348
  69. package/src/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +0 -61
  70. package/src/components/organisms/ServicesWorkspace/demo.js +0 -58
  71. package/src/components/organisms/ServicesWorkspace/index.js +0 -556
  72. package/src/components/organisms/ServicesWorkspace/servicesModel.js +0 -203
  73. package/src/components/organisms/ServicesWorkspace/tooltipStyles.js +0 -27
  74. package/src/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +0 -175
  75. package/src/components/pages/ProductEdition/ProductEdition.stories.js +0 -106
  76. package/src/components/pages/ProductEdition/ProductEditionView.jsx +0 -1142
  77. package/src/components/pages/ProductEdition/ServiceHeader.jsx +0 -104
  78. package/src/components/pages/ProductEdition/api.js +0 -84
  79. package/src/components/pages/ProductEdition/index.js +0 -21
  80. package/src/components/pages/ProductEdition/permissions.js +0 -128
  81. package/src/components/pages/ProductEdition/permissions.test.js +0 -249
  82. package/src/components/pages/ProductEdition/sections/CatalogServicePanel.jsx +0 -123
  83. package/src/components/pages/ProductEdition/sections/EditionTopBar.jsx +0 -134
  84. package/src/components/pages/ProductEdition/sections/ImagePanel.jsx +0 -342
  85. package/src/components/pages/ProductEdition/sections/ServiceTeam.jsx +0 -184
  86. package/src/components/pages/ProductEdition/sections/ServiceTools.jsx +0 -134
  87. package/src/components/pages/ProductEdition/services.js +0 -187
  88. package/src/components/pages/ProductEdition/services.test.js +0 -88
@@ -1,813 +0,0 @@
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.ServicesWorkspace = exports.default = ServicesWorkspace;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
-
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
13
-
14
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
15
-
16
- var _react = require("react");
17
-
18
- var _material = require("@mui/material");
19
-
20
- var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
21
-
22
- var _Search = _interopRequireDefault(require("@mui/icons-material/Search"));
23
-
24
- var _EditOutlined = _interopRequireDefault(require("@mui/icons-material/EditOutlined"));
25
-
26
- var _CloudUploadOutlined = _interopRequireDefault(require("@mui/icons-material/CloudUploadOutlined"));
27
-
28
- var _ArrowForward = _interopRequireDefault(require("@mui/icons-material/ArrowForward"));
29
-
30
- var _AssigneePicker = _interopRequireDefault(require("./AssigneePicker"));
31
-
32
- var _tooltipStyles = require("./tooltipStyles");
33
-
34
- var _demo = require("./demo");
35
-
36
- var _servicesModel = require("./servicesModel");
37
-
38
- var _jsxRuntime = require("react/jsx-runtime");
39
-
40
- /*
41
- Pestaña "Servicios" de la edición de producto.
42
-
43
- Con 3 servicios bastaban 3 pestañas; con 20 la barra deja de servir. Aquí
44
- todos los servicios del producto viven en un mismo lugar, con el lenguaje que
45
- ya usa la tabla de Creators:
46
- - izquierda: el resumen (barra por etapas y lo que pide atención), un
47
- buscador y la lista agrupada por etapa, desplegable.
48
- - derecha: el servicio elegido: estatus, equipo (responsable, facilitador,
49
- auditor), su avance por cadena y su entregable.
50
- Ficha técnica, Descripción e Imágenes también aparecen en la lista para ver
51
- el panorama completo, pero se siguen editando en su pestaña (botón "Ir a").
52
- */
53
- var C = {
54
- pink: "#E33AA9",
55
- pinkHard: "#B12D84",
56
- purple: "#8A6CAA",
57
- textPurple: "#503D66",
58
- purpleLight: "#F0EEF2",
59
- white: "#FFFFFF",
60
- gray: "#707070",
61
- grayLight: "#F0F0F0",
62
- black: "#262626"
63
- };
64
- var sectionTitleSx = {
65
- fontFamily: "Lato, sans-serif",
66
- fontSize: 12,
67
- fontWeight: 700,
68
- letterSpacing: 0.4,
69
- textTransform: "uppercase",
70
- color: C.gray,
71
- mb: 1
72
- };
73
-
74
- function StatusChip(_ref) {
75
- var status = _ref.status,
76
- _ref$long = _ref.long,
77
- long = _ref$long === void 0 ? false : _ref$long;
78
- var color = (0, _servicesModel.getStatusColor)(status);
79
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
80
- component: "span",
81
- title: (0, _servicesModel.getStatusName)(status),
82
- sx: {
83
- display: "inline-flex",
84
- alignItems: "center",
85
- height: 22,
86
- px: 1,
87
- borderRadius: "6px",
88
- background: color,
89
- color: C.white,
90
- fontFamily: "Lato, sans-serif",
91
- fontSize: 12,
92
- fontWeight: 700,
93
- whiteSpace: "nowrap"
94
- },
95
- children: long ? "".concat(status, " \xB7 ").concat((0, _servicesModel.getStatusName)(status)) : status
96
- });
97
- }
98
-
99
- function StageDot(_ref2) {
100
- var color = _ref2.color,
101
- _ref2$size = _ref2.size,
102
- size = _ref2$size === void 0 ? 8 : _ref2$size;
103
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
104
- component: "span",
105
- sx: {
106
- width: size,
107
- height: size,
108
- borderRadius: "50%",
109
- background: color,
110
- flexShrink: 0
111
- }
112
- });
113
- }
114
-
115
- function ServicesBar(_ref3) {
116
- var groups = _ref3.groups;
117
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
118
- "aria-hidden": "true",
119
- sx: {
120
- display: "flex",
121
- gap: "2px",
122
- height: 8
123
- },
124
- children: groups.flatMap(function (group) {
125
- return group.services.map(function (service) {
126
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
127
- component: "span",
128
- sx: {
129
- flex: "1 1 0",
130
- minWidth: 3,
131
- borderRadius: "2px",
132
- background: group.stage.color
133
- }
134
- }, service.service_name);
135
- });
136
- })
137
- });
138
- }
139
-
140
- function ServicesWorkspace(_ref4) {
141
- var _services$find;
142
-
143
- var product = _ref4.product,
144
- _ref4$retailers = _ref4.retailers,
145
- retailers = _ref4$retailers === void 0 ? [] : _ref4$retailers,
146
- _ref4$users = _ref4.users,
147
- users = _ref4$users === void 0 ? {} : _ref4$users,
148
- _ref4$canAssign = _ref4.canAssign,
149
- canAssign = _ref4$canAssign === void 0 ? true : _ref4$canAssign,
150
- onAssign = _ref4.onAssign,
151
- onOpenEditor = _ref4.onOpenEditor;
152
- var services = (0, _react.useMemo)(function () {
153
- return (0, _servicesModel.getProductServices)(product);
154
- }, [product]);
155
- var groups = (0, _react.useMemo)(function () {
156
- return (0, _servicesModel.groupServicesByStage)(services);
157
- }, [services]);
158
- var attention = (0, _servicesModel.getAttention)(groups);
159
-
160
- var _useState = (0, _react.useState)(""),
161
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
162
- query = _useState2[0],
163
- setQuery = _useState2[1];
164
-
165
- var _useState3 = (0, _react.useState)(function () {
166
- return (0, _servicesModel.pickInitialService)(services);
167
- }),
168
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
169
- selectedName = _useState4[0],
170
- setSelectedName = _useState4[1];
171
-
172
- var _useState5 = (0, _react.useState)([]),
173
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
174
- expanded = _useState6[0],
175
- setExpanded = _useState6[1]; // Al cambiar de producto: se elige lo que pide atención y se abre su etapa.
176
-
177
-
178
- var productKey = "".concat(product === null || product === void 0 ? void 0 : product.id_article, "-").concat(product === null || product === void 0 ? void 0 : product.id_order);
179
- (0, _react.useEffect)(function () {
180
- var first = (0, _servicesModel.pickInitialService)(services);
181
- setSelectedName(first);
182
- var firstService = services.find(function (service) {
183
- return service.service_name === first;
184
- });
185
- setExpanded(firstService ? [(0, _servicesModel.getServiceStage)(firstService).stage_name] : []); // eslint-disable-next-line react-hooks/exhaustive-deps
186
- }, [productKey]);
187
- var text = query.trim().toLowerCase();
188
- var visibleGroups = text ? (0, _servicesModel.groupServicesByStage)(services.filter(function (service) {
189
- return service.display_name.toLowerCase().includes(text);
190
- })) : groups;
191
- var selected = (_services$find = services.find(function (service) {
192
- return service.service_name === selectedName;
193
- })) !== null && _services$find !== void 0 ? _services$find : null;
194
-
195
- var toggle = function toggle(stageName) {
196
- return setExpanded(function (prev) {
197
- return prev.includes(stageName) ? prev.filter(function (name) {
198
- return name !== stageName;
199
- }) : [].concat((0, _toConsumableArray2.default)(prev), [stageName]);
200
- });
201
- };
202
-
203
- if (services.length === 0) {
204
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
205
- sx: {
206
- p: 4,
207
- textAlign: "center",
208
- color: C.gray,
209
- fontFamily: "Lato, sans-serif"
210
- },
211
- children: "Este producto no tiene servicios solicitados."
212
- });
213
- }
214
-
215
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
216
- sx: {
217
- display: "grid",
218
- gridTemplateColumns: {
219
- xs: "1fr",
220
- md: "300px minmax(0, 1fr)"
221
- },
222
- minHeight: 480,
223
- border: "1px solid ".concat(C.purpleLight),
224
- borderRadius: "12px",
225
- background: C.white,
226
- overflow: "hidden",
227
- textAlign: "left",
228
- // La librería no fija la tipografía del cuerpo: sin esto, los textos
229
- // sueltos (Box) heredan la del navegador fuera de las aplicaciones.
230
- fontFamily: "Lato, sans-serif"
231
- },
232
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
233
- component: "nav",
234
- "aria-label": "Servicios del producto",
235
- sx: {
236
- borderRight: {
237
- md: "1px solid ".concat(C.purpleLight)
238
- },
239
- p: 2,
240
- display: "flex",
241
- flexDirection: "column",
242
- gap: 1.5,
243
- minWidth: 0
244
- },
245
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
246
- sx: {
247
- display: "flex",
248
- alignItems: "baseline",
249
- gap: 1
250
- },
251
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
252
- sx: {
253
- fontFamily: "Raleway, sans-serif",
254
- fontSize: 16,
255
- fontWeight: 600,
256
- color: C.textPurple
257
- },
258
- children: "Servicios"
259
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
260
- sx: {
261
- flex: 1,
262
- fontFamily: "Lato, sans-serif",
263
- fontSize: 12,
264
- color: C.gray
265
- },
266
- children: services.length
267
- }), attention && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
268
- component: "span",
269
- sx: {
270
- display: "inline-flex",
271
- alignItems: "center",
272
- gap: 0.75,
273
- px: 1,
274
- height: 22,
275
- alignSelf: "center",
276
- borderRadius: "11px",
277
- background: C.purpleLight,
278
- fontFamily: "Lato, sans-serif",
279
- fontSize: 12,
280
- fontWeight: 700,
281
- color: C.textPurple,
282
- whiteSpace: "nowrap"
283
- },
284
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StageDot, {
285
- color: attention.stage.color
286
- }), attention.label]
287
- })]
288
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ServicesBar, {
289
- groups: groups
290
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
291
- size: "small",
292
- placeholder: "Buscar servicio\u2026",
293
- value: query,
294
- onChange: function onChange(event) {
295
- return setQuery(event.target.value);
296
- },
297
- InputProps: {
298
- startAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputAdornment, {
299
- position: "start",
300
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Search.default, {
301
- sx: {
302
- fontSize: 18,
303
- color: C.gray
304
- }
305
- })
306
- }),
307
- sx: {
308
- borderRadius: "8px",
309
- fontFamily: "Lato, sans-serif",
310
- fontSize: 13,
311
- "&.Mui-focused .MuiOutlinedInput-notchedOutline": {
312
- borderColor: C.pink
313
- }
314
- }
315
- }
316
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
317
- sx: {
318
- display: "flex",
319
- flexDirection: "column",
320
- gap: 0.5,
321
- overflowY: "auto",
322
- maxHeight: 520
323
- },
324
- children: [visibleGroups.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
325
- sx: {
326
- py: 2,
327
- textAlign: "center",
328
- fontSize: 13,
329
- color: C.gray
330
- },
331
- children: "Sin coincidencias"
332
- }), visibleGroups.map(function (_ref5) {
333
- var stage = _ref5.stage,
334
- inStage = _ref5.services;
335
- var isOpen = Boolean(text) || expanded.includes(stage.stage_name);
336
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
337
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonBase, {
338
- onClick: function onClick() {
339
- return toggle(stage.stage_name);
340
- },
341
- "aria-expanded": isOpen,
342
- sx: {
343
- width: "100%",
344
- display: "flex",
345
- alignItems: "center",
346
- gap: 1,
347
- px: 1,
348
- py: 0.75,
349
- borderRadius: "8px",
350
- textAlign: "left",
351
- "&:hover": {
352
- backgroundColor: C.purpleLight
353
- }
354
- },
355
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StageDot, {
356
- color: stage.color,
357
- size: 10
358
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
359
- sx: {
360
- flex: 1,
361
- fontSize: 13,
362
- fontWeight: 700,
363
- color: C.textPurple
364
- },
365
- children: stage.display_name
366
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
367
- sx: {
368
- fontFamily: "Lato, sans-serif",
369
- fontSize: 12,
370
- fontWeight: 700,
371
- color: C.gray
372
- },
373
- children: inStage.length
374
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {
375
- fontSize: "small",
376
- sx: {
377
- color: C.purple,
378
- transition: "transform 150ms",
379
- transform: isOpen ? "rotate(180deg)" : "none"
380
- }
381
- })]
382
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Collapse, {
383
- in: isOpen,
384
- unmountOnExit: true,
385
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
386
- sx: {
387
- display: "flex",
388
- flexDirection: "column",
389
- py: 0.25
390
- },
391
- children: inStage.map(function (service) {
392
- var active = service.service_name === selectedName;
393
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonBase, {
394
- onClick: function onClick() {
395
- return setSelectedName(service.service_name);
396
- },
397
- "aria-current": active ? "true" : undefined,
398
- sx: {
399
- display: "flex",
400
- alignItems: "center",
401
- gap: 1,
402
- pl: 3,
403
- pr: 1,
404
- py: 0.75,
405
- borderRadius: "8px",
406
- textAlign: "left",
407
- borderLeft: "3px solid ".concat(active ? C.pink : "transparent"),
408
- backgroundColor: active ? C.purpleLight : "transparent",
409
- "&:hover": {
410
- backgroundColor: C.purpleLight
411
- }
412
- },
413
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
414
- sx: {
415
- flex: 1,
416
- minWidth: 0,
417
- fontSize: 14,
418
- fontWeight: active ? 700 : 400,
419
- color: active ? C.textPurple : C.black,
420
- overflow: "hidden",
421
- textOverflow: "ellipsis",
422
- whiteSpace: "nowrap"
423
- },
424
- children: service.display_name
425
- }), service.editor_tab && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _tooltipStyles.whiteTooltipProps), {}, {
426
- title: "Se edita en la pesta\xF1a ".concat(service.editor_tab),
427
- arrow: true,
428
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditOutlined.default, {
429
- sx: {
430
- fontSize: 18,
431
- color: C.purple
432
- }
433
- })
434
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatusChip, {
435
- status: service.has_workflow ? service.status : "REG"
436
- })]
437
- }, service.service_name);
438
- })
439
- })
440
- })]
441
- }, stage.stage_name);
442
- })]
443
- })]
444
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
445
- component: "section",
446
- "aria-live": "polite",
447
- sx: {
448
- p: 3,
449
- minWidth: 0
450
- },
451
- children: selected ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ServiceDetail, {
452
- product: product,
453
- service: selected,
454
- retailers: retailers,
455
- users: users,
456
- canAssign: canAssign,
457
- onAssign: onAssign,
458
- onOpenEditor: onOpenEditor
459
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
460
- sx: {
461
- color: C.gray
462
- },
463
- children: "Elige un servicio de la lista."
464
- })
465
- })]
466
- });
467
- }
468
-
469
- var personName = function personName() {
470
- var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
471
- var id = arguments.length > 1 ? arguments[1] : undefined;
472
- if (!id) return "Por asignar";
473
- var person = list.find(function (user) {
474
- return user.id_user === id;
475
- });
476
- return person ? [person.name, person.last_name].filter(Boolean).join(" ") : "Asignado";
477
- };
478
-
479
- function ServiceDetail(_ref6) {
480
- var _ref7, _service$deliverable_, _DEMO_CATALOG$find, _service$assignees, _service$assignees2;
481
-
482
- var product = _ref6.product,
483
- service = _ref6.service,
484
- retailers = _ref6.retailers,
485
- users = _ref6.users,
486
- canAssign = _ref6.canAssign,
487
- _onAssign = _ref6.onAssign,
488
- onOpenEditor = _ref6.onOpenEditor;
489
- var stage = (0, _servicesModel.getServiceStage)(service);
490
- var retailerStatuses = (0, _servicesModel.getRetailerStatuses)(product, service, retailers);
491
- var deliverableType = (_ref7 = (_service$deliverable_ = service.deliverable_type) !== null && _service$deliverable_ !== void 0 ? _service$deliverable_ : (_DEMO_CATALOG$find = _demo.DEMO_CATALOG.find(function (item) {
492
- return item.service_name === service.service_name;
493
- })) === null || _DEMO_CATALOG$find === void 0 ? void 0 : _DEMO_CATALOG$find.deliverable_type) !== null && _ref7 !== void 0 ? _ref7 : "Entregable";
494
-
495
- var lockReason = function lockReason(role) {
496
- var _users$role;
497
-
498
- // El auditor es del producto, no del servicio: no depende de este.
499
- var perService = role !== "auditor";
500
- if (perService && !service.has_workflow) return "Servicio de registro: no lleva equipo";
501
- if (perService && service.is_demo) return "Se podrá asignar cuando el servicio exista en el catálogo";
502
- if (!canAssign) return "Tu rol puede ver la asignación, pero no cambiarla";
503
- if (!_onAssign) return "Asigna desde la tabla de productos";
504
- if (!((_users$role = users[role]) !== null && _users$role !== void 0 ? _users$role : []).length) return "No hay personas asignables para este rol";
505
- return null;
506
- };
507
-
508
- var team = [{
509
- role: "especialist",
510
- label: "Responsable",
511
- currentId: (_service$assignees = service.assignees) === null || _service$assignees === void 0 ? void 0 : _service$assignees.especialist
512
- }, {
513
- role: "facilitator",
514
- label: "Facilitador",
515
- currentId: (_service$assignees2 = service.assignees) === null || _service$assignees2 === void 0 ? void 0 : _service$assignees2.facilitator
516
- }, {
517
- role: "auditor",
518
- label: "Auditor",
519
- currentId: (product === null || product === void 0 ? void 0 : product.id_auditor) || null,
520
- note: "del producto"
521
- }];
522
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
523
- sx: {
524
- display: "flex",
525
- flexDirection: "column",
526
- gap: 3
527
- },
528
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
529
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
530
- sx: {
531
- display: "flex",
532
- alignItems: "center",
533
- gap: 1,
534
- flexWrap: "wrap"
535
- },
536
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
537
- component: "h3",
538
- sx: {
539
- m: 0,
540
- fontFamily: "Raleway, sans-serif",
541
- fontSize: 22,
542
- fontWeight: 600,
543
- color: C.textPurple
544
- },
545
- children: service.display_name
546
- }), service.is_demo && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
547
- component: "span",
548
- sx: {
549
- fontSize: 12,
550
- fontStyle: "italic",
551
- color: C.gray
552
- },
553
- children: "ejemplo"
554
- })]
555
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
556
- sx: {
557
- mt: 1,
558
- display: "flex",
559
- alignItems: "center",
560
- gap: 1,
561
- flexWrap: "wrap"
562
- },
563
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StatusChip, {
564
- status: service.has_workflow ? service.status : "REG",
565
- long: true
566
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
567
- component: "span",
568
- sx: {
569
- display: "inline-flex",
570
- alignItems: "center",
571
- gap: 0.75,
572
- fontSize: 13,
573
- color: C.gray
574
- },
575
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(StageDot, {
576
- color: stage.color
577
- }), stage.display_name]
578
- })]
579
- })]
580
- }), service.editor_tab && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
581
- sx: {
582
- display: "flex",
583
- alignItems: "center",
584
- gap: 2,
585
- p: 1.5,
586
- borderRadius: "10px",
587
- background: C.purpleLight
588
- },
589
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_EditOutlined.default, {
590
- sx: {
591
- color: C.purple
592
- }
593
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
594
- sx: {
595
- flex: 1,
596
- fontSize: 14,
597
- color: C.textPurple
598
- },
599
- children: ["Este servicio se trabaja en la pesta\xF1a ", /*#__PURE__*/(0, _jsxRuntime.jsx)("b", {
600
- children: service.editor_tab
601
- }), "."]
602
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Button, {
603
- onClick: function onClick() {
604
- return onOpenEditor === null || onOpenEditor === void 0 ? void 0 : onOpenEditor(service.editor_tab);
605
- },
606
- endIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowForward.default, {
607
- fontSize: "small"
608
- }),
609
- sx: {
610
- textTransform: "none",
611
- fontWeight: 700,
612
- color: C.pinkHard,
613
- borderRadius: "8px"
614
- },
615
- children: ["Ir a ", service.editor_tab]
616
- })]
617
- }), service.has_workflow && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
618
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
619
- sx: sectionTitleSx,
620
- children: "Acciones"
621
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _tooltipStyles.whiteTooltipProps), {}, {
622
- title: "Se habilita con el motor de estatus (status-engine)",
623
- arrow: true,
624
- placement: "top-start",
625
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
626
- sx: {
627
- display: "inline-flex",
628
- gap: 1,
629
- flexWrap: "wrap"
630
- },
631
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
632
- disabled: true,
633
- variant: "contained",
634
- sx: {
635
- textTransform: "none",
636
- borderRadius: "8px",
637
- boxShadow: "none"
638
- },
639
- children: "Aprobar"
640
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
641
- disabled: true,
642
- variant: "outlined",
643
- sx: {
644
- textTransform: "none",
645
- borderRadius: "8px"
646
- },
647
- children: "Rechazar"
648
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
649
- disabled: true,
650
- sx: {
651
- textTransform: "none",
652
- borderRadius: "8px"
653
- },
654
- children: "Cambiar estatus\u2026"
655
- })]
656
- })
657
- }))]
658
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
659
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
660
- sx: sectionTitleSx,
661
- children: "Equipo"
662
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
663
- sx: {
664
- display: "flex",
665
- flexDirection: "column",
666
- gap: 1
667
- },
668
- children: team.map(function (_ref8) {
669
- var _users$role2;
670
-
671
- var role = _ref8.role,
672
- label = _ref8.label,
673
- currentId = _ref8.currentId,
674
- note = _ref8.note;
675
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
676
- sx: {
677
- display: "grid",
678
- gridTemplateColumns: "minmax(0, 1fr) auto",
679
- alignItems: "center",
680
- gap: 1
681
- },
682
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
683
- sx: {
684
- fontSize: 14,
685
- color: C.black
686
- },
687
- children: [label, note && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
688
- component: "span",
689
- sx: {
690
- ml: 0.75,
691
- fontSize: 12,
692
- color: C.gray
693
- },
694
- children: note
695
- })]
696
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AssigneePicker.default, {
697
- // Aquí el estatus ya está arriba: la pastilla dice quién es.
698
- statusLabel: function statusLabel(current) {
699
- return current ? personName([current], current.id_user) : personName(users[role], currentId);
700
- },
701
- statusTitle: (0, _servicesModel.getStatusName)(service.status),
702
- users: (_users$role2 = users[role]) !== null && _users$role2 !== void 0 ? _users$role2 : [],
703
- currentId: currentId || null,
704
- roleLabel: label,
705
- lockedReason: lockReason(role),
706
- onAssign: function onAssign(user) {
707
- return _onAssign === null || _onAssign === void 0 ? void 0 : _onAssign(service.service_name, role, user);
708
- }
709
- }, "".concat(service.service_name, "-").concat(role, "-").concat(currentId))]
710
- }, role);
711
- })
712
- })]
713
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
714
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
715
- sx: sectionTitleSx,
716
- children: "Por cadena"
717
- }), retailerStatuses.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
718
- sx: {
719
- fontSize: 13,
720
- color: C.gray
721
- },
722
- children: "Sin cadenas para este servicio."
723
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
724
- sx: {
725
- display: "flex",
726
- flexDirection: "column",
727
- gap: 0.5
728
- },
729
- children: retailerStatuses.map(function (item) {
730
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
731
- sx: {
732
- display: "flex",
733
- alignItems: "center",
734
- gap: 1,
735
- py: 0.75,
736
- px: 1.25,
737
- borderRadius: "8px",
738
- background: C.grayLight
739
- },
740
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
741
- sx: {
742
- flex: 1,
743
- fontSize: 14,
744
- color: C.black
745
- },
746
- children: item.retailer
747
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(StatusChip, {
748
- status: item.status
749
- })]
750
- }, item.id_retailer);
751
- })
752
- })]
753
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
754
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
755
- sx: sectionTitleSx,
756
- children: "Entregable"
757
- }), service.editor_tab ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
758
- sx: {
759
- fontSize: 13,
760
- color: C.gray
761
- },
762
- children: ["El entregable es el contenido de la pesta\xF1a ", service.editor_tab, "."]
763
- }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
764
- sx: {
765
- display: "flex",
766
- alignItems: "center",
767
- gap: 2,
768
- p: 2,
769
- borderRadius: "10px",
770
- border: "1px dashed ".concat(C.purple)
771
- },
772
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CloudUploadOutlined.default, {
773
- sx: {
774
- color: C.purple,
775
- fontSize: 32
776
- }
777
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
778
- sx: {
779
- flex: 1
780
- },
781
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
782
- sx: {
783
- fontSize: 14,
784
- fontWeight: 700,
785
- color: C.textPurple
786
- },
787
- children: "A\xFAn no hay entregables"
788
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
789
- sx: {
790
- fontSize: 13,
791
- color: C.gray
792
- },
793
- children: ["Tipo: ", deliverableType]
794
- })]
795
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _tooltipStyles.whiteTooltipProps), {}, {
796
- title: "Se habilita con el gestor de servicios",
797
- arrow: true,
798
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
799
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
800
- disabled: true,
801
- variant: "outlined",
802
- sx: {
803
- textTransform: "none",
804
- borderRadius: "8px"
805
- },
806
- children: "Subir entregable"
807
- })
808
- })
809
- }))]
810
- })]
811
- })]
812
- });
813
- }