@strapi/review-workflows 0.0.0-experimental.defd8568ae03ef8d52f86e1f3541979f953c3941 → 0.0.0-experimental.df298029ec6478763dcca7d59fafe8d2ae4ed60a

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.
Files changed (73) hide show
  1. package/LICENSE +12 -17
  2. package/dist/_chunks/{Layout-Py8gxQW2.js → Layout-8i0EXRRs.js} +11 -20
  3. package/dist/_chunks/Layout-8i0EXRRs.js.map +1 -0
  4. package/dist/_chunks/{Layout-B_cKmQA3.mjs → Layout-C9m07iTY.mjs} +13 -20
  5. package/dist/_chunks/Layout-C9m07iTY.mjs.map +1 -0
  6. package/dist/_chunks/{_id-BeUU-t6D.js → id-CmtaTf1x.js} +325 -420
  7. package/dist/_chunks/id-CmtaTf1x.js.map +1 -0
  8. package/dist/_chunks/{_id-C_HRFhcV.mjs → id-DV0Ndeav.mjs} +319 -412
  9. package/dist/_chunks/id-DV0Ndeav.mjs.map +1 -0
  10. package/dist/_chunks/{index-DyJcIA81.js → index-B8WmHbCU.js} +19 -53
  11. package/dist/_chunks/index-B8WmHbCU.js.map +1 -0
  12. package/dist/_chunks/{index-D3AvHSbj.js → index-BCUO98DV.js} +186 -226
  13. package/dist/_chunks/index-BCUO98DV.js.map +1 -0
  14. package/dist/_chunks/{index-CAgnun9R.mjs → index-CA5Axcoc.mjs} +21 -53
  15. package/dist/_chunks/index-CA5Axcoc.mjs.map +1 -0
  16. package/dist/_chunks/{index-DjHtLGgq.mjs → index-CqYVkW3E.mjs} +189 -227
  17. package/dist/_chunks/index-CqYVkW3E.mjs.map +1 -0
  18. package/dist/_chunks/{purchase-review-workflows-DyffLpyz.mjs → purchase-review-workflows-BN-5Ube7.mjs} +5 -4
  19. package/dist/_chunks/purchase-review-workflows-BN-5Ube7.mjs.map +1 -0
  20. package/dist/_chunks/{purchase-review-workflows-BaOk5p_m.js → purchase-review-workflows-DlCDg0fD.js} +4 -3
  21. package/dist/_chunks/purchase-review-workflows-DlCDg0fD.js.map +1 -0
  22. package/dist/_chunks/{router-BwVSq4yF.js → router-BOXlNnrU.js} +3 -3
  23. package/dist/_chunks/router-BOXlNnrU.js.map +1 -0
  24. package/dist/_chunks/{router-zN3-SLwz.mjs → router-Jdt6SbIA.mjs} +3 -3
  25. package/dist/_chunks/router-Jdt6SbIA.mjs.map +1 -0
  26. package/dist/admin/index.js +1 -1
  27. package/dist/admin/index.mjs +1 -1
  28. package/dist/admin/src/components/LimitsModal.d.ts +2 -4
  29. package/dist/admin/src/routes/content-manager/[model]/[id]/components/Panel.d.ts +1 -1
  30. package/dist/admin/src/routes/settings/hooks/useDragAndDrop.d.ts +4 -4
  31. package/dist/admin/src/routes/settings/hooks/useKeyboardDragAndDrop.d.ts +1 -1
  32. package/dist/admin/src/routes/settings/hooks/useReviewWorkflows.d.ts +3 -3
  33. package/dist/admin/src/services/admin.d.ts +2 -2
  34. package/dist/admin/src/services/api.d.ts +2 -3
  35. package/dist/admin/src/services/content-manager.d.ts +7 -7
  36. package/dist/admin/src/services/settings.d.ts +1734 -8
  37. package/dist/admin/src/utils/api.d.ts +4 -19
  38. package/dist/admin/src/utils/cm-hooks.d.ts +1 -1
  39. package/dist/server/index.js +49 -68
  40. package/dist/server/index.js.map +1 -1
  41. package/dist/server/index.mjs +49 -68
  42. package/dist/server/index.mjs.map +1 -1
  43. package/dist/server/src/controllers/assignees.d.ts.map +1 -1
  44. package/dist/server/src/controllers/index.d.ts +0 -1
  45. package/dist/server/src/controllers/index.d.ts.map +1 -1
  46. package/dist/server/src/controllers/stages.d.ts.map +1 -1
  47. package/dist/server/src/controllers/workflows.d.ts +0 -7
  48. package/dist/server/src/controllers/workflows.d.ts.map +1 -1
  49. package/dist/server/src/index.d.ts +1 -2
  50. package/dist/server/src/index.d.ts.map +1 -1
  51. package/dist/server/src/routes/review-workflows.d.ts.map +1 -1
  52. package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
  53. package/dist/server/src/services/index.d.ts +1 -1
  54. package/dist/server/src/services/metrics/weekly-metrics.d.ts.map +1 -1
  55. package/dist/server/src/services/stages.d.ts +2 -7
  56. package/dist/server/src/services/stages.d.ts.map +1 -1
  57. package/dist/shared/contracts/review-workflows.d.ts +1 -14
  58. package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
  59. package/package.json +16 -17
  60. package/dist/_chunks/Layout-B_cKmQA3.mjs.map +0 -1
  61. package/dist/_chunks/Layout-Py8gxQW2.js.map +0 -1
  62. package/dist/_chunks/_id-BeUU-t6D.js.map +0 -1
  63. package/dist/_chunks/_id-C_HRFhcV.mjs.map +0 -1
  64. package/dist/_chunks/index-CAgnun9R.mjs.map +0 -1
  65. package/dist/_chunks/index-D3AvHSbj.js.map +0 -1
  66. package/dist/_chunks/index-DjHtLGgq.mjs.map +0 -1
  67. package/dist/_chunks/index-DyJcIA81.js.map +0 -1
  68. package/dist/_chunks/purchase-review-workflows-BaOk5p_m.js.map +0 -1
  69. package/dist/_chunks/purchase-review-workflows-DyffLpyz.mjs.map +0 -1
  70. package/dist/_chunks/router-BwVSq4yF.js.map +0 -1
  71. package/dist/_chunks/router-zN3-SLwz.mjs.map +0 -1
  72. package/strapi-server.js +0 -3
  73. /package/dist/admin/src/routes/settings/{:id.d.ts → id.d.ts} +0 -0
@@ -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-D3AvHSbj.js");
15
- const Layout = require("./Layout-Py8gxQW2.js");
13
+ const index = require("./index-BCUO98DV.js");
14
+ const Layout = require("./Layout-8i0EXRRs.js");
16
15
  const reactDndHtml5Backend = require("react-dnd-html5-backend");
17
- const styled = require("styled-components");
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
- getRoles: builder.query({
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 { useGetRolesQuery } = adminApi;
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,74 +269,35 @@ const AddStage = ({ children, ...props }) => {
272
269
  return /* @__PURE__ */ jsxRuntime.jsx(
273
270
  StyledButton,
274
271
  {
275
- as: "button",
272
+ tag: "button",
276
273
  background: "neutral0",
277
- border: "neutral150",
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.jsxs(designSystem.Flex, { gap: 2, children: [
285
- /* @__PURE__ */ jsxRuntime.jsx(StyledAddIcon, { "aria-hidden": true }),
286
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral500", children })
287
- ] })
281
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
282
+ /* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
283
+ children
284
+ ] }) })
288
285
  }
289
286
  );
290
287
  };
291
- const StyledAddIcon = styled__default.default(icons.PlusCircle)`
292
- > circle {
293
- fill: ${({ theme }) => theme.colors.neutral150};
294
- }
295
- > path {
296
- fill: ${({ theme }) => theme.colors.neutral600};
297
- }
298
- `;
299
- const StyledButton = styled__default.default(designSystem.Box)`
288
+ const StyledButton = styledComponents.styled(designSystem.Box)`
300
289
  border-radius: 26px;
301
-
302
- svg {
303
- height: ${({ theme }) => theme.spaces[6]};
304
- width: ${({ theme }) => theme.spaces[6]};
305
-
306
- > path {
307
- fill: ${({ theme }) => theme.colors.neutral600};
308
- }
309
- }
290
+ color: ${({ theme }) => theme.colors.neutral500};
310
291
 
311
292
  &:hover {
312
- color: ${({ theme }) => theme.colors.primary600} !important;
313
- ${designSystem.Typography} {
314
- color: ${({ theme }) => theme.colors.primary600} !important;
315
- }
316
-
317
- ${StyledAddIcon} {
318
- > circle {
319
- fill: ${({ theme }) => theme.colors.primary600};
320
- }
321
- > path {
322
- fill: ${({ theme }) => theme.colors.neutral100};
323
- }
324
- }
293
+ color: ${({ theme }) => theme.colors.primary600};
325
294
  }
326
295
 
327
296
  &:active {
328
- ${designSystem.Typography} {
329
- color: ${({ theme }) => theme.colors.primary600};
330
- }
331
-
332
- ${StyledAddIcon} {
333
- > circle {
334
- fill: ${({ theme }) => theme.colors.primary600};
335
- }
336
- > path {
337
- fill: ${({ theme }) => theme.colors.neutral100};
338
- }
339
- }
297
+ color: ${({ theme }) => theme.colors.primary600};
340
298
  }
341
299
  `;
342
- const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
300
+ const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
343
301
  const { formatMessage } = reactIntl.useIntl();
344
302
  const { trackUsage } = strapiAdmin.useTracking();
345
303
  const addFieldRow = strapiAdmin.useForm("Stages", (state) => state.addFieldRow);
@@ -354,35 +312,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
354
312
  left: "50%",
355
313
  position: "absolute",
356
314
  top: "0",
357
- width: 2,
358
- zIndex: 1
315
+ width: 2
359
316
  }
360
317
  ),
361
- /* @__PURE__ */ jsxRuntime.jsx(
362
- designSystem.Flex,
363
- {
364
- direction: "column",
365
- alignItems: "stretch",
366
- gap: 6,
367
- zIndex: 2,
368
- position: "relative",
369
- as: "ol",
370
- children: stages.map((stage, index2) => {
371
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { as: "li", children: /* @__PURE__ */ jsxRuntime.jsx(
372
- Stage,
373
- {
374
- index: index2,
375
- canDelete: stages.length > 1 && canDelete,
376
- canReorder: stages.length > 1,
377
- canUpdate,
378
- stagesCount: stages.length,
379
- isOpen: isCreating,
380
- ...stage
381
- }
382
- ) }, stage.__temp_key__);
383
- })
384
- }
385
- )
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
+ }) })
386
332
  ] }),
387
333
  canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
388
334
  AddStage,
@@ -400,7 +346,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
400
346
  )
401
347
  ] });
402
348
  };
403
- const Background = styled__default.default(designSystem.Box)`
349
+ const Background = styledComponents.styled(designSystem.Box)`
404
350
  transform: translateX(-50%);
405
351
  `;
406
352
  const Stage = ({
@@ -408,16 +354,15 @@ const Stage = ({
408
354
  canDelete = false,
409
355
  canReorder = false,
410
356
  canUpdate = false,
411
- isOpen: isOpenDefault = false,
412
357
  stagesCount,
413
358
  name,
414
359
  permissions,
415
- color
360
+ color,
361
+ defaultOpen
416
362
  }) => {
417
363
  const [liveText, setLiveText] = React__namespace.useState();
418
364
  const { formatMessage } = reactIntl.useIntl();
419
365
  const { trackUsage } = strapiAdmin.useTracking();
420
- const [isOpen, setIsOpen] = React__namespace.useState(isOpenDefault);
421
366
  const stageErrors = strapiAdmin.useForm("Stages", (state) => state.errors.stages);
422
367
  const error = stageErrors?.[index2];
423
368
  const addFieldRow = strapiAdmin.useForm("Stage", (state) => state.addFieldRow);
@@ -499,7 +444,8 @@ const Stage = ({
499
444
  const handleCloneClick = () => {
500
445
  addFieldRow("stages", { name, color, permissions });
501
446
  };
502
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: (ref) => composedRef(ref), children: [
447
+ const id = React__namespace.useId();
448
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, shadow: "tableShadow", children: [
503
449
  liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
504
450
  isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
505
451
  designSystem.Box,
@@ -510,74 +456,61 @@ const Stage = ({
510
456
  borderWidth: "1px",
511
457
  display: "block",
512
458
  hasRadius: true,
513
- padding: 6,
514
- shadow: "tableShadow"
459
+ padding: 6
515
460
  }
516
- ) : /* @__PURE__ */ jsxRuntime.jsxs(
517
- designSystem.Accordion,
461
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
462
+ AccordionRoot,
518
463
  {
519
- size: "S",
520
- variant: "primary",
521
- onToggle: () => {
522
- setIsOpen(!isOpen);
523
- if (!isOpen) {
464
+ onValueChange: (value) => {
465
+ if (value) {
524
466
  trackUsage("willEditStage");
525
467
  }
526
468
  },
527
- expanded: isOpen,
528
- shadow: "tableShadow",
529
- error: Object.values(error ?? {})[0],
530
- hasErrorMessage: false,
531
- children: [
532
- /* @__PURE__ */ jsxRuntime.jsx(
533
- designSystem.AccordionToggle,
534
- {
535
- title: name,
536
- togglePosition: "left",
537
- action: (canDelete || canUpdate) && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
538
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
539
- /* @__PURE__ */ jsxRuntime.jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
540
- /* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
541
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { as: "span", children: formatMessage({
542
- id: "[tbdb].components.DynamicZone.more-actions",
543
- defaultMessage: "More actions"
544
- }) })
545
- ] }),
546
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.SubRoot, { children: [
547
- canUpdate && /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: handleCloneClick, children: formatMessage({
548
- id: "Settings.review-workflows.stage.delete",
549
- defaultMessage: "Duplicate stage"
550
- }) }),
551
- canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
552
- id: "Settings.review-workflows.stage.delete",
553
- defaultMessage: "Delete"
554
- }) })
555
- ] }) })
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
+ }) })
556
482
  ] }),
557
- canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
558
- DragIconButton,
559
- {
560
- background: "transparent",
561
- forwardedAs: "div",
562
- hasRadius: true,
563
- role: "button",
564
- noBorder: true,
565
- tabIndex: 0,
566
- "data-handler-id": handlerId,
567
- ref: dragRef,
568
- label: formatMessage({
569
- id: "Settings.review-workflows.stage.drag",
570
- defaultMessage: "Drag"
571
- }),
572
- onClick: (e) => e.stopPropagation(),
573
- onKeyDown: handleKeyDown,
574
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, {})
575
- }
576
- )
577
- ] })
578
- }
579
- ),
580
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.AccordionContent, { padding: 6, background: "neutral0", hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: [
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: [
581
514
  {
582
515
  disabled: !canUpdate,
583
516
  label: formatMessage({
@@ -615,16 +548,20 @@ const Stage = ({
615
548
  size: 6,
616
549
  type: "permissions"
617
550
  }
618
- ].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: size, children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
619
- ]
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
+ ] })
620
553
  }
621
554
  )
622
555
  ] });
623
556
  };
624
- const DeleteMenuItem = styled__default.default(designSystem.MenuItem)`
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)`
625
562
  color: ${({ theme }) => theme.colors.danger600};
626
563
  `;
627
- const ContextMenuTrigger = styled__default.default(designSystem.Menu.Trigger)`
564
+ const ContextMenuTrigger = styledComponents.styled(designSystem.Menu.Trigger)`
628
565
  :hover,
629
566
  :focus {
630
567
  background-color: ${({ theme }) => theme.colors.neutral100};
@@ -634,22 +571,6 @@ const ContextMenuTrigger = styled__default.default(designSystem.Menu.Trigger)`
634
571
  font-size: 0;
635
572
  }
636
573
  `;
637
- const DragIconButton = styled__default.default(designSystem.IconButton)`
638
- align-items: center;
639
- border-radius: ${({ theme }) => theme.borderRadius};
640
- display: flex;
641
- justify-content: center;
642
-
643
- &:hover,
644
- &:focus {
645
- background-color: ${({ theme }) => theme.colors.neutral100};
646
- }
647
-
648
- svg {
649
- height: auto;
650
- width: ${({ theme }) => theme.spaces[3]};
651
- }
652
- `;
653
574
  const InputRenderer = (props) => {
654
575
  switch (props.type) {
655
576
  case "color":
@@ -675,54 +596,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
675
596
  color: hex
676
597
  }));
677
598
  const { themeColorName } = index.getStageColorByHex(value) ?? {};
678
- return /* @__PURE__ */ jsxRuntime.jsx(
679
- designSystem.SingleSelect,
680
- {
681
- disabled,
682
- error,
683
- required,
684
- label,
685
- onChange: (v) => {
686
- onChange(name, v.toString());
687
- },
688
- value: value?.toUpperCase(),
689
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(
690
- designSystem.Flex,
691
- {
692
- as: "span",
693
- height: 2,
694
- background: value,
695
- borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
696
- hasRadius: true,
697
- shrink: 0,
698
- width: 2
699
- }
700
- ),
701
- children: colorOptions.map(({ value: value2, label: label2, color }) => {
702
- const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
703
- return /* @__PURE__ */ jsxRuntime.jsx(
704
- 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,
705
611
  {
706
- value: value2,
707
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(
708
- designSystem.Flex,
709
- {
710
- as: "span",
711
- height: 2,
712
- background: color,
713
- borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
714
- hasRadius: true,
715
- shrink: 0,
716
- width: 2
717
- }
718
- ),
719
- children: label2
720
- },
721
- value2
722
- );
723
- })
724
- }
725
- );
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
+ ] });
726
648
  };
727
649
  const PermissionsField = ({ disabled, name, placeholder, required }) => {
728
650
  const { formatMessage } = reactIntl.useIntl();
@@ -731,57 +653,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
731
653
  const { value = [], error, onChange } = strapiAdmin.useField(name);
732
654
  const allStages = strapiAdmin.useForm("PermissionsField", (state) => state.values.stages);
733
655
  const onFormValueChange = strapiAdmin.useForm("PermissionsField", (state) => state.onChange);
734
- const { data: roles = [], isLoading } = useGetRolesQuery();
656
+ const rolesErrorCount = React__namespace.useRef(0);
657
+ const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
735
658
  const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
736
659
  React__namespace.useEffect(() => {
737
- if (!isLoading && roles.length === 0) {
660
+ if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
661
+ rolesErrorCount.current = 1;
738
662
  toggleNotification({
739
663
  blockTransition: true,
740
664
  type: "danger",
741
665
  message: formatMessage({
742
666
  id: "review-workflows.stage.permissions.noPermissions.description",
743
- defaultMessage: "You don’t have the permission to see roles"
667
+ defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
744
668
  })
745
669
  });
746
670
  }
747
- }, [formatMessage, isLoading, roles, toggleNotification]);
671
+ }, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
748
672
  if (!isLoading && filteredRoles.length === 0) {
749
- return /* @__PURE__ */ jsxRuntime.jsx(
750
- designSystem.TextInput,
673
+ return /* @__PURE__ */ jsxRuntime.jsxs(
674
+ designSystem.Field.Root,
751
675
  {
752
- disabled: true,
753
676
  name,
754
677
  hint: formatMessage({
755
678
  id: "Settings.review-workflows.stage.permissions.noPermissions.description",
756
679
  defaultMessage: "You don’t have the permission to see roles"
757
680
  }),
758
- label: formatMessage({
759
- id: "Settings.review-workflows.stage.permissions.label",
760
- defaultMessage: "Roles that can change this stage"
761
- }),
762
- placeholder: formatMessage({
763
- id: "components.NotAllowedInput.text",
764
- defaultMessage: "No permissions to see this field"
765
- }),
766
681
  required,
767
- startAction: /* @__PURE__ */ jsxRuntime.jsx(StyledIcon, {}),
768
- type: "text",
769
- value: ""
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
+ ]
770
702
  }
771
703
  );
772
704
  }
773
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
774
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-end", gap: 3, children: [
775
- /* @__PURE__ */ jsxRuntime.jsx(PermissionWrapper, { grow: 1, children: /* @__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(
776
712
  designSystem.MultiSelect,
777
713
  {
778
714
  disabled,
779
- error,
780
- id: name,
781
- label: formatMessage({
782
- id: "Settings.review-workflows.stage.permissions.label",
783
- defaultMessage: "Roles that can change this stage"
784
- }),
785
715
  onChange: (values) => {
786
716
  const permissions = values.map((value2) => ({
787
717
  role: parseInt(value2, 10),
@@ -790,7 +720,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
790
720
  onChange(name, permissions);
791
721
  },
792
722
  placeholder,
793
- required: true,
794
723
  value: value.map((permission) => `${permission.role}`),
795
724
  withTags: true,
796
725
  children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -807,70 +736,64 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
807
736
  }
808
737
  )
809
738
  }
810
- ) }),
811
- /* @__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(
812
744
  designSystem.IconButton,
813
745
  {
814
746
  disabled,
815
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {}),
816
747
  label: formatMessage({
817
748
  id: "Settings.review-workflows.stage.permissions.apply.label",
818
749
  defaultMessage: "Apply to all stages"
819
750
  }),
820
751
  size: "L",
821
- variant: "secondary",
822
- onClick: () => setIsApplyAllConfirmationOpen(true)
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
+ })
823
780
  }
824
781
  )
825
- ] }),
826
- /* @__PURE__ */ jsxRuntime.jsx(
827
- strapiAdmin.ConfirmDialog,
828
- {
829
- isOpen: isApplyAllConfirmationOpen,
830
- onClose: () => setIsApplyAllConfirmationOpen(false),
831
- onConfirm: () => {
832
- onFormValueChange(
833
- "stages",
834
- allStages.map((stage) => ({
835
- ...stage,
836
- permissions: value
837
- }))
838
- );
839
- setIsApplyAllConfirmationOpen(false);
840
- toggleNotification({
841
- type: "success",
842
- message: formatMessage({
843
- id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
844
- defaultMessage: "Applied roles to all other stages of the workflow"
845
- })
846
- });
847
- },
848
- variant: "default",
849
- children: formatMessage({
850
- id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
851
- defaultMessage: "Roles that can change that stage will be applied to all the other stages."
852
- })
853
- }
854
- )
855
- ] });
782
+ ] })
783
+ ] }) });
856
784
  };
857
- const StyledIcon = styled__default.default(icons.EyeStriked)`
858
- & > path {
859
- fill: ${({ theme }) => theme.colors.neutral600};
860
- }
861
- `;
862
- const NestedOption$1 = styled__default.default(designSystem.MultiSelectOption)`
785
+ const NestedOption$1 = styledComponents.styled(designSystem.MultiSelectOption)`
863
786
  padding-left: ${({ theme }) => theme.spaces[7]};
864
787
  `;
865
- const PermissionWrapper = styled__default.default(designSystem.Flex)`
788
+ const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
866
789
  > * {
867
790
  flex-grow: 1;
868
791
  }
869
792
  `;
870
793
  const WorkflowAttributes = ({ canUpdate = true }) => {
871
794
  const { formatMessage } = reactIntl.useIntl();
872
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
873
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
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(
874
797
  strapiAdmin.InputRenderer,
875
798
  {
876
799
  disabled: !canUpdate,
@@ -883,7 +806,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
883
806
  type: "string"
884
807
  }
885
808
  ) }),
886
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
809
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
887
810
  ] });
888
811
  };
889
812
  const ContentTypesSelector = ({ disabled }) => {
@@ -904,86 +827,87 @@ const ContentTypesSelector = ({ disabled }) => {
904
827
  label: contentType.info.displayName,
905
828
  value: contentType.uid
906
829
  }));
907
- return /* @__PURE__ */ jsxRuntime.jsx(
908
- designSystem.MultiSelect,
909
- {
910
- customizeContent: (value2) => formatMessage(
911
- {
912
- id: "Settings.review-workflows.workflow.contentTypes.displayValue",
913
- defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
914
- },
915
- { count: value2?.length }
916
- ),
917
- disabled: isDisabled,
918
- error,
919
- label: formatMessage({
920
- id: "Settings.review-workflows.workflow.contentTypes.label",
921
- defaultMessage: "Associated to"
922
- }),
923
- onChange: (values) => {
924
- onChange("contentTypes", values);
925
- },
926
- value,
927
- placeholder: formatMessage({
928
- id: "Settings.review-workflows.workflow.contentTypes.placeholder",
929
- defaultMessage: "Select"
930
- }),
931
- children: [
932
- ...collectionTypes.length > 0 ? [
933
- {
934
- label: formatMessage({
935
- id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
936
- defaultMessage: "Collection Types"
937
- }),
938
- children: collectionTypes
939
- }
940
- ] : [],
941
- ...singleTypes.length > 0 ? [
942
- {
943
- label: formatMessage({
944
- id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
945
- defaultMessage: "Single Types"
946
- }),
947
- children: singleTypes
948
- }
949
- ] : []
950
- ].map((opt) => {
951
- return /* @__PURE__ */ jsxRuntime.jsx(
952
- 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(
953
839
  {
954
- label: opt.label,
955
- values: opt.children.map((child) => child.value.toString()),
956
- children: opt.children.map((child) => {
957
- const { name: assignedWorkflowName } = workflows?.find(
958
- (workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
959
- ) ?? {};
960
- return /* @__PURE__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
961
- // @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
962
- children: formatMessage(
963
- {
964
- id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
965
- defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
966
- },
967
- {
968
- label: child.label,
969
- name: assignedWorkflowName,
970
- em: (...children) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "em", fontWeight: "bold", children }),
971
- i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
972
- }
973
- )
974
- }) }, child.value);
975
- })
840
+ id: "Settings.review-workflows.workflow.contentTypes.displayValue",
841
+ defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
976
842
  },
977
- opt.label
978
- );
979
- })
980
- }
981
- );
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
+ ] });
982
906
  };
983
- const NestedOption = styled__default.default(designSystem.MultiSelectOption)`
907
+ const NestedOption = styledComponents.styled(designSystem.MultiSelectOption)`
984
908
  padding-left: ${({ theme }) => theme.spaces[7]};
985
909
  `;
986
- const ContentTypeTakeNotice = styled__default.default(designSystem.Typography)`
910
+ const ContentTypeTakeNotice = styledComponents.styled(designSystem.Typography)`
987
911
  font-style: italic;
988
912
  `;
989
913
  const WORKFLOW_SCHEMA = yup__namespace.object({
@@ -991,10 +915,10 @@ const WORKFLOW_SCHEMA = yup__namespace.object({
991
915
  name: yup__namespace.string().max(255, {
992
916
  id: "review-workflows.validation.name.max-length",
993
917
  defaultMessage: "Name can not be longer than 255 characters"
994
- }).required(),
918
+ }).required().nullable(),
995
919
  stages: yup__namespace.array().of(
996
920
  yup__namespace.object().shape({
997
- name: yup__namespace.string().required({
921
+ name: yup__namespace.string().nullable().required({
998
922
  id: "review-workflows.validation.stage.name",
999
923
  defaultMessage: "Name is required"
1000
924
  }).max(255, {
@@ -1011,7 +935,7 @@ const WORKFLOW_SCHEMA = yup__namespace.object({
1011
935
  return stages.filter((stage) => stage.name === stageName).length === 1;
1012
936
  }
1013
937
  ),
1014
- color: yup__namespace.string().required({
938
+ color: yup__namespace.string().nullable().required({
1015
939
  id: "review-workflows.validation.stage.color",
1016
940
  defaultMessage: "Color is required"
1017
941
  }).matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i),
@@ -1037,7 +961,6 @@ const EditPage = () => {
1037
961
  const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
1038
962
  const navigate = reactRouterDom.useNavigate();
1039
963
  const { toggleNotification } = strapiAdmin.useNotification();
1040
- const dispatch = reactRedux.useDispatch();
1041
964
  const {
1042
965
  isLoading: isLoadingWorkflow,
1043
966
  meta,
@@ -1045,7 +968,7 @@ const EditPage = () => {
1045
968
  error,
1046
969
  update,
1047
970
  create
1048
- } = Layout.useReviewWorkflows({ id: isCreatingWorkflow ? void 0 : id });
971
+ } = Layout.useReviewWorkflows();
1049
972
  const permissions = index.useTypedSelector(
1050
973
  (state) => state.admin_app.permissions["settings"]?.["review-workflows"]
1051
974
  );
@@ -1088,36 +1011,13 @@ const EditPage = () => {
1088
1011
  });
1089
1012
  if ("error" in res && index.isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1090
1013
  helpers.setErrors(formatValidationErrors(res.error));
1091
- } else if ("data" in res) {
1092
- for (const uid of res.data.contentTypes) {
1093
- dispatch({
1094
- type: "contentManagerApi/invalidateTags",
1095
- payload: [
1096
- {
1097
- type: "ContentTypesConfiguration",
1098
- id: uid
1099
- }
1100
- ]
1101
- });
1102
- }
1103
1014
  }
1104
1015
  } else {
1105
1016
  const res = await create(data);
1106
1017
  if ("error" in res && index.isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1107
1018
  helpers.setErrors(formatValidationErrors(res.error));
1108
1019
  } else if ("data" in res) {
1109
- for (const uid of res.data.contentTypes) {
1110
- dispatch({
1111
- type: "contentManagerApi/invalidateTags",
1112
- payload: [
1113
- {
1114
- type: "ContentTypesConfiguration",
1115
- id: uid
1116
- }
1117
- ]
1118
- });
1119
- }
1120
- navigate(`../${res.data.id}`);
1020
+ navigate(`../${res.data.id}`, { replace: true });
1121
1021
  }
1122
1022
  }
1123
1023
  } catch (error2) {
@@ -1216,7 +1116,6 @@ const EditPage = () => {
1216
1116
  {
1217
1117
  startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}),
1218
1118
  type: "submit",
1219
- size: "M",
1220
1119
  disabled: !modified || isSubmitting || values.stages.length === 0,
1221
1120
  loading: !Boolean(Object.keys(savePrompts).length > 0) && isSubmitting,
1222
1121
  children: formatMessage({
@@ -1239,23 +1138,22 @@ const EditPage = () => {
1239
1138
  }
1240
1139
  ),
1241
1140
  /* @__PURE__ */ jsxRuntime.jsx(Layout.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
1242
- /* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate }),
1141
+ /* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
1243
1142
  /* @__PURE__ */ jsxRuntime.jsx(
1244
1143
  Stages,
1245
1144
  {
1246
1145
  canDelete,
1247
- canUpdate,
1146
+ canUpdate: canUpdate || canCreate,
1248
1147
  isCreating: isCreatingWorkflow
1249
1148
  }
1250
1149
  )
1251
1150
  ] }) }),
1252
1151
  /* @__PURE__ */ jsxRuntime.jsx(
1253
- strapiAdmin.ConfirmDialog,
1152
+ designSystem.Dialog.Root,
1254
1153
  {
1255
- isOpen: Object.keys(savePrompts).length > 0,
1256
- onClose: handleConfirmClose,
1257
- onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
1258
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
1154
+ open: Object.keys(savePrompts).length > 0,
1155
+ onOpenChange: handleConfirmClose,
1156
+ children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
1259
1157
  savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", variant: "omega", children: formatMessage({
1260
1158
  id: "review-workflows.page.delete.confirm.stages.body",
1261
1159
  defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
@@ -1267,7 +1165,7 @@ const EditPage = () => {
1267
1165
  },
1268
1166
  {
1269
1167
  count: contentTypesFromOtherWorkflows?.filter(
1270
- (contentType) => currentWorkflow?.contentTypes?.includes(contentType)
1168
+ (contentType) => values.contentTypes.includes(contentType)
1271
1169
  ).length ?? 0
1272
1170
  }
1273
1171
  ) }),
@@ -1275,7 +1173,7 @@ const EditPage = () => {
1275
1173
  id: "review-workflows.page.delete.confirm.confirm",
1276
1174
  defaultMessage: "Are you sure you want to save?"
1277
1175
  }) })
1278
- ] })
1176
+ ] }) })
1279
1177
  }
1280
1178
  )
1281
1179
  ] })
@@ -1284,8 +1182,8 @@ const EditPage = () => {
1284
1182
  /* @__PURE__ */ jsxRuntime.jsxs(
1285
1183
  index.LimitsModal.Root,
1286
1184
  {
1287
- isOpen: showLimitModal === "workflow",
1288
- onClose: () => setShowLimitModal(null),
1185
+ open: showLimitModal === "workflow",
1186
+ onOpenChange: () => setShowLimitModal(null),
1289
1187
  children: [
1290
1188
  /* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
1291
1189
  id: "review-workflows.edit.page.workflows.limit.title",
@@ -1298,16 +1196,23 @@ const EditPage = () => {
1298
1196
  ]
1299
1197
  }
1300
1198
  ),
1301
- /* @__PURE__ */ jsxRuntime.jsxs(index.LimitsModal.Root, { isOpen: showLimitModal === "stage", onClose: () => setShowLimitModal(null), children: [
1302
- /* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
1303
- id: "review-workflows.edit.page.stages.limit.title",
1304
- defaultMessage: "You have reached the limit of stages for this workflow in your plan"
1305
- }) }),
1306
- /* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Body, { children: formatMessage({
1307
- id: "review-workflows.edit.page.stages.limit.body",
1308
- defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
1309
- }) })
1310
- ] })
1199
+ /* @__PURE__ */ jsxRuntime.jsxs(
1200
+ index.LimitsModal.Root,
1201
+ {
1202
+ open: showLimitModal === "stage",
1203
+ onOpenChange: () => setShowLimitModal(null),
1204
+ children: [
1205
+ /* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
1206
+ id: "review-workflows.edit.page.stages.limit.title",
1207
+ defaultMessage: "You have reached the limit of stages for this workflow in your plan"
1208
+ }) }),
1209
+ /* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Body, { children: formatMessage({
1210
+ id: "review-workflows.edit.page.stages.limit.body",
1211
+ defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
1212
+ }) })
1213
+ ]
1214
+ }
1215
+ )
1311
1216
  ] });
1312
1217
  };
1313
1218
  const addTmpKeysToStages = (data) => {
@@ -1329,4 +1234,4 @@ const ProtectedEditPage = () => {
1329
1234
  return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
1330
1235
  };
1331
1236
  exports.ProtectedEditPage = ProtectedEditPage;
1332
- //# sourceMappingURL=_id-BeUU-t6D.js.map
1237
+ //# sourceMappingURL=id-CmtaTf1x.js.map