@strapi/review-workflows 0.0.0-experimental.d23c1d5b0e45dd06ef09977f526c85468be05403 → 0.0.0-experimental.d325780feab1caf1b9e4423588eb1cc73b74c376

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 (96) hide show
  1. package/LICENSE +12 -17
  2. package/dist/_chunks/{Layout-dGg4FA1R.js → Layout-C3IORH2n.js} +14 -24
  3. package/dist/_chunks/Layout-C3IORH2n.js.map +1 -0
  4. package/dist/_chunks/{Layout-facLKucY.mjs → Layout-DNKR5bym.mjs} +16 -23
  5. package/dist/_chunks/Layout-DNKR5bym.mjs.map +1 -0
  6. package/dist/_chunks/{en-xcewH2pC.js → en-CYgjfSep.js} +5 -2
  7. package/dist/_chunks/en-CYgjfSep.js.map +1 -0
  8. package/dist/_chunks/{en-D9ZrQAV6.mjs → en-D9dxziEb.mjs} +5 -2
  9. package/dist/_chunks/en-D9dxziEb.mjs.map +1 -0
  10. package/dist/_chunks/{_id-D4CXKOqG.mjs → id-C9Ku9Br9.mjs} +390 -427
  11. package/dist/_chunks/id-C9Ku9Br9.mjs.map +1 -0
  12. package/dist/_chunks/{_id-B6DgrtpA.js → id-oOE1bYls.js} +395 -435
  13. package/dist/_chunks/id-oOE1bYls.js.map +1 -0
  14. package/dist/_chunks/{index-D7Y0ofdg.mjs → index-ByXbOW-R.mjs} +196 -232
  15. package/dist/_chunks/index-ByXbOW-R.mjs.map +1 -0
  16. package/dist/_chunks/{index-BuKZWpJw.js → index-CmHHjN95.js} +24 -61
  17. package/dist/_chunks/index-CmHHjN95.js.map +1 -0
  18. package/dist/_chunks/{index-QbWLXdZR.mjs → index-CyhaJuJG.mjs} +24 -58
  19. package/dist/_chunks/index-CyhaJuJG.mjs.map +1 -0
  20. package/dist/_chunks/{index-DX8AGcIP.js → index-DMT27jNE.js} +196 -235
  21. package/dist/_chunks/index-DMT27jNE.js.map +1 -0
  22. package/dist/_chunks/{purchase-review-workflows-Ds61D_tk.js → purchase-review-workflows-BxoDFxQ5.js} +8 -7
  23. package/dist/_chunks/purchase-review-workflows-BxoDFxQ5.js.map +1 -0
  24. package/dist/_chunks/{purchase-review-workflows-B-V0sA2I.mjs → purchase-review-workflows-DyFV_H0I.mjs} +9 -8
  25. package/dist/_chunks/purchase-review-workflows-DyFV_H0I.mjs.map +1 -0
  26. package/dist/_chunks/{router-ylD0eA48.mjs → router-BPl2HZMq.mjs} +3 -3
  27. package/dist/_chunks/router-BPl2HZMq.mjs.map +1 -0
  28. package/dist/_chunks/{router-CL62NScV.js → router-vDfGt9bq.js} +3 -3
  29. package/dist/_chunks/router-vDfGt9bq.js.map +1 -0
  30. package/dist/admin/index.js +1 -1
  31. package/dist/admin/index.mjs +1 -1
  32. package/dist/admin/src/components/LimitsModal.d.ts +2 -4
  33. package/dist/admin/src/routes/content-manager/[model]/[id]/components/Panel.d.ts +1 -1
  34. package/dist/admin/src/routes/settings/hooks/useDragAndDrop.d.ts +4 -4
  35. package/dist/admin/src/routes/settings/hooks/useKeyboardDragAndDrop.d.ts +1 -1
  36. package/dist/admin/src/routes/settings/hooks/useReviewWorkflows.d.ts +3 -3
  37. package/dist/admin/src/services/admin.d.ts +2 -2
  38. package/dist/admin/src/services/api.d.ts +2 -3
  39. package/dist/admin/src/services/content-manager.d.ts +7 -7
  40. package/dist/admin/src/services/settings.d.ts +1740 -10
  41. package/dist/admin/src/utils/api.d.ts +4 -19
  42. package/dist/admin/src/utils/cm-hooks.d.ts +1 -1
  43. package/dist/server/index.js +455 -628
  44. package/dist/server/index.js.map +1 -1
  45. package/dist/server/index.mjs +455 -628
  46. package/dist/server/index.mjs.map +1 -1
  47. package/dist/server/src/bootstrap.d.ts.map +1 -1
  48. package/dist/server/src/constants/workflows.d.ts +1 -0
  49. package/dist/server/src/constants/workflows.d.ts.map +1 -1
  50. package/dist/server/src/content-types/index.d.ts +6 -0
  51. package/dist/server/src/content-types/index.d.ts.map +1 -1
  52. package/dist/server/src/content-types/workflow/index.d.ts +6 -0
  53. package/dist/server/src/content-types/workflow/index.d.ts.map +1 -1
  54. package/dist/server/src/controllers/assignees.d.ts.map +1 -1
  55. package/dist/server/src/controllers/index.d.ts +0 -1
  56. package/dist/server/src/controllers/index.d.ts.map +1 -1
  57. package/dist/server/src/controllers/stages.d.ts.map +1 -1
  58. package/dist/server/src/controllers/workflows.d.ts +0 -7
  59. package/dist/server/src/controllers/workflows.d.ts.map +1 -1
  60. package/dist/server/src/index.d.ts +28 -7
  61. package/dist/server/src/index.d.ts.map +1 -1
  62. package/dist/server/src/register.d.ts.map +1 -1
  63. package/dist/server/src/routes/review-workflows.d.ts.map +1 -1
  64. package/dist/server/src/services/assignees.d.ts +8 -4
  65. package/dist/server/src/services/assignees.d.ts.map +1 -1
  66. package/dist/server/src/services/document-service-middleware.d.ts +1 -0
  67. package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
  68. package/dist/server/src/services/index.d.ts +16 -6
  69. package/dist/server/src/services/index.d.ts.map +1 -1
  70. package/dist/server/src/services/metrics/index.d.ts +4 -4
  71. package/dist/server/src/services/metrics/index.d.ts.map +1 -1
  72. package/dist/server/src/services/metrics/weekly-metrics.d.ts.map +1 -1
  73. package/dist/server/src/services/stages.d.ts +7 -7
  74. package/dist/server/src/services/stages.d.ts.map +1 -1
  75. package/dist/server/src/services/workflows.d.ts.map +1 -1
  76. package/dist/server/src/validation/review-workflows.d.ts +4 -0
  77. package/dist/server/src/validation/review-workflows.d.ts.map +1 -1
  78. package/dist/shared/contracts/review-workflows.d.ts +9 -17
  79. package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
  80. package/package.json +17 -20
  81. package/dist/_chunks/Layout-dGg4FA1R.js.map +0 -1
  82. package/dist/_chunks/Layout-facLKucY.mjs.map +0 -1
  83. package/dist/_chunks/_id-B6DgrtpA.js.map +0 -1
  84. package/dist/_chunks/_id-D4CXKOqG.mjs.map +0 -1
  85. package/dist/_chunks/en-D9ZrQAV6.mjs.map +0 -1
  86. package/dist/_chunks/en-xcewH2pC.js.map +0 -1
  87. package/dist/_chunks/index-BuKZWpJw.js.map +0 -1
  88. package/dist/_chunks/index-D7Y0ofdg.mjs.map +0 -1
  89. package/dist/_chunks/index-DX8AGcIP.js.map +0 -1
  90. package/dist/_chunks/index-QbWLXdZR.mjs.map +0 -1
  91. package/dist/_chunks/purchase-review-workflows-B-V0sA2I.mjs.map +0 -1
  92. package/dist/_chunks/purchase-review-workflows-Ds61D_tk.js.map +0 -1
  93. package/dist/_chunks/router-CL62NScV.js.map +0 -1
  94. package/dist/_chunks/router-ylD0eA48.mjs.map +0 -1
  95. package/strapi-server.js +0 -3
  96. /package/dist/admin/src/routes/settings/{:id.d.ts → id.d.ts} +0 -0
@@ -5,17 +5,13 @@ const React = require("react");
5
5
  const strapiAdmin = require("@strapi/admin/strapi-admin");
6
6
  const ee = require("@strapi/admin/strapi-admin/ee");
7
7
  const designSystem = require("@strapi/design-system");
8
- const v2 = require("@strapi/design-system/v2");
9
8
  const icons = require("@strapi/icons");
10
9
  const reactIntl = require("react-intl");
11
10
  const reactRouterDom = require("react-router-dom");
12
- const styled = require("styled-components");
13
- const index = require("./index-DX8AGcIP.js");
14
- const Layout = require("./Layout-dGg4FA1R.js");
15
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
+ const index = require("./index-DMT27jNE.js");
12
+ const Layout = require("./Layout-C3IORH2n.js");
16
13
  function _interopNamespace(e) {
17
- if (e && e.__esModule)
18
- return e;
14
+ if (e && e.__esModule) return e;
19
15
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
20
16
  if (e) {
21
17
  for (const k in e) {
@@ -32,7 +28,6 @@ function _interopNamespace(e) {
32
28
  return Object.freeze(n);
33
29
  }
34
30
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
35
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
36
31
  const ReviewWorkflowsListView = () => {
37
32
  const { formatMessage } = reactIntl.useIntl();
38
33
  const navigate = reactRouterDom.useNavigate();
@@ -57,8 +52,7 @@ const ReviewWorkflowsListView = () => {
57
52
  setWorkflowToDelete(null);
58
53
  };
59
54
  const handleConfirmDeleteDialog = async () => {
60
- if (!workflowToDelete)
61
- return;
55
+ if (!workflowToDelete) return;
62
56
  await deleteAction(workflowToDelete);
63
57
  setWorkflowToDelete(null);
64
58
  };
@@ -114,11 +108,11 @@ const ReviewWorkflowsListView = () => {
114
108
  Layout.Header,
115
109
  {
116
110
  primaryAction: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(
117
- v2.LinkButton,
111
+ designSystem.LinkButton,
118
112
  {
119
113
  startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
120
114
  size: "S",
121
- as: reactRouterDom.NavLink,
115
+ tag: reactRouterDom.NavLink,
122
116
  to: "create",
123
117
  onClick: handleCreateClick,
124
118
  children: formatMessage({
@@ -143,7 +137,7 @@ const ReviewWorkflowsListView = () => {
143
137
  {
144
138
  isLoading,
145
139
  rows: workflows,
146
- footer: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.TFooter, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}), onClick: handleCreateClick, children: formatMessage({
140
+ footer: canCreate ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.TFooter, { cursor: "pointer", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}), onClick: handleCreateClick, children: formatMessage({
147
141
  id: "Settings.review-workflows.list.page.create",
148
142
  defaultMessage: "Create new workflow"
149
143
  }) }) : null,
@@ -157,7 +151,7 @@ const ReviewWorkflowsListView = () => {
157
151
  navigate(`${workflow.id}`);
158
152
  },
159
153
  children: [
160
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { width: `${250 / 16}rem`, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", ellipsis: true, children: workflow.name }) }),
154
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { width: "25rem", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", ellipsis: true, children: workflow.name }) }),
161
155
  /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: workflow.stages.length }) }),
162
156
  /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: workflow.contentTypes.map((uid) => {
163
157
  const contentType = contentTypes.find(
@@ -167,35 +161,38 @@ const ReviewWorkflowsListView = () => {
167
161
  }).join(", ") }) }),
168
162
  /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", justifyContent: "end", children: [
169
163
  canRead || canUpdate ? /* @__PURE__ */ jsxRuntime.jsx(
170
- ActionLink,
164
+ designSystem.IconButton,
171
165
  {
172
- to: `${workflow.id}`,
173
- "aria-label": formatMessage(
166
+ tag: reactRouterDom.Link,
167
+ to: workflow.id.toString(),
168
+ label: formatMessage(
174
169
  {
175
170
  id: "Settings.review-workflows.list.page.list.column.actions.edit.label",
176
171
  defaultMessage: "Edit {name}"
177
172
  },
178
173
  { name: workflow.name }
179
174
  ),
175
+ variant: "ghost",
180
176
  children: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {})
181
177
  }
182
178
  ) : null,
183
179
  workflows.length > 1 && canDelete ? /* @__PURE__ */ jsxRuntime.jsx(
184
180
  designSystem.IconButton,
185
181
  {
186
- "aria-label": formatMessage(
182
+ withTooltip: false,
183
+ label: formatMessage(
187
184
  {
188
185
  id: "Settings.review-workflows.list.page.list.column.actions.delete.label",
189
186
  defaultMessage: "Delete {name}"
190
187
  },
191
188
  { name: "Default workflow" }
192
189
  ),
193
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {}),
194
- borderWidth: 0,
190
+ variant: "ghost",
195
191
  onClick: (e) => {
196
192
  e.stopPropagation();
197
193
  handleDeleteWorkflow(String(workflow.id));
198
- }
194
+ },
195
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
199
196
  }
200
197
  ) : null
201
198
  ] }) })
@@ -206,19 +203,11 @@ const ReviewWorkflowsListView = () => {
206
203
  ] })
207
204
  }
208
205
  ),
209
- /* @__PURE__ */ jsxRuntime.jsx(
210
- strapiAdmin.ConfirmDialog,
211
- {
212
- isOpen: !!workflowToDelete,
213
- onClose: toggleConfirmDeleteDialog,
214
- onConfirm: handleConfirmDeleteDialog,
215
- children: formatMessage({
216
- id: "Settings.review-workflows.list.page.delete.confirm.body",
217
- defaultMessage: "If you remove this worfklow, all stage-related information will be removed for this content-type. Are you sure you want to remove it?"
218
- })
219
- }
220
- ),
221
- /* @__PURE__ */ jsxRuntime.jsxs(index.LimitsModal.Root, { isOpen: showLimitModal, onClose: () => setShowLimitModal(false), children: [
206
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: !!workflowToDelete, onOpenChange: toggleConfirmDeleteDialog, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleConfirmDeleteDialog, children: formatMessage({
207
+ id: "Settings.review-workflows.list.page.delete.confirm.body",
208
+ defaultMessage: "If you remove this worfklow, all stage-related information will be removed for this content-type. Are you sure you want to remove it?"
209
+ }) }) }),
210
+ /* @__PURE__ */ jsxRuntime.jsxs(index.LimitsModal.Root, { open: showLimitModal, onOpenChange: () => setShowLimitModal(false), children: [
222
211
  /* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
223
212
  id: "Settings.review-workflows.list.page.workflows.limit.title",
224
213
  defaultMessage: "You’ve reached the limit of workflows in your plan"
@@ -231,32 +220,6 @@ const ReviewWorkflowsListView = () => {
231
220
  ] })
232
221
  ] });
233
222
  };
234
- const ActionLink = styled__default.default(v2.Link)`
235
- align-items: center;
236
- height: ${32 / 16}rem;
237
- display: flex;
238
- justify-content: center;
239
- padding: ${({ theme }) => `${theme.spaces[2]}}`};
240
- width: ${32 / 16}rem;
241
-
242
- svg {
243
- height: ${12 / 16}rem;
244
- width: ${12 / 16}rem;
245
-
246
- path {
247
- fill: ${({ theme }) => theme.colors.neutral500};
248
- }
249
- }
250
-
251
- &:hover,
252
- &:focus {
253
- svg {
254
- path {
255
- fill: ${({ theme }) => theme.colors.neutral800};
256
- }
257
- }
258
- }
259
- `;
260
223
  const ProtectedListPage = () => {
261
224
  const permissions = index.useTypedSelector(
262
225
  (state) => state.admin_app.permissions.settings?.["review-workflows"]?.main
@@ -265,4 +228,4 @@ const ProtectedListPage = () => {
265
228
  };
266
229
  exports.ProtectedListPage = ProtectedListPage;
267
230
  exports.ReviewWorkflowsListView = ReviewWorkflowsListView;
268
- //# sourceMappingURL=index-BuKZWpJw.js.map
231
+ //# sourceMappingURL=index-CmHHjN95.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CmHHjN95.js","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 cursor=\"pointer\" 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":["useIntl","useNavigate","useTracking","React","useGetContentTypesQuery","useReviewWorkflows","useLicenseLimits","useTypedSelector","useRBAC","CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME","jsx","Page","jsxs","Fragment","Layout.Header","LinkButton","Plus","NavLink","Layout.Root","Table","TFooter","Typography","contentType","Flex","IconButton","Link","Pencil","Trash","Dialog","ConfirmDialog","LimitsModal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,0BAA0B,MAAM;AACrC,QAAA,EAAE,cAAc,IAAIA,kBAAQ;AAClC,QAAM,WAAWC,eAAAA,YAAY;AACvB,QAAA,EAAE,WAAW,IAAIC,wBAAY;AACnC,QAAM,CAAC,kBAAkB,mBAAmB,IAAIC,iBAAM,SAAwB,IAAI;AAClF,QAAM,CAAC,gBAAgB,iBAAiB,IAAIA,iBAAM,SAAkB,KAAK;AACzE,QAAM,EAAE,MAAM,WAAW,gBAAA,IAAoBC,MAAAA,wBAAwB;AACrE,QAAM,EAAE,MAAM,WAAW,WAAW,QAAQ,iBAAiBC,0BAAmB;AAChF,QAAM,EAAE,YAAY,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,cAAc,MAAM,kBAAkB,KAAK,GACjF,UAAA;AAAA,QAACpB,2BAAAA,IAAAoB,MAAAA,YAAY,OAAZ,EACE,UAAc,cAAA;AAAA,UACb,IAAI;AAAA,UACJ,gBAAgB;AAAA,QACjB,CAAA,GACH;AAAA,QAECpB,2BAAAA,IAAAoB,MAAAA,YAAY,MAAZ,EACE,UAAc,cAAA;AAAA,UACb,IAAI;AAAA,UACJ,gBAAgB;AAAA,QAAA,CACjB,EACH,CAAA;AAAA,MAAA,EACF,CAAA;AAAA,IAAA,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;AAEA,MAAM,oBAAoB,MAAM;AAC9B,QAAM,cAAcvB,MAAA;AAAA,IAClB,CAAC,UAAU,MAAM,UAAU,YAAY,WAAW,kBAAkB,GAAG;AAAA,EACzE;AAEA,wCACGI,iBAAK,SAAL,EAAa,aACZ,UAAAD,+BAAC,0BAAwB,CAAA,GAC3B;AAEJ;;;"}
@@ -2,14 +2,12 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { useTracking, useRBAC, Page, Table, ConfirmDialog } from "@strapi/admin/strapi-admin";
4
4
  import { useLicenseLimits } from "@strapi/admin/strapi-admin/ee";
5
- import { TFooter, Typography, Flex, IconButton } from "@strapi/design-system";
6
- import { LinkButton, Link } from "@strapi/design-system/v2";
5
+ import { LinkButton, TFooter, Typography, Flex, IconButton, Dialog } from "@strapi/design-system";
7
6
  import { Plus, Pencil, Trash } from "@strapi/icons";
8
7
  import { useIntl } from "react-intl";
9
- import { useNavigate, NavLink } from "react-router-dom";
10
- import styled from "styled-components";
11
- import { u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal } from "./index-D7Y0ofdg.mjs";
12
- import { u as useReviewWorkflows, H as Header, R as Root } from "./Layout-facLKucY.mjs";
8
+ import { useNavigate, NavLink, Link } from "react-router-dom";
9
+ import { u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal } from "./index-ByXbOW-R.mjs";
10
+ import { u as useReviewWorkflows, H as Header, R as Root } from "./Layout-DNKR5bym.mjs";
13
11
  const ReviewWorkflowsListView = () => {
14
12
  const { formatMessage } = useIntl();
15
13
  const navigate = useNavigate();
@@ -34,8 +32,7 @@ const ReviewWorkflowsListView = () => {
34
32
  setWorkflowToDelete(null);
35
33
  };
36
34
  const handleConfirmDeleteDialog = async () => {
37
- if (!workflowToDelete)
38
- return;
35
+ if (!workflowToDelete) return;
39
36
  await deleteAction(workflowToDelete);
40
37
  setWorkflowToDelete(null);
41
38
  };
@@ -95,7 +92,7 @@ const ReviewWorkflowsListView = () => {
95
92
  {
96
93
  startIcon: /* @__PURE__ */ jsx(Plus, {}),
97
94
  size: "S",
98
- as: NavLink,
95
+ tag: NavLink,
99
96
  to: "create",
100
97
  onClick: handleCreateClick,
101
98
  children: formatMessage({
@@ -120,7 +117,7 @@ const ReviewWorkflowsListView = () => {
120
117
  {
121
118
  isLoading,
122
119
  rows: workflows,
123
- footer: canCreate ? /* @__PURE__ */ jsx(TFooter, { icon: /* @__PURE__ */ jsx(Plus, {}), onClick: handleCreateClick, children: formatMessage({
120
+ footer: canCreate ? /* @__PURE__ */ jsx(TFooter, { cursor: "pointer", icon: /* @__PURE__ */ jsx(Plus, {}), onClick: handleCreateClick, children: formatMessage({
124
121
  id: "Settings.review-workflows.list.page.create",
125
122
  defaultMessage: "Create new workflow"
126
123
  }) }) : null,
@@ -134,7 +131,7 @@ const ReviewWorkflowsListView = () => {
134
131
  navigate(`${workflow.id}`);
135
132
  },
136
133
  children: [
137
- /* @__PURE__ */ jsx(Table.Cell, { width: `${250 / 16}rem`, children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", ellipsis: true, children: workflow.name }) }),
134
+ /* @__PURE__ */ jsx(Table.Cell, { width: "25rem", children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", ellipsis: true, children: workflow.name }) }),
138
135
  /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: workflow.stages.length }) }),
139
136
  /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: workflow.contentTypes.map((uid) => {
140
137
  const contentType = contentTypes.find(
@@ -144,35 +141,38 @@ const ReviewWorkflowsListView = () => {
144
141
  }).join(", ") }) }),
145
142
  /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", justifyContent: "end", children: [
146
143
  canRead || canUpdate ? /* @__PURE__ */ jsx(
147
- ActionLink,
144
+ IconButton,
148
145
  {
149
- to: `${workflow.id}`,
150
- "aria-label": formatMessage(
146
+ tag: Link,
147
+ to: workflow.id.toString(),
148
+ label: formatMessage(
151
149
  {
152
150
  id: "Settings.review-workflows.list.page.list.column.actions.edit.label",
153
151
  defaultMessage: "Edit {name}"
154
152
  },
155
153
  { name: workflow.name }
156
154
  ),
155
+ variant: "ghost",
157
156
  children: /* @__PURE__ */ jsx(Pencil, {})
158
157
  }
159
158
  ) : null,
160
159
  workflows.length > 1 && canDelete ? /* @__PURE__ */ jsx(
161
160
  IconButton,
162
161
  {
163
- "aria-label": formatMessage(
162
+ withTooltip: false,
163
+ label: formatMessage(
164
164
  {
165
165
  id: "Settings.review-workflows.list.page.list.column.actions.delete.label",
166
166
  defaultMessage: "Delete {name}"
167
167
  },
168
168
  { name: "Default workflow" }
169
169
  ),
170
- icon: /* @__PURE__ */ jsx(Trash, {}),
171
- borderWidth: 0,
170
+ variant: "ghost",
172
171
  onClick: (e) => {
173
172
  e.stopPropagation();
174
173
  handleDeleteWorkflow(String(workflow.id));
175
- }
174
+ },
175
+ children: /* @__PURE__ */ jsx(Trash, {})
176
176
  }
177
177
  ) : null
178
178
  ] }) })
@@ -183,19 +183,11 @@ const ReviewWorkflowsListView = () => {
183
183
  ] })
184
184
  }
185
185
  ),
186
- /* @__PURE__ */ jsx(
187
- ConfirmDialog,
188
- {
189
- isOpen: !!workflowToDelete,
190
- onClose: toggleConfirmDeleteDialog,
191
- onConfirm: handleConfirmDeleteDialog,
192
- children: formatMessage({
193
- id: "Settings.review-workflows.list.page.delete.confirm.body",
194
- defaultMessage: "If you remove this worfklow, all stage-related information will be removed for this content-type. Are you sure you want to remove it?"
195
- })
196
- }
197
- ),
198
- /* @__PURE__ */ jsxs(LimitsModal.Root, { isOpen: showLimitModal, onClose: () => setShowLimitModal(false), children: [
186
+ /* @__PURE__ */ jsx(Dialog.Root, { open: !!workflowToDelete, onOpenChange: toggleConfirmDeleteDialog, children: /* @__PURE__ */ jsx(ConfirmDialog, { onConfirm: handleConfirmDeleteDialog, children: formatMessage({
187
+ id: "Settings.review-workflows.list.page.delete.confirm.body",
188
+ defaultMessage: "If you remove this worfklow, all stage-related information will be removed for this content-type. Are you sure you want to remove it?"
189
+ }) }) }),
190
+ /* @__PURE__ */ jsxs(LimitsModal.Root, { open: showLimitModal, onOpenChange: () => setShowLimitModal(false), children: [
199
191
  /* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
200
192
  id: "Settings.review-workflows.list.page.workflows.limit.title",
201
193
  defaultMessage: "You’ve reached the limit of workflows in your plan"
@@ -208,32 +200,6 @@ const ReviewWorkflowsListView = () => {
208
200
  ] })
209
201
  ] });
210
202
  };
211
- const ActionLink = styled(Link)`
212
- align-items: center;
213
- height: ${32 / 16}rem;
214
- display: flex;
215
- justify-content: center;
216
- padding: ${({ theme }) => `${theme.spaces[2]}}`};
217
- width: ${32 / 16}rem;
218
-
219
- svg {
220
- height: ${12 / 16}rem;
221
- width: ${12 / 16}rem;
222
-
223
- path {
224
- fill: ${({ theme }) => theme.colors.neutral500};
225
- }
226
- }
227
-
228
- &:hover,
229
- &:focus {
230
- svg {
231
- path {
232
- fill: ${({ theme }) => theme.colors.neutral800};
233
- }
234
- }
235
- }
236
- `;
237
203
  const ProtectedListPage = () => {
238
204
  const permissions = useTypedSelector(
239
205
  (state) => state.admin_app.permissions.settings?.["review-workflows"]?.main
@@ -244,4 +210,4 @@ export {
244
210
  ProtectedListPage,
245
211
  ReviewWorkflowsListView
246
212
  };
247
- //# sourceMappingURL=index-QbWLXdZR.mjs.map
213
+ //# sourceMappingURL=index-CyhaJuJG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CyhaJuJG.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 cursor=\"pointer\" 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,cAAc,IAAI,QAAQ;AAClC,QAAM,WAAW,YAAY;AACvB,QAAA,EAAE,WAAW,IAAI,YAAY;AACnC,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,MAAM,SAAwB,IAAI;AAClF,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,MAAM,SAAkB,KAAK;AACzE,QAAM,EAAE,MAAM,WAAW,gBAAA,IAAoB,wBAAwB;AACrE,QAAM,EAAE,MAAM,WAAW,WAAW,QAAQ,iBAAiB,mBAAmB;AAChF,QAAM,EAAE,YAAY,WAAW,iBAAA,IAAqB,iBAAiB;AACrE,QAAM,cAAc;AAAA,IAClB,CAAC,UAAU,MAAM,UAAU,YAAY,WAAW,kBAAkB;AAAA,EACtE;AACM,QAAA;AAAA,IACJ,gBAAgB,EAAE,WAAW,SAAS,WAAW,UAAU;AAAA,EAAA,IACzD,QAAQ,WAAW;AAEjB,QAAA,SAAS,WAAW,kBAAkB;AACtC,QAAA,oBAAoB,SAAS,mCAAmC;AAEhE,QAAA,uBAAuB,CAAC,eAAuB;AACnD,wBAAoB,UAAU;AAAA,EAChC;AAEA,QAAM,4BAA4B,MAAM;AACtC,wBAAoB,IAAI;AAAA,EAC1B;AAEA,QAAM,4BAA4B,YAAY;AAC5C,QAAI,CAAC,iBAAkB;AAEvB,UAAM,aAAa,gBAAgB;AAEnC,wBAAoB,IAAI;AAAA,EAC1B;AAEM,QAAA,oBACiE,CAAC,UAAU;AAChF,UAAM,eAAe;AAWrB,QAAI,qBAAqB,QAAQ,MAAM,iBAAiB,SAAS,mBAAmB,EAAE,GAAG;AACvF,YAAM,eAAe;AACrB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