@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
|
@@ -8,15 +8,13 @@ const designSystem = require("@strapi/design-system");
|
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const fractionalIndexing = require("fractional-indexing");
|
|
10
10
|
const reactIntl = require("react-intl");
|
|
11
|
-
const reactRedux = require("react-redux");
|
|
12
11
|
const reactRouterDom = require("react-router-dom");
|
|
13
12
|
const yup = require("yup");
|
|
14
|
-
const index = require("./index-
|
|
15
|
-
const Layout = require("./Layout-
|
|
13
|
+
const index = require("./index-CIBLMG85.js");
|
|
14
|
+
const Layout = require("./Layout-AREWDuuq.js");
|
|
16
15
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
17
|
-
const
|
|
16
|
+
const styledComponents = require("styled-components");
|
|
18
17
|
const reactDnd = require("react-dnd");
|
|
19
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
20
18
|
function _interopNamespace(e) {
|
|
21
19
|
if (e && e.__esModule)
|
|
22
20
|
return e;
|
|
@@ -37,11 +35,10 @@ function _interopNamespace(e) {
|
|
|
37
35
|
}
|
|
38
36
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
39
37
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
40
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
41
38
|
const adminApi = index.reviewWorkflowsApi.injectEndpoints({
|
|
42
39
|
endpoints(builder) {
|
|
43
40
|
return {
|
|
44
|
-
|
|
41
|
+
getAdminRoles: builder.query({
|
|
45
42
|
query: () => ({
|
|
46
43
|
url: `/admin/roles`,
|
|
47
44
|
method: "GET"
|
|
@@ -53,7 +50,7 @@ const adminApi = index.reviewWorkflowsApi.injectEndpoints({
|
|
|
53
50
|
};
|
|
54
51
|
}
|
|
55
52
|
});
|
|
56
|
-
const {
|
|
53
|
+
const { useGetAdminRolesQuery } = adminApi;
|
|
57
54
|
const useKeyboardDragAndDrop = (active, index2, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
|
|
58
55
|
const [isSelected, setIsSelected] = React__namespace.useState(false);
|
|
59
56
|
const handleMove = (movement) => {
|
|
@@ -272,23 +269,23 @@ const AddStage = ({ children, ...props }) => {
|
|
|
272
269
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
273
270
|
StyledButton,
|
|
274
271
|
{
|
|
275
|
-
|
|
272
|
+
tag: "button",
|
|
276
273
|
background: "neutral0",
|
|
277
|
-
|
|
274
|
+
borderColor: "neutral150",
|
|
278
275
|
paddingBottom: 3,
|
|
279
276
|
paddingLeft: 4,
|
|
280
277
|
paddingRight: 4,
|
|
281
278
|
paddingTop: 3,
|
|
282
279
|
shadow: "filterShadow",
|
|
283
280
|
...props,
|
|
284
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold",
|
|
281
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
|
|
285
282
|
/* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
|
|
286
283
|
children
|
|
287
284
|
] }) })
|
|
288
285
|
}
|
|
289
286
|
);
|
|
290
287
|
};
|
|
291
|
-
const StyledButton =
|
|
288
|
+
const StyledButton = styledComponents.styled(designSystem.Box)`
|
|
292
289
|
border-radius: 26px;
|
|
293
290
|
color: ${({ theme }) => theme.colors.neutral500};
|
|
294
291
|
|
|
@@ -300,7 +297,7 @@ const StyledButton = styled__default.default(designSystem.Box)`
|
|
|
300
297
|
color: ${({ theme }) => theme.colors.primary600};
|
|
301
298
|
}
|
|
302
299
|
`;
|
|
303
|
-
const Stages = ({ canDelete = true, canUpdate = true, isCreating
|
|
300
|
+
const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
304
301
|
const { formatMessage } = reactIntl.useIntl();
|
|
305
302
|
const { trackUsage } = strapiAdmin.useTracking();
|
|
306
303
|
const addFieldRow = strapiAdmin.useForm("Stages", (state) => state.addFieldRow);
|
|
@@ -315,35 +312,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
315
312
|
left: "50%",
|
|
316
313
|
position: "absolute",
|
|
317
314
|
top: "0",
|
|
318
|
-
width: 2
|
|
319
|
-
zIndex: 1
|
|
315
|
+
width: 2
|
|
320
316
|
}
|
|
321
317
|
),
|
|
322
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
323
|
-
designSystem.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
canDelete: stages.length > 1 && canDelete,
|
|
337
|
-
canReorder: stages.length > 1,
|
|
338
|
-
canUpdate,
|
|
339
|
-
stagesCount: stages.length,
|
|
340
|
-
isOpen: isCreating,
|
|
341
|
-
...stage
|
|
342
|
-
}
|
|
343
|
-
) }, stage.__temp_key__);
|
|
344
|
-
})
|
|
345
|
-
}
|
|
346
|
-
)
|
|
318
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, position: "relative", tag: "ol", children: stages.map((stage, index2) => {
|
|
319
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
320
|
+
Stage,
|
|
321
|
+
{
|
|
322
|
+
index: index2,
|
|
323
|
+
canDelete: stages.length > 1 && canDelete,
|
|
324
|
+
canReorder: stages.length > 1,
|
|
325
|
+
canUpdate,
|
|
326
|
+
stagesCount: stages.length,
|
|
327
|
+
defaultOpen: isCreating,
|
|
328
|
+
...stage
|
|
329
|
+
}
|
|
330
|
+
) }, stage.__temp_key__);
|
|
331
|
+
}) })
|
|
347
332
|
] }),
|
|
348
333
|
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
349
334
|
AddStage,
|
|
@@ -361,7 +346,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
361
346
|
)
|
|
362
347
|
] });
|
|
363
348
|
};
|
|
364
|
-
const Background =
|
|
349
|
+
const Background = styledComponents.styled(designSystem.Box)`
|
|
365
350
|
transform: translateX(-50%);
|
|
366
351
|
`;
|
|
367
352
|
const Stage = ({
|
|
@@ -369,16 +354,15 @@ const Stage = ({
|
|
|
369
354
|
canDelete = false,
|
|
370
355
|
canReorder = false,
|
|
371
356
|
canUpdate = false,
|
|
372
|
-
isOpen: isOpenDefault = false,
|
|
373
357
|
stagesCount,
|
|
374
358
|
name,
|
|
375
359
|
permissions,
|
|
376
|
-
color
|
|
360
|
+
color,
|
|
361
|
+
defaultOpen
|
|
377
362
|
}) => {
|
|
378
363
|
const [liveText, setLiveText] = React__namespace.useState();
|
|
379
364
|
const { formatMessage } = reactIntl.useIntl();
|
|
380
365
|
const { trackUsage } = strapiAdmin.useTracking();
|
|
381
|
-
const [isOpen, setIsOpen] = React__namespace.useState(isOpenDefault);
|
|
382
366
|
const stageErrors = strapiAdmin.useForm("Stages", (state) => state.errors.stages);
|
|
383
367
|
const error = stageErrors?.[index2];
|
|
384
368
|
const addFieldRow = strapiAdmin.useForm("Stage", (state) => state.addFieldRow);
|
|
@@ -460,7 +444,8 @@ const Stage = ({
|
|
|
460
444
|
const handleCloneClick = () => {
|
|
461
445
|
addFieldRow("stages", { name, color, permissions });
|
|
462
446
|
};
|
|
463
|
-
|
|
447
|
+
const id = React__namespace.useId();
|
|
448
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
464
449
|
liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
465
450
|
isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
466
451
|
designSystem.Box,
|
|
@@ -471,74 +456,61 @@ const Stage = ({
|
|
|
471
456
|
borderWidth: "1px",
|
|
472
457
|
display: "block",
|
|
473
458
|
hasRadius: true,
|
|
474
|
-
padding: 6
|
|
475
|
-
shadow: "tableShadow"
|
|
459
|
+
padding: 6
|
|
476
460
|
}
|
|
477
|
-
) : /* @__PURE__ */ jsxRuntime.
|
|
478
|
-
|
|
461
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
462
|
+
AccordionRoot,
|
|
479
463
|
{
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
onToggle: () => {
|
|
483
|
-
setIsOpen(!isOpen);
|
|
484
|
-
if (!isOpen) {
|
|
464
|
+
onValueChange: (value) => {
|
|
465
|
+
if (value) {
|
|
485
466
|
trackUsage("willEditStage");
|
|
486
467
|
}
|
|
487
468
|
},
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
|
|
502
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { as: "span", children: formatMessage({
|
|
503
|
-
id: "[tbdb].components.DynamicZone.more-actions",
|
|
504
|
-
defaultMessage: "More actions"
|
|
505
|
-
}) })
|
|
506
|
-
] }),
|
|
507
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.SubRoot, { children: [
|
|
508
|
-
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
509
|
-
id: "Settings.review-workflows.stage.delete",
|
|
510
|
-
defaultMessage: "Duplicate stage"
|
|
511
|
-
}) }),
|
|
512
|
-
canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
|
|
513
|
-
id: "Settings.review-workflows.stage.delete",
|
|
514
|
-
defaultMessage: "Delete"
|
|
515
|
-
}) })
|
|
516
|
-
] }) })
|
|
469
|
+
defaultValue: defaultOpen ? id : void 0,
|
|
470
|
+
$error: Object.values(error ?? {}).length > 0,
|
|
471
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: id, children: [
|
|
472
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
|
|
473
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: name }),
|
|
474
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Actions, { children: canDelete || canUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
475
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
476
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
|
477
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
|
|
478
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "span", children: formatMessage({
|
|
479
|
+
id: "[tbdb].components.DynamicZone.more-actions",
|
|
480
|
+
defaultMessage: "More actions"
|
|
481
|
+
}) })
|
|
517
482
|
] }),
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
483
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.SubRoot, { children: [
|
|
484
|
+
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
485
|
+
id: "Settings.review-workflows.stage.delete",
|
|
486
|
+
defaultMessage: "Duplicate stage"
|
|
487
|
+
}) }),
|
|
488
|
+
canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
|
|
489
|
+
id: "Settings.review-workflows.stage.delete",
|
|
490
|
+
defaultMessage: "Delete"
|
|
491
|
+
}) })
|
|
492
|
+
] }) })
|
|
493
|
+
] }),
|
|
494
|
+
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
495
|
+
designSystem.IconButton,
|
|
496
|
+
{
|
|
497
|
+
background: "transparent",
|
|
498
|
+
hasRadius: true,
|
|
499
|
+
variant: "ghost",
|
|
500
|
+
"data-handler-id": handlerId,
|
|
501
|
+
ref: dragRef,
|
|
502
|
+
label: formatMessage({
|
|
503
|
+
id: "Settings.review-workflows.stage.drag",
|
|
504
|
+
defaultMessage: "Drag"
|
|
505
|
+
}),
|
|
506
|
+
onClick: (e) => e.stopPropagation(),
|
|
507
|
+
onKeyDown: handleKeyDown,
|
|
508
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, {})
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
] }) : null })
|
|
512
|
+
] }),
|
|
513
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, padding: 6, children: [
|
|
542
514
|
{
|
|
543
515
|
disabled: !canUpdate,
|
|
544
516
|
label: formatMessage({
|
|
@@ -576,16 +548,20 @@ const Stage = ({
|
|
|
576
548
|
size: 6,
|
|
577
549
|
type: "permissions"
|
|
578
550
|
}
|
|
579
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
580
|
-
]
|
|
551
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
552
|
+
] })
|
|
581
553
|
}
|
|
582
554
|
)
|
|
583
555
|
] });
|
|
584
556
|
};
|
|
585
|
-
const
|
|
557
|
+
const AccordionRoot = styledComponents.styled(designSystem.Accordion.Root)`
|
|
558
|
+
border: 1px solid
|
|
559
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
|
560
|
+
`;
|
|
561
|
+
const DeleteMenuItem = styledComponents.styled(designSystem.MenuItem)`
|
|
586
562
|
color: ${({ theme }) => theme.colors.danger600};
|
|
587
563
|
`;
|
|
588
|
-
const ContextMenuTrigger =
|
|
564
|
+
const ContextMenuTrigger = styledComponents.styled(designSystem.Menu.Trigger)`
|
|
589
565
|
:hover,
|
|
590
566
|
:focus {
|
|
591
567
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
@@ -595,22 +571,6 @@ const ContextMenuTrigger = styled__default.default(designSystem.Menu.Trigger)`
|
|
|
595
571
|
font-size: 0;
|
|
596
572
|
}
|
|
597
573
|
`;
|
|
598
|
-
const DragIconButton = styled__default.default(designSystem.IconButton)`
|
|
599
|
-
align-items: center;
|
|
600
|
-
border-radius: ${({ theme }) => theme.borderRadius};
|
|
601
|
-
display: flex;
|
|
602
|
-
justify-content: center;
|
|
603
|
-
|
|
604
|
-
&:hover,
|
|
605
|
-
&:focus {
|
|
606
|
-
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
svg {
|
|
610
|
-
height: auto;
|
|
611
|
-
width: ${({ theme }) => theme.spaces[3]};
|
|
612
|
-
}
|
|
613
|
-
`;
|
|
614
574
|
const InputRenderer = (props) => {
|
|
615
575
|
switch (props.type) {
|
|
616
576
|
case "color":
|
|
@@ -636,54 +596,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
|
|
|
636
596
|
color: hex
|
|
637
597
|
}));
|
|
638
598
|
const { themeColorName } = index.getStageColorByHex(value) ?? {};
|
|
639
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
640
|
-
designSystem.
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
designSystem.Flex,
|
|
652
|
-
{
|
|
653
|
-
as: "span",
|
|
654
|
-
height: 2,
|
|
655
|
-
background: value,
|
|
656
|
-
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
657
|
-
hasRadius: true,
|
|
658
|
-
shrink: 0,
|
|
659
|
-
width: 2
|
|
660
|
-
}
|
|
661
|
-
),
|
|
662
|
-
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
663
|
-
const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
|
|
664
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
665
|
-
designSystem.SingleSelectOption,
|
|
599
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required, children: [
|
|
600
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
602
|
+
designSystem.SingleSelect,
|
|
603
|
+
{
|
|
604
|
+
disabled,
|
|
605
|
+
onChange: (v) => {
|
|
606
|
+
onChange(name, v.toString());
|
|
607
|
+
},
|
|
608
|
+
value: value?.toUpperCase(),
|
|
609
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
610
|
+
designSystem.Flex,
|
|
666
611
|
{
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
612
|
+
tag: "span",
|
|
613
|
+
height: 2,
|
|
614
|
+
background: value,
|
|
615
|
+
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
616
|
+
hasRadius: true,
|
|
617
|
+
shrink: 0,
|
|
618
|
+
width: 2
|
|
619
|
+
}
|
|
620
|
+
),
|
|
621
|
+
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
622
|
+
const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
|
|
623
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
624
|
+
designSystem.SingleSelectOption,
|
|
625
|
+
{
|
|
626
|
+
value: value2,
|
|
627
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
628
|
+
designSystem.Flex,
|
|
629
|
+
{
|
|
630
|
+
tag: "span",
|
|
631
|
+
height: 2,
|
|
632
|
+
background: color,
|
|
633
|
+
borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
|
|
634
|
+
hasRadius: true,
|
|
635
|
+
shrink: 0,
|
|
636
|
+
width: 2
|
|
637
|
+
}
|
|
638
|
+
),
|
|
639
|
+
children: label2
|
|
640
|
+
},
|
|
641
|
+
value2
|
|
642
|
+
);
|
|
643
|
+
})
|
|
644
|
+
}
|
|
645
|
+
),
|
|
646
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
647
|
+
] });
|
|
687
648
|
};
|
|
688
649
|
const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
689
650
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -692,57 +653,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
692
653
|
const { value = [], error, onChange } = strapiAdmin.useField(name);
|
|
693
654
|
const allStages = strapiAdmin.useForm("PermissionsField", (state) => state.values.stages);
|
|
694
655
|
const onFormValueChange = strapiAdmin.useForm("PermissionsField", (state) => state.onChange);
|
|
695
|
-
const
|
|
656
|
+
const rolesErrorCount = React__namespace.useRef(0);
|
|
657
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
696
658
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
697
659
|
React__namespace.useEffect(() => {
|
|
698
|
-
if (!isLoading &&
|
|
660
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
661
|
+
rolesErrorCount.current = 1;
|
|
699
662
|
toggleNotification({
|
|
700
663
|
blockTransition: true,
|
|
701
664
|
type: "danger",
|
|
702
665
|
message: formatMessage({
|
|
703
666
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
704
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
667
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
705
668
|
})
|
|
706
669
|
});
|
|
707
670
|
}
|
|
708
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
671
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
709
672
|
if (!isLoading && filteredRoles.length === 0) {
|
|
710
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
711
|
-
designSystem.
|
|
673
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
674
|
+
designSystem.Field.Root,
|
|
712
675
|
{
|
|
713
|
-
disabled: true,
|
|
714
676
|
name,
|
|
715
677
|
hint: formatMessage({
|
|
716
678
|
id: "Settings.review-workflows.stage.permissions.noPermissions.description",
|
|
717
679
|
defaultMessage: "You don’t have the permission to see roles"
|
|
718
680
|
}),
|
|
719
|
-
label: formatMessage({
|
|
720
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
721
|
-
defaultMessage: "Roles that can change this stage"
|
|
722
|
-
}),
|
|
723
|
-
placeholder: formatMessage({
|
|
724
|
-
id: "components.NotAllowedInput.text",
|
|
725
|
-
defaultMessage: "No permissions to see this field"
|
|
726
|
-
}),
|
|
727
681
|
required,
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
682
|
+
children: [
|
|
683
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
684
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
685
|
+
defaultMessage: "Roles that can change this stage"
|
|
686
|
+
}) }),
|
|
687
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
688
|
+
designSystem.TextInput,
|
|
689
|
+
{
|
|
690
|
+
disabled: true,
|
|
691
|
+
placeholder: formatMessage({
|
|
692
|
+
id: "components.NotAllowedInput.text",
|
|
693
|
+
defaultMessage: "No permissions to see this field"
|
|
694
|
+
}),
|
|
695
|
+
startAction: /* @__PURE__ */ jsxRuntime.jsx(icons.EyeStriked, { fill: "neutral600" }),
|
|
696
|
+
type: "text",
|
|
697
|
+
value: ""
|
|
698
|
+
}
|
|
699
|
+
),
|
|
700
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
701
|
+
]
|
|
731
702
|
}
|
|
732
703
|
);
|
|
733
704
|
}
|
|
734
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
735
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
736
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
705
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-end", gap: 3, children: [
|
|
706
|
+
/* @__PURE__ */ jsxRuntime.jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required: true, children: [
|
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
708
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
709
|
+
defaultMessage: "Roles that can change this stage"
|
|
710
|
+
}) }),
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
737
712
|
designSystem.MultiSelect,
|
|
738
713
|
{
|
|
739
714
|
disabled,
|
|
740
|
-
error,
|
|
741
|
-
id: name,
|
|
742
|
-
label: formatMessage({
|
|
743
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
744
|
-
defaultMessage: "Roles that can change this stage"
|
|
745
|
-
}),
|
|
746
715
|
onChange: (values) => {
|
|
747
716
|
const permissions = values.map((value2) => ({
|
|
748
717
|
role: parseInt(value2, 10),
|
|
@@ -751,7 +720,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
751
720
|
onChange(name, permissions);
|
|
752
721
|
},
|
|
753
722
|
placeholder,
|
|
754
|
-
required: true,
|
|
755
723
|
value: value.map((permission) => `${permission.role}`),
|
|
756
724
|
withTags: true,
|
|
757
725
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -768,70 +736,64 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
768
736
|
}
|
|
769
737
|
)
|
|
770
738
|
}
|
|
771
|
-
)
|
|
772
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
739
|
+
),
|
|
740
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
741
|
+
] }) }),
|
|
742
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { open: isApplyAllConfirmationOpen, onOpenChange: setIsApplyAllConfirmationOpen, children: [
|
|
743
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
773
744
|
designSystem.IconButton,
|
|
774
745
|
{
|
|
775
746
|
disabled,
|
|
776
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {}),
|
|
777
747
|
label: formatMessage({
|
|
778
748
|
id: "Settings.review-workflows.stage.permissions.apply.label",
|
|
779
749
|
defaultMessage: "Apply to all stages"
|
|
780
750
|
}),
|
|
781
751
|
size: "L",
|
|
782
|
-
|
|
783
|
-
|
|
752
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
|
|
753
|
+
}
|
|
754
|
+
) }),
|
|
755
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
756
|
+
strapiAdmin.ConfirmDialog,
|
|
757
|
+
{
|
|
758
|
+
onConfirm: () => {
|
|
759
|
+
onFormValueChange(
|
|
760
|
+
"stages",
|
|
761
|
+
allStages.map((stage) => ({
|
|
762
|
+
...stage,
|
|
763
|
+
permissions: value
|
|
764
|
+
}))
|
|
765
|
+
);
|
|
766
|
+
setIsApplyAllConfirmationOpen(false);
|
|
767
|
+
toggleNotification({
|
|
768
|
+
type: "success",
|
|
769
|
+
message: formatMessage({
|
|
770
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
771
|
+
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
772
|
+
})
|
|
773
|
+
});
|
|
774
|
+
},
|
|
775
|
+
variant: "default",
|
|
776
|
+
children: formatMessage({
|
|
777
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
778
|
+
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
779
|
+
})
|
|
784
780
|
}
|
|
785
781
|
)
|
|
786
|
-
] })
|
|
787
|
-
|
|
788
|
-
strapiAdmin.ConfirmDialog,
|
|
789
|
-
{
|
|
790
|
-
isOpen: isApplyAllConfirmationOpen,
|
|
791
|
-
onClose: () => setIsApplyAllConfirmationOpen(false),
|
|
792
|
-
onConfirm: () => {
|
|
793
|
-
onFormValueChange(
|
|
794
|
-
"stages",
|
|
795
|
-
allStages.map((stage) => ({
|
|
796
|
-
...stage,
|
|
797
|
-
permissions: value
|
|
798
|
-
}))
|
|
799
|
-
);
|
|
800
|
-
setIsApplyAllConfirmationOpen(false);
|
|
801
|
-
toggleNotification({
|
|
802
|
-
type: "success",
|
|
803
|
-
message: formatMessage({
|
|
804
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
805
|
-
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
806
|
-
})
|
|
807
|
-
});
|
|
808
|
-
},
|
|
809
|
-
variant: "default",
|
|
810
|
-
children: formatMessage({
|
|
811
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
812
|
-
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
813
|
-
})
|
|
814
|
-
}
|
|
815
|
-
)
|
|
816
|
-
] });
|
|
782
|
+
] })
|
|
783
|
+
] }) });
|
|
817
784
|
};
|
|
818
|
-
const
|
|
819
|
-
& > path {
|
|
820
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
821
|
-
}
|
|
822
|
-
`;
|
|
823
|
-
const NestedOption$1 = styled__default.default(designSystem.MultiSelectOption)`
|
|
785
|
+
const NestedOption$1 = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
824
786
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
825
787
|
`;
|
|
826
|
-
const PermissionWrapper =
|
|
788
|
+
const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
|
|
827
789
|
> * {
|
|
828
790
|
flex-grow: 1;
|
|
829
791
|
}
|
|
830
792
|
`;
|
|
831
793
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
832
794
|
const { formatMessage } = reactIntl.useIntl();
|
|
833
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
834
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
795
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
796
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
835
797
|
strapiAdmin.InputRenderer,
|
|
836
798
|
{
|
|
837
799
|
disabled: !canUpdate,
|
|
@@ -844,7 +806,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
844
806
|
type: "string"
|
|
845
807
|
}
|
|
846
808
|
) }),
|
|
847
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
809
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
848
810
|
] });
|
|
849
811
|
};
|
|
850
812
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -865,86 +827,87 @@ const ContentTypesSelector = ({ disabled }) => {
|
|
|
865
827
|
label: contentType.info.displayName,
|
|
866
828
|
value: contentType.uid
|
|
867
829
|
}));
|
|
868
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
869
|
-
designSystem.
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
),
|
|
878
|
-
disabled: isDisabled,
|
|
879
|
-
error,
|
|
880
|
-
label: formatMessage({
|
|
881
|
-
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
882
|
-
defaultMessage: "Associated to"
|
|
883
|
-
}),
|
|
884
|
-
onChange: (values) => {
|
|
885
|
-
onChange("contentTypes", values);
|
|
886
|
-
},
|
|
887
|
-
value,
|
|
888
|
-
placeholder: formatMessage({
|
|
889
|
-
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
890
|
-
defaultMessage: "Select"
|
|
891
|
-
}),
|
|
892
|
-
children: [
|
|
893
|
-
...collectionTypes.length > 0 ? [
|
|
894
|
-
{
|
|
895
|
-
label: formatMessage({
|
|
896
|
-
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
897
|
-
defaultMessage: "Collection Types"
|
|
898
|
-
}),
|
|
899
|
-
children: collectionTypes
|
|
900
|
-
}
|
|
901
|
-
] : [],
|
|
902
|
-
...singleTypes.length > 0 ? [
|
|
903
|
-
{
|
|
904
|
-
label: formatMessage({
|
|
905
|
-
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
906
|
-
defaultMessage: "Single Types"
|
|
907
|
-
}),
|
|
908
|
-
children: singleTypes
|
|
909
|
-
}
|
|
910
|
-
] : []
|
|
911
|
-
].map((opt) => {
|
|
912
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
913
|
-
designSystem.MultiSelectGroup,
|
|
830
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name: "contentTypes", children: [
|
|
831
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
832
|
+
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
833
|
+
defaultMessage: "Associated to"
|
|
834
|
+
}) }),
|
|
835
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
836
|
+
designSystem.MultiSelect,
|
|
837
|
+
{
|
|
838
|
+
customizeContent: (value2) => formatMessage(
|
|
914
839
|
{
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
children: opt.children.map((child) => {
|
|
918
|
-
const { name: assignedWorkflowName } = workflows?.find(
|
|
919
|
-
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
920
|
-
) ?? {};
|
|
921
|
-
return /* @__PURE__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
922
|
-
// @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
|
|
923
|
-
children: formatMessage(
|
|
924
|
-
{
|
|
925
|
-
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
926
|
-
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
927
|
-
},
|
|
928
|
-
{
|
|
929
|
-
label: child.label,
|
|
930
|
-
name: assignedWorkflowName,
|
|
931
|
-
em: (...children) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "em", fontWeight: "bold", children }),
|
|
932
|
-
i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
|
|
933
|
-
}
|
|
934
|
-
)
|
|
935
|
-
}) }, child.value);
|
|
936
|
-
})
|
|
840
|
+
id: "Settings.review-workflows.workflow.contentTypes.displayValue",
|
|
841
|
+
defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
|
|
937
842
|
},
|
|
938
|
-
|
|
939
|
-
)
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
843
|
+
{ count: value2?.length }
|
|
844
|
+
),
|
|
845
|
+
disabled: isDisabled,
|
|
846
|
+
onChange: (values) => {
|
|
847
|
+
onChange("contentTypes", values);
|
|
848
|
+
},
|
|
849
|
+
value,
|
|
850
|
+
placeholder: formatMessage({
|
|
851
|
+
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
852
|
+
defaultMessage: "Select"
|
|
853
|
+
}),
|
|
854
|
+
children: [
|
|
855
|
+
...collectionTypes.length > 0 ? [
|
|
856
|
+
{
|
|
857
|
+
label: formatMessage({
|
|
858
|
+
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
859
|
+
defaultMessage: "Collection Types"
|
|
860
|
+
}),
|
|
861
|
+
children: collectionTypes
|
|
862
|
+
}
|
|
863
|
+
] : [],
|
|
864
|
+
...singleTypes.length > 0 ? [
|
|
865
|
+
{
|
|
866
|
+
label: formatMessage({
|
|
867
|
+
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
868
|
+
defaultMessage: "Single Types"
|
|
869
|
+
}),
|
|
870
|
+
children: singleTypes
|
|
871
|
+
}
|
|
872
|
+
] : []
|
|
873
|
+
].map((opt) => {
|
|
874
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
875
|
+
designSystem.MultiSelectGroup,
|
|
876
|
+
{
|
|
877
|
+
label: opt.label,
|
|
878
|
+
values: opt.children.map((child) => child.value.toString()),
|
|
879
|
+
children: opt.children.map((child) => {
|
|
880
|
+
const { name: assignedWorkflowName } = workflows?.find(
|
|
881
|
+
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
882
|
+
) ?? {};
|
|
883
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
884
|
+
// @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
|
|
885
|
+
children: formatMessage(
|
|
886
|
+
{
|
|
887
|
+
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
888
|
+
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
label: child.label,
|
|
892
|
+
name: assignedWorkflowName,
|
|
893
|
+
em: (...children) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "em", fontWeight: "bold", children }),
|
|
894
|
+
i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
|
|
895
|
+
}
|
|
896
|
+
)
|
|
897
|
+
}) }, child.value);
|
|
898
|
+
})
|
|
899
|
+
},
|
|
900
|
+
opt.label
|
|
901
|
+
);
|
|
902
|
+
})
|
|
903
|
+
}
|
|
904
|
+
)
|
|
905
|
+
] });
|
|
943
906
|
};
|
|
944
|
-
const NestedOption =
|
|
907
|
+
const NestedOption = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
945
908
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
946
909
|
`;
|
|
947
|
-
const ContentTypeTakeNotice =
|
|
910
|
+
const ContentTypeTakeNotice = styledComponents.styled(designSystem.Typography)`
|
|
948
911
|
font-style: italic;
|
|
949
912
|
`;
|
|
950
913
|
const WORKFLOW_SCHEMA = yup__namespace.object({
|
|
@@ -998,7 +961,6 @@ const EditPage = () => {
|
|
|
998
961
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
|
999
962
|
const navigate = reactRouterDom.useNavigate();
|
|
1000
963
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1001
|
-
const dispatch = reactRedux.useDispatch();
|
|
1002
964
|
const {
|
|
1003
965
|
isLoading: isLoadingWorkflow,
|
|
1004
966
|
meta,
|
|
@@ -1006,7 +968,7 @@ const EditPage = () => {
|
|
|
1006
968
|
error,
|
|
1007
969
|
update,
|
|
1008
970
|
create
|
|
1009
|
-
} = Layout.useReviewWorkflows(
|
|
971
|
+
} = Layout.useReviewWorkflows();
|
|
1010
972
|
const permissions = index.useTypedSelector(
|
|
1011
973
|
(state) => state.admin_app.permissions["settings"]?.["review-workflows"]
|
|
1012
974
|
);
|
|
@@ -1049,36 +1011,13 @@ const EditPage = () => {
|
|
|
1049
1011
|
});
|
|
1050
1012
|
if ("error" in res && index.isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1051
1013
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1052
|
-
} else if ("data" in res) {
|
|
1053
|
-
for (const uid of res.data.contentTypes) {
|
|
1054
|
-
dispatch({
|
|
1055
|
-
type: "contentManagerApi/invalidateTags",
|
|
1056
|
-
payload: [
|
|
1057
|
-
{
|
|
1058
|
-
type: "ContentTypesConfiguration",
|
|
1059
|
-
id: uid
|
|
1060
|
-
}
|
|
1061
|
-
]
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1064
1014
|
}
|
|
1065
1015
|
} else {
|
|
1066
1016
|
const res = await create(data);
|
|
1067
1017
|
if ("error" in res && index.isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1068
1018
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1069
1019
|
} else if ("data" in res) {
|
|
1070
|
-
|
|
1071
|
-
dispatch({
|
|
1072
|
-
type: "contentManagerApi/invalidateTags",
|
|
1073
|
-
payload: [
|
|
1074
|
-
{
|
|
1075
|
-
type: "ContentTypesConfiguration",
|
|
1076
|
-
id: uid
|
|
1077
|
-
}
|
|
1078
|
-
]
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1081
|
-
navigate(`../${res.data.id}`);
|
|
1020
|
+
navigate(`../${res.data.id}`, { replace: true });
|
|
1082
1021
|
}
|
|
1083
1022
|
}
|
|
1084
1023
|
} catch (error2) {
|
|
@@ -1200,23 +1139,22 @@ const EditPage = () => {
|
|
|
1200
1139
|
}
|
|
1201
1140
|
),
|
|
1202
1141
|
/* @__PURE__ */ jsxRuntime.jsx(Layout.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1203
|
-
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate }),
|
|
1142
|
+
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1204
1143
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1205
1144
|
Stages,
|
|
1206
1145
|
{
|
|
1207
1146
|
canDelete,
|
|
1208
|
-
canUpdate,
|
|
1147
|
+
canUpdate: canUpdate || canCreate,
|
|
1209
1148
|
isCreating: isCreatingWorkflow
|
|
1210
1149
|
}
|
|
1211
1150
|
)
|
|
1212
1151
|
] }) }),
|
|
1213
1152
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1214
|
-
|
|
1153
|
+
designSystem.Dialog.Root,
|
|
1215
1154
|
{
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
|
|
1219
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1155
|
+
open: Object.keys(savePrompts).length > 0,
|
|
1156
|
+
onOpenChange: handleConfirmClose,
|
|
1157
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1220
1158
|
savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", variant: "omega", children: formatMessage({
|
|
1221
1159
|
id: "review-workflows.page.delete.confirm.stages.body",
|
|
1222
1160
|
defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
|
|
@@ -1228,7 +1166,7 @@ const EditPage = () => {
|
|
|
1228
1166
|
},
|
|
1229
1167
|
{
|
|
1230
1168
|
count: contentTypesFromOtherWorkflows?.filter(
|
|
1231
|
-
(contentType) =>
|
|
1169
|
+
(contentType) => values.contentTypes.includes(contentType)
|
|
1232
1170
|
).length ?? 0
|
|
1233
1171
|
}
|
|
1234
1172
|
) }),
|
|
@@ -1236,7 +1174,7 @@ const EditPage = () => {
|
|
|
1236
1174
|
id: "review-workflows.page.delete.confirm.confirm",
|
|
1237
1175
|
defaultMessage: "Are you sure you want to save?"
|
|
1238
1176
|
}) })
|
|
1239
|
-
] })
|
|
1177
|
+
] }) })
|
|
1240
1178
|
}
|
|
1241
1179
|
)
|
|
1242
1180
|
] })
|
|
@@ -1245,8 +1183,8 @@ const EditPage = () => {
|
|
|
1245
1183
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1246
1184
|
index.LimitsModal.Root,
|
|
1247
1185
|
{
|
|
1248
|
-
|
|
1249
|
-
|
|
1186
|
+
open: showLimitModal === "workflow",
|
|
1187
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1250
1188
|
children: [
|
|
1251
1189
|
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1252
1190
|
id: "review-workflows.edit.page.workflows.limit.title",
|
|
@@ -1259,16 +1197,23 @@ const EditPage = () => {
|
|
|
1259
1197
|
]
|
|
1260
1198
|
}
|
|
1261
1199
|
),
|
|
1262
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1200
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1201
|
+
index.LimitsModal.Root,
|
|
1202
|
+
{
|
|
1203
|
+
open: showLimitModal === "stage",
|
|
1204
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1205
|
+
children: [
|
|
1206
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1207
|
+
id: "review-workflows.edit.page.stages.limit.title",
|
|
1208
|
+
defaultMessage: "You have reached the limit of stages for this workflow in your plan"
|
|
1209
|
+
}) }),
|
|
1210
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Body, { children: formatMessage({
|
|
1211
|
+
id: "review-workflows.edit.page.stages.limit.body",
|
|
1212
|
+
defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
|
|
1213
|
+
}) })
|
|
1214
|
+
]
|
|
1215
|
+
}
|
|
1216
|
+
)
|
|
1272
1217
|
] });
|
|
1273
1218
|
};
|
|
1274
1219
|
const addTmpKeysToStages = (data) => {
|
|
@@ -1290,4 +1235,4 @@ const ProtectedEditPage = () => {
|
|
|
1290
1235
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
|
|
1291
1236
|
};
|
|
1292
1237
|
exports.ProtectedEditPage = ProtectedEditPage;
|
|
1293
|
-
//# sourceMappingURL=_id-
|
|
1238
|
+
//# sourceMappingURL=_id-C7pCAzXV.js.map
|