@strapi/content-releases 0.0.0-experimental.ec089c69ff953942fb39de032c12daafaf7176e6 → 0.0.0-experimental.f75e3c6d67cc47c64ab37479efdbb7b43be50b78
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-HjWtUYmc.js → App-DUmziQ17.js} +401 -388
- package/dist/_chunks/App-DUmziQ17.js.map +1 -0
- package/dist/_chunks/{App-gu1aiP6i.mjs → App-D_6Y9N2F.mjs} +378 -364
- package/dist/_chunks/App-D_6Y9N2F.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-bpIYXOfu.js → PurchaseContentReleases-Be3acS2L.js} +7 -6
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-3tRbmbY3.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +8 -7
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-ltT1TlKQ.mjs → en-B9Ur3VsE.mjs} +1 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-HrREghh3.js → en-DtFJ5ViE.js} +1 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-mvj9PSKd.mjs → index-BomF0-yY.mjs} +180 -476
- package/dist/_chunks/index-BomF0-yY.mjs.map +1 -0
- package/dist/_chunks/{index-ZNwxYN8H.js → index-C5Hc767q.js} +177 -475
- package/dist/_chunks/index-C5Hc767q.js.map +1 -0
- package/dist/admin/index.js +1 -15
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +2 -16
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +22 -0
- package/dist/admin/src/components/RelativeTime.d.ts +28 -0
- package/dist/admin/src/components/ReleaseAction.d.ts +3 -0
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +26 -0
- package/dist/admin/src/components/ReleaseActionOptions.d.ts +9 -0
- package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +16 -0
- package/dist/admin/src/constants.d.ts +58 -0
- package/dist/admin/src/index.d.ts +3 -0
- package/dist/admin/src/pages/App.d.ts +1 -0
- package/dist/admin/src/pages/PurchaseContentReleases.d.ts +2 -0
- package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +2 -0
- package/dist/admin/src/pages/ReleasesPage.d.ts +8 -0
- package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +181 -0
- package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +39 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/services/release.d.ts +105 -0
- package/dist/admin/src/store/hooks.d.ts +7 -0
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
- package/dist/admin/src/utils/time.d.ts +1 -0
- package/dist/server/index.js +83 -86
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +84 -86
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/bootstrap.d.ts.map +1 -0
- package/dist/server/src/constants.d.ts +12 -0
- package/dist/server/src/constants.d.ts.map +1 -0
- package/dist/server/src/content-types/index.d.ts +99 -0
- package/dist/server/src/content-types/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/index.d.ts +48 -0
- package/dist/server/src/content-types/release/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/schema.d.ts +47 -0
- package/dist/server/src/content-types/release/schema.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/index.d.ts +50 -0
- package/dist/server/src/content-types/release-action/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/schema.d.ts +49 -0
- package/dist/server/src/content-types/release-action/schema.d.ts.map +1 -0
- package/dist/server/src/controllers/index.d.ts +20 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -0
- package/dist/server/src/controllers/release-action.d.ts +10 -0
- package/dist/server/src/controllers/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/release.d.ts +12 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release-action.d.ts +8 -0
- package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release.d.ts +2 -0
- package/dist/server/src/controllers/validation/release.d.ts.map +1 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/destroy.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +2096 -0
- package/dist/server/src/index.d.ts.map +1 -0
- package/dist/server/src/migrations/index.d.ts +13 -0
- package/dist/server/src/migrations/index.d.ts.map +1 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/register.d.ts.map +1 -0
- package/dist/server/src/routes/index.d.ts +35 -0
- package/dist/server/src/routes/index.d.ts.map +1 -0
- package/dist/server/src/routes/release-action.d.ts +18 -0
- package/dist/server/src/routes/release-action.d.ts.map +1 -0
- package/dist/server/src/routes/release.d.ts +18 -0
- package/dist/server/src/routes/release.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +1826 -0
- package/dist/server/src/services/index.d.ts.map +1 -0
- package/dist/server/src/services/release.d.ts +66 -0
- package/dist/server/src/services/release.d.ts.map +1 -0
- package/dist/server/src/services/scheduling.d.ts +18 -0
- package/dist/server/src/services/scheduling.d.ts.map +1 -0
- package/dist/server/src/services/validation.d.ts +18 -0
- package/dist/server/src/services/validation.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +14 -0
- package/dist/server/src/utils/index.d.ts.map +1 -0
- package/dist/shared/contracts/release-actions.d.ts +131 -0
- package/dist/shared/contracts/release-actions.d.ts.map +1 -0
- package/dist/shared/contracts/releases.d.ts +182 -0
- package/dist/shared/contracts/releases.d.ts.map +1 -0
- package/dist/shared/types.d.ts +24 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/validation-schemas.d.ts +2 -0
- package/dist/shared/validation-schemas.d.ts.map +1 -0
- package/package.json +29 -36
- package/dist/_chunks/App-HjWtUYmc.js.map +0 -1
- package/dist/_chunks/App-gu1aiP6i.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +0 -1
- package/dist/_chunks/en-HrREghh3.js.map +0 -1
- package/dist/_chunks/en-ltT1TlKQ.mjs.map +0 -1
- package/dist/_chunks/index-ZNwxYN8H.js.map +0 -1
- package/dist/_chunks/index-mvj9PSKd.mjs.map +0 -1
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { getFetchClient, useNotification, useAPIErrorHandler, CheckPermissions, useCMEditViewDataManager, NoContent, useRBAC, SortIcon, prefixPluginTranslations } from "@strapi/helper-plugin";
|
|
2
1
|
import { Cross, Pencil, More, Plus, PaperPlane } from "@strapi/icons";
|
|
3
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
3
|
import * as React from "react";
|
|
5
4
|
import { skipToken } from "@reduxjs/toolkit/query";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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, ModalLayout, ModalHeader, ModalBody, SingleSelect, SingleSelectOption, ModalFooter, 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";
|
|
15
|
-
import { useDispatch, useSelector } from "react-redux";
|
|
13
|
+
import { styled } from "styled-components";
|
|
16
14
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
17
15
|
const v = glob[path];
|
|
18
16
|
if (v) {
|
|
@@ -94,49 +92,9 @@ const PERMISSIONS = {
|
|
|
94
92
|
}
|
|
95
93
|
]
|
|
96
94
|
};
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
method,
|
|
101
|
-
data,
|
|
102
|
-
config
|
|
103
|
-
}) => {
|
|
104
|
-
try {
|
|
105
|
-
const { get, post, del, put } = getFetchClient();
|
|
106
|
-
if (method === "POST") {
|
|
107
|
-
const result2 = await post(url, data, config);
|
|
108
|
-
return { data: result2.data };
|
|
109
|
-
}
|
|
110
|
-
if (method === "DELETE") {
|
|
111
|
-
const result2 = await del(url, config);
|
|
112
|
-
return { data: result2.data };
|
|
113
|
-
}
|
|
114
|
-
if (method === "PUT") {
|
|
115
|
-
const result2 = await put(url, data, config);
|
|
116
|
-
return { data: result2.data };
|
|
117
|
-
}
|
|
118
|
-
const result = await get(url, config);
|
|
119
|
-
return { data: result.data };
|
|
120
|
-
} catch (error) {
|
|
121
|
-
const err = error;
|
|
122
|
-
return {
|
|
123
|
-
error: {
|
|
124
|
-
status: err.response?.status,
|
|
125
|
-
code: err.code,
|
|
126
|
-
response: {
|
|
127
|
-
data: err.response?.data
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
const isAxiosError = (err) => {
|
|
134
|
-
return typeof err === "object" && err !== null && "response" in err && typeof err.response === "object" && err.response !== null && "data" in err.response;
|
|
135
|
-
};
|
|
136
|
-
const releaseApi = createApi({
|
|
137
|
-
reducerPath: pluginId,
|
|
138
|
-
baseQuery: axiosBaseQuery,
|
|
139
|
-
tagTypes: ["Release", "ReleaseAction", "EntriesInRelease"],
|
|
95
|
+
const releaseApi = adminApi.enhanceEndpoints({
|
|
96
|
+
addTagTypes: ["Release", "ReleaseAction", "EntriesInRelease"]
|
|
97
|
+
}).injectEndpoints({
|
|
140
98
|
endpoints: (build) => {
|
|
141
99
|
return {
|
|
142
100
|
getReleasesForEntry: build.query({
|
|
@@ -280,13 +238,17 @@ const releaseApi = createApi({
|
|
|
280
238
|
...query
|
|
281
239
|
};
|
|
282
240
|
const patchResult = dispatch(
|
|
283
|
-
releaseApi.util.updateQueryData(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
241
|
+
releaseApi.util.updateQueryData(
|
|
242
|
+
"getReleaseActions",
|
|
243
|
+
paramsWithoutActionId,
|
|
244
|
+
(draft) => {
|
|
245
|
+
const [key, index] = actionPath;
|
|
246
|
+
const action = draft.data[key][index];
|
|
247
|
+
if (action) {
|
|
248
|
+
action.type = body.type;
|
|
249
|
+
}
|
|
288
250
|
}
|
|
289
|
-
|
|
251
|
+
)
|
|
290
252
|
);
|
|
291
253
|
try {
|
|
292
254
|
await queryFulfilled;
|
|
@@ -376,16 +338,12 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
376
338
|
return "";
|
|
377
339
|
}
|
|
378
340
|
};
|
|
379
|
-
const useTypedDispatch = useDispatch;
|
|
380
|
-
const useTypedSelector = useSelector;
|
|
381
341
|
const StyledMenuItem = styled(Menu.Item)`
|
|
382
342
|
&:hover {
|
|
383
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
343
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
384
344
|
|
|
385
345
|
svg {
|
|
386
|
-
|
|
387
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
388
|
-
}
|
|
346
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
389
347
|
}
|
|
390
348
|
|
|
391
349
|
a {
|
|
@@ -394,9 +352,7 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
394
352
|
}
|
|
395
353
|
|
|
396
354
|
svg {
|
|
397
|
-
|
|
398
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
399
|
-
}
|
|
355
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
400
356
|
}
|
|
401
357
|
|
|
402
358
|
a {
|
|
@@ -408,15 +364,14 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
408
364
|
width: 100%;
|
|
409
365
|
}
|
|
410
366
|
`;
|
|
411
|
-
const StyledIconButton = styled(IconButton)`
|
|
412
|
-
/* Setting this style inline with borderColor will not apply the style */
|
|
413
|
-
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
414
|
-
`;
|
|
415
367
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
416
368
|
const { formatMessage } = useIntl();
|
|
417
|
-
const toggleNotification = useNotification();
|
|
369
|
+
const { toggleNotification } = useNotification();
|
|
418
370
|
const { formatAPIError } = useAPIErrorHandler();
|
|
419
371
|
const [deleteReleaseAction] = useDeleteReleaseActionMutation();
|
|
372
|
+
const {
|
|
373
|
+
allowedActions: { canDeleteAction }
|
|
374
|
+
} = useRBAC(PERMISSIONS);
|
|
420
375
|
const handleDeleteAction = async () => {
|
|
421
376
|
const response = await deleteReleaseAction({
|
|
422
377
|
params: { releaseId, actionId }
|
|
@@ -432,26 +387,29 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
432
387
|
return;
|
|
433
388
|
}
|
|
434
389
|
if ("error" in response) {
|
|
435
|
-
if (
|
|
390
|
+
if (isFetchError(response.error)) {
|
|
436
391
|
toggleNotification({
|
|
437
|
-
type: "
|
|
392
|
+
type: "danger",
|
|
438
393
|
message: formatAPIError(response.error)
|
|
439
394
|
});
|
|
440
395
|
} else {
|
|
441
396
|
toggleNotification({
|
|
442
|
-
type: "
|
|
397
|
+
type: "danger",
|
|
443
398
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
444
399
|
});
|
|
445
400
|
}
|
|
446
401
|
}
|
|
447
402
|
};
|
|
448
|
-
|
|
449
|
-
|
|
403
|
+
if (!canDeleteAction) {
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
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" }),
|
|
450
408
|
/* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
451
409
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
452
410
|
defaultMessage: "Remove from release"
|
|
453
411
|
}) })
|
|
454
|
-
] }) })
|
|
412
|
+
] }) });
|
|
455
413
|
};
|
|
456
414
|
const ReleaseActionEntryLinkItem = ({
|
|
457
415
|
contentTypeUid,
|
|
@@ -459,77 +417,79 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
459
417
|
locale
|
|
460
418
|
}) => {
|
|
461
419
|
const { formatMessage } = useIntl();
|
|
462
|
-
const
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
!
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
420
|
+
const userPermissions = useAuth("ReleaseActionEntryLinkItem", (state) => state.permissions);
|
|
421
|
+
const canUpdateEntryForLocale = React.useMemo(() => {
|
|
422
|
+
const updatePermissions = userPermissions.find(
|
|
423
|
+
(permission) => permission.subject === contentTypeUid && permission.action === "plugin::content-manager.explorer.update"
|
|
424
|
+
);
|
|
425
|
+
if (!updatePermissions) {
|
|
426
|
+
return false;
|
|
427
|
+
}
|
|
428
|
+
return Boolean(!locale || updatePermissions.properties?.locales?.includes(locale));
|
|
429
|
+
}, [contentTypeUid, locale, userPermissions]);
|
|
430
|
+
const {
|
|
431
|
+
allowedActions: { canUpdate: canUpdateContentType }
|
|
432
|
+
} = useRBAC({
|
|
433
|
+
updateContentType: [
|
|
434
|
+
{
|
|
435
|
+
action: "plugin::content-manager.explorer.update",
|
|
436
|
+
subject: contentTypeUid
|
|
437
|
+
}
|
|
438
|
+
]
|
|
439
|
+
});
|
|
440
|
+
if (!canUpdateContentType || !canUpdateEntryForLocale) {
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
471
443
|
return /* @__PURE__ */ jsx(
|
|
472
|
-
|
|
444
|
+
StyledMenuItem,
|
|
473
445
|
{
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
children:
|
|
481
|
-
|
|
482
|
-
{
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
},
|
|
488
|
-
startIcon: /* @__PURE__ */ jsx(Icon, { as: Pencil, width: 3, height: 3 }),
|
|
489
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatMessage({
|
|
490
|
-
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
491
|
-
defaultMessage: "Edit entry"
|
|
492
|
-
}) })
|
|
493
|
-
}
|
|
494
|
-
) })
|
|
446
|
+
tag: Link,
|
|
447
|
+
isLink: true,
|
|
448
|
+
to: {
|
|
449
|
+
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
450
|
+
search: locale && `?plugins[i18n][locale]=${locale}`
|
|
451
|
+
},
|
|
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
|
+
] })
|
|
495
459
|
}
|
|
496
460
|
);
|
|
497
461
|
};
|
|
498
462
|
const EditReleaseItem = ({ releaseId }) => {
|
|
499
463
|
const { formatMessage } = useIntl();
|
|
500
|
-
return
|
|
501
|
-
|
|
502
|
-
{
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
isExternal: false,
|
|
506
|
-
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({
|
|
507
469
|
id: "content-releases.content-manager-edit-view.edit-release",
|
|
508
470
|
defaultMessage: "Edit release"
|
|
509
471
|
}) })
|
|
510
|
-
}
|
|
511
|
-
)
|
|
472
|
+
] }) })
|
|
473
|
+
);
|
|
512
474
|
};
|
|
513
|
-
const Root = ({ children
|
|
475
|
+
const Root = ({ children }) => {
|
|
514
476
|
const { formatMessage } = useIntl();
|
|
477
|
+
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
515
478
|
return (
|
|
516
479
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
517
|
-
|
|
518
|
-
/* @__PURE__ */ jsx(
|
|
519
|
-
|
|
480
|
+
allowedActions.canDeleteAction || allowedActions.canUpdate ? /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
481
|
+
/* @__PURE__ */ jsx(Menu.Trigger, { paddingLeft: 2, paddingRight: 2, children: /* @__PURE__ */ jsx(
|
|
482
|
+
AccessibleIcon,
|
|
520
483
|
{
|
|
521
|
-
|
|
522
|
-
paddingLeft: 2,
|
|
523
|
-
paddingRight: 2,
|
|
524
|
-
"aria-label": formatMessage({
|
|
484
|
+
label: formatMessage({
|
|
525
485
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
526
486
|
defaultMessage: "Release action options"
|
|
527
487
|
}),
|
|
528
|
-
|
|
488
|
+
children: /* @__PURE__ */ jsx(More, {})
|
|
529
489
|
}
|
|
530
|
-
),
|
|
490
|
+
) }),
|
|
531
491
|
/* @__PURE__ */ jsx(Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
532
|
-
] })
|
|
492
|
+
] }) : null
|
|
533
493
|
);
|
|
534
494
|
};
|
|
535
495
|
const ReleaseActionMenu = {
|
|
@@ -544,11 +504,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
544
504
|
const getBorderRightRadiusValue = (actionType) => {
|
|
545
505
|
return actionType === "publish" ? 0 : 1;
|
|
546
506
|
};
|
|
547
|
-
const FieldWrapper = styled(Field)`
|
|
548
|
-
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
549
|
-
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
550
|
-
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
551
|
-
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)]};
|
|
552
512
|
|
|
553
513
|
> label {
|
|
554
514
|
color: inherit;
|
|
@@ -559,14 +519,14 @@ const FieldWrapper = styled(Field)`
|
|
|
559
519
|
}
|
|
560
520
|
|
|
561
521
|
&[data-checked='true'] {
|
|
562
|
-
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
563
|
-
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
564
|
-
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};
|
|
565
525
|
}
|
|
566
526
|
|
|
567
527
|
&[data-checked='false'] {
|
|
568
|
-
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
569
|
-
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
528
|
+
border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
|
|
529
|
+
border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
|
|
570
530
|
}
|
|
571
531
|
|
|
572
532
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -595,7 +555,7 @@ const ActionOption = ({
|
|
|
595
555
|
return /* @__PURE__ */ jsx(
|
|
596
556
|
FieldWrapper,
|
|
597
557
|
{
|
|
598
|
-
actionType,
|
|
558
|
+
$actionType: actionType,
|
|
599
559
|
background: "primary0",
|
|
600
560
|
borderColor: "neutral200",
|
|
601
561
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -603,12 +563,11 @@ const ActionOption = ({
|
|
|
603
563
|
cursor: "pointer",
|
|
604
564
|
"data-checked": selected === actionType,
|
|
605
565
|
"data-disabled": disabled && selected !== actionType,
|
|
606
|
-
children: /* @__PURE__ */ jsxs(
|
|
566
|
+
children: /* @__PURE__ */ jsxs(Field.Label, { children: [
|
|
607
567
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(
|
|
608
|
-
|
|
568
|
+
Field.Input,
|
|
609
569
|
{
|
|
610
570
|
type: "radio",
|
|
611
|
-
id: `${name}-${actionType}`,
|
|
612
571
|
name,
|
|
613
572
|
checked: selected === actionType,
|
|
614
573
|
onChange: handleChange,
|
|
@@ -661,19 +620,20 @@ const INITIAL_VALUES = {
|
|
|
661
620
|
const NoReleases = () => {
|
|
662
621
|
const { formatMessage } = useIntl();
|
|
663
622
|
return /* @__PURE__ */ jsx(
|
|
664
|
-
|
|
623
|
+
EmptyStateLayout,
|
|
665
624
|
{
|
|
666
|
-
|
|
625
|
+
icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "16rem" }),
|
|
626
|
+
content: formatMessage({
|
|
667
627
|
id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
|
|
668
628
|
defaultMessage: "No available releases. Open the list of releases and create a new one from there."
|
|
669
|
-
},
|
|
629
|
+
}),
|
|
670
630
|
action: /* @__PURE__ */ jsx(
|
|
671
631
|
LinkButton,
|
|
672
632
|
{
|
|
673
633
|
to: {
|
|
674
634
|
pathname: "/plugins/content-releases"
|
|
675
635
|
},
|
|
676
|
-
|
|
636
|
+
tag: Link,
|
|
677
637
|
variant: "secondary",
|
|
678
638
|
children: formatMessage({
|
|
679
639
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -691,9 +651,10 @@ const AddActionToReleaseModal = ({
|
|
|
691
651
|
}) => {
|
|
692
652
|
const releaseHeaderId = React.useId();
|
|
693
653
|
const { formatMessage } = useIntl();
|
|
694
|
-
const toggleNotification = useNotification();
|
|
654
|
+
const { toggleNotification } = useNotification();
|
|
695
655
|
const { formatAPIError } = useAPIErrorHandler();
|
|
696
|
-
const {
|
|
656
|
+
const [{ query }] = useQueryParams();
|
|
657
|
+
const locale = query.plugins?.i18n?.locale;
|
|
697
658
|
const response = useGetReleasesForEntryQuery({
|
|
698
659
|
contentTypeUid,
|
|
699
660
|
entryId,
|
|
@@ -702,7 +663,6 @@ const AddActionToReleaseModal = ({
|
|
|
702
663
|
const releases = response.data?.data;
|
|
703
664
|
const [createReleaseAction, { isLoading }] = useCreateReleaseActionMutation();
|
|
704
665
|
const handleSubmit = async (values) => {
|
|
705
|
-
const locale = modifiedData.locale;
|
|
706
666
|
const releaseActionEntry = {
|
|
707
667
|
contentType: contentTypeUid,
|
|
708
668
|
id: entryId,
|
|
@@ -724,14 +684,14 @@ const AddActionToReleaseModal = ({
|
|
|
724
684
|
return;
|
|
725
685
|
}
|
|
726
686
|
if ("error" in response2) {
|
|
727
|
-
if (
|
|
687
|
+
if (isFetchError(response2.error)) {
|
|
728
688
|
toggleNotification({
|
|
729
|
-
type: "
|
|
689
|
+
type: "danger",
|
|
730
690
|
message: formatAPIError(response2.error)
|
|
731
691
|
});
|
|
732
692
|
} else {
|
|
733
693
|
toggleNotification({
|
|
734
|
-
type: "
|
|
694
|
+
type: "danger",
|
|
735
695
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
736
696
|
});
|
|
737
697
|
}
|
|
@@ -751,24 +711,25 @@ const AddActionToReleaseModal = ({
|
|
|
751
711
|
children: ({ values, setFieldValue }) => {
|
|
752
712
|
return /* @__PURE__ */ jsxs(Form, { children: [
|
|
753
713
|
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
754
|
-
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
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({
|
|
772
733
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
773
734
|
defaultMessage: "What do you want to do with this entry?"
|
|
774
735
|
}) }),
|
|
@@ -784,7 +745,7 @@ const AddActionToReleaseModal = ({
|
|
|
784
745
|
/* @__PURE__ */ jsx(
|
|
785
746
|
ModalFooter,
|
|
786
747
|
{
|
|
787
|
-
startActions: /* @__PURE__ */ jsx(Button
|
|
748
|
+
startActions: /* @__PURE__ */ jsx(Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({
|
|
788
749
|
id: "content-releases.content-manager-edit-view.add-to-release.cancel-button",
|
|
789
750
|
defaultMessage: "Cancel"
|
|
790
751
|
}) }),
|
|
@@ -793,7 +754,7 @@ const AddActionToReleaseModal = ({
|
|
|
793
754
|
* TODO: Ideally we would use isValid from Formik to disable the button, however currently it always returns true
|
|
794
755
|
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
795
756
|
*/
|
|
796
|
-
/* @__PURE__ */ jsx(Button
|
|
757
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
797
758
|
id: "content-releases.content-manager-edit-view.add-to-release.continue-button",
|
|
798
759
|
defaultMessage: "Continue"
|
|
799
760
|
}) })
|
|
@@ -809,14 +770,18 @@ const AddActionToReleaseModal = ({
|
|
|
809
770
|
const CMReleasesContainer = () => {
|
|
810
771
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
811
772
|
const { formatMessage, formatDate, formatTime } = useIntl();
|
|
812
|
-
const {
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
} =
|
|
773
|
+
const { id, slug, collectionType } = useParams();
|
|
774
|
+
const isCreatingEntry = id === "create";
|
|
775
|
+
const entryId = parseInt(id, 10);
|
|
776
|
+
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
777
|
+
const { canCreateAction, canRead: canMain, canDeleteAction } = allowedActions;
|
|
778
|
+
const { schema } = unstable_useDocument({
|
|
779
|
+
collectionType,
|
|
780
|
+
model: slug
|
|
781
|
+
});
|
|
782
|
+
const hasDraftAndPublish = schema?.options?.draftAndPublish;
|
|
818
783
|
const contentTypeUid = slug;
|
|
819
|
-
const canFetch =
|
|
784
|
+
const canFetch = id != null && contentTypeUid != null;
|
|
820
785
|
const fetchParams = canFetch ? {
|
|
821
786
|
contentTypeUid,
|
|
822
787
|
entryId,
|
|
@@ -837,10 +802,13 @@ const CMReleasesContainer = () => {
|
|
|
837
802
|
}
|
|
838
803
|
return `success${shade}`;
|
|
839
804
|
};
|
|
840
|
-
|
|
805
|
+
if (!canMain) {
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
return /* @__PURE__ */ jsxs(
|
|
841
809
|
Box,
|
|
842
810
|
{
|
|
843
|
-
|
|
811
|
+
tag: "aside",
|
|
844
812
|
"aria-label": formatMessage({
|
|
845
813
|
id: "content-releases.plugin.name",
|
|
846
814
|
defaultMessage: "Releases"
|
|
@@ -894,7 +862,7 @@ const CMReleasesContainer = () => {
|
|
|
894
862
|
)
|
|
895
863
|
}
|
|
896
864
|
),
|
|
897
|
-
/* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
865
|
+
/* @__PURE__ */ jsx(Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: /* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
898
866
|
/* @__PURE__ */ jsx(Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
899
867
|
release.scheduledAt && release.timezone && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
900
868
|
{
|
|
@@ -918,7 +886,7 @@ const CMReleasesContainer = () => {
|
|
|
918
886
|
)
|
|
919
887
|
}
|
|
920
888
|
) }),
|
|
921
|
-
|
|
889
|
+
canDeleteAction ? /* @__PURE__ */ jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
|
|
922
890
|
/* @__PURE__ */ jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
|
|
923
891
|
/* @__PURE__ */ jsx(
|
|
924
892
|
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
@@ -927,15 +895,15 @@ const CMReleasesContainer = () => {
|
|
|
927
895
|
actionId: release.actions[0].id
|
|
928
896
|
}
|
|
929
897
|
)
|
|
930
|
-
] })
|
|
931
|
-
] })
|
|
898
|
+
] }) : null
|
|
899
|
+
] }) })
|
|
932
900
|
]
|
|
933
901
|
},
|
|
934
902
|
release.id
|
|
935
903
|
);
|
|
936
904
|
}),
|
|
937
|
-
|
|
938
|
-
Button
|
|
905
|
+
canCreateAction ? /* @__PURE__ */ jsx(
|
|
906
|
+
Button,
|
|
939
907
|
{
|
|
940
908
|
justifyContent: "center",
|
|
941
909
|
paddingLeft: 4,
|
|
@@ -949,7 +917,7 @@ const CMReleasesContainer = () => {
|
|
|
949
917
|
defaultMessage: "Add to release"
|
|
950
918
|
})
|
|
951
919
|
}
|
|
952
|
-
)
|
|
920
|
+
) : null
|
|
953
921
|
] }),
|
|
954
922
|
isModalOpen && /* @__PURE__ */ jsx(
|
|
955
923
|
AddActionToReleaseModal,
|
|
@@ -961,269 +929,17 @@ const CMReleasesContainer = () => {
|
|
|
961
929
|
)
|
|
962
930
|
]
|
|
963
931
|
}
|
|
964
|
-
) });
|
|
965
|
-
};
|
|
966
|
-
const getContentPermissions = (subject) => {
|
|
967
|
-
const permissions = {
|
|
968
|
-
publish: [
|
|
969
|
-
{
|
|
970
|
-
action: "plugin::content-manager.explorer.publish",
|
|
971
|
-
subject,
|
|
972
|
-
id: "",
|
|
973
|
-
actionParameters: {},
|
|
974
|
-
properties: {},
|
|
975
|
-
conditions: []
|
|
976
|
-
}
|
|
977
|
-
]
|
|
978
|
-
};
|
|
979
|
-
return permissions;
|
|
980
|
-
};
|
|
981
|
-
const ReleaseAction = ({ ids, model }) => {
|
|
982
|
-
const { formatMessage } = useIntl();
|
|
983
|
-
const toggleNotification = useNotification();
|
|
984
|
-
const { formatAPIError } = useAPIErrorHandler();
|
|
985
|
-
const { modifiedData } = useCMEditViewDataManager();
|
|
986
|
-
const contentPermissions = getContentPermissions(model);
|
|
987
|
-
const {
|
|
988
|
-
allowedActions: { canPublish }
|
|
989
|
-
} = useRBAC(contentPermissions);
|
|
990
|
-
const {
|
|
991
|
-
allowedActions: { canCreate }
|
|
992
|
-
} = useRBAC(PERMISSIONS);
|
|
993
|
-
const response = useGetReleasesQuery();
|
|
994
|
-
const releases = response.data?.data;
|
|
995
|
-
const [createManyReleaseActions, { isLoading }] = useCreateManyReleaseActionsMutation();
|
|
996
|
-
const handleSubmit = async (values) => {
|
|
997
|
-
const locale = modifiedData.locale;
|
|
998
|
-
const releaseActionEntries = ids.map((id) => ({
|
|
999
|
-
type: values.type,
|
|
1000
|
-
entry: {
|
|
1001
|
-
contentType: model,
|
|
1002
|
-
id,
|
|
1003
|
-
locale
|
|
1004
|
-
}
|
|
1005
|
-
}));
|
|
1006
|
-
const response2 = await createManyReleaseActions({
|
|
1007
|
-
body: releaseActionEntries,
|
|
1008
|
-
params: { releaseId: values.releaseId }
|
|
1009
|
-
});
|
|
1010
|
-
if ("data" in response2) {
|
|
1011
|
-
const notificationMessage = formatMessage(
|
|
1012
|
-
{
|
|
1013
|
-
id: "content-releases.content-manager-list-view.add-to-release.notification.success.message",
|
|
1014
|
-
defaultMessage: "{entriesAlreadyInRelease} out of {totalEntries} entries were already in the release."
|
|
1015
|
-
},
|
|
1016
|
-
{
|
|
1017
|
-
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1018
|
-
totalEntries: response2.data.meta.totalEntries
|
|
1019
|
-
}
|
|
1020
|
-
);
|
|
1021
|
-
const notification = {
|
|
1022
|
-
type: "success",
|
|
1023
|
-
title: formatMessage(
|
|
1024
|
-
{
|
|
1025
|
-
id: "content-releases.content-manager-list-view.add-to-release.notification.success.title",
|
|
1026
|
-
defaultMessage: "Successfully added to release."
|
|
1027
|
-
},
|
|
1028
|
-
{
|
|
1029
|
-
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1030
|
-
totalEntries: response2.data.meta.totalEntries
|
|
1031
|
-
}
|
|
1032
|
-
),
|
|
1033
|
-
message: response2.data.meta.entriesAlreadyInRelease ? notificationMessage : ""
|
|
1034
|
-
};
|
|
1035
|
-
toggleNotification(notification);
|
|
1036
|
-
return true;
|
|
1037
|
-
}
|
|
1038
|
-
if ("error" in response2) {
|
|
1039
|
-
if (isAxiosError$1(response2.error)) {
|
|
1040
|
-
toggleNotification({
|
|
1041
|
-
type: "warning",
|
|
1042
|
-
message: formatAPIError(response2.error)
|
|
1043
|
-
});
|
|
1044
|
-
} else {
|
|
1045
|
-
toggleNotification({
|
|
1046
|
-
type: "warning",
|
|
1047
|
-
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
};
|
|
1052
|
-
if (!canCreate || !canPublish)
|
|
1053
|
-
return null;
|
|
1054
|
-
return {
|
|
1055
|
-
actionType: "release",
|
|
1056
|
-
variant: "tertiary",
|
|
1057
|
-
label: formatMessage({
|
|
1058
|
-
id: "content-manager-list-view.add-to-release",
|
|
1059
|
-
defaultMessage: "Add to Release"
|
|
1060
|
-
}),
|
|
1061
|
-
dialog: {
|
|
1062
|
-
type: "modal",
|
|
1063
|
-
title: formatMessage({
|
|
1064
|
-
id: "content-manager-list-view.add-to-release",
|
|
1065
|
-
defaultMessage: "Add to Release"
|
|
1066
|
-
}),
|
|
1067
|
-
content: ({ onClose }) => {
|
|
1068
|
-
return /* @__PURE__ */ jsx(
|
|
1069
|
-
Formik,
|
|
1070
|
-
{
|
|
1071
|
-
onSubmit: async (values) => {
|
|
1072
|
-
const data = await handleSubmit(values);
|
|
1073
|
-
if (data) {
|
|
1074
|
-
return onClose();
|
|
1075
|
-
}
|
|
1076
|
-
},
|
|
1077
|
-
validationSchema: RELEASE_ACTION_FORM_SCHEMA,
|
|
1078
|
-
initialValues: INITIAL_VALUES,
|
|
1079
|
-
children: ({ values, setFieldValue }) => /* @__PURE__ */ jsxs(Form, { children: [
|
|
1080
|
-
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
1081
|
-
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */ jsx(
|
|
1082
|
-
SingleSelect,
|
|
1083
|
-
{
|
|
1084
|
-
required: true,
|
|
1085
|
-
label: formatMessage({
|
|
1086
|
-
id: "content-releases.content-manager-list-view.add-to-release.select-label",
|
|
1087
|
-
defaultMessage: "Select a release"
|
|
1088
|
-
}),
|
|
1089
|
-
placeholder: formatMessage({
|
|
1090
|
-
id: "content-releases.content-manager-list-view.add-to-release.select-placeholder",
|
|
1091
|
-
defaultMessage: "Select"
|
|
1092
|
-
}),
|
|
1093
|
-
onChange: (value) => setFieldValue("releaseId", value),
|
|
1094
|
-
value: values.releaseId,
|
|
1095
|
-
children: releases?.map((release) => /* @__PURE__ */ jsx(SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
1096
|
-
}
|
|
1097
|
-
) }),
|
|
1098
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: formatMessage({
|
|
1099
|
-
id: "content-releases.content-manager-list-view.add-to-release.action-type-label",
|
|
1100
|
-
defaultMessage: "What do you want to do with these entries?"
|
|
1101
|
-
}) }),
|
|
1102
|
-
/* @__PURE__ */ jsx(
|
|
1103
|
-
ReleaseActionOptions,
|
|
1104
|
-
{
|
|
1105
|
-
selected: values.type,
|
|
1106
|
-
handleChange: (e) => setFieldValue("type", e.target.value),
|
|
1107
|
-
name: "type"
|
|
1108
|
-
}
|
|
1109
|
-
)
|
|
1110
|
-
] }) }),
|
|
1111
|
-
/* @__PURE__ */ jsx(
|
|
1112
|
-
ModalFooter,
|
|
1113
|
-
{
|
|
1114
|
-
startActions: /* @__PURE__ */ jsx(Button$1, { onClick: onClose, variant: "tertiary", name: "cancel", children: formatMessage({
|
|
1115
|
-
id: "content-releases.content-manager-list-view.add-to-release.cancel-button",
|
|
1116
|
-
defaultMessage: "Cancel"
|
|
1117
|
-
}) }),
|
|
1118
|
-
endActions: (
|
|
1119
|
-
/**
|
|
1120
|
-
* TODO: Ideally we would use isValid from Formik to disable the button, however currently it always returns true
|
|
1121
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
1122
|
-
*/
|
|
1123
|
-
/* @__PURE__ */ jsx(Button$1, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
1124
|
-
id: "content-releases.content-manager-list-view.add-to-release.continue-button",
|
|
1125
|
-
defaultMessage: "Continue"
|
|
1126
|
-
}) })
|
|
1127
|
-
)
|
|
1128
|
-
}
|
|
1129
|
-
)
|
|
1130
|
-
] })
|
|
1131
|
-
}
|
|
1132
|
-
);
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
};
|
|
1136
|
-
};
|
|
1137
|
-
const Button = styled.button`
|
|
1138
|
-
svg {
|
|
1139
|
-
> g,
|
|
1140
|
-
path {
|
|
1141
|
-
fill: ${({ theme }) => theme.colors.neutral500};
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
&:hover {
|
|
1145
|
-
svg {
|
|
1146
|
-
> g,
|
|
1147
|
-
path {
|
|
1148
|
-
fill: ${({ theme }) => theme.colors.neutral600};
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
&:active {
|
|
1153
|
-
svg {
|
|
1154
|
-
> g,
|
|
1155
|
-
path {
|
|
1156
|
-
fill: ${({ theme }) => theme.colors.neutral400};
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
`;
|
|
1161
|
-
const ActionWrapper = styled(Flex)`
|
|
1162
|
-
svg {
|
|
1163
|
-
height: ${4 / 16}rem;
|
|
1164
|
-
}
|
|
1165
|
-
`;
|
|
1166
|
-
const useReleasesList = (entryId) => {
|
|
1167
|
-
const { uid: contentTypeUid } = useTypedSelector(
|
|
1168
|
-
(state) => state["content-manager_listView"].contentType
|
|
1169
932
|
);
|
|
1170
|
-
const listViewData = useTypedSelector((state) => state["content-manager_listView"].data);
|
|
1171
|
-
const entriesIds = listViewData.map((entry) => entry.id);
|
|
1172
|
-
const response = useGetMappedEntriesInReleasesQuery(
|
|
1173
|
-
{ contentTypeUid, entriesIds },
|
|
1174
|
-
{ skip: !entriesIds || !contentTypeUid || entriesIds.length === 0 }
|
|
1175
|
-
);
|
|
1176
|
-
const mappedEntriesInReleases = response.data || {};
|
|
1177
|
-
return mappedEntriesInReleases?.[entryId] || [];
|
|
1178
933
|
};
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1181
|
-
if (!
|
|
1182
|
-
|
|
934
|
+
const pluginId = "content-releases";
|
|
935
|
+
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
936
|
+
if (!pluginId2) {
|
|
937
|
+
throw new TypeError("pluginId can't be empty");
|
|
1183
938
|
}
|
|
1184
|
-
return {
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
key: "__release_key__",
|
|
1189
|
-
fieldSchema: { type: "string" },
|
|
1190
|
-
metadatas: { label: "To be released in", searchable: true, sortable: false },
|
|
1191
|
-
name: "releasedAt",
|
|
1192
|
-
cellFormatter: (props) => /* @__PURE__ */ jsx(ReleaseListCell, { ...props })
|
|
1193
|
-
}
|
|
1194
|
-
],
|
|
1195
|
-
layout
|
|
1196
|
-
};
|
|
1197
|
-
};
|
|
1198
|
-
const ReleaseListCell = ({ id }) => {
|
|
1199
|
-
const releases = useReleasesList(id);
|
|
1200
|
-
const [visible, setVisible] = React.useState(false);
|
|
1201
|
-
const buttonRef = React.useRef(null);
|
|
1202
|
-
const { formatMessage } = useIntl();
|
|
1203
|
-
const handleTogglePopover = () => setVisible((prev) => !prev);
|
|
1204
|
-
return /* @__PURE__ */ jsx(Flex, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(Button, { type: "button", onClick: handleTogglePopover, ref: buttonRef, children: /* @__PURE__ */ jsxs(ActionWrapper, { height: "2rem", width: "2rem", children: [
|
|
1205
|
-
/* @__PURE__ */ jsx(Typography, { style: { maxWidth: "252px", cursor: "pointer" }, textColor: "neutral800", children: releases.length > 0 ? formatMessage(
|
|
1206
|
-
{
|
|
1207
|
-
id: "content-releases.content-manager.list-view.releases-number",
|
|
1208
|
-
defaultMessage: "{number} {number, plural, one {release} other {releases}}"
|
|
1209
|
-
},
|
|
1210
|
-
{
|
|
1211
|
-
number: releases.length
|
|
1212
|
-
}
|
|
1213
|
-
) : "-" }),
|
|
1214
|
-
/* @__PURE__ */ jsxs(Flex, { children: [
|
|
1215
|
-
releases.length > 0 && /* @__PURE__ */ jsx(SortIcon, {}),
|
|
1216
|
-
visible && /* @__PURE__ */ jsx(
|
|
1217
|
-
Popover,
|
|
1218
|
-
{
|
|
1219
|
-
onDismiss: handleTogglePopover,
|
|
1220
|
-
source: buttonRef,
|
|
1221
|
-
spacing: 16,
|
|
1222
|
-
children: /* @__PURE__ */ jsx("ul", { children: releases.map(({ id: id2, name }) => /* @__PURE__ */ jsx(Box, { padding: 3, as: "li", children: /* @__PURE__ */ jsx(Link, { href: `/admin/plugins/content-releases/${id2}`, isExternal: false, children: name }) }, id2)) })
|
|
1223
|
-
}
|
|
1224
|
-
)
|
|
1225
|
-
] })
|
|
1226
|
-
] }) }) });
|
|
939
|
+
return Object.keys(trad).reduce((acc, current) => {
|
|
940
|
+
acc[`${pluginId2}.${current}`] = trad[current];
|
|
941
|
+
return acc;
|
|
942
|
+
}, {});
|
|
1227
943
|
};
|
|
1228
944
|
const admin = {
|
|
1229
945
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1231,32 +947,20 @@ const admin = {
|
|
|
1231
947
|
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
1232
948
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
1233
949
|
app.addMenuLink({
|
|
1234
|
-
to:
|
|
950
|
+
to: `plugins/${pluginId}`,
|
|
1235
951
|
icon: PaperPlane,
|
|
1236
952
|
intlLabel: {
|
|
1237
953
|
id: `${pluginId}.plugin.name`,
|
|
1238
954
|
defaultMessage: "Releases"
|
|
1239
955
|
},
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
},
|
|
1244
|
-
permissions: PERMISSIONS.main
|
|
956
|
+
Component: () => import("./App-D_6Y9N2F.mjs").then((mod) => ({ default: mod.App })),
|
|
957
|
+
permissions: PERMISSIONS.main,
|
|
958
|
+
position: 2
|
|
1245
959
|
});
|
|
1246
|
-
app.
|
|
1247
|
-
app.addReducers({
|
|
1248
|
-
[releaseApi.reducerPath]: releaseApi.reducer
|
|
1249
|
-
});
|
|
1250
|
-
app.injectContentManagerComponent("editView", "right-links", {
|
|
960
|
+
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
1251
961
|
name: `${pluginId}-link`,
|
|
1252
962
|
Component: CMReleasesContainer
|
|
1253
963
|
});
|
|
1254
|
-
app.plugins["content-manager"].apis.addBulkAction((actions) => {
|
|
1255
|
-
const deleteActionIndex = actions.findIndex((action) => action.name === "DeleteAction");
|
|
1256
|
-
actions.splice(deleteActionIndex, 0, ReleaseAction);
|
|
1257
|
-
return actions;
|
|
1258
|
-
});
|
|
1259
|
-
app.registerHook("Admin/CM/pages/ListView/inject-column-in-table", addColumnToTableHook);
|
|
1260
964
|
} else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
|
|
1261
965
|
app.addMenuLink({
|
|
1262
966
|
to: `/plugins/purchase-content-releases`,
|
|
@@ -1265,18 +969,20 @@ const admin = {
|
|
|
1265
969
|
id: `${pluginId}.plugin.name`,
|
|
1266
970
|
defaultMessage: "Releases"
|
|
1267
971
|
},
|
|
972
|
+
permissions: [],
|
|
1268
973
|
async Component() {
|
|
1269
|
-
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-
|
|
1270
|
-
return PurchaseContentReleases;
|
|
974
|
+
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-_MxP6-Dt.mjs");
|
|
975
|
+
return { default: PurchaseContentReleases };
|
|
1271
976
|
},
|
|
1272
|
-
lockIcon: true
|
|
977
|
+
lockIcon: true,
|
|
978
|
+
position: 2
|
|
1273
979
|
});
|
|
1274
980
|
}
|
|
1275
981
|
},
|
|
1276
982
|
async registerTrads({ locales }) {
|
|
1277
983
|
const importedTrads = await Promise.all(
|
|
1278
984
|
locales.map((locale) => {
|
|
1279
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-
|
|
985
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-B9Ur3VsE.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
1280
986
|
return {
|
|
1281
987
|
data: prefixPluginTranslations(data, "content-releases"),
|
|
1282
988
|
locale
|
|
@@ -1300,15 +1006,13 @@ export {
|
|
|
1300
1006
|
useUpdateReleaseMutation as c,
|
|
1301
1007
|
useDeleteReleaseMutation as d,
|
|
1302
1008
|
usePublishReleaseMutation as e,
|
|
1303
|
-
|
|
1009
|
+
useGetReleaseActionsQuery as f,
|
|
1304
1010
|
getTimezoneOffset as g,
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
ReleaseActionMenu as k,
|
|
1309
|
-
admin as l,
|
|
1011
|
+
useUpdateReleaseActionMutation as h,
|
|
1012
|
+
ReleaseActionMenu as i,
|
|
1013
|
+
admin as j,
|
|
1310
1014
|
pluginId as p,
|
|
1311
1015
|
releaseApi as r,
|
|
1312
1016
|
useGetReleasesQuery as u
|
|
1313
1017
|
};
|
|
1314
|
-
//# sourceMappingURL=index-
|
|
1018
|
+
//# sourceMappingURL=index-BomF0-yY.mjs.map
|