@strapi/content-releases 0.0.0-experimental.bcfd4881e086b8126222bb894121c61ff9a1fc82 → 0.0.0-experimental.c3e9d4b26f9fd3d9eb530b5c11f9baa1d09b13ad
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--3HPsVgM.js → App-DUmziQ17.js} +401 -388
- package/dist/_chunks/App-DUmziQ17.js.map +1 -0
- package/dist/_chunks/{App-CRNZU_DZ.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-bpHsnU0n.mjs → en-B9Ur3VsE.mjs} +2 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-3SGjiVyR.js → en-DtFJ5ViE.js} +2 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-_wu9g0yG.mjs → index-BomF0-yY.mjs} +206 -392
- package/dist/_chunks/index-BomF0-yY.mjs.map +1 -0
- package/dist/_chunks/{index-xV3jXcZj.js → index-C5Hc767q.js} +206 -394
- 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 +152 -93
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +153 -93
- 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--3HPsVgM.js.map +0 -1
- package/dist/_chunks/App-CRNZU_DZ.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-3SGjiVyR.js.map +0 -1
- package/dist/_chunks/en-bpHsnU0n.mjs.map +0 -1
- package/dist/_chunks/index-_wu9g0yG.mjs.map +0 -1
- package/dist/_chunks/index-xV3jXcZj.js.map +0 -1
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { getFetchClient, useNotification, useAPIErrorHandler, CheckPermissions, useCMEditViewDataManager, NoContent, useRBAC, 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"],
|
|
95
|
+
const releaseApi = adminApi.enhanceEndpoints({
|
|
96
|
+
addTagTypes: ["Release", "ReleaseAction", "EntriesInRelease"]
|
|
97
|
+
}).injectEndpoints({
|
|
140
98
|
endpoints: (build) => {
|
|
141
99
|
return {
|
|
142
100
|
getReleasesForEntry: build.query({
|
|
@@ -261,7 +219,8 @@ const releaseApi = createApi({
|
|
|
261
219
|
},
|
|
262
220
|
invalidatesTags: [
|
|
263
221
|
{ type: "Release", id: "LIST" },
|
|
264
|
-
{ type: "ReleaseAction", id: "LIST" }
|
|
222
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
223
|
+
{ type: "EntriesInRelease" }
|
|
265
224
|
]
|
|
266
225
|
}),
|
|
267
226
|
updateReleaseAction: build.mutation({
|
|
@@ -279,13 +238,17 @@ const releaseApi = createApi({
|
|
|
279
238
|
...query
|
|
280
239
|
};
|
|
281
240
|
const patchResult = dispatch(
|
|
282
|
-
releaseApi.util.updateQueryData(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
+
}
|
|
287
250
|
}
|
|
288
|
-
|
|
251
|
+
)
|
|
289
252
|
);
|
|
290
253
|
try {
|
|
291
254
|
await queryFulfilled;
|
|
@@ -304,7 +267,8 @@ const releaseApi = createApi({
|
|
|
304
267
|
invalidatesTags: (result, error, arg) => [
|
|
305
268
|
{ type: "Release", id: "LIST" },
|
|
306
269
|
{ type: "Release", id: arg.params.releaseId },
|
|
307
|
-
{ type: "ReleaseAction", id: "LIST" }
|
|
270
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
271
|
+
{ type: "EntriesInRelease" }
|
|
308
272
|
]
|
|
309
273
|
}),
|
|
310
274
|
publishRelease: build.mutation({
|
|
@@ -323,7 +287,22 @@ const releaseApi = createApi({
|
|
|
323
287
|
method: "DELETE"
|
|
324
288
|
};
|
|
325
289
|
},
|
|
326
|
-
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" }]
|
|
327
306
|
})
|
|
328
307
|
};
|
|
329
308
|
}
|
|
@@ -340,7 +319,8 @@ const {
|
|
|
340
319
|
useUpdateReleaseActionMutation,
|
|
341
320
|
usePublishReleaseMutation,
|
|
342
321
|
useDeleteReleaseActionMutation,
|
|
343
|
-
useDeleteReleaseMutation
|
|
322
|
+
useDeleteReleaseMutation,
|
|
323
|
+
useGetMappedEntriesInReleasesQuery
|
|
344
324
|
} = releaseApi;
|
|
345
325
|
const getTimezoneOffset = (timezone, date) => {
|
|
346
326
|
try {
|
|
@@ -358,16 +338,12 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
358
338
|
return "";
|
|
359
339
|
}
|
|
360
340
|
};
|
|
361
|
-
const useTypedDispatch = useDispatch;
|
|
362
|
-
const useTypedSelector = useSelector;
|
|
363
341
|
const StyledMenuItem = styled(Menu.Item)`
|
|
364
342
|
&:hover {
|
|
365
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
343
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
366
344
|
|
|
367
345
|
svg {
|
|
368
|
-
|
|
369
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
370
|
-
}
|
|
346
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
371
347
|
}
|
|
372
348
|
|
|
373
349
|
a {
|
|
@@ -376,9 +352,7 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
376
352
|
}
|
|
377
353
|
|
|
378
354
|
svg {
|
|
379
|
-
|
|
380
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
381
|
-
}
|
|
355
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
382
356
|
}
|
|
383
357
|
|
|
384
358
|
a {
|
|
@@ -390,15 +364,14 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
390
364
|
width: 100%;
|
|
391
365
|
}
|
|
392
366
|
`;
|
|
393
|
-
const StyledIconButton = styled(IconButton)`
|
|
394
|
-
/* Setting this style inline with borderColor will not apply the style */
|
|
395
|
-
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
396
|
-
`;
|
|
397
367
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
398
368
|
const { formatMessage } = useIntl();
|
|
399
|
-
const toggleNotification = useNotification();
|
|
369
|
+
const { toggleNotification } = useNotification();
|
|
400
370
|
const { formatAPIError } = useAPIErrorHandler();
|
|
401
371
|
const [deleteReleaseAction] = useDeleteReleaseActionMutation();
|
|
372
|
+
const {
|
|
373
|
+
allowedActions: { canDeleteAction }
|
|
374
|
+
} = useRBAC(PERMISSIONS);
|
|
402
375
|
const handleDeleteAction = async () => {
|
|
403
376
|
const response = await deleteReleaseAction({
|
|
404
377
|
params: { releaseId, actionId }
|
|
@@ -414,26 +387,29 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
414
387
|
return;
|
|
415
388
|
}
|
|
416
389
|
if ("error" in response) {
|
|
417
|
-
if (
|
|
390
|
+
if (isFetchError(response.error)) {
|
|
418
391
|
toggleNotification({
|
|
419
|
-
type: "
|
|
392
|
+
type: "danger",
|
|
420
393
|
message: formatAPIError(response.error)
|
|
421
394
|
});
|
|
422
395
|
} else {
|
|
423
396
|
toggleNotification({
|
|
424
|
-
type: "
|
|
397
|
+
type: "danger",
|
|
425
398
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
426
399
|
});
|
|
427
400
|
}
|
|
428
401
|
}
|
|
429
402
|
};
|
|
430
|
-
|
|
431
|
-
|
|
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" }),
|
|
432
408
|
/* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
433
409
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
434
410
|
defaultMessage: "Remove from release"
|
|
435
411
|
}) })
|
|
436
|
-
] }) })
|
|
412
|
+
] }) });
|
|
437
413
|
};
|
|
438
414
|
const ReleaseActionEntryLinkItem = ({
|
|
439
415
|
contentTypeUid,
|
|
@@ -441,77 +417,79 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
441
417
|
locale
|
|
442
418
|
}) => {
|
|
443
419
|
const { formatMessage } = useIntl();
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
!
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
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
|
+
}
|
|
453
443
|
return /* @__PURE__ */ jsx(
|
|
454
|
-
|
|
444
|
+
StyledMenuItem,
|
|
455
445
|
{
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
children:
|
|
463
|
-
|
|
464
|
-
{
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
},
|
|
470
|
-
startIcon: /* @__PURE__ */ jsx(Icon, { as: Pencil, width: 3, height: 3 }),
|
|
471
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatMessage({
|
|
472
|
-
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
473
|
-
defaultMessage: "Edit entry"
|
|
474
|
-
}) })
|
|
475
|
-
}
|
|
476
|
-
) })
|
|
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
|
+
] })
|
|
477
459
|
}
|
|
478
460
|
);
|
|
479
461
|
};
|
|
480
462
|
const EditReleaseItem = ({ releaseId }) => {
|
|
481
463
|
const { formatMessage } = useIntl();
|
|
482
|
-
return
|
|
483
|
-
|
|
484
|
-
{
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
isExternal: false,
|
|
488
|
-
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({
|
|
489
469
|
id: "content-releases.content-manager-edit-view.edit-release",
|
|
490
470
|
defaultMessage: "Edit release"
|
|
491
471
|
}) })
|
|
492
|
-
}
|
|
493
|
-
)
|
|
472
|
+
] }) })
|
|
473
|
+
);
|
|
494
474
|
};
|
|
495
|
-
const Root = ({ children
|
|
475
|
+
const Root = ({ children }) => {
|
|
496
476
|
const { formatMessage } = useIntl();
|
|
477
|
+
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
497
478
|
return (
|
|
498
479
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
499
|
-
|
|
500
|
-
/* @__PURE__ */ jsx(
|
|
501
|
-
|
|
480
|
+
allowedActions.canDeleteAction || allowedActions.canUpdate ? /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
481
|
+
/* @__PURE__ */ jsx(Menu.Trigger, { paddingLeft: 2, paddingRight: 2, children: /* @__PURE__ */ jsx(
|
|
482
|
+
AccessibleIcon,
|
|
502
483
|
{
|
|
503
|
-
|
|
504
|
-
paddingLeft: 2,
|
|
505
|
-
paddingRight: 2,
|
|
506
|
-
"aria-label": formatMessage({
|
|
484
|
+
label: formatMessage({
|
|
507
485
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
508
486
|
defaultMessage: "Release action options"
|
|
509
487
|
}),
|
|
510
|
-
|
|
488
|
+
children: /* @__PURE__ */ jsx(More, {})
|
|
511
489
|
}
|
|
512
|
-
),
|
|
490
|
+
) }),
|
|
513
491
|
/* @__PURE__ */ jsx(Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
514
|
-
] })
|
|
492
|
+
] }) : null
|
|
515
493
|
);
|
|
516
494
|
};
|
|
517
495
|
const ReleaseActionMenu = {
|
|
@@ -526,11 +504,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
526
504
|
const getBorderRightRadiusValue = (actionType) => {
|
|
527
505
|
return actionType === "publish" ? 0 : 1;
|
|
528
506
|
};
|
|
529
|
-
const FieldWrapper = styled(Field)`
|
|
530
|
-
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
531
|
-
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
532
|
-
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
533
|
-
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)]};
|
|
534
512
|
|
|
535
513
|
> label {
|
|
536
514
|
color: inherit;
|
|
@@ -541,14 +519,14 @@ const FieldWrapper = styled(Field)`
|
|
|
541
519
|
}
|
|
542
520
|
|
|
543
521
|
&[data-checked='true'] {
|
|
544
|
-
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
545
|
-
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
546
|
-
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};
|
|
547
525
|
}
|
|
548
526
|
|
|
549
527
|
&[data-checked='false'] {
|
|
550
|
-
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
551
|
-
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
528
|
+
border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
|
|
529
|
+
border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
|
|
552
530
|
}
|
|
553
531
|
|
|
554
532
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -577,7 +555,7 @@ const ActionOption = ({
|
|
|
577
555
|
return /* @__PURE__ */ jsx(
|
|
578
556
|
FieldWrapper,
|
|
579
557
|
{
|
|
580
|
-
actionType,
|
|
558
|
+
$actionType: actionType,
|
|
581
559
|
background: "primary0",
|
|
582
560
|
borderColor: "neutral200",
|
|
583
561
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -585,12 +563,11 @@ const ActionOption = ({
|
|
|
585
563
|
cursor: "pointer",
|
|
586
564
|
"data-checked": selected === actionType,
|
|
587
565
|
"data-disabled": disabled && selected !== actionType,
|
|
588
|
-
children: /* @__PURE__ */ jsxs(
|
|
566
|
+
children: /* @__PURE__ */ jsxs(Field.Label, { children: [
|
|
589
567
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(
|
|
590
|
-
|
|
568
|
+
Field.Input,
|
|
591
569
|
{
|
|
592
570
|
type: "radio",
|
|
593
|
-
id: `${name}-${actionType}`,
|
|
594
571
|
name,
|
|
595
572
|
checked: selected === actionType,
|
|
596
573
|
onChange: handleChange,
|
|
@@ -643,19 +620,20 @@ const INITIAL_VALUES = {
|
|
|
643
620
|
const NoReleases = () => {
|
|
644
621
|
const { formatMessage } = useIntl();
|
|
645
622
|
return /* @__PURE__ */ jsx(
|
|
646
|
-
|
|
623
|
+
EmptyStateLayout,
|
|
647
624
|
{
|
|
648
|
-
|
|
625
|
+
icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "16rem" }),
|
|
626
|
+
content: formatMessage({
|
|
649
627
|
id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
|
|
650
628
|
defaultMessage: "No available releases. Open the list of releases and create a new one from there."
|
|
651
|
-
},
|
|
629
|
+
}),
|
|
652
630
|
action: /* @__PURE__ */ jsx(
|
|
653
631
|
LinkButton,
|
|
654
632
|
{
|
|
655
633
|
to: {
|
|
656
634
|
pathname: "/plugins/content-releases"
|
|
657
635
|
},
|
|
658
|
-
|
|
636
|
+
tag: Link,
|
|
659
637
|
variant: "secondary",
|
|
660
638
|
children: formatMessage({
|
|
661
639
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -673,9 +651,10 @@ const AddActionToReleaseModal = ({
|
|
|
673
651
|
}) => {
|
|
674
652
|
const releaseHeaderId = React.useId();
|
|
675
653
|
const { formatMessage } = useIntl();
|
|
676
|
-
const toggleNotification = useNotification();
|
|
654
|
+
const { toggleNotification } = useNotification();
|
|
677
655
|
const { formatAPIError } = useAPIErrorHandler();
|
|
678
|
-
const {
|
|
656
|
+
const [{ query }] = useQueryParams();
|
|
657
|
+
const locale = query.plugins?.i18n?.locale;
|
|
679
658
|
const response = useGetReleasesForEntryQuery({
|
|
680
659
|
contentTypeUid,
|
|
681
660
|
entryId,
|
|
@@ -684,7 +663,6 @@ const AddActionToReleaseModal = ({
|
|
|
684
663
|
const releases = response.data?.data;
|
|
685
664
|
const [createReleaseAction, { isLoading }] = useCreateReleaseActionMutation();
|
|
686
665
|
const handleSubmit = async (values) => {
|
|
687
|
-
const locale = modifiedData.locale;
|
|
688
666
|
const releaseActionEntry = {
|
|
689
667
|
contentType: contentTypeUid,
|
|
690
668
|
id: entryId,
|
|
@@ -706,14 +684,14 @@ const AddActionToReleaseModal = ({
|
|
|
706
684
|
return;
|
|
707
685
|
}
|
|
708
686
|
if ("error" in response2) {
|
|
709
|
-
if (
|
|
687
|
+
if (isFetchError(response2.error)) {
|
|
710
688
|
toggleNotification({
|
|
711
|
-
type: "
|
|
689
|
+
type: "danger",
|
|
712
690
|
message: formatAPIError(response2.error)
|
|
713
691
|
});
|
|
714
692
|
} else {
|
|
715
693
|
toggleNotification({
|
|
716
|
-
type: "
|
|
694
|
+
type: "danger",
|
|
717
695
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
718
696
|
});
|
|
719
697
|
}
|
|
@@ -733,24 +711,25 @@ const AddActionToReleaseModal = ({
|
|
|
733
711
|
children: ({ values, setFieldValue }) => {
|
|
734
712
|
return /* @__PURE__ */ jsxs(Form, { children: [
|
|
735
713
|
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
736
|
-
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
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({
|
|
754
733
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
755
734
|
defaultMessage: "What do you want to do with this entry?"
|
|
756
735
|
}) }),
|
|
@@ -791,14 +770,18 @@ const AddActionToReleaseModal = ({
|
|
|
791
770
|
const CMReleasesContainer = () => {
|
|
792
771
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
793
772
|
const { formatMessage, formatDate, formatTime } = useIntl();
|
|
794
|
-
const {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
} =
|
|
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;
|
|
800
783
|
const contentTypeUid = slug;
|
|
801
|
-
const canFetch =
|
|
784
|
+
const canFetch = id != null && contentTypeUid != null;
|
|
802
785
|
const fetchParams = canFetch ? {
|
|
803
786
|
contentTypeUid,
|
|
804
787
|
entryId,
|
|
@@ -819,10 +802,13 @@ const CMReleasesContainer = () => {
|
|
|
819
802
|
}
|
|
820
803
|
return `success${shade}`;
|
|
821
804
|
};
|
|
822
|
-
|
|
805
|
+
if (!canMain) {
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
return /* @__PURE__ */ jsxs(
|
|
823
809
|
Box,
|
|
824
810
|
{
|
|
825
|
-
|
|
811
|
+
tag: "aside",
|
|
826
812
|
"aria-label": formatMessage({
|
|
827
813
|
id: "content-releases.plugin.name",
|
|
828
814
|
defaultMessage: "Releases"
|
|
@@ -846,7 +832,7 @@ const CMReleasesContainer = () => {
|
|
|
846
832
|
alignItems: "start",
|
|
847
833
|
borderWidth: "1px",
|
|
848
834
|
borderStyle: "solid",
|
|
849
|
-
borderColor: getReleaseColorVariant(release.
|
|
835
|
+
borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
|
|
850
836
|
overflow: "hidden",
|
|
851
837
|
hasRadius: true,
|
|
852
838
|
children: [
|
|
@@ -857,26 +843,26 @@ const CMReleasesContainer = () => {
|
|
|
857
843
|
paddingBottom: 3,
|
|
858
844
|
paddingLeft: 4,
|
|
859
845
|
paddingRight: 4,
|
|
860
|
-
background: getReleaseColorVariant(release.
|
|
846
|
+
background: getReleaseColorVariant(release.actions[0].type, "100"),
|
|
861
847
|
width: "100%",
|
|
862
848
|
children: /* @__PURE__ */ jsx(
|
|
863
849
|
Typography,
|
|
864
850
|
{
|
|
865
851
|
fontSize: 1,
|
|
866
852
|
variant: "pi",
|
|
867
|
-
textColor: getReleaseColorVariant(release.
|
|
853
|
+
textColor: getReleaseColorVariant(release.actions[0].type, "600"),
|
|
868
854
|
children: formatMessage(
|
|
869
855
|
{
|
|
870
856
|
id: "content-releases.content-manager-edit-view.list-releases.title",
|
|
871
857
|
defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
|
|
872
858
|
},
|
|
873
|
-
{ isPublish: release.
|
|
859
|
+
{ isPublish: release.actions[0].type === "publish" }
|
|
874
860
|
)
|
|
875
861
|
}
|
|
876
862
|
)
|
|
877
863
|
}
|
|
878
864
|
),
|
|
879
|
-
/* @__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: [
|
|
880
866
|
/* @__PURE__ */ jsx(Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
881
867
|
release.scheduledAt && release.timezone && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
882
868
|
{
|
|
@@ -900,23 +886,23 @@ const CMReleasesContainer = () => {
|
|
|
900
886
|
)
|
|
901
887
|
}
|
|
902
888
|
) }),
|
|
903
|
-
|
|
889
|
+
canDeleteAction ? /* @__PURE__ */ jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
|
|
904
890
|
/* @__PURE__ */ jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
|
|
905
891
|
/* @__PURE__ */ jsx(
|
|
906
892
|
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
907
893
|
{
|
|
908
894
|
releaseId: release.id,
|
|
909
|
-
actionId: release.
|
|
895
|
+
actionId: release.actions[0].id
|
|
910
896
|
}
|
|
911
897
|
)
|
|
912
|
-
] })
|
|
913
|
-
] })
|
|
898
|
+
] }) : null
|
|
899
|
+
] }) })
|
|
914
900
|
]
|
|
915
901
|
},
|
|
916
902
|
release.id
|
|
917
903
|
);
|
|
918
904
|
}),
|
|
919
|
-
|
|
905
|
+
canCreateAction ? /* @__PURE__ */ jsx(
|
|
920
906
|
Button,
|
|
921
907
|
{
|
|
922
908
|
justifyContent: "center",
|
|
@@ -931,7 +917,7 @@ const CMReleasesContainer = () => {
|
|
|
931
917
|
defaultMessage: "Add to release"
|
|
932
918
|
})
|
|
933
919
|
}
|
|
934
|
-
)
|
|
920
|
+
) : null
|
|
935
921
|
] }),
|
|
936
922
|
isModalOpen && /* @__PURE__ */ jsx(
|
|
937
923
|
AddActionToReleaseModal,
|
|
@@ -943,178 +929,17 @@ const CMReleasesContainer = () => {
|
|
|
943
929
|
)
|
|
944
930
|
]
|
|
945
931
|
}
|
|
946
|
-
)
|
|
947
|
-
};
|
|
948
|
-
const getContentPermissions = (subject) => {
|
|
949
|
-
const permissions = {
|
|
950
|
-
publish: [
|
|
951
|
-
{
|
|
952
|
-
action: "plugin::content-manager.explorer.publish",
|
|
953
|
-
subject,
|
|
954
|
-
id: "",
|
|
955
|
-
actionParameters: {},
|
|
956
|
-
properties: {},
|
|
957
|
-
conditions: []
|
|
958
|
-
}
|
|
959
|
-
]
|
|
960
|
-
};
|
|
961
|
-
return permissions;
|
|
932
|
+
);
|
|
962
933
|
};
|
|
963
|
-
const
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
}
|
|
972
|
-
const {
|
|
973
|
-
allowedActions: { canCreate }
|
|
974
|
-
} = useRBAC(PERMISSIONS);
|
|
975
|
-
const response = useGetReleasesQuery();
|
|
976
|
-
const releases = response.data?.data;
|
|
977
|
-
const [createManyReleaseActions, { isLoading }] = useCreateManyReleaseActionsMutation();
|
|
978
|
-
const handleSubmit = async (values) => {
|
|
979
|
-
const locale = modifiedData.locale;
|
|
980
|
-
const releaseActionEntries = ids.map((id) => ({
|
|
981
|
-
type: values.type,
|
|
982
|
-
entry: {
|
|
983
|
-
contentType: model,
|
|
984
|
-
id,
|
|
985
|
-
locale
|
|
986
|
-
}
|
|
987
|
-
}));
|
|
988
|
-
const response2 = await createManyReleaseActions({
|
|
989
|
-
body: releaseActionEntries,
|
|
990
|
-
params: { releaseId: values.releaseId }
|
|
991
|
-
});
|
|
992
|
-
if ("data" in response2) {
|
|
993
|
-
const notificationMessage = formatMessage(
|
|
994
|
-
{
|
|
995
|
-
id: "content-releases.content-manager-list-view.add-to-release.notification.success.message",
|
|
996
|
-
defaultMessage: "{entriesAlreadyInRelease} out of {totalEntries} entries were already in the release."
|
|
997
|
-
},
|
|
998
|
-
{
|
|
999
|
-
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1000
|
-
totalEntries: response2.data.meta.totalEntries
|
|
1001
|
-
}
|
|
1002
|
-
);
|
|
1003
|
-
const notification = {
|
|
1004
|
-
type: "success",
|
|
1005
|
-
title: formatMessage(
|
|
1006
|
-
{
|
|
1007
|
-
id: "content-releases.content-manager-list-view.add-to-release.notification.success.title",
|
|
1008
|
-
defaultMessage: "Successfully added to release."
|
|
1009
|
-
},
|
|
1010
|
-
{
|
|
1011
|
-
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1012
|
-
totalEntries: response2.data.meta.totalEntries
|
|
1013
|
-
}
|
|
1014
|
-
),
|
|
1015
|
-
message: response2.data.meta.entriesAlreadyInRelease ? notificationMessage : ""
|
|
1016
|
-
};
|
|
1017
|
-
toggleNotification(notification);
|
|
1018
|
-
return true;
|
|
1019
|
-
}
|
|
1020
|
-
if ("error" in response2) {
|
|
1021
|
-
if (isAxiosError$1(response2.error)) {
|
|
1022
|
-
toggleNotification({
|
|
1023
|
-
type: "warning",
|
|
1024
|
-
message: formatAPIError(response2.error)
|
|
1025
|
-
});
|
|
1026
|
-
} else {
|
|
1027
|
-
toggleNotification({
|
|
1028
|
-
type: "warning",
|
|
1029
|
-
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1030
|
-
});
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
};
|
|
1034
|
-
if (!canCreate || !canPublish)
|
|
1035
|
-
return null;
|
|
1036
|
-
return {
|
|
1037
|
-
actionType: "release",
|
|
1038
|
-
variant: "tertiary",
|
|
1039
|
-
label: formatMessage({
|
|
1040
|
-
id: "content-manager-list-view.add-to-release",
|
|
1041
|
-
defaultMessage: "Add to Release"
|
|
1042
|
-
}),
|
|
1043
|
-
dialog: {
|
|
1044
|
-
type: "modal",
|
|
1045
|
-
title: formatMessage({
|
|
1046
|
-
id: "content-manager-list-view.add-to-release",
|
|
1047
|
-
defaultMessage: "Add to Release"
|
|
1048
|
-
}),
|
|
1049
|
-
content: ({ onClose }) => {
|
|
1050
|
-
return /* @__PURE__ */ jsx(
|
|
1051
|
-
Formik,
|
|
1052
|
-
{
|
|
1053
|
-
onSubmit: async (values) => {
|
|
1054
|
-
const data = await handleSubmit(values);
|
|
1055
|
-
if (data) {
|
|
1056
|
-
return onClose();
|
|
1057
|
-
}
|
|
1058
|
-
},
|
|
1059
|
-
validationSchema: RELEASE_ACTION_FORM_SCHEMA,
|
|
1060
|
-
initialValues: INITIAL_VALUES,
|
|
1061
|
-
children: ({ values, setFieldValue }) => /* @__PURE__ */ jsxs(Form, { children: [
|
|
1062
|
-
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
1063
|
-
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */ jsx(
|
|
1064
|
-
SingleSelect,
|
|
1065
|
-
{
|
|
1066
|
-
required: true,
|
|
1067
|
-
label: formatMessage({
|
|
1068
|
-
id: "content-releases.content-manager-list-view.add-to-release.select-label",
|
|
1069
|
-
defaultMessage: "Select a release"
|
|
1070
|
-
}),
|
|
1071
|
-
placeholder: formatMessage({
|
|
1072
|
-
id: "content-releases.content-manager-list-view.add-to-release.select-placeholder",
|
|
1073
|
-
defaultMessage: "Select"
|
|
1074
|
-
}),
|
|
1075
|
-
onChange: (value) => setFieldValue("releaseId", value),
|
|
1076
|
-
value: values.releaseId,
|
|
1077
|
-
children: releases?.map((release) => /* @__PURE__ */ jsx(SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
1078
|
-
}
|
|
1079
|
-
) }),
|
|
1080
|
-
/* @__PURE__ */ jsx(FieldLabel, { children: formatMessage({
|
|
1081
|
-
id: "content-releases.content-manager-list-view.add-to-release.action-type-label",
|
|
1082
|
-
defaultMessage: "What do you want to do with these entries?"
|
|
1083
|
-
}) }),
|
|
1084
|
-
/* @__PURE__ */ jsx(
|
|
1085
|
-
ReleaseActionOptions,
|
|
1086
|
-
{
|
|
1087
|
-
selected: values.type,
|
|
1088
|
-
handleChange: (e) => setFieldValue("type", e.target.value),
|
|
1089
|
-
name: "type"
|
|
1090
|
-
}
|
|
1091
|
-
)
|
|
1092
|
-
] }) }),
|
|
1093
|
-
/* @__PURE__ */ jsx(
|
|
1094
|
-
ModalFooter,
|
|
1095
|
-
{
|
|
1096
|
-
startActions: /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", name: "cancel", children: formatMessage({
|
|
1097
|
-
id: "content-releases.content-manager-list-view.add-to-release.cancel-button",
|
|
1098
|
-
defaultMessage: "Cancel"
|
|
1099
|
-
}) }),
|
|
1100
|
-
endActions: (
|
|
1101
|
-
/**
|
|
1102
|
-
* TODO: Ideally we would use isValid from Formik to disable the button, however currently it always returns true
|
|
1103
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
1104
|
-
*/
|
|
1105
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
1106
|
-
id: "content-releases.content-manager-list-view.add-to-release.continue-button",
|
|
1107
|
-
defaultMessage: "Continue"
|
|
1108
|
-
}) })
|
|
1109
|
-
)
|
|
1110
|
-
}
|
|
1111
|
-
)
|
|
1112
|
-
] })
|
|
1113
|
-
}
|
|
1114
|
-
);
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
};
|
|
934
|
+
const pluginId = "content-releases";
|
|
935
|
+
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
936
|
+
if (!pluginId2) {
|
|
937
|
+
throw new TypeError("pluginId can't be empty");
|
|
938
|
+
}
|
|
939
|
+
return Object.keys(trad).reduce((acc, current) => {
|
|
940
|
+
acc[`${pluginId2}.${current}`] = trad[current];
|
|
941
|
+
return acc;
|
|
942
|
+
}, {});
|
|
1118
943
|
};
|
|
1119
944
|
const admin = {
|
|
1120
945
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1122,31 +947,20 @@ const admin = {
|
|
|
1122
947
|
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
1123
948
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
1124
949
|
app.addMenuLink({
|
|
1125
|
-
to:
|
|
950
|
+
to: `plugins/${pluginId}`,
|
|
1126
951
|
icon: PaperPlane,
|
|
1127
952
|
intlLabel: {
|
|
1128
953
|
id: `${pluginId}.plugin.name`,
|
|
1129
954
|
defaultMessage: "Releases"
|
|
1130
955
|
},
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
},
|
|
1135
|
-
permissions: PERMISSIONS.main
|
|
956
|
+
Component: () => import("./App-D_6Y9N2F.mjs").then((mod) => ({ default: mod.App })),
|
|
957
|
+
permissions: PERMISSIONS.main,
|
|
958
|
+
position: 2
|
|
1136
959
|
});
|
|
1137
|
-
app.
|
|
1138
|
-
app.addReducers({
|
|
1139
|
-
[releaseApi.reducerPath]: releaseApi.reducer
|
|
1140
|
-
});
|
|
1141
|
-
app.injectContentManagerComponent("editView", "right-links", {
|
|
960
|
+
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
1142
961
|
name: `${pluginId}-link`,
|
|
1143
962
|
Component: CMReleasesContainer
|
|
1144
963
|
});
|
|
1145
|
-
app.plugins["content-manager"].apis.addBulkAction((actions) => {
|
|
1146
|
-
const deleteActionIndex = actions.findIndex((action) => action.name === "DeleteAction");
|
|
1147
|
-
actions.splice(deleteActionIndex, 0, ReleaseAction);
|
|
1148
|
-
return actions;
|
|
1149
|
-
});
|
|
1150
964
|
} else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
|
|
1151
965
|
app.addMenuLink({
|
|
1152
966
|
to: `/plugins/purchase-content-releases`,
|
|
@@ -1155,18 +969,20 @@ const admin = {
|
|
|
1155
969
|
id: `${pluginId}.plugin.name`,
|
|
1156
970
|
defaultMessage: "Releases"
|
|
1157
971
|
},
|
|
972
|
+
permissions: [],
|
|
1158
973
|
async Component() {
|
|
1159
|
-
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-
|
|
1160
|
-
return PurchaseContentReleases;
|
|
974
|
+
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-_MxP6-Dt.mjs");
|
|
975
|
+
return { default: PurchaseContentReleases };
|
|
1161
976
|
},
|
|
1162
|
-
lockIcon: true
|
|
977
|
+
lockIcon: true,
|
|
978
|
+
position: 2
|
|
1163
979
|
});
|
|
1164
980
|
}
|
|
1165
981
|
},
|
|
1166
982
|
async registerTrads({ locales }) {
|
|
1167
983
|
const importedTrads = await Promise.all(
|
|
1168
984
|
locales.map((locale) => {
|
|
1169
|
-
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 }) => {
|
|
1170
986
|
return {
|
|
1171
987
|
data: prefixPluginTranslations(data, "content-releases"),
|
|
1172
988
|
locale
|
|
@@ -1190,15 +1006,13 @@ export {
|
|
|
1190
1006
|
useUpdateReleaseMutation as c,
|
|
1191
1007
|
useDeleteReleaseMutation as d,
|
|
1192
1008
|
usePublishReleaseMutation as e,
|
|
1193
|
-
|
|
1009
|
+
useGetReleaseActionsQuery as f,
|
|
1194
1010
|
getTimezoneOffset as g,
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
ReleaseActionMenu as k,
|
|
1199
|
-
admin as l,
|
|
1011
|
+
useUpdateReleaseActionMutation as h,
|
|
1012
|
+
ReleaseActionMenu as i,
|
|
1013
|
+
admin as j,
|
|
1200
1014
|
pluginId as p,
|
|
1201
1015
|
releaseApi as r,
|
|
1202
1016
|
useGetReleasesQuery as u
|
|
1203
1017
|
};
|
|
1204
|
-
//# sourceMappingURL=index-
|
|
1018
|
+
//# sourceMappingURL=index-BomF0-yY.mjs.map
|