@strapi/content-releases 0.0.0-experimental.d4cb32ce579e12a4436d68036f2327132fba1309 → 0.0.0-experimental.d53e940834bf72ddc725f1d2fd36dac9abec30cb
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-xAkiD42p.mjs → App-B2R2exNT.mjs} +656 -625
- package/dist/_chunks/App-B2R2exNT.mjs.map +1 -0
- package/dist/_chunks/{App-OK4Xac-O.js → App-CEwOQkKT.js} +671 -641
- package/dist/_chunks/App-CEwOQkKT.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-Be3acS2L.js} +8 -7
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +9 -8
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-veqvqeEr.mjs → en-B9Ur3VsE.mjs} +14 -5
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-r0otWaln.js → en-DtFJ5ViE.js} +14 -5
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-JvA2_26n.js → index-BrWv-zV4.js} +258 -244
- package/dist/_chunks/index-BrWv-zV4.js.map +1 -0
- package/dist/_chunks/{index-exoiSU3V.mjs → index-DbmynICx.mjs} +264 -248
- package/dist/_chunks/index-DbmynICx.mjs.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 +675 -232
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +675 -232
- 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-OK4Xac-O.js.map +0 -1
- package/dist/_chunks/App-xAkiD42p.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +0 -1
- package/dist/_chunks/en-r0otWaln.js.map +0 -1
- package/dist/_chunks/en-veqvqeEr.mjs.map +0 -1
- package/dist/_chunks/index-JvA2_26n.js.map +0 -1
- package/dist/_chunks/index-exoiSU3V.mjs.map +0 -1
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const helperPlugin = require("@strapi/helper-plugin");
|
|
3
2
|
const icons = require("@strapi/icons");
|
|
4
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
5
4
|
const React = require("react");
|
|
6
5
|
const query = require("@reduxjs/toolkit/query");
|
|
6
|
+
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
7
|
+
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
7
8
|
const designSystem = require("@strapi/design-system");
|
|
8
|
-
const
|
|
9
|
-
const axios = require("axios");
|
|
9
|
+
const symbols = require("@strapi/icons/symbols");
|
|
10
10
|
const formik = require("formik");
|
|
11
11
|
const reactIntl = require("react-intl");
|
|
12
12
|
const reactRouterDom = require("react-router-dom");
|
|
13
13
|
const yup = require("yup");
|
|
14
|
-
const
|
|
15
|
-
const styled = require("styled-components");
|
|
16
|
-
const reactRedux = require("react-redux");
|
|
17
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
|
+
const styledComponents = require("styled-components");
|
|
18
15
|
function _interopNamespace(e) {
|
|
19
16
|
if (e && e.__esModule)
|
|
20
17
|
return e;
|
|
@@ -35,7 +32,6 @@ function _interopNamespace(e) {
|
|
|
35
32
|
}
|
|
36
33
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
37
34
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
38
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
39
35
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
40
36
|
const v = glob[path];
|
|
41
37
|
if (v) {
|
|
@@ -117,49 +113,9 @@ const PERMISSIONS = {
|
|
|
117
113
|
}
|
|
118
114
|
]
|
|
119
115
|
};
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
method,
|
|
124
|
-
data,
|
|
125
|
-
config
|
|
126
|
-
}) => {
|
|
127
|
-
try {
|
|
128
|
-
const { get, post, del, put } = helperPlugin.getFetchClient();
|
|
129
|
-
if (method === "POST") {
|
|
130
|
-
const result2 = await post(url, data, config);
|
|
131
|
-
return { data: result2.data };
|
|
132
|
-
}
|
|
133
|
-
if (method === "DELETE") {
|
|
134
|
-
const result2 = await del(url, config);
|
|
135
|
-
return { data: result2.data };
|
|
136
|
-
}
|
|
137
|
-
if (method === "PUT") {
|
|
138
|
-
const result2 = await put(url, data, config);
|
|
139
|
-
return { data: result2.data };
|
|
140
|
-
}
|
|
141
|
-
const result = await get(url, config);
|
|
142
|
-
return { data: result.data };
|
|
143
|
-
} catch (error) {
|
|
144
|
-
const err = error;
|
|
145
|
-
return {
|
|
146
|
-
error: {
|
|
147
|
-
status: err.response?.status,
|
|
148
|
-
code: err.code,
|
|
149
|
-
response: {
|
|
150
|
-
data: err.response?.data
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
const isAxiosError = (err) => {
|
|
157
|
-
return typeof err === "object" && err !== null && "response" in err && typeof err.response === "object" && err.response !== null && "data" in err.response;
|
|
158
|
-
};
|
|
159
|
-
const releaseApi = react.createApi({
|
|
160
|
-
reducerPath: pluginId,
|
|
161
|
-
baseQuery: axiosBaseQuery,
|
|
162
|
-
tagTypes: ["Release", "ReleaseAction"],
|
|
116
|
+
const releaseApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
117
|
+
addTagTypes: ["Release", "ReleaseAction", "EntriesInRelease"]
|
|
118
|
+
}).injectEndpoints({
|
|
163
119
|
endpoints: (build) => {
|
|
164
120
|
return {
|
|
165
121
|
getReleasesForEntry: build.query({
|
|
@@ -274,6 +230,20 @@ const releaseApi = react.createApi({
|
|
|
274
230
|
{ type: "ReleaseAction", id: "LIST" }
|
|
275
231
|
]
|
|
276
232
|
}),
|
|
233
|
+
createManyReleaseActions: build.mutation({
|
|
234
|
+
query({ body, params }) {
|
|
235
|
+
return {
|
|
236
|
+
url: `/content-releases/${params.releaseId}/actions/bulk`,
|
|
237
|
+
method: "POST",
|
|
238
|
+
data: body
|
|
239
|
+
};
|
|
240
|
+
},
|
|
241
|
+
invalidatesTags: [
|
|
242
|
+
{ type: "Release", id: "LIST" },
|
|
243
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
244
|
+
{ type: "EntriesInRelease" }
|
|
245
|
+
]
|
|
246
|
+
}),
|
|
277
247
|
updateReleaseAction: build.mutation({
|
|
278
248
|
query({ body, params }) {
|
|
279
249
|
return {
|
|
@@ -289,13 +259,17 @@ const releaseApi = react.createApi({
|
|
|
289
259
|
...query2
|
|
290
260
|
};
|
|
291
261
|
const patchResult = dispatch(
|
|
292
|
-
releaseApi.util.updateQueryData(
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
262
|
+
releaseApi.util.updateQueryData(
|
|
263
|
+
"getReleaseActions",
|
|
264
|
+
paramsWithoutActionId,
|
|
265
|
+
(draft) => {
|
|
266
|
+
const [key, index] = actionPath;
|
|
267
|
+
const action = draft.data[key][index];
|
|
268
|
+
if (action) {
|
|
269
|
+
action.type = body.type;
|
|
270
|
+
}
|
|
297
271
|
}
|
|
298
|
-
|
|
272
|
+
)
|
|
299
273
|
);
|
|
300
274
|
try {
|
|
301
275
|
await queryFulfilled;
|
|
@@ -311,9 +285,11 @@ const releaseApi = react.createApi({
|
|
|
311
285
|
method: "DELETE"
|
|
312
286
|
};
|
|
313
287
|
},
|
|
314
|
-
invalidatesTags: [
|
|
288
|
+
invalidatesTags: (result, error, arg) => [
|
|
315
289
|
{ type: "Release", id: "LIST" },
|
|
316
|
-
{ type: "
|
|
290
|
+
{ type: "Release", id: arg.params.releaseId },
|
|
291
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
292
|
+
{ type: "EntriesInRelease" }
|
|
317
293
|
]
|
|
318
294
|
}),
|
|
319
295
|
publishRelease: build.mutation({
|
|
@@ -332,7 +308,22 @@ const releaseApi = react.createApi({
|
|
|
332
308
|
method: "DELETE"
|
|
333
309
|
};
|
|
334
310
|
},
|
|
335
|
-
invalidatesTags: (
|
|
311
|
+
invalidatesTags: () => [{ type: "Release", id: "LIST" }, { type: "EntriesInRelease" }]
|
|
312
|
+
}),
|
|
313
|
+
getMappedEntriesInReleases: build.query({
|
|
314
|
+
query(params) {
|
|
315
|
+
return {
|
|
316
|
+
url: "/content-releases/mapEntriesToReleases",
|
|
317
|
+
method: "GET",
|
|
318
|
+
config: {
|
|
319
|
+
params
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
},
|
|
323
|
+
transformResponse(response) {
|
|
324
|
+
return response.data;
|
|
325
|
+
},
|
|
326
|
+
providesTags: [{ type: "EntriesInRelease" }]
|
|
336
327
|
})
|
|
337
328
|
};
|
|
338
329
|
}
|
|
@@ -344,11 +335,13 @@ const {
|
|
|
344
335
|
useGetReleaseActionsQuery,
|
|
345
336
|
useCreateReleaseMutation,
|
|
346
337
|
useCreateReleaseActionMutation,
|
|
338
|
+
useCreateManyReleaseActionsMutation,
|
|
347
339
|
useUpdateReleaseMutation,
|
|
348
340
|
useUpdateReleaseActionMutation,
|
|
349
341
|
usePublishReleaseMutation,
|
|
350
342
|
useDeleteReleaseActionMutation,
|
|
351
|
-
useDeleteReleaseMutation
|
|
343
|
+
useDeleteReleaseMutation,
|
|
344
|
+
useGetMappedEntriesInReleasesQuery
|
|
352
345
|
} = releaseApi;
|
|
353
346
|
const getTimezoneOffset = (timezone, date) => {
|
|
354
347
|
try {
|
|
@@ -366,16 +359,12 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
366
359
|
return "";
|
|
367
360
|
}
|
|
368
361
|
};
|
|
369
|
-
const
|
|
370
|
-
const useTypedSelector = reactRedux.useSelector;
|
|
371
|
-
const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
362
|
+
const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
372
363
|
&:hover {
|
|
373
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
364
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
374
365
|
|
|
375
366
|
svg {
|
|
376
|
-
|
|
377
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
378
|
-
}
|
|
367
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
379
368
|
}
|
|
380
369
|
|
|
381
370
|
a {
|
|
@@ -384,9 +373,7 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
384
373
|
}
|
|
385
374
|
|
|
386
375
|
svg {
|
|
387
|
-
|
|
388
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
389
|
-
}
|
|
376
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
390
377
|
}
|
|
391
378
|
|
|
392
379
|
a {
|
|
@@ -398,15 +385,14 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
398
385
|
width: 100%;
|
|
399
386
|
}
|
|
400
387
|
`;
|
|
401
|
-
const StyledIconButton = styled__default.default(designSystem.IconButton)`
|
|
402
|
-
/* Setting this style inline with borderColor will not apply the style */
|
|
403
|
-
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
404
|
-
`;
|
|
405
388
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
406
389
|
const { formatMessage } = reactIntl.useIntl();
|
|
407
|
-
const toggleNotification =
|
|
408
|
-
const { formatAPIError } =
|
|
390
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
391
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
409
392
|
const [deleteReleaseAction] = useDeleteReleaseActionMutation();
|
|
393
|
+
const {
|
|
394
|
+
allowedActions: { canDeleteAction }
|
|
395
|
+
} = strapiAdmin.useRBAC(PERMISSIONS);
|
|
410
396
|
const handleDeleteAction = async () => {
|
|
411
397
|
const response = await deleteReleaseAction({
|
|
412
398
|
params: { releaseId, actionId }
|
|
@@ -422,26 +408,29 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
422
408
|
return;
|
|
423
409
|
}
|
|
424
410
|
if ("error" in response) {
|
|
425
|
-
if (
|
|
411
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
426
412
|
toggleNotification({
|
|
427
|
-
type: "
|
|
413
|
+
type: "danger",
|
|
428
414
|
message: formatAPIError(response.error)
|
|
429
415
|
});
|
|
430
416
|
} else {
|
|
431
417
|
toggleNotification({
|
|
432
|
-
type: "
|
|
418
|
+
type: "danger",
|
|
433
419
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
434
420
|
});
|
|
435
421
|
}
|
|
436
422
|
}
|
|
437
423
|
};
|
|
438
|
-
|
|
439
|
-
|
|
424
|
+
if (!canDeleteAction) {
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { $variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
428
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Cross, { width: "1.6rem", height: "1.6rem" }),
|
|
440
429
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
441
430
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
442
431
|
defaultMessage: "Remove from release"
|
|
443
432
|
}) })
|
|
444
|
-
] }) })
|
|
433
|
+
] }) });
|
|
445
434
|
};
|
|
446
435
|
const ReleaseActionEntryLinkItem = ({
|
|
447
436
|
contentTypeUid,
|
|
@@ -449,66 +438,84 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
449
438
|
locale
|
|
450
439
|
}) => {
|
|
451
440
|
const { formatMessage } = reactIntl.useIntl();
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
!
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
441
|
+
const userPermissions = strapiAdmin.useAuth("ReleaseActionEntryLinkItem", (state) => state.permissions);
|
|
442
|
+
const canUpdateEntryForLocale = React__namespace.useMemo(() => {
|
|
443
|
+
const updatePermissions = userPermissions.find(
|
|
444
|
+
(permission) => permission.subject === contentTypeUid && permission.action === "plugin::content-manager.explorer.update"
|
|
445
|
+
);
|
|
446
|
+
if (!updatePermissions) {
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
return Boolean(!locale || updatePermissions.properties?.locales?.includes(locale));
|
|
450
|
+
}, [contentTypeUid, locale, userPermissions]);
|
|
451
|
+
const {
|
|
452
|
+
allowedActions: { canUpdate: canUpdateContentType }
|
|
453
|
+
} = strapiAdmin.useRBAC({
|
|
454
|
+
updateContentType: [
|
|
455
|
+
{
|
|
456
|
+
action: "plugin::content-manager.explorer.update",
|
|
457
|
+
subject: contentTypeUid
|
|
458
|
+
}
|
|
459
|
+
]
|
|
460
|
+
});
|
|
461
|
+
if (!canUpdateContentType || !canUpdateEntryForLocale) {
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
461
464
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
462
|
-
|
|
465
|
+
StyledMenuItem,
|
|
463
466
|
{
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
children:
|
|
471
|
-
|
|
472
|
-
{
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
},
|
|
478
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil, width: 3, height: 3 }),
|
|
479
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
480
|
-
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
481
|
-
defaultMessage: "Edit entry"
|
|
482
|
-
}) })
|
|
483
|
-
}
|
|
484
|
-
) })
|
|
467
|
+
tag: reactRouterDom.Link,
|
|
468
|
+
isLink: true,
|
|
469
|
+
to: {
|
|
470
|
+
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
471
|
+
search: locale && `?plugins[i18n][locale]=${locale}`
|
|
472
|
+
},
|
|
473
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
474
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, { width: "1.6rem", height: "1.6rem" }),
|
|
475
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
476
|
+
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
477
|
+
defaultMessage: "Edit entry"
|
|
478
|
+
}) })
|
|
479
|
+
] })
|
|
485
480
|
}
|
|
486
481
|
);
|
|
487
482
|
};
|
|
488
|
-
const
|
|
483
|
+
const EditReleaseItem = ({ releaseId }) => {
|
|
484
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
485
|
+
return (
|
|
486
|
+
/* @ts-expect-error inference isn't working in DS */
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { tag: reactRouterDom.Link, isLink: true, to: `/plugins/content-releases/${releaseId}`, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
488
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, { width: "1.6rem", height: "1.6rem" }),
|
|
489
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
490
|
+
id: "content-releases.content-manager-edit-view.edit-release",
|
|
491
|
+
defaultMessage: "Edit release"
|
|
492
|
+
}) })
|
|
493
|
+
] }) })
|
|
494
|
+
);
|
|
495
|
+
};
|
|
496
|
+
const Root = ({ children }) => {
|
|
489
497
|
const { formatMessage } = reactIntl.useIntl();
|
|
498
|
+
const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
|
|
490
499
|
return (
|
|
491
500
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
492
|
-
|
|
493
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
494
|
-
|
|
501
|
+
allowedActions.canDeleteAction || allowedActions.canUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
502
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Trigger, { paddingLeft: 2, paddingRight: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
503
|
+
designSystem.AccessibleIcon,
|
|
495
504
|
{
|
|
496
|
-
|
|
497
|
-
paddingLeft: 2,
|
|
498
|
-
paddingRight: 2,
|
|
499
|
-
"aria-label": formatMessage({
|
|
505
|
+
label: formatMessage({
|
|
500
506
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
501
507
|
defaultMessage: "Release action options"
|
|
502
508
|
}),
|
|
503
|
-
|
|
509
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
|
|
504
510
|
}
|
|
505
|
-
),
|
|
506
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
507
|
-
] })
|
|
511
|
+
) }),
|
|
512
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
513
|
+
] }) : null
|
|
508
514
|
);
|
|
509
515
|
};
|
|
510
516
|
const ReleaseActionMenu = {
|
|
511
517
|
Root,
|
|
518
|
+
EditReleaseItem,
|
|
512
519
|
DeleteReleaseActionItem,
|
|
513
520
|
ReleaseActionEntryLinkItem
|
|
514
521
|
};
|
|
@@ -518,11 +525,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
518
525
|
const getBorderRightRadiusValue = (actionType) => {
|
|
519
526
|
return actionType === "publish" ? 0 : 1;
|
|
520
527
|
};
|
|
521
|
-
const FieldWrapper =
|
|
522
|
-
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
523
|
-
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
524
|
-
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
525
|
-
border-bottom-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
528
|
+
const FieldWrapper = styledComponents.styled(designSystem.Field.Root)`
|
|
529
|
+
border-top-left-radius: ${({ $actionType, theme }) => theme.spaces[getBorderLeftRadiusValue($actionType)]};
|
|
530
|
+
border-bottom-left-radius: ${({ $actionType, theme }) => theme.spaces[getBorderLeftRadiusValue($actionType)]};
|
|
531
|
+
border-top-right-radius: ${({ $actionType, theme }) => theme.spaces[getBorderRightRadiusValue($actionType)]};
|
|
532
|
+
border-bottom-right-radius: ${({ $actionType, theme }) => theme.spaces[getBorderRightRadiusValue($actionType)]};
|
|
526
533
|
|
|
527
534
|
> label {
|
|
528
535
|
color: inherit;
|
|
@@ -533,14 +540,14 @@ const FieldWrapper = styled__default.default(designSystem.Field)`
|
|
|
533
540
|
}
|
|
534
541
|
|
|
535
542
|
&[data-checked='true'] {
|
|
536
|
-
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
537
|
-
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
538
|
-
border-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
543
|
+
color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
544
|
+
background-color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
545
|
+
border-color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
539
546
|
}
|
|
540
547
|
|
|
541
548
|
&[data-checked='false'] {
|
|
542
|
-
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
543
|
-
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
549
|
+
border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
|
|
550
|
+
border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
|
|
544
551
|
}
|
|
545
552
|
|
|
546
553
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -569,7 +576,7 @@ const ActionOption = ({
|
|
|
569
576
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
570
577
|
FieldWrapper,
|
|
571
578
|
{
|
|
572
|
-
actionType,
|
|
579
|
+
$actionType: actionType,
|
|
573
580
|
background: "primary0",
|
|
574
581
|
borderColor: "neutral200",
|
|
575
582
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -577,12 +584,11 @@ const ActionOption = ({
|
|
|
577
584
|
cursor: "pointer",
|
|
578
585
|
"data-checked": selected === actionType,
|
|
579
586
|
"data-disabled": disabled && selected !== actionType,
|
|
580
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
587
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
|
|
581
588
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
582
|
-
designSystem.
|
|
589
|
+
designSystem.Field.Input,
|
|
583
590
|
{
|
|
584
591
|
type: "radio",
|
|
585
|
-
id: `${name}-${actionType}`,
|
|
586
592
|
name,
|
|
587
593
|
checked: selected === actionType,
|
|
588
594
|
onChange: handleChange,
|
|
@@ -635,19 +641,20 @@ const INITIAL_VALUES = {
|
|
|
635
641
|
const NoReleases = () => {
|
|
636
642
|
const { formatMessage } = reactIntl.useIntl();
|
|
637
643
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
638
|
-
|
|
644
|
+
designSystem.EmptyStateLayout,
|
|
639
645
|
{
|
|
640
|
-
|
|
646
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
647
|
+
content: formatMessage({
|
|
641
648
|
id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
|
|
642
649
|
defaultMessage: "No available releases. Open the list of releases and create a new one from there."
|
|
643
|
-
},
|
|
650
|
+
}),
|
|
644
651
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
645
|
-
|
|
652
|
+
designSystem.LinkButton,
|
|
646
653
|
{
|
|
647
654
|
to: {
|
|
648
655
|
pathname: "/plugins/content-releases"
|
|
649
656
|
},
|
|
650
|
-
|
|
657
|
+
tag: reactRouterDom.Link,
|
|
651
658
|
variant: "secondary",
|
|
652
659
|
children: formatMessage({
|
|
653
660
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -659,15 +666,16 @@ const NoReleases = () => {
|
|
|
659
666
|
);
|
|
660
667
|
};
|
|
661
668
|
const AddActionToReleaseModal = ({
|
|
662
|
-
|
|
669
|
+
open,
|
|
670
|
+
onOpenChange,
|
|
663
671
|
contentTypeUid,
|
|
664
672
|
entryId
|
|
665
673
|
}) => {
|
|
666
|
-
const releaseHeaderId = React__namespace.useId();
|
|
667
674
|
const { formatMessage } = reactIntl.useIntl();
|
|
668
|
-
const toggleNotification =
|
|
669
|
-
const { formatAPIError } =
|
|
670
|
-
const {
|
|
675
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
676
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
677
|
+
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
|
678
|
+
const locale = query2.plugins?.i18n?.locale;
|
|
671
679
|
const response = useGetReleasesForEntryQuery({
|
|
672
680
|
contentTypeUid,
|
|
673
681
|
entryId,
|
|
@@ -676,7 +684,6 @@ const AddActionToReleaseModal = ({
|
|
|
676
684
|
const releases = response.data?.data;
|
|
677
685
|
const [createReleaseAction, { isLoading }] = useCreateReleaseActionMutation();
|
|
678
686
|
const handleSubmit = async (values) => {
|
|
679
|
-
const locale = modifiedData.locale;
|
|
680
687
|
const releaseActionEntry = {
|
|
681
688
|
contentType: contentTypeUid,
|
|
682
689
|
id: entryId,
|
|
@@ -694,25 +701,25 @@ const AddActionToReleaseModal = ({
|
|
|
694
701
|
defaultMessage: "Entry added to release"
|
|
695
702
|
})
|
|
696
703
|
});
|
|
697
|
-
|
|
704
|
+
onOpenChange();
|
|
698
705
|
return;
|
|
699
706
|
}
|
|
700
707
|
if ("error" in response2) {
|
|
701
|
-
if (
|
|
708
|
+
if (strapiAdmin.isFetchError(response2.error)) {
|
|
702
709
|
toggleNotification({
|
|
703
|
-
type: "
|
|
710
|
+
type: "danger",
|
|
704
711
|
message: formatAPIError(response2.error)
|
|
705
712
|
});
|
|
706
713
|
} else {
|
|
707
714
|
toggleNotification({
|
|
708
|
-
type: "
|
|
715
|
+
type: "danger",
|
|
709
716
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
710
717
|
});
|
|
711
718
|
}
|
|
712
719
|
}
|
|
713
720
|
};
|
|
714
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
715
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
721
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
|
|
722
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { fontWeight: "bold", children: formatMessage({
|
|
716
723
|
id: "content-releases.content-manager-edit-view.add-to-release",
|
|
717
724
|
defaultMessage: "Add to release"
|
|
718
725
|
}) }) }),
|
|
@@ -724,25 +731,26 @@ const AddActionToReleaseModal = ({
|
|
|
724
731
|
initialValues: INITIAL_VALUES,
|
|
725
732
|
children: ({ values, setFieldValue }) => {
|
|
726
733
|
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
727
|
-
releases?.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(NoReleases, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
728
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.
|
|
729
|
-
designSystem.
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
734
|
+
releases?.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(NoReleases, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
735
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { required: true, children: [
|
|
736
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
737
|
+
id: "content-releases.content-manager-edit-view.add-to-release.select-label",
|
|
738
|
+
defaultMessage: "Select a release"
|
|
739
|
+
}) }),
|
|
740
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
741
|
+
designSystem.SingleSelect,
|
|
742
|
+
{
|
|
743
|
+
placeholder: formatMessage({
|
|
744
|
+
id: "content-releases.content-manager-edit-view.add-to-release.select-placeholder",
|
|
745
|
+
defaultMessage: "Select"
|
|
746
|
+
}),
|
|
747
|
+
onChange: (value) => setFieldValue("releaseId", value),
|
|
748
|
+
value: values.releaseId,
|
|
749
|
+
children: releases?.map((release) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
750
|
+
}
|
|
751
|
+
)
|
|
752
|
+
] }) }),
|
|
753
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
746
754
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
747
755
|
defaultMessage: "What do you want to do with this entry?"
|
|
748
756
|
}) }),
|
|
@@ -755,43 +763,37 @@ const AddActionToReleaseModal = ({
|
|
|
755
763
|
}
|
|
756
764
|
)
|
|
757
765
|
] }) }),
|
|
758
|
-
/* @__PURE__ */ jsxRuntime.
|
|
759
|
-
designSystem.
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
769
|
-
*/
|
|
770
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
771
|
-
id: "content-releases.content-manager-edit-view.add-to-release.continue-button",
|
|
772
|
-
defaultMessage: "Continue"
|
|
773
|
-
}) })
|
|
774
|
-
)
|
|
775
|
-
}
|
|
776
|
-
)
|
|
766
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
|
767
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Close, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", name: "cancel", children: formatMessage({
|
|
768
|
+
id: "content-releases.content-manager-edit-view.add-to-release.cancel-button",
|
|
769
|
+
defaultMessage: "Cancel"
|
|
770
|
+
}) }) }),
|
|
771
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
772
|
+
id: "content-releases.content-manager-edit-view.add-to-release.continue-button",
|
|
773
|
+
defaultMessage: "Continue"
|
|
774
|
+
}) })
|
|
775
|
+
] })
|
|
777
776
|
] });
|
|
778
777
|
}
|
|
779
778
|
}
|
|
780
779
|
)
|
|
781
|
-
] });
|
|
780
|
+
] }) });
|
|
782
781
|
};
|
|
783
782
|
const CMReleasesContainer = () => {
|
|
784
783
|
const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
|
|
785
784
|
const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
|
|
786
|
-
const {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
} =
|
|
785
|
+
const { id, slug, collectionType } = reactRouterDom.useParams();
|
|
786
|
+
const isCreatingEntry = id === "create";
|
|
787
|
+
const entryId = parseInt(id, 10);
|
|
788
|
+
const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
|
|
789
|
+
const { canCreateAction, canRead: canMain, canDeleteAction } = allowedActions;
|
|
790
|
+
const { schema } = strapiAdmin$1.unstable_useDocument({
|
|
791
|
+
collectionType,
|
|
792
|
+
model: slug
|
|
793
|
+
});
|
|
794
|
+
const hasDraftAndPublish = schema?.options?.draftAndPublish;
|
|
792
795
|
const contentTypeUid = slug;
|
|
793
|
-
const
|
|
794
|
-
const canFetch = entryId != null && contentTypeUid != null;
|
|
796
|
+
const canFetch = id != null && contentTypeUid != null;
|
|
795
797
|
const fetchParams = canFetch ? {
|
|
796
798
|
contentTypeUid,
|
|
797
799
|
entryId,
|
|
@@ -812,10 +814,13 @@ const CMReleasesContainer = () => {
|
|
|
812
814
|
}
|
|
813
815
|
return `success${shade}`;
|
|
814
816
|
};
|
|
815
|
-
|
|
817
|
+
if (!canMain) {
|
|
818
|
+
return null;
|
|
819
|
+
}
|
|
820
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
816
821
|
designSystem.Box,
|
|
817
822
|
{
|
|
818
|
-
|
|
823
|
+
tag: "aside",
|
|
819
824
|
"aria-label": formatMessage({
|
|
820
825
|
id: "content-releases.plugin.name",
|
|
821
826
|
defaultMessage: "Releases"
|
|
@@ -839,7 +844,7 @@ const CMReleasesContainer = () => {
|
|
|
839
844
|
alignItems: "start",
|
|
840
845
|
borderWidth: "1px",
|
|
841
846
|
borderStyle: "solid",
|
|
842
|
-
borderColor: getReleaseColorVariant(release.
|
|
847
|
+
borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
|
|
843
848
|
overflow: "hidden",
|
|
844
849
|
hasRadius: true,
|
|
845
850
|
children: [
|
|
@@ -850,28 +855,28 @@ const CMReleasesContainer = () => {
|
|
|
850
855
|
paddingBottom: 3,
|
|
851
856
|
paddingLeft: 4,
|
|
852
857
|
paddingRight: 4,
|
|
853
|
-
background: getReleaseColorVariant(release.
|
|
858
|
+
background: getReleaseColorVariant(release.actions[0].type, "100"),
|
|
854
859
|
width: "100%",
|
|
855
860
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
856
861
|
designSystem.Typography,
|
|
857
862
|
{
|
|
858
863
|
fontSize: 1,
|
|
859
864
|
variant: "pi",
|
|
860
|
-
textColor: getReleaseColorVariant(release.
|
|
865
|
+
textColor: getReleaseColorVariant(release.actions[0].type, "600"),
|
|
861
866
|
children: formatMessage(
|
|
862
867
|
{
|
|
863
868
|
id: "content-releases.content-manager-edit-view.list-releases.title",
|
|
864
869
|
defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
|
|
865
870
|
},
|
|
866
|
-
{ isPublish: release.
|
|
871
|
+
{ isPublish: release.actions[0].type === "publish" }
|
|
867
872
|
)
|
|
868
873
|
}
|
|
869
874
|
)
|
|
870
875
|
}
|
|
871
876
|
),
|
|
872
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
877
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
873
878
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
874
|
-
|
|
879
|
+
release.scheduledAt && release.timezone && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
875
880
|
{
|
|
876
881
|
id: "content-releases.content-manager-edit-view.scheduled.date",
|
|
877
882
|
defaultMessage: "{date} at {time} ({offset})"
|
|
@@ -893,20 +898,23 @@ const CMReleasesContainer = () => {
|
|
|
893
898
|
)
|
|
894
899
|
}
|
|
895
900
|
) }),
|
|
896
|
-
|
|
897
|
-
ReleaseActionMenu.
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
901
|
+
canDeleteAction ? /* @__PURE__ */ jsxRuntime.jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
|
|
902
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
|
|
903
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
904
|
+
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
905
|
+
{
|
|
906
|
+
releaseId: release.id,
|
|
907
|
+
actionId: release.actions[0].id
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
] }) : null
|
|
911
|
+
] }) })
|
|
904
912
|
]
|
|
905
913
|
},
|
|
906
914
|
release.id
|
|
907
915
|
);
|
|
908
916
|
}),
|
|
909
|
-
|
|
917
|
+
canCreateAction ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
910
918
|
designSystem.Button,
|
|
911
919
|
{
|
|
912
920
|
justifyContent: "center",
|
|
@@ -921,42 +929,48 @@ const CMReleasesContainer = () => {
|
|
|
921
929
|
defaultMessage: "Add to release"
|
|
922
930
|
})
|
|
923
931
|
}
|
|
924
|
-
)
|
|
932
|
+
) : null
|
|
925
933
|
] }),
|
|
926
|
-
|
|
934
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
927
935
|
AddActionToReleaseModal,
|
|
928
936
|
{
|
|
929
|
-
|
|
937
|
+
open: isModalOpen,
|
|
938
|
+
onOpenChange: toggleModal,
|
|
930
939
|
contentTypeUid,
|
|
931
940
|
entryId
|
|
932
941
|
}
|
|
933
942
|
)
|
|
934
943
|
]
|
|
935
944
|
}
|
|
936
|
-
)
|
|
945
|
+
);
|
|
946
|
+
};
|
|
947
|
+
const pluginId = "content-releases";
|
|
948
|
+
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
949
|
+
if (!pluginId2) {
|
|
950
|
+
throw new TypeError("pluginId can't be empty");
|
|
951
|
+
}
|
|
952
|
+
return Object.keys(trad).reduce((acc, current) => {
|
|
953
|
+
acc[`${pluginId2}.${current}`] = trad[current];
|
|
954
|
+
return acc;
|
|
955
|
+
}, {});
|
|
937
956
|
};
|
|
938
957
|
const admin = {
|
|
939
958
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
940
959
|
register(app) {
|
|
960
|
+
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
941
961
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
942
962
|
app.addMenuLink({
|
|
943
|
-
to:
|
|
963
|
+
to: `plugins/${pluginId}`,
|
|
944
964
|
icon: icons.PaperPlane,
|
|
945
965
|
intlLabel: {
|
|
946
966
|
id: `${pluginId}.plugin.name`,
|
|
947
967
|
defaultMessage: "Releases"
|
|
948
968
|
},
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
},
|
|
953
|
-
permissions: PERMISSIONS.main
|
|
954
|
-
});
|
|
955
|
-
app.addMiddlewares([() => releaseApi.middleware]);
|
|
956
|
-
app.addReducers({
|
|
957
|
-
[releaseApi.reducerPath]: releaseApi.reducer
|
|
969
|
+
Component: () => Promise.resolve().then(() => require("./App-CEwOQkKT.js")).then((mod) => ({ default: mod.App })),
|
|
970
|
+
permissions: PERMISSIONS.main,
|
|
971
|
+
position: 2
|
|
958
972
|
});
|
|
959
|
-
app.
|
|
973
|
+
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
960
974
|
name: `${pluginId}-link`,
|
|
961
975
|
Component: CMReleasesContainer
|
|
962
976
|
});
|
|
@@ -968,20 +982,22 @@ const admin = {
|
|
|
968
982
|
id: `${pluginId}.plugin.name`,
|
|
969
983
|
defaultMessage: "Releases"
|
|
970
984
|
},
|
|
985
|
+
permissions: [],
|
|
971
986
|
async Component() {
|
|
972
|
-
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-
|
|
973
|
-
return PurchaseContentReleases;
|
|
987
|
+
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-Be3acS2L.js"));
|
|
988
|
+
return { default: PurchaseContentReleases };
|
|
974
989
|
},
|
|
975
|
-
|
|
990
|
+
licenseOnly: true,
|
|
991
|
+
position: 2
|
|
976
992
|
});
|
|
977
993
|
}
|
|
978
994
|
},
|
|
979
995
|
async registerTrads({ locales }) {
|
|
980
996
|
const importedTrads = await Promise.all(
|
|
981
997
|
locales.map((locale) => {
|
|
982
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
|
998
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-DtFJ5ViE.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
983
999
|
return {
|
|
984
|
-
data:
|
|
1000
|
+
data: prefixPluginTranslations(data, "content-releases"),
|
|
985
1001
|
locale
|
|
986
1002
|
};
|
|
987
1003
|
}).catch(() => {
|
|
@@ -1000,7 +1016,6 @@ exports.ReleaseActionMenu = ReleaseActionMenu;
|
|
|
1000
1016
|
exports.ReleaseActionOptions = ReleaseActionOptions;
|
|
1001
1017
|
exports.admin = admin;
|
|
1002
1018
|
exports.getTimezoneOffset = getTimezoneOffset;
|
|
1003
|
-
exports.isAxiosError = isAxiosError;
|
|
1004
1019
|
exports.pluginId = pluginId;
|
|
1005
1020
|
exports.releaseApi = releaseApi;
|
|
1006
1021
|
exports.useCreateReleaseMutation = useCreateReleaseMutation;
|
|
@@ -1009,7 +1024,6 @@ exports.useGetReleaseActionsQuery = useGetReleaseActionsQuery;
|
|
|
1009
1024
|
exports.useGetReleaseQuery = useGetReleaseQuery;
|
|
1010
1025
|
exports.useGetReleasesQuery = useGetReleasesQuery;
|
|
1011
1026
|
exports.usePublishReleaseMutation = usePublishReleaseMutation;
|
|
1012
|
-
exports.useTypedDispatch = useTypedDispatch;
|
|
1013
1027
|
exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
|
|
1014
1028
|
exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
|
|
1015
|
-
//# sourceMappingURL=index-
|
|
1029
|
+
//# sourceMappingURL=index-BrWv-zV4.js.map
|