@strapi/content-releases 5.0.0-beta.0 → 5.0.0-beta.10
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-IkyOz9wq.mjs → App-B2R2exNT.mjs} +257 -256
- package/dist/_chunks/App-B2R2exNT.mjs.map +1 -0
- package/dist/_chunks/{App-FuRaphre.js → App-CEwOQkKT.js} +265 -265
- package/dist/_chunks/App-CEwOQkKT.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-Be3acS2L.js} +8 -7
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +9 -8
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-RdapH-9X.mjs → en-B9Ur3VsE.mjs} +11 -2
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-faJDuv3q.js → en-DtFJ5ViE.js} +11 -2
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-Sb3Nal8H.js → index-BrWv-zV4.js} +169 -193
- package/dist/_chunks/index-BrWv-zV4.js.map +1 -0
- package/dist/_chunks/{index-qP3rNiDS.mjs → index-DbmynICx.mjs} +170 -192
- package/dist/_chunks/index-DbmynICx.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/src/components/CMReleasesContainer.d.ts +21 -0
- package/dist/admin/src/components/ReleaseAction.d.ts +3 -0
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +1 -1
- package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +3 -2
- package/dist/admin/src/services/release.d.ts +56 -320
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/dist/server/index.js +101 -52
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +102 -53
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +2 -2
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts +1 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/release.d.ts +1 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/release-action.d.ts +7 -2
- package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -1
- package/dist/server/src/destroy.d.ts +2 -2
- package/dist/server/src/destroy.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +1412 -1411
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/migrations/index.d.ts.map +1 -1
- package/dist/server/src/register.d.ts +2 -2
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/release.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +1407 -1407
- package/dist/server/src/services/release.d.ts +9 -9
- package/dist/server/src/services/release.d.ts.map +1 -1
- package/dist/server/src/services/scheduling.d.ts +6 -6
- package/dist/server/src/services/scheduling.d.ts.map +1 -1
- package/dist/server/src/services/validation.d.ts +2 -2
- package/dist/server/src/services/validation.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +10 -10
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/release-actions.d.ts +9 -9
- package/dist/shared/contracts/release-actions.d.ts.map +1 -1
- package/dist/shared/contracts/releases.d.ts +17 -1
- package/dist/shared/contracts/releases.d.ts.map +1 -1
- package/dist/shared/types.d.ts +2 -2
- package/dist/shared/types.d.ts.map +1 -1
- package/package.json +19 -19
- package/dist/_chunks/App-FuRaphre.js.map +0 -1
- package/dist/_chunks/App-IkyOz9wq.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +0 -1
- package/dist/_chunks/en-RdapH-9X.mjs.map +0 -1
- package/dist/_chunks/en-faJDuv3q.js.map +0 -1
- package/dist/_chunks/index-Sb3Nal8H.js.map +0 -1
- package/dist/_chunks/index-qP3rNiDS.mjs.map +0 -1
- package/dist/admin/src/services/axios.d.ts +0 -29
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { Cross, Pencil, More, Plus,
|
|
1
|
+
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 {
|
|
6
|
-
import {
|
|
7
|
-
import { Menu,
|
|
8
|
-
import {
|
|
5
|
+
import { adminApi, useNotification, useAPIErrorHandler, useRBAC, useAuth, isFetchError, useQueryParams } from "@strapi/admin/strapi-admin";
|
|
6
|
+
import { unstable_useDocument } from "@strapi/content-manager/strapi-admin";
|
|
7
|
+
import { Menu, Flex, Typography, AccessibleIcon, Field, VisuallyHidden, Box, Button, Modal, SingleSelect, SingleSelectOption, EmptyStateLayout, LinkButton } from "@strapi/design-system";
|
|
8
|
+
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
9
9
|
import { Formik, Form } from "formik";
|
|
10
10
|
import { useIntl } from "react-intl";
|
|
11
|
-
import {
|
|
11
|
+
import { Link, useParams } from "react-router-dom";
|
|
12
12
|
import * as yup from "yup";
|
|
13
|
-
import {
|
|
14
|
-
import styled from "styled-components";
|
|
13
|
+
import { styled } from "styled-components";
|
|
15
14
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
16
15
|
const v = glob[path];
|
|
17
16
|
if (v) {
|
|
@@ -93,49 +92,9 @@ const PERMISSIONS = {
|
|
|
93
92
|
}
|
|
94
93
|
]
|
|
95
94
|
};
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
method,
|
|
100
|
-
data,
|
|
101
|
-
config
|
|
102
|
-
}) => {
|
|
103
|
-
try {
|
|
104
|
-
const { get, post, del, put } = getFetchClient();
|
|
105
|
-
if (method === "POST") {
|
|
106
|
-
const result2 = await post(url, data, config);
|
|
107
|
-
return { data: result2.data };
|
|
108
|
-
}
|
|
109
|
-
if (method === "DELETE") {
|
|
110
|
-
const result2 = await del(url, config);
|
|
111
|
-
return { data: result2.data };
|
|
112
|
-
}
|
|
113
|
-
if (method === "PUT") {
|
|
114
|
-
const result2 = await put(url, data, config);
|
|
115
|
-
return { data: result2.data };
|
|
116
|
-
}
|
|
117
|
-
const result = await get(url, config);
|
|
118
|
-
return { data: result.data };
|
|
119
|
-
} catch (error) {
|
|
120
|
-
const err = error;
|
|
121
|
-
return {
|
|
122
|
-
error: {
|
|
123
|
-
status: err.response?.status,
|
|
124
|
-
code: err.code,
|
|
125
|
-
response: {
|
|
126
|
-
data: err.response?.data
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
const isAxiosError = (err) => {
|
|
133
|
-
return typeof err === "object" && err !== null && "response" in err && typeof err.response === "object" && err.response !== null && "data" in err.response;
|
|
134
|
-
};
|
|
135
|
-
const releaseApi = createApi({
|
|
136
|
-
reducerPath: pluginId,
|
|
137
|
-
baseQuery: axiosBaseQuery,
|
|
138
|
-
tagTypes: ["Release", "ReleaseAction"],
|
|
95
|
+
const releaseApi = adminApi.enhanceEndpoints({
|
|
96
|
+
addTagTypes: ["Release", "ReleaseAction", "EntriesInRelease"]
|
|
97
|
+
}).injectEndpoints({
|
|
139
98
|
endpoints: (build) => {
|
|
140
99
|
return {
|
|
141
100
|
getReleasesForEntry: build.query({
|
|
@@ -250,6 +209,20 @@ const releaseApi = createApi({
|
|
|
250
209
|
{ type: "ReleaseAction", id: "LIST" }
|
|
251
210
|
]
|
|
252
211
|
}),
|
|
212
|
+
createManyReleaseActions: build.mutation({
|
|
213
|
+
query({ body, params }) {
|
|
214
|
+
return {
|
|
215
|
+
url: `/content-releases/${params.releaseId}/actions/bulk`,
|
|
216
|
+
method: "POST",
|
|
217
|
+
data: body
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
invalidatesTags: [
|
|
221
|
+
{ type: "Release", id: "LIST" },
|
|
222
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
223
|
+
{ type: "EntriesInRelease" }
|
|
224
|
+
]
|
|
225
|
+
}),
|
|
253
226
|
updateReleaseAction: build.mutation({
|
|
254
227
|
query({ body, params }) {
|
|
255
228
|
return {
|
|
@@ -265,13 +238,17 @@ const releaseApi = createApi({
|
|
|
265
238
|
...query
|
|
266
239
|
};
|
|
267
240
|
const patchResult = dispatch(
|
|
268
|
-
releaseApi.util.updateQueryData(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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
|
+
}
|
|
273
250
|
}
|
|
274
|
-
|
|
251
|
+
)
|
|
275
252
|
);
|
|
276
253
|
try {
|
|
277
254
|
await queryFulfilled;
|
|
@@ -287,9 +264,11 @@ const releaseApi = createApi({
|
|
|
287
264
|
method: "DELETE"
|
|
288
265
|
};
|
|
289
266
|
},
|
|
290
|
-
invalidatesTags: [
|
|
267
|
+
invalidatesTags: (result, error, arg) => [
|
|
291
268
|
{ type: "Release", id: "LIST" },
|
|
292
|
-
{ type: "
|
|
269
|
+
{ type: "Release", id: arg.params.releaseId },
|
|
270
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
271
|
+
{ type: "EntriesInRelease" }
|
|
293
272
|
]
|
|
294
273
|
}),
|
|
295
274
|
publishRelease: build.mutation({
|
|
@@ -308,7 +287,22 @@ const releaseApi = createApi({
|
|
|
308
287
|
method: "DELETE"
|
|
309
288
|
};
|
|
310
289
|
},
|
|
311
|
-
invalidatesTags: () => [{ type: "Release", id: "LIST" }]
|
|
290
|
+
invalidatesTags: () => [{ type: "Release", id: "LIST" }, { type: "EntriesInRelease" }]
|
|
291
|
+
}),
|
|
292
|
+
getMappedEntriesInReleases: build.query({
|
|
293
|
+
query(params) {
|
|
294
|
+
return {
|
|
295
|
+
url: "/content-releases/mapEntriesToReleases",
|
|
296
|
+
method: "GET",
|
|
297
|
+
config: {
|
|
298
|
+
params
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
},
|
|
302
|
+
transformResponse(response) {
|
|
303
|
+
return response.data;
|
|
304
|
+
},
|
|
305
|
+
providesTags: [{ type: "EntriesInRelease" }]
|
|
312
306
|
})
|
|
313
307
|
};
|
|
314
308
|
}
|
|
@@ -320,11 +314,13 @@ const {
|
|
|
320
314
|
useGetReleaseActionsQuery,
|
|
321
315
|
useCreateReleaseMutation,
|
|
322
316
|
useCreateReleaseActionMutation,
|
|
317
|
+
useCreateManyReleaseActionsMutation,
|
|
323
318
|
useUpdateReleaseMutation,
|
|
324
319
|
useUpdateReleaseActionMutation,
|
|
325
320
|
usePublishReleaseMutation,
|
|
326
321
|
useDeleteReleaseActionMutation,
|
|
327
|
-
useDeleteReleaseMutation
|
|
322
|
+
useDeleteReleaseMutation,
|
|
323
|
+
useGetMappedEntriesInReleasesQuery
|
|
328
324
|
} = releaseApi;
|
|
329
325
|
const getTimezoneOffset = (timezone, date) => {
|
|
330
326
|
try {
|
|
@@ -344,12 +340,10 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
344
340
|
};
|
|
345
341
|
const StyledMenuItem = styled(Menu.Item)`
|
|
346
342
|
&:hover {
|
|
347
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
343
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
348
344
|
|
|
349
345
|
svg {
|
|
350
|
-
|
|
351
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
352
|
-
}
|
|
346
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
353
347
|
}
|
|
354
348
|
|
|
355
349
|
a {
|
|
@@ -358,9 +352,7 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
358
352
|
}
|
|
359
353
|
|
|
360
354
|
svg {
|
|
361
|
-
|
|
362
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
363
|
-
}
|
|
355
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
364
356
|
}
|
|
365
357
|
|
|
366
358
|
a {
|
|
@@ -372,10 +364,6 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
372
364
|
width: 100%;
|
|
373
365
|
}
|
|
374
366
|
`;
|
|
375
|
-
const StyledIconButton = styled(IconButton)`
|
|
376
|
-
/* Setting this style inline with borderColor will not apply the style */
|
|
377
|
-
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
378
|
-
`;
|
|
379
367
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
380
368
|
const { formatMessage } = useIntl();
|
|
381
369
|
const { toggleNotification } = useNotification();
|
|
@@ -399,7 +387,7 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
399
387
|
return;
|
|
400
388
|
}
|
|
401
389
|
if ("error" in response) {
|
|
402
|
-
if (
|
|
390
|
+
if (isFetchError(response.error)) {
|
|
403
391
|
toggleNotification({
|
|
404
392
|
type: "danger",
|
|
405
393
|
message: formatAPIError(response.error)
|
|
@@ -415,8 +403,8 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
415
403
|
if (!canDeleteAction) {
|
|
416
404
|
return null;
|
|
417
405
|
}
|
|
418
|
-
return /* @__PURE__ */ jsx(StyledMenuItem, { variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
419
|
-
/* @__PURE__ */ jsx(
|
|
406
|
+
return /* @__PURE__ */ jsx(StyledMenuItem, { $variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
407
|
+
/* @__PURE__ */ jsx(Cross, { width: "1.6rem", height: "1.6rem" }),
|
|
420
408
|
/* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
421
409
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
422
410
|
defaultMessage: "Remove from release"
|
|
@@ -440,7 +428,7 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
440
428
|
return Boolean(!locale || updatePermissions.properties?.locales?.includes(locale));
|
|
441
429
|
}, [contentTypeUid, locale, userPermissions]);
|
|
442
430
|
const {
|
|
443
|
-
allowedActions: { canUpdateContentType }
|
|
431
|
+
allowedActions: { canUpdate: canUpdateContentType }
|
|
444
432
|
} = useRBAC({
|
|
445
433
|
updateContentType: [
|
|
446
434
|
{
|
|
@@ -452,56 +440,54 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
452
440
|
if (!canUpdateContentType || !canUpdateEntryForLocale) {
|
|
453
441
|
return null;
|
|
454
442
|
}
|
|
455
|
-
return /* @__PURE__ */ jsx(
|
|
456
|
-
|
|
443
|
+
return /* @__PURE__ */ jsx(
|
|
444
|
+
StyledMenuItem,
|
|
457
445
|
{
|
|
458
|
-
|
|
446
|
+
tag: Link,
|
|
447
|
+
isLink: true,
|
|
459
448
|
to: {
|
|
460
449
|
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
461
450
|
search: locale && `?plugins[i18n][locale]=${locale}`
|
|
462
451
|
},
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
452
|
+
children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
453
|
+
/* @__PURE__ */ jsx(Pencil, { width: "1.6rem", height: "1.6rem" }),
|
|
454
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatMessage({
|
|
455
|
+
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
456
|
+
defaultMessage: "Edit entry"
|
|
457
|
+
}) })
|
|
458
|
+
] })
|
|
468
459
|
}
|
|
469
|
-
)
|
|
460
|
+
);
|
|
470
461
|
};
|
|
471
462
|
const EditReleaseItem = ({ releaseId }) => {
|
|
472
463
|
const { formatMessage } = useIntl();
|
|
473
|
-
return
|
|
474
|
-
|
|
475
|
-
{
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
startIcon: /* @__PURE__ */ jsx(Icon, { as: Pencil, width: 3, height: 3 }),
|
|
479
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatMessage({
|
|
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({
|
|
480
469
|
id: "content-releases.content-manager-edit-view.edit-release",
|
|
481
470
|
defaultMessage: "Edit release"
|
|
482
471
|
}) })
|
|
483
|
-
}
|
|
484
|
-
)
|
|
472
|
+
] }) })
|
|
473
|
+
);
|
|
485
474
|
};
|
|
486
|
-
const Root = ({ children
|
|
475
|
+
const Root = ({ children }) => {
|
|
487
476
|
const { formatMessage } = useIntl();
|
|
488
477
|
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
489
478
|
return (
|
|
490
479
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
491
480
|
allowedActions.canDeleteAction || allowedActions.canUpdate ? /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
492
|
-
/* @__PURE__ */ jsx(
|
|
493
|
-
|
|
481
|
+
/* @__PURE__ */ jsx(Menu.Trigger, { paddingLeft: 2, paddingRight: 2, children: /* @__PURE__ */ jsx(
|
|
482
|
+
AccessibleIcon,
|
|
494
483
|
{
|
|
495
|
-
|
|
496
|
-
paddingLeft: 2,
|
|
497
|
-
paddingRight: 2,
|
|
498
|
-
"aria-label": formatMessage({
|
|
484
|
+
label: formatMessage({
|
|
499
485
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
500
486
|
defaultMessage: "Release action options"
|
|
501
487
|
}),
|
|
502
|
-
|
|
488
|
+
children: /* @__PURE__ */ jsx(More, {})
|
|
503
489
|
}
|
|
504
|
-
),
|
|
490
|
+
) }),
|
|
505
491
|
/* @__PURE__ */ jsx(Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
506
492
|
] }) : null
|
|
507
493
|
);
|
|
@@ -518,11 +504,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
518
504
|
const getBorderRightRadiusValue = (actionType) => {
|
|
519
505
|
return actionType === "publish" ? 0 : 1;
|
|
520
506
|
};
|
|
521
|
-
const FieldWrapper = styled(Field)`
|
|
522
|
-
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
523
|
-
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
524
|
-
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
525
|
-
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)]};
|
|
526
512
|
|
|
527
513
|
> label {
|
|
528
514
|
color: inherit;
|
|
@@ -533,14 +519,14 @@ const FieldWrapper = styled(Field)`
|
|
|
533
519
|
}
|
|
534
520
|
|
|
535
521
|
&[data-checked='true'] {
|
|
536
|
-
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
537
|
-
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
538
|
-
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};
|
|
539
525
|
}
|
|
540
526
|
|
|
541
527
|
&[data-checked='false'] {
|
|
542
|
-
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
543
|
-
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
528
|
+
border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
|
|
529
|
+
border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
|
|
544
530
|
}
|
|
545
531
|
|
|
546
532
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -569,7 +555,7 @@ const ActionOption = ({
|
|
|
569
555
|
return /* @__PURE__ */ jsx(
|
|
570
556
|
FieldWrapper,
|
|
571
557
|
{
|
|
572
|
-
actionType,
|
|
558
|
+
$actionType: actionType,
|
|
573
559
|
background: "primary0",
|
|
574
560
|
borderColor: "neutral200",
|
|
575
561
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -577,12 +563,11 @@ const ActionOption = ({
|
|
|
577
563
|
cursor: "pointer",
|
|
578
564
|
"data-checked": selected === actionType,
|
|
579
565
|
"data-disabled": disabled && selected !== actionType,
|
|
580
|
-
children: /* @__PURE__ */ jsxs(
|
|
566
|
+
children: /* @__PURE__ */ jsxs(Field.Label, { children: [
|
|
581
567
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(
|
|
582
|
-
|
|
568
|
+
Field.Input,
|
|
583
569
|
{
|
|
584
570
|
type: "radio",
|
|
585
|
-
id: `${name}-${actionType}`,
|
|
586
571
|
name,
|
|
587
572
|
checked: selected === actionType,
|
|
588
573
|
onChange: handleChange,
|
|
@@ -637,7 +622,7 @@ const NoReleases = () => {
|
|
|
637
622
|
return /* @__PURE__ */ jsx(
|
|
638
623
|
EmptyStateLayout,
|
|
639
624
|
{
|
|
640
|
-
icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "
|
|
625
|
+
icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "16rem" }),
|
|
641
626
|
content: formatMessage({
|
|
642
627
|
id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
|
|
643
628
|
defaultMessage: "No available releases. Open the list of releases and create a new one from there."
|
|
@@ -648,7 +633,7 @@ const NoReleases = () => {
|
|
|
648
633
|
to: {
|
|
649
634
|
pathname: "/plugins/content-releases"
|
|
650
635
|
},
|
|
651
|
-
|
|
636
|
+
tag: Link,
|
|
652
637
|
variant: "secondary",
|
|
653
638
|
children: formatMessage({
|
|
654
639
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -660,11 +645,11 @@ const NoReleases = () => {
|
|
|
660
645
|
);
|
|
661
646
|
};
|
|
662
647
|
const AddActionToReleaseModal = ({
|
|
663
|
-
|
|
648
|
+
open,
|
|
649
|
+
onOpenChange,
|
|
664
650
|
contentTypeUid,
|
|
665
651
|
entryId
|
|
666
652
|
}) => {
|
|
667
|
-
const releaseHeaderId = React.useId();
|
|
668
653
|
const { formatMessage } = useIntl();
|
|
669
654
|
const { toggleNotification } = useNotification();
|
|
670
655
|
const { formatAPIError } = useAPIErrorHandler();
|
|
@@ -695,11 +680,11 @@ const AddActionToReleaseModal = ({
|
|
|
695
680
|
defaultMessage: "Entry added to release"
|
|
696
681
|
})
|
|
697
682
|
});
|
|
698
|
-
|
|
683
|
+
onOpenChange();
|
|
699
684
|
return;
|
|
700
685
|
}
|
|
701
686
|
if ("error" in response2) {
|
|
702
|
-
if (
|
|
687
|
+
if (isFetchError(response2.error)) {
|
|
703
688
|
toggleNotification({
|
|
704
689
|
type: "danger",
|
|
705
690
|
message: formatAPIError(response2.error)
|
|
@@ -712,8 +697,8 @@ const AddActionToReleaseModal = ({
|
|
|
712
697
|
}
|
|
713
698
|
}
|
|
714
699
|
};
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */ jsx(
|
|
700
|
+
return /* @__PURE__ */ jsx(Modal.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
|
|
701
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { fontWeight: "bold", children: formatMessage({
|
|
717
702
|
id: "content-releases.content-manager-edit-view.add-to-release",
|
|
718
703
|
defaultMessage: "Add to release"
|
|
719
704
|
}) }) }),
|
|
@@ -725,25 +710,26 @@ const AddActionToReleaseModal = ({
|
|
|
725
710
|
initialValues: INITIAL_VALUES,
|
|
726
711
|
children: ({ values, setFieldValue }) => {
|
|
727
712
|
return /* @__PURE__ */ jsxs(Form, { children: [
|
|
728
|
-
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(
|
|
729
|
-
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
713
|
+
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
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({
|
|
747
733
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
748
734
|
defaultMessage: "What do you want to do with this entry?"
|
|
749
735
|
}) }),
|
|
@@ -756,39 +742,30 @@ const AddActionToReleaseModal = ({
|
|
|
756
742
|
}
|
|
757
743
|
)
|
|
758
744
|
] }) }),
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
770
|
-
*/
|
|
771
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
772
|
-
id: "content-releases.content-manager-edit-view.add-to-release.continue-button",
|
|
773
|
-
defaultMessage: "Continue"
|
|
774
|
-
}) })
|
|
775
|
-
)
|
|
776
|
-
}
|
|
777
|
-
)
|
|
745
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
746
|
+
/* @__PURE__ */ jsx(Modal.Close, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", name: "cancel", children: formatMessage({
|
|
747
|
+
id: "content-releases.content-manager-edit-view.add-to-release.cancel-button",
|
|
748
|
+
defaultMessage: "Cancel"
|
|
749
|
+
}) }) }),
|
|
750
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
751
|
+
id: "content-releases.content-manager-edit-view.add-to-release.continue-button",
|
|
752
|
+
defaultMessage: "Continue"
|
|
753
|
+
}) })
|
|
754
|
+
] })
|
|
778
755
|
] });
|
|
779
756
|
}
|
|
780
757
|
}
|
|
781
758
|
)
|
|
782
|
-
] });
|
|
759
|
+
] }) });
|
|
783
760
|
};
|
|
784
761
|
const CMReleasesContainer = () => {
|
|
785
762
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
786
763
|
const { formatMessage, formatDate, formatTime } = useIntl();
|
|
787
764
|
const { id, slug, collectionType } = useParams();
|
|
788
765
|
const isCreatingEntry = id === "create";
|
|
789
|
-
const
|
|
790
|
-
|
|
791
|
-
} =
|
|
766
|
+
const entryId = parseInt(id, 10);
|
|
767
|
+
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
768
|
+
const { canCreateAction, canRead: canMain, canDeleteAction } = allowedActions;
|
|
792
769
|
const { schema } = unstable_useDocument({
|
|
793
770
|
collectionType,
|
|
794
771
|
model: slug
|
|
@@ -798,7 +775,7 @@ const CMReleasesContainer = () => {
|
|
|
798
775
|
const canFetch = id != null && contentTypeUid != null;
|
|
799
776
|
const fetchParams = canFetch ? {
|
|
800
777
|
contentTypeUid,
|
|
801
|
-
entryId
|
|
778
|
+
entryId,
|
|
802
779
|
hasEntryAttached: true
|
|
803
780
|
} : skipToken;
|
|
804
781
|
const response = useGetReleasesForEntryQuery(fetchParams);
|
|
@@ -822,7 +799,7 @@ const CMReleasesContainer = () => {
|
|
|
822
799
|
return /* @__PURE__ */ jsxs(
|
|
823
800
|
Box,
|
|
824
801
|
{
|
|
825
|
-
|
|
802
|
+
tag: "aside",
|
|
826
803
|
"aria-label": formatMessage({
|
|
827
804
|
id: "content-releases.plugin.name",
|
|
828
805
|
defaultMessage: "Releases"
|
|
@@ -846,7 +823,7 @@ const CMReleasesContainer = () => {
|
|
|
846
823
|
alignItems: "start",
|
|
847
824
|
borderWidth: "1px",
|
|
848
825
|
borderStyle: "solid",
|
|
849
|
-
borderColor: getReleaseColorVariant(release.
|
|
826
|
+
borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
|
|
850
827
|
overflow: "hidden",
|
|
851
828
|
hasRadius: true,
|
|
852
829
|
children: [
|
|
@@ -857,20 +834,20 @@ const CMReleasesContainer = () => {
|
|
|
857
834
|
paddingBottom: 3,
|
|
858
835
|
paddingLeft: 4,
|
|
859
836
|
paddingRight: 4,
|
|
860
|
-
background: getReleaseColorVariant(release.
|
|
837
|
+
background: getReleaseColorVariant(release.actions[0].type, "100"),
|
|
861
838
|
width: "100%",
|
|
862
839
|
children: /* @__PURE__ */ jsx(
|
|
863
840
|
Typography,
|
|
864
841
|
{
|
|
865
842
|
fontSize: 1,
|
|
866
843
|
variant: "pi",
|
|
867
|
-
textColor: getReleaseColorVariant(release.
|
|
844
|
+
textColor: getReleaseColorVariant(release.actions[0].type, "600"),
|
|
868
845
|
children: formatMessage(
|
|
869
846
|
{
|
|
870
847
|
id: "content-releases.content-manager-edit-view.list-releases.title",
|
|
871
848
|
defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
|
|
872
849
|
},
|
|
873
|
-
{ isPublish: release.
|
|
850
|
+
{ isPublish: release.actions[0].type === "publish" }
|
|
874
851
|
)
|
|
875
852
|
}
|
|
876
853
|
)
|
|
@@ -906,7 +883,7 @@ const CMReleasesContainer = () => {
|
|
|
906
883
|
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
907
884
|
{
|
|
908
885
|
releaseId: release.id,
|
|
909
|
-
actionId: release.
|
|
886
|
+
actionId: release.actions[0].id
|
|
910
887
|
}
|
|
911
888
|
)
|
|
912
889
|
] }) : null
|
|
@@ -933,18 +910,20 @@ const CMReleasesContainer = () => {
|
|
|
933
910
|
}
|
|
934
911
|
) : null
|
|
935
912
|
] }),
|
|
936
|
-
|
|
913
|
+
/* @__PURE__ */ jsx(
|
|
937
914
|
AddActionToReleaseModal,
|
|
938
915
|
{
|
|
939
|
-
|
|
916
|
+
open: isModalOpen,
|
|
917
|
+
onOpenChange: toggleModal,
|
|
940
918
|
contentTypeUid,
|
|
941
|
-
entryId
|
|
919
|
+
entryId
|
|
942
920
|
}
|
|
943
921
|
)
|
|
944
922
|
]
|
|
945
923
|
}
|
|
946
924
|
);
|
|
947
925
|
};
|
|
926
|
+
const pluginId = "content-releases";
|
|
948
927
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
949
928
|
if (!pluginId2) {
|
|
950
929
|
throw new TypeError("pluginId can't be empty");
|
|
@@ -957,6 +936,7 @@ const prefixPluginTranslations = (trad, pluginId2) => {
|
|
|
957
936
|
const admin = {
|
|
958
937
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
959
938
|
register(app) {
|
|
939
|
+
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
960
940
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
961
941
|
app.addMenuLink({
|
|
962
942
|
to: `plugins/${pluginId}`,
|
|
@@ -965,14 +945,11 @@ const admin = {
|
|
|
965
945
|
id: `${pluginId}.plugin.name`,
|
|
966
946
|
defaultMessage: "Releases"
|
|
967
947
|
},
|
|
968
|
-
Component: () => import("./App-
|
|
969
|
-
permissions: PERMISSIONS.main
|
|
970
|
-
|
|
971
|
-
app.addMiddlewares([() => releaseApi.middleware]);
|
|
972
|
-
app.addReducers({
|
|
973
|
-
[releaseApi.reducerPath]: releaseApi.reducer
|
|
948
|
+
Component: () => import("./App-B2R2exNT.mjs").then((mod) => ({ default: mod.App })),
|
|
949
|
+
permissions: PERMISSIONS.main,
|
|
950
|
+
position: 2
|
|
974
951
|
});
|
|
975
|
-
app.
|
|
952
|
+
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
976
953
|
name: `${pluginId}-link`,
|
|
977
954
|
Component: CMReleasesContainer
|
|
978
955
|
});
|
|
@@ -984,18 +961,20 @@ const admin = {
|
|
|
984
961
|
id: `${pluginId}.plugin.name`,
|
|
985
962
|
defaultMessage: "Releases"
|
|
986
963
|
},
|
|
964
|
+
permissions: [],
|
|
987
965
|
async Component() {
|
|
988
|
-
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-
|
|
989
|
-
return PurchaseContentReleases;
|
|
966
|
+
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-_MxP6-Dt.mjs");
|
|
967
|
+
return { default: PurchaseContentReleases };
|
|
990
968
|
},
|
|
991
|
-
|
|
969
|
+
licenseOnly: true,
|
|
970
|
+
position: 2
|
|
992
971
|
});
|
|
993
972
|
}
|
|
994
973
|
},
|
|
995
974
|
async registerTrads({ locales }) {
|
|
996
975
|
const importedTrads = await Promise.all(
|
|
997
976
|
locales.map((locale) => {
|
|
998
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-
|
|
977
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-B9Ur3VsE.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
999
978
|
return {
|
|
1000
979
|
data: prefixPluginTranslations(data, "content-releases"),
|
|
1001
980
|
locale
|
|
@@ -1022,11 +1001,10 @@ export {
|
|
|
1022
1001
|
useGetReleaseActionsQuery as f,
|
|
1023
1002
|
getTimezoneOffset as g,
|
|
1024
1003
|
useUpdateReleaseActionMutation as h,
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
admin as k,
|
|
1004
|
+
ReleaseActionMenu as i,
|
|
1005
|
+
admin as j,
|
|
1028
1006
|
pluginId as p,
|
|
1029
1007
|
releaseApi as r,
|
|
1030
1008
|
useGetReleasesQuery as u
|
|
1031
1009
|
};
|
|
1032
|
-
//# sourceMappingURL=index-
|
|
1010
|
+
//# sourceMappingURL=index-DbmynICx.mjs.map
|