@strapi/content-releases 0.0.0-next.d470b4f75cf00f24f440b80300f1c833c322b871 → 0.0.0-next.de77e236e318525454da54a1a2617d86742e6e6c
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-1hHIqUoZ.js → App-HjWtUYmc.js} +636 -382
- package/dist/_chunks/App-HjWtUYmc.js.map +1 -0
- package/dist/_chunks/{App-U6GbyLIE.mjs → App-gu1aiP6i.mjs} +647 -394
- package/dist/_chunks/App-gu1aiP6i.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-3tRbmbY3.mjs} +2 -2
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-bpIYXOfu.js} +2 -2
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +1 -0
- package/dist/_chunks/{en-bDhIlw-B.js → en-HrREghh3.js} +23 -6
- package/dist/_chunks/en-HrREghh3.js.map +1 -0
- package/dist/_chunks/{en-GqXgfmzl.mjs → en-ltT1TlKQ.mjs} +23 -6
- package/dist/_chunks/en-ltT1TlKQ.mjs.map +1 -0
- package/dist/_chunks/{index-l-FvkQlQ.js → index-ZNwxYN8H.js} +384 -20
- package/dist/_chunks/index-ZNwxYN8H.js.map +1 -0
- package/dist/_chunks/{index-gkExFBa0.mjs → index-mvj9PSKd.mjs} +400 -36
- package/dist/_chunks/index-mvj9PSKd.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/server/index.js +948 -450
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +947 -450
- package/dist/server/index.mjs.map +1 -1
- package/package.json +14 -12
- package/dist/_chunks/App-1hHIqUoZ.js.map +0 -1
- package/dist/_chunks/App-U6GbyLIE.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +0 -1
- package/dist/_chunks/en-GqXgfmzl.mjs.map +0 -1
- package/dist/_chunks/en-bDhIlw-B.js.map +0 -1
- package/dist/_chunks/index-gkExFBa0.mjs.map +0 -1
- package/dist/_chunks/index-l-FvkQlQ.js.map +0 -1
|
@@ -159,7 +159,7 @@ const isAxiosError = (err) => {
|
|
|
159
159
|
const releaseApi = react.createApi({
|
|
160
160
|
reducerPath: pluginId,
|
|
161
161
|
baseQuery: axiosBaseQuery,
|
|
162
|
-
tagTypes: ["Release", "ReleaseAction"],
|
|
162
|
+
tagTypes: ["Release", "ReleaseAction", "EntriesInRelease"],
|
|
163
163
|
endpoints: (build) => {
|
|
164
164
|
return {
|
|
165
165
|
getReleasesForEntry: build.query({
|
|
@@ -274,6 +274,20 @@ const releaseApi = react.createApi({
|
|
|
274
274
|
{ type: "ReleaseAction", id: "LIST" }
|
|
275
275
|
]
|
|
276
276
|
}),
|
|
277
|
+
createManyReleaseActions: build.mutation({
|
|
278
|
+
query({ body, params }) {
|
|
279
|
+
return {
|
|
280
|
+
url: `/content-releases/${params.releaseId}/actions/bulk`,
|
|
281
|
+
method: "POST",
|
|
282
|
+
data: body
|
|
283
|
+
};
|
|
284
|
+
},
|
|
285
|
+
invalidatesTags: [
|
|
286
|
+
{ type: "Release", id: "LIST" },
|
|
287
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
288
|
+
{ type: "EntriesInRelease" }
|
|
289
|
+
]
|
|
290
|
+
}),
|
|
277
291
|
updateReleaseAction: build.mutation({
|
|
278
292
|
query({ body, params }) {
|
|
279
293
|
return {
|
|
@@ -311,9 +325,11 @@ const releaseApi = react.createApi({
|
|
|
311
325
|
method: "DELETE"
|
|
312
326
|
};
|
|
313
327
|
},
|
|
314
|
-
invalidatesTags: [
|
|
328
|
+
invalidatesTags: (result, error, arg) => [
|
|
315
329
|
{ type: "Release", id: "LIST" },
|
|
316
|
-
{ type: "
|
|
330
|
+
{ type: "Release", id: arg.params.releaseId },
|
|
331
|
+
{ type: "ReleaseAction", id: "LIST" },
|
|
332
|
+
{ type: "EntriesInRelease" }
|
|
317
333
|
]
|
|
318
334
|
}),
|
|
319
335
|
publishRelease: build.mutation({
|
|
@@ -332,7 +348,22 @@ const releaseApi = react.createApi({
|
|
|
332
348
|
method: "DELETE"
|
|
333
349
|
};
|
|
334
350
|
},
|
|
335
|
-
invalidatesTags: (
|
|
351
|
+
invalidatesTags: () => [{ type: "Release", id: "LIST" }, { type: "EntriesInRelease" }]
|
|
352
|
+
}),
|
|
353
|
+
getMappedEntriesInReleases: build.query({
|
|
354
|
+
query(params) {
|
|
355
|
+
return {
|
|
356
|
+
url: "/content-releases/mapEntriesToReleases",
|
|
357
|
+
method: "GET",
|
|
358
|
+
config: {
|
|
359
|
+
params
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
},
|
|
363
|
+
transformResponse(response) {
|
|
364
|
+
return response.data;
|
|
365
|
+
},
|
|
366
|
+
providesTags: [{ type: "EntriesInRelease" }]
|
|
336
367
|
})
|
|
337
368
|
};
|
|
338
369
|
}
|
|
@@ -344,12 +375,30 @@ const {
|
|
|
344
375
|
useGetReleaseActionsQuery,
|
|
345
376
|
useCreateReleaseMutation,
|
|
346
377
|
useCreateReleaseActionMutation,
|
|
378
|
+
useCreateManyReleaseActionsMutation,
|
|
347
379
|
useUpdateReleaseMutation,
|
|
348
380
|
useUpdateReleaseActionMutation,
|
|
349
381
|
usePublishReleaseMutation,
|
|
350
382
|
useDeleteReleaseActionMutation,
|
|
351
|
-
useDeleteReleaseMutation
|
|
383
|
+
useDeleteReleaseMutation,
|
|
384
|
+
useGetMappedEntriesInReleasesQuery
|
|
352
385
|
} = releaseApi;
|
|
386
|
+
const getTimezoneOffset = (timezone, date) => {
|
|
387
|
+
try {
|
|
388
|
+
const offsetPart = new Intl.DateTimeFormat("en", {
|
|
389
|
+
timeZone: timezone,
|
|
390
|
+
timeZoneName: "longOffset"
|
|
391
|
+
}).formatToParts(date).find((part) => part.type === "timeZoneName");
|
|
392
|
+
const offset = offsetPart ? offsetPart.value : "";
|
|
393
|
+
let utcOffset = offset.replace("GMT", "UTC");
|
|
394
|
+
if (!utcOffset.includes("+") && !utcOffset.includes("-")) {
|
|
395
|
+
utcOffset = `${utcOffset}+00:00`;
|
|
396
|
+
}
|
|
397
|
+
return utcOffset;
|
|
398
|
+
} catch (error) {
|
|
399
|
+
return "";
|
|
400
|
+
}
|
|
401
|
+
};
|
|
353
402
|
const useTypedDispatch = reactRedux.useDispatch;
|
|
354
403
|
const useTypedSelector = reactRedux.useSelector;
|
|
355
404
|
const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
@@ -469,6 +518,21 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
469
518
|
}
|
|
470
519
|
);
|
|
471
520
|
};
|
|
521
|
+
const EditReleaseItem = ({ releaseId }) => {
|
|
522
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
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({
|
|
530
|
+
id: "content-releases.content-manager-edit-view.edit-release",
|
|
531
|
+
defaultMessage: "Edit release"
|
|
532
|
+
}) })
|
|
533
|
+
}
|
|
534
|
+
) });
|
|
535
|
+
};
|
|
472
536
|
const Root = ({ children, hasTriggerBorder = false }) => {
|
|
473
537
|
const { formatMessage } = reactIntl.useIntl();
|
|
474
538
|
return (
|
|
@@ -493,6 +557,7 @@ const Root = ({ children, hasTriggerBorder = false }) => {
|
|
|
493
557
|
};
|
|
494
558
|
const ReleaseActionMenu = {
|
|
495
559
|
Root,
|
|
560
|
+
EditReleaseItem,
|
|
496
561
|
DeleteReleaseActionItem,
|
|
497
562
|
ReleaseActionEntryLinkItem
|
|
498
563
|
};
|
|
@@ -531,6 +596,10 @@ const FieldWrapper = styled__default.default(designSystem.Field)`
|
|
|
531
596
|
color: ${({ theme }) => theme.colors.neutral700};
|
|
532
597
|
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
533
598
|
border-color: ${({ theme }) => theme.colors.neutral200};
|
|
599
|
+
|
|
600
|
+
& > label {
|
|
601
|
+
cursor: pointer;
|
|
602
|
+
}
|
|
534
603
|
}
|
|
535
604
|
|
|
536
605
|
&[data-disabled='true'] {
|
|
@@ -762,7 +831,7 @@ const AddActionToReleaseModal = ({
|
|
|
762
831
|
};
|
|
763
832
|
const CMReleasesContainer = () => {
|
|
764
833
|
const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
|
|
765
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
834
|
+
const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
|
|
766
835
|
const {
|
|
767
836
|
isCreatingEntry,
|
|
768
837
|
hasDraftAndPublish,
|
|
@@ -818,7 +887,7 @@ const CMReleasesContainer = () => {
|
|
|
818
887
|
alignItems: "start",
|
|
819
888
|
borderWidth: "1px",
|
|
820
889
|
borderStyle: "solid",
|
|
821
|
-
borderColor: getReleaseColorVariant(release.
|
|
890
|
+
borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
|
|
822
891
|
overflow: "hidden",
|
|
823
892
|
hasRadius: true,
|
|
824
893
|
children: [
|
|
@@ -829,34 +898,59 @@ const CMReleasesContainer = () => {
|
|
|
829
898
|
paddingBottom: 3,
|
|
830
899
|
paddingLeft: 4,
|
|
831
900
|
paddingRight: 4,
|
|
832
|
-
background: getReleaseColorVariant(release.
|
|
901
|
+
background: getReleaseColorVariant(release.actions[0].type, "100"),
|
|
833
902
|
width: "100%",
|
|
834
903
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
835
904
|
designSystem.Typography,
|
|
836
905
|
{
|
|
837
906
|
fontSize: 1,
|
|
838
907
|
variant: "pi",
|
|
839
|
-
textColor: getReleaseColorVariant(release.
|
|
908
|
+
textColor: getReleaseColorVariant(release.actions[0].type, "600"),
|
|
840
909
|
children: formatMessage(
|
|
841
910
|
{
|
|
842
911
|
id: "content-releases.content-manager-edit-view.list-releases.title",
|
|
843
912
|
defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
|
|
844
913
|
},
|
|
845
|
-
{ isPublish: release.
|
|
914
|
+
{ isPublish: release.actions[0].type === "publish" }
|
|
846
915
|
)
|
|
847
916
|
}
|
|
848
917
|
)
|
|
849
918
|
}
|
|
850
919
|
),
|
|
851
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap:
|
|
920
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
852
921
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
853
|
-
|
|
854
|
-
|
|
922
|
+
release.scheduledAt && release.timezone && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
923
|
+
{
|
|
924
|
+
id: "content-releases.content-manager-edit-view.scheduled.date",
|
|
925
|
+
defaultMessage: "{date} at {time} ({offset})"
|
|
926
|
+
},
|
|
855
927
|
{
|
|
856
|
-
|
|
857
|
-
|
|
928
|
+
date: formatDate(new Date(release.scheduledAt), {
|
|
929
|
+
day: "2-digit",
|
|
930
|
+
month: "2-digit",
|
|
931
|
+
year: "numeric",
|
|
932
|
+
timeZone: release.timezone
|
|
933
|
+
}),
|
|
934
|
+
time: formatTime(new Date(release.scheduledAt), {
|
|
935
|
+
hourCycle: "h23",
|
|
936
|
+
timeZone: release.timezone
|
|
937
|
+
}),
|
|
938
|
+
offset: getTimezoneOffset(
|
|
939
|
+
release.timezone,
|
|
940
|
+
new Date(release.scheduledAt)
|
|
941
|
+
)
|
|
858
942
|
}
|
|
859
|
-
) })
|
|
943
|
+
) }),
|
|
944
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.deleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
|
|
945
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
|
|
946
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
947
|
+
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
948
|
+
{
|
|
949
|
+
releaseId: release.id,
|
|
950
|
+
actionId: release.actions[0].id
|
|
951
|
+
}
|
|
952
|
+
)
|
|
953
|
+
] }) })
|
|
860
954
|
] })
|
|
861
955
|
]
|
|
862
956
|
},
|
|
@@ -892,9 +986,272 @@ const CMReleasesContainer = () => {
|
|
|
892
986
|
}
|
|
893
987
|
) });
|
|
894
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
|
|
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] || [];
|
|
1201
|
+
};
|
|
1202
|
+
const addColumnToTableHook = ({ displayedHeaders, layout }) => {
|
|
1203
|
+
const { contentType } = layout;
|
|
1204
|
+
if (!contentType.options?.draftAndPublish) {
|
|
1205
|
+
return { displayedHeaders, layout };
|
|
1206
|
+
}
|
|
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
|
+
] }) }) });
|
|
1250
|
+
};
|
|
895
1251
|
const admin = {
|
|
896
1252
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
897
1253
|
register(app) {
|
|
1254
|
+
app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
|
|
898
1255
|
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
899
1256
|
app.addMenuLink({
|
|
900
1257
|
to: `/plugins/${pluginId}`,
|
|
@@ -904,7 +1261,7 @@ const admin = {
|
|
|
904
1261
|
defaultMessage: "Releases"
|
|
905
1262
|
},
|
|
906
1263
|
async Component() {
|
|
907
|
-
const { App } = await Promise.resolve().then(() => require("./App-
|
|
1264
|
+
const { App } = await Promise.resolve().then(() => require("./App-HjWtUYmc.js"));
|
|
908
1265
|
return App;
|
|
909
1266
|
},
|
|
910
1267
|
permissions: PERMISSIONS.main
|
|
@@ -917,6 +1274,12 @@ const admin = {
|
|
|
917
1274
|
name: `${pluginId}-link`,
|
|
918
1275
|
Component: CMReleasesContainer
|
|
919
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);
|
|
920
1283
|
} else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
|
|
921
1284
|
app.addMenuLink({
|
|
922
1285
|
to: `/plugins/purchase-content-releases`,
|
|
@@ -926,7 +1289,7 @@ const admin = {
|
|
|
926
1289
|
defaultMessage: "Releases"
|
|
927
1290
|
},
|
|
928
1291
|
async Component() {
|
|
929
|
-
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-
|
|
1292
|
+
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-bpIYXOfu.js"));
|
|
930
1293
|
return PurchaseContentReleases;
|
|
931
1294
|
},
|
|
932
1295
|
lockIcon: true
|
|
@@ -936,7 +1299,7 @@ const admin = {
|
|
|
936
1299
|
async registerTrads({ locales }) {
|
|
937
1300
|
const importedTrads = await Promise.all(
|
|
938
1301
|
locales.map((locale) => {
|
|
939
|
-
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 }) => {
|
|
940
1303
|
return {
|
|
941
1304
|
data: helperPlugin.prefixPluginTranslations(data, "content-releases"),
|
|
942
1305
|
locale
|
|
@@ -956,6 +1319,7 @@ exports.PERMISSIONS = PERMISSIONS;
|
|
|
956
1319
|
exports.ReleaseActionMenu = ReleaseActionMenu;
|
|
957
1320
|
exports.ReleaseActionOptions = ReleaseActionOptions;
|
|
958
1321
|
exports.admin = admin;
|
|
1322
|
+
exports.getTimezoneOffset = getTimezoneOffset;
|
|
959
1323
|
exports.isAxiosError = isAxiosError;
|
|
960
1324
|
exports.pluginId = pluginId;
|
|
961
1325
|
exports.releaseApi = releaseApi;
|
|
@@ -968,4 +1332,4 @@ exports.usePublishReleaseMutation = usePublishReleaseMutation;
|
|
|
968
1332
|
exports.useTypedDispatch = useTypedDispatch;
|
|
969
1333
|
exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
|
|
970
1334
|
exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
|
|
971
|
-
//# sourceMappingURL=index-
|
|
1335
|
+
//# sourceMappingURL=index-ZNwxYN8H.js.map
|