@strapi/content-releases 0.0.0-experimental.bcfd4881e086b8126222bb894121c61ff9a1fc82 → 0.0.0-experimental.c3e9d4b26f9fd3d9eb530b5c11f9baa1d09b13ad
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{App--3HPsVgM.js → App-DUmziQ17.js} +401 -388
- package/dist/_chunks/App-DUmziQ17.js.map +1 -0
- package/dist/_chunks/{App-CRNZU_DZ.mjs → App-D_6Y9N2F.mjs} +378 -364
- package/dist/_chunks/App-D_6Y9N2F.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-bpIYXOfu.js → PurchaseContentReleases-Be3acS2L.js} +7 -6
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-3tRbmbY3.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +8 -7
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{en-bpHsnU0n.mjs → en-B9Ur3VsE.mjs} +2 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
- package/dist/_chunks/{en-3SGjiVyR.js → en-DtFJ5ViE.js} +2 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
- package/dist/_chunks/{index-_wu9g0yG.mjs → index-BomF0-yY.mjs} +206 -392
- package/dist/_chunks/index-BomF0-yY.mjs.map +1 -0
- package/dist/_chunks/{index-xV3jXcZj.js → index-C5Hc767q.js} +206 -394
- package/dist/_chunks/index-C5Hc767q.js.map +1 -0
- package/dist/admin/index.js +1 -15
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +2 -16
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +22 -0
- package/dist/admin/src/components/RelativeTime.d.ts +28 -0
- package/dist/admin/src/components/ReleaseAction.d.ts +3 -0
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +26 -0
- package/dist/admin/src/components/ReleaseActionOptions.d.ts +9 -0
- package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +16 -0
- package/dist/admin/src/constants.d.ts +58 -0
- package/dist/admin/src/index.d.ts +3 -0
- package/dist/admin/src/pages/App.d.ts +1 -0
- package/dist/admin/src/pages/PurchaseContentReleases.d.ts +2 -0
- package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +2 -0
- package/dist/admin/src/pages/ReleasesPage.d.ts +8 -0
- package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +181 -0
- package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +39 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/services/release.d.ts +105 -0
- package/dist/admin/src/store/hooks.d.ts +7 -0
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
- package/dist/admin/src/utils/time.d.ts +1 -0
- package/dist/server/index.js +152 -93
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +153 -93
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/bootstrap.d.ts.map +1 -0
- package/dist/server/src/constants.d.ts +12 -0
- package/dist/server/src/constants.d.ts.map +1 -0
- package/dist/server/src/content-types/index.d.ts +99 -0
- package/dist/server/src/content-types/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/index.d.ts +48 -0
- package/dist/server/src/content-types/release/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release/schema.d.ts +47 -0
- package/dist/server/src/content-types/release/schema.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/index.d.ts +50 -0
- package/dist/server/src/content-types/release-action/index.d.ts.map +1 -0
- package/dist/server/src/content-types/release-action/schema.d.ts +49 -0
- package/dist/server/src/content-types/release-action/schema.d.ts.map +1 -0
- package/dist/server/src/controllers/index.d.ts +20 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -0
- package/dist/server/src/controllers/release-action.d.ts +10 -0
- package/dist/server/src/controllers/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/release.d.ts +12 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release-action.d.ts +8 -0
- package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/release.d.ts +2 -0
- package/dist/server/src/controllers/validation/release.d.ts.map +1 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/destroy.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +2096 -0
- package/dist/server/src/index.d.ts.map +1 -0
- package/dist/server/src/migrations/index.d.ts +13 -0
- package/dist/server/src/migrations/index.d.ts.map +1 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/register.d.ts.map +1 -0
- package/dist/server/src/routes/index.d.ts +35 -0
- package/dist/server/src/routes/index.d.ts.map +1 -0
- package/dist/server/src/routes/release-action.d.ts +18 -0
- package/dist/server/src/routes/release-action.d.ts.map +1 -0
- package/dist/server/src/routes/release.d.ts +18 -0
- package/dist/server/src/routes/release.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +1826 -0
- package/dist/server/src/services/index.d.ts.map +1 -0
- package/dist/server/src/services/release.d.ts +66 -0
- package/dist/server/src/services/release.d.ts.map +1 -0
- package/dist/server/src/services/scheduling.d.ts +18 -0
- package/dist/server/src/services/scheduling.d.ts.map +1 -0
- package/dist/server/src/services/validation.d.ts +18 -0
- package/dist/server/src/services/validation.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +14 -0
- package/dist/server/src/utils/index.d.ts.map +1 -0
- package/dist/shared/contracts/release-actions.d.ts +131 -0
- package/dist/shared/contracts/release-actions.d.ts.map +1 -0
- package/dist/shared/contracts/releases.d.ts +182 -0
- package/dist/shared/contracts/releases.d.ts.map +1 -0
- package/dist/shared/types.d.ts +24 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/validation-schemas.d.ts +2 -0
- package/dist/shared/validation-schemas.d.ts.map +1 -0
- package/package.json +29 -36
- package/dist/_chunks/App--3HPsVgM.js.map +0 -1
- package/dist/_chunks/App-CRNZU_DZ.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +0 -1
- package/dist/_chunks/en-3SGjiVyR.js.map +0 -1
- package/dist/_chunks/en-bpHsnU0n.mjs.map +0 -1
- package/dist/_chunks/index-_wu9g0yG.mjs.map +0 -1
- package/dist/_chunks/index-xV3jXcZj.js.map +0 -1
|
@@ -1,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",
|
|
@@ -696,9 +672,10 @@ const AddActionToReleaseModal = ({
|
|
|
696
672
|
}) => {
|
|
697
673
|
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,
|
|
@@ -729,14 +705,14 @@ const AddActionToReleaseModal = ({
|
|
|
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
|
}
|
|
@@ -756,24 +732,25 @@ const AddActionToReleaseModal = ({
|
|
|
756
732
|
children: ({ values, setFieldValue }) => {
|
|
757
733
|
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
758
734
|
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: [
|
|
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
|
-
|
|
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
|
}) }),
|
|
@@ -814,14 +791,18 @@ const AddActionToReleaseModal = ({
|
|
|
814
791
|
const CMReleasesContainer = () => {
|
|
815
792
|
const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
|
|
816
793
|
const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
|
|
817
|
-
const {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
} =
|
|
794
|
+
const { id, slug, collectionType } = reactRouterDom.useParams();
|
|
795
|
+
const isCreatingEntry = id === "create";
|
|
796
|
+
const entryId = parseInt(id, 10);
|
|
797
|
+
const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
|
|
798
|
+
const { canCreateAction, canRead: canMain, canDeleteAction } = allowedActions;
|
|
799
|
+
const { schema } = strapiAdmin$1.unstable_useDocument({
|
|
800
|
+
collectionType,
|
|
801
|
+
model: slug
|
|
802
|
+
});
|
|
803
|
+
const hasDraftAndPublish = schema?.options?.draftAndPublish;
|
|
823
804
|
const contentTypeUid = slug;
|
|
824
|
-
const canFetch =
|
|
805
|
+
const canFetch = id != null && contentTypeUid != null;
|
|
825
806
|
const fetchParams = canFetch ? {
|
|
826
807
|
contentTypeUid,
|
|
827
808
|
entryId,
|
|
@@ -842,10 +823,13 @@ const CMReleasesContainer = () => {
|
|
|
842
823
|
}
|
|
843
824
|
return `success${shade}`;
|
|
844
825
|
};
|
|
845
|
-
|
|
826
|
+
if (!canMain) {
|
|
827
|
+
return null;
|
|
828
|
+
}
|
|
829
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
846
830
|
designSystem.Box,
|
|
847
831
|
{
|
|
848
|
-
|
|
832
|
+
tag: "aside",
|
|
849
833
|
"aria-label": formatMessage({
|
|
850
834
|
id: "content-releases.plugin.name",
|
|
851
835
|
defaultMessage: "Releases"
|
|
@@ -869,7 +853,7 @@ const CMReleasesContainer = () => {
|
|
|
869
853
|
alignItems: "start",
|
|
870
854
|
borderWidth: "1px",
|
|
871
855
|
borderStyle: "solid",
|
|
872
|
-
borderColor: getReleaseColorVariant(release.
|
|
856
|
+
borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
|
|
873
857
|
overflow: "hidden",
|
|
874
858
|
hasRadius: true,
|
|
875
859
|
children: [
|
|
@@ -880,26 +864,26 @@ const CMReleasesContainer = () => {
|
|
|
880
864
|
paddingBottom: 3,
|
|
881
865
|
paddingLeft: 4,
|
|
882
866
|
paddingRight: 4,
|
|
883
|
-
background: getReleaseColorVariant(release.
|
|
867
|
+
background: getReleaseColorVariant(release.actions[0].type, "100"),
|
|
884
868
|
width: "100%",
|
|
885
869
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
886
870
|
designSystem.Typography,
|
|
887
871
|
{
|
|
888
872
|
fontSize: 1,
|
|
889
873
|
variant: "pi",
|
|
890
|
-
textColor: getReleaseColorVariant(release.
|
|
874
|
+
textColor: getReleaseColorVariant(release.actions[0].type, "600"),
|
|
891
875
|
children: formatMessage(
|
|
892
876
|
{
|
|
893
877
|
id: "content-releases.content-manager-edit-view.list-releases.title",
|
|
894
878
|
defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
|
|
895
879
|
},
|
|
896
|
-
{ isPublish: release.
|
|
880
|
+
{ isPublish: release.actions[0].type === "publish" }
|
|
897
881
|
)
|
|
898
882
|
}
|
|
899
883
|
)
|
|
900
884
|
}
|
|
901
885
|
),
|
|
902
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
886
|
+
/* @__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
887
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
904
888
|
release.scheduledAt && release.timezone && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
905
889
|
{
|
|
@@ -923,23 +907,23 @@ const CMReleasesContainer = () => {
|
|
|
923
907
|
)
|
|
924
908
|
}
|
|
925
909
|
) }),
|
|
926
|
-
|
|
910
|
+
canDeleteAction ? /* @__PURE__ */ jsxRuntime.jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
|
|
927
911
|
/* @__PURE__ */ jsxRuntime.jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
|
|
928
912
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
929
913
|
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
930
914
|
{
|
|
931
915
|
releaseId: release.id,
|
|
932
|
-
actionId: release.
|
|
916
|
+
actionId: release.actions[0].id
|
|
933
917
|
}
|
|
934
918
|
)
|
|
935
|
-
] })
|
|
936
|
-
] })
|
|
919
|
+
] }) : null
|
|
920
|
+
] }) })
|
|
937
921
|
]
|
|
938
922
|
},
|
|
939
923
|
release.id
|
|
940
924
|
);
|
|
941
925
|
}),
|
|
942
|
-
|
|
926
|
+
canCreateAction ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
943
927
|
designSystem.Button,
|
|
944
928
|
{
|
|
945
929
|
justifyContent: "center",
|
|
@@ -954,7 +938,7 @@ const CMReleasesContainer = () => {
|
|
|
954
938
|
defaultMessage: "Add to release"
|
|
955
939
|
})
|
|
956
940
|
}
|
|
957
|
-
)
|
|
941
|
+
) : null
|
|
958
942
|
] }),
|
|
959
943
|
isModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
960
944
|
AddActionToReleaseModal,
|
|
@@ -966,178 +950,17 @@ const CMReleasesContainer = () => {
|
|
|
966
950
|
)
|
|
967
951
|
]
|
|
968
952
|
}
|
|
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;
|
|
953
|
+
);
|
|
985
954
|
};
|
|
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
|
-
};
|
|
955
|
+
const pluginId = "content-releases";
|
|
956
|
+
const prefixPluginTranslations = (trad, pluginId2) => {
|
|
957
|
+
if (!pluginId2) {
|
|
958
|
+
throw new TypeError("pluginId can't be empty");
|
|
959
|
+
}
|
|
960
|
+
return Object.keys(trad).reduce((acc, current) => {
|
|
961
|
+
acc[`${pluginId2}.${current}`] = trad[current];
|
|
962
|
+
return acc;
|
|
963
|
+
}, {});
|
|
1141
964
|
};
|
|
1142
965
|
const admin = {
|
|
1143
966
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1145,31 +968,20 @@ const admin = {
|
|
|
1145
968
|
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
1146
969
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
1147
970
|
app.addMenuLink({
|
|
1148
|
-
to:
|
|
971
|
+
to: `plugins/${pluginId}`,
|
|
1149
972
|
icon: icons.PaperPlane,
|
|
1150
973
|
intlLabel: {
|
|
1151
974
|
id: `${pluginId}.plugin.name`,
|
|
1152
975
|
defaultMessage: "Releases"
|
|
1153
976
|
},
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
},
|
|
1158
|
-
permissions: PERMISSIONS.main
|
|
977
|
+
Component: () => Promise.resolve().then(() => require("./App-DUmziQ17.js")).then((mod) => ({ default: mod.App })),
|
|
978
|
+
permissions: PERMISSIONS.main,
|
|
979
|
+
position: 2
|
|
1159
980
|
});
|
|
1160
|
-
app.
|
|
1161
|
-
app.addReducers({
|
|
1162
|
-
[releaseApi.reducerPath]: releaseApi.reducer
|
|
1163
|
-
});
|
|
1164
|
-
app.injectContentManagerComponent("editView", "right-links", {
|
|
981
|
+
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
1165
982
|
name: `${pluginId}-link`,
|
|
1166
983
|
Component: CMReleasesContainer
|
|
1167
984
|
});
|
|
1168
|
-
app.plugins["content-manager"].apis.addBulkAction((actions) => {
|
|
1169
|
-
const deleteActionIndex = actions.findIndex((action) => action.name === "DeleteAction");
|
|
1170
|
-
actions.splice(deleteActionIndex, 0, ReleaseAction);
|
|
1171
|
-
return actions;
|
|
1172
|
-
});
|
|
1173
985
|
} else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
|
|
1174
986
|
app.addMenuLink({
|
|
1175
987
|
to: `/plugins/purchase-content-releases`,
|
|
@@ -1178,20 +990,22 @@ const admin = {
|
|
|
1178
990
|
id: `${pluginId}.plugin.name`,
|
|
1179
991
|
defaultMessage: "Releases"
|
|
1180
992
|
},
|
|
993
|
+
permissions: [],
|
|
1181
994
|
async Component() {
|
|
1182
|
-
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-
|
|
1183
|
-
return PurchaseContentReleases;
|
|
995
|
+
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-Be3acS2L.js"));
|
|
996
|
+
return { default: PurchaseContentReleases };
|
|
1184
997
|
},
|
|
1185
|
-
lockIcon: true
|
|
998
|
+
lockIcon: true,
|
|
999
|
+
position: 2
|
|
1186
1000
|
});
|
|
1187
1001
|
}
|
|
1188
1002
|
},
|
|
1189
1003
|
async registerTrads({ locales }) {
|
|
1190
1004
|
const importedTrads = await Promise.all(
|
|
1191
1005
|
locales.map((locale) => {
|
|
1192
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
|
1006
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-DtFJ5ViE.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
1193
1007
|
return {
|
|
1194
|
-
data:
|
|
1008
|
+
data: prefixPluginTranslations(data, "content-releases"),
|
|
1195
1009
|
locale
|
|
1196
1010
|
};
|
|
1197
1011
|
}).catch(() => {
|
|
@@ -1210,7 +1024,6 @@ exports.ReleaseActionMenu = ReleaseActionMenu;
|
|
|
1210
1024
|
exports.ReleaseActionOptions = ReleaseActionOptions;
|
|
1211
1025
|
exports.admin = admin;
|
|
1212
1026
|
exports.getTimezoneOffset = getTimezoneOffset;
|
|
1213
|
-
exports.isAxiosError = isAxiosError;
|
|
1214
1027
|
exports.pluginId = pluginId;
|
|
1215
1028
|
exports.releaseApi = releaseApi;
|
|
1216
1029
|
exports.useCreateReleaseMutation = useCreateReleaseMutation;
|
|
@@ -1219,7 +1032,6 @@ exports.useGetReleaseActionsQuery = useGetReleaseActionsQuery;
|
|
|
1219
1032
|
exports.useGetReleaseQuery = useGetReleaseQuery;
|
|
1220
1033
|
exports.useGetReleasesQuery = useGetReleasesQuery;
|
|
1221
1034
|
exports.usePublishReleaseMutation = usePublishReleaseMutation;
|
|
1222
|
-
exports.useTypedDispatch = useTypedDispatch;
|
|
1223
1035
|
exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
|
|
1224
1036
|
exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
|
|
1225
|
-
//# sourceMappingURL=index-
|
|
1037
|
+
//# sourceMappingURL=index-C5Hc767q.js.map
|