@strapi/content-releases 0.0.0-experimental.d8a676a242377cee820b59b21a05d47290d9ac73 → 0.0.0-experimental.d954d57341a6623992a0d211daaec8e245c3517d
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-p8aKBitd.js → App-CqbuK4M6.js} +426 -427
- package/dist/_chunks/App-CqbuK4M6.js.map +1 -0
- package/dist/_chunks/{App-bpzO2Ljh.mjs → App-Do-Rnv0A.mjs} +406 -406
- package/dist/_chunks/App-Do-Rnv0A.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-Be3acS2L.js} +8 -7
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +9 -8
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-WuuhP6Bn.mjs → en-B9Ur3VsE.mjs} +11 -3
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-gcJJ5htG.js → en-DtFJ5ViE.js} +11 -3
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-AECgcaDa.mjs → index-D_pgdqQL.mjs} +244 -247
- package/dist/_chunks/index-D_pgdqQL.mjs.map +1 -0
- package/dist/_chunks/{index-fP3qoWZ4.js → index-Tedsw4GC.js} +244 -249
- package/dist/_chunks/index-Tedsw4GC.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 +17 -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 +358 -237
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +359 -237
- 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-bpzO2Ljh.mjs.map +0 -1
- package/dist/_chunks/App-p8aKBitd.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +0 -1
- package/dist/_chunks/en-WuuhP6Bn.mjs.map +0 -1
- package/dist/_chunks/en-gcJJ5htG.js.map +0 -1
- package/dist/_chunks/index-AECgcaDa.mjs.map +0 -1
- package/dist/_chunks/index-fP3qoWZ4.js.map +0 -1
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { getFetchClient, useNotification, useAPIErrorHandler, CheckPermissions, useCMEditViewDataManager, NoContent, 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, Modal, SingleSelect, SingleSelectOption, EmptyStateLayout, LinkButton } from "@strapi/design-system";
|
|
8
|
+
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
9
9
|
import { Formik, Form } from "formik";
|
|
10
10
|
import { useIntl } from "react-intl";
|
|
11
|
-
import {
|
|
11
|
+
import { Link, useParams } from "react-router-dom";
|
|
12
12
|
import * as yup from "yup";
|
|
13
|
-
import {
|
|
14
|
-
import styled from "styled-components";
|
|
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({
|
|
@@ -251,6 +209,20 @@ const releaseApi = createApi({
|
|
|
251
209
|
{ type: "ReleaseAction", id: "LIST" }
|
|
252
210
|
]
|
|
253
211
|
}),
|
|
212
|
+
createManyReleaseActions: build.mutation({
|
|
213
|
+
query({ body, params }) {
|
|
214
|
+
return {
|
|
215
|
+
url: `/content-releases/${params.releaseId}/actions/bulk`,
|
|
216
|
+
method: "POST",
|
|
217
|
+
data: body
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
invalidatesTags: [
|
|
221
|
+
{ type: "Release", id: "LIST" },
|
|
222
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
223
|
+
{ type: "EntriesInRelease" }
|
|
224
|
+
]
|
|
225
|
+
}),
|
|
254
226
|
updateReleaseAction: build.mutation({
|
|
255
227
|
query({ body, params }) {
|
|
256
228
|
return {
|
|
@@ -266,13 +238,17 @@ const releaseApi = createApi({
|
|
|
266
238
|
...query
|
|
267
239
|
};
|
|
268
240
|
const patchResult = dispatch(
|
|
269
|
-
releaseApi.util.updateQueryData(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
+
}
|
|
274
250
|
}
|
|
275
|
-
|
|
251
|
+
)
|
|
276
252
|
);
|
|
277
253
|
try {
|
|
278
254
|
await queryFulfilled;
|
|
@@ -288,9 +264,11 @@ const releaseApi = createApi({
|
|
|
288
264
|
method: "DELETE"
|
|
289
265
|
};
|
|
290
266
|
},
|
|
291
|
-
invalidatesTags: [
|
|
267
|
+
invalidatesTags: (result, error, arg) => [
|
|
292
268
|
{ type: "Release", id: "LIST" },
|
|
293
|
-
{ type: "
|
|
269
|
+
{ type: "Release", id: arg.params.releaseId },
|
|
270
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
271
|
+
{ type: "EntriesInRelease" }
|
|
294
272
|
]
|
|
295
273
|
}),
|
|
296
274
|
publishRelease: build.mutation({
|
|
@@ -309,7 +287,22 @@ const releaseApi = createApi({
|
|
|
309
287
|
method: "DELETE"
|
|
310
288
|
};
|
|
311
289
|
},
|
|
312
|
-
invalidatesTags: () => [{ type: "Release", id: "LIST" }]
|
|
290
|
+
invalidatesTags: () => [{ type: "Release", id: "LIST" }, { type: "EntriesInRelease" }]
|
|
291
|
+
}),
|
|
292
|
+
getMappedEntriesInReleases: build.query({
|
|
293
|
+
query(params) {
|
|
294
|
+
return {
|
|
295
|
+
url: "/content-releases/mapEntriesToReleases",
|
|
296
|
+
method: "GET",
|
|
297
|
+
config: {
|
|
298
|
+
params
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
},
|
|
302
|
+
transformResponse(response) {
|
|
303
|
+
return response.data;
|
|
304
|
+
},
|
|
305
|
+
providesTags: [{ type: "EntriesInRelease" }]
|
|
313
306
|
})
|
|
314
307
|
};
|
|
315
308
|
}
|
|
@@ -321,11 +314,13 @@ const {
|
|
|
321
314
|
useGetReleaseActionsQuery,
|
|
322
315
|
useCreateReleaseMutation,
|
|
323
316
|
useCreateReleaseActionMutation,
|
|
317
|
+
useCreateManyReleaseActionsMutation,
|
|
324
318
|
useUpdateReleaseMutation,
|
|
325
319
|
useUpdateReleaseActionMutation,
|
|
326
320
|
usePublishReleaseMutation,
|
|
327
321
|
useDeleteReleaseActionMutation,
|
|
328
|
-
useDeleteReleaseMutation
|
|
322
|
+
useDeleteReleaseMutation,
|
|
323
|
+
useGetMappedEntriesInReleasesQuery
|
|
329
324
|
} = releaseApi;
|
|
330
325
|
const getTimezoneOffset = (timezone, date) => {
|
|
331
326
|
try {
|
|
@@ -343,16 +338,12 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
343
338
|
return "";
|
|
344
339
|
}
|
|
345
340
|
};
|
|
346
|
-
const useTypedDispatch = useDispatch;
|
|
347
|
-
const useTypedSelector = useSelector;
|
|
348
341
|
const StyledMenuItem = styled(Menu.Item)`
|
|
349
342
|
&:hover {
|
|
350
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
343
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
351
344
|
|
|
352
345
|
svg {
|
|
353
|
-
|
|
354
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
355
|
-
}
|
|
346
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
356
347
|
}
|
|
357
348
|
|
|
358
349
|
a {
|
|
@@ -361,9 +352,7 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
361
352
|
}
|
|
362
353
|
|
|
363
354
|
svg {
|
|
364
|
-
|
|
365
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
366
|
-
}
|
|
355
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
367
356
|
}
|
|
368
357
|
|
|
369
358
|
a {
|
|
@@ -375,15 +364,14 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
375
364
|
width: 100%;
|
|
376
365
|
}
|
|
377
366
|
`;
|
|
378
|
-
const StyledIconButton = styled(IconButton)`
|
|
379
|
-
/* Setting this style inline with borderColor will not apply the style */
|
|
380
|
-
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
381
|
-
`;
|
|
382
367
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
383
368
|
const { formatMessage } = useIntl();
|
|
384
|
-
const toggleNotification = useNotification();
|
|
369
|
+
const { toggleNotification } = useNotification();
|
|
385
370
|
const { formatAPIError } = useAPIErrorHandler();
|
|
386
371
|
const [deleteReleaseAction] = useDeleteReleaseActionMutation();
|
|
372
|
+
const {
|
|
373
|
+
allowedActions: { canDeleteAction }
|
|
374
|
+
} = useRBAC(PERMISSIONS);
|
|
387
375
|
const handleDeleteAction = async () => {
|
|
388
376
|
const response = await deleteReleaseAction({
|
|
389
377
|
params: { releaseId, actionId }
|
|
@@ -399,26 +387,29 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
399
387
|
return;
|
|
400
388
|
}
|
|
401
389
|
if ("error" in response) {
|
|
402
|
-
if (
|
|
390
|
+
if (isFetchError(response.error)) {
|
|
403
391
|
toggleNotification({
|
|
404
|
-
type: "
|
|
392
|
+
type: "danger",
|
|
405
393
|
message: formatAPIError(response.error)
|
|
406
394
|
});
|
|
407
395
|
} else {
|
|
408
396
|
toggleNotification({
|
|
409
|
-
type: "
|
|
397
|
+
type: "danger",
|
|
410
398
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
411
399
|
});
|
|
412
400
|
}
|
|
413
401
|
}
|
|
414
402
|
};
|
|
415
|
-
|
|
416
|
-
|
|
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" }),
|
|
417
408
|
/* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
418
409
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
419
410
|
defaultMessage: "Remove from release"
|
|
420
411
|
}) })
|
|
421
|
-
] }) })
|
|
412
|
+
] }) });
|
|
422
413
|
};
|
|
423
414
|
const ReleaseActionEntryLinkItem = ({
|
|
424
415
|
contentTypeUid,
|
|
@@ -426,77 +417,79 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
426
417
|
locale
|
|
427
418
|
}) => {
|
|
428
419
|
const { formatMessage } = useIntl();
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
!
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
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
|
+
}
|
|
438
443
|
return /* @__PURE__ */ jsx(
|
|
439
|
-
|
|
444
|
+
StyledMenuItem,
|
|
440
445
|
{
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
children:
|
|
448
|
-
|
|
449
|
-
{
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
},
|
|
455
|
-
startIcon: /* @__PURE__ */ jsx(Icon, { as: Pencil, width: 3, height: 3 }),
|
|
456
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatMessage({
|
|
457
|
-
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
458
|
-
defaultMessage: "Edit entry"
|
|
459
|
-
}) })
|
|
460
|
-
}
|
|
461
|
-
) })
|
|
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
|
+
] })
|
|
462
459
|
}
|
|
463
460
|
);
|
|
464
461
|
};
|
|
465
462
|
const EditReleaseItem = ({ releaseId }) => {
|
|
466
463
|
const { formatMessage } = useIntl();
|
|
467
|
-
return
|
|
468
|
-
|
|
469
|
-
{
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
startIcon: /* @__PURE__ */ jsx(Icon, { as: Pencil, width: 3, height: 3 }),
|
|
473
|
-
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({
|
|
474
469
|
id: "content-releases.content-manager-edit-view.edit-release",
|
|
475
470
|
defaultMessage: "Edit release"
|
|
476
471
|
}) })
|
|
477
|
-
}
|
|
478
|
-
)
|
|
472
|
+
] }) })
|
|
473
|
+
);
|
|
479
474
|
};
|
|
480
|
-
const Root = ({ children
|
|
475
|
+
const Root = ({ children }) => {
|
|
481
476
|
const { formatMessage } = useIntl();
|
|
477
|
+
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
482
478
|
return (
|
|
483
479
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
484
|
-
|
|
485
|
-
/* @__PURE__ */ jsx(
|
|
486
|
-
|
|
480
|
+
allowedActions.canDeleteAction || allowedActions.canUpdate ? /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
481
|
+
/* @__PURE__ */ jsx(Menu.Trigger, { paddingLeft: 2, paddingRight: 2, children: /* @__PURE__ */ jsx(
|
|
482
|
+
AccessibleIcon,
|
|
487
483
|
{
|
|
488
|
-
|
|
489
|
-
paddingLeft: 2,
|
|
490
|
-
paddingRight: 2,
|
|
491
|
-
"aria-label": formatMessage({
|
|
484
|
+
label: formatMessage({
|
|
492
485
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
493
486
|
defaultMessage: "Release action options"
|
|
494
487
|
}),
|
|
495
|
-
|
|
488
|
+
children: /* @__PURE__ */ jsx(More, {})
|
|
496
489
|
}
|
|
497
|
-
),
|
|
490
|
+
) }),
|
|
498
491
|
/* @__PURE__ */ jsx(Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
499
|
-
] })
|
|
492
|
+
] }) : null
|
|
500
493
|
);
|
|
501
494
|
};
|
|
502
495
|
const ReleaseActionMenu = {
|
|
@@ -511,11 +504,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
511
504
|
const getBorderRightRadiusValue = (actionType) => {
|
|
512
505
|
return actionType === "publish" ? 0 : 1;
|
|
513
506
|
};
|
|
514
|
-
const FieldWrapper = styled(Field)`
|
|
515
|
-
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
516
|
-
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
517
|
-
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
518
|
-
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)]};
|
|
519
512
|
|
|
520
513
|
> label {
|
|
521
514
|
color: inherit;
|
|
@@ -526,14 +519,14 @@ const FieldWrapper = styled(Field)`
|
|
|
526
519
|
}
|
|
527
520
|
|
|
528
521
|
&[data-checked='true'] {
|
|
529
|
-
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
530
|
-
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
531
|
-
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};
|
|
532
525
|
}
|
|
533
526
|
|
|
534
527
|
&[data-checked='false'] {
|
|
535
|
-
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
536
|
-
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
528
|
+
border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
|
|
529
|
+
border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
|
|
537
530
|
}
|
|
538
531
|
|
|
539
532
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -562,7 +555,7 @@ const ActionOption = ({
|
|
|
562
555
|
return /* @__PURE__ */ jsx(
|
|
563
556
|
FieldWrapper,
|
|
564
557
|
{
|
|
565
|
-
actionType,
|
|
558
|
+
$actionType: actionType,
|
|
566
559
|
background: "primary0",
|
|
567
560
|
borderColor: "neutral200",
|
|
568
561
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -570,12 +563,11 @@ const ActionOption = ({
|
|
|
570
563
|
cursor: "pointer",
|
|
571
564
|
"data-checked": selected === actionType,
|
|
572
565
|
"data-disabled": disabled && selected !== actionType,
|
|
573
|
-
children: /* @__PURE__ */ jsxs(
|
|
566
|
+
children: /* @__PURE__ */ jsxs(Field.Label, { children: [
|
|
574
567
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(
|
|
575
|
-
|
|
568
|
+
Field.Input,
|
|
576
569
|
{
|
|
577
570
|
type: "radio",
|
|
578
|
-
id: `${name}-${actionType}`,
|
|
579
571
|
name,
|
|
580
572
|
checked: selected === actionType,
|
|
581
573
|
onChange: handleChange,
|
|
@@ -628,19 +620,20 @@ const INITIAL_VALUES = {
|
|
|
628
620
|
const NoReleases = () => {
|
|
629
621
|
const { formatMessage } = useIntl();
|
|
630
622
|
return /* @__PURE__ */ jsx(
|
|
631
|
-
|
|
623
|
+
EmptyStateLayout,
|
|
632
624
|
{
|
|
633
|
-
|
|
625
|
+
icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "16rem" }),
|
|
626
|
+
content: formatMessage({
|
|
634
627
|
id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
|
|
635
628
|
defaultMessage: "No available releases. Open the list of releases and create a new one from there."
|
|
636
|
-
},
|
|
629
|
+
}),
|
|
637
630
|
action: /* @__PURE__ */ jsx(
|
|
638
631
|
LinkButton,
|
|
639
632
|
{
|
|
640
633
|
to: {
|
|
641
634
|
pathname: "/plugins/content-releases"
|
|
642
635
|
},
|
|
643
|
-
|
|
636
|
+
tag: Link,
|
|
644
637
|
variant: "secondary",
|
|
645
638
|
children: formatMessage({
|
|
646
639
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -652,15 +645,16 @@ const NoReleases = () => {
|
|
|
652
645
|
);
|
|
653
646
|
};
|
|
654
647
|
const AddActionToReleaseModal = ({
|
|
655
|
-
|
|
648
|
+
open,
|
|
649
|
+
onOpenChange,
|
|
656
650
|
contentTypeUid,
|
|
657
651
|
entryId
|
|
658
652
|
}) => {
|
|
659
|
-
const releaseHeaderId = React.useId();
|
|
660
653
|
const { formatMessage } = useIntl();
|
|
661
|
-
const toggleNotification = useNotification();
|
|
654
|
+
const { toggleNotification } = useNotification();
|
|
662
655
|
const { formatAPIError } = useAPIErrorHandler();
|
|
663
|
-
const {
|
|
656
|
+
const [{ query }] = useQueryParams();
|
|
657
|
+
const locale = query.plugins?.i18n?.locale;
|
|
664
658
|
const response = useGetReleasesForEntryQuery({
|
|
665
659
|
contentTypeUid,
|
|
666
660
|
entryId,
|
|
@@ -669,7 +663,6 @@ const AddActionToReleaseModal = ({
|
|
|
669
663
|
const releases = response.data?.data;
|
|
670
664
|
const [createReleaseAction, { isLoading }] = useCreateReleaseActionMutation();
|
|
671
665
|
const handleSubmit = async (values) => {
|
|
672
|
-
const locale = modifiedData.locale;
|
|
673
666
|
const releaseActionEntry = {
|
|
674
667
|
contentType: contentTypeUid,
|
|
675
668
|
id: entryId,
|
|
@@ -687,25 +680,25 @@ const AddActionToReleaseModal = ({
|
|
|
687
680
|
defaultMessage: "Entry added to release"
|
|
688
681
|
})
|
|
689
682
|
});
|
|
690
|
-
|
|
683
|
+
onOpenChange();
|
|
691
684
|
return;
|
|
692
685
|
}
|
|
693
686
|
if ("error" in response2) {
|
|
694
|
-
if (
|
|
687
|
+
if (isFetchError(response2.error)) {
|
|
695
688
|
toggleNotification({
|
|
696
|
-
type: "
|
|
689
|
+
type: "danger",
|
|
697
690
|
message: formatAPIError(response2.error)
|
|
698
691
|
});
|
|
699
692
|
} else {
|
|
700
693
|
toggleNotification({
|
|
701
|
-
type: "
|
|
694
|
+
type: "danger",
|
|
702
695
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
703
696
|
});
|
|
704
697
|
}
|
|
705
698
|
}
|
|
706
699
|
};
|
|
707
|
-
return /* @__PURE__ */
|
|
708
|
-
/* @__PURE__ */ jsx(
|
|
700
|
+
return /* @__PURE__ */ jsx(Modal.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
|
|
701
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { fontWeight: "bold", children: formatMessage({
|
|
709
702
|
id: "content-releases.content-manager-edit-view.add-to-release",
|
|
710
703
|
defaultMessage: "Add to release"
|
|
711
704
|
}) }) }),
|
|
@@ -717,25 +710,26 @@ const AddActionToReleaseModal = ({
|
|
|
717
710
|
initialValues: INITIAL_VALUES,
|
|
718
711
|
children: ({ values, setFieldValue }) => {
|
|
719
712
|
return /* @__PURE__ */ jsxs(Form, { children: [
|
|
720
|
-
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(
|
|
721
|
-
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
713
|
+
releases?.length === 0 ? /* @__PURE__ */ jsx(NoReleases, {}) : /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
714
|
+
/* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxs(Field.Root, { required: true, children: [
|
|
715
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
716
|
+
id: "content-releases.content-manager-edit-view.add-to-release.select-label",
|
|
717
|
+
defaultMessage: "Select a release"
|
|
718
|
+
}) }),
|
|
719
|
+
/* @__PURE__ */ jsx(
|
|
720
|
+
SingleSelect,
|
|
721
|
+
{
|
|
722
|
+
placeholder: formatMessage({
|
|
723
|
+
id: "content-releases.content-manager-edit-view.add-to-release.select-placeholder",
|
|
724
|
+
defaultMessage: "Select"
|
|
725
|
+
}),
|
|
726
|
+
onChange: (value) => setFieldValue("releaseId", value),
|
|
727
|
+
value: values.releaseId,
|
|
728
|
+
children: releases?.map((release) => /* @__PURE__ */ jsx(SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
] }) }),
|
|
732
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
739
733
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
740
734
|
defaultMessage: "What do you want to do with this entry?"
|
|
741
735
|
}) }),
|
|
@@ -748,43 +742,37 @@ const AddActionToReleaseModal = ({
|
|
|
748
742
|
}
|
|
749
743
|
)
|
|
750
744
|
] }) }),
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
762
|
-
*/
|
|
763
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
764
|
-
id: "content-releases.content-manager-edit-view.add-to-release.continue-button",
|
|
765
|
-
defaultMessage: "Continue"
|
|
766
|
-
}) })
|
|
767
|
-
)
|
|
768
|
-
}
|
|
769
|
-
)
|
|
745
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
746
|
+
/* @__PURE__ */ jsx(Modal.Close, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", name: "cancel", children: formatMessage({
|
|
747
|
+
id: "content-releases.content-manager-edit-view.add-to-release.cancel-button",
|
|
748
|
+
defaultMessage: "Cancel"
|
|
749
|
+
}) }) }),
|
|
750
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
751
|
+
id: "content-releases.content-manager-edit-view.add-to-release.continue-button",
|
|
752
|
+
defaultMessage: "Continue"
|
|
753
|
+
}) })
|
|
754
|
+
] })
|
|
770
755
|
] });
|
|
771
756
|
}
|
|
772
757
|
}
|
|
773
758
|
)
|
|
774
|
-
] });
|
|
759
|
+
] }) });
|
|
775
760
|
};
|
|
776
761
|
const CMReleasesContainer = () => {
|
|
777
762
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
778
763
|
const { formatMessage, formatDate, formatTime } = useIntl();
|
|
779
|
-
const {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
} =
|
|
764
|
+
const { id, slug, collectionType } = useParams();
|
|
765
|
+
const isCreatingEntry = id === "create";
|
|
766
|
+
const entryId = parseInt(id, 10);
|
|
767
|
+
const { allowedActions } = useRBAC(PERMISSIONS);
|
|
768
|
+
const { canCreateAction, canRead: canMain, canDeleteAction } = allowedActions;
|
|
769
|
+
const { schema } = unstable_useDocument({
|
|
770
|
+
collectionType,
|
|
771
|
+
model: slug
|
|
772
|
+
});
|
|
773
|
+
const hasDraftAndPublish = schema?.options?.draftAndPublish;
|
|
785
774
|
const contentTypeUid = slug;
|
|
786
|
-
const
|
|
787
|
-
const canFetch = entryId != null && contentTypeUid != null;
|
|
775
|
+
const canFetch = id != null && contentTypeUid != null;
|
|
788
776
|
const fetchParams = canFetch ? {
|
|
789
777
|
contentTypeUid,
|
|
790
778
|
entryId,
|
|
@@ -805,10 +793,13 @@ const CMReleasesContainer = () => {
|
|
|
805
793
|
}
|
|
806
794
|
return `success${shade}`;
|
|
807
795
|
};
|
|
808
|
-
|
|
796
|
+
if (!canMain) {
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
return /* @__PURE__ */ jsxs(
|
|
809
800
|
Box,
|
|
810
801
|
{
|
|
811
|
-
|
|
802
|
+
tag: "aside",
|
|
812
803
|
"aria-label": formatMessage({
|
|
813
804
|
id: "content-releases.plugin.name",
|
|
814
805
|
defaultMessage: "Releases"
|
|
@@ -832,7 +823,7 @@ const CMReleasesContainer = () => {
|
|
|
832
823
|
alignItems: "start",
|
|
833
824
|
borderWidth: "1px",
|
|
834
825
|
borderStyle: "solid",
|
|
835
|
-
borderColor: getReleaseColorVariant(release.
|
|
826
|
+
borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
|
|
836
827
|
overflow: "hidden",
|
|
837
828
|
hasRadius: true,
|
|
838
829
|
children: [
|
|
@@ -843,28 +834,28 @@ const CMReleasesContainer = () => {
|
|
|
843
834
|
paddingBottom: 3,
|
|
844
835
|
paddingLeft: 4,
|
|
845
836
|
paddingRight: 4,
|
|
846
|
-
background: getReleaseColorVariant(release.
|
|
837
|
+
background: getReleaseColorVariant(release.actions[0].type, "100"),
|
|
847
838
|
width: "100%",
|
|
848
839
|
children: /* @__PURE__ */ jsx(
|
|
849
840
|
Typography,
|
|
850
841
|
{
|
|
851
842
|
fontSize: 1,
|
|
852
843
|
variant: "pi",
|
|
853
|
-
textColor: getReleaseColorVariant(release.
|
|
844
|
+
textColor: getReleaseColorVariant(release.actions[0].type, "600"),
|
|
854
845
|
children: formatMessage(
|
|
855
846
|
{
|
|
856
847
|
id: "content-releases.content-manager-edit-view.list-releases.title",
|
|
857
848
|
defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
|
|
858
849
|
},
|
|
859
|
-
{ isPublish: release.
|
|
850
|
+
{ isPublish: release.actions[0].type === "publish" }
|
|
860
851
|
)
|
|
861
852
|
}
|
|
862
853
|
)
|
|
863
854
|
}
|
|
864
855
|
),
|
|
865
|
-
/* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
856
|
+
/* @__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: [
|
|
866
857
|
/* @__PURE__ */ jsx(Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
867
|
-
|
|
858
|
+
release.scheduledAt && release.timezone && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
868
859
|
{
|
|
869
860
|
id: "content-releases.content-manager-edit-view.scheduled.date",
|
|
870
861
|
defaultMessage: "{date} at {time} ({offset})"
|
|
@@ -886,23 +877,23 @@ const CMReleasesContainer = () => {
|
|
|
886
877
|
)
|
|
887
878
|
}
|
|
888
879
|
) }),
|
|
889
|
-
|
|
880
|
+
canDeleteAction ? /* @__PURE__ */ jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
|
|
890
881
|
/* @__PURE__ */ jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
|
|
891
882
|
/* @__PURE__ */ jsx(
|
|
892
883
|
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
893
884
|
{
|
|
894
885
|
releaseId: release.id,
|
|
895
|
-
actionId: release.
|
|
886
|
+
actionId: release.actions[0].id
|
|
896
887
|
}
|
|
897
888
|
)
|
|
898
|
-
] })
|
|
899
|
-
] })
|
|
889
|
+
] }) : null
|
|
890
|
+
] }) })
|
|
900
891
|
]
|
|
901
892
|
},
|
|
902
893
|
release.id
|
|
903
894
|
);
|
|
904
895
|
}),
|
|
905
|
-
|
|
896
|
+
canCreateAction ? /* @__PURE__ */ jsx(
|
|
906
897
|
Button,
|
|
907
898
|
{
|
|
908
899
|
justifyContent: "center",
|
|
@@ -917,42 +908,48 @@ const CMReleasesContainer = () => {
|
|
|
917
908
|
defaultMessage: "Add to release"
|
|
918
909
|
})
|
|
919
910
|
}
|
|
920
|
-
)
|
|
911
|
+
) : null
|
|
921
912
|
] }),
|
|
922
|
-
|
|
913
|
+
/* @__PURE__ */ jsx(
|
|
923
914
|
AddActionToReleaseModal,
|
|
924
915
|
{
|
|
925
|
-
|
|
916
|
+
open: isModalOpen,
|
|
917
|
+
onOpenChange: toggleModal,
|
|
926
918
|
contentTypeUid,
|
|
927
919
|
entryId
|
|
928
920
|
}
|
|
929
921
|
)
|
|
930
922
|
]
|
|
931
923
|
}
|
|
932
|
-
)
|
|
924
|
+
);
|
|
925
|
+
};
|
|
926
|
+
const pluginId = "content-releases";
|
|
927
|
+
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
928
|
+
if (!pluginId2) {
|
|
929
|
+
throw new TypeError("pluginId can't be empty");
|
|
930
|
+
}
|
|
931
|
+
return Object.keys(trad).reduce((acc, current) => {
|
|
932
|
+
acc[`${pluginId2}.${current}`] = trad[current];
|
|
933
|
+
return acc;
|
|
934
|
+
}, {});
|
|
933
935
|
};
|
|
934
936
|
const admin = {
|
|
935
937
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
936
938
|
register(app) {
|
|
939
|
+
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
937
940
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
938
941
|
app.addMenuLink({
|
|
939
|
-
to:
|
|
942
|
+
to: `plugins/${pluginId}`,
|
|
940
943
|
icon: PaperPlane,
|
|
941
944
|
intlLabel: {
|
|
942
945
|
id: `${pluginId}.plugin.name`,
|
|
943
946
|
defaultMessage: "Releases"
|
|
944
947
|
},
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
},
|
|
949
|
-
permissions: PERMISSIONS.main
|
|
950
|
-
});
|
|
951
|
-
app.addMiddlewares([() => releaseApi.middleware]);
|
|
952
|
-
app.addReducers({
|
|
953
|
-
[releaseApi.reducerPath]: releaseApi.reducer
|
|
948
|
+
Component: () => import("./App-Do-Rnv0A.mjs").then((mod) => ({ default: mod.App })),
|
|
949
|
+
permissions: PERMISSIONS.main,
|
|
950
|
+
position: 2
|
|
954
951
|
});
|
|
955
|
-
app.
|
|
952
|
+
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
956
953
|
name: `${pluginId}-link`,
|
|
957
954
|
Component: CMReleasesContainer
|
|
958
955
|
});
|
|
@@ -964,18 +961,20 @@ const admin = {
|
|
|
964
961
|
id: `${pluginId}.plugin.name`,
|
|
965
962
|
defaultMessage: "Releases"
|
|
966
963
|
},
|
|
964
|
+
permissions: [],
|
|
967
965
|
async Component() {
|
|
968
|
-
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-
|
|
969
|
-
return PurchaseContentReleases;
|
|
966
|
+
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-_MxP6-Dt.mjs");
|
|
967
|
+
return { default: PurchaseContentReleases };
|
|
970
968
|
},
|
|
971
|
-
lockIcon: true
|
|
969
|
+
lockIcon: true,
|
|
970
|
+
position: 2
|
|
972
971
|
});
|
|
973
972
|
}
|
|
974
973
|
},
|
|
975
974
|
async registerTrads({ locales }) {
|
|
976
975
|
const importedTrads = await Promise.all(
|
|
977
976
|
locales.map((locale) => {
|
|
978
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-
|
|
977
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-B9Ur3VsE.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
979
978
|
return {
|
|
980
979
|
data: prefixPluginTranslations(data, "content-releases"),
|
|
981
980
|
locale
|
|
@@ -999,15 +998,13 @@ export {
|
|
|
999
998
|
useUpdateReleaseMutation as c,
|
|
1000
999
|
useDeleteReleaseMutation as d,
|
|
1001
1000
|
usePublishReleaseMutation as e,
|
|
1002
|
-
|
|
1001
|
+
useGetReleaseActionsQuery as f,
|
|
1003
1002
|
getTimezoneOffset as g,
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
ReleaseActionMenu as k,
|
|
1008
|
-
admin as l,
|
|
1003
|
+
useUpdateReleaseActionMutation as h,
|
|
1004
|
+
ReleaseActionMenu as i,
|
|
1005
|
+
admin as j,
|
|
1009
1006
|
pluginId as p,
|
|
1010
1007
|
releaseApi as r,
|
|
1011
1008
|
useGetReleasesQuery as u
|
|
1012
1009
|
};
|
|
1013
|
-
//# sourceMappingURL=index-
|
|
1010
|
+
//# sourceMappingURL=index-D_pgdqQL.mjs.map
|