@strapi/review-workflows 0.0.0-experimental.76447298a89499e415c97916c03f4f90c25ff336 → 0.0.0-experimental.779667bd163026468f566293decf331a0246fff9
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-D3DDQmMI.js} +7 -15
- package/dist/_chunks/Layout-D3DDQmMI.js.map +1 -0
- package/dist/_chunks/{Layout-facLKucY.mjs → Layout-Da8jupiA.mjs} +10 -16
- package/dist/_chunks/Layout-Da8jupiA.mjs.map +1 -0
- package/dist/_chunks/{_id-B6DgrtpA.js → _id-CnRDP3Xx.js} +319 -388
- package/dist/_chunks/_id-CnRDP3Xx.js.map +1 -0
- package/dist/_chunks/{_id-D4CXKOqG.mjs → _id-xSrgPSJs.mjs} +313 -380
- package/dist/_chunks/_id-xSrgPSJs.mjs.map +1 -0
- package/dist/_chunks/{index-BuKZWpJw.js → index-4kp4AkBB.js} +25 -40
- package/dist/_chunks/index-4kp4AkBB.js.map +1 -0
- package/dist/_chunks/{index-D7Y0ofdg.mjs → index-DDsJlZQw.mjs} +115 -165
- package/dist/_chunks/index-DDsJlZQw.mjs.map +1 -0
- package/dist/_chunks/{index-DX8AGcIP.js → index-DhPxWpsW.js} +115 -167
- package/dist/_chunks/index-DhPxWpsW.js.map +1 -0
- package/dist/_chunks/{index-QbWLXdZR.mjs → index-jfO5GxtW.mjs} +24 -37
- package/dist/_chunks/index-jfO5GxtW.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-DOEULOpS.mjs} +3 -3
- package/dist/_chunks/{router-ylD0eA48.mjs.map → router-DOEULOpS.mjs.map} +1 -1
- package/dist/_chunks/{router-CL62NScV.js → router-DSXpeew4.js} +3 -3
- package/dist/_chunks/{router-CL62NScV.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-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
|
@@ -11,13 +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-
|
|
16
|
-
const v2 = require("@strapi/design-system/v2");
|
|
14
|
+
const index = require("./index-DhPxWpsW.js");
|
|
15
|
+
const Layout = require("./Layout-D3DDQmMI.js");
|
|
17
16
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
18
|
-
const
|
|
17
|
+
const styledComponents = require("styled-components");
|
|
19
18
|
const reactDnd = require("react-dnd");
|
|
20
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
21
19
|
function _interopNamespace(e) {
|
|
22
20
|
if (e && e.__esModule)
|
|
23
21
|
return e;
|
|
@@ -38,11 +36,10 @@ function _interopNamespace(e) {
|
|
|
38
36
|
}
|
|
39
37
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
40
38
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
41
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
42
39
|
const adminApi = index.reviewWorkflowsApi.injectEndpoints({
|
|
43
40
|
endpoints(builder) {
|
|
44
41
|
return {
|
|
45
|
-
|
|
42
|
+
getAdminRoles: builder.query({
|
|
46
43
|
query: () => ({
|
|
47
44
|
url: `/admin/roles`,
|
|
48
45
|
method: "GET"
|
|
@@ -54,7 +51,7 @@ const adminApi = index.reviewWorkflowsApi.injectEndpoints({
|
|
|
54
51
|
};
|
|
55
52
|
}
|
|
56
53
|
});
|
|
57
|
-
const {
|
|
54
|
+
const { useGetAdminRolesQuery } = adminApi;
|
|
58
55
|
const useKeyboardDragAndDrop = (active, index2, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
|
|
59
56
|
const [isSelected, setIsSelected] = React__namespace.useState(false);
|
|
60
57
|
const handleMove = (movement) => {
|
|
@@ -273,74 +270,35 @@ const AddStage = ({ children, ...props }) => {
|
|
|
273
270
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
274
271
|
StyledButton,
|
|
275
272
|
{
|
|
276
|
-
|
|
273
|
+
tag: "button",
|
|
277
274
|
background: "neutral0",
|
|
278
|
-
|
|
275
|
+
borderColor: "neutral150",
|
|
279
276
|
paddingBottom: 3,
|
|
280
277
|
paddingLeft: 4,
|
|
281
278
|
paddingRight: 4,
|
|
282
279
|
paddingTop: 3,
|
|
283
280
|
shadow: "filterShadow",
|
|
284
281
|
...props,
|
|
285
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
286
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
-
|
|
288
|
-
] })
|
|
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
|
+
] }) })
|
|
289
286
|
}
|
|
290
287
|
);
|
|
291
288
|
};
|
|
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)`
|
|
289
|
+
const StyledButton = styledComponents.styled(designSystem.Box)`
|
|
301
290
|
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
|
-
}
|
|
291
|
+
color: ${({ theme }) => theme.colors.neutral500};
|
|
311
292
|
|
|
312
293
|
&: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
|
-
}
|
|
294
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
326
295
|
}
|
|
327
296
|
|
|
328
297
|
&: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
|
-
}
|
|
298
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
341
299
|
}
|
|
342
300
|
`;
|
|
343
|
-
const Stages = ({ canDelete = true, canUpdate = true, isCreating
|
|
301
|
+
const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
344
302
|
const { formatMessage } = reactIntl.useIntl();
|
|
345
303
|
const { trackUsage } = strapiAdmin.useTracking();
|
|
346
304
|
const addFieldRow = strapiAdmin.useForm("Stages", (state) => state.addFieldRow);
|
|
@@ -355,35 +313,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
355
313
|
left: "50%",
|
|
356
314
|
position: "absolute",
|
|
357
315
|
top: "0",
|
|
358
|
-
width: 2
|
|
359
|
-
zIndex: 1
|
|
316
|
+
width: 2
|
|
360
317
|
}
|
|
361
318
|
),
|
|
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
|
-
)
|
|
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
|
+
}) })
|
|
387
333
|
] }),
|
|
388
334
|
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
389
335
|
AddStage,
|
|
@@ -401,7 +347,7 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
401
347
|
)
|
|
402
348
|
] });
|
|
403
349
|
};
|
|
404
|
-
const Background =
|
|
350
|
+
const Background = styledComponents.styled(designSystem.Box)`
|
|
405
351
|
transform: translateX(-50%);
|
|
406
352
|
`;
|
|
407
353
|
const Stage = ({
|
|
@@ -409,16 +355,15 @@ const Stage = ({
|
|
|
409
355
|
canDelete = false,
|
|
410
356
|
canReorder = false,
|
|
411
357
|
canUpdate = false,
|
|
412
|
-
isOpen: isOpenDefault = false,
|
|
413
358
|
stagesCount,
|
|
414
359
|
name,
|
|
415
360
|
permissions,
|
|
416
|
-
color
|
|
361
|
+
color,
|
|
362
|
+
defaultOpen
|
|
417
363
|
}) => {
|
|
418
364
|
const [liveText, setLiveText] = React__namespace.useState();
|
|
419
365
|
const { formatMessage } = reactIntl.useIntl();
|
|
420
366
|
const { trackUsage } = strapiAdmin.useTracking();
|
|
421
|
-
const [isOpen, setIsOpen] = React__namespace.useState(isOpenDefault);
|
|
422
367
|
const stageErrors = strapiAdmin.useForm("Stages", (state) => state.errors.stages);
|
|
423
368
|
const error = stageErrors?.[index2];
|
|
424
369
|
const addFieldRow = strapiAdmin.useForm("Stage", (state) => state.addFieldRow);
|
|
@@ -500,7 +445,8 @@ const Stage = ({
|
|
|
500
445
|
const handleCloneClick = () => {
|
|
501
446
|
addFieldRow("stages", { name, color, permissions });
|
|
502
447
|
};
|
|
503
|
-
|
|
448
|
+
const id = React__namespace.useId();
|
|
449
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
504
450
|
liveText && /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
505
451
|
isDragging ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
506
452
|
designSystem.Box,
|
|
@@ -511,74 +457,61 @@ const Stage = ({
|
|
|
511
457
|
borderWidth: "1px",
|
|
512
458
|
display: "block",
|
|
513
459
|
hasRadius: true,
|
|
514
|
-
padding: 6
|
|
515
|
-
shadow: "tableShadow"
|
|
460
|
+
padding: 6
|
|
516
461
|
}
|
|
517
|
-
) : /* @__PURE__ */ jsxRuntime.
|
|
518
|
-
|
|
462
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
463
|
+
AccordionRoot,
|
|
519
464
|
{
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
onToggle: () => {
|
|
523
|
-
setIsOpen(!isOpen);
|
|
524
|
-
if (!isOpen) {
|
|
465
|
+
onValueChange: (value) => {
|
|
466
|
+
if (value) {
|
|
525
467
|
trackUsage("willEditStage");
|
|
526
468
|
}
|
|
527
469
|
},
|
|
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
|
-
] }) })
|
|
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
|
+
}) })
|
|
557
483
|
] }),
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
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: [
|
|
582
515
|
{
|
|
583
516
|
disabled: !canUpdate,
|
|
584
517
|
label: formatMessage({
|
|
@@ -616,16 +549,20 @@ const Stage = ({
|
|
|
616
549
|
size: 6,
|
|
617
550
|
type: "permissions"
|
|
618
551
|
}
|
|
619
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
620
|
-
]
|
|
552
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: size, children: /* @__PURE__ */ jsxRuntime.jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
553
|
+
] })
|
|
621
554
|
}
|
|
622
555
|
)
|
|
623
556
|
] });
|
|
624
557
|
};
|
|
625
|
-
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)`
|
|
626
563
|
color: ${({ theme }) => theme.colors.danger600};
|
|
627
564
|
`;
|
|
628
|
-
const ContextMenuTrigger =
|
|
565
|
+
const ContextMenuTrigger = styledComponents.styled(designSystem.Menu.Trigger)`
|
|
629
566
|
:hover,
|
|
630
567
|
:focus {
|
|
631
568
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
@@ -635,22 +572,6 @@ const ContextMenuTrigger = styled__default.default(v2.Menu.Trigger)`
|
|
|
635
572
|
font-size: 0;
|
|
636
573
|
}
|
|
637
574
|
`;
|
|
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
575
|
const InputRenderer = (props) => {
|
|
655
576
|
switch (props.type) {
|
|
656
577
|
case "color":
|
|
@@ -676,54 +597,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
|
|
|
676
597
|
color: hex
|
|
677
598
|
}));
|
|
678
599
|
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,
|
|
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,
|
|
706
612
|
{
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
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
|
+
] });
|
|
727
649
|
};
|
|
728
650
|
const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
729
651
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -732,57 +654,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
732
654
|
const { value = [], error, onChange } = strapiAdmin.useField(name);
|
|
733
655
|
const allStages = strapiAdmin.useForm("PermissionsField", (state) => state.values.stages);
|
|
734
656
|
const onFormValueChange = strapiAdmin.useForm("PermissionsField", (state) => state.onChange);
|
|
735
|
-
const
|
|
657
|
+
const rolesErrorCount = React__namespace.useRef(0);
|
|
658
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
736
659
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
737
660
|
React__namespace.useEffect(() => {
|
|
738
|
-
if (!isLoading &&
|
|
661
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
662
|
+
rolesErrorCount.current = 1;
|
|
739
663
|
toggleNotification({
|
|
740
664
|
blockTransition: true,
|
|
741
665
|
type: "danger",
|
|
742
666
|
message: formatMessage({
|
|
743
667
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
744
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
668
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
745
669
|
})
|
|
746
670
|
});
|
|
747
671
|
}
|
|
748
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
672
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
749
673
|
if (!isLoading && filteredRoles.length === 0) {
|
|
750
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
751
|
-
designSystem.
|
|
674
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
675
|
+
designSystem.Field.Root,
|
|
752
676
|
{
|
|
753
|
-
disabled: true,
|
|
754
677
|
name,
|
|
755
678
|
hint: formatMessage({
|
|
756
679
|
id: "Settings.review-workflows.stage.permissions.noPermissions.description",
|
|
757
680
|
defaultMessage: "You don’t have the permission to see roles"
|
|
758
681
|
}),
|
|
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
682
|
required,
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
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
|
+
]
|
|
771
703
|
}
|
|
772
704
|
);
|
|
773
705
|
}
|
|
774
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
775
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
776
|
-
/* @__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(
|
|
777
713
|
designSystem.MultiSelect,
|
|
778
714
|
{
|
|
779
715
|
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
716
|
onChange: (values) => {
|
|
787
717
|
const permissions = values.map((value2) => ({
|
|
788
718
|
role: parseInt(value2, 10),
|
|
@@ -791,7 +721,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
791
721
|
onChange(name, permissions);
|
|
792
722
|
},
|
|
793
723
|
placeholder,
|
|
794
|
-
required: true,
|
|
795
724
|
value: value.map((permission) => `${permission.role}`),
|
|
796
725
|
withTags: true,
|
|
797
726
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -808,70 +737,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
808
737
|
}
|
|
809
738
|
)
|
|
810
739
|
}
|
|
811
|
-
)
|
|
812
|
-
/* @__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(
|
|
813
745
|
designSystem.IconButton,
|
|
814
746
|
{
|
|
815
747
|
disabled,
|
|
816
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Duplicate, {}),
|
|
817
748
|
label: formatMessage({
|
|
818
749
|
id: "Settings.review-workflows.stage.permissions.apply.label",
|
|
819
750
|
defaultMessage: "Apply to all stages"
|
|
820
751
|
}),
|
|
821
752
|
size: "L",
|
|
822
753
|
variant: "secondary",
|
|
823
|
-
|
|
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
|
+
})
|
|
824
782
|
}
|
|
825
783
|
)
|
|
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
|
-
] });
|
|
784
|
+
] })
|
|
785
|
+
] }) });
|
|
857
786
|
};
|
|
858
|
-
const
|
|
859
|
-
& > path {
|
|
860
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
861
|
-
}
|
|
862
|
-
`;
|
|
863
|
-
const NestedOption$1 = styled__default.default(designSystem.MultiSelectOption)`
|
|
787
|
+
const NestedOption$1 = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
864
788
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
865
789
|
`;
|
|
866
|
-
const PermissionWrapper =
|
|
790
|
+
const PermissionWrapper = styledComponents.styled(designSystem.Flex)`
|
|
867
791
|
> * {
|
|
868
792
|
flex-grow: 1;
|
|
869
793
|
}
|
|
870
794
|
`;
|
|
871
795
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
872
796
|
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.
|
|
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(
|
|
875
799
|
strapiAdmin.InputRenderer,
|
|
876
800
|
{
|
|
877
801
|
disabled: !canUpdate,
|
|
@@ -884,7 +808,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
884
808
|
type: "string"
|
|
885
809
|
}
|
|
886
810
|
) }),
|
|
887
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
811
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
888
812
|
] });
|
|
889
813
|
};
|
|
890
814
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -905,86 +829,87 @@ const ContentTypesSelector = ({ disabled }) => {
|
|
|
905
829
|
label: contentType.info.displayName,
|
|
906
830
|
value: contentType.uid
|
|
907
831
|
}));
|
|
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,
|
|
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(
|
|
954
841
|
{
|
|
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
|
-
})
|
|
842
|
+
id: "Settings.review-workflows.workflow.contentTypes.displayValue",
|
|
843
|
+
defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
|
|
977
844
|
},
|
|
978
|
-
|
|
979
|
-
)
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
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
|
+
] });
|
|
983
908
|
};
|
|
984
|
-
const NestedOption =
|
|
909
|
+
const NestedOption = styledComponents.styled(designSystem.MultiSelectOption)`
|
|
985
910
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
986
911
|
`;
|
|
987
|
-
const ContentTypeTakeNotice =
|
|
912
|
+
const ContentTypeTakeNotice = styledComponents.styled(designSystem.Typography)`
|
|
988
913
|
font-style: italic;
|
|
989
914
|
`;
|
|
990
915
|
const WORKFLOW_SCHEMA = yup__namespace.object({
|
|
@@ -1240,23 +1165,22 @@ const EditPage = () => {
|
|
|
1240
1165
|
}
|
|
1241
1166
|
),
|
|
1242
1167
|
/* @__PURE__ */ jsxRuntime.jsx(Layout.Root, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1243
|
-
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate }),
|
|
1168
|
+
/* @__PURE__ */ jsxRuntime.jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1244
1169
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1245
1170
|
Stages,
|
|
1246
1171
|
{
|
|
1247
1172
|
canDelete,
|
|
1248
|
-
canUpdate,
|
|
1173
|
+
canUpdate: canUpdate || canCreate,
|
|
1249
1174
|
isCreating: isCreatingWorkflow
|
|
1250
1175
|
}
|
|
1251
1176
|
)
|
|
1252
1177
|
] }) }),
|
|
1253
1178
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1254
|
-
|
|
1179
|
+
designSystem.Dialog.Root,
|
|
1255
1180
|
{
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
|
|
1259
|
-
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: [
|
|
1260
1184
|
savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textAlign: "center", variant: "omega", children: formatMessage({
|
|
1261
1185
|
id: "review-workflows.page.delete.confirm.stages.body",
|
|
1262
1186
|
defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
|
|
@@ -1276,7 +1200,7 @@ const EditPage = () => {
|
|
|
1276
1200
|
id: "review-workflows.page.delete.confirm.confirm",
|
|
1277
1201
|
defaultMessage: "Are you sure you want to save?"
|
|
1278
1202
|
}) })
|
|
1279
|
-
] })
|
|
1203
|
+
] }) })
|
|
1280
1204
|
}
|
|
1281
1205
|
)
|
|
1282
1206
|
] })
|
|
@@ -1285,8 +1209,8 @@ const EditPage = () => {
|
|
|
1285
1209
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1286
1210
|
index.LimitsModal.Root,
|
|
1287
1211
|
{
|
|
1288
|
-
|
|
1289
|
-
|
|
1212
|
+
open: showLimitModal === "workflow",
|
|
1213
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1290
1214
|
children: [
|
|
1291
1215
|
/* @__PURE__ */ jsxRuntime.jsx(index.LimitsModal.Title, { children: formatMessage({
|
|
1292
1216
|
id: "review-workflows.edit.page.workflows.limit.title",
|
|
@@ -1299,16 +1223,23 @@ const EditPage = () => {
|
|
|
1299
1223
|
]
|
|
1300
1224
|
}
|
|
1301
1225
|
),
|
|
1302
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
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
|
+
)
|
|
1312
1243
|
] });
|
|
1313
1244
|
};
|
|
1314
1245
|
const addTmpKeysToStages = (data) => {
|
|
@@ -1330,4 +1261,4 @@ const ProtectedEditPage = () => {
|
|
|
1330
1261
|
return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions, children: /* @__PURE__ */ jsxRuntime.jsx(EditPage, {}) });
|
|
1331
1262
|
};
|
|
1332
1263
|
exports.ProtectedEditPage = ProtectedEditPage;
|
|
1333
|
-
//# sourceMappingURL=_id-
|
|
1264
|
+
//# sourceMappingURL=_id-CnRDP3Xx.js.map
|