@strapi/review-workflows 0.0.0-experimental.fb442e5e12dd3f611303691bf85a249520ba348b → 0.0.0-experimental.fd379e4937e431407d784eaa5fe7f93cf2a53386

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.
Files changed (42) hide show
  1. package/dist/_chunks/{Layout-D5aa9iUm.mjs → Layout-C_uZ98Uf.mjs} +2 -2
  2. package/dist/_chunks/{Layout-D5aa9iUm.mjs.map → Layout-C_uZ98Uf.mjs.map} +1 -1
  3. package/dist/_chunks/{Layout-AREWDuuq.js → Layout-b_msoxIP.js} +2 -2
  4. package/dist/_chunks/{Layout-AREWDuuq.js.map → Layout-b_msoxIP.js.map} +1 -1
  5. package/dist/_chunks/{_id-C7pCAzXV.js → _id-4xBYY7wK.js} +6 -7
  6. package/dist/_chunks/_id-4xBYY7wK.js.map +1 -0
  7. package/dist/_chunks/{_id-DDNHKV_W.mjs → _id-mkPbu6GX.mjs} +6 -7
  8. package/dist/_chunks/_id-mkPbu6GX.mjs.map +1 -0
  9. package/dist/_chunks/{index-CIBLMG85.js → index-C5NgBQMb.js} +25 -22
  10. package/dist/_chunks/index-C5NgBQMb.js.map +1 -0
  11. package/dist/_chunks/{index-Bv3cQ3c-.js → index-CIGzoVfk.js} +8 -28
  12. package/dist/_chunks/index-CIGzoVfk.js.map +1 -0
  13. package/dist/_chunks/{index-Cx5QECZI.mjs → index-DL8-Q4Q5.mjs} +25 -22
  14. package/dist/_chunks/index-DL8-Q4Q5.mjs.map +1 -0
  15. package/dist/_chunks/{index-CeaoNBIP.mjs → index-D_k4wfAN.mjs} +10 -30
  16. package/dist/_chunks/index-D_k4wfAN.mjs.map +1 -0
  17. package/dist/_chunks/{router-gRPIa2_c.js → router-BFr5lHsE.js} +3 -3
  18. package/dist/_chunks/{router-gRPIa2_c.js.map → router-BFr5lHsE.js.map} +1 -1
  19. package/dist/_chunks/{router-BEoNwQZ1.mjs → router-DnQKLQOJ.mjs} +3 -3
  20. package/dist/_chunks/{router-BEoNwQZ1.mjs.map → router-DnQKLQOJ.mjs.map} +1 -1
  21. package/dist/admin/index.js +1 -1
  22. package/dist/admin/index.mjs +1 -1
  23. package/dist/server/index.js +47 -27
  24. package/dist/server/index.js.map +1 -1
  25. package/dist/server/index.mjs +47 -27
  26. package/dist/server/index.mjs.map +1 -1
  27. package/dist/server/src/controllers/assignees.d.ts.map +1 -1
  28. package/dist/server/src/controllers/stages.d.ts.map +1 -1
  29. package/dist/server/src/index.d.ts +1 -1
  30. package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
  31. package/dist/server/src/services/index.d.ts +1 -1
  32. package/dist/server/src/services/metrics/weekly-metrics.d.ts.map +1 -1
  33. package/dist/server/src/services/stages.d.ts +2 -7
  34. package/dist/server/src/services/stages.d.ts.map +1 -1
  35. package/package.json +8 -8
  36. package/dist/_chunks/_id-C7pCAzXV.js.map +0 -1
  37. package/dist/_chunks/_id-DDNHKV_W.mjs.map +0 -1
  38. package/dist/_chunks/index-Bv3cQ3c-.js.map +0 -1
  39. package/dist/_chunks/index-CIBLMG85.js.map +0 -1
  40. package/dist/_chunks/index-CeaoNBIP.mjs.map +0 -1
  41. package/dist/_chunks/index-Cx5QECZI.mjs.map +0 -1
  42. package/strapi-server.js +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-D_k4wfAN.mjs","sources":["../../admin/src/routes/settings/index.tsx"],"sourcesContent":["/* eslint-disable check-file/no-index */\n/* eslint-disable check-file/filename-naming-convention */\nimport * as React from 'react';\n\nimport { Page, useTracking, ConfirmDialog, useRBAC, Table } from '@strapi/admin/strapi-admin';\nimport { useLicenseLimits } from '@strapi/admin/strapi-admin/ee';\nimport { Flex, IconButton, TFooter, Typography, LinkButton, Dialog } from '@strapi/design-system';\nimport { Pencil, Plus, Trash } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { NavLink, Link, useNavigate } from 'react-router-dom';\n\nimport { LimitsModal } from '../../components/LimitsModal';\nimport { CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME } from '../../constants';\nimport { useTypedSelector } from '../../modules/hooks';\nimport { ContentType, useGetContentTypesQuery } from '../../services/content-manager';\n\nimport * as Layout from './components/Layout';\nimport { useReviewWorkflows } from './hooks/useReviewWorkflows';\n\nexport const ReviewWorkflowsListView = () => {\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const { trackUsage } = useTracking();\n const [workflowToDelete, setWorkflowToDelete] = React.useState<string | null>(null);\n const [showLimitModal, setShowLimitModal] = React.useState<boolean>(false);\n const { data, isLoading: isLoadingModels } = useGetContentTypesQuery();\n const { meta, workflows, isLoading, delete: deleteAction } = useReviewWorkflows();\n const { getFeature, isLoading: isLicenseLoading } = useLicenseLimits();\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.settings?.['review-workflows']\n );\n const {\n allowedActions: { canCreate, canRead, canUpdate, canDelete },\n } = useRBAC(permissions);\n\n const limits = getFeature('review-workflows');\n const numberOfWorkflows = limits?.[CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME] as string;\n\n const handleDeleteWorkflow = (workflowId: string) => {\n setWorkflowToDelete(workflowId);\n };\n\n const toggleConfirmDeleteDialog = () => {\n setWorkflowToDelete(null);\n };\n\n const handleConfirmDeleteDialog = async () => {\n if (!workflowToDelete) return;\n\n await deleteAction(workflowToDelete);\n\n setWorkflowToDelete(null);\n };\n\n const handleCreateClick: React.MouseEventHandler<HTMLAnchorElement> &\n ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void) = (event) => {\n event.preventDefault();\n /**\n * If the current license has a workflow limit:\n * check if the total count of workflows exceeds that limit. If so,\n * prevent the navigation and show the limits overlay.\n *\n * If the current license does not have a limit (e.g. offline license):\n * allow the user to navigate to the create-view. In case they exceed the\n * current hard-limit of 200 they will see an error thrown by the API.\n */\n\n if (numberOfWorkflows && meta && meta?.workflowCount >= parseInt(numberOfWorkflows, 10)) {\n event.preventDefault();\n setShowLimitModal(true);\n } else {\n navigate('create');\n trackUsage('willCreateWorkflow');\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 (!isLoading && !isLicenseLoading) {\n if (numberOfWorkflows && meta && meta?.workflowCount > parseInt(numberOfWorkflows, 10)) {\n setShowLimitModal(true);\n }\n }\n }, [isLicenseLoading, isLoading, meta, meta?.workflowCount, numberOfWorkflows]);\n\n const headers = [\n {\n label: formatMessage({\n id: 'Settings.review-workflows.list.page.list.column.name.title',\n defaultMessage: 'Name',\n }),\n name: 'name',\n },\n {\n label: formatMessage({\n id: 'Settings.review-workflows.list.page.list.column.stages.title',\n defaultMessage: 'Stages',\n }),\n name: 'stages',\n },\n {\n label: formatMessage({\n id: 'Settings.review-workflows.list.page.list.column.contentTypes.title',\n defaultMessage: 'Content Types',\n }),\n name: 'content-types',\n },\n ];\n\n if (isLoading || isLoadingModels) {\n return <Page.Loading />;\n }\n\n const contentTypes = Object.values(data ?? {}).reduce<ContentType[]>((acc, curr) => {\n acc.push(...curr);\n return acc;\n }, []);\n\n return (\n <>\n <Layout.Header\n primaryAction={\n canCreate ? (\n <LinkButton\n startIcon={<Plus />}\n size=\"S\"\n tag={NavLink}\n to=\"create\"\n onClick={handleCreateClick}\n >\n {formatMessage({\n id: 'Settings.review-workflows.list.page.create',\n defaultMessage: 'Create new workflow',\n })}\n </LinkButton>\n ) : null\n }\n subtitle={formatMessage({\n id: 'Settings.review-workflows.list.page.subtitle',\n defaultMessage: 'Manage your content review process',\n })}\n title={formatMessage({\n id: 'Settings.review-workflows.list.page.title',\n defaultMessage: 'Review Workflows',\n })}\n />\n\n <Layout.Root>\n <Table.Root\n isLoading={isLoading}\n rows={workflows}\n footer={\n canCreate ? (\n <TFooter icon={<Plus />} onClick={handleCreateClick}>\n {formatMessage({\n id: 'Settings.review-workflows.list.page.create',\n defaultMessage: 'Create new workflow',\n })}\n </TFooter>\n ) : null\n }\n headers={headers}\n >\n <Table.Content>\n <Table.Head>\n {headers.map((head) => (\n <Table.HeaderCell key={head.name} {...head} />\n ))}\n </Table.Head>\n\n <Table.Body>\n {workflows.map((workflow) => (\n <Table.Row\n onClick={() => {\n navigate(`${workflow.id}`);\n }}\n key={workflow.id}\n >\n <Table.Cell width=\"25rem\">\n <Typography textColor=\"neutral800\" fontWeight=\"bold\" ellipsis>\n {workflow.name}\n </Typography>\n </Table.Cell>\n <Table.Cell>\n <Typography textColor=\"neutral800\">{workflow.stages.length}</Typography>\n </Table.Cell>\n <Table.Cell>\n <Typography textColor=\"neutral800\">\n {workflow.contentTypes\n .map((uid: string) => {\n const contentType = contentTypes.find(\n (contentType) => contentType.uid === uid\n );\n\n return contentType?.info.displayName ?? '';\n })\n .join(', ')}\n </Typography>\n </Table.Cell>\n <Table.Cell>\n <Flex alignItems=\"center\" justifyContent=\"end\">\n {canRead || canUpdate ? (\n <IconButton\n tag={Link}\n to={workflow.id.toString()}\n label={formatMessage(\n {\n id: 'Settings.review-workflows.list.page.list.column.actions.edit.label',\n defaultMessage: 'Edit {name}',\n },\n { name: workflow.name }\n )}\n variant=\"ghost\"\n >\n <Pencil />\n </IconButton>\n ) : null}\n {workflows.length > 1 && canDelete ? (\n <IconButton\n withTooltip={false}\n label={formatMessage(\n {\n id: 'Settings.review-workflows.list.page.list.column.actions.delete.label',\n defaultMessage: 'Delete {name}',\n },\n { name: 'Default workflow' }\n )}\n variant=\"ghost\"\n onClick={(e) => {\n e.stopPropagation();\n handleDeleteWorkflow(String(workflow.id));\n }}\n >\n <Trash />\n </IconButton>\n ) : null}\n </Flex>\n </Table.Cell>\n </Table.Row>\n ))}\n </Table.Body>\n </Table.Content>\n </Table.Root>\n\n <Dialog.Root open={!!workflowToDelete} onOpenChange={toggleConfirmDeleteDialog}>\n <ConfirmDialog onConfirm={handleConfirmDeleteDialog}>\n {formatMessage({\n id: 'Settings.review-workflows.list.page.delete.confirm.body',\n defaultMessage:\n 'If you remove this worfklow, all stage-related information will be removed for this content-type. Are you sure you want to remove it?',\n })}\n </ConfirmDialog>\n </Dialog.Root>\n\n <LimitsModal.Root open={showLimitModal} onOpenChange={() => setShowLimitModal(false)}>\n <LimitsModal.Title>\n {formatMessage({\n id: 'Settings.review-workflows.list.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: 'Settings.review-workflows.list.page.workflows.limit.body',\n defaultMessage: 'Delete a workflow or contact Sales to enable more workflows.',\n })}\n </LimitsModal.Body>\n </LimitsModal.Root>\n </Layout.Root>\n </>\n );\n};\n\nconst ProtectedListPage = () => {\n const permissions = useTypedSelector(\n (state) => state.admin_app.permissions.settings?.['review-workflows']?.main\n );\n\n return (\n <Page.Protect permissions={permissions}>\n <ReviewWorkflowsListView />\n </Page.Protect>\n );\n};\n\nexport { ProtectedListPage };\n"],"names":["Layout.Header","Layout.Root","contentType"],"mappings":";;;;;;;;;;AAmBO,MAAM,0BAA0B,MAAM;AACrC,QAAA,EAAE,kBAAkB;AAC1B,QAAM,WAAW;AACX,QAAA,EAAE,eAAe;AACvB,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,MAAM,SAAwB,IAAI;AAClF,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,MAAM,SAAkB,KAAK;AACzE,QAAM,EAAE,MAAM,WAAW,oBAAoB,wBAAwB;AACrE,QAAM,EAAE,MAAM,WAAW,WAAW,QAAQ,aAAA,IAAiB;AAC7D,QAAM,EAAE,YAAY,WAAW,qBAAqB,iBAAiB;AACrE,QAAM,cAAc;AAAA,IAClB,CAAC,UAAU,MAAM,UAAU,YAAY,WAAW,kBAAkB;AAAA,EAAA;AAEhE,QAAA;AAAA,IACJ,gBAAgB,EAAE,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");
4
4
  const React = require("react");
5
5
  const reactRouterDom = require("react-router-dom");
6
6
  const ProtectedListPage = React.lazy(
7
- () => Promise.resolve().then(() => require("./index-Bv3cQ3c-.js")).then((mod) => ({ default: mod.ProtectedListPage }))
7
+ () => Promise.resolve().then(() => require("./index-CIGzoVfk.js")).then((mod) => ({ default: mod.ProtectedListPage }))
8
8
  );
9
9
  const ProtectedEditPage = React.lazy(
10
- () => Promise.resolve().then(() => require("./_id-C7pCAzXV.js")).then((mod) => ({ default: mod.ProtectedEditPage }))
10
+ () => Promise.resolve().then(() => require("./_id-4xBYY7wK.js")).then((mod) => ({ default: mod.ProtectedEditPage }))
11
11
  );
12
12
  const routes = [
13
13
  {
@@ -21,4 +21,4 @@ const routes = [
21
21
  ];
22
22
  const Router = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Routes, { children: routes.map((route) => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { ...route }, route.path)) });
23
23
  exports.Router = Router;
24
- //# sourceMappingURL=router-gRPIa2_c.js.map
24
+ //# sourceMappingURL=router-BFr5lHsE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"router-gRPIa2_c.js","sources":["../../admin/src/router.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { lazy } from 'react';\n\nimport { Routes, Route, PathRouteProps } from 'react-router-dom';\n\nconst ProtectedListPage = lazy(() =>\n import('./routes/settings').then((mod) => ({ default: mod.ProtectedListPage }))\n);\nconst ProtectedEditPage = lazy(() =>\n import('./routes/settings/:id').then((mod) => ({ default: mod.ProtectedEditPage }))\n);\n\nconst routes: PathRouteProps[] = [\n {\n path: '/',\n Component: ProtectedListPage,\n },\n {\n path: ':id',\n Component: ProtectedEditPage,\n },\n];\n\nconst Router = () => (\n <Routes>\n {routes.map((route) => (\n <Route key={route.path} {...route} />\n ))}\n </Routes>\n);\n\nexport { Router };\n"],"names":["lazy","jsx","Routes","Route"],"mappings":";;;;;AAKA,MAAM,oBAAoBA,MAAA;AAAA,EAAK,MAC7B,QAAO,QAAA,EAAA,KAAA,MAAA,QAAA,qBAAmB,GAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AAChF;AACA,MAAM,oBAAoBA,MAAA;AAAA,EAAK,MAC7B,QAAO,QAAA,EAAA,KAAA,MAAA,QAAA,mBAAuB,GAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AACpF;AAEA,MAAM,SAA2B;AAAA,EAC/B;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AACF;AAEA,MAAM,SAAS,MACZC,2BAAAA,IAAAC,eAAAA,QAAA,EACE,iBAAO,IAAI,CAAC,UACXD,2BAAA,IAACE,wBAAwB,GAAG,MAAA,GAAhB,MAAM,IAAiB,CACpC,EACH,CAAA;;"}
1
+ {"version":3,"file":"router-BFr5lHsE.js","sources":["../../admin/src/router.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { lazy } from 'react';\n\nimport { Routes, Route, PathRouteProps } from 'react-router-dom';\n\nconst ProtectedListPage = lazy(() =>\n import('./routes/settings').then((mod) => ({ default: mod.ProtectedListPage }))\n);\nconst ProtectedEditPage = lazy(() =>\n import('./routes/settings/:id').then((mod) => ({ default: mod.ProtectedEditPage }))\n);\n\nconst routes: PathRouteProps[] = [\n {\n path: '/',\n Component: ProtectedListPage,\n },\n {\n path: ':id',\n Component: ProtectedEditPage,\n },\n];\n\nconst Router = () => (\n <Routes>\n {routes.map((route) => (\n <Route key={route.path} {...route} />\n ))}\n </Routes>\n);\n\nexport { Router };\n"],"names":["lazy","jsx","Routes","Route"],"mappings":";;;;;AAKA,MAAM,oBAAoBA,MAAA;AAAA,EAAK,MAC7B,QAAO,QAAA,EAAA,KAAA,MAAA,QAAA,qBAAmB,GAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AAChF;AACA,MAAM,oBAAoBA,MAAA;AAAA,EAAK,MAC7B,QAAO,QAAA,EAAA,KAAA,MAAA,QAAA,mBAAuB,GAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AACpF;AAEA,MAAM,SAA2B;AAAA,EAC/B;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AACF;AAEA,MAAM,SAAS,MACZC,2BAAAA,IAAAC,eAAAA,QAAA,EACE,iBAAO,IAAI,CAAC,UACXD,2BAAA,IAACE,wBAAwB,GAAG,MAAA,GAAhB,MAAM,IAAiB,CACpC,EACH,CAAA;;"}
@@ -2,10 +2,10 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { lazy } from "react";
3
3
  import { Routes, Route } from "react-router-dom";
4
4
  const ProtectedListPage = lazy(
5
- () => import("./index-CeaoNBIP.mjs").then((mod) => ({ default: mod.ProtectedListPage }))
5
+ () => import("./index-D_k4wfAN.mjs").then((mod) => ({ default: mod.ProtectedListPage }))
6
6
  );
7
7
  const ProtectedEditPage = lazy(
8
- () => import("./_id-DDNHKV_W.mjs").then((mod) => ({ default: mod.ProtectedEditPage }))
8
+ () => import("./_id-mkPbu6GX.mjs").then((mod) => ({ default: mod.ProtectedEditPage }))
9
9
  );
10
10
  const routes = [
11
11
  {
@@ -21,4 +21,4 @@ const Router = () => /* @__PURE__ */ jsx(Routes, { children: routes.map((route)
21
21
  export {
22
22
  Router
23
23
  };
24
- //# sourceMappingURL=router-BEoNwQZ1.mjs.map
24
+ //# sourceMappingURL=router-DnQKLQOJ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"router-BEoNwQZ1.mjs","sources":["../../admin/src/router.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { lazy } from 'react';\n\nimport { Routes, Route, PathRouteProps } from 'react-router-dom';\n\nconst ProtectedListPage = lazy(() =>\n import('./routes/settings').then((mod) => ({ default: mod.ProtectedListPage }))\n);\nconst ProtectedEditPage = lazy(() =>\n import('./routes/settings/:id').then((mod) => ({ default: mod.ProtectedEditPage }))\n);\n\nconst routes: PathRouteProps[] = [\n {\n path: '/',\n Component: ProtectedListPage,\n },\n {\n path: ':id',\n Component: ProtectedEditPage,\n },\n];\n\nconst Router = () => (\n <Routes>\n {routes.map((route) => (\n <Route key={route.path} {...route} />\n ))}\n </Routes>\n);\n\nexport { Router };\n"],"names":[],"mappings":";;;AAKA,MAAM,oBAAoB;AAAA,EAAK,MAC7B,OAAO,sBAAmB,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AAChF;AACA,MAAM,oBAAoB;AAAA,EAAK,MAC7B,OAAO,oBAAuB,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AACpF;AAEA,MAAM,SAA2B;AAAA,EAC/B;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AACF;AAEA,MAAM,SAAS,MACZ,oBAAA,QAAA,EACE,iBAAO,IAAI,CAAC,UACX,oBAAC,SAAwB,GAAG,MAAA,GAAhB,MAAM,IAAiB,CACpC,EACH,CAAA;"}
1
+ {"version":3,"file":"router-DnQKLQOJ.mjs","sources":["../../admin/src/router.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { lazy } from 'react';\n\nimport { Routes, Route, PathRouteProps } from 'react-router-dom';\n\nconst ProtectedListPage = lazy(() =>\n import('./routes/settings').then((mod) => ({ default: mod.ProtectedListPage }))\n);\nconst ProtectedEditPage = lazy(() =>\n import('./routes/settings/:id').then((mod) => ({ default: mod.ProtectedEditPage }))\n);\n\nconst routes: PathRouteProps[] = [\n {\n path: '/',\n Component: ProtectedListPage,\n },\n {\n path: ':id',\n Component: ProtectedEditPage,\n },\n];\n\nconst Router = () => (\n <Routes>\n {routes.map((route) => (\n <Route key={route.path} {...route} />\n ))}\n </Routes>\n);\n\nexport { Router };\n"],"names":[],"mappings":";;;AAKA,MAAM,oBAAoB;AAAA,EAAK,MAC7B,OAAO,sBAAmB,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AAChF;AACA,MAAM,oBAAoB;AAAA,EAAK,MAC7B,OAAO,oBAAuB,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AACpF;AAEA,MAAM,SAA2B;AAAA,EAC/B;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AACF;AAEA,MAAM,SAAS,MACZ,oBAAA,QAAA,EACE,iBAAO,IAAI,CAAC,UACX,oBAAC,SAAwB,GAAG,MAAA,GAAhB,MAAM,IAAiB,CACpC,EACH,CAAA;"}
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-CIBLMG85.js");
2
+ const index = require("../_chunks/index-C5NgBQMb.js");
3
3
  module.exports = index.admin;
4
4
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { h } from "../_chunks/index-Cx5QECZI.mjs";
1
+ import { h } from "../_chunks/index-DL8-Q4Q5.mjs";
2
2
  export {
3
3
  h as default
4
4
  };
@@ -6901,7 +6901,7 @@ const reviewWorkflows = {
6901
6901
  {
6902
6902
  name: "admin::hasPermissions",
6903
6903
  config: {
6904
- actions: ["admin::users.read", "admin::review-workflows.read"]
6904
+ actions: ["admin::users.read"]
6905
6905
  }
6906
6906
  }
6907
6907
  ]
@@ -7322,23 +7322,17 @@ const stages$1 = ({ strapi: strapi2 }) => {
7322
7322
  },
7323
7323
  /**
7324
7324
  * Update the stage of an entity
7325
- *
7326
- * @param {object} entityInfo
7327
- * @param {number} entityInfo.id - Entity id
7328
- * @param {string} entityInfo.modelUID - the content-type of the entity
7329
- * @param {number} stageId - The id of the stage to assign to the entity
7330
7325
  */
7331
- async updateEntity(entityInfo, stageId) {
7326
+ async updateEntity(documentId, locale, model, stageId) {
7332
7327
  const stage = await this.findById(stageId);
7333
7328
  await workflowValidator.validateWorkflowCount();
7334
7329
  if (!stage) {
7335
7330
  throw new ApplicationError$2(`Selected stage does not exist`);
7336
7331
  }
7337
- const entity = await strapi2.db.query(entityInfo.modelUID).update({
7338
- where: {
7339
- id: entityInfo.id
7340
- },
7341
- data: { [ENTITY_STAGE_ATTRIBUTE]: stageId },
7332
+ const entity = await strapi2.documents(model).update({
7333
+ documentId,
7334
+ locale,
7335
+ data: { [ENTITY_STAGE_ATTRIBUTE]: stage },
7342
7336
  populate: [ENTITY_STAGE_ATTRIBUTE]
7343
7337
  });
7344
7338
  metrics.sendDidChangeEntryStage();
@@ -7614,13 +7608,13 @@ const reviewWorkflowsMetrics = {
7614
7608
  sendDidSendReviewWorkflowPropertiesOnceAWeek,
7615
7609
  sendDidEditAssignee
7616
7610
  };
7617
- function _typeof(obj) {
7611
+ function _typeof(o) {
7618
7612
  "@babel/helpers - typeof";
7619
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
7620
- return typeof obj2;
7621
- } : function(obj2) {
7622
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
7623
- }, _typeof(obj);
7613
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
7614
+ return typeof o2;
7615
+ } : function(o2) {
7616
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
7617
+ }, _typeof(o);
7624
7618
  }
7625
7619
  function toInteger(dirtyNumber) {
7626
7620
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
@@ -7755,7 +7749,12 @@ const reviewWorkflowsWeeklyMetrics = ({ strapi: strapi2 }) => {
7755
7749
  },
7756
7750
  async registerCron() {
7757
7751
  const weeklySchedule = await this.ensureWeeklyStoredCronSchedule();
7758
- strapi2.cron.add({ [weeklySchedule]: this.sendMetrics.bind(this) });
7752
+ strapi2.cron.add({
7753
+ reviewWorkflowsWeekly: {
7754
+ task: this.sendMetrics.bind(this),
7755
+ options: weeklySchedule
7756
+ }
7757
+ });
7759
7758
  }
7760
7759
  };
7761
7760
  };
@@ -7811,6 +7810,7 @@ const handleStageOnUpdate = async (ctx, next) => {
7811
7810
  strapi.eventHub.emit(WORKFLOW_UPDATE_STAGE, {
7812
7811
  model: model.modelName,
7813
7812
  uid: model.uid,
7813
+ // TODO v6: Rename to "entry", which is what is used for regular CRUD updates
7814
7814
  entity: {
7815
7815
  // @ts-expect-error
7816
7816
  id: result?.id,
@@ -8096,7 +8096,12 @@ const stages = {
8096
8096
  );
8097
8097
  const workflow2 = await workflowService.assertContentTypeBelongsToWorkflow(modelUID);
8098
8098
  workflowService.assertStageBelongsToWorkflow(stageId, workflow2);
8099
- const updatedEntity = await stagesService.updateEntity({ id: entity.id, modelUID }, stageId);
8099
+ const updatedEntity = await stagesService.updateEntity(
8100
+ entity.documentId,
8101
+ entity.locale,
8102
+ modelUID,
8103
+ stageId
8104
+ );
8100
8105
  ctx.body = { data: await sanitizeOutput(updatedEntity) };
8101
8106
  },
8102
8107
  /**
@@ -8116,10 +8121,9 @@ const stages = {
8116
8121
  if (strapi.plugin("content-manager").service("permission-checker").create({ userAbility: ctx.state.userAbility, model: modelUID }).cannot.read()) {
8117
8122
  return ctx.forbidden();
8118
8123
  }
8119
- const locale = await validateLocale(query?.locale);
8124
+ const locale = await validateLocale(query?.locale) ?? void 0;
8120
8125
  const entity = await strapi.documents(modelUID).findOne({
8121
8126
  documentId,
8122
- // @ts-expect-error - locale should be also null in the doc service types
8123
8127
  locale,
8124
8128
  populate: [ENTITY_STAGE_ATTRIBUTE]
8125
8129
  });
@@ -8128,12 +8132,13 @@ const stages = {
8128
8132
  }
8129
8133
  const entityStageId = entity[ENTITY_STAGE_ATTRIBUTE]?.id;
8130
8134
  const canTransition = stagePermissions2.can(STAGE_TRANSITION_UID, entityStageId);
8131
- const [workflowCount, { stages: workflowStages }] = await Promise.all([
8135
+ const [workflowCount, workflowResult] = await Promise.all([
8132
8136
  workflowService.count(),
8133
8137
  workflowService.getAssignedWorkflow(modelUID, {
8134
8138
  populate: "stages"
8135
8139
  })
8136
8140
  ]);
8141
+ const workflowStages = workflowResult ? workflowResult.stages : [];
8137
8142
  const meta = {
8138
8143
  stageCount: workflowStages.length,
8139
8144
  workflowCount
@@ -8169,22 +8174,37 @@ const assignees = {
8169
8174
  async updateEntity(ctx) {
8170
8175
  const assigneeService = getService("assignees");
8171
8176
  const workflowService = getService("workflows");
8177
+ const stagePermissions2 = getService("stage-permissions");
8172
8178
  const { model_uid: model, id: documentId } = ctx.params;
8173
- const { locale } = ctx.request.query || {};
8179
+ const locale = await validateLocale(ctx.request.query?.locale) ?? void 0;
8174
8180
  const { sanitizeOutput } = strapi.plugin("content-manager").service("permission-checker").create({ userAbility: ctx.state.userAbility, model });
8181
+ const entity = await strapi.documents(model).findOne({
8182
+ documentId,
8183
+ locale,
8184
+ populate: [ENTITY_STAGE_ATTRIBUTE]
8185
+ });
8186
+ if (!entity) {
8187
+ ctx.throw(404, "Entity not found");
8188
+ }
8189
+ const canTransitionStage = stagePermissions2.can(
8190
+ STAGE_TRANSITION_UID,
8191
+ entity[ENTITY_STAGE_ATTRIBUTE]?.id
8192
+ );
8193
+ if (!canTransitionStage) {
8194
+ ctx.throw(403, "Stage transition permission is required");
8195
+ }
8175
8196
  const { id: assigneeId } = await validateUpdateAssigneeOnEntity(
8176
8197
  ctx.request?.body?.data,
8177
8198
  "You should pass a valid id to the body of the put request."
8178
8199
  );
8179
- await validateLocale(locale);
8180
8200
  await workflowService.assertContentTypeBelongsToWorkflow(model);
8181
- const entity = await assigneeService.updateEntityAssignee(
8201
+ const updatedEntity = await assigneeService.updateEntityAssignee(
8182
8202
  documentId,
8183
8203
  locale || null,
8184
8204
  model,
8185
8205
  assigneeId
8186
8206
  );
8187
- ctx.body = { data: await sanitizeOutput(entity) };
8207
+ ctx.body = { data: await sanitizeOutput(updatedEntity) };
8188
8208
  }
8189
8209
  };
8190
8210
  const controllers = {