@strapi/review-workflows 0.0.0-experimental.a53a4b1c8f7981a689823cdd719105671e1c6392 → 0.0.0-experimental.a9a5a36dd73072c19eadeff5f387e8286b2a4d22
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-BWzD-Tfe.js → Layout-D3DDQmMI.js} +3 -3
- package/dist/_chunks/{Layout-BWzD-Tfe.js.map → Layout-D3DDQmMI.js.map} +1 -1
- package/dist/_chunks/{Layout-D292CXD6.mjs → Layout-Da8jupiA.mjs} +3 -3
- package/dist/_chunks/{Layout-D292CXD6.mjs.map → Layout-Da8jupiA.mjs.map} +1 -1
- package/dist/_chunks/{_id-CoX9yljN.js → _id-CnRDP3Xx.js} +26 -36
- package/dist/_chunks/_id-CnRDP3Xx.js.map +1 -0
- package/dist/_chunks/{_id-DqEUzU_u.mjs → _id-xSrgPSJs.mjs} +26 -36
- package/dist/_chunks/_id-xSrgPSJs.mjs.map +1 -0
- package/dist/_chunks/{index-CDMcvtW9.js → index-4kp4AkBB.js} +3 -3
- package/dist/_chunks/{index-CDMcvtW9.js.map → index-4kp4AkBB.js.map} +1 -1
- package/dist/_chunks/{index-udedGkii.mjs → index-DDsJlZQw.mjs} +2 -2
- package/dist/_chunks/{index-udedGkii.mjs.map → index-DDsJlZQw.mjs.map} +1 -1
- package/dist/_chunks/{index-D-KMrml_.js → index-DhPxWpsW.js} +2 -2
- package/dist/_chunks/{index-D-KMrml_.js.map → index-DhPxWpsW.js.map} +1 -1
- package/dist/_chunks/{index-2nkLt-AE.mjs → index-jfO5GxtW.mjs} +3 -3
- package/dist/_chunks/{index-2nkLt-AE.mjs.map → index-jfO5GxtW.mjs.map} +1 -1
- package/dist/_chunks/{router-bmjk-Tpf.mjs → router-DOEULOpS.mjs} +3 -3
- package/dist/_chunks/{router-bmjk-Tpf.mjs.map → router-DOEULOpS.mjs.map} +1 -1
- package/dist/_chunks/{router-C19H1Rju.js → router-DSXpeew4.js} +3 -3
- package/dist/_chunks/{router-C19H1Rju.js.map → router-DSXpeew4.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/package.json +6 -6
- package/dist/_chunks/_id-CoX9yljN.js.map +0 -1
- package/dist/_chunks/_id-DqEUzU_u.mjs.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-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,g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{"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,QACN,SAA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AM,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-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 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,MAAU,IAAA;A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,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 { DragLayerRendered, Header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sB;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,
|
|
@@ -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,
|
|
@@ -1175,12 +1165,12 @@ const EditPage = () => {
|
|
|
1175
1165
|
}
|
|
1176
1166
|
),
|
|
1177
1167
|
/* @__PURE__ */ jsxRuntime.jsx(Layout.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1178
|
-
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate }),
|
|
1168
|
+
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1179
1169
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1180
1170
|
Stages,
|
|
1181
1171
|
{
|
|
1182
1172
|
canDelete,
|
|
1183
|
-
canUpdate,
|
|
1173
|
+
canUpdate: canUpdate || canCreate,
|
|
1184
1174
|
isCreating: isCreatingWorkflow
|
|
1185
1175
|
}
|
|
1186
1176
|
)
|
|
@@ -1271,4 +1261,4 @@ const ProtectedEditPage = () => {
|
|
|
1271
1261
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
|
|
1272
1262
|
};
|
|
1273
1263
|
exports.ProtectedEditPage = ProtectedEditPage;
|
|
1274
|
-
//# sourceMappingURL=_id-
|
|
1264
|
+
//# sourceMappingURL=_id-CnRDP3Xx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_id-CnRDP3Xx.js","sources":["../../admin/src/services/admin.ts","../../admin/src/routes/settings/hooks/useKeyboardDragAndDrop.ts","../../admin/src/routes/settings/hooks/useDragAndDrop.ts","../../admin/src/routes/settings/components/AddStage.tsx","../../admin/src/routes/settings/components/Stages.tsx","../../admin/src/routes/settings/components/WorkflowAttributes.tsx","../../admin/src/routes/settings/:id.tsx"],"sourcesContent":["import { SanitizedAdminUser } from '@strapi/admin/strapi-admin';\n\nimport { reviewWorkflowsApi } from './api';\n\ntype Roles = SanitizedAdminUser['roles'];\ntype RolesResponse = { data: Roles };\n\nconst adminApi = reviewWorkflowsApi.injectEndpoints({\n endpoints(builder) {\n return {\n getAdminRoles: builder.query<Roles, void>({\n query: () => ({\n url: `/admin/roles`,\n method: 'GET',\n }),\n transformResponse: (res: RolesResponse) => {\n return res.data;\n },\n }),\n };\n },\n});\n\nconst { useGetAdminRolesQuery } = adminApi;\n\nexport { useGetAdminRolesQuery };\nexport type { SanitizedAdminUser, Roles };\n","import * as React from 'react';\n\nexport type UseKeyboardDragAndDropCallbacks<TIndex extends number | Array<number> = number> = {\n onCancel?: (index: TIndex) => void;\n onDropItem?: (currentIndex: TIndex, newIndex?: TIndex) => void;\n onGrabItem?: (index: TIndex) => void;\n onMoveItem?: (newIndex: TIndex, currentIndex: TIndex) => void;\n};\n\n/**\n * Utility hook designed to implement keyboard accessibile drag and drop by\n * returning an onKeyDown handler to be passed to the drag icon button.\n *\n * @internal - You should use `useDragAndDrop` instead.\n */\nexport const useKeyboardDragAndDrop = <TIndex extends number | Array<number> = number>(\n active: boolean,\n index: TIndex,\n { onCancel, onDropItem, onGrabItem, onMoveItem }: UseKeyboardDragAndDropCallbacks<TIndex>\n) => {\n const [isSelected, setIsSelected] = React.useState(false);\n\n const handleMove = (movement: 'UP' | 'DOWN') => {\n if (!isSelected) {\n return;\n }\n if (typeof index === 'number' && onMoveItem) {\n if (movement === 'UP') {\n onMoveItem((index - 1) as TIndex, index);\n } else if (movement === 'DOWN') {\n onMoveItem((index + 1) as TIndex, index);\n }\n }\n };\n\n const handleDragClick = () => {\n if (isSelected) {\n if (onDropItem) {\n onDropItem(index);\n }\n setIsSelected(false);\n } else {\n if (onGrabItem) {\n onGrabItem(index);\n }\n setIsSelected(true);\n }\n };\n\n const handleCancel = () => {\n if (isSelected) {\n setIsSelected(false);\n\n if (onCancel) {\n onCancel(index);\n }\n }\n };\n\n const handleKeyDown = <E extends Element>(e: React.KeyboardEvent<E>) => {\n if (!active) {\n return;\n }\n\n if (e.key === 'Tab' && !isSelected) {\n return;\n }\n\n e.preventDefault();\n\n switch (e.key) {\n case ' ':\n case 'Enter':\n handleDragClick();\n break;\n\n case 'Escape':\n handleCancel();\n break;\n\n case 'ArrowDown':\n case 'ArrowRight':\n handleMove('DOWN');\n break;\n\n case 'ArrowUp':\n case 'ArrowLeft':\n handleMove('UP');\n break;\n\n default:\n }\n };\n\n return handleKeyDown;\n};\n","import * as React from 'react';\n\nimport {\n useDrag,\n useDrop,\n type HandlerManager,\n type ConnectDragSource,\n type ConnectDropTarget,\n type ConnectDragPreview,\n type DragSourceMonitor,\n} from 'react-dnd';\n\nimport {\n useKeyboardDragAndDrop,\n type UseKeyboardDragAndDropCallbacks,\n} from './useKeyboardDragAndDrop';\n\nimport type { Data } from '@strapi/types';\n\nconst DIRECTIONS = {\n UPWARD: 'upward',\n DOWNWARD: 'downward',\n} as const;\n\nconst DROP_SENSITIVITY = {\n REGULAR: 'regular',\n IMMEDIATE: 'immediate',\n} as const;\n\ninterface UseDragAndDropOptions<\n TIndex extends number | Array<number> = number,\n TItem extends { index: TIndex } = { index: TIndex },\n> extends UseKeyboardDragAndDropCallbacks<TIndex> {\n type?: string;\n index: TIndex;\n item?: TItem;\n onStart?: () => void;\n onEnd?: () => void;\n dropSensitivity?: (typeof DROP_SENSITIVITY)[keyof typeof DROP_SENSITIVITY];\n}\n\ntype Identifier = ReturnType<HandlerManager['getHandlerId']>;\n\ntype UseDragAndDropReturn<E extends Element = HTMLElement> = [\n props: {\n handlerId: Identifier;\n isDragging: boolean;\n handleKeyDown: <E extends Element>(event: React.KeyboardEvent<E>) => void;\n isOverDropTarget: boolean;\n direction: (typeof DIRECTIONS)[keyof typeof DIRECTIONS] | null;\n },\n objectRef: React.RefObject<E>,\n dropRef: ConnectDropTarget,\n dragRef: ConnectDragSource,\n dragPreviewRef: ConnectDragPreview,\n];\n\ntype DropCollectedProps = {\n handlerId: Identifier;\n isOver: boolean;\n};\n\n/**\n * A utility hook abstracting the general drag and drop hooks from react-dnd.\n * Centralising the same behaviours and by default offering keyboard support.\n */\nconst useDragAndDrop = <\n TIndex extends number | Array<number>,\n TItem extends { index: TIndex; id?: Data.ID; [key: string]: unknown } = {\n index: TIndex;\n [key: string]: unknown;\n },\n E extends Element = HTMLElement,\n>(\n active: boolean,\n {\n type = 'STRAPI_DND',\n index,\n item,\n onStart,\n onEnd,\n onGrabItem,\n onDropItem,\n onCancel,\n onMoveItem,\n dropSensitivity = DROP_SENSITIVITY.REGULAR,\n }: UseDragAndDropOptions<TIndex, TItem>\n): UseDragAndDropReturn<E> => {\n const objectRef = React.useRef<E>(null);\n\n const [{ handlerId, isOver }, dropRef] = useDrop<TItem, void, DropCollectedProps>({\n accept: type,\n collect(monitor) {\n return {\n handlerId: monitor.getHandlerId(),\n isOver: monitor.isOver({ shallow: true }),\n };\n },\n drop(item) {\n const draggedIndex = item.index;\n const newIndex = index;\n\n if (isOver && onDropItem) {\n onDropItem(draggedIndex, newIndex);\n }\n },\n hover(item, monitor) {\n if (!objectRef.current || !onMoveItem) {\n return;\n }\n\n const dragIndex = item.index;\n const newIndex = index;\n\n const hoverBoundingRect = objectRef.current?.getBoundingClientRect();\n const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;\n const clientOffset = monitor.getClientOffset();\n if (!clientOffset) return;\n\n const hoverClientY = clientOffset && clientOffset.y - hoverBoundingRect.top;\n if (typeof dragIndex === 'number' && typeof newIndex === 'number') {\n if (dragIndex === newIndex) {\n // Don't replace items with themselves\n return;\n }\n\n if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {\n // Dragging downwards\n if (dragIndex < newIndex && hoverClientY < hoverMiddleY) {\n return;\n }\n\n // Dragging upwards\n if (dragIndex > newIndex && hoverClientY > hoverMiddleY) {\n return;\n }\n }\n\n // Time to actually perform the action\n onMoveItem(newIndex, dragIndex);\n item.index = newIndex;\n } else {\n // Using numbers as indices doesn't work for nested list items with path like [1, 1, 0]\n if (Array.isArray(dragIndex) && Array.isArray(newIndex)) {\n // Indices comparison to find item position in nested list\n const minLength = Math.min(dragIndex.length, newIndex.length);\n let areEqual = true;\n let isLessThan = false;\n let isGreaterThan = false;\n\n for (let i = 0; i < minLength; i++) {\n if (dragIndex[i] < newIndex[i]) {\n isLessThan = true;\n areEqual = false;\n break;\n } else if (dragIndex[i] > newIndex[i]) {\n isGreaterThan = true;\n areEqual = false;\n break;\n }\n }\n\n // Don't replace items with themselves\n if (areEqual && dragIndex.length === newIndex.length) {\n return;\n }\n\n if (dropSensitivity === DROP_SENSITIVITY.REGULAR) {\n // Dragging downwards\n if (isLessThan && !isGreaterThan && hoverClientY < hoverMiddleY) {\n return;\n }\n\n // Dragging upwards\n if (isGreaterThan && !isLessThan && hoverClientY > hoverMiddleY) {\n return;\n }\n }\n }\n\n onMoveItem(newIndex, dragIndex);\n item.index = newIndex;\n }\n },\n });\n\n const getDragDirection = (monitor: DragSourceMonitor<TItem, void>) => {\n if (\n monitor &&\n monitor.isDragging() &&\n !monitor.didDrop() &&\n monitor.getInitialClientOffset() &&\n monitor.getClientOffset()\n ) {\n const deltaY = monitor.getInitialClientOffset()!.y - monitor.getClientOffset()!.y;\n\n if (deltaY > 0) return DIRECTIONS.UPWARD;\n\n if (deltaY < 0) return DIRECTIONS.DOWNWARD;\n\n return null;\n }\n\n return null;\n };\n\n const [{ isDragging, direction }, dragRef, dragPreviewRef] = useDrag({\n type,\n item() {\n if (onStart) {\n onStart();\n }\n\n /**\n * This will be attached and it helps define the preview sizes\n * when a component is flexy e.g. Relations\n */\n const { width } = objectRef.current?.getBoundingClientRect() ?? {};\n\n return { index, width, ...item };\n },\n end() {\n if (onEnd) {\n onEnd();\n }\n },\n canDrag: active,\n /**\n * This is useful when the item is in a virtualized list.\n * However, if we don't have an ID then we want the libraries\n * defaults to take care of this.\n */\n isDragging: item?.id\n ? (monitor) => {\n return item.id === monitor.getItem().id;\n }\n : undefined,\n collect: (monitor) => ({\n isDragging: monitor.isDragging(),\n initialOffset: monitor.getInitialClientOffset(),\n currentOffset: monitor.getClientOffset(),\n direction: getDragDirection(monitor),\n }),\n });\n\n const handleKeyDown = useKeyboardDragAndDrop(active, index, {\n onGrabItem,\n onDropItem,\n onCancel,\n onMoveItem,\n });\n\n return [\n { handlerId, isDragging, handleKeyDown, isOverDropTarget: isOver, direction },\n objectRef,\n dropRef,\n dragRef,\n dragPreviewRef,\n ];\n};\n\nexport {\n useDragAndDrop,\n UseDragAndDropReturn,\n UseDragAndDropOptions,\n DIRECTIONS,\n DROP_SENSITIVITY,\n};\n","import { Box, BoxComponent, ButtonProps, Flex, Typography } from '@strapi/design-system';\nimport { PlusCircle } from '@strapi/icons';\nimport { styled } from 'styled-components';\n\nexport const AddStage = ({ children, ...props }: ButtonProps) => {\n return (\n <StyledButton\n tag=\"button\"\n background=\"neutral0\"\n borderColor=\"neutral150\"\n paddingBottom={3}\n paddingLeft={4}\n paddingRight={4}\n paddingTop={3}\n shadow=\"filterShadow\"\n {...props}\n >\n <Typography variant=\"pi\" fontWeight=\"bold\">\n <Flex tag=\"span\" gap={2}>\n <PlusCircle width=\"2.4rem\" height=\"2.4rem\" aria-hidden />\n {children}\n </Flex>\n </Typography>\n </StyledButton>\n );\n};\n\nconst StyledButton = styled<BoxComponent<'button'>>(Box)`\n border-radius: 26px;\n color: ${({ theme }) => theme.colors.neutral500};\n\n &:hover {\n color: ${({ theme }) => theme.colors.primary600};\n }\n\n &:active {\n color: ${({ theme }) => theme.colors.primary600};\n }\n`;\n","import * as React from 'react';\n\nimport {\n useField,\n useForm,\n useTracking,\n ConfirmDialog,\n useNotification,\n InputRenderer as AdminInputRenderer,\n InputProps,\n} from '@strapi/admin/strapi-admin';\nimport {\n Box,\n Flex,\n MultiSelectOption,\n Accordion,\n Grid,\n IconButton,\n MultiSelect,\n MultiSelectGroup,\n SingleSelect,\n SingleSelectOption,\n TextInput,\n VisuallyHidden,\n useComposedRefs,\n Menu,\n MenuItem,\n Field,\n Dialog,\n} from '@strapi/design-system';\nimport { Duplicate, Drag, More, EyeStriked } from '@strapi/icons';\nimport { getEmptyImage } from 'react-dnd-html5-backend';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { Stage as IStage, StagePermission } from '../../../../../shared/contracts/review-workflows';\nimport { useGetAdminRolesQuery } from '../../../services/admin';\nimport { AVAILABLE_COLORS, getStageColorByHex } from '../../../utils/colors';\nimport { DRAG_DROP_TYPES } from '../constants';\nimport { useDragAndDrop } from '../hooks/useDragAndDrop';\n\nimport { AddStage } from './AddStage';\n\ninterface WorkflowStage extends Pick<IStage, 'id' | 'name' | 'permissions' | 'color'> {\n __temp_key__: string;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Stages\n * -----------------------------------------------------------------------------------------------*/\ninterface StagesProps {\n canDelete?: boolean;\n canUpdate?: boolean;\n isCreating?: boolean;\n}\n\nconst Stages = ({ canDelete = true, canUpdate = true, isCreating }: StagesProps) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const addFieldRow = useForm('Stages', (state) => state.addFieldRow);\n const { value: stages = [] } = useField<WorkflowStage[]>('stages');\n\n return (\n <Flex direction=\"column\" gap={6} width=\"100%\">\n <Box position=\"relative\" width=\"100%\">\n <Background\n background=\"neutral200\"\n height=\"100%\"\n left=\"50%\"\n position=\"absolute\"\n top=\"0\"\n width={2}\n />\n\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6} position=\"relative\" tag=\"ol\">\n {stages.map((stage, index) => {\n return (\n <Box key={stage.__temp_key__} tag=\"li\">\n <Stage\n index={index}\n canDelete={stages.length > 1 && canDelete}\n canReorder={stages.length > 1}\n canUpdate={canUpdate}\n stagesCount={stages.length}\n defaultOpen={isCreating}\n {...stage}\n />\n </Box>\n );\n })}\n </Flex>\n </Box>\n\n {canUpdate && (\n <AddStage\n type=\"button\"\n onClick={() => {\n addFieldRow('stages', { name: '' });\n trackUsage('willCreateStage');\n }}\n >\n {formatMessage({\n id: 'Settings.review-workflows.stage.add',\n defaultMessage: 'Add new stage',\n })}\n </AddStage>\n )}\n </Flex>\n );\n};\n\nconst Background = styled(Box)`\n transform: translateX(-50%);\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * Stage\n * -----------------------------------------------------------------------------------------------*/\ninterface StageProps extends WorkflowStage {\n canDelete?: boolean;\n canReorder?: boolean;\n canUpdate?: boolean;\n index: number;\n stagesCount: number;\n defaultOpen?: boolean;\n}\n\nconst Stage = ({\n index,\n canDelete = false,\n canReorder = false,\n canUpdate = false,\n stagesCount,\n name,\n permissions,\n color,\n defaultOpen,\n}: StageProps) => {\n const [liveText, setLiveText] = React.useState<string>();\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const stageErrors = useForm('Stages', (state) => state.errors.stages as object[]);\n const error = stageErrors?.[index];\n const addFieldRow = useForm('Stage', (state) => state.addFieldRow);\n const moveFieldRow = useForm('Stage', (state) => state.moveFieldRow);\n const removeFieldRow = useForm('Stage', (state) => state.removeFieldRow);\n\n const getItemPos = (index: number) => `${index + 1} of ${stagesCount}`;\n\n const handleGrabStage = (index: number) => {\n setLiveText(\n formatMessage(\n {\n id: 'dnd.grab-item',\n defaultMessage: `{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel.`,\n },\n {\n item: name,\n position: getItemPos(index),\n }\n )\n );\n };\n\n const handleDropStage = (index: number) => {\n setLiveText(\n formatMessage(\n {\n id: 'dnd.drop-item',\n defaultMessage: `{item}, dropped. Final position in list: {position}.`,\n },\n {\n item: name,\n position: getItemPos(index),\n }\n )\n );\n };\n\n const handleCancelDragStage = () => {\n setLiveText(\n formatMessage(\n {\n id: 'dnd.cancel-item',\n defaultMessage: '{item}, dropped. Re-order cancelled.',\n },\n {\n item: name,\n }\n )\n );\n };\n\n const handleMoveStage = (newIndex: number, oldIndex: number) => {\n setLiveText(\n formatMessage(\n {\n id: 'dnd.reorder',\n defaultMessage: '{item}, moved. New position in list: {position}.',\n },\n {\n item: name,\n position: getItemPos(newIndex),\n }\n )\n );\n\n moveFieldRow('stages', oldIndex, newIndex);\n };\n\n const [{ handlerId, isDragging, handleKeyDown }, stageRef, dropRef, dragRef, dragPreviewRef] =\n useDragAndDrop(canReorder, {\n index,\n item: {\n index,\n name,\n },\n onGrabItem: handleGrabStage,\n onDropItem: handleDropStage,\n onMoveItem: handleMoveStage,\n onCancel: handleCancelDragStage,\n type: DRAG_DROP_TYPES.STAGE,\n });\n\n // @ts-expect-error – the stageRef is incorrectly typed.\n const composedRef = useComposedRefs<HTMLDivElement>(stageRef, dropRef);\n\n React.useEffect(() => {\n dragPreviewRef(getEmptyImage(), { captureDraggingState: false });\n }, [dragPreviewRef, index]);\n\n const handleCloneClick = () => {\n addFieldRow('stages', { name, color, permissions });\n };\n\n const id = React.useId();\n\n return (\n <Box ref={composedRef} shadow=\"tableShadow\">\n {liveText && <VisuallyHidden aria-live=\"assertive\">{liveText}</VisuallyHidden>}\n\n {isDragging ? (\n <Box\n background=\"primary100\"\n borderStyle=\"dashed\"\n borderColor=\"primary600\"\n borderWidth=\"1px\"\n display=\"block\"\n hasRadius\n padding={6}\n />\n ) : (\n <AccordionRoot\n onValueChange={(value) => {\n if (value) {\n trackUsage('willEditStage');\n }\n }}\n defaultValue={defaultOpen ? id : undefined}\n $error={Object.values(error ?? {}).length > 0}\n >\n <Accordion.Item value={id}>\n <Accordion.Header>\n <Accordion.Trigger>{name}</Accordion.Trigger>\n <Accordion.Actions>\n {canDelete || canUpdate ? (\n <>\n <Menu.Root>\n <ContextMenuTrigger size=\"S\" endIcon={null} paddingLeft={2} paddingRight={2}>\n <More aria-hidden focusable={false} />\n <VisuallyHidden tag=\"span\">\n {formatMessage({\n id: '[tbdb].components.DynamicZone.more-actions',\n defaultMessage: 'More actions',\n })}\n </VisuallyHidden>\n </ContextMenuTrigger>\n {/* z-index needs to be as big as the one defined for the wrapper in Stages, otherwise the menu\n * disappears behind the accordion\n */}\n <Menu.Content popoverPlacement=\"bottom-end\" zIndex={2}>\n <Menu.SubRoot>\n {canUpdate && (\n <MenuItem onClick={handleCloneClick}>\n {formatMessage({\n id: 'Settings.review-workflows.stage.delete',\n defaultMessage: 'Duplicate stage',\n })}\n </MenuItem>\n )}\n\n {canDelete && (\n <DeleteMenuItem onClick={() => removeFieldRow('stages', index)}>\n {formatMessage({\n id: 'Settings.review-workflows.stage.delete',\n defaultMessage: 'Delete',\n })}\n </DeleteMenuItem>\n )}\n </Menu.SubRoot>\n </Menu.Content>\n </Menu.Root>\n\n {canUpdate && (\n <IconButton\n background=\"transparent\"\n hasRadius\n borderWidth={0}\n data-handler-id={handlerId}\n ref={dragRef}\n label={formatMessage({\n id: 'Settings.review-workflows.stage.drag',\n defaultMessage: 'Drag',\n })}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={handleKeyDown}\n >\n <Drag />\n </IconButton>\n )}\n </>\n ) : null}\n </Accordion.Actions>\n </Accordion.Header>\n <Accordion.Content>\n <Grid.Root gap={4} padding={6}>\n {[\n {\n disabled: !canUpdate,\n label: formatMessage({\n id: 'Settings.review-workflows.stage.name.label',\n defaultMessage: 'Stage name',\n }),\n name: `stages.${index}.name`,\n required: true,\n size: 6,\n type: 'string' as const,\n },\n {\n disabled: !canUpdate,\n label: formatMessage({\n id: 'content-manager.reviewWorkflows.stage.color',\n defaultMessage: 'Color',\n }),\n name: `stages.${index}.color`,\n required: true,\n size: 6,\n type: 'color' as const,\n },\n {\n disabled: !canUpdate,\n label: formatMessage({\n id: 'Settings.review-workflows.stage.permissions.label',\n defaultMessage: 'Roles that can change this stage',\n }),\n name: `stages.${index}.permissions`,\n placeholder: formatMessage({\n id: 'Settings.review-workflows.stage.permissions.placeholder',\n defaultMessage: 'Select a role',\n }),\n required: true,\n size: 6,\n type: 'permissions' as const,\n },\n ].map(({ size, ...field }) => (\n <Grid.Item key={field.name} col={size}>\n <InputRenderer {...field} />\n </Grid.Item>\n ))}\n </Grid.Root>\n </Accordion.Content>\n </Accordion.Item>\n </AccordionRoot>\n )}\n </Box>\n );\n};\n\nconst AccordionRoot = styled(Accordion.Root)<{ $error?: boolean }>`\n border: 1px solid\n ${({ theme, $error }) => ($error ? theme.colors.danger600 : theme.colors.neutral200)};\n`;\n\nconst DeleteMenuItem = styled(MenuItem)`\n color: ${({ theme }) => theme.colors.danger600};\n`;\n\n// Removing the font-size from the child-span aligns the\n// more icon vertically\nconst ContextMenuTrigger = styled(Menu.Trigger)`\n :hover,\n :focus {\n background-color: ${({ theme }) => theme.colors.neutral100};\n }\n\n > span {\n font-size: 0;\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * InputRenderer\n * -----------------------------------------------------------------------------------------------*/\n\ntype InputRendererProps = InputProps | ColorSelectorProps | PermissionsFieldProps;\n\nconst InputRenderer = (props: InputRendererProps) => {\n switch (props.type) {\n case 'color':\n return <ColorSelector {...props} />;\n case 'permissions':\n return <PermissionsField {...props} />;\n default:\n return <AdminInputRenderer {...props} />;\n }\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ColorSelector\n * -----------------------------------------------------------------------------------------------*/\n\ninterface ColorSelectorProps\n extends Omit<Extract<InputProps, { type: 'enumeration' }>, 'type' | 'options'> {\n type: 'color';\n}\n\nconst ColorSelector = ({ disabled, label, name, required }: ColorSelectorProps) => {\n const { formatMessage } = useIntl();\n const { value, error, onChange } = useField<string>(name);\n\n const colorOptions = AVAILABLE_COLORS.map(({ hex, name }) => ({\n value: hex,\n label: formatMessage(\n {\n id: 'Settings.review-workflows.stage.color.name',\n defaultMessage: '{name}',\n },\n { name }\n ),\n color: hex,\n }));\n\n const { themeColorName } = getStageColorByHex(value) ?? {};\n\n return (\n <Field.Root error={error} name={name} required={required}>\n <Field.Label>{label}</Field.Label>\n <SingleSelect\n disabled={disabled}\n onChange={(v) => {\n onChange(name, v.toString());\n }}\n value={value?.toUpperCase()}\n startIcon={\n <Flex\n tag=\"span\"\n height={2}\n background={value}\n // @ts-expect-error - transparent doesn't exist in theme.colors\n borderColor={themeColorName === 'neutral0' ? 'neutral150' : 'transparent'}\n hasRadius\n shrink={0}\n width={2}\n />\n }\n >\n {colorOptions.map(({ value, label, color }) => {\n const { themeColorName } = getStageColorByHex(color) || {};\n\n return (\n <SingleSelectOption\n value={value}\n key={value}\n startIcon={\n <Flex\n tag=\"span\"\n height={2}\n background={color}\n // @ts-expect-error - transparent doesn't exist in theme.colors\n borderColor={themeColorName === 'neutral0' ? 'neutral150' : 'transparent'}\n hasRadius\n shrink={0}\n width={2}\n />\n }\n >\n {label}\n </SingleSelectOption>\n );\n })}\n </SingleSelect>\n <Field.Error />\n </Field.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PermissionsField\n * -----------------------------------------------------------------------------------------------*/\ninterface PermissionsFieldProps\n extends Omit<Extract<InputProps, { type: 'enumeration' }>, 'type' | 'options'> {\n type: 'permissions';\n}\n\nconst PermissionsField = ({ disabled, name, placeholder, required }: PermissionsFieldProps) => {\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n const [isApplyAllConfirmationOpen, setIsApplyAllConfirmationOpen] = React.useState(false);\n const { value = [], error, onChange } = useField<StagePermission[]>(name);\n const allStages = useForm<WorkflowStage[]>('PermissionsField', (state) => state.values.stages);\n const onFormValueChange = useForm('PermissionsField', (state) => state.onChange);\n const rolesErrorCount = React.useRef(0);\n\n const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();\n\n // Super admins always have permissions to do everything and therefore\n // there is no point for this role to show up in the role combobox\n const filteredRoles = roles?.filter((role) => role.code !== 'strapi-super-admin') ?? [];\n\n React.useEffect(() => {\n if (\n !isLoading &&\n getRolesError &&\n 'status' in getRolesError &&\n getRolesError.status == 403 &&\n rolesErrorCount.current === 0\n ) {\n rolesErrorCount.current = 1;\n\n toggleNotification({\n blockTransition: true,\n type: 'danger',\n message: formatMessage({\n id: 'review-workflows.stage.permissions.noPermissions.description',\n defaultMessage: 'You don’t have the permission to see roles. Contact your administrator.',\n }),\n });\n }\n }, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);\n\n if (!isLoading && filteredRoles.length === 0) {\n return (\n <Field.Root\n name={name}\n hint={formatMessage({\n id: 'Settings.review-workflows.stage.permissions.noPermissions.description',\n defaultMessage: 'You don’t have the permission to see roles',\n })}\n required={required}\n >\n <Field.Label>\n {formatMessage({\n id: 'Settings.review-workflows.stage.permissions.label',\n defaultMessage: 'Roles that can change this stage',\n })}\n </Field.Label>\n <TextInput\n disabled\n placeholder={formatMessage({\n id: 'components.NotAllowedInput.text',\n defaultMessage: 'No permissions to see this field',\n })}\n startAction={<EyeStriked fill=\"neutral600\" />}\n type=\"text\"\n value=\"\"\n />\n <Field.Hint />\n </Field.Root>\n );\n }\n\n return (\n <>\n <Flex alignItems=\"flex-end\" gap={3}>\n <PermissionWrapper grow={1}>\n <Field.Root error={error} name={name} required>\n <Field.Label>\n {formatMessage({\n id: 'Settings.review-workflows.stage.permissions.label',\n defaultMessage: 'Roles that can change this stage',\n })}\n </Field.Label>\n <MultiSelect\n disabled={disabled}\n onChange={(values) => {\n // Because the select components expects strings for values, but\n // the yup schema validates we are sending full permission objects to the API,\n // we must coerce the string value back to an object\n const permissions = values.map((value) => ({\n role: parseInt(value, 10),\n action: 'admin::review-workflows.stage.transition',\n }));\n\n onChange(name, permissions);\n }}\n placeholder={placeholder}\n // The Select component expects strings for values\n value={value.map((permission) => `${permission.role}`)}\n withTags\n >\n <MultiSelectGroup\n label={formatMessage({\n id: 'Settings.review-workflows.stage.permissions.allRoles.label',\n defaultMessage: 'All roles',\n })}\n values={filteredRoles.map((r) => `${r.id}`)}\n >\n {filteredRoles.map((role) => {\n return (\n <NestedOption key={role.id} value={`${role.id}`}>\n {role.name}\n </NestedOption>\n );\n })}\n </MultiSelectGroup>\n </MultiSelect>\n <Field.Error />\n </Field.Root>\n </PermissionWrapper>\n <Dialog.Root open={isApplyAllConfirmationOpen} onOpenChange={setIsApplyAllConfirmationOpen}>\n <Dialog.Trigger>\n <IconButton\n disabled={disabled}\n label={formatMessage({\n id: 'Settings.review-workflows.stage.permissions.apply.label',\n defaultMessage: 'Apply to all stages',\n })}\n size=\"L\"\n variant=\"secondary\"\n >\n <Duplicate />\n </IconButton>\n </Dialog.Trigger>\n <ConfirmDialog\n onConfirm={() => {\n onFormValueChange(\n 'stages',\n allStages.map((stage) => ({\n ...stage,\n permissions: value,\n }))\n );\n\n setIsApplyAllConfirmationOpen(false);\n toggleNotification({\n type: 'success',\n message: formatMessage({\n id: 'Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success',\n defaultMessage: 'Applied roles to all other stages of the workflow',\n }),\n });\n }}\n variant=\"default\"\n >\n {formatMessage({\n id: 'Settings.review-workflows.page.edit.confirm.stages.permissions.copy',\n defaultMessage:\n 'Roles that can change that stage will be applied to all the other stages.',\n })}\n </ConfirmDialog>\n </Dialog.Root>\n </Flex>\n </>\n );\n};\n\nconst NestedOption = styled(MultiSelectOption)`\n padding-left: ${({ theme }) => theme.spaces[7]};\n`;\n\n// Grow the size of the permission Select\nconst PermissionWrapper = styled(Flex)`\n > * {\n flex-grow: 1;\n }\n`;\n\nexport { Stages };\nexport type { StagesProps, WorkflowStage };\n","import { InputRenderer, useField, useForm } from '@strapi/admin/strapi-admin';\nimport {\n Field,\n Grid,\n MultiSelect,\n MultiSelectGroup,\n MultiSelectOption,\n Typography,\n useCollator,\n} from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { useGetContentTypesQuery } from '../../../services/content-manager';\nimport { useReviewWorkflows } from '../hooks/useReviewWorkflows';\n\n/* -------------------------------------------------------------------------------------------------\n * WorkflowAttributes\n * -----------------------------------------------------------------------------------------------*/\ninterface WorkflowAttributesProps {\n canUpdate?: boolean;\n}\n\nconst WorkflowAttributes = ({ canUpdate = true }: WorkflowAttributesProps) => {\n const { formatMessage } = useIntl();\n\n return (\n <Grid.Root background=\"neutral0\" hasRadius gap={4} padding={6} shadow=\"tableShadow\">\n <Grid.Item col={6}>\n <InputRenderer\n disabled={!canUpdate}\n label={formatMessage({\n id: 'Settings.review-workflows.workflow.name.label',\n defaultMessage: 'Workflow Name',\n })}\n name=\"name\"\n required\n type=\"string\"\n />\n </Grid.Item>\n <Grid.Item col={6}>\n <ContentTypesSelector disabled={!canUpdate} />\n </Grid.Item>\n </Grid.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ContentTypesSelector\n * -----------------------------------------------------------------------------------------------*/\ninterface ContentTypesSelectorProps {\n disabled?: boolean;\n}\n\nconst ContentTypesSelector = ({ disabled }: ContentTypesSelectorProps) => {\n const { formatMessage, locale } = useIntl();\n const { data: contentTypes, isLoading } = useGetContentTypesQuery();\n const { workflows } = useReviewWorkflows();\n const currentWorkflow = useForm('ContentTypesSelector', (state) => state.values);\n\n const { error, value, onChange } = useField('contentTypes');\n\n const formatter = useCollator(locale, {\n sensitivity: 'base',\n });\n\n const isDisabled =\n disabled ||\n isLoading ||\n !contentTypes ||\n (contentTypes.collectionType.length === 0 && contentTypes.singleType.length === 0);\n\n const collectionTypes = (contentTypes?.collectionType ?? [])\n .toSorted((a, b) => formatter.compare(a.info.displayName, b.info.displayName))\n .map((contentType) => ({\n label: contentType.info.displayName,\n value: contentType.uid,\n }));\n\n const singleTypes = (contentTypes?.singleType ?? []).map((contentType) => ({\n label: contentType.info.displayName,\n value: contentType.uid,\n }));\n\n return (\n <Field.Root error={error} name={'contentTypes'}>\n <Field.Label>\n {formatMessage({\n id: 'Settings.review-workflows.workflow.contentTypes.label',\n defaultMessage: 'Associated to',\n })}\n </Field.Label>\n <MultiSelect\n customizeContent={(value) =>\n formatMessage(\n {\n id: 'Settings.review-workflows.workflow.contentTypes.displayValue',\n defaultMessage:\n '{count} {count, plural, one {content type} other {content types}} selected',\n },\n { count: value?.length }\n )\n }\n disabled={isDisabled}\n onChange={(values) => {\n onChange('contentTypes', values);\n }}\n value={value}\n placeholder={formatMessage({\n id: 'Settings.review-workflows.workflow.contentTypes.placeholder',\n defaultMessage: 'Select',\n })}\n >\n {[\n ...(collectionTypes.length > 0\n ? [\n {\n label: formatMessage({\n id: 'Settings.review-workflows.workflow.contentTypes.collectionTypes.label',\n defaultMessage: 'Collection Types',\n }),\n children: collectionTypes,\n },\n ]\n : []),\n\n ...(singleTypes.length > 0\n ? [\n {\n label: formatMessage({\n id: 'Settings.review-workflows.workflow.contentTypes.singleTypes.label',\n defaultMessage: 'Single Types',\n }),\n children: singleTypes,\n },\n ]\n : []),\n ].map((opt) => {\n return (\n <MultiSelectGroup\n key={opt.label}\n label={opt.label}\n values={opt.children.map((child) => child.value.toString())}\n >\n {opt.children.map((child) => {\n const { name: assignedWorkflowName } =\n workflows?.find(\n (workflow) =>\n ((currentWorkflow && workflow.id !== currentWorkflow.id) ||\n !currentWorkflow) &&\n workflow.contentTypes.includes(child.value)\n ) ?? {};\n\n return (\n <NestedOption key={child.value} value={child.value}>\n <Typography>\n {\n // @ts-expect-error - formatMessage options doesn't expect to be a React component but that's what we need actually for the <i> and <em> components\n formatMessage(\n {\n id: 'Settings.review-workflows.workflow.contentTypes.assigned.notice',\n defaultMessage:\n '{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}',\n },\n {\n label: child.label,\n name: assignedWorkflowName,\n em: (...children) => (\n <Typography tag=\"em\" fontWeight=\"bold\">\n {children}\n </Typography>\n ),\n i: (...children) => (\n <ContentTypeTakeNotice>{children}</ContentTypeTakeNotice>\n ),\n }\n )\n }\n </Typography>\n </NestedOption>\n );\n })}\n </MultiSelectGroup>\n );\n })}\n </MultiSelect>\n </Field.Root>\n );\n};\n\nconst NestedOption = styled(MultiSelectOption)`\n padding-left: ${({ theme }) => theme.spaces[7]};\n`;\n\nconst ContentTypeTakeNotice = styled(Typography)`\n font-style: italic;\n`;\n\nexport { WorkflowAttributes };\nexport type { WorkflowAttributesProps };\n","import * as React from 'react';\n\nimport {\n ConfirmDialog,\n BackButton,\n useNotification,\n useAPIErrorHandler,\n useRBAC,\n Form,\n Page,\n FormProps,\n FormHelpers,\n} from '@strapi/admin/strapi-admin';\nimport { useLicenseLimits } from '@strapi/admin/strapi-admin/ee';\nimport { Button, Dialog, Flex, Typography } from '@strapi/design-system';\nimport { Check } from '@strapi/icons';\nimport { generateNKeysBetween } from 'fractional-indexing';\nimport { useIntl } from 'react-intl';\nimport { useDispatch } from 'react-redux';\nimport { useNavigate, useParams } from 'react-router-dom';\nimport * as yup from 'yup';\n\nimport { LimitsModal } from '../../components/LimitsModal';\nimport {\n CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME,\n CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME,\n} from '../../constants';\nimport { useTypedSelector } from '../../modules/hooks';\nimport { isBaseQueryError } from '../../utils/api';\n\nimport * as Layout from './components/Layout';\nimport { Stages, WorkflowStage } from './components/Stages';\nimport { WorkflowAttributes } from './components/WorkflowAttributes';\nimport { useReviewWorkflows } from './hooks/useReviewWorkflows';\n\nimport type { Stage, Workflow } from '../../../../shared/contracts/review-workflows';\n\n/* -------------------------------------------------------------------------------------------------\n * EditPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst WORKFLOW_SCHEMA = yup.object({\n contentTypes: yup.array().of(yup.string()),\n name: yup\n .string()\n .max(255, {\n id: 'review-workflows.validation.name.max-length',\n defaultMessage: 'Name can not be longer than 255 characters',\n })\n .required(),\n stages: yup\n .array()\n .of(\n yup.object().shape({\n name: yup\n .string()\n .required({\n id: 'review-workflows.validation.stage.name',\n defaultMessage: 'Name is required',\n })\n .max(255, {\n id: 'review-workflows.validation.stage.max-length',\n defaultMessage: 'Name can not be longer than 255 characters',\n })\n .test(\n 'unique-name',\n {\n id: 'review-workflows.validation.stage.duplicate',\n defaultMessage: 'Stage name must be unique',\n },\n (stageName, context) => {\n // @ts-expect-error it does exist.\n const { stages } = context.from[1].value;\n\n return stages.filter((stage: Stage) => stage.name === stageName).length === 1;\n }\n ),\n color: yup\n .string()\n .required({\n id: 'review-workflows.validation.stage.color',\n defaultMessage: 'Color is required',\n })\n .matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i),\n\n permissions: yup\n .array(\n yup.object({\n role: yup\n .number()\n .strict()\n .typeError({\n id: 'review-workflows.validation.stage.permissions.role.number',\n defaultMessage: 'Role must be of type number',\n })\n .required(),\n action: yup.string().required({\n id: 'review-workflows.validation.stage.permissions.action.required',\n defaultMessage: 'Action is a required argument',\n }),\n })\n )\n .strict(),\n })\n )\n .min(1),\n});\n\nconst EditPage = () => {\n const { id = '' } = useParams<{ id: string }>();\n const isCreatingWorkflow = id === 'create';\n const { formatMessage } = useIntl();\n const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();\n const navigate = useNavigate();\n const { toggleNotification } = useNotification();\n const dispatch = useDispatch();\n const {\n isLoading: isLoadingWorkflow,\n meta,\n workflows,\n error,\n update,\n create,\n } = useReviewWorkflows({ id: isCreatingWorkflow ? undefined : id });\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions['settings']?.['review-workflows']\n );\n const {\n allowedActions: { canDelete, canUpdate, canCreate },\n } = useRBAC(permissions);\n\n const [savePrompts, setSavePrompts] = React.useState<{\n hasDeletedServerStages?: boolean;\n hasReassignedContentTypes?: boolean;\n }>({});\n const { getFeature, isLoading: isLicenseLoading } = useLicenseLimits();\n const [showLimitModal, setShowLimitModal] = React.useState<'workflow' | 'stage' | null>(null);\n\n const currentWorkflow = workflows?.find((workflow) => workflow.id === parseInt(id, 10));\n const contentTypesFromOtherWorkflows = workflows\n ?.filter((workflow) => workflow.id !== parseInt(id, 10))\n .flatMap((workflow) => workflow.contentTypes);\n\n const limits = getFeature<string>('review-workflows');\n const numberOfWorkflows = limits?.[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME];\n const stagesPerWorkflow = limits?.[CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME];\n\n interface FormValues {\n name: string;\n stages: WorkflowStage[];\n contentTypes: string[];\n }\n\n const submitForm = async (data: FormValues, helpers: Pick<FormHelpers, 'setErrors'>) => {\n try {\n if (!isCreatingWorkflow) {\n const res = await update(id, {\n ...data,\n // compare permissions of stages and only submit them if at least one has\n // changed; this enables partial updates e.g. for users who don't have\n // permissions to see roles\n stages: data.stages.map((stage) => {\n let hasUpdatedPermissions = true;\n const serverStage = currentWorkflow?.stages?.find(\n (serverStage) => serverStage.id === stage?.id\n );\n if (serverStage) {\n hasUpdatedPermissions =\n serverStage.permissions?.length !== stage.permissions?.length ||\n !serverStage.permissions?.every(\n (serverPermission) =>\n !!stage.permissions?.find(\n (permission) => permission.role === serverPermission.role\n )\n );\n }\n return {\n ...stage,\n permissions: hasUpdatedPermissions ? stage.permissions : undefined,\n } satisfies Stage;\n }),\n });\n\n if ('error' in res && isBaseQueryError(res.error) && res.error.name === 'ValidationError') {\n helpers.setErrors(formatValidationErrors(res.error));\n } else if ('data' in res) {\n for (const uid of res.data.contentTypes) {\n // Invalidates the content-manager's API cache for the document layout so we can see RW enabled.\n dispatch({\n type: 'contentManagerApi/invalidateTags',\n payload: [\n {\n type: 'ContentTypesConfiguration',\n id: uid,\n },\n ],\n });\n }\n }\n } else {\n const res = await create(data);\n\n if ('error' in res && isBaseQueryError(res.error) && res.error.name === 'ValidationError') {\n helpers.setErrors(formatValidationErrors(res.error));\n } else if ('data' in res) {\n for (const uid of res.data.contentTypes) {\n // Invalidates the content-manager's API cache for the document layout so we can see RW enabled.\n dispatch({\n type: 'contentManagerApi/invalidateTags',\n payload: [\n {\n type: 'ContentTypesConfiguration',\n id: uid,\n },\n ],\n });\n }\n\n navigate(`../${res.data.id}`);\n }\n }\n } catch (error) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred',\n }),\n });\n }\n setSavePrompts({});\n };\n\n const handleConfirmDeleteDialog =\n (data: FormValues, helpers: Pick<FormHelpers, 'setErrors'>) => async () => {\n await submitForm(data, helpers);\n };\n\n const handleConfirmClose = () => {\n setSavePrompts({});\n };\n\n const handleSubmit: FormProps<FormValues>['onSubmit'] = async (data, helpers) => {\n const isContentTypeReassignment = data.contentTypes.some((contentType) =>\n contentTypesFromOtherWorkflows?.includes(contentType)\n );\n const hasDeletedServerStages =\n !isCreatingWorkflow &&\n !currentWorkflow?.stages.every((stage) =>\n data.stages.some((newStage) => newStage.id === stage.id)\n );\n\n if (meta && numberOfWorkflows && meta?.workflowCount > parseInt(numberOfWorkflows, 10)) {\n /**\n * If the current license has a limit, check if the total count of workflows\n * exceeds that limit and display the limits modal instead of sending the\n * update, because it would throw an API error.\n */\n setShowLimitModal('workflow');\n\n /**\n * If the current license has a limit, check if the total count of stages\n * exceeds that limit and display the limits modal instead of sending the\n * update, because it would throw an API error.\n */\n } else if (\n data.stages &&\n stagesPerWorkflow &&\n data.stages.length > parseInt(stagesPerWorkflow, 10)\n ) {\n setShowLimitModal('stage');\n } else if (hasDeletedServerStages || isContentTypeReassignment) {\n if (hasDeletedServerStages) {\n setSavePrompts((prev) => ({ ...prev, hasDeletedServerStages: true }));\n }\n\n if (isContentTypeReassignment) {\n setSavePrompts((prev) => ({ ...prev, hasReassignedContentTypes: true }));\n }\n } else {\n await submitForm(data, helpers);\n }\n };\n\n /**\n * If the current license has a limit:\n * check if the total count of workflows or stages exceeds that limit and display\n * the limits modal on page load. It can be closed by the user, but the\n * API will throw an error in case they try to create a new workflow or update the\n * stages.\n *\n * If the current license does not have a limit (e.g. offline license):\n * do nothing (for now). In case they are trying to create the 201st workflow/ stage\n * the API will throw an error.\n *\n */\n React.useEffect(() => {\n if (!isLoadingWorkflow && !isLicenseLoading) {\n if (meta && numberOfWorkflows && meta?.workflowCount > parseInt(numberOfWorkflows, 10)) {\n setShowLimitModal('workflow');\n } else if (\n currentWorkflow &&\n currentWorkflow.stages &&\n stagesPerWorkflow &&\n currentWorkflow.stages.length > parseInt(stagesPerWorkflow, 10)\n ) {\n setShowLimitModal('stage');\n }\n }\n }, [\n currentWorkflow,\n isLicenseLoading,\n isLoadingWorkflow,\n limits,\n meta,\n numberOfWorkflows,\n stagesPerWorkflow,\n ]);\n\n const initialValues: FormValues = React.useMemo(() => {\n if (isCreatingWorkflow || !currentWorkflow) {\n return {\n name: '',\n stages: [],\n contentTypes: [],\n };\n } else {\n return {\n name: currentWorkflow.name,\n stages: addTmpKeysToStages(currentWorkflow.stages),\n contentTypes: currentWorkflow.contentTypes,\n };\n }\n }, [currentWorkflow, isCreatingWorkflow]);\n\n if (isLoadingWorkflow) {\n return <Page.Loading />;\n }\n\n if (error) {\n return <Page.Error />;\n }\n\n return (\n <>\n <Layout.DragLayerRendered />\n\n <Form\n method={isCreatingWorkflow ? 'POST' : 'PUT'}\n initialValues={initialValues}\n validationSchema={WORKFLOW_SCHEMA}\n onSubmit={handleSubmit}\n >\n {({ modified, isSubmitting, values, setErrors }) => (\n <>\n <Layout.Header\n navigationAction={<BackButton />}\n primaryAction={\n canUpdate || canCreate ? (\n <Button\n startIcon={<Check />}\n type=\"submit\"\n size=\"M\"\n disabled={!modified || isSubmitting || values.stages.length === 0}\n // if the confirm dialog is open the loading state is on\n // the confirm button already\n loading={!Boolean(Object.keys(savePrompts).length > 0) && isSubmitting}\n >\n {formatMessage({\n id: 'global.save',\n defaultMessage: 'Save',\n })}\n </Button>\n ) : null\n }\n subtitle={formatMessage(\n {\n id: 'review-workflows.page.subtitle',\n defaultMessage: '{count, plural, one {# stage} other {# stages}}',\n },\n { count: currentWorkflow?.stages?.length ?? 0 }\n )}\n title={\n currentWorkflow?.name ||\n formatMessage({\n id: 'Settings.review-workflows.create.page.title',\n defaultMessage: 'Create Review Workflow',\n })\n }\n />\n <Layout.Root>\n <Flex alignItems=\"stretch\" direction=\"column\" gap={7}>\n <WorkflowAttributes canUpdate={canUpdate || canCreate} />\n <Stages\n canDelete={canDelete}\n canUpdate={canUpdate || canCreate}\n isCreating={isCreatingWorkflow}\n />\n </Flex>\n </Layout.Root>\n <Dialog.Root\n open={Object.keys(savePrompts).length > 0}\n onOpenChange={handleConfirmClose}\n >\n <ConfirmDialog onConfirm={handleConfirmDeleteDialog(values, { setErrors })}>\n <Flex direction=\"column\" gap={5}>\n {savePrompts.hasDeletedServerStages && (\n <Typography textAlign=\"center\" variant=\"omega\">\n {formatMessage({\n id: 'review-workflows.page.delete.confirm.stages.body',\n defaultMessage:\n 'All entries assigned to deleted stages will be moved to the previous stage.',\n })}\n </Typography>\n )}\n\n {savePrompts.hasReassignedContentTypes && (\n <Typography textAlign=\"center\" variant=\"omega\">\n {formatMessage(\n {\n id: 'review-workflows.page.delete.confirm.contentType.body',\n defaultMessage:\n '{count} {count, plural, one {content-type} other {content-types}} {count, plural, one {is} other {are}} already mapped to {count, plural, one {another workflow} other {other workflows}}. If you save changes, {count, plural, one {this} other {these}} {count, plural, one {content-type} other {{count} content-types}} will no more be mapped to the {count, plural, one {another workflow} other {other workflows}} and all corresponding information will be removed.',\n },\n {\n count:\n contentTypesFromOtherWorkflows?.filter((contentType) =>\n currentWorkflow?.contentTypes?.includes(contentType)\n ).length ?? 0,\n }\n )}\n </Typography>\n )}\n\n <Typography textAlign=\"center\" variant=\"omega\">\n {formatMessage({\n id: 'review-workflows.page.delete.confirm.confirm',\n defaultMessage: 'Are you sure you want to save?',\n })}\n </Typography>\n </Flex>\n </ConfirmDialog>\n </Dialog.Root>\n </>\n )}\n </Form>\n\n <LimitsModal.Root\n open={showLimitModal === 'workflow'}\n onOpenChange={() => setShowLimitModal(null)}\n >\n <LimitsModal.Title>\n {formatMessage({\n id: 'review-workflows.edit.page.workflows.limit.title',\n defaultMessage: 'You’ve reached the limit of workflows in your plan',\n })}\n </LimitsModal.Title>\n\n <LimitsModal.Body>\n {formatMessage({\n id: 'review-workflows.edit.page.workflows.limit.body',\n defaultMessage: 'Delete a workflow or contact Sales to enable more workflows.',\n })}\n </LimitsModal.Body>\n </LimitsModal.Root>\n\n <LimitsModal.Root\n open={showLimitModal === 'stage'}\n onOpenChange={() => setShowLimitModal(null)}\n >\n <LimitsModal.Title>\n {formatMessage({\n id: 'review-workflows.edit.page.stages.limit.title',\n defaultMessage: 'You have reached the limit of stages for this workflow in your plan',\n })}\n </LimitsModal.Title>\n\n <LimitsModal.Body>\n {formatMessage({\n id: 'review-workflows.edit.page.stages.limit.body',\n defaultMessage: 'Try deleting some stages or contact Sales to enable more stages.',\n })}\n </LimitsModal.Body>\n </LimitsModal.Root>\n </>\n );\n};\n\nconst addTmpKeysToStages = (data: Workflow['stages']) => {\n const keys = generateNKeysBetween(undefined, undefined, data.length);\n\n return data.map((datum, index) => ({\n ...datum,\n __temp_key__: keys[index],\n }));\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedEditPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedEditPage = () => {\n const permissions = useTypedSelector((state) => {\n const {\n create = [],\n update = [],\n read = [],\n } = state.admin_app.permissions.settings?.['review-workflows'] ?? {};\n\n return [...create, ...update, ...read];\n });\n\n return (\n <Page.Protect permissions={permissions}>\n <EditPage />\n </Page.Protect>\n );\n};\n\nexport { ProtectedEditPage };\n"],"names":["reviewWorkflowsApi","index","React","useDrop","item","useDrag","jsx","Typography","jsxs","Flex","PlusCircle","styled","Box","useIntl","useTracking","useForm","useField","DRAG_DROP_TYPES","useComposedRefs","getEmptyImage","VisuallyHidden","Accordion","Fragment","Menu","More","MenuItem","IconButton","Drag","Grid","AdminInputRenderer","AVAILABLE_COLORS","name","getStageColorByHex","Field","SingleSelect","value","label","themeColorName","SingleSelectOption","useNotification","TextInput","EyeStriked","MultiSelect","MultiSelectGroup","NestedOption","Dialog","Duplicate","ConfirmDialog","MultiSelectOption","InputRenderer","useGetContentTypesQuery","useReviewWorkflows","useCollator","yup","useParams","useAPIErrorHandler","useNavigate","useDispatch","useTypedSelector","useRBAC","useLicenseLimits","CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME","CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME","serverStage","isBaseQueryError","error","Page","Layout.DragLayerRendered","Form","Layout.Header","BackButton","Button","Check","Layout.Root","LimitsModal","generateNKeysBetween"],"mappings":";;;;;;;;;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