@strapi/review-workflows 0.0.0-experimental.defd8568ae03ef8d52f86e1f3541979f953c3941 → 0.0.0-experimental.edc24aaa3bb5a90fa5fd4fee208167dd4e2e38d4
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-D3DDQmMI.js} +6 -14
- package/dist/_chunks/Layout-D3DDQmMI.js.map +1 -0
- package/dist/_chunks/{Layout-B_cKmQA3.mjs → Layout-Da8jupiA.mjs} +8 -14
- package/dist/_chunks/Layout-Da8jupiA.mjs.map +1 -0
- package/dist/_chunks/{_id-BeUU-t6D.js → _id-CnRDP3Xx.js} +319 -387
- package/dist/_chunks/_id-CnRDP3Xx.js.map +1 -0
- package/dist/_chunks/{_id-C_HRFhcV.mjs → _id-xSrgPSJs.mjs} +313 -379
- package/dist/_chunks/_id-xSrgPSJs.mjs.map +1 -0
- package/dist/_chunks/{index-DyJcIA81.js → index-4kp4AkBB.js} +23 -37
- package/dist/_chunks/index-4kp4AkBB.js.map +1 -0
- package/dist/_chunks/{index-DjHtLGgq.mjs → index-DDsJlZQw.mjs} +114 -163
- package/dist/_chunks/index-DDsJlZQw.mjs.map +1 -0
- package/dist/_chunks/{index-D3AvHSbj.js → index-DhPxWpsW.js} +112 -163
- package/dist/_chunks/index-DhPxWpsW.js.map +1 -0
- package/dist/_chunks/{index-CAgnun9R.mjs → index-jfO5GxtW.mjs} +23 -35
- package/dist/_chunks/index-jfO5GxtW.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-DOEULOpS.mjs} +3 -3
- package/dist/_chunks/{router-zN3-SLwz.mjs.map → router-DOEULOpS.mjs.map} +1 -1
- package/dist/_chunks/{router-BwVSq4yF.js → router-DSXpeew4.js} +3 -3
- package/dist/_chunks/{router-BwVSq4yF.js.map → router-DSXpeew4.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 +4 -4
- package/dist/admin/src/utils/api.d.ts +4 -19
- package/dist/admin/src/utils/cm-hooks.d.ts +1 -1
- package/package.json +14 -15
- 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
|
@@ -11,12 +11,11 @@ const reactIntl = require("react-intl");
|
|
|
11
11
|
const reactRedux = require("react-redux");
|
|
12
12
|
const reactRouterDom = require("react-router-dom");
|
|
13
13
|
const yup = require("yup");
|
|
14
|
-
const index = require("./index-
|
|
15
|
-
const Layout = require("./Layout-
|
|
14
|
+
const index = require("./index-DhPxWpsW.js");
|
|
15
|
+
const Layout = require("./Layout-D3DDQmMI.js");
|
|
16
16
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
17
|
-
const
|
|
17
|
+
const styledComponents = require("styled-components");
|
|
18
18
|
const reactDnd = require("react-dnd");
|
|
19
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
20
19
|
function _interopNamespace(e) {
|
|
21
20
|
if (e && e.__esModule)
|
|
22
21
|
return e;
|
|
@@ -37,11 +36,10 @@ function _interopNamespace(e) {
|
|
|
37
36
|
}
|
|
38
37
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
39
38
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
40
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
41
39
|
const adminApi = index.reviewWorkflowsApi.injectEndpoints({
|
|
42
40
|
endpoints(builder) {
|
|
43
41
|
return {
|
|
44
|
-
|
|
42
|
+
getAdminRoles: builder.query({
|
|
45
43
|
query: () => ({
|
|
46
44
|
url: `/admin/roles`,
|
|
47
45
|
method: "GET"
|
|
@@ -53,7 +51,7 @@ const adminApi = index.reviewWorkflowsApi.injectEndpoints({
|
|
|
53
51
|
};
|
|
54
52
|
}
|
|
55
53
|
});
|
|
56
|
-
const {
|
|
54
|
+
const { useGetAdminRolesQuery } = adminApi;
|
|
57
55
|
const useKeyboardDragAndDrop = (active, index2, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
|
|
58
56
|
const [isSelected, setIsSelected] = React__namespace.useState(false);
|
|
59
57
|
const handleMove = (movement) => {
|
|
@@ -272,74 +270,35 @@ const AddStage = ({ children, ...props }) => {
|
|
|
272
270
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
273
271
|
StyledButton,
|
|
274
272
|
{
|
|
275
|
-
|
|
273
|
+
tag: "button",
|
|
276
274
|
background: "neutral0",
|
|
277
|
-
|
|
275
|
+
borderColor: "neutral150",
|
|
278
276
|
paddingBottom: 3,
|
|
279
277
|
paddingLeft: 4,
|
|
280
278
|
paddingRight: 4,
|
|
281
279
|
paddingTop: 3,
|
|
282
280
|
shadow: "filterShadow",
|
|
283
281
|
...props,
|
|
284
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
285
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
286
|
-
|
|
287
|
-
] })
|
|
282
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "span", gap: 2, children: [
|
|
283
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
|
|
284
|
+
children
|
|
285
|
+
] }) })
|
|
288
286
|
}
|
|
289
287
|
);
|
|
290
288
|
};
|
|
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)`
|
|
289
|
+
const StyledButton = styledComponents.styled(designSystem.Box)`
|
|
300
290
|
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
|
-
}
|
|
291
|
+
color: ${({ theme }) => theme.colors.neutral500};
|
|
310
292
|
|
|
311
293
|
&: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
|
-
}
|
|
294
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
325
295
|
}
|
|
326
296
|
|
|
327
297
|
&: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
|
-
}
|
|
298
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
340
299
|
}
|
|
341
300
|
`;
|
|
342
|
-
const Stages = ({ canDelete = true, canUpdate = true, isCreating
|
|
301
|
+
const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
343
302
|
const { formatMessage } = reactIntl.useIntl();
|
|
344
303
|
const { trackUsage } = strapiAdmin.useTracking();
|
|
345
304
|
const addFieldRow = strapiAdmin.useForm("Stages", (state) => state.addFieldRow);
|
|
@@ -354,35 +313,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
354
313
|
left: "50%",
|
|
355
314
|
position: "absolute",
|
|
356
315
|
top: "0",
|
|
357
|
-
width: 2
|
|
358
|
-
zIndex: 1
|
|
316
|
+
width: 2
|
|
359
317
|
}
|
|
360
318
|
),
|
|
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
|
-
)
|
|
319
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, position: "relative", tag: "ol", children: stages.map((stage, index2) => {
|
|
320
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
321
|
+
Stage,
|
|
322
|
+
{
|
|
323
|
+
index: index2,
|
|
324
|
+
canDelete: stages.length > 1 && canDelete,
|
|
325
|
+
canReorder: stages.length > 1,
|
|
326
|
+
canUpdate,
|
|
327
|
+
stagesCount: stages.length,
|
|
328
|
+
defaultOpen: isCreating,
|
|
329
|
+
...stage
|
|
330
|
+
}
|
|
331
|
+
) }, stage.__temp_key__);
|
|
332
|
+
}) })
|
|
386
333
|
] }),
|
|
387
334
|
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
388
335
|
AddStage,
|
|
@@ -400,7 +347,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
400
347
|
)
|
|
401
348
|
] });
|
|
402
349
|
};
|
|
403
|
-
const Background =
|
|
350
|
+
const Background = styledComponents.styled(designSystem.Box)`
|
|
404
351
|
transform: translateX(-50%);
|
|
405
352
|
`;
|
|
406
353
|
const Stage = ({
|
|
@@ -408,16 +355,15 @@ const Stage = ({
|
|
|
408
355
|
canDelete = false,
|
|
409
356
|
canReorder = false,
|
|
410
357
|
canUpdate = false,
|
|
411
|
-
isOpen: isOpenDefault = false,
|
|
412
358
|
stagesCount,
|
|
413
359
|
name,
|
|
414
360
|
permissions,
|
|
415
|
-
color
|
|
361
|
+
color,
|
|
362
|
+
defaultOpen
|
|
416
363
|
}) => {
|
|
417
364
|
const [liveText, setLiveText] = React__namespace.useState();
|
|
418
365
|
const { formatMessage } = reactIntl.useIntl();
|
|
419
366
|
const { trackUsage } = strapiAdmin.useTracking();
|
|
420
|
-
const [isOpen, setIsOpen] = React__namespace.useState(isOpenDefault);
|
|
421
367
|
const stageErrors = strapiAdmin.useForm("Stages", (state) => state.errors.stages);
|
|
422
368
|
const error = stageErrors?.[index2];
|
|
423
369
|
const addFieldRow = strapiAdmin.useForm("Stage", (state) => state.addFieldRow);
|
|
@@ -499,7 +445,8 @@ const Stage = ({
|
|
|
499
445
|
const handleCloneClick = () => {
|
|
500
446
|
addFieldRow("stages", { name, color, permissions });
|
|
501
447
|
};
|
|
502
|
-
|
|
448
|
+
const id = React__namespace.useId();
|
|
449
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
503
450
|
liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
504
451
|
isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
505
452
|
designSystem.Box,
|
|
@@ -510,74 +457,61 @@ const Stage = ({
|
|
|
510
457
|
borderWidth: "1px",
|
|
511
458
|
display: "block",
|
|
512
459
|
hasRadius: true,
|
|
513
|
-
padding: 6
|
|
514
|
-
shadow: "tableShadow"
|
|
460
|
+
padding: 6
|
|
515
461
|
}
|
|
516
|
-
) : /* @__PURE__ */ jsxRuntime.
|
|
517
|
-
|
|
462
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
463
|
+
AccordionRoot,
|
|
518
464
|
{
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
onToggle: () => {
|
|
522
|
-
setIsOpen(!isOpen);
|
|
523
|
-
if (!isOpen) {
|
|
465
|
+
onValueChange: (value) => {
|
|
466
|
+
if (value) {
|
|
524
467
|
trackUsage("willEditStage");
|
|
525
468
|
}
|
|
526
469
|
},
|
|
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
|
-
] }) })
|
|
470
|
+
defaultValue: defaultOpen ? id : void 0,
|
|
471
|
+
$error: Object.values(error ?? {}).length > 0,
|
|
472
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: id, children: [
|
|
473
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Header, { children: [
|
|
474
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: name }),
|
|
475
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Actions, { children: canDelete || canUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
476
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
477
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
|
478
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.More, { "aria-hidden": true, focusable: false }),
|
|
479
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { tag: "span", children: formatMessage({
|
|
480
|
+
id: "[tbdb].components.DynamicZone.more-actions",
|
|
481
|
+
defaultMessage: "More actions"
|
|
482
|
+
}) })
|
|
556
483
|
] }),
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
484
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.SubRoot, { children: [
|
|
485
|
+
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
486
|
+
id: "Settings.review-workflows.stage.delete",
|
|
487
|
+
defaultMessage: "Duplicate stage"
|
|
488
|
+
}) }),
|
|
489
|
+
canDelete && /* @__PURE__ */ jsxRuntime.jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index2), children: formatMessage({
|
|
490
|
+
id: "Settings.review-workflows.stage.delete",
|
|
491
|
+
defaultMessage: "Delete"
|
|
492
|
+
}) })
|
|
493
|
+
] }) })
|
|
494
|
+
] }),
|
|
495
|
+
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
496
|
+
designSystem.IconButton,
|
|
497
|
+
{
|
|
498
|
+
background: "transparent",
|
|
499
|
+
hasRadius: true,
|
|
500
|
+
borderWidth: 0,
|
|
501
|
+
"data-handler-id": handlerId,
|
|
502
|
+
ref: dragRef,
|
|
503
|
+
label: formatMessage({
|
|
504
|
+
id: "Settings.review-workflows.stage.drag",
|
|
505
|
+
defaultMessage: "Drag"
|
|
506
|
+
}),
|
|
507
|
+
onClick: (e) => e.stopPropagation(),
|
|
508
|
+
onKeyDown: handleKeyDown,
|
|
509
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Drag, {})
|
|
510
|
+
}
|
|
511
|
+
)
|
|
512
|
+
] }) : null })
|
|
513
|
+
] }),
|
|
514
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, padding: 6, children: [
|
|
581
515
|
{
|
|
582
516
|
disabled: !canUpdate,
|
|
583
517
|
label: formatMessage({
|
|
@@ -615,16 +549,20 @@ const Stage = ({
|
|
|
615
549
|
size: 6,
|
|
616
550
|
type: "permissions"
|
|
617
551
|
}
|
|
618
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
619
|
-
]
|
|
552
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
553
|
+
] })
|
|
620
554
|
}
|
|
621
555
|
)
|
|
622
556
|
] });
|
|
623
557
|
};
|
|
624
|
-
const
|
|
558
|
+
const AccordionRoot = styledComponents.styled(designSystem.Accordion.Root)`
|
|
559
|
+
border: 1px solid
|
|
560
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
|
561
|
+
`;
|
|
562
|
+
const DeleteMenuItem = styledComponents.styled(designSystem.MenuItem)`
|
|
625
563
|
color: ${({ theme }) => theme.colors.danger600};
|
|
626
564
|
`;
|
|
627
|
-
const ContextMenuTrigger =
|
|
565
|
+
const ContextMenuTrigger = styledComponents.styled(designSystem.Menu.Trigger)`
|
|
628
566
|
:hover,
|
|
629
567
|
:focus {
|
|
630
568
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
@@ -634,22 +572,6 @@ const ContextMenuTrigger = styled__default.default(designSystem.Menu.Trigger)`
|
|
|
634
572
|
font-size: 0;
|
|
635
573
|
}
|
|
636
574
|
`;
|
|
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
575
|
const InputRenderer = (props) => {
|
|
654
576
|
switch (props.type) {
|
|
655
577
|
case "color":
|
|
@@ -675,54 +597,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
|
|
|
675
597
|
color: hex
|
|
676
598
|
}));
|
|
677
599
|
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,
|
|
600
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required, children: [
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
|
|
602
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
603
|
+
designSystem.SingleSelect,
|
|
604
|
+
{
|
|
605
|
+
disabled,
|
|
606
|
+
onChange: (v) => {
|
|
607
|
+
onChange(name, v.toString());
|
|
608
|
+
},
|
|
609
|
+
value: value?.toUpperCase(),
|
|
610
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
611
|
+
designSystem.Flex,
|
|
705
612
|
{
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
613
|
+
tag: "span",
|
|
614
|
+
height: 2,
|
|
615
|
+
background: value,
|
|
616
|
+
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
617
|
+
hasRadius: true,
|
|
618
|
+
shrink: 0,
|
|
619
|
+
width: 2
|
|
620
|
+
}
|
|
621
|
+
),
|
|
622
|
+
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
623
|
+
const { themeColorName: themeColorName2 } = index.getStageColorByHex(color) || {};
|
|
624
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
625
|
+
designSystem.SingleSelectOption,
|
|
626
|
+
{
|
|
627
|
+
value: value2,
|
|
628
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
629
|
+
designSystem.Flex,
|
|
630
|
+
{
|
|
631
|
+
tag: "span",
|
|
632
|
+
height: 2,
|
|
633
|
+
background: color,
|
|
634
|
+
borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
|
|
635
|
+
hasRadius: true,
|
|
636
|
+
shrink: 0,
|
|
637
|
+
width: 2
|
|
638
|
+
}
|
|
639
|
+
),
|
|
640
|
+
children: label2
|
|
641
|
+
},
|
|
642
|
+
value2
|
|
643
|
+
);
|
|
644
|
+
})
|
|
645
|
+
}
|
|
646
|
+
),
|
|
647
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
648
|
+
] });
|
|
726
649
|
};
|
|
727
650
|
const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
728
651
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -731,57 +654,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
731
654
|
const { value = [], error, onChange } = strapiAdmin.useField(name);
|
|
732
655
|
const allStages = strapiAdmin.useForm("PermissionsField", (state) => state.values.stages);
|
|
733
656
|
const onFormValueChange = strapiAdmin.useForm("PermissionsField", (state) => state.onChange);
|
|
734
|
-
const
|
|
657
|
+
const rolesErrorCount = React__namespace.useRef(0);
|
|
658
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
735
659
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
736
660
|
React__namespace.useEffect(() => {
|
|
737
|
-
if (!isLoading &&
|
|
661
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
662
|
+
rolesErrorCount.current = 1;
|
|
738
663
|
toggleNotification({
|
|
739
664
|
blockTransition: true,
|
|
740
665
|
type: "danger",
|
|
741
666
|
message: formatMessage({
|
|
742
667
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
743
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
668
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
744
669
|
})
|
|
745
670
|
});
|
|
746
671
|
}
|
|
747
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
672
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
748
673
|
if (!isLoading && filteredRoles.length === 0) {
|
|
749
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
750
|
-
designSystem.
|
|
674
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
675
|
+
designSystem.Field.Root,
|
|
751
676
|
{
|
|
752
|
-
disabled: true,
|
|
753
677
|
name,
|
|
754
678
|
hint: formatMessage({
|
|
755
679
|
id: "Settings.review-workflows.stage.permissions.noPermissions.description",
|
|
756
680
|
defaultMessage: "You don’t have the permission to see roles"
|
|
757
681
|
}),
|
|
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
682
|
required,
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
683
|
+
children: [
|
|
684
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
685
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
686
|
+
defaultMessage: "Roles that can change this stage"
|
|
687
|
+
}) }),
|
|
688
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
689
|
+
designSystem.TextInput,
|
|
690
|
+
{
|
|
691
|
+
disabled: true,
|
|
692
|
+
placeholder: formatMessage({
|
|
693
|
+
id: "components.NotAllowedInput.text",
|
|
694
|
+
defaultMessage: "No permissions to see this field"
|
|
695
|
+
}),
|
|
696
|
+
startAction: /* @__PURE__ */ jsxRuntime.jsx(icons.EyeStriked, { fill: "neutral600" }),
|
|
697
|
+
type: "text",
|
|
698
|
+
value: ""
|
|
699
|
+
}
|
|
700
|
+
),
|
|
701
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
702
|
+
]
|
|
770
703
|
}
|
|
771
704
|
);
|
|
772
705
|
}
|
|
773
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
774
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
775
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
706
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "flex-end", gap: 3, children: [
|
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name, required: true, children: [
|
|
708
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
709
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
710
|
+
defaultMessage: "Roles that can change this stage"
|
|
711
|
+
}) }),
|
|
712
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
776
713
|
designSystem.MultiSelect,
|
|
777
714
|
{
|
|
778
715
|
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
716
|
onChange: (values) => {
|
|
786
717
|
const permissions = values.map((value2) => ({
|
|
787
718
|
role: parseInt(value2, 10),
|
|
@@ -790,7 +721,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
790
721
|
onChange(name, permissions);
|
|
791
722
|
},
|
|
792
723
|
placeholder,
|
|
793
|
-
required: true,
|
|
794
724
|
value: value.map((permission) => `${permission.role}`),
|
|
795
725
|
withTags: true,
|
|
796
726
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -807,70 +737,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
807
737
|
}
|
|
808
738
|
)
|
|
809
739
|
}
|
|
810
|
-
)
|
|
811
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
740
|
+
),
|
|
741
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
742
|
+
] }) }),
|
|
743
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { open: isApplyAllConfirmationOpen, onOpenChange: setIsApplyAllConfirmationOpen, children: [
|
|
744
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
812
745
|
designSystem.IconButton,
|
|
813
746
|
{
|
|
814
747
|
disabled,
|
|
815
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {}),
|
|
816
748
|
label: formatMessage({
|
|
817
749
|
id: "Settings.review-workflows.stage.permissions.apply.label",
|
|
818
750
|
defaultMessage: "Apply to all stages"
|
|
819
751
|
}),
|
|
820
752
|
size: "L",
|
|
821
753
|
variant: "secondary",
|
|
822
|
-
|
|
754
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {})
|
|
755
|
+
}
|
|
756
|
+
) }),
|
|
757
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
758
|
+
strapiAdmin.ConfirmDialog,
|
|
759
|
+
{
|
|
760
|
+
onConfirm: () => {
|
|
761
|
+
onFormValueChange(
|
|
762
|
+
"stages",
|
|
763
|
+
allStages.map((stage) => ({
|
|
764
|
+
...stage,
|
|
765
|
+
permissions: value
|
|
766
|
+
}))
|
|
767
|
+
);
|
|
768
|
+
setIsApplyAllConfirmationOpen(false);
|
|
769
|
+
toggleNotification({
|
|
770
|
+
type: "success",
|
|
771
|
+
message: formatMessage({
|
|
772
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
773
|
+
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
774
|
+
})
|
|
775
|
+
});
|
|
776
|
+
},
|
|
777
|
+
variant: "default",
|
|
778
|
+
children: formatMessage({
|
|
779
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
780
|
+
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
781
|
+
})
|
|
823
782
|
}
|
|
824
783
|
)
|
|
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
|
-
] });
|
|
784
|
+
] })
|
|
785
|
+
] }) });
|
|
856
786
|
};
|
|
857
|
-
const
|
|
858
|
-
& > path {
|
|
859
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
860
|
-
}
|
|
861
|
-
`;
|
|
862
|
-
const NestedOption$1 = styled__default.default(designSystem.MultiSelectOption)`
|
|
787
|
+
const NestedOption$1 = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
863
788
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
864
789
|
`;
|
|
865
|
-
const PermissionWrapper =
|
|
790
|
+
const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
|
|
866
791
|
> * {
|
|
867
792
|
flex-grow: 1;
|
|
868
793
|
}
|
|
869
794
|
`;
|
|
870
795
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
871
796
|
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.
|
|
797
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
798
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
874
799
|
strapiAdmin.InputRenderer,
|
|
875
800
|
{
|
|
876
801
|
disabled: !canUpdate,
|
|
@@ -883,7 +808,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
883
808
|
type: "string"
|
|
884
809
|
}
|
|
885
810
|
) }),
|
|
886
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
811
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
887
812
|
] });
|
|
888
813
|
};
|
|
889
814
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -904,86 +829,87 @@ const ContentTypesSelector = ({ disabled }) => {
|
|
|
904
829
|
label: contentType.info.displayName,
|
|
905
830
|
value: contentType.uid
|
|
906
831
|
}));
|
|
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,
|
|
832
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error, name: "contentTypes", children: [
|
|
833
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
834
|
+
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
835
|
+
defaultMessage: "Associated to"
|
|
836
|
+
}) }),
|
|
837
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
838
|
+
designSystem.MultiSelect,
|
|
839
|
+
{
|
|
840
|
+
customizeContent: (value2) => formatMessage(
|
|
953
841
|
{
|
|
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
|
-
})
|
|
842
|
+
id: "Settings.review-workflows.workflow.contentTypes.displayValue",
|
|
843
|
+
defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
|
|
976
844
|
},
|
|
977
|
-
|
|
978
|
-
)
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
845
|
+
{ count: value2?.length }
|
|
846
|
+
),
|
|
847
|
+
disabled: isDisabled,
|
|
848
|
+
onChange: (values) => {
|
|
849
|
+
onChange("contentTypes", values);
|
|
850
|
+
},
|
|
851
|
+
value,
|
|
852
|
+
placeholder: formatMessage({
|
|
853
|
+
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
854
|
+
defaultMessage: "Select"
|
|
855
|
+
}),
|
|
856
|
+
children: [
|
|
857
|
+
...collectionTypes.length > 0 ? [
|
|
858
|
+
{
|
|
859
|
+
label: formatMessage({
|
|
860
|
+
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
861
|
+
defaultMessage: "Collection Types"
|
|
862
|
+
}),
|
|
863
|
+
children: collectionTypes
|
|
864
|
+
}
|
|
865
|
+
] : [],
|
|
866
|
+
...singleTypes.length > 0 ? [
|
|
867
|
+
{
|
|
868
|
+
label: formatMessage({
|
|
869
|
+
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
870
|
+
defaultMessage: "Single Types"
|
|
871
|
+
}),
|
|
872
|
+
children: singleTypes
|
|
873
|
+
}
|
|
874
|
+
] : []
|
|
875
|
+
].map((opt) => {
|
|
876
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
877
|
+
designSystem.MultiSelectGroup,
|
|
878
|
+
{
|
|
879
|
+
label: opt.label,
|
|
880
|
+
values: opt.children.map((child) => child.value.toString()),
|
|
881
|
+
children: opt.children.map((child) => {
|
|
882
|
+
const { name: assignedWorkflowName } = workflows?.find(
|
|
883
|
+
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
884
|
+
) ?? {};
|
|
885
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, {
|
|
886
|
+
// @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
|
|
887
|
+
children: formatMessage(
|
|
888
|
+
{
|
|
889
|
+
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
890
|
+
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
label: child.label,
|
|
894
|
+
name: assignedWorkflowName,
|
|
895
|
+
em: (...children) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "em", fontWeight: "bold", children }),
|
|
896
|
+
i: (...children) => /* @__PURE__ */ jsxRuntime.jsx(ContentTypeTakeNotice, { children })
|
|
897
|
+
}
|
|
898
|
+
)
|
|
899
|
+
}) }, child.value);
|
|
900
|
+
})
|
|
901
|
+
},
|
|
902
|
+
opt.label
|
|
903
|
+
);
|
|
904
|
+
})
|
|
905
|
+
}
|
|
906
|
+
)
|
|
907
|
+
] });
|
|
982
908
|
};
|
|
983
|
-
const NestedOption =
|
|
909
|
+
const NestedOption = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
984
910
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
985
911
|
`;
|
|
986
|
-
const ContentTypeTakeNotice =
|
|
912
|
+
const ContentTypeTakeNotice = styledComponents.styled(designSystem.Typography)`
|
|
987
913
|
font-style: italic;
|
|
988
914
|
`;
|
|
989
915
|
const WORKFLOW_SCHEMA = yup__namespace.object({
|
|
@@ -1239,23 +1165,22 @@ const EditPage = () => {
|
|
|
1239
1165
|
}
|
|
1240
1166
|
),
|
|
1241
1167
|
/* @__PURE__ */ jsxRuntime.jsx(Layout.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1242
|
-
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate }),
|
|
1168
|
+
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1243
1169
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1244
1170
|
Stages,
|
|
1245
1171
|
{
|
|
1246
1172
|
canDelete,
|
|
1247
|
-
canUpdate,
|
|
1173
|
+
canUpdate: canUpdate || canCreate,
|
|
1248
1174
|
isCreating: isCreatingWorkflow
|
|
1249
1175
|
}
|
|
1250
1176
|
)
|
|
1251
1177
|
] }) }),
|
|
1252
1178
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1253
|
-
|
|
1179
|
+
designSystem.Dialog.Root,
|
|
1254
1180
|
{
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
|
|
1258
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1181
|
+
open: Object.keys(savePrompts).length > 0,
|
|
1182
|
+
onOpenChange: handleConfirmClose,
|
|
1183
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 5, children: [
|
|
1259
1184
|
savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", variant: "omega", children: formatMessage({
|
|
1260
1185
|
id: "review-workflows.page.delete.confirm.stages.body",
|
|
1261
1186
|
defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
|
|
@@ -1275,7 +1200,7 @@ const EditPage = () => {
|
|
|
1275
1200
|
id: "review-workflows.page.delete.confirm.confirm",
|
|
1276
1201
|
defaultMessage: "Are you sure you want to save?"
|
|
1277
1202
|
}) })
|
|
1278
|
-
] })
|
|
1203
|
+
] }) })
|
|
1279
1204
|
}
|
|
1280
1205
|
)
|
|
1281
1206
|
] })
|
|
@@ -1284,8 +1209,8 @@ const EditPage = () => {
|
|
|
1284
1209
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1285
1210
|
index.LimitsModal.Root,
|
|
1286
1211
|
{
|
|
1287
|
-
|
|
1288
|
-
|
|
1212
|
+
open: showLimitModal === "workflow",
|
|
1213
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1289
1214
|
children: [
|
|
1290
1215
|
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1291
1216
|
id: "review-workflows.edit.page.workflows.limit.title",
|
|
@@ -1298,16 +1223,23 @@ const EditPage = () => {
|
|
|
1298
1223
|
]
|
|
1299
1224
|
}
|
|
1300
1225
|
),
|
|
1301
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1226
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1227
|
+
index.LimitsModal.Root,
|
|
1228
|
+
{
|
|
1229
|
+
open: showLimitModal === "stage",
|
|
1230
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1231
|
+
children: [
|
|
1232
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1233
|
+
id: "review-workflows.edit.page.stages.limit.title",
|
|
1234
|
+
defaultMessage: "You have reached the limit of stages for this workflow in your plan"
|
|
1235
|
+
}) }),
|
|
1236
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Body, { children: formatMessage({
|
|
1237
|
+
id: "review-workflows.edit.page.stages.limit.body",
|
|
1238
|
+
defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
|
|
1239
|
+
}) })
|
|
1240
|
+
]
|
|
1241
|
+
}
|
|
1242
|
+
)
|
|
1311
1243
|
] });
|
|
1312
1244
|
};
|
|
1313
1245
|
const addTmpKeysToStages = (data) => {
|
|
@@ -1329,4 +1261,4 @@ const ProtectedEditPage = () => {
|
|
|
1329
1261
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
|
|
1330
1262
|
};
|
|
1331
1263
|
exports.ProtectedEditPage = ProtectedEditPage;
|
|
1332
|
-
//# sourceMappingURL=_id-
|
|
1264
|
+
//# sourceMappingURL=_id-CnRDP3Xx.js.map
|