@strapi/review-workflows 0.0.0-experimental.defd8568ae03ef8d52f86e1f3541979f953c3941 → 0.0.0-experimental.e14656d3b8681880212c13260b9a2b340c182f2d
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/LICENSE +12 -17
- package/dist/_chunks/{Layout-Py8gxQW2.js → Layout-AREWDuuq.js} +11 -20
- package/dist/_chunks/Layout-AREWDuuq.js.map +1 -0
- package/dist/_chunks/{Layout-B_cKmQA3.mjs → Layout-D5aa9iUm.mjs} +13 -20
- package/dist/_chunks/Layout-D5aa9iUm.mjs.map +1 -0
- package/dist/_chunks/{_id-BeUU-t6D.js → _id-C7pCAzXV.js} +322 -416
- package/dist/_chunks/_id-C7pCAzXV.js.map +1 -0
- package/dist/_chunks/{_id-C_HRFhcV.mjs → _id-DDNHKV_W.mjs} +316 -408
- package/dist/_chunks/_id-DDNHKV_W.mjs.map +1 -0
- package/dist/_chunks/{index-DyJcIA81.js → index-Bv3cQ3c-.js} +24 -38
- package/dist/_chunks/index-Bv3cQ3c-.js.map +1 -0
- package/dist/_chunks/{index-D3AvHSbj.js → index-CIBLMG85.js} +164 -207
- package/dist/_chunks/index-CIBLMG85.js.map +1 -0
- package/dist/_chunks/{index-CAgnun9R.mjs → index-CeaoNBIP.mjs} +24 -36
- package/dist/_chunks/index-CeaoNBIP.mjs.map +1 -0
- package/dist/_chunks/{index-DjHtLGgq.mjs → index-Cx5QECZI.mjs} +167 -208
- package/dist/_chunks/index-Cx5QECZI.mjs.map +1 -0
- package/dist/_chunks/{purchase-review-workflows-DyffLpyz.mjs → purchase-review-workflows-BN-5Ube7.mjs} +5 -4
- package/dist/_chunks/purchase-review-workflows-BN-5Ube7.mjs.map +1 -0
- package/dist/_chunks/{purchase-review-workflows-BaOk5p_m.js → purchase-review-workflows-DlCDg0fD.js} +4 -3
- package/dist/_chunks/purchase-review-workflows-DlCDg0fD.js.map +1 -0
- package/dist/_chunks/{router-zN3-SLwz.mjs → router-BEoNwQZ1.mjs} +3 -3
- package/dist/_chunks/{router-zN3-SLwz.mjs.map → router-BEoNwQZ1.mjs.map} +1 -1
- package/dist/_chunks/{router-BwVSq4yF.js → router-gRPIa2_c.js} +3 -3
- package/dist/_chunks/{router-BwVSq4yF.js.map → router-gRPIa2_c.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/LimitsModal.d.ts +2 -4
- package/dist/admin/src/routes/content-manager/[model]/[id]/components/Panel.d.ts +1 -1
- package/dist/admin/src/routes/settings/hooks/useDragAndDrop.d.ts +4 -4
- package/dist/admin/src/routes/settings/hooks/useKeyboardDragAndDrop.d.ts +1 -1
- package/dist/admin/src/routes/settings/hooks/useReviewWorkflows.d.ts +3 -3
- package/dist/admin/src/services/admin.d.ts +2 -2
- package/dist/admin/src/services/api.d.ts +2 -3
- package/dist/admin/src/services/content-manager.d.ts +7 -7
- package/dist/admin/src/services/settings.d.ts +1734 -8
- package/dist/admin/src/utils/api.d.ts +4 -19
- package/dist/admin/src/utils/cm-hooks.d.ts +1 -1
- package/dist/server/index.js +12 -53
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +12 -53
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/index.d.ts +0 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/stages.d.ts.map +1 -1
- package/dist/server/src/controllers/workflows.d.ts +0 -7
- package/dist/server/src/controllers/workflows.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +1 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/review-workflows.d.ts.map +1 -1
- package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +1 -1
- package/dist/server/src/services/stages.d.ts +2 -7
- package/dist/server/src/services/stages.d.ts.map +1 -1
- package/dist/shared/contracts/review-workflows.d.ts +1 -14
- package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
- package/package.json +15 -16
- package/dist/_chunks/Layout-B_cKmQA3.mjs.map +0 -1
- package/dist/_chunks/Layout-Py8gxQW2.js.map +0 -1
- package/dist/_chunks/_id-BeUU-t6D.js.map +0 -1
- package/dist/_chunks/_id-C_HRFhcV.mjs.map +0 -1
- package/dist/_chunks/index-CAgnun9R.mjs.map +0 -1
- package/dist/_chunks/index-D3AvHSbj.js.map +0 -1
- package/dist/_chunks/index-DjHtLGgq.mjs.map +0 -1
- package/dist/_chunks/index-DyJcIA81.js.map +0 -1
- package/dist/_chunks/purchase-review-workflows-BaOk5p_m.js.map +0 -1
- package/dist/_chunks/purchase-review-workflows-DyffLpyz.mjs.map +0 -1
|
@@ -2,22 +2,21 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { useTracking, useForm, useField, InputRenderer as InputRenderer$1, useNotification, ConfirmDialog, Page, useAPIErrorHandler, useRBAC, Form, BackButton } from "@strapi/admin/strapi-admin";
|
|
4
4
|
import { useLicenseLimits } from "@strapi/admin/strapi-admin/ee";
|
|
5
|
-
import { Box, Typography, Flex, MenuItem, Menu,
|
|
6
|
-
import { PlusCircle,
|
|
5
|
+
import { Box, Typography, Flex, Accordion, MenuItem, Menu, MultiSelectOption, useComposedRefs, VisuallyHidden, IconButton, Grid, Field, SingleSelect, SingleSelectOption, TextInput, MultiSelect, MultiSelectGroup, Dialog, useCollator, Button } from "@strapi/design-system";
|
|
6
|
+
import { PlusCircle, More, Drag, EyeStriked, Duplicate, Check } from "@strapi/icons";
|
|
7
7
|
import { generateNKeysBetween } from "fractional-indexing";
|
|
8
8
|
import { useIntl } from "react-intl";
|
|
9
|
-
import { useDispatch } from "react-redux";
|
|
10
9
|
import { useParams, useNavigate } from "react-router-dom";
|
|
11
10
|
import * as yup from "yup";
|
|
12
|
-
import { r as reviewWorkflowsApi, A as AVAILABLE_COLORS, g as getStageColorByHex, u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, b as CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal, i as isBaseQueryError } from "./index-
|
|
13
|
-
import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-
|
|
11
|
+
import { r as reviewWorkflowsApi, A as AVAILABLE_COLORS, g as getStageColorByHex, u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, b as CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal, i as isBaseQueryError } from "./index-Cx5QECZI.mjs";
|
|
12
|
+
import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-D5aa9iUm.mjs";
|
|
14
13
|
import { getEmptyImage } from "react-dnd-html5-backend";
|
|
15
|
-
import styled from "styled-components";
|
|
14
|
+
import { styled } from "styled-components";
|
|
16
15
|
import { useDrop, useDrag } from "react-dnd";
|
|
17
16
|
const adminApi = reviewWorkflowsApi.injectEndpoints({
|
|
18
17
|
endpoints(builder) {
|
|
19
18
|
return {
|
|
20
|
-
|
|
19
|
+
getAdminRoles: builder.query({
|
|
21
20
|
query: () => ({
|
|
22
21
|
url: `/admin/roles`,
|
|
23
22
|
method: "GET"
|
|
@@ -29,7 +28,7 @@ const adminApi = reviewWorkflowsApi.injectEndpoints({
|
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
30
|
});
|
|
32
|
-
const {
|
|
31
|
+
const { useGetAdminRolesQuery } = adminApi;
|
|
33
32
|
const useKeyboardDragAndDrop = (active, index, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
|
|
34
33
|
const [isSelected, setIsSelected] = React.useState(false);
|
|
35
34
|
const handleMove = (movement) => {
|
|
@@ -248,74 +247,35 @@ const AddStage = ({ children, ...props }) => {
|
|
|
248
247
|
return /* @__PURE__ */ jsx(
|
|
249
248
|
StyledButton,
|
|
250
249
|
{
|
|
251
|
-
|
|
250
|
+
tag: "button",
|
|
252
251
|
background: "neutral0",
|
|
253
|
-
|
|
252
|
+
borderColor: "neutral150",
|
|
254
253
|
paddingBottom: 3,
|
|
255
254
|
paddingLeft: 4,
|
|
256
255
|
paddingRight: 4,
|
|
257
256
|
paddingTop: 3,
|
|
258
257
|
shadow: "filterShadow",
|
|
259
258
|
...props,
|
|
260
|
-
children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
261
|
-
/* @__PURE__ */ jsx(
|
|
262
|
-
|
|
263
|
-
] })
|
|
259
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
|
260
|
+
/* @__PURE__ */ jsx(PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
|
|
261
|
+
children
|
|
262
|
+
] }) })
|
|
264
263
|
}
|
|
265
264
|
);
|
|
266
265
|
};
|
|
267
|
-
const StyledAddIcon = styled(PlusCircle)`
|
|
268
|
-
> circle {
|
|
269
|
-
fill: ${({ theme }) => theme.colors.neutral150};
|
|
270
|
-
}
|
|
271
|
-
> path {
|
|
272
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
273
|
-
}
|
|
274
|
-
`;
|
|
275
266
|
const StyledButton = styled(Box)`
|
|
276
267
|
border-radius: 26px;
|
|
277
|
-
|
|
278
|
-
svg {
|
|
279
|
-
height: ${({ theme }) => theme.spaces[6]};
|
|
280
|
-
width: ${({ theme }) => theme.spaces[6]};
|
|
281
|
-
|
|
282
|
-
> path {
|
|
283
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
284
|
-
}
|
|
285
|
-
}
|
|
268
|
+
color: ${({ theme }) => theme.colors.neutral500};
|
|
286
269
|
|
|
287
270
|
&:hover {
|
|
288
|
-
color: ${({ theme }) => theme.colors.primary600}
|
|
289
|
-
${Typography} {
|
|
290
|
-
color: ${({ theme }) => theme.colors.primary600} !important;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
${StyledAddIcon} {
|
|
294
|
-
> circle {
|
|
295
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
296
|
-
}
|
|
297
|
-
> path {
|
|
298
|
-
fill: ${({ theme }) => theme.colors.neutral100};
|
|
299
|
-
}
|
|
300
|
-
}
|
|
271
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
301
272
|
}
|
|
302
273
|
|
|
303
274
|
&:active {
|
|
304
|
-
${
|
|
305
|
-
color: ${({ theme }) => theme.colors.primary600};
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
${StyledAddIcon} {
|
|
309
|
-
> circle {
|
|
310
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
311
|
-
}
|
|
312
|
-
> path {
|
|
313
|
-
fill: ${({ theme }) => theme.colors.neutral100};
|
|
314
|
-
}
|
|
315
|
-
}
|
|
275
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
316
276
|
}
|
|
317
277
|
`;
|
|
318
|
-
const Stages = ({ canDelete = true, canUpdate = true, isCreating
|
|
278
|
+
const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
319
279
|
const { formatMessage } = useIntl();
|
|
320
280
|
const { trackUsage } = useTracking();
|
|
321
281
|
const addFieldRow = useForm("Stages", (state) => state.addFieldRow);
|
|
@@ -330,35 +290,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
330
290
|
left: "50%",
|
|
331
291
|
position: "absolute",
|
|
332
292
|
top: "0",
|
|
333
|
-
width: 2
|
|
334
|
-
zIndex: 1
|
|
293
|
+
width: 2
|
|
335
294
|
}
|
|
336
295
|
),
|
|
337
|
-
/* @__PURE__ */ jsx(
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
canDelete: stages.length > 1 && canDelete,
|
|
352
|
-
canReorder: stages.length > 1,
|
|
353
|
-
canUpdate,
|
|
354
|
-
stagesCount: stages.length,
|
|
355
|
-
isOpen: isCreating,
|
|
356
|
-
...stage
|
|
357
|
-
}
|
|
358
|
-
) }, stage.__temp_key__);
|
|
359
|
-
})
|
|
360
|
-
}
|
|
361
|
-
)
|
|
296
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, position: "relative", tag: "ol", children: stages.map((stage, index) => {
|
|
297
|
+
return /* @__PURE__ */ jsx(Box, { tag: "li", children: /* @__PURE__ */ jsx(
|
|
298
|
+
Stage,
|
|
299
|
+
{
|
|
300
|
+
index,
|
|
301
|
+
canDelete: stages.length > 1 && canDelete,
|
|
302
|
+
canReorder: stages.length > 1,
|
|
303
|
+
canUpdate,
|
|
304
|
+
stagesCount: stages.length,
|
|
305
|
+
defaultOpen: isCreating,
|
|
306
|
+
...stage
|
|
307
|
+
}
|
|
308
|
+
) }, stage.__temp_key__);
|
|
309
|
+
}) })
|
|
362
310
|
] }),
|
|
363
311
|
canUpdate && /* @__PURE__ */ jsx(
|
|
364
312
|
AddStage,
|
|
@@ -384,16 +332,15 @@ const Stage = ({
|
|
|
384
332
|
canDelete = false,
|
|
385
333
|
canReorder = false,
|
|
386
334
|
canUpdate = false,
|
|
387
|
-
isOpen: isOpenDefault = false,
|
|
388
335
|
stagesCount,
|
|
389
336
|
name,
|
|
390
337
|
permissions,
|
|
391
|
-
color
|
|
338
|
+
color,
|
|
339
|
+
defaultOpen
|
|
392
340
|
}) => {
|
|
393
341
|
const [liveText, setLiveText] = React.useState();
|
|
394
342
|
const { formatMessage } = useIntl();
|
|
395
343
|
const { trackUsage } = useTracking();
|
|
396
|
-
const [isOpen, setIsOpen] = React.useState(isOpenDefault);
|
|
397
344
|
const stageErrors = useForm("Stages", (state) => state.errors.stages);
|
|
398
345
|
const error = stageErrors?.[index];
|
|
399
346
|
const addFieldRow = useForm("Stage", (state) => state.addFieldRow);
|
|
@@ -475,7 +422,8 @@ const Stage = ({
|
|
|
475
422
|
const handleCloneClick = () => {
|
|
476
423
|
addFieldRow("stages", { name, color, permissions });
|
|
477
424
|
};
|
|
478
|
-
|
|
425
|
+
const id = React.useId();
|
|
426
|
+
return /* @__PURE__ */ jsxs(Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
479
427
|
liveText && /* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
480
428
|
isDragging ? /* @__PURE__ */ jsx(
|
|
481
429
|
Box,
|
|
@@ -486,74 +434,61 @@ const Stage = ({
|
|
|
486
434
|
borderWidth: "1px",
|
|
487
435
|
display: "block",
|
|
488
436
|
hasRadius: true,
|
|
489
|
-
padding: 6
|
|
490
|
-
shadow: "tableShadow"
|
|
437
|
+
padding: 6
|
|
491
438
|
}
|
|
492
|
-
) : /* @__PURE__ */
|
|
493
|
-
|
|
439
|
+
) : /* @__PURE__ */ jsx(
|
|
440
|
+
AccordionRoot,
|
|
494
441
|
{
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
onToggle: () => {
|
|
498
|
-
setIsOpen(!isOpen);
|
|
499
|
-
if (!isOpen) {
|
|
442
|
+
onValueChange: (value) => {
|
|
443
|
+
if (value) {
|
|
500
444
|
trackUsage("willEditStage");
|
|
501
445
|
}
|
|
502
446
|
},
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
|
517
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { as: "span", children: formatMessage({
|
|
518
|
-
id: "[tbdb].components.DynamicZone.more-actions",
|
|
519
|
-
defaultMessage: "More actions"
|
|
520
|
-
}) })
|
|
521
|
-
] }),
|
|
522
|
-
/* @__PURE__ */ jsx(Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxs(Menu.SubRoot, { children: [
|
|
523
|
-
canUpdate && /* @__PURE__ */ jsx(MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
524
|
-
id: "Settings.review-workflows.stage.delete",
|
|
525
|
-
defaultMessage: "Duplicate stage"
|
|
526
|
-
}) }),
|
|
527
|
-
canDelete && /* @__PURE__ */ jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index), children: formatMessage({
|
|
528
|
-
id: "Settings.review-workflows.stage.delete",
|
|
529
|
-
defaultMessage: "Delete"
|
|
530
|
-
}) })
|
|
531
|
-
] }) })
|
|
447
|
+
defaultValue: defaultOpen ? id : void 0,
|
|
448
|
+
$error: Object.values(error ?? {}).length > 0,
|
|
449
|
+
children: /* @__PURE__ */ jsxs(Accordion.Item, { value: id, children: [
|
|
450
|
+
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
|
451
|
+
/* @__PURE__ */ jsx(Accordion.Trigger, { children: name }),
|
|
452
|
+
/* @__PURE__ */ jsx(Accordion.Actions, { children: canDelete || canUpdate ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
453
|
+
/* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
454
|
+
/* @__PURE__ */ jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
|
455
|
+
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
|
456
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: formatMessage({
|
|
457
|
+
id: "[tbdb].components.DynamicZone.more-actions",
|
|
458
|
+
defaultMessage: "More actions"
|
|
459
|
+
}) })
|
|
532
460
|
] }),
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
461
|
+
/* @__PURE__ */ jsx(Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxs(Menu.SubRoot, { children: [
|
|
462
|
+
canUpdate && /* @__PURE__ */ jsx(MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
463
|
+
id: "Settings.review-workflows.stage.delete",
|
|
464
|
+
defaultMessage: "Duplicate stage"
|
|
465
|
+
}) }),
|
|
466
|
+
canDelete && /* @__PURE__ */ jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index), children: formatMessage({
|
|
467
|
+
id: "Settings.review-workflows.stage.delete",
|
|
468
|
+
defaultMessage: "Delete"
|
|
469
|
+
}) })
|
|
470
|
+
] }) })
|
|
471
|
+
] }),
|
|
472
|
+
canUpdate && /* @__PURE__ */ jsx(
|
|
473
|
+
IconButton,
|
|
474
|
+
{
|
|
475
|
+
background: "transparent",
|
|
476
|
+
hasRadius: true,
|
|
477
|
+
variant: "ghost",
|
|
478
|
+
"data-handler-id": handlerId,
|
|
479
|
+
ref: dragRef,
|
|
480
|
+
label: formatMessage({
|
|
481
|
+
id: "Settings.review-workflows.stage.drag",
|
|
482
|
+
defaultMessage: "Drag"
|
|
483
|
+
}),
|
|
484
|
+
onClick: (e) => e.stopPropagation(),
|
|
485
|
+
onKeyDown: handleKeyDown,
|
|
486
|
+
children: /* @__PURE__ */ jsx(Drag, {})
|
|
487
|
+
}
|
|
488
|
+
)
|
|
489
|
+
] }) : null })
|
|
490
|
+
] }),
|
|
491
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Grid.Root, { gap: 4, padding: 6, children: [
|
|
557
492
|
{
|
|
558
493
|
disabled: !canUpdate,
|
|
559
494
|
label: formatMessage({
|
|
@@ -591,12 +526,16 @@ const Stage = ({
|
|
|
591
526
|
size: 6,
|
|
592
527
|
type: "permissions"
|
|
593
528
|
}
|
|
594
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsx(
|
|
595
|
-
]
|
|
529
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsx(Grid.Item, { col: size, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
530
|
+
] })
|
|
596
531
|
}
|
|
597
532
|
)
|
|
598
533
|
] });
|
|
599
534
|
};
|
|
535
|
+
const AccordionRoot = styled(Accordion.Root)`
|
|
536
|
+
border: 1px solid
|
|
537
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
|
538
|
+
`;
|
|
600
539
|
const DeleteMenuItem = styled(MenuItem)`
|
|
601
540
|
color: ${({ theme }) => theme.colors.danger600};
|
|
602
541
|
`;
|
|
@@ -610,22 +549,6 @@ const ContextMenuTrigger = styled(Menu.Trigger)`
|
|
|
610
549
|
font-size: 0;
|
|
611
550
|
}
|
|
612
551
|
`;
|
|
613
|
-
const DragIconButton = styled(IconButton)`
|
|
614
|
-
align-items: center;
|
|
615
|
-
border-radius: ${({ theme }) => theme.borderRadius};
|
|
616
|
-
display: flex;
|
|
617
|
-
justify-content: center;
|
|
618
|
-
|
|
619
|
-
&:hover,
|
|
620
|
-
&:focus {
|
|
621
|
-
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
svg {
|
|
625
|
-
height: auto;
|
|
626
|
-
width: ${({ theme }) => theme.spaces[3]};
|
|
627
|
-
}
|
|
628
|
-
`;
|
|
629
552
|
const InputRenderer = (props) => {
|
|
630
553
|
switch (props.type) {
|
|
631
554
|
case "color":
|
|
@@ -651,54 +574,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
|
|
|
651
574
|
color: hex
|
|
652
575
|
}));
|
|
653
576
|
const { themeColorName } = getStageColorByHex(value) ?? {};
|
|
654
|
-
return /* @__PURE__ */
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
Flex,
|
|
667
|
-
{
|
|
668
|
-
as: "span",
|
|
669
|
-
height: 2,
|
|
670
|
-
background: value,
|
|
671
|
-
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
672
|
-
hasRadius: true,
|
|
673
|
-
shrink: 0,
|
|
674
|
-
width: 2
|
|
675
|
-
}
|
|
676
|
-
),
|
|
677
|
-
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
678
|
-
const { themeColorName: themeColorName2 } = getStageColorByHex(color) || {};
|
|
679
|
-
return /* @__PURE__ */ jsx(
|
|
680
|
-
SingleSelectOption,
|
|
577
|
+
return /* @__PURE__ */ jsxs(Field.Root, { error, name, required, children: [
|
|
578
|
+
/* @__PURE__ */ jsx(Field.Label, { children: label }),
|
|
579
|
+
/* @__PURE__ */ jsx(
|
|
580
|
+
SingleSelect,
|
|
581
|
+
{
|
|
582
|
+
disabled,
|
|
583
|
+
onChange: (v) => {
|
|
584
|
+
onChange(name, v.toString());
|
|
585
|
+
},
|
|
586
|
+
value: value?.toUpperCase(),
|
|
587
|
+
startIcon: /* @__PURE__ */ jsx(
|
|
588
|
+
Flex,
|
|
681
589
|
{
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
590
|
+
tag: "span",
|
|
591
|
+
height: 2,
|
|
592
|
+
background: value,
|
|
593
|
+
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
594
|
+
hasRadius: true,
|
|
595
|
+
shrink: 0,
|
|
596
|
+
width: 2
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
600
|
+
const { themeColorName: themeColorName2 } = getStageColorByHex(color) || {};
|
|
601
|
+
return /* @__PURE__ */ jsx(
|
|
602
|
+
SingleSelectOption,
|
|
603
|
+
{
|
|
604
|
+
value: value2,
|
|
605
|
+
startIcon: /* @__PURE__ */ jsx(
|
|
606
|
+
Flex,
|
|
607
|
+
{
|
|
608
|
+
tag: "span",
|
|
609
|
+
height: 2,
|
|
610
|
+
background: color,
|
|
611
|
+
borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
|
|
612
|
+
hasRadius: true,
|
|
613
|
+
shrink: 0,
|
|
614
|
+
width: 2
|
|
615
|
+
}
|
|
616
|
+
),
|
|
617
|
+
children: label2
|
|
618
|
+
},
|
|
619
|
+
value2
|
|
620
|
+
);
|
|
621
|
+
})
|
|
622
|
+
}
|
|
623
|
+
),
|
|
624
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
625
|
+
] });
|
|
702
626
|
};
|
|
703
627
|
const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
704
628
|
const { formatMessage } = useIntl();
|
|
@@ -707,57 +631,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
707
631
|
const { value = [], error, onChange } = useField(name);
|
|
708
632
|
const allStages = useForm("PermissionsField", (state) => state.values.stages);
|
|
709
633
|
const onFormValueChange = useForm("PermissionsField", (state) => state.onChange);
|
|
710
|
-
const
|
|
634
|
+
const rolesErrorCount = React.useRef(0);
|
|
635
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
711
636
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
712
637
|
React.useEffect(() => {
|
|
713
|
-
if (!isLoading &&
|
|
638
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
639
|
+
rolesErrorCount.current = 1;
|
|
714
640
|
toggleNotification({
|
|
715
641
|
blockTransition: true,
|
|
716
642
|
type: "danger",
|
|
717
643
|
message: formatMessage({
|
|
718
644
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
719
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
645
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
720
646
|
})
|
|
721
647
|
});
|
|
722
648
|
}
|
|
723
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
649
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
724
650
|
if (!isLoading && filteredRoles.length === 0) {
|
|
725
|
-
return /* @__PURE__ */
|
|
726
|
-
|
|
651
|
+
return /* @__PURE__ */ jsxs(
|
|
652
|
+
Field.Root,
|
|
727
653
|
{
|
|
728
|
-
disabled: true,
|
|
729
654
|
name,
|
|
730
655
|
hint: formatMessage({
|
|
731
656
|
id: "Settings.review-workflows.stage.permissions.noPermissions.description",
|
|
732
657
|
defaultMessage: "You don’t have the permission to see roles"
|
|
733
658
|
}),
|
|
734
|
-
label: formatMessage({
|
|
735
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
736
|
-
defaultMessage: "Roles that can change this stage"
|
|
737
|
-
}),
|
|
738
|
-
placeholder: formatMessage({
|
|
739
|
-
id: "components.NotAllowedInput.text",
|
|
740
|
-
defaultMessage: "No permissions to see this field"
|
|
741
|
-
}),
|
|
742
659
|
required,
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
660
|
+
children: [
|
|
661
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
662
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
663
|
+
defaultMessage: "Roles that can change this stage"
|
|
664
|
+
}) }),
|
|
665
|
+
/* @__PURE__ */ jsx(
|
|
666
|
+
TextInput,
|
|
667
|
+
{
|
|
668
|
+
disabled: true,
|
|
669
|
+
placeholder: formatMessage({
|
|
670
|
+
id: "components.NotAllowedInput.text",
|
|
671
|
+
defaultMessage: "No permissions to see this field"
|
|
672
|
+
}),
|
|
673
|
+
startAction: /* @__PURE__ */ jsx(EyeStriked, { fill: "neutral600" }),
|
|
674
|
+
type: "text",
|
|
675
|
+
value: ""
|
|
676
|
+
}
|
|
677
|
+
),
|
|
678
|
+
/* @__PURE__ */ jsx(Field.Hint, {})
|
|
679
|
+
]
|
|
746
680
|
}
|
|
747
681
|
);
|
|
748
682
|
}
|
|
749
|
-
return /* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */ jsx(
|
|
683
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-end", gap: 3, children: [
|
|
684
|
+
/* @__PURE__ */ jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxs(Field.Root, { error, name, required: true, children: [
|
|
685
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
686
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
687
|
+
defaultMessage: "Roles that can change this stage"
|
|
688
|
+
}) }),
|
|
689
|
+
/* @__PURE__ */ jsx(
|
|
752
690
|
MultiSelect,
|
|
753
691
|
{
|
|
754
692
|
disabled,
|
|
755
|
-
error,
|
|
756
|
-
id: name,
|
|
757
|
-
label: formatMessage({
|
|
758
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
759
|
-
defaultMessage: "Roles that can change this stage"
|
|
760
|
-
}),
|
|
761
693
|
onChange: (values) => {
|
|
762
694
|
const permissions = values.map((value2) => ({
|
|
763
695
|
role: parseInt(value2, 10),
|
|
@@ -766,7 +698,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
766
698
|
onChange(name, permissions);
|
|
767
699
|
},
|
|
768
700
|
placeholder,
|
|
769
|
-
required: true,
|
|
770
701
|
value: value.map((permission) => `${permission.role}`),
|
|
771
702
|
withTags: true,
|
|
772
703
|
children: /* @__PURE__ */ jsx(
|
|
@@ -783,58 +714,52 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
783
714
|
}
|
|
784
715
|
)
|
|
785
716
|
}
|
|
786
|
-
)
|
|
787
|
-
/* @__PURE__ */ jsx(
|
|
717
|
+
),
|
|
718
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
719
|
+
] }) }),
|
|
720
|
+
/* @__PURE__ */ jsxs(Dialog.Root, { open: isApplyAllConfirmationOpen, onOpenChange: setIsApplyAllConfirmationOpen, children: [
|
|
721
|
+
/* @__PURE__ */ jsx(Dialog.Trigger, { children: /* @__PURE__ */ jsx(
|
|
788
722
|
IconButton,
|
|
789
723
|
{
|
|
790
724
|
disabled,
|
|
791
|
-
icon: /* @__PURE__ */ jsx(Duplicate, {}),
|
|
792
725
|
label: formatMessage({
|
|
793
726
|
id: "Settings.review-workflows.stage.permissions.apply.label",
|
|
794
727
|
defaultMessage: "Apply to all stages"
|
|
795
728
|
}),
|
|
796
729
|
size: "L",
|
|
797
|
-
|
|
798
|
-
|
|
730
|
+
children: /* @__PURE__ */ jsx(Duplicate, {})
|
|
731
|
+
}
|
|
732
|
+
) }),
|
|
733
|
+
/* @__PURE__ */ jsx(
|
|
734
|
+
ConfirmDialog,
|
|
735
|
+
{
|
|
736
|
+
onConfirm: () => {
|
|
737
|
+
onFormValueChange(
|
|
738
|
+
"stages",
|
|
739
|
+
allStages.map((stage) => ({
|
|
740
|
+
...stage,
|
|
741
|
+
permissions: value
|
|
742
|
+
}))
|
|
743
|
+
);
|
|
744
|
+
setIsApplyAllConfirmationOpen(false);
|
|
745
|
+
toggleNotification({
|
|
746
|
+
type: "success",
|
|
747
|
+
message: formatMessage({
|
|
748
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
749
|
+
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
750
|
+
})
|
|
751
|
+
});
|
|
752
|
+
},
|
|
753
|
+
variant: "default",
|
|
754
|
+
children: formatMessage({
|
|
755
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
756
|
+
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
757
|
+
})
|
|
799
758
|
}
|
|
800
759
|
)
|
|
801
|
-
] })
|
|
802
|
-
|
|
803
|
-
ConfirmDialog,
|
|
804
|
-
{
|
|
805
|
-
isOpen: isApplyAllConfirmationOpen,
|
|
806
|
-
onClose: () => setIsApplyAllConfirmationOpen(false),
|
|
807
|
-
onConfirm: () => {
|
|
808
|
-
onFormValueChange(
|
|
809
|
-
"stages",
|
|
810
|
-
allStages.map((stage) => ({
|
|
811
|
-
...stage,
|
|
812
|
-
permissions: value
|
|
813
|
-
}))
|
|
814
|
-
);
|
|
815
|
-
setIsApplyAllConfirmationOpen(false);
|
|
816
|
-
toggleNotification({
|
|
817
|
-
type: "success",
|
|
818
|
-
message: formatMessage({
|
|
819
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
820
|
-
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
821
|
-
})
|
|
822
|
-
});
|
|
823
|
-
},
|
|
824
|
-
variant: "default",
|
|
825
|
-
children: formatMessage({
|
|
826
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
827
|
-
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
828
|
-
})
|
|
829
|
-
}
|
|
830
|
-
)
|
|
831
|
-
] });
|
|
760
|
+
] })
|
|
761
|
+
] }) });
|
|
832
762
|
};
|
|
833
|
-
const StyledIcon = styled(EyeStriked)`
|
|
834
|
-
& > path {
|
|
835
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
836
|
-
}
|
|
837
|
-
`;
|
|
838
763
|
const NestedOption$1 = styled(MultiSelectOption)`
|
|
839
764
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
840
765
|
`;
|
|
@@ -845,8 +770,8 @@ const PermissionWrapper = styled(Flex)`
|
|
|
845
770
|
`;
|
|
846
771
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
847
772
|
const { formatMessage } = useIntl();
|
|
848
|
-
return /* @__PURE__ */ jsxs(Grid, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
849
|
-
/* @__PURE__ */ jsx(
|
|
773
|
+
return /* @__PURE__ */ jsxs(Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
774
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(
|
|
850
775
|
InputRenderer$1,
|
|
851
776
|
{
|
|
852
777
|
disabled: !canUpdate,
|
|
@@ -859,7 +784,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
859
784
|
type: "string"
|
|
860
785
|
}
|
|
861
786
|
) }),
|
|
862
|
-
/* @__PURE__ */ jsx(
|
|
787
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
863
788
|
] });
|
|
864
789
|
};
|
|
865
790
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -880,81 +805,82 @@ const ContentTypesSelector = ({ disabled }) => {
|
|
|
880
805
|
label: contentType.info.displayName,
|
|
881
806
|
value: contentType.uid
|
|
882
807
|
}));
|
|
883
|
-
return /* @__PURE__ */
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
),
|
|
893
|
-
disabled: isDisabled,
|
|
894
|
-
error,
|
|
895
|
-
label: formatMessage({
|
|
896
|
-
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
897
|
-
defaultMessage: "Associated to"
|
|
898
|
-
}),
|
|
899
|
-
onChange: (values) => {
|
|
900
|
-
onChange("contentTypes", values);
|
|
901
|
-
},
|
|
902
|
-
value,
|
|
903
|
-
placeholder: formatMessage({
|
|
904
|
-
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
905
|
-
defaultMessage: "Select"
|
|
906
|
-
}),
|
|
907
|
-
children: [
|
|
908
|
-
...collectionTypes.length > 0 ? [
|
|
909
|
-
{
|
|
910
|
-
label: formatMessage({
|
|
911
|
-
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
912
|
-
defaultMessage: "Collection Types"
|
|
913
|
-
}),
|
|
914
|
-
children: collectionTypes
|
|
915
|
-
}
|
|
916
|
-
] : [],
|
|
917
|
-
...singleTypes.length > 0 ? [
|
|
918
|
-
{
|
|
919
|
-
label: formatMessage({
|
|
920
|
-
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
921
|
-
defaultMessage: "Single Types"
|
|
922
|
-
}),
|
|
923
|
-
children: singleTypes
|
|
924
|
-
}
|
|
925
|
-
] : []
|
|
926
|
-
].map((opt) => {
|
|
927
|
-
return /* @__PURE__ */ jsx(
|
|
928
|
-
MultiSelectGroup,
|
|
808
|
+
return /* @__PURE__ */ jsxs(Field.Root, { error, name: "contentTypes", children: [
|
|
809
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
810
|
+
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
811
|
+
defaultMessage: "Associated to"
|
|
812
|
+
}) }),
|
|
813
|
+
/* @__PURE__ */ jsx(
|
|
814
|
+
MultiSelect,
|
|
815
|
+
{
|
|
816
|
+
customizeContent: (value2) => formatMessage(
|
|
929
817
|
{
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
children: opt.children.map((child) => {
|
|
933
|
-
const { name: assignedWorkflowName } = workflows?.find(
|
|
934
|
-
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
935
|
-
) ?? {};
|
|
936
|
-
return /* @__PURE__ */ jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsx(Typography, {
|
|
937
|
-
// @ts-expect-error - formatMessage options doesn't expect to be a React component but that's what we need actually for the <i> and <em> components
|
|
938
|
-
children: formatMessage(
|
|
939
|
-
{
|
|
940
|
-
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
941
|
-
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
942
|
-
},
|
|
943
|
-
{
|
|
944
|
-
label: child.label,
|
|
945
|
-
name: assignedWorkflowName,
|
|
946
|
-
em: (...children) => /* @__PURE__ */ jsx(Typography, { as: "em", fontWeight: "bold", children }),
|
|
947
|
-
i: (...children) => /* @__PURE__ */ jsx(ContentTypeTakeNotice, { children })
|
|
948
|
-
}
|
|
949
|
-
)
|
|
950
|
-
}) }, child.value);
|
|
951
|
-
})
|
|
818
|
+
id: "Settings.review-workflows.workflow.contentTypes.displayValue",
|
|
819
|
+
defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
|
|
952
820
|
},
|
|
953
|
-
|
|
954
|
-
)
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
821
|
+
{ count: value2?.length }
|
|
822
|
+
),
|
|
823
|
+
disabled: isDisabled,
|
|
824
|
+
onChange: (values) => {
|
|
825
|
+
onChange("contentTypes", values);
|
|
826
|
+
},
|
|
827
|
+
value,
|
|
828
|
+
placeholder: formatMessage({
|
|
829
|
+
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
830
|
+
defaultMessage: "Select"
|
|
831
|
+
}),
|
|
832
|
+
children: [
|
|
833
|
+
...collectionTypes.length > 0 ? [
|
|
834
|
+
{
|
|
835
|
+
label: formatMessage({
|
|
836
|
+
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
837
|
+
defaultMessage: "Collection Types"
|
|
838
|
+
}),
|
|
839
|
+
children: collectionTypes
|
|
840
|
+
}
|
|
841
|
+
] : [],
|
|
842
|
+
...singleTypes.length > 0 ? [
|
|
843
|
+
{
|
|
844
|
+
label: formatMessage({
|
|
845
|
+
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
846
|
+
defaultMessage: "Single Types"
|
|
847
|
+
}),
|
|
848
|
+
children: singleTypes
|
|
849
|
+
}
|
|
850
|
+
] : []
|
|
851
|
+
].map((opt) => {
|
|
852
|
+
return /* @__PURE__ */ jsx(
|
|
853
|
+
MultiSelectGroup,
|
|
854
|
+
{
|
|
855
|
+
label: opt.label,
|
|
856
|
+
values: opt.children.map((child) => child.value.toString()),
|
|
857
|
+
children: opt.children.map((child) => {
|
|
858
|
+
const { name: assignedWorkflowName } = workflows?.find(
|
|
859
|
+
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
860
|
+
) ?? {};
|
|
861
|
+
return /* @__PURE__ */ jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsx(Typography, {
|
|
862
|
+
// @ts-expect-error - formatMessage options doesn't expect to be a React component but that's what we need actually for the <i> and <em> components
|
|
863
|
+
children: formatMessage(
|
|
864
|
+
{
|
|
865
|
+
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
866
|
+
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
label: child.label,
|
|
870
|
+
name: assignedWorkflowName,
|
|
871
|
+
em: (...children) => /* @__PURE__ */ jsx(Typography, { tag: "em", fontWeight: "bold", children }),
|
|
872
|
+
i: (...children) => /* @__PURE__ */ jsx(ContentTypeTakeNotice, { children })
|
|
873
|
+
}
|
|
874
|
+
)
|
|
875
|
+
}) }, child.value);
|
|
876
|
+
})
|
|
877
|
+
},
|
|
878
|
+
opt.label
|
|
879
|
+
);
|
|
880
|
+
})
|
|
881
|
+
}
|
|
882
|
+
)
|
|
883
|
+
] });
|
|
958
884
|
};
|
|
959
885
|
const NestedOption = styled(MultiSelectOption)`
|
|
960
886
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
@@ -1013,7 +939,6 @@ const EditPage = () => {
|
|
|
1013
939
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
|
1014
940
|
const navigate = useNavigate();
|
|
1015
941
|
const { toggleNotification } = useNotification();
|
|
1016
|
-
const dispatch = useDispatch();
|
|
1017
942
|
const {
|
|
1018
943
|
isLoading: isLoadingWorkflow,
|
|
1019
944
|
meta,
|
|
@@ -1021,7 +946,7 @@ const EditPage = () => {
|
|
|
1021
946
|
error,
|
|
1022
947
|
update,
|
|
1023
948
|
create
|
|
1024
|
-
} = useReviewWorkflows(
|
|
949
|
+
} = useReviewWorkflows();
|
|
1025
950
|
const permissions = useTypedSelector(
|
|
1026
951
|
(state) => state.admin_app.permissions["settings"]?.["review-workflows"]
|
|
1027
952
|
);
|
|
@@ -1064,36 +989,13 @@ const EditPage = () => {
|
|
|
1064
989
|
});
|
|
1065
990
|
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1066
991
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1067
|
-
} else if ("data" in res) {
|
|
1068
|
-
for (const uid of res.data.contentTypes) {
|
|
1069
|
-
dispatch({
|
|
1070
|
-
type: "contentManagerApi/invalidateTags",
|
|
1071
|
-
payload: [
|
|
1072
|
-
{
|
|
1073
|
-
type: "ContentTypesConfiguration",
|
|
1074
|
-
id: uid
|
|
1075
|
-
}
|
|
1076
|
-
]
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
992
|
}
|
|
1080
993
|
} else {
|
|
1081
994
|
const res = await create(data);
|
|
1082
995
|
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1083
996
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1084
997
|
} else if ("data" in res) {
|
|
1085
|
-
|
|
1086
|
-
dispatch({
|
|
1087
|
-
type: "contentManagerApi/invalidateTags",
|
|
1088
|
-
payload: [
|
|
1089
|
-
{
|
|
1090
|
-
type: "ContentTypesConfiguration",
|
|
1091
|
-
id: uid
|
|
1092
|
-
}
|
|
1093
|
-
]
|
|
1094
|
-
});
|
|
1095
|
-
}
|
|
1096
|
-
navigate(`../${res.data.id}`);
|
|
998
|
+
navigate(`../${res.data.id}`, { replace: true });
|
|
1097
999
|
}
|
|
1098
1000
|
}
|
|
1099
1001
|
} catch (error2) {
|
|
@@ -1215,23 +1117,22 @@ const EditPage = () => {
|
|
|
1215
1117
|
}
|
|
1216
1118
|
),
|
|
1217
1119
|
/* @__PURE__ */ jsx(Root, { children: /* @__PURE__ */ jsxs(Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1218
|
-
/* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate }),
|
|
1120
|
+
/* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1219
1121
|
/* @__PURE__ */ jsx(
|
|
1220
1122
|
Stages,
|
|
1221
1123
|
{
|
|
1222
1124
|
canDelete,
|
|
1223
|
-
canUpdate,
|
|
1125
|
+
canUpdate: canUpdate || canCreate,
|
|
1224
1126
|
isCreating: isCreatingWorkflow
|
|
1225
1127
|
}
|
|
1226
1128
|
)
|
|
1227
1129
|
] }) }),
|
|
1228
1130
|
/* @__PURE__ */ jsx(
|
|
1229
|
-
|
|
1131
|
+
Dialog.Root,
|
|
1230
1132
|
{
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
|
|
1234
|
-
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 5, children: [
|
|
1133
|
+
open: Object.keys(savePrompts).length > 0,
|
|
1134
|
+
onOpenChange: handleConfirmClose,
|
|
1135
|
+
children: /* @__PURE__ */ jsx(ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 5, children: [
|
|
1235
1136
|
savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsx(Typography, { textAlign: "center", variant: "omega", children: formatMessage({
|
|
1236
1137
|
id: "review-workflows.page.delete.confirm.stages.body",
|
|
1237
1138
|
defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
|
|
@@ -1243,7 +1144,7 @@ const EditPage = () => {
|
|
|
1243
1144
|
},
|
|
1244
1145
|
{
|
|
1245
1146
|
count: contentTypesFromOtherWorkflows?.filter(
|
|
1246
|
-
(contentType) =>
|
|
1147
|
+
(contentType) => values.contentTypes.includes(contentType)
|
|
1247
1148
|
).length ?? 0
|
|
1248
1149
|
}
|
|
1249
1150
|
) }),
|
|
@@ -1251,7 +1152,7 @@ const EditPage = () => {
|
|
|
1251
1152
|
id: "review-workflows.page.delete.confirm.confirm",
|
|
1252
1153
|
defaultMessage: "Are you sure you want to save?"
|
|
1253
1154
|
}) })
|
|
1254
|
-
] })
|
|
1155
|
+
] }) })
|
|
1255
1156
|
}
|
|
1256
1157
|
)
|
|
1257
1158
|
] })
|
|
@@ -1260,8 +1161,8 @@ const EditPage = () => {
|
|
|
1260
1161
|
/* @__PURE__ */ jsxs(
|
|
1261
1162
|
LimitsModal.Root,
|
|
1262
1163
|
{
|
|
1263
|
-
|
|
1264
|
-
|
|
1164
|
+
open: showLimitModal === "workflow",
|
|
1165
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1265
1166
|
children: [
|
|
1266
1167
|
/* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
|
|
1267
1168
|
id: "review-workflows.edit.page.workflows.limit.title",
|
|
@@ -1274,16 +1175,23 @@ const EditPage = () => {
|
|
|
1274
1175
|
]
|
|
1275
1176
|
}
|
|
1276
1177
|
),
|
|
1277
|
-
/* @__PURE__ */ jsxs(
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1178
|
+
/* @__PURE__ */ jsxs(
|
|
1179
|
+
LimitsModal.Root,
|
|
1180
|
+
{
|
|
1181
|
+
open: showLimitModal === "stage",
|
|
1182
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1183
|
+
children: [
|
|
1184
|
+
/* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
|
|
1185
|
+
id: "review-workflows.edit.page.stages.limit.title",
|
|
1186
|
+
defaultMessage: "You have reached the limit of stages for this workflow in your plan"
|
|
1187
|
+
}) }),
|
|
1188
|
+
/* @__PURE__ */ jsx(LimitsModal.Body, { children: formatMessage({
|
|
1189
|
+
id: "review-workflows.edit.page.stages.limit.body",
|
|
1190
|
+
defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
|
|
1191
|
+
}) })
|
|
1192
|
+
]
|
|
1193
|
+
}
|
|
1194
|
+
)
|
|
1287
1195
|
] });
|
|
1288
1196
|
};
|
|
1289
1197
|
const addTmpKeysToStages = (data) => {
|
|
@@ -1307,4 +1215,4 @@ const ProtectedEditPage = () => {
|
|
|
1307
1215
|
export {
|
|
1308
1216
|
ProtectedEditPage
|
|
1309
1217
|
};
|
|
1310
|
-
//# sourceMappingURL=_id-
|
|
1218
|
+
//# sourceMappingURL=_id-DDNHKV_W.mjs.map
|