@strapi/content-releases 0.0.0-experimental.b5b7b8260a4549f3bd7443fbd68be5ccc9857cd7 → 0.0.0-experimental.c5354c231bf2abb4fe353d2ab7812bced4a1c6fa
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-AYV8n9jv.js → App-OP70yd5M.js} +784 -435
- package/dist/_chunks/App-OP70yd5M.js.map +1 -0
- package/dist/_chunks/App-x6Tjj3HN.mjs +1315 -0
- package/dist/_chunks/App-x6Tjj3HN.mjs.map +1 -0
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs +51 -0
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +1 -0
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js +51 -0
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +1 -0
- package/dist/_chunks/{en-gYDqKYFd.js → en-3SGjiVyR.js} +29 -7
- package/dist/_chunks/en-3SGjiVyR.js.map +1 -0
- package/dist/_chunks/{en-MyLPoISH.mjs → en-bpHsnU0n.mjs} +29 -7
- package/dist/_chunks/en-bpHsnU0n.mjs.map +1 -0
- package/dist/_chunks/{index-NFIckO1N.mjs → index-1ejXLtzt.mjs} +367 -48
- package/dist/_chunks/index-1ejXLtzt.mjs.map +1 -0
- package/dist/_chunks/{index-FYDbIuRi.js → index-ydocdaZ0.js} +355 -36
- package/dist/_chunks/index-ydocdaZ0.js.map +1 -0
- package/dist/admin/index.js +2 -2
- package/dist/admin/index.mjs +3 -3
- package/dist/server/index.js +1059 -377
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +1060 -379
- package/dist/server/index.mjs.map +1 -1
- package/package.json +16 -11
- package/dist/_chunks/App-AYV8n9jv.js.map +0 -1
- package/dist/_chunks/App-KBaxZVmD.mjs +0 -967
- package/dist/_chunks/App-KBaxZVmD.mjs.map +0 -1
- package/dist/_chunks/en-MyLPoISH.mjs.map +0 -1
- package/dist/_chunks/en-gYDqKYFd.js.map +0 -1
- package/dist/_chunks/index-FYDbIuRi.js.map +0 -1
- package/dist/_chunks/index-NFIckO1N.mjs.map +0 -1
|
@@ -12,8 +12,8 @@ const reactIntl = require("react-intl");
|
|
|
12
12
|
const reactRouterDom = require("react-router-dom");
|
|
13
13
|
const yup = require("yup");
|
|
14
14
|
const react = require("@reduxjs/toolkit/query/react");
|
|
15
|
-
const reactRedux = require("react-redux");
|
|
16
15
|
const styled = require("styled-components");
|
|
16
|
+
const reactRedux = require("react-redux");
|
|
17
17
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
18
18
|
function _interopNamespace(e) {
|
|
19
19
|
if (e && e.__esModule)
|
|
@@ -274,6 +274,19 @@ 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
|
+
]
|
|
289
|
+
}),
|
|
277
290
|
updateReleaseAction: build.mutation({
|
|
278
291
|
query({ body, params }) {
|
|
279
292
|
return {
|
|
@@ -282,7 +295,27 @@ const releaseApi = react.createApi({
|
|
|
282
295
|
data: body
|
|
283
296
|
};
|
|
284
297
|
},
|
|
285
|
-
invalidatesTags: () => [{ type: "ReleaseAction", id: "LIST" }]
|
|
298
|
+
invalidatesTags: () => [{ type: "ReleaseAction", id: "LIST" }],
|
|
299
|
+
async onQueryStarted({ body, params, query: query2, actionPath }, { dispatch, queryFulfilled }) {
|
|
300
|
+
const paramsWithoutActionId = {
|
|
301
|
+
releaseId: params.releaseId,
|
|
302
|
+
...query2
|
|
303
|
+
};
|
|
304
|
+
const patchResult = dispatch(
|
|
305
|
+
releaseApi.util.updateQueryData("getReleaseActions", paramsWithoutActionId, (draft) => {
|
|
306
|
+
const [key, index] = actionPath;
|
|
307
|
+
const action = draft.data[key][index];
|
|
308
|
+
if (action) {
|
|
309
|
+
action.type = body.type;
|
|
310
|
+
}
|
|
311
|
+
})
|
|
312
|
+
);
|
|
313
|
+
try {
|
|
314
|
+
await queryFulfilled;
|
|
315
|
+
} catch {
|
|
316
|
+
patchResult.undo();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
286
319
|
}),
|
|
287
320
|
deleteReleaseAction: build.mutation({
|
|
288
321
|
query({ params }) {
|
|
@@ -291,8 +324,9 @@ const releaseApi = react.createApi({
|
|
|
291
324
|
method: "DELETE"
|
|
292
325
|
};
|
|
293
326
|
},
|
|
294
|
-
invalidatesTags: [
|
|
327
|
+
invalidatesTags: (result, error, arg) => [
|
|
295
328
|
{ type: "Release", id: "LIST" },
|
|
329
|
+
{ type: "Release", id: arg.params.releaseId },
|
|
296
330
|
{ type: "ReleaseAction", id: "LIST" }
|
|
297
331
|
]
|
|
298
332
|
}),
|
|
@@ -312,7 +346,7 @@ const releaseApi = react.createApi({
|
|
|
312
346
|
method: "DELETE"
|
|
313
347
|
};
|
|
314
348
|
},
|
|
315
|
-
invalidatesTags: (
|
|
349
|
+
invalidatesTags: () => [{ type: "Release", id: "LIST" }]
|
|
316
350
|
})
|
|
317
351
|
};
|
|
318
352
|
}
|
|
@@ -324,12 +358,30 @@ const {
|
|
|
324
358
|
useGetReleaseActionsQuery,
|
|
325
359
|
useCreateReleaseMutation,
|
|
326
360
|
useCreateReleaseActionMutation,
|
|
361
|
+
useCreateManyReleaseActionsMutation,
|
|
327
362
|
useUpdateReleaseMutation,
|
|
328
363
|
useUpdateReleaseActionMutation,
|
|
329
364
|
usePublishReleaseMutation,
|
|
330
365
|
useDeleteReleaseActionMutation,
|
|
331
366
|
useDeleteReleaseMutation
|
|
332
367
|
} = releaseApi;
|
|
368
|
+
const getTimezoneOffset = (timezone, date) => {
|
|
369
|
+
try {
|
|
370
|
+
const offsetPart = new Intl.DateTimeFormat("en", {
|
|
371
|
+
timeZone: timezone,
|
|
372
|
+
timeZoneName: "longOffset"
|
|
373
|
+
}).formatToParts(date).find((part) => part.type === "timeZoneName");
|
|
374
|
+
const offset = offsetPart ? offsetPart.value : "";
|
|
375
|
+
let utcOffset = offset.replace("GMT", "UTC");
|
|
376
|
+
if (!utcOffset.includes("+") && !utcOffset.includes("-")) {
|
|
377
|
+
utcOffset = `${utcOffset}+00:00`;
|
|
378
|
+
}
|
|
379
|
+
return utcOffset;
|
|
380
|
+
} catch (error) {
|
|
381
|
+
return "";
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
const useTypedDispatch = reactRedux.useDispatch;
|
|
333
385
|
const useTypedSelector = reactRedux.useSelector;
|
|
334
386
|
const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
335
387
|
&:hover {
|
|
@@ -399,7 +451,7 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
399
451
|
}
|
|
400
452
|
};
|
|
401
453
|
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: [
|
|
402
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Cross,
|
|
454
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Cross, width: 3, height: 3 }),
|
|
403
455
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
404
456
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
405
457
|
defaultMessage: "Remove from release"
|
|
@@ -438,7 +490,7 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
438
490
|
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
439
491
|
search: locale && `?plugins[i18n][locale]=${locale}`
|
|
440
492
|
},
|
|
441
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil,
|
|
493
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil, width: 3, height: 3 }),
|
|
442
494
|
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
443
495
|
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
444
496
|
defaultMessage: "Edit entry"
|
|
@@ -448,6 +500,21 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
448
500
|
}
|
|
449
501
|
);
|
|
450
502
|
};
|
|
503
|
+
const EditReleaseItem = ({ releaseId }) => {
|
|
504
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
505
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
506
|
+
v2.Link,
|
|
507
|
+
{
|
|
508
|
+
href: `/admin/plugins/content-releases/${releaseId}`,
|
|
509
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil, width: 3, height: 3 }),
|
|
510
|
+
isExternal: false,
|
|
511
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
512
|
+
id: "content-releases.content-manager-edit-view.edit-release",
|
|
513
|
+
defaultMessage: "Edit release"
|
|
514
|
+
}) })
|
|
515
|
+
}
|
|
516
|
+
) });
|
|
517
|
+
};
|
|
451
518
|
const Root = ({ children, hasTriggerBorder = false }) => {
|
|
452
519
|
const { formatMessage } = reactIntl.useIntl();
|
|
453
520
|
return (
|
|
@@ -472,6 +539,7 @@ const Root = ({ children, hasTriggerBorder = false }) => {
|
|
|
472
539
|
};
|
|
473
540
|
const ReleaseActionMenu = {
|
|
474
541
|
Root,
|
|
542
|
+
EditReleaseItem,
|
|
475
543
|
DeleteReleaseActionItem,
|
|
476
544
|
ReleaseActionEntryLinkItem
|
|
477
545
|
};
|
|
@@ -495,19 +563,40 @@ const FieldWrapper = styled__default.default(designSystem.Field)`
|
|
|
495
563
|
text-transform: capitalize;
|
|
496
564
|
}
|
|
497
565
|
|
|
498
|
-
&:active,
|
|
499
566
|
&[data-checked='true'] {
|
|
500
|
-
color: ${({ theme }) => theme.colors.primary700};
|
|
501
|
-
background-color: ${({ theme }) => theme.colors.primary100};
|
|
502
|
-
border-color: ${({ theme }) => theme.colors.primary700};
|
|
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};
|
|
503
570
|
}
|
|
504
571
|
|
|
505
572
|
&[data-checked='false'] {
|
|
506
573
|
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
507
574
|
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
508
575
|
}
|
|
576
|
+
|
|
577
|
+
&[data-checked='false'][data-disabled='false']:hover {
|
|
578
|
+
color: ${({ theme }) => theme.colors.neutral700};
|
|
579
|
+
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
580
|
+
border-color: ${({ theme }) => theme.colors.neutral200};
|
|
581
|
+
|
|
582
|
+
& > label {
|
|
583
|
+
cursor: pointer;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
&[data-disabled='true'] {
|
|
588
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
|
589
|
+
background-color: ${({ theme }) => theme.colors.neutral150};
|
|
590
|
+
border-color: ${({ theme }) => theme.colors.neutral300};
|
|
591
|
+
}
|
|
509
592
|
`;
|
|
510
|
-
const ActionOption = ({
|
|
593
|
+
const ActionOption = ({
|
|
594
|
+
selected,
|
|
595
|
+
actionType,
|
|
596
|
+
handleChange,
|
|
597
|
+
name,
|
|
598
|
+
disabled = false
|
|
599
|
+
}) => {
|
|
511
600
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
512
601
|
FieldWrapper,
|
|
513
602
|
{
|
|
@@ -518,6 +607,7 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
518
607
|
position: "relative",
|
|
519
608
|
cursor: "pointer",
|
|
520
609
|
"data-checked": selected === actionType,
|
|
610
|
+
"data-disabled": disabled && selected !== actionType,
|
|
521
611
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.FieldLabel, { htmlFor: `${name}-${actionType}`, children: [
|
|
522
612
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
523
613
|
designSystem.FieldInput,
|
|
@@ -527,7 +617,8 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
527
617
|
name,
|
|
528
618
|
checked: selected === actionType,
|
|
529
619
|
onChange: handleChange,
|
|
530
|
-
value: actionType
|
|
620
|
+
value: actionType,
|
|
621
|
+
disabled
|
|
531
622
|
}
|
|
532
623
|
) }),
|
|
533
624
|
actionType
|
|
@@ -535,7 +626,12 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
535
626
|
}
|
|
536
627
|
);
|
|
537
628
|
};
|
|
538
|
-
const ReleaseActionOptions = ({
|
|
629
|
+
const ReleaseActionOptions = ({
|
|
630
|
+
selected,
|
|
631
|
+
handleChange,
|
|
632
|
+
name,
|
|
633
|
+
disabled = false
|
|
634
|
+
}) => {
|
|
539
635
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
|
540
636
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
541
637
|
ActionOption,
|
|
@@ -543,7 +639,8 @@ const ReleaseActionOptions = ({ selected, handleChange, name }) => {
|
|
|
543
639
|
actionType: "publish",
|
|
544
640
|
selected,
|
|
545
641
|
handleChange,
|
|
546
|
-
name
|
|
642
|
+
name,
|
|
643
|
+
disabled
|
|
547
644
|
}
|
|
548
645
|
),
|
|
549
646
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -552,7 +649,8 @@ const ReleaseActionOptions = ({ selected, handleChange, name }) => {
|
|
|
552
649
|
actionType: "unpublish",
|
|
553
650
|
selected,
|
|
554
651
|
handleChange,
|
|
555
|
-
name
|
|
652
|
+
name,
|
|
653
|
+
disabled
|
|
556
654
|
}
|
|
557
655
|
)
|
|
558
656
|
] });
|
|
@@ -596,6 +694,7 @@ const AddActionToReleaseModal = ({
|
|
|
596
694
|
contentTypeUid,
|
|
597
695
|
entryId
|
|
598
696
|
}) => {
|
|
697
|
+
const releaseHeaderId = React__namespace.useId();
|
|
599
698
|
const { formatMessage } = reactIntl.useIntl();
|
|
600
699
|
const toggleNotification = helperPlugin.useNotification();
|
|
601
700
|
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
@@ -643,8 +742,8 @@ const AddActionToReleaseModal = ({
|
|
|
643
742
|
}
|
|
644
743
|
}
|
|
645
744
|
};
|
|
646
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { onClose: handleClose, labelledBy:
|
|
647
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id:
|
|
745
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { onClose: handleClose, labelledBy: releaseHeaderId, children: [
|
|
746
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: releaseHeaderId, fontWeight: "bold", textColor: "neutral800", children: formatMessage({
|
|
648
747
|
id: "content-releases.content-manager-edit-view.add-to-release",
|
|
649
748
|
defaultMessage: "Add to release"
|
|
650
749
|
}) }) }),
|
|
@@ -714,16 +813,18 @@ const AddActionToReleaseModal = ({
|
|
|
714
813
|
};
|
|
715
814
|
const CMReleasesContainer = () => {
|
|
716
815
|
const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
|
|
717
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
816
|
+
const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
|
|
718
817
|
const {
|
|
719
818
|
isCreatingEntry,
|
|
720
|
-
|
|
819
|
+
hasDraftAndPublish,
|
|
820
|
+
initialData: { id: entryId },
|
|
821
|
+
slug
|
|
721
822
|
} = helperPlugin.useCMEditViewDataManager();
|
|
722
|
-
const
|
|
723
|
-
const canFetch =
|
|
823
|
+
const contentTypeUid = slug;
|
|
824
|
+
const canFetch = entryId != null && contentTypeUid != null;
|
|
724
825
|
const fetchParams = canFetch ? {
|
|
725
|
-
contentTypeUid
|
|
726
|
-
entryId
|
|
826
|
+
contentTypeUid,
|
|
827
|
+
entryId,
|
|
727
828
|
hasEntryAttached: true
|
|
728
829
|
} : query.skipToken;
|
|
729
830
|
const response = useGetReleasesForEntryQuery(fetchParams);
|
|
@@ -731,7 +832,7 @@ const CMReleasesContainer = () => {
|
|
|
731
832
|
if (!canFetch) {
|
|
732
833
|
return null;
|
|
733
834
|
}
|
|
734
|
-
if (isCreatingEntry || !
|
|
835
|
+
if (isCreatingEntry || !hasDraftAndPublish) {
|
|
735
836
|
return null;
|
|
736
837
|
}
|
|
737
838
|
const toggleModal = () => setIsModalOpen((prev) => !prev);
|
|
@@ -798,15 +899,40 @@ const CMReleasesContainer = () => {
|
|
|
798
899
|
)
|
|
799
900
|
}
|
|
800
901
|
),
|
|
801
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap:
|
|
902
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
802
903
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
803
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
804
|
-
|
|
904
|
+
release.scheduledAt && release.timezone && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
905
|
+
{
|
|
906
|
+
id: "content-releases.content-manager-edit-view.scheduled.date",
|
|
907
|
+
defaultMessage: "{date} at {time} ({offset})"
|
|
908
|
+
},
|
|
805
909
|
{
|
|
806
|
-
|
|
807
|
-
|
|
910
|
+
date: formatDate(new Date(release.scheduledAt), {
|
|
911
|
+
day: "2-digit",
|
|
912
|
+
month: "2-digit",
|
|
913
|
+
year: "numeric",
|
|
914
|
+
timeZone: release.timezone
|
|
915
|
+
}),
|
|
916
|
+
time: formatTime(new Date(release.scheduledAt), {
|
|
917
|
+
hourCycle: "h23",
|
|
918
|
+
timeZone: release.timezone
|
|
919
|
+
}),
|
|
920
|
+
offset: getTimezoneOffset(
|
|
921
|
+
release.timezone,
|
|
922
|
+
new Date(release.scheduledAt)
|
|
923
|
+
)
|
|
808
924
|
}
|
|
809
|
-
) })
|
|
925
|
+
) }),
|
|
926
|
+
/* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.deleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
|
|
927
|
+
/* @__PURE__ */ jsxRuntime.jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
|
|
928
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
929
|
+
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
930
|
+
{
|
|
931
|
+
releaseId: release.id,
|
|
932
|
+
actionId: release.action.id
|
|
933
|
+
}
|
|
934
|
+
)
|
|
935
|
+
] }) })
|
|
810
936
|
] })
|
|
811
937
|
]
|
|
812
938
|
},
|
|
@@ -834,18 +960,189 @@ const CMReleasesContainer = () => {
|
|
|
834
960
|
AddActionToReleaseModal,
|
|
835
961
|
{
|
|
836
962
|
handleClose: toggleModal,
|
|
837
|
-
contentTypeUid
|
|
838
|
-
entryId
|
|
963
|
+
contentTypeUid,
|
|
964
|
+
entryId
|
|
839
965
|
}
|
|
840
966
|
)
|
|
841
967
|
]
|
|
842
968
|
}
|
|
843
969
|
) });
|
|
844
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;
|
|
985
|
+
};
|
|
986
|
+
const ReleaseAction = ({ ids, model }) => {
|
|
987
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
988
|
+
const toggleNotification = helperPlugin.useNotification();
|
|
989
|
+
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
990
|
+
const { modifiedData } = helperPlugin.useCMEditViewDataManager();
|
|
991
|
+
const contentPermissions = getContentPermissions(model);
|
|
992
|
+
const {
|
|
993
|
+
allowedActions: { canPublish }
|
|
994
|
+
} = helperPlugin.useRBAC(contentPermissions);
|
|
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
|
+
};
|
|
1141
|
+
};
|
|
845
1142
|
const admin = {
|
|
846
1143
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
847
1144
|
register(app) {
|
|
848
|
-
if (window.strapi.features.isEnabled("cms-content-releases")
|
|
1145
|
+
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
849
1146
|
app.addMenuLink({
|
|
850
1147
|
to: `/plugins/${pluginId}`,
|
|
851
1148
|
icon: icons.PaperPlane,
|
|
@@ -854,7 +1151,7 @@ const admin = {
|
|
|
854
1151
|
defaultMessage: "Releases"
|
|
855
1152
|
},
|
|
856
1153
|
async Component() {
|
|
857
|
-
const { App } = await Promise.resolve().then(() => require("./App-
|
|
1154
|
+
const { App } = await Promise.resolve().then(() => require("./App-OP70yd5M.js"));
|
|
858
1155
|
return App;
|
|
859
1156
|
},
|
|
860
1157
|
permissions: PERMISSIONS.main
|
|
@@ -867,12 +1164,31 @@ const admin = {
|
|
|
867
1164
|
name: `${pluginId}-link`,
|
|
868
1165
|
Component: CMReleasesContainer
|
|
869
1166
|
});
|
|
1167
|
+
app.plugins["content-manager"].apis.addBulkAction((actions) => {
|
|
1168
|
+
const deleteActionIndex = actions.findIndex((action) => action.name === "DeleteAction");
|
|
1169
|
+
actions.splice(deleteActionIndex, 0, ReleaseAction);
|
|
1170
|
+
return actions;
|
|
1171
|
+
});
|
|
1172
|
+
} else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
|
|
1173
|
+
app.addMenuLink({
|
|
1174
|
+
to: `/plugins/purchase-content-releases`,
|
|
1175
|
+
icon: icons.PaperPlane,
|
|
1176
|
+
intlLabel: {
|
|
1177
|
+
id: `${pluginId}.plugin.name`,
|
|
1178
|
+
defaultMessage: "Releases"
|
|
1179
|
+
},
|
|
1180
|
+
async Component() {
|
|
1181
|
+
const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-bpIYXOfu.js"));
|
|
1182
|
+
return PurchaseContentReleases;
|
|
1183
|
+
},
|
|
1184
|
+
lockIcon: true
|
|
1185
|
+
});
|
|
870
1186
|
}
|
|
871
1187
|
},
|
|
872
1188
|
async registerTrads({ locales }) {
|
|
873
1189
|
const importedTrads = await Promise.all(
|
|
874
1190
|
locales.map((locale) => {
|
|
875
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
|
1191
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-3SGjiVyR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
876
1192
|
return {
|
|
877
1193
|
data: helperPlugin.prefixPluginTranslations(data, "content-releases"),
|
|
878
1194
|
locale
|
|
@@ -892,14 +1208,17 @@ exports.PERMISSIONS = PERMISSIONS;
|
|
|
892
1208
|
exports.ReleaseActionMenu = ReleaseActionMenu;
|
|
893
1209
|
exports.ReleaseActionOptions = ReleaseActionOptions;
|
|
894
1210
|
exports.admin = admin;
|
|
1211
|
+
exports.getTimezoneOffset = getTimezoneOffset;
|
|
895
1212
|
exports.isAxiosError = isAxiosError;
|
|
896
1213
|
exports.pluginId = pluginId;
|
|
1214
|
+
exports.releaseApi = releaseApi;
|
|
897
1215
|
exports.useCreateReleaseMutation = useCreateReleaseMutation;
|
|
898
1216
|
exports.useDeleteReleaseMutation = useDeleteReleaseMutation;
|
|
899
1217
|
exports.useGetReleaseActionsQuery = useGetReleaseActionsQuery;
|
|
900
1218
|
exports.useGetReleaseQuery = useGetReleaseQuery;
|
|
901
1219
|
exports.useGetReleasesQuery = useGetReleasesQuery;
|
|
902
1220
|
exports.usePublishReleaseMutation = usePublishReleaseMutation;
|
|
1221
|
+
exports.useTypedDispatch = useTypedDispatch;
|
|
903
1222
|
exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
|
|
904
1223
|
exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
|
|
905
|
-
//# sourceMappingURL=index-
|
|
1224
|
+
//# sourceMappingURL=index-ydocdaZ0.js.map
|