@strapi/review-workflows 0.0.0-experimental.e60ec1829240dae21c1e1d29076681c322288813 → 0.0.0-experimental.e9122b401c96877b6707775c4f893660eab93ae3
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-BemsgaWF.js → Layout-AREWDuuq.js} +10 -19
- package/dist/_chunks/Layout-AREWDuuq.js.map +1 -0
- package/dist/_chunks/{Layout-BSrg0PBJ.mjs → Layout-D5aa9iUm.mjs} +10 -17
- package/dist/_chunks/Layout-D5aa9iUm.mjs.map +1 -0
- package/dist/_chunks/{_id-BDSg16su.js → _id-C7pCAzXV.js} +316 -371
- package/dist/_chunks/_id-C7pCAzXV.js.map +1 -0
- package/dist/_chunks/{_id-DO302-GM.mjs → _id-DDNHKV_W.mjs} +310 -363
- package/dist/_chunks/_id-DDNHKV_W.mjs.map +1 -0
- package/dist/_chunks/{index-DV2HXfsG.js → index-Bv3cQ3c-.js} +16 -25
- package/dist/_chunks/index-Bv3cQ3c-.js.map +1 -0
- package/dist/_chunks/{index-BIHOhXvS.js → index-CIBLMG85.js} +162 -205
- package/dist/_chunks/index-CIBLMG85.js.map +1 -0
- package/dist/_chunks/{index-u8XaKwOw.mjs → index-CeaoNBIP.mjs} +16 -23
- package/dist/_chunks/index-CeaoNBIP.mjs.map +1 -0
- package/dist/_chunks/{index-7V_6cgRk.mjs → index-Cx5QECZI.mjs} +165 -206
- package/dist/_chunks/index-Cx5QECZI.mjs.map +1 -0
- package/dist/_chunks/{router-BdBbXIaZ.mjs → router-BEoNwQZ1.mjs} +3 -3
- package/dist/_chunks/{router-BdBbXIaZ.mjs.map → router-BEoNwQZ1.mjs.map} +1 -1
- package/dist/_chunks/{router-BtE6OQHw.js → router-gRPIa2_c.js} +3 -3
- package/dist/_chunks/{router-BtE6OQHw.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/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 +6 -6
- package/dist/admin/src/services/settings.d.ts +1734 -8
- package/dist/admin/src/utils/api.d.ts +4 -19
- 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 +14 -15
- package/dist/_chunks/Layout-BSrg0PBJ.mjs.map +0 -1
- package/dist/_chunks/Layout-BemsgaWF.js.map +0 -1
- package/dist/_chunks/_id-BDSg16su.js.map +0 -1
- package/dist/_chunks/_id-DO302-GM.mjs.map +0 -1
- package/dist/_chunks/index-7V_6cgRk.mjs.map +0 -1
- package/dist/_chunks/index-BIHOhXvS.js.map +0 -1
- package/dist/_chunks/index-DV2HXfsG.js.map +0 -1
- package/dist/_chunks/index-u8XaKwOw.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,16 +247,16 @@ 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__ */ jsx(Typography, { variant: "pi", fontWeight: "bold",
|
|
259
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
|
261
260
|
/* @__PURE__ */ jsx(PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
|
|
262
261
|
children
|
|
263
262
|
] }) })
|
|
@@ -276,7 +275,7 @@ const StyledButton = styled(Box)`
|
|
|
276
275
|
color: ${({ theme }) => theme.colors.primary600};
|
|
277
276
|
}
|
|
278
277
|
`;
|
|
279
|
-
const Stages = ({ canDelete = true, canUpdate = true, isCreating
|
|
278
|
+
const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
280
279
|
const { formatMessage } = useIntl();
|
|
281
280
|
const { trackUsage } = useTracking();
|
|
282
281
|
const addFieldRow = useForm("Stages", (state) => state.addFieldRow);
|
|
@@ -291,35 +290,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
291
290
|
left: "50%",
|
|
292
291
|
position: "absolute",
|
|
293
292
|
top: "0",
|
|
294
|
-
width: 2
|
|
295
|
-
zIndex: 1
|
|
293
|
+
width: 2
|
|
296
294
|
}
|
|
297
295
|
),
|
|
298
|
-
/* @__PURE__ */ jsx(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
canDelete: stages.length > 1 && canDelete,
|
|
313
|
-
canReorder: stages.length > 1,
|
|
314
|
-
canUpdate,
|
|
315
|
-
stagesCount: stages.length,
|
|
316
|
-
isOpen: isCreating,
|
|
317
|
-
...stage
|
|
318
|
-
}
|
|
319
|
-
) }, stage.__temp_key__);
|
|
320
|
-
})
|
|
321
|
-
}
|
|
322
|
-
)
|
|
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
|
+
}) })
|
|
323
310
|
] }),
|
|
324
311
|
canUpdate && /* @__PURE__ */ jsx(
|
|
325
312
|
AddStage,
|
|
@@ -345,16 +332,15 @@ const Stage = ({
|
|
|
345
332
|
canDelete = false,
|
|
346
333
|
canReorder = false,
|
|
347
334
|
canUpdate = false,
|
|
348
|
-
isOpen: isOpenDefault = false,
|
|
349
335
|
stagesCount,
|
|
350
336
|
name,
|
|
351
337
|
permissions,
|
|
352
|
-
color
|
|
338
|
+
color,
|
|
339
|
+
defaultOpen
|
|
353
340
|
}) => {
|
|
354
341
|
const [liveText, setLiveText] = React.useState();
|
|
355
342
|
const { formatMessage } = useIntl();
|
|
356
343
|
const { trackUsage } = useTracking();
|
|
357
|
-
const [isOpen, setIsOpen] = React.useState(isOpenDefault);
|
|
358
344
|
const stageErrors = useForm("Stages", (state) => state.errors.stages);
|
|
359
345
|
const error = stageErrors?.[index];
|
|
360
346
|
const addFieldRow = useForm("Stage", (state) => state.addFieldRow);
|
|
@@ -436,7 +422,8 @@ const Stage = ({
|
|
|
436
422
|
const handleCloneClick = () => {
|
|
437
423
|
addFieldRow("stages", { name, color, permissions });
|
|
438
424
|
};
|
|
439
|
-
|
|
425
|
+
const id = React.useId();
|
|
426
|
+
return /* @__PURE__ */ jsxs(Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
440
427
|
liveText && /* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
441
428
|
isDragging ? /* @__PURE__ */ jsx(
|
|
442
429
|
Box,
|
|
@@ -447,74 +434,61 @@ const Stage = ({
|
|
|
447
434
|
borderWidth: "1px",
|
|
448
435
|
display: "block",
|
|
449
436
|
hasRadius: true,
|
|
450
|
-
padding: 6
|
|
451
|
-
shadow: "tableShadow"
|
|
437
|
+
padding: 6
|
|
452
438
|
}
|
|
453
|
-
) : /* @__PURE__ */
|
|
454
|
-
|
|
439
|
+
) : /* @__PURE__ */ jsx(
|
|
440
|
+
AccordionRoot,
|
|
455
441
|
{
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
onToggle: () => {
|
|
459
|
-
setIsOpen(!isOpen);
|
|
460
|
-
if (!isOpen) {
|
|
442
|
+
onValueChange: (value) => {
|
|
443
|
+
if (value) {
|
|
461
444
|
trackUsage("willEditStage");
|
|
462
445
|
}
|
|
463
446
|
},
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
|
478
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { as: "span", children: formatMessage({
|
|
479
|
-
id: "[tbdb].components.DynamicZone.more-actions",
|
|
480
|
-
defaultMessage: "More actions"
|
|
481
|
-
}) })
|
|
482
|
-
] }),
|
|
483
|
-
/* @__PURE__ */ jsx(Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxs(Menu.SubRoot, { children: [
|
|
484
|
-
canUpdate && /* @__PURE__ */ jsx(MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
485
|
-
id: "Settings.review-workflows.stage.delete",
|
|
486
|
-
defaultMessage: "Duplicate stage"
|
|
487
|
-
}) }),
|
|
488
|
-
canDelete && /* @__PURE__ */ jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index), children: formatMessage({
|
|
489
|
-
id: "Settings.review-workflows.stage.delete",
|
|
490
|
-
defaultMessage: "Delete"
|
|
491
|
-
}) })
|
|
492
|
-
] }) })
|
|
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
|
+
}) })
|
|
493
460
|
] }),
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
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: [
|
|
518
492
|
{
|
|
519
493
|
disabled: !canUpdate,
|
|
520
494
|
label: formatMessage({
|
|
@@ -552,12 +526,16 @@ const Stage = ({
|
|
|
552
526
|
size: 6,
|
|
553
527
|
type: "permissions"
|
|
554
528
|
}
|
|
555
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsx(
|
|
556
|
-
]
|
|
529
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsx(Grid.Item, { col: size, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
530
|
+
] })
|
|
557
531
|
}
|
|
558
532
|
)
|
|
559
533
|
] });
|
|
560
534
|
};
|
|
535
|
+
const AccordionRoot = styled(Accordion.Root)`
|
|
536
|
+
border: 1px solid
|
|
537
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
|
538
|
+
`;
|
|
561
539
|
const DeleteMenuItem = styled(MenuItem)`
|
|
562
540
|
color: ${({ theme }) => theme.colors.danger600};
|
|
563
541
|
`;
|
|
@@ -571,22 +549,6 @@ const ContextMenuTrigger = styled(Menu.Trigger)`
|
|
|
571
549
|
font-size: 0;
|
|
572
550
|
}
|
|
573
551
|
`;
|
|
574
|
-
const DragIconButton = styled(IconButton)`
|
|
575
|
-
align-items: center;
|
|
576
|
-
border-radius: ${({ theme }) => theme.borderRadius};
|
|
577
|
-
display: flex;
|
|
578
|
-
justify-content: center;
|
|
579
|
-
|
|
580
|
-
&:hover,
|
|
581
|
-
&:focus {
|
|
582
|
-
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
svg {
|
|
586
|
-
height: auto;
|
|
587
|
-
width: ${({ theme }) => theme.spaces[3]};
|
|
588
|
-
}
|
|
589
|
-
`;
|
|
590
552
|
const InputRenderer = (props) => {
|
|
591
553
|
switch (props.type) {
|
|
592
554
|
case "color":
|
|
@@ -612,54 +574,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
|
|
|
612
574
|
color: hex
|
|
613
575
|
}));
|
|
614
576
|
const { themeColorName } = getStageColorByHex(value) ?? {};
|
|
615
|
-
return /* @__PURE__ */
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
Flex,
|
|
628
|
-
{
|
|
629
|
-
as: "span",
|
|
630
|
-
height: 2,
|
|
631
|
-
background: value,
|
|
632
|
-
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
633
|
-
hasRadius: true,
|
|
634
|
-
shrink: 0,
|
|
635
|
-
width: 2
|
|
636
|
-
}
|
|
637
|
-
),
|
|
638
|
-
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
639
|
-
const { themeColorName: themeColorName2 } = getStageColorByHex(color) || {};
|
|
640
|
-
return /* @__PURE__ */ jsx(
|
|
641
|
-
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,
|
|
642
589
|
{
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
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
|
+
] });
|
|
663
626
|
};
|
|
664
627
|
const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
665
628
|
const { formatMessage } = useIntl();
|
|
@@ -668,57 +631,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
668
631
|
const { value = [], error, onChange } = useField(name);
|
|
669
632
|
const allStages = useForm("PermissionsField", (state) => state.values.stages);
|
|
670
633
|
const onFormValueChange = useForm("PermissionsField", (state) => state.onChange);
|
|
671
|
-
const
|
|
634
|
+
const rolesErrorCount = React.useRef(0);
|
|
635
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
672
636
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
673
637
|
React.useEffect(() => {
|
|
674
|
-
if (!isLoading &&
|
|
638
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
639
|
+
rolesErrorCount.current = 1;
|
|
675
640
|
toggleNotification({
|
|
676
641
|
blockTransition: true,
|
|
677
642
|
type: "danger",
|
|
678
643
|
message: formatMessage({
|
|
679
644
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
680
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
645
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
681
646
|
})
|
|
682
647
|
});
|
|
683
648
|
}
|
|
684
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
649
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
685
650
|
if (!isLoading && filteredRoles.length === 0) {
|
|
686
|
-
return /* @__PURE__ */
|
|
687
|
-
|
|
651
|
+
return /* @__PURE__ */ jsxs(
|
|
652
|
+
Field.Root,
|
|
688
653
|
{
|
|
689
|
-
disabled: true,
|
|
690
654
|
name,
|
|
691
655
|
hint: formatMessage({
|
|
692
656
|
id: "Settings.review-workflows.stage.permissions.noPermissions.description",
|
|
693
657
|
defaultMessage: "You don’t have the permission to see roles"
|
|
694
658
|
}),
|
|
695
|
-
label: formatMessage({
|
|
696
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
697
|
-
defaultMessage: "Roles that can change this stage"
|
|
698
|
-
}),
|
|
699
|
-
placeholder: formatMessage({
|
|
700
|
-
id: "components.NotAllowedInput.text",
|
|
701
|
-
defaultMessage: "No permissions to see this field"
|
|
702
|
-
}),
|
|
703
659
|
required,
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
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
|
+
]
|
|
707
680
|
}
|
|
708
681
|
);
|
|
709
682
|
}
|
|
710
|
-
return /* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
/* @__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(
|
|
713
690
|
MultiSelect,
|
|
714
691
|
{
|
|
715
692
|
disabled,
|
|
716
|
-
error,
|
|
717
|
-
id: name,
|
|
718
|
-
label: formatMessage({
|
|
719
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
720
|
-
defaultMessage: "Roles that can change this stage"
|
|
721
|
-
}),
|
|
722
693
|
onChange: (values) => {
|
|
723
694
|
const permissions = values.map((value2) => ({
|
|
724
695
|
role: parseInt(value2, 10),
|
|
@@ -727,7 +698,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
727
698
|
onChange(name, permissions);
|
|
728
699
|
},
|
|
729
700
|
placeholder,
|
|
730
|
-
required: true,
|
|
731
701
|
value: value.map((permission) => `${permission.role}`),
|
|
732
702
|
withTags: true,
|
|
733
703
|
children: /* @__PURE__ */ jsx(
|
|
@@ -744,58 +714,52 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
744
714
|
}
|
|
745
715
|
)
|
|
746
716
|
}
|
|
747
|
-
)
|
|
748
|
-
/* @__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(
|
|
749
722
|
IconButton,
|
|
750
723
|
{
|
|
751
724
|
disabled,
|
|
752
|
-
icon: /* @__PURE__ */ jsx(Duplicate, {}),
|
|
753
725
|
label: formatMessage({
|
|
754
726
|
id: "Settings.review-workflows.stage.permissions.apply.label",
|
|
755
727
|
defaultMessage: "Apply to all stages"
|
|
756
728
|
}),
|
|
757
729
|
size: "L",
|
|
758
|
-
|
|
759
|
-
|
|
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
|
+
})
|
|
760
758
|
}
|
|
761
759
|
)
|
|
762
|
-
] })
|
|
763
|
-
|
|
764
|
-
ConfirmDialog,
|
|
765
|
-
{
|
|
766
|
-
isOpen: isApplyAllConfirmationOpen,
|
|
767
|
-
onClose: () => setIsApplyAllConfirmationOpen(false),
|
|
768
|
-
onConfirm: () => {
|
|
769
|
-
onFormValueChange(
|
|
770
|
-
"stages",
|
|
771
|
-
allStages.map((stage) => ({
|
|
772
|
-
...stage,
|
|
773
|
-
permissions: value
|
|
774
|
-
}))
|
|
775
|
-
);
|
|
776
|
-
setIsApplyAllConfirmationOpen(false);
|
|
777
|
-
toggleNotification({
|
|
778
|
-
type: "success",
|
|
779
|
-
message: formatMessage({
|
|
780
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
781
|
-
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
782
|
-
})
|
|
783
|
-
});
|
|
784
|
-
},
|
|
785
|
-
variant: "default",
|
|
786
|
-
children: formatMessage({
|
|
787
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
788
|
-
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
789
|
-
})
|
|
790
|
-
}
|
|
791
|
-
)
|
|
792
|
-
] });
|
|
760
|
+
] })
|
|
761
|
+
] }) });
|
|
793
762
|
};
|
|
794
|
-
const StyledIcon = styled(EyeStriked)`
|
|
795
|
-
& > path {
|
|
796
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
797
|
-
}
|
|
798
|
-
`;
|
|
799
763
|
const NestedOption$1 = styled(MultiSelectOption)`
|
|
800
764
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
801
765
|
`;
|
|
@@ -806,8 +770,8 @@ const PermissionWrapper = styled(Flex)`
|
|
|
806
770
|
`;
|
|
807
771
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
808
772
|
const { formatMessage } = useIntl();
|
|
809
|
-
return /* @__PURE__ */ jsxs(Grid, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
810
|
-
/* @__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(
|
|
811
775
|
InputRenderer$1,
|
|
812
776
|
{
|
|
813
777
|
disabled: !canUpdate,
|
|
@@ -820,7 +784,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
820
784
|
type: "string"
|
|
821
785
|
}
|
|
822
786
|
) }),
|
|
823
|
-
/* @__PURE__ */ jsx(
|
|
787
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
824
788
|
] });
|
|
825
789
|
};
|
|
826
790
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -841,81 +805,82 @@ const ContentTypesSelector = ({ disabled }) => {
|
|
|
841
805
|
label: contentType.info.displayName,
|
|
842
806
|
value: contentType.uid
|
|
843
807
|
}));
|
|
844
|
-
return /* @__PURE__ */
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
),
|
|
854
|
-
disabled: isDisabled,
|
|
855
|
-
error,
|
|
856
|
-
label: formatMessage({
|
|
857
|
-
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
858
|
-
defaultMessage: "Associated to"
|
|
859
|
-
}),
|
|
860
|
-
onChange: (values) => {
|
|
861
|
-
onChange("contentTypes", values);
|
|
862
|
-
},
|
|
863
|
-
value,
|
|
864
|
-
placeholder: formatMessage({
|
|
865
|
-
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
866
|
-
defaultMessage: "Select"
|
|
867
|
-
}),
|
|
868
|
-
children: [
|
|
869
|
-
...collectionTypes.length > 0 ? [
|
|
870
|
-
{
|
|
871
|
-
label: formatMessage({
|
|
872
|
-
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
873
|
-
defaultMessage: "Collection Types"
|
|
874
|
-
}),
|
|
875
|
-
children: collectionTypes
|
|
876
|
-
}
|
|
877
|
-
] : [],
|
|
878
|
-
...singleTypes.length > 0 ? [
|
|
879
|
-
{
|
|
880
|
-
label: formatMessage({
|
|
881
|
-
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
882
|
-
defaultMessage: "Single Types"
|
|
883
|
-
}),
|
|
884
|
-
children: singleTypes
|
|
885
|
-
}
|
|
886
|
-
] : []
|
|
887
|
-
].map((opt) => {
|
|
888
|
-
return /* @__PURE__ */ jsx(
|
|
889
|
-
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(
|
|
890
817
|
{
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
children: opt.children.map((child) => {
|
|
894
|
-
const { name: assignedWorkflowName } = workflows?.find(
|
|
895
|
-
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
896
|
-
) ?? {};
|
|
897
|
-
return /* @__PURE__ */ jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsx(Typography, {
|
|
898
|
-
// @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
|
|
899
|
-
children: formatMessage(
|
|
900
|
-
{
|
|
901
|
-
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
902
|
-
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
903
|
-
},
|
|
904
|
-
{
|
|
905
|
-
label: child.label,
|
|
906
|
-
name: assignedWorkflowName,
|
|
907
|
-
em: (...children) => /* @__PURE__ */ jsx(Typography, { as: "em", fontWeight: "bold", children }),
|
|
908
|
-
i: (...children) => /* @__PURE__ */ jsx(ContentTypeTakeNotice, { children })
|
|
909
|
-
}
|
|
910
|
-
)
|
|
911
|
-
}) }, child.value);
|
|
912
|
-
})
|
|
818
|
+
id: "Settings.review-workflows.workflow.contentTypes.displayValue",
|
|
819
|
+
defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
|
|
913
820
|
},
|
|
914
|
-
|
|
915
|
-
)
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
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
|
+
] });
|
|
919
884
|
};
|
|
920
885
|
const NestedOption = styled(MultiSelectOption)`
|
|
921
886
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
@@ -974,7 +939,6 @@ const EditPage = () => {
|
|
|
974
939
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
|
975
940
|
const navigate = useNavigate();
|
|
976
941
|
const { toggleNotification } = useNotification();
|
|
977
|
-
const dispatch = useDispatch();
|
|
978
942
|
const {
|
|
979
943
|
isLoading: isLoadingWorkflow,
|
|
980
944
|
meta,
|
|
@@ -982,7 +946,7 @@ const EditPage = () => {
|
|
|
982
946
|
error,
|
|
983
947
|
update,
|
|
984
948
|
create
|
|
985
|
-
} = useReviewWorkflows(
|
|
949
|
+
} = useReviewWorkflows();
|
|
986
950
|
const permissions = useTypedSelector(
|
|
987
951
|
(state) => state.admin_app.permissions["settings"]?.["review-workflows"]
|
|
988
952
|
);
|
|
@@ -1025,36 +989,13 @@ const EditPage = () => {
|
|
|
1025
989
|
});
|
|
1026
990
|
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1027
991
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1028
|
-
} else if ("data" in res) {
|
|
1029
|
-
for (const uid of res.data.contentTypes) {
|
|
1030
|
-
dispatch({
|
|
1031
|
-
type: "contentManagerApi/invalidateTags",
|
|
1032
|
-
payload: [
|
|
1033
|
-
{
|
|
1034
|
-
type: "ContentTypesConfiguration",
|
|
1035
|
-
id: uid
|
|
1036
|
-
}
|
|
1037
|
-
]
|
|
1038
|
-
});
|
|
1039
|
-
}
|
|
1040
992
|
}
|
|
1041
993
|
} else {
|
|
1042
994
|
const res = await create(data);
|
|
1043
995
|
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1044
996
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1045
997
|
} else if ("data" in res) {
|
|
1046
|
-
|
|
1047
|
-
dispatch({
|
|
1048
|
-
type: "contentManagerApi/invalidateTags",
|
|
1049
|
-
payload: [
|
|
1050
|
-
{
|
|
1051
|
-
type: "ContentTypesConfiguration",
|
|
1052
|
-
id: uid
|
|
1053
|
-
}
|
|
1054
|
-
]
|
|
1055
|
-
});
|
|
1056
|
-
}
|
|
1057
|
-
navigate(`../${res.data.id}`);
|
|
998
|
+
navigate(`../${res.data.id}`, { replace: true });
|
|
1058
999
|
}
|
|
1059
1000
|
}
|
|
1060
1001
|
} catch (error2) {
|
|
@@ -1176,23 +1117,22 @@ const EditPage = () => {
|
|
|
1176
1117
|
}
|
|
1177
1118
|
),
|
|
1178
1119
|
/* @__PURE__ */ jsx(Root, { children: /* @__PURE__ */ jsxs(Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1179
|
-
/* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate }),
|
|
1120
|
+
/* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1180
1121
|
/* @__PURE__ */ jsx(
|
|
1181
1122
|
Stages,
|
|
1182
1123
|
{
|
|
1183
1124
|
canDelete,
|
|
1184
|
-
canUpdate,
|
|
1125
|
+
canUpdate: canUpdate || canCreate,
|
|
1185
1126
|
isCreating: isCreatingWorkflow
|
|
1186
1127
|
}
|
|
1187
1128
|
)
|
|
1188
1129
|
] }) }),
|
|
1189
1130
|
/* @__PURE__ */ jsx(
|
|
1190
|
-
|
|
1131
|
+
Dialog.Root,
|
|
1191
1132
|
{
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
|
|
1195
|
-
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: [
|
|
1196
1136
|
savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsx(Typography, { textAlign: "center", variant: "omega", children: formatMessage({
|
|
1197
1137
|
id: "review-workflows.page.delete.confirm.stages.body",
|
|
1198
1138
|
defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
|
|
@@ -1204,7 +1144,7 @@ const EditPage = () => {
|
|
|
1204
1144
|
},
|
|
1205
1145
|
{
|
|
1206
1146
|
count: contentTypesFromOtherWorkflows?.filter(
|
|
1207
|
-
(contentType) =>
|
|
1147
|
+
(contentType) => values.contentTypes.includes(contentType)
|
|
1208
1148
|
).length ?? 0
|
|
1209
1149
|
}
|
|
1210
1150
|
) }),
|
|
@@ -1212,7 +1152,7 @@ const EditPage = () => {
|
|
|
1212
1152
|
id: "review-workflows.page.delete.confirm.confirm",
|
|
1213
1153
|
defaultMessage: "Are you sure you want to save?"
|
|
1214
1154
|
}) })
|
|
1215
|
-
] })
|
|
1155
|
+
] }) })
|
|
1216
1156
|
}
|
|
1217
1157
|
)
|
|
1218
1158
|
] })
|
|
@@ -1221,8 +1161,8 @@ const EditPage = () => {
|
|
|
1221
1161
|
/* @__PURE__ */ jsxs(
|
|
1222
1162
|
LimitsModal.Root,
|
|
1223
1163
|
{
|
|
1224
|
-
|
|
1225
|
-
|
|
1164
|
+
open: showLimitModal === "workflow",
|
|
1165
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1226
1166
|
children: [
|
|
1227
1167
|
/* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
|
|
1228
1168
|
id: "review-workflows.edit.page.workflows.limit.title",
|
|
@@ -1235,16 +1175,23 @@ const EditPage = () => {
|
|
|
1235
1175
|
]
|
|
1236
1176
|
}
|
|
1237
1177
|
),
|
|
1238
|
-
/* @__PURE__ */ jsxs(
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
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
|
+
)
|
|
1248
1195
|
] });
|
|
1249
1196
|
};
|
|
1250
1197
|
const addTmpKeysToStages = (data) => {
|
|
@@ -1268,4 +1215,4 @@ const ProtectedEditPage = () => {
|
|
|
1268
1215
|
export {
|
|
1269
1216
|
ProtectedEditPage
|
|
1270
1217
|
};
|
|
1271
|
-
//# sourceMappingURL=_id-
|
|
1218
|
+
//# sourceMappingURL=_id-DDNHKV_W.mjs.map
|