@strapi/review-workflows 0.0.0-experimental.f75e3c6d67cc47c64ab37479efdbb7b43be50b78 → 5.0.0-beta.10
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-BMqtFafC.js → Layout-BWzD-Tfe.js} +2 -2
- package/dist/_chunks/{Layout-BMqtFafC.js.map → Layout-BWzD-Tfe.js.map} +1 -1
- package/dist/_chunks/{Layout-lg3hbwGL.mjs → Layout-D292CXD6.mjs} +2 -2
- package/dist/_chunks/{Layout-lg3hbwGL.mjs.map → Layout-D292CXD6.mjs.map} +1 -1
- package/dist/_chunks/{_id-B853wt9z.js → _id-CoX9yljN.js} +100 -97
- package/dist/_chunks/_id-CoX9yljN.js.map +1 -0
- package/dist/_chunks/{_id-B3jMqqMH.mjs → _id-DqEUzU_u.mjs} +101 -98
- package/dist/_chunks/_id-DqEUzU_u.mjs.map +1 -0
- package/dist/_chunks/{index-BhJmjDbj.mjs → index-2nkLt-AE.mjs} +9 -17
- package/dist/_chunks/index-2nkLt-AE.mjs.map +1 -0
- package/dist/_chunks/{index-CdU1x9cZ.js → index-CDMcvtW9.js} +8 -16
- package/dist/_chunks/index-CDMcvtW9.js.map +1 -0
- package/dist/_chunks/{index-Ujtj1Rcp.js → index-D-KMrml_.js} +30 -28
- package/dist/_chunks/{index-Ujtj1Rcp.js.map → index-D-KMrml_.js.map} +1 -1
- package/dist/_chunks/{index-lebOqdrv.mjs → index-udedGkii.mjs} +31 -29
- package/dist/_chunks/{index-lebOqdrv.mjs.map → index-udedGkii.mjs.map} +1 -1
- package/dist/_chunks/{router-BboD243b.js → router-C19H1Rju.js} +3 -3
- package/dist/_chunks/{router-BboD243b.js.map → router-C19H1Rju.js.map} +1 -1
- package/dist/_chunks/{router-CvMnSjb9.mjs → router-bmjk-Tpf.mjs} +3 -3
- package/dist/_chunks/{router-CvMnSjb9.mjs.map → router-bmjk-Tpf.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/LimitsModal.d.ts +2 -4
- package/package.json +8 -8
- package/dist/_chunks/_id-B3jMqqMH.mjs.map +0 -1
- package/dist/_chunks/_id-B853wt9z.js.map +0 -1
- package/dist/_chunks/index-BhJmjDbj.mjs.map +0 -1
- package/dist/_chunks/index-CdU1x9cZ.js.map +0 -1
|
@@ -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-D-KMrml_.js");
|
|
6
6
|
const jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
const designSystem = require("@strapi/design-system");
|
|
8
8
|
const reactDnd = require("react-dnd");
|
|
@@ -249,4 +249,4 @@ exports.DragLayerRendered = DragLayerRendered;
|
|
|
249
249
|
exports.Header = Header;
|
|
250
250
|
exports.Root = Root;
|
|
251
251
|
exports.useReviewWorkflows = useReviewWorkflows;
|
|
252
|
-
//# sourceMappingURL=Layout-
|
|
252
|
+
//# sourceMappingURL=Layout-BWzD-Tfe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout-BMqtFafC.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 { id = '', skip = false, ...queryParams } = params;\n\n const { data, isLoading, error } = useGetWorkflowsQuery(\n {\n id,\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.Header\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","id","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,KAAK,IAAI,OAAO,OAAO,GAAG,YAAgB,IAAA;AAElD,QAAM,EAAE,MAAM,WAAW,MAAU,IAAAC,MAAA;AAAA,IACjC;AAAA,MACE;AAAA,MACA,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,EAAE,IAAI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AAA;AAAA,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;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Layout-BWzD-Tfe.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 { id = '', skip = false, ...queryParams } = params;\n\n const { data, isLoading, error } = useGetWorkflowsQuery(\n {\n id,\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.Header\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","id","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,KAAK,IAA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H,2BAAA;AAAA,IAACI,aAAA;AAAA,IAAA;AAAA,MACC,QAAO;AAAA,MACP,MAAM;AAAA,MACN,UAAS;AAAA,MACT,eAAc;AAAA,MACd,KAAK;AAAA,MACL,QAAQ;AAAA,MACR,OAAM;AAAA,MAEN,0CAACA,aAAI,KAAA,EAAA,OAAO,SAAS,eAAe,eAAe,WAAW,GAC5D,UAAA;AAAA,QAACJ,2BAAAA,IAAA,kBAAA,EAAiB,MAAM,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO,MAAM;AAAA,QAAE;AAAA,MAAA,GAC9E;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,MAAM,OAA0C,CAAC,EAAE,eAAe;AAE9D,SAAAA,+BAACK,YAAAA,KAAK,MAAL,EACC,yCAACC,YAAQ,QAAA,SAAR,EAAiB,SAAS,CAAA,EAC7B,CAAA;AAEJ;AAUA,MAAM,SAAgC,CAAC,EAAE,OAAO,UAAU,kBAAkB,oBAAoB;AACxF,QAAA,EAAE,kBAAkBjB,UAAAA;AAC1B,SAEIS,2BAAA,KAAAS,qBAAA,EAAA,UAAA;AAAA,IAACP,2BAAAA,IAAAK,YAAA,KAAK,OAAL,EACE,UAAA;AAAA,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;;;;;;"}
|
|
@@ -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-udedGkii.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";
|
|
@@ -231,4 +231,4 @@ export {
|
|
|
231
231
|
DragLayerRendered as a,
|
|
232
232
|
useReviewWorkflows as u
|
|
233
233
|
};
|
|
234
|
-
//# sourceMappingURL=Layout-
|
|
234
|
+
//# sourceMappingURL=Layout-D292CXD6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout-lg3hbwGL.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 { id = '', skip = false, ...queryParams } = params;\n\n const { data, isLoading, error } = useGetWorkflowsQuery(\n {\n id,\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.Header\n navigationAction={navigationAction}\n primaryAction={primaryAction}\n title={title}\n subtitle={subtitle}\n />\n </>\n );\n};\n\nexport { DragLayerRendered, Header, Root };\n"],"names":["data","id"],"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,KAAK,IAAI,OAAO,OAAO,GAAG,YA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QAAQ;AAAA,MACR,OAAM;AAAA,MAEN,+BAAC,KAAI,EAAA,OAAO,SAAS,eAAe,eAAe,WAAW,GAC5D,UAAA;AAAA,QAAC,oBAAA,kBAAA,EAAiB,MAAM,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO,MAAM;AAAA,QAAE;AAAA,MAAA,GAC9E;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,MAAM,OAA0C,CAAC,EAAE,eAAe;AAE9D,SAAA,oBAAC,KAAK,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;"}
|
|
1
|
+
{"version":3,"file":"Layout-D292CXD6.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 { id = '', skip = false, ...queryParams } = params;\n\n const { data, isLoading, error } = useGetWorkflowsQuery(\n {\n id,\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.Header\n navigationAction={navigationAction}\n primaryAction={primaryAction}\n title={title}\n sub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= require("react-router-dom");
|
|
13
13
|
const yup = require("yup");
|
|
14
|
-
const index = require("./index-
|
|
15
|
-
const Layout = require("./Layout-
|
|
14
|
+
const index = require("./index-D-KMrml_.js");
|
|
15
|
+
const Layout = require("./Layout-BWzD-Tfe.js");
|
|
16
16
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
17
17
|
const styledComponents = require("styled-components");
|
|
18
18
|
const reactDnd = require("react-dnd");
|
|
@@ -458,7 +458,7 @@ const Stage = ({
|
|
|
458
458
|
addFieldRow("stages", { name, color, permissions });
|
|
459
459
|
};
|
|
460
460
|
const id = React__namespace.useId();
|
|
461
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, children: [
|
|
461
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
462
462
|
liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
463
463
|
isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
464
464
|
designSystem.Box,
|
|
@@ -523,7 +523,7 @@ const Stage = ({
|
|
|
523
523
|
)
|
|
524
524
|
] }) : null })
|
|
525
525
|
] }),
|
|
526
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, padding: 6, children: [
|
|
526
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, padding: 6, children: [
|
|
527
527
|
{
|
|
528
528
|
disabled: !canUpdate,
|
|
529
529
|
label: formatMessage({
|
|
@@ -561,7 +561,7 @@ const Stage = ({
|
|
|
561
561
|
size: 6,
|
|
562
562
|
type: "permissions"
|
|
563
563
|
}
|
|
564
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
564
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
565
565
|
] })
|
|
566
566
|
}
|
|
567
567
|
)
|
|
@@ -713,45 +713,45 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
713
713
|
}
|
|
714
714
|
);
|
|
715
715
|
}
|
|
716
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
717
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
718
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
}) }),
|
|
723
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
724
|
-
designSystem.MultiSelect,
|
|
725
|
-
{
|
|
726
|
-
disabled,
|
|
727
|
-
onChange: (values) => {
|
|
728
|
-
const permissions = values.map((value2) => ({
|
|
729
|
-
role: parseInt(value2, 10),
|
|
730
|
-
action: "admin::review-workflows.stage.transition"
|
|
731
|
-
}));
|
|
732
|
-
onChange(name, permissions);
|
|
733
|
-
},
|
|
734
|
-
placeholder,
|
|
735
|
-
value: value.map((permission) => `${permission.role}`),
|
|
736
|
-
withTags: true,
|
|
737
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
738
|
-
designSystem.MultiSelectGroup,
|
|
739
|
-
{
|
|
740
|
-
label: formatMessage({
|
|
741
|
-
id: "Settings.review-workflows.stage.permissions.allRoles.label",
|
|
742
|
-
defaultMessage: "All roles"
|
|
743
|
-
}),
|
|
744
|
-
values: filteredRoles.map((r) => `${r.id}`),
|
|
745
|
-
children: filteredRoles.map((role) => {
|
|
746
|
-
return /* @__PURE__ */ jsxRuntime.jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
|
|
747
|
-
})
|
|
748
|
-
}
|
|
749
|
-
)
|
|
750
|
-
}
|
|
751
|
-
),
|
|
752
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
753
|
-
] }) }),
|
|
716
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-end", gap: 3, children: [
|
|
717
|
+
/* @__PURE__ */ jsxRuntime.jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required: true, children: [
|
|
718
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
719
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
720
|
+
defaultMessage: "Roles that can change this stage"
|
|
721
|
+
}) }),
|
|
754
722
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
723
|
+
designSystem.MultiSelect,
|
|
724
|
+
{
|
|
725
|
+
disabled,
|
|
726
|
+
onChange: (values) => {
|
|
727
|
+
const permissions = values.map((value2) => ({
|
|
728
|
+
role: parseInt(value2, 10),
|
|
729
|
+
action: "admin::review-workflows.stage.transition"
|
|
730
|
+
}));
|
|
731
|
+
onChange(name, permissions);
|
|
732
|
+
},
|
|
733
|
+
placeholder,
|
|
734
|
+
value: value.map((permission) => `${permission.role}`),
|
|
735
|
+
withTags: true,
|
|
736
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
737
|
+
designSystem.MultiSelectGroup,
|
|
738
|
+
{
|
|
739
|
+
label: formatMessage({
|
|
740
|
+
id: "Settings.review-workflows.stage.permissions.allRoles.label",
|
|
741
|
+
defaultMessage: "All roles"
|
|
742
|
+
}),
|
|
743
|
+
values: filteredRoles.map((r) => `${r.id}`),
|
|
744
|
+
children: filteredRoles.map((role) => {
|
|
745
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
|
|
746
|
+
})
|
|
747
|
+
}
|
|
748
|
+
)
|
|
749
|
+
}
|
|
750
|
+
),
|
|
751
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
752
|
+
] }) }),
|
|
753
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { open: isApplyAllConfirmationOpen, onOpenChange: setIsApplyAllConfirmationOpen, children: [
|
|
754
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
755
755
|
designSystem.IconButton,
|
|
756
756
|
{
|
|
757
757
|
disabled,
|
|
@@ -761,41 +761,38 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
761
761
|
}),
|
|
762
762
|
size: "L",
|
|
763
763
|
variant: "secondary",
|
|
764
|
-
onClick: () => setIsApplyAllConfirmationOpen(true),
|
|
765
764
|
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
|
|
766
765
|
}
|
|
766
|
+
) }),
|
|
767
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
768
|
+
strapiAdmin.ConfirmDialog,
|
|
769
|
+
{
|
|
770
|
+
onConfirm: () => {
|
|
771
|
+
onFormValueChange(
|
|
772
|
+
"stages",
|
|
773
|
+
allStages.map((stage) => ({
|
|
774
|
+
...stage,
|
|
775
|
+
permissions: value
|
|
776
|
+
}))
|
|
777
|
+
);
|
|
778
|
+
setIsApplyAllConfirmationOpen(false);
|
|
779
|
+
toggleNotification({
|
|
780
|
+
type: "success",
|
|
781
|
+
message: formatMessage({
|
|
782
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
783
|
+
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
784
|
+
})
|
|
785
|
+
});
|
|
786
|
+
},
|
|
787
|
+
variant: "default",
|
|
788
|
+
children: formatMessage({
|
|
789
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
790
|
+
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
791
|
+
})
|
|
792
|
+
}
|
|
767
793
|
)
|
|
768
|
-
] })
|
|
769
|
-
|
|
770
|
-
strapiAdmin.ConfirmDialog,
|
|
771
|
-
{
|
|
772
|
-
isOpen: isApplyAllConfirmationOpen,
|
|
773
|
-
onClose: () => setIsApplyAllConfirmationOpen(false),
|
|
774
|
-
onConfirm: () => {
|
|
775
|
-
onFormValueChange(
|
|
776
|
-
"stages",
|
|
777
|
-
allStages.map((stage) => ({
|
|
778
|
-
...stage,
|
|
779
|
-
permissions: value
|
|
780
|
-
}))
|
|
781
|
-
);
|
|
782
|
-
setIsApplyAllConfirmationOpen(false);
|
|
783
|
-
toggleNotification({
|
|
784
|
-
type: "success",
|
|
785
|
-
message: formatMessage({
|
|
786
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
787
|
-
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
788
|
-
})
|
|
789
|
-
});
|
|
790
|
-
},
|
|
791
|
-
variant: "default",
|
|
792
|
-
children: formatMessage({
|
|
793
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
794
|
-
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
795
|
-
})
|
|
796
|
-
}
|
|
797
|
-
)
|
|
798
|
-
] });
|
|
794
|
+
] })
|
|
795
|
+
] }) });
|
|
799
796
|
};
|
|
800
797
|
const NestedOption$1 = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
801
798
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
@@ -807,8 +804,8 @@ const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
|
|
|
807
804
|
`;
|
|
808
805
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
809
806
|
const { formatMessage } = reactIntl.useIntl();
|
|
810
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
811
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
807
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
808
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
812
809
|
strapiAdmin.InputRenderer,
|
|
813
810
|
{
|
|
814
811
|
disabled: !canUpdate,
|
|
@@ -821,7 +818,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
821
818
|
type: "string"
|
|
822
819
|
}
|
|
823
820
|
) }),
|
|
824
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
821
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
825
822
|
] });
|
|
826
823
|
};
|
|
827
824
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -1189,12 +1186,11 @@ const EditPage = () => {
|
|
|
1189
1186
|
)
|
|
1190
1187
|
] }) }),
|
|
1191
1188
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1192
|
-
|
|
1189
|
+
designSystem.Dialog.Root,
|
|
1193
1190
|
{
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
|
|
1197
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1191
|
+
open: Object.keys(savePrompts).length > 0,
|
|
1192
|
+
onOpenChange: handleConfirmClose,
|
|
1193
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1198
1194
|
savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", variant: "omega", children: formatMessage({
|
|
1199
1195
|
id: "review-workflows.page.delete.confirm.stages.body",
|
|
1200
1196
|
defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
|
|
@@ -1214,7 +1210,7 @@ const EditPage = () => {
|
|
|
1214
1210
|
id: "review-workflows.page.delete.confirm.confirm",
|
|
1215
1211
|
defaultMessage: "Are you sure you want to save?"
|
|
1216
1212
|
}) })
|
|
1217
|
-
] })
|
|
1213
|
+
] }) })
|
|
1218
1214
|
}
|
|
1219
1215
|
)
|
|
1220
1216
|
] })
|
|
@@ -1223,8 +1219,8 @@ const EditPage = () => {
|
|
|
1223
1219
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1224
1220
|
index.LimitsModal.Root,
|
|
1225
1221
|
{
|
|
1226
|
-
|
|
1227
|
-
|
|
1222
|
+
open: showLimitModal === "workflow",
|
|
1223
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1228
1224
|
children: [
|
|
1229
1225
|
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1230
1226
|
id: "review-workflows.edit.page.workflows.limit.title",
|
|
@@ -1237,16 +1233,23 @@ const EditPage = () => {
|
|
|
1237
1233
|
]
|
|
1238
1234
|
}
|
|
1239
1235
|
),
|
|
1240
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1236
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1237
|
+
index.LimitsModal.Root,
|
|
1238
|
+
{
|
|
1239
|
+
open: showLimitModal === "stage",
|
|
1240
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1241
|
+
children: [
|
|
1242
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1243
|
+
id: "review-workflows.edit.page.stages.limit.title",
|
|
1244
|
+
defaultMessage: "You have reached the limit of stages for this workflow in your plan"
|
|
1245
|
+
}) }),
|
|
1246
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Body, { children: formatMessage({
|
|
1247
|
+
id: "review-workflows.edit.page.stages.limit.body",
|
|
1248
|
+
defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
|
|
1249
|
+
}) })
|
|
1250
|
+
]
|
|
1251
|
+
}
|
|
1252
|
+
)
|
|
1250
1253
|
] });
|
|
1251
1254
|
};
|
|
1252
1255
|
const addTmpKeysToStages = (data) => {
|
|
@@ -1268,4 +1271,4 @@ const ProtectedEditPage = () => {
|
|
|
1268
1271
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
|
|
1269
1272
|
};
|
|
1270
1273
|
exports.ProtectedEditPage = ProtectedEditPage;
|
|
1271
|
-
//# sourceMappingURL=_id-
|
|
1274
|
+
//# sourceMappingURL=_id-CoX9yljN.js.map
|