@strapi/review-workflows 5.0.0-beta.8 → 5.0.0-rc.0
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/LICENSE +12 -17
- package/dist/_chunks/{Layout-BMqtFafC.js → Layout-D3DDQmMI.js} +3 -3
- package/dist/_chunks/{Layout-BMqtFafC.js.map → Layout-D3DDQmMI.js.map} +1 -1
- package/dist/_chunks/{Layout-lg3hbwGL.mjs → Layout-Da8jupiA.mjs} +3 -3
- package/dist/_chunks/{Layout-lg3hbwGL.mjs.map → Layout-Da8jupiA.mjs.map} +1 -1
- package/dist/_chunks/{_id-B853wt9z.js → _id-CnRDP3Xx.js} +123 -130
- package/dist/_chunks/_id-CnRDP3Xx.js.map +1 -0
- package/dist/_chunks/{_id-B3jMqqMH.mjs → _id-xSrgPSJs.mjs} +124 -131
- package/dist/_chunks/_id-xSrgPSJs.mjs.map +1 -0
- package/dist/_chunks/{index-CdU1x9cZ.js → index-4kp4AkBB.js} +8 -16
- package/dist/_chunks/index-4kp4AkBB.js.map +1 -0
- package/dist/_chunks/{index-lebOqdrv.mjs → index-DDsJlZQw.mjs} +31 -29
- package/dist/_chunks/{index-lebOqdrv.mjs.map → index-DDsJlZQw.mjs.map} +1 -1
- package/dist/_chunks/{index-Ujtj1Rcp.js → index-DhPxWpsW.js} +30 -28
- package/dist/_chunks/{index-Ujtj1Rcp.js.map → index-DhPxWpsW.js.map} +1 -1
- package/dist/_chunks/{index-BhJmjDbj.mjs → index-jfO5GxtW.mjs} +9 -17
- package/dist/_chunks/index-jfO5GxtW.mjs.map +1 -0
- package/dist/_chunks/{router-CvMnSjb9.mjs → router-DOEULOpS.mjs} +3 -3
- package/dist/_chunks/{router-CvMnSjb9.mjs.map → router-DOEULOpS.mjs.map} +1 -1
- package/dist/_chunks/{router-BboD243b.js → router-DSXpeew4.js} +3 -3
- package/dist/_chunks/{router-BboD243b.js.map → router-DSXpeew4.js.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
package/LICENSE
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
Copyright (c) 2015-present Strapi Solutions SAS
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
* All software that resides within this directory and its subdirectories, is licensed under the license defined below.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Enterprise License
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at
|
|
8
|
+
https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you
|
|
9
|
+
represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have
|
|
10
|
+
agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software.
|
|
11
|
+
Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software.
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions:
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
13
|
+
BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT.
|
|
14
|
+
IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU
|
|
15
|
+
HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF
|
|
16
|
+
THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS;
|
|
17
|
+
IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
|
|
@@ -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-DhPxWpsW.js");
|
|
6
6
|
const jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
const designSystem = require("@strapi/design-system");
|
|
8
8
|
const reactDnd = require("react-dnd");
|
|
@@ -234,7 +234,7 @@ const Header = ({ title, subtitle, navigationAction, primaryAction }) => {
|
|
|
234
234
|
}
|
|
235
235
|
) }),
|
|
236
236
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
237
|
-
strapiAdmin.Layouts.
|
|
237
|
+
strapiAdmin.Layouts.BaseHeader,
|
|
238
238
|
{
|
|
239
239
|
navigationAction,
|
|
240
240
|
primaryAction,
|
|
@@ -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-D3DDQmMI.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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
1
|
+
{"version":3,"file":"Layout-D3DDQmMI.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.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","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,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AAiB,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-DDsJlZQw.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";
|
|
@@ -214,7 +214,7 @@ const Header = ({ title, subtitle, navigationAction, primaryAction }) => {
|
|
|
214
214
|
}
|
|
215
215
|
) }),
|
|
216
216
|
/* @__PURE__ */ jsx(
|
|
217
|
-
Layouts.
|
|
217
|
+
Layouts.BaseHeader,
|
|
218
218
|
{
|
|
219
219
|
navigationAction,
|
|
220
220
|
primaryAction,
|
|
@@ -231,4 +231,4 @@ export {
|
|
|
231
231
|
DragLayerRendered as a,
|
|
232
232
|
useReviewWorkflows as u
|
|
233
233
|
};
|
|
234
|
-
//# sourceMappingURL=Layout-
|
|
234
|
+
//# sourceMappingURL=Layout-Da8jupiA.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,YAAgB,IAAA;AAElD,QAAM,EAAE,MAAM,WAAW,MA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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-Da8jupiA.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.BaseHeader\n navigationAction={navigationAction}\n primaryAction={primaryAction}\n title={title}\n subtitle={subtitle}\n />\n </>\n );\n};\n\nexport { Drag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AAQ,sBAAsB;AAAA,MAC7C,YAAY,QAAQ,WAAW;AAAA,MAC/B,aAAa,QAAQ,gBAAgB;AAAA,IAAA;AAAA,EACvC;AAGF,MAAI,CAAC,cAAc,aAAa,gBAAgB,OAAO;AAC9C,WAAA;AAAA,EACT;AAGE,SAAA;AAAA,IAAC;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,+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;"}
|
|
@@ -11,8 +11,8 @@ const reactIntl = require("react-intl");
|
|
|
11
11
|
const reactRedux = require("react-redux");
|
|
12
12
|
const reactRouterDom = 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-DhPxWpsW.js");
|
|
15
|
+
const Layout = require("./Layout-D3DDQmMI.js");
|
|
16
16
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
17
17
|
const styledComponents = require("styled-components");
|
|
18
18
|
const reactDnd = require("react-dnd");
|
|
@@ -313,35 +313,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
|
313
313
|
left: "50%",
|
|
314
314
|
position: "absolute",
|
|
315
315
|
top: "0",
|
|
316
|
-
width: 2
|
|
317
|
-
zIndex: 1
|
|
316
|
+
width: 2
|
|
318
317
|
}
|
|
319
318
|
),
|
|
320
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
321
|
-
designSystem.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
canDelete: stages.length > 1 && canDelete,
|
|
335
|
-
canReorder: stages.length > 1,
|
|
336
|
-
canUpdate,
|
|
337
|
-
stagesCount: stages.length,
|
|
338
|
-
defaultOpen: isCreating,
|
|
339
|
-
...stage
|
|
340
|
-
}
|
|
341
|
-
) }, stage.__temp_key__);
|
|
342
|
-
})
|
|
343
|
-
}
|
|
344
|
-
)
|
|
319
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, position: "relative", tag: "ol", children: stages.map((stage, index2) => {
|
|
320
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
321
|
+
Stage,
|
|
322
|
+
{
|
|
323
|
+
index: index2,
|
|
324
|
+
canDelete: stages.length > 1 && canDelete,
|
|
325
|
+
canReorder: stages.length > 1,
|
|
326
|
+
canUpdate,
|
|
327
|
+
stagesCount: stages.length,
|
|
328
|
+
defaultOpen: isCreating,
|
|
329
|
+
...stage
|
|
330
|
+
}
|
|
331
|
+
) }, stage.__temp_key__);
|
|
332
|
+
}) })
|
|
345
333
|
] }),
|
|
346
334
|
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
347
335
|
AddStage,
|
|
@@ -458,7 +446,7 @@ const Stage = ({
|
|
|
458
446
|
addFieldRow("stages", { name, color, permissions });
|
|
459
447
|
};
|
|
460
448
|
const id = React__namespace.useId();
|
|
461
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, children: [
|
|
449
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
462
450
|
liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
463
451
|
isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
464
452
|
designSystem.Box,
|
|
@@ -523,7 +511,7 @@ const Stage = ({
|
|
|
523
511
|
)
|
|
524
512
|
] }) : null })
|
|
525
513
|
] }),
|
|
526
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, padding: 6, children: [
|
|
514
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, padding: 6, children: [
|
|
527
515
|
{
|
|
528
516
|
disabled: !canUpdate,
|
|
529
517
|
label: formatMessage({
|
|
@@ -561,7 +549,7 @@ const Stage = ({
|
|
|
561
549
|
size: 6,
|
|
562
550
|
type: "permissions"
|
|
563
551
|
}
|
|
564
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
552
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
565
553
|
] })
|
|
566
554
|
}
|
|
567
555
|
)
|
|
@@ -666,20 +654,22 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
666
654
|
const { value = [], error, onChange } = strapiAdmin.useField(name);
|
|
667
655
|
const allStages = strapiAdmin.useForm("PermissionsField", (state) => state.values.stages);
|
|
668
656
|
const onFormValueChange = strapiAdmin.useForm("PermissionsField", (state) => state.onChange);
|
|
669
|
-
const
|
|
657
|
+
const rolesErrorCount = React__namespace.useRef(0);
|
|
658
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
670
659
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
671
660
|
React__namespace.useEffect(() => {
|
|
672
|
-
if (!isLoading &&
|
|
661
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
662
|
+
rolesErrorCount.current = 1;
|
|
673
663
|
toggleNotification({
|
|
674
664
|
blockTransition: true,
|
|
675
665
|
type: "danger",
|
|
676
666
|
message: formatMessage({
|
|
677
667
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
678
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
668
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
679
669
|
})
|
|
680
670
|
});
|
|
681
671
|
}
|
|
682
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
672
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
683
673
|
if (!isLoading && filteredRoles.length === 0) {
|
|
684
674
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
685
675
|
designSystem.Field.Root,
|
|
@@ -713,45 +703,45 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
713
703
|
}
|
|
714
704
|
);
|
|
715
705
|
}
|
|
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
|
-
] }) }),
|
|
706
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-end", gap: 3, children: [
|
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required: true, children: [
|
|
708
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
709
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
710
|
+
defaultMessage: "Roles that can change this stage"
|
|
711
|
+
}) }),
|
|
754
712
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
713
|
+
designSystem.MultiSelect,
|
|
714
|
+
{
|
|
715
|
+
disabled,
|
|
716
|
+
onChange: (values) => {
|
|
717
|
+
const permissions = values.map((value2) => ({
|
|
718
|
+
role: parseInt(value2, 10),
|
|
719
|
+
action: "admin::review-workflows.stage.transition"
|
|
720
|
+
}));
|
|
721
|
+
onChange(name, permissions);
|
|
722
|
+
},
|
|
723
|
+
placeholder,
|
|
724
|
+
value: value.map((permission) => `${permission.role}`),
|
|
725
|
+
withTags: true,
|
|
726
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
727
|
+
designSystem.MultiSelectGroup,
|
|
728
|
+
{
|
|
729
|
+
label: formatMessage({
|
|
730
|
+
id: "Settings.review-workflows.stage.permissions.allRoles.label",
|
|
731
|
+
defaultMessage: "All roles"
|
|
732
|
+
}),
|
|
733
|
+
values: filteredRoles.map((r) => `${r.id}`),
|
|
734
|
+
children: filteredRoles.map((role) => {
|
|
735
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NestedOption$1, { value: `${role.id}`, children: role.name }, role.id);
|
|
736
|
+
})
|
|
737
|
+
}
|
|
738
|
+
)
|
|
739
|
+
}
|
|
740
|
+
),
|
|
741
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
742
|
+
] }) }),
|
|
743
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { open: isApplyAllConfirmationOpen, onOpenChange: setIsApplyAllConfirmationOpen, children: [
|
|
744
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
755
745
|
designSystem.IconButton,
|
|
756
746
|
{
|
|
757
747
|
disabled,
|
|
@@ -761,41 +751,38 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
761
751
|
}),
|
|
762
752
|
size: "L",
|
|
763
753
|
variant: "secondary",
|
|
764
|
-
onClick: () => setIsApplyAllConfirmationOpen(true),
|
|
765
754
|
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
|
|
766
755
|
}
|
|
756
|
+
) }),
|
|
757
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
758
|
+
strapiAdmin.ConfirmDialog,
|
|
759
|
+
{
|
|
760
|
+
onConfirm: () => {
|
|
761
|
+
onFormValueChange(
|
|
762
|
+
"stages",
|
|
763
|
+
allStages.map((stage) => ({
|
|
764
|
+
...stage,
|
|
765
|
+
permissions: value
|
|
766
|
+
}))
|
|
767
|
+
);
|
|
768
|
+
setIsApplyAllConfirmationOpen(false);
|
|
769
|
+
toggleNotification({
|
|
770
|
+
type: "success",
|
|
771
|
+
message: formatMessage({
|
|
772
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
773
|
+
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
774
|
+
})
|
|
775
|
+
});
|
|
776
|
+
},
|
|
777
|
+
variant: "default",
|
|
778
|
+
children: formatMessage({
|
|
779
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
780
|
+
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
781
|
+
})
|
|
782
|
+
}
|
|
767
783
|
)
|
|
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
|
-
] });
|
|
784
|
+
] })
|
|
785
|
+
] }) });
|
|
799
786
|
};
|
|
800
787
|
const NestedOption$1 = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
801
788
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
@@ -807,8 +794,8 @@ const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
|
|
|
807
794
|
`;
|
|
808
795
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
809
796
|
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.
|
|
797
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
798
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
812
799
|
strapiAdmin.InputRenderer,
|
|
813
800
|
{
|
|
814
801
|
disabled: !canUpdate,
|
|
@@ -821,7 +808,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
821
808
|
type: "string"
|
|
822
809
|
}
|
|
823
810
|
) }),
|
|
824
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
811
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
825
812
|
] });
|
|
826
813
|
};
|
|
827
814
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -1178,23 +1165,22 @@ const EditPage = () => {
|
|
|
1178
1165
|
}
|
|
1179
1166
|
),
|
|
1180
1167
|
/* @__PURE__ */ jsxRuntime.jsx(Layout.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1181
|
-
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate }),
|
|
1168
|
+
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1182
1169
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1183
1170
|
Stages,
|
|
1184
1171
|
{
|
|
1185
1172
|
canDelete,
|
|
1186
|
-
canUpdate,
|
|
1173
|
+
canUpdate: canUpdate || canCreate,
|
|
1187
1174
|
isCreating: isCreatingWorkflow
|
|
1188
1175
|
}
|
|
1189
1176
|
)
|
|
1190
1177
|
] }) }),
|
|
1191
1178
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1192
|
-
|
|
1179
|
+
designSystem.Dialog.Root,
|
|
1193
1180
|
{
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
|
|
1197
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1181
|
+
open: Object.keys(savePrompts).length > 0,
|
|
1182
|
+
onOpenChange: handleConfirmClose,
|
|
1183
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1198
1184
|
savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", variant: "omega", children: formatMessage({
|
|
1199
1185
|
id: "review-workflows.page.delete.confirm.stages.body",
|
|
1200
1186
|
defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
|
|
@@ -1214,7 +1200,7 @@ const EditPage = () => {
|
|
|
1214
1200
|
id: "review-workflows.page.delete.confirm.confirm",
|
|
1215
1201
|
defaultMessage: "Are you sure you want to save?"
|
|
1216
1202
|
}) })
|
|
1217
|
-
] })
|
|
1203
|
+
] }) })
|
|
1218
1204
|
}
|
|
1219
1205
|
)
|
|
1220
1206
|
] })
|
|
@@ -1223,8 +1209,8 @@ const EditPage = () => {
|
|
|
1223
1209
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1224
1210
|
index.LimitsModal.Root,
|
|
1225
1211
|
{
|
|
1226
|
-
|
|
1227
|
-
|
|
1212
|
+
open: showLimitModal === "workflow",
|
|
1213
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1228
1214
|
children: [
|
|
1229
1215
|
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1230
1216
|
id: "review-workflows.edit.page.workflows.limit.title",
|
|
@@ -1237,16 +1223,23 @@ const EditPage = () => {
|
|
|
1237
1223
|
]
|
|
1238
1224
|
}
|
|
1239
1225
|
),
|
|
1240
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1226
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1227
|
+
index.LimitsModal.Root,
|
|
1228
|
+
{
|
|
1229
|
+
open: showLimitModal === "stage",
|
|
1230
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1231
|
+
children: [
|
|
1232
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1233
|
+
id: "review-workflows.edit.page.stages.limit.title",
|
|
1234
|
+
defaultMessage: "You have reached the limit of stages for this workflow in your plan"
|
|
1235
|
+
}) }),
|
|
1236
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Body, { children: formatMessage({
|
|
1237
|
+
id: "review-workflows.edit.page.stages.limit.body",
|
|
1238
|
+
defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
|
|
1239
|
+
}) })
|
|
1240
|
+
]
|
|
1241
|
+
}
|
|
1242
|
+
)
|
|
1250
1243
|
] });
|
|
1251
1244
|
};
|
|
1252
1245
|
const addTmpKeysToStages = (data) => {
|
|
@@ -1268,4 +1261,4 @@ const ProtectedEditPage = () => {
|
|
|
1268
1261
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
|
|
1269
1262
|
};
|
|
1270
1263
|
exports.ProtectedEditPage = ProtectedEditPage;
|
|
1271
|
-
//# sourceMappingURL=_id-
|
|
1264
|
+
//# sourceMappingURL=_id-CnRDP3Xx.js.map
|