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