@strapi/review-workflows 5.0.0-beta.6 → 5.0.0-beta.8
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/dist/_chunks/{Layout-2ZuobDLm.js → Layout-BMqtFafC.js} +6 -14
- package/dist/_chunks/Layout-BMqtFafC.js.map +1 -0
- package/dist/_chunks/{Layout-BlUjTO46.mjs → Layout-lg3hbwGL.mjs} +8 -14
- package/dist/_chunks/Layout-lg3hbwGL.mjs.map +1 -0
- package/dist/_chunks/{_id-BuJ0Ud8T.mjs → _id-B3jMqqMH.mjs} +256 -276
- package/dist/_chunks/_id-B3jMqqMH.mjs.map +1 -0
- package/dist/_chunks/{_id-yjWLof5q.js → _id-B853wt9z.js} +262 -284
- package/dist/_chunks/_id-B853wt9z.js.map +1 -0
- package/dist/_chunks/{index-sU2Cg2WW.mjs → index-BhJmjDbj.mjs} +9 -8
- package/dist/_chunks/index-BhJmjDbj.mjs.map +1 -0
- package/dist/_chunks/{index-CQGgid_7.js → index-CdU1x9cZ.js} +10 -11
- package/dist/_chunks/index-CdU1x9cZ.js.map +1 -0
- package/dist/_chunks/{index-qAnk2xH9.js → index-Ujtj1Rcp.js} +84 -137
- package/dist/_chunks/index-Ujtj1Rcp.js.map +1 -0
- package/dist/_chunks/{index-D91cCzpN.mjs → index-lebOqdrv.mjs} +86 -137
- package/dist/_chunks/index-lebOqdrv.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-n4oxCWpr.js → router-BboD243b.js} +3 -3
- package/dist/_chunks/{router-n4oxCWpr.js.map → router-BboD243b.js.map} +1 -1
- package/dist/_chunks/{router-DkLtLJRZ.mjs → router-CvMnSjb9.mjs} +3 -3
- package/dist/_chunks/{router-DkLtLJRZ.mjs.map → router-CvMnSjb9.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +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 +6 -6
- package/dist/admin/src/services/settings.d.ts +4 -4
- package/dist/admin/src/utils/api.d.ts +4 -19
- package/package.json +13 -14
- package/dist/_chunks/Layout-2ZuobDLm.js.map +0 -1
- package/dist/_chunks/Layout-BlUjTO46.mjs.map +0 -1
- package/dist/_chunks/_id-BuJ0Ud8T.mjs.map +0 -1
- package/dist/_chunks/_id-yjWLof5q.js.map +0 -1
- package/dist/_chunks/index-CQGgid_7.js.map +0 -1
- package/dist/_chunks/index-D91cCzpN.mjs.map +0 -1
- package/dist/_chunks/index-qAnk2xH9.js.map +0 -1
- package/dist/_chunks/index-sU2Cg2WW.mjs.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,22 @@ 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, GridItem, Field, SingleSelect, SingleSelectOption, TextInput, MultiSelect, MultiSelectGroup, 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
9
|
import { useDispatch } from "react-redux";
|
|
10
10
|
import { useParams, useNavigate } from "react-router-dom";
|
|
11
11
|
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-
|
|
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-lebOqdrv.mjs";
|
|
13
|
+
import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-lg3hbwGL.mjs";
|
|
14
14
|
import { getEmptyImage } from "react-dnd-html5-backend";
|
|
15
|
-
import styled from "styled-components";
|
|
15
|
+
import { styled } from "styled-components";
|
|
16
16
|
import { useDrop, useDrag } from "react-dnd";
|
|
17
17
|
const adminApi = reviewWorkflowsApi.injectEndpoints({
|
|
18
18
|
endpoints(builder) {
|
|
19
19
|
return {
|
|
20
|
-
|
|
20
|
+
getAdminRoles: builder.query({
|
|
21
21
|
query: () => ({
|
|
22
22
|
url: `/admin/roles`,
|
|
23
23
|
method: "GET"
|
|
@@ -29,7 +29,7 @@ const adminApi = reviewWorkflowsApi.injectEndpoints({
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
const {
|
|
32
|
+
const { useGetAdminRolesQuery } = adminApi;
|
|
33
33
|
const useKeyboardDragAndDrop = (active, index, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
|
|
34
34
|
const [isSelected, setIsSelected] = React.useState(false);
|
|
35
35
|
const handleMove = (movement) => {
|
|
@@ -248,16 +248,16 @@ const AddStage = ({ children, ...props }) => {
|
|
|
248
248
|
return /* @__PURE__ */ jsx(
|
|
249
249
|
StyledButton,
|
|
250
250
|
{
|
|
251
|
-
|
|
251
|
+
tag: "button",
|
|
252
252
|
background: "neutral0",
|
|
253
|
-
|
|
253
|
+
borderColor: "neutral150",
|
|
254
254
|
paddingBottom: 3,
|
|
255
255
|
paddingLeft: 4,
|
|
256
256
|
paddingRight: 4,
|
|
257
257
|
paddingTop: 3,
|
|
258
258
|
shadow: "filterShadow",
|
|
259
259
|
...props,
|
|
260
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold",
|
|
260
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
|
261
261
|
/* @__PURE__ */ jsx(PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
|
|
262
262
|
children
|
|
263
263
|
] }) })
|
|
@@ -276,7 +276,7 @@ const StyledButton = styled(Box)`
|
|
|
276
276
|
color: ${({ theme }) => theme.colors.primary600};
|
|
277
277
|
}
|
|
278
278
|
`;
|
|
279
|
-
const Stages = ({ canDelete = true, canUpdate = true, isCreating
|
|
279
|
+
const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
280
280
|
const { formatMessage } = useIntl();
|
|
281
281
|
const { trackUsage } = useTracking();
|
|
282
282
|
const addFieldRow = useForm("Stages", (state) => state.addFieldRow);
|
|
@@ -303,9 +303,9 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
303
303
|
gap: 6,
|
|
304
304
|
zIndex: 2,
|
|
305
305
|
position: "relative",
|
|
306
|
-
|
|
306
|
+
tag: "ol",
|
|
307
307
|
children: stages.map((stage, index) => {
|
|
308
|
-
return /* @__PURE__ */ jsx(Box, {
|
|
308
|
+
return /* @__PURE__ */ jsx(Box, { tag: "li", children: /* @__PURE__ */ jsx(
|
|
309
309
|
Stage,
|
|
310
310
|
{
|
|
311
311
|
index,
|
|
@@ -313,7 +313,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
313
313
|
canReorder: stages.length > 1,
|
|
314
314
|
canUpdate,
|
|
315
315
|
stagesCount: stages.length,
|
|
316
|
-
|
|
316
|
+
defaultOpen: isCreating,
|
|
317
317
|
...stage
|
|
318
318
|
}
|
|
319
319
|
) }, stage.__temp_key__);
|
|
@@ -345,16 +345,15 @@ const Stage = ({
|
|
|
345
345
|
canDelete = false,
|
|
346
346
|
canReorder = false,
|
|
347
347
|
canUpdate = false,
|
|
348
|
-
isOpen: isOpenDefault = false,
|
|
349
348
|
stagesCount,
|
|
350
349
|
name,
|
|
351
350
|
permissions,
|
|
352
|
-
color
|
|
351
|
+
color,
|
|
352
|
+
defaultOpen
|
|
353
353
|
}) => {
|
|
354
354
|
const [liveText, setLiveText] = React.useState();
|
|
355
355
|
const { formatMessage } = useIntl();
|
|
356
356
|
const { trackUsage } = useTracking();
|
|
357
|
-
const [isOpen, setIsOpen] = React.useState(isOpenDefault);
|
|
358
357
|
const stageErrors = useForm("Stages", (state) => state.errors.stages);
|
|
359
358
|
const error = stageErrors?.[index];
|
|
360
359
|
const addFieldRow = useForm("Stage", (state) => state.addFieldRow);
|
|
@@ -436,7 +435,8 @@ const Stage = ({
|
|
|
436
435
|
const handleCloneClick = () => {
|
|
437
436
|
addFieldRow("stages", { name, color, permissions });
|
|
438
437
|
};
|
|
439
|
-
|
|
438
|
+
const id = React.useId();
|
|
439
|
+
return /* @__PURE__ */ jsxs(Box, { ref: composedRef, children: [
|
|
440
440
|
liveText && /* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
441
441
|
isDragging ? /* @__PURE__ */ jsx(
|
|
442
442
|
Box,
|
|
@@ -447,74 +447,61 @@ const Stage = ({
|
|
|
447
447
|
borderWidth: "1px",
|
|
448
448
|
display: "block",
|
|
449
449
|
hasRadius: true,
|
|
450
|
-
padding: 6
|
|
451
|
-
shadow: "tableShadow"
|
|
450
|
+
padding: 6
|
|
452
451
|
}
|
|
453
|
-
) : /* @__PURE__ */
|
|
454
|
-
|
|
452
|
+
) : /* @__PURE__ */ jsx(
|
|
453
|
+
AccordionRoot,
|
|
455
454
|
{
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
onToggle: () => {
|
|
459
|
-
setIsOpen(!isOpen);
|
|
460
|
-
if (!isOpen) {
|
|
455
|
+
onValueChange: (value) => {
|
|
456
|
+
if (value) {
|
|
461
457
|
trackUsage("willEditStage");
|
|
462
458
|
}
|
|
463
459
|
},
|
|
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
|
-
] }) })
|
|
460
|
+
defaultValue: defaultOpen ? id : void 0,
|
|
461
|
+
$error: Object.values(error ?? {}).length > 0,
|
|
462
|
+
children: /* @__PURE__ */ jsxs(Accordion.Item, { value: id, children: [
|
|
463
|
+
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
|
464
|
+
/* @__PURE__ */ jsx(Accordion.Trigger, { children: name }),
|
|
465
|
+
/* @__PURE__ */ jsx(Accordion.Actions, { children: canDelete || canUpdate ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
466
|
+
/* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
467
|
+
/* @__PURE__ */ jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
|
468
|
+
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
|
469
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: formatMessage({
|
|
470
|
+
id: "[tbdb].components.DynamicZone.more-actions",
|
|
471
|
+
defaultMessage: "More actions"
|
|
472
|
+
}) })
|
|
493
473
|
] }),
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
474
|
+
/* @__PURE__ */ jsx(Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxs(Menu.SubRoot, { children: [
|
|
475
|
+
canUpdate && /* @__PURE__ */ jsx(MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
476
|
+
id: "Settings.review-workflows.stage.delete",
|
|
477
|
+
defaultMessage: "Duplicate stage"
|
|
478
|
+
}) }),
|
|
479
|
+
canDelete && /* @__PURE__ */ jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index), children: formatMessage({
|
|
480
|
+
id: "Settings.review-workflows.stage.delete",
|
|
481
|
+
defaultMessage: "Delete"
|
|
482
|
+
}) })
|
|
483
|
+
] }) })
|
|
484
|
+
] }),
|
|
485
|
+
canUpdate && /* @__PURE__ */ jsx(
|
|
486
|
+
IconButton,
|
|
487
|
+
{
|
|
488
|
+
background: "transparent",
|
|
489
|
+
hasRadius: true,
|
|
490
|
+
borderWidth: 0,
|
|
491
|
+
"data-handler-id": handlerId,
|
|
492
|
+
ref: dragRef,
|
|
493
|
+
label: formatMessage({
|
|
494
|
+
id: "Settings.review-workflows.stage.drag",
|
|
495
|
+
defaultMessage: "Drag"
|
|
496
|
+
}),
|
|
497
|
+
onClick: (e) => e.stopPropagation(),
|
|
498
|
+
onKeyDown: handleKeyDown,
|
|
499
|
+
children: /* @__PURE__ */ jsx(Drag, {})
|
|
500
|
+
}
|
|
501
|
+
)
|
|
502
|
+
] }) : null })
|
|
503
|
+
] }),
|
|
504
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Grid, { gap: 4, padding: 6, children: [
|
|
518
505
|
{
|
|
519
506
|
disabled: !canUpdate,
|
|
520
507
|
label: formatMessage({
|
|
@@ -553,11 +540,15 @@ const Stage = ({
|
|
|
553
540
|
type: "permissions"
|
|
554
541
|
}
|
|
555
542
|
].map(({ size, ...field }) => /* @__PURE__ */ jsx(GridItem, { col: size, children: /* @__PURE__ */ jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
556
|
-
]
|
|
543
|
+
] })
|
|
557
544
|
}
|
|
558
545
|
)
|
|
559
546
|
] });
|
|
560
547
|
};
|
|
548
|
+
const AccordionRoot = styled(Accordion.Root)`
|
|
549
|
+
border: 1px solid
|
|
550
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
|
551
|
+
`;
|
|
561
552
|
const DeleteMenuItem = styled(MenuItem)`
|
|
562
553
|
color: ${({ theme }) => theme.colors.danger600};
|
|
563
554
|
`;
|
|
@@ -571,22 +562,6 @@ const ContextMenuTrigger = styled(Menu.Trigger)`
|
|
|
571
562
|
font-size: 0;
|
|
572
563
|
}
|
|
573
564
|
`;
|
|
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
565
|
const InputRenderer = (props) => {
|
|
591
566
|
switch (props.type) {
|
|
592
567
|
case "color":
|
|
@@ -612,54 +587,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
|
|
|
612
587
|
color: hex
|
|
613
588
|
}));
|
|
614
589
|
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,
|
|
590
|
+
return /* @__PURE__ */ jsxs(Field.Root, { error, name, required, children: [
|
|
591
|
+
/* @__PURE__ */ jsx(Field.Label, { children: label }),
|
|
592
|
+
/* @__PURE__ */ jsx(
|
|
593
|
+
SingleSelect,
|
|
594
|
+
{
|
|
595
|
+
disabled,
|
|
596
|
+
onChange: (v) => {
|
|
597
|
+
onChange(name, v.toString());
|
|
598
|
+
},
|
|
599
|
+
value: value?.toUpperCase(),
|
|
600
|
+
startIcon: /* @__PURE__ */ jsx(
|
|
601
|
+
Flex,
|
|
642
602
|
{
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
603
|
+
tag: "span",
|
|
604
|
+
height: 2,
|
|
605
|
+
background: value,
|
|
606
|
+
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
607
|
+
hasRadius: true,
|
|
608
|
+
shrink: 0,
|
|
609
|
+
width: 2
|
|
610
|
+
}
|
|
611
|
+
),
|
|
612
|
+
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
613
|
+
const { themeColorName: themeColorName2 } = getStageColorByHex(color) || {};
|
|
614
|
+
return /* @__PURE__ */ jsx(
|
|
615
|
+
SingleSelectOption,
|
|
616
|
+
{
|
|
617
|
+
value: value2,
|
|
618
|
+
startIcon: /* @__PURE__ */ jsx(
|
|
619
|
+
Flex,
|
|
620
|
+
{
|
|
621
|
+
tag: "span",
|
|
622
|
+
height: 2,
|
|
623
|
+
background: color,
|
|
624
|
+
borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
|
|
625
|
+
hasRadius: true,
|
|
626
|
+
shrink: 0,
|
|
627
|
+
width: 2
|
|
628
|
+
}
|
|
629
|
+
),
|
|
630
|
+
children: label2
|
|
631
|
+
},
|
|
632
|
+
value2
|
|
633
|
+
);
|
|
634
|
+
})
|
|
635
|
+
}
|
|
636
|
+
),
|
|
637
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
638
|
+
] });
|
|
663
639
|
};
|
|
664
640
|
const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
665
641
|
const { formatMessage } = useIntl();
|
|
@@ -668,7 +644,7 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
668
644
|
const { value = [], error, onChange } = useField(name);
|
|
669
645
|
const allStages = useForm("PermissionsField", (state) => state.values.stages);
|
|
670
646
|
const onFormValueChange = useForm("PermissionsField", (state) => state.onChange);
|
|
671
|
-
const { data: roles = [], isLoading } =
|
|
647
|
+
const { data: roles = [], isLoading } = useGetAdminRolesQuery();
|
|
672
648
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
673
649
|
React.useEffect(() => {
|
|
674
650
|
if (!isLoading && roles.length === 0) {
|
|
@@ -683,80 +659,88 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
683
659
|
}
|
|
684
660
|
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
685
661
|
if (!isLoading && filteredRoles.length === 0) {
|
|
686
|
-
return /* @__PURE__ */
|
|
687
|
-
|
|
662
|
+
return /* @__PURE__ */ jsxs(
|
|
663
|
+
Field.Root,
|
|
688
664
|
{
|
|
689
|
-
disabled: true,
|
|
690
665
|
name,
|
|
691
666
|
hint: formatMessage({
|
|
692
667
|
id: "Settings.review-workflows.stage.permissions.noPermissions.description",
|
|
693
668
|
defaultMessage: "You don’t have the permission to see roles"
|
|
694
669
|
}),
|
|
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
670
|
required,
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
value: ""
|
|
707
|
-
}
|
|
708
|
-
);
|
|
709
|
-
}
|
|
710
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
711
|
-
/* @__PURE__ */ jsxs(Flex, { alignItems: "flex-end", gap: 3, children: [
|
|
712
|
-
/* @__PURE__ */ jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsx(
|
|
713
|
-
MultiSelect,
|
|
714
|
-
{
|
|
715
|
-
disabled,
|
|
716
|
-
error,
|
|
717
|
-
id: name,
|
|
718
|
-
label: formatMessage({
|
|
671
|
+
children: [
|
|
672
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
719
673
|
id: "Settings.review-workflows.stage.permissions.label",
|
|
720
674
|
defaultMessage: "Roles that can change this stage"
|
|
721
|
-
}),
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
role: parseInt(value2, 10),
|
|
725
|
-
action: "admin::review-workflows.stage.transition"
|
|
726
|
-
}));
|
|
727
|
-
onChange(name, permissions);
|
|
728
|
-
},
|
|
729
|
-
placeholder,
|
|
730
|
-
required: true,
|
|
731
|
-
value: value.map((permission) => `${permission.role}`),
|
|
732
|
-
withTags: true,
|
|
733
|
-
children: /* @__PURE__ */ jsx(
|
|
734
|
-
MultiSelectGroup,
|
|
675
|
+
}) }),
|
|
676
|
+
/* @__PURE__ */ jsx(
|
|
677
|
+
TextInput,
|
|
735
678
|
{
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
679
|
+
disabled: true,
|
|
680
|
+
placeholder: formatMessage({
|
|
681
|
+
id: "components.NotAllowedInput.text",
|
|
682
|
+
defaultMessage: "No permissions to see this field"
|
|
739
683
|
}),
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
})
|
|
684
|
+
startAction: /* @__PURE__ */ jsx(EyeStriked, { fill: "neutral600" }),
|
|
685
|
+
type: "text",
|
|
686
|
+
value: ""
|
|
744
687
|
}
|
|
745
|
-
)
|
|
746
|
-
|
|
747
|
-
|
|
688
|
+
),
|
|
689
|
+
/* @__PURE__ */ jsx(Field.Hint, {})
|
|
690
|
+
]
|
|
691
|
+
}
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
695
|
+
/* @__PURE__ */ jsxs(Flex, { alignItems: "flex-end", gap: 3, children: [
|
|
696
|
+
/* @__PURE__ */ jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxs(Field.Root, { error, name, required: true, children: [
|
|
697
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
698
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
699
|
+
defaultMessage: "Roles that can change this stage"
|
|
700
|
+
}) }),
|
|
701
|
+
/* @__PURE__ */ jsx(
|
|
702
|
+
MultiSelect,
|
|
703
|
+
{
|
|
704
|
+
disabled,
|
|
705
|
+
onChange: (values) => {
|
|
706
|
+
const permissions = values.map((value2) => ({
|
|
707
|
+
role: parseInt(value2, 10),
|
|
708
|
+
action: "admin::review-workflows.stage.transition"
|
|
709
|
+
}));
|
|
710
|
+
onChange(name, permissions);
|
|
711
|
+
},
|
|
712
|
+
placeholder,
|
|
713
|
+
value: value.map((permission) => `${permission.role}`),
|
|
714
|
+
withTags: true,
|
|
715
|
+
children: /* @__PURE__ */ jsx(
|
|
716
|
+
MultiSelectGroup,
|
|
717
|
+
{
|
|
718
|
+
label: formatMessage({
|
|
719
|
+
id: "Settings.review-workflows.stage.permissions.allRoles.label",
|
|
720
|
+
defaultMessage: "All roles"
|
|
721
|
+
}),
|
|
722
|
+
values: filteredRoles.map((r) => `${r.id}`),
|
|
723
|
+
children: filteredRoles.map((role) => {
|
|
724
|
+
return /* @__PURE__ */ jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
|
|
725
|
+
})
|
|
726
|
+
}
|
|
727
|
+
)
|
|
728
|
+
}
|
|
729
|
+
),
|
|
730
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
731
|
+
] }) }),
|
|
748
732
|
/* @__PURE__ */ jsx(
|
|
749
733
|
IconButton,
|
|
750
734
|
{
|
|
751
735
|
disabled,
|
|
752
|
-
icon: /* @__PURE__ */ jsx(Duplicate, {}),
|
|
753
736
|
label: formatMessage({
|
|
754
737
|
id: "Settings.review-workflows.stage.permissions.apply.label",
|
|
755
738
|
defaultMessage: "Apply to all stages"
|
|
756
739
|
}),
|
|
757
740
|
size: "L",
|
|
758
741
|
variant: "secondary",
|
|
759
|
-
onClick: () => setIsApplyAllConfirmationOpen(true)
|
|
742
|
+
onClick: () => setIsApplyAllConfirmationOpen(true),
|
|
743
|
+
children: /* @__PURE__ */ jsx(Duplicate, {})
|
|
760
744
|
}
|
|
761
745
|
)
|
|
762
746
|
] }),
|
|
@@ -791,11 +775,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
791
775
|
)
|
|
792
776
|
] });
|
|
793
777
|
};
|
|
794
|
-
const StyledIcon = styled(EyeStriked)`
|
|
795
|
-
& > path {
|
|
796
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
797
|
-
}
|
|
798
|
-
`;
|
|
799
778
|
const NestedOption$1 = styled(MultiSelectOption)`
|
|
800
779
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
801
780
|
`;
|
|
@@ -841,81 +820,82 @@ const ContentTypesSelector = ({ disabled }) => {
|
|
|
841
820
|
label: contentType.info.displayName,
|
|
842
821
|
value: contentType.uid
|
|
843
822
|
}));
|
|
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,
|
|
823
|
+
return /* @__PURE__ */ jsxs(Field.Root, { error, name: "contentTypes", children: [
|
|
824
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
825
|
+
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
826
|
+
defaultMessage: "Associated to"
|
|
827
|
+
}) }),
|
|
828
|
+
/* @__PURE__ */ jsx(
|
|
829
|
+
MultiSelect,
|
|
830
|
+
{
|
|
831
|
+
customizeContent: (value2) => formatMessage(
|
|
890
832
|
{
|
|
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
|
-
})
|
|
833
|
+
id: "Settings.review-workflows.workflow.contentTypes.displayValue",
|
|
834
|
+
defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
|
|
913
835
|
},
|
|
914
|
-
|
|
915
|
-
)
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
836
|
+
{ count: value2?.length }
|
|
837
|
+
),
|
|
838
|
+
disabled: isDisabled,
|
|
839
|
+
onChange: (values) => {
|
|
840
|
+
onChange("contentTypes", values);
|
|
841
|
+
},
|
|
842
|
+
value,
|
|
843
|
+
placeholder: formatMessage({
|
|
844
|
+
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
845
|
+
defaultMessage: "Select"
|
|
846
|
+
}),
|
|
847
|
+
children: [
|
|
848
|
+
...collectionTypes.length > 0 ? [
|
|
849
|
+
{
|
|
850
|
+
label: formatMessage({
|
|
851
|
+
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
852
|
+
defaultMessage: "Collection Types"
|
|
853
|
+
}),
|
|
854
|
+
children: collectionTypes
|
|
855
|
+
}
|
|
856
|
+
] : [],
|
|
857
|
+
...singleTypes.length > 0 ? [
|
|
858
|
+
{
|
|
859
|
+
label: formatMessage({
|
|
860
|
+
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
861
|
+
defaultMessage: "Single Types"
|
|
862
|
+
}),
|
|
863
|
+
children: singleTypes
|
|
864
|
+
}
|
|
865
|
+
] : []
|
|
866
|
+
].map((opt) => {
|
|
867
|
+
return /* @__PURE__ */ jsx(
|
|
868
|
+
MultiSelectGroup,
|
|
869
|
+
{
|
|
870
|
+
label: opt.label,
|
|
871
|
+
values: opt.children.map((child) => child.value.toString()),
|
|
872
|
+
children: opt.children.map((child) => {
|
|
873
|
+
const { name: assignedWorkflowName } = workflows?.find(
|
|
874
|
+
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
875
|
+
) ?? {};
|
|
876
|
+
return /* @__PURE__ */ jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsx(Typography, {
|
|
877
|
+
// @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
|
|
878
|
+
children: formatMessage(
|
|
879
|
+
{
|
|
880
|
+
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
881
|
+
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
label: child.label,
|
|
885
|
+
name: assignedWorkflowName,
|
|
886
|
+
em: (...children) => /* @__PURE__ */ jsx(Typography, { tag: "em", fontWeight: "bold", children }),
|
|
887
|
+
i: (...children) => /* @__PURE__ */ jsx(ContentTypeTakeNotice, { children })
|
|
888
|
+
}
|
|
889
|
+
)
|
|
890
|
+
}) }, child.value);
|
|
891
|
+
})
|
|
892
|
+
},
|
|
893
|
+
opt.label
|
|
894
|
+
);
|
|
895
|
+
})
|
|
896
|
+
}
|
|
897
|
+
)
|
|
898
|
+
] });
|
|
919
899
|
};
|
|
920
900
|
const NestedOption = styled(MultiSelectOption)`
|
|
921
901
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
@@ -1268,4 +1248,4 @@ const ProtectedEditPage = () => {
|
|
|
1268
1248
|
export {
|
|
1269
1249
|
ProtectedEditPage
|
|
1270
1250
|
};
|
|
1271
|
-
//# sourceMappingURL=_id-
|
|
1251
|
+
//# sourceMappingURL=_id-B3jMqqMH.mjs.map
|