@strapi/review-workflows 0.0.0-experimental.7431ba9b3883991b77bbf6a70bd9806090706724 → 0.0.0-experimental.745741d19e90275ca6f7c928ca19f9bb0fd9d933
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-facLKucY.mjs → Layout-5ljKgKPQ.mjs} +10 -16
- package/dist/_chunks/Layout-5ljKgKPQ.mjs.map +1 -0
- package/dist/_chunks/{Layout-dGg4FA1R.js → Layout-BiM6w0JE.js} +7 -15
- package/dist/_chunks/Layout-BiM6w0JE.js.map +1 -0
- package/dist/_chunks/{_id-B6DgrtpA.js → _id-B11TjsDY.js} +307 -364
- package/dist/_chunks/_id-B11TjsDY.js.map +1 -0
- package/dist/_chunks/{_id-D4CXKOqG.mjs → _id-D9zpHIKW.mjs} +301 -356
- package/dist/_chunks/_id-D9zpHIKW.mjs.map +1 -0
- package/dist/_chunks/{index-BuKZWpJw.js → index-BAXO_30S.js} +25 -40
- package/dist/_chunks/index-BAXO_30S.js.map +1 -0
- package/dist/_chunks/{index-QbWLXdZR.mjs → index-BvEfJ4ta.mjs} +24 -37
- package/dist/_chunks/index-BvEfJ4ta.mjs.map +1 -0
- package/dist/_chunks/{index-D7Y0ofdg.mjs → index-CWIQ-LER.mjs} +115 -165
- package/dist/_chunks/index-CWIQ-LER.mjs.map +1 -0
- package/dist/_chunks/{index-DX8AGcIP.js → index-DIXWkgzz.js} +115 -167
- package/dist/_chunks/index-DIXWkgzz.js.map +1 -0
- package/dist/_chunks/{purchase-review-workflows-B-V0sA2I.mjs → purchase-review-workflows-BN-5Ube7.mjs} +8 -7
- package/dist/_chunks/purchase-review-workflows-BN-5Ube7.mjs.map +1 -0
- package/dist/_chunks/{purchase-review-workflows-Ds61D_tk.js → purchase-review-workflows-DlCDg0fD.js} +7 -6
- package/dist/_chunks/purchase-review-workflows-DlCDg0fD.js.map +1 -0
- package/dist/_chunks/{router-ylD0eA48.mjs → router-BMH37QoK.mjs} +3 -3
- package/dist/_chunks/{router-ylD0eA48.mjs.map → router-BMH37QoK.mjs.map} +1 -1
- package/dist/_chunks/{router-CL62NScV.js → router-DRZjVs98.js} +3 -3
- package/dist/_chunks/{router-CL62NScV.js.map → router-DRZjVs98.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/LimitsModal.d.ts +2 -4
- package/dist/admin/src/routes/content-manager/[model]/[id]/components/Panel.d.ts +1 -1
- package/dist/admin/src/routes/settings/hooks/useDragAndDrop.d.ts +4 -4
- package/dist/admin/src/routes/settings/hooks/useKeyboardDragAndDrop.d.ts +1 -1
- package/dist/admin/src/routes/settings/hooks/useReviewWorkflows.d.ts +3 -3
- package/dist/admin/src/services/admin.d.ts +2 -2
- package/dist/admin/src/services/api.d.ts +2 -3
- package/dist/admin/src/services/content-manager.d.ts +7 -7
- package/dist/admin/src/services/settings.d.ts +4 -4
- package/dist/admin/src/utils/api.d.ts +4 -19
- package/dist/admin/src/utils/cm-hooks.d.ts +1 -1
- package/package.json +14 -15
- package/dist/_chunks/Layout-dGg4FA1R.js.map +0 -1
- package/dist/_chunks/Layout-facLKucY.mjs.map +0 -1
- package/dist/_chunks/_id-B6DgrtpA.js.map +0 -1
- package/dist/_chunks/_id-D4CXKOqG.mjs.map +0 -1
- package/dist/_chunks/index-BuKZWpJw.js.map +0 -1
- package/dist/_chunks/index-D7Y0ofdg.mjs.map +0 -1
- package/dist/_chunks/index-DX8AGcIP.js.map +0 -1
- package/dist/_chunks/index-QbWLXdZR.mjs.map +0 -1
- package/dist/_chunks/purchase-review-workflows-B-V0sA2I.mjs.map +0 -1
- package/dist/_chunks/purchase-review-workflows-Ds61D_tk.js.map +0 -1
|
@@ -11,13 +11,11 @@ const reactIntl = require("react-intl");
|
|
|
11
11
|
const reactRedux = require("react-redux");
|
|
12
12
|
const reactRouterDom = require("react-router-dom");
|
|
13
13
|
const yup = require("yup");
|
|
14
|
-
const index = require("./index-
|
|
15
|
-
const Layout = require("./Layout-
|
|
16
|
-
const v2 = require("@strapi/design-system/v2");
|
|
14
|
+
const index = require("./index-DIXWkgzz.js");
|
|
15
|
+
const Layout = require("./Layout-BiM6w0JE.js");
|
|
17
16
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
18
|
-
const
|
|
17
|
+
const styledComponents = require("styled-components");
|
|
19
18
|
const reactDnd = require("react-dnd");
|
|
20
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
21
19
|
function _interopNamespace(e) {
|
|
22
20
|
if (e && e.__esModule)
|
|
23
21
|
return e;
|
|
@@ -38,11 +36,10 @@ function _interopNamespace(e) {
|
|
|
38
36
|
}
|
|
39
37
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
40
38
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
41
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
42
39
|
const adminApi = index.reviewWorkflowsApi.injectEndpoints({
|
|
43
40
|
endpoints(builder) {
|
|
44
41
|
return {
|
|
45
|
-
|
|
42
|
+
getAdminRoles: builder.query({
|
|
46
43
|
query: () => ({
|
|
47
44
|
url: `/admin/roles`,
|
|
48
45
|
method: "GET"
|
|
@@ -54,7 +51,7 @@ const adminApi = index.reviewWorkflowsApi.injectEndpoints({
|
|
|
54
51
|
};
|
|
55
52
|
}
|
|
56
53
|
});
|
|
57
|
-
const {
|
|
54
|
+
const { useGetAdminRolesQuery } = adminApi;
|
|
58
55
|
const useKeyboardDragAndDrop = (active, index2, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
|
|
59
56
|
const [isSelected, setIsSelected] = React__namespace.useState(false);
|
|
60
57
|
const handleMove = (movement) => {
|
|
@@ -273,74 +270,35 @@ const AddStage = ({ children, ...props }) => {
|
|
|
273
270
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
274
271
|
StyledButton,
|
|
275
272
|
{
|
|
276
|
-
|
|
273
|
+
tag: "button",
|
|
277
274
|
background: "neutral0",
|
|
278
|
-
|
|
275
|
+
borderColor: "neutral150",
|
|
279
276
|
paddingBottom: 3,
|
|
280
277
|
paddingLeft: 4,
|
|
281
278
|
paddingRight: 4,
|
|
282
279
|
paddingTop: 3,
|
|
283
280
|
shadow: "filterShadow",
|
|
284
281
|
...props,
|
|
285
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
286
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
-
|
|
288
|
-
] })
|
|
282
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
|
|
283
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
|
|
284
|
+
children
|
|
285
|
+
] }) })
|
|
289
286
|
}
|
|
290
287
|
);
|
|
291
288
|
};
|
|
292
|
-
const
|
|
293
|
-
> circle {
|
|
294
|
-
fill: ${({ theme }) => theme.colors.neutral150};
|
|
295
|
-
}
|
|
296
|
-
> path {
|
|
297
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
298
|
-
}
|
|
299
|
-
`;
|
|
300
|
-
const StyledButton = styled__default.default(designSystem.Box)`
|
|
289
|
+
const StyledButton = styledComponents.styled(designSystem.Box)`
|
|
301
290
|
border-radius: 26px;
|
|
302
|
-
|
|
303
|
-
svg {
|
|
304
|
-
height: ${({ theme }) => theme.spaces[6]};
|
|
305
|
-
width: ${({ theme }) => theme.spaces[6]};
|
|
306
|
-
|
|
307
|
-
> path {
|
|
308
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
309
|
-
}
|
|
310
|
-
}
|
|
291
|
+
color: ${({ theme }) => theme.colors.neutral500};
|
|
311
292
|
|
|
312
293
|
&:hover {
|
|
313
|
-
color: ${({ theme }) => theme.colors.primary600}
|
|
314
|
-
${designSystem.Typography} {
|
|
315
|
-
color: ${({ theme }) => theme.colors.primary600} !important;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
${StyledAddIcon} {
|
|
319
|
-
> circle {
|
|
320
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
321
|
-
}
|
|
322
|
-
> path {
|
|
323
|
-
fill: ${({ theme }) => theme.colors.neutral100};
|
|
324
|
-
}
|
|
325
|
-
}
|
|
294
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
326
295
|
}
|
|
327
296
|
|
|
328
297
|
&:active {
|
|
329
|
-
${
|
|
330
|
-
color: ${({ theme }) => theme.colors.primary600};
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
${StyledAddIcon} {
|
|
334
|
-
> circle {
|
|
335
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
336
|
-
}
|
|
337
|
-
> path {
|
|
338
|
-
fill: ${({ theme }) => theme.colors.neutral100};
|
|
339
|
-
}
|
|
340
|
-
}
|
|
298
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
341
299
|
}
|
|
342
300
|
`;
|
|
343
|
-
const Stages = ({ canDelete = true, canUpdate = true, isCreating
|
|
301
|
+
const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
344
302
|
const { formatMessage } = reactIntl.useIntl();
|
|
345
303
|
const { trackUsage } = strapiAdmin.useTracking();
|
|
346
304
|
const addFieldRow = strapiAdmin.useForm("Stages", (state) => state.addFieldRow);
|
|
@@ -367,9 +325,9 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
367
325
|
gap: 6,
|
|
368
326
|
zIndex: 2,
|
|
369
327
|
position: "relative",
|
|
370
|
-
|
|
328
|
+
tag: "ol",
|
|
371
329
|
children: stages.map((stage, index2) => {
|
|
372
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, {
|
|
330
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
373
331
|
Stage,
|
|
374
332
|
{
|
|
375
333
|
index: index2,
|
|
@@ -377,7 +335,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
377
335
|
canReorder: stages.length > 1,
|
|
378
336
|
canUpdate,
|
|
379
337
|
stagesCount: stages.length,
|
|
380
|
-
|
|
338
|
+
defaultOpen: isCreating,
|
|
381
339
|
...stage
|
|
382
340
|
}
|
|
383
341
|
) }, stage.__temp_key__);
|
|
@@ -401,7 +359,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
401
359
|
)
|
|
402
360
|
] });
|
|
403
361
|
};
|
|
404
|
-
const Background =
|
|
362
|
+
const Background = styledComponents.styled(designSystem.Box)`
|
|
405
363
|
transform: translateX(-50%);
|
|
406
364
|
`;
|
|
407
365
|
const Stage = ({
|
|
@@ -409,16 +367,15 @@ const Stage = ({
|
|
|
409
367
|
canDelete = false,
|
|
410
368
|
canReorder = false,
|
|
411
369
|
canUpdate = false,
|
|
412
|
-
isOpen: isOpenDefault = false,
|
|
413
370
|
stagesCount,
|
|
414
371
|
name,
|
|
415
372
|
permissions,
|
|
416
|
-
color
|
|
373
|
+
color,
|
|
374
|
+
defaultOpen
|
|
417
375
|
}) => {
|
|
418
376
|
const [liveText, setLiveText] = React__namespace.useState();
|
|
419
377
|
const { formatMessage } = reactIntl.useIntl();
|
|
420
378
|
const { trackUsage } = strapiAdmin.useTracking();
|
|
421
|
-
const [isOpen, setIsOpen] = React__namespace.useState(isOpenDefault);
|
|
422
379
|
const stageErrors = strapiAdmin.useForm("Stages", (state) => state.errors.stages);
|
|
423
380
|
const error = stageErrors?.[index2];
|
|
424
381
|
const addFieldRow = strapiAdmin.useForm("Stage", (state) => state.addFieldRow);
|
|
@@ -500,7 +457,8 @@ const Stage = ({
|
|
|
500
457
|
const handleCloneClick = () => {
|
|
501
458
|
addFieldRow("stages", { name, color, permissions });
|
|
502
459
|
};
|
|
503
|
-
|
|
460
|
+
const id = React__namespace.useId();
|
|
461
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
504
462
|
liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
505
463
|
isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
506
464
|
designSystem.Box,
|
|
@@ -511,74 +469,61 @@ const Stage = ({
|
|
|
511
469
|
borderWidth: "1px",
|
|
512
470
|
display: "block",
|
|
513
471
|
hasRadius: true,
|
|
514
|
-
padding: 6
|
|
515
|
-
shadow: "tableShadow"
|
|
472
|
+
padding: 6
|
|
516
473
|
}
|
|
517
|
-
) : /* @__PURE__ */ jsxRuntime.
|
|
518
|
-
|
|
474
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
475
|
+
AccordionRoot,
|
|
519
476
|
{
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
onToggle: () => {
|
|
523
|
-
setIsOpen(!isOpen);
|
|
524
|
-
if (!isOpen) {
|
|
477
|
+
onValueChange: (value) => {
|
|
478
|
+
if (value) {
|
|
525
479
|
trackUsage("willEditStage");
|
|
526
480
|
}
|
|
527
481
|
},
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
|
|
542
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { as: "span", children: formatMessage({
|
|
543
|
-
id: "[tbdb].components.DynamicZone.more-actions",
|
|
544
|
-
defaultMessage: "More actions"
|
|
545
|
-
}) })
|
|
546
|
-
] }),
|
|
547
|
-
/* @__PURE__ */ jsxRuntime.jsx(v2.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.SubRoot, { children: [
|
|
548
|
-
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(v2.MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
549
|
-
id: "Settings.review-workflows.stage.delete",
|
|
550
|
-
defaultMessage: "Duplicate stage"
|
|
551
|
-
}) }),
|
|
552
|
-
canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
|
|
553
|
-
id: "Settings.review-workflows.stage.delete",
|
|
554
|
-
defaultMessage: "Delete"
|
|
555
|
-
}) })
|
|
556
|
-
] }) })
|
|
482
|
+
defaultValue: defaultOpen ? id : void 0,
|
|
483
|
+
$error: Object.values(error ?? {}).length > 0,
|
|
484
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: id, children: [
|
|
485
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
|
|
486
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: name }),
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Actions, { children: canDelete || canUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
488
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
489
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
|
490
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
|
|
491
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "span", children: formatMessage({
|
|
492
|
+
id: "[tbdb].components.DynamicZone.more-actions",
|
|
493
|
+
defaultMessage: "More actions"
|
|
494
|
+
}) })
|
|
557
495
|
] }),
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
496
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.SubRoot, { children: [
|
|
497
|
+
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
498
|
+
id: "Settings.review-workflows.stage.delete",
|
|
499
|
+
defaultMessage: "Duplicate stage"
|
|
500
|
+
}) }),
|
|
501
|
+
canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
|
|
502
|
+
id: "Settings.review-workflows.stage.delete",
|
|
503
|
+
defaultMessage: "Delete"
|
|
504
|
+
}) })
|
|
505
|
+
] }) })
|
|
506
|
+
] }),
|
|
507
|
+
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
508
|
+
designSystem.IconButton,
|
|
509
|
+
{
|
|
510
|
+
background: "transparent",
|
|
511
|
+
hasRadius: true,
|
|
512
|
+
borderWidth: 0,
|
|
513
|
+
"data-handler-id": handlerId,
|
|
514
|
+
ref: dragRef,
|
|
515
|
+
label: formatMessage({
|
|
516
|
+
id: "Settings.review-workflows.stage.drag",
|
|
517
|
+
defaultMessage: "Drag"
|
|
518
|
+
}),
|
|
519
|
+
onClick: (e) => e.stopPropagation(),
|
|
520
|
+
onKeyDown: handleKeyDown,
|
|
521
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, {})
|
|
522
|
+
}
|
|
523
|
+
)
|
|
524
|
+
] }) : null })
|
|
525
|
+
] }),
|
|
526
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, padding: 6, children: [
|
|
582
527
|
{
|
|
583
528
|
disabled: !canUpdate,
|
|
584
529
|
label: formatMessage({
|
|
@@ -616,16 +561,20 @@ const Stage = ({
|
|
|
616
561
|
size: 6,
|
|
617
562
|
type: "permissions"
|
|
618
563
|
}
|
|
619
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
620
|
-
]
|
|
564
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
565
|
+
] })
|
|
621
566
|
}
|
|
622
567
|
)
|
|
623
568
|
] });
|
|
624
569
|
};
|
|
625
|
-
const
|
|
570
|
+
const AccordionRoot = styledComponents.styled(designSystem.Accordion.Root)`
|
|
571
|
+
border: 1px solid
|
|
572
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
|
573
|
+
`;
|
|
574
|
+
const DeleteMenuItem = styledComponents.styled(designSystem.MenuItem)`
|
|
626
575
|
color: ${({ theme }) => theme.colors.danger600};
|
|
627
576
|
`;
|
|
628
|
-
const ContextMenuTrigger =
|
|
577
|
+
const ContextMenuTrigger = styledComponents.styled(designSystem.Menu.Trigger)`
|
|
629
578
|
:hover,
|
|
630
579
|
:focus {
|
|
631
580
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
@@ -635,22 +584,6 @@ const ContextMenuTrigger = styled__default.default(v2.Menu.Trigger)`
|
|
|
635
584
|
font-size: 0;
|
|
636
585
|
}
|
|
637
586
|
`;
|
|
638
|
-
const DragIconButton = styled__default.default(designSystem.IconButton)`
|
|
639
|
-
align-items: center;
|
|
640
|
-
border-radius: ${({ theme }) => theme.borderRadius};
|
|
641
|
-
display: flex;
|
|
642
|
-
justify-content: center;
|
|
643
|
-
|
|
644
|
-
&:hover,
|
|
645
|
-
&:focus {
|
|
646
|
-
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
svg {
|
|
650
|
-
height: auto;
|
|
651
|
-
width: ${({ theme }) => theme.spaces[3]};
|
|
652
|
-
}
|
|
653
|
-
`;
|
|
654
587
|
const InputRenderer = (props) => {
|
|
655
588
|
switch (props.type) {
|
|
656
589
|
case "color":
|
|
@@ -676,54 +609,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
|
|
|
676
609
|
color: hex
|
|
677
610
|
}));
|
|
678
611
|
const { themeColorName } = index.getStageColorByHex(value) ?? {};
|
|
679
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
680
|
-
designSystem.
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
designSystem.Flex,
|
|
692
|
-
{
|
|
693
|
-
as: "span",
|
|
694
|
-
height: 2,
|
|
695
|
-
background: value,
|
|
696
|
-
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
697
|
-
hasRadius: true,
|
|
698
|
-
shrink: 0,
|
|
699
|
-
width: 2
|
|
700
|
-
}
|
|
701
|
-
),
|
|
702
|
-
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
703
|
-
const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
|
|
704
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
705
|
-
designSystem.SingleSelectOption,
|
|
612
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required, children: [
|
|
613
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
|
|
614
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
615
|
+
designSystem.SingleSelect,
|
|
616
|
+
{
|
|
617
|
+
disabled,
|
|
618
|
+
onChange: (v) => {
|
|
619
|
+
onChange(name, v.toString());
|
|
620
|
+
},
|
|
621
|
+
value: value?.toUpperCase(),
|
|
622
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
623
|
+
designSystem.Flex,
|
|
706
624
|
{
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
625
|
+
tag: "span",
|
|
626
|
+
height: 2,
|
|
627
|
+
background: value,
|
|
628
|
+
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
629
|
+
hasRadius: true,
|
|
630
|
+
shrink: 0,
|
|
631
|
+
width: 2
|
|
632
|
+
}
|
|
633
|
+
),
|
|
634
|
+
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
635
|
+
const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
|
|
636
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
637
|
+
designSystem.SingleSelectOption,
|
|
638
|
+
{
|
|
639
|
+
value: value2,
|
|
640
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
641
|
+
designSystem.Flex,
|
|
642
|
+
{
|
|
643
|
+
tag: "span",
|
|
644
|
+
height: 2,
|
|
645
|
+
background: color,
|
|
646
|
+
borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
|
|
647
|
+
hasRadius: true,
|
|
648
|
+
shrink: 0,
|
|
649
|
+
width: 2
|
|
650
|
+
}
|
|
651
|
+
),
|
|
652
|
+
children: label2
|
|
653
|
+
},
|
|
654
|
+
value2
|
|
655
|
+
);
|
|
656
|
+
})
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
660
|
+
] });
|
|
727
661
|
};
|
|
728
662
|
const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
729
663
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -732,57 +666,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
732
666
|
const { value = [], error, onChange } = strapiAdmin.useField(name);
|
|
733
667
|
const allStages = strapiAdmin.useForm("PermissionsField", (state) => state.values.stages);
|
|
734
668
|
const onFormValueChange = strapiAdmin.useForm("PermissionsField", (state) => state.onChange);
|
|
735
|
-
const
|
|
669
|
+
const rolesErrorCount = React__namespace.useRef(0);
|
|
670
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
736
671
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
737
672
|
React__namespace.useEffect(() => {
|
|
738
|
-
if (!isLoading &&
|
|
673
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
674
|
+
rolesErrorCount.current = 1;
|
|
739
675
|
toggleNotification({
|
|
740
676
|
blockTransition: true,
|
|
741
677
|
type: "danger",
|
|
742
678
|
message: formatMessage({
|
|
743
679
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
744
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
680
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
745
681
|
})
|
|
746
682
|
});
|
|
747
683
|
}
|
|
748
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
684
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
749
685
|
if (!isLoading && filteredRoles.length === 0) {
|
|
750
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
751
|
-
designSystem.
|
|
686
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
687
|
+
designSystem.Field.Root,
|
|
752
688
|
{
|
|
753
|
-
disabled: true,
|
|
754
689
|
name,
|
|
755
690
|
hint: formatMessage({
|
|
756
691
|
id: "Settings.review-workflows.stage.permissions.noPermissions.description",
|
|
757
692
|
defaultMessage: "You don’t have the permission to see roles"
|
|
758
693
|
}),
|
|
759
|
-
label: formatMessage({
|
|
760
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
761
|
-
defaultMessage: "Roles that can change this stage"
|
|
762
|
-
}),
|
|
763
|
-
placeholder: formatMessage({
|
|
764
|
-
id: "components.NotAllowedInput.text",
|
|
765
|
-
defaultMessage: "No permissions to see this field"
|
|
766
|
-
}),
|
|
767
694
|
required,
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
695
|
+
children: [
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
697
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
698
|
+
defaultMessage: "Roles that can change this stage"
|
|
699
|
+
}) }),
|
|
700
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
701
|
+
designSystem.TextInput,
|
|
702
|
+
{
|
|
703
|
+
disabled: true,
|
|
704
|
+
placeholder: formatMessage({
|
|
705
|
+
id: "components.NotAllowedInput.text",
|
|
706
|
+
defaultMessage: "No permissions to see this field"
|
|
707
|
+
}),
|
|
708
|
+
startAction: /* @__PURE__ */ jsxRuntime.jsx(icons.EyeStriked, { fill: "neutral600" }),
|
|
709
|
+
type: "text",
|
|
710
|
+
value: ""
|
|
711
|
+
}
|
|
712
|
+
),
|
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
714
|
+
]
|
|
771
715
|
}
|
|
772
716
|
);
|
|
773
717
|
}
|
|
774
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
775
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
776
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
718
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-end", gap: 3, children: [
|
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required: true, children: [
|
|
720
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
721
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
722
|
+
defaultMessage: "Roles that can change this stage"
|
|
723
|
+
}) }),
|
|
724
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
777
725
|
designSystem.MultiSelect,
|
|
778
726
|
{
|
|
779
727
|
disabled,
|
|
780
|
-
error,
|
|
781
|
-
id: name,
|
|
782
|
-
label: formatMessage({
|
|
783
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
784
|
-
defaultMessage: "Roles that can change this stage"
|
|
785
|
-
}),
|
|
786
728
|
onChange: (values) => {
|
|
787
729
|
const permissions = values.map((value2) => ({
|
|
788
730
|
role: parseInt(value2, 10),
|
|
@@ -791,7 +733,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
791
733
|
onChange(name, permissions);
|
|
792
734
|
},
|
|
793
735
|
placeholder,
|
|
794
|
-
required: true,
|
|
795
736
|
value: value.map((permission) => `${permission.role}`),
|
|
796
737
|
withTags: true,
|
|
797
738
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -808,70 +749,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
808
749
|
}
|
|
809
750
|
)
|
|
810
751
|
}
|
|
811
|
-
)
|
|
812
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
752
|
+
),
|
|
753
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
754
|
+
] }) }),
|
|
755
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { open: isApplyAllConfirmationOpen, onOpenChange: setIsApplyAllConfirmationOpen, children: [
|
|
756
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
813
757
|
designSystem.IconButton,
|
|
814
758
|
{
|
|
815
759
|
disabled,
|
|
816
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {}),
|
|
817
760
|
label: formatMessage({
|
|
818
761
|
id: "Settings.review-workflows.stage.permissions.apply.label",
|
|
819
762
|
defaultMessage: "Apply to all stages"
|
|
820
763
|
}),
|
|
821
764
|
size: "L",
|
|
822
765
|
variant: "secondary",
|
|
823
|
-
|
|
766
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
|
|
767
|
+
}
|
|
768
|
+
) }),
|
|
769
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
770
|
+
strapiAdmin.ConfirmDialog,
|
|
771
|
+
{
|
|
772
|
+
onConfirm: () => {
|
|
773
|
+
onFormValueChange(
|
|
774
|
+
"stages",
|
|
775
|
+
allStages.map((stage) => ({
|
|
776
|
+
...stage,
|
|
777
|
+
permissions: value
|
|
778
|
+
}))
|
|
779
|
+
);
|
|
780
|
+
setIsApplyAllConfirmationOpen(false);
|
|
781
|
+
toggleNotification({
|
|
782
|
+
type: "success",
|
|
783
|
+
message: formatMessage({
|
|
784
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
785
|
+
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
786
|
+
})
|
|
787
|
+
});
|
|
788
|
+
},
|
|
789
|
+
variant: "default",
|
|
790
|
+
children: formatMessage({
|
|
791
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
792
|
+
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
793
|
+
})
|
|
824
794
|
}
|
|
825
795
|
)
|
|
826
|
-
] })
|
|
827
|
-
|
|
828
|
-
strapiAdmin.ConfirmDialog,
|
|
829
|
-
{
|
|
830
|
-
isOpen: isApplyAllConfirmationOpen,
|
|
831
|
-
onClose: () => setIsApplyAllConfirmationOpen(false),
|
|
832
|
-
onConfirm: () => {
|
|
833
|
-
onFormValueChange(
|
|
834
|
-
"stages",
|
|
835
|
-
allStages.map((stage) => ({
|
|
836
|
-
...stage,
|
|
837
|
-
permissions: value
|
|
838
|
-
}))
|
|
839
|
-
);
|
|
840
|
-
setIsApplyAllConfirmationOpen(false);
|
|
841
|
-
toggleNotification({
|
|
842
|
-
type: "success",
|
|
843
|
-
message: formatMessage({
|
|
844
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
845
|
-
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
846
|
-
})
|
|
847
|
-
});
|
|
848
|
-
},
|
|
849
|
-
variant: "default",
|
|
850
|
-
children: formatMessage({
|
|
851
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
852
|
-
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
853
|
-
})
|
|
854
|
-
}
|
|
855
|
-
)
|
|
856
|
-
] });
|
|
796
|
+
] })
|
|
797
|
+
] }) });
|
|
857
798
|
};
|
|
858
|
-
const
|
|
859
|
-
& > path {
|
|
860
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
861
|
-
}
|
|
862
|
-
`;
|
|
863
|
-
const NestedOption$1 = styled__default.default(designSystem.MultiSelectOption)`
|
|
799
|
+
const NestedOption$1 = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
864
800
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
865
801
|
`;
|
|
866
|
-
const PermissionWrapper =
|
|
802
|
+
const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
|
|
867
803
|
> * {
|
|
868
804
|
flex-grow: 1;
|
|
869
805
|
}
|
|
870
806
|
`;
|
|
871
807
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
872
808
|
const { formatMessage } = reactIntl.useIntl();
|
|
873
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
874
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
809
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
810
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
875
811
|
strapiAdmin.InputRenderer,
|
|
876
812
|
{
|
|
877
813
|
disabled: !canUpdate,
|
|
@@ -884,7 +820,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
884
820
|
type: "string"
|
|
885
821
|
}
|
|
886
822
|
) }),
|
|
887
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
823
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
888
824
|
] });
|
|
889
825
|
};
|
|
890
826
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -905,86 +841,87 @@ const ContentTypesSelector = ({ disabled }) => {
|
|
|
905
841
|
label: contentType.info.displayName,
|
|
906
842
|
value: contentType.uid
|
|
907
843
|
}));
|
|
908
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
909
|
-
designSystem.
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
),
|
|
918
|
-
disabled: isDisabled,
|
|
919
|
-
error,
|
|
920
|
-
label: formatMessage({
|
|
921
|
-
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
922
|
-
defaultMessage: "Associated to"
|
|
923
|
-
}),
|
|
924
|
-
onChange: (values) => {
|
|
925
|
-
onChange("contentTypes", values);
|
|
926
|
-
},
|
|
927
|
-
value,
|
|
928
|
-
placeholder: formatMessage({
|
|
929
|
-
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
930
|
-
defaultMessage: "Select"
|
|
931
|
-
}),
|
|
932
|
-
children: [
|
|
933
|
-
...collectionTypes.length > 0 ? [
|
|
934
|
-
{
|
|
935
|
-
label: formatMessage({
|
|
936
|
-
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
937
|
-
defaultMessage: "Collection Types"
|
|
938
|
-
}),
|
|
939
|
-
children: collectionTypes
|
|
940
|
-
}
|
|
941
|
-
] : [],
|
|
942
|
-
...singleTypes.length > 0 ? [
|
|
943
|
-
{
|
|
944
|
-
label: formatMessage({
|
|
945
|
-
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
946
|
-
defaultMessage: "Single Types"
|
|
947
|
-
}),
|
|
948
|
-
children: singleTypes
|
|
949
|
-
}
|
|
950
|
-
] : []
|
|
951
|
-
].map((opt) => {
|
|
952
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
953
|
-
designSystem.MultiSelectGroup,
|
|
844
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name: "contentTypes", children: [
|
|
845
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
846
|
+
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
847
|
+
defaultMessage: "Associated to"
|
|
848
|
+
}) }),
|
|
849
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
850
|
+
designSystem.MultiSelect,
|
|
851
|
+
{
|
|
852
|
+
customizeContent: (value2) => formatMessage(
|
|
954
853
|
{
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
children: opt.children.map((child) => {
|
|
958
|
-
const { name: assignedWorkflowName } = workflows?.find(
|
|
959
|
-
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
960
|
-
) ?? {};
|
|
961
|
-
return /* @__PURE__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
962
|
-
// @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
|
|
963
|
-
children: formatMessage(
|
|
964
|
-
{
|
|
965
|
-
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
966
|
-
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
967
|
-
},
|
|
968
|
-
{
|
|
969
|
-
label: child.label,
|
|
970
|
-
name: assignedWorkflowName,
|
|
971
|
-
em: (...children) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "em", fontWeight: "bold", children }),
|
|
972
|
-
i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
|
|
973
|
-
}
|
|
974
|
-
)
|
|
975
|
-
}) }, child.value);
|
|
976
|
-
})
|
|
854
|
+
id: "Settings.review-workflows.workflow.contentTypes.displayValue",
|
|
855
|
+
defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
|
|
977
856
|
},
|
|
978
|
-
|
|
979
|
-
)
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
857
|
+
{ count: value2?.length }
|
|
858
|
+
),
|
|
859
|
+
disabled: isDisabled,
|
|
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__ */ jsxRuntime.jsx(
|
|
889
|
+
designSystem.MultiSelectGroup,
|
|
890
|
+
{
|
|
891
|
+
label: opt.label,
|
|
892
|
+
values: opt.children.map((child) => child.value.toString()),
|
|
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__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.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__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "em", fontWeight: "bold", children }),
|
|
908
|
+
i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
|
|
909
|
+
}
|
|
910
|
+
)
|
|
911
|
+
}) }, child.value);
|
|
912
|
+
})
|
|
913
|
+
},
|
|
914
|
+
opt.label
|
|
915
|
+
);
|
|
916
|
+
})
|
|
917
|
+
}
|
|
918
|
+
)
|
|
919
|
+
] });
|
|
983
920
|
};
|
|
984
|
-
const NestedOption =
|
|
921
|
+
const NestedOption = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
985
922
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
986
923
|
`;
|
|
987
|
-
const ContentTypeTakeNotice =
|
|
924
|
+
const ContentTypeTakeNotice = styledComponents.styled(designSystem.Typography)`
|
|
988
925
|
font-style: italic;
|
|
989
926
|
`;
|
|
990
927
|
const WORKFLOW_SCHEMA = yup__namespace.object({
|
|
@@ -1240,23 +1177,22 @@ const EditPage = () => {
|
|
|
1240
1177
|
}
|
|
1241
1178
|
),
|
|
1242
1179
|
/* @__PURE__ */ jsxRuntime.jsx(Layout.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1243
|
-
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate }),
|
|
1180
|
+
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1244
1181
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1245
1182
|
Stages,
|
|
1246
1183
|
{
|
|
1247
1184
|
canDelete,
|
|
1248
|
-
canUpdate,
|
|
1185
|
+
canUpdate: canUpdate || canCreate,
|
|
1249
1186
|
isCreating: isCreatingWorkflow
|
|
1250
1187
|
}
|
|
1251
1188
|
)
|
|
1252
1189
|
] }) }),
|
|
1253
1190
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1254
|
-
|
|
1191
|
+
designSystem.Dialog.Root,
|
|
1255
1192
|
{
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
|
|
1259
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1193
|
+
open: Object.keys(savePrompts).length > 0,
|
|
1194
|
+
onOpenChange: handleConfirmClose,
|
|
1195
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1260
1196
|
savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", variant: "omega", children: formatMessage({
|
|
1261
1197
|
id: "review-workflows.page.delete.confirm.stages.body",
|
|
1262
1198
|
defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
|
|
@@ -1276,7 +1212,7 @@ const EditPage = () => {
|
|
|
1276
1212
|
id: "review-workflows.page.delete.confirm.confirm",
|
|
1277
1213
|
defaultMessage: "Are you sure you want to save?"
|
|
1278
1214
|
}) })
|
|
1279
|
-
] })
|
|
1215
|
+
] }) })
|
|
1280
1216
|
}
|
|
1281
1217
|
)
|
|
1282
1218
|
] })
|
|
@@ -1285,8 +1221,8 @@ const EditPage = () => {
|
|
|
1285
1221
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1286
1222
|
index.LimitsModal.Root,
|
|
1287
1223
|
{
|
|
1288
|
-
|
|
1289
|
-
|
|
1224
|
+
open: showLimitModal === "workflow",
|
|
1225
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1290
1226
|
children: [
|
|
1291
1227
|
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1292
1228
|
id: "review-workflows.edit.page.workflows.limit.title",
|
|
@@ -1299,16 +1235,23 @@ const EditPage = () => {
|
|
|
1299
1235
|
]
|
|
1300
1236
|
}
|
|
1301
1237
|
),
|
|
1302
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1238
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1239
|
+
index.LimitsModal.Root,
|
|
1240
|
+
{
|
|
1241
|
+
open: showLimitModal === "stage",
|
|
1242
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1243
|
+
children: [
|
|
1244
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1245
|
+
id: "review-workflows.edit.page.stages.limit.title",
|
|
1246
|
+
defaultMessage: "You have reached the limit of stages for this workflow in your plan"
|
|
1247
|
+
}) }),
|
|
1248
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Body, { children: formatMessage({
|
|
1249
|
+
id: "review-workflows.edit.page.stages.limit.body",
|
|
1250
|
+
defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
|
|
1251
|
+
}) })
|
|
1252
|
+
]
|
|
1253
|
+
}
|
|
1254
|
+
)
|
|
1312
1255
|
] });
|
|
1313
1256
|
};
|
|
1314
1257
|
const addTmpKeysToStages = (data) => {
|
|
@@ -1330,4 +1273,4 @@ const ProtectedEditPage = () => {
|
|
|
1330
1273
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
|
|
1331
1274
|
};
|
|
1332
1275
|
exports.ProtectedEditPage = ProtectedEditPage;
|
|
1333
|
-
//# sourceMappingURL=_id-
|
|
1276
|
+
//# sourceMappingURL=_id-B11TjsDY.js.map
|