@strapi/content-releases 5.0.0-beta.1 → 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-X01LBg5V.mjs → App-B2R2exNT.mjs} +245 -251
- package/dist/_chunks/App-B2R2exNT.mjs.map +1 -0
- package/dist/_chunks/{App-1LckaIGY.js → App-CEwOQkKT.js} +253 -260
- 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-cYWov2wa.js → index-BrWv-zV4.js} +167 -192
- package/dist/_chunks/index-BrWv-zV4.js.map +1 -0
- package/dist/_chunks/{index-OD9AlD-6.mjs → index-DbmynICx.mjs} +168 -191
- 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 +44 -308
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/dist/server/index.js +93 -32
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +93 -32
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +1 -1
- 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/destroy.d.ts +1 -1
- package/dist/server/src/destroy.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +9 -8
- 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 +1 -1
- 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 +4 -4
- package/dist/server/src/services/release.d.ts +3 -3
- package/dist/server/src/services/release.d.ts.map +1 -1
- package/dist/server/src/services/scheduling.d.ts +1 -1
- package/dist/server/src/services/scheduling.d.ts.map +1 -1
- package/dist/server/src/services/validation.d.ts +1 -1
- package/dist/server/src/services/validation.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +9 -9
- package/dist/server/src/utils/index.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/package.json +18 -18
- package/dist/_chunks/App-1LckaIGY.js.map +0 -1
- package/dist/_chunks/App-X01LBg5V.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-OD9AlD-6.mjs.map +0 -1
- package/dist/_chunks/index-cYWov2wa.js.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;
|
|
@@ -290,7 +267,8 @@ const releaseApi = createApi({
|
|
|
290
267
|
invalidatesTags: (result, error, arg) => [
|
|
291
268
|
{ type: "Release", id: "LIST" },
|
|
292
269
|
{ type: "Release", id: arg.params.releaseId },
|
|
293
|
-
{ type: "ReleaseAction", id: "LIST" }
|
|
270
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
271
|
+
{ type: "EntriesInRelease" }
|
|
294
272
|
]
|
|
295
273
|
}),
|
|
296
274
|
publishRelease: build.mutation({
|
|
@@ -309,7 +287,22 @@ const releaseApi = createApi({
|
|
|
309
287
|
method: "DELETE"
|
|
310
288
|
};
|
|
311
289
|
},
|
|
312
|
-
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" }]
|
|
313
306
|
})
|
|
314
307
|
};
|
|
315
308
|
}
|
|
@@ -321,11 +314,13 @@ const {
|
|
|
321
314
|
useGetReleaseActionsQuery,
|
|
322
315
|
useCreateReleaseMutation,
|
|
323
316
|
useCreateReleaseActionMutation,
|
|
317
|
+
useCreateManyReleaseActionsMutation,
|
|
324
318
|
useUpdateReleaseMutation,
|
|
325
319
|
useUpdateReleaseActionMutation,
|
|
326
320
|
usePublishReleaseMutation,
|
|
327
321
|
useDeleteReleaseActionMutation,
|
|
328
|
-
useDeleteReleaseMutation
|
|
322
|
+
useDeleteReleaseMutation,
|
|
323
|
+
useGetMappedEntriesInReleasesQuery
|
|
329
324
|
} = releaseApi;
|
|
330
325
|
const getTimezoneOffset = (timezone, date) => {
|
|
331
326
|
try {
|
|
@@ -345,12 +340,10 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
345
340
|
};
|
|
346
341
|
const StyledMenuItem = styled(Menu.Item)`
|
|
347
342
|
&:hover {
|
|
348
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
343
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
349
344
|
|
|
350
345
|
svg {
|
|
351
|
-
|
|
352
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
353
|
-
}
|
|
346
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
354
347
|
}
|
|
355
348
|
|
|
356
349
|
a {
|
|
@@ -359,9 +352,7 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
359
352
|
}
|
|
360
353
|
|
|
361
354
|
svg {
|
|
362
|
-
|
|
363
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
364
|
-
}
|
|
355
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
365
356
|
}
|
|
366
357
|
|
|
367
358
|
a {
|
|
@@ -373,10 +364,6 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
373
364
|
width: 100%;
|
|
374
365
|
}
|
|
375
366
|
`;
|
|
376
|
-
const StyledIconButton = styled(IconButton)`
|
|
377
|
-
/* Setting this style inline with borderColor will not apply the style */
|
|
378
|
-
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
379
|
-
`;
|
|
380
367
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
381
368
|
const { formatMessage } = useIntl();
|
|
382
369
|
const { toggleNotification } = useNotification();
|
|
@@ -400,7 +387,7 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
400
387
|
return;
|
|
401
388
|
}
|
|
402
389
|
if ("error" in response) {
|
|
403
|
-
if (
|
|
390
|
+
if (isFetchError(response.error)) {
|
|
404
391
|
toggleNotification({
|
|
405
392
|
type: "danger",
|
|
406
393
|
message: formatAPIError(response.error)
|
|
@@ -416,8 +403,8 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
416
403
|
if (!canDeleteAction) {
|
|
417
404
|
return null;
|
|
418
405
|
}
|
|
419
|
-
return /* @__PURE__ */ jsx(StyledMenuItem, { variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
420
|
-
/* @__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" }),
|
|
421
408
|
/* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
422
409
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
423
410
|
defaultMessage: "Remove from release"
|
|
@@ -441,7 +428,7 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
441
428
|
return Boolean(!locale || updatePermissions.properties?.locales?.includes(locale));
|
|
442
429
|
}, [contentTypeUid, locale, userPermissions]);
|
|
443
430
|
const {
|
|
444
|
-
allowedActions: { canUpdateContentType }
|
|
431
|
+
allowedActions: { canUpdate: canUpdateContentType }
|
|
445
432
|
} = useRBAC({
|
|
446
433
|
updateContentType: [
|
|
447
434
|
{
|
|
@@ -453,56 +440,54 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
453
440
|
if (!canUpdateContentType || !canUpdateEntryForLocale) {
|
|
454
441
|
return null;
|
|
455
442
|
}
|
|
456
|
-
return /* @__PURE__ */ jsx(
|
|
457
|
-
|
|
443
|
+
return /* @__PURE__ */ jsx(
|
|
444
|
+
StyledMenuItem,
|
|
458
445
|
{
|
|
459
|
-
|
|
446
|
+
tag: Link,
|
|
447
|
+
isLink: true,
|
|
460
448
|
to: {
|
|
461
449
|
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
462
450
|
search: locale && `?plugins[i18n][locale]=${locale}`
|
|
463
451
|
},
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
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
|
+
] })
|
|
469
459
|
}
|
|
470
|
-
)
|
|
460
|
+
);
|
|
471
461
|
};
|
|
472
462
|
const EditReleaseItem = ({ releaseId }) => {
|
|
473
463
|
const { formatMessage } = useIntl();
|
|
474
|
-
return
|
|
475
|
-
|
|
476
|
-
{
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
isExternal: false,
|
|
480
|
-
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({
|
|
481
469
|
id: "content-releases.content-manager-edit-view.edit-release",
|
|
482
470
|
defaultMessage: "Edit release"
|
|
483
471
|
}) })
|
|
484
|
-
}
|
|
485
|
-
)
|
|
472
|
+
] }) })
|
|
473
|
+
);
|
|
486
474
|
};
|
|
487
|
-
const Root = ({ children
|
|
475
|
+
const Root = ({ children }) => {
|
|
488
476
|
const { formatMessage } = useIntl();
|
|
489
477
|
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
490
478
|
return (
|
|
491
479
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
492
480
|
allowedActions.canDeleteAction || allowedActions.canUpdate ? /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
493
|
-
/* @__PURE__ */ jsx(
|
|
494
|
-
|
|
481
|
+
/* @__PURE__ */ jsx(Menu.Trigger, { paddingLeft: 2, paddingRight: 2, children: /* @__PURE__ */ jsx(
|
|
482
|
+
AccessibleIcon,
|
|
495
483
|
{
|
|
496
|
-
|
|
497
|
-
paddingLeft: 2,
|
|
498
|
-
paddingRight: 2,
|
|
499
|
-
"aria-label": formatMessage({
|
|
484
|
+
label: formatMessage({
|
|
500
485
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
501
486
|
defaultMessage: "Release action options"
|
|
502
487
|
}),
|
|
503
|
-
|
|
488
|
+
children: /* @__PURE__ */ jsx(More, {})
|
|
504
489
|
}
|
|
505
|
-
),
|
|
490
|
+
) }),
|
|
506
491
|
/* @__PURE__ */ jsx(Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
507
492
|
] }) : null
|
|
508
493
|
);
|
|
@@ -519,11 +504,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
519
504
|
const getBorderRightRadiusValue = (actionType) => {
|
|
520
505
|
return actionType === "publish" ? 0 : 1;
|
|
521
506
|
};
|
|
522
|
-
const FieldWrapper = styled(Field)`
|
|
523
|
-
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
524
|
-
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
525
|
-
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
526
|
-
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)]};
|
|
527
512
|
|
|
528
513
|
> label {
|
|
529
514
|
color: inherit;
|
|
@@ -534,14 +519,14 @@ const FieldWrapper = styled(Field)`
|
|
|
534
519
|
}
|
|
535
520
|
|
|
536
521
|
&[data-checked='true'] {
|
|
537
|
-
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
538
|
-
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
539
|
-
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};
|
|
540
525
|
}
|
|
541
526
|
|
|
542
527
|
&[data-checked='false'] {
|
|
543
|
-
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
544
|
-
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
528
|
+
border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
|
|
529
|
+
border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
|
|
545
530
|
}
|
|
546
531
|
|
|
547
532
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -570,7 +555,7 @@ const ActionOption = ({
|
|
|
570
555
|
return /* @__PURE__ */ jsx(
|
|
571
556
|
FieldWrapper,
|
|
572
557
|
{
|
|
573
|
-
actionType,
|
|
558
|
+
$actionType: actionType,
|
|
574
559
|
background: "primary0",
|
|
575
560
|
borderColor: "neutral200",
|
|
576
561
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -578,12 +563,11 @@ const ActionOption = ({
|
|
|
578
563
|
cursor: "pointer",
|
|
579
564
|
"data-checked": selected === actionType,
|
|
580
565
|
"data-disabled": disabled && selected !== actionType,
|
|
581
|
-
children: /* @__PURE__ */ jsxs(
|
|
566
|
+
children: /* @__PURE__ */ jsxs(Field.Label, { children: [
|
|
582
567
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(
|
|
583
|
-
|
|
568
|
+
Field.Input,
|
|
584
569
|
{
|
|
585
570
|
type: "radio",
|
|
586
|
-
id: `${name}-${actionType}`,
|
|
587
571
|
name,
|
|
588
572
|
checked: selected === actionType,
|
|
589
573
|
onChange: handleChange,
|
|
@@ -638,7 +622,7 @@ const NoReleases = () => {
|
|
|
638
622
|
return /* @__PURE__ */ jsx(
|
|
639
623
|
EmptyStateLayout,
|
|
640
624
|
{
|
|
641
|
-
icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "
|
|
625
|
+
icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "16rem" }),
|
|
642
626
|
content: formatMessage({
|
|
643
627
|
id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
|
|
644
628
|
defaultMessage: "No available releases. Open the list of releases and create a new one from there."
|
|
@@ -649,7 +633,7 @@ const NoReleases = () => {
|
|
|
649
633
|
to: {
|
|
650
634
|
pathname: "/plugins/content-releases"
|
|
651
635
|
},
|
|
652
|
-
|
|
636
|
+
tag: Link,
|
|
653
637
|
variant: "secondary",
|
|
654
638
|
children: formatMessage({
|
|
655
639
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -661,11 +645,11 @@ const NoReleases = () => {
|
|
|
661
645
|
);
|
|
662
646
|
};
|
|
663
647
|
const AddActionToReleaseModal = ({
|
|
664
|
-
|
|
648
|
+
open,
|
|
649
|
+
onOpenChange,
|
|
665
650
|
contentTypeUid,
|
|
666
651
|
entryId
|
|
667
652
|
}) => {
|
|
668
|
-
const releaseHeaderId = React.useId();
|
|
669
653
|
const { formatMessage } = useIntl();
|
|
670
654
|
const { toggleNotification } = useNotification();
|
|
671
655
|
const { formatAPIError } = useAPIErrorHandler();
|
|
@@ -696,11 +680,11 @@ const AddActionToReleaseModal = ({
|
|
|
696
680
|
defaultMessage: "Entry added to release"
|
|
697
681
|
})
|
|
698
682
|
});
|
|
699
|
-
|
|
683
|
+
onOpenChange();
|
|
700
684
|
return;
|
|
701
685
|
}
|
|
702
686
|
if ("error" in response2) {
|
|
703
|
-
if (
|
|
687
|
+
if (isFetchError(response2.error)) {
|
|
704
688
|
toggleNotification({
|
|
705
689
|
type: "danger",
|
|
706
690
|
message: formatAPIError(response2.error)
|
|
@@ -713,8 +697,8 @@ const AddActionToReleaseModal = ({
|
|
|
713
697
|
}
|
|
714
698
|
}
|
|
715
699
|
};
|
|
716
|
-
return /* @__PURE__ */
|
|
717
|
-
/* @__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({
|
|
718
702
|
id: "content-releases.content-manager-edit-view.add-to-release",
|
|
719
703
|
defaultMessage: "Add to release"
|
|
720
704
|
}) }) }),
|
|
@@ -726,25 +710,26 @@ const AddActionToReleaseModal = ({
|
|
|
726
710
|
initialValues: INITIAL_VALUES,
|
|
727
711
|
children: ({ values, setFieldValue }) => {
|
|
728
712
|
return /* @__PURE__ */ jsxs(Form, { children: [
|
|
729
|
-
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(
|
|
730
|
-
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
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({
|
|
748
733
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
749
734
|
defaultMessage: "What do you want to do with this entry?"
|
|
750
735
|
}) }),
|
|
@@ -757,39 +742,30 @@ const AddActionToReleaseModal = ({
|
|
|
757
742
|
}
|
|
758
743
|
)
|
|
759
744
|
] }) }),
|
|
760
|
-
/* @__PURE__ */
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
771
|
-
*/
|
|
772
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
773
|
-
id: "content-releases.content-manager-edit-view.add-to-release.continue-button",
|
|
774
|
-
defaultMessage: "Continue"
|
|
775
|
-
}) })
|
|
776
|
-
)
|
|
777
|
-
}
|
|
778
|
-
)
|
|
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
|
+
] })
|
|
779
755
|
] });
|
|
780
756
|
}
|
|
781
757
|
}
|
|
782
758
|
)
|
|
783
|
-
] });
|
|
759
|
+
] }) });
|
|
784
760
|
};
|
|
785
761
|
const CMReleasesContainer = () => {
|
|
786
762
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
787
763
|
const { formatMessage, formatDate, formatTime } = useIntl();
|
|
788
764
|
const { id, slug, collectionType } = useParams();
|
|
789
765
|
const isCreatingEntry = id === "create";
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
} =
|
|
766
|
+
const entryId = parseInt(id, 10);
|
|
767
|
+
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
768
|
+
const { canCreateAction, canRead: canMain, canDeleteAction } = allowedActions;
|
|
793
769
|
const { schema } = unstable_useDocument({
|
|
794
770
|
collectionType,
|
|
795
771
|
model: slug
|
|
@@ -799,7 +775,7 @@ const CMReleasesContainer = () => {
|
|
|
799
775
|
const canFetch = id != null && contentTypeUid != null;
|
|
800
776
|
const fetchParams = canFetch ? {
|
|
801
777
|
contentTypeUid,
|
|
802
|
-
entryId
|
|
778
|
+
entryId,
|
|
803
779
|
hasEntryAttached: true
|
|
804
780
|
} : skipToken;
|
|
805
781
|
const response = useGetReleasesForEntryQuery(fetchParams);
|
|
@@ -823,7 +799,7 @@ const CMReleasesContainer = () => {
|
|
|
823
799
|
return /* @__PURE__ */ jsxs(
|
|
824
800
|
Box,
|
|
825
801
|
{
|
|
826
|
-
|
|
802
|
+
tag: "aside",
|
|
827
803
|
"aria-label": formatMessage({
|
|
828
804
|
id: "content-releases.plugin.name",
|
|
829
805
|
defaultMessage: "Releases"
|
|
@@ -847,7 +823,7 @@ const CMReleasesContainer = () => {
|
|
|
847
823
|
alignItems: "start",
|
|
848
824
|
borderWidth: "1px",
|
|
849
825
|
borderStyle: "solid",
|
|
850
|
-
borderColor: getReleaseColorVariant(release.
|
|
826
|
+
borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
|
|
851
827
|
overflow: "hidden",
|
|
852
828
|
hasRadius: true,
|
|
853
829
|
children: [
|
|
@@ -858,20 +834,20 @@ const CMReleasesContainer = () => {
|
|
|
858
834
|
paddingBottom: 3,
|
|
859
835
|
paddingLeft: 4,
|
|
860
836
|
paddingRight: 4,
|
|
861
|
-
background: getReleaseColorVariant(release.
|
|
837
|
+
background: getReleaseColorVariant(release.actions[0].type, "100"),
|
|
862
838
|
width: "100%",
|
|
863
839
|
children: /* @__PURE__ */ jsx(
|
|
864
840
|
Typography,
|
|
865
841
|
{
|
|
866
842
|
fontSize: 1,
|
|
867
843
|
variant: "pi",
|
|
868
|
-
textColor: getReleaseColorVariant(release.
|
|
844
|
+
textColor: getReleaseColorVariant(release.actions[0].type, "600"),
|
|
869
845
|
children: formatMessage(
|
|
870
846
|
{
|
|
871
847
|
id: "content-releases.content-manager-edit-view.list-releases.title",
|
|
872
848
|
defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
|
|
873
849
|
},
|
|
874
|
-
{ isPublish: release.
|
|
850
|
+
{ isPublish: release.actions[0].type === "publish" }
|
|
875
851
|
)
|
|
876
852
|
}
|
|
877
853
|
)
|
|
@@ -907,7 +883,7 @@ const CMReleasesContainer = () => {
|
|
|
907
883
|
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
908
884
|
{
|
|
909
885
|
releaseId: release.id,
|
|
910
|
-
actionId: release.
|
|
886
|
+
actionId: release.actions[0].id
|
|
911
887
|
}
|
|
912
888
|
)
|
|
913
889
|
] }) : null
|
|
@@ -934,18 +910,20 @@ const CMReleasesContainer = () => {
|
|
|
934
910
|
}
|
|
935
911
|
) : null
|
|
936
912
|
] }),
|
|
937
|
-
|
|
913
|
+
/* @__PURE__ */ jsx(
|
|
938
914
|
AddActionToReleaseModal,
|
|
939
915
|
{
|
|
940
|
-
|
|
916
|
+
open: isModalOpen,
|
|
917
|
+
onOpenChange: toggleModal,
|
|
941
918
|
contentTypeUid,
|
|
942
|
-
entryId
|
|
919
|
+
entryId
|
|
943
920
|
}
|
|
944
921
|
)
|
|
945
922
|
]
|
|
946
923
|
}
|
|
947
924
|
);
|
|
948
925
|
};
|
|
926
|
+
const pluginId = "content-releases";
|
|
949
927
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
950
928
|
if (!pluginId2) {
|
|
951
929
|
throw new TypeError("pluginId can't be empty");
|
|
@@ -958,6 +936,7 @@ const prefixPluginTranslations = (trad, pluginId2) => {
|
|
|
958
936
|
const admin = {
|
|
959
937
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
960
938
|
register(app) {
|
|
939
|
+
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
961
940
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
962
941
|
app.addMenuLink({
|
|
963
942
|
to: `plugins/${pluginId}`,
|
|
@@ -966,14 +945,11 @@ const admin = {
|
|
|
966
945
|
id: `${pluginId}.plugin.name`,
|
|
967
946
|
defaultMessage: "Releases"
|
|
968
947
|
},
|
|
969
|
-
Component: () => import("./App-
|
|
970
|
-
permissions: PERMISSIONS.main
|
|
971
|
-
|
|
972
|
-
app.addMiddlewares([() => releaseApi.middleware]);
|
|
973
|
-
app.addReducers({
|
|
974
|
-
[releaseApi.reducerPath]: releaseApi.reducer
|
|
948
|
+
Component: () => import("./App-B2R2exNT.mjs").then((mod) => ({ default: mod.App })),
|
|
949
|
+
permissions: PERMISSIONS.main,
|
|
950
|
+
position: 2
|
|
975
951
|
});
|
|
976
|
-
app.
|
|
952
|
+
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
977
953
|
name: `${pluginId}-link`,
|
|
978
954
|
Component: CMReleasesContainer
|
|
979
955
|
});
|
|
@@ -985,18 +961,20 @@ const admin = {
|
|
|
985
961
|
id: `${pluginId}.plugin.name`,
|
|
986
962
|
defaultMessage: "Releases"
|
|
987
963
|
},
|
|
964
|
+
permissions: [],
|
|
988
965
|
async Component() {
|
|
989
|
-
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-
|
|
990
|
-
return PurchaseContentReleases;
|
|
966
|
+
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-_MxP6-Dt.mjs");
|
|
967
|
+
return { default: PurchaseContentReleases };
|
|
991
968
|
},
|
|
992
|
-
|
|
969
|
+
licenseOnly: true,
|
|
970
|
+
position: 2
|
|
993
971
|
});
|
|
994
972
|
}
|
|
995
973
|
},
|
|
996
974
|
async registerTrads({ locales }) {
|
|
997
975
|
const importedTrads = await Promise.all(
|
|
998
976
|
locales.map((locale) => {
|
|
999
|
-
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 }) => {
|
|
1000
978
|
return {
|
|
1001
979
|
data: prefixPluginTranslations(data, "content-releases"),
|
|
1002
980
|
locale
|
|
@@ -1023,11 +1001,10 @@ export {
|
|
|
1023
1001
|
useGetReleaseActionsQuery as f,
|
|
1024
1002
|
getTimezoneOffset as g,
|
|
1025
1003
|
useUpdateReleaseActionMutation as h,
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
admin as k,
|
|
1004
|
+
ReleaseActionMenu as i,
|
|
1005
|
+
admin as j,
|
|
1029
1006
|
pluginId as p,
|
|
1030
1007
|
releaseApi as r,
|
|
1031
1008
|
useGetReleasesQuery as u
|
|
1032
1009
|
};
|
|
1033
|
-
//# sourceMappingURL=index-
|
|
1010
|
+
//# sourceMappingURL=index-DbmynICx.mjs.map
|