@strapi/content-releases 5.0.0-beta.1 → 5.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{App-X01LBg5V.mjs → App-B2R2exNT.mjs} +245 -251
- package/dist/_chunks/App-B2R2exNT.mjs.map +1 -0
- package/dist/_chunks/{App-1LckaIGY.js → App-CEwOQkKT.js} +253 -260
- package/dist/_chunks/App-CEwOQkKT.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-Be3acS2L.js} +8 -7
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +9 -8
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-RdapH-9X.mjs → en-B9Ur3VsE.mjs} +11 -2
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-faJDuv3q.js → en-DtFJ5ViE.js} +11 -2
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-cYWov2wa.js → index-BrWv-zV4.js} +167 -192
- package/dist/_chunks/index-BrWv-zV4.js.map +1 -0
- package/dist/_chunks/{index-OD9AlD-6.mjs → index-DbmynICx.mjs} +168 -191
- package/dist/_chunks/index-DbmynICx.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/src/components/CMReleasesContainer.d.ts +21 -0
- package/dist/admin/src/components/ReleaseAction.d.ts +3 -0
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +1 -1
- package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +3 -2
- package/dist/admin/src/services/release.d.ts +44 -308
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/dist/server/index.js +93 -32
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +93 -32
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts +1 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/release.d.ts +1 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -1
- package/dist/server/src/destroy.d.ts +1 -1
- package/dist/server/src/destroy.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +9 -8
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/migrations/index.d.ts.map +1 -1
- package/dist/server/src/register.d.ts +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/release.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -4
- package/dist/server/src/services/release.d.ts +3 -3
- package/dist/server/src/services/release.d.ts.map +1 -1
- package/dist/server/src/services/scheduling.d.ts +1 -1
- package/dist/server/src/services/scheduling.d.ts.map +1 -1
- package/dist/server/src/services/validation.d.ts +1 -1
- package/dist/server/src/services/validation.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +9 -9
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/releases.d.ts +17 -1
- package/dist/shared/contracts/releases.d.ts.map +1 -1
- package/package.json +18 -18
- package/dist/_chunks/App-1LckaIGY.js.map +0 -1
- package/dist/_chunks/App-X01LBg5V.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +0 -1
- package/dist/_chunks/en-RdapH-9X.mjs.map +0 -1
- package/dist/_chunks/en-faJDuv3q.js.map +0 -1
- package/dist/_chunks/index-OD9AlD-6.mjs.map +0 -1
- package/dist/_chunks/index-cYWov2wa.js.map +0 -1
- package/dist/admin/src/services/axios.d.ts +0 -29
|
@@ -4,16 +4,14 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const query = require("@reduxjs/toolkit/query");
|
|
6
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 _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
|
+
const styledComponents = require("styled-components");
|
|
17
15
|
function _interopNamespace(e) {
|
|
18
16
|
if (e && e.__esModule)
|
|
19
17
|
return e;
|
|
@@ -34,7 +32,6 @@ function _interopNamespace(e) {
|
|
|
34
32
|
}
|
|
35
33
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
36
34
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
37
|
-
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
38
35
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
39
36
|
const v = glob[path];
|
|
40
37
|
if (v) {
|
|
@@ -116,49 +113,9 @@ const PERMISSIONS = {
|
|
|
116
113
|
}
|
|
117
114
|
]
|
|
118
115
|
};
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
method,
|
|
123
|
-
data,
|
|
124
|
-
config
|
|
125
|
-
}) => {
|
|
126
|
-
try {
|
|
127
|
-
const { get, post, del, put } = strapiAdmin.getFetchClient();
|
|
128
|
-
if (method === "POST") {
|
|
129
|
-
const result2 = await post(url, data, config);
|
|
130
|
-
return { data: result2.data };
|
|
131
|
-
}
|
|
132
|
-
if (method === "DELETE") {
|
|
133
|
-
const result2 = await del(url, config);
|
|
134
|
-
return { data: result2.data };
|
|
135
|
-
}
|
|
136
|
-
if (method === "PUT") {
|
|
137
|
-
const result2 = await put(url, data, config);
|
|
138
|
-
return { data: result2.data };
|
|
139
|
-
}
|
|
140
|
-
const result = await get(url, config);
|
|
141
|
-
return { data: result.data };
|
|
142
|
-
} catch (error) {
|
|
143
|
-
const err = error;
|
|
144
|
-
return {
|
|
145
|
-
error: {
|
|
146
|
-
status: err.response?.status,
|
|
147
|
-
code: err.code,
|
|
148
|
-
response: {
|
|
149
|
-
data: err.response?.data
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const isAxiosError = (err) => {
|
|
156
|
-
return typeof err === "object" && err !== null && "response" in err && typeof err.response === "object" && err.response !== null && "data" in err.response;
|
|
157
|
-
};
|
|
158
|
-
const releaseApi = react.createApi({
|
|
159
|
-
reducerPath: pluginId,
|
|
160
|
-
baseQuery: axiosBaseQuery,
|
|
161
|
-
tagTypes: ["Release", "ReleaseAction"],
|
|
116
|
+
const releaseApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
117
|
+
addTagTypes: ["Release", "ReleaseAction", "EntriesInRelease"]
|
|
118
|
+
}).injectEndpoints({
|
|
162
119
|
endpoints: (build) => {
|
|
163
120
|
return {
|
|
164
121
|
getReleasesForEntry: build.query({
|
|
@@ -273,6 +230,20 @@ const releaseApi = react.createApi({
|
|
|
273
230
|
{ type: "ReleaseAction", id: "LIST" }
|
|
274
231
|
]
|
|
275
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
|
+
}),
|
|
276
247
|
updateReleaseAction: build.mutation({
|
|
277
248
|
query({ body, params }) {
|
|
278
249
|
return {
|
|
@@ -288,13 +259,17 @@ const releaseApi = react.createApi({
|
|
|
288
259
|
...query2
|
|
289
260
|
};
|
|
290
261
|
const patchResult = dispatch(
|
|
291
|
-
releaseApi.util.updateQueryData(
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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
|
+
}
|
|
296
271
|
}
|
|
297
|
-
|
|
272
|
+
)
|
|
298
273
|
);
|
|
299
274
|
try {
|
|
300
275
|
await queryFulfilled;
|
|
@@ -313,7 +288,8 @@ const releaseApi = react.createApi({
|
|
|
313
288
|
invalidatesTags: (result, error, arg) => [
|
|
314
289
|
{ type: "Release", id: "LIST" },
|
|
315
290
|
{ type: "Release", id: arg.params.releaseId },
|
|
316
|
-
{ type: "ReleaseAction", id: "LIST" }
|
|
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: () => [{ type: "Release", id: "LIST" }]
|
|
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,14 +359,12 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
366
359
|
return "";
|
|
367
360
|
}
|
|
368
361
|
};
|
|
369
|
-
const StyledMenuItem =
|
|
362
|
+
const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
370
363
|
&:hover {
|
|
371
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
364
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
372
365
|
|
|
373
366
|
svg {
|
|
374
|
-
|
|
375
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
376
|
-
}
|
|
367
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
377
368
|
}
|
|
378
369
|
|
|
379
370
|
a {
|
|
@@ -382,9 +373,7 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
382
373
|
}
|
|
383
374
|
|
|
384
375
|
svg {
|
|
385
|
-
|
|
386
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
387
|
-
}
|
|
376
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
388
377
|
}
|
|
389
378
|
|
|
390
379
|
a {
|
|
@@ -396,10 +385,6 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
396
385
|
width: 100%;
|
|
397
386
|
}
|
|
398
387
|
`;
|
|
399
|
-
const StyledIconButton = styled__default.default(designSystem.IconButton)`
|
|
400
|
-
/* Setting this style inline with borderColor will not apply the style */
|
|
401
|
-
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
402
|
-
`;
|
|
403
388
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
404
389
|
const { formatMessage } = reactIntl.useIntl();
|
|
405
390
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
@@ -423,7 +408,7 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
423
408
|
return;
|
|
424
409
|
}
|
|
425
410
|
if ("error" in response) {
|
|
426
|
-
if (
|
|
411
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
427
412
|
toggleNotification({
|
|
428
413
|
type: "danger",
|
|
429
414
|
message: formatAPIError(response.error)
|
|
@@ -439,8 +424,8 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
439
424
|
if (!canDeleteAction) {
|
|
440
425
|
return null;
|
|
441
426
|
}
|
|
442
|
-
return /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
443
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
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" }),
|
|
444
429
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
445
430
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
446
431
|
defaultMessage: "Remove from release"
|
|
@@ -464,7 +449,7 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
464
449
|
return Boolean(!locale || updatePermissions.properties?.locales?.includes(locale));
|
|
465
450
|
}, [contentTypeUid, locale, userPermissions]);
|
|
466
451
|
const {
|
|
467
|
-
allowedActions: { canUpdateContentType }
|
|
452
|
+
allowedActions: { canUpdate: canUpdateContentType }
|
|
468
453
|
} = strapiAdmin.useRBAC({
|
|
469
454
|
updateContentType: [
|
|
470
455
|
{
|
|
@@ -476,57 +461,55 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
476
461
|
if (!canUpdateContentType || !canUpdateEntryForLocale) {
|
|
477
462
|
return null;
|
|
478
463
|
}
|
|
479
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
480
|
-
|
|
464
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
465
|
+
StyledMenuItem,
|
|
481
466
|
{
|
|
482
|
-
|
|
467
|
+
tag: reactRouterDom.Link,
|
|
468
|
+
isLink: true,
|
|
483
469
|
to: {
|
|
484
470
|
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
485
471
|
search: locale && `?plugins[i18n][locale]=${locale}`
|
|
486
472
|
},
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
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
|
+
] })
|
|
492
480
|
}
|
|
493
|
-
)
|
|
481
|
+
);
|
|
494
482
|
};
|
|
495
483
|
const EditReleaseItem = ({ releaseId }) => {
|
|
496
484
|
const { formatMessage } = reactIntl.useIntl();
|
|
497
|
-
return
|
|
498
|
-
|
|
499
|
-
{
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
isExternal: false,
|
|
503
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
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({
|
|
504
490
|
id: "content-releases.content-manager-edit-view.edit-release",
|
|
505
491
|
defaultMessage: "Edit release"
|
|
506
492
|
}) })
|
|
507
|
-
}
|
|
508
|
-
)
|
|
493
|
+
] }) })
|
|
494
|
+
);
|
|
509
495
|
};
|
|
510
|
-
const Root = ({ children
|
|
496
|
+
const Root = ({ children }) => {
|
|
511
497
|
const { formatMessage } = reactIntl.useIntl();
|
|
512
498
|
const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
|
|
513
499
|
return (
|
|
514
500
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
515
|
-
allowedActions.canDeleteAction || allowedActions.canUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
516
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
517
|
-
|
|
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,
|
|
518
504
|
{
|
|
519
|
-
|
|
520
|
-
paddingLeft: 2,
|
|
521
|
-
paddingRight: 2,
|
|
522
|
-
"aria-label": formatMessage({
|
|
505
|
+
label: formatMessage({
|
|
523
506
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
524
507
|
defaultMessage: "Release action options"
|
|
525
508
|
}),
|
|
526
|
-
|
|
509
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
|
|
527
510
|
}
|
|
528
|
-
),
|
|
529
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
511
|
+
) }),
|
|
512
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
530
513
|
] }) : null
|
|
531
514
|
);
|
|
532
515
|
};
|
|
@@ -542,11 +525,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
542
525
|
const getBorderRightRadiusValue = (actionType) => {
|
|
543
526
|
return actionType === "publish" ? 0 : 1;
|
|
544
527
|
};
|
|
545
|
-
const FieldWrapper =
|
|
546
|
-
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
547
|
-
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
548
|
-
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
549
|
-
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)]};
|
|
550
533
|
|
|
551
534
|
> label {
|
|
552
535
|
color: inherit;
|
|
@@ -557,14 +540,14 @@ const FieldWrapper = styled__default.default(designSystem.Field)`
|
|
|
557
540
|
}
|
|
558
541
|
|
|
559
542
|
&[data-checked='true'] {
|
|
560
|
-
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
561
|
-
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
562
|
-
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};
|
|
563
546
|
}
|
|
564
547
|
|
|
565
548
|
&[data-checked='false'] {
|
|
566
|
-
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
567
|
-
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
549
|
+
border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
|
|
550
|
+
border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
|
|
568
551
|
}
|
|
569
552
|
|
|
570
553
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -593,7 +576,7 @@ const ActionOption = ({
|
|
|
593
576
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
594
577
|
FieldWrapper,
|
|
595
578
|
{
|
|
596
|
-
actionType,
|
|
579
|
+
$actionType: actionType,
|
|
597
580
|
background: "primary0",
|
|
598
581
|
borderColor: "neutral200",
|
|
599
582
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -601,12 +584,11 @@ const ActionOption = ({
|
|
|
601
584
|
cursor: "pointer",
|
|
602
585
|
"data-checked": selected === actionType,
|
|
603
586
|
"data-disabled": disabled && selected !== actionType,
|
|
604
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
587
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
|
|
605
588
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
606
|
-
designSystem.
|
|
589
|
+
designSystem.Field.Input,
|
|
607
590
|
{
|
|
608
591
|
type: "radio",
|
|
609
|
-
id: `${name}-${actionType}`,
|
|
610
592
|
name,
|
|
611
593
|
checked: selected === actionType,
|
|
612
594
|
onChange: handleChange,
|
|
@@ -661,18 +643,18 @@ const NoReleases = () => {
|
|
|
661
643
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
662
644
|
designSystem.EmptyStateLayout,
|
|
663
645
|
{
|
|
664
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
646
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
665
647
|
content: formatMessage({
|
|
666
648
|
id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
|
|
667
649
|
defaultMessage: "No available releases. Open the list of releases and create a new one from there."
|
|
668
650
|
}),
|
|
669
651
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
670
|
-
|
|
652
|
+
designSystem.LinkButton,
|
|
671
653
|
{
|
|
672
654
|
to: {
|
|
673
655
|
pathname: "/plugins/content-releases"
|
|
674
656
|
},
|
|
675
|
-
|
|
657
|
+
tag: reactRouterDom.Link,
|
|
676
658
|
variant: "secondary",
|
|
677
659
|
children: formatMessage({
|
|
678
660
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -684,11 +666,11 @@ const NoReleases = () => {
|
|
|
684
666
|
);
|
|
685
667
|
};
|
|
686
668
|
const AddActionToReleaseModal = ({
|
|
687
|
-
|
|
669
|
+
open,
|
|
670
|
+
onOpenChange,
|
|
688
671
|
contentTypeUid,
|
|
689
672
|
entryId
|
|
690
673
|
}) => {
|
|
691
|
-
const releaseHeaderId = React__namespace.useId();
|
|
692
674
|
const { formatMessage } = reactIntl.useIntl();
|
|
693
675
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
694
676
|
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
@@ -719,11 +701,11 @@ const AddActionToReleaseModal = ({
|
|
|
719
701
|
defaultMessage: "Entry added to release"
|
|
720
702
|
})
|
|
721
703
|
});
|
|
722
|
-
|
|
704
|
+
onOpenChange();
|
|
723
705
|
return;
|
|
724
706
|
}
|
|
725
707
|
if ("error" in response2) {
|
|
726
|
-
if (
|
|
708
|
+
if (strapiAdmin.isFetchError(response2.error)) {
|
|
727
709
|
toggleNotification({
|
|
728
710
|
type: "danger",
|
|
729
711
|
message: formatAPIError(response2.error)
|
|
@@ -736,8 +718,8 @@ const AddActionToReleaseModal = ({
|
|
|
736
718
|
}
|
|
737
719
|
}
|
|
738
720
|
};
|
|
739
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
740
|
-
/* @__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({
|
|
741
723
|
id: "content-releases.content-manager-edit-view.add-to-release",
|
|
742
724
|
defaultMessage: "Add to release"
|
|
743
725
|
}) }) }),
|
|
@@ -749,25 +731,26 @@ const AddActionToReleaseModal = ({
|
|
|
749
731
|
initialValues: INITIAL_VALUES,
|
|
750
732
|
children: ({ values, setFieldValue }) => {
|
|
751
733
|
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
752
|
-
releases?.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(NoReleases, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
753
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.
|
|
754
|
-
designSystem.
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
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({
|
|
771
754
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
772
755
|
defaultMessage: "What do you want to do with this entry?"
|
|
773
756
|
}) }),
|
|
@@ -780,40 +763,31 @@ const AddActionToReleaseModal = ({
|
|
|
780
763
|
}
|
|
781
764
|
)
|
|
782
765
|
] }) }),
|
|
783
|
-
/* @__PURE__ */ jsxRuntime.
|
|
784
|
-
designSystem.
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
794
|
-
*/
|
|
795
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
796
|
-
id: "content-releases.content-manager-edit-view.add-to-release.continue-button",
|
|
797
|
-
defaultMessage: "Continue"
|
|
798
|
-
}) })
|
|
799
|
-
)
|
|
800
|
-
}
|
|
801
|
-
)
|
|
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
|
+
] })
|
|
802
776
|
] });
|
|
803
777
|
}
|
|
804
778
|
}
|
|
805
779
|
)
|
|
806
|
-
] });
|
|
780
|
+
] }) });
|
|
807
781
|
};
|
|
808
782
|
const CMReleasesContainer = () => {
|
|
809
783
|
const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
|
|
810
784
|
const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
|
|
811
785
|
const { id, slug, collectionType } = reactRouterDom.useParams();
|
|
812
786
|
const isCreatingEntry = id === "create";
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
} =
|
|
816
|
-
const { schema } = strapiAdmin.unstable_useDocument({
|
|
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({
|
|
817
791
|
collectionType,
|
|
818
792
|
model: slug
|
|
819
793
|
});
|
|
@@ -822,7 +796,7 @@ const CMReleasesContainer = () => {
|
|
|
822
796
|
const canFetch = id != null && contentTypeUid != null;
|
|
823
797
|
const fetchParams = canFetch ? {
|
|
824
798
|
contentTypeUid,
|
|
825
|
-
entryId
|
|
799
|
+
entryId,
|
|
826
800
|
hasEntryAttached: true
|
|
827
801
|
} : query.skipToken;
|
|
828
802
|
const response = useGetReleasesForEntryQuery(fetchParams);
|
|
@@ -846,7 +820,7 @@ const CMReleasesContainer = () => {
|
|
|
846
820
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
847
821
|
designSystem.Box,
|
|
848
822
|
{
|
|
849
|
-
|
|
823
|
+
tag: "aside",
|
|
850
824
|
"aria-label": formatMessage({
|
|
851
825
|
id: "content-releases.plugin.name",
|
|
852
826
|
defaultMessage: "Releases"
|
|
@@ -870,7 +844,7 @@ const CMReleasesContainer = () => {
|
|
|
870
844
|
alignItems: "start",
|
|
871
845
|
borderWidth: "1px",
|
|
872
846
|
borderStyle: "solid",
|
|
873
|
-
borderColor: getReleaseColorVariant(release.
|
|
847
|
+
borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
|
|
874
848
|
overflow: "hidden",
|
|
875
849
|
hasRadius: true,
|
|
876
850
|
children: [
|
|
@@ -881,20 +855,20 @@ const CMReleasesContainer = () => {
|
|
|
881
855
|
paddingBottom: 3,
|
|
882
856
|
paddingLeft: 4,
|
|
883
857
|
paddingRight: 4,
|
|
884
|
-
background: getReleaseColorVariant(release.
|
|
858
|
+
background: getReleaseColorVariant(release.actions[0].type, "100"),
|
|
885
859
|
width: "100%",
|
|
886
860
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
887
861
|
designSystem.Typography,
|
|
888
862
|
{
|
|
889
863
|
fontSize: 1,
|
|
890
864
|
variant: "pi",
|
|
891
|
-
textColor: getReleaseColorVariant(release.
|
|
865
|
+
textColor: getReleaseColorVariant(release.actions[0].type, "600"),
|
|
892
866
|
children: formatMessage(
|
|
893
867
|
{
|
|
894
868
|
id: "content-releases.content-manager-edit-view.list-releases.title",
|
|
895
869
|
defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
|
|
896
870
|
},
|
|
897
|
-
{ isPublish: release.
|
|
871
|
+
{ isPublish: release.actions[0].type === "publish" }
|
|
898
872
|
)
|
|
899
873
|
}
|
|
900
874
|
)
|
|
@@ -930,7 +904,7 @@ const CMReleasesContainer = () => {
|
|
|
930
904
|
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
931
905
|
{
|
|
932
906
|
releaseId: release.id,
|
|
933
|
-
actionId: release.
|
|
907
|
+
actionId: release.actions[0].id
|
|
934
908
|
}
|
|
935
909
|
)
|
|
936
910
|
] }) : null
|
|
@@ -957,18 +931,20 @@ const CMReleasesContainer = () => {
|
|
|
957
931
|
}
|
|
958
932
|
) : null
|
|
959
933
|
] }),
|
|
960
|
-
|
|
934
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
961
935
|
AddActionToReleaseModal,
|
|
962
936
|
{
|
|
963
|
-
|
|
937
|
+
open: isModalOpen,
|
|
938
|
+
onOpenChange: toggleModal,
|
|
964
939
|
contentTypeUid,
|
|
965
|
-
entryId
|
|
940
|
+
entryId
|
|
966
941
|
}
|
|
967
942
|
)
|
|
968
943
|
]
|
|
969
944
|
}
|
|
970
945
|
);
|
|
971
946
|
};
|
|
947
|
+
const pluginId = "content-releases";
|
|
972
948
|
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
973
949
|
if (!pluginId2) {
|
|
974
950
|
throw new TypeError("pluginId can't be empty");
|
|
@@ -981,6 +957,7 @@ const prefixPluginTranslations = (trad, pluginId2) => {
|
|
|
981
957
|
const admin = {
|
|
982
958
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
983
959
|
register(app) {
|
|
960
|
+
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
984
961
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
985
962
|
app.addMenuLink({
|
|
986
963
|
to: `plugins/${pluginId}`,
|
|
@@ -989,14 +966,11 @@ const admin = {
|
|
|
989
966
|
id: `${pluginId}.plugin.name`,
|
|
990
967
|
defaultMessage: "Releases"
|
|
991
968
|
},
|
|
992
|
-
Component: () => Promise.resolve().then(() => require("./App-
|
|
993
|
-
permissions: PERMISSIONS.main
|
|
994
|
-
|
|
995
|
-
app.addMiddlewares([() => releaseApi.middleware]);
|
|
996
|
-
app.addReducers({
|
|
997
|
-
[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
|
|
998
972
|
});
|
|
999
|
-
app.
|
|
973
|
+
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
1000
974
|
name: `${pluginId}-link`,
|
|
1001
975
|
Component: CMReleasesContainer
|
|
1002
976
|
});
|
|
@@ -1008,18 +982,20 @@ const admin = {
|
|
|
1008
982
|
id: `${pluginId}.plugin.name`,
|
|
1009
983
|
defaultMessage: "Releases"
|
|
1010
984
|
},
|
|
985
|
+
permissions: [],
|
|
1011
986
|
async Component() {
|
|
1012
|
-
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-
|
|
1013
|
-
return PurchaseContentReleases;
|
|
987
|
+
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-Be3acS2L.js"));
|
|
988
|
+
return { default: PurchaseContentReleases };
|
|
1014
989
|
},
|
|
1015
|
-
|
|
990
|
+
licenseOnly: true,
|
|
991
|
+
position: 2
|
|
1016
992
|
});
|
|
1017
993
|
}
|
|
1018
994
|
},
|
|
1019
995
|
async registerTrads({ locales }) {
|
|
1020
996
|
const importedTrads = await Promise.all(
|
|
1021
997
|
locales.map((locale) => {
|
|
1022
|
-
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 }) => {
|
|
1023
999
|
return {
|
|
1024
1000
|
data: prefixPluginTranslations(data, "content-releases"),
|
|
1025
1001
|
locale
|
|
@@ -1040,7 +1016,6 @@ exports.ReleaseActionMenu = ReleaseActionMenu;
|
|
|
1040
1016
|
exports.ReleaseActionOptions = ReleaseActionOptions;
|
|
1041
1017
|
exports.admin = admin;
|
|
1042
1018
|
exports.getTimezoneOffset = getTimezoneOffset;
|
|
1043
|
-
exports.isAxiosError = isAxiosError;
|
|
1044
1019
|
exports.pluginId = pluginId;
|
|
1045
1020
|
exports.releaseApi = releaseApi;
|
|
1046
1021
|
exports.useCreateReleaseMutation = useCreateReleaseMutation;
|
|
@@ -1051,4 +1026,4 @@ exports.useGetReleasesQuery = useGetReleasesQuery;
|
|
|
1051
1026
|
exports.usePublishReleaseMutation = usePublishReleaseMutation;
|
|
1052
1027
|
exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
|
|
1053
1028
|
exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
|
|
1054
|
-
//# sourceMappingURL=index-
|
|
1029
|
+
//# sourceMappingURL=index-BrWv-zV4.js.map
|