@strapi/review-workflows 0.0.0-experimental.f75e3c6d67cc47c64ab37479efdbb7b43be50b78 → 0.0.0-experimental.f9cac24ba3b2f6acb12d0fb5669106e5a134174e

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 (58) hide show
  1. package/LICENSE +12 -17
  2. package/dist/_chunks/{Layout-lg3hbwGL.mjs → Layout-CJZ4iUxI.mjs} +8 -9
  3. package/dist/_chunks/Layout-CJZ4iUxI.mjs.map +1 -0
  4. package/dist/_chunks/{Layout-BMqtFafC.js → Layout-D7wwT4c7.js} +8 -9
  5. package/dist/_chunks/Layout-D7wwT4c7.js.map +1 -0
  6. package/dist/_chunks/{_id-B3jMqqMH.mjs → _id-DA44l-QM.mjs} +131 -165
  7. package/dist/_chunks/_id-DA44l-QM.mjs.map +1 -0
  8. package/dist/_chunks/{_id-B853wt9z.js → _id-DgUOk637.js} +130 -164
  9. package/dist/_chunks/_id-DgUOk637.js.map +1 -0
  10. package/dist/_chunks/{index-lebOqdrv.mjs → index-C33Q2-Fc.mjs} +108 -92
  11. package/dist/_chunks/index-C33Q2-Fc.mjs.map +1 -0
  12. package/dist/_chunks/{index-BhJmjDbj.mjs → index-CnyO97Gi.mjs} +16 -44
  13. package/dist/_chunks/index-CnyO97Gi.mjs.map +1 -0
  14. package/dist/_chunks/{index-CdU1x9cZ.js → index-DL9odlOl.js} +14 -42
  15. package/dist/_chunks/index-DL9odlOl.js.map +1 -0
  16. package/dist/_chunks/{index-Ujtj1Rcp.js → index-mQar1hfK.js} +106 -90
  17. package/dist/_chunks/index-mQar1hfK.js.map +1 -0
  18. package/dist/_chunks/{router-BboD243b.js → router-B1YtLp6u.js} +3 -3
  19. package/dist/_chunks/{router-BboD243b.js.map → router-B1YtLp6u.js.map} +1 -1
  20. package/dist/_chunks/{router-CvMnSjb9.mjs → router-BFv8U71z.mjs} +3 -3
  21. package/dist/_chunks/{router-CvMnSjb9.mjs.map → router-BFv8U71z.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 +41 -62
  30. package/dist/server/index.js.map +1 -1
  31. package/dist/server/index.mjs +41 -62
  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/metrics/weekly-metrics.d.ts.map +1 -1
  45. package/dist/server/src/services/stages.d.ts +2 -7
  46. package/dist/server/src/services/stages.d.ts.map +1 -1
  47. package/dist/shared/contracts/review-workflows.d.ts +1 -14
  48. package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
  49. package/package.json +10 -10
  50. package/dist/_chunks/Layout-BMqtFafC.js.map +0 -1
  51. package/dist/_chunks/Layout-lg3hbwGL.mjs.map +0 -1
  52. package/dist/_chunks/_id-B3jMqqMH.mjs.map +0 -1
  53. package/dist/_chunks/_id-B853wt9z.js.map +0 -1
  54. package/dist/_chunks/index-BhJmjDbj.mjs.map +0 -1
  55. package/dist/_chunks/index-CdU1x9cZ.js.map +0 -1
  56. package/dist/_chunks/index-Ujtj1Rcp.js.map +0 -1
  57. package/dist/_chunks/index-lebOqdrv.mjs.map +0 -1
  58. 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-C33Q2-Fc.mjs";
12
+ import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-CJZ4iUxI.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) {
@@ -1133,7 +1094,6 @@ const EditPage = () => {
1133
1094
  {
1134
1095
  startIcon: /* @__PURE__ */ jsx(Check, {}),
1135
1096
  type: "submit",
1136
- size: "M",
1137
1097
  disabled: !modified || isSubmitting || values.stages.length === 0,
1138
1098
  loading: !Boolean(Object.keys(savePrompts).length > 0) && isSubmitting,
1139
1099
  children: formatMessage({
@@ -1156,23 +1116,22 @@ const EditPage = () => {
1156
1116
  }
1157
1117
  ),
1158
1118
  /* @__PURE__ */ jsx(Root, { children: /* @__PURE__ */ jsxs(Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
1159
- /* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate }),
1119
+ /* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
1160
1120
  /* @__PURE__ */ jsx(
1161
1121
  Stages,
1162
1122
  {
1163
1123
  canDelete,
1164
- canUpdate,
1124
+ canUpdate: canUpdate || canCreate,
1165
1125
  isCreating: isCreatingWorkflow
1166
1126
  }
1167
1127
  )
1168
1128
  ] }) }),
1169
1129
  /* @__PURE__ */ jsx(
1170
- ConfirmDialog,
1130
+ Dialog.Root,
1171
1131
  {
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: [
1132
+ open: Object.keys(savePrompts).length > 0,
1133
+ onOpenChange: handleConfirmClose,
1134
+ children: /* @__PURE__ */ jsx(ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 5, children: [
1176
1135
  savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsx(Typography, { textAlign: "center", variant: "omega", children: formatMessage({
1177
1136
  id: "review-workflows.page.delete.confirm.stages.body",
1178
1137
  defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
@@ -1184,7 +1143,7 @@ const EditPage = () => {
1184
1143
  },
1185
1144
  {
1186
1145
  count: contentTypesFromOtherWorkflows?.filter(
1187
- (contentType) => currentWorkflow?.contentTypes?.includes(contentType)
1146
+ (contentType) => values.contentTypes.includes(contentType)
1188
1147
  ).length ?? 0
1189
1148
  }
1190
1149
  ) }),
@@ -1192,7 +1151,7 @@ const EditPage = () => {
1192
1151
  id: "review-workflows.page.delete.confirm.confirm",
1193
1152
  defaultMessage: "Are you sure you want to save?"
1194
1153
  }) })
1195
- ] })
1154
+ ] }) })
1196
1155
  }
1197
1156
  )
1198
1157
  ] })
@@ -1201,8 +1160,8 @@ const EditPage = () => {
1201
1160
  /* @__PURE__ */ jsxs(
1202
1161
  LimitsModal.Root,
1203
1162
  {
1204
- isOpen: showLimitModal === "workflow",
1205
- onClose: () => setShowLimitModal(null),
1163
+ open: showLimitModal === "workflow",
1164
+ onOpenChange: () => setShowLimitModal(null),
1206
1165
  children: [
1207
1166
  /* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
1208
1167
  id: "review-workflows.edit.page.workflows.limit.title",
@@ -1215,16 +1174,23 @@ const EditPage = () => {
1215
1174
  ]
1216
1175
  }
1217
1176
  ),
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
- ] })
1177
+ /* @__PURE__ */ jsxs(
1178
+ LimitsModal.Root,
1179
+ {
1180
+ open: showLimitModal === "stage",
1181
+ onOpenChange: () => setShowLimitModal(null),
1182
+ children: [
1183
+ /* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
1184
+ id: "review-workflows.edit.page.stages.limit.title",
1185
+ defaultMessage: "You have reached the limit of stages for this workflow in your plan"
1186
+ }) }),
1187
+ /* @__PURE__ */ jsx(LimitsModal.Body, { children: formatMessage({
1188
+ id: "review-workflows.edit.page.stages.limit.body",
1189
+ defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
1190
+ }) })
1191
+ ]
1192
+ }
1193
+ )
1228
1194
  ] });
1229
1195
  };
1230
1196
  const addTmpKeysToStages = (data) => {
@@ -1248,4 +1214,4 @@ const ProtectedEditPage = () => {
1248
1214
  export {
1249
1215
  ProtectedEditPage
1250
1216
  };
1251
- //# sourceMappingURL=_id-B3jMqqMH.mjs.map
1217
+ //# sourceMappingURL=_id-DA44l-QM.mjs.map