contentoh-components-library 21.6.61 → 21.6.63
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/ai/prompts/attribute.prompt.js +28 -0
- package/dist/ai/prompts/description.prompt.js +33 -0
- package/dist/ai/schemas/attribute.schema.js +35 -0
- package/dist/ai/schemas/description.schema.js +27 -0
- package/dist/components/atoms/MetricCard/index.js +3 -1
- package/dist/components/organisms/DashboardMetric/DashboardMetric.stories.js +12 -2
- package/dist/components/organisms/DashboardMetric/index.js +24 -1
- package/dist/components/organisms/DashboardMetric/styles.js +1 -1
- package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +11 -5
- package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +58 -31
- package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +5 -1
- package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +3 -40
- package/dist/components/pages/CreatorsProductEdition/sections/ImagesSection.js +18 -3
- package/dist/components/pages/CreatorsProductEdition/sections/StatusChip.js +4 -13
- package/dist/components/pages/CreatorsProductEdition/sections/TabsBar.js +10 -0
- package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +10 -2
- package/dist/components/pages/Dashboard/dashboardUtils.js +3 -3
- package/dist/components/pages/Dashboard/index.js +102 -88
- package/dist/components/pages/Dashboard/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -15
- package/dist/components/pages/RetailerProductEdition/index.js +40 -57
- package/dist/components/pages/RetailerProductEdition/utils.js +2 -6
- package/dist/index.js +0 -13
- package/package.json +1 -1
- package/src/components/atoms/MetricCard/index.js +2 -2
- package/src/components/organisms/DashboardMetric/DashboardMetric.stories.js +11 -0
- package/src/components/organisms/DashboardMetric/index.js +13 -1
- package/src/components/organisms/DashboardMetric/styles.js +13 -0
- package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +22 -3
- package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +36 -1
- package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +15 -3
- package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +8 -18
- package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +24 -2
- package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +4 -8
- package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +9 -0
- package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +6 -0
- package/src/components/pages/Dashboard/dashboardUtils.js +3 -3
- package/src/components/pages/Dashboard/index.js +62 -106
- package/src/components/pages/Dashboard/styles.js +17 -12
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +0 -12
- package/src/components/pages/RetailerProductEdition/index.js +3 -28
- package/src/components/pages/RetailerProductEdition/utils.js +0 -5
- package/src/index.js +0 -1
- package/dist/components/organisms/ServicesNavigation/ServiceToolbar.js +0 -210
- package/dist/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +0 -138
- package/dist/components/organisms/ServicesNavigation/ServicesRail.js +0 -705
- package/dist/components/organisms/ServicesNavigation/catalog.js +0 -505
- package/dist/components/organisms/ServicesNavigation/index.js +0 -337
- package/dist/components/organisms/ServicesNavigation/model.js +0 -167
- package/dist/components/organisms/ServicesNavigation/ui.js +0 -371
- package/dist/components/organisms/ServicesNavigation/views.js +0 -1237
- package/dist/components/organisms/ServicesWorkspace/AssigneePicker.js +0 -459
- package/dist/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +0 -119
- package/dist/components/organisms/ServicesWorkspace/demo.js +0 -137
- package/dist/components/organisms/ServicesWorkspace/index.js +0 -813
- package/dist/components/organisms/ServicesWorkspace/servicesModel.js +0 -351
- package/dist/components/organisms/ServicesWorkspace/tooltipStyles.js +0 -37
- package/dist/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +0 -387
- package/dist/components/pages/ProductEdition/ProductEdition.stories.js +0 -148
- package/dist/components/pages/ProductEdition/ProductEditionView.js +0 -1355
- package/dist/components/pages/ProductEdition/ServiceHeader.js +0 -142
- package/dist/components/pages/ProductEdition/api.js +0 -256
- package/dist/components/pages/ProductEdition/index.js +0 -37
- package/dist/components/pages/ProductEdition/permissions.js +0 -200
- package/dist/components/pages/ProductEdition/permissions.test.js +0 -320
- package/dist/components/pages/ProductEdition/sections/CatalogServicePanel.js +0 -237
- package/dist/components/pages/ProductEdition/sections/EditionTopBar.js +0 -174
- package/dist/components/pages/ProductEdition/sections/ImagePanel.js +0 -440
- package/dist/components/pages/ProductEdition/sections/ServiceTeam.js +0 -275
- package/dist/components/pages/ProductEdition/sections/ServiceTools.js +0 -186
- package/dist/components/pages/ProductEdition/services.js +0 -233
- package/dist/components/pages/ProductEdition/services.test.js +0 -195
- package/src/components/organisms/ServicesNavigation/ServiceToolbar.jsx +0 -143
- package/src/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +0 -101
- package/src/components/organisms/ServicesNavigation/ServicesRail.jsx +0 -591
- package/src/components/organisms/ServicesNavigation/catalog.js +0 -180
- package/src/components/organisms/ServicesNavigation/index.jsx +0 -232
- package/src/components/organisms/ServicesNavigation/model.js +0 -85
- package/src/components/organisms/ServicesNavigation/ui.jsx +0 -229
- package/src/components/organisms/ServicesNavigation/views.jsx +0 -705
- package/src/components/organisms/ServicesWorkspace/AssigneePicker.js +0 -348
- package/src/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +0 -61
- package/src/components/organisms/ServicesWorkspace/demo.js +0 -58
- package/src/components/organisms/ServicesWorkspace/index.js +0 -556
- package/src/components/organisms/ServicesWorkspace/servicesModel.js +0 -203
- package/src/components/organisms/ServicesWorkspace/tooltipStyles.js +0 -27
- package/src/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +0 -175
- package/src/components/pages/ProductEdition/ProductEdition.stories.js +0 -106
- package/src/components/pages/ProductEdition/ProductEditionView.jsx +0 -1142
- package/src/components/pages/ProductEdition/ServiceHeader.jsx +0 -104
- package/src/components/pages/ProductEdition/api.js +0 -84
- package/src/components/pages/ProductEdition/index.js +0 -21
- package/src/components/pages/ProductEdition/permissions.js +0 -128
- package/src/components/pages/ProductEdition/permissions.test.js +0 -249
- package/src/components/pages/ProductEdition/sections/CatalogServicePanel.jsx +0 -123
- package/src/components/pages/ProductEdition/sections/EditionTopBar.jsx +0 -134
- package/src/components/pages/ProductEdition/sections/ImagePanel.jsx +0 -342
- package/src/components/pages/ProductEdition/sections/ServiceTeam.jsx +0 -184
- package/src/components/pages/ProductEdition/sections/ServiceTools.jsx +0 -134
- package/src/components/pages/ProductEdition/services.js +0 -187
- package/src/components/pages/ProductEdition/services.test.js +0 -88
|
@@ -1,275 +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.ServiceTeam = void 0;
|
|
9
|
-
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
-
|
|
12
|
-
var _react = require("react");
|
|
13
|
-
|
|
14
|
-
var _material = require("@mui/material");
|
|
15
|
-
|
|
16
|
-
var _data = require("../../../../global-files/data");
|
|
17
|
-
|
|
18
|
-
var _tokens = require("../../CreatorsProductEdition/sections/tokens");
|
|
19
|
-
|
|
20
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
|
|
22
|
-
/*
|
|
23
|
-
Equipo del servicio abierto: especialista, coordinador y auditor, con foto,
|
|
24
|
-
rol y nombre («Tú» para quien está viendo).
|
|
25
|
-
|
|
26
|
-
Reemplaza al grupo de avatares «Asig.» de la barra de pestañas, que no decía
|
|
27
|
-
quién era quién. Quien puede asignar (permissions.canAssign) hace clic en el
|
|
28
|
-
especialista o en el coordinador y elige de la lista, igual que antes.
|
|
29
|
-
|
|
30
|
-
`roles` (opcional) limita los roles que se muestran: un servicio del catálogo
|
|
31
|
-
de flujo simple solo tiene especialista. Por omisión, los tres.
|
|
32
|
-
*/
|
|
33
|
-
var ROLES = [{
|
|
34
|
-
role: "especialist",
|
|
35
|
-
label: "Especialista",
|
|
36
|
-
assignable: true
|
|
37
|
-
}, {
|
|
38
|
-
role: "facilitator",
|
|
39
|
-
label: "Coordinador",
|
|
40
|
-
assignable: true
|
|
41
|
-
}, {
|
|
42
|
-
role: "auditor",
|
|
43
|
-
label: "Auditor",
|
|
44
|
-
assignable: false
|
|
45
|
-
}];
|
|
46
|
-
|
|
47
|
-
var nameOf = function nameOf(person) {
|
|
48
|
-
return person ? [person.name, person.last_name].filter(Boolean).join(" ").trim() : "";
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
var initialsOf = function initialsOf(person) {
|
|
52
|
-
return nameOf(person).split(/\s+/).filter(Boolean).slice(0, 2).map(function (word) {
|
|
53
|
-
return word[0];
|
|
54
|
-
}).join("").toUpperCase();
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
var PersonAvatar = function PersonAvatar(_ref) {
|
|
58
|
-
var person = _ref.person,
|
|
59
|
-
isMe = _ref.isMe,
|
|
60
|
-
_ref$size = _ref.size,
|
|
61
|
-
size = _ref$size === void 0 ? 26 : _ref$size;
|
|
62
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
|
|
63
|
-
src: person !== null && person !== void 0 && person.id_user ? (0, _data.getProfilePicture)(person.id_user, 48, 48) : undefined,
|
|
64
|
-
alt: nameOf(person),
|
|
65
|
-
sx: {
|
|
66
|
-
width: size,
|
|
67
|
-
height: size,
|
|
68
|
-
fontSize: size * 0.4,
|
|
69
|
-
fontFamily: _tokens.FONTS.Lato,
|
|
70
|
-
fontWeight: 700,
|
|
71
|
-
bgcolor: person ? _tokens.COLORS.s2 : _tokens.COLORS.white,
|
|
72
|
-
color: person ? _tokens.COLORS.s5 : _tokens.COLORS.s3,
|
|
73
|
-
border: "2px solid ".concat(isMe ? _tokens.COLORS.magenta_s2 : _tokens.COLORS.white),
|
|
74
|
-
outline: person ? "none" : "1px dashed ".concat(_tokens.COLORS.s3),
|
|
75
|
-
outlineOffset: -3
|
|
76
|
-
},
|
|
77
|
-
children: person ? initialsOf(person) : "?"
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
var ServiceTeam = function ServiceTeam(_ref2) {
|
|
82
|
-
var _assig$collaborators$, _assig$collaborators, _ROLES$find;
|
|
83
|
-
|
|
84
|
-
var _ref2$assignees = _ref2.assignees,
|
|
85
|
-
assignees = _ref2$assignees === void 0 ? {} : _ref2$assignees,
|
|
86
|
-
userId = _ref2.userId,
|
|
87
|
-
_ref2$canAssign = _ref2.canAssign,
|
|
88
|
-
canAssign = _ref2$canAssign === void 0 ? false : _ref2$canAssign,
|
|
89
|
-
assig = _ref2.assig,
|
|
90
|
-
setAssignation = _ref2.setAssignation,
|
|
91
|
-
resetKey = _ref2.resetKey,
|
|
92
|
-
roles = _ref2.roles;
|
|
93
|
-
|
|
94
|
-
var _useState = (0, _react.useState)(null),
|
|
95
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
96
|
-
anchor = _useState2[0],
|
|
97
|
-
setAnchor = _useState2[1];
|
|
98
|
-
|
|
99
|
-
var _useState3 = (0, _react.useState)(null),
|
|
100
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
101
|
-
role = _useState4[0],
|
|
102
|
-
setRole = _useState4[1];
|
|
103
|
-
|
|
104
|
-
(0, _react.useEffect)(function () {
|
|
105
|
-
return setAnchor(null);
|
|
106
|
-
}, [resetKey]);
|
|
107
|
-
var options = (_assig$collaborators$ = assig === null || assig === void 0 ? void 0 : (_assig$collaborators = assig.collaborators) === null || _assig$collaborators === void 0 ? void 0 : _assig$collaborators[role]) !== null && _assig$collaborators$ !== void 0 ? _assig$collaborators$ : [];
|
|
108
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
109
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
|
|
110
|
-
direction: "row",
|
|
111
|
-
alignItems: "center",
|
|
112
|
-
spacing: 1.5,
|
|
113
|
-
sx: {
|
|
114
|
-
flexWrap: "wrap",
|
|
115
|
-
rowGap: 0.75,
|
|
116
|
-
minWidth: 0
|
|
117
|
-
},
|
|
118
|
-
children: ROLES.filter(function (item) {
|
|
119
|
-
return !roles || roles.includes(item.role);
|
|
120
|
-
}).map(function (item) {
|
|
121
|
-
var person = assignees[item.role];
|
|
122
|
-
var isMe = Boolean(person) && person.id_user === userId;
|
|
123
|
-
var clickable = canAssign && item.assignable;
|
|
124
|
-
var content = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
125
|
-
direction: "row",
|
|
126
|
-
alignItems: "center",
|
|
127
|
-
spacing: 0.75,
|
|
128
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(PersonAvatar, {
|
|
129
|
-
person: person,
|
|
130
|
-
isMe: isMe
|
|
131
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
132
|
-
sx: {
|
|
133
|
-
lineHeight: 1.1,
|
|
134
|
-
textAlign: "left",
|
|
135
|
-
minWidth: 0
|
|
136
|
-
},
|
|
137
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
138
|
-
sx: {
|
|
139
|
-
fontFamily: _tokens.FONTS.Lato,
|
|
140
|
-
fontSize: 10,
|
|
141
|
-
color: _tokens.COLORS.s4,
|
|
142
|
-
textTransform: "uppercase",
|
|
143
|
-
letterSpacing: "0.05em"
|
|
144
|
-
},
|
|
145
|
-
children: item.label
|
|
146
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
147
|
-
noWrap: true,
|
|
148
|
-
sx: {
|
|
149
|
-
maxWidth: 120,
|
|
150
|
-
fontFamily: _tokens.FONTS.Lato,
|
|
151
|
-
fontSize: 12,
|
|
152
|
-
fontWeight: isMe ? 700 : 400,
|
|
153
|
-
color: person ? _tokens.COLORS.s5 : _tokens.COLORS.s3
|
|
154
|
-
},
|
|
155
|
-
children: person ? isMe ? "Tú" : nameOf(person) : "Sin asignar"
|
|
156
|
-
})]
|
|
157
|
-
})]
|
|
158
|
-
});
|
|
159
|
-
var title = person ? "".concat(item.label, ": ").concat(nameOf(person)) : "".concat(item.label, ": sin asignar");
|
|
160
|
-
return clickable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
161
|
-
title: "".concat(title, " \xB7 Clic para asignar"),
|
|
162
|
-
arrow: true,
|
|
163
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ButtonBase, {
|
|
164
|
-
onClick: function onClick(event) {
|
|
165
|
-
setRole(item.role);
|
|
166
|
-
setAnchor(event.currentTarget);
|
|
167
|
-
},
|
|
168
|
-
sx: {
|
|
169
|
-
borderRadius: "8px",
|
|
170
|
-
px: 0.5,
|
|
171
|
-
py: 0.25,
|
|
172
|
-
"&:hover": {
|
|
173
|
-
bgcolor: _tokens.COLORS.s2
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
children: content
|
|
177
|
-
})
|
|
178
|
-
}, item.role) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
179
|
-
title: title,
|
|
180
|
-
arrow: true,
|
|
181
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
182
|
-
sx: {
|
|
183
|
-
px: 0.5,
|
|
184
|
-
py: 0.25
|
|
185
|
-
},
|
|
186
|
-
children: content
|
|
187
|
-
})
|
|
188
|
-
}, item.role);
|
|
189
|
-
})
|
|
190
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Popover, {
|
|
191
|
-
open: Boolean(anchor),
|
|
192
|
-
anchorEl: anchor,
|
|
193
|
-
onClose: function onClose() {
|
|
194
|
-
return setAnchor(null);
|
|
195
|
-
},
|
|
196
|
-
anchorOrigin: {
|
|
197
|
-
vertical: "bottom",
|
|
198
|
-
horizontal: "left"
|
|
199
|
-
},
|
|
200
|
-
transformOrigin: {
|
|
201
|
-
vertical: "top",
|
|
202
|
-
horizontal: "left"
|
|
203
|
-
},
|
|
204
|
-
PaperProps: {
|
|
205
|
-
sx: {
|
|
206
|
-
width: 260,
|
|
207
|
-
maxWidth: "calc(100vw - 24px)",
|
|
208
|
-
mt: 1,
|
|
209
|
-
p: 1.5,
|
|
210
|
-
borderRadius: "10px"
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
214
|
-
sx: {
|
|
215
|
-
fontFamily: _tokens.FONTS.Lato,
|
|
216
|
-
fontSize: 12,
|
|
217
|
-
fontWeight: 700,
|
|
218
|
-
color: _tokens.COLORS.s4,
|
|
219
|
-
mb: 1
|
|
220
|
-
},
|
|
221
|
-
children: ["Asignar ", (_ROLES$find = ROLES.find(function (item) {
|
|
222
|
-
return item.role === role;
|
|
223
|
-
})) === null || _ROLES$find === void 0 ? void 0 : _ROLES$find.label.toLowerCase()]
|
|
224
|
-
}), options.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.List, {
|
|
225
|
-
dense: true,
|
|
226
|
-
disablePadding: true,
|
|
227
|
-
sx: {
|
|
228
|
-
maxHeight: 280,
|
|
229
|
-
overflowY: "auto"
|
|
230
|
-
},
|
|
231
|
-
children: options.map(function (person, index) {
|
|
232
|
-
var _assignees$role;
|
|
233
|
-
|
|
234
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
|
235
|
-
selected: (person === null || person === void 0 ? void 0 : person.id_user) === ((_assignees$role = assignees[role]) === null || _assignees$role === void 0 ? void 0 : _assignees$role.id_user),
|
|
236
|
-
onClick: function onClick() {
|
|
237
|
-
setAssignation && setAssignation(role, person === null || person === void 0 ? void 0 : person.id_user);
|
|
238
|
-
setAnchor(null);
|
|
239
|
-
},
|
|
240
|
-
sx: {
|
|
241
|
-
borderRadius: "6px"
|
|
242
|
-
},
|
|
243
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemAvatar, {
|
|
244
|
-
sx: {
|
|
245
|
-
minWidth: 38
|
|
246
|
-
},
|
|
247
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PersonAvatar, {
|
|
248
|
-
person: person
|
|
249
|
-
})
|
|
250
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
|
|
251
|
-
primary: nameOf(person),
|
|
252
|
-
primaryTypographyProps: {
|
|
253
|
-
sx: {
|
|
254
|
-
fontFamily: _tokens.FONTS.Lato,
|
|
255
|
-
fontSize: 14,
|
|
256
|
-
color: _tokens.COLORS.s5
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
})]
|
|
260
|
-
}, "".concat(index, "-").concat(person === null || person === void 0 ? void 0 : person.id_user));
|
|
261
|
-
})
|
|
262
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
263
|
-
sx: {
|
|
264
|
-
fontFamily: _tokens.FONTS.Lato,
|
|
265
|
-
fontSize: 13,
|
|
266
|
-
color: _tokens.COLORS.s4,
|
|
267
|
-
py: 1
|
|
268
|
-
},
|
|
269
|
-
children: "Sin personas para asignar"
|
|
270
|
-
})]
|
|
271
|
-
})]
|
|
272
|
-
});
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
exports.ServiceTeam = ServiceTeam;
|
|
@@ -1,186 +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.ServiceTools = void 0;
|
|
9
|
-
|
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
-
|
|
12
|
-
var _material = require("@mui/material");
|
|
13
|
-
|
|
14
|
-
var _AiProductEdition = require("../../../../contexts/AiProductEdition");
|
|
15
|
-
|
|
16
|
-
var _saveIcon = _interopRequireDefault(require("../../../../assets/images/generalButton/saveIcon.svg"));
|
|
17
|
-
|
|
18
|
-
var _saveIconHover = _interopRequireDefault(require("../../../../assets/images/generalButton/saveIconHover.svg"));
|
|
19
|
-
|
|
20
|
-
var _deleteIcon = _interopRequireDefault(require("../../../../assets/images/generalButton/deleteIcon.svg"));
|
|
21
|
-
|
|
22
|
-
var _deleteIconHover = _interopRequireDefault(require("../../../../assets/images/generalButton/deleteIconHover.svg"));
|
|
23
|
-
|
|
24
|
-
var _downloadIcon = _interopRequireDefault(require("../../../../assets/images/generalButton/downloadIcon.svg"));
|
|
25
|
-
|
|
26
|
-
var _rowLayout = _interopRequireDefault(require("../../../../assets/images/generalButton/rowLayout.svg"));
|
|
27
|
-
|
|
28
|
-
var _gridLayout = _interopRequireDefault(require("../../../../assets/images/generalButton/gridLayout.svg"));
|
|
29
|
-
|
|
30
|
-
var _tokens = require("../../CreatorsProductEdition/sections/tokens");
|
|
31
|
-
|
|
32
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
|
-
|
|
34
|
-
/*
|
|
35
|
-
Herramientas del servicio abierto: versión, guardar y, en imágenes, borrar,
|
|
36
|
-
descargar y cambiar de vista.
|
|
37
|
-
|
|
38
|
-
Sale de `ServiceActions` de CreatorsProductEdition sin tres cosas que ahora
|
|
39
|
-
viven en otro lado o ya no se usan:
|
|
40
|
-
- el botón de ayuda (las diapositivas de «Valida tu producto…»): el equipo
|
|
41
|
-
ya no lo usa;
|
|
42
|
-
- el estatus: lo muestra el encabezado del servicio junto a su nombre;
|
|
43
|
-
- las asignaciones: las muestra ServiceTeam con nombre y rol.
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
/** Botón redondo con el ícono de siempre y su versión «hover». */
|
|
47
|
-
var RoundIcon = function RoundIcon(_ref) {
|
|
48
|
-
var label = _ref.label,
|
|
49
|
-
icon = _ref.icon,
|
|
50
|
-
hoverIcon = _ref.hoverIcon,
|
|
51
|
-
onClick = _ref.onClick,
|
|
52
|
-
_ref$bordered = _ref.bordered,
|
|
53
|
-
bordered = _ref$bordered === void 0 ? _tokens.COLORS.s3 : _ref$bordered,
|
|
54
|
-
_ref$hoverBg = _ref.hoverBg,
|
|
55
|
-
hoverBg = _ref$hoverBg === void 0 ? _tokens.COLORS.magenta_s2 : _ref$hoverBg,
|
|
56
|
-
_ref$size = _ref.size,
|
|
57
|
-
size = _ref$size === void 0 ? 15 : _ref$size;
|
|
58
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
59
|
-
title: label,
|
|
60
|
-
arrow: true,
|
|
61
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
62
|
-
"aria-label": label,
|
|
63
|
-
onClick: onClick,
|
|
64
|
-
sx: {
|
|
65
|
-
width: 28,
|
|
66
|
-
height: 28,
|
|
67
|
-
p: 0,
|
|
68
|
-
border: bordered ? "1px solid ".concat(bordered) : "none",
|
|
69
|
-
backgroundImage: "url(".concat(icon, ")"),
|
|
70
|
-
backgroundRepeat: "no-repeat",
|
|
71
|
-
backgroundPosition: "center",
|
|
72
|
-
backgroundSize: size,
|
|
73
|
-
"&:hover": (0, _objectSpread2.default)({
|
|
74
|
-
backgroundColor: hoverBg,
|
|
75
|
-
borderColor: hoverBg
|
|
76
|
-
}, hoverIcon ? {
|
|
77
|
-
backgroundImage: "url(".concat(hoverIcon, ")")
|
|
78
|
-
} : {})
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
var ServiceTools = function ServiceTools(_ref2) {
|
|
85
|
-
var _ref2$imagesSection = _ref2.imagesSection,
|
|
86
|
-
imagesSection = _ref2$imagesSection === void 0 ? false : _ref2$imagesSection,
|
|
87
|
-
imageLayout = _ref2.imageLayout,
|
|
88
|
-
setImageLayout = _ref2.setImageLayout,
|
|
89
|
-
downloadImages = _ref2.downloadImages,
|
|
90
|
-
askToDeleteImages = _ref2.askToDeleteImages,
|
|
91
|
-
onClickSave = _ref2.onClickSave,
|
|
92
|
-
showSaveButton = _ref2.showSaveButton,
|
|
93
|
-
version = _ref2.version,
|
|
94
|
-
setShowVersionSelector = _ref2.setShowVersionSelector;
|
|
95
|
-
|
|
96
|
-
var _useAiProductEdition = (0, _AiProductEdition.useAiProductEdition)(),
|
|
97
|
-
inputsUsingAi = _useAiProductEdition.inputsUsingAi;
|
|
98
|
-
|
|
99
|
-
var save = function save() {
|
|
100
|
-
if (Object.values(inputsUsingAi !== null && inputsUsingAi !== void 0 ? inputsUsingAi : {}).some(function (input) {
|
|
101
|
-
return !!(input !== null && input !== void 0 && input.using);
|
|
102
|
-
})) {
|
|
103
|
-
console.warn("Para guardar se debe de dejar de usar la generación con IA");
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
onClickSave && onClickSave();
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
111
|
-
direction: "row",
|
|
112
|
-
alignItems: "center",
|
|
113
|
-
gap: "8px",
|
|
114
|
-
sx: {
|
|
115
|
-
flexShrink: 0
|
|
116
|
-
},
|
|
117
|
-
children: [version && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
118
|
-
title: "Cambiar de versi\xF3n",
|
|
119
|
-
arrow: true,
|
|
120
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Button, {
|
|
121
|
-
onClick: function onClick(event) {
|
|
122
|
-
event.stopPropagation();
|
|
123
|
-
setShowVersionSelector(true);
|
|
124
|
-
},
|
|
125
|
-
sx: {
|
|
126
|
-
minWidth: 28,
|
|
127
|
-
width: 28,
|
|
128
|
-
height: 28,
|
|
129
|
-
p: 0,
|
|
130
|
-
borderRadius: "50%",
|
|
131
|
-
border: "1px solid ".concat(_tokens.COLORS.color_purple),
|
|
132
|
-
color: _tokens.COLORS.color_purple,
|
|
133
|
-
fontFamily: _tokens.FONTS.AvenirNext,
|
|
134
|
-
fontSize: 11,
|
|
135
|
-
lineHeight: "28px"
|
|
136
|
-
},
|
|
137
|
-
children: ["V", version]
|
|
138
|
-
})
|
|
139
|
-
}), showSaveButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(RoundIcon, {
|
|
140
|
-
label: "Guardar",
|
|
141
|
-
icon: _saveIcon.default,
|
|
142
|
-
hoverIcon: _saveIconHover.default,
|
|
143
|
-
bordered: _tokens.COLORS.color_gray,
|
|
144
|
-
hoverBg: _tokens.COLORS.color_pink,
|
|
145
|
-
size: undefined,
|
|
146
|
-
onClick: save
|
|
147
|
-
}), imagesSection && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
148
|
-
children: [showSaveButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(RoundIcon, {
|
|
149
|
-
label: "Borrar seleccionadas",
|
|
150
|
-
icon: _deleteIcon.default,
|
|
151
|
-
hoverIcon: _deleteIconHover.default,
|
|
152
|
-
onClick: function onClick() {
|
|
153
|
-
return askToDeleteImages && askToDeleteImages();
|
|
154
|
-
}
|
|
155
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(RoundIcon, {
|
|
156
|
-
label: "Descargar",
|
|
157
|
-
icon: _downloadIcon.default,
|
|
158
|
-
onClick: function onClick() {
|
|
159
|
-
return downloadImages && downloadImages();
|
|
160
|
-
}
|
|
161
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
162
|
-
title: imageLayout ? "Ver como lista" : "Ver como cuadrícula",
|
|
163
|
-
arrow: true,
|
|
164
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
165
|
-
"aria-label": imageLayout ? "Ver como lista" : "Ver como cuadrícula",
|
|
166
|
-
onClick: function onClick() {
|
|
167
|
-
return setImageLayout && setImageLayout(!imageLayout);
|
|
168
|
-
},
|
|
169
|
-
sx: {
|
|
170
|
-
width: 28,
|
|
171
|
-
height: 28,
|
|
172
|
-
p: 0
|
|
173
|
-
},
|
|
174
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
175
|
-
src: imageLayout ? _rowLayout.default : _gridLayout.default,
|
|
176
|
-
alt: "",
|
|
177
|
-
width: 24,
|
|
178
|
-
height: 24
|
|
179
|
-
})
|
|
180
|
-
})
|
|
181
|
-
})]
|
|
182
|
-
})]
|
|
183
|
-
});
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
exports.ServiceTools = ServiceTools;
|
|
@@ -1,233 +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.buildServicesFromApi = exports.buildEditionServices = void 0;
|
|
9
|
-
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
-
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
13
|
-
|
|
14
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
15
|
-
|
|
16
|
-
var _catalog = require("../../organisms/ServicesNavigation/catalog");
|
|
17
|
-
|
|
18
|
-
var _permissions = require("./permissions");
|
|
19
|
-
|
|
20
|
-
/*
|
|
21
|
-
Servicios del producto para la lista lateral de la edición.
|
|
22
|
-
|
|
23
|
-
Hoy los servicios con editor son los tres de siempre: salen de los estatus
|
|
24
|
-
del producto (`<servicio>_status`) y el de la cadena activa sale de
|
|
25
|
-
`services_data`. Un servicio con estatus vacío o «NS» no está contratado y
|
|
26
|
-
no aparece.
|
|
27
|
-
|
|
28
|
-
Esta lista es el respaldo de cuando GET /product-services no responde
|
|
29
|
-
(buildServicesFromApi, abajo): solo los servicios de siempre. Los servicios
|
|
30
|
-
del producto nunca salen de datos de muestra; la prop `demoServices` es solo
|
|
31
|
-
para las historias de Storybook.
|
|
32
|
-
*/
|
|
33
|
-
var NOT_REQUESTED = [undefined, null, "", "NS", "NULL", "-"];
|
|
34
|
-
|
|
35
|
-
var catalogEntry = function catalogEntry(serviceName) {
|
|
36
|
-
var _SERVICE_CATALOG$find;
|
|
37
|
-
|
|
38
|
-
return (_SERVICE_CATALOG$find = _catalog.SERVICE_CATALOG.find(function (item) {
|
|
39
|
-
return item.service_name === serviceName;
|
|
40
|
-
})) !== null && _SERVICE_CATALOG$find !== void 0 ? _SERVICE_CATALOG$find : {
|
|
41
|
-
service_name: serviceName,
|
|
42
|
-
group: "review",
|
|
43
|
-
view: "files",
|
|
44
|
-
icon: null
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
/** Persona de las listas de asignables (`collaborator_assignations`). */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var findUser = function findUser(collaborators, id) {
|
|
51
|
-
if (!id) return null;
|
|
52
|
-
var all = Object.values(collaborators !== null && collaborators !== void 0 ? collaborators : {}).flat();
|
|
53
|
-
var user = all.find(function (item) {
|
|
54
|
-
return (item === null || item === void 0 ? void 0 : item.id_user) === id;
|
|
55
|
-
});
|
|
56
|
-
return user !== null && user !== void 0 ? user : {
|
|
57
|
-
id_user: id,
|
|
58
|
-
name: "Asignado",
|
|
59
|
-
last_name: ""
|
|
60
|
-
};
|
|
61
|
-
}; // `services_data` y `collaborator_assignations` llegan en null mientras carga.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var retailerStatus = function retailerStatus(servicesData, serviceName, retailerId, fallback) {
|
|
65
|
-
var _find$status, _find;
|
|
66
|
-
|
|
67
|
-
return (_find$status = (_find = (servicesData !== null && servicesData !== void 0 ? servicesData : []).find(function (item) {
|
|
68
|
-
return item.service === serviceName && item.id_retailer === retailerId;
|
|
69
|
-
})) === null || _find === void 0 ? void 0 : _find.status) !== null && _find$status !== void 0 ? _find$status : fallback;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* @returns {Array<{service_name, display_name, group, view, icon, status,
|
|
73
|
-
* tab, assignees, mine, pending, is_demo}>}
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var buildEditionServices = function buildEditionServices(_ref) {
|
|
78
|
-
var product = _ref.product,
|
|
79
|
-
user = _ref.user,
|
|
80
|
-
servicesData = _ref.servicesData,
|
|
81
|
-
activeRetailerId = _ref.activeRetailerId,
|
|
82
|
-
collaboratorAssignations = _ref.collaboratorAssignations,
|
|
83
|
-
auditors = _ref.auditors,
|
|
84
|
-
demoServices = _ref.demoServices;
|
|
85
|
-
if (!product) return [];
|
|
86
|
-
|
|
87
|
-
var classic = _permissions.CLASSIC_SERVICES.filter(function (item) {
|
|
88
|
-
return !NOT_REQUESTED.includes(product["".concat(item.service_name, "_status")]);
|
|
89
|
-
}).map(function (item) {
|
|
90
|
-
var _collaboratorAssignat, _collaboratorAssignat2;
|
|
91
|
-
|
|
92
|
-
var definition = catalogEntry(item.service_name);
|
|
93
|
-
var collaborators = (_collaboratorAssignat = collaboratorAssignations === null || collaboratorAssignations === void 0 ? void 0 : (_collaboratorAssignat2 = collaboratorAssignations[item.tab]) === null || _collaboratorAssignat2 === void 0 ? void 0 : _collaboratorAssignat2.collaborators) !== null && _collaboratorAssignat !== void 0 ? _collaboratorAssignat : {};
|
|
94
|
-
var status = retailerStatus(servicesData, item.service_name, activeRetailerId, product["".concat(item.service_name, "_status")]);
|
|
95
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, definition), {}, {
|
|
96
|
-
status: status,
|
|
97
|
-
tab: item.tab,
|
|
98
|
-
assignees: {
|
|
99
|
-
especialist: findUser(collaborators, product["id_".concat(item.service_name, "_especialist")]),
|
|
100
|
-
facilitator: findUser(collaborators, product["id_".concat(item.service_name, "_facilitator")]),
|
|
101
|
-
auditor: product.id_auditor ? findUser((0, _objectSpread2.default)((0, _objectSpread2.default)({}, collaborators), {}, {
|
|
102
|
-
auditors: auditors !== null && auditors !== void 0 ? auditors : []
|
|
103
|
-
}), product.id_auditor) : null
|
|
104
|
-
},
|
|
105
|
-
mine: (0, _permissions.rolesInService)(product, user, item.service_name).length > 0 || (0, _permissions.isAssignedToService)(product, user, item.service_name) || (0, _permissions.isAuditorAssigned)(product, user),
|
|
106
|
-
pending: (0, _permissions.isPendingFor)(product, user, item.service_name, status),
|
|
107
|
-
is_demo: false
|
|
108
|
-
});
|
|
109
|
-
}); // Solo historias (`demoServices`): el auditor del producto lo es de todos sus
|
|
110
|
-
// servicios, así «Míos» de un auditor no esconde los que no tienen editor.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var productAuditor = product.id_auditor ? findUser({
|
|
114
|
-
auditors: auditors !== null && auditors !== void 0 ? auditors : []
|
|
115
|
-
}, product.id_auditor) : null;
|
|
116
|
-
var auditorIsMe = (0, _permissions.isAuditorAssigned)(product, user);
|
|
117
|
-
var demo = (demoServices !== null && demoServices !== void 0 ? demoServices : []).map(function (service) {
|
|
118
|
-
var _ref2, _service$display_name;
|
|
119
|
-
|
|
120
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, catalogEntry(service.service_name)), {}, {
|
|
121
|
-
display_name: (_ref2 = (_service$display_name = service.display_name) !== null && _service$display_name !== void 0 ? _service$display_name : catalogEntry(service.service_name).display_name) !== null && _ref2 !== void 0 ? _ref2 : service.service_name,
|
|
122
|
-
status: service.status,
|
|
123
|
-
tab: null,
|
|
124
|
-
assignees: {
|
|
125
|
-
especialist: null,
|
|
126
|
-
facilitator: null,
|
|
127
|
-
auditor: productAuditor
|
|
128
|
-
},
|
|
129
|
-
mine: auditorIsMe,
|
|
130
|
-
pending: false,
|
|
131
|
-
is_demo: true
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
return [].concat((0, _toConsumableArray2.default)(classic), (0, _toConsumableArray2.default)(demo));
|
|
135
|
-
};
|
|
136
|
-
/* ------------------------------------------------------------------------ */
|
|
137
|
-
|
|
138
|
-
/* Desde el backend (GET /product-services) */
|
|
139
|
-
|
|
140
|
-
/* ------------------------------------------------------------------------ */
|
|
141
|
-
|
|
142
|
-
/*
|
|
143
|
-
Los servicios del producto como los devuelve GET /product-services: leídos
|
|
144
|
-
de las columnas del catálogo de rel_order_services (id_service, id_status,
|
|
145
|
-
id_especialist, id_facilitator). Trae todos los servicios del producto, los
|
|
146
|
-
de siempre y los del catálogo, con su estatus por cadena, su equipo y lo que
|
|
147
|
-
la persona puede hacer con cada uno (`actions`).
|
|
148
|
-
|
|
149
|
-
Cuando esta lista está, la edición la usa en lugar de armar los servicios con
|
|
150
|
-
los campos del producto (buildEditionServices).
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
/** En qué estatus le toca actuar a cada rol (flujo completo, el del motor). */
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
exports.buildEditionServices = buildEditionServices;
|
|
157
|
-
var WORKFLOW_ACTIONABLE = {
|
|
158
|
-
especialist: ["AS", "CA", "RC", "RA"],
|
|
159
|
-
facilitator: ["PA", "IE"],
|
|
160
|
-
auditor: ["AC", "RP", "RCA", "SAC"]
|
|
161
|
-
};
|
|
162
|
-
/** Roles de la persona en el servicio, según su equipo. */
|
|
163
|
-
|
|
164
|
-
var rolesOfUser = function rolesOfUser(assignees, userId) {
|
|
165
|
-
return Object.entries(assignees !== null && assignees !== void 0 ? assignees : {}).filter(function (_ref3) {
|
|
166
|
-
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
|
|
167
|
-
person = _ref4[1];
|
|
168
|
-
|
|
169
|
-
return person && userId && person.id_user === userId;
|
|
170
|
-
}).map(function (_ref5) {
|
|
171
|
-
var _ref6 = (0, _slicedToArray2.default)(_ref5, 1),
|
|
172
|
-
role = _ref6[0];
|
|
173
|
-
|
|
174
|
-
return role;
|
|
175
|
-
});
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* @param {{ productServices: { services: Array }, user: Object, activeRetailerId?: number }} params
|
|
179
|
-
* @returns {Array} servicios con la forma de la lista lateral, más `api` (el
|
|
180
|
-
* servicio tal como llegó) para los paneles que lo necesitan.
|
|
181
|
-
*/
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
var buildServicesFromApi = function buildServicesFromApi(_ref7) {
|
|
185
|
-
var _productServices$serv;
|
|
186
|
-
|
|
187
|
-
var productServices = _ref7.productServices,
|
|
188
|
-
user = _ref7.user,
|
|
189
|
-
activeRetailerId = _ref7.activeRetailerId;
|
|
190
|
-
var userId = user === null || user === void 0 ? void 0 : user.id_user;
|
|
191
|
-
return ((_productServices$serv = productServices === null || productServices === void 0 ? void 0 : productServices.services) !== null && _productServices$serv !== void 0 ? _productServices$serv : []).map(function (service) {
|
|
192
|
-
var _service$status_flow$, _service$status_flow, _ref8, _service$retailers$fi, _service$retailers, _service$retailers$fi2, _service$assignees, _status$status_name, _ref9, _service$display_name2, _service$category$cat, _service$category, _service$icon_name, _status$status_name2, _status$display_name, _status$color;
|
|
193
|
-
|
|
194
|
-
var entry = catalogEntry(service.service_name);
|
|
195
|
-
var flowType = (_service$status_flow$ = (_service$status_flow = service.status_flow) === null || _service$status_flow === void 0 ? void 0 : _service$status_flow.flow_type) !== null && _service$status_flow$ !== void 0 ? _service$status_flow$ : "workflow";
|
|
196
|
-
var simple = flowType === "simple"; // Estatus de la cadena activa; si el servicio no es por cadena (o no está
|
|
197
|
-
// en ella), el general.
|
|
198
|
-
|
|
199
|
-
var status = (_ref8 = (_service$retailers$fi = (_service$retailers = service.retailers) === null || _service$retailers === void 0 ? void 0 : (_service$retailers$fi2 = _service$retailers.find(function (retailer) {
|
|
200
|
-
return retailer.id_retailer === activeRetailerId;
|
|
201
|
-
})) === null || _service$retailers$fi2 === void 0 ? void 0 : _service$retailers$fi2.status) !== null && _service$retailers$fi !== void 0 ? _service$retailers$fi : service.status) !== null && _ref8 !== void 0 ? _ref8 : null;
|
|
202
|
-
var assignees = (_service$assignees = service.assignees) !== null && _service$assignees !== void 0 ? _service$assignees : {};
|
|
203
|
-
var roles = rolesOfUser(assignees, userId);
|
|
204
|
-
var parts = String((_status$status_name = status === null || status === void 0 ? void 0 : status.status_name) !== null && _status$status_name !== void 0 ? _status$status_name : "").split("/");
|
|
205
|
-
var pending = simple ? roles.includes("especialist") && Boolean(status) && !status.is_final : roles.some(function (role) {
|
|
206
|
-
return parts.some(function (part) {
|
|
207
|
-
var _WORKFLOW_ACTIONABLE$;
|
|
208
|
-
|
|
209
|
-
return (_WORKFLOW_ACTIONABLE$ = WORKFLOW_ACTIONABLE[role]) === null || _WORKFLOW_ACTIONABLE$ === void 0 ? void 0 : _WORKFLOW_ACTIONABLE$.includes(part);
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, entry), {}, {
|
|
213
|
-
service_name: service.service_name,
|
|
214
|
-
display_name: (_ref9 = (_service$display_name2 = service.display_name) !== null && _service$display_name2 !== void 0 ? _service$display_name2 : entry.display_name) !== null && _ref9 !== void 0 ? _ref9 : service.service_name,
|
|
215
|
-
group: (_service$category$cat = (_service$category = service.category) === null || _service$category === void 0 ? void 0 : _service$category.category_name) !== null && _service$category$cat !== void 0 ? _service$category$cat : entry.group,
|
|
216
|
-
view: simple ? "simple" : entry.view,
|
|
217
|
-
icon: (_service$icon_name = service.icon_name) !== null && _service$icon_name !== void 0 ? _service$icon_name : entry.icon,
|
|
218
|
-
status: (_status$status_name2 = status === null || status === void 0 ? void 0 : status.status_name) !== null && _status$status_name2 !== void 0 ? _status$status_name2 : null,
|
|
219
|
-
status_label: (_status$display_name = status === null || status === void 0 ? void 0 : status.display_name) !== null && _status$display_name !== void 0 ? _status$display_name : null,
|
|
220
|
-
status_color: (_status$color = status === null || status === void 0 ? void 0 : status.color) !== null && _status$color !== void 0 ? _status$color : null,
|
|
221
|
-
status_flow_type: flowType,
|
|
222
|
-
tab: (0, _permissions.tabOf)(service.service_name),
|
|
223
|
-
assignees: assignees,
|
|
224
|
-
mine: roles.length > 0,
|
|
225
|
-
pending: pending,
|
|
226
|
-
is_demo: false,
|
|
227
|
-
is_catalog: !service.is_legacy,
|
|
228
|
-
api: service
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
exports.buildServicesFromApi = buildServicesFromApi;
|