@strapi/content-releases 5.2.0 → 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.
Files changed (40) hide show
  1. package/dist/_chunks/{App-Cne--1Z8.mjs → App-BX6_LcmS.mjs} +297 -112
  2. package/dist/_chunks/App-BX6_LcmS.mjs.map +1 -0
  3. package/dist/_chunks/{App-BKB1esYS.js → App-DITZWWqI.js} +337 -152
  4. package/dist/_chunks/App-DITZWWqI.js.map +1 -0
  5. package/dist/_chunks/{ReleasesSettingsPage-C1WwGWIH.mjs → ReleasesSettingsPage-BMgLwqci.mjs} +2 -2
  6. package/dist/_chunks/{ReleasesSettingsPage-C1WwGWIH.mjs.map → ReleasesSettingsPage-BMgLwqci.mjs.map} +1 -1
  7. package/dist/_chunks/{ReleasesSettingsPage-kuXIwpWp.js → ReleasesSettingsPage-DZcRvN_O.js} +2 -2
  8. package/dist/_chunks/{ReleasesSettingsPage-kuXIwpWp.js.map → ReleasesSettingsPage-DZcRvN_O.js.map} +1 -1
  9. package/dist/_chunks/{en-CmYoEnA7.js → en-BWPPsSH-.js} +11 -2
  10. package/dist/_chunks/en-BWPPsSH-.js.map +1 -0
  11. package/dist/_chunks/{en-D0yVZFqf.mjs → en-D9Q4YW03.mjs} +11 -2
  12. package/dist/_chunks/en-D9Q4YW03.mjs.map +1 -0
  13. package/dist/_chunks/{index-Cy7qwpaU.mjs → index-CBsSVKTv.mjs} +22 -4
  14. package/dist/_chunks/index-CBsSVKTv.mjs.map +1 -0
  15. package/dist/_chunks/{index-5Odi61vw.js → index-TfMp19WL.js} +22 -4
  16. package/dist/_chunks/index-TfMp19WL.js.map +1 -0
  17. package/dist/admin/index.js +1 -1
  18. package/dist/admin/index.mjs +1 -1
  19. package/dist/admin/src/components/EntryValidationPopover.d.ts +13 -0
  20. package/dist/server/index.js +72 -6
  21. package/dist/server/index.js.map +1 -1
  22. package/dist/server/index.mjs +72 -6
  23. package/dist/server/index.mjs.map +1 -1
  24. package/dist/server/src/index.d.ts +2 -6
  25. package/dist/server/src/index.d.ts.map +1 -1
  26. package/dist/server/src/middlewares/documents.d.ts.map +1 -1
  27. package/dist/server/src/services/index.d.ts +2 -6
  28. package/dist/server/src/services/index.d.ts.map +1 -1
  29. package/dist/server/src/services/release-action.d.ts +3 -7
  30. package/dist/server/src/services/release-action.d.ts.map +1 -1
  31. package/dist/server/src/utils/index.d.ts.map +1 -1
  32. package/dist/shared/contracts/release-actions.d.ts +8 -1
  33. package/dist/shared/contracts/release-actions.d.ts.map +1 -1
  34. package/package.json +11 -10
  35. package/dist/_chunks/App-BKB1esYS.js.map +0 -1
  36. package/dist/_chunks/App-Cne--1Z8.mjs.map +0 -1
  37. package/dist/_chunks/en-CmYoEnA7.js.map +0 -1
  38. package/dist/_chunks/en-D0yVZFqf.mjs.map +0 -1
  39. package/dist/_chunks/index-5Odi61vw.js.map +0 -1
  40. package/dist/_chunks/index-Cy7qwpaU.mjs.map +0 -1
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const strapiAdmin = require("@strapi/admin/strapi-admin");
4
+ const strapiAdmin$1 = require("@strapi/admin/strapi-admin");
5
5
  const reactRouterDom = require("react-router-dom");
6
- const index = require("./index-5Odi61vw.js");
6
+ const index = require("./index-TfMp19WL.js");
7
7
  const React = require("react");
8
- const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
9
8
  const designSystem = require("@strapi/design-system");
10
9
  const icons = require("@strapi/icons");
11
10
  const symbols = require("@strapi/icons/symbols");
@@ -13,6 +12,8 @@ const format = require("date-fns/format");
13
12
  const dateFnsTz = require("date-fns-tz");
14
13
  const reactIntl = require("react-intl");
15
14
  const styledComponents = require("styled-components");
15
+ const strapiAdmin = require("@strapi/content-manager/strapi-admin");
16
+ const qs = require("qs");
16
17
  const dateFns = require("date-fns");
17
18
  const formik = require("formik");
18
19
  const schemas = require("./schemas-BE1LxE9J.js");
@@ -39,6 +40,290 @@ function _interopNamespace(e) {
39
40
  }
40
41
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
41
42
  const format__default = /* @__PURE__ */ _interopDefault(format);
43
+ const StyledPopoverFlex = styledComponents.styled(designSystem.Flex)`
44
+ width: 100%;
45
+ max-width: 256px;
46
+
47
+ & > * {
48
+ border-bottom: 1px solid ${({ theme }) => theme.colors.neutral150};
49
+ }
50
+
51
+ & > *:last-child {
52
+ border-bottom: none;
53
+ }
54
+ `;
55
+ const EntryStatusTrigger = ({
56
+ action,
57
+ status,
58
+ hasErrors,
59
+ requiredStage,
60
+ entryStage
61
+ }) => {
62
+ const { formatMessage } = reactIntl.useIntl();
63
+ if (action === "publish") {
64
+ if (hasErrors || requiredStage && requiredStage.id !== entryStage?.id) {
65
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
66
+ designSystem.Button,
67
+ {
68
+ variant: "ghost",
69
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
70
+ endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}),
71
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", fontWeight: "bold", children: formatMessage({
72
+ id: "content-releases.pages.ReleaseDetails.entry-validation.not-ready",
73
+ defaultMessage: "Not ready to publish"
74
+ }) })
75
+ }
76
+ ) });
77
+ }
78
+ if (status === "draft") {
79
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
80
+ designSystem.Button,
81
+ {
82
+ variant: "ghost",
83
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
84
+ endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}),
85
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
86
+ id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
87
+ defaultMessage: "Ready to publish"
88
+ }) })
89
+ }
90
+ ) });
91
+ }
92
+ if (status === "modified") {
93
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
94
+ designSystem.Button,
95
+ {
96
+ variant: "ghost",
97
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
98
+ endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}),
99
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", textColor: "alternative600", children: formatMessage({
100
+ id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
101
+ defaultMessage: "Ready to publish changes"
102
+ }) })
103
+ }
104
+ ) });
105
+ }
106
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
107
+ designSystem.Button,
108
+ {
109
+ variant: "ghost",
110
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
111
+ endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}),
112
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
113
+ id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
114
+ defaultMessage: "Already published"
115
+ }) })
116
+ }
117
+ ) });
118
+ }
119
+ if (status === "published") {
120
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
121
+ designSystem.Button,
122
+ {
123
+ variant: "ghost",
124
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
125
+ endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}),
126
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
127
+ id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
128
+ defaultMessage: "Ready to unpublish"
129
+ }) })
130
+ }
131
+ ) });
132
+ }
133
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "ghost", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }), endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.CaretDown, {}), children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", variant: "omega", fontWeight: "bold", children: formatMessage({
134
+ id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
135
+ defaultMessage: "Already unpublished"
136
+ }) }) }) });
137
+ };
138
+ const FieldsValidation = ({
139
+ hasErrors,
140
+ errors,
141
+ kind,
142
+ contentTypeUid,
143
+ documentId,
144
+ locale
145
+ }) => {
146
+ const { formatMessage } = reactIntl.useIntl();
147
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, width: "100%", padding: 5, children: [
148
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, width: "100%", children: [
149
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
150
+ id: "content-releases.pages.ReleaseDetails.entry-validation.fields",
151
+ defaultMessage: "Fields"
152
+ }) }),
153
+ hasErrors ? /* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" })
154
+ ] }),
155
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { width: "100%", textColor: "neutral600", children: hasErrors ? formatMessage(
156
+ {
157
+ id: "content-releases.pages.ReleaseDetails.entry-validation.fields.error",
158
+ defaultMessage: "{errors} errors on fields."
159
+ },
160
+ { errors: errors ? Object.keys(errors).length : 0 }
161
+ ) : formatMessage({
162
+ id: "content-releases.pages.ReleaseDetails.entry-validation.fields.success",
163
+ defaultMessage: "All fields are filled correctly."
164
+ }) }),
165
+ hasErrors && /* @__PURE__ */ jsxRuntime.jsx(
166
+ designSystem.LinkButton,
167
+ {
168
+ tag: reactRouterDom.Link,
169
+ to: {
170
+ pathname: `/content-manager/${kind === "collectionType" ? "collection-types" : "single-types"}/${contentTypeUid}/${documentId}`,
171
+ search: locale ? qs.stringify({
172
+ plugins: {
173
+ i18n: {
174
+ locale
175
+ }
176
+ }
177
+ }) : ""
178
+ },
179
+ variant: "secondary",
180
+ fullWidth: true,
181
+ state: { forceValidation: true },
182
+ children: formatMessage({
183
+ id: "content-releases.pages.ReleaseDetails.entry-validation.fields.see-errors",
184
+ defaultMessage: "See errors"
185
+ })
186
+ }
187
+ )
188
+ ] });
189
+ };
190
+ const getReviewStageIcon = ({
191
+ contentTypeHasReviewWorkflow,
192
+ requiredStage,
193
+ entryStage
194
+ }) => {
195
+ if (!contentTypeHasReviewWorkflow) {
196
+ return /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "neutral200" });
197
+ }
198
+ if (requiredStage && requiredStage.id !== entryStage?.id) {
199
+ return /* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" });
200
+ }
201
+ return /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" });
202
+ };
203
+ const getReviewStageMessage = ({
204
+ contentTypeHasReviewWorkflow,
205
+ requiredStage,
206
+ entryStage,
207
+ formatMessage
208
+ }) => {
209
+ if (!contentTypeHasReviewWorkflow) {
210
+ return formatMessage({
211
+ id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.not-enabled",
212
+ defaultMessage: "This entry is not associated to any workflow."
213
+ });
214
+ }
215
+ if (requiredStage && requiredStage.id !== entryStage?.id) {
216
+ return formatMessage(
217
+ {
218
+ id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.not-ready",
219
+ defaultMessage: "This entry is not at the required stage for publishing. ({stageName})"
220
+ },
221
+ {
222
+ stageName: requiredStage?.name ?? ""
223
+ }
224
+ );
225
+ }
226
+ if (requiredStage && requiredStage.id === entryStage?.id) {
227
+ return formatMessage(
228
+ {
229
+ id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.ready",
230
+ defaultMessage: "This entry is at the required stage for publishing. ({stageName})"
231
+ },
232
+ {
233
+ stageName: requiredStage?.name ?? ""
234
+ }
235
+ );
236
+ }
237
+ return formatMessage({
238
+ id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.stage-not-required",
239
+ defaultMessage: "No required stage for publication"
240
+ });
241
+ };
242
+ const ReviewStageValidation = ({
243
+ contentTypeHasReviewWorkflow,
244
+ requiredStage,
245
+ entryStage
246
+ }) => {
247
+ const { formatMessage } = reactIntl.useIntl();
248
+ const Icon = getReviewStageIcon({
249
+ contentTypeHasReviewWorkflow,
250
+ requiredStage,
251
+ entryStage
252
+ });
253
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, width: "100%", padding: 5, children: [
254
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, width: "100%", children: [
255
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
256
+ id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage",
257
+ defaultMessage: "Review stage"
258
+ }) }),
259
+ Icon
260
+ ] }),
261
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: getReviewStageMessage({
262
+ contentTypeHasReviewWorkflow,
263
+ requiredStage,
264
+ entryStage,
265
+ formatMessage
266
+ }) })
267
+ ] });
268
+ };
269
+ const EntryValidationPopover = ({
270
+ schema,
271
+ entry,
272
+ status,
273
+ action
274
+ }) => {
275
+ const { validate, isLoading } = strapiAdmin.unstable_useDocument(
276
+ {
277
+ collectionType: schema?.kind ?? "",
278
+ model: schema?.uid ?? ""
279
+ },
280
+ {
281
+ // 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
282
+ skip: true
283
+ }
284
+ );
285
+ const errors = isLoading ? null : validate(entry);
286
+ const hasErrors = errors ? Object.keys(errors).length > 0 : false;
287
+ const contentTypeHasReviewWorkflow = schema?.hasReviewWorkflow ?? false;
288
+ const requiredStage = schema?.stageRequiredToPublish;
289
+ const entryStage = entry.strapi_stage;
290
+ if (isLoading) {
291
+ return null;
292
+ }
293
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { children: [
294
+ /* @__PURE__ */ jsxRuntime.jsx(
295
+ EntryStatusTrigger,
296
+ {
297
+ action,
298
+ status,
299
+ hasErrors,
300
+ requiredStage,
301
+ entryStage
302
+ }
303
+ ),
304
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(StyledPopoverFlex, { direction: "column", children: [
305
+ /* @__PURE__ */ jsxRuntime.jsx(
306
+ FieldsValidation,
307
+ {
308
+ hasErrors,
309
+ errors,
310
+ contentTypeUid: schema?.uid,
311
+ kind: schema?.kind,
312
+ documentId: entry.documentId,
313
+ locale: entry.locale
314
+ }
315
+ ),
316
+ /* @__PURE__ */ jsxRuntime.jsx(
317
+ ReviewStageValidation,
318
+ {
319
+ contentTypeHasReviewWorkflow,
320
+ requiredStage,
321
+ entryStage
322
+ }
323
+ )
324
+ ] }) })
325
+ ] });
326
+ };
42
327
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
43
328
  const RelativeTime$1 = React__namespace.forwardRef(
44
329
  ({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
@@ -346,7 +631,7 @@ const getBadgeProps = (status) => {
346
631
  const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
347
632
  const { formatMessage } = reactIntl.useIntl();
348
633
  if (isError) {
349
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
634
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Error, {});
350
635
  }
351
636
  if (releases?.length === 0) {
352
637
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -410,20 +695,20 @@ const INITIAL_FORM_VALUES = {
410
695
  const ReleasesPage = () => {
411
696
  const location = reactRouterDom.useLocation();
412
697
  const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
413
- const { toggleNotification } = strapiAdmin.useNotification();
698
+ const { toggleNotification } = strapiAdmin$1.useNotification();
414
699
  const { formatMessage } = reactIntl.useIntl();
415
700
  const navigate = reactRouterDom.useNavigate();
416
- const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
417
- const [{ query }, setQuery] = strapiAdmin.useQueryParams();
701
+ const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
702
+ const [{ query }, setQuery] = strapiAdmin$1.useQueryParams();
418
703
  const response = index.useGetReleasesQuery(query);
419
704
  const { data, isLoading: isLoadingSettings } = index.useGetReleaseSettingsQuery();
420
705
  const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
421
706
  const { getFeature } = ee.useLicenseLimits();
422
707
  const { maximumReleases = 3 } = getFeature("cms-content-releases");
423
- const { trackUsage } = strapiAdmin.useTracking();
708
+ const { trackUsage } = strapiAdmin$1.useTracking();
424
709
  const {
425
710
  allowedActions: { canCreate }
426
- } = strapiAdmin.useRBAC(index.PERMISSIONS);
711
+ } = strapiAdmin$1.useRBAC(index.PERMISSIONS);
427
712
  const { isLoading: isLoadingReleases, isSuccess, isError } = response;
428
713
  const activeTab = response?.currentData?.meta?.activeTab || "pending";
429
714
  React__namespace.useEffect(() => {
@@ -446,7 +731,7 @@ const ReleasesPage = () => {
446
731
  setReleaseModalShown((prev) => !prev);
447
732
  };
448
733
  if (isLoadingReleases || isLoadingSettings) {
449
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
734
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {});
450
735
  }
451
736
  const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
452
737
  const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
@@ -478,7 +763,7 @@ const ReleasesPage = () => {
478
763
  });
479
764
  trackUsage("didCreateRelease");
480
765
  navigate(response2.data.data.id.toString());
481
- } else if (strapiAdmin.isFetchError(response2.error)) {
766
+ } else if (strapiAdmin$1.isFetchError(response2.error)) {
482
767
  toggleNotification({
483
768
  type: "danger",
484
769
  message: formatAPIError(response2.error)
@@ -492,7 +777,7 @@ const ReleasesPage = () => {
492
777
  };
493
778
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingReleases || isLoadingSettings, children: [
494
779
  /* @__PURE__ */ jsxRuntime.jsx(
495
- strapiAdmin.Layouts.Header,
780
+ strapiAdmin$1.Layouts.Header,
496
781
  {
497
782
  title: formatMessage({
498
783
  id: "content-releases.pages.Releases.title",
@@ -516,7 +801,7 @@ const ReleasesPage = () => {
516
801
  ) : null
517
802
  }
518
803
  ),
519
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
804
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
520
805
  hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
521
806
  StyledAlert,
522
807
  {
@@ -587,13 +872,13 @@ const ReleasesPage = () => {
587
872
  ) })
588
873
  ] }),
589
874
  /* @__PURE__ */ jsxRuntime.jsxs(
590
- strapiAdmin.Pagination.Root,
875
+ strapiAdmin$1.Pagination.Root,
591
876
  {
592
877
  ...response?.currentData?.meta?.pagination,
593
878
  defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
594
879
  children: [
595
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
596
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
880
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
881
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.Links, {})
597
882
  ]
598
883
  }
599
884
  )
@@ -645,105 +930,6 @@ const TrashIcon = styledComponents.styled(icons.Trash)`
645
930
  fill: ${({ theme }) => theme.colors.danger600};
646
931
  }
647
932
  `;
648
- const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
649
- max-width: 300px;
650
- `;
651
- const EntryValidationText = ({ action, schema, entry, status }) => {
652
- const { formatMessage } = reactIntl.useIntl();
653
- const { validate, isLoading } = strapiAdmin$1.unstable_useDocument(
654
- {
655
- collectionType: schema?.kind ?? "",
656
- model: schema?.uid ?? ""
657
- },
658
- {
659
- // 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
660
- skip: true
661
- }
662
- );
663
- const errorsToString = (errors2, prefix = "") => {
664
- if (Object.keys(errors2).length === 0) {
665
- return "";
666
- }
667
- return Object.entries(errors2).map(([key, value]) => {
668
- if (value === void 0 || value === null) {
669
- return "";
670
- }
671
- if (typeof value === "string") {
672
- return formatMessage(
673
- { id: value, defaultMessage: value },
674
- { field: prefix ? `${prefix}.${key}` : key }
675
- );
676
- }
677
- if (typeof value === "object" && value !== null && "id" in value && "defaultMessage" in value) {
678
- return formatMessage(
679
- // @ts-expect-error – TODO: default message will be a string
680
- { id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
681
- { field: prefix ? `${prefix}.${key}` : key }
682
- );
683
- }
684
- return errorsToString(value, key);
685
- }).join(" ");
686
- };
687
- if (isLoading) {
688
- return null;
689
- }
690
- const errors = validate(entry) ?? {};
691
- if (action === "publish") {
692
- if (Object.keys(errors).length > 0) {
693
- const validationErrorsMessages = errorsToString(errors);
694
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
695
- /* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }),
696
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsxRuntime.jsx(
697
- TypographyMaxWidth,
698
- {
699
- textColor: "danger600",
700
- variant: "omega",
701
- fontWeight: "semiBold",
702
- ellipsis: true,
703
- children: validationErrorsMessages
704
- }
705
- ) })
706
- ] });
707
- }
708
- if (status === "draft") {
709
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
710
- /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
711
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
712
- id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-publish",
713
- defaultMessage: "Ready to publish"
714
- }) })
715
- ] });
716
- }
717
- if (status === "modified") {
718
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
719
- /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowsCounterClockwise, { fill: "alternative600" }),
720
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
721
- id: "content-releases.pages.ReleaseDetails.entry-validation.modified",
722
- defaultMessage: "Ready to publish changes"
723
- }) })
724
- ] });
725
- }
726
- if (status === "published") {
727
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
728
- /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
729
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
730
- id: "content-releases.pages.ReleaseDetails.entry-validation.already-published",
731
- defaultMessage: "Already published"
732
- }) })
733
- ] });
734
- }
735
- }
736
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
737
- /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" }),
738
- !entry.publishedAt ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
739
- id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
740
- defaultMessage: "Already unpublished"
741
- }) }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: formatMessage({
742
- id: "content-releases.pages.ReleaseDetails.entry-validation.ready-to-unpublish",
743
- defaultMessage: "Ready to unpublish"
744
- }) })
745
- ] });
746
- };
747
933
  const ReleaseDetailsLayout = ({
748
934
  toggleEditReleaseModal,
749
935
  toggleWarningSubmit,
@@ -762,12 +948,12 @@ const ReleaseDetailsLayout = ({
762
948
  }
763
949
  );
764
950
  const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
765
- const { toggleNotification } = strapiAdmin.useNotification();
766
- const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
767
- const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
951
+ const { toggleNotification } = strapiAdmin$1.useNotification();
952
+ const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
953
+ const { allowedActions } = strapiAdmin$1.useRBAC(index.PERMISSIONS);
768
954
  const { canUpdate, canDelete, canPublish } = allowedActions;
769
955
  const dispatch = useTypedDispatch();
770
- const { trackUsage } = strapiAdmin.useTracking();
956
+ const { trackUsage } = strapiAdmin$1.useTracking();
771
957
  const release = data?.data;
772
958
  const handlePublishRelease = (id) => async () => {
773
959
  const response = await publishRelease({ id });
@@ -785,7 +971,7 @@ const ReleaseDetailsLayout = ({
785
971
  totalPublishedEntries,
786
972
  totalUnpublishedEntries
787
973
  });
788
- } else if (strapiAdmin.isFetchError(response.error)) {
974
+ } else if (strapiAdmin$1.isFetchError(response.error)) {
789
975
  toggleNotification({
790
976
  type: "danger",
791
977
  message: formatAPIError(response.error)
@@ -818,7 +1004,7 @@ const ReleaseDetailsLayout = ({
818
1004
  return release.createdBy.email;
819
1005
  };
820
1006
  if (isLoadingDetails) {
821
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
1007
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {});
822
1008
  }
823
1009
  if (isBaseQueryError(error) && "code" in error || !release) {
824
1010
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -868,14 +1054,14 @@ const ReleaseDetailsLayout = ({
868
1054
  ) : "";
869
1055
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
870
1056
  /* @__PURE__ */ jsxRuntime.jsx(
871
- strapiAdmin.Layouts.Header,
1057
+ strapiAdmin$1.Layouts.Header,
872
1058
  {
873
1059
  title: release.name,
874
1060
  subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
875
1061
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
876
1062
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
877
1063
  ] }),
878
- navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
1064
+ navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.BackButton, {}),
879
1065
  primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
880
1066
  /* @__PURE__ */ jsxRuntime.jsxs(
881
1067
  SimpleMenuButton,
@@ -993,9 +1179,9 @@ const getGroupByOptionLabel = (value) => {
993
1179
  };
994
1180
  const ReleaseDetailsBody = ({ releaseId }) => {
995
1181
  const { formatMessage } = reactIntl.useIntl();
996
- const [{ query }, setQuery] = strapiAdmin.useQueryParams();
997
- const { toggleNotification } = strapiAdmin.useNotification();
998
- const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
1182
+ const [{ query }, setQuery] = strapiAdmin$1.useQueryParams();
1183
+ const { toggleNotification } = strapiAdmin$1.useNotification();
1184
+ const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
999
1185
  const {
1000
1186
  data: releaseData,
1001
1187
  isLoading: isReleaseLoading,
@@ -1003,8 +1189,8 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1003
1189
  } = index.useGetReleaseQuery({ id: releaseId });
1004
1190
  const {
1005
1191
  allowedActions: { canUpdate }
1006
- } = strapiAdmin.useRBAC(index.PERMISSIONS);
1007
- const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
1192
+ } = strapiAdmin$1.useRBAC(index.PERMISSIONS);
1193
+ const runHookWaterfall = strapiAdmin$1.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
1008
1194
  const { displayedHeaders, hasI18nEnabled } = runHookWaterfall("ContentReleases/pages/ReleaseDetails/add-locale-in-releases", {
1009
1195
  displayedHeaders: [
1010
1196
  {
@@ -1045,7 +1231,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1045
1231
  // We are passing the action path to found the position in the cache of the action for optimistic updates
1046
1232
  });
1047
1233
  if ("error" in response) {
1048
- if (strapiAdmin.isFetchError(response.error)) {
1234
+ if (strapiAdmin$1.isFetchError(response.error)) {
1049
1235
  toggleNotification({
1050
1236
  type: "danger",
1051
1237
  message: formatAPIError(response.error)
@@ -1059,12 +1245,12 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1059
1245
  }
1060
1246
  };
1061
1247
  if (isLoading || isReleaseLoading) {
1062
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
1248
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {});
1063
1249
  }
1064
1250
  const releaseActions = data?.data;
1065
1251
  const releaseMeta = data?.meta;
1066
1252
  const contentTypes = releaseMeta?.contentTypes || {};
1067
- const components = releaseMeta?.components || {};
1253
+ releaseMeta?.components || {};
1068
1254
  if (isBaseQueryError(releaseError) || !release) {
1069
1255
  const errorsArray = [];
1070
1256
  if (releaseError && "code" in releaseError) {
@@ -1088,10 +1274,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1088
1274
  );
1089
1275
  }
1090
1276
  if (isError || !releaseActions) {
1091
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
1277
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Error, {});
1092
1278
  }
1093
1279
  if (Object.keys(releaseActions).length === 0) {
1094
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
1280
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
1095
1281
  designSystem.EmptyStateLayout,
1096
1282
  {
1097
1283
  action: /* @__PURE__ */ jsxRuntime.jsx(
@@ -1148,7 +1334,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1148
1334
  ] : []
1149
1335
  ];
1150
1336
  const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
1151
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
1337
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
1152
1338
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
1153
1339
  designSystem.SingleSelect,
1154
1340
  {
@@ -1171,7 +1357,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1171
1357
  Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
1172
1358
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
1173
1359
  /* @__PURE__ */ jsxRuntime.jsx(
1174
- strapiAdmin.Table.Root,
1360
+ strapiAdmin$1.Table.Root,
1175
1361
  {
1176
1362
  rows: releaseActions[key].map((item) => ({
1177
1363
  ...item,
@@ -1179,10 +1365,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1179
1365
  })),
1180
1366
  headers,
1181
1367
  isLoading: isLoading || isFetching,
1182
- children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Content, { children: [
1183
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Head, { children: headers.map(({ label, name }) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.HeaderCell, { label: formatMessage(label), name }, name)) }),
1184
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
1185
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: releaseActions[key].map(
1368
+ children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin$1.Table.Content, { children: [
1369
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.Head, { children: headers.map(({ label, name }) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.HeaderCell, { label: formatMessage(label), name }, name)) }),
1370
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.Loading, {}),
1371
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.Body, { children: releaseActions[key].map(
1186
1372
  ({ id, contentType, locale, type, entry, status }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
1187
1373
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
1188
1374
  hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
@@ -1207,11 +1393,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1207
1393
  ) }),
1208
1394
  !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1209
1395
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", minWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(
1210
- EntryValidationText,
1396
+ EntryValidationPopover,
1211
1397
  {
1212
1398
  action: type,
1213
1399
  schema: contentTypes?.[contentType.uid],
1214
- components,
1215
1400
  entry,
1216
1401
  status
1217
1402
  }
@@ -1241,13 +1426,13 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1241
1426
  )
1242
1427
  ] }, `releases-group-${key}`)),
1243
1428
  /* @__PURE__ */ jsxRuntime.jsxs(
1244
- strapiAdmin.Pagination.Root,
1429
+ strapiAdmin$1.Pagination.Root,
1245
1430
  {
1246
1431
  ...releaseMeta?.pagination,
1247
1432
  defaultPageSize: releaseMeta?.pagination?.pageSize,
1248
1433
  children: [
1249
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
1250
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
1434
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.PageSize, {}),
1435
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.Links, {})
1251
1436
  ]
1252
1437
  }
1253
1438
  )
@@ -1256,8 +1441,8 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1256
1441
  const ReleaseDetailsPage = () => {
1257
1442
  const { formatMessage } = reactIntl.useIntl();
1258
1443
  const { releaseId } = reactRouterDom.useParams();
1259
- const { toggleNotification } = strapiAdmin.useNotification();
1260
- const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
1444
+ const { toggleNotification } = strapiAdmin$1.useNotification();
1445
+ const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
1261
1446
  const navigate = reactRouterDom.useNavigate();
1262
1447
  const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
1263
1448
  const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
@@ -1294,7 +1479,7 @@ const ReleaseDetailsPage = () => {
1294
1479
  {
1295
1480
  toggleEditReleaseModal,
1296
1481
  toggleWarningSubmit,
1297
- children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
1482
+ children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {})
1298
1483
  }
1299
1484
  );
1300
1485
  }
@@ -1323,7 +1508,7 @@ const ReleaseDetailsPage = () => {
1323
1508
  })
1324
1509
  });
1325
1510
  toggleEditReleaseModal();
1326
- } else if (strapiAdmin.isFetchError(response.error)) {
1511
+ } else if (strapiAdmin$1.isFetchError(response.error)) {
1327
1512
  toggleNotification({
1328
1513
  type: "danger",
1329
1514
  message: formatAPIError(response.error)
@@ -1341,7 +1526,7 @@ const ReleaseDetailsPage = () => {
1341
1526
  });
1342
1527
  if ("data" in response) {
1343
1528
  navigate("..");
1344
- } else if (strapiAdmin.isFetchError(response.error)) {
1529
+ } else if (strapiAdmin$1.isFetchError(response.error)) {
1345
1530
  toggleNotification({
1346
1531
  type: "danger",
1347
1532
  message: formatAPIError(response.error)
@@ -1377,7 +1562,7 @@ const ReleaseDetailsPage = () => {
1377
1562
  }
1378
1563
  }
1379
1564
  ),
1380
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
1565
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
1381
1566
  id: "content-releases.dialog.confirmation-message",
1382
1567
  defaultMessage: "Are you sure you want to delete this release?"
1383
1568
  }) }) })
@@ -1386,10 +1571,10 @@ const ReleaseDetailsPage = () => {
1386
1571
  );
1387
1572
  };
1388
1573
  const App = () => {
1389
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
1574
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
1390
1575
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ReleasesPage, {}) }),
1391
1576
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":releaseId", element: /* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsPage, {}) })
1392
1577
  ] }) });
1393
1578
  };
1394
1579
  exports.App = App;
1395
- //# sourceMappingURL=App-BKB1esYS.js.map
1580
+ //# sourceMappingURL=App-DITZWWqI.js.map