@strapi/content-releases 0.0.0-experimental.e1ede8c55a0e1e22ce20137bf238fc374bd5dd51 → 0.0.0-experimental.e5740babedd53cf5b6af99d74920b6b9ef1e4c11
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-o5_WfqR-.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-ngTk74JV.mjs → en-RdapH-9X.mjs} +22 -7
- package/dist/_chunks/en-RdapH-9X.mjs.map +1 -0
- package/dist/_chunks/{en-haKSQIo8.js → en-faJDuv3q.js} +22 -7
- package/dist/_chunks/en-faJDuv3q.js.map +1 -0
- package/dist/_chunks/{index-EdBmRHRU.js → index-ML_b3php.js} +242 -57
- package/dist/_chunks/index-ML_b3php.js.map +1 -0
- package/dist/_chunks/{index-XAQOX_IB.mjs → index-Ys87ROOe.mjs} +257 -72
- 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-g2P5kbSm.mjs +0 -945
- package/dist/_chunks/App-g2P5kbSm.mjs.map +0 -1
- package/dist/_chunks/App-o5_WfqR-.js.map +0 -1
- package/dist/_chunks/en-haKSQIo8.js.map +0 -1
- package/dist/_chunks/en-ngTk74JV.mjs.map +0 -1
- package/dist/_chunks/index-EdBmRHRU.js.map +0 -1
- package/dist/_chunks/index-XAQOX_IB.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,37 +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
|
-
`;
|
|
328
|
-
const StyledCross = styled(Cross)`
|
|
329
|
-
padding: ${({ theme }) => theme.spaces[1]};
|
|
330
378
|
`;
|
|
331
379
|
const StyledIconButton = styled(IconButton)`
|
|
332
380
|
/* Setting this style inline with borderColor will not apply the style */
|
|
333
381
|
border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
|
|
334
382
|
`;
|
|
335
|
-
const
|
|
336
|
-
releaseId,
|
|
337
|
-
actionId,
|
|
338
|
-
hasTriggerBorder = false
|
|
339
|
-
}) => {
|
|
383
|
+
const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
|
|
340
384
|
const { formatMessage } = useIntl();
|
|
341
385
|
const toggleNotification = useNotification();
|
|
342
386
|
const { formatAPIError } = useAPIErrorHandler();
|
|
@@ -369,6 +413,73 @@ const ReleaseActionMenu = ({
|
|
|
369
413
|
}
|
|
370
414
|
}
|
|
371
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();
|
|
372
483
|
return (
|
|
373
484
|
// A user can access the dropdown if they have permissions to delete a release-action OR update a release
|
|
374
485
|
/* @__PURE__ */ jsx(CheckPermissions, { permissions: [...PERMISSIONS.deleteAction, ...PERMISSIONS.update], children: /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
@@ -385,16 +496,16 @@ const ReleaseActionMenu = ({
|
|
|
385
496
|
icon: /* @__PURE__ */ jsx(More, {})
|
|
386
497
|
}
|
|
387
498
|
),
|
|
388
|
-
/* @__PURE__ */ jsx(Menu.Content, { top: 1, popoverPlacement: "bottom-end", children
|
|
389
|
-
/* @__PURE__ */ jsx(StyledCross, {}),
|
|
390
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
|
|
391
|
-
id: "content-releases.content-manager-edit-view.remove-from-release",
|
|
392
|
-
defaultMessage: "Remove from release"
|
|
393
|
-
}) })
|
|
394
|
-
] }) }) }) })
|
|
499
|
+
/* @__PURE__ */ jsx(Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
|
|
395
500
|
] }) })
|
|
396
501
|
);
|
|
397
502
|
};
|
|
503
|
+
const ReleaseActionMenu = {
|
|
504
|
+
Root,
|
|
505
|
+
EditReleaseItem,
|
|
506
|
+
DeleteReleaseActionItem,
|
|
507
|
+
ReleaseActionEntryLinkItem
|
|
508
|
+
};
|
|
398
509
|
const getBorderLeftRadiusValue = (actionType) => {
|
|
399
510
|
return actionType === "publish" ? 1 : 0;
|
|
400
511
|
};
|
|
@@ -415,19 +526,40 @@ const FieldWrapper = styled(Field)`
|
|
|
415
526
|
text-transform: capitalize;
|
|
416
527
|
}
|
|
417
528
|
|
|
418
|
-
&:active,
|
|
419
529
|
&[data-checked='true'] {
|
|
420
|
-
color: ${({ theme }) => theme.colors.primary700};
|
|
421
|
-
background-color: ${({ theme }) => theme.colors.primary100};
|
|
422
|
-
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};
|
|
423
533
|
}
|
|
424
534
|
|
|
425
535
|
&[data-checked='false'] {
|
|
426
536
|
border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
|
|
427
537
|
border-right: ${({ actionType }) => actionType === "publish" && "none"};
|
|
428
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
|
+
}
|
|
429
555
|
`;
|
|
430
|
-
const ActionOption = ({
|
|
556
|
+
const ActionOption = ({
|
|
557
|
+
selected,
|
|
558
|
+
actionType,
|
|
559
|
+
handleChange,
|
|
560
|
+
name,
|
|
561
|
+
disabled = false
|
|
562
|
+
}) => {
|
|
431
563
|
return /* @__PURE__ */ jsx(
|
|
432
564
|
FieldWrapper,
|
|
433
565
|
{
|
|
@@ -438,6 +570,7 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
438
570
|
position: "relative",
|
|
439
571
|
cursor: "pointer",
|
|
440
572
|
"data-checked": selected === actionType,
|
|
573
|
+
"data-disabled": disabled && selected !== actionType,
|
|
441
574
|
children: /* @__PURE__ */ jsxs(FieldLabel, { htmlFor: `${name}-${actionType}`, children: [
|
|
442
575
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(
|
|
443
576
|
FieldInput,
|
|
@@ -447,7 +580,8 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
447
580
|
name,
|
|
448
581
|
checked: selected === actionType,
|
|
449
582
|
onChange: handleChange,
|
|
450
|
-
value: actionType
|
|
583
|
+
value: actionType,
|
|
584
|
+
disabled
|
|
451
585
|
}
|
|
452
586
|
) }),
|
|
453
587
|
actionType
|
|
@@ -455,7 +589,12 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
|
|
|
455
589
|
}
|
|
456
590
|
);
|
|
457
591
|
};
|
|
458
|
-
const ReleaseActionOptions = ({
|
|
592
|
+
const ReleaseActionOptions = ({
|
|
593
|
+
selected,
|
|
594
|
+
handleChange,
|
|
595
|
+
name,
|
|
596
|
+
disabled = false
|
|
597
|
+
}) => {
|
|
459
598
|
return /* @__PURE__ */ jsxs(Flex, { children: [
|
|
460
599
|
/* @__PURE__ */ jsx(
|
|
461
600
|
ActionOption,
|
|
@@ -463,7 +602,8 @@ const ReleaseActionOptions = ({ selected, handleChange, name }) => {
|
|
|
463
602
|
actionType: "publish",
|
|
464
603
|
selected,
|
|
465
604
|
handleChange,
|
|
466
|
-
name
|
|
605
|
+
name,
|
|
606
|
+
disabled
|
|
467
607
|
}
|
|
468
608
|
),
|
|
469
609
|
/* @__PURE__ */ jsx(
|
|
@@ -472,7 +612,8 @@ const ReleaseActionOptions = ({ selected, handleChange, name }) => {
|
|
|
472
612
|
actionType: "unpublish",
|
|
473
613
|
selected,
|
|
474
614
|
handleChange,
|
|
475
|
-
name
|
|
615
|
+
name,
|
|
616
|
+
disabled
|
|
476
617
|
}
|
|
477
618
|
)
|
|
478
619
|
] });
|
|
@@ -500,7 +641,7 @@ const NoReleases = () => {
|
|
|
500
641
|
to: {
|
|
501
642
|
pathname: "/plugins/content-releases"
|
|
502
643
|
},
|
|
503
|
-
as: Link,
|
|
644
|
+
as: Link$1,
|
|
504
645
|
variant: "secondary",
|
|
505
646
|
children: formatMessage({
|
|
506
647
|
id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
|
|
@@ -516,6 +657,7 @@ const AddActionToReleaseModal = ({
|
|
|
516
657
|
contentTypeUid,
|
|
517
658
|
entryId
|
|
518
659
|
}) => {
|
|
660
|
+
const releaseHeaderId = React.useId();
|
|
519
661
|
const { formatMessage } = useIntl();
|
|
520
662
|
const toggleNotification = useNotification();
|
|
521
663
|
const { formatAPIError } = useAPIErrorHandler();
|
|
@@ -563,8 +705,8 @@ const AddActionToReleaseModal = ({
|
|
|
563
705
|
}
|
|
564
706
|
}
|
|
565
707
|
};
|
|
566
|
-
return /* @__PURE__ */ jsxs(ModalLayout, { onClose: handleClose, labelledBy:
|
|
567
|
-
/* @__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({
|
|
568
710
|
id: "content-releases.content-manager-edit-view.add-to-release",
|
|
569
711
|
defaultMessage: "Add to release"
|
|
570
712
|
}) }) }),
|
|
@@ -634,16 +776,18 @@ const AddActionToReleaseModal = ({
|
|
|
634
776
|
};
|
|
635
777
|
const CMReleasesContainer = () => {
|
|
636
778
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
637
|
-
const { formatMessage } = useIntl();
|
|
779
|
+
const { formatMessage, formatDate, formatTime } = useIntl();
|
|
638
780
|
const {
|
|
639
781
|
isCreatingEntry,
|
|
640
|
-
|
|
782
|
+
hasDraftAndPublish,
|
|
783
|
+
initialData: { id: entryId },
|
|
784
|
+
slug
|
|
641
785
|
} = useCMEditViewDataManager();
|
|
642
|
-
const
|
|
643
|
-
const canFetch =
|
|
786
|
+
const contentTypeUid = slug;
|
|
787
|
+
const canFetch = entryId != null && contentTypeUid != null;
|
|
644
788
|
const fetchParams = canFetch ? {
|
|
645
|
-
contentTypeUid
|
|
646
|
-
entryId
|
|
789
|
+
contentTypeUid,
|
|
790
|
+
entryId,
|
|
647
791
|
hasEntryAttached: true
|
|
648
792
|
} : skipToken;
|
|
649
793
|
const response = useGetReleasesForEntryQuery(fetchParams);
|
|
@@ -651,7 +795,7 @@ const CMReleasesContainer = () => {
|
|
|
651
795
|
if (!canFetch) {
|
|
652
796
|
return null;
|
|
653
797
|
}
|
|
654
|
-
if (isCreatingEntry || !
|
|
798
|
+
if (isCreatingEntry || !hasDraftAndPublish) {
|
|
655
799
|
return null;
|
|
656
800
|
}
|
|
657
801
|
const toggleModal = () => setIsModalOpen((prev) => !prev);
|
|
@@ -718,16 +862,40 @@ const CMReleasesContainer = () => {
|
|
|
718
862
|
)
|
|
719
863
|
}
|
|
720
864
|
),
|
|
721
|
-
/* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap:
|
|
865
|
+
/* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
|
|
722
866
|
/* @__PURE__ */ jsx(Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
|
|
723
|
-
/* @__PURE__ */ jsx(
|
|
724
|
-
|
|
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
|
+
},
|
|
725
872
|
{
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
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
|
+
)
|
|
729
887
|
}
|
|
730
|
-
)
|
|
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
|
+
] }) })
|
|
731
899
|
] })
|
|
732
900
|
]
|
|
733
901
|
},
|
|
@@ -755,8 +923,8 @@ const CMReleasesContainer = () => {
|
|
|
755
923
|
AddActionToReleaseModal,
|
|
756
924
|
{
|
|
757
925
|
handleClose: toggleModal,
|
|
758
|
-
contentTypeUid
|
|
759
|
-
entryId
|
|
926
|
+
contentTypeUid,
|
|
927
|
+
entryId
|
|
760
928
|
}
|
|
761
929
|
)
|
|
762
930
|
]
|
|
@@ -766,7 +934,7 @@ const CMReleasesContainer = () => {
|
|
|
766
934
|
const admin = {
|
|
767
935
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
768
936
|
register(app) {
|
|
769
|
-
if (window.strapi.features.isEnabled("cms-content-releases")
|
|
937
|
+
if (window.strapi.features.isEnabled("cms-content-releases")) {
|
|
770
938
|
app.addMenuLink({
|
|
771
939
|
to: `/plugins/${pluginId}`,
|
|
772
940
|
icon: PaperPlane,
|
|
@@ -775,7 +943,7 @@ const admin = {
|
|
|
775
943
|
defaultMessage: "Releases"
|
|
776
944
|
},
|
|
777
945
|
async Component() {
|
|
778
|
-
const { App } = await import("./App-
|
|
946
|
+
const { App } = await import("./App-HVXzE3i3.mjs");
|
|
779
947
|
return App;
|
|
780
948
|
},
|
|
781
949
|
permissions: PERMISSIONS.main
|
|
@@ -788,12 +956,26 @@ const admin = {
|
|
|
788
956
|
name: `${pluginId}-link`,
|
|
789
957
|
Component: CMReleasesContainer
|
|
790
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
|
+
});
|
|
791
973
|
}
|
|
792
974
|
},
|
|
793
975
|
async registerTrads({ locales }) {
|
|
794
976
|
const importedTrads = await Promise.all(
|
|
795
977
|
locales.map((locale) => {
|
|
796
|
-
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 }) => {
|
|
797
979
|
return {
|
|
798
980
|
data: prefixPluginTranslations(data, "content-releases"),
|
|
799
981
|
locale
|
|
@@ -812,17 +994,20 @@ const admin = {
|
|
|
812
994
|
export {
|
|
813
995
|
PERMISSIONS as P,
|
|
814
996
|
ReleaseActionOptions as R,
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
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,
|
|
823
1005
|
isAxiosError as i,
|
|
824
|
-
|
|
1006
|
+
useUpdateReleaseActionMutation as j,
|
|
1007
|
+
ReleaseActionMenu as k,
|
|
1008
|
+
admin as l,
|
|
825
1009
|
pluginId as p,
|
|
826
|
-
|
|
1010
|
+
releaseApi as r,
|
|
1011
|
+
useGetReleasesQuery as u
|
|
827
1012
|
};
|
|
828
|
-
//# sourceMappingURL=index-
|
|
1013
|
+
//# sourceMappingURL=index-Ys87ROOe.mjs.map
|