@strapi/content-releases 0.0.0-experimental.d5b46d578a5c055b8dcc66939e1b5d540976fafb → 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-OP70yd5M.js → App-CqbuK4M6.js} +440 -433
- package/dist/_chunks/App-CqbuK4M6.js.map +1 -0
- package/dist/_chunks/{App-x6Tjj3HN.mjs → App-Do-Rnv0A.mjs} +418 -410
- package/dist/_chunks/App-Do-Rnv0A.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-bpIYXOfu.js → PurchaseContentReleases-Be3acS2L.js} +7 -6
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-3tRbmbY3.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +8 -7
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-bpHsnU0n.mjs → en-B9Ur3VsE.mjs} +2 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-3SGjiVyR.js → en-DtFJ5ViE.js} +2 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-1ejXLtzt.mjs → index-D_pgdqQL.mjs} +227 -420
- package/dist/_chunks/index-D_pgdqQL.mjs.map +1 -0
- package/dist/_chunks/{index-ydocdaZ0.js → index-Tedsw4GC.js} +227 -422
- 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 +152 -93
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +153 -93
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/bootstrap.d.ts.map +1 -0
- package/dist/server/src/constants.d.ts +12 -0
- package/dist/server/src/constants.d.ts.map +1 -0
- package/dist/server/src/content-types/index.d.ts +99 -0
- package/dist/server/src/content-types/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/index.d.ts +48 -0
- package/dist/server/src/content-types/release/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/schema.d.ts +47 -0
- package/dist/server/src/content-types/release/schema.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/index.d.ts +50 -0
- package/dist/server/src/content-types/release-action/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/schema.d.ts +49 -0
- package/dist/server/src/content-types/release-action/schema.d.ts.map +1 -0
- package/dist/server/src/controllers/index.d.ts +20 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -0
- package/dist/server/src/controllers/release-action.d.ts +10 -0
- package/dist/server/src/controllers/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/release.d.ts +12 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release-action.d.ts +8 -0
- package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release.d.ts +2 -0
- package/dist/server/src/controllers/validation/release.d.ts.map +1 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/destroy.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +2096 -0
- package/dist/server/src/index.d.ts.map +1 -0
- package/dist/server/src/migrations/index.d.ts +13 -0
- package/dist/server/src/migrations/index.d.ts.map +1 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/register.d.ts.map +1 -0
- package/dist/server/src/routes/index.d.ts +35 -0
- package/dist/server/src/routes/index.d.ts.map +1 -0
- package/dist/server/src/routes/release-action.d.ts +18 -0
- package/dist/server/src/routes/release-action.d.ts.map +1 -0
- package/dist/server/src/routes/release.d.ts +18 -0
- package/dist/server/src/routes/release.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +1826 -0
- package/dist/server/src/services/index.d.ts.map +1 -0
- package/dist/server/src/services/release.d.ts +66 -0
- package/dist/server/src/services/release.d.ts.map +1 -0
- package/dist/server/src/services/scheduling.d.ts +18 -0
- package/dist/server/src/services/scheduling.d.ts.map +1 -0
- package/dist/server/src/services/validation.d.ts +18 -0
- package/dist/server/src/services/validation.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +14 -0
- package/dist/server/src/utils/index.d.ts.map +1 -0
- package/dist/shared/contracts/release-actions.d.ts +131 -0
- package/dist/shared/contracts/release-actions.d.ts.map +1 -0
- package/dist/shared/contracts/releases.d.ts +182 -0
- package/dist/shared/contracts/releases.d.ts.map +1 -0
- package/dist/shared/types.d.ts +24 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/validation-schemas.d.ts +2 -0
- package/dist/shared/validation-schemas.d.ts.map +1 -0
- package/package.json +29 -36
- package/dist/_chunks/App-OP70yd5M.js.map +0 -1
- package/dist/_chunks/App-x6Tjj3HN.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +0 -1
- package/dist/_chunks/en-3SGjiVyR.js.map +0 -1
- package/dist/_chunks/en-bpHsnU0n.mjs.map +0 -1
- package/dist/_chunks/index-1ejXLtzt.mjs.map +0 -1
- package/dist/_chunks/index-ydocdaZ0.js.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({
|
|
@@ -284,7 +240,8 @@ const releaseApi = react.createApi({
|
|
|
284
240
|
},
|
|
285
241
|
invalidatesTags: [
|
|
286
242
|
{ type: "Release", id: "LIST" },
|
|
287
|
-
{ type: "ReleaseAction", id: "LIST" }
|
|
243
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
244
|
+
{ type: "EntriesInRelease" }
|
|
288
245
|
]
|
|
289
246
|
}),
|
|
290
247
|
updateReleaseAction: build.mutation({
|
|
@@ -302,13 +259,17 @@ const releaseApi = react.createApi({
|
|
|
302
259
|
...query2
|
|
303
260
|
};
|
|
304
261
|
const patchResult = dispatch(
|
|
305
|
-
releaseApi.util.updateQueryData(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
+
}
|
|
310
271
|
}
|
|
311
|
-
|
|
272
|
+
)
|
|
312
273
|
);
|
|
313
274
|
try {
|
|
314
275
|
await queryFulfilled;
|
|
@@ -327,7 +288,8 @@ const releaseApi = react.createApi({
|
|
|
327
288
|
invalidatesTags: (result, error, arg) => [
|
|
328
289
|
{ type: "Release", id: "LIST" },
|
|
329
290
|
{ type: "Release", id: arg.params.releaseId },
|
|
330
|
-
{ type: "ReleaseAction", id: "LIST" }
|
|
291
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
292
|
+
{ type: "EntriesInRelease" }
|
|
331
293
|
]
|
|
332
294
|
}),
|
|
333
295
|
publishRelease: build.mutation({
|
|
@@ -346,7 +308,22 @@ const releaseApi = react.createApi({
|
|
|
346
308
|
method: "DELETE"
|
|
347
309
|
};
|
|
348
310
|
},
|
|
349
|
-
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" }]
|
|
350
327
|
})
|
|
351
328
|
};
|
|
352
329
|
}
|
|
@@ -363,7 +340,8 @@ const {
|
|
|
363
340
|
useUpdateReleaseActionMutation,
|
|
364
341
|
usePublishReleaseMutation,
|
|
365
342
|
useDeleteReleaseActionMutation,
|
|
366
|
-
useDeleteReleaseMutation
|
|
343
|
+
useDeleteReleaseMutation,
|
|
344
|
+
useGetMappedEntriesInReleasesQuery
|
|
367
345
|
} = releaseApi;
|
|
368
346
|
const getTimezoneOffset = (timezone, date) => {
|
|
369
347
|
try {
|
|
@@ -381,16 +359,12 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
381
359
|
return "";
|
|
382
360
|
}
|
|
383
361
|
};
|
|
384
|
-
const
|
|
385
|
-
const useTypedSelector = reactRedux.useSelector;
|
|
386
|
-
const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
362
|
+
const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
387
363
|
&:hover {
|
|
388
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
364
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
389
365
|
|
|
390
366
|
svg {
|
|
391
|
-
|
|
392
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
393
|
-
}
|
|
367
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
394
368
|
}
|
|
395
369
|
|
|
396
370
|
a {
|
|
@@ -399,9 +373,7 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
399
373
|
}
|
|
400
374
|
|
|
401
375
|
svg {
|
|
402
|
-
|
|
403
|
-
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
404
|
-
}
|
|
376
|
+
fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
|
|
405
377
|
}
|
|
406
378
|
|
|
407
379
|
a {
|
|
@@ -413,15 +385,14 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
|
413
385
|
width: 100%;
|
|
414
386
|
}
|
|
415
387
|
`;
|
|
416
|
-
const StyledIconButton = styled__default.default(designSystem.IconButton)`
|
|
417
|
-
/* Setting this style inline with borderColor will not apply the style */
|
|
418
|
-
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
419
|
-
`;
|
|
420
388
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
421
389
|
const { formatMessage } = reactIntl.useIntl();
|
|
422
|
-
const toggleNotification =
|
|
423
|
-
const { formatAPIError } =
|
|
390
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
391
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
424
392
|
const [deleteReleaseAction] = useDeleteReleaseActionMutation();
|
|
393
|
+
const {
|
|
394
|
+
allowedActions: { canDeleteAction }
|
|
395
|
+
} = strapiAdmin.useRBAC(PERMISSIONS);
|
|
425
396
|
const handleDeleteAction = async () => {
|
|
426
397
|
const response = await deleteReleaseAction({
|
|
427
398
|
params: { releaseId, actionId }
|
|
@@ -437,26 +408,29 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
437
408
|
return;
|
|
438
409
|
}
|
|
439
410
|
if ("error" in response) {
|
|
440
|
-
if (
|
|
411
|
+
if (strapiAdmin.isFetchError(response.error)) {
|
|
441
412
|
toggleNotification({
|
|
442
|
-
type: "
|
|
413
|
+
type: "danger",
|
|
443
414
|
message: formatAPIError(response.error)
|
|
444
415
|
});
|
|
445
416
|
} else {
|
|
446
417
|
toggleNotification({
|
|
447
|
-
type: "
|
|
418
|
+
type: "danger",
|
|
448
419
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
449
420
|
});
|
|
450
421
|
}
|
|
451
422
|
}
|
|
452
423
|
};
|
|
453
|
-
|
|
454
|
-
|
|
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" }),
|
|
455
429
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
456
430
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
457
431
|
defaultMessage: "Remove from release"
|
|
458
432
|
}) })
|
|
459
|
-
] }) })
|
|
433
|
+
] }) });
|
|
460
434
|
};
|
|
461
435
|
const ReleaseActionEntryLinkItem = ({
|
|
462
436
|
contentTypeUid,
|
|
@@ -464,77 +438,79 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
464
438
|
locale
|
|
465
439
|
}) => {
|
|
466
440
|
const { formatMessage } = reactIntl.useIntl();
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
!
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
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
|
+
}
|
|
476
464
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
477
|
-
|
|
465
|
+
StyledMenuItem,
|
|
478
466
|
{
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
children:
|
|
486
|
-
|
|
487
|
-
{
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
},
|
|
493
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil, width: 3, height: 3 }),
|
|
494
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
495
|
-
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
496
|
-
defaultMessage: "Edit entry"
|
|
497
|
-
}) })
|
|
498
|
-
}
|
|
499
|
-
) })
|
|
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
|
+
] })
|
|
500
480
|
}
|
|
501
481
|
);
|
|
502
482
|
};
|
|
503
483
|
const EditReleaseItem = ({ releaseId }) => {
|
|
504
484
|
const { formatMessage } = reactIntl.useIntl();
|
|
505
|
-
return
|
|
506
|
-
|
|
507
|
-
{
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
isExternal: false,
|
|
511
|
-
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({
|
|
512
490
|
id: "content-releases.content-manager-edit-view.edit-release",
|
|
513
491
|
defaultMessage: "Edit release"
|
|
514
492
|
}) })
|
|
515
|
-
}
|
|
516
|
-
)
|
|
493
|
+
] }) })
|
|
494
|
+
);
|
|
517
495
|
};
|
|
518
|
-
const Root = ({ children
|
|
496
|
+
const Root = ({ children }) => {
|
|
519
497
|
const { formatMessage } = reactIntl.useIntl();
|
|
498
|
+
const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
|
|
520
499
|
return (
|
|
521
500
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
522
|
-
|
|
523
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
524
|
-
|
|
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,
|
|
525
504
|
{
|
|
526
|
-
|
|
527
|
-
paddingLeft: 2,
|
|
528
|
-
paddingRight: 2,
|
|
529
|
-
"aria-label": formatMessage({
|
|
505
|
+
label: formatMessage({
|
|
530
506
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
531
507
|
defaultMessage: "Release action options"
|
|
532
508
|
}),
|
|
533
|
-
|
|
509
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
|
|
534
510
|
}
|
|
535
|
-
),
|
|
536
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
537
|
-
] })
|
|
511
|
+
) }),
|
|
512
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
513
|
+
] }) : null
|
|
538
514
|
);
|
|
539
515
|
};
|
|
540
516
|
const ReleaseActionMenu = {
|
|
@@ -549,11 +525,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
549
525
|
const getBorderRightRadiusValue = (actionType) => {
|
|
550
526
|
return actionType === "publish" ? 0 : 1;
|
|
551
527
|
};
|
|
552
|
-
const FieldWrapper =
|
|
553
|
-
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
554
|
-
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
555
|
-
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
556
|
-
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)]};
|
|
557
533
|
|
|
558
534
|
> label {
|
|
559
535
|
color: inherit;
|
|
@@ -564,14 +540,14 @@ const FieldWrapper = styled__default.default(designSystem.Field)`
|
|
|
564
540
|
}
|
|
565
541
|
|
|
566
542
|
&[data-checked='true'] {
|
|
567
|
-
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
568
|
-
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
569
|
-
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};
|
|
570
546
|
}
|
|
571
547
|
|
|
572
548
|
&[data-checked='false'] {
|
|
573
|
-
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
574
|
-
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
549
|
+
border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
|
|
550
|
+
border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
|
|
575
551
|
}
|
|
576
552
|
|
|
577
553
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -600,7 +576,7 @@ const ActionOption = ({
|
|
|
600
576
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
601
577
|
FieldWrapper,
|
|
602
578
|
{
|
|
603
|
-
actionType,
|
|
579
|
+
$actionType: actionType,
|
|
604
580
|
background: "primary0",
|
|
605
581
|
borderColor: "neutral200",
|
|
606
582
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -608,12 +584,11 @@ const ActionOption = ({
|
|
|
608
584
|
cursor: "pointer",
|
|
609
585
|
"data-checked": selected === actionType,
|
|
610
586
|
"data-disabled": disabled && selected !== actionType,
|
|
611
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
587
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
|
|
612
588
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
613
|
-
designSystem.
|
|
589
|
+
designSystem.Field.Input,
|
|
614
590
|
{
|
|
615
591
|
type: "radio",
|
|
616
|
-
id: `${name}-${actionType}`,
|
|
617
592
|
name,
|
|
618
593
|
checked: selected === actionType,
|
|
619
594
|
onChange: handleChange,
|
|
@@ -666,19 +641,20 @@ const INITIAL_VALUES = {
|
|
|
666
641
|
const NoReleases = () => {
|
|
667
642
|
const { formatMessage } = reactIntl.useIntl();
|
|
668
643
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
669
|
-
|
|
644
|
+
designSystem.EmptyStateLayout,
|
|
670
645
|
{
|
|
671
|
-
|
|
646
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
|
|
647
|
+
content: formatMessage({
|
|
672
648
|
id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
|
|
673
649
|
defaultMessage: "No available releases. Open the list of releases and create a new one from there."
|
|
674
|
-
},
|
|
650
|
+
}),
|
|
675
651
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
676
|
-
|
|
652
|
+
designSystem.LinkButton,
|
|
677
653
|
{
|
|
678
654
|
to: {
|
|
679
655
|
pathname: "/plugins/content-releases"
|
|
680
656
|
},
|
|
681
|
-
|
|
657
|
+
tag: reactRouterDom.Link,
|
|
682
658
|
variant: "secondary",
|
|
683
659
|
children: formatMessage({
|
|
684
660
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -690,15 +666,16 @@ const NoReleases = () => {
|
|
|
690
666
|
);
|
|
691
667
|
};
|
|
692
668
|
const AddActionToReleaseModal = ({
|
|
693
|
-
|
|
669
|
+
open,
|
|
670
|
+
onOpenChange,
|
|
694
671
|
contentTypeUid,
|
|
695
672
|
entryId
|
|
696
673
|
}) => {
|
|
697
|
-
const releaseHeaderId = React__namespace.useId();
|
|
698
674
|
const { formatMessage } = reactIntl.useIntl();
|
|
699
|
-
const toggleNotification =
|
|
700
|
-
const { formatAPIError } =
|
|
701
|
-
const {
|
|
675
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
|
676
|
+
const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
|
677
|
+
const [{ query: query2 }] = strapiAdmin.useQueryParams();
|
|
678
|
+
const locale = query2.plugins?.i18n?.locale;
|
|
702
679
|
const response = useGetReleasesForEntryQuery({
|
|
703
680
|
contentTypeUid,
|
|
704
681
|
entryId,
|
|
@@ -707,7 +684,6 @@ const AddActionToReleaseModal = ({
|
|
|
707
684
|
const releases = response.data?.data;
|
|
708
685
|
const [createReleaseAction, { isLoading }] = useCreateReleaseActionMutation();
|
|
709
686
|
const handleSubmit = async (values) => {
|
|
710
|
-
const locale = modifiedData.locale;
|
|
711
687
|
const releaseActionEntry = {
|
|
712
688
|
contentType: contentTypeUid,
|
|
713
689
|
id: entryId,
|
|
@@ -725,25 +701,25 @@ const AddActionToReleaseModal = ({
|
|
|
725
701
|
defaultMessage: "Entry added to release"
|
|
726
702
|
})
|
|
727
703
|
});
|
|
728
|
-
|
|
704
|
+
onOpenChange();
|
|
729
705
|
return;
|
|
730
706
|
}
|
|
731
707
|
if ("error" in response2) {
|
|
732
|
-
if (
|
|
708
|
+
if (strapiAdmin.isFetchError(response2.error)) {
|
|
733
709
|
toggleNotification({
|
|
734
|
-
type: "
|
|
710
|
+
type: "danger",
|
|
735
711
|
message: formatAPIError(response2.error)
|
|
736
712
|
});
|
|
737
713
|
} else {
|
|
738
714
|
toggleNotification({
|
|
739
|
-
type: "
|
|
715
|
+
type: "danger",
|
|
740
716
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
741
717
|
});
|
|
742
718
|
}
|
|
743
719
|
}
|
|
744
720
|
};
|
|
745
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
746
|
-
/* @__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({
|
|
747
723
|
id: "content-releases.content-manager-edit-view.add-to-release",
|
|
748
724
|
defaultMessage: "Add to release"
|
|
749
725
|
}) }) }),
|
|
@@ -755,25 +731,26 @@ const AddActionToReleaseModal = ({
|
|
|
755
731
|
initialValues: INITIAL_VALUES,
|
|
756
732
|
children: ({ values, setFieldValue }) => {
|
|
757
733
|
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
758
|
-
releases?.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(NoReleases, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
759
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.
|
|
760
|
-
designSystem.
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
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({
|
|
777
754
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
778
755
|
defaultMessage: "What do you want to do with this entry?"
|
|
779
756
|
}) }),
|
|
@@ -786,42 +763,37 @@ const AddActionToReleaseModal = ({
|
|
|
786
763
|
}
|
|
787
764
|
)
|
|
788
765
|
] }) }),
|
|
789
|
-
/* @__PURE__ */ jsxRuntime.
|
|
790
|
-
designSystem.
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
800
|
-
*/
|
|
801
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
802
|
-
id: "content-releases.content-manager-edit-view.add-to-release.continue-button",
|
|
803
|
-
defaultMessage: "Continue"
|
|
804
|
-
}) })
|
|
805
|
-
)
|
|
806
|
-
}
|
|
807
|
-
)
|
|
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
|
+
] })
|
|
808
776
|
] });
|
|
809
777
|
}
|
|
810
778
|
}
|
|
811
779
|
)
|
|
812
|
-
] });
|
|
780
|
+
] }) });
|
|
813
781
|
};
|
|
814
782
|
const CMReleasesContainer = () => {
|
|
815
783
|
const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
|
|
816
784
|
const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
|
|
817
|
-
const {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
} =
|
|
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;
|
|
823
795
|
const contentTypeUid = slug;
|
|
824
|
-
const canFetch =
|
|
796
|
+
const canFetch = id != null && contentTypeUid != null;
|
|
825
797
|
const fetchParams = canFetch ? {
|
|
826
798
|
contentTypeUid,
|
|
827
799
|
entryId,
|
|
@@ -842,10 +814,13 @@ const CMReleasesContainer = () => {
|
|
|
842
814
|
}
|
|
843
815
|
return `success${shade}`;
|
|
844
816
|
};
|
|
845
|
-
|
|
817
|
+
if (!canMain) {
|
|
818
|
+
return null;
|
|
819
|
+
}
|
|
820
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
846
821
|
designSystem.Box,
|
|
847
822
|
{
|
|
848
|
-
|
|
823
|
+
tag: "aside",
|
|
849
824
|
"aria-label": formatMessage({
|
|
850
825
|
id: "content-releases.plugin.name",
|
|
851
826
|
defaultMessage: "Releases"
|
|
@@ -869,7 +844,7 @@ const CMReleasesContainer = () => {
|
|
|
869
844
|
alignItems: "start",
|
|
870
845
|
borderWidth: "1px",
|
|
871
846
|
borderStyle: "solid",
|
|
872
|
-
borderColor: getReleaseColorVariant(release.
|
|
847
|
+
borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
|
|
873
848
|
overflow: "hidden",
|
|
874
849
|
hasRadius: true,
|
|
875
850
|
children: [
|
|
@@ -880,26 +855,26 @@ const CMReleasesContainer = () => {
|
|
|
880
855
|
paddingBottom: 3,
|
|
881
856
|
paddingLeft: 4,
|
|
882
857
|
paddingRight: 4,
|
|
883
|
-
background: getReleaseColorVariant(release.
|
|
858
|
+
background: getReleaseColorVariant(release.actions[0].type, "100"),
|
|
884
859
|
width: "100%",
|
|
885
860
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
886
861
|
designSystem.Typography,
|
|
887
862
|
{
|
|
888
863
|
fontSize: 1,
|
|
889
864
|
variant: "pi",
|
|
890
|
-
textColor: getReleaseColorVariant(release.
|
|
865
|
+
textColor: getReleaseColorVariant(release.actions[0].type, "600"),
|
|
891
866
|
children: formatMessage(
|
|
892
867
|
{
|
|
893
868
|
id: "content-releases.content-manager-edit-view.list-releases.title",
|
|
894
869
|
defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
|
|
895
870
|
},
|
|
896
|
-
{ isPublish: release.
|
|
871
|
+
{ isPublish: release.actions[0].type === "publish" }
|
|
897
872
|
)
|
|
898
873
|
}
|
|
899
874
|
)
|
|
900
875
|
}
|
|
901
876
|
),
|
|
902
|
-
/* @__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: [
|
|
903
878
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
904
879
|
release.scheduledAt && release.timezone && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
905
880
|
{
|
|
@@ -923,23 +898,23 @@ const CMReleasesContainer = () => {
|
|
|
923
898
|
)
|
|
924
899
|
}
|
|
925
900
|
) }),
|
|
926
|
-
|
|
901
|
+
canDeleteAction ? /* @__PURE__ */ jsxRuntime.jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
|
|
927
902
|
/* @__PURE__ */ jsxRuntime.jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
|
|
928
903
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
929
904
|
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
930
905
|
{
|
|
931
906
|
releaseId: release.id,
|
|
932
|
-
actionId: release.
|
|
907
|
+
actionId: release.actions[0].id
|
|
933
908
|
}
|
|
934
909
|
)
|
|
935
|
-
] })
|
|
936
|
-
] })
|
|
910
|
+
] }) : null
|
|
911
|
+
] }) })
|
|
937
912
|
]
|
|
938
913
|
},
|
|
939
914
|
release.id
|
|
940
915
|
);
|
|
941
916
|
}),
|
|
942
|
-
|
|
917
|
+
canCreateAction ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
943
918
|
designSystem.Button,
|
|
944
919
|
{
|
|
945
920
|
justifyContent: "center",
|
|
@@ -954,221 +929,51 @@ const CMReleasesContainer = () => {
|
|
|
954
929
|
defaultMessage: "Add to release"
|
|
955
930
|
})
|
|
956
931
|
}
|
|
957
|
-
)
|
|
932
|
+
) : null
|
|
958
933
|
] }),
|
|
959
|
-
|
|
934
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
960
935
|
AddActionToReleaseModal,
|
|
961
936
|
{
|
|
962
|
-
|
|
937
|
+
open: isModalOpen,
|
|
938
|
+
onOpenChange: toggleModal,
|
|
963
939
|
contentTypeUid,
|
|
964
940
|
entryId
|
|
965
941
|
}
|
|
966
942
|
)
|
|
967
943
|
]
|
|
968
944
|
}
|
|
969
|
-
)
|
|
970
|
-
};
|
|
971
|
-
const getContentPermissions = (subject) => {
|
|
972
|
-
const permissions = {
|
|
973
|
-
publish: [
|
|
974
|
-
{
|
|
975
|
-
action: "plugin::content-manager.explorer.publish",
|
|
976
|
-
subject,
|
|
977
|
-
id: "",
|
|
978
|
-
actionParameters: {},
|
|
979
|
-
properties: {},
|
|
980
|
-
conditions: []
|
|
981
|
-
}
|
|
982
|
-
]
|
|
983
|
-
};
|
|
984
|
-
return permissions;
|
|
945
|
+
);
|
|
985
946
|
};
|
|
986
|
-
const
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
}
|
|
995
|
-
const {
|
|
996
|
-
allowedActions: { canCreate }
|
|
997
|
-
} = helperPlugin.useRBAC(PERMISSIONS);
|
|
998
|
-
const response = useGetReleasesQuery();
|
|
999
|
-
const releases = response.data?.data;
|
|
1000
|
-
const [createManyReleaseActions, { isLoading }] = useCreateManyReleaseActionsMutation();
|
|
1001
|
-
const handleSubmit = async (values) => {
|
|
1002
|
-
const locale = modifiedData.locale;
|
|
1003
|
-
const releaseActionEntries = ids.map((id) => ({
|
|
1004
|
-
type: values.type,
|
|
1005
|
-
entry: {
|
|
1006
|
-
contentType: model,
|
|
1007
|
-
id,
|
|
1008
|
-
locale
|
|
1009
|
-
}
|
|
1010
|
-
}));
|
|
1011
|
-
const response2 = await createManyReleaseActions({
|
|
1012
|
-
body: releaseActionEntries,
|
|
1013
|
-
params: { releaseId: values.releaseId }
|
|
1014
|
-
});
|
|
1015
|
-
if ("data" in response2) {
|
|
1016
|
-
const notificationMessage = formatMessage(
|
|
1017
|
-
{
|
|
1018
|
-
id: "content-releases.content-manager-list-view.add-to-release.notification.success.message",
|
|
1019
|
-
defaultMessage: "{entriesAlreadyInRelease} out of {totalEntries} entries were already in the release."
|
|
1020
|
-
},
|
|
1021
|
-
{
|
|
1022
|
-
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1023
|
-
totalEntries: response2.data.meta.totalEntries
|
|
1024
|
-
}
|
|
1025
|
-
);
|
|
1026
|
-
const notification = {
|
|
1027
|
-
type: "success",
|
|
1028
|
-
title: formatMessage(
|
|
1029
|
-
{
|
|
1030
|
-
id: "content-releases.content-manager-list-view.add-to-release.notification.success.title",
|
|
1031
|
-
defaultMessage: "Successfully added to release."
|
|
1032
|
-
},
|
|
1033
|
-
{
|
|
1034
|
-
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1035
|
-
totalEntries: response2.data.meta.totalEntries
|
|
1036
|
-
}
|
|
1037
|
-
),
|
|
1038
|
-
message: response2.data.meta.entriesAlreadyInRelease ? notificationMessage : ""
|
|
1039
|
-
};
|
|
1040
|
-
toggleNotification(notification);
|
|
1041
|
-
return true;
|
|
1042
|
-
}
|
|
1043
|
-
if ("error" in response2) {
|
|
1044
|
-
if (axios.isAxiosError(response2.error)) {
|
|
1045
|
-
toggleNotification({
|
|
1046
|
-
type: "warning",
|
|
1047
|
-
message: formatAPIError(response2.error)
|
|
1048
|
-
});
|
|
1049
|
-
} else {
|
|
1050
|
-
toggleNotification({
|
|
1051
|
-
type: "warning",
|
|
1052
|
-
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1053
|
-
});
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
};
|
|
1057
|
-
if (!canCreate || !canPublish)
|
|
1058
|
-
return null;
|
|
1059
|
-
return {
|
|
1060
|
-
actionType: "release",
|
|
1061
|
-
variant: "tertiary",
|
|
1062
|
-
label: formatMessage({
|
|
1063
|
-
id: "content-manager-list-view.add-to-release",
|
|
1064
|
-
defaultMessage: "Add to Release"
|
|
1065
|
-
}),
|
|
1066
|
-
dialog: {
|
|
1067
|
-
type: "modal",
|
|
1068
|
-
title: formatMessage({
|
|
1069
|
-
id: "content-manager-list-view.add-to-release",
|
|
1070
|
-
defaultMessage: "Add to Release"
|
|
1071
|
-
}),
|
|
1072
|
-
content: ({ onClose }) => {
|
|
1073
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1074
|
-
formik.Formik,
|
|
1075
|
-
{
|
|
1076
|
-
onSubmit: async (values) => {
|
|
1077
|
-
const data = await handleSubmit(values);
|
|
1078
|
-
if (data) {
|
|
1079
|
-
return onClose();
|
|
1080
|
-
}
|
|
1081
|
-
},
|
|
1082
|
-
validationSchema: RELEASE_ACTION_FORM_SCHEMA,
|
|
1083
|
-
initialValues: INITIAL_VALUES,
|
|
1084
|
-
children: ({ values, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
1085
|
-
releases?.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(NoReleases, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
1086
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1087
|
-
designSystem.SingleSelect,
|
|
1088
|
-
{
|
|
1089
|
-
required: true,
|
|
1090
|
-
label: formatMessage({
|
|
1091
|
-
id: "content-releases.content-manager-list-view.add-to-release.select-label",
|
|
1092
|
-
defaultMessage: "Select a release"
|
|
1093
|
-
}),
|
|
1094
|
-
placeholder: formatMessage({
|
|
1095
|
-
id: "content-releases.content-manager-list-view.add-to-release.select-placeholder",
|
|
1096
|
-
defaultMessage: "Select"
|
|
1097
|
-
}),
|
|
1098
|
-
onChange: (value) => setFieldValue("releaseId", value),
|
|
1099
|
-
value: values.releaseId,
|
|
1100
|
-
children: releases?.map((release) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
1101
|
-
}
|
|
1102
|
-
) }),
|
|
1103
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
|
|
1104
|
-
id: "content-releases.content-manager-list-view.add-to-release.action-type-label",
|
|
1105
|
-
defaultMessage: "What do you want to do with these entries?"
|
|
1106
|
-
}) }),
|
|
1107
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1108
|
-
ReleaseActionOptions,
|
|
1109
|
-
{
|
|
1110
|
-
selected: values.type,
|
|
1111
|
-
handleChange: (e) => setFieldValue("type", e.target.value),
|
|
1112
|
-
name: "type"
|
|
1113
|
-
}
|
|
1114
|
-
)
|
|
1115
|
-
] }) }),
|
|
1116
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1117
|
-
designSystem.ModalFooter,
|
|
1118
|
-
{
|
|
1119
|
-
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", name: "cancel", children: formatMessage({
|
|
1120
|
-
id: "content-releases.content-manager-list-view.add-to-release.cancel-button",
|
|
1121
|
-
defaultMessage: "Cancel"
|
|
1122
|
-
}) }),
|
|
1123
|
-
endActions: (
|
|
1124
|
-
/**
|
|
1125
|
-
* TODO: Ideally we would use isValid from Formik to disable the button, however currently it always returns true
|
|
1126
|
-
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
1127
|
-
*/
|
|
1128
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
1129
|
-
id: "content-releases.content-manager-list-view.add-to-release.continue-button",
|
|
1130
|
-
defaultMessage: "Continue"
|
|
1131
|
-
}) })
|
|
1132
|
-
)
|
|
1133
|
-
}
|
|
1134
|
-
)
|
|
1135
|
-
] })
|
|
1136
|
-
}
|
|
1137
|
-
);
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
};
|
|
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
|
+
}, {});
|
|
1141
956
|
};
|
|
1142
957
|
const admin = {
|
|
1143
958
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1144
959
|
register(app) {
|
|
960
|
+
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
1145
961
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
1146
962
|
app.addMenuLink({
|
|
1147
|
-
to:
|
|
963
|
+
to: `plugins/${pluginId}`,
|
|
1148
964
|
icon: icons.PaperPlane,
|
|
1149
965
|
intlLabel: {
|
|
1150
966
|
id: `${pluginId}.plugin.name`,
|
|
1151
967
|
defaultMessage: "Releases"
|
|
1152
968
|
},
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
},
|
|
1157
|
-
permissions: PERMISSIONS.main
|
|
969
|
+
Component: () => Promise.resolve().then(() => require("./App-CqbuK4M6.js")).then((mod) => ({ default: mod.App })),
|
|
970
|
+
permissions: PERMISSIONS.main,
|
|
971
|
+
position: 2
|
|
1158
972
|
});
|
|
1159
|
-
app.
|
|
1160
|
-
app.addReducers({
|
|
1161
|
-
[releaseApi.reducerPath]: releaseApi.reducer
|
|
1162
|
-
});
|
|
1163
|
-
app.injectContentManagerComponent("editView", "right-links", {
|
|
973
|
+
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
1164
974
|
name: `${pluginId}-link`,
|
|
1165
975
|
Component: CMReleasesContainer
|
|
1166
976
|
});
|
|
1167
|
-
app.plugins["content-manager"].apis.addBulkAction((actions) => {
|
|
1168
|
-
const deleteActionIndex = actions.findIndex((action) => action.name === "DeleteAction");
|
|
1169
|
-
actions.splice(deleteActionIndex, 0, ReleaseAction);
|
|
1170
|
-
return actions;
|
|
1171
|
-
});
|
|
1172
977
|
} else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
|
|
1173
978
|
app.addMenuLink({
|
|
1174
979
|
to: `/plugins/purchase-content-releases`,
|
|
@@ -1177,20 +982,22 @@ const admin = {
|
|
|
1177
982
|
id: `${pluginId}.plugin.name`,
|
|
1178
983
|
defaultMessage: "Releases"
|
|
1179
984
|
},
|
|
985
|
+
permissions: [],
|
|
1180
986
|
async Component() {
|
|
1181
|
-
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-
|
|
1182
|
-
return PurchaseContentReleases;
|
|
987
|
+
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-Be3acS2L.js"));
|
|
988
|
+
return { default: PurchaseContentReleases };
|
|
1183
989
|
},
|
|
1184
|
-
lockIcon: true
|
|
990
|
+
lockIcon: true,
|
|
991
|
+
position: 2
|
|
1185
992
|
});
|
|
1186
993
|
}
|
|
1187
994
|
},
|
|
1188
995
|
async registerTrads({ locales }) {
|
|
1189
996
|
const importedTrads = await Promise.all(
|
|
1190
997
|
locales.map((locale) => {
|
|
1191
|
-
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 }) => {
|
|
1192
999
|
return {
|
|
1193
|
-
data:
|
|
1000
|
+
data: prefixPluginTranslations(data, "content-releases"),
|
|
1194
1001
|
locale
|
|
1195
1002
|
};
|
|
1196
1003
|
}).catch(() => {
|
|
@@ -1209,7 +1016,6 @@ exports.ReleaseActionMenu = ReleaseActionMenu;
|
|
|
1209
1016
|
exports.ReleaseActionOptions = ReleaseActionOptions;
|
|
1210
1017
|
exports.admin = admin;
|
|
1211
1018
|
exports.getTimezoneOffset = getTimezoneOffset;
|
|
1212
|
-
exports.isAxiosError = isAxiosError;
|
|
1213
1019
|
exports.pluginId = pluginId;
|
|
1214
1020
|
exports.releaseApi = releaseApi;
|
|
1215
1021
|
exports.useCreateReleaseMutation = useCreateReleaseMutation;
|
|
@@ -1218,7 +1024,6 @@ exports.useGetReleaseActionsQuery = useGetReleaseActionsQuery;
|
|
|
1218
1024
|
exports.useGetReleaseQuery = useGetReleaseQuery;
|
|
1219
1025
|
exports.useGetReleasesQuery = useGetReleasesQuery;
|
|
1220
1026
|
exports.usePublishReleaseMutation = usePublishReleaseMutation;
|
|
1221
|
-
exports.useTypedDispatch = useTypedDispatch;
|
|
1222
1027
|
exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
|
|
1223
1028
|
exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
|
|
1224
|
-
//# sourceMappingURL=index-
|
|
1029
|
+
//# sourceMappingURL=index-Tedsw4GC.js.map
|