@strapi/review-workflows 0.0.0-experimental.d23c1d5b0e45dd06ef09977f526c85468be05403 → 0.0.0-experimental.d53e940834bf72ddc725f1d2fd36dac9abec30cb

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