@strapi/content-releases 0.0.0-experimental.cae3a5a17d131a6f59673b62d01cfac869ea9cc2 → 0.0.0-experimental.cf82c830d8a75c9f35466f4c6010fb588d34063f
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-iqqoPnBO.js → App-OP70yd5M.js} +696 -433
- package/dist/_chunks/App-OP70yd5M.js.map +1 -0
- package/dist/_chunks/{App-_Jj3tWts.mjs → App-x6Tjj3HN.mjs} +704 -442
- 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-2DuPv5k0.js → en-3SGjiVyR.js} +26 -7
- package/dist/_chunks/en-3SGjiVyR.js.map +1 -0
- package/dist/_chunks/{en-SOqjCdyh.mjs → en-bpHsnU0n.mjs} +26 -7
- package/dist/_chunks/en-bpHsnU0n.mjs.map +1 -0
- package/dist/_chunks/{index-bsuc8ZwZ.mjs → index-1ejXLtzt.mjs} +342 -46
- package/dist/_chunks/index-1ejXLtzt.mjs.map +1 -0
- package/dist/_chunks/{index-_lT-gI3M.js → index-ydocdaZ0.js} +329 -33
- package/dist/_chunks/index-ydocdaZ0.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/server/index.js +998 -399
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +997 -399
- package/dist/server/index.mjs.map +1 -1
- package/package.json +15 -12
- package/dist/_chunks/App-_Jj3tWts.mjs.map +0 -1
- package/dist/_chunks/App-iqqoPnBO.js.map +0 -1
- package/dist/_chunks/en-2DuPv5k0.js.map +0 -1
- package/dist/_chunks/en-SOqjCdyh.mjs.map +0 -1
- package/dist/_chunks/index-_lT-gI3M.js.map +0 -1
- package/dist/_chunks/index-bsuc8ZwZ.mjs.map +0 -1
|
@@ -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 {
|
|
@@ -311,8 +324,9 @@ const releaseApi = react.createApi({
|
|
|
311
324
|
method: "DELETE"
|
|
312
325
|
};
|
|
313
326
|
},
|
|
314
|
-
invalidatesTags: [
|
|
327
|
+
invalidatesTags: (result, error, arg) => [
|
|
315
328
|
{ type: "Release", id: "LIST" },
|
|
329
|
+
{ type: "Release", id: arg.params.releaseId },
|
|
316
330
|
{ type: "ReleaseAction", id: "LIST" }
|
|
317
331
|
]
|
|
318
332
|
}),
|
|
@@ -332,7 +346,7 @@ const releaseApi = react.createApi({
|
|
|
332
346
|
method: "DELETE"
|
|
333
347
|
};
|
|
334
348
|
},
|
|
335
|
-
invalidatesTags: (
|
|
349
|
+
invalidatesTags: () => [{ type: "Release", id: "LIST" }]
|
|
336
350
|
})
|
|
337
351
|
};
|
|
338
352
|
}
|
|
@@ -344,12 +358,29 @@ const {
|
|
|
344
358
|
useGetReleaseActionsQuery,
|
|
345
359
|
useCreateReleaseMutation,
|
|
346
360
|
useCreateReleaseActionMutation,
|
|
361
|
+
useCreateManyReleaseActionsMutation,
|
|
347
362
|
useUpdateReleaseMutation,
|
|
348
363
|
useUpdateReleaseActionMutation,
|
|
349
364
|
usePublishReleaseMutation,
|
|
350
365
|
useDeleteReleaseActionMutation,
|
|
351
366
|
useDeleteReleaseMutation
|
|
352
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
|
+
};
|
|
353
384
|
const useTypedDispatch = reactRedux.useDispatch;
|
|
354
385
|
const useTypedSelector = reactRedux.useSelector;
|
|
355
386
|
const StyledMenuItem = styled__default.default(v2.Menu.Item)`
|
|
@@ -420,7 +451,7 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
|
420
451
|
}
|
|
421
452
|
};
|
|
422
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: [
|
|
423
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Cross,
|
|
454
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Cross, width: 3, height: 3 }),
|
|
424
455
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
425
456
|
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
426
457
|
defaultMessage: "Remove from release"
|
|
@@ -459,7 +490,7 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
459
490
|
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
460
491
|
search: locale && `?plugins[i18n][locale]=${locale}`
|
|
461
492
|
},
|
|
462
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil,
|
|
493
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil, width: 3, height: 3 }),
|
|
463
494
|
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
|
|
464
495
|
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
465
496
|
defaultMessage: "Edit entry"
|
|
@@ -469,6 +500,21 @@ const ReleaseActionEntryLinkItem = ({
|
|
|
469
500
|
}
|
|
470
501
|
);
|
|
471
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
|
+
};
|
|
472
518
|
const Root = ({ children, hasTriggerBorder = false }) => {
|
|
473
519
|
const { formatMessage } = reactIntl.useIntl();
|
|
474
520
|
return (
|
|
@@ -493,6 +539,7 @@ const Root = ({ children, hasTriggerBorder = false }) => {
|
|
|
493
539
|
};
|
|
494
540
|
const ReleaseActionMenu = {
|
|
495
541
|
Root,
|
|
542
|
+
EditReleaseItem,
|
|
496
543
|
DeleteReleaseActionItem,
|
|
497
544
|
ReleaseActionEntryLinkItem
|
|
498
545
|
};
|
|
@@ -516,19 +563,40 @@ const FieldWrapper = styled__default.default(designSystem.Field)`
|
|
|
516
563
|
text-transform: capitalize;
|
|
517
564
|
}
|
|
518
565
|
|
|
519
|
-
&:active,
|
|
520
566
|
&[data-checked='true'] {
|
|
521
|
-
color: ${({ theme }) => theme.colors.primary700};
|
|
522
|
-
background-color: ${({ theme }) => theme.colors.primary100};
|
|
523
|
-
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};
|
|
524
570
|
}
|
|
525
571
|
|
|
526
572
|
&[data-checked='false'] {
|
|
527
573
|
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
528
574
|
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
529
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
|
+
}
|
|
530
592
|
`;
|
|
531
|
-
const ActionOption = ({
|
|
593
|
+
const ActionOption = ({
|
|
594
|
+
selected,
|
|
595
|
+
actionType,
|
|
596
|
+
handleChange,
|
|
597
|
+
name,
|
|
598
|
+
disabled = false
|
|
599
|
+
}) => {
|
|
532
600
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
533
601
|
FieldWrapper,
|
|
534
602
|
{
|
|
@@ -539,6 +607,7 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
539
607
|
position: "relative",
|
|
540
608
|
cursor: "pointer",
|
|
541
609
|
"data-checked": selected === actionType,
|
|
610
|
+
"data-disabled": disabled && selected !== actionType,
|
|
542
611
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.FieldLabel, { htmlFor: `${name}-${actionType}`, children: [
|
|
543
612
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
544
613
|
designSystem.FieldInput,
|
|
@@ -548,7 +617,8 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
548
617
|
name,
|
|
549
618
|
checked: selected === actionType,
|
|
550
619
|
onChange: handleChange,
|
|
551
|
-
value: actionType
|
|
620
|
+
value: actionType,
|
|
621
|
+
disabled
|
|
552
622
|
}
|
|
553
623
|
) }),
|
|
554
624
|
actionType
|
|
@@ -556,7 +626,12 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
556
626
|
}
|
|
557
627
|
);
|
|
558
628
|
};
|
|
559
|
-
const ReleaseActionOptions = ({
|
|
629
|
+
const ReleaseActionOptions = ({
|
|
630
|
+
selected,
|
|
631
|
+
handleChange,
|
|
632
|
+
name,
|
|
633
|
+
disabled = false
|
|
634
|
+
}) => {
|
|
560
635
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
|
561
636
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
562
637
|
ActionOption,
|
|
@@ -564,7 +639,8 @@ const ReleaseActionOptions = ({ selected, handleChange, name }) => {
|
|
|
564
639
|
actionType: "publish",
|
|
565
640
|
selected,
|
|
566
641
|
handleChange,
|
|
567
|
-
name
|
|
642
|
+
name,
|
|
643
|
+
disabled
|
|
568
644
|
}
|
|
569
645
|
),
|
|
570
646
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -573,7 +649,8 @@ const ReleaseActionOptions = ({ selected, handleChange, name }) => {
|
|
|
573
649
|
actionType: "unpublish",
|
|
574
650
|
selected,
|
|
575
651
|
handleChange,
|
|
576
|
-
name
|
|
652
|
+
name,
|
|
653
|
+
disabled
|
|
577
654
|
}
|
|
578
655
|
)
|
|
579
656
|
] });
|
|
@@ -617,6 +694,7 @@ const AddActionToReleaseModal = ({
|
|
|
617
694
|
contentTypeUid,
|
|
618
695
|
entryId
|
|
619
696
|
}) => {
|
|
697
|
+
const releaseHeaderId = React__namespace.useId();
|
|
620
698
|
const { formatMessage } = reactIntl.useIntl();
|
|
621
699
|
const toggleNotification = helperPlugin.useNotification();
|
|
622
700
|
const { formatAPIError } = helperPlugin.useAPIErrorHandler();
|
|
@@ -664,8 +742,8 @@ const AddActionToReleaseModal = ({
|
|
|
664
742
|
}
|
|
665
743
|
}
|
|
666
744
|
};
|
|
667
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { onClose: handleClose, labelledBy:
|
|
668
|
-
/* @__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({
|
|
669
747
|
id: "content-releases.content-manager-edit-view.add-to-release",
|
|
670
748
|
defaultMessage: "Add to release"
|
|
671
749
|
}) }) }),
|
|
@@ -735,16 +813,18 @@ const AddActionToReleaseModal = ({
|
|
|
735
813
|
};
|
|
736
814
|
const CMReleasesContainer = () => {
|
|
737
815
|
const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
|
|
738
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
816
|
+
const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
|
|
739
817
|
const {
|
|
740
818
|
isCreatingEntry,
|
|
741
|
-
|
|
819
|
+
hasDraftAndPublish,
|
|
820
|
+
initialData: { id: entryId },
|
|
821
|
+
slug
|
|
742
822
|
} = helperPlugin.useCMEditViewDataManager();
|
|
743
|
-
const
|
|
744
|
-
const canFetch =
|
|
823
|
+
const contentTypeUid = slug;
|
|
824
|
+
const canFetch = entryId != null && contentTypeUid != null;
|
|
745
825
|
const fetchParams = canFetch ? {
|
|
746
|
-
contentTypeUid
|
|
747
|
-
entryId
|
|
826
|
+
contentTypeUid,
|
|
827
|
+
entryId,
|
|
748
828
|
hasEntryAttached: true
|
|
749
829
|
} : query.skipToken;
|
|
750
830
|
const response = useGetReleasesForEntryQuery(fetchParams);
|
|
@@ -752,7 +832,7 @@ const CMReleasesContainer = () => {
|
|
|
752
832
|
if (!canFetch) {
|
|
753
833
|
return null;
|
|
754
834
|
}
|
|
755
|
-
if (isCreatingEntry || !
|
|
835
|
+
if (isCreatingEntry || !hasDraftAndPublish) {
|
|
756
836
|
return null;
|
|
757
837
|
}
|
|
758
838
|
const toggleModal = () => setIsModalOpen((prev) => !prev);
|
|
@@ -819,15 +899,40 @@ const CMReleasesContainer = () => {
|
|
|
819
899
|
)
|
|
820
900
|
}
|
|
821
901
|
),
|
|
822
|
-
/* @__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: [
|
|
823
903
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
824
|
-
|
|
825
|
-
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
904
|
+
release.scheduledAt && release.timezone && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
826
905
|
{
|
|
827
|
-
|
|
828
|
-
|
|
906
|
+
id: "content-releases.content-manager-edit-view.scheduled.date",
|
|
907
|
+
defaultMessage: "{date} at {time} ({offset})"
|
|
908
|
+
},
|
|
909
|
+
{
|
|
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
|
+
)
|
|
829
924
|
}
|
|
830
|
-
) })
|
|
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
|
+
] }) })
|
|
831
936
|
] })
|
|
832
937
|
]
|
|
833
938
|
},
|
|
@@ -855,14 +960,185 @@ const CMReleasesContainer = () => {
|
|
|
855
960
|
AddActionToReleaseModal,
|
|
856
961
|
{
|
|
857
962
|
handleClose: toggleModal,
|
|
858
|
-
contentTypeUid
|
|
859
|
-
entryId
|
|
963
|
+
contentTypeUid,
|
|
964
|
+
entryId
|
|
860
965
|
}
|
|
861
966
|
)
|
|
862
967
|
]
|
|
863
968
|
}
|
|
864
969
|
) });
|
|
865
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
|
+
};
|
|
866
1142
|
const admin = {
|
|
867
1143
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
868
1144
|
register(app) {
|
|
@@ -875,7 +1151,7 @@ const admin = {
|
|
|
875
1151
|
defaultMessage: "Releases"
|
|
876
1152
|
},
|
|
877
1153
|
async Component() {
|
|
878
|
-
const { App } = await Promise.resolve().then(() => require("./App-
|
|
1154
|
+
const { App } = await Promise.resolve().then(() => require("./App-OP70yd5M.js"));
|
|
879
1155
|
return App;
|
|
880
1156
|
},
|
|
881
1157
|
permissions: PERMISSIONS.main
|
|
@@ -888,12 +1164,31 @@ const admin = {
|
|
|
888
1164
|
name: `${pluginId}-link`,
|
|
889
1165
|
Component: CMReleasesContainer
|
|
890
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
|
+
});
|
|
891
1186
|
}
|
|
892
1187
|
},
|
|
893
1188
|
async registerTrads({ locales }) {
|
|
894
1189
|
const importedTrads = await Promise.all(
|
|
895
1190
|
locales.map((locale) => {
|
|
896
|
-
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 }) => {
|
|
897
1192
|
return {
|
|
898
1193
|
data: helperPlugin.prefixPluginTranslations(data, "content-releases"),
|
|
899
1194
|
locale
|
|
@@ -913,6 +1208,7 @@ exports.PERMISSIONS = PERMISSIONS;
|
|
|
913
1208
|
exports.ReleaseActionMenu = ReleaseActionMenu;
|
|
914
1209
|
exports.ReleaseActionOptions = ReleaseActionOptions;
|
|
915
1210
|
exports.admin = admin;
|
|
1211
|
+
exports.getTimezoneOffset = getTimezoneOffset;
|
|
916
1212
|
exports.isAxiosError = isAxiosError;
|
|
917
1213
|
exports.pluginId = pluginId;
|
|
918
1214
|
exports.releaseApi = releaseApi;
|
|
@@ -925,4 +1221,4 @@ exports.usePublishReleaseMutation = usePublishReleaseMutation;
|
|
|
925
1221
|
exports.useTypedDispatch = useTypedDispatch;
|
|
926
1222
|
exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
|
|
927
1223
|
exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
|
|
928
|
-
//# sourceMappingURL=index-
|
|
1224
|
+
//# sourceMappingURL=index-ydocdaZ0.js.map
|