@strapi/review-workflows 5.0.0-rc.3 → 5.0.0-rc.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{Layout-Da8jupiA.mjs → Layout-BJOxxAeM.mjs} +7 -8
- package/dist/_chunks/Layout-BJOxxAeM.mjs.map +1 -0
- package/dist/_chunks/{Layout-D3DDQmMI.js → Layout-DnEAvmeU.js} +7 -8
- package/dist/_chunks/Layout-DnEAvmeU.js.map +1 -0
- package/dist/_chunks/{_id-xSrgPSJs.mjs → _id-6LK95-rZ.mjs} +13 -39
- package/dist/_chunks/_id-6LK95-rZ.mjs.map +1 -0
- package/dist/_chunks/{_id-CnRDP3Xx.js → _id-DSDzUpwX.js} +13 -39
- package/dist/_chunks/_id-DSDzUpwX.js.map +1 -0
- package/dist/_chunks/{index-4kp4AkBB.js → index-6FZL88pd.js} +9 -29
- package/dist/_chunks/index-6FZL88pd.js.map +1 -0
- package/dist/_chunks/{index-DhPxWpsW.js → index-DZSLya4b.js} +78 -64
- package/dist/_chunks/index-DZSLya4b.js.map +1 -0
- package/dist/_chunks/{index-jfO5GxtW.mjs → index-Df1alkCk.mjs} +11 -31
- package/dist/_chunks/index-Df1alkCk.mjs.map +1 -0
- package/dist/_chunks/{index-DDsJlZQw.mjs → index-lJqpw8bs.mjs} +79 -65
- package/dist/_chunks/index-lJqpw8bs.mjs.map +1 -0
- package/dist/_chunks/{router-DSXpeew4.js → router-CZqe-02r.js} +3 -3
- package/dist/_chunks/{router-DSXpeew4.js.map → router-CZqe-02r.js.map} +1 -1
- package/dist/_chunks/{router-DOEULOpS.mjs → router-DeSH-NeW.mjs} +3 -3
- package/dist/_chunks/{router-DOEULOpS.mjs.map → router-DeSH-NeW.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/services/admin.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/content-manager.d.ts +4 -4
- package/dist/admin/src/services/settings.d.ts +1733 -7
- package/dist/server/index.js +35 -61
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +35 -61
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/assignees.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts +0 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/stages.d.ts.map +1 -1
- package/dist/server/src/controllers/workflows.d.ts +0 -7
- package/dist/server/src/controllers/workflows.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +1 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/review-workflows.d.ts.map +1 -1
- package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +1 -1
- package/dist/server/src/services/stages.d.ts +2 -7
- package/dist/server/src/services/stages.d.ts.map +1 -1
- package/dist/shared/contracts/review-workflows.d.ts +1 -14
- package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/_chunks/Layout-D3DDQmMI.js.map +0 -1
- package/dist/_chunks/Layout-Da8jupiA.mjs.map +0 -1
- package/dist/_chunks/_id-CnRDP3Xx.js.map +0 -1
- package/dist/_chunks/_id-xSrgPSJs.mjs.map +0 -1
- package/dist/_chunks/index-4kp4AkBB.js.map +0 -1
- package/dist/_chunks/index-DDsJlZQw.mjs.map +0 -1
- package/dist/_chunks/index-DhPxWpsW.js.map +0 -1
- package/dist/_chunks/index-jfO5GxtW.mjs.map +0 -1
- package/strapi-server.js +0 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useNotification, useAPIErrorHandler, Page, Layouts } from "@strapi/admin/strapi-admin";
|
|
3
3
|
import { useIntl } from "react-intl";
|
|
4
|
-
import { c as useGetWorkflowsQuery, d as useCreateWorkflowMutation, e as useUpdateWorkflowMutation, f as useDeleteWorkflowMutation } from "./index-
|
|
4
|
+
import { c as useGetWorkflowsQuery, d as useCreateWorkflowMutation, e as useUpdateWorkflowMutation, f as useDeleteWorkflowMutation } from "./index-lJqpw8bs.mjs";
|
|
5
5
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
6
6
|
import { Flex, Typography, Box } from "@strapi/design-system";
|
|
7
7
|
import { useDragLayer } from "react-dnd";
|
|
@@ -14,10 +14,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
14
14
|
const { toggleNotification } = useNotification();
|
|
15
15
|
const { formatMessage } = useIntl();
|
|
16
16
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
|
17
|
-
const {
|
|
17
|
+
const { skip = false, ...queryParams } = params;
|
|
18
18
|
const { data, isLoading, error } = useGetWorkflowsQuery(
|
|
19
19
|
{
|
|
20
|
-
id,
|
|
21
20
|
populate: "stages",
|
|
22
21
|
...queryParams
|
|
23
22
|
},
|
|
@@ -62,9 +61,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
62
61
|
);
|
|
63
62
|
const [updateWorkflow] = useUpdateWorkflowMutation();
|
|
64
63
|
const update = React.useCallback(
|
|
65
|
-
async (
|
|
64
|
+
async (id, data2) => {
|
|
66
65
|
try {
|
|
67
|
-
const res = await updateWorkflow({ id
|
|
66
|
+
const res = await updateWorkflow({ id, data: data2 });
|
|
68
67
|
if ("error" in res) {
|
|
69
68
|
toggleNotification({
|
|
70
69
|
type: "danger",
|
|
@@ -89,9 +88,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
89
88
|
);
|
|
90
89
|
const [deleteWorkflow] = useDeleteWorkflowMutation();
|
|
91
90
|
const deleteAction = React.useCallback(
|
|
92
|
-
async (
|
|
91
|
+
async (id) => {
|
|
93
92
|
try {
|
|
94
|
-
const res = await deleteWorkflow({ id
|
|
93
|
+
const res = await deleteWorkflow({ id });
|
|
95
94
|
if ("error" in res) {
|
|
96
95
|
toggleNotification({
|
|
97
96
|
type: "danger",
|
|
@@ -231,4 +230,4 @@ export {
|
|
|
231
230
|
DragLayerRendered as a,
|
|
232
231
|
useReviewWorkflows as u
|
|
233
232
|
};
|
|
234
|
-
//# sourceMappingURL=Layout-
|
|
233
|
+
//# sourceMappingURL=Layout-BJOxxAeM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout-BJOxxAeM.mjs","sources":["../../admin/src/routes/settings/hooks/useReviewWorkflows.ts","../../admin/src/routes/settings/constants.ts","../../admin/src/routes/settings/components/StageDragPreview.tsx","../../admin/src/routes/settings/components/Layout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useAPIErrorHandler, useNotification } from '@strapi/admin/strapi-admin';\nimport { type MessageDescriptor, useIntl } from 'react-intl';\n\nimport {\n GetWorkflowsParams,\n useCreateWorkflowMutation,\n useDeleteWorkflowMutation,\n useGetWorkflowsQuery,\n useUpdateWorkflowMutation,\n} from '../../../services/settings';\n\nimport type { Create, Update } from '../../../../../shared/contracts/review-workflows';\n\nconst DEFAULT_UNEXPECTED_ERROR_MSG = {\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n} satisfies MessageDescriptor;\n\ntype UseReviewWorkflowsArgs = GetWorkflowsParams & {\n skip?: boolean;\n};\n\nconst useReviewWorkflows = (params: UseReviewWorkflowsArgs = {}) => {\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const { skip = false, ...queryParams } = params;\n\n const { data, isLoading, error } = useGetWorkflowsQuery(\n {\n populate: 'stages',\n ...queryParams,\n },\n {\n skip,\n }\n );\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n const [createWorkflow] = useCreateWorkflowMutation();\n const create = React.useCallback(\n async (data: Create.Request['body']['data']) => {\n try {\n const res = await createWorkflow({ data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.created', defaultMessage: 'Created workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [createWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const [updateWorkflow] = useUpdateWorkflowMutation();\n const update = React.useCallback(\n async (id: string, data: Update.Request['body']['data']) => {\n try {\n const res = await updateWorkflow({ id, data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.updated', defaultMessage: 'Updated workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [formatAPIError, formatMessage, toggleNotification, updateWorkflow]\n );\n\n const [deleteWorkflow] = useDeleteWorkflowMutation();\n const deleteAction = React.useCallback(\n async (id: string) => {\n try {\n const res = await deleteWorkflow({ id });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.deleted', defaultMessage: 'Deleted workflow' }),\n });\n\n return res.data;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [deleteWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const { workflows = [], meta } = data ?? {};\n\n return {\n // meta contains e.g. the total of all workflows. we can not use\n // the pagination object here, because the list is not paginated.\n meta,\n workflows,\n isLoading,\n error,\n create,\n delete: deleteAction,\n update,\n };\n};\n\nexport { useReviewWorkflows };\n","export type DragDropTypes = 'stage';\n\nexport const DRAG_DROP_TYPES: Record<Uppercase<DragDropTypes>, DragDropTypes> = {\n STAGE: 'stage',\n};\n","import { Flex, Typography } from '@strapi/design-system';\nimport { CaretDown } from '@strapi/icons';\n\ninterface StageDragPreviewType {\n name: string | null;\n}\n\nconst StageDragPreview = ({ name }: StageDragPreviewType) => {\n return (\n <Flex\n background=\"primary100\"\n borderStyle=\"dashed\"\n borderColor=\"primary600\"\n borderWidth=\"1px\"\n gap={3}\n hasRadius\n padding={3}\n shadow=\"tableShadow\"\n width=\"30rem\"\n >\n <Flex\n alignItems=\"center\"\n background=\"neutral200\"\n borderRadius=\"50%\"\n height={6}\n justifyContent=\"center\"\n width={6}\n >\n <CaretDown width=\"0.8rem\" fill=\"neutral600\" />\n </Flex>\n\n <Typography fontWeight=\"bold\">{name}</Typography>\n </Flex>\n );\n};\n\nexport { StageDragPreview };\nexport type { StageDragPreviewType };\n","import * as React from 'react';\n\nimport { Page, Layouts } from '@strapi/admin/strapi-admin';\nimport { Box } from '@strapi/design-system';\nimport { XYCoord, useDragLayer } from 'react-dnd';\nimport { useIntl } from 'react-intl';\n\nimport { DRAG_DROP_TYPES } from '../constants';\n\nimport { StageDragPreview } from './StageDragPreview';\n\nfunction getStyle(\n initialOffset: XYCoord | null,\n currentOffset: XYCoord | null,\n mouseOffset: XYCoord | null\n) {\n if (!initialOffset || !currentOffset || !mouseOffset) {\n return { display: 'none' };\n }\n\n const { x, y } = mouseOffset;\n\n return {\n transform: `translate(${x}px, ${y}px)`,\n };\n}\n\nconst DragLayerRendered = () => {\n const { itemType, isDragging, item, initialOffset, currentOffset, mouseOffset } = useDragLayer(\n (monitor) => ({\n item: monitor.getItem(),\n itemType: monitor.getItemType(),\n initialOffset: monitor.getInitialSourceClientOffset(),\n currentOffset: monitor.getSourceClientOffset(),\n isDragging: monitor.isDragging(),\n mouseOffset: monitor.getClientOffset(),\n })\n );\n\n if (!isDragging || itemType !== DRAG_DROP_TYPES.STAGE) {\n return null;\n }\n\n return (\n <Box\n height=\"100%\"\n left={0}\n position=\"fixed\"\n pointerEvents=\"none\"\n top={0}\n zIndex={100}\n width=\"100%\"\n >\n <Box style={getStyle(initialOffset, currentOffset, mouseOffset)}>\n <StageDragPreview name={typeof item.item === 'string' ? item.item : null} />;\n </Box>\n </Box>\n );\n};\n\nconst Root: React.FC<React.PropsWithChildren> = ({ children }) => {\n return (\n <Page.Main>\n <Layouts.Content>{children}</Layouts.Content>\n </Page.Main>\n );\n};\n\ninterface HeaderProps {\n title: string;\n navigationAction?: React.ReactNode;\n primaryAction?: React.ReactNode;\n secondaryAction?: React.ReactNode;\n subtitle?: React.ReactNode;\n}\n\nconst Header: React.FC<HeaderProps> = ({ title, subtitle, navigationAction, primaryAction }) => {\n const { formatMessage } = useIntl();\n return (\n <>\n <Page.Title>\n {formatMessage(\n { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },\n {\n name: title,\n }\n )}\n </Page.Title>\n <Layouts.BaseHeader\n navigationAction={navigationAction}\n primaryAction={primaryAction}\n title={title}\n subtitle={subtitle}\n />\n </>\n );\n};\n\nexport { DragLayerRendered, Header, Root };\n"],"names":["data"],"mappings":";;;;;;;;AAeA,MAAM,+BAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,gBAAgB;AAClB;AAMA,MAAM,qBAAqB,CAAC,SAAiC,OAAO;AAC5D,QAAA,EAAE,uBAAuB;AACzB,QAAA,EAAE,kBAAkB;AAC1B,QAAM,EAAE,yBAAyB,eAAe,IAAI,mBAAmB;AAEvE,QAAM,EAAE,OAAO,OAAO,GAAG,gBAAgB;AAEzC,QAAM,EAAE,MAAM,WAAW,MAAU,IAAA;AAAA,IACjC;AAAA,MACE,UAAU;AAAA,MACV,GAAG;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,IACF;AAAA,EAAA;AAGF,QAAM,UAAU,MAAM;AACpB,QAAI,OAAO;AACU,yBAAA;AAAA,QACjB,MAAM;AAAA,QACN,SAAS,eAAe,KAAK;AAAA,MAAA,CAC9B;AA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MAAL,EACC,8BAAC,QAAQ,SAAR,EAAiB,SAAS,CAAA,EAC7B,CAAA;AAEJ;AAUA,MAAM,SAAgC,CAAC,EAAE,OAAO,UAAU,kBAAkB,oBAAoB;AACxF,QAAA,EAAE,kBAAkB;AAC1B,SAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAC,oBAAA,KAAK,OAAL,EACE,UAAA;AAAA,MACC,EAAE,IAAI,sBAAsB,gBAAgB,oBAAoB;AAAA,MAChE;AAAA,QACE,MAAM;AAAA,MACR;AAAA,IAAA,GAEJ;AAAA,IACA;AAAA,MAAC,QAAQ;AAAA,MAAR;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const React = require("react");
|
|
3
3
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
4
4
|
const reactIntl = require("react-intl");
|
|
5
|
-
const index = require("./index-
|
|
5
|
+
const index = require("./index-DZSLya4b.js");
|
|
6
6
|
const jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
const designSystem = require("@strapi/design-system");
|
|
8
8
|
const reactDnd = require("react-dnd");
|
|
@@ -34,10 +34,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
34
34
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
35
35
|
const { formatMessage } = reactIntl.useIntl();
|
|
36
36
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
37
|
-
const {
|
|
37
|
+
const { skip = false, ...queryParams } = params;
|
|
38
38
|
const { data, isLoading, error } = index.useGetWorkflowsQuery(
|
|
39
39
|
{
|
|
40
|
-
id,
|
|
41
40
|
populate: "stages",
|
|
42
41
|
...queryParams
|
|
43
42
|
},
|
|
@@ -82,9 +81,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
82
81
|
);
|
|
83
82
|
const [updateWorkflow] = index.useUpdateWorkflowMutation();
|
|
84
83
|
const update = React__namespace.useCallback(
|
|
85
|
-
async (
|
|
84
|
+
async (id, data2) => {
|
|
86
85
|
try {
|
|
87
|
-
const res = await updateWorkflow({ id
|
|
86
|
+
const res = await updateWorkflow({ id, data: data2 });
|
|
88
87
|
if ("error" in res) {
|
|
89
88
|
toggleNotification({
|
|
90
89
|
type: "danger",
|
|
@@ -109,9 +108,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
109
108
|
);
|
|
110
109
|
const [deleteWorkflow] = index.useDeleteWorkflowMutation();
|
|
111
110
|
const deleteAction = React__namespace.useCallback(
|
|
112
|
-
async (
|
|
111
|
+
async (id) => {
|
|
113
112
|
try {
|
|
114
|
-
const res = await deleteWorkflow({ id
|
|
113
|
+
const res = await deleteWorkflow({ id });
|
|
115
114
|
if ("error" in res) {
|
|
116
115
|
toggleNotification({
|
|
117
116
|
type: "danger",
|
|
@@ -249,4 +248,4 @@ exports.DragLayerRendered = DragLayerRendered;
|
|
|
249
248
|
exports.Header = Header;
|
|
250
249
|
exports.Root = Root;
|
|
251
250
|
exports.useReviewWorkflows = useReviewWorkflows;
|
|
252
|
-
//# sourceMappingURL=Layout-
|
|
251
|
+
//# sourceMappingURL=Layout-DnEAvmeU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout-DnEAvmeU.js","sources":["../../admin/src/routes/settings/hooks/useReviewWorkflows.ts","../../admin/src/routes/settings/constants.ts","../../admin/src/routes/settings/components/StageDragPreview.tsx","../../admin/src/routes/settings/components/Layout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useAPIErrorHandler, useNotification } from '@strapi/admin/strapi-admin';\nimport { type MessageDescriptor, useIntl } from 'react-intl';\n\nimport {\n GetWorkflowsParams,\n useCreateWorkflowMutation,\n useDeleteWorkflowMutation,\n useGetWorkflowsQuery,\n useUpdateWorkflowMutation,\n} from '../../../services/settings';\n\nimport type { Create, Update } from '../../../../../shared/contracts/review-workflows';\n\nconst DEFAULT_UNEXPECTED_ERROR_MSG = {\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n} satisfies MessageDescriptor;\n\ntype UseReviewWorkflowsArgs = GetWorkflowsParams & {\n skip?: boolean;\n};\n\nconst useReviewWorkflows = (params: UseReviewWorkflowsArgs = {}) => {\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const { skip = false, ...queryParams } = params;\n\n const { data, isLoading, error } = useGetWorkflowsQuery(\n {\n populate: 'stages',\n ...queryParams,\n },\n {\n skip,\n }\n );\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n const [createWorkflow] = useCreateWorkflowMutation();\n const create = React.useCallback(\n async (data: Create.Request['body']['data']) => {\n try {\n const res = await createWorkflow({ data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.created', defaultMessage: 'Created workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [createWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const [updateWorkflow] = useUpdateWorkflowMutation();\n const update = React.useCallback(\n async (id: string, data: Update.Request['body']['data']) => {\n try {\n const res = await updateWorkflow({ id, data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.updated', defaultMessage: 'Updated workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [formatAPIError, formatMessage, toggleNotification, updateWorkflow]\n );\n\n const [deleteWorkflow] = useDeleteWorkflowMutation();\n const deleteAction = React.useCallback(\n async (id: string) => {\n try {\n const res = await deleteWorkflow({ id });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.deleted', defaultMessage: 'Deleted workflow' }),\n });\n\n return res.data;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [deleteWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const { workflows = [], meta } = data ?? {};\n\n return {\n // meta contains e.g. the total of all workflows. we can not use\n // the pagination object here, because the list is not paginated.\n meta,\n workflows,\n isLoading,\n error,\n create,\n delete: deleteAction,\n update,\n };\n};\n\nexport { useReviewWorkflows };\n","export type DragDropTypes = 'stage';\n\nexport const DRAG_DROP_TYPES: Record<Uppercase<DragDropTypes>, DragDropTypes> = {\n STAGE: 'stage',\n};\n","import { Flex, Typography } from '@strapi/design-system';\nimport { CaretDown } from '@strapi/icons';\n\ninterface StageDragPreviewType {\n name: string | null;\n}\n\nconst StageDragPreview = ({ name }: StageDragPreviewType) => {\n return (\n <Flex\n background=\"primary100\"\n borderStyle=\"dashed\"\n borderColor=\"primary600\"\n borderWidth=\"1px\"\n gap={3}\n hasRadius\n padding={3}\n shadow=\"tableShadow\"\n width=\"30rem\"\n >\n <Flex\n alignItems=\"center\"\n background=\"neutral200\"\n borderRadius=\"50%\"\n height={6}\n justifyContent=\"center\"\n width={6}\n >\n <CaretDown width=\"0.8rem\" fill=\"neutral600\" />\n </Flex>\n\n <Typography fontWeight=\"bold\">{name}</Typography>\n </Flex>\n );\n};\n\nexport { StageDragPreview };\nexport type { StageDragPreviewType };\n","import * as React from 'react';\n\nimport { Page, Layouts } from '@strapi/admin/strapi-admin';\nimport { Box } from '@strapi/design-system';\nimport { XYCoord, useDragLayer } from 'react-dnd';\nimport { useIntl } from 'react-intl';\n\nimport { DRAG_DROP_TYPES } from '../constants';\n\nimport { StageDragPreview } from './StageDragPreview';\n\nfunction getStyle(\n initialOffset: XYCoord | null,\n currentOffset: XYCoord | null,\n mouseOffset: XYCoord | null\n) {\n if (!initialOffset || !currentOffset || !mouseOffset) {\n return { display: 'none' };\n }\n\n const { x, y } = mouseOffset;\n\n return {\n transform: `translate(${x}px, ${y}px)`,\n };\n}\n\nconst DragLayerRendered = () => {\n const { itemType, isDragging, item, initialOffset, currentOffset, mouseOffset } = useDragLayer(\n (monitor) => ({\n item: monitor.getItem(),\n itemType: monitor.getItemType(),\n initialOffset: monitor.getInitialSourceClientOffset(),\n currentOffset: monitor.getSourceClientOffset(),\n isDragging: monitor.isDragging(),\n mouseOffset: monitor.getClientOffset(),\n })\n );\n\n if (!isDragging || itemType !== DRAG_DROP_TYPES.STAGE) {\n return null;\n }\n\n return (\n <Box\n height=\"100%\"\n left={0}\n position=\"fixed\"\n pointerEvents=\"none\"\n top={0}\n zIndex={100}\n width=\"100%\"\n >\n <Box style={getStyle(initialOffset, currentOffset, mouseOffset)}>\n <StageDragPreview name={typeof item.item === 'string' ? item.item : null} />;\n </Box>\n </Box>\n );\n};\n\nconst Root: React.FC<React.PropsWithChildren> = ({ children }) => {\n return (\n <Page.Main>\n <Layouts.Content>{children}</Layouts.Content>\n </Page.Main>\n );\n};\n\ninterface HeaderProps {\n title: string;\n navigationAction?: React.ReactNode;\n primaryAction?: React.ReactNode;\n secondaryAction?: React.ReactNode;\n subtitle?: React.ReactNode;\n}\n\nconst Header: React.FC<HeaderProps> = ({ title, subtitle, navigationAction, primaryAction }) => {\n const { formatMessage } = useIntl();\n return (\n <>\n <Page.Title>\n {formatMessage(\n { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },\n {\n name: title,\n }\n )}\n </Page.Title>\n <Layouts.BaseHeader\n navigationAction={navigationAction}\n primaryAction={primaryAction}\n title={title}\n subtitle={subtitle}\n />\n </>\n );\n};\n\nexport { DragLayerRendered, Header, Root };\n"],"names":["useNotification","useIntl","useAPIErrorHandler","useGetWorkflowsQuery","React","useCreateWorkflowMutation","data","useUpdateWorkflowMutation","useDeleteWorkflowMutation","jsxs","Flex","jsx","CaretDown","Typography","useDragLayer","Box","Page","Layouts","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,+BAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,gBAAgB;AAClB;AAMA,MAAM,qBAAqB,CAAC,SAAiC,OAAO;AAC5D,QAAA,EAAE,uBAAuBA,YAAAA;AACzB,QAAA,EAAE,kBAAkBC,UAAAA;AAC1B,QAAM,EAAE,yBAAyB,eAAe,IAAIC,YAAmB,mBAAA;AAEvE,QAAM,EAAE,OAAO,OAAO,GAAG,gBAAgB;AAEzC,QAAM,EAAE,MAAM,WAAW,MAAU,IAAAC,MAAA;AAAA,IACjC;AAAA,MACE,UAAU;AAAA,MACV,GAAG;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,IACF;AAAA,EAAA;AAGFC,mBAAM,UAAU,MAAM;AACpB,QAAI,OAAO;AACU,yBAAA;AAAA,QACjB,MAAM;AAAA,QACN,SAAS,eAAe,KAAK;AAAA,MAAA,CAC9B;AAAA,IACH;AAAA,EACC,GAAA,CAAC,OAAO,gBAAgB,kBAAkB,CAAC;AAExC,QAAA,CAAC,cAAc,IAAIC,MAAAA;AACzB,QAAM,SAASD,iBAAM;AAAA,IACnB,OAAOE,UAAyC;AAC1C,UAAA;AACF,cAAM,MAAM,MAAM,eAAe,EAAE,MAAAA,MAAM,CAAA;AAEzC,YAAI,WAAW,KAAK;AACC,6BAAA;AAAA,YACjB,MAAM;AAAA,YACN,SAAS,eAAe,IAAI,KAAK;AAAA,UAAA,CAClC;AAEM,iBAAA;AAAA,QACT;AAEmB,2BAAA;AAAA,UACjB,MAAM;AAAA,UACN,SAAS,cAAc,EAA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A,MACC,EAAE,IAAI,sBAAsB,gBAAgB,oBAAoB;AAAA,MAChE;AAAA,QACE,MAAM;AAAA,MACR;AAAA,IAAA,GAEJ;AAAA,IACAL,2BAAA;AAAA,MAACM,YAAAA,QAAQ;AAAA,MAAR;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ;;;;;;"}
|
|
@@ -6,11 +6,10 @@ import { Box, Typography, Flex, Accordion, MenuItem, Menu, MultiSelectOption, us
|
|
|
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-
|
|
13
|
-
import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-
|
|
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";
|
|
@@ -475,7 +474,7 @@ const Stage = ({
|
|
|
475
474
|
{
|
|
476
475
|
background: "transparent",
|
|
477
476
|
hasRadius: true,
|
|
478
|
-
|
|
477
|
+
variant: "ghost",
|
|
479
478
|
"data-handler-id": handlerId,
|
|
480
479
|
ref: dragRef,
|
|
481
480
|
label: formatMessage({
|
|
@@ -527,7 +526,7 @@ const Stage = ({
|
|
|
527
526
|
size: 6,
|
|
528
527
|
type: "permissions"
|
|
529
528
|
}
|
|
530
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsx(Grid.Item, { 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)) }) })
|
|
531
530
|
] })
|
|
532
531
|
}
|
|
533
532
|
)
|
|
@@ -728,7 +727,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
728
727
|
defaultMessage: "Apply to all stages"
|
|
729
728
|
}),
|
|
730
729
|
size: "L",
|
|
731
|
-
variant: "secondary",
|
|
732
730
|
children: /* @__PURE__ */ jsx(Duplicate, {})
|
|
733
731
|
}
|
|
734
732
|
) }),
|
|
@@ -773,7 +771,7 @@ const PermissionWrapper = styled(Flex)`
|
|
|
773
771
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
774
772
|
const { formatMessage } = useIntl();
|
|
775
773
|
return /* @__PURE__ */ jsxs(Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
776
|
-
/* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(
|
|
774
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(
|
|
777
775
|
InputRenderer$1,
|
|
778
776
|
{
|
|
779
777
|
disabled: !canUpdate,
|
|
@@ -786,7 +784,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
786
784
|
type: "string"
|
|
787
785
|
}
|
|
788
786
|
) }),
|
|
789
|
-
/* @__PURE__ */ jsx(Grid.Item, { 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 }) })
|
|
790
788
|
] });
|
|
791
789
|
};
|
|
792
790
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -895,10 +893,10 @@ const WORKFLOW_SCHEMA = yup.object({
|
|
|
895
893
|
name: yup.string().max(255, {
|
|
896
894
|
id: "review-workflows.validation.name.max-length",
|
|
897
895
|
defaultMessage: "Name can not be longer than 255 characters"
|
|
898
|
-
}).required(),
|
|
896
|
+
}).required().nullable(),
|
|
899
897
|
stages: yup.array().of(
|
|
900
898
|
yup.object().shape({
|
|
901
|
-
name: yup.string().required({
|
|
899
|
+
name: yup.string().nullable().required({
|
|
902
900
|
id: "review-workflows.validation.stage.name",
|
|
903
901
|
defaultMessage: "Name is required"
|
|
904
902
|
}).max(255, {
|
|
@@ -915,7 +913,7 @@ const WORKFLOW_SCHEMA = yup.object({
|
|
|
915
913
|
return stages.filter((stage) => stage.name === stageName).length === 1;
|
|
916
914
|
}
|
|
917
915
|
),
|
|
918
|
-
color: yup.string().required({
|
|
916
|
+
color: yup.string().nullable().required({
|
|
919
917
|
id: "review-workflows.validation.stage.color",
|
|
920
918
|
defaultMessage: "Color is required"
|
|
921
919
|
}).matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i),
|
|
@@ -941,7 +939,6 @@ const EditPage = () => {
|
|
|
941
939
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
|
942
940
|
const navigate = useNavigate();
|
|
943
941
|
const { toggleNotification } = useNotification();
|
|
944
|
-
const dispatch = useDispatch();
|
|
945
942
|
const {
|
|
946
943
|
isLoading: isLoadingWorkflow,
|
|
947
944
|
meta,
|
|
@@ -949,7 +946,7 @@ const EditPage = () => {
|
|
|
949
946
|
error,
|
|
950
947
|
update,
|
|
951
948
|
create
|
|
952
|
-
} = useReviewWorkflows(
|
|
949
|
+
} = useReviewWorkflows();
|
|
953
950
|
const permissions = useTypedSelector(
|
|
954
951
|
(state) => state.admin_app.permissions["settings"]?.["review-workflows"]
|
|
955
952
|
);
|
|
@@ -992,36 +989,13 @@ const EditPage = () => {
|
|
|
992
989
|
});
|
|
993
990
|
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
994
991
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
995
|
-
} else if ("data" in res) {
|
|
996
|
-
for (const uid of res.data.contentTypes) {
|
|
997
|
-
dispatch({
|
|
998
|
-
type: "contentManagerApi/invalidateTags",
|
|
999
|
-
payload: [
|
|
1000
|
-
{
|
|
1001
|
-
type: "ContentTypesConfiguration",
|
|
1002
|
-
id: uid
|
|
1003
|
-
}
|
|
1004
|
-
]
|
|
1005
|
-
});
|
|
1006
|
-
}
|
|
1007
992
|
}
|
|
1008
993
|
} else {
|
|
1009
994
|
const res = await create(data);
|
|
1010
995
|
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1011
996
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1012
997
|
} else if ("data" in res) {
|
|
1013
|
-
|
|
1014
|
-
dispatch({
|
|
1015
|
-
type: "contentManagerApi/invalidateTags",
|
|
1016
|
-
payload: [
|
|
1017
|
-
{
|
|
1018
|
-
type: "ContentTypesConfiguration",
|
|
1019
|
-
id: uid
|
|
1020
|
-
}
|
|
1021
|
-
]
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
navigate(`../${res.data.id}`);
|
|
998
|
+
navigate(`../${res.data.id}`, { replace: true });
|
|
1025
999
|
}
|
|
1026
1000
|
}
|
|
1027
1001
|
} catch (error2) {
|
|
@@ -1170,7 +1144,7 @@ const EditPage = () => {
|
|
|
1170
1144
|
},
|
|
1171
1145
|
{
|
|
1172
1146
|
count: contentTypesFromOtherWorkflows?.filter(
|
|
1173
|
-
(contentType) =>
|
|
1147
|
+
(contentType) => values.contentTypes.includes(contentType)
|
|
1174
1148
|
).length ?? 0
|
|
1175
1149
|
}
|
|
1176
1150
|
) }),
|
|
@@ -1241,4 +1215,4 @@ const ProtectedEditPage = () => {
|
|
|
1241
1215
|
export {
|
|
1242
1216
|
ProtectedEditPage
|
|
1243
1217
|
};
|
|
1244
|
-
//# sourceMappingURL=_id-
|
|
1218
|
+
//# sourceMappingURL=_id-6LK95-rZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_id-6LK95-rZ.mjs","sources":["../../admin/src/services/admin.ts","../../admin/src/routes/settings/hooks/useKeyboardDragAndDrop.ts","../../admin/src/routes/settings/hooks/useDragAndDrop.ts","../../admin/src/routes/settings/components/AddStage.tsx","../../admin/src/routes/settings/components/Stages.tsx","../../admin/src/routes/settings/components/WorkflowAttributes.tsx","../../admin/src/routes/settings/:id.tsx"],"sourcesContent":["import { SanitizedAdminUser } from '@strapi/admin/strapi-admin';\n\nimport { reviewWorkflowsApi } from './api';\n\ntype Roles = SanitizedAdminUser['roles'];\ntype RolesResponse = { data: Roles };\n\nconst adminApi = reviewWorkflowsApi.injectEndpoints({\n endpoints(builder) {\n return {\n getAdminRoles: builder.query<Roles, void>({\n query: () => ({\n url: `/admin/roles`,\n method: 'GET',\n }),\n transformResponse: (res: RolesResponse) => {\n return res.data;\n },\n }),\n };\n },\n});\n\nconst { useGetAdminRolesQuery } = adminApi;\n\nexport { useGetAdminRolesQuery };\nexport type { SanitizedAdminUser, Roles };\n","import * as React from 'react';\n\nexport type UseKeyboardDragAndDropCallbacks<TIndex extends number | Array<number> = number> = {\n onCancel?: (index: TIndex) => void;\n onDropItem?: (currentIndex: TIndex, newIndex?: TIndex) => void;\n onGrabItem?: (index: TIndex) => void;\n onMoveItem?: (newIndex: TIndex, currentIndex: TIndex) => void;\n};\n\n/**\n * Utility hook designed to implement keyboard accessibile drag and drop by\n * returning an onKeyDown handler to be passed to the drag icon button.\n *\n * @internal - You should use `useDragAndDrop` instead.\n */\nexport const useKeyboardDragAndDrop = <TIndex extends number | Array<number> = number>(\n active: boolean,\n index: TIndex,\n { onCancel, onDropItem, onGrabItem, onMoveItem }: UseKeyboardDragAndDropCallbacks<TIndex>\n) => {\n const [isSelected, setIsSelected] = React.useState(false);\n\n const handleMove = (movement: 'UP' | 'DOWN') => {\n if (!isSelected) {\n return;\n }\n if (typeof index === 'number' && onMoveItem) {\n if (movement === 'UP') {\n onMoveItem((index - 1) as TIndex, index);\n } else if (movement === 'DOWN') {\n onMoveItem((index + 1) as TIndex, index);\n }\n }\n };\n\n const handleDragClick = () => {\n if (isSelected) {\n if (onDropItem) {\n onDropItem(index);\n }\n setIsSelected(false);\n } else {\n if (onGrabItem) {\n onGrabItem(index);\n }\n setIsSelected(true);\n }\n };\n\n const handleCancel = () => {\n if (isSelected) {\n setIsSelected(false);\n\n if (onCancel) {\n onCancel(index);\n }\n }\n };\n\n const handleKeyDown = <E extends Element>(e: React.KeyboardEvent<E>) => {\n if (!active) {\n return;\n }\n\n if (e.key === 'Tab' && !isSelected) {\n return;\n }\n\n e.preventDefault();\n\n switch (e.key) {\n case ' ':\n case 'Enter':\n handleDragClick();\n break;\n\n case 'Escape':\n handleCancel();\n break;\n\n case 'ArrowDown':\n case 'ArrowRight':\n handleMove('DOWN');\n break;\n\n case 'ArrowUp':\n case 'ArrowLeft':\n handleMove('UP');\n break;\n\n default:\n }\n };\n\n return handleKeyDown;\n};\n","import * as React from 'react';\n\nimport {\n useDrag,\n useDrop,\n type HandlerManager,\n type ConnectDragSource,\n type ConnectDropTarget,\n type ConnectDragPreview,\n type DragSourceMonitor,\n} from 'react-dnd';\n\nimport {\n useKeyboardDragAndDrop,\n type UseKeyboardDragAndDropCallbacks,\n} from './useKeyboardDragAndDrop';\n\nimport type { Data } from '@strapi/types';\n\nconst DIRECTIONS = {\n UPWARD: 'upward',\n DOWNWARD: 'downward',\n} as const;\n\nconst DROP_SENSITIVITY = {\n REGULAR: 'regular',\n IMMEDIATE: 'immediate',\n} as const;\n\ninterface UseDragAndDropOptions<\n TIndex extends number | Array<number> = number,\n TItem extends { index: TIndex } = { index: TIndex },\n> extends UseKeyboardDragAndDropCallbacks<TIndex> {\n type?: string;\n index: TIndex;\n item?: TItem;\n onStart?: () => void;\n onEnd?: () => void;\n dropSensitivity?: (typeof DROP_SENSITIVITY)[keyof typeof DROP_SENSITIVITY];\n}\n\ntype Identifier = ReturnType<HandlerManager['getHandlerId']>;\n\ntype UseDragAndDropReturn<E extends Element = HTMLElement> = [\n props: {\n handlerId: Identifier;\n isDragging: boolean;\n handleKeyDown: <E extends Element>(event: React.KeyboardEvent<E>) => void;\n isOverDropTarget: boolean;\n direction: (typeof DIRECTIONS)[keyof typeof DIRECTIONS] | null;\n },\n objectRef: React.RefObject<E>,\n dropRef: ConnectDropTarget,\n dragRef: ConnectDragSource,\n dragPreviewRef: ConnectDragPreview,\n];\n\ntype DropCollectedProps = {\n handlerId: Identifier;\n isOver: boolean;\n};\n\n/**\n * A utility hook abstracting the general drag and drop hooks from react-dnd.\n * Centralising the same behaviours and by default offering keyboard support.\n */\nconst useDragAndDrop = <\n TIndex extends number | Array<number>,\n TItem extends { index: TIndex; id?: Data.ID; [key: string]: unknown } = {\n index: TIndex;\n [key: string]: unknown;\n },\n E extends Element = HTMLElement,\n>(\n active: boolean,\n {\n type = 'STRAPI_DND',\n index,\n item,\n onStart,\n onEnd,\n onGrabItem,\n onDropItem,\n onCancel,\n onMoveItem,\n dropSensitivity = DROP_SENSITIVITY.REGULAR,\n }: UseDragAndDropOptions<TIndex, TItem>\n): UseDragAndDropReturn<E> => {\n const objectRef = React.useRef<E>(null);\n\n const [{ handlerId, isOver }, dropRef] = useDrop<TItem, void, DropCollectedProps>({\n accept: type,\n collect(monitor) {\n return {\n handlerId: monitor.getHandlerId(),\n isOver: monitor.isOver({ shallow: true }),\n };\n },\n drop(item) {\n const draggedIndex = item.index;\n const newIndex = index;\n\n if (isOver && onDropItem) {\n onDropItem(draggedIndex, newIndex);\n }\n },\n hover(item, monitor) {\n if (!objectRef.current || !onMoveItem) {\n return;\n }\n\n const dragIndex = item.index;\n const newIndex = index;\n\n const hoverBoundingRect = objectRef.current?.getBoundingClientRect();\n const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;\n const clientOffset = monitor.getClientOffset();\n if (!clientOffset) return;\n\n const hoverClientY = clientOffset && clientOffset.y - hoverBoundingRect.top;\n if (typeof dragIndex === 'number' && typeof newIndex === 'number') {\n if (dragIndex === newIndex) {\n // Don't replace items with themselves\n return;\n }\n\n if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {\n // Dragging downwards\n if (dragIndex < newIndex && hoverClientY < hoverMiddleY) {\n return;\n }\n\n // Dragging upwards\n if (dragIndex > newIndex && hoverClientY > hoverMiddleY) {\n return;\n }\n }\n\n // Time to actually perform the action\n onMoveItem(newIndex, dragIndex);\n item.index = newIndex;\n } else {\n // Using numbers as indices doesn't work for nested list items with path like [1, 1, 0]\n if (Array.isArray(dragIndex) && Array.isArray(newIndex)) {\n // Indices comparison to find item position in nested list\n const minLength = Math.min(dragIndex.length, newIndex.length);\n let areEqual = true;\n let isLessThan = false;\n let isGreaterThan = false;\n\n for (let i = 0; i < minLength; i++) {\n if (dragIndex[i] < newIndex[i]) {\n isLessThan = true;\n areEqual = false;\n break;\n } else if (dragIndex[i] > newIndex[i]) {\n isGreaterThan = true;\n areEqual = false;\n break;\n }\n }\n\n // Don't replace items with themselves\n if (areEqual && dragIndex.length === newIndex.length) {\n return;\n }\n\n if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {\n // Dragging downwards\n if (isLessThan && !isGreaterThan && hoverClientY < hoverMiddleY) {\n return;\n }\n\n // Dragging upwards\n if (isGreaterThan && !isLessThan && hoverClientY > hoverMiddleY) {\n return;\n }\n }\n }\n\n onMoveItem(newIndex, dragIndex);\n item.index = newIndex;\n }\n },\n });\n\n const getDragDirection = (monitor: DragSourceMonitor<TItem, void>) => {\n if (\n monitor &&\n monitor.isDragging() &&\n !monitor.didDrop() &&\n monitor.getInitialClientOffset() &&\n monitor.getClientOffset()\n ) {\n const deltaY = monitor.getInitialClientOffset()!.y - monitor.getClientOffset()!.y;\n\n if (deltaY > 0) return DIRECTIONS.UPWARD;\n\n if (deltaY < 0) return DIRECTIONS.DOWNWARD;\n\n return null;\n }\n\n return null;\n };\n\n const [{ isDragging, direction }, dragRef, dragPreviewRef] = useDrag({\n type,\n item() {\n if (onStart) {\n onStart();\n }\n\n /**\n * This will be attached and it helps define the preview sizes\n * when a component is flexy e.g. Relations\n */\n const { width } = objectRef.current?.getBoundingClientRect() ?? {};\n\n return { index, width, ...item };\n },\n end() {\n if (onEnd) {\n onEnd();\n }\n },\n canDrag: active,\n /**\n * This is useful when the item is in a virtualized list.\n * However, if we don't have an ID then we want the libraries\n * defaults to take care of this.\n */\n isDragging: item?.id\n ? (monitor) => {\n return item.id === monitor.getItem().id;\n }\n : undefined,\n collect: (monitor) => ({\n isDragging: monitor.isDragging(),\n initialOffset: monitor.getInitialClientOffset(),\n currentOffset: monitor.getClientOffset(),\n direction: getDragDirection(monitor),\n }),\n });\n\n const handleKeyDown = useKeyboardDragAndDrop(active, index, {\n onGrabItem,\n onDropItem,\n onCancel,\n onMoveItem,\n });\n\n return [\n { handlerId, isDragging, handleKeyDown, isOverDropTarget: isOver, direction },\n objectRef,\n dropRef,\n dragRef,\n dragPreviewRef,\n ];\n};\n\nexport {\n useDragAndDrop,\n UseDragAndDropReturn,\n UseDragAndDropOptions,\n DIRECTIONS,\n DROP_SENSITIVITY,\n};\n","import { Box, BoxComponent, ButtonProps, Flex, Typography } from '@strapi/design-system';\nimport { PlusCircle } from '@strapi/icons';\nimport { styled } from 'styled-components';\n\nexport const AddStage = ({ children, ...props }: ButtonProps) => {\n return (\n <StyledButton\n tag=\"button\"\n background=\"neutral0\"\n borderColor=\"neutral150\"\n paddingBottom={3}\n paddingLeft={4}\n paddingRight={4}\n paddingTop={3}\n shadow=\"filterShadow\"\n {...props}\n >\n <Typography variant=\"pi\" fontWeight=\"bold\">\n <Flex tag=\"span\" gap={2}>\n <PlusCircle width=\"2.4rem\" height=\"2.4rem\" aria-hidden />\n {children}\n </Flex>\n </Typography>\n </StyledButton>\n );\n};\n\nconst StyledButton = styled<BoxComponent<'button'>>(Box)`\n border-radius: 26px;\n color: ${({ theme }) => theme.colors.neutral500};\n\n &:hover {\n color: ${({ theme }) => theme.colors.primary600};\n }\n\n &:active {\n color: ${({ theme }) => theme.colors.primary600};\n }\n`;\n","import * as React from 'react';\n\nimport {\n useField,\n useForm,\n useTracking,\n ConfirmDialog,\n useNotification,\n InputRenderer as AdminInputRenderer,\n InputProps,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Flex,\n MultiSelectOption,\n Accordion,\n Grid,\n IconButton,\n MultiSelect,\n MultiSelectGroup,\n SingleSelect,\n SingleSelectOption,\n TextInput,\n VisuallyHidden,\n useComposedRefs,\n Menu,\n MenuItem,\n Field,\n Dialog,\n} from '@strapi/design-system';\nimport { Duplicate, Drag, More, EyeStriked } from '@strapi/icons';\nimport { getEmptyImage } from 'react-dnd-html5-backend';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { Stage as IStage, StagePermission } from '../../../../../shared/contracts/review-workflows';\nimport { useGetAdminRolesQuery } from '../../../services/admin';\nimport { AVAILABLE_COLORS, getStageColorByHex } from '../../../utils/colors';\nimport { DRAG_DROP_TYPES } from '../constants';\nimport { useDragAndDrop } from '../hooks/useDragAndDrop';\n\nimport { AddStage } from './AddStage';\n\ninterface WorkflowStage extends Pick<IStage, 'id' | 'name' | 'permissions' | 'color'> {\n __temp_key__: string;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Stages\n * -----------------------------------------------------------------------------------------------*/\ninterface StagesProps {\n canDelete?: boolean;\n canUpdate?: boolean;\n isCreating?: boolean;\n}\n\nconst Stages = ({ canDelete = true, canUpdate = true, isCreating }: StagesProps) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const addFieldRow = useForm('Stages', (state) => state.addFieldRow);\n const { value: stages = [] } = useField<WorkflowStage[]>('stages');\n\n return (\n <Flex direction=\"column\" gap={6} width=\"100%\">\n <Box position=\"relative\" width=\"100%\">\n <Background\n background=\"neutral200\"\n height=\"100%\"\n left=\"50%\"\n position=\"absolute\"\n top=\"0\"\n width={2}\n />\n\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6} position=\"relative\" tag=\"ol\">\n {stages.map((stage, index) => {\n return (\n <Box key={stage.__temp_key__} tag=\"li\">\n <Stage\n index={index}\n canDelete={stages.length > 1 && canDelete}\n canReorder={stages.length > 1}\n canUpdate={canUpdate}\n stagesCount={stages.length}\n defaultOpen={isCreating}\n {...stage}\n />\n </Box>\n );\n })}\n </Flex>\n </Box>\n\n {canUpdate && (\n <AddStage\n type=\"button\"\n onClick={() => {\n addFieldRow('stages', { name: '' });\n trackUsage('willCreateStage');\n }}\n >\n {formatMessage({\n id: 'Settings.review-workflows.stage.add',\n defaultMessage: 'Add new stage',\n })}\n </AddStage>\n )}\n </Flex>\n );\n};\n\nconst Background = styled(Box)`\n transform: translateX(-50%);\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * Stage\n * -----------------------------------------------------------------------------------------------*/\ninterface StageProps extends WorkflowStage {\n canDelete?: boolean;\n canReorder?: boolean;\n canUpdate?: boolean;\n index: number;\n stagesCount: number;\n defaultOpen?: boolean;\n}\n\nconst Stage = ({\n index,\n canDelete = false,\n canReorder = false,\n canUpdate = false,\n stagesCount,\n name,\n permissions,\n color,\n defaultOpen,\n}: StageProps) => {\n const [liveText, setLiveText] = React.useState<string>();\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const stageErrors = useForm('Stages', (state) => state.errors.stages as object[]);\n const error = stageErrors?.[index];\n const addFieldRow = useForm('Stage', (state) => state.addFieldRow);\n const moveFieldRow = useForm('Stage', (state) => state.moveFieldRow);\n const removeFieldRow = useForm('Stage', (state) => state.removeFieldRow);\n\n const getItemPos = (index: number) => `${index + 1} of ${stagesCount}`;\n\n const handleGrabStage = (index: number) => {\n setLiveText(\n formatMessage(\n {\n id: 'dnd.grab-item',\n defaultMessage: `{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel.`,\n },\n {\n item: name,\n position: getItemPos(index),\n }\n )\n );\n };\n\n const handleDropStage = (index: number) => {\n setLiveText(\n formatMessage(\n {\n id: 'dnd.drop-item',\n defaultMessage: `{item}, dropped. Final position in list: {position}.`,\n },\n {\n item: name,\n position: getItemPos(index),\n }\n )\n );\n };\n\n const handleCancelDragStage = () => {\n setLiveText(\n formatMessage(\n {\n id: 'dnd.cancel-item',\n defaultMessage: '{item}, dropped. Re-order cancelled.',\n },\n {\n item: name,\n }\n )\n );\n };\n\n const handleMoveStage = (newIndex: number, oldIndex: number) => {\n setLiveText(\n formatMessage(\n {\n id: 'dnd.reorder',\n defaultMessage: '{item}, moved. New position in list: {position}.',\n },\n {\n item: name,\n position: getItemPos(newIndex),\n }\n )\n );\n\n moveFieldRow('stages', oldIndex, newIndex);\n };\n\n const [{ handlerId, isDragging, handleKeyDown }, stageRef, dropRef, dragRef, dragPreviewRef] =\n useDragAndDrop(canReorder, {\n index,\n item: {\n index,\n name,\n },\n onGrabItem: handleGrabStage,\n onDropItem: handleDropStage,\n onMoveItem: handleMoveStage,\n onCancel: handleCancelDragStage,\n type: DRAG_DROP_TYPES.STAGE,\n });\n\n // @ts-expect-error – the stageRef is incorrectly typed.\n const composedRef = useComposedRefs<HTMLDivElement>(stageRef, dropRef);\n\n React.useEffect(() => {\n dragPreviewRef(getEmptyImage(), { captureDraggingState: false });\n }, [dragPreviewRef, index]);\n\n const handleCloneClick = () => {\n addFieldRow('stages', { name, color, permissions });\n };\n\n const id = React.useId();\n\n return (\n <Box ref={composedRef} shadow=\"tableShadow\">\n {liveText && <VisuallyHidden aria-live=\"assertive\">{liveText}</VisuallyHidden>}\n\n {isDragging ? (\n <Box\n background=\"primary100\"\n borderStyle=\"dashed\"\n borderColor=\"primary600\"\n borderWidth=\"1px\"\n display=\"block\"\n hasRadius\n padding={6}\n />\n ) : (\n <AccordionRoot\n onValueChange={(value) => {\n if (value) {\n trackUsage('willEditStage');\n }\n }}\n defaultValue={defaultOpen ? id : undefined}\n $error={Object.values(error ?? {}).length > 0}\n >\n <Accordion.Item value={id}>\n <Accordion.Header>\n <Accordion.Trigger>{name}</Accordion.Trigger>\n <Accordion.Actions>\n {canDelete || canUpdate ? (\n <>\n <Menu.Root>\n <ContextMenuTrigger size=\"S\" endIcon={null} paddingLeft={2} paddingRight={2}>\n <More aria-hidden focusable={false} />\n <VisuallyHidden tag=\"span\">\n {formatMessage({\n id: '[tbdb].components.DynamicZone.more-actions',\n defaultMessage: 'More actions',\n })}\n </VisuallyHidden>\n </ContextMenuTrigger>\n {/* z-index needs to be as big as the one defined for the wrapper in Stages, otherwise the menu\n * disappears behind the accordion\n */}\n <Menu.Content popoverPlacement=\"bottom-end\" zIndex={2}>\n <Menu.SubRoot>\n {canUpdate && (\n <MenuItem onClick={handleCloneClick}>\n {formatMessage({\n id: 'Settings.review-workflows.stage.delete',\n defaultMessage: 'Duplicate stage',\n })}\n </MenuItem>\n )}\n\n {canDelete && (\n <DeleteMenuItem onClick={() => removeFieldRow('stages', index)}>\n {formatMessage({\n id: 'Settings.review-workflows.stage.delete',\n defaultMessage: 'Delete',\n })}\n </DeleteMenuItem>\n )}\n </Menu.SubRoot>\n </Menu.Content>\n </Menu.Root>\n\n {canUpdate && (\n <IconButton\n background=\"transparent\"\n hasRadius\n variant=\"ghost\"\n data-handler-id={handlerId}\n ref={dragRef}\n label={formatMessage({\n id: 'Settings.review-workflows.stage.drag',\n defaultMessage: 'Drag',\n })}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={handleKeyDown}\n >\n <Drag />\n </IconButton>\n )}\n </>\n ) : null}\n </Accordion.Actions>\n </Accordion.Header>\n <Accordion.Content>\n <Grid.Root gap={4} padding={6}>\n {[\n {\n disabled: !canUpdate,\n label: formatMessage({\n id: 'Settings.review-workflows.stage.name.label',\n defaultMessage: 'Stage name',\n }),\n name: `stages.${index}.name`,\n required: true,\n size: 6,\n type: 'string' as const,\n },\n {\n disabled: !canUpdate,\n label: formatMessage({\n id: 'content-manager.reviewWorkflows.stage.color',\n defaultMessage: 'Color',\n }),\n name: `stages.${index}.color`,\n required: true,\n size: 6,\n type: 'color' as const,\n },\n {\n disabled: !canUpdate,\n label: formatMessage({\n id: 'Settings.review-workflows.stage.permissions.label',\n defaultMessage: 'Roles that can change this stage',\n }),\n name: `stages.${index}.permissions`,\n placeholder: formatMessage({\n id: 'Settings.review-workflows.stage.permissions.placeholder',\n defaultMessage: 'Select a role',\n }),\n required: true,\n size: 6,\n type: 'permissions' as const,\n },\n ].map(({ size, ...field }) => (\n <Grid.Item key={field.name} col={size} direction=\"column\" alignItems=\"stretch\">\n <InputRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n </Accordion.Content>\n </Accordion.Item>\n </AccordionRoot>\n )}\n </Box>\n );\n};\n\nconst AccordionRoot = styled(Accordion.Root)<{ $error?: boolean }>`\n border: 1px solid\n ${({ theme, $error }) => ($error ? theme.colors.danger600 : theme.colors.neutral200)};\n`;\n\nconst DeleteMenuItem = styled(MenuItem)`\n color: ${({ theme }) => theme.colors.danger600};\n`;\n\n// Removing the font-size from the child-span aligns the\n// more icon vertically\nconst ContextMenuTrigger = styled(Menu.Trigger)`\n :hover,\n :focus {\n background-color: ${({ theme }) => theme.colors.neutral100};\n }\n\n > span {\n font-size: 0;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * InputRenderer\n * -----------------------------------------------------------------------------------------------*/\n\ntype InputRendererProps = InputProps | ColorSelectorProps | PermissionsFieldProps;\n\nconst InputRenderer = (props: InputRendererProps) => {\n switch (props.type) {\n case 'color':\n return <ColorSelector {...props} />;\n case 'permissions':\n return <PermissionsField {...props} />;\n default:\n return <AdminInputRenderer {...props} />;\n }\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ColorSelector\n * -----------------------------------------------------------------------------------------------*/\n\ninterface ColorSelectorProps\n extends Omit<Extract<InputProps, { type: 'enumeration' }>, 'type' | 'options'> {\n type: 'color';\n}\n\nconst ColorSelector = ({ disabled, label, name, required }: ColorSelectorProps) => {\n const { formatMessage } = useIntl();\n const { value, error, onChange } = useField<string>(name);\n\n const colorOptions = AVAILABLE_COLORS.map(({ hex, name }) => ({\n value: hex,\n label: formatMessage(\n {\n id: 'Settings.review-workflows.stage.color.name',\n defaultMessage: '{name}',\n },\n { name }\n ),\n color: hex,\n }));\n\n const { themeColorName } = getStageColorByHex(value) ?? {};\n\n return (\n <Field.Root error={error} name={name} required={required}>\n <Field.Label>{label}</Field.Label>\n <SingleSelect\n disabled={disabled}\n onChange={(v) => {\n onChange(name, v.toString());\n }}\n value={value?.toUpperCase()}\n startIcon={\n <Flex\n tag=\"span\"\n height={2}\n background={value}\n borderColor={themeColorName === 'neutral0' ? 'neutral150' : 'transparent'}\n hasRadius\n shrink={0}\n width={2}\n />\n }\n >\n {colorOptions.map(({ value, label, color }) => {\n const { themeColorName } = getStageColorByHex(color) || {};\n\n return (\n <SingleSelectOption\n value={value}\n key={value}\n startIcon={\n <Flex\n tag=\"span\"\n height={2}\n background={color}\n borderColor={themeColorName === 'neutral0' ? 'neutral150' : 'transparent'}\n hasRadius\n shrink={0}\n width={2}\n />\n }\n >\n {label}\n </SingleSelectOption>\n );\n })}\n </SingleSelect>\n <Field.Error />\n </Field.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PermissionsField\n * -----------------------------------------------------------------------------------------------*/\ninterface PermissionsFieldProps\n extends Omit<Extract<InputProps, { type: 'enumeration' }>, 'type' | 'options'> {\n type: 'permissions';\n}\n\nconst PermissionsField = ({ disabled, name, placeholder, required }: PermissionsFieldProps) => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const [isApplyAllConfirmationOpen, setIsApplyAllConfirmationOpen] = React.useState(false);\n const { value = [], error, onChange } = useField<StagePermission[]>(name);\n const allStages = useForm<WorkflowStage[]>('PermissionsField', (state) => state.values.stages);\n const onFormValueChange = useForm('PermissionsField', (state) => state.onChange);\n const rolesErrorCount = React.useRef(0);\n\n const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();\n\n // Super admins always have permissions to do everything and therefore\n // there is no point for this role to show up in the role combobox\n const filteredRoles = roles?.filter((role) => role.code !== 'strapi-super-admin') ?? [];\n\n React.useEffect(() => {\n if (\n !isLoading &&\n getRolesError &&\n 'status' in getRolesError &&\n getRolesError.status == 403 &&\n rolesErrorCount.current === 0\n ) {\n rolesErrorCount.current = 1;\n\n toggleNotification({\n blockTransition: true,\n type: 'danger',\n message: formatMessage({\n id: 'review-workflows.stage.permissions.noPermissions.description',\n defaultMessage: 'You don’t have the permission to see roles. Contact your administrator.',\n }),\n });\n }\n }, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);\n\n if (!isLoading && filteredRoles.length === 0) {\n return (\n <Field.Root\n name={name}\n hint={formatMessage({\n id: 'Settings.review-workflows.stage.permissions.noPermissions.description',\n defaultMessage: 'You don’t have the permission to see roles',\n })}\n required={required}\n >\n <Field.Label>\n {formatMessage({\n id: 'Settings.review-workflows.stage.permissions.label',\n defaultMessage: 'Roles that can change this stage',\n })}\n </Field.Label>\n <TextInput\n disabled\n placeholder={formatMessage({\n id: 'components.NotAllowedInput.text',\n defaultMessage: 'No permissions to see this field',\n })}\n startAction={<EyeStriked fill=\"neutral600\" />}\n type=\"text\"\n value=\"\"\n />\n <Field.Hint />\n </Field.Root>\n );\n }\n\n return (\n <>\n <Flex alignItems=\"flex-end\" gap={3}>\n <PermissionWrapper grow={1}>\n <Field.Root error={error} name={name} required>\n <Field.Label>\n {formatMessage({\n id: 'Settings.review-workflows.stage.permissions.label',\n defaultMessage: 'Roles that can change this stage',\n })}\n </Field.Label>\n <MultiSelect\n disabled={disabled}\n onChange={(values) => {\n // Because the select components expects strings for values, but\n // the yup schema validates we are sending full permission objects to the API,\n // we must coerce the string value back to an object\n const permissions = values.map((value) => ({\n role: parseInt(value, 10),\n action: 'admin::review-workflows.stage.transition',\n }));\n\n onChange(name, permissions);\n }}\n placeholder={placeholder}\n // The Select component expects strings for values\n value={value.map((permission) => `${permission.role}`)}\n withTags\n >\n <MultiSelectGroup\n label={formatMessage({\n id: 'Settings.review-workflows.stage.permissions.allRoles.label',\n defaultMessage: 'All roles',\n })}\n values={filteredRoles.map((r) => `${r.id}`)}\n >\n {filteredRoles.map((role) => {\n return (\n <NestedOption key={role.id} value={`${role.id}`}>\n {role.name}\n </NestedOption>\n );\n })}\n </MultiSelectGroup>\n </MultiSelect>\n <Field.Error />\n </Field.Root>\n </PermissionWrapper>\n <Dialog.Root open={isApplyAllConfirmationOpen} onOpenChange={setIsApplyAllConfirmationOpen}>\n <Dialog.Trigger>\n <IconButton\n disabled={disabled}\n label={formatMessage({\n id: 'Settings.review-workflows.stage.permissions.apply.label',\n defaultMessage: 'Apply to all stages',\n })}\n size=\"L\"\n >\n <Duplicate />\n </IconButton>\n </Dialog.Trigger>\n <ConfirmDialog\n onConfirm={() => {\n onFormValueChange(\n 'stages',\n allStages.map((stage) => ({\n ...stage,\n permissions: value,\n }))\n );\n\n setIsApplyAllConfirmationOpen(false);\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: 'Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success',\n defaultMessage: 'Applied roles to all other stages of the workflow',\n }),\n });\n }}\n variant=\"default\"\n >\n {formatMessage({\n id: 'Settings.review-workflows.page.edit.confirm.stages.permissions.copy',\n defaultMessage:\n 'Roles that can change that stage will be applied to all the other stages.',\n })}\n </ConfirmDialog>\n </Dialog.Root>\n </Flex>\n </>\n );\n};\n\nconst NestedOption = styled(MultiSelectOption)`\n padding-left: ${({ theme }) => theme.spaces[7]};\n`;\n\n// Grow the size of the permission Select\nconst PermissionWrapper = styled(Flex)`\n > * {\n flex-grow: 1;\n }\n`;\n\nexport { Stages };\nexport type { StagesProps, WorkflowStage };\n","import { InputRenderer, useField, useForm } from '@strapi/admin/strapi-admin';\nimport {\n Field,\n Grid,\n MultiSelect,\n MultiSelectGroup,\n MultiSelectOption,\n Typography,\n useCollator,\n} from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { useGetContentTypesQuery } from '../../../services/content-manager';\nimport { useReviewWorkflows } from '../hooks/useReviewWorkflows';\n\n/* -------------------------------------------------------------------------------------------------\n * WorkflowAttributes\n * -----------------------------------------------------------------------------------------------*/\ninterface WorkflowAttributesProps {\n canUpdate?: boolean;\n}\n\nconst WorkflowAttributes = ({ canUpdate = true }: WorkflowAttributesProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Grid.Root background=\"neutral0\" hasRadius gap={4} padding={6} shadow=\"tableShadow\">\n <Grid.Item col={6} direction=\"column\" alignItems=\"stretch\">\n <InputRenderer\n disabled={!canUpdate}\n label={formatMessage({\n id: 'Settings.review-workflows.workflow.name.label',\n defaultMessage: 'Workflow Name',\n })}\n name=\"name\"\n required\n type=\"string\"\n />\n </Grid.Item>\n <Grid.Item col={6} direction=\"column\" alignItems=\"stretch\">\n <ContentTypesSelector disabled={!canUpdate} />\n </Grid.Item>\n </Grid.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ContentTypesSelector\n * -----------------------------------------------------------------------------------------------*/\ninterface ContentTypesSelectorProps {\n disabled?: boolean;\n}\n\nconst ContentTypesSelector = ({ disabled }: ContentTypesSelectorProps) => {\n const { formatMessage, locale } = useIntl();\n const { data: contentTypes, isLoading } = useGetContentTypesQuery();\n const { workflows } = useReviewWorkflows();\n const currentWorkflow = useForm('ContentTypesSelector', (state) => state.values);\n\n const { error, value, onChange } = useField('contentTypes');\n\n const formatter = useCollator(locale, {\n sensitivity: 'base',\n });\n\n const isDisabled =\n disabled ||\n isLoading ||\n !contentTypes ||\n (contentTypes.collectionType.length === 0 && contentTypes.singleType.length === 0);\n\n const collectionTypes = (contentTypes?.collectionType ?? [])\n .toSorted((a, b) => formatter.compare(a.info.displayName, b.info.displayName))\n .map((contentType) => ({\n label: contentType.info.displayName,\n value: contentType.uid,\n }));\n\n const singleTypes = (contentTypes?.singleType ?? []).map((contentType) => ({\n label: contentType.info.displayName,\n value: contentType.uid,\n }));\n\n return (\n <Field.Root error={error} name={'contentTypes'}>\n <Field.Label>\n {formatMessage({\n id: 'Settings.review-workflows.workflow.contentTypes.label',\n defaultMessage: 'Associated to',\n })}\n </Field.Label>\n <MultiSelect\n customizeContent={(value) =>\n formatMessage(\n {\n id: 'Settings.review-workflows.workflow.contentTypes.displayValue',\n defaultMessage:\n '{count} {count, plural, one {content type} other {content types}} selected',\n },\n { count: value?.length }\n )\n }\n disabled={isDisabled}\n onChange={(values) => {\n onChange('contentTypes', values);\n }}\n value={value}\n placeholder={formatMessage({\n id: 'Settings.review-workflows.workflow.contentTypes.placeholder',\n defaultMessage: 'Select',\n })}\n >\n {[\n ...(collectionTypes.length > 0\n ? [\n {\n label: formatMessage({\n id: 'Settings.review-workflows.workflow.contentTypes.collectionTypes.label',\n defaultMessage: 'Collection Types',\n }),\n children: collectionTypes,\n },\n ]\n : []),\n\n ...(singleTypes.length > 0\n ? [\n {\n label: formatMessage({\n id: 'Settings.review-workflows.workflow.contentTypes.singleTypes.label',\n defaultMessage: 'Single Types',\n }),\n children: singleTypes,\n },\n ]\n : []),\n ].map((opt) => {\n return (\n <MultiSelectGroup\n key={opt.label}\n label={opt.label}\n values={opt.children.map((child) => child.value.toString())}\n >\n {opt.children.map((child) => {\n const { name: assignedWorkflowName } =\n workflows?.find(\n (workflow) =>\n ((currentWorkflow && workflow.id !== currentWorkflow.id) ||\n !currentWorkflow) &&\n workflow.contentTypes.includes(child.value)\n ) ?? {};\n\n return (\n <NestedOption key={child.value} value={child.value}>\n <Typography>\n {\n // @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\n formatMessage(\n {\n id: 'Settings.review-workflows.workflow.contentTypes.assigned.notice',\n defaultMessage:\n '{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}',\n },\n {\n label: child.label,\n name: assignedWorkflowName,\n em: (...children) => (\n <Typography tag=\"em\" fontWeight=\"bold\">\n {children}\n </Typography>\n ),\n i: (...children) => (\n <ContentTypeTakeNotice>{children}</ContentTypeTakeNotice>\n ),\n }\n )\n }\n </Typography>\n </NestedOption>\n );\n })}\n </MultiSelectGroup>\n );\n })}\n </MultiSelect>\n </Field.Root>\n );\n};\n\nconst NestedOption = styled(MultiSelectOption)`\n padding-left: ${({ theme }) => theme.spaces[7]};\n`;\n\nconst ContentTypeTakeNotice = styled(Typography)`\n font-style: italic;\n`;\n\nexport { WorkflowAttributes };\nexport type { WorkflowAttributesProps };\n","import * as React from 'react';\n\nimport {\n ConfirmDialog,\n BackButton,\n useNotification,\n useAPIErrorHandler,\n useRBAC,\n Form,\n Page,\n FormProps,\n FormHelpers,\n} from '@strapi/admin/strapi-admin';\nimport { useLicenseLimits } from '@strapi/admin/strapi-admin/ee';\nimport { Button, Dialog, Flex, Typography } from '@strapi/design-system';\nimport { Check } from '@strapi/icons';\nimport { generateNKeysBetween } from 'fractional-indexing';\nimport { useIntl } from 'react-intl';\nimport { useNavigate, useParams } from 'react-router-dom';\nimport * as yup from 'yup';\n\nimport { LimitsModal } from '../../components/LimitsModal';\nimport {\n CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME,\n CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME,\n} from '../../constants';\nimport { useTypedSelector } from '../../modules/hooks';\nimport { isBaseQueryError } from '../../utils/api';\n\nimport * as Layout from './components/Layout';\nimport { Stages, WorkflowStage } from './components/Stages';\nimport { WorkflowAttributes } from './components/WorkflowAttributes';\nimport { useReviewWorkflows } from './hooks/useReviewWorkflows';\n\nimport type { Stage, Workflow } from '../../../../shared/contracts/review-workflows';\n\n/* -------------------------------------------------------------------------------------------------\n * EditPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst WORKFLOW_SCHEMA = yup.object({\n contentTypes: yup.array().of(yup.string()),\n name: yup\n .string()\n .max(255, {\n id: 'review-workflows.validation.name.max-length',\n defaultMessage: 'Name can not be longer than 255 characters',\n })\n .required()\n .nullable(),\n stages: yup\n .array()\n .of(\n yup.object().shape({\n name: yup\n .string()\n .nullable()\n .required({\n id: 'review-workflows.validation.stage.name',\n defaultMessage: 'Name is required',\n })\n .max(255, {\n id: 'review-workflows.validation.stage.max-length',\n defaultMessage: 'Name can not be longer than 255 characters',\n })\n .test(\n 'unique-name',\n {\n id: 'review-workflows.validation.stage.duplicate',\n defaultMessage: 'Stage name must be unique',\n },\n (stageName, context) => {\n // @ts-expect-error it does exist.\n const { stages } = context.from[1].value;\n\n return stages.filter((stage: Stage) => stage.name === stageName).length === 1;\n }\n ),\n color: yup\n .string()\n .nullable()\n .required({\n id: 'review-workflows.validation.stage.color',\n defaultMessage: 'Color is required',\n })\n .matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i),\n\n permissions: yup\n .array(\n yup.object({\n role: yup\n .number()\n .strict()\n .typeError({\n id: 'review-workflows.validation.stage.permissions.role.number',\n defaultMessage: 'Role must be of type number',\n })\n .required(),\n action: yup.string().required({\n id: 'review-workflows.validation.stage.permissions.action.required',\n defaultMessage: 'Action is a required argument',\n }),\n })\n )\n .strict(),\n })\n )\n .min(1),\n});\n\nconst EditPage = () => {\n const { id = '' } = useParams<{ id: string }>();\n const isCreatingWorkflow = id === 'create';\n const { formatMessage } = useIntl();\n const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();\n const navigate = useNavigate();\n const { toggleNotification } = useNotification();\n const {\n isLoading: isLoadingWorkflow,\n meta,\n workflows,\n error,\n update,\n create,\n } = useReviewWorkflows();\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions['settings']?.['review-workflows']\n );\n const {\n allowedActions: { canDelete, canUpdate, canCreate },\n } = useRBAC(permissions);\n\n const [savePrompts, setSavePrompts] = React.useState<{\n hasDeletedServerStages?: boolean;\n hasReassignedContentTypes?: boolean;\n }>({});\n const { getFeature, isLoading: isLicenseLoading } = useLicenseLimits();\n const [showLimitModal, setShowLimitModal] = React.useState<'workflow' | 'stage' | null>(null);\n\n const currentWorkflow = workflows?.find((workflow) => workflow.id === parseInt(id, 10));\n const contentTypesFromOtherWorkflows = workflows\n ?.filter((workflow) => workflow.id !== parseInt(id, 10))\n .flatMap((workflow) => workflow.contentTypes);\n\n const limits = getFeature<string>('review-workflows');\n const numberOfWorkflows = limits?.[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME];\n const stagesPerWorkflow = limits?.[CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME];\n\n interface FormValues {\n name: string;\n stages: WorkflowStage[];\n contentTypes: string[];\n }\n\n const submitForm = async (data: FormValues, helpers: Pick<FormHelpers, 'setErrors'>) => {\n try {\n if (!isCreatingWorkflow) {\n const res = await update(id, {\n ...data,\n // compare permissions of stages and only submit them if at least one has\n // changed; this enables partial updates e.g. for users who don't have\n // permissions to see roles\n stages: data.stages.map((stage) => {\n let hasUpdatedPermissions = true;\n const serverStage = currentWorkflow?.stages?.find(\n (serverStage) => serverStage.id === stage?.id\n );\n if (serverStage) {\n hasUpdatedPermissions =\n serverStage.permissions?.length !== stage.permissions?.length ||\n !serverStage.permissions?.every(\n (serverPermission) =>\n !!stage.permissions?.find(\n (permission) => permission.role === serverPermission.role\n )\n );\n }\n return {\n ...stage,\n permissions: hasUpdatedPermissions ? stage.permissions : undefined,\n } satisfies Stage;\n }),\n });\n\n if ('error' in res && isBaseQueryError(res.error) && res.error.name === 'ValidationError') {\n helpers.setErrors(formatValidationErrors(res.error));\n }\n } else {\n const res = await create(data);\n\n if ('error' in res && isBaseQueryError(res.error) && res.error.name === 'ValidationError') {\n helpers.setErrors(formatValidationErrors(res.error));\n } else if ('data' in res) {\n navigate(`../${res.data.id}`, { replace: true });\n }\n }\n } catch (error) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred',\n }),\n });\n }\n setSavePrompts({});\n };\n\n const handleConfirmDeleteDialog =\n (data: FormValues, helpers: Pick<FormHelpers, 'setErrors'>) => async () => {\n await submitForm(data, helpers);\n };\n\n const handleConfirmClose = () => {\n setSavePrompts({});\n };\n\n const handleSubmit: FormProps<FormValues>['onSubmit'] = async (data, helpers) => {\n const isContentTypeReassignment = data.contentTypes.some((contentType) =>\n contentTypesFromOtherWorkflows?.includes(contentType)\n );\n const hasDeletedServerStages =\n !isCreatingWorkflow &&\n !currentWorkflow?.stages.every((stage) =>\n data.stages.some((newStage) => newStage.id === stage.id)\n );\n\n if (meta && numberOfWorkflows && meta?.workflowCount > parseInt(numberOfWorkflows, 10)) {\n /**\n * If the current license has a limit, check if the total count of workflows\n * exceeds that limit and display the limits modal instead of sending the\n * update, because it would throw an API error.\n */\n setShowLimitModal('workflow');\n\n /**\n * If the current license has a limit, check if the total count of stages\n * exceeds that limit and display the limits modal instead of sending the\n * update, because it would throw an API error.\n */\n } else if (\n data.stages &&\n stagesPerWorkflow &&\n data.stages.length > parseInt(stagesPerWorkflow, 10)\n ) {\n setShowLimitModal('stage');\n } else if (hasDeletedServerStages || isContentTypeReassignment) {\n if (hasDeletedServerStages) {\n setSavePrompts((prev) => ({ ...prev, hasDeletedServerStages: true }));\n }\n\n if (isContentTypeReassignment) {\n setSavePrompts((prev) => ({ ...prev, hasReassignedContentTypes: true }));\n }\n } else {\n await submitForm(data, helpers);\n }\n };\n\n /**\n * If the current license has a limit:\n * check if the total count of workflows or stages exceeds that limit and display\n * the limits modal on page load. It can be closed by the user, but the\n * API will throw an error in case they try to create a new workflow or update the\n * stages.\n *\n * If the current license does not have a limit (e.g. offline license):\n * do nothing (for now). In case they are trying to create the 201st workflow/ stage\n * the API will throw an error.\n *\n */\n React.useEffect(() => {\n if (!isLoadingWorkflow && !isLicenseLoading) {\n if (meta && numberOfWorkflows && meta?.workflowCount > parseInt(numberOfWorkflows, 10)) {\n setShowLimitModal('workflow');\n } else if (\n currentWorkflow &&\n currentWorkflow.stages &&\n stagesPerWorkflow &&\n currentWorkflow.stages.length > parseInt(stagesPerWorkflow, 10)\n ) {\n setShowLimitModal('stage');\n }\n }\n }, [\n currentWorkflow,\n isLicenseLoading,\n isLoadingWorkflow,\n limits,\n meta,\n numberOfWorkflows,\n stagesPerWorkflow,\n ]);\n\n const initialValues: FormValues = React.useMemo(() => {\n if (isCreatingWorkflow || !currentWorkflow) {\n return {\n name: '',\n stages: [],\n contentTypes: [],\n };\n } else {\n return {\n name: currentWorkflow.name,\n stages: addTmpKeysToStages(currentWorkflow.stages),\n contentTypes: currentWorkflow.contentTypes,\n };\n }\n }, [currentWorkflow, isCreatingWorkflow]);\n\n if (isLoadingWorkflow) {\n return <Page.Loading />;\n }\n\n if (error) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Layout.DragLayerRendered />\n\n <Form\n method={isCreatingWorkflow ? 'POST' : 'PUT'}\n initialValues={initialValues}\n validationSchema={WORKFLOW_SCHEMA}\n onSubmit={handleSubmit}\n >\n {({ modified, isSubmitting, values, setErrors }) => (\n <>\n <Layout.Header\n navigationAction={<BackButton />}\n primaryAction={\n canUpdate || canCreate ? (\n <Button\n startIcon={<Check />}\n type=\"submit\"\n size=\"M\"\n disabled={!modified || isSubmitting || values.stages.length === 0}\n // if the confirm dialog is open the loading state is on\n // the confirm button already\n loading={!Boolean(Object.keys(savePrompts).length > 0) && isSubmitting}\n >\n {formatMessage({\n id: 'global.save',\n defaultMessage: 'Save',\n })}\n </Button>\n ) : null\n }\n subtitle={formatMessage(\n {\n id: 'review-workflows.page.subtitle',\n defaultMessage: '{count, plural, one {# stage} other {# stages}}',\n },\n { count: currentWorkflow?.stages?.length ?? 0 }\n )}\n title={\n currentWorkflow?.name ||\n formatMessage({\n id: 'Settings.review-workflows.create.page.title',\n defaultMessage: 'Create Review Workflow',\n })\n }\n />\n <Layout.Root>\n <Flex alignItems=\"stretch\" direction=\"column\" gap={7}>\n <WorkflowAttributes canUpdate={canUpdate || canCreate} />\n <Stages\n canDelete={canDelete}\n canUpdate={canUpdate || canCreate}\n isCreating={isCreatingWorkflow}\n />\n </Flex>\n </Layout.Root>\n <Dialog.Root\n open={Object.keys(savePrompts).length > 0}\n onOpenChange={handleConfirmClose}\n >\n <ConfirmDialog onConfirm={handleConfirmDeleteDialog(values, { setErrors })}>\n <Flex direction=\"column\" gap={5}>\n {savePrompts.hasDeletedServerStages && (\n <Typography textAlign=\"center\" variant=\"omega\">\n {formatMessage({\n id: 'review-workflows.page.delete.confirm.stages.body',\n defaultMessage:\n 'All entries assigned to deleted stages will be moved to the previous stage.',\n })}\n </Typography>\n )}\n\n {savePrompts.hasReassignedContentTypes && (\n <Typography textAlign=\"center\" variant=\"omega\">\n {formatMessage(\n {\n id: 'review-workflows.page.delete.confirm.contentType.body',\n defaultMessage:\n '{count} {count, plural, one {content-type} other {content-types}} {count, plural, one {is} other {are}} already mapped to {count, plural, one {another workflow} other {other workflows}}. If you save changes, {count, plural, one {this} other {these}} {count, plural, one {content-type} other {{count} content-types}} will no more be mapped to the {count, plural, one {another workflow} other {other workflows}} and all corresponding information will be removed.',\n },\n {\n count:\n contentTypesFromOtherWorkflows?.filter((contentType) =>\n values.contentTypes.includes(contentType)\n ).length ?? 0,\n }\n )}\n </Typography>\n )}\n\n <Typography textAlign=\"center\" variant=\"omega\">\n {formatMessage({\n id: 'review-workflows.page.delete.confirm.confirm',\n defaultMessage: 'Are you sure you want to save?',\n })}\n </Typography>\n </Flex>\n </ConfirmDialog>\n </Dialog.Root>\n </>\n )}\n </Form>\n\n <LimitsModal.Root\n open={showLimitModal === 'workflow'}\n onOpenChange={() => setShowLimitModal(null)}\n >\n <LimitsModal.Title>\n {formatMessage({\n id: 'review-workflows.edit.page.workflows.limit.title',\n defaultMessage: 'You’ve reached the limit of workflows in your plan',\n })}\n </LimitsModal.Title>\n\n <LimitsModal.Body>\n {formatMessage({\n id: 'review-workflows.edit.page.workflows.limit.body',\n defaultMessage: 'Delete a workflow or contact Sales to enable more workflows.',\n })}\n </LimitsModal.Body>\n </LimitsModal.Root>\n\n <LimitsModal.Root\n open={showLimitModal === 'stage'}\n onOpenChange={() => setShowLimitModal(null)}\n >\n <LimitsModal.Title>\n {formatMessage({\n id: 'review-workflows.edit.page.stages.limit.title',\n defaultMessage: 'You have reached the limit of stages for this workflow in your plan',\n })}\n </LimitsModal.Title>\n\n <LimitsModal.Body>\n {formatMessage({\n id: 'review-workflows.edit.page.stages.limit.body',\n defaultMessage: 'Try deleting some stages or contact Sales to enable more stages.',\n })}\n </LimitsModal.Body>\n </LimitsModal.Root>\n </>\n );\n};\n\nconst addTmpKeysToStages = (data: Workflow['stages']) => {\n const keys = generateNKeysBetween(undefined, undefined, data.length);\n\n return data.map((datum, index) => ({\n ...datum,\n __temp_key__: keys[index],\n }));\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedEditPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedEditPage = () => {\n const permissions = useTypedSelector((state) => {\n const {\n create = [],\n update = [],\n read = [],\n } = state.admin_app.permissions.settings?.['review-workflows'] ?? {};\n\n return [...create, ...update, ...read];\n });\n\n return (\n <Page.Protect permissions={permissions}>\n <EditPage />\n </Page.Protect>\n );\n};\n\nexport { ProtectedEditPage };\n"],"names":["item","index","AdminInputRenderer","name","value","label","themeColorName","NestedOption","InputRenderer","serverStage","error","Layout.DragLayerRendered","Layout.Header","Layout.Root"],"mappings":";;;;;;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