@strapi/review-workflows 0.0.0-experimental.f75e3c6d67cc47c64ab37479efdbb7b43be50b78 → 0.0.0-next.ce84fada19d58a7dfbdd553035e6558f8befcba4

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 (57) hide show
  1. package/LICENSE +12 -17
  2. package/dist/_chunks/{Layout-lg3hbwGL.mjs → Layout-BJOxxAeM.mjs} +8 -9
  3. package/dist/_chunks/Layout-BJOxxAeM.mjs.map +1 -0
  4. package/dist/_chunks/{Layout-BMqtFafC.js → Layout-DnEAvmeU.js} +8 -9
  5. package/dist/_chunks/Layout-DnEAvmeU.js.map +1 -0
  6. package/dist/_chunks/{_id-B3jMqqMH.mjs → _id-6LK95-rZ.mjs} +131 -164
  7. package/dist/_chunks/_id-6LK95-rZ.mjs.map +1 -0
  8. package/dist/_chunks/{_id-B853wt9z.js → _id-DSDzUpwX.js} +130 -163
  9. package/dist/_chunks/_id-DSDzUpwX.js.map +1 -0
  10. package/dist/_chunks/{index-CdU1x9cZ.js → index-6FZL88pd.js} +14 -42
  11. package/dist/_chunks/index-6FZL88pd.js.map +1 -0
  12. package/dist/_chunks/{index-Ujtj1Rcp.js → index-DZSLya4b.js} +106 -90
  13. package/dist/_chunks/index-DZSLya4b.js.map +1 -0
  14. package/dist/_chunks/{index-BhJmjDbj.mjs → index-Df1alkCk.mjs} +16 -44
  15. package/dist/_chunks/index-Df1alkCk.mjs.map +1 -0
  16. package/dist/_chunks/{index-lebOqdrv.mjs → index-lJqpw8bs.mjs} +108 -92
  17. package/dist/_chunks/index-lJqpw8bs.mjs.map +1 -0
  18. package/dist/_chunks/{router-BboD243b.js → router-CZqe-02r.js} +3 -3
  19. package/dist/_chunks/{router-BboD243b.js.map → router-CZqe-02r.js.map} +1 -1
  20. package/dist/_chunks/{router-CvMnSjb9.mjs → router-DeSH-NeW.mjs} +3 -3
  21. package/dist/_chunks/{router-CvMnSjb9.mjs.map → router-DeSH-NeW.mjs.map} +1 -1
  22. package/dist/admin/index.js +1 -1
  23. package/dist/admin/index.mjs +1 -1
  24. package/dist/admin/src/components/LimitsModal.d.ts +2 -4
  25. package/dist/admin/src/services/admin.d.ts +1 -1
  26. package/dist/admin/src/services/api.d.ts +1 -1
  27. package/dist/admin/src/services/content-manager.d.ts +4 -4
  28. package/dist/admin/src/services/settings.d.ts +1733 -7
  29. package/dist/server/index.js +35 -61
  30. package/dist/server/index.js.map +1 -1
  31. package/dist/server/index.mjs +35 -61
  32. package/dist/server/index.mjs.map +1 -1
  33. package/dist/server/src/controllers/assignees.d.ts.map +1 -1
  34. package/dist/server/src/controllers/index.d.ts +0 -1
  35. package/dist/server/src/controllers/index.d.ts.map +1 -1
  36. package/dist/server/src/controllers/stages.d.ts.map +1 -1
  37. package/dist/server/src/controllers/workflows.d.ts +0 -7
  38. package/dist/server/src/controllers/workflows.d.ts.map +1 -1
  39. package/dist/server/src/index.d.ts +1 -2
  40. package/dist/server/src/index.d.ts.map +1 -1
  41. package/dist/server/src/routes/review-workflows.d.ts.map +1 -1
  42. package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
  43. package/dist/server/src/services/index.d.ts +1 -1
  44. package/dist/server/src/services/stages.d.ts +2 -7
  45. package/dist/server/src/services/stages.d.ts.map +1 -1
  46. package/dist/shared/contracts/review-workflows.d.ts +1 -14
  47. package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
  48. package/package.json +9 -9
  49. package/dist/_chunks/Layout-BMqtFafC.js.map +0 -1
  50. package/dist/_chunks/Layout-lg3hbwGL.mjs.map +0 -1
  51. package/dist/_chunks/_id-B3jMqqMH.mjs.map +0 -1
  52. package/dist/_chunks/_id-B853wt9z.js.map +0 -1
  53. package/dist/_chunks/index-BhJmjDbj.mjs.map +0 -1
  54. package/dist/_chunks/index-CdU1x9cZ.js.map +0 -1
  55. package/dist/_chunks/index-Ujtj1Rcp.js.map +0 -1
  56. package/dist/_chunks/index-lebOqdrv.mjs.map +0 -1
  57. package/strapi-server.js +0 -3
@@ -2,15 +2,14 @@ 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, Accordion, MenuItem, Menu, MultiSelectOption, useComposedRefs, VisuallyHidden, IconButton, Grid, GridItem, Field, SingleSelect, SingleSelectOption, TextInput, MultiSelect, MultiSelectGroup, useCollator, Button } from "@strapi/design-system";
5
+ import { Box, Typography, Flex, Accordion, MenuItem, Menu, MultiSelectOption, useComposedRefs, VisuallyHidden, IconButton, Grid, Field, SingleSelect, SingleSelectOption, TextInput, MultiSelect, MultiSelectGroup, Dialog, useCollator, Button } from "@strapi/design-system";
6
6
  import { PlusCircle, More, Drag, EyeStriked, Duplicate, Check } from "@strapi/icons";
7
7
  import { generateNKeysBetween } from "fractional-indexing";
8
8
  import { useIntl } from "react-intl";
9
- import { useDispatch } from "react-redux";
10
9
  import { useParams, useNavigate } from "react-router-dom";
11
10
  import * as yup from "yup";
12
- import { r as reviewWorkflowsApi, A as AVAILABLE_COLORS, g as getStageColorByHex, u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, b as CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal, i as isBaseQueryError } from "./index-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";
11
+ import { r as reviewWorkflowsApi, A as AVAILABLE_COLORS, g as getStageColorByHex, u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, b as CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal, i as isBaseQueryError } from "./index-lJqpw8bs.mjs";
12
+ import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-BJOxxAeM.mjs";
14
13
  import { getEmptyImage } from "react-dnd-html5-backend";
15
14
  import { styled } from "styled-components";
16
15
  import { useDrop, useDrag } from "react-dnd";
@@ -291,35 +290,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
291
290
  left: "50%",
292
291
  position: "absolute",
293
292
  top: "0",
294
- width: 2,
295
- zIndex: 1
293
+ width: 2
296
294
  }
297
295
  ),
298
- /* @__PURE__ */ jsx(
299
- Flex,
300
- {
301
- direction: "column",
302
- alignItems: "stretch",
303
- gap: 6,
304
- zIndex: 2,
305
- position: "relative",
306
- tag: "ol",
307
- children: stages.map((stage, index) => {
308
- return /* @__PURE__ */ jsx(Box, { tag: "li", children: /* @__PURE__ */ jsx(
309
- Stage,
310
- {
311
- index,
312
- canDelete: stages.length > 1 && canDelete,
313
- canReorder: stages.length > 1,
314
- canUpdate,
315
- stagesCount: stages.length,
316
- defaultOpen: isCreating,
317
- ...stage
318
- }
319
- ) }, stage.__temp_key__);
320
- })
321
- }
322
- )
296
+ /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, position: "relative", tag: "ol", children: stages.map((stage, index) => {
297
+ return /* @__PURE__ */ jsx(Box, { tag: "li", children: /* @__PURE__ */ jsx(
298
+ Stage,
299
+ {
300
+ index,
301
+ canDelete: stages.length > 1 && canDelete,
302
+ canReorder: stages.length > 1,
303
+ canUpdate,
304
+ stagesCount: stages.length,
305
+ defaultOpen: isCreating,
306
+ ...stage
307
+ }
308
+ ) }, stage.__temp_key__);
309
+ }) })
323
310
  ] }),
324
311
  canUpdate && /* @__PURE__ */ jsx(
325
312
  AddStage,
@@ -436,7 +423,7 @@ const Stage = ({
436
423
  addFieldRow("stages", { name, color, permissions });
437
424
  };
438
425
  const id = React.useId();
439
- return /* @__PURE__ */ jsxs(Box, { ref: composedRef, children: [
426
+ return /* @__PURE__ */ jsxs(Box, { ref: composedRef, shadow: "tableShadow", children: [
440
427
  liveText && /* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "assertive", children: liveText }),
441
428
  isDragging ? /* @__PURE__ */ jsx(
442
429
  Box,
@@ -487,7 +474,7 @@ const Stage = ({
487
474
  {
488
475
  background: "transparent",
489
476
  hasRadius: true,
490
- borderWidth: 0,
477
+ variant: "ghost",
491
478
  "data-handler-id": handlerId,
492
479
  ref: dragRef,
493
480
  label: formatMessage({
@@ -501,7 +488,7 @@ const Stage = ({
501
488
  )
502
489
  ] }) : null })
503
490
  ] }),
504
- /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Grid, { gap: 4, padding: 6, children: [
491
+ /* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Grid.Root, { gap: 4, padding: 6, children: [
505
492
  {
506
493
  disabled: !canUpdate,
507
494
  label: formatMessage({
@@ -539,7 +526,7 @@ const Stage = ({
539
526
  size: 6,
540
527
  type: "permissions"
541
528
  }
542
- ].map(({ size, ...field }) => /* @__PURE__ */ jsx(GridItem, { col: size, children: /* @__PURE__ */ jsx(InputRenderer, { ...field }) }, field.name)) }) })
529
+ ].map(({ size, ...field }) => /* @__PURE__ */ jsx(Grid.Item, { col: size, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(InputRenderer, { ...field }) }, field.name)) }) })
543
530
  ] })
544
531
  }
545
532
  )
@@ -644,20 +631,22 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
644
631
  const { value = [], error, onChange } = useField(name);
645
632
  const allStages = useForm("PermissionsField", (state) => state.values.stages);
646
633
  const onFormValueChange = useForm("PermissionsField", (state) => state.onChange);
647
- const { data: roles = [], isLoading } = useGetAdminRolesQuery();
634
+ const rolesErrorCount = React.useRef(0);
635
+ const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
648
636
  const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
649
637
  React.useEffect(() => {
650
- if (!isLoading && roles.length === 0) {
638
+ if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
639
+ rolesErrorCount.current = 1;
651
640
  toggleNotification({
652
641
  blockTransition: true,
653
642
  type: "danger",
654
643
  message: formatMessage({
655
644
  id: "review-workflows.stage.permissions.noPermissions.description",
656
- defaultMessage: "You don’t have the permission to see roles"
645
+ defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
657
646
  })
658
647
  });
659
648
  }
660
- }, [formatMessage, isLoading, roles, toggleNotification]);
649
+ }, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
661
650
  if (!isLoading && filteredRoles.length === 0) {
662
651
  return /* @__PURE__ */ jsxs(
663
652
  Field.Root,
@@ -691,45 +680,45 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
691
680
  }
692
681
  );
693
682
  }
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
- ] }) }),
683
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-end", gap: 3, children: [
684
+ /* @__PURE__ */ jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxs(Field.Root, { error, name, required: true, children: [
685
+ /* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
686
+ id: "Settings.review-workflows.stage.permissions.label",
687
+ defaultMessage: "Roles that can change this stage"
688
+ }) }),
732
689
  /* @__PURE__ */ jsx(
690
+ MultiSelect,
691
+ {
692
+ disabled,
693
+ onChange: (values) => {
694
+ const permissions = values.map((value2) => ({
695
+ role: parseInt(value2, 10),
696
+ action: "admin::review-workflows.stage.transition"
697
+ }));
698
+ onChange(name, permissions);
699
+ },
700
+ placeholder,
701
+ value: value.map((permission) => `${permission.role}`),
702
+ withTags: true,
703
+ children: /* @__PURE__ */ jsx(
704
+ MultiSelectGroup,
705
+ {
706
+ label: formatMessage({
707
+ id: "Settings.review-workflows.stage.permissions.allRoles.label",
708
+ defaultMessage: "All roles"
709
+ }),
710
+ values: filteredRoles.map((r) => `${r.id}`),
711
+ children: filteredRoles.map((role) => {
712
+ return /* @__PURE__ */ jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
713
+ })
714
+ }
715
+ )
716
+ }
717
+ ),
718
+ /* @__PURE__ */ jsx(Field.Error, {})
719
+ ] }) }),
720
+ /* @__PURE__ */ jsxs(Dialog.Root, { open: isApplyAllConfirmationOpen, onOpenChange: setIsApplyAllConfirmationOpen, children: [
721
+ /* @__PURE__ */ jsx(Dialog.Trigger, { children: /* @__PURE__ */ jsx(
733
722
  IconButton,
734
723
  {
735
724
  disabled,
@@ -738,42 +727,38 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
738
727
  defaultMessage: "Apply to all stages"
739
728
  }),
740
729
  size: "L",
741
- variant: "secondary",
742
- onClick: () => setIsApplyAllConfirmationOpen(true),
743
730
  children: /* @__PURE__ */ jsx(Duplicate, {})
744
731
  }
732
+ ) }),
733
+ /* @__PURE__ */ jsx(
734
+ ConfirmDialog,
735
+ {
736
+ onConfirm: () => {
737
+ onFormValueChange(
738
+ "stages",
739
+ allStages.map((stage) => ({
740
+ ...stage,
741
+ permissions: value
742
+ }))
743
+ );
744
+ setIsApplyAllConfirmationOpen(false);
745
+ toggleNotification({
746
+ type: "success",
747
+ message: formatMessage({
748
+ id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
749
+ defaultMessage: "Applied roles to all other stages of the workflow"
750
+ })
751
+ });
752
+ },
753
+ variant: "default",
754
+ children: formatMessage({
755
+ id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
756
+ defaultMessage: "Roles that can change that stage will be applied to all the other stages."
757
+ })
758
+ }
745
759
  )
746
- ] }),
747
- /* @__PURE__ */ jsx(
748
- ConfirmDialog,
749
- {
750
- isOpen: isApplyAllConfirmationOpen,
751
- onClose: () => setIsApplyAllConfirmationOpen(false),
752
- onConfirm: () => {
753
- onFormValueChange(
754
- "stages",
755
- allStages.map((stage) => ({
756
- ...stage,
757
- permissions: value
758
- }))
759
- );
760
- setIsApplyAllConfirmationOpen(false);
761
- toggleNotification({
762
- type: "success",
763
- message: formatMessage({
764
- id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
765
- defaultMessage: "Applied roles to all other stages of the workflow"
766
- })
767
- });
768
- },
769
- variant: "default",
770
- children: formatMessage({
771
- id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
772
- defaultMessage: "Roles that can change that stage will be applied to all the other stages."
773
- })
774
- }
775
- )
776
- ] });
760
+ ] })
761
+ ] }) });
777
762
  };
778
763
  const NestedOption$1 = styled(MultiSelectOption)`
779
764
  padding-left: ${({ theme }) => theme.spaces[7]};
@@ -785,8 +770,8 @@ const PermissionWrapper = styled(Flex)`
785
770
  `;
786
771
  const WorkflowAttributes = ({ canUpdate = true }) => {
787
772
  const { formatMessage } = useIntl();
788
- return /* @__PURE__ */ jsxs(Grid, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
789
- /* @__PURE__ */ jsx(GridItem, { col: 6, children: /* @__PURE__ */ jsx(
773
+ return /* @__PURE__ */ jsxs(Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
774
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(
790
775
  InputRenderer$1,
791
776
  {
792
777
  disabled: !canUpdate,
@@ -799,7 +784,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
799
784
  type: "string"
800
785
  }
801
786
  ) }),
802
- /* @__PURE__ */ jsx(GridItem, { col: 6, children: /* @__PURE__ */ jsx(ContentTypesSelector, { disabled: !canUpdate }) })
787
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(ContentTypesSelector, { disabled: !canUpdate }) })
803
788
  ] });
804
789
  };
805
790
  const ContentTypesSelector = ({ disabled }) => {
@@ -908,10 +893,10 @@ const WORKFLOW_SCHEMA = yup.object({
908
893
  name: yup.string().max(255, {
909
894
  id: "review-workflows.validation.name.max-length",
910
895
  defaultMessage: "Name can not be longer than 255 characters"
911
- }).required(),
896
+ }).required().nullable(),
912
897
  stages: yup.array().of(
913
898
  yup.object().shape({
914
- name: yup.string().required({
899
+ name: yup.string().nullable().required({
915
900
  id: "review-workflows.validation.stage.name",
916
901
  defaultMessage: "Name is required"
917
902
  }).max(255, {
@@ -928,7 +913,7 @@ const WORKFLOW_SCHEMA = yup.object({
928
913
  return stages.filter((stage) => stage.name === stageName).length === 1;
929
914
  }
930
915
  ),
931
- color: yup.string().required({
916
+ color: yup.string().nullable().required({
932
917
  id: "review-workflows.validation.stage.color",
933
918
  defaultMessage: "Color is required"
934
919
  }).matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i),
@@ -954,7 +939,6 @@ const EditPage = () => {
954
939
  const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
955
940
  const navigate = useNavigate();
956
941
  const { toggleNotification } = useNotification();
957
- const dispatch = useDispatch();
958
942
  const {
959
943
  isLoading: isLoadingWorkflow,
960
944
  meta,
@@ -962,7 +946,7 @@ const EditPage = () => {
962
946
  error,
963
947
  update,
964
948
  create
965
- } = useReviewWorkflows({ id: isCreatingWorkflow ? void 0 : id });
949
+ } = useReviewWorkflows();
966
950
  const permissions = useTypedSelector(
967
951
  (state) => state.admin_app.permissions["settings"]?.["review-workflows"]
968
952
  );
@@ -1005,36 +989,13 @@ const EditPage = () => {
1005
989
  });
1006
990
  if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1007
991
  helpers.setErrors(formatValidationErrors(res.error));
1008
- } else if ("data" in res) {
1009
- for (const uid of res.data.contentTypes) {
1010
- dispatch({
1011
- type: "contentManagerApi/invalidateTags",
1012
- payload: [
1013
- {
1014
- type: "ContentTypesConfiguration",
1015
- id: uid
1016
- }
1017
- ]
1018
- });
1019
- }
1020
992
  }
1021
993
  } else {
1022
994
  const res = await create(data);
1023
995
  if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1024
996
  helpers.setErrors(formatValidationErrors(res.error));
1025
997
  } else if ("data" in res) {
1026
- for (const uid of res.data.contentTypes) {
1027
- dispatch({
1028
- type: "contentManagerApi/invalidateTags",
1029
- payload: [
1030
- {
1031
- type: "ContentTypesConfiguration",
1032
- id: uid
1033
- }
1034
- ]
1035
- });
1036
- }
1037
- navigate(`../${res.data.id}`);
998
+ navigate(`../${res.data.id}`, { replace: true });
1038
999
  }
1039
1000
  }
1040
1001
  } catch (error2) {
@@ -1156,23 +1117,22 @@ const EditPage = () => {
1156
1117
  }
1157
1118
  ),
1158
1119
  /* @__PURE__ */ jsx(Root, { children: /* @__PURE__ */ jsxs(Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
1159
- /* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate }),
1120
+ /* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
1160
1121
  /* @__PURE__ */ jsx(
1161
1122
  Stages,
1162
1123
  {
1163
1124
  canDelete,
1164
- canUpdate,
1125
+ canUpdate: canUpdate || canCreate,
1165
1126
  isCreating: isCreatingWorkflow
1166
1127
  }
1167
1128
  )
1168
1129
  ] }) }),
1169
1130
  /* @__PURE__ */ jsx(
1170
- ConfirmDialog,
1131
+ Dialog.Root,
1171
1132
  {
1172
- isOpen: Object.keys(savePrompts).length > 0,
1173
- onClose: handleConfirmClose,
1174
- onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
1175
- children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 5, children: [
1133
+ open: Object.keys(savePrompts).length > 0,
1134
+ onOpenChange: handleConfirmClose,
1135
+ children: /* @__PURE__ */ jsx(ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 5, children: [
1176
1136
  savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsx(Typography, { textAlign: "center", variant: "omega", children: formatMessage({
1177
1137
  id: "review-workflows.page.delete.confirm.stages.body",
1178
1138
  defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
@@ -1184,7 +1144,7 @@ const EditPage = () => {
1184
1144
  },
1185
1145
  {
1186
1146
  count: contentTypesFromOtherWorkflows?.filter(
1187
- (contentType) => currentWorkflow?.contentTypes?.includes(contentType)
1147
+ (contentType) => values.contentTypes.includes(contentType)
1188
1148
  ).length ?? 0
1189
1149
  }
1190
1150
  ) }),
@@ -1192,7 +1152,7 @@ const EditPage = () => {
1192
1152
  id: "review-workflows.page.delete.confirm.confirm",
1193
1153
  defaultMessage: "Are you sure you want to save?"
1194
1154
  }) })
1195
- ] })
1155
+ ] }) })
1196
1156
  }
1197
1157
  )
1198
1158
  ] })
@@ -1201,8 +1161,8 @@ const EditPage = () => {
1201
1161
  /* @__PURE__ */ jsxs(
1202
1162
  LimitsModal.Root,
1203
1163
  {
1204
- isOpen: showLimitModal === "workflow",
1205
- onClose: () => setShowLimitModal(null),
1164
+ open: showLimitModal === "workflow",
1165
+ onOpenChange: () => setShowLimitModal(null),
1206
1166
  children: [
1207
1167
  /* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
1208
1168
  id: "review-workflows.edit.page.workflows.limit.title",
@@ -1215,16 +1175,23 @@ const EditPage = () => {
1215
1175
  ]
1216
1176
  }
1217
1177
  ),
1218
- /* @__PURE__ */ jsxs(LimitsModal.Root, { isOpen: showLimitModal === "stage", onClose: () => setShowLimitModal(null), children: [
1219
- /* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
1220
- id: "review-workflows.edit.page.stages.limit.title",
1221
- defaultMessage: "You have reached the limit of stages for this workflow in your plan"
1222
- }) }),
1223
- /* @__PURE__ */ jsx(LimitsModal.Body, { children: formatMessage({
1224
- id: "review-workflows.edit.page.stages.limit.body",
1225
- defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
1226
- }) })
1227
- ] })
1178
+ /* @__PURE__ */ jsxs(
1179
+ LimitsModal.Root,
1180
+ {
1181
+ open: showLimitModal === "stage",
1182
+ onOpenChange: () => setShowLimitModal(null),
1183
+ children: [
1184
+ /* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
1185
+ id: "review-workflows.edit.page.stages.limit.title",
1186
+ defaultMessage: "You have reached the limit of stages for this workflow in your plan"
1187
+ }) }),
1188
+ /* @__PURE__ */ jsx(LimitsModal.Body, { children: formatMessage({
1189
+ id: "review-workflows.edit.page.stages.limit.body",
1190
+ defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
1191
+ }) })
1192
+ ]
1193
+ }
1194
+ )
1228
1195
  ] });
1229
1196
  };
1230
1197
  const addTmpKeysToStages = (data) => {
@@ -1248,4 +1215,4 @@ const ProtectedEditPage = () => {
1248
1215
  export {
1249
1216
  ProtectedEditPage
1250
1217
  };
1251
- //# sourceMappingURL=_id-B3jMqqMH.mjs.map
1218
+ //# sourceMappingURL=_id-6LK95-rZ.mjs.map