@strapi/content-releases 0.0.0-next.09b9d36b22a205d90c9303f2e37134938cf76c90 → 0.0.0-next.0a8a7f1e0ee2fb410eeffb9eb1943d28f1f24705
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-HVXzE3i3.mjs +1313 -0
- package/dist/_chunks/App-HVXzE3i3.mjs.map +1 -0
- package/dist/_chunks/{App-8384e404.js → App-l62gIUTX.js} +790 -421
- package/dist/_chunks/App-l62gIUTX.js.map +1 -0
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs +51 -0
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +1 -0
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js +51 -0
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +1 -0
- package/dist/_chunks/{en-142f336a.mjs → en-RdapH-9X.mjs} +22 -7
- package/dist/_chunks/en-RdapH-9X.mjs.map +1 -0
- package/dist/_chunks/{en-f235921e.js → en-faJDuv3q.js} +22 -7
- package/dist/_chunks/en-faJDuv3q.js.map +1 -0
- package/dist/_chunks/{index-7250b0a5.js → index-ML_b3php.js} +248 -48
- package/dist/_chunks/index-ML_b3php.js.map +1 -0
- package/dist/_chunks/{index-e14e1ea9.mjs → index-Ys87ROOe.mjs} +263 -63
- package/dist/_chunks/index-Ys87ROOe.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +3 -2
- package/dist/admin/index.mjs.map +1 -1
- package/dist/server/index.js +1130 -299
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +1129 -300
- package/dist/server/index.mjs.map +1 -1
- package/package.json +15 -11
- package/dist/_chunks/App-8384e404.js.map +0 -1
- package/dist/_chunks/App-c3fca40f.mjs +0 -945
- package/dist/_chunks/App-c3fca40f.mjs.map +0 -1
- package/dist/_chunks/en-142f336a.mjs.map +0 -1
- package/dist/_chunks/en-f235921e.js.map +0 -1
- package/dist/_chunks/index-7250b0a5.js.map +0 -1
- package/dist/_chunks/index-e14e1ea9.mjs.map +0 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { getFetchClient, useNotification, useAPIErrorHandler, CheckPermissions, useCMEditViewDataManager, NoContent, prefixPluginTranslations } from "@strapi/helper-plugin";
|
|
2
|
-
import { Cross, More, Plus, PaperPlane } from "@strapi/icons";
|
|
2
|
+
import { Cross, Pencil, More, Plus, PaperPlane } from "@strapi/icons";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { skipToken } from "@reduxjs/toolkit/query";
|
|
6
|
-
import { IconButton, Flex, Typography, Field, FieldLabel, VisuallyHidden, FieldInput, Box, Button, ModalLayout, ModalHeader, ModalBody, SingleSelect, SingleSelectOption, ModalFooter } from "@strapi/design-system";
|
|
7
|
-
import { Menu, LinkButton } from "@strapi/design-system/v2";
|
|
6
|
+
import { IconButton, Flex, Icon, Typography, Field, FieldLabel, VisuallyHidden, FieldInput, Box, Button, ModalLayout, ModalHeader, ModalBody, SingleSelect, SingleSelectOption, ModalFooter } from "@strapi/design-system";
|
|
7
|
+
import { Menu, Link, LinkButton } from "@strapi/design-system/v2";
|
|
8
8
|
import { isAxiosError as isAxiosError$1 } from "axios";
|
|
9
9
|
import { Formik, Form } from "formik";
|
|
10
10
|
import { useIntl } from "react-intl";
|
|
11
|
-
import {
|
|
11
|
+
import { NavLink, Link as Link$1 } from "react-router-dom";
|
|
12
12
|
import * as yup from "yup";
|
|
13
13
|
import { createApi } from "@reduxjs/toolkit/query/react";
|
|
14
14
|
import styled from "styled-components";
|
|
15
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
15
16
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
|
16
17
|
const v = glob[path];
|
|
17
18
|
if (v) {
|
|
@@ -258,7 +259,27 @@ const releaseApi = createApi({
|
|
|
258
259
|
data: body
|
|
259
260
|
};
|
|
260
261
|
},
|
|
261
|
-
invalidatesTags: () => [{ type: "ReleaseAction", id: "LIST" }]
|
|
262
|
+
invalidatesTags: () => [{ type: "ReleaseAction", id: "LIST" }],
|
|
263
|
+
async onQueryStarted({ body, params, query, actionPath }, { dispatch, queryFulfilled }) {
|
|
264
|
+
const paramsWithoutActionId = {
|
|
265
|
+
releaseId: params.releaseId,
|
|
266
|
+
...query
|
|
267
|
+
};
|
|
268
|
+
const patchResult = dispatch(
|
|
269
|
+
releaseApi.util.updateQueryData("getReleaseActions", paramsWithoutActionId, (draft) => {
|
|
270
|
+
const [key, index] = actionPath;
|
|
271
|
+
const action = draft.data[key][index];
|
|
272
|
+
if (action) {
|
|
273
|
+
action.type = body.type;
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
);
|
|
277
|
+
try {
|
|
278
|
+
await queryFulfilled;
|
|
279
|
+
} catch {
|
|
280
|
+
patchResult.undo();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
262
283
|
}),
|
|
263
284
|
deleteReleaseAction: build.mutation({
|
|
264
285
|
query({ params }) {
|
|
@@ -267,8 +288,9 @@ const releaseApi = createApi({
|
|
|
267
288
|
method: "DELETE"
|
|
268
289
|
};
|
|
269
290
|
},
|
|
270
|
-
invalidatesTags: [
|
|
291
|
+
invalidatesTags: (result, error, arg) => [
|
|
271
292
|
{ type: "Release", id: "LIST" },
|
|
293
|
+
{ type: "Release", id: arg.params.releaseId },
|
|
272
294
|
{ type: "ReleaseAction", id: "LIST" }
|
|
273
295
|
]
|
|
274
296
|
}),
|
|
@@ -288,7 +310,7 @@ const releaseApi = createApi({
|
|
|
288
310
|
method: "DELETE"
|
|
289
311
|
};
|
|
290
312
|
},
|
|
291
|
-
invalidatesTags: (
|
|
313
|
+
invalidatesTags: () => [{ type: "Release", id: "LIST" }]
|
|
292
314
|
})
|
|
293
315
|
};
|
|
294
316
|
}
|
|
@@ -306,29 +328,59 @@ const {
|
|
|
306
328
|
useDeleteReleaseActionMutation,
|
|
307
329
|
useDeleteReleaseMutation
|
|
308
330
|
} = releaseApi;
|
|
331
|
+
const getTimezoneOffset = (timezone, date) => {
|
|
332
|
+
try {
|
|
333
|
+
const offsetPart = new Intl.DateTimeFormat("en", {
|
|
334
|
+
timeZone: timezone,
|
|
335
|
+
timeZoneName: "longOffset"
|
|
336
|
+
}).formatToParts(date).find((part) => part.type === "timeZoneName");
|
|
337
|
+
const offset = offsetPart ? offsetPart.value : "";
|
|
338
|
+
let utcOffset = offset.replace("GMT", "UTC");
|
|
339
|
+
if (!utcOffset.includes("+") && !utcOffset.includes("-")) {
|
|
340
|
+
utcOffset = `${utcOffset}+00:00`;
|
|
341
|
+
}
|
|
342
|
+
return utcOffset;
|
|
343
|
+
} catch (error) {
|
|
344
|
+
return "";
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
const useTypedDispatch = useDispatch;
|
|
348
|
+
const useTypedSelector = useSelector;
|
|
309
349
|
const StyledMenuItem = styled(Menu.Item)`
|
|
310
350
|
&:hover {
|
|
311
|
-
background: ${({ theme }) => theme.colors
|
|
351
|
+
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
352
|
+
|
|
353
|
+
svg {
|
|
354
|
+
path {
|
|
355
|
+
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
a {
|
|
360
|
+
color: ${({ theme }) => theme.colors.neutral800};
|
|
361
|
+
}
|
|
312
362
|
}
|
|
313
363
|
|
|
314
364
|
svg {
|
|
315
365
|
path {
|
|
316
|
-
fill: ${({ theme }) => theme.colors
|
|
366
|
+
fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
|
|
317
367
|
}
|
|
318
368
|
}
|
|
319
369
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
370
|
+
a {
|
|
371
|
+
color: ${({ theme }) => theme.colors.neutral800};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
span,
|
|
375
|
+
a {
|
|
376
|
+
width: 100%;
|
|
326
377
|
}
|
|
327
378
|
`;
|
|
328
|
-
const
|
|
329
|
-
|
|
379
|
+
const StyledIconButton = styled(IconButton)`
|
|
380
|
+
/* Setting this style inline with borderColor will not apply the style */
|
|
381
|
+
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
330
382
|
`;
|
|
331
|
-
const
|
|
383
|
+
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
332
384
|
const { formatMessage } = useIntl();
|
|
333
385
|
const toggleNotification = useNotification();
|
|
334
386
|
const { formatAPIError } = useAPIErrorHandler();
|
|
@@ -361,13 +413,80 @@ const ReleaseActionMenu = ({ releaseId, actionId }) => {
|
|
|
361
413
|
}
|
|
362
414
|
}
|
|
363
415
|
};
|
|
416
|
+
return /* @__PURE__ */ jsx(CheckPermissions, { permissions: PERMISSIONS.deleteAction, children: /* @__PURE__ */ jsx(StyledMenuItem, { variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
417
|
+
/* @__PURE__ */ jsx(Icon, { as: Cross, width: 3, height: 3 }),
|
|
418
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
419
|
+
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
420
|
+
defaultMessage: "Remove from release"
|
|
421
|
+
}) })
|
|
422
|
+
] }) }) });
|
|
423
|
+
};
|
|
424
|
+
const ReleaseActionEntryLinkItem = ({
|
|
425
|
+
contentTypeUid,
|
|
426
|
+
entryId,
|
|
427
|
+
locale
|
|
428
|
+
}) => {
|
|
429
|
+
const { formatMessage } = useIntl();
|
|
430
|
+
const collectionTypePermissions = useTypedSelector(
|
|
431
|
+
(state) => state.rbacProvider.collectionTypesRelatedPermissions
|
|
432
|
+
);
|
|
433
|
+
const updatePermissions = contentTypeUid ? collectionTypePermissions[contentTypeUid]?.["plugin::content-manager.explorer.update"] : [];
|
|
434
|
+
const canUpdateEntryForLocale = Boolean(
|
|
435
|
+
!locale || updatePermissions?.find(
|
|
436
|
+
(permission) => permission.properties?.locales?.includes(locale)
|
|
437
|
+
)
|
|
438
|
+
);
|
|
439
|
+
return /* @__PURE__ */ jsx(
|
|
440
|
+
CheckPermissions,
|
|
441
|
+
{
|
|
442
|
+
permissions: [
|
|
443
|
+
{
|
|
444
|
+
action: "plugin::content-manager.explorer.update",
|
|
445
|
+
subject: contentTypeUid
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
children: canUpdateEntryForLocale && /* @__PURE__ */ jsx(StyledMenuItem, { children: /* @__PURE__ */ jsx(
|
|
449
|
+
Link,
|
|
450
|
+
{
|
|
451
|
+
as: NavLink,
|
|
452
|
+
to: {
|
|
453
|
+
pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
|
|
454
|
+
search: locale && `?plugins[i18n][locale]=${locale}`
|
|
455
|
+
},
|
|
456
|
+
startIcon: /* @__PURE__ */ jsx(Icon, { as: Pencil, width: 3, height: 3 }),
|
|
457
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatMessage({
|
|
458
|
+
id: "content-releases.content-manager-edit-view.edit-entry",
|
|
459
|
+
defaultMessage: "Edit entry"
|
|
460
|
+
}) })
|
|
461
|
+
}
|
|
462
|
+
) })
|
|
463
|
+
}
|
|
464
|
+
);
|
|
465
|
+
};
|
|
466
|
+
const EditReleaseItem = ({ releaseId }) => {
|
|
467
|
+
const { formatMessage } = useIntl();
|
|
468
|
+
return /* @__PURE__ */ jsx(StyledMenuItem, { children: /* @__PURE__ */ jsx(
|
|
469
|
+
Link,
|
|
470
|
+
{
|
|
471
|
+
href: `/admin/plugins/content-releases/${releaseId}`,
|
|
472
|
+
startIcon: /* @__PURE__ */ jsx(Icon, { as: Pencil, width: 3, height: 3 }),
|
|
473
|
+
isExternal: false,
|
|
474
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatMessage({
|
|
475
|
+
id: "content-releases.content-manager-edit-view.edit-release",
|
|
476
|
+
defaultMessage: "Edit release"
|
|
477
|
+
}) })
|
|
478
|
+
}
|
|
479
|
+
) });
|
|
480
|
+
};
|
|
481
|
+
const Root = ({ children, hasTriggerBorder = false }) => {
|
|
482
|
+
const { formatMessage } = useIntl();
|
|
364
483
|
return (
|
|
365
484
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
366
485
|
/* @__PURE__ */ jsx(CheckPermissions, { permissions: [...PERMISSIONS.deleteAction, ...PERMISSIONS.update], children: /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
367
486
|
/* @__PURE__ */ jsx(
|
|
368
487
|
Menu.Trigger,
|
|
369
488
|
{
|
|
370
|
-
as: IconButton,
|
|
489
|
+
as: hasTriggerBorder ? StyledIconButton : IconButton,
|
|
371
490
|
paddingLeft: 2,
|
|
372
491
|
paddingRight: 2,
|
|
373
492
|
"aria-label": formatMessage({
|
|
@@ -377,16 +496,16 @@ const ReleaseActionMenu = ({ releaseId, actionId }) => {
|
|
|
377
496
|
icon: /* @__PURE__ */ jsx(More, {})
|
|
378
497
|
}
|
|
379
498
|
),
|
|
380
|
-
/* @__PURE__ */ jsx(Menu.Content, { top: 1, popoverPlacement: "bottom-end", children
|
|
381
|
-
/* @__PURE__ */ jsx(StyledCross, {}),
|
|
382
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", children: formatMessage({
|
|
383
|
-
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
384
|
-
defaultMessage: "Remove from release"
|
|
385
|
-
}) })
|
|
386
|
-
] }) }) }) })
|
|
499
|
+
/* @__PURE__ */ jsx(Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
387
500
|
] }) })
|
|
388
501
|
);
|
|
389
502
|
};
|
|
503
|
+
const ReleaseActionMenu = {
|
|
504
|
+
Root,
|
|
505
|
+
EditReleaseItem,
|
|
506
|
+
DeleteReleaseActionItem,
|
|
507
|
+
ReleaseActionEntryLinkItem
|
|
508
|
+
};
|
|
390
509
|
const getBorderLeftRadiusValue = (actionType) => {
|
|
391
510
|
return actionType === "publish" ? 1 : 0;
|
|
392
511
|
};
|
|
@@ -407,19 +526,40 @@ const FieldWrapper = styled(Field)`
|
|
|
407
526
|
text-transform: capitalize;
|
|
408
527
|
}
|
|
409
528
|
|
|
410
|
-
&:active,
|
|
411
529
|
&[data-checked='true'] {
|
|
412
|
-
color: ${({ theme }) => theme.colors.primary700};
|
|
413
|
-
background-color: ${({ theme }) => theme.colors.primary100};
|
|
414
|
-
border-color: ${({ theme }) => theme.colors.primary700};
|
|
530
|
+
color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
531
|
+
background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
|
|
532
|
+
border-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
|
|
415
533
|
}
|
|
416
534
|
|
|
417
535
|
&[data-checked='false'] {
|
|
418
536
|
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
419
537
|
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
420
538
|
}
|
|
539
|
+
|
|
540
|
+
&[data-checked='false'][data-disabled='false']:hover {
|
|
541
|
+
color: ${({ theme }) => theme.colors.neutral700};
|
|
542
|
+
background-color: ${({ theme }) => theme.colors.neutral100};
|
|
543
|
+
border-color: ${({ theme }) => theme.colors.neutral200};
|
|
544
|
+
|
|
545
|
+
& > label {
|
|
546
|
+
cursor: pointer;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
&[data-disabled='true'] {
|
|
551
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
|
552
|
+
background-color: ${({ theme }) => theme.colors.neutral150};
|
|
553
|
+
border-color: ${({ theme }) => theme.colors.neutral300};
|
|
554
|
+
}
|
|
421
555
|
`;
|
|
422
|
-
const ActionOption = ({
|
|
556
|
+
const ActionOption = ({
|
|
557
|
+
selected,
|
|
558
|
+
actionType,
|
|
559
|
+
handleChange,
|
|
560
|
+
name,
|
|
561
|
+
disabled = false
|
|
562
|
+
}) => {
|
|
423
563
|
return /* @__PURE__ */ jsx(
|
|
424
564
|
FieldWrapper,
|
|
425
565
|
{
|
|
@@ -430,6 +570,7 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
430
570
|
position: "relative",
|
|
431
571
|
cursor: "pointer",
|
|
432
572
|
"data-checked": selected === actionType,
|
|
573
|
+
"data-disabled": disabled && selected !== actionType,
|
|
433
574
|
children: /* @__PURE__ */ jsxs(FieldLabel, { htmlFor: `${name}-${actionType}`, children: [
|
|
434
575
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(
|
|
435
576
|
FieldInput,
|
|
@@ -439,7 +580,8 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
439
580
|
name,
|
|
440
581
|
checked: selected === actionType,
|
|
441
582
|
onChange: handleChange,
|
|
442
|
-
value: actionType
|
|
583
|
+
value: actionType,
|
|
584
|
+
disabled
|
|
443
585
|
}
|
|
444
586
|
) }),
|
|
445
587
|
actionType
|
|
@@ -447,7 +589,12 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
447
589
|
}
|
|
448
590
|
);
|
|
449
591
|
};
|
|
450
|
-
const ReleaseActionOptions = ({
|
|
592
|
+
const ReleaseActionOptions = ({
|
|
593
|
+
selected,
|
|
594
|
+
handleChange,
|
|
595
|
+
name,
|
|
596
|
+
disabled = false
|
|
597
|
+
}) => {
|
|
451
598
|
return /* @__PURE__ */ jsxs(Flex, { children: [
|
|
452
599
|
/* @__PURE__ */ jsx(
|
|
453
600
|
ActionOption,
|
|
@@ -455,7 +602,8 @@ const ReleaseActionOptions = ({ selected, handleChange, name }) => {
|
|
|
455
602
|
actionType: "publish",
|
|
456
603
|
selected,
|
|
457
604
|
handleChange,
|
|
458
|
-
name
|
|
605
|
+
name,
|
|
606
|
+
disabled
|
|
459
607
|
}
|
|
460
608
|
),
|
|
461
609
|
/* @__PURE__ */ jsx(
|
|
@@ -464,7 +612,8 @@ const ReleaseActionOptions = ({ selected, handleChange, name }) => {
|
|
|
464
612
|
actionType: "unpublish",
|
|
465
613
|
selected,
|
|
466
614
|
handleChange,
|
|
467
|
-
name
|
|
615
|
+
name,
|
|
616
|
+
disabled
|
|
468
617
|
}
|
|
469
618
|
)
|
|
470
619
|
] });
|
|
@@ -492,7 +641,7 @@ const NoReleases = () => {
|
|
|
492
641
|
to: {
|
|
493
642
|
pathname: "/plugins/content-releases"
|
|
494
643
|
},
|
|
495
|
-
as: Link,
|
|
644
|
+
as: Link$1,
|
|
496
645
|
variant: "secondary",
|
|
497
646
|
children: formatMessage({
|
|
498
647
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -508,6 +657,7 @@ const AddActionToReleaseModal = ({
|
|
|
508
657
|
contentTypeUid,
|
|
509
658
|
entryId
|
|
510
659
|
}) => {
|
|
660
|
+
const releaseHeaderId = React.useId();
|
|
511
661
|
const { formatMessage } = useIntl();
|
|
512
662
|
const toggleNotification = useNotification();
|
|
513
663
|
const { formatAPIError } = useAPIErrorHandler();
|
|
@@ -555,8 +705,8 @@ const AddActionToReleaseModal = ({
|
|
|
555
705
|
}
|
|
556
706
|
}
|
|
557
707
|
};
|
|
558
|
-
return /* @__PURE__ */ jsxs(ModalLayout, { onClose: handleClose, labelledBy:
|
|
559
|
-
/* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsx(Typography, { id:
|
|
708
|
+
return /* @__PURE__ */ jsxs(ModalLayout, { onClose: handleClose, labelledBy: releaseHeaderId, children: [
|
|
709
|
+
/* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsx(Typography, { id: releaseHeaderId, fontWeight: "bold", textColor: "neutral800", children: formatMessage({
|
|
560
710
|
id: "content-releases.content-manager-edit-view.add-to-release",
|
|
561
711
|
defaultMessage: "Add to release"
|
|
562
712
|
}) }) }),
|
|
@@ -626,16 +776,18 @@ const AddActionToReleaseModal = ({
|
|
|
626
776
|
};
|
|
627
777
|
const CMReleasesContainer = () => {
|
|
628
778
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
629
|
-
const { formatMessage } = useIntl();
|
|
779
|
+
const { formatMessage, formatDate, formatTime } = useIntl();
|
|
630
780
|
const {
|
|
631
781
|
isCreatingEntry,
|
|
632
|
-
|
|
782
|
+
hasDraftAndPublish,
|
|
783
|
+
initialData: { id: entryId },
|
|
784
|
+
slug
|
|
633
785
|
} = useCMEditViewDataManager();
|
|
634
|
-
const
|
|
635
|
-
const canFetch =
|
|
786
|
+
const contentTypeUid = slug;
|
|
787
|
+
const canFetch = entryId != null && contentTypeUid != null;
|
|
636
788
|
const fetchParams = canFetch ? {
|
|
637
|
-
contentTypeUid
|
|
638
|
-
entryId
|
|
789
|
+
contentTypeUid,
|
|
790
|
+
entryId,
|
|
639
791
|
hasEntryAttached: true
|
|
640
792
|
} : skipToken;
|
|
641
793
|
const response = useGetReleasesForEntryQuery(fetchParams);
|
|
@@ -643,7 +795,7 @@ const CMReleasesContainer = () => {
|
|
|
643
795
|
if (!canFetch) {
|
|
644
796
|
return null;
|
|
645
797
|
}
|
|
646
|
-
if (isCreatingEntry || !
|
|
798
|
+
if (isCreatingEntry || !hasDraftAndPublish) {
|
|
647
799
|
return null;
|
|
648
800
|
}
|
|
649
801
|
const toggleModal = () => setIsModalOpen((prev) => !prev);
|
|
@@ -710,9 +862,40 @@ const CMReleasesContainer = () => {
|
|
|
710
862
|
)
|
|
711
863
|
}
|
|
712
864
|
),
|
|
713
|
-
/* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap:
|
|
865
|
+
/* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
714
866
|
/* @__PURE__ */ jsx(Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
715
|
-
/* @__PURE__ */ jsx(
|
|
867
|
+
release.scheduledAt && release.timezone && /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
|
|
868
|
+
{
|
|
869
|
+
id: "content-releases.content-manager-edit-view.scheduled.date",
|
|
870
|
+
defaultMessage: "{date} at {time} ({offset})"
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
date: formatDate(new Date(release.scheduledAt), {
|
|
874
|
+
day: "2-digit",
|
|
875
|
+
month: "2-digit",
|
|
876
|
+
year: "numeric",
|
|
877
|
+
timeZone: release.timezone
|
|
878
|
+
}),
|
|
879
|
+
time: formatTime(new Date(release.scheduledAt), {
|
|
880
|
+
hourCycle: "h23",
|
|
881
|
+
timeZone: release.timezone
|
|
882
|
+
}),
|
|
883
|
+
offset: getTimezoneOffset(
|
|
884
|
+
release.timezone,
|
|
885
|
+
new Date(release.scheduledAt)
|
|
886
|
+
)
|
|
887
|
+
}
|
|
888
|
+
) }),
|
|
889
|
+
/* @__PURE__ */ jsx(CheckPermissions, { permissions: PERMISSIONS.deleteAction, children: /* @__PURE__ */ jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
|
|
890
|
+
/* @__PURE__ */ jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
|
|
891
|
+
/* @__PURE__ */ jsx(
|
|
892
|
+
ReleaseActionMenu.DeleteReleaseActionItem,
|
|
893
|
+
{
|
|
894
|
+
releaseId: release.id,
|
|
895
|
+
actionId: release.action.id
|
|
896
|
+
}
|
|
897
|
+
)
|
|
898
|
+
] }) })
|
|
716
899
|
] })
|
|
717
900
|
]
|
|
718
901
|
},
|
|
@@ -740,8 +923,8 @@ const CMReleasesContainer = () => {
|
|
|
740
923
|
AddActionToReleaseModal,
|
|
741
924
|
{
|
|
742
925
|
handleClose: toggleModal,
|
|
743
|
-
contentTypeUid
|
|
744
|
-
entryId
|
|
926
|
+
contentTypeUid,
|
|
927
|
+
entryId
|
|
745
928
|
}
|
|
746
929
|
)
|
|
747
930
|
]
|
|
@@ -751,7 +934,7 @@ const CMReleasesContainer = () => {
|
|
|
751
934
|
const admin = {
|
|
752
935
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
753
936
|
register(app) {
|
|
754
|
-
if (window.strapi.features.isEnabled("cms-content-releases")
|
|
937
|
+
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
755
938
|
app.addMenuLink({
|
|
756
939
|
to: `/plugins/${pluginId}`,
|
|
757
940
|
icon: PaperPlane,
|
|
@@ -760,7 +943,7 @@ const admin = {
|
|
|
760
943
|
defaultMessage: "Releases"
|
|
761
944
|
},
|
|
762
945
|
async Component() {
|
|
763
|
-
const { App } = await import("./App-
|
|
946
|
+
const { App } = await import("./App-HVXzE3i3.mjs");
|
|
764
947
|
return App;
|
|
765
948
|
},
|
|
766
949
|
permissions: PERMISSIONS.main
|
|
@@ -773,12 +956,26 @@ const admin = {
|
|
|
773
956
|
name: `${pluginId}-link`,
|
|
774
957
|
Component: CMReleasesContainer
|
|
775
958
|
});
|
|
959
|
+
} else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
|
|
960
|
+
app.addMenuLink({
|
|
961
|
+
to: `/plugins/purchase-content-releases`,
|
|
962
|
+
icon: PaperPlane,
|
|
963
|
+
intlLabel: {
|
|
964
|
+
id: `${pluginId}.plugin.name`,
|
|
965
|
+
defaultMessage: "Releases"
|
|
966
|
+
},
|
|
967
|
+
async Component() {
|
|
968
|
+
const { PurchaseContentReleases } = await import("./PurchaseContentReleases-Clm0iACO.mjs");
|
|
969
|
+
return PurchaseContentReleases;
|
|
970
|
+
},
|
|
971
|
+
lockIcon: true
|
|
972
|
+
});
|
|
776
973
|
}
|
|
777
974
|
},
|
|
778
975
|
async registerTrads({ locales }) {
|
|
779
976
|
const importedTrads = await Promise.all(
|
|
780
977
|
locales.map((locale) => {
|
|
781
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-
|
|
978
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-RdapH-9X.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
|
|
782
979
|
return {
|
|
783
980
|
data: prefixPluginTranslations(data, "content-releases"),
|
|
784
981
|
locale
|
|
@@ -797,17 +994,20 @@ const admin = {
|
|
|
797
994
|
export {
|
|
798
995
|
PERMISSIONS as P,
|
|
799
996
|
ReleaseActionOptions as R,
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
997
|
+
useCreateReleaseMutation as a,
|
|
998
|
+
useGetReleaseQuery as b,
|
|
999
|
+
useUpdateReleaseMutation as c,
|
|
1000
|
+
useDeleteReleaseMutation as d,
|
|
1001
|
+
usePublishReleaseMutation as e,
|
|
1002
|
+
useTypedDispatch as f,
|
|
1003
|
+
getTimezoneOffset as g,
|
|
1004
|
+
useGetReleaseActionsQuery as h,
|
|
808
1005
|
isAxiosError as i,
|
|
809
|
-
|
|
1006
|
+
useUpdateReleaseActionMutation as j,
|
|
1007
|
+
ReleaseActionMenu as k,
|
|
1008
|
+
admin as l,
|
|
810
1009
|
pluginId as p,
|
|
811
|
-
|
|
1010
|
+
releaseApi as r,
|
|
1011
|
+
useGetReleasesQuery as u
|
|
812
1012
|
};
|
|
813
|
-
//# sourceMappingURL=index-
|
|
1013
|
+
//# sourceMappingURL=index-Ys87ROOe.mjs.map
|