@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
|
@@ -7,14 +7,11 @@ const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
|
7
7
|
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
8
8
|
const designSystem = require("@strapi/design-system");
|
|
9
9
|
const symbols = require("@strapi/icons/symbols");
|
|
10
|
-
const axios = require("axios");
|
|
11
10
|
const formik = require("formik");
|
|
12
11
|
const reactIntl = require("react-intl");
|
|
13
12
|
const reactRouterDom = require("react-router-dom");
|
|
14
13
|
const yup = require("yup");
|
|
15
|
-
const
|
|
16
|
-
const styled = require("styled-components");
|
|
17
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
|
+
const styledComponents = require("styled-components");
|
|
18
15
|
function _interopNamespace(e) {
|
|
19
16
|
if (e && e.__esModule)
|
|
20
17
|
return e;
|
|
@@ -35,7 +32,6 @@ function _interopNamespace(e) {
|
|
|
35
32
|
}
|
|
36
33
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
37
34
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
38
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
39
35
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
40
36
|
const v = glob[path];
|
|
41
37
|
if (v) {
|
|
@@ -117,49 +113,9 @@ const PERMISSIONS = {
|
|
|
117
113
|
}
|
|
118
114
|
]
|
|
119
115
|
};
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
method,
|
|
124
|
-
data,
|
|
125
|
-
config
|
|
126
|
-
}) => {
|
|
127
|
-
try {
|
|
128
|
-
const { get, post, del, put } = strapiAdmin.getFetchClient();
|
|
129
|
-
if (method === "POST") {
|
|
130
|
-
const result2 = await post(url, data, config);
|
|
131
|
-
return { data: result2.data };
|
|
132
|
-
}
|
|
133
|
-
if (method === "DELETE") {
|
|
134
|
-
const result2 = await del(url, config);
|
|
135
|
-
return { data: result2.data };
|
|
136
|
-
}
|
|
137
|
-
if (method === "PUT") {
|
|
138
|
-
const result2 = await put(url, data, config);
|
|
139
|
-
return { data: result2.data };
|
|
140
|
-
}
|
|
141
|
-
const result = await get(url, config);
|
|
142
|
-
return { data: result.data };
|
|
143
|
-
} catch (error) {
|
|
144
|
-
const err = error;
|
|
145
|
-
return {
|
|
146
|
-
error: {
|
|
147
|
-
status: err.response?.status,
|
|
148
|
-
code: err.code,
|
|
149
|
-
response: {
|
|
150
|
-
data: err.response?.data
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
const isAxiosError = (err) => {
|
|
157
|
-
return typeof err === "object" && err !== null && "response" in err && typeof err.response === "object" && err.response !== null && "data" in err.response;
|
|
158
|
-
};
|
|
159
|
-
const releaseApi = react.createApi({
|
|
160
|
-
reducerPath: pluginId,
|
|
161
|
-
baseQuery: axiosBaseQuery,
|
|
162
|
-
tagTypes: ["Release", "ReleaseAction", "EntriesInRelease"],
|
|
116
|
+
const releaseApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
117
|
+
addTagTypes: ["Release", "ReleaseAction", "EntriesInRelease"]
|
|
118
|
+
}).injectEndpoints({
|
|
163
119
|
endpoints: (build) => {
|
|
164
120
|
return {
|
|
165
121
|
getReleasesForEntry: build.query({
|
|
@@ -303,13 +259,17 @@ const releaseApi = react.createApi({
|
|
|
303
259
|
...query2
|
|
304
260
|
};
|
|
305
261
|
const patchResult = dispatch(
|
|
306
|
-
releaseApi.util.updateQueryData(
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
262
|
+
releaseApi.util.updateQueryData(
|
|
263
|
+
"getReleaseActions",
|
|
264
|
+
paramsWithoutActionId,
|
|
265
|
+
(draft) => {
|
|
266
|
+
const [key, index] = actionPath;
|
|
267
|
+
const action = draft.data[key][index];
|
|
268
|
+
if (action) {
|
|
269
|
+
action.type = body.type;
|
|
270
|
+
}
|
|
311
271
|
}
|
|
312
|
-
|
|
272
|
+
)
|
|
313
273
|
);
|
|
314
274
|
try {
|
|
315
275
|
await queryFulfilled;
|
|
@@ -399,12 +359,12 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
399
359
|
return "";
|
|
400
360
|
}
|
|
401
361
|
};
|
|
402
|
-
const StyledMenuItem =
|
|
362
|
+
const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
403
363
|
&:hover {
|
|
404
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
364
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
405
365
|
|
|
406
366
|
svg {
|
|
407
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
367
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
408
368
|
}
|
|
409
369
|
|
|
410
370
|
a {
|
|
@@ -413,7 +373,7 @@ const StyledMenuItem = styled__default.default(designSystem.Menu.Item)`
|
|
|
413
373
|
}
|
|
414
374
|
|
|
415
375
|
svg {
|
|
416
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
376
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
417
377
|
}
|
|
418
378
|
|
|
419
379
|
a {
|
|
@@ -425,10 +385,6 @@ const StyledMenuItem = styled__default.default(designSystem.Menu.Item)`
|
|
|
425
385
|
width: 100%;
|
|
426
386
|
}
|
|
427
387
|
`;
|
|
428
|
-
const StyledIconButton = styled__default.default(designSystem.IconButton)`
|
|
429
|
-
/* Setting this style inline with borderColor will not apply the style */
|
|
430
|
-
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
431
|
-
`;
|
|
432
388
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
433
389
|
const { formatMessage } = reactIntl.useIntl();
|
|
434
390
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
@@ -452,7 +408,7 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
452
408
|
return;
|
|
453
409
|
}
|
|
454
410
|
if ("error" in response) {
|
|
455
|
-
if (
|
|
411
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
456
412
|
toggleNotification({
|
|
457
413
|
type: "danger",
|
|
458
414
|
message: formatAPIError(response.error)
|
|
@@ -468,7 +424,7 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
468
424
|
if (!canDeleteAction) {
|
|
469
425
|
return null;
|
|
470
426
|
}
|
|
471
|
-
return /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
427
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { $variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
472
428
|
/* @__PURE__ */ jsxRuntime.jsx(icons.Cross, { width: "1.6rem", height: "1.6rem" }),
|
|
473
429
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
474
430
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
@@ -508,7 +464,7 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
508
464
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
509
465
|
StyledMenuItem,
|
|
510
466
|
{
|
|
511
|
-
|
|
467
|
+
tag: reactRouterDom.Link,
|
|
512
468
|
isLink: true,
|
|
513
469
|
to: {
|
|
514
470
|
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
@@ -526,33 +482,33 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
526
482
|
};
|
|
527
483
|
const EditReleaseItem = ({ releaseId }) => {
|
|
528
484
|
const { formatMessage } = reactIntl.useIntl();
|
|
529
|
-
return
|
|
530
|
-
/* @
|
|
531
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
485
|
+
return (
|
|
486
|
+
/* @ts-expect-error inference isn't working in DS */
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { tag: reactRouterDom.Link, isLink: true, to: `/plugins/content-releases/${releaseId}`, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
488
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, { width: "1.6rem", height: "1.6rem" }),
|
|
489
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
490
|
+
id: "content-releases.content-manager-edit-view.edit-release",
|
|
491
|
+
defaultMessage: "Edit release"
|
|
492
|
+
}) })
|
|
493
|
+
] }) })
|
|
494
|
+
);
|
|
536
495
|
};
|
|
537
|
-
const Root = ({ children
|
|
496
|
+
const Root = ({ children }) => {
|
|
538
497
|
const { formatMessage } = reactIntl.useIntl();
|
|
539
498
|
const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
|
|
540
499
|
return (
|
|
541
500
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
542
501
|
allowedActions.canDeleteAction || allowedActions.canUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
543
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
544
|
-
designSystem.
|
|
502
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Trigger, { paddingLeft: 2, paddingRight: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
503
|
+
designSystem.AccessibleIcon,
|
|
545
504
|
{
|
|
546
|
-
|
|
547
|
-
paddingLeft: 2,
|
|
548
|
-
paddingRight: 2,
|
|
549
|
-
"aria-label": formatMessage({
|
|
505
|
+
label: formatMessage({
|
|
550
506
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
551
507
|
defaultMessage: "Release action options"
|
|
552
508
|
}),
|
|
553
|
-
|
|
509
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
|
|
554
510
|
}
|
|
555
|
-
),
|
|
511
|
+
) }),
|
|
556
512
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
557
513
|
] }) : null
|
|
558
514
|
);
|
|
@@ -569,11 +525,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
569
525
|
const getBorderRightRadiusValue = (actionType) => {
|
|
570
526
|
return actionType === "publish" ? 0 : 1;
|
|
571
527
|
};
|
|
572
|
-
const FieldWrapper =
|
|
573
|
-
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
574
|
-
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
575
|
-
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
576
|
-
border-bottom-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
528
|
+
const FieldWrapper = styledComponents.styled(designSystem.Field.Root)`
|
|
529
|
+
border-top-left-radius: ${({ $actionType, theme }) => theme.spaces[getBorderLeftRadiusValue($actionType)]};
|
|
530
|
+
border-bottom-left-radius: ${({ $actionType, theme }) => theme.spaces[getBorderLeftRadiusValue($actionType)]};
|
|
531
|
+
border-top-right-radius: ${({ $actionType, theme }) => theme.spaces[getBorderRightRadiusValue($actionType)]};
|
|
532
|
+
border-bottom-right-radius: ${({ $actionType, theme }) => theme.spaces[getBorderRightRadiusValue($actionType)]};
|
|
577
533
|
|
|
578
534
|
> label {
|
|
579
535
|
color: inherit;
|
|
@@ -584,14 +540,14 @@ const FieldWrapper = styled__default.default(designSystem.Field)`
|
|
|
584
540
|
}
|
|
585
541
|
|
|
586
542
|
&[data-checked='true'] {
|
|
587
|
-
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
588
|
-
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
589
|
-
border-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
543
|
+
color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
544
|
+
background-color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
545
|
+
border-color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
590
546
|
}
|
|
591
547
|
|
|
592
548
|
&[data-checked='false'] {
|
|
593
|
-
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
594
|
-
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
549
|
+
border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
|
|
550
|
+
border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
|
|
595
551
|
}
|
|
596
552
|
|
|
597
553
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -620,7 +576,7 @@ const ActionOption = ({
|
|
|
620
576
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
621
577
|
FieldWrapper,
|
|
622
578
|
{
|
|
623
|
-
actionType,
|
|
579
|
+
$actionType: actionType,
|
|
624
580
|
background: "primary0",
|
|
625
581
|
borderColor: "neutral200",
|
|
626
582
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -628,12 +584,11 @@ const ActionOption = ({
|
|
|
628
584
|
cursor: "pointer",
|
|
629
585
|
"data-checked": selected === actionType,
|
|
630
586
|
"data-disabled": disabled && selected !== actionType,
|
|
631
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
587
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
|
|
632
588
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
633
|
-
designSystem.
|
|
589
|
+
designSystem.Field.Input,
|
|
634
590
|
{
|
|
635
591
|
type: "radio",
|
|
636
|
-
id: `${name}-${actionType}`,
|
|
637
592
|
name,
|
|
638
593
|
checked: selected === actionType,
|
|
639
594
|
onChange: handleChange,
|
|
@@ -699,7 +654,7 @@ const NoReleases = () => {
|
|
|
699
654
|
to: {
|
|
700
655
|
pathname: "/plugins/content-releases"
|
|
701
656
|
},
|
|
702
|
-
|
|
657
|
+
tag: reactRouterDom.Link,
|
|
703
658
|
variant: "secondary",
|
|
704
659
|
children: formatMessage({
|
|
705
660
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -750,7 +705,7 @@ const AddActionToReleaseModal = ({
|
|
|
750
705
|
return;
|
|
751
706
|
}
|
|
752
707
|
if ("error" in response2) {
|
|
753
|
-
if (
|
|
708
|
+
if (strapiAdmin.isFetchError(response2.error)) {
|
|
754
709
|
toggleNotification({
|
|
755
710
|
type: "danger",
|
|
756
711
|
message: formatAPIError(response2.error)
|
|
@@ -777,24 +732,25 @@ const AddActionToReleaseModal = ({
|
|
|
777
732
|
children: ({ values, setFieldValue }) => {
|
|
778
733
|
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
779
734
|
releases?.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(NoReleases, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
780
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.
|
|
781
|
-
designSystem.
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
735
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { required: true, children: [
|
|
736
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
737
|
+
id: "content-releases.content-manager-edit-view.add-to-release.select-label",
|
|
738
|
+
defaultMessage: "Select a release"
|
|
739
|
+
}) }),
|
|
740
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
741
|
+
designSystem.SingleSelect,
|
|
742
|
+
{
|
|
743
|
+
placeholder: formatMessage({
|
|
744
|
+
id: "content-releases.content-manager-edit-view.add-to-release.select-placeholder",
|
|
745
|
+
defaultMessage: "Select"
|
|
746
|
+
}),
|
|
747
|
+
onChange: (value) => setFieldValue("releaseId", value),
|
|
748
|
+
value: values.releaseId,
|
|
749
|
+
children: releases?.map((release) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
750
|
+
}
|
|
751
|
+
)
|
|
752
|
+
] }) }),
|
|
753
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
798
754
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
799
755
|
defaultMessage: "What do you want to do with this entry?"
|
|
800
756
|
}) }),
|
|
@@ -837,6 +793,7 @@ const CMReleasesContainer = () => {
|
|
|
837
793
|
const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
|
|
838
794
|
const { id, slug, collectionType } = reactRouterDom.useParams();
|
|
839
795
|
const isCreatingEntry = id === "create";
|
|
796
|
+
const entryId = parseInt(id, 10);
|
|
840
797
|
const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
|
|
841
798
|
const { canCreateAction, canRead: canMain, canDeleteAction } = allowedActions;
|
|
842
799
|
const { schema } = strapiAdmin$1.unstable_useDocument({
|
|
@@ -848,7 +805,7 @@ const CMReleasesContainer = () => {
|
|
|
848
805
|
const canFetch = id != null && contentTypeUid != null;
|
|
849
806
|
const fetchParams = canFetch ? {
|
|
850
807
|
contentTypeUid,
|
|
851
|
-
entryId
|
|
808
|
+
entryId,
|
|
852
809
|
hasEntryAttached: true
|
|
853
810
|
} : query.skipToken;
|
|
854
811
|
const response = useGetReleasesForEntryQuery(fetchParams);
|
|
@@ -872,7 +829,7 @@ const CMReleasesContainer = () => {
|
|
|
872
829
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
873
830
|
designSystem.Box,
|
|
874
831
|
{
|
|
875
|
-
|
|
832
|
+
tag: "aside",
|
|
876
833
|
"aria-label": formatMessage({
|
|
877
834
|
id: "content-releases.plugin.name",
|
|
878
835
|
defaultMessage: "Releases"
|
|
@@ -988,186 +945,14 @@ const CMReleasesContainer = () => {
|
|
|
988
945
|
{
|
|
989
946
|
handleClose: toggleModal,
|
|
990
947
|
contentTypeUid,
|
|
991
|
-
entryId
|
|
948
|
+
entryId
|
|
992
949
|
}
|
|
993
950
|
)
|
|
994
951
|
]
|
|
995
952
|
}
|
|
996
953
|
);
|
|
997
954
|
};
|
|
998
|
-
const
|
|
999
|
-
const permissions = {
|
|
1000
|
-
publish: [
|
|
1001
|
-
{
|
|
1002
|
-
action: "plugin::content-manager.explorer.publish",
|
|
1003
|
-
subject,
|
|
1004
|
-
id: "",
|
|
1005
|
-
actionParameters: {},
|
|
1006
|
-
properties: {},
|
|
1007
|
-
conditions: []
|
|
1008
|
-
}
|
|
1009
|
-
]
|
|
1010
|
-
};
|
|
1011
|
-
return permissions;
|
|
1012
|
-
};
|
|
1013
|
-
const ReleaseAction = ({ documentIds, model }) => {
|
|
1014
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
1015
|
-
const { toggleNotification } = strapiAdmin.useNotification();
|
|
1016
|
-
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
1017
|
-
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
|
1018
|
-
const contentPermissions = getContentPermissions(model);
|
|
1019
|
-
const {
|
|
1020
|
-
allowedActions: { canPublish }
|
|
1021
|
-
} = strapiAdmin.useRBAC(contentPermissions);
|
|
1022
|
-
const {
|
|
1023
|
-
allowedActions: { canCreate }
|
|
1024
|
-
} = strapiAdmin.useRBAC(PERMISSIONS);
|
|
1025
|
-
const response = useGetReleasesQuery();
|
|
1026
|
-
const releases = response.data?.data;
|
|
1027
|
-
const [createManyReleaseActions, { isLoading }] = useCreateManyReleaseActionsMutation();
|
|
1028
|
-
const handleSubmit = async (values) => {
|
|
1029
|
-
const locale = query2.plugins?.i18n?.locale;
|
|
1030
|
-
const releaseActionEntries = documentIds.map(
|
|
1031
|
-
(id) => ({
|
|
1032
|
-
type: values.type,
|
|
1033
|
-
entry: {
|
|
1034
|
-
contentType: model,
|
|
1035
|
-
id,
|
|
1036
|
-
locale
|
|
1037
|
-
}
|
|
1038
|
-
})
|
|
1039
|
-
);
|
|
1040
|
-
const response2 = await createManyReleaseActions({
|
|
1041
|
-
body: releaseActionEntries,
|
|
1042
|
-
params: { releaseId: values.releaseId }
|
|
1043
|
-
});
|
|
1044
|
-
if ("data" in response2) {
|
|
1045
|
-
const notificationMessage = formatMessage(
|
|
1046
|
-
{
|
|
1047
|
-
id: "content-releases.content-manager-list-view.add-to-release.notification.success.message",
|
|
1048
|
-
defaultMessage: "{entriesAlreadyInRelease} out of {totalEntries} entries were already in the release."
|
|
1049
|
-
},
|
|
1050
|
-
{
|
|
1051
|
-
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1052
|
-
totalEntries: response2.data.meta.totalEntries
|
|
1053
|
-
}
|
|
1054
|
-
);
|
|
1055
|
-
const notification = {
|
|
1056
|
-
type: "success",
|
|
1057
|
-
title: formatMessage(
|
|
1058
|
-
{
|
|
1059
|
-
id: "content-releases.content-manager-list-view.add-to-release.notification.success.title",
|
|
1060
|
-
defaultMessage: "Successfully added to release."
|
|
1061
|
-
},
|
|
1062
|
-
{
|
|
1063
|
-
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1064
|
-
totalEntries: response2.data.meta.totalEntries
|
|
1065
|
-
}
|
|
1066
|
-
),
|
|
1067
|
-
message: response2.data.meta.entriesAlreadyInRelease ? notificationMessage : ""
|
|
1068
|
-
};
|
|
1069
|
-
toggleNotification(notification);
|
|
1070
|
-
return true;
|
|
1071
|
-
}
|
|
1072
|
-
if ("error" in response2) {
|
|
1073
|
-
if (axios.isAxiosError(response2.error)) {
|
|
1074
|
-
toggleNotification({
|
|
1075
|
-
type: "warning",
|
|
1076
|
-
message: formatAPIError(response2.error)
|
|
1077
|
-
});
|
|
1078
|
-
} else {
|
|
1079
|
-
toggleNotification({
|
|
1080
|
-
type: "warning",
|
|
1081
|
-
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1082
|
-
});
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
};
|
|
1086
|
-
if (!canCreate || !canPublish)
|
|
1087
|
-
return null;
|
|
1088
|
-
return {
|
|
1089
|
-
actionType: "release",
|
|
1090
|
-
variant: "tertiary",
|
|
1091
|
-
label: formatMessage({
|
|
1092
|
-
id: "content-manager-list-view.add-to-release",
|
|
1093
|
-
defaultMessage: "Add to Release"
|
|
1094
|
-
}),
|
|
1095
|
-
dialog: {
|
|
1096
|
-
type: "modal",
|
|
1097
|
-
title: formatMessage({
|
|
1098
|
-
id: "content-manager-list-view.add-to-release",
|
|
1099
|
-
defaultMessage: "Add to Release"
|
|
1100
|
-
}),
|
|
1101
|
-
content: ({ onClose }) => {
|
|
1102
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1103
|
-
formik.Formik,
|
|
1104
|
-
{
|
|
1105
|
-
onSubmit: async (values) => {
|
|
1106
|
-
const data = await handleSubmit(values);
|
|
1107
|
-
if (data) {
|
|
1108
|
-
return onClose();
|
|
1109
|
-
}
|
|
1110
|
-
},
|
|
1111
|
-
validationSchema: RELEASE_ACTION_FORM_SCHEMA,
|
|
1112
|
-
initialValues: INITIAL_VALUES,
|
|
1113
|
-
children: ({ values, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
1114
|
-
releases?.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(NoReleases, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
1115
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1116
|
-
designSystem.SingleSelect,
|
|
1117
|
-
{
|
|
1118
|
-
required: true,
|
|
1119
|
-
label: formatMessage({
|
|
1120
|
-
id: "content-releases.content-manager-list-view.add-to-release.select-label",
|
|
1121
|
-
defaultMessage: "Select a release"
|
|
1122
|
-
}),
|
|
1123
|
-
placeholder: formatMessage({
|
|
1124
|
-
id: "content-releases.content-manager-list-view.add-to-release.select-placeholder",
|
|
1125
|
-
defaultMessage: "Select"
|
|
1126
|
-
}),
|
|
1127
|
-
onChange: (value) => setFieldValue("releaseId", value),
|
|
1128
|
-
value: values.releaseId,
|
|
1129
|
-
children: releases?.map((release) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
1130
|
-
}
|
|
1131
|
-
) }),
|
|
1132
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
|
|
1133
|
-
id: "content-releases.content-manager-list-view.add-to-release.action-type-label",
|
|
1134
|
-
defaultMessage: "What do you want to do with these entries?"
|
|
1135
|
-
}) }),
|
|
1136
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1137
|
-
ReleaseActionOptions,
|
|
1138
|
-
{
|
|
1139
|
-
selected: values.type,
|
|
1140
|
-
handleChange: (e) => setFieldValue("type", e.target.value),
|
|
1141
|
-
name: "type"
|
|
1142
|
-
}
|
|
1143
|
-
)
|
|
1144
|
-
] }) }),
|
|
1145
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1146
|
-
designSystem.ModalFooter,
|
|
1147
|
-
{
|
|
1148
|
-
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", name: "cancel", children: formatMessage({
|
|
1149
|
-
id: "content-releases.content-manager-list-view.add-to-release.cancel-button",
|
|
1150
|
-
defaultMessage: "Cancel"
|
|
1151
|
-
}) }),
|
|
1152
|
-
endActions: (
|
|
1153
|
-
/**
|
|
1154
|
-
* TODO: Ideally we would use isValid from Formik to disable the button, however currently it always returns true
|
|
1155
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
1156
|
-
*/
|
|
1157
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
1158
|
-
id: "content-releases.content-manager-list-view.add-to-release.continue-button",
|
|
1159
|
-
defaultMessage: "Continue"
|
|
1160
|
-
}) })
|
|
1161
|
-
)
|
|
1162
|
-
}
|
|
1163
|
-
)
|
|
1164
|
-
] })
|
|
1165
|
-
}
|
|
1166
|
-
);
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
};
|
|
1170
|
-
};
|
|
955
|
+
const pluginId = "content-releases";
|
|
1171
956
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
1172
957
|
if (!pluginId2) {
|
|
1173
958
|
throw new TypeError("pluginId can't be empty");
|
|
@@ -1189,22 +974,14 @@ const admin = {
|
|
|
1189
974
|
id: `${pluginId}.plugin.name`,
|
|
1190
975
|
defaultMessage: "Releases"
|
|
1191
976
|
},
|
|
1192
|
-
Component: () => Promise.resolve().then(() => require("./App-
|
|
1193
|
-
permissions: PERMISSIONS.main
|
|
1194
|
-
|
|
1195
|
-
app.addMiddlewares([() => releaseApi.middleware]);
|
|
1196
|
-
app.addReducers({
|
|
1197
|
-
[releaseApi.reducerPath]: releaseApi.reducer
|
|
977
|
+
Component: () => Promise.resolve().then(() => require("./App-DUmziQ17.js")).then((mod) => ({ default: mod.App })),
|
|
978
|
+
permissions: PERMISSIONS.main,
|
|
979
|
+
position: 2
|
|
1198
980
|
});
|
|
1199
981
|
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
1200
982
|
name: `${pluginId}-link`,
|
|
1201
983
|
Component: CMReleasesContainer
|
|
1202
984
|
});
|
|
1203
|
-
app.plugins["content-manager"].apis.addBulkAction((actions) => {
|
|
1204
|
-
const deleteActionIndex = actions.findIndex((action) => action.name === "DeleteAction");
|
|
1205
|
-
actions.splice(deleteActionIndex, 0, ReleaseAction);
|
|
1206
|
-
return actions;
|
|
1207
|
-
});
|
|
1208
985
|
} else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
|
|
1209
986
|
app.addMenuLink({
|
|
1210
987
|
to: `/plugins/purchase-content-releases`,
|
|
@@ -1215,10 +992,11 @@ const admin = {
|
|
|
1215
992
|
},
|
|
1216
993
|
permissions: [],
|
|
1217
994
|
async Component() {
|
|
1218
|
-
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-
|
|
995
|
+
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-Be3acS2L.js"));
|
|
1219
996
|
return { default: PurchaseContentReleases };
|
|
1220
997
|
},
|
|
1221
|
-
lockIcon: true
|
|
998
|
+
lockIcon: true,
|
|
999
|
+
position: 2
|
|
1222
1000
|
});
|
|
1223
1001
|
}
|
|
1224
1002
|
},
|
|
@@ -1246,7 +1024,6 @@ exports.ReleaseActionMenu = ReleaseActionMenu;
|
|
|
1246
1024
|
exports.ReleaseActionOptions = ReleaseActionOptions;
|
|
1247
1025
|
exports.admin = admin;
|
|
1248
1026
|
exports.getTimezoneOffset = getTimezoneOffset;
|
|
1249
|
-
exports.isAxiosError = isAxiosError;
|
|
1250
1027
|
exports.pluginId = pluginId;
|
|
1251
1028
|
exports.releaseApi = releaseApi;
|
|
1252
1029
|
exports.useCreateReleaseMutation = useCreateReleaseMutation;
|
|
@@ -1257,4 +1034,4 @@ exports.useGetReleasesQuery = useGetReleasesQuery;
|
|
|
1257
1034
|
exports.usePublishReleaseMutation = usePublishReleaseMutation;
|
|
1258
1035
|
exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
|
|
1259
1036
|
exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
|
|
1260
|
-
//# sourceMappingURL=index-
|
|
1037
|
+
//# sourceMappingURL=index-C5Hc767q.js.map
|