@strapi/review-workflows 0.0.0-experimental.d53e940834bf72ddc725f1d2fd36dac9abec30cb → 0.0.0-experimental.d65615a2b9130dd742d3c396674457d7971da928
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-BWZ_v3U2.js} +8 -9
- package/dist/_chunks/Layout-BWZ_v3U2.js.map +1 -0
- package/dist/_chunks/{Layout-D292CXD6.mjs → Layout-D67sjTk0.mjs} +8 -9
- package/dist/_chunks/Layout-D67sjTk0.mjs.map +1 -0
- package/dist/_chunks/{_id-DqEUzU_u.mjs → _id-V0we8TjF.mjs} +36 -72
- package/dist/_chunks/_id-V0we8TjF.mjs.map +1 -0
- package/dist/_chunks/{_id-CoX9yljN.js → _id-yvj51pI9.js} +36 -72
- package/dist/_chunks/_id-yvj51pI9.js.map +1 -0
- package/dist/_chunks/{index-udedGkii.mjs → index-94iCcgYf.mjs} +79 -68
- package/dist/_chunks/index-94iCcgYf.mjs.map +1 -0
- package/dist/_chunks/{index-D-KMrml_.js → index-B-9wJGm0.js} +78 -67
- package/dist/_chunks/index-B-9wJGm0.js.map +1 -0
- package/dist/_chunks/{index-2nkLt-AE.mjs → index-C1DFk3YF.mjs} +11 -31
- package/dist/_chunks/index-C1DFk3YF.mjs.map +1 -0
- package/dist/_chunks/{index-CDMcvtW9.js → index-DoDtuLNl.js} +9 -29
- package/dist/_chunks/index-DoDtuLNl.js.map +1 -0
- package/dist/_chunks/{router-bmjk-Tpf.mjs → router-BXkSghs6.mjs} +3 -3
- package/dist/_chunks/{router-bmjk-Tpf.mjs.map → router-BXkSghs6.mjs.map} +1 -1
- package/dist/_chunks/{router-C19H1Rju.js → router-By3ObDDu.js} +3 -3
- package/dist/_chunks/{router-C19H1Rju.js.map → router-By3ObDDu.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/services/admin.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/content-manager.d.ts +4 -4
- package/dist/admin/src/services/settings.d.ts +1733 -7
- package/dist/server/index.js +41 -67
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +41 -67
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/assignees.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts +0 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/stages.d.ts.map +1 -1
- package/dist/server/src/controllers/workflows.d.ts +0 -7
- package/dist/server/src/controllers/workflows.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +1 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/review-workflows.d.ts.map +1 -1
- package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +1 -1
- package/dist/server/src/services/stages.d.ts +2 -7
- package/dist/server/src/services/stages.d.ts.map +1 -1
- package/dist/shared/contracts/review-workflows.d.ts +1 -14
- package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/_chunks/Layout-BWzD-Tfe.js.map +0 -1
- package/dist/_chunks/Layout-D292CXD6.mjs.map +0 -1
- package/dist/_chunks/_id-CoX9yljN.js.map +0 -1
- package/dist/_chunks/_id-DqEUzU_u.mjs.map +0 -1
- package/dist/_chunks/index-2nkLt-AE.mjs.map +0 -1
- package/dist/_chunks/index-CDMcvtW9.js.map +0 -1
- package/dist/_chunks/index-D-KMrml_.js.map +0 -1
- package/dist/_chunks/index-udedGkii.mjs.map +0 -1
- package/strapi-server.js +0 -3
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-B-9wJGm0.js");
|
|
6
6
|
const jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
const designSystem = require("@strapi/design-system");
|
|
8
8
|
const reactDnd = require("react-dnd");
|
|
@@ -34,10 +34,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
34
34
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
35
35
|
const { formatMessage } = reactIntl.useIntl();
|
|
36
36
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
37
|
-
const {
|
|
37
|
+
const { skip = false, ...queryParams } = params;
|
|
38
38
|
const { data, isLoading, error } = index.useGetWorkflowsQuery(
|
|
39
39
|
{
|
|
40
|
-
id,
|
|
41
40
|
populate: "stages",
|
|
42
41
|
...queryParams
|
|
43
42
|
},
|
|
@@ -82,9 +81,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
82
81
|
);
|
|
83
82
|
const [updateWorkflow] = index.useUpdateWorkflowMutation();
|
|
84
83
|
const update = React__namespace.useCallback(
|
|
85
|
-
async (
|
|
84
|
+
async (id, data2) => {
|
|
86
85
|
try {
|
|
87
|
-
const res = await updateWorkflow({ id
|
|
86
|
+
const res = await updateWorkflow({ id, data: data2 });
|
|
88
87
|
if ("error" in res) {
|
|
89
88
|
toggleNotification({
|
|
90
89
|
type: "danger",
|
|
@@ -109,9 +108,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
109
108
|
);
|
|
110
109
|
const [deleteWorkflow] = index.useDeleteWorkflowMutation();
|
|
111
110
|
const deleteAction = React__namespace.useCallback(
|
|
112
|
-
async (
|
|
111
|
+
async (id) => {
|
|
113
112
|
try {
|
|
114
|
-
const res = await deleteWorkflow({ id
|
|
113
|
+
const res = await deleteWorkflow({ id });
|
|
115
114
|
if ("error" in res) {
|
|
116
115
|
toggleNotification({
|
|
117
116
|
type: "danger",
|
|
@@ -234,7 +233,7 @@ const Header = ({ title, subtitle, navigationAction, primaryAction }) => {
|
|
|
234
233
|
}
|
|
235
234
|
) }),
|
|
236
235
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
237
|
-
strapiAdmin.Layouts.
|
|
236
|
+
strapiAdmin.Layouts.BaseHeader,
|
|
238
237
|
{
|
|
239
238
|
navigationAction,
|
|
240
239
|
primaryAction,
|
|
@@ -249,4 +248,4 @@ exports.DragLayerRendered = DragLayerRendered;
|
|
|
249
248
|
exports.Header = Header;
|
|
250
249
|
exports.Root = Root;
|
|
251
250
|
exports.useReviewWorkflows = useReviewWorkflows;
|
|
252
|
-
//# sourceMappingURL=Layout-
|
|
251
|
+
//# sourceMappingURL=Layout-BWZ_v3U2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout-BWZ_v3U2.js","sources":["../../admin/src/routes/settings/hooks/useReviewWorkflows.ts","../../admin/src/routes/settings/constants.ts","../../admin/src/routes/settings/components/StageDragPreview.tsx","../../admin/src/routes/settings/components/Layout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useAPIErrorHandler, useNotification } from '@strapi/admin/strapi-admin';\nimport { type MessageDescriptor, useIntl } from 'react-intl';\n\nimport {\n GetWorkflowsParams,\n useCreateWorkflowMutation,\n useDeleteWorkflowMutation,\n useGetWorkflowsQuery,\n useUpdateWorkflowMutation,\n} from '../../../services/settings';\n\nimport type { Create, Update } from '../../../../../shared/contracts/review-workflows';\n\nconst DEFAULT_UNEXPECTED_ERROR_MSG = {\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n} satisfies MessageDescriptor;\n\ntype UseReviewWorkflowsArgs = GetWorkflowsParams & {\n skip?: boolean;\n};\n\nconst useReviewWorkflows = (params: UseReviewWorkflowsArgs = {}) => {\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const { skip = false, ...queryParams } = params;\n\n const { data, isLoading, error } = useGetWorkflowsQuery(\n {\n populate: 'stages',\n ...queryParams,\n },\n {\n skip,\n }\n );\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n const [createWorkflow] = useCreateWorkflowMutation();\n const create = React.useCallback(\n async (data: Create.Request['body']['data']) => {\n try {\n const res = await createWorkflow({ data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.created', defaultMessage: 'Created workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [createWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const [updateWorkflow] = useUpdateWorkflowMutation();\n const update = React.useCallback(\n async (id: string, data: Update.Request['body']['data']) => {\n try {\n const res = await updateWorkflow({ id, data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.updated', defaultMessage: 'Updated workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [formatAPIError, formatMessage, toggleNotification, updateWorkflow]\n );\n\n const [deleteWorkflow] = useDeleteWorkflowMutation();\n const deleteAction = React.useCallback(\n async (id: string) => {\n try {\n const res = await deleteWorkflow({ id });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.deleted', defaultMessage: 'Deleted workflow' }),\n });\n\n return res.data;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [deleteWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const { workflows = [], meta } = data ?? {};\n\n return {\n // meta contains e.g. the total of all workflows. we can not use\n // the pagination object here, because the list is not paginated.\n meta,\n workflows,\n isLoading,\n error,\n create,\n delete: deleteAction,\n update,\n };\n};\n\nexport { useReviewWorkflows };\n","export type DragDropTypes = 'stage';\n\nexport const DRAG_DROP_TYPES: Record<Uppercase<DragDropTypes>, DragDropTypes> = {\n STAGE: 'stage',\n};\n","import { Flex, Typography } from '@strapi/design-system';\nimport { CaretDown } from '@strapi/icons';\n\ninterface StageDragPreviewType {\n name: string | null;\n}\n\nconst StageDragPreview = ({ name }: StageDragPreviewType) => {\n return (\n <Flex\n background=\"primary100\"\n borderStyle=\"dashed\"\n borderColor=\"primary600\"\n borderWidth=\"1px\"\n gap={3}\n hasRadius\n padding={3}\n shadow=\"tableShadow\"\n width=\"30rem\"\n >\n <Flex\n alignItems=\"center\"\n background=\"neutral200\"\n borderRadius=\"50%\"\n height={6}\n justifyContent=\"center\"\n width={6}\n >\n <CaretDown width=\"0.8rem\" fill=\"neutral600\" />\n </Flex>\n\n <Typography fontWeight=\"bold\">{name}</Typography>\n </Flex>\n );\n};\n\nexport { StageDragPreview };\nexport type { StageDragPreviewType };\n","import * as React from 'react';\n\nimport { Page, Layouts } from '@strapi/admin/strapi-admin';\nimport { Box } from '@strapi/design-system';\nimport { XYCoord, useDragLayer } from 'react-dnd';\nimport { useIntl } from 'react-intl';\n\nimport { DRAG_DROP_TYPES } from '../constants';\n\nimport { StageDragPreview } from './StageDragPreview';\n\nfunction getStyle(\n initialOffset: XYCoord | null,\n currentOffset: XYCoord | null,\n mouseOffset: XYCoord | null\n) {\n if (!initialOffset || !currentOffset || !mouseOffset) {\n return { display: 'none' };\n }\n\n const { x, y } = mouseOffset;\n\n return {\n transform: `translate(${x}px, ${y}px)`,\n };\n}\n\nconst DragLayerRendered = () => {\n const { itemType, isDragging, item, initialOffset, currentOffset, mouseOffset } = useDragLayer(\n (monitor) => ({\n item: monitor.getItem(),\n itemType: monitor.getItemType(),\n initialOffset: monitor.getInitialSourceClientOffset(),\n currentOffset: monitor.getSourceClientOffset(),\n isDragging: monitor.isDragging(),\n mouseOffset: monitor.getClientOffset(),\n })\n );\n\n if (!isDragging || itemType !== DRAG_DROP_TYPES.STAGE) {\n return null;\n }\n\n return (\n <Box\n height=\"100%\"\n left={0}\n position=\"fixed\"\n pointerEvents=\"none\"\n top={0}\n zIndex={100}\n width=\"100%\"\n >\n <Box style={getStyle(initialOffset, currentOffset, mouseOffset)}>\n <StageDragPreview name={typeof item.item === 'string' ? item.item : null} />;\n </Box>\n </Box>\n );\n};\n\nconst Root: React.FC<React.PropsWithChildren> = ({ children }) => {\n return (\n <Page.Main>\n <Layouts.Content>{children}</Layouts.Content>\n </Page.Main>\n );\n};\n\ninterface HeaderProps {\n title: string;\n navigationAction?: React.ReactNode;\n primaryAction?: React.ReactNode;\n secondaryAction?: React.ReactNode;\n subtitle?: React.ReactNode;\n}\n\nconst Header: React.FC<HeaderProps> = ({ title, subtitle, navigationAction, primaryAction }) => {\n const { formatMessage } = useIntl();\n return (\n <>\n <Page.Title>\n {formatMessage(\n { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },\n {\n name: title,\n }\n )}\n </Page.Title>\n <Layouts.BaseHeader\n navigationAction={navigationAction}\n primaryAction={primaryAction}\n title={title}\n subtitle={subtitle}\n />\n </>\n );\n};\n\nexport { DragLayerRendered, Header, Root };\n"],"names":["useNotification","useIntl","useAPIErrorHandler","useGetWorkflowsQuery","React","useCreateWorkflowMutation","data","useUpdateWorkflowMutation","useDeleteWorkflowMutation","jsxs","Flex","jsx","CaretDown","Typography","useDragLayer","Box","Page","Layouts","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM,+BAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,gBAAgB;AAClB;AAMA,MAAM,qBAAqB,CAAC,SAAiC,OAAO;AAC5D,QAAA,EAAE,uBAAuBA,YAAAA;AACzB,QAAA,EAAE,kBAAkBC,UAAAA;AAC1B,QAAM,EAAE,yBAAyB,eAAe,IAAIC,YAAmB,mBAAA;AAEvE,QAAM,EAAE,OAAO,OAAO,GAAG,gBAAgB;AAEzC,QAAM,EAAE,MAAM,WAAW,MAAU,IAAAC,MAAA;AAAA,IACjC;AAAA,MACE,UAAU;AAAA,MACV,GAAG;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,IACF;AAAA,EAAA;AAGFC,mBAAM,UAAU,MAAM;AACpB,QAAI,OAAO;AACU,yBAAA;AAAA,QACjB,MAAM;AAAA,QACN,SAAS,eAAe,KAAK;AAAA,MAAA,CAC9B;AAAA,IACH;AAAA,EACC,GAAA,CAAC,OAAO,gBAAgB,kBAAkB,CAAC;AAExC,QAAA,CAAC,cAAc,IAAIC,MAAAA;AACzB,QAA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AACK,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,kBAAkBhB,UAAAA;AAC1B,SAEIQ,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-94iCcgYf.mjs";
|
|
5
5
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
6
6
|
import { Flex, Typography, Box } from "@strapi/design-system";
|
|
7
7
|
import { useDragLayer } from "react-dnd";
|
|
@@ -14,10 +14,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
14
14
|
const { toggleNotification } = useNotification();
|
|
15
15
|
const { formatMessage } = useIntl();
|
|
16
16
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
|
17
|
-
const {
|
|
17
|
+
const { skip = false, ...queryParams } = params;
|
|
18
18
|
const { data, isLoading, error } = useGetWorkflowsQuery(
|
|
19
19
|
{
|
|
20
|
-
id,
|
|
21
20
|
populate: "stages",
|
|
22
21
|
...queryParams
|
|
23
22
|
},
|
|
@@ -62,9 +61,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
62
61
|
);
|
|
63
62
|
const [updateWorkflow] = useUpdateWorkflowMutation();
|
|
64
63
|
const update = React.useCallback(
|
|
65
|
-
async (
|
|
64
|
+
async (id, data2) => {
|
|
66
65
|
try {
|
|
67
|
-
const res = await updateWorkflow({ id
|
|
66
|
+
const res = await updateWorkflow({ id, data: data2 });
|
|
68
67
|
if ("error" in res) {
|
|
69
68
|
toggleNotification({
|
|
70
69
|
type: "danger",
|
|
@@ -89,9 +88,9 @@ const useReviewWorkflows = (params = {}) => {
|
|
|
89
88
|
);
|
|
90
89
|
const [deleteWorkflow] = useDeleteWorkflowMutation();
|
|
91
90
|
const deleteAction = React.useCallback(
|
|
92
|
-
async (
|
|
91
|
+
async (id) => {
|
|
93
92
|
try {
|
|
94
|
-
const res = await deleteWorkflow({ id
|
|
93
|
+
const res = await deleteWorkflow({ id });
|
|
95
94
|
if ("error" in res) {
|
|
96
95
|
toggleNotification({
|
|
97
96
|
type: "danger",
|
|
@@ -214,7 +213,7 @@ const Header = ({ title, subtitle, navigationAction, primaryAction }) => {
|
|
|
214
213
|
}
|
|
215
214
|
) }),
|
|
216
215
|
/* @__PURE__ */ jsx(
|
|
217
|
-
Layouts.
|
|
216
|
+
Layouts.BaseHeader,
|
|
218
217
|
{
|
|
219
218
|
navigationAction,
|
|
220
219
|
primaryAction,
|
|
@@ -231,4 +230,4 @@ export {
|
|
|
231
230
|
DragLayerRendered as a,
|
|
232
231
|
useReviewWorkflows as u
|
|
233
232
|
};
|
|
234
|
-
//# sourceMappingURL=Layout-
|
|
233
|
+
//# sourceMappingURL=Layout-D67sjTk0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout-D67sjTk0.mjs","sources":["../../admin/src/routes/settings/hooks/useReviewWorkflows.ts","../../admin/src/routes/settings/constants.ts","../../admin/src/routes/settings/components/StageDragPreview.tsx","../../admin/src/routes/settings/components/Layout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useAPIErrorHandler, useNotification } from '@strapi/admin/strapi-admin';\nimport { type MessageDescriptor, useIntl } from 'react-intl';\n\nimport {\n GetWorkflowsParams,\n useCreateWorkflowMutation,\n useDeleteWorkflowMutation,\n useGetWorkflowsQuery,\n useUpdateWorkflowMutation,\n} from '../../../services/settings';\n\nimport type { Create, Update } from '../../../../../shared/contracts/review-workflows';\n\nconst DEFAULT_UNEXPECTED_ERROR_MSG = {\n id: 'notification.error',\n defaultMessage: 'An error occurred, please try again',\n} satisfies MessageDescriptor;\n\ntype UseReviewWorkflowsArgs = GetWorkflowsParams & {\n skip?: boolean;\n};\n\nconst useReviewWorkflows = (params: UseReviewWorkflowsArgs = {}) => {\n const { toggleNotification } = useNotification();\n const { formatMessage } = useIntl();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n\n const { skip = false, ...queryParams } = params;\n\n const { data, isLoading, error } = useGetWorkflowsQuery(\n {\n populate: 'stages',\n ...queryParams,\n },\n {\n skip,\n }\n );\n\n React.useEffect(() => {\n if (error) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(error),\n });\n }\n }, [error, formatAPIError, toggleNotification]);\n\n const [createWorkflow] = useCreateWorkflowMutation();\n const create = React.useCallback(\n async (data: Create.Request['body']['data']) => {\n try {\n const res = await createWorkflow({ data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.created', defaultMessage: 'Created workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [createWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const [updateWorkflow] = useUpdateWorkflowMutation();\n const update = React.useCallback(\n async (id: string, data: Update.Request['body']['data']) => {\n try {\n const res = await updateWorkflow({ id, data });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return res;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.updated', defaultMessage: 'Updated workflow' }),\n });\n\n return res;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [formatAPIError, formatMessage, toggleNotification, updateWorkflow]\n );\n\n const [deleteWorkflow] = useDeleteWorkflowMutation();\n const deleteAction = React.useCallback(\n async (id: string) => {\n try {\n const res = await deleteWorkflow({ id });\n\n if ('error' in res) {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n\n return;\n }\n\n toggleNotification({\n type: 'success',\n message: formatMessage({ id: 'actions.deleted', defaultMessage: 'Deleted workflow' }),\n });\n\n return res.data;\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG),\n });\n\n throw err;\n }\n },\n [deleteWorkflow, formatAPIError, formatMessage, toggleNotification]\n );\n\n const { workflows = [], meta } = data ?? {};\n\n return {\n // meta contains e.g. the total of all workflows. we can not use\n // the pagination object here, because the list is not paginated.\n meta,\n workflows,\n isLoading,\n error,\n create,\n delete: deleteAction,\n update,\n };\n};\n\nexport { useReviewWorkflows };\n","export type DragDropTypes = 'stage';\n\nexport const DRAG_DROP_TYPES: Record<Uppercase<DragDropTypes>, DragDropTypes> = {\n STAGE: 'stage',\n};\n","import { Flex, Typography } from '@strapi/design-system';\nimport { CaretDown } from '@strapi/icons';\n\ninterface StageDragPreviewType {\n name: string | null;\n}\n\nconst StageDragPreview = ({ name }: StageDragPreviewType) => {\n return (\n <Flex\n background=\"primary100\"\n borderStyle=\"dashed\"\n borderColor=\"primary600\"\n borderWidth=\"1px\"\n gap={3}\n hasRadius\n padding={3}\n shadow=\"tableShadow\"\n width=\"30rem\"\n >\n <Flex\n alignItems=\"center\"\n background=\"neutral200\"\n borderRadius=\"50%\"\n height={6}\n justifyContent=\"center\"\n width={6}\n >\n <CaretDown width=\"0.8rem\" fill=\"neutral600\" />\n </Flex>\n\n <Typography fontWeight=\"bold\">{name}</Typography>\n </Flex>\n );\n};\n\nexport { StageDragPreview };\nexport type { StageDragPreviewType };\n","import * as React from 'react';\n\nimport { Page, Layouts } from '@strapi/admin/strapi-admin';\nimport { Box } from '@strapi/design-system';\nimport { XYCoord, useDragLayer } from 'react-dnd';\nimport { useIntl } from 'react-intl';\n\nimport { DRAG_DROP_TYPES } from '../constants';\n\nimport { StageDragPreview } from './StageDragPreview';\n\nfunction getStyle(\n initialOffset: XYCoord | null,\n currentOffset: XYCoord | null,\n mouseOffset: XYCoord | null\n) {\n if (!initialOffset || !currentOffset || !mouseOffset) {\n return { display: 'none' };\n }\n\n const { x, y } = mouseOffset;\n\n return {\n transform: `translate(${x}px, ${y}px)`,\n };\n}\n\nconst DragLayerRendered = () => {\n const { itemType, isDragging, item, initialOffset, currentOffset, mouseOffset } = useDragLayer(\n (monitor) => ({\n item: monitor.getItem(),\n itemType: monitor.getItemType(),\n initialOffset: monitor.getInitialSourceClientOffset(),\n currentOffset: monitor.getSourceClientOffset(),\n isDragging: monitor.isDragging(),\n mouseOffset: monitor.getClientOffset(),\n })\n );\n\n if (!isDragging || itemType !== DRAG_DROP_TYPES.STAGE) {\n return null;\n }\n\n return (\n <Box\n height=\"100%\"\n left={0}\n position=\"fixed\"\n pointerEvents=\"none\"\n top={0}\n zIndex={100}\n width=\"100%\"\n >\n <Box style={getStyle(initialOffset, currentOffset, mouseOffset)}>\n <StageDragPreview name={typeof item.item === 'string' ? item.item : null} />;\n </Box>\n </Box>\n );\n};\n\nconst Root: React.FC<React.PropsWithChildren> = ({ children }) => {\n return (\n <Page.Main>\n <Layouts.Content>{children}</Layouts.Content>\n </Page.Main>\n );\n};\n\ninterface HeaderProps {\n title: string;\n navigationAction?: React.ReactNode;\n primaryAction?: React.ReactNode;\n secondaryAction?: React.ReactNode;\n subtitle?: React.ReactNode;\n}\n\nconst Header: React.FC<HeaderProps> = ({ title, subtitle, navigationAction, primaryAction }) => {\n const { formatMessage } = useIntl();\n return (\n <>\n <Page.Title>\n {formatMessage(\n { id: 'Settings.PageTitle', defaultMessage: 'Settings - {name}' },\n {\n name: title,\n }\n )}\n </Page.Title>\n <Layouts.BaseHeader\n navigationAction={navigationAction}\n primaryAction={primaryAction}\n title={title}\n subtitle={subtitle}\n />\n </>\n );\n};\n\nexport { DragLayerRendered, Header, Root };\n"],"names":["data"],"mappings":";;;;;;;;AAeA,MAAM,+BAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,gBAAgB;AAClB;AAMA,MAAM,qBAAqB,CAAC,SAAiC,OAAO;AAC5D,QAAA,EAAE,uBAAuB;AACzB,QAAA,EAAE,kBAAkB;AAC1B,QAAM,EAAE,yBAAyB,eAAe,IAAI,mBAAmB;AAEvE,QAAM,EAAE,OAAO,OAAO,GAAG,gBAAgB;AAEzC,QAAM,EAAE,MAAM,WAAW,MAAU,IAAA;AAAA,IACjC;AAAA,MACE,UAAU;AAAA,MACV,GAAG;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,IACF;AAAA,EAAA;AAGF,QAAM,UAAU,MAAM;AACpB,QAAI,OAAO;AACU,yBAAA;AAAA,QACjB,MAAM;AAAA,QACN,SAAS,eAAe,KAAK;AAAA,MAAA,CAC9B;AAAA,IACH;AAAA,EACC,GAAA,CAAC,OAAO,gBAAgB,kBAAkB,CAAC;AAExC,QAAA,CAAC,cAAc,IAAI;AACzB,QAAM,SAAS,MAAM;AAAA,IACnB,OAAOA,UAAyC;AAC1C,UAAA;AACF,cAAM,MAAM,MAAM,eAAe,EAAE,MAAAA,MAAM,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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;"}
|
|
@@ -6,11 +6,10 @@ import { Box, Typography, Flex, Accordion, MenuItem, Menu, MultiSelectOption, us
|
|
|
6
6
|
import { PlusCircle, More, Drag, EyeStriked, Duplicate, Check } from "@strapi/icons";
|
|
7
7
|
import { generateNKeysBetween } from "fractional-indexing";
|
|
8
8
|
import { useIntl } from "react-intl";
|
|
9
|
-
import { useDispatch } from "react-redux";
|
|
10
9
|
import { useParams, useNavigate } from "react-router-dom";
|
|
11
10
|
import * as yup from "yup";
|
|
12
|
-
import { r as reviewWorkflowsApi, A as AVAILABLE_COLORS, g as getStageColorByHex, u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, b as CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal, i as isBaseQueryError } from "./index-
|
|
13
|
-
import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-
|
|
11
|
+
import { r as reviewWorkflowsApi, A as AVAILABLE_COLORS, g as getStageColorByHex, u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, b as CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal, i as isBaseQueryError } from "./index-94iCcgYf.mjs";
|
|
12
|
+
import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-D67sjTk0.mjs";
|
|
14
13
|
import { getEmptyImage } from "react-dnd-html5-backend";
|
|
15
14
|
import { styled } from "styled-components";
|
|
16
15
|
import { useDrop, useDrag } from "react-dnd";
|
|
@@ -291,35 +290,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
|
291
290
|
left: "50%",
|
|
292
291
|
position: "absolute",
|
|
293
292
|
top: "0",
|
|
294
|
-
width: 2
|
|
295
|
-
zIndex: 1
|
|
293
|
+
width: 2
|
|
296
294
|
}
|
|
297
295
|
),
|
|
298
|
-
/* @__PURE__ */ jsx(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
canDelete: stages.length > 1 && canDelete,
|
|
313
|
-
canReorder: stages.length > 1,
|
|
314
|
-
canUpdate,
|
|
315
|
-
stagesCount: stages.length,
|
|
316
|
-
defaultOpen: isCreating,
|
|
317
|
-
...stage
|
|
318
|
-
}
|
|
319
|
-
) }, stage.__temp_key__);
|
|
320
|
-
})
|
|
321
|
-
}
|
|
322
|
-
)
|
|
296
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, position: "relative", tag: "ol", children: stages.map((stage, index) => {
|
|
297
|
+
return /* @__PURE__ */ jsx(Box, { tag: "li", children: /* @__PURE__ */ jsx(
|
|
298
|
+
Stage,
|
|
299
|
+
{
|
|
300
|
+
index,
|
|
301
|
+
canDelete: stages.length > 1 && canDelete,
|
|
302
|
+
canReorder: stages.length > 1,
|
|
303
|
+
canUpdate,
|
|
304
|
+
stagesCount: stages.length,
|
|
305
|
+
defaultOpen: isCreating,
|
|
306
|
+
...stage
|
|
307
|
+
}
|
|
308
|
+
) }, stage.__temp_key__);
|
|
309
|
+
}) })
|
|
323
310
|
] }),
|
|
324
311
|
canUpdate && /* @__PURE__ */ jsx(
|
|
325
312
|
AddStage,
|
|
@@ -487,7 +474,7 @@ const Stage = ({
|
|
|
487
474
|
{
|
|
488
475
|
background: "transparent",
|
|
489
476
|
hasRadius: true,
|
|
490
|
-
|
|
477
|
+
variant: "ghost",
|
|
491
478
|
"data-handler-id": handlerId,
|
|
492
479
|
ref: dragRef,
|
|
493
480
|
label: formatMessage({
|
|
@@ -539,7 +526,7 @@ const Stage = ({
|
|
|
539
526
|
size: 6,
|
|
540
527
|
type: "permissions"
|
|
541
528
|
}
|
|
542
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsx(Grid.Item, { col: size, children: /* @__PURE__ */ jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
529
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsx(Grid.Item, { col: size, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
543
530
|
] })
|
|
544
531
|
}
|
|
545
532
|
)
|
|
@@ -644,20 +631,22 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
644
631
|
const { value = [], error, onChange } = useField(name);
|
|
645
632
|
const allStages = useForm("PermissionsField", (state) => state.values.stages);
|
|
646
633
|
const onFormValueChange = useForm("PermissionsField", (state) => state.onChange);
|
|
647
|
-
const
|
|
634
|
+
const rolesErrorCount = React.useRef(0);
|
|
635
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
648
636
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
649
637
|
React.useEffect(() => {
|
|
650
|
-
if (!isLoading &&
|
|
638
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
639
|
+
rolesErrorCount.current = 1;
|
|
651
640
|
toggleNotification({
|
|
652
641
|
blockTransition: true,
|
|
653
642
|
type: "danger",
|
|
654
643
|
message: formatMessage({
|
|
655
644
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
656
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
645
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
657
646
|
})
|
|
658
647
|
});
|
|
659
648
|
}
|
|
660
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
649
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
661
650
|
if (!isLoading && filteredRoles.length === 0) {
|
|
662
651
|
return /* @__PURE__ */ jsxs(
|
|
663
652
|
Field.Root,
|
|
@@ -738,7 +727,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
738
727
|
defaultMessage: "Apply to all stages"
|
|
739
728
|
}),
|
|
740
729
|
size: "L",
|
|
741
|
-
variant: "secondary",
|
|
742
730
|
children: /* @__PURE__ */ jsx(Duplicate, {})
|
|
743
731
|
}
|
|
744
732
|
) }),
|
|
@@ -783,7 +771,7 @@ const PermissionWrapper = styled(Flex)`
|
|
|
783
771
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
784
772
|
const { formatMessage } = useIntl();
|
|
785
773
|
return /* @__PURE__ */ jsxs(Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
786
|
-
/* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(
|
|
774
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(
|
|
787
775
|
InputRenderer$1,
|
|
788
776
|
{
|
|
789
777
|
disabled: !canUpdate,
|
|
@@ -796,7 +784,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
796
784
|
type: "string"
|
|
797
785
|
}
|
|
798
786
|
) }),
|
|
799
|
-
/* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
787
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
800
788
|
] });
|
|
801
789
|
};
|
|
802
790
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -905,10 +893,10 @@ const WORKFLOW_SCHEMA = yup.object({
|
|
|
905
893
|
name: yup.string().max(255, {
|
|
906
894
|
id: "review-workflows.validation.name.max-length",
|
|
907
895
|
defaultMessage: "Name can not be longer than 255 characters"
|
|
908
|
-
}).required(),
|
|
896
|
+
}).required().nullable(),
|
|
909
897
|
stages: yup.array().of(
|
|
910
898
|
yup.object().shape({
|
|
911
|
-
name: yup.string().required({
|
|
899
|
+
name: yup.string().nullable().required({
|
|
912
900
|
id: "review-workflows.validation.stage.name",
|
|
913
901
|
defaultMessage: "Name is required"
|
|
914
902
|
}).max(255, {
|
|
@@ -925,7 +913,7 @@ const WORKFLOW_SCHEMA = yup.object({
|
|
|
925
913
|
return stages.filter((stage) => stage.name === stageName).length === 1;
|
|
926
914
|
}
|
|
927
915
|
),
|
|
928
|
-
color: yup.string().required({
|
|
916
|
+
color: yup.string().nullable().required({
|
|
929
917
|
id: "review-workflows.validation.stage.color",
|
|
930
918
|
defaultMessage: "Color is required"
|
|
931
919
|
}).matches(/^#(?:[0-9a-fA-F]{3}){1,2}$/i),
|
|
@@ -951,7 +939,6 @@ const EditPage = () => {
|
|
|
951
939
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
|
952
940
|
const navigate = useNavigate();
|
|
953
941
|
const { toggleNotification } = useNotification();
|
|
954
|
-
const dispatch = useDispatch();
|
|
955
942
|
const {
|
|
956
943
|
isLoading: isLoadingWorkflow,
|
|
957
944
|
meta,
|
|
@@ -959,7 +946,7 @@ const EditPage = () => {
|
|
|
959
946
|
error,
|
|
960
947
|
update,
|
|
961
948
|
create
|
|
962
|
-
} = useReviewWorkflows(
|
|
949
|
+
} = useReviewWorkflows();
|
|
963
950
|
const permissions = useTypedSelector(
|
|
964
951
|
(state) => state.admin_app.permissions["settings"]?.["review-workflows"]
|
|
965
952
|
);
|
|
@@ -1002,36 +989,13 @@ const EditPage = () => {
|
|
|
1002
989
|
});
|
|
1003
990
|
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1004
991
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1005
|
-
} else if ("data" in res) {
|
|
1006
|
-
for (const uid of res.data.contentTypes) {
|
|
1007
|
-
dispatch({
|
|
1008
|
-
type: "contentManagerApi/invalidateTags",
|
|
1009
|
-
payload: [
|
|
1010
|
-
{
|
|
1011
|
-
type: "ContentTypesConfiguration",
|
|
1012
|
-
id: uid
|
|
1013
|
-
}
|
|
1014
|
-
]
|
|
1015
|
-
});
|
|
1016
|
-
}
|
|
1017
992
|
}
|
|
1018
993
|
} else {
|
|
1019
994
|
const res = await create(data);
|
|
1020
995
|
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1021
996
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1022
997
|
} else if ("data" in res) {
|
|
1023
|
-
|
|
1024
|
-
dispatch({
|
|
1025
|
-
type: "contentManagerApi/invalidateTags",
|
|
1026
|
-
payload: [
|
|
1027
|
-
{
|
|
1028
|
-
type: "ContentTypesConfiguration",
|
|
1029
|
-
id: uid
|
|
1030
|
-
}
|
|
1031
|
-
]
|
|
1032
|
-
});
|
|
1033
|
-
}
|
|
1034
|
-
navigate(`../${res.data.id}`);
|
|
998
|
+
navigate(`../${res.data.id}`, { replace: true });
|
|
1035
999
|
}
|
|
1036
1000
|
}
|
|
1037
1001
|
} catch (error2) {
|
|
@@ -1153,12 +1117,12 @@ const EditPage = () => {
|
|
|
1153
1117
|
}
|
|
1154
1118
|
),
|
|
1155
1119
|
/* @__PURE__ */ jsx(Root, { children: /* @__PURE__ */ jsxs(Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1156
|
-
/* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate }),
|
|
1120
|
+
/* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1157
1121
|
/* @__PURE__ */ jsx(
|
|
1158
1122
|
Stages,
|
|
1159
1123
|
{
|
|
1160
1124
|
canDelete,
|
|
1161
|
-
canUpdate,
|
|
1125
|
+
canUpdate: canUpdate || canCreate,
|
|
1162
1126
|
isCreating: isCreatingWorkflow
|
|
1163
1127
|
}
|
|
1164
1128
|
)
|
|
@@ -1180,7 +1144,7 @@ const EditPage = () => {
|
|
|
1180
1144
|
},
|
|
1181
1145
|
{
|
|
1182
1146
|
count: contentTypesFromOtherWorkflows?.filter(
|
|
1183
|
-
(contentType) =>
|
|
1147
|
+
(contentType) => values.contentTypes.includes(contentType)
|
|
1184
1148
|
).length ?? 0
|
|
1185
1149
|
}
|
|
1186
1150
|
) }),
|
|
@@ -1251,4 +1215,4 @@ const ProtectedEditPage = () => {
|
|
|
1251
1215
|
export {
|
|
1252
1216
|
ProtectedEditPage
|
|
1253
1217
|
};
|
|
1254
|
-
//# sourceMappingURL=_id-
|
|
1218
|
+
//# sourceMappingURL=_id-V0we8TjF.mjs.map
|