@strapi/content-releases 5.0.0-beta.6 → 5.0.0-beta.8
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/dist/_chunks/{App-CbOy9Yd2.js → App-DUmziQ17.js} +170 -170
- package/dist/_chunks/App-DUmziQ17.js.map +1 -0
- package/dist/_chunks/{App-CVlffj0R.mjs → App-D_6Y9N2F.mjs} +165 -164
- package/dist/_chunks/App-D_6Y9N2F.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-DAHdUpAA.js → PurchaseContentReleases-Be3acS2L.js} +4 -3
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Ex09YpKR.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +5 -4
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{index-B7mc1tVq.mjs → index-BomF0-yY.mjs} +86 -307
- package/dist/_chunks/index-BomF0-yY.mjs.map +1 -0
- package/dist/_chunks/{index-Bwn36oqx.js → index-C5Hc767q.js} +83 -306
- package/dist/_chunks/index-C5Hc767q.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +1 -1
- package/dist/admin/src/components/ReleaseModal.d.ts +1 -1
- package/dist/admin/src/services/release.d.ts +36 -360
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/package.json +15 -17
- package/dist/_chunks/App-CVlffj0R.mjs.map +0 -1
- package/dist/_chunks/App-CbOy9Yd2.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-DAHdUpAA.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Ex09YpKR.mjs.map +0 -1
- package/dist/_chunks/index-B7mc1tVq.mjs.map +0 -1
- package/dist/_chunks/index-Bwn36oqx.js.map +0 -1
- package/dist/admin/src/services/axios.d.ts +0 -29
|
@@ -2,17 +2,15 @@ import { Cross, Pencil, More, Plus, PaperPlane } from "@strapi/icons";
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { skipToken } from "@reduxjs/toolkit/query";
|
|
5
|
-
import {
|
|
5
|
+
import { adminApi, useNotification, useAPIErrorHandler, useRBAC, useAuth, isFetchError, useQueryParams } from "@strapi/admin/strapi-admin";
|
|
6
6
|
import { unstable_useDocument } from "@strapi/content-manager/strapi-admin";
|
|
7
|
-
import { Menu,
|
|
7
|
+
import { Menu, Flex, Typography, AccessibleIcon, Field, VisuallyHidden, Box, Button, ModalLayout, ModalHeader, ModalBody, SingleSelect, SingleSelectOption, ModalFooter, EmptyStateLayout, LinkButton } from "@strapi/design-system";
|
|
8
8
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
9
|
-
import { isAxiosError as isAxiosError$1 } from "axios";
|
|
10
9
|
import { Formik, Form } from "formik";
|
|
11
10
|
import { useIntl } from "react-intl";
|
|
12
11
|
import { Link, useParams } from "react-router-dom";
|
|
13
12
|
import * as yup from "yup";
|
|
14
|
-
import {
|
|
15
|
-
import styled from "styled-components";
|
|
13
|
+
import { styled } from "styled-components";
|
|
16
14
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
17
15
|
const v = glob[path];
|
|
18
16
|
if (v) {
|
|
@@ -94,49 +92,9 @@ const PERMISSIONS = {
|
|
|
94
92
|
}
|
|
95
93
|
]
|
|
96
94
|
};
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
method,
|
|
101
|
-
data,
|
|
102
|
-
config
|
|
103
|
-
}) => {
|
|
104
|
-
try {
|
|
105
|
-
const { get, post, del, put } = getFetchClient();
|
|
106
|
-
if (method === "POST") {
|
|
107
|
-
const result2 = await post(url, data, config);
|
|
108
|
-
return { data: result2.data };
|
|
109
|
-
}
|
|
110
|
-
if (method === "DELETE") {
|
|
111
|
-
const result2 = await del(url, config);
|
|
112
|
-
return { data: result2.data };
|
|
113
|
-
}
|
|
114
|
-
if (method === "PUT") {
|
|
115
|
-
const result2 = await put(url, data, config);
|
|
116
|
-
return { data: result2.data };
|
|
117
|
-
}
|
|
118
|
-
const result = await get(url, config);
|
|
119
|
-
return { data: result.data };
|
|
120
|
-
} catch (error) {
|
|
121
|
-
const err = error;
|
|
122
|
-
return {
|
|
123
|
-
error: {
|
|
124
|
-
status: err.response?.status,
|
|
125
|
-
code: err.code,
|
|
126
|
-
response: {
|
|
127
|
-
data: err.response?.data
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
const isAxiosError = (err) => {
|
|
134
|
-
return typeof err === "object" && err !== null && "response" in err && typeof err.response === "object" && err.response !== null && "data" in err.response;
|
|
135
|
-
};
|
|
136
|
-
const releaseApi = createApi({
|
|
137
|
-
reducerPath: pluginId,
|
|
138
|
-
baseQuery: axiosBaseQuery,
|
|
139
|
-
tagTypes: ["Release", "ReleaseAction", "EntriesInRelease"],
|
|
95
|
+
const releaseApi = adminApi.enhanceEndpoints({
|
|
96
|
+
addTagTypes: ["Release", "ReleaseAction", "EntriesInRelease"]
|
|
97
|
+
}).injectEndpoints({
|
|
140
98
|
endpoints: (build) => {
|
|
141
99
|
return {
|
|
142
100
|
getReleasesForEntry: build.query({
|
|
@@ -280,13 +238,17 @@ const releaseApi = createApi({
|
|
|
280
238
|
...query
|
|
281
239
|
};
|
|
282
240
|
const patchResult = dispatch(
|
|
283
|
-
releaseApi.util.updateQueryData(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
241
|
+
releaseApi.util.updateQueryData(
|
|
242
|
+
"getReleaseActions",
|
|
243
|
+
paramsWithoutActionId,
|
|
244
|
+
(draft) => {
|
|
245
|
+
const [key, index] = actionPath;
|
|
246
|
+
const action = draft.data[key][index];
|
|
247
|
+
if (action) {
|
|
248
|
+
action.type = body.type;
|
|
249
|
+
}
|
|
288
250
|
}
|
|
289
|
-
|
|
251
|
+
)
|
|
290
252
|
);
|
|
291
253
|
try {
|
|
292
254
|
await queryFulfilled;
|
|
@@ -378,10 +340,10 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
378
340
|
};
|
|
379
341
|
const StyledMenuItem = styled(Menu.Item)`
|
|
380
342
|
&:hover {
|
|
381
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
343
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
382
344
|
|
|
383
345
|
svg {
|
|
384
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
346
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
385
347
|
}
|
|
386
348
|
|
|
387
349
|
a {
|
|
@@ -390,7 +352,7 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
390
352
|
}
|
|
391
353
|
|
|
392
354
|
svg {
|
|
393
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
355
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
394
356
|
}
|
|
395
357
|
|
|
396
358
|
a {
|
|
@@ -402,10 +364,6 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
402
364
|
width: 100%;
|
|
403
365
|
}
|
|
404
366
|
`;
|
|
405
|
-
const StyledIconButton = styled(IconButton)`
|
|
406
|
-
/* Setting this style inline with borderColor will not apply the style */
|
|
407
|
-
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
408
|
-
`;
|
|
409
367
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
410
368
|
const { formatMessage } = useIntl();
|
|
411
369
|
const { toggleNotification } = useNotification();
|
|
@@ -429,7 +387,7 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
429
387
|
return;
|
|
430
388
|
}
|
|
431
389
|
if ("error" in response) {
|
|
432
|
-
if (
|
|
390
|
+
if (isFetchError(response.error)) {
|
|
433
391
|
toggleNotification({
|
|
434
392
|
type: "danger",
|
|
435
393
|
message: formatAPIError(response.error)
|
|
@@ -445,7 +403,7 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
445
403
|
if (!canDeleteAction) {
|
|
446
404
|
return null;
|
|
447
405
|
}
|
|
448
|
-
return /* @__PURE__ */ jsx(StyledMenuItem, { variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
406
|
+
return /* @__PURE__ */ jsx(StyledMenuItem, { $variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
449
407
|
/* @__PURE__ */ jsx(Cross, { width: "1.6rem", height: "1.6rem" }),
|
|
450
408
|
/* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
451
409
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
@@ -485,7 +443,7 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
485
443
|
return /* @__PURE__ */ jsx(
|
|
486
444
|
StyledMenuItem,
|
|
487
445
|
{
|
|
488
|
-
|
|
446
|
+
tag: Link,
|
|
489
447
|
isLink: true,
|
|
490
448
|
to: {
|
|
491
449
|
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
@@ -503,33 +461,33 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
503
461
|
};
|
|
504
462
|
const EditReleaseItem = ({ releaseId }) => {
|
|
505
463
|
const { formatMessage } = useIntl();
|
|
506
|
-
return
|
|
507
|
-
/* @
|
|
508
|
-
/* @__PURE__ */ jsx(
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
464
|
+
return (
|
|
465
|
+
/* @ts-expect-error inference isn't working in DS */
|
|
466
|
+
/* @__PURE__ */ jsx(StyledMenuItem, { tag: Link, isLink: true, to: `/plugins/content-releases/${releaseId}`, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
467
|
+
/* @__PURE__ */ jsx(Pencil, { width: "1.6rem", height: "1.6rem" }),
|
|
468
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatMessage({
|
|
469
|
+
id: "content-releases.content-manager-edit-view.edit-release",
|
|
470
|
+
defaultMessage: "Edit release"
|
|
471
|
+
}) })
|
|
472
|
+
] }) })
|
|
473
|
+
);
|
|
513
474
|
};
|
|
514
|
-
const Root = ({ children
|
|
475
|
+
const Root = ({ children }) => {
|
|
515
476
|
const { formatMessage } = useIntl();
|
|
516
477
|
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
517
478
|
return (
|
|
518
479
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
519
480
|
allowedActions.canDeleteAction || allowedActions.canUpdate ? /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
520
|
-
/* @__PURE__ */ jsx(
|
|
521
|
-
|
|
481
|
+
/* @__PURE__ */ jsx(Menu.Trigger, { paddingLeft: 2, paddingRight: 2, children: /* @__PURE__ */ jsx(
|
|
482
|
+
AccessibleIcon,
|
|
522
483
|
{
|
|
523
|
-
|
|
524
|
-
paddingLeft: 2,
|
|
525
|
-
paddingRight: 2,
|
|
526
|
-
"aria-label": formatMessage({
|
|
484
|
+
label: formatMessage({
|
|
527
485
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
528
486
|
defaultMessage: "Release action options"
|
|
529
487
|
}),
|
|
530
|
-
|
|
488
|
+
children: /* @__PURE__ */ jsx(More, {})
|
|
531
489
|
}
|
|
532
|
-
),
|
|
490
|
+
) }),
|
|
533
491
|
/* @__PURE__ */ jsx(Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
534
492
|
] }) : null
|
|
535
493
|
);
|
|
@@ -546,11 +504,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
546
504
|
const getBorderRightRadiusValue = (actionType) => {
|
|
547
505
|
return actionType === "publish" ? 0 : 1;
|
|
548
506
|
};
|
|
549
|
-
const FieldWrapper = styled(Field)`
|
|
550
|
-
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
551
|
-
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
552
|
-
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
553
|
-
border-bottom-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
507
|
+
const FieldWrapper = styled(Field.Root)`
|
|
508
|
+
border-top-left-radius: ${({ $actionType, theme }) => theme.spaces[getBorderLeftRadiusValue($actionType)]};
|
|
509
|
+
border-bottom-left-radius: ${({ $actionType, theme }) => theme.spaces[getBorderLeftRadiusValue($actionType)]};
|
|
510
|
+
border-top-right-radius: ${({ $actionType, theme }) => theme.spaces[getBorderRightRadiusValue($actionType)]};
|
|
511
|
+
border-bottom-right-radius: ${({ $actionType, theme }) => theme.spaces[getBorderRightRadiusValue($actionType)]};
|
|
554
512
|
|
|
555
513
|
> label {
|
|
556
514
|
color: inherit;
|
|
@@ -561,14 +519,14 @@ const FieldWrapper = styled(Field)`
|
|
|
561
519
|
}
|
|
562
520
|
|
|
563
521
|
&[data-checked='true'] {
|
|
564
|
-
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
565
|
-
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
566
|
-
border-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
522
|
+
color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
523
|
+
background-color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
524
|
+
border-color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
567
525
|
}
|
|
568
526
|
|
|
569
527
|
&[data-checked='false'] {
|
|
570
|
-
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
571
|
-
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
528
|
+
border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
|
|
529
|
+
border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
|
|
572
530
|
}
|
|
573
531
|
|
|
574
532
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -597,7 +555,7 @@ const ActionOption = ({
|
|
|
597
555
|
return /* @__PURE__ */ jsx(
|
|
598
556
|
FieldWrapper,
|
|
599
557
|
{
|
|
600
|
-
actionType,
|
|
558
|
+
$actionType: actionType,
|
|
601
559
|
background: "primary0",
|
|
602
560
|
borderColor: "neutral200",
|
|
603
561
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -605,12 +563,11 @@ const ActionOption = ({
|
|
|
605
563
|
cursor: "pointer",
|
|
606
564
|
"data-checked": selected === actionType,
|
|
607
565
|
"data-disabled": disabled && selected !== actionType,
|
|
608
|
-
children: /* @__PURE__ */ jsxs(
|
|
566
|
+
children: /* @__PURE__ */ jsxs(Field.Label, { children: [
|
|
609
567
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(
|
|
610
|
-
|
|
568
|
+
Field.Input,
|
|
611
569
|
{
|
|
612
570
|
type: "radio",
|
|
613
|
-
id: `${name}-${actionType}`,
|
|
614
571
|
name,
|
|
615
572
|
checked: selected === actionType,
|
|
616
573
|
onChange: handleChange,
|
|
@@ -676,7 +633,7 @@ const NoReleases = () => {
|
|
|
676
633
|
to: {
|
|
677
634
|
pathname: "/plugins/content-releases"
|
|
678
635
|
},
|
|
679
|
-
|
|
636
|
+
tag: Link,
|
|
680
637
|
variant: "secondary",
|
|
681
638
|
children: formatMessage({
|
|
682
639
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -727,7 +684,7 @@ const AddActionToReleaseModal = ({
|
|
|
727
684
|
return;
|
|
728
685
|
}
|
|
729
686
|
if ("error" in response2) {
|
|
730
|
-
if (
|
|
687
|
+
if (isFetchError(response2.error)) {
|
|
731
688
|
toggleNotification({
|
|
732
689
|
type: "danger",
|
|
733
690
|
message: formatAPIError(response2.error)
|
|
@@ -754,24 +711,25 @@ const AddActionToReleaseModal = ({
|
|
|
754
711
|
children: ({ values, setFieldValue }) => {
|
|
755
712
|
return /* @__PURE__ */ jsxs(Form, { children: [
|
|
756
713
|
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
757
|
-
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
714
|
+
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxs(Field.Root, { required: true, children: [
|
|
715
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
716
|
+
id: "content-releases.content-manager-edit-view.add-to-release.select-label",
|
|
717
|
+
defaultMessage: "Select a release"
|
|
718
|
+
}) }),
|
|
719
|
+
/* @__PURE__ */ jsx(
|
|
720
|
+
SingleSelect,
|
|
721
|
+
{
|
|
722
|
+
placeholder: formatMessage({
|
|
723
|
+
id: "content-releases.content-manager-edit-view.add-to-release.select-placeholder",
|
|
724
|
+
defaultMessage: "Select"
|
|
725
|
+
}),
|
|
726
|
+
onChange: (value) => setFieldValue("releaseId", value),
|
|
727
|
+
value: values.releaseId,
|
|
728
|
+
children: releases?.map((release) => /* @__PURE__ */ jsx(SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
] }) }),
|
|
732
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
775
733
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
776
734
|
defaultMessage: "What do you want to do with this entry?"
|
|
777
735
|
}) }),
|
|
@@ -814,6 +772,7 @@ const CMReleasesContainer = () => {
|
|
|
814
772
|
const { formatMessage, formatDate, formatTime } = useIntl();
|
|
815
773
|
const { id, slug, collectionType } = useParams();
|
|
816
774
|
const isCreatingEntry = id === "create";
|
|
775
|
+
const entryId = parseInt(id, 10);
|
|
817
776
|
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
818
777
|
const { canCreateAction, canRead: canMain, canDeleteAction } = allowedActions;
|
|
819
778
|
const { schema } = unstable_useDocument({
|
|
@@ -825,7 +784,7 @@ const CMReleasesContainer = () => {
|
|
|
825
784
|
const canFetch = id != null && contentTypeUid != null;
|
|
826
785
|
const fetchParams = canFetch ? {
|
|
827
786
|
contentTypeUid,
|
|
828
|
-
entryId
|
|
787
|
+
entryId,
|
|
829
788
|
hasEntryAttached: true
|
|
830
789
|
} : skipToken;
|
|
831
790
|
const response = useGetReleasesForEntryQuery(fetchParams);
|
|
@@ -849,7 +808,7 @@ const CMReleasesContainer = () => {
|
|
|
849
808
|
return /* @__PURE__ */ jsxs(
|
|
850
809
|
Box,
|
|
851
810
|
{
|
|
852
|
-
|
|
811
|
+
tag: "aside",
|
|
853
812
|
"aria-label": formatMessage({
|
|
854
813
|
id: "content-releases.plugin.name",
|
|
855
814
|
defaultMessage: "Releases"
|
|
@@ -965,186 +924,14 @@ const CMReleasesContainer = () => {
|
|
|
965
924
|
{
|
|
966
925
|
handleClose: toggleModal,
|
|
967
926
|
contentTypeUid,
|
|
968
|
-
entryId
|
|
927
|
+
entryId
|
|
969
928
|
}
|
|
970
929
|
)
|
|
971
930
|
]
|
|
972
931
|
}
|
|
973
932
|
);
|
|
974
933
|
};
|
|
975
|
-
const
|
|
976
|
-
const permissions = {
|
|
977
|
-
publish: [
|
|
978
|
-
{
|
|
979
|
-
action: "plugin::content-manager.explorer.publish",
|
|
980
|
-
subject,
|
|
981
|
-
id: "",
|
|
982
|
-
actionParameters: {},
|
|
983
|
-
properties: {},
|
|
984
|
-
conditions: []
|
|
985
|
-
}
|
|
986
|
-
]
|
|
987
|
-
};
|
|
988
|
-
return permissions;
|
|
989
|
-
};
|
|
990
|
-
const ReleaseAction = ({ documentIds, model }) => {
|
|
991
|
-
const { formatMessage } = useIntl();
|
|
992
|
-
const { toggleNotification } = useNotification();
|
|
993
|
-
const { formatAPIError } = useAPIErrorHandler();
|
|
994
|
-
const [{ query }] = useQueryParams();
|
|
995
|
-
const contentPermissions = getContentPermissions(model);
|
|
996
|
-
const {
|
|
997
|
-
allowedActions: { canPublish }
|
|
998
|
-
} = useRBAC(contentPermissions);
|
|
999
|
-
const {
|
|
1000
|
-
allowedActions: { canCreate }
|
|
1001
|
-
} = useRBAC(PERMISSIONS);
|
|
1002
|
-
const response = useGetReleasesQuery();
|
|
1003
|
-
const releases = response.data?.data;
|
|
1004
|
-
const [createManyReleaseActions, { isLoading }] = useCreateManyReleaseActionsMutation();
|
|
1005
|
-
const handleSubmit = async (values) => {
|
|
1006
|
-
const locale = query.plugins?.i18n?.locale;
|
|
1007
|
-
const releaseActionEntries = documentIds.map(
|
|
1008
|
-
(id) => ({
|
|
1009
|
-
type: values.type,
|
|
1010
|
-
entry: {
|
|
1011
|
-
contentType: model,
|
|
1012
|
-
id,
|
|
1013
|
-
locale
|
|
1014
|
-
}
|
|
1015
|
-
})
|
|
1016
|
-
);
|
|
1017
|
-
const response2 = await createManyReleaseActions({
|
|
1018
|
-
body: releaseActionEntries,
|
|
1019
|
-
params: { releaseId: values.releaseId }
|
|
1020
|
-
});
|
|
1021
|
-
if ("data" in response2) {
|
|
1022
|
-
const notificationMessage = formatMessage(
|
|
1023
|
-
{
|
|
1024
|
-
id: "content-releases.content-manager-list-view.add-to-release.notification.success.message",
|
|
1025
|
-
defaultMessage: "{entriesAlreadyInRelease} out of {totalEntries} entries were already in the release."
|
|
1026
|
-
},
|
|
1027
|
-
{
|
|
1028
|
-
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1029
|
-
totalEntries: response2.data.meta.totalEntries
|
|
1030
|
-
}
|
|
1031
|
-
);
|
|
1032
|
-
const notification = {
|
|
1033
|
-
type: "success",
|
|
1034
|
-
title: formatMessage(
|
|
1035
|
-
{
|
|
1036
|
-
id: "content-releases.content-manager-list-view.add-to-release.notification.success.title",
|
|
1037
|
-
defaultMessage: "Successfully added to release."
|
|
1038
|
-
},
|
|
1039
|
-
{
|
|
1040
|
-
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1041
|
-
totalEntries: response2.data.meta.totalEntries
|
|
1042
|
-
}
|
|
1043
|
-
),
|
|
1044
|
-
message: response2.data.meta.entriesAlreadyInRelease ? notificationMessage : ""
|
|
1045
|
-
};
|
|
1046
|
-
toggleNotification(notification);
|
|
1047
|
-
return true;
|
|
1048
|
-
}
|
|
1049
|
-
if ("error" in response2) {
|
|
1050
|
-
if (isAxiosError$1(response2.error)) {
|
|
1051
|
-
toggleNotification({
|
|
1052
|
-
type: "warning",
|
|
1053
|
-
message: formatAPIError(response2.error)
|
|
1054
|
-
});
|
|
1055
|
-
} else {
|
|
1056
|
-
toggleNotification({
|
|
1057
|
-
type: "warning",
|
|
1058
|
-
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
};
|
|
1063
|
-
if (!canCreate || !canPublish)
|
|
1064
|
-
return null;
|
|
1065
|
-
return {
|
|
1066
|
-
actionType: "release",
|
|
1067
|
-
variant: "tertiary",
|
|
1068
|
-
label: formatMessage({
|
|
1069
|
-
id: "content-manager-list-view.add-to-release",
|
|
1070
|
-
defaultMessage: "Add to Release"
|
|
1071
|
-
}),
|
|
1072
|
-
dialog: {
|
|
1073
|
-
type: "modal",
|
|
1074
|
-
title: formatMessage({
|
|
1075
|
-
id: "content-manager-list-view.add-to-release",
|
|
1076
|
-
defaultMessage: "Add to Release"
|
|
1077
|
-
}),
|
|
1078
|
-
content: ({ onClose }) => {
|
|
1079
|
-
return /* @__PURE__ */ jsx(
|
|
1080
|
-
Formik,
|
|
1081
|
-
{
|
|
1082
|
-
onSubmit: async (values) => {
|
|
1083
|
-
const data = await handleSubmit(values);
|
|
1084
|
-
if (data) {
|
|
1085
|
-
return onClose();
|
|
1086
|
-
}
|
|
1087
|
-
},
|
|
1088
|
-
validationSchema: RELEASE_ACTION_FORM_SCHEMA,
|
|
1089
|
-
initialValues: INITIAL_VALUES,
|
|
1090
|
-
children: ({ values, setFieldValue }) => /* @__PURE__ */ jsxs(Form, { children: [
|
|
1091
|
-
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
1092
|
-
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */ jsx(
|
|
1093
|
-
SingleSelect,
|
|
1094
|
-
{
|
|
1095
|
-
required: true,
|
|
1096
|
-
label: formatMessage({
|
|
1097
|
-
id: "content-releases.content-manager-list-view.add-to-release.select-label",
|
|
1098
|
-
defaultMessage: "Select a release"
|
|
1099
|
-
}),
|
|
1100
|
-
placeholder: formatMessage({
|
|
1101
|
-
id: "content-releases.content-manager-list-view.add-to-release.select-placeholder",
|
|
1102
|
-
defaultMessage: "Select"
|
|
1103
|
-
}),
|
|
1104
|
-
onChange: (value) => setFieldValue("releaseId", value),
|
|
1105
|
-
value: values.releaseId,
|
|
1106
|
-
children: releases?.map((release) => /* @__PURE__ */ jsx(SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
1107
|
-
}
|
|
1108
|
-
) }),
|
|
1109
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: formatMessage({
|
|
1110
|
-
id: "content-releases.content-manager-list-view.add-to-release.action-type-label",
|
|
1111
|
-
defaultMessage: "What do you want to do with these entries?"
|
|
1112
|
-
}) }),
|
|
1113
|
-
/* @__PURE__ */ jsx(
|
|
1114
|
-
ReleaseActionOptions,
|
|
1115
|
-
{
|
|
1116
|
-
selected: values.type,
|
|
1117
|
-
handleChange: (e) => setFieldValue("type", e.target.value),
|
|
1118
|
-
name: "type"
|
|
1119
|
-
}
|
|
1120
|
-
)
|
|
1121
|
-
] }) }),
|
|
1122
|
-
/* @__PURE__ */ jsx(
|
|
1123
|
-
ModalFooter,
|
|
1124
|
-
{
|
|
1125
|
-
startActions: /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", name: "cancel", children: formatMessage({
|
|
1126
|
-
id: "content-releases.content-manager-list-view.add-to-release.cancel-button",
|
|
1127
|
-
defaultMessage: "Cancel"
|
|
1128
|
-
}) }),
|
|
1129
|
-
endActions: (
|
|
1130
|
-
/**
|
|
1131
|
-
* TODO: Ideally we would use isValid from Formik to disable the button, however currently it always returns true
|
|
1132
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
1133
|
-
*/
|
|
1134
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
1135
|
-
id: "content-releases.content-manager-list-view.add-to-release.continue-button",
|
|
1136
|
-
defaultMessage: "Continue"
|
|
1137
|
-
}) })
|
|
1138
|
-
)
|
|
1139
|
-
}
|
|
1140
|
-
)
|
|
1141
|
-
] })
|
|
1142
|
-
}
|
|
1143
|
-
);
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
};
|
|
1147
|
-
};
|
|
934
|
+
const pluginId = "content-releases";
|
|
1148
935
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
1149
936
|
if (!pluginId2) {
|
|
1150
937
|
throw new TypeError("pluginId can't be empty");
|
|
@@ -1166,22 +953,14 @@ const admin = {
|
|
|
1166
953
|
id: `${pluginId}.plugin.name`,
|
|
1167
954
|
defaultMessage: "Releases"
|
|
1168
955
|
},
|
|
1169
|
-
Component: () => import("./App-
|
|
1170
|
-
permissions: PERMISSIONS.main
|
|
1171
|
-
|
|
1172
|
-
app.addMiddlewares([() => releaseApi.middleware]);
|
|
1173
|
-
app.addReducers({
|
|
1174
|
-
[releaseApi.reducerPath]: releaseApi.reducer
|
|
956
|
+
Component: () => import("./App-D_6Y9N2F.mjs").then((mod) => ({ default: mod.App })),
|
|
957
|
+
permissions: PERMISSIONS.main,
|
|
958
|
+
position: 2
|
|
1175
959
|
});
|
|
1176
960
|
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
1177
961
|
name: `${pluginId}-link`,
|
|
1178
962
|
Component: CMReleasesContainer
|
|
1179
963
|
});
|
|
1180
|
-
app.plugins["content-manager"].apis.addBulkAction((actions) => {
|
|
1181
|
-
const deleteActionIndex = actions.findIndex((action) => action.name === "DeleteAction");
|
|
1182
|
-
actions.splice(deleteActionIndex, 0, ReleaseAction);
|
|
1183
|
-
return actions;
|
|
1184
|
-
});
|
|
1185
964
|
} else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
|
|
1186
965
|
app.addMenuLink({
|
|
1187
966
|
to: `/plugins/purchase-content-releases`,
|
|
@@ -1192,10 +971,11 @@ const admin = {
|
|
|
1192
971
|
},
|
|
1193
972
|
permissions: [],
|
|
1194
973
|
async Component() {
|
|
1195
|
-
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-
|
|
974
|
+
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-_MxP6-Dt.mjs");
|
|
1196
975
|
return { default: PurchaseContentReleases };
|
|
1197
976
|
},
|
|
1198
|
-
lockIcon: true
|
|
977
|
+
lockIcon: true,
|
|
978
|
+
position: 2
|
|
1199
979
|
});
|
|
1200
980
|
}
|
|
1201
981
|
},
|
|
@@ -1229,11 +1009,10 @@ export {
|
|
|
1229
1009
|
useGetReleaseActionsQuery as f,
|
|
1230
1010
|
getTimezoneOffset as g,
|
|
1231
1011
|
useUpdateReleaseActionMutation as h,
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
admin as k,
|
|
1012
|
+
ReleaseActionMenu as i,
|
|
1013
|
+
admin as j,
|
|
1235
1014
|
pluginId as p,
|
|
1236
1015
|
releaseApi as r,
|
|
1237
1016
|
useGetReleasesQuery as u
|
|
1238
1017
|
};
|
|
1239
|
-
//# sourceMappingURL=index-
|
|
1018
|
+
//# sourceMappingURL=index-BomF0-yY.mjs.map
|