@strapi/content-releases 0.0.0-experimental.da85533897155e719d784f0271223c866d2f69ab → 0.0.0-experimental.dad3c50630ca4fd9eccdcbe549ee632fc572e23d
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-B4mkcLmw.mjs → App-CiZCkScI.mjs} +304 -102
- package/dist/_chunks/App-CiZCkScI.mjs.map +1 -0
- package/dist/_chunks/{App-DpoC8s97.js → App-SGjO5UPV.js} +344 -143
- package/dist/_chunks/App-SGjO5UPV.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Be3acS2L.js → PurchaseContentReleases--qQepXpP.js} +2 -2
- package/dist/_chunks/PurchaseContentReleases--qQepXpP.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-_MxP6-Dt.mjs → PurchaseContentReleases-D-n-w-st.mjs} +2 -2
- package/dist/_chunks/{PurchaseContentReleases-_MxP6-Dt.mjs.map → PurchaseContentReleases-D-n-w-st.mjs.map} +1 -1
- package/dist/_chunks/{ReleasesSettingsPage-B89WWWJf.js → ReleasesSettingsPage-Cto_NLUd.js} +3 -3
- package/dist/_chunks/{ReleasesSettingsPage-B89WWWJf.js.map → ReleasesSettingsPage-Cto_NLUd.js.map} +1 -1
- package/dist/_chunks/{ReleasesSettingsPage-DfL6yxLG.mjs → ReleasesSettingsPage-DQT8N3A-.mjs} +3 -3
- package/dist/_chunks/{ReleasesSettingsPage-DfL6yxLG.mjs.map → ReleasesSettingsPage-DQT8N3A-.mjs.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-B3cqcIza.mjs → index-BjvFfTtA.mjs} +68 -24
- package/dist/_chunks/index-BjvFfTtA.mjs.map +1 -0
- package/dist/_chunks/{index-sGcuP2hw.js → index-CyU534vL.js} +69 -26
- package/dist/_chunks/index-CyU534vL.js.map +1 -0
- package/dist/_chunks/{schemas-z5zp-_Gd.js → schemas-DBYv9gK8.js} +3 -4
- package/dist/_chunks/schemas-DBYv9gK8.js.map +1 -0
- package/dist/_chunks/{schemas-63pFihNF.mjs → schemas-DdA2ic2U.mjs} +2 -2
- package/dist/_chunks/schemas-DdA2ic2U.mjs.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/admin/src/services/release.d.ts +28 -28
- package/dist/server/index.js +119 -17
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +118 -15
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/release.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +4 -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/migrations/database/5.0.0-document-id-in-actions.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -6
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/release-action.d.ts +6 -8
- 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 +18 -16
- package/dist/_chunks/App-B4mkcLmw.mjs.map +0 -1
- package/dist/_chunks/App-DpoC8s97.js.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-B3cqcIza.mjs.map +0 -1
- package/dist/_chunks/index-sGcuP2hw.js.map +0 -1
- package/dist/_chunks/schemas-63pFihNF.mjs.map +0 -1
- package/dist/_chunks/schemas-z5zp-_Gd.js.map +0 -1
- package/strapi-server.js +0 -3
|
@@ -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-BjvFfTtA.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
|
-
import { R as RELEASE_SCHEMA } from "./schemas-
|
|
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
|
}) }),
|
|
@@ -609,100 +893,19 @@ const StyledMenuItem = styled(MenuItem)`
|
|
|
609
893
|
}
|
|
610
894
|
`;
|
|
611
895
|
const PencilIcon = styled(Pencil)`
|
|
612
|
-
width: ${({ theme }) => theme.spaces[
|
|
613
|
-
height: ${({ theme }) => theme.spaces[
|
|
896
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
897
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
614
898
|
path {
|
|
615
899
|
fill: ${({ theme }) => theme.colors.neutral600};
|
|
616
900
|
}
|
|
617
901
|
`;
|
|
618
902
|
const TrashIcon = styled(Trash)`
|
|
619
|
-
width: ${({ theme }) => theme.spaces[
|
|
620
|
-
height: ${({ theme }) => theme.spaces[
|
|
903
|
+
width: ${({ theme }) => theme.spaces[4]};
|
|
904
|
+
height: ${({ theme }) => theme.spaces[4]};
|
|
621
905
|
path {
|
|
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
|
-
if (isLoading) {
|
|
641
|
-
return null;
|
|
642
|
-
}
|
|
643
|
-
const errors = validate(entry) ?? {};
|
|
644
|
-
if (action === "publish") {
|
|
645
|
-
if (Object.keys(errors).length > 0) {
|
|
646
|
-
const validationErrorsMessages = Object.entries(errors).map(
|
|
647
|
-
([key, value]) => formatMessage(
|
|
648
|
-
// @ts-expect-error – TODO: fix this will better checks
|
|
649
|
-
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
650
|
-
{ field: key }
|
|
651
|
-
)
|
|
652
|
-
).join(" ");
|
|
653
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
654
|
-
/* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }),
|
|
655
|
-
/* @__PURE__ */ jsx(Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsx(
|
|
656
|
-
TypographyMaxWidth,
|
|
657
|
-
{
|
|
658
|
-
textColor: "danger600",
|
|
659
|
-
variant: "omega",
|
|
660
|
-
fontWeight: "semiBold",
|
|
661
|
-
ellipsis: true,
|
|
662
|
-
children: validationErrorsMessages
|
|
663
|
-
}
|
|
664
|
-
) })
|
|
665
|
-
] });
|
|
666
|
-
}
|
|
667
|
-
if (status === "draft") {
|
|
668
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
669
|
-
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
670
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
671
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
|
|
672
|
-
defaultMessage: "Ready to publish"
|
|
673
|
-
}) })
|
|
674
|
-
] });
|
|
675
|
-
}
|
|
676
|
-
if (status === "modified") {
|
|
677
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
678
|
-
/* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
|
|
679
|
-
/* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
680
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
|
|
681
|
-
defaultMessage: "Ready to publish changes"
|
|
682
|
-
}) })
|
|
683
|
-
] });
|
|
684
|
-
}
|
|
685
|
-
if (status === "published") {
|
|
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.already-published",
|
|
690
|
-
defaultMessage: "Already published"
|
|
691
|
-
}) })
|
|
692
|
-
] });
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
696
|
-
/* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
|
|
697
|
-
!entry.publishedAt ? /* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
|
|
698
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
|
|
699
|
-
defaultMessage: "Already unpublished"
|
|
700
|
-
}) }) : /* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
701
|
-
id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
|
|
702
|
-
defaultMessage: "Ready to unpublish"
|
|
703
|
-
}) })
|
|
704
|
-
] });
|
|
705
|
-
};
|
|
706
909
|
const ReleaseDetailsLayout = ({
|
|
707
910
|
toggleEditReleaseModal,
|
|
708
911
|
toggleWarningSubmit,
|
|
@@ -834,7 +1037,7 @@ const ReleaseDetailsLayout = ({
|
|
|
834
1037
|
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
|
|
835
1038
|
/* @__PURE__ */ jsx(Badge, { ...getBadgeProps(release.status), children: release.status })
|
|
836
1039
|
] }),
|
|
837
|
-
navigationAction: /* @__PURE__ */ jsx(BackButton, {}),
|
|
1040
|
+
navigationAction: /* @__PURE__ */ jsx(BackButton, { fallback: ".." }),
|
|
838
1041
|
primaryAction: !release.releasedAt && /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
839
1042
|
/* @__PURE__ */ jsxs(
|
|
840
1043
|
SimpleMenuButton,
|
|
@@ -1023,7 +1226,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1023
1226
|
const releaseActions = data?.data;
|
|
1024
1227
|
const releaseMeta = data?.meta;
|
|
1025
1228
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1026
|
-
|
|
1229
|
+
releaseMeta?.components || {};
|
|
1027
1230
|
if (isBaseQueryError(releaseError) || !release) {
|
|
1028
1231
|
const errorsArray = [];
|
|
1029
1232
|
if (releaseError && "code" in releaseError) {
|
|
@@ -1056,7 +1259,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1056
1259
|
action: /* @__PURE__ */ jsx(
|
|
1057
1260
|
LinkButton,
|
|
1058
1261
|
{
|
|
1059
|
-
tag: Link
|
|
1262
|
+
tag: Link,
|
|
1060
1263
|
to: {
|
|
1061
1264
|
pathname: "/content-manager"
|
|
1062
1265
|
},
|
|
@@ -1166,11 +1369,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1166
1369
|
) }),
|
|
1167
1370
|
!release.releasedAt && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1168
1371
|
/* @__PURE__ */ jsx(Td, { width: "20%", minWidth: "200px", children: /* @__PURE__ */ jsx(
|
|
1169
|
-
|
|
1372
|
+
EntryValidationPopover,
|
|
1170
1373
|
{
|
|
1171
1374
|
action: type,
|
|
1172
1375
|
schema: contentTypes?.[contentType.uid],
|
|
1173
|
-
components,
|
|
1174
1376
|
entry,
|
|
1175
1377
|
status
|
|
1176
1378
|
}
|
|
@@ -1353,4 +1555,4 @@ const App = () => {
|
|
|
1353
1555
|
export {
|
|
1354
1556
|
App
|
|
1355
1557
|
};
|
|
1356
|
-
//# sourceMappingURL=App-
|
|
1558
|
+
//# sourceMappingURL=App-CiZCkScI.mjs.map
|