@strapi/content-releases 0.0.0-next.f5312617ca16b870c2bf1adcea2c69b676979e29 → 0.0.0-next.f698d55751345c4ca87477ef683475c1a68f310a
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-Cx72FM22.mjs} +299 -115
- package/dist/_chunks/App-Cx72FM22.mjs.map +1 -0
- package/dist/_chunks/{App-BKB1esYS.js → App-DyjVixKE.js} +340 -157
- package/dist/_chunks/App-DyjVixKE.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Be3acS2L.js → PurchaseContentReleases-BJlgTIuR.js} +2 -2
- package/dist/_chunks/PurchaseContentReleases-BJlgTIuR.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-_MxP6-Dt.mjs → PurchaseContentReleases-CIiBmOhI.mjs} +2 -2
- package/dist/_chunks/{PurchaseContentReleases-_MxP6-Dt.mjs.map → PurchaseContentReleases-CIiBmOhI.mjs.map} +1 -1
- package/dist/_chunks/{ReleasesSettingsPage-C1WwGWIH.mjs → ReleasesSettingsPage-9si_53C5.mjs} +2 -2
- package/dist/_chunks/{ReleasesSettingsPage-C1WwGWIH.mjs.map → ReleasesSettingsPage-9si_53C5.mjs.map} +1 -1
- package/dist/_chunks/{ReleasesSettingsPage-kuXIwpWp.js → ReleasesSettingsPage-FsXF_FuJ.js} +3 -3
- package/dist/_chunks/{ReleasesSettingsPage-kuXIwpWp.js.map → ReleasesSettingsPage-FsXF_FuJ.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-CVj5EFQC.mjs} +33 -9
- package/dist/_chunks/index-CVj5EFQC.mjs.map +1 -0
- package/dist/_chunks/{index-5Odi61vw.js → index-CpTN5TdF.js} +34 -11
- package/dist/_chunks/index-CpTN5TdF.js.map +1 -0
- package/dist/_chunks/{schemas-BE1LxE9J.js → schemas-DBYv9gK8.js} +2 -3
- package/dist/_chunks/{schemas-BE1LxE9J.js.map → schemas-DBYv9gK8.js.map} +1 -1
- package/dist/_chunks/schemas-DdA2ic2U.mjs.map +1 -1
- 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 +73 -8
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +72 -6
- 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 +12 -11
- package/dist/_chunks/App-BKB1esYS.js.map +0 -1
- package/dist/_chunks/App-Cne--1Z8.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.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-CVj5EFQC.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) => {
|
|
@@ -61,8 +346,7 @@ const ReleaseModal = ({
|
|
|
61
346
|
);
|
|
62
347
|
const getScheduledTimestamp = (values) => {
|
|
63
348
|
const { date, time, timezone } = values;
|
|
64
|
-
if (!date || !time || !timezone)
|
|
65
|
-
return null;
|
|
349
|
+
if (!date || !time || !timezone) return null;
|
|
66
350
|
const timezoneWithoutOffset = timezone.split("&")[1];
|
|
67
351
|
return zonedTimeToUtc(`${date} ${time}`, timezoneWithoutOffset);
|
|
68
352
|
};
|
|
@@ -286,7 +570,7 @@ const useTypedDispatch = useDispatch;
|
|
|
286
570
|
const isBaseQueryError = (error) => {
|
|
287
571
|
return typeof error !== "undefined" && error.name !== void 0;
|
|
288
572
|
};
|
|
289
|
-
const LinkCard = styled(Link)`
|
|
573
|
+
const LinkCard = styled(Link$1)`
|
|
290
574
|
display: block;
|
|
291
575
|
`;
|
|
292
576
|
const RelativeTime = styled(RelativeTime$1)`
|
|
@@ -498,7 +782,7 @@ const ReleasesPage = () => {
|
|
|
498
782
|
StyledAlert,
|
|
499
783
|
{
|
|
500
784
|
marginBottom: 6,
|
|
501
|
-
action: /* @__PURE__ */ jsx(Link, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
785
|
+
action: /* @__PURE__ */ jsx(Link$1, { href: "https://strapi.io/pricing-cloud", isExternal: true, children: formatMessage({
|
|
502
786
|
id: "content-releases.pages.Releases.max-limit-reached.action",
|
|
503
787
|
defaultMessage: "Explore plans"
|
|
504
788
|
}) }),
|
|
@@ -622,105 +906,6 @@ const TrashIcon = styled(Trash)`
|
|
|
622
906
|
fill: ${({ theme }) => theme.colors.danger600};
|
|
623
907
|
}
|
|
624
908
|
`;
|
|
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
909
|
const ReleaseDetailsLayout = ({
|
|
725
910
|
toggleEditReleaseModal,
|
|
726
911
|
toggleWarningSubmit,
|
|
@@ -852,7 +1037,7 @@ const ReleaseDetailsLayout = ({
|
|
|
852
1037
|
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
853
1038
|
/* @__PURE__ */ jsx(Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
854
1039
|
] }),
|
|
855
|
-
navigationAction: /* @__PURE__ */ jsx(BackButton, {}),
|
|
1040
|
+
navigationAction: /* @__PURE__ */ jsx(BackButton, { fallback: ".." }),
|
|
856
1041
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
857
1042
|
/* @__PURE__ */ jsxs(
|
|
858
1043
|
SimpleMenuButton,
|
|
@@ -1041,7 +1226,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1041
1226
|
const releaseActions = data?.data;
|
|
1042
1227
|
const releaseMeta = data?.meta;
|
|
1043
1228
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1044
|
-
|
|
1229
|
+
releaseMeta?.components || {};
|
|
1045
1230
|
if (isBaseQueryError(releaseError) || !release) {
|
|
1046
1231
|
const errorsArray = [];
|
|
1047
1232
|
if (releaseError && "code" in releaseError) {
|
|
@@ -1074,7 +1259,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1074
1259
|
action: /* @__PURE__ */ jsx(
|
|
1075
1260
|
LinkButton,
|
|
1076
1261
|
{
|
|
1077
|
-
tag: Link
|
|
1262
|
+
tag: Link,
|
|
1078
1263
|
to: {
|
|
1079
1264
|
pathname: "/content-manager"
|
|
1080
1265
|
},
|
|
@@ -1184,11 +1369,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1184
1369
|
) }),
|
|
1185
1370
|
!release.releasedAt && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1186
1371
|
/* @__PURE__ */ jsx(Td, { width: "20%", minWidth: "200px", children: /* @__PURE__ */ jsx(
|
|
1187
|
-
|
|
1372
|
+
EntryValidationPopover,
|
|
1188
1373
|
{
|
|
1189
1374
|
action: type,
|
|
1190
1375
|
schema: contentTypes?.[contentType.uid],
|
|
1191
|
-
components,
|
|
1192
1376
|
entry,
|
|
1193
1377
|
status
|
|
1194
1378
|
}
|
|
@@ -1371,4 +1555,4 @@ const App = () => {
|
|
|
1371
1555
|
export {
|
|
1372
1556
|
App
|
|
1373
1557
|
};
|
|
1374
|
-
//# sourceMappingURL=App-
|
|
1558
|
+
//# sourceMappingURL=App-Cx72FM22.mjs.map
|