@strapi/content-releases 0.0.0-experimental.f75e3c6d67cc47c64ab37479efdbb7b43be50b78 → 0.0.0-experimental.f77206734629a2b88793a7a8abca40388843c656
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-DUmziQ17.js → App-HjWtUYmc.js} +388 -401
- package/dist/_chunks/App-HjWtUYmc.js.map +1 -0
- package/dist/_chunks/{App-D_6Y9N2F.mjs → App-gu1aiP6i.mjs} +364 -378
- package/dist/_chunks/App-gu1aiP6i.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-_MxP6-Dt.mjs → PurchaseContentReleases-3tRbmbY3.mjs} +7 -8
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Be3acS2L.js → PurchaseContentReleases-bpIYXOfu.js} +6 -7
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +1 -0
- package/dist/_chunks/{en-DtFJ5ViE.js → en-HrREghh3.js} +1 -1
- package/dist/_chunks/en-HrREghh3.js.map +1 -0
- package/dist/_chunks/{en-B9Ur3VsE.mjs → en-ltT1TlKQ.mjs} +1 -1
- package/dist/_chunks/en-ltT1TlKQ.mjs.map +1 -0
- package/dist/_chunks/{index-C5Hc767q.js → index-ZNwxYN8H.js} +475 -177
- package/dist/_chunks/index-ZNwxYN8H.js.map +1 -0
- package/dist/_chunks/{index-BomF0-yY.mjs → index-mvj9PSKd.mjs} +476 -180
- package/dist/_chunks/index-mvj9PSKd.mjs.map +1 -0
- package/dist/admin/index.js +15 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +16 -2
- package/dist/admin/index.mjs.map +1 -1
- package/dist/server/index.js +86 -83
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +86 -84
- package/dist/server/index.mjs.map +1 -1
- package/package.json +36 -29
- package/dist/_chunks/App-DUmziQ17.js.map +0 -1
- package/dist/_chunks/App-D_6Y9N2F.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +0 -1
- package/dist/_chunks/en-B9Ur3VsE.mjs.map +0 -1
- package/dist/_chunks/en-DtFJ5ViE.js.map +0 -1
- package/dist/_chunks/index-BomF0-yY.mjs.map +0 -1
- package/dist/_chunks/index-C5Hc767q.js.map +0 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +0 -22
- package/dist/admin/src/components/RelativeTime.d.ts +0 -28
- package/dist/admin/src/components/ReleaseAction.d.ts +0 -3
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +0 -26
- package/dist/admin/src/components/ReleaseActionOptions.d.ts +0 -9
- package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
- package/dist/admin/src/components/ReleaseModal.d.ts +0 -16
- package/dist/admin/src/constants.d.ts +0 -58
- package/dist/admin/src/index.d.ts +0 -3
- package/dist/admin/src/pages/App.d.ts +0 -1
- package/dist/admin/src/pages/PurchaseContentReleases.d.ts +0 -2
- package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +0 -2
- package/dist/admin/src/pages/ReleasesPage.d.ts +0 -8
- package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +0 -181
- package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +0 -39
- package/dist/admin/src/pluginId.d.ts +0 -1
- package/dist/admin/src/services/release.d.ts +0 -105
- package/dist/admin/src/store/hooks.d.ts +0 -7
- package/dist/admin/src/utils/api.d.ts +0 -6
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +0 -3
- package/dist/admin/src/utils/time.d.ts +0 -1
- package/dist/server/src/bootstrap.d.ts +0 -5
- package/dist/server/src/bootstrap.d.ts.map +0 -1
- package/dist/server/src/constants.d.ts +0 -12
- package/dist/server/src/constants.d.ts.map +0 -1
- package/dist/server/src/content-types/index.d.ts +0 -99
- package/dist/server/src/content-types/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release/index.d.ts +0 -48
- package/dist/server/src/content-types/release/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release/schema.d.ts +0 -47
- package/dist/server/src/content-types/release/schema.d.ts.map +0 -1
- package/dist/server/src/content-types/release-action/index.d.ts +0 -50
- package/dist/server/src/content-types/release-action/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release-action/schema.d.ts +0 -49
- package/dist/server/src/content-types/release-action/schema.d.ts.map +0 -1
- package/dist/server/src/controllers/index.d.ts +0 -20
- package/dist/server/src/controllers/index.d.ts.map +0 -1
- package/dist/server/src/controllers/release-action.d.ts +0 -10
- package/dist/server/src/controllers/release-action.d.ts.map +0 -1
- package/dist/server/src/controllers/release.d.ts +0 -12
- package/dist/server/src/controllers/release.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/release-action.d.ts +0 -8
- package/dist/server/src/controllers/validation/release-action.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/release.d.ts +0 -2
- package/dist/server/src/controllers/validation/release.d.ts.map +0 -1
- package/dist/server/src/destroy.d.ts +0 -5
- package/dist/server/src/destroy.d.ts.map +0 -1
- package/dist/server/src/index.d.ts +0 -2096
- package/dist/server/src/index.d.ts.map +0 -1
- package/dist/server/src/migrations/index.d.ts +0 -13
- package/dist/server/src/migrations/index.d.ts.map +0 -1
- package/dist/server/src/register.d.ts +0 -5
- package/dist/server/src/register.d.ts.map +0 -1
- package/dist/server/src/routes/index.d.ts +0 -35
- package/dist/server/src/routes/index.d.ts.map +0 -1
- package/dist/server/src/routes/release-action.d.ts +0 -18
- package/dist/server/src/routes/release-action.d.ts.map +0 -1
- package/dist/server/src/routes/release.d.ts +0 -18
- package/dist/server/src/routes/release.d.ts.map +0 -1
- package/dist/server/src/services/index.d.ts +0 -1826
- package/dist/server/src/services/index.d.ts.map +0 -1
- package/dist/server/src/services/release.d.ts +0 -66
- package/dist/server/src/services/release.d.ts.map +0 -1
- package/dist/server/src/services/scheduling.d.ts +0 -18
- package/dist/server/src/services/scheduling.d.ts.map +0 -1
- package/dist/server/src/services/validation.d.ts +0 -18
- package/dist/server/src/services/validation.d.ts.map +0 -1
- package/dist/server/src/utils/index.d.ts +0 -14
- package/dist/server/src/utils/index.d.ts.map +0 -1
- package/dist/shared/contracts/release-actions.d.ts +0 -131
- package/dist/shared/contracts/release-actions.d.ts.map +0 -1
- package/dist/shared/contracts/releases.d.ts +0 -182
- package/dist/shared/contracts/releases.d.ts.map +0 -1
- package/dist/shared/types.d.ts +0 -24
- package/dist/shared/types.d.ts.map +0 -1
- package/dist/shared/validation-schemas.d.ts +0 -2
- package/dist/shared/validation-schemas.d.ts.map +0 -1
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const helperPlugin = require("@strapi/helper-plugin");
|
|
2
3
|
const icons = require("@strapi/icons");
|
|
3
4
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
5
|
const React = require("react");
|
|
5
6
|
const query = require("@reduxjs/toolkit/query");
|
|
6
|
-
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
7
|
-
const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
|
|
8
7
|
const designSystem = require("@strapi/design-system");
|
|
9
|
-
const
|
|
8
|
+
const v2 = require("@strapi/design-system/v2");
|
|
9
|
+
const axios = require("axios");
|
|
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
|
|
14
|
+
const react = require("@reduxjs/toolkit/query/react");
|
|
15
|
+
const styled = require("styled-components");
|
|
16
|
+
const reactRedux = require("react-redux");
|
|
17
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
15
18
|
function _interopNamespace(e) {
|
|
16
19
|
if (e && e.__esModule)
|
|
17
20
|
return e;
|
|
@@ -32,6 +35,7 @@ function _interopNamespace(e) {
|
|
|
32
35
|
}
|
|
33
36
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
34
37
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
38
|
+
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
35
39
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
36
40
|
const v = glob[path];
|
|
37
41
|
if (v) {
|
|
@@ -113,9 +117,49 @@ const PERMISSIONS = {
|
|
|
113
117
|
}
|
|
114
118
|
]
|
|
115
119
|
};
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
const pluginId = "content-releases";
|
|
121
|
+
const axiosBaseQuery = async ({
|
|
122
|
+
url,
|
|
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", "EntriesInRelease"],
|
|
119
163
|
endpoints: (build) => {
|
|
120
164
|
return {
|
|
121
165
|
getReleasesForEntry: build.query({
|
|
@@ -259,17 +303,13 @@ const releaseApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
|
259
303
|
...query2
|
|
260
304
|
};
|
|
261
305
|
const patchResult = dispatch(
|
|
262
|
-
releaseApi.util.updateQueryData(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
(
|
|
266
|
-
|
|
267
|
-
const action = draft.data[key][index];
|
|
268
|
-
if (action) {
|
|
269
|
-
action.type = body.type;
|
|
270
|
-
}
|
|
306
|
+
releaseApi.util.updateQueryData("getReleaseActions", paramsWithoutActionId, (draft) => {
|
|
307
|
+
const [key, index] = actionPath;
|
|
308
|
+
const action = draft.data[key][index];
|
|
309
|
+
if (action) {
|
|
310
|
+
action.type = body.type;
|
|
271
311
|
}
|
|
272
|
-
)
|
|
312
|
+
})
|
|
273
313
|
);
|
|
274
314
|
try {
|
|
275
315
|
await queryFulfilled;
|
|
@@ -359,12 +399,16 @@ const getTimezoneOffset = (timezone, date) => {
|
|
|
359
399
|
return "";
|
|
360
400
|
}
|
|
361
401
|
};
|
|
362
|
-
const
|
|
402
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
403
|
+
const useTypedSelector = reactRedux.useSelector;
|
|
404
|
+
const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
363
405
|
&:hover {
|
|
364
|
-
background: ${({ theme,
|
|
406
|
+
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
365
407
|
|
|
366
408
|
svg {
|
|
367
|
-
|
|
409
|
+
path {
|
|
410
|
+
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
411
|
+
}
|
|
368
412
|
}
|
|
369
413
|
|
|
370
414
|
a {
|
|
@@ -373,7 +417,9 @@ const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
|
373
417
|
}
|
|
374
418
|
|
|
375
419
|
svg {
|
|
376
|
-
|
|
420
|
+
path {
|
|
421
|
+
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
422
|
+
}
|
|
377
423
|
}
|
|
378
424
|
|
|
379
425
|
a {
|
|
@@ -385,14 +431,15 @@ const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
|
|
385
431
|
width: 100%;
|
|
386
432
|
}
|
|
387
433
|
`;
|
|
434
|
+
const StyledIconButton = styled__default.default(designSystem.IconButton)`
|
|
435
|
+
/* Setting this style inline with borderColor will not apply the style */
|
|
436
|
+
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
437
|
+
`;
|
|
388
438
|
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
389
439
|
const { formatMessage } = reactIntl.useIntl();
|
|
390
|
-
const
|
|
391
|
-
const { formatAPIError } =
|
|
440
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
441
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
392
442
|
const [deleteReleaseAction] = useDeleteReleaseActionMutation();
|
|
393
|
-
const {
|
|
394
|
-
allowedActions: { canDeleteAction }
|
|
395
|
-
} = strapiAdmin.useRBAC(PERMISSIONS);
|
|
396
443
|
const handleDeleteAction = async () => {
|
|
397
444
|
const response = await deleteReleaseAction({
|
|
398
445
|
params: { releaseId, actionId }
|
|
@@ -408,29 +455,26 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
408
455
|
return;
|
|
409
456
|
}
|
|
410
457
|
if ("error" in response) {
|
|
411
|
-
if (
|
|
458
|
+
if (axios.isAxiosError(response.error)) {
|
|
412
459
|
toggleNotification({
|
|
413
|
-
type: "
|
|
460
|
+
type: "warning",
|
|
414
461
|
message: formatAPIError(response.error)
|
|
415
462
|
});
|
|
416
463
|
} else {
|
|
417
464
|
toggleNotification({
|
|
418
|
-
type: "
|
|
465
|
+
type: "warning",
|
|
419
466
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
420
467
|
});
|
|
421
468
|
}
|
|
422
469
|
}
|
|
423
470
|
};
|
|
424
|
-
|
|
425
|
-
|
|
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" }),
|
|
471
|
+
return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.deleteAction, children: /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
472
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Cross, width: 3, height: 3 }),
|
|
429
473
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
430
474
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
431
475
|
defaultMessage: "Remove from release"
|
|
432
476
|
}) })
|
|
433
|
-
] }) });
|
|
477
|
+
] }) }) });
|
|
434
478
|
};
|
|
435
479
|
const ReleaseActionEntryLinkItem = ({
|
|
436
480
|
contentTypeUid,
|
|
@@ -438,79 +482,77 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
438
482
|
locale
|
|
439
483
|
}) => {
|
|
440
484
|
const { formatMessage } = reactIntl.useIntl();
|
|
441
|
-
const
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
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
|
-
}
|
|
485
|
+
const collectionTypePermissions = useTypedSelector(
|
|
486
|
+
(state) => state.rbacProvider.collectionTypesRelatedPermissions
|
|
487
|
+
);
|
|
488
|
+
const updatePermissions = contentTypeUid ? collectionTypePermissions[contentTypeUid]?.["plugin::content-manager.explorer.update"] : [];
|
|
489
|
+
const canUpdateEntryForLocale = Boolean(
|
|
490
|
+
!locale || updatePermissions?.find(
|
|
491
|
+
(permission) => permission.properties?.locales?.includes(locale)
|
|
492
|
+
)
|
|
493
|
+
);
|
|
464
494
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
465
|
-
|
|
495
|
+
helperPlugin.CheckPermissions,
|
|
466
496
|
{
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
children: /* @__PURE__ */ jsxRuntime.
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
497
|
+
permissions: [
|
|
498
|
+
{
|
|
499
|
+
action: "plugin::content-manager.explorer.update",
|
|
500
|
+
subject: contentTypeUid
|
|
501
|
+
}
|
|
502
|
+
],
|
|
503
|
+
children: canUpdateEntryForLocale && /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
504
|
+
v2.Link,
|
|
505
|
+
{
|
|
506
|
+
as: reactRouterDom.NavLink,
|
|
507
|
+
to: {
|
|
508
|
+
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
509
|
+
search: locale && `?plugins[i18n][locale]=${locale}`
|
|
510
|
+
},
|
|
511
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil, width: 3, height: 3 }),
|
|
512
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
513
|
+
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
514
|
+
defaultMessage: "Edit entry"
|
|
515
|
+
}) })
|
|
516
|
+
}
|
|
517
|
+
) })
|
|
480
518
|
}
|
|
481
519
|
);
|
|
482
520
|
};
|
|
483
521
|
const EditReleaseItem = ({ releaseId }) => {
|
|
484
522
|
const { formatMessage } = reactIntl.useIntl();
|
|
485
|
-
return (
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
523
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
524
|
+
v2.Link,
|
|
525
|
+
{
|
|
526
|
+
href: `/admin/plugins/content-releases/${releaseId}`,
|
|
527
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil, width: 3, height: 3 }),
|
|
528
|
+
isExternal: false,
|
|
529
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
490
530
|
id: "content-releases.content-manager-edit-view.edit-release",
|
|
491
531
|
defaultMessage: "Edit release"
|
|
492
532
|
}) })
|
|
493
|
-
|
|
494
|
-
);
|
|
533
|
+
}
|
|
534
|
+
) });
|
|
495
535
|
};
|
|
496
|
-
const Root = ({ children }) => {
|
|
536
|
+
const Root = ({ children, hasTriggerBorder = false }) => {
|
|
497
537
|
const { formatMessage } = reactIntl.useIntl();
|
|
498
|
-
const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
|
|
499
538
|
return (
|
|
500
539
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
501
|
-
|
|
502
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
503
|
-
|
|
540
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: [...PERMISSIONS.deleteAction, ...PERMISSIONS.update], children: /* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Root, { children: [
|
|
541
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
542
|
+
v2.Menu.Trigger,
|
|
504
543
|
{
|
|
505
|
-
|
|
544
|
+
as: hasTriggerBorder ? StyledIconButton : designSystem.IconButton,
|
|
545
|
+
paddingLeft: 2,
|
|
546
|
+
paddingRight: 2,
|
|
547
|
+
"aria-label": formatMessage({
|
|
506
548
|
id: "content-releases.content-manager-edit-view.release-action-menu",
|
|
507
549
|
defaultMessage: "Release action options"
|
|
508
550
|
}),
|
|
509
|
-
|
|
551
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
|
|
510
552
|
}
|
|
511
|
-
)
|
|
512
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
513
|
-
] })
|
|
553
|
+
),
|
|
554
|
+
/* @__PURE__ */ jsxRuntime.jsx(v2.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
555
|
+
] }) })
|
|
514
556
|
);
|
|
515
557
|
};
|
|
516
558
|
const ReleaseActionMenu = {
|
|
@@ -525,11 +567,11 @@ const getBorderLeftRadiusValue = (actionType) => {
|
|
|
525
567
|
const getBorderRightRadiusValue = (actionType) => {
|
|
526
568
|
return actionType === "publish" ? 0 : 1;
|
|
527
569
|
};
|
|
528
|
-
const FieldWrapper =
|
|
529
|
-
border-top-left-radius: ${({
|
|
530
|
-
border-bottom-left-radius: ${({
|
|
531
|
-
border-top-right-radius: ${({
|
|
532
|
-
border-bottom-right-radius: ${({
|
|
570
|
+
const FieldWrapper = styled__default.default(designSystem.Field)`
|
|
571
|
+
border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
572
|
+
border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
|
|
573
|
+
border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
574
|
+
border-bottom-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
|
|
533
575
|
|
|
534
576
|
> label {
|
|
535
577
|
color: inherit;
|
|
@@ -540,14 +582,14 @@ const FieldWrapper = styledComponents.styled(designSystem.Field.Root)`
|
|
|
540
582
|
}
|
|
541
583
|
|
|
542
584
|
&[data-checked='true'] {
|
|
543
|
-
color: ${({ theme,
|
|
544
|
-
background-color: ${({ theme,
|
|
545
|
-
border-color: ${({ theme,
|
|
585
|
+
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
586
|
+
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
587
|
+
border-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
546
588
|
}
|
|
547
589
|
|
|
548
590
|
&[data-checked='false'] {
|
|
549
|
-
border-left: ${({
|
|
550
|
-
border-right: ${({
|
|
591
|
+
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
592
|
+
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
551
593
|
}
|
|
552
594
|
|
|
553
595
|
&[data-checked='false'][data-disabled='false']:hover {
|
|
@@ -576,7 +618,7 @@ const ActionOption = ({
|
|
|
576
618
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
577
619
|
FieldWrapper,
|
|
578
620
|
{
|
|
579
|
-
|
|
621
|
+
actionType,
|
|
580
622
|
background: "primary0",
|
|
581
623
|
borderColor: "neutral200",
|
|
582
624
|
color: selected === actionType ? "primary600" : "neutral600",
|
|
@@ -584,11 +626,12 @@ const ActionOption = ({
|
|
|
584
626
|
cursor: "pointer",
|
|
585
627
|
"data-checked": selected === actionType,
|
|
586
628
|
"data-disabled": disabled && selected !== actionType,
|
|
587
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
|
629
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.FieldLabel, { htmlFor: `${name}-${actionType}`, children: [
|
|
588
630
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
589
|
-
designSystem.
|
|
631
|
+
designSystem.FieldInput,
|
|
590
632
|
{
|
|
591
633
|
type: "radio",
|
|
634
|
+
id: `${name}-${actionType}`,
|
|
592
635
|
name,
|
|
593
636
|
checked: selected === actionType,
|
|
594
637
|
onChange: handleChange,
|
|
@@ -641,20 +684,19 @@ const INITIAL_VALUES = {
|
|
|
641
684
|
const NoReleases = () => {
|
|
642
685
|
const { formatMessage } = reactIntl.useIntl();
|
|
643
686
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
644
|
-
|
|
687
|
+
helperPlugin.NoContent,
|
|
645
688
|
{
|
|
646
|
-
|
|
647
|
-
content: formatMessage({
|
|
689
|
+
content: {
|
|
648
690
|
id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
|
|
649
691
|
defaultMessage: "No available releases. Open the list of releases and create a new one from there."
|
|
650
|
-
}
|
|
692
|
+
},
|
|
651
693
|
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
652
|
-
|
|
694
|
+
v2.LinkButton,
|
|
653
695
|
{
|
|
654
696
|
to: {
|
|
655
697
|
pathname: "/plugins/content-releases"
|
|
656
698
|
},
|
|
657
|
-
|
|
699
|
+
as: reactRouterDom.Link,
|
|
658
700
|
variant: "secondary",
|
|
659
701
|
children: formatMessage({
|
|
660
702
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -672,10 +714,9 @@ const AddActionToReleaseModal = ({
|
|
|
672
714
|
}) => {
|
|
673
715
|
const releaseHeaderId = React__namespace.useId();
|
|
674
716
|
const { formatMessage } = reactIntl.useIntl();
|
|
675
|
-
const
|
|
676
|
-
const { formatAPIError } =
|
|
677
|
-
const
|
|
678
|
-
const locale = query2.plugins?.i18n?.locale;
|
|
717
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
718
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
719
|
+
const { modifiedData } = helperPlugin.useCMEditViewDataManager();
|
|
679
720
|
const response = useGetReleasesForEntryQuery({
|
|
680
721
|
contentTypeUid,
|
|
681
722
|
entryId,
|
|
@@ -684,6 +725,7 @@ const AddActionToReleaseModal = ({
|
|
|
684
725
|
const releases = response.data?.data;
|
|
685
726
|
const [createReleaseAction, { isLoading }] = useCreateReleaseActionMutation();
|
|
686
727
|
const handleSubmit = async (values) => {
|
|
728
|
+
const locale = modifiedData.locale;
|
|
687
729
|
const releaseActionEntry = {
|
|
688
730
|
contentType: contentTypeUid,
|
|
689
731
|
id: entryId,
|
|
@@ -705,14 +747,14 @@ const AddActionToReleaseModal = ({
|
|
|
705
747
|
return;
|
|
706
748
|
}
|
|
707
749
|
if ("error" in response2) {
|
|
708
|
-
if (
|
|
750
|
+
if (axios.isAxiosError(response2.error)) {
|
|
709
751
|
toggleNotification({
|
|
710
|
-
type: "
|
|
752
|
+
type: "warning",
|
|
711
753
|
message: formatAPIError(response2.error)
|
|
712
754
|
});
|
|
713
755
|
} else {
|
|
714
756
|
toggleNotification({
|
|
715
|
-
type: "
|
|
757
|
+
type: "warning",
|
|
716
758
|
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
717
759
|
});
|
|
718
760
|
}
|
|
@@ -732,25 +774,24 @@ const AddActionToReleaseModal = ({
|
|
|
732
774
|
children: ({ values, setFieldValue }) => {
|
|
733
775
|
return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
734
776
|
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: [
|
|
735
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
|
|
777
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
778
|
+
designSystem.SingleSelect,
|
|
779
|
+
{
|
|
780
|
+
required: true,
|
|
781
|
+
label: formatMessage({
|
|
782
|
+
id: "content-releases.content-manager-edit-view.add-to-release.select-label",
|
|
783
|
+
defaultMessage: "Select a release"
|
|
784
|
+
}),
|
|
785
|
+
placeholder: formatMessage({
|
|
786
|
+
id: "content-releases.content-manager-edit-view.add-to-release.select-placeholder",
|
|
787
|
+
defaultMessage: "Select"
|
|
788
|
+
}),
|
|
789
|
+
onChange: (value) => setFieldValue("releaseId", value),
|
|
790
|
+
value: values.releaseId,
|
|
791
|
+
children: releases?.map((release) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
792
|
+
}
|
|
793
|
+
) }),
|
|
794
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
|
|
754
795
|
id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
|
|
755
796
|
defaultMessage: "What do you want to do with this entry?"
|
|
756
797
|
}) }),
|
|
@@ -791,18 +832,14 @@ const AddActionToReleaseModal = ({
|
|
|
791
832
|
const CMReleasesContainer = () => {
|
|
792
833
|
const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
|
|
793
834
|
const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
|
|
794
|
-
const {
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
collectionType,
|
|
801
|
-
model: slug
|
|
802
|
-
});
|
|
803
|
-
const hasDraftAndPublish = schema?.options?.draftAndPublish;
|
|
835
|
+
const {
|
|
836
|
+
isCreatingEntry,
|
|
837
|
+
hasDraftAndPublish,
|
|
838
|
+
initialData: { id: entryId },
|
|
839
|
+
slug
|
|
840
|
+
} = helperPlugin.useCMEditViewDataManager();
|
|
804
841
|
const contentTypeUid = slug;
|
|
805
|
-
const canFetch =
|
|
842
|
+
const canFetch = entryId != null && contentTypeUid != null;
|
|
806
843
|
const fetchParams = canFetch ? {
|
|
807
844
|
contentTypeUid,
|
|
808
845
|
entryId,
|
|
@@ -823,13 +860,10 @@ const CMReleasesContainer = () => {
|
|
|
823
860
|
}
|
|
824
861
|
return `success${shade}`;
|
|
825
862
|
};
|
|
826
|
-
|
|
827
|
-
return null;
|
|
828
|
-
}
|
|
829
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
863
|
+
return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
830
864
|
designSystem.Box,
|
|
831
865
|
{
|
|
832
|
-
|
|
866
|
+
as: "aside",
|
|
833
867
|
"aria-label": formatMessage({
|
|
834
868
|
id: "content-releases.plugin.name",
|
|
835
869
|
defaultMessage: "Releases"
|
|
@@ -883,7 +917,7 @@ const CMReleasesContainer = () => {
|
|
|
883
917
|
)
|
|
884
918
|
}
|
|
885
919
|
),
|
|
886
|
-
/* @__PURE__ */ jsxRuntime.
|
|
920
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
887
921
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
888
922
|
release.scheduledAt && release.timezone && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
889
923
|
{
|
|
@@ -907,7 +941,7 @@ const CMReleasesContainer = () => {
|
|
|
907
941
|
)
|
|
908
942
|
}
|
|
909
943
|
) }),
|
|
910
|
-
|
|
944
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.deleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
|
|
911
945
|
/* @__PURE__ */ jsxRuntime.jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
|
|
912
946
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
913
947
|
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
@@ -916,14 +950,14 @@ const CMReleasesContainer = () => {
|
|
|
916
950
|
actionId: release.actions[0].id
|
|
917
951
|
}
|
|
918
952
|
)
|
|
919
|
-
] })
|
|
920
|
-
] })
|
|
953
|
+
] }) })
|
|
954
|
+
] })
|
|
921
955
|
]
|
|
922
956
|
},
|
|
923
957
|
release.id
|
|
924
958
|
);
|
|
925
959
|
}),
|
|
926
|
-
|
|
960
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.createAction, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
927
961
|
designSystem.Button,
|
|
928
962
|
{
|
|
929
963
|
justifyContent: "center",
|
|
@@ -938,7 +972,7 @@ const CMReleasesContainer = () => {
|
|
|
938
972
|
defaultMessage: "Add to release"
|
|
939
973
|
})
|
|
940
974
|
}
|
|
941
|
-
)
|
|
975
|
+
) })
|
|
942
976
|
] }),
|
|
943
977
|
isModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
944
978
|
AddActionToReleaseModal,
|
|
@@ -950,17 +984,269 @@ const CMReleasesContainer = () => {
|
|
|
950
984
|
)
|
|
951
985
|
]
|
|
952
986
|
}
|
|
987
|
+
) });
|
|
988
|
+
};
|
|
989
|
+
const getContentPermissions = (subject) => {
|
|
990
|
+
const permissions = {
|
|
991
|
+
publish: [
|
|
992
|
+
{
|
|
993
|
+
action: "plugin::content-manager.explorer.publish",
|
|
994
|
+
subject,
|
|
995
|
+
id: "",
|
|
996
|
+
actionParameters: {},
|
|
997
|
+
properties: {},
|
|
998
|
+
conditions: []
|
|
999
|
+
}
|
|
1000
|
+
]
|
|
1001
|
+
};
|
|
1002
|
+
return permissions;
|
|
1003
|
+
};
|
|
1004
|
+
const ReleaseAction = ({ ids, model }) => {
|
|
1005
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
1006
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
1007
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
1008
|
+
const { modifiedData } = helperPlugin.useCMEditViewDataManager();
|
|
1009
|
+
const contentPermissions = getContentPermissions(model);
|
|
1010
|
+
const {
|
|
1011
|
+
allowedActions: { canPublish }
|
|
1012
|
+
} = helperPlugin.useRBAC(contentPermissions);
|
|
1013
|
+
const {
|
|
1014
|
+
allowedActions: { canCreate }
|
|
1015
|
+
} = helperPlugin.useRBAC(PERMISSIONS);
|
|
1016
|
+
const response = useGetReleasesQuery();
|
|
1017
|
+
const releases = response.data?.data;
|
|
1018
|
+
const [createManyReleaseActions, { isLoading }] = useCreateManyReleaseActionsMutation();
|
|
1019
|
+
const handleSubmit = async (values) => {
|
|
1020
|
+
const locale = modifiedData.locale;
|
|
1021
|
+
const releaseActionEntries = ids.map((id) => ({
|
|
1022
|
+
type: values.type,
|
|
1023
|
+
entry: {
|
|
1024
|
+
contentType: model,
|
|
1025
|
+
id,
|
|
1026
|
+
locale
|
|
1027
|
+
}
|
|
1028
|
+
}));
|
|
1029
|
+
const response2 = await createManyReleaseActions({
|
|
1030
|
+
body: releaseActionEntries,
|
|
1031
|
+
params: { releaseId: values.releaseId }
|
|
1032
|
+
});
|
|
1033
|
+
if ("data" in response2) {
|
|
1034
|
+
const notificationMessage = formatMessage(
|
|
1035
|
+
{
|
|
1036
|
+
id: "content-releases.content-manager-list-view.add-to-release.notification.success.message",
|
|
1037
|
+
defaultMessage: "{entriesAlreadyInRelease} out of {totalEntries} entries were already in the release."
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1041
|
+
totalEntries: response2.data.meta.totalEntries
|
|
1042
|
+
}
|
|
1043
|
+
);
|
|
1044
|
+
const notification = {
|
|
1045
|
+
type: "success",
|
|
1046
|
+
title: formatMessage(
|
|
1047
|
+
{
|
|
1048
|
+
id: "content-releases.content-manager-list-view.add-to-release.notification.success.title",
|
|
1049
|
+
defaultMessage: "Successfully added to release."
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
|
|
1053
|
+
totalEntries: response2.data.meta.totalEntries
|
|
1054
|
+
}
|
|
1055
|
+
),
|
|
1056
|
+
message: response2.data.meta.entriesAlreadyInRelease ? notificationMessage : ""
|
|
1057
|
+
};
|
|
1058
|
+
toggleNotification(notification);
|
|
1059
|
+
return true;
|
|
1060
|
+
}
|
|
1061
|
+
if ("error" in response2) {
|
|
1062
|
+
if (axios.isAxiosError(response2.error)) {
|
|
1063
|
+
toggleNotification({
|
|
1064
|
+
type: "warning",
|
|
1065
|
+
message: formatAPIError(response2.error)
|
|
1066
|
+
});
|
|
1067
|
+
} else {
|
|
1068
|
+
toggleNotification({
|
|
1069
|
+
type: "warning",
|
|
1070
|
+
message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
if (!canCreate || !canPublish)
|
|
1076
|
+
return null;
|
|
1077
|
+
return {
|
|
1078
|
+
actionType: "release",
|
|
1079
|
+
variant: "tertiary",
|
|
1080
|
+
label: formatMessage({
|
|
1081
|
+
id: "content-manager-list-view.add-to-release",
|
|
1082
|
+
defaultMessage: "Add to Release"
|
|
1083
|
+
}),
|
|
1084
|
+
dialog: {
|
|
1085
|
+
type: "modal",
|
|
1086
|
+
title: formatMessage({
|
|
1087
|
+
id: "content-manager-list-view.add-to-release",
|
|
1088
|
+
defaultMessage: "Add to Release"
|
|
1089
|
+
}),
|
|
1090
|
+
content: ({ onClose }) => {
|
|
1091
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1092
|
+
formik.Formik,
|
|
1093
|
+
{
|
|
1094
|
+
onSubmit: async (values) => {
|
|
1095
|
+
const data = await handleSubmit(values);
|
|
1096
|
+
if (data) {
|
|
1097
|
+
return onClose();
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1100
|
+
validationSchema: RELEASE_ACTION_FORM_SCHEMA,
|
|
1101
|
+
initialValues: INITIAL_VALUES,
|
|
1102
|
+
children: ({ values, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
1103
|
+
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: [
|
|
1104
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1105
|
+
designSystem.SingleSelect,
|
|
1106
|
+
{
|
|
1107
|
+
required: true,
|
|
1108
|
+
label: formatMessage({
|
|
1109
|
+
id: "content-releases.content-manager-list-view.add-to-release.select-label",
|
|
1110
|
+
defaultMessage: "Select a release"
|
|
1111
|
+
}),
|
|
1112
|
+
placeholder: formatMessage({
|
|
1113
|
+
id: "content-releases.content-manager-list-view.add-to-release.select-placeholder",
|
|
1114
|
+
defaultMessage: "Select"
|
|
1115
|
+
}),
|
|
1116
|
+
onChange: (value) => setFieldValue("releaseId", value),
|
|
1117
|
+
value: values.releaseId,
|
|
1118
|
+
children: releases?.map((release) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: release.id, children: release.name }, release.id))
|
|
1119
|
+
}
|
|
1120
|
+
) }),
|
|
1121
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
|
|
1122
|
+
id: "content-releases.content-manager-list-view.add-to-release.action-type-label",
|
|
1123
|
+
defaultMessage: "What do you want to do with these entries?"
|
|
1124
|
+
}) }),
|
|
1125
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1126
|
+
ReleaseActionOptions,
|
|
1127
|
+
{
|
|
1128
|
+
selected: values.type,
|
|
1129
|
+
handleChange: (e) => setFieldValue("type", e.target.value),
|
|
1130
|
+
name: "type"
|
|
1131
|
+
}
|
|
1132
|
+
)
|
|
1133
|
+
] }) }),
|
|
1134
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1135
|
+
designSystem.ModalFooter,
|
|
1136
|
+
{
|
|
1137
|
+
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", name: "cancel", children: formatMessage({
|
|
1138
|
+
id: "content-releases.content-manager-list-view.add-to-release.cancel-button",
|
|
1139
|
+
defaultMessage: "Cancel"
|
|
1140
|
+
}) }),
|
|
1141
|
+
endActions: (
|
|
1142
|
+
/**
|
|
1143
|
+
* TODO: Ideally we would use isValid from Formik to disable the button, however currently it always returns true
|
|
1144
|
+
* for yup.string().required(), even when the value is falsy (including empty string)
|
|
1145
|
+
*/
|
|
1146
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
|
|
1147
|
+
id: "content-releases.content-manager-list-view.add-to-release.continue-button",
|
|
1148
|
+
defaultMessage: "Continue"
|
|
1149
|
+
}) })
|
|
1150
|
+
)
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
] })
|
|
1154
|
+
}
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
};
|
|
1160
|
+
const Button = styled__default.default.button`
|
|
1161
|
+
svg {
|
|
1162
|
+
> g,
|
|
1163
|
+
path {
|
|
1164
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
&:hover {
|
|
1168
|
+
svg {
|
|
1169
|
+
> g,
|
|
1170
|
+
path {
|
|
1171
|
+
fill: ${({ theme }) => theme.colors.neutral600};
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
&:active {
|
|
1176
|
+
svg {
|
|
1177
|
+
> g,
|
|
1178
|
+
path {
|
|
1179
|
+
fill: ${({ theme }) => theme.colors.neutral400};
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
`;
|
|
1184
|
+
const ActionWrapper = styled__default.default(designSystem.Flex)`
|
|
1185
|
+
svg {
|
|
1186
|
+
height: ${4 / 16}rem;
|
|
1187
|
+
}
|
|
1188
|
+
`;
|
|
1189
|
+
const useReleasesList = (entryId) => {
|
|
1190
|
+
const { uid: contentTypeUid } = useTypedSelector(
|
|
1191
|
+
(state) => state["content-manager_listView"].contentType
|
|
953
1192
|
);
|
|
1193
|
+
const listViewData = useTypedSelector((state) => state["content-manager_listView"].data);
|
|
1194
|
+
const entriesIds = listViewData.map((entry) => entry.id);
|
|
1195
|
+
const response = useGetMappedEntriesInReleasesQuery(
|
|
1196
|
+
{ contentTypeUid, entriesIds },
|
|
1197
|
+
{ skip: !entriesIds || !contentTypeUid || entriesIds.length === 0 }
|
|
1198
|
+
);
|
|
1199
|
+
const mappedEntriesInReleases = response.data || {};
|
|
1200
|
+
return mappedEntriesInReleases?.[entryId] || [];
|
|
954
1201
|
};
|
|
955
|
-
const
|
|
956
|
-
const
|
|
957
|
-
if (!
|
|
958
|
-
|
|
1202
|
+
const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
|
1203
|
+
const { contentType } = layout;
|
|
1204
|
+
if (!contentType.options?.draftAndPublish) {
|
|
1205
|
+
return { displayedHeaders, layout };
|
|
959
1206
|
}
|
|
960
|
-
return
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
1207
|
+
return {
|
|
1208
|
+
displayedHeaders: [
|
|
1209
|
+
...displayedHeaders,
|
|
1210
|
+
{
|
|
1211
|
+
key: "__release_key__",
|
|
1212
|
+
fieldSchema: { type: "string" },
|
|
1213
|
+
metadatas: { label: "To be released in", searchable: true, sortable: false },
|
|
1214
|
+
name: "releasedAt",
|
|
1215
|
+
cellFormatter: (props) => /* @__PURE__ */ jsxRuntime.jsx(ReleaseListCell, { ...props })
|
|
1216
|
+
}
|
|
1217
|
+
],
|
|
1218
|
+
layout
|
|
1219
|
+
};
|
|
1220
|
+
};
|
|
1221
|
+
const ReleaseListCell = ({ id }) => {
|
|
1222
|
+
const releases = useReleasesList(id);
|
|
1223
|
+
const [visible, setVisible] = React__namespace.useState(false);
|
|
1224
|
+
const buttonRef = React__namespace.useRef(null);
|
|
1225
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
1226
|
+
const handleTogglePopover = () => setVisible((prev) => !prev);
|
|
1227
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", onClick: handleTogglePopover, ref: buttonRef, children: /* @__PURE__ */ jsxRuntime.jsxs(ActionWrapper, { height: "2rem", width: "2rem", children: [
|
|
1228
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { style: { maxWidth: "252px", cursor: "pointer" }, textColor: "neutral800", children: releases.length > 0 ? formatMessage(
|
|
1229
|
+
{
|
|
1230
|
+
id: "content-releases.content-manager.list-view.releases-number",
|
|
1231
|
+
defaultMessage: "{number} {number, plural, one {release} other {releases}}"
|
|
1232
|
+
},
|
|
1233
|
+
{
|
|
1234
|
+
number: releases.length
|
|
1235
|
+
}
|
|
1236
|
+
) : "-" }),
|
|
1237
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
|
1238
|
+
releases.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.SortIcon, {}),
|
|
1239
|
+
visible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1240
|
+
designSystem.Popover,
|
|
1241
|
+
{
|
|
1242
|
+
onDismiss: handleTogglePopover,
|
|
1243
|
+
source: buttonRef,
|
|
1244
|
+
spacing: 16,
|
|
1245
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children: releases.map(({ id: id2, name }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 3, as: "li", children: /* @__PURE__ */ jsxRuntime.jsx(v2.Link, { href: `/admin/plugins/content-releases/${id2}`, isExternal: false, children: name }) }, id2)) })
|
|
1246
|
+
}
|
|
1247
|
+
)
|
|
1248
|
+
] })
|
|
1249
|
+
] }) }) });
|
|
964
1250
|
};
|
|
965
1251
|
const admin = {
|
|
966
1252
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -968,20 +1254,32 @@ const admin = {
|
|
|
968
1254
|
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
969
1255
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
970
1256
|
app.addMenuLink({
|
|
971
|
-
to:
|
|
1257
|
+
to: `/plugins/${pluginId}`,
|
|
972
1258
|
icon: icons.PaperPlane,
|
|
973
1259
|
intlLabel: {
|
|
974
1260
|
id: `${pluginId}.plugin.name`,
|
|
975
1261
|
defaultMessage: "Releases"
|
|
976
1262
|
},
|
|
977
|
-
Component
|
|
978
|
-
|
|
979
|
-
|
|
1263
|
+
async Component() {
|
|
1264
|
+
const { App } = await Promise.resolve().then(() => require("./App-HjWtUYmc.js"));
|
|
1265
|
+
return App;
|
|
1266
|
+
},
|
|
1267
|
+
permissions: PERMISSIONS.main
|
|
980
1268
|
});
|
|
981
|
-
app.
|
|
1269
|
+
app.addMiddlewares([() => releaseApi.middleware]);
|
|
1270
|
+
app.addReducers({
|
|
1271
|
+
[releaseApi.reducerPath]: releaseApi.reducer
|
|
1272
|
+
});
|
|
1273
|
+
app.injectContentManagerComponent("editView", "right-links", {
|
|
982
1274
|
name: `${pluginId}-link`,
|
|
983
1275
|
Component: CMReleasesContainer
|
|
984
1276
|
});
|
|
1277
|
+
app.plugins["content-manager"].apis.addBulkAction((actions) => {
|
|
1278
|
+
const deleteActionIndex = actions.findIndex((action) => action.name === "DeleteAction");
|
|
1279
|
+
actions.splice(deleteActionIndex, 0, ReleaseAction);
|
|
1280
|
+
return actions;
|
|
1281
|
+
});
|
|
1282
|
+
app.registerHook("Admin/CM/pages/ListView/inject-column-in-table", addColumnToTableHook);
|
|
985
1283
|
} else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
|
|
986
1284
|
app.addMenuLink({
|
|
987
1285
|
to: `/plugins/purchase-content-releases`,
|
|
@@ -990,22 +1288,20 @@ const admin = {
|
|
|
990
1288
|
id: `${pluginId}.plugin.name`,
|
|
991
1289
|
defaultMessage: "Releases"
|
|
992
1290
|
},
|
|
993
|
-
permissions: [],
|
|
994
1291
|
async Component() {
|
|
995
|
-
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-
|
|
996
|
-
return
|
|
1292
|
+
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-bpIYXOfu.js"));
|
|
1293
|
+
return PurchaseContentReleases;
|
|
997
1294
|
},
|
|
998
|
-
lockIcon: true
|
|
999
|
-
position: 2
|
|
1295
|
+
lockIcon: true
|
|
1000
1296
|
});
|
|
1001
1297
|
}
|
|
1002
1298
|
},
|
|
1003
1299
|
async registerTrads({ locales }) {
|
|
1004
1300
|
const importedTrads = await Promise.all(
|
|
1005
1301
|
locales.map((locale) => {
|
|
1006
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
|
1302
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-HrREghh3.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
1007
1303
|
return {
|
|
1008
|
-
data: prefixPluginTranslations(data, "content-releases"),
|
|
1304
|
+
data: helperPlugin.prefixPluginTranslations(data, "content-releases"),
|
|
1009
1305
|
locale
|
|
1010
1306
|
};
|
|
1011
1307
|
}).catch(() => {
|
|
@@ -1024,6 +1320,7 @@ exports.ReleaseActionMenu = ReleaseActionMenu;
|
|
|
1024
1320
|
exports.ReleaseActionOptions = ReleaseActionOptions;
|
|
1025
1321
|
exports.admin = admin;
|
|
1026
1322
|
exports.getTimezoneOffset = getTimezoneOffset;
|
|
1323
|
+
exports.isAxiosError = isAxiosError;
|
|
1027
1324
|
exports.pluginId = pluginId;
|
|
1028
1325
|
exports.releaseApi = releaseApi;
|
|
1029
1326
|
exports.useCreateReleaseMutation = useCreateReleaseMutation;
|
|
@@ -1032,6 +1329,7 @@ exports.useGetReleaseActionsQuery = useGetReleaseActionsQuery;
|
|
|
1032
1329
|
exports.useGetReleaseQuery = useGetReleaseQuery;
|
|
1033
1330
|
exports.useGetReleasesQuery = useGetReleasesQuery;
|
|
1034
1331
|
exports.usePublishReleaseMutation = usePublishReleaseMutation;
|
|
1332
|
+
exports.useTypedDispatch = useTypedDispatch;
|
|
1035
1333
|
exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
|
|
1036
1334
|
exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
|
|
1037
|
-
//# sourceMappingURL=index-
|
|
1335
|
+
//# sourceMappingURL=index-ZNwxYN8H.js.map
|