@strapi/content-releases 5.1.1 → 5.3.0
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-Cne--1Z8.mjs → App-BX6_LcmS.mjs} +297 -112
- package/dist/_chunks/App-BX6_LcmS.mjs.map +1 -0
- package/dist/_chunks/{App-BKB1esYS.js → App-DITZWWqI.js} +337 -152
- package/dist/_chunks/App-DITZWWqI.js.map +1 -0
- package/dist/_chunks/{ReleasesSettingsPage-C1WwGWIH.mjs → ReleasesSettingsPage-BMgLwqci.mjs} +2 -2
- package/dist/_chunks/{ReleasesSettingsPage-C1WwGWIH.mjs.map → ReleasesSettingsPage-BMgLwqci.mjs.map} +1 -1
- package/dist/_chunks/{ReleasesSettingsPage-kuXIwpWp.js → ReleasesSettingsPage-DZcRvN_O.js} +2 -2
- package/dist/_chunks/{ReleasesSettingsPage-kuXIwpWp.js.map → ReleasesSettingsPage-DZcRvN_O.js.map} +1 -1
- package/dist/_chunks/{en-CmYoEnA7.js → en-BWPPsSH-.js} +11 -2
- package/dist/_chunks/en-BWPPsSH-.js.map +1 -0
- package/dist/_chunks/{en-D0yVZFqf.mjs → en-D9Q4YW03.mjs} +11 -2
- package/dist/_chunks/en-D9Q4YW03.mjs.map +1 -0
- package/dist/_chunks/{index-Cy7qwpaU.mjs → index-CBsSVKTv.mjs} +22 -4
- package/dist/_chunks/index-CBsSVKTv.mjs.map +1 -0
- package/dist/_chunks/{index-5Odi61vw.js → index-TfMp19WL.js} +22 -4
- package/dist/_chunks/index-TfMp19WL.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/EntryValidationPopover.d.ts +13 -0
- package/dist/server/index.js +79 -9
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +79 -9
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/index.d.ts +2 -6
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/middlewares/documents.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +2 -6
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/release-action.d.ts +3 -7
- package/dist/server/src/services/release-action.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/release-actions.d.ts +8 -1
- package/dist/shared/contracts/release-actions.d.ts.map +1 -1
- package/package.json +11 -10
- package/dist/_chunks/App-BKB1esYS.js.map +0 -1
- package/dist/_chunks/App-Cne--1Z8.mjs.map +0 -1
- package/dist/_chunks/en-CmYoEnA7.js.map +0 -1
- package/dist/_chunks/en-D0yVZFqf.mjs.map +0 -1
- package/dist/_chunks/index-5Odi61vw.js.map +0 -1
- package/dist/_chunks/index-Cy7qwpaU.mjs.map +0 -1
|
@@ -1,21 +1,306 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useNotification, useAPIErrorHandler, useQueryParams, useTracking, useRBAC, Page, Layouts, Pagination, isFetchError, ConfirmDialog, BackButton, useStrapiApp, Table } from "@strapi/admin/strapi-admin";
|
|
3
|
-
import { useLocation, useNavigate, NavLink, useParams, Navigate,
|
|
4
|
-
import { g as getTimezones, p as pluginId, u as useGetReleasesQuery, a as useGetReleaseSettingsQuery, b as useCreateReleaseMutation, P as PERMISSIONS, c as useGetReleaseQuery, d as useUpdateReleaseMutation, e as useDeleteReleaseMutation, f as usePublishReleaseMutation, h as getTimezoneOffset, i as useGetReleaseActionsQuery, j as useUpdateReleaseActionMutation, R as ReleaseActionOptions, k as ReleaseActionMenu, r as releaseApi } from "./index-
|
|
3
|
+
import { Link, useLocation, useNavigate, NavLink, useParams, Navigate, Routes, Route } from "react-router-dom";
|
|
4
|
+
import { g as getTimezones, p as pluginId, u as useGetReleasesQuery, a as useGetReleaseSettingsQuery, b as useCreateReleaseMutation, P as PERMISSIONS, c as useGetReleaseQuery, d as useUpdateReleaseMutation, e as useDeleteReleaseMutation, f as usePublishReleaseMutation, h as getTimezoneOffset, i as useGetReleaseActionsQuery, j as useUpdateReleaseActionMutation, R as ReleaseActionOptions, k as ReleaseActionMenu, r as releaseApi } from "./index-CBsSVKTv.mjs";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { Plus, Pencil, Trash, More, CrossCircle, CheckCircle, ArrowsCounterClockwise } from "@strapi/icons";
|
|
6
|
+
import { Flex, Popover, Button, Typography, LinkButton, Modal, Field, TextInput, Box, Checkbox, DatePicker, TimePicker, Combobox, ComboboxOption, Link as Link$1, Alert, Main, Tabs, Divider, EmptyStateLayout, Grid, Badge, MenuItem, SimpleMenu, Dialog, SingleSelect, SingleSelectOption, Tr, Td } from "@strapi/design-system";
|
|
7
|
+
import { CrossCircle, CaretDown, CheckCircle, ArrowsCounterClockwise, Plus, Pencil, Trash, More } from "@strapi/icons";
|
|
9
8
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
10
9
|
import format$1 from "date-fns/format";
|
|
11
10
|
import { utcToZonedTime, zonedTimeToUtc } from "date-fns-tz";
|
|
12
11
|
import { useIntl } from "react-intl";
|
|
13
12
|
import { styled } from "styled-components";
|
|
13
|
+
import { unstable_useDocument } from "@strapi/content-manager/strapi-admin";
|
|
14
|
+
import { stringify } from "qs";
|
|
14
15
|
import { intervalToDuration, isPast, formatISO, format } from "date-fns";
|
|
15
16
|
import { Formik, Form, useFormikContext } from "formik";
|
|
16
17
|
import { R as RELEASE_SCHEMA } from "./schemas-DdA2ic2U.mjs";
|
|
17
18
|
import { useDispatch } from "react-redux";
|
|
18
19
|
import { useLicenseLimits } from "@strapi/admin/strapi-admin/ee";
|
|
20
|
+
const StyledPopoverFlex = styled(Flex)`
|
|
21
|
+
width: 100%;
|
|
22
|
+
max-width: 256px;
|
|
23
|
+
|
|
24
|
+
& > * {
|
|
25
|
+
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
& > *:last-child {
|
|
29
|
+
border-bottom: none;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const EntryStatusTrigger = ({
|
|
33
|
+
action,
|
|
34
|
+
status,
|
|
35
|
+
hasErrors,
|
|
36
|
+
requiredStage,
|
|
37
|
+
entryStage
|
|
38
|
+
}) => {
|
|
39
|
+
const { formatMessage } = useIntl();
|
|
40
|
+
if (action === "publish") {
|
|
41
|
+
if (hasErrors || requiredStage && requiredStage.id !== entryStage?.id) {
|
|
42
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
43
|
+
Button,
|
|
44
|
+
{
|
|
45
|
+
variant: "ghost",
|
|
46
|
+
startIcon: /* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }),
|
|
47
|
+
endIcon: /* @__PURE__ */ jsx(CaretDown, {}),
|
|
48
|
+
children: /* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
49
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.not-ready",
|
|
50
|
+
defaultMessage: "Not ready to publish"
|
|
51
|
+
}) })
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
}
|
|
55
|
+
if (status === "draft") {
|
|
56
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
57
|
+
Button,
|
|
58
|
+
{
|
|
59
|
+
variant: "ghost",
|
|
60
|
+
startIcon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
61
|
+
endIcon: /* @__PURE__ */ jsx(CaretDown, {}),
|
|
62
|
+
children: /* @__PURE__ */ jsx(Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
63
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
64
|
+
defaultMessage: "Ready to publish"
|
|
65
|
+
}) })
|
|
66
|
+
}
|
|
67
|
+
) });
|
|
68
|
+
}
|
|
69
|
+
if (status === "modified") {
|
|
70
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
71
|
+
Button,
|
|
72
|
+
{
|
|
73
|
+
variant: "ghost",
|
|
74
|
+
startIcon: /* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
75
|
+
endIcon: /* @__PURE__ */ jsx(CaretDown, {}),
|
|
76
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", textColor: "alternative600", children: formatMessage({
|
|
77
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
78
|
+
defaultMessage: "Ready to publish changes"
|
|
79
|
+
}) })
|
|
80
|
+
}
|
|
81
|
+
) });
|
|
82
|
+
}
|
|
83
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
84
|
+
Button,
|
|
85
|
+
{
|
|
86
|
+
variant: "ghost",
|
|
87
|
+
startIcon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
88
|
+
endIcon: /* @__PURE__ */ jsx(CaretDown, {}),
|
|
89
|
+
children: /* @__PURE__ */ jsx(Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
90
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
91
|
+
defaultMessage: "Already published"
|
|
92
|
+
}) })
|
|
93
|
+
}
|
|
94
|
+
) });
|
|
95
|
+
}
|
|
96
|
+
if (status === "published") {
|
|
97
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
98
|
+
Button,
|
|
99
|
+
{
|
|
100
|
+
variant: "ghost",
|
|
101
|
+
startIcon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
102
|
+
endIcon: /* @__PURE__ */ jsx(CaretDown, {}),
|
|
103
|
+
children: /* @__PURE__ */ jsx(Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
104
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
|
|
105
|
+
defaultMessage: "Ready to unpublish"
|
|
106
|
+
}) })
|
|
107
|
+
}
|
|
108
|
+
) });
|
|
109
|
+
}
|
|
110
|
+
return /* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(Button, { variant: "ghost", startIcon: /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }), endIcon: /* @__PURE__ */ jsx(CaretDown, {}), children: /* @__PURE__ */ jsx(Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
|
|
111
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
112
|
+
defaultMessage: "Already unpublished"
|
|
113
|
+
}) }) }) });
|
|
114
|
+
};
|
|
115
|
+
const FieldsValidation = ({
|
|
116
|
+
hasErrors,
|
|
117
|
+
errors,
|
|
118
|
+
kind,
|
|
119
|
+
contentTypeUid,
|
|
120
|
+
documentId,
|
|
121
|
+
locale
|
|
122
|
+
}) => {
|
|
123
|
+
const { formatMessage } = useIntl();
|
|
124
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, width: "100%", padding: 5, children: [
|
|
125
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, width: "100%", children: [
|
|
126
|
+
/* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({
|
|
127
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields",
|
|
128
|
+
defaultMessage: "Fields"
|
|
129
|
+
}) }),
|
|
130
|
+
hasErrors ? /* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }) : /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" })
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ jsx(Typography, { width: "100%", textColor: "neutral600", children: hasErrors ? formatMessage(
|
|
133
|
+
{
|
|
134
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields.error",
|
|
135
|
+
defaultMessage: "{errors} errors on fields."
|
|
136
|
+
},
|
|
137
|
+
{ errors: errors ? Object.keys(errors).length : 0 }
|
|
138
|
+
) : formatMessage({
|
|
139
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields.success",
|
|
140
|
+
defaultMessage: "All fields are filled correctly."
|
|
141
|
+
}) }),
|
|
142
|
+
hasErrors && /* @__PURE__ */ jsx(
|
|
143
|
+
LinkButton,
|
|
144
|
+
{
|
|
145
|
+
tag: Link,
|
|
146
|
+
to: {
|
|
147
|
+
pathname: `/content-manager/${kind === "collectionType" ? "collection-types" : "single-types"}/${contentTypeUid}/${documentId}`,
|
|
148
|
+
search: locale ? stringify({
|
|
149
|
+
plugins: {
|
|
150
|
+
i18n: {
|
|
151
|
+
locale
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}) : ""
|
|
155
|
+
},
|
|
156
|
+
variant: "secondary",
|
|
157
|
+
fullWidth: true,
|
|
158
|
+
state: { forceValidation: true },
|
|
159
|
+
children: formatMessage({
|
|
160
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.fields.see-errors",
|
|
161
|
+
defaultMessage: "See errors"
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
] });
|
|
166
|
+
};
|
|
167
|
+
const getReviewStageIcon = ({
|
|
168
|
+
contentTypeHasReviewWorkflow,
|
|
169
|
+
requiredStage,
|
|
170
|
+
entryStage
|
|
171
|
+
}) => {
|
|
172
|
+
if (!contentTypeHasReviewWorkflow) {
|
|
173
|
+
return /* @__PURE__ */ jsx(CheckCircle, { fill: "neutral200" });
|
|
174
|
+
}
|
|
175
|
+
if (requiredStage && requiredStage.id !== entryStage?.id) {
|
|
176
|
+
return /* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" });
|
|
177
|
+
}
|
|
178
|
+
return /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" });
|
|
179
|
+
};
|
|
180
|
+
const getReviewStageMessage = ({
|
|
181
|
+
contentTypeHasReviewWorkflow,
|
|
182
|
+
requiredStage,
|
|
183
|
+
entryStage,
|
|
184
|
+
formatMessage
|
|
185
|
+
}) => {
|
|
186
|
+
if (!contentTypeHasReviewWorkflow) {
|
|
187
|
+
return formatMessage({
|
|
188
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.not-enabled",
|
|
189
|
+
defaultMessage: "This entry is not associated to any workflow."
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
if (requiredStage && requiredStage.id !== entryStage?.id) {
|
|
193
|
+
return formatMessage(
|
|
194
|
+
{
|
|
195
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.not-ready",
|
|
196
|
+
defaultMessage: "This entry is not at the required stage for publishing. ({stageName})"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
stageName: requiredStage?.name ?? ""
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
if (requiredStage && requiredStage.id === entryStage?.id) {
|
|
204
|
+
return formatMessage(
|
|
205
|
+
{
|
|
206
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.ready",
|
|
207
|
+
defaultMessage: "This entry is at the required stage for publishing. ({stageName})"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
stageName: requiredStage?.name ?? ""
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
return formatMessage({
|
|
215
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.stage-not-required",
|
|
216
|
+
defaultMessage: "No required stage for publication"
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
const ReviewStageValidation = ({
|
|
220
|
+
contentTypeHasReviewWorkflow,
|
|
221
|
+
requiredStage,
|
|
222
|
+
entryStage
|
|
223
|
+
}) => {
|
|
224
|
+
const { formatMessage } = useIntl();
|
|
225
|
+
const Icon = getReviewStageIcon({
|
|
226
|
+
contentTypeHasReviewWorkflow,
|
|
227
|
+
requiredStage,
|
|
228
|
+
entryStage
|
|
229
|
+
});
|
|
230
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, width: "100%", padding: 5, children: [
|
|
231
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, width: "100%", children: [
|
|
232
|
+
/* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: formatMessage({
|
|
233
|
+
id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage",
|
|
234
|
+
defaultMessage: "Review stage"
|
|
235
|
+
}) }),
|
|
236
|
+
Icon
|
|
237
|
+
] }),
|
|
238
|
+
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: getReviewStageMessage({
|
|
239
|
+
contentTypeHasReviewWorkflow,
|
|
240
|
+
requiredStage,
|
|
241
|
+
entryStage,
|
|
242
|
+
formatMessage
|
|
243
|
+
}) })
|
|
244
|
+
] });
|
|
245
|
+
};
|
|
246
|
+
const EntryValidationPopover = ({
|
|
247
|
+
schema,
|
|
248
|
+
entry,
|
|
249
|
+
status,
|
|
250
|
+
action
|
|
251
|
+
}) => {
|
|
252
|
+
const { validate, isLoading } = unstable_useDocument(
|
|
253
|
+
{
|
|
254
|
+
collectionType: schema?.kind ?? "",
|
|
255
|
+
model: schema?.uid ?? ""
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
// useDocument makes a request to get more data about the entry, but we only want to have the validation function so we skip the request
|
|
259
|
+
skip: true
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
const errors = isLoading ? null : validate(entry);
|
|
263
|
+
const hasErrors = errors ? Object.keys(errors).length > 0 : false;
|
|
264
|
+
const contentTypeHasReviewWorkflow = schema?.hasReviewWorkflow ?? false;
|
|
265
|
+
const requiredStage = schema?.stageRequiredToPublish;
|
|
266
|
+
const entryStage = entry.strapi_stage;
|
|
267
|
+
if (isLoading) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { children: [
|
|
271
|
+
/* @__PURE__ */ jsx(
|
|
272
|
+
EntryStatusTrigger,
|
|
273
|
+
{
|
|
274
|
+
action,
|
|
275
|
+
status,
|
|
276
|
+
hasErrors,
|
|
277
|
+
requiredStage,
|
|
278
|
+
entryStage
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ jsx(Popover.Content, { children: /* @__PURE__ */ jsxs(StyledPopoverFlex, { direction: "column", children: [
|
|
282
|
+
/* @__PURE__ */ jsx(
|
|
283
|
+
FieldsValidation,
|
|
284
|
+
{
|
|
285
|
+
hasErrors,
|
|
286
|
+
errors,
|
|
287
|
+
contentTypeUid: schema?.uid,
|
|
288
|
+
kind: schema?.kind,
|
|
289
|
+
documentId: entry.documentId,
|
|
290
|
+
locale: entry.locale
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
/* @__PURE__ */ jsx(
|
|
294
|
+
ReviewStageValidation,
|
|
295
|
+
{
|
|
296
|
+
contentTypeHasReviewWorkflow,
|
|
297
|
+
requiredStage,
|
|
298
|
+
entryStage
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
] }) })
|
|
302
|
+
] });
|
|
303
|
+
};
|
|
19
304
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
|
20
305
|
const RelativeTime$1 = React.forwardRef(
|
|
21
306
|
({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
|
|
@@ -286,7 +571,7 @@ const useTypedDispatch = useDispatch;
|
|
|
286
571
|
const isBaseQueryError = (error) => {
|
|
287
572
|
return typeof error !== "undefined" && error.name !== void 0;
|
|
288
573
|
};
|
|
289
|
-
const LinkCard = styled(Link)`
|
|
574
|
+
const LinkCard = styled(Link$1)`
|
|
290
575
|
display: block;
|
|
291
576
|
`;
|
|
292
577
|
const RelativeTime = styled(RelativeTime$1)`
|
|
@@ -498,7 +783,7 @@ const ReleasesPage = () => {
|
|
|
498
783
|
StyledAlert,
|
|
499
784
|
{
|
|
500
785
|
marginBottom: 6,
|
|
501
|
-
action: /* @__PURE__ */ jsx(Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
786
|
+
action: /* @__PURE__ */ jsx(Link$1, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
502
787
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
503
788
|
defaultMessage: "Explore plans"
|
|
504
789
|
}) }),
|
|
@@ -622,105 +907,6 @@ const TrashIcon = styled(Trash)`
|
|
|
622
907
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
623
908
|
}
|
|
624
909
|
`;
|
|
625
|
-
const TypographyMaxWidth = styled(Typography)`
|
|
626
|
-
max-width: 300px;
|
|
627
|
-
`;
|
|
628
|
-
const EntryValidationText = ({ action, schema, entry, status }) => {
|
|
629
|
-
const { formatMessage } = useIntl();
|
|
630
|
-
const { validate, isLoading } = unstable_useDocument(
|
|
631
|
-
{
|
|
632
|
-
collectionType: schema?.kind ?? "",
|
|
633
|
-
model: schema?.uid ?? ""
|
|
634
|
-
},
|
|
635
|
-
{
|
|
636
|
-
// useDocument makes a request to get more data about the entry, but we only want to have the validation function so we skip the request
|
|
637
|
-
skip: true
|
|
638
|
-
}
|
|
639
|
-
);
|
|
640
|
-
const errorsToString = (errors2, prefix = "") => {
|
|
641
|
-
if (Object.keys(errors2).length === 0) {
|
|
642
|
-
return "";
|
|
643
|
-
}
|
|
644
|
-
return Object.entries(errors2).map(([key, value]) => {
|
|
645
|
-
if (value === void 0 || value === null) {
|
|
646
|
-
return "";
|
|
647
|
-
}
|
|
648
|
-
if (typeof value === "string") {
|
|
649
|
-
return formatMessage(
|
|
650
|
-
{ id: value, defaultMessage: value },
|
|
651
|
-
{ field: prefix ? `${prefix}.${key}` : key }
|
|
652
|
-
);
|
|
653
|
-
}
|
|
654
|
-
if (typeof value === "object" && value !== null && "id" in value && "defaultMessage" in value) {
|
|
655
|
-
return formatMessage(
|
|
656
|
-
// @ts-expect-error – TODO: default message will be a string
|
|
657
|
-
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
658
|
-
{ field: prefix ? `${prefix}.${key}` : key }
|
|
659
|
-
);
|
|
660
|
-
}
|
|
661
|
-
return errorsToString(value, key);
|
|
662
|
-
}).join(" ");
|
|
663
|
-
};
|
|
664
|
-
if (isLoading) {
|
|
665
|
-
return null;
|
|
666
|
-
}
|
|
667
|
-
const errors = validate(entry) ?? {};
|
|
668
|
-
if (action === "publish") {
|
|
669
|
-
if (Object.keys(errors).length > 0) {
|
|
670
|
-
const validationErrorsMessages = errorsToString(errors);
|
|
671
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
672
|
-
/* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }),
|
|
673
|
-
/* @__PURE__ */ jsx(Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsx(
|
|
674
|
-
TypographyMaxWidth,
|
|
675
|
-
{
|
|
676
|
-
textColor: "danger600",
|
|
677
|
-
variant: "omega",
|
|
678
|
-
fontWeight: "semiBold",
|
|
679
|
-
ellipsis: true,
|
|
680
|
-
children: validationErrorsMessages
|
|
681
|
-
}
|
|
682
|
-
) })
|
|
683
|
-
] });
|
|
684
|
-
}
|
|
685
|
-
if (status === "draft") {
|
|
686
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
687
|
-
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
688
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
689
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
690
|
-
defaultMessage: "Ready to publish"
|
|
691
|
-
}) })
|
|
692
|
-
] });
|
|
693
|
-
}
|
|
694
|
-
if (status === "modified") {
|
|
695
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
696
|
-
/* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
697
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
698
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
699
|
-
defaultMessage: "Ready to publish changes"
|
|
700
|
-
}) })
|
|
701
|
-
] });
|
|
702
|
-
}
|
|
703
|
-
if (status === "published") {
|
|
704
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
705
|
-
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
706
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
707
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
|
|
708
|
-
defaultMessage: "Already published"
|
|
709
|
-
}) })
|
|
710
|
-
] });
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
714
|
-
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
715
|
-
!entry.publishedAt ? /* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
716
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
717
|
-
defaultMessage: "Already unpublished"
|
|
718
|
-
}) }) : /* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
719
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
|
|
720
|
-
defaultMessage: "Ready to unpublish"
|
|
721
|
-
}) })
|
|
722
|
-
] });
|
|
723
|
-
};
|
|
724
910
|
const ReleaseDetailsLayout = ({
|
|
725
911
|
toggleEditReleaseModal,
|
|
726
912
|
toggleWarningSubmit,
|
|
@@ -1041,7 +1227,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1041
1227
|
const releaseActions = data?.data;
|
|
1042
1228
|
const releaseMeta = data?.meta;
|
|
1043
1229
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1044
|
-
|
|
1230
|
+
releaseMeta?.components || {};
|
|
1045
1231
|
if (isBaseQueryError(releaseError) || !release) {
|
|
1046
1232
|
const errorsArray = [];
|
|
1047
1233
|
if (releaseError && "code" in releaseError) {
|
|
@@ -1074,7 +1260,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1074
1260
|
action: /* @__PURE__ */ jsx(
|
|
1075
1261
|
LinkButton,
|
|
1076
1262
|
{
|
|
1077
|
-
tag: Link
|
|
1263
|
+
tag: Link,
|
|
1078
1264
|
to: {
|
|
1079
1265
|
pathname: "/content-manager"
|
|
1080
1266
|
},
|
|
@@ -1184,11 +1370,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1184
1370
|
) }),
|
|
1185
1371
|
!release.releasedAt && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1186
1372
|
/* @__PURE__ */ jsx(Td, { width: "20%", minWidth: "200px", children: /* @__PURE__ */ jsx(
|
|
1187
|
-
|
|
1373
|
+
EntryValidationPopover,
|
|
1188
1374
|
{
|
|
1189
1375
|
action: type,
|
|
1190
1376
|
schema: contentTypes?.[contentType.uid],
|
|
1191
|
-
components,
|
|
1192
1377
|
entry,
|
|
1193
1378
|
status
|
|
1194
1379
|
}
|
|
@@ -1371,4 +1556,4 @@ const App = () => {
|
|
|
1371
1556
|
export {
|
|
1372
1557
|
App
|
|
1373
1558
|
};
|
|
1374
|
-
//# sourceMappingURL=App-
|
|
1559
|
+
//# sourceMappingURL=App-BX6_LcmS.mjs.map
|