@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
|
@@ -2,22 +2,22 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { useTracking, useForm, useField, InputRenderer as InputRenderer$1, useNotification, ConfirmDialog, Page, useAPIErrorHandler, useRBAC, Form, BackButton } from "@strapi/admin/strapi-admin";
|
|
4
4
|
import { useLicenseLimits } from "@strapi/admin/strapi-admin/ee";
|
|
5
|
-
import { Box, Typography, Flex, MenuItem, Menu,
|
|
6
|
-
import { PlusCircle,
|
|
5
|
+
import { Box, Typography, Flex, Accordion, MenuItem, Menu, MultiSelectOption, useComposedRefs, VisuallyHidden, IconButton, Grid, Field, SingleSelect, SingleSelectOption, TextInput, MultiSelect, MultiSelectGroup, Dialog, useCollator, Button } from "@strapi/design-system";
|
|
6
|
+
import { PlusCircle, More, Drag, EyeStriked, Duplicate, Check } from "@strapi/icons";
|
|
7
7
|
import { generateNKeysBetween } from "fractional-indexing";
|
|
8
8
|
import { useIntl } from "react-intl";
|
|
9
9
|
import { useDispatch } from "react-redux";
|
|
10
10
|
import { useParams, useNavigate } from "react-router-dom";
|
|
11
11
|
import * as yup from "yup";
|
|
12
|
-
import { r as reviewWorkflowsApi, A as AVAILABLE_COLORS, g as getStageColorByHex, u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, b as CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal, i as isBaseQueryError } from "./index-
|
|
13
|
-
import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-
|
|
12
|
+
import { r as reviewWorkflowsApi, A as AVAILABLE_COLORS, g as getStageColorByHex, u as useGetContentTypesQuery, a as useTypedSelector, C as CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME, b as CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME, L as LimitsModal, i as isBaseQueryError } from "./index-DDsJlZQw.mjs";
|
|
13
|
+
import { D as DRAG_DROP_TYPES, u as useReviewWorkflows, a as DragLayerRendered, H as Header, R as Root } from "./Layout-Da8jupiA.mjs";
|
|
14
14
|
import { getEmptyImage } from "react-dnd-html5-backend";
|
|
15
|
-
import styled from "styled-components";
|
|
15
|
+
import { styled } from "styled-components";
|
|
16
16
|
import { useDrop, useDrag } from "react-dnd";
|
|
17
17
|
const adminApi = reviewWorkflowsApi.injectEndpoints({
|
|
18
18
|
endpoints(builder) {
|
|
19
19
|
return {
|
|
20
|
-
|
|
20
|
+
getAdminRoles: builder.query({
|
|
21
21
|
query: () => ({
|
|
22
22
|
url: `/admin/roles`,
|
|
23
23
|
method: "GET"
|
|
@@ -29,7 +29,7 @@ const adminApi = reviewWorkflowsApi.injectEndpoints({
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
const {
|
|
32
|
+
const { useGetAdminRolesQuery } = adminApi;
|
|
33
33
|
const useKeyboardDragAndDrop = (active, index, { onCancel, onDropItem, onGrabItem, onMoveItem }) => {
|
|
34
34
|
const [isSelected, setIsSelected] = React.useState(false);
|
|
35
35
|
const handleMove = (movement) => {
|
|
@@ -248,74 +248,35 @@ const AddStage = ({ children, ...props }) => {
|
|
|
248
248
|
return /* @__PURE__ */ jsx(
|
|
249
249
|
StyledButton,
|
|
250
250
|
{
|
|
251
|
-
|
|
251
|
+
tag: "button",
|
|
252
252
|
background: "neutral0",
|
|
253
|
-
|
|
253
|
+
borderColor: "neutral150",
|
|
254
254
|
paddingBottom: 3,
|
|
255
255
|
paddingLeft: 4,
|
|
256
256
|
paddingRight: 4,
|
|
257
257
|
paddingTop: 3,
|
|
258
258
|
shadow: "filterShadow",
|
|
259
259
|
...props,
|
|
260
|
-
children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
261
|
-
/* @__PURE__ */ jsx(
|
|
262
|
-
|
|
263
|
-
] })
|
|
260
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", children: /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
|
261
|
+
/* @__PURE__ */ jsx(PlusCircle, { width: "2.4rem", height: "2.4rem", "aria-hidden": true }),
|
|
262
|
+
children
|
|
263
|
+
] }) })
|
|
264
264
|
}
|
|
265
265
|
);
|
|
266
266
|
};
|
|
267
|
-
const StyledAddIcon = styled(PlusCircle)`
|
|
268
|
-
> circle {
|
|
269
|
-
fill: ${({ theme }) => theme.colors.neutral150};
|
|
270
|
-
}
|
|
271
|
-
> path {
|
|
272
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
273
|
-
}
|
|
274
|
-
`;
|
|
275
267
|
const StyledButton = styled(Box)`
|
|
276
268
|
border-radius: 26px;
|
|
277
|
-
|
|
278
|
-
svg {
|
|
279
|
-
height: ${({ theme }) => theme.spaces[6]};
|
|
280
|
-
width: ${({ theme }) => theme.spaces[6]};
|
|
281
|
-
|
|
282
|
-
> path {
|
|
283
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
284
|
-
}
|
|
285
|
-
}
|
|
269
|
+
color: ${({ theme }) => theme.colors.neutral500};
|
|
286
270
|
|
|
287
271
|
&:hover {
|
|
288
|
-
color: ${({ theme }) => theme.colors.primary600}
|
|
289
|
-
${Typography} {
|
|
290
|
-
color: ${({ theme }) => theme.colors.primary600} !important;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
${StyledAddIcon} {
|
|
294
|
-
> circle {
|
|
295
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
296
|
-
}
|
|
297
|
-
> path {
|
|
298
|
-
fill: ${({ theme }) => theme.colors.neutral100};
|
|
299
|
-
}
|
|
300
|
-
}
|
|
272
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
301
273
|
}
|
|
302
274
|
|
|
303
275
|
&:active {
|
|
304
|
-
${
|
|
305
|
-
color: ${({ theme }) => theme.colors.primary600};
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
${StyledAddIcon} {
|
|
309
|
-
> circle {
|
|
310
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
311
|
-
}
|
|
312
|
-
> path {
|
|
313
|
-
fill: ${({ theme }) => theme.colors.neutral100};
|
|
314
|
-
}
|
|
315
|
-
}
|
|
276
|
+
color: ${({ theme }) => theme.colors.primary600};
|
|
316
277
|
}
|
|
317
278
|
`;
|
|
318
|
-
const Stages = ({ canDelete = true, canUpdate = true, isCreating
|
|
279
|
+
const Stages = ({ canDelete = true, canUpdate = true, isCreating }) => {
|
|
319
280
|
const { formatMessage } = useIntl();
|
|
320
281
|
const { trackUsage } = useTracking();
|
|
321
282
|
const addFieldRow = useForm("Stages", (state) => state.addFieldRow);
|
|
@@ -330,35 +291,23 @@ const Stages = ({ canDelete = true, canUpdate = true, isCreating = false }) => {
|
|
|
330
291
|
left: "50%",
|
|
331
292
|
position: "absolute",
|
|
332
293
|
top: "0",
|
|
333
|
-
width: 2
|
|
334
|
-
zIndex: 1
|
|
294
|
+
width: 2
|
|
335
295
|
}
|
|
336
296
|
),
|
|
337
|
-
/* @__PURE__ */ jsx(
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
canDelete: stages.length > 1 && canDelete,
|
|
352
|
-
canReorder: stages.length > 1,
|
|
353
|
-
canUpdate,
|
|
354
|
-
stagesCount: stages.length,
|
|
355
|
-
isOpen: isCreating,
|
|
356
|
-
...stage
|
|
357
|
-
}
|
|
358
|
-
) }, stage.__temp_key__);
|
|
359
|
-
})
|
|
360
|
-
}
|
|
361
|
-
)
|
|
297
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, position: "relative", tag: "ol", children: stages.map((stage, index) => {
|
|
298
|
+
return /* @__PURE__ */ jsx(Box, { tag: "li", children: /* @__PURE__ */ jsx(
|
|
299
|
+
Stage,
|
|
300
|
+
{
|
|
301
|
+
index,
|
|
302
|
+
canDelete: stages.length > 1 && canDelete,
|
|
303
|
+
canReorder: stages.length > 1,
|
|
304
|
+
canUpdate,
|
|
305
|
+
stagesCount: stages.length,
|
|
306
|
+
defaultOpen: isCreating,
|
|
307
|
+
...stage
|
|
308
|
+
}
|
|
309
|
+
) }, stage.__temp_key__);
|
|
310
|
+
}) })
|
|
362
311
|
] }),
|
|
363
312
|
canUpdate && /* @__PURE__ */ jsx(
|
|
364
313
|
AddStage,
|
|
@@ -384,16 +333,15 @@ const Stage = ({
|
|
|
384
333
|
canDelete = false,
|
|
385
334
|
canReorder = false,
|
|
386
335
|
canUpdate = false,
|
|
387
|
-
isOpen: isOpenDefault = false,
|
|
388
336
|
stagesCount,
|
|
389
337
|
name,
|
|
390
338
|
permissions,
|
|
391
|
-
color
|
|
339
|
+
color,
|
|
340
|
+
defaultOpen
|
|
392
341
|
}) => {
|
|
393
342
|
const [liveText, setLiveText] = React.useState();
|
|
394
343
|
const { formatMessage } = useIntl();
|
|
395
344
|
const { trackUsage } = useTracking();
|
|
396
|
-
const [isOpen, setIsOpen] = React.useState(isOpenDefault);
|
|
397
345
|
const stageErrors = useForm("Stages", (state) => state.errors.stages);
|
|
398
346
|
const error = stageErrors?.[index];
|
|
399
347
|
const addFieldRow = useForm("Stage", (state) => state.addFieldRow);
|
|
@@ -475,7 +423,8 @@ const Stage = ({
|
|
|
475
423
|
const handleCloneClick = () => {
|
|
476
424
|
addFieldRow("stages", { name, color, permissions });
|
|
477
425
|
};
|
|
478
|
-
|
|
426
|
+
const id = React.useId();
|
|
427
|
+
return /* @__PURE__ */ jsxs(Box, { ref: composedRef, shadow: "tableShadow", children: [
|
|
479
428
|
liveText && /* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "assertive", children: liveText }),
|
|
480
429
|
isDragging ? /* @__PURE__ */ jsx(
|
|
481
430
|
Box,
|
|
@@ -486,74 +435,61 @@ const Stage = ({
|
|
|
486
435
|
borderWidth: "1px",
|
|
487
436
|
display: "block",
|
|
488
437
|
hasRadius: true,
|
|
489
|
-
padding: 6
|
|
490
|
-
shadow: "tableShadow"
|
|
438
|
+
padding: 6
|
|
491
439
|
}
|
|
492
|
-
) : /* @__PURE__ */
|
|
493
|
-
|
|
440
|
+
) : /* @__PURE__ */ jsx(
|
|
441
|
+
AccordionRoot,
|
|
494
442
|
{
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
onToggle: () => {
|
|
498
|
-
setIsOpen(!isOpen);
|
|
499
|
-
if (!isOpen) {
|
|
443
|
+
onValueChange: (value) => {
|
|
444
|
+
if (value) {
|
|
500
445
|
trackUsage("willEditStage");
|
|
501
446
|
}
|
|
502
447
|
},
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
|
517
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { as: "span", children: formatMessage({
|
|
518
|
-
id: "[tbdb].components.DynamicZone.more-actions",
|
|
519
|
-
defaultMessage: "More actions"
|
|
520
|
-
}) })
|
|
521
|
-
] }),
|
|
522
|
-
/* @__PURE__ */ jsx(Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxs(Menu.SubRoot, { children: [
|
|
523
|
-
canUpdate && /* @__PURE__ */ jsx(MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
524
|
-
id: "Settings.review-workflows.stage.delete",
|
|
525
|
-
defaultMessage: "Duplicate stage"
|
|
526
|
-
}) }),
|
|
527
|
-
canDelete && /* @__PURE__ */ jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index), children: formatMessage({
|
|
528
|
-
id: "Settings.review-workflows.stage.delete",
|
|
529
|
-
defaultMessage: "Delete"
|
|
530
|
-
}) })
|
|
531
|
-
] }) })
|
|
448
|
+
defaultValue: defaultOpen ? id : void 0,
|
|
449
|
+
$error: Object.values(error ?? {}).length > 0,
|
|
450
|
+
children: /* @__PURE__ */ jsxs(Accordion.Item, { value: id, children: [
|
|
451
|
+
/* @__PURE__ */ jsxs(Accordion.Header, { children: [
|
|
452
|
+
/* @__PURE__ */ jsx(Accordion.Trigger, { children: name }),
|
|
453
|
+
/* @__PURE__ */ jsx(Accordion.Actions, { children: canDelete || canUpdate ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
454
|
+
/* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
455
|
+
/* @__PURE__ */ jsxs(ContextMenuTrigger, { size: "S", endIcon: null, paddingLeft: 2, paddingRight: 2, children: [
|
|
456
|
+
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
|
457
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: formatMessage({
|
|
458
|
+
id: "[tbdb].components.DynamicZone.more-actions",
|
|
459
|
+
defaultMessage: "More actions"
|
|
460
|
+
}) })
|
|
532
461
|
] }),
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
462
|
+
/* @__PURE__ */ jsx(Menu.Content, { popoverPlacement: "bottom-end", zIndex: 2, children: /* @__PURE__ */ jsxs(Menu.SubRoot, { children: [
|
|
463
|
+
canUpdate && /* @__PURE__ */ jsx(MenuItem, { onClick: handleCloneClick, children: formatMessage({
|
|
464
|
+
id: "Settings.review-workflows.stage.delete",
|
|
465
|
+
defaultMessage: "Duplicate stage"
|
|
466
|
+
}) }),
|
|
467
|
+
canDelete && /* @__PURE__ */ jsx(DeleteMenuItem, { onClick: () => removeFieldRow("stages", index), children: formatMessage({
|
|
468
|
+
id: "Settings.review-workflows.stage.delete",
|
|
469
|
+
defaultMessage: "Delete"
|
|
470
|
+
}) })
|
|
471
|
+
] }) })
|
|
472
|
+
] }),
|
|
473
|
+
canUpdate && /* @__PURE__ */ jsx(
|
|
474
|
+
IconButton,
|
|
475
|
+
{
|
|
476
|
+
background: "transparent",
|
|
477
|
+
hasRadius: true,
|
|
478
|
+
borderWidth: 0,
|
|
479
|
+
"data-handler-id": handlerId,
|
|
480
|
+
ref: dragRef,
|
|
481
|
+
label: formatMessage({
|
|
482
|
+
id: "Settings.review-workflows.stage.drag",
|
|
483
|
+
defaultMessage: "Drag"
|
|
484
|
+
}),
|
|
485
|
+
onClick: (e) => e.stopPropagation(),
|
|
486
|
+
onKeyDown: handleKeyDown,
|
|
487
|
+
children: /* @__PURE__ */ jsx(Drag, {})
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
] }) : null })
|
|
491
|
+
] }),
|
|
492
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(Grid.Root, { gap: 4, padding: 6, children: [
|
|
557
493
|
{
|
|
558
494
|
disabled: !canUpdate,
|
|
559
495
|
label: formatMessage({
|
|
@@ -591,12 +527,16 @@ const Stage = ({
|
|
|
591
527
|
size: 6,
|
|
592
528
|
type: "permissions"
|
|
593
529
|
}
|
|
594
|
-
].map(({ size, ...field }) => /* @__PURE__ */ jsx(
|
|
595
|
-
]
|
|
530
|
+
].map(({ size, ...field }) => /* @__PURE__ */ jsx(Grid.Item, { col: size, children: /* @__PURE__ */ jsx(InputRenderer, { ...field }) }, field.name)) }) })
|
|
531
|
+
] })
|
|
596
532
|
}
|
|
597
533
|
)
|
|
598
534
|
] });
|
|
599
535
|
};
|
|
536
|
+
const AccordionRoot = styled(Accordion.Root)`
|
|
537
|
+
border: 1px solid
|
|
538
|
+
${({ theme, $error }) => $error ? theme.colors.danger600 : theme.colors.neutral200};
|
|
539
|
+
`;
|
|
600
540
|
const DeleteMenuItem = styled(MenuItem)`
|
|
601
541
|
color: ${({ theme }) => theme.colors.danger600};
|
|
602
542
|
`;
|
|
@@ -610,22 +550,6 @@ const ContextMenuTrigger = styled(Menu.Trigger)`
|
|
|
610
550
|
font-size: 0;
|
|
611
551
|
}
|
|
612
552
|
`;
|
|
613
|
-
const DragIconButton = styled(IconButton)`
|
|
614
|
-
align-items: center;
|
|
615
|
-
border-radius: ${({ theme }) => theme.borderRadius};
|
|
616
|
-
display: flex;
|
|
617
|
-
justify-content: center;
|
|
618
|
-
|
|
619
|
-
&:hover,
|
|
620
|
-
&:focus {
|
|
621
|
-
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
svg {
|
|
625
|
-
height: auto;
|
|
626
|
-
width: ${({ theme }) => theme.spaces[3]};
|
|
627
|
-
}
|
|
628
|
-
`;
|
|
629
553
|
const InputRenderer = (props) => {
|
|
630
554
|
switch (props.type) {
|
|
631
555
|
case "color":
|
|
@@ -651,54 +575,55 @@ const ColorSelector = ({ disabled, label, name, required }) => {
|
|
|
651
575
|
color: hex
|
|
652
576
|
}));
|
|
653
577
|
const { themeColorName } = getStageColorByHex(value) ?? {};
|
|
654
|
-
return /* @__PURE__ */
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
Flex,
|
|
667
|
-
{
|
|
668
|
-
as: "span",
|
|
669
|
-
height: 2,
|
|
670
|
-
background: value,
|
|
671
|
-
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
672
|
-
hasRadius: true,
|
|
673
|
-
shrink: 0,
|
|
674
|
-
width: 2
|
|
675
|
-
}
|
|
676
|
-
),
|
|
677
|
-
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
678
|
-
const { themeColorName: themeColorName2 } = getStageColorByHex(color) || {};
|
|
679
|
-
return /* @__PURE__ */ jsx(
|
|
680
|
-
SingleSelectOption,
|
|
578
|
+
return /* @__PURE__ */ jsxs(Field.Root, { error, name, required, children: [
|
|
579
|
+
/* @__PURE__ */ jsx(Field.Label, { children: label }),
|
|
580
|
+
/* @__PURE__ */ jsx(
|
|
581
|
+
SingleSelect,
|
|
582
|
+
{
|
|
583
|
+
disabled,
|
|
584
|
+
onChange: (v) => {
|
|
585
|
+
onChange(name, v.toString());
|
|
586
|
+
},
|
|
587
|
+
value: value?.toUpperCase(),
|
|
588
|
+
startIcon: /* @__PURE__ */ jsx(
|
|
589
|
+
Flex,
|
|
681
590
|
{
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
591
|
+
tag: "span",
|
|
592
|
+
height: 2,
|
|
593
|
+
background: value,
|
|
594
|
+
borderColor: themeColorName === "neutral0" ? "neutral150" : "transparent",
|
|
595
|
+
hasRadius: true,
|
|
596
|
+
shrink: 0,
|
|
597
|
+
width: 2
|
|
598
|
+
}
|
|
599
|
+
),
|
|
600
|
+
children: colorOptions.map(({ value: value2, label: label2, color }) => {
|
|
601
|
+
const { themeColorName: themeColorName2 } = getStageColorByHex(color) || {};
|
|
602
|
+
return /* @__PURE__ */ jsx(
|
|
603
|
+
SingleSelectOption,
|
|
604
|
+
{
|
|
605
|
+
value: value2,
|
|
606
|
+
startIcon: /* @__PURE__ */ jsx(
|
|
607
|
+
Flex,
|
|
608
|
+
{
|
|
609
|
+
tag: "span",
|
|
610
|
+
height: 2,
|
|
611
|
+
background: color,
|
|
612
|
+
borderColor: themeColorName2 === "neutral0" ? "neutral150" : "transparent",
|
|
613
|
+
hasRadius: true,
|
|
614
|
+
shrink: 0,
|
|
615
|
+
width: 2
|
|
616
|
+
}
|
|
617
|
+
),
|
|
618
|
+
children: label2
|
|
619
|
+
},
|
|
620
|
+
value2
|
|
621
|
+
);
|
|
622
|
+
})
|
|
623
|
+
}
|
|
624
|
+
),
|
|
625
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
626
|
+
] });
|
|
702
627
|
};
|
|
703
628
|
const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
704
629
|
const { formatMessage } = useIntl();
|
|
@@ -707,57 +632,65 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
707
632
|
const { value = [], error, onChange } = useField(name);
|
|
708
633
|
const allStages = useForm("PermissionsField", (state) => state.values.stages);
|
|
709
634
|
const onFormValueChange = useForm("PermissionsField", (state) => state.onChange);
|
|
710
|
-
const
|
|
635
|
+
const rolesErrorCount = React.useRef(0);
|
|
636
|
+
const { data: roles = [], isLoading, error: getRolesError } = useGetAdminRolesQuery();
|
|
711
637
|
const filteredRoles = roles?.filter((role) => role.code !== "strapi-super-admin") ?? [];
|
|
712
638
|
React.useEffect(() => {
|
|
713
|
-
if (!isLoading &&
|
|
639
|
+
if (!isLoading && getRolesError && "status" in getRolesError && getRolesError.status == 403 && rolesErrorCount.current === 0) {
|
|
640
|
+
rolesErrorCount.current = 1;
|
|
714
641
|
toggleNotification({
|
|
715
642
|
blockTransition: true,
|
|
716
643
|
type: "danger",
|
|
717
644
|
message: formatMessage({
|
|
718
645
|
id: "review-workflows.stage.permissions.noPermissions.description",
|
|
719
|
-
defaultMessage: "You don’t have the permission to see roles"
|
|
646
|
+
defaultMessage: "You don’t have the permission to see roles. Contact your administrator."
|
|
720
647
|
})
|
|
721
648
|
});
|
|
722
649
|
}
|
|
723
|
-
}, [formatMessage, isLoading, roles, toggleNotification]);
|
|
650
|
+
}, [formatMessage, isLoading, roles, toggleNotification, getRolesError]);
|
|
724
651
|
if (!isLoading && filteredRoles.length === 0) {
|
|
725
|
-
return /* @__PURE__ */
|
|
726
|
-
|
|
652
|
+
return /* @__PURE__ */ jsxs(
|
|
653
|
+
Field.Root,
|
|
727
654
|
{
|
|
728
|
-
disabled: true,
|
|
729
655
|
name,
|
|
730
656
|
hint: formatMessage({
|
|
731
657
|
id: "Settings.review-workflows.stage.permissions.noPermissions.description",
|
|
732
658
|
defaultMessage: "You don’t have the permission to see roles"
|
|
733
659
|
}),
|
|
734
|
-
label: formatMessage({
|
|
735
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
736
|
-
defaultMessage: "Roles that can change this stage"
|
|
737
|
-
}),
|
|
738
|
-
placeholder: formatMessage({
|
|
739
|
-
id: "components.NotAllowedInput.text",
|
|
740
|
-
defaultMessage: "No permissions to see this field"
|
|
741
|
-
}),
|
|
742
660
|
required,
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
661
|
+
children: [
|
|
662
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
663
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
664
|
+
defaultMessage: "Roles that can change this stage"
|
|
665
|
+
}) }),
|
|
666
|
+
/* @__PURE__ */ jsx(
|
|
667
|
+
TextInput,
|
|
668
|
+
{
|
|
669
|
+
disabled: true,
|
|
670
|
+
placeholder: formatMessage({
|
|
671
|
+
id: "components.NotAllowedInput.text",
|
|
672
|
+
defaultMessage: "No permissions to see this field"
|
|
673
|
+
}),
|
|
674
|
+
startAction: /* @__PURE__ */ jsx(EyeStriked, { fill: "neutral600" }),
|
|
675
|
+
type: "text",
|
|
676
|
+
value: ""
|
|
677
|
+
}
|
|
678
|
+
),
|
|
679
|
+
/* @__PURE__ */ jsx(Field.Hint, {})
|
|
680
|
+
]
|
|
746
681
|
}
|
|
747
682
|
);
|
|
748
683
|
}
|
|
749
|
-
return /* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */ jsx(
|
|
684
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-end", gap: 3, children: [
|
|
685
|
+
/* @__PURE__ */ jsx(PermissionWrapper, { grow: 1, children: /* @__PURE__ */ jsxs(Field.Root, { error, name, required: true, children: [
|
|
686
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
687
|
+
id: "Settings.review-workflows.stage.permissions.label",
|
|
688
|
+
defaultMessage: "Roles that can change this stage"
|
|
689
|
+
}) }),
|
|
690
|
+
/* @__PURE__ */ jsx(
|
|
752
691
|
MultiSelect,
|
|
753
692
|
{
|
|
754
693
|
disabled,
|
|
755
|
-
error,
|
|
756
|
-
id: name,
|
|
757
|
-
label: formatMessage({
|
|
758
|
-
id: "Settings.review-workflows.stage.permissions.label",
|
|
759
|
-
defaultMessage: "Roles that can change this stage"
|
|
760
|
-
}),
|
|
761
694
|
onChange: (values) => {
|
|
762
695
|
const permissions = values.map((value2) => ({
|
|
763
696
|
role: parseInt(value2, 10),
|
|
@@ -766,7 +699,6 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
766
699
|
onChange(name, permissions);
|
|
767
700
|
},
|
|
768
701
|
placeholder,
|
|
769
|
-
required: true,
|
|
770
702
|
value: value.map((permission) => `${permission.role}`),
|
|
771
703
|
withTags: true,
|
|
772
704
|
children: /* @__PURE__ */ jsx(
|
|
@@ -783,58 +715,53 @@ const PermissionsField = ({ disabled, name, placeholder, required }) => {
|
|
|
783
715
|
}
|
|
784
716
|
)
|
|
785
717
|
}
|
|
786
|
-
)
|
|
787
|
-
/* @__PURE__ */ jsx(
|
|
718
|
+
),
|
|
719
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
720
|
+
] }) }),
|
|
721
|
+
/* @__PURE__ */ jsxs(Dialog.Root, { open: isApplyAllConfirmationOpen, onOpenChange: setIsApplyAllConfirmationOpen, children: [
|
|
722
|
+
/* @__PURE__ */ jsx(Dialog.Trigger, { children: /* @__PURE__ */ jsx(
|
|
788
723
|
IconButton,
|
|
789
724
|
{
|
|
790
725
|
disabled,
|
|
791
|
-
icon: /* @__PURE__ */ jsx(Duplicate, {}),
|
|
792
726
|
label: formatMessage({
|
|
793
727
|
id: "Settings.review-workflows.stage.permissions.apply.label",
|
|
794
728
|
defaultMessage: "Apply to all stages"
|
|
795
729
|
}),
|
|
796
730
|
size: "L",
|
|
797
731
|
variant: "secondary",
|
|
798
|
-
|
|
732
|
+
children: /* @__PURE__ */ jsx(Duplicate, {})
|
|
733
|
+
}
|
|
734
|
+
) }),
|
|
735
|
+
/* @__PURE__ */ jsx(
|
|
736
|
+
ConfirmDialog,
|
|
737
|
+
{
|
|
738
|
+
onConfirm: () => {
|
|
739
|
+
onFormValueChange(
|
|
740
|
+
"stages",
|
|
741
|
+
allStages.map((stage) => ({
|
|
742
|
+
...stage,
|
|
743
|
+
permissions: value
|
|
744
|
+
}))
|
|
745
|
+
);
|
|
746
|
+
setIsApplyAllConfirmationOpen(false);
|
|
747
|
+
toggleNotification({
|
|
748
|
+
type: "success",
|
|
749
|
+
message: formatMessage({
|
|
750
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
751
|
+
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
752
|
+
})
|
|
753
|
+
});
|
|
754
|
+
},
|
|
755
|
+
variant: "default",
|
|
756
|
+
children: formatMessage({
|
|
757
|
+
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
758
|
+
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
759
|
+
})
|
|
799
760
|
}
|
|
800
761
|
)
|
|
801
|
-
] })
|
|
802
|
-
|
|
803
|
-
ConfirmDialog,
|
|
804
|
-
{
|
|
805
|
-
isOpen: isApplyAllConfirmationOpen,
|
|
806
|
-
onClose: () => setIsApplyAllConfirmationOpen(false),
|
|
807
|
-
onConfirm: () => {
|
|
808
|
-
onFormValueChange(
|
|
809
|
-
"stages",
|
|
810
|
-
allStages.map((stage) => ({
|
|
811
|
-
...stage,
|
|
812
|
-
permissions: value
|
|
813
|
-
}))
|
|
814
|
-
);
|
|
815
|
-
setIsApplyAllConfirmationOpen(false);
|
|
816
|
-
toggleNotification({
|
|
817
|
-
type: "success",
|
|
818
|
-
message: formatMessage({
|
|
819
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy.success",
|
|
820
|
-
defaultMessage: "Applied roles to all other stages of the workflow"
|
|
821
|
-
})
|
|
822
|
-
});
|
|
823
|
-
},
|
|
824
|
-
variant: "default",
|
|
825
|
-
children: formatMessage({
|
|
826
|
-
id: "Settings.review-workflows.page.edit.confirm.stages.permissions.copy",
|
|
827
|
-
defaultMessage: "Roles that can change that stage will be applied to all the other stages."
|
|
828
|
-
})
|
|
829
|
-
}
|
|
830
|
-
)
|
|
831
|
-
] });
|
|
762
|
+
] })
|
|
763
|
+
] }) });
|
|
832
764
|
};
|
|
833
|
-
const StyledIcon = styled(EyeStriked)`
|
|
834
|
-
& > path {
|
|
835
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
836
|
-
}
|
|
837
|
-
`;
|
|
838
765
|
const NestedOption$1 = styled(MultiSelectOption)`
|
|
839
766
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
840
767
|
`;
|
|
@@ -845,8 +772,8 @@ const PermissionWrapper = styled(Flex)`
|
|
|
845
772
|
`;
|
|
846
773
|
const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
847
774
|
const { formatMessage } = useIntl();
|
|
848
|
-
return /* @__PURE__ */ jsxs(Grid, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
849
|
-
/* @__PURE__ */ jsx(
|
|
775
|
+
return /* @__PURE__ */ jsxs(Grid.Root, { background: "neutral0", hasRadius: true, gap: 4, padding: 6, shadow: "tableShadow", children: [
|
|
776
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(
|
|
850
777
|
InputRenderer$1,
|
|
851
778
|
{
|
|
852
779
|
disabled: !canUpdate,
|
|
@@ -859,7 +786,7 @@ const WorkflowAttributes = ({ canUpdate = true }) => {
|
|
|
859
786
|
type: "string"
|
|
860
787
|
}
|
|
861
788
|
) }),
|
|
862
|
-
/* @__PURE__ */ jsx(
|
|
789
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 6, children: /* @__PURE__ */ jsx(ContentTypesSelector, { disabled: !canUpdate }) })
|
|
863
790
|
] });
|
|
864
791
|
};
|
|
865
792
|
const ContentTypesSelector = ({ disabled }) => {
|
|
@@ -880,81 +807,82 @@ const ContentTypesSelector = ({ disabled }) => {
|
|
|
880
807
|
label: contentType.info.displayName,
|
|
881
808
|
value: contentType.uid
|
|
882
809
|
}));
|
|
883
|
-
return /* @__PURE__ */
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
),
|
|
893
|
-
disabled: isDisabled,
|
|
894
|
-
error,
|
|
895
|
-
label: formatMessage({
|
|
896
|
-
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
897
|
-
defaultMessage: "Associated to"
|
|
898
|
-
}),
|
|
899
|
-
onChange: (values) => {
|
|
900
|
-
onChange("contentTypes", values);
|
|
901
|
-
},
|
|
902
|
-
value,
|
|
903
|
-
placeholder: formatMessage({
|
|
904
|
-
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
905
|
-
defaultMessage: "Select"
|
|
906
|
-
}),
|
|
907
|
-
children: [
|
|
908
|
-
...collectionTypes.length > 0 ? [
|
|
909
|
-
{
|
|
910
|
-
label: formatMessage({
|
|
911
|
-
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
912
|
-
defaultMessage: "Collection Types"
|
|
913
|
-
}),
|
|
914
|
-
children: collectionTypes
|
|
915
|
-
}
|
|
916
|
-
] : [],
|
|
917
|
-
...singleTypes.length > 0 ? [
|
|
918
|
-
{
|
|
919
|
-
label: formatMessage({
|
|
920
|
-
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
921
|
-
defaultMessage: "Single Types"
|
|
922
|
-
}),
|
|
923
|
-
children: singleTypes
|
|
924
|
-
}
|
|
925
|
-
] : []
|
|
926
|
-
].map((opt) => {
|
|
927
|
-
return /* @__PURE__ */ jsx(
|
|
928
|
-
MultiSelectGroup,
|
|
810
|
+
return /* @__PURE__ */ jsxs(Field.Root, { error, name: "contentTypes", children: [
|
|
811
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
812
|
+
id: "Settings.review-workflows.workflow.contentTypes.label",
|
|
813
|
+
defaultMessage: "Associated to"
|
|
814
|
+
}) }),
|
|
815
|
+
/* @__PURE__ */ jsx(
|
|
816
|
+
MultiSelect,
|
|
817
|
+
{
|
|
818
|
+
customizeContent: (value2) => formatMessage(
|
|
929
819
|
{
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
children: opt.children.map((child) => {
|
|
933
|
-
const { name: assignedWorkflowName } = workflows?.find(
|
|
934
|
-
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
935
|
-
) ?? {};
|
|
936
|
-
return /* @__PURE__ */ jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsx(Typography, {
|
|
937
|
-
// @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
|
|
938
|
-
children: formatMessage(
|
|
939
|
-
{
|
|
940
|
-
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
941
|
-
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
942
|
-
},
|
|
943
|
-
{
|
|
944
|
-
label: child.label,
|
|
945
|
-
name: assignedWorkflowName,
|
|
946
|
-
em: (...children) => /* @__PURE__ */ jsx(Typography, { as: "em", fontWeight: "bold", children }),
|
|
947
|
-
i: (...children) => /* @__PURE__ */ jsx(ContentTypeTakeNotice, { children })
|
|
948
|
-
}
|
|
949
|
-
)
|
|
950
|
-
}) }, child.value);
|
|
951
|
-
})
|
|
820
|
+
id: "Settings.review-workflows.workflow.contentTypes.displayValue",
|
|
821
|
+
defaultMessage: "{count} {count, plural, one {content type} other {content types}} selected"
|
|
952
822
|
},
|
|
953
|
-
|
|
954
|
-
)
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
823
|
+
{ count: value2?.length }
|
|
824
|
+
),
|
|
825
|
+
disabled: isDisabled,
|
|
826
|
+
onChange: (values) => {
|
|
827
|
+
onChange("contentTypes", values);
|
|
828
|
+
},
|
|
829
|
+
value,
|
|
830
|
+
placeholder: formatMessage({
|
|
831
|
+
id: "Settings.review-workflows.workflow.contentTypes.placeholder",
|
|
832
|
+
defaultMessage: "Select"
|
|
833
|
+
}),
|
|
834
|
+
children: [
|
|
835
|
+
...collectionTypes.length > 0 ? [
|
|
836
|
+
{
|
|
837
|
+
label: formatMessage({
|
|
838
|
+
id: "Settings.review-workflows.workflow.contentTypes.collectionTypes.label",
|
|
839
|
+
defaultMessage: "Collection Types"
|
|
840
|
+
}),
|
|
841
|
+
children: collectionTypes
|
|
842
|
+
}
|
|
843
|
+
] : [],
|
|
844
|
+
...singleTypes.length > 0 ? [
|
|
845
|
+
{
|
|
846
|
+
label: formatMessage({
|
|
847
|
+
id: "Settings.review-workflows.workflow.contentTypes.singleTypes.label",
|
|
848
|
+
defaultMessage: "Single Types"
|
|
849
|
+
}),
|
|
850
|
+
children: singleTypes
|
|
851
|
+
}
|
|
852
|
+
] : []
|
|
853
|
+
].map((opt) => {
|
|
854
|
+
return /* @__PURE__ */ jsx(
|
|
855
|
+
MultiSelectGroup,
|
|
856
|
+
{
|
|
857
|
+
label: opt.label,
|
|
858
|
+
values: opt.children.map((child) => child.value.toString()),
|
|
859
|
+
children: opt.children.map((child) => {
|
|
860
|
+
const { name: assignedWorkflowName } = workflows?.find(
|
|
861
|
+
(workflow) => (currentWorkflow && workflow.id !== currentWorkflow.id || !currentWorkflow) && workflow.contentTypes.includes(child.value)
|
|
862
|
+
) ?? {};
|
|
863
|
+
return /* @__PURE__ */ jsx(NestedOption, { value: child.value, children: /* @__PURE__ */ jsx(Typography, {
|
|
864
|
+
// @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
|
|
865
|
+
children: formatMessage(
|
|
866
|
+
{
|
|
867
|
+
id: "Settings.review-workflows.workflow.contentTypes.assigned.notice",
|
|
868
|
+
defaultMessage: "{label} {name, select, undefined {} other {<i>(assigned to <em>{name}</em> workflow)</i>}}"
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
label: child.label,
|
|
872
|
+
name: assignedWorkflowName,
|
|
873
|
+
em: (...children) => /* @__PURE__ */ jsx(Typography, { tag: "em", fontWeight: "bold", children }),
|
|
874
|
+
i: (...children) => /* @__PURE__ */ jsx(ContentTypeTakeNotice, { children })
|
|
875
|
+
}
|
|
876
|
+
)
|
|
877
|
+
}) }, child.value);
|
|
878
|
+
})
|
|
879
|
+
},
|
|
880
|
+
opt.label
|
|
881
|
+
);
|
|
882
|
+
})
|
|
883
|
+
}
|
|
884
|
+
)
|
|
885
|
+
] });
|
|
958
886
|
};
|
|
959
887
|
const NestedOption = styled(MultiSelectOption)`
|
|
960
888
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
@@ -1215,23 +1143,22 @@ const EditPage = () => {
|
|
|
1215
1143
|
}
|
|
1216
1144
|
),
|
|
1217
1145
|
/* @__PURE__ */ jsx(Root, { children: /* @__PURE__ */ jsxs(Flex, { alignItems: "stretch", direction: "column", gap: 7, children: [
|
|
1218
|
-
/* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate }),
|
|
1146
|
+
/* @__PURE__ */ jsx(WorkflowAttributes, { canUpdate: canUpdate || canCreate }),
|
|
1219
1147
|
/* @__PURE__ */ jsx(
|
|
1220
1148
|
Stages,
|
|
1221
1149
|
{
|
|
1222
1150
|
canDelete,
|
|
1223
|
-
canUpdate,
|
|
1151
|
+
canUpdate: canUpdate || canCreate,
|
|
1224
1152
|
isCreating: isCreatingWorkflow
|
|
1225
1153
|
}
|
|
1226
1154
|
)
|
|
1227
1155
|
] }) }),
|
|
1228
1156
|
/* @__PURE__ */ jsx(
|
|
1229
|
-
|
|
1157
|
+
Dialog.Root,
|
|
1230
1158
|
{
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
onConfirm: handleConfirmDeleteDialog(values, { setErrors }),
|
|
1234
|
-
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 5, children: [
|
|
1159
|
+
open: Object.keys(savePrompts).length > 0,
|
|
1160
|
+
onOpenChange: handleConfirmClose,
|
|
1161
|
+
children: /* @__PURE__ */ jsx(ConfirmDialog, { onConfirm: handleConfirmDeleteDialog(values, { setErrors }), children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 5, children: [
|
|
1235
1162
|
savePrompts.hasDeletedServerStages && /* @__PURE__ */ jsx(Typography, { textAlign: "center", variant: "omega", children: formatMessage({
|
|
1236
1163
|
id: "review-workflows.page.delete.confirm.stages.body",
|
|
1237
1164
|
defaultMessage: "All entries assigned to deleted stages will be moved to the previous stage."
|
|
@@ -1251,7 +1178,7 @@ const EditPage = () => {
|
|
|
1251
1178
|
id: "review-workflows.page.delete.confirm.confirm",
|
|
1252
1179
|
defaultMessage: "Are you sure you want to save?"
|
|
1253
1180
|
}) })
|
|
1254
|
-
] })
|
|
1181
|
+
] }) })
|
|
1255
1182
|
}
|
|
1256
1183
|
)
|
|
1257
1184
|
] })
|
|
@@ -1260,8 +1187,8 @@ const EditPage = () => {
|
|
|
1260
1187
|
/* @__PURE__ */ jsxs(
|
|
1261
1188
|
LimitsModal.Root,
|
|
1262
1189
|
{
|
|
1263
|
-
|
|
1264
|
-
|
|
1190
|
+
open: showLimitModal === "workflow",
|
|
1191
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1265
1192
|
children: [
|
|
1266
1193
|
/* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
|
|
1267
1194
|
id: "review-workflows.edit.page.workflows.limit.title",
|
|
@@ -1274,16 +1201,23 @@ const EditPage = () => {
|
|
|
1274
1201
|
]
|
|
1275
1202
|
}
|
|
1276
1203
|
),
|
|
1277
|
-
/* @__PURE__ */ jsxs(
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1204
|
+
/* @__PURE__ */ jsxs(
|
|
1205
|
+
LimitsModal.Root,
|
|
1206
|
+
{
|
|
1207
|
+
open: showLimitModal === "stage",
|
|
1208
|
+
onOpenChange: () => setShowLimitModal(null),
|
|
1209
|
+
children: [
|
|
1210
|
+
/* @__PURE__ */ jsx(LimitsModal.Title, { children: formatMessage({
|
|
1211
|
+
id: "review-workflows.edit.page.stages.limit.title",
|
|
1212
|
+
defaultMessage: "You have reached the limit of stages for this workflow in your plan"
|
|
1213
|
+
}) }),
|
|
1214
|
+
/* @__PURE__ */ jsx(LimitsModal.Body, { children: formatMessage({
|
|
1215
|
+
id: "review-workflows.edit.page.stages.limit.body",
|
|
1216
|
+
defaultMessage: "Try deleting some stages or contact Sales to enable more stages."
|
|
1217
|
+
}) })
|
|
1218
|
+
]
|
|
1219
|
+
}
|
|
1220
|
+
)
|
|
1287
1221
|
] });
|
|
1288
1222
|
};
|
|
1289
1223
|
const addTmpKeysToStages = (data) => {
|
|
@@ -1307,4 +1241,4 @@ const ProtectedEditPage = () => {
|
|
|
1307
1241
|
export {
|
|
1308
1242
|
ProtectedEditPage
|
|
1309
1243
|
};
|
|
1310
|
-
//# sourceMappingURL=_id-
|
|
1244
|
+
//# sourceMappingURL=_id-xSrgPSJs.mjs.map
|