@strapi/review-workflows 0.0.0-experimental.d23c1d5b0e45dd06ef09977f526c85468be05403 → 0.0.0-experimental.d834c9e658d1fb037e6da1105150593521c667cc
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-dGg4FA1R.js → Layout-AREWDuuq.js} +12 -21
- package/dist/_chunks/Layout-AREWDuuq.js.map +1 -0
- package/dist/_chunks/{Layout-facLKucY.mjs → Layout-D5aa9iUm.mjs} +15 -22
- package/dist/_chunks/Layout-D5aa9iUm.mjs.map +1 -0
- package/dist/_chunks/{_id-B6DgrtpA.js → _id-C7pCAzXV.js} +322 -417
- package/dist/_chunks/_id-C7pCAzXV.js.map +1 -0
- package/dist/_chunks/{_id-D4CXKOqG.mjs → _id-DDNHKV_W.mjs} +316 -409
- package/dist/_chunks/_id-DDNHKV_W.mjs.map +1 -0
- package/dist/_chunks/{index-BuKZWpJw.js → index-Bv3cQ3c-.js} +26 -41
- package/dist/_chunks/index-Bv3cQ3c-.js.map +1 -0
- package/dist/_chunks/{index-DX8AGcIP.js → index-CIBLMG85.js} +167 -211
- package/dist/_chunks/index-CIBLMG85.js.map +1 -0
- package/dist/_chunks/{index-QbWLXdZR.mjs → index-CeaoNBIP.mjs} +25 -38
- package/dist/_chunks/index-CeaoNBIP.mjs.map +1 -0
- package/dist/_chunks/{index-D7Y0ofdg.mjs → index-Cx5QECZI.mjs} +168 -210
- package/dist/_chunks/index-Cx5QECZI.mjs.map +1 -0
- package/dist/_chunks/{purchase-review-workflows-B-V0sA2I.mjs → purchase-review-workflows-BN-5Ube7.mjs} +8 -7
- package/dist/_chunks/purchase-review-workflows-BN-5Ube7.mjs.map +1 -0
- package/dist/_chunks/{purchase-review-workflows-Ds61D_tk.js → purchase-review-workflows-DlCDg0fD.js} +7 -6
- package/dist/_chunks/purchase-review-workflows-DlCDg0fD.js.map +1 -0
- package/dist/_chunks/{router-ylD0eA48.mjs → router-BEoNwQZ1.mjs} +3 -3
- package/dist/_chunks/{router-ylD0eA48.mjs.map → router-BEoNwQZ1.mjs.map} +1 -1
- package/dist/_chunks/{router-CL62NScV.js → router-gRPIa2_c.js} +3 -3
- package/dist/_chunks/{router-CL62NScV.js.map → router-gRPIa2_c.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/LimitsModal.d.ts +2 -4
- package/dist/admin/src/routes/content-manager/[model]/[id]/components/Panel.d.ts +1 -1
- package/dist/admin/src/routes/settings/hooks/useDragAndDrop.d.ts +4 -4
- package/dist/admin/src/routes/settings/hooks/useKeyboardDragAndDrop.d.ts +1 -1
- package/dist/admin/src/routes/settings/hooks/useReviewWorkflows.d.ts +3 -3
- package/dist/admin/src/services/admin.d.ts +2 -2
- package/dist/admin/src/services/api.d.ts +2 -3
- package/dist/admin/src/services/content-manager.d.ts +7 -7
- package/dist/admin/src/services/settings.d.ts +1734 -8
- package/dist/admin/src/utils/api.d.ts +4 -19
- package/dist/admin/src/utils/cm-hooks.d.ts +1 -1
- package/dist/server/index.js +12 -53
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +12 -53
- package/dist/server/index.mjs.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 +15 -16
- package/dist/_chunks/Layout-dGg4FA1R.js.map +0 -1
- package/dist/_chunks/Layout-facLKucY.mjs.map +0 -1
- package/dist/_chunks/_id-B6DgrtpA.js.map +0 -1
- package/dist/_chunks/_id-D4CXKOqG.mjs.map +0 -1
- package/dist/_chunks/index-BuKZWpJw.js.map +0 -1
- package/dist/_chunks/index-D7Y0ofdg.mjs.map +0 -1
- package/dist/_chunks/index-DX8AGcIP.js.map +0 -1
- package/dist/_chunks/index-QbWLXdZR.mjs.map +0 -1
- package/dist/_chunks/purchase-review-workflows-B-V0sA2I.mjs.map +0 -1
- package/dist/_chunks/purchase-review-workflows-Ds61D_tk.js.map +0 -1
|
@@ -8,16 +8,13 @@ const designSystem = require("@strapi/design-system");
|
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const fractionalIndexing = require("fractional-indexing");
|
|
10
10
|
const reactIntl = require("react-intl");
|
|
11
|
-
const reactRedux = require("react-redux");
|
|
12
11
|
const reactRouterDom = require("react-router-dom");
|
|
13
12
|
const yup = require("yup");
|
|
14
|
-
const index = require("./index-
|
|
15
|
-
const Layout = require("./Layout-
|
|
16
|
-
const v2 = require("@strapi/design-system/v2");
|
|
13
|
+
const index = require("./index-CIBLMG85.js");
|
|
14
|
+
const Layout = require("./Layout-AREWDuuq.js");
|
|
17
15
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
18
|
-
const
|
|
16
|
+
const styledComponents = require("styled-components");
|
|
19
17
|
const reactDnd = require("react-dnd");
|
|
20
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
21
18
|
function _interopNamespace(e) {
|
|
22
19
|
if (e && e.__esModule)
|
|
23
20
|
return e;
|
|
@@ -38,11 +35,10 @@ function _interopNamespace(e) {
|
|
|
38
35
|
}
|
|
39
36
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
40
37
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
41
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
42
38
|
const adminApi = index.reviewWorkflowsApi.injectEndpoints({
|
|
43
39
|
endpoints(builder) {
|
|
44
40
|
return {
|
|
45
|
-
|
|
41
|
+
getAdminRoles: builder.query({
|
|
46
42
|
query: () => ({
|
|
47
43
|
url: `/admin/roles`,
|
|
48
44
|
method: "GET"
|
|
@@ -54,7 +50,7 @@ const adminApi = index.reviewWorkflowsApi.injectEndpoints({
|
|
|
54
50
|
};
|
|
55
51
|
}
|
|
56
52
|
});
|
|
57
|
-
const {
|
|
53
|
+
const { useGetAdminRolesQuery } = adminApi;
|
|
58
54
|
const useKeyboardDragAndDrop = (active, index2, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
|
|
59
55
|
const [isSelected, setIsSelected] = React__namespace.useState(false);
|
|
60
56
|
const handleMove = (movement) => {
|
|
@@ -273,74 +269,35 @@ const AddStage = ({ children, ...props }) => {
|
|
|
273
269
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
274
270
|
StyledButton,
|
|
275
271
|
{
|
|
276
|
-
|
|
272
|
+
tag: "button",
|
|
277
273
|
background: "neutral0",
|
|
278
|
-
|
|
274
|
+
borderColor: "neutral150",
|
|
279
275
|
paddingBottom: 3,
|
|
280
276
|
paddingLeft: 4,
|
|
281
277
|
paddingRight: 4,
|
|
282
278
|
paddingTop: 3,
|
|
283
279
|
shadow: "filterShadow",
|
|
284
280
|
...props,
|
|
285
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
286
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
-
|
|
288
|
-
] })
|
|
281
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
|
|
282
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
|
|
283
|
+
children
|
|
284
|
+
] }) })
|
|
289
285
|
}
|
|
290
286
|
);
|
|
291
287
|
};
|
|
292
|
-
const
|
|
293
|
-
> circle {
|
|
294
|
-
fill: ${({ theme }) => theme.colors.neutral150};
|
|
295
|
-
}
|
|
296
|
-
> path {
|
|
297
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
298
|
-
}
|
|
299
|
-
`;
|
|
300
|
-
const StyledButton = styled__default.default(designSystem.Box)`
|
|
288
|
+
const StyledButton = styledComponents.styled(designSystem.Box)`
|
|
301
289
|
border-radius: 26px;
|
|
302
|
-
|
|
303
|
-
svg {
|
|
304
|
-
height: ${({ theme }) => theme.spaces[6]};
|
|
305
|
-
width: ${({ theme }) => theme.spaces[6]};
|
|
306
|
-
|
|
307
|
-
> path {
|
|
308
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
309
|
-
}
|
|
310
|
-
}
|
|
290
|
+
color: ${({ theme }) => theme.colors.neutral500};
|
|
311
291
|
|
|
312
292
|
&:hover {
|
|
313
|
-
color: ${({ theme }) => theme.colors.primary600}
|
|
314
|
-
${designSystem.Typography} {
|
|
315
|
-
color: ${({ theme }) => theme.colors.primary600} !important;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
${StyledAddIcon} {
|
|
319
|
-
> circle {
|
|
320
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
321
|
-
}
|
|
322
|
-
> path {
|
|
323
|
-
fill: ${({ theme }) => theme.colors.neutral100};
|
|
324
|
-
}
|
|
325
|
-
}
|
|
293
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
326
294
|
}
|
|
327
295
|
|
|
328
296
|
&:active {
|
|
329
|
-
${
|
|
330
|
-
color: ${({ theme }) => theme.colors.primary600};
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
${StyledAddIcon} {
|
|
334
|
-
> circle {
|
|
335
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
336
|
-
}
|
|
337
|
-
> path {
|
|
338
|
-
fill: ${({ theme }) => theme.colors.neutral100};
|
|
339
|
-
}
|
|
340
|
-
}
|
|
297
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
341
298
|
}
|
|
342
299
|
`;
|
|
343
|
-
const Stages = ({ canDelete = true, canUpdate = true, isCreating
|
|
300
|
+
const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
344
301
|
const { formatMessage } = reactIntl.useIntl();
|
|
345
302
|
const { trackUsage } = strapiAdmin.useTracking();
|
|
346
303
|
const addFieldRow = strapiAdmin.useForm("Stages", (state) => state.addFieldRow);
|
|
@@ -355,35 +312,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
355
312
|
left: "50%",
|
|
356
313
|
position: "absolute",
|
|
357
314
|
top: "0",
|
|
358
|
-
width: 2
|
|
359
|
-
zIndex: 1
|
|
315
|
+
width: 2
|
|
360
316
|
}
|
|
361
317
|
),
|
|
362
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
363
|
-
designSystem.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
canDelete: stages.length > 1 && canDelete,
|
|
377
|
-
canReorder: stages.length > 1,
|
|
378
|
-
canUpdate,
|
|
379
|
-
stagesCount: stages.length,
|
|
380
|
-
isOpen: isCreating,
|
|
381
|
-
...stage
|
|
382
|
-
}
|
|
383
|
-
) }, stage.__temp_key__);
|
|
384
|
-
})
|
|
385
|
-
}
|
|
386
|
-
)
|
|
318
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, position: "relative", tag: "ol", children: stages.map((stage, index2) => {
|
|
319
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
320
|
+
Stage,
|
|
321
|
+
{
|
|
322
|
+
index: index2,
|
|
323
|
+
canDelete: stages.length > 1 && canDelete,
|
|
324
|
+
canReorder: stages.length > 1,
|
|
325
|
+
canUpdate,
|
|
326
|
+
stagesCount: stages.length,
|
|
327
|
+
defaultOpen: isCreating,
|
|
328
|
+
...stage
|
|
329
|
+
}
|
|
330
|
+
) }, stage.__temp_key__);
|
|
331
|
+
}) })
|
|
387
332
|
] }),
|
|
388
333
|
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
389
334
|
AddStage,
|
|
@@ -401,7 +346,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
401
346
|
)
|
|
402
347
|
] });
|
|
403
348
|
};
|
|
404
|
-
const Background =
|
|
349
|
+
const Background = styledComponents.styled(designSystem.Box)`
|
|
405
350
|
transform: translateX(-50%);
|
|
406
351
|
`;
|
|
407
352
|
const Stage = ({
|
|
@@ -409,16 +354,15 @@ const Stage = ({
|
|
|
409
354
|
canDelete = false,
|
|
410
355
|
canReorder = false,
|
|
411
356
|
canUpdate = false,
|
|
412
|
-
isOpen: isOpenDefault = false,
|
|
413
357
|
stagesCount,
|
|
414
358
|
name,
|
|
415
359
|
permissions,
|
|
416
|
-
color
|
|
360
|
+
color,
|
|
361
|
+
defaultOpen
|
|
417
362
|
}) => {
|
|
418
363
|
const [liveText, setLiveText] = React__namespace.useState();
|
|
419
364
|
const { formatMessage } = reactIntl.useIntl();
|
|
420
365
|
const { trackUsage } = strapiAdmin.useTracking();
|
|
421
|
-
const [isOpen, setIsOpen] = React__namespace.useState(isOpenDefault);
|
|
422
366
|
const stageErrors = strapiAdmin.useForm("Stages", (state) => state.errors.stages);
|
|
423
367
|
const error = stageErrors?.[index2];
|
|
424
368
|
const addFieldRow = strapiAdmin.useForm("Stage", (state) => state.addFieldRow);
|
|
@@ -500,7 +444,8 @@ const Stage = ({
|
|
|
500
444
|
const handleCloneClick = () => {
|
|
501
445
|
addFieldRow("stages", { name, color, permissions });
|
|
502
446
|
};
|
|
503
|
-
|
|
447
|
+
const id = React__namespace.useId();
|
|
448
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
504
449
|
liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
505
450
|
isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
506
451
|
designSystem.Box,
|
|
@@ -511,74 +456,61 @@ const Stage = ({
|
|
|
511
456
|
borderWidth: "1px",
|
|
512
457
|
display: "block",
|
|
513
458
|
hasRadius: true,
|
|
514
|
-
padding: 6
|
|
515
|
-
shadow: "tableShadow"
|
|
459
|
+
padding: 6
|
|
516
460
|
}
|
|
517
|
-
) : /* @__PURE__ */ jsxRuntime.
|
|
518
|
-
|
|
461
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
462
|
+
AccordionRoot,
|
|
519
463
|
{
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
onToggle: () => {
|
|
523
|
-
setIsOpen(!isOpen);
|
|
524
|
-
if (!isOpen) {
|
|
464
|
+
onValueChange: (value) => {
|
|
465
|
+
if (value) {
|
|
525
466
|
trackUsage("willEditStage");
|
|
526
467
|
}
|
|
527
468
|
},
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
|
|
542
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { as: "span", children: formatMessage({
|
|
543
|
-
id: "[tbdb].components.DynamicZone.more-actions",
|
|
544
|
-
defaultMessage: "More actions"
|
|
545
|
-
}) })
|
|
546
|
-
] }),
|
|
547
|
-
/* @__PURE__ */ jsxRuntime.jsx(v2.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.SubRoot, { children: [
|
|
548
|
-
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(v2.MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
549
|
-
id: "Settings.review-workflows.stage.delete",
|
|
550
|
-
defaultMessage: "Duplicate stage"
|
|
551
|
-
}) }),
|
|
552
|
-
canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
|
|
553
|
-
id: "Settings.review-workflows.stage.delete",
|
|
554
|
-
defaultMessage: "Delete"
|
|
555
|
-
}) })
|
|
556
|
-
] }) })
|
|
469
|
+
defaultValue: defaultOpen ? id : void 0,
|
|
470
|
+
$error: Object.values(error ?? {}).length > 0,
|
|
471
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: id, children: [
|
|
472
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
|
|
473
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: name }),
|
|
474
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Actions, { children: canDelete || canUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
475
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
476
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
|
477
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
|
|
478
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "span", children: formatMessage({
|
|
479
|
+
id: "[tbdb].components.DynamicZone.more-actions",
|
|
480
|
+
defaultMessage: "More actions"
|
|
481
|
+
}) })
|
|
557
482
|
] }),
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
483
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.SubRoot, { children: [
|
|
484
|
+
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
485
|
+
id: "Settings.review-workflows.stage.delete",
|
|
486
|
+
defaultMessage: "Duplicate stage"
|
|
487
|
+
}) }),
|
|
488
|
+
canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
|
|
489
|
+
id: "Settings.review-workflows.stage.delete",
|
|
490
|
+
defaultMessage: "Delete"
|
|
491
|
+
}) })
|
|
492
|
+
] }) })
|
|
493
|
+
] }),
|
|
494
|
+
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
495
|
+
designSystem.IconButton,
|
|
496
|
+
{
|
|
497
|
+
background: "transparent",
|
|
498
|
+
hasRadius: true,
|
|
499
|
+
variant: "ghost",
|
|
500
|
+
"data-handler-id": handlerId,
|
|
501
|
+
ref: dragRef,
|
|
502
|
+
label: formatMessage({
|
|
503
|
+
id: "Settings.review-workflows.stage.drag",
|
|
504
|
+
defaultMessage: "Drag"
|
|
505
|
+
}),
|
|
506
|
+
onClick: (e) => e.stopPropagation(),
|
|
507
|
+
onKeyDown: handleKeyDown,
|
|
508
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, {})
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
] }) : null })
|
|
512
|
+
] }),
|
|
513
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, padding: 6, children: [
|
|
582
514
|
{
|
|
583
515
|
disabled: !canUpdate,
|
|
584
516
|
label: formatMessage({
|
|
@@ -616,16 +548,20 @@ const Stage = ({
|
|
|
616
548
|
size: 6,
|
|
617
549
|
type: "permissions"
|
|
618
550
|
}
|
|
619
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
620
|
-
]
|
|
551
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
552
|
+
] })
|
|
621
553
|
}
|
|
622
554
|
)
|
|
623
555
|
] });
|
|
624
556
|
};
|
|
625
|
-
const
|
|
557
|
+
const AccordionRoot = styledComponents.styled(designSystem.Accordion.Root)`
|
|
558
|
+
border: 1px solid
|
|
559
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
|
560
|
+
`;
|
|
561
|
+
const DeleteMenuItem = styledComponents.styled(designSystem.MenuItem)`
|
|
626
562
|
color: ${({ theme }) => theme.colors.danger600};
|
|
627
563
|
`;
|
|
628
|
-
const ContextMenuTrigger =
|
|
564
|
+
const ContextMenuTrigger = styledComponents.styled(designSystem.Menu.Trigger)`
|
|
629
565
|
:hover,
|
|
630
566
|
:focus {
|
|
631
567
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
@@ -635,22 +571,6 @@ const ContextMenuTrigger = styled__default.default(v2.Menu.Trigger)`
|
|
|
635
571
|
font-size: 0;
|
|
636
572
|
}
|
|
637
573
|
`;
|
|
638
|
-
const DragIconButton = styled__default.default(designSystem.IconButton)`
|
|
639
|
-
align-items: center;
|
|
640
|
-
border-radius: ${({ theme }) => theme.borderRadius};
|
|
641
|
-
display: flex;
|
|
642
|
-
justify-content: center;
|
|
643
|
-
|
|
644
|
-
&:hover,
|
|
645
|
-
&:focus {
|
|
646
|
-
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
svg {
|
|
650
|
-
height: auto;
|
|
651
|
-
width: ${({ theme }) => theme.spaces[3]};
|
|
652
|
-
}
|
|
653
|
-
`;
|
|
654
574
|
const InputRenderer = (props) => {
|
|
655
575
|
switch (props.type) {
|
|
656
576
|
case "color":
|
|
@@ -676,54 +596,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
|
|
|
676
596
|
color: hex
|
|
677
597
|
}));
|
|
678
598
|
const { themeColorName } = index.getStageColorByHex(value) ?? {};
|
|
679
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
680
|
-
designSystem.
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
designSystem.Flex,
|
|
692
|
-
{
|
|
693
|
-
as: "span",
|
|
694
|
-
height: 2,
|
|
695
|
-
background: value,
|
|
696
|
-
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
697
|
-
hasRadius: true,
|
|
698
|
-
shrink: 0,
|
|
699
|
-
width: 2
|
|
700
|
-
}
|
|
701
|
-
),
|
|
702
|
-
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
703
|
-
const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
|
|
704
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
705
|
-
designSystem.SingleSelectOption,
|
|
599
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required, children: [
|
|
600
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
602
|
+
designSystem.SingleSelect,
|
|
603
|
+
{
|
|
604
|
+
disabled,
|
|
605
|
+
onChange: (v) => {
|
|
606
|
+
onChange(name, v.toString());
|
|
607
|
+
},
|
|
608
|
+
value: value?.toUpperCase(),
|
|
609
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
610
|
+
designSystem.Flex,
|
|
706
611
|
{
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
612
|
+
tag: "span",
|
|
613
|
+
height: 2,
|
|
614
|
+
background: value,
|
|
615
|
+
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
616
|
+
hasRadius: true,
|
|
617
|
+
shrink: 0,
|
|
618
|
+
width: 2
|
|
619
|
+
}
|
|
620
|
+
),
|
|
621
|
+
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
622
|
+
const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
|
|
623
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
624
|
+
designSystem.SingleSelectOption,
|
|
625
|
+
{
|
|
626
|
+
value: value2,
|
|
627
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
628
|
+
designSystem.Flex,
|
|
629
|
+
{
|
|
630
|
+
tag: "span",
|
|
631
|
+
height: 2,
|
|
632
|
+
background: color,
|
|
633
|
+
borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
|
|
634
|
+
hasRadius: true,
|
|
635
|
+
shrink: 0,
|
|
636
|
+
width: 2
|
|
637
|
+
}
|
|
638
|
+
),
|
|
639
|
+
children: label2
|
|
640
|
+
},
|
|
641
|
+
value2
|
|
642
|
+
);
|
|
643
|
+
})
|
|
644
|
+
}
|
|
645
|
+
),
|
|
646
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
647
|
+
] });
|
|
727
648
|
};
|
|
728
649
|
const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
729
650
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -732,57 +653,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
732
653
|
const { value = [], error, onChange } = strapiAdmin.useField(name);
|
|
733
654
|
const allStages = strapiAdmin.useForm("PermissionsField", (state) => state.values.stages);
|
|
734
655
|
const onFormValueChange = strapiAdmin.useForm("PermissionsField", (state) => state.onChange);
|
|
735
|
-
const
|
|
656
|
+
const rolesErrorCount = React__namespace.useRef(0);
|
|
657
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
736
658
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
737
659
|
React__namespace.useEffect(() => {
|
|
738
|
-
if (!isLoading &&
|
|
660
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
661
|
+
rolesErrorCount.current = 1;
|
|
739
662
|
toggleNotification({
|
|
740
663
|
blockTransition: true,
|
|
741
664
|
type: "danger",
|
|
742
665
|
message: formatMessage({
|
|
743
666
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
744
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
667
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
745
668
|
})
|
|
746
669
|
});
|
|
747
670
|
}
|
|
748
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
671
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
749
672
|
if (!isLoading && filteredRoles.length === 0) {
|
|
750
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
751
|
-
designSystem.
|
|
673
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
674
|
+
designSystem.Field.Root,
|
|
752
675
|
{
|
|
753
|
-
disabled: true,
|
|
754
676
|
name,
|
|
755
677
|
hint: formatMessage({
|
|
756
678
|
id: "Settings.review-workflows.stage.permissions.noPermissions.description",
|
|
757
679
|
defaultMessage: "You don’t have the permission to see roles"
|
|
758
680
|
}),
|
|
759
|
-
label: formatMessage({
|
|
760
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
761
|
-
defaultMessage: "Roles that can change this stage"
|
|
762
|
-
}),
|
|
763
|
-
placeholder: formatMessage({
|
|
764
|
-
id: "components.NotAllowedInput.text",
|
|
765
|
-
defaultMessage: "No permissions to see this field"
|
|
766
|
-
}),
|
|
767
681
|
required,
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
682
|
+
children: [
|
|
683
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
684
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
685
|
+
defaultMessage: "Roles that can change this stage"
|
|
686
|
+
}) }),
|
|
687
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
688
|
+
designSystem.TextInput,
|
|
689
|
+
{
|
|
690
|
+
disabled: true,
|
|
691
|
+
placeholder: formatMessage({
|
|
692
|
+
id: "components.NotAllowedInput.text",
|
|
693
|
+
defaultMessage: "No permissions to see this field"
|
|
694
|
+
}),
|
|
695
|
+
startAction: /* @__PURE__ */ jsxRuntime.jsx(icons.EyeStriked, { fill: "neutral600" }),
|
|
696
|
+
type: "text",
|
|
697
|
+
value: ""
|
|
698
|
+
}
|
|
699
|
+
),
|
|
700
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
701
|
+
]
|
|
771
702
|
}
|
|
772
703
|
);
|
|
773
704
|
}
|
|
774
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
775
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
776
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
705
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-end", gap: 3, children: [
|
|
706
|
+
/* @__PURE__ */ jsxRuntime.jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required: true, children: [
|
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
708
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
709
|
+
defaultMessage: "Roles that can change this stage"
|
|
710
|
+
}) }),
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
777
712
|
designSystem.MultiSelect,
|
|
778
713
|
{
|
|
779
714
|
disabled,
|
|
780
|
-
error,
|
|
781
|
-
id: name,
|
|
782
|
-
label: formatMessage({
|
|
783
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
784
|
-
defaultMessage: "Roles that can change this stage"
|
|
785
|
-
}),
|
|
786
715
|
onChange: (values) => {
|
|
787
716
|
const permissions = values.map((value2) => ({
|
|
788
717
|
role: parseInt(value2, 10),
|
|
@@ -791,7 +720,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
791
720
|
onChange(name, permissions);
|
|
792
721
|
},
|
|
793
722
|
placeholder,
|
|
794
|
-
required: true,
|
|
795
723
|
value: value.map((permission) => `${permission.role}`),
|
|
796
724
|
withTags: true,
|
|
797
725
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -808,70 +736,64 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
808
736
|
}
|
|
809
737
|
)
|
|
810
738
|
}
|
|
811
|
-
)
|
|
812
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
739
|
+
),
|
|
740
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
741
|
+
] }) }),
|
|
742
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { open: isApplyAllConfirmationOpen, onOpenChange: setIsApplyAllConfirmationOpen, children: [
|
|
743
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
813
744
|
designSystem.IconButton,
|
|
814
745
|
{
|
|
815
746
|
disabled,
|
|
816
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {}),
|
|
817
747
|
label: formatMessage({
|
|
818
748
|
id: "Settings.review-workflows.stage.permissions.apply.label",
|
|
819
749
|
defaultMessage: "Apply to all stages"
|
|
820
750
|
}),
|
|
821
751
|
size: "L",
|
|
822
|
-
|
|
823
|
-
|
|
752
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
|
|
753
|
+
}
|
|
754
|
+
) }),
|
|
755
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
756
|
+
strapiAdmin.ConfirmDialog,
|
|
757
|
+
{
|
|
758
|
+
onConfirm: () => {
|
|
759
|
+
onFormValueChange(
|
|
760
|
+
"stages",
|
|
761
|
+
allStages.map((stage) => ({
|
|
762
|
+
...stage,
|
|
763
|
+
permissions: value
|
|
764
|
+
}))
|
|
765
|
+
);
|
|
766
|
+
setIsApplyAllConfirmationOpen(false);
|
|
767
|
+
toggleNotification({
|
|
768
|
+
type: "success",
|
|
769
|
+
message: formatMessage({
|
|
770
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
771
|
+
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
772
|
+
})
|
|
773
|
+
});
|
|
774
|
+
},
|
|
775
|
+
variant: "default",
|
|
776
|
+
children: formatMessage({
|
|
777
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
778
|
+
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
779
|
+
})
|
|
824
780
|
}
|
|
825
781
|
)
|
|
826
|
-
] })
|
|
827
|
-
|
|
828
|
-
strapiAdmin.ConfirmDialog,
|
|
829
|
-
{
|
|
830
|
-
isOpen: isApplyAllConfirmationOpen,
|
|
831
|
-
onClose: () => setIsApplyAllConfirmationOpen(false),
|
|
832
|
-
onConfirm: () => {
|
|
833
|
-
onFormValueChange(
|
|
834
|
-
"stages",
|
|
835
|
-
allStages.map((stage) => ({
|
|
836
|
-
...stage,
|
|
837
|
-
permissions: value
|
|
838
|
-
}))
|
|
839
|
-
);
|
|
840
|
-
setIsApplyAllConfirmationOpen(false);
|
|
841
|
-
toggleNotification({
|
|
842
|
-
type: "success",
|
|
843
|
-
message: formatMessage({
|
|
844
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
845
|
-
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
846
|
-
})
|
|
847
|
-
});
|
|
848
|
-
},
|
|
849
|
-
variant: "default",
|
|
850
|
-
children: formatMessage({
|
|
851
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
852
|
-
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
853
|
-
})
|
|
854
|
-
}
|
|
855
|
-
)
|
|
856
|
-
] });
|
|
782
|
+
] })
|
|
783
|
+
] }) });
|
|
857
784
|
};
|
|
858
|
-
const
|
|
859
|
-
& > path {
|
|
860
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
861
|
-
}
|
|
862
|
-
`;
|
|
863
|
-
const NestedOption$1 = styled__default.default(designSystem.MultiSelectOption)`
|
|
785
|
+
const NestedOption$1 = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
864
786
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
865
787
|
`;
|
|
866
|
-
const PermissionWrapper =
|
|
788
|
+
const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
|
|
867
789
|
> * {
|
|
868
790
|
flex-grow: 1;
|
|
869
791
|
}
|
|
870
792
|
`;
|
|
871
793
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
872
794
|
const { formatMessage } = reactIntl.useIntl();
|
|
873
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
874
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
795
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
796
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
875
797
|
strapiAdmin.InputRenderer,
|
|
876
798
|
{
|
|
877
799
|
disabled: !canUpdate,
|
|
@@ -884,7 +806,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
884
806
|
type: "string"
|
|
885
807
|
}
|
|
886
808
|
) }),
|
|
887
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
809
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
888
810
|
] });
|
|
889
811
|
};
|
|
890
812
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -905,86 +827,87 @@ const ContentTypesSelector = ({ disabled }) => {
|
|
|
905
827
|
label: contentType.info.displayName,
|
|
906
828
|
value: contentType.uid
|
|
907
829
|
}));
|
|
908
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
909
|
-
designSystem.
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
),
|
|
918
|
-
disabled: isDisabled,
|
|
919
|
-
error,
|
|
920
|
-
label: formatMessage({
|
|
921
|
-
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
922
|
-
defaultMessage: "Associated to"
|
|
923
|
-
}),
|
|
924
|
-
onChange: (values) => {
|
|
925
|
-
onChange("contentTypes", values);
|
|
926
|
-
},
|
|
927
|
-
value,
|
|
928
|
-
placeholder: formatMessage({
|
|
929
|
-
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
930
|
-
defaultMessage: "Select"
|
|
931
|
-
}),
|
|
932
|
-
children: [
|
|
933
|
-
...collectionTypes.length > 0 ? [
|
|
934
|
-
{
|
|
935
|
-
label: formatMessage({
|
|
936
|
-
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
937
|
-
defaultMessage: "Collection Types"
|
|
938
|
-
}),
|
|
939
|
-
children: collectionTypes
|
|
940
|
-
}
|
|
941
|
-
] : [],
|
|
942
|
-
...singleTypes.length > 0 ? [
|
|
943
|
-
{
|
|
944
|
-
label: formatMessage({
|
|
945
|
-
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
946
|
-
defaultMessage: "Single Types"
|
|
947
|
-
}),
|
|
948
|
-
children: singleTypes
|
|
949
|
-
}
|
|
950
|
-
] : []
|
|
951
|
-
].map((opt) => {
|
|
952
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
953
|
-
designSystem.MultiSelectGroup,
|
|
830
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name: "contentTypes", children: [
|
|
831
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
832
|
+
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
833
|
+
defaultMessage: "Associated to"
|
|
834
|
+
}) }),
|
|
835
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
836
|
+
designSystem.MultiSelect,
|
|
837
|
+
{
|
|
838
|
+
customizeContent: (value2) => formatMessage(
|
|
954
839
|
{
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
children: opt.children.map((child) => {
|
|
958
|
-
const { name: assignedWorkflowName } = workflows?.find(
|
|
959
|
-
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
960
|
-
) ?? {};
|
|
961
|
-
return /* @__PURE__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
962
|
-
// @ts-expect-error - formatMessage options doesn't expect to be a React component but that's what we need actually for the <i> and <em> components
|
|
963
|
-
children: formatMessage(
|
|
964
|
-
{
|
|
965
|
-
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
966
|
-
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
967
|
-
},
|
|
968
|
-
{
|
|
969
|
-
label: child.label,
|
|
970
|
-
name: assignedWorkflowName,
|
|
971
|
-
em: (...children) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "em", fontWeight: "bold", children }),
|
|
972
|
-
i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
|
|
973
|
-
}
|
|
974
|
-
)
|
|
975
|
-
}) }, child.value);
|
|
976
|
-
})
|
|
840
|
+
id: "Settings.review-workflows.workflow.contentTypes.displayValue",
|
|
841
|
+
defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
|
|
977
842
|
},
|
|
978
|
-
|
|
979
|
-
)
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
843
|
+
{ count: value2?.length }
|
|
844
|
+
),
|
|
845
|
+
disabled: isDisabled,
|
|
846
|
+
onChange: (values) => {
|
|
847
|
+
onChange("contentTypes", values);
|
|
848
|
+
},
|
|
849
|
+
value,
|
|
850
|
+
placeholder: formatMessage({
|
|
851
|
+
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
852
|
+
defaultMessage: "Select"
|
|
853
|
+
}),
|
|
854
|
+
children: [
|
|
855
|
+
...collectionTypes.length > 0 ? [
|
|
856
|
+
{
|
|
857
|
+
label: formatMessage({
|
|
858
|
+
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
859
|
+
defaultMessage: "Collection Types"
|
|
860
|
+
}),
|
|
861
|
+
children: collectionTypes
|
|
862
|
+
}
|
|
863
|
+
] : [],
|
|
864
|
+
...singleTypes.length > 0 ? [
|
|
865
|
+
{
|
|
866
|
+
label: formatMessage({
|
|
867
|
+
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
868
|
+
defaultMessage: "Single Types"
|
|
869
|
+
}),
|
|
870
|
+
children: singleTypes
|
|
871
|
+
}
|
|
872
|
+
] : []
|
|
873
|
+
].map((opt) => {
|
|
874
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
875
|
+
designSystem.MultiSelectGroup,
|
|
876
|
+
{
|
|
877
|
+
label: opt.label,
|
|
878
|
+
values: opt.children.map((child) => child.value.toString()),
|
|
879
|
+
children: opt.children.map((child) => {
|
|
880
|
+
const { name: assignedWorkflowName } = workflows?.find(
|
|
881
|
+
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
882
|
+
) ?? {};
|
|
883
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
884
|
+
// @ts-expect-error - formatMessage options doesn't expect to be a React component but that's what we need actually for the <i> and <em> components
|
|
885
|
+
children: formatMessage(
|
|
886
|
+
{
|
|
887
|
+
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
888
|
+
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
label: child.label,
|
|
892
|
+
name: assignedWorkflowName,
|
|
893
|
+
em: (...children) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "em", fontWeight: "bold", children }),
|
|
894
|
+
i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
|
|
895
|
+
}
|
|
896
|
+
)
|
|
897
|
+
}) }, child.value);
|
|
898
|
+
})
|
|
899
|
+
},
|
|
900
|
+
opt.label
|
|
901
|
+
);
|
|
902
|
+
})
|
|
903
|
+
}
|
|
904
|
+
)
|
|
905
|
+
] });
|
|
983
906
|
};
|
|
984
|
-
const NestedOption =
|
|
907
|
+
const NestedOption = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
985
908
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
986
909
|
`;
|
|
987
|
-
const ContentTypeTakeNotice =
|
|
910
|
+
const ContentTypeTakeNotice = styledComponents.styled(designSystem.Typography)`
|
|
988
911
|
font-style: italic;
|
|
989
912
|
`;
|
|
990
913
|
const WORKFLOW_SCHEMA = yup__namespace.object({
|
|
@@ -1038,7 +961,6 @@ const EditPage = () => {
|
|
|
1038
961
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
|
1039
962
|
const navigate = reactRouterDom.useNavigate();
|
|
1040
963
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1041
|
-
const dispatch = reactRedux.useDispatch();
|
|
1042
964
|
const {
|
|
1043
965
|
isLoading: isLoadingWorkflow,
|
|
1044
966
|
meta,
|
|
@@ -1046,7 +968,7 @@ const EditPage = () => {
|
|
|
1046
968
|
error,
|
|
1047
969
|
update,
|
|
1048
970
|
create
|
|
1049
|
-
} = Layout.useReviewWorkflows(
|
|
971
|
+
} = Layout.useReviewWorkflows();
|
|
1050
972
|
const permissions = index.useTypedSelector(
|
|
1051
973
|
(state) => state.admin_app.permissions["settings"]?.["review-workflows"]
|
|
1052
974
|
);
|
|
@@ -1089,36 +1011,13 @@ const EditPage = () => {
|
|
|
1089
1011
|
});
|
|
1090
1012
|
if ("error" in res && index.isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1091
1013
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1092
|
-
} else if ("data" in res) {
|
|
1093
|
-
for (const uid of res.data.contentTypes) {
|
|
1094
|
-
dispatch({
|
|
1095
|
-
type: "contentManagerApi/invalidateTags",
|
|
1096
|
-
payload: [
|
|
1097
|
-
{
|
|
1098
|
-
type: "ContentTypesConfiguration",
|
|
1099
|
-
id: uid
|
|
1100
|
-
}
|
|
1101
|
-
]
|
|
1102
|
-
});
|
|
1103
|
-
}
|
|
1104
1014
|
}
|
|
1105
1015
|
} else {
|
|
1106
1016
|
const res = await create(data);
|
|
1107
1017
|
if ("error" in res && index.isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
|
1108
1018
|
helpers.setErrors(formatValidationErrors(res.error));
|
|
1109
1019
|
} else if ("data" in res) {
|
|
1110
|
-
|
|
1111
|
-
dispatch({
|
|
1112
|
-
type: "contentManagerApi/invalidateTags",
|
|
1113
|
-
payload: [
|
|
1114
|
-
{
|
|
1115
|
-
type: "ContentTypesConfiguration",
|
|
1116
|
-
id: uid
|
|
1117
|
-
}
|
|
1118
|
-
]
|
|
1119
|
-
});
|
|
1120
|
-
}
|
|
1121
|
-
navigate(`../${res.data.id}`);
|
|
1020
|
+
navigate(`../${res.data.id}`, { replace: true });
|
|
1122
1021
|
}
|
|
1123
1022
|
}
|
|
1124
1023
|
} catch (error2) {
|
|
@@ -1240,23 +1139,22 @@ const EditPage = () => {
|
|
|
1240
1139
|
}
|
|
1241
1140
|
),
|
|
1242
1141
|
/* @__PURE__ */ jsxRuntime.jsx(Layout.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1243
|
-
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate }),
|
|
1142
|
+
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1244
1143
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1245
1144
|
Stages,
|
|
1246
1145
|
{
|
|
1247
1146
|
canDelete,
|
|
1248
|
-
canUpdate,
|
|
1147
|
+
canUpdate: canUpdate || canCreate,
|
|
1249
1148
|
isCreating: isCreatingWorkflow
|
|
1250
1149
|
}
|
|
1251
1150
|
)
|
|
1252
1151
|
] }) }),
|
|
1253
1152
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1254
|
-
|
|
1153
|
+
designSystem.Dialog.Root,
|
|
1255
1154
|
{
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
|
|
1259
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1155
|
+
open: Object.keys(savePrompts).length > 0,
|
|
1156
|
+
onOpenChange: handleConfirmClose,
|
|
1157
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1260
1158
|
savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", variant: "omega", children: formatMessage({
|
|
1261
1159
|
id: "review-workflows.page.delete.confirm.stages.body",
|
|
1262
1160
|
defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
|
|
@@ -1268,7 +1166,7 @@ const EditPage = () => {
|
|
|
1268
1166
|
},
|
|
1269
1167
|
{
|
|
1270
1168
|
count: contentTypesFromOtherWorkflows?.filter(
|
|
1271
|
-
(contentType) =>
|
|
1169
|
+
(contentType) => values.contentTypes.includes(contentType)
|
|
1272
1170
|
).length ?? 0
|
|
1273
1171
|
}
|
|
1274
1172
|
) }),
|
|
@@ -1276,7 +1174,7 @@ const EditPage = () => {
|
|
|
1276
1174
|
id: "review-workflows.page.delete.confirm.confirm",
|
|
1277
1175
|
defaultMessage: "Are you sure you want to save?"
|
|
1278
1176
|
}) })
|
|
1279
|
-
] })
|
|
1177
|
+
] }) })
|
|
1280
1178
|
}
|
|
1281
1179
|
)
|
|
1282
1180
|
] })
|
|
@@ -1285,8 +1183,8 @@ const EditPage = () => {
|
|
|
1285
1183
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1286
1184
|
index.LimitsModal.Root,
|
|
1287
1185
|
{
|
|
1288
|
-
|
|
1289
|
-
|
|
1186
|
+
open: showLimitModal === "workflow",
|
|
1187
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1290
1188
|
children: [
|
|
1291
1189
|
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1292
1190
|
id: "review-workflows.edit.page.workflows.limit.title",
|
|
@@ -1299,16 +1197,23 @@ const EditPage = () => {
|
|
|
1299
1197
|
]
|
|
1300
1198
|
}
|
|
1301
1199
|
),
|
|
1302
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1200
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1201
|
+
index.LimitsModal.Root,
|
|
1202
|
+
{
|
|
1203
|
+
open: showLimitModal === "stage",
|
|
1204
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1205
|
+
children: [
|
|
1206
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1207
|
+
id: "review-workflows.edit.page.stages.limit.title",
|
|
1208
|
+
defaultMessage: "You have reached the limit of stages for this workflow in your plan"
|
|
1209
|
+
}) }),
|
|
1210
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Body, { children: formatMessage({
|
|
1211
|
+
id: "review-workflows.edit.page.stages.limit.body",
|
|
1212
|
+
defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
|
|
1213
|
+
}) })
|
|
1214
|
+
]
|
|
1215
|
+
}
|
|
1216
|
+
)
|
|
1312
1217
|
] });
|
|
1313
1218
|
};
|
|
1314
1219
|
const addTmpKeysToStages = (data) => {
|
|
@@ -1330,4 +1235,4 @@ const ProtectedEditPage = () => {
|
|
|
1330
1235
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
|
|
1331
1236
|
};
|
|
1332
1237
|
exports.ProtectedEditPage = ProtectedEditPage;
|
|
1333
|
-
//# sourceMappingURL=_id-
|
|
1238
|
+
//# sourceMappingURL=_id-C7pCAzXV.js.map
|