@strapi/content-releases 0.0.0-experimental.fd55b75e545ef2b5c16b5f49a04e0db294663d8d → 0.0.0-experimental.fdacf4285d1cada9d94ab4dcd756c5362cba1b54

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 (37) hide show
  1. package/dist/_chunks/{App-Cne--1Z8.mjs → App-B7XAvv8M.mjs} +283 -112
  2. package/dist/_chunks/App-B7XAvv8M.mjs.map +1 -0
  3. package/dist/_chunks/{App-BKB1esYS.js → App-bh0od5o7.js} +323 -152
  4. package/dist/_chunks/App-bh0od5o7.js.map +1 -0
  5. package/dist/_chunks/{ReleasesSettingsPage-C1WwGWIH.mjs → ReleasesSettingsPage-DI0i3yzr.mjs} +2 -2
  6. package/dist/_chunks/{ReleasesSettingsPage-C1WwGWIH.mjs.map → ReleasesSettingsPage-DI0i3yzr.mjs.map} +1 -1
  7. package/dist/_chunks/{ReleasesSettingsPage-kuXIwpWp.js → ReleasesSettingsPage-DegTeuSf.js} +2 -2
  8. package/dist/_chunks/{ReleasesSettingsPage-kuXIwpWp.js.map → ReleasesSettingsPage-DegTeuSf.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-5Odi61vw.js → index-B7aCK4-q.js} +7 -4
  14. package/dist/_chunks/{index-5Odi61vw.js.map → index-B7aCK4-q.js.map} +1 -1
  15. package/dist/_chunks/{index-Cy7qwpaU.mjs → index-ok-2phdF.mjs} +7 -4
  16. package/dist/_chunks/{index-Cy7qwpaU.mjs.map → index-ok-2phdF.mjs.map} +1 -1
  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 +12 -0
  20. package/dist/server/index.js +14 -9
  21. package/dist/server/index.js.map +1 -1
  22. package/dist/server/index.mjs +14 -9
  23. package/dist/server/index.mjs.map +1 -1
  24. package/dist/server/src/index.d.ts +1 -6
  25. package/dist/server/src/index.d.ts.map +1 -1
  26. package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts.map +1 -1
  27. package/dist/server/src/services/index.d.ts +1 -6
  28. package/dist/server/src/services/index.d.ts.map +1 -1
  29. package/dist/server/src/services/release-action.d.ts +2 -7
  30. package/dist/server/src/services/release-action.d.ts.map +1 -1
  31. package/dist/shared/contracts/release-actions.d.ts +7 -1
  32. package/dist/shared/contracts/release-actions.d.ts.map +1 -1
  33. package/package.json +12 -11
  34. package/dist/_chunks/App-BKB1esYS.js.map +0 -1
  35. package/dist/_chunks/App-Cne--1Z8.mjs.map +0 -1
  36. package/dist/_chunks/en-CmYoEnA7.js.map +0 -1
  37. package/dist/_chunks/en-D0yVZFqf.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-B7aCK4-q.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,276 @@ 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
+ 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({
120
+ id: "content-releases.pages.ReleaseDetails.entry-validation.already-unpublished",
121
+ defaultMessage: "Already unpublished"
122
+ }) }) }) });
123
+ };
124
+ const FieldsValidation = ({
125
+ hasErrors,
126
+ errors,
127
+ kind,
128
+ contentTypeUid,
129
+ documentId,
130
+ locale
131
+ }) => {
132
+ const { formatMessage } = reactIntl.useIntl();
133
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, width: "100%", padding: 5, children: [
134
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, width: "100%", children: [
135
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
136
+ id: "content-releases.pages.ReleaseDetails.entry-validation.fields",
137
+ defaultMessage: "Fields"
138
+ }) }),
139
+ hasErrors ? /* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" })
140
+ ] }),
141
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { width: "100%", textColor: "neutral600", children: hasErrors ? formatMessage(
142
+ {
143
+ id: "content-releases.pages.ReleaseDetails.entry-validation.fields.error",
144
+ defaultMessage: "{errors} errors on fields."
145
+ },
146
+ { errors: errors ? Object.keys(errors).length : 0 }
147
+ ) : formatMessage({
148
+ id: "content-releases.pages.ReleaseDetails.entry-validation.fields.success",
149
+ defaultMessage: "All fields are filled correctly."
150
+ }) }),
151
+ hasErrors && /* @__PURE__ */ jsxRuntime.jsx(
152
+ designSystem.LinkButton,
153
+ {
154
+ tag: reactRouterDom.Link,
155
+ to: {
156
+ pathname: `/content-manager/${kind === "collectionType" ? "collection-types" : "single-types"}/${contentTypeUid}/${documentId}`,
157
+ search: locale ? qs.stringify({
158
+ plugins: {
159
+ i18n: {
160
+ locale
161
+ }
162
+ }
163
+ }) : ""
164
+ },
165
+ variant: "secondary",
166
+ fullWidth: true,
167
+ state: { forceValidation: true },
168
+ children: formatMessage({
169
+ id: "content-releases.pages.ReleaseDetails.entry-validation.fields.see-errors",
170
+ defaultMessage: "See errors"
171
+ })
172
+ }
173
+ )
174
+ ] });
175
+ };
176
+ const getReviewStageIcon = ({
177
+ contentTypeHasReviewWorkflow,
178
+ requiredStage,
179
+ entryStage
180
+ }) => {
181
+ if (!contentTypeHasReviewWorkflow) {
182
+ return /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "neutral200" });
183
+ }
184
+ if (requiredStage && requiredStage.id !== entryStage?.id) {
185
+ return /* @__PURE__ */ jsxRuntime.jsx(icons.CrossCircle, { fill: "danger600" });
186
+ }
187
+ return /* @__PURE__ */ jsxRuntime.jsx(icons.CheckCircle, { fill: "success600" });
188
+ };
189
+ const getReviewStageMessage = ({
190
+ contentTypeHasReviewWorkflow,
191
+ requiredStage,
192
+ entryStage,
193
+ formatMessage
194
+ }) => {
195
+ if (!contentTypeHasReviewWorkflow) {
196
+ return formatMessage({
197
+ id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.not-enabled",
198
+ defaultMessage: "This entry is not associated to any workflow."
199
+ });
200
+ }
201
+ if (requiredStage && requiredStage.id !== entryStage?.id) {
202
+ return formatMessage(
203
+ {
204
+ id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.not-ready",
205
+ defaultMessage: "This entry is not at the required stage for publishing. ({stageName})"
206
+ },
207
+ {
208
+ stageName: requiredStage?.name ?? ""
209
+ }
210
+ );
211
+ }
212
+ if (requiredStage && requiredStage.id === entryStage?.id) {
213
+ return formatMessage(
214
+ {
215
+ id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.ready",
216
+ defaultMessage: "This entry is at the required stage for publishing. ({stageName})"
217
+ },
218
+ {
219
+ stageName: requiredStage?.name ?? ""
220
+ }
221
+ );
222
+ }
223
+ return formatMessage({
224
+ id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage.stage-not-required",
225
+ defaultMessage: "No required stage for publication"
226
+ });
227
+ };
228
+ const ReviewStageValidation = ({
229
+ contentTypeHasReviewWorkflow,
230
+ requiredStage,
231
+ entryStage
232
+ }) => {
233
+ const { formatMessage } = reactIntl.useIntl();
234
+ const Icon = getReviewStageIcon({
235
+ contentTypeHasReviewWorkflow,
236
+ requiredStage,
237
+ entryStage
238
+ });
239
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, width: "100%", padding: 5, children: [
240
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, width: "100%", children: [
241
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({
242
+ id: "content-releases.pages.ReleaseDetails.entry-validation.review-stage",
243
+ defaultMessage: "Review stage"
244
+ }) }),
245
+ Icon
246
+ ] }),
247
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: getReviewStageMessage({
248
+ contentTypeHasReviewWorkflow,
249
+ requiredStage,
250
+ entryStage,
251
+ formatMessage
252
+ }) })
253
+ ] });
254
+ };
255
+ const EntryValidationPopover = ({
256
+ action,
257
+ schema,
258
+ entry,
259
+ status
260
+ }) => {
261
+ const { validate, isLoading } = strapiAdmin.unstable_useDocument(
262
+ {
263
+ collectionType: schema?.kind ?? "",
264
+ model: schema?.uid ?? ""
265
+ },
266
+ {
267
+ // 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
268
+ skip: true
269
+ }
270
+ );
271
+ const errors = isLoading ? null : validate(entry);
272
+ const hasErrors = errors ? Object.keys(errors).length > 0 : false;
273
+ const contentTypeHasReviewWorkflow = schema?.options?.reviewWorkflows ?? false;
274
+ const requiredStage = schema?.stageRequiredToPublish;
275
+ const entryStage = entry.strapi_stage;
276
+ if (isLoading) {
277
+ return null;
278
+ }
279
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Popover.Root, { children: [
280
+ /* @__PURE__ */ jsxRuntime.jsx(
281
+ EntryStatusTrigger,
282
+ {
283
+ action,
284
+ status,
285
+ hasErrors,
286
+ requiredStage,
287
+ entryStage
288
+ }
289
+ ),
290
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(StyledPopoverFlex, { direction: "column", children: [
291
+ /* @__PURE__ */ jsxRuntime.jsx(
292
+ FieldsValidation,
293
+ {
294
+ hasErrors,
295
+ errors,
296
+ contentTypeUid: schema?.uid,
297
+ kind: schema?.kind,
298
+ documentId: entry.documentId,
299
+ locale: entry.locale
300
+ }
301
+ ),
302
+ /* @__PURE__ */ jsxRuntime.jsx(
303
+ ReviewStageValidation,
304
+ {
305
+ contentTypeHasReviewWorkflow,
306
+ requiredStage,
307
+ entryStage
308
+ }
309
+ )
310
+ ] }) })
311
+ ] });
312
+ };
42
313
  const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
43
314
  const RelativeTime$1 = React__namespace.forwardRef(
44
315
  ({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
@@ -346,7 +617,7 @@ const getBadgeProps = (status) => {
346
617
  const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
347
618
  const { formatMessage } = reactIntl.useIntl();
348
619
  if (isError) {
349
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
620
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Error, {});
350
621
  }
351
622
  if (releases?.length === 0) {
352
623
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -410,20 +681,20 @@ const INITIAL_FORM_VALUES = {
410
681
  const ReleasesPage = () => {
411
682
  const location = reactRouterDom.useLocation();
412
683
  const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
413
- const { toggleNotification } = strapiAdmin.useNotification();
684
+ const { toggleNotification } = strapiAdmin$1.useNotification();
414
685
  const { formatMessage } = reactIntl.useIntl();
415
686
  const navigate = reactRouterDom.useNavigate();
416
- const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
417
- const [{ query }, setQuery] = strapiAdmin.useQueryParams();
687
+ const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
688
+ const [{ query }, setQuery] = strapiAdmin$1.useQueryParams();
418
689
  const response = index.useGetReleasesQuery(query);
419
690
  const { data, isLoading: isLoadingSettings } = index.useGetReleaseSettingsQuery();
420
691
  const [createRelease, { isLoading: isSubmittingForm }] = index.useCreateReleaseMutation();
421
692
  const { getFeature } = ee.useLicenseLimits();
422
693
  const { maximumReleases = 3 } = getFeature("cms-content-releases");
423
- const { trackUsage } = strapiAdmin.useTracking();
694
+ const { trackUsage } = strapiAdmin$1.useTracking();
424
695
  const {
425
696
  allowedActions: { canCreate }
426
- } = strapiAdmin.useRBAC(index.PERMISSIONS);
697
+ } = strapiAdmin$1.useRBAC(index.PERMISSIONS);
427
698
  const { isLoading: isLoadingReleases, isSuccess, isError } = response;
428
699
  const activeTab = response?.currentData?.meta?.activeTab || "pending";
429
700
  React__namespace.useEffect(() => {
@@ -446,7 +717,7 @@ const ReleasesPage = () => {
446
717
  setReleaseModalShown((prev) => !prev);
447
718
  };
448
719
  if (isLoadingReleases || isLoadingSettings) {
449
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
720
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {});
450
721
  }
451
722
  const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
452
723
  const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
@@ -478,7 +749,7 @@ const ReleasesPage = () => {
478
749
  });
479
750
  trackUsage("didCreateRelease");
480
751
  navigate(response2.data.data.id.toString());
481
- } else if (strapiAdmin.isFetchError(response2.error)) {
752
+ } else if (strapiAdmin$1.isFetchError(response2.error)) {
482
753
  toggleNotification({
483
754
  type: "danger",
484
755
  message: formatAPIError(response2.error)
@@ -492,7 +763,7 @@ const ReleasesPage = () => {
492
763
  };
493
764
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingReleases || isLoadingSettings, children: [
494
765
  /* @__PURE__ */ jsxRuntime.jsx(
495
- strapiAdmin.Layouts.Header,
766
+ strapiAdmin$1.Layouts.Header,
496
767
  {
497
768
  title: formatMessage({
498
769
  id: "content-releases.pages.Releases.title",
@@ -516,7 +787,7 @@ const ReleasesPage = () => {
516
787
  ) : null
517
788
  }
518
789
  ),
519
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
790
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
520
791
  hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
521
792
  StyledAlert,
522
793
  {
@@ -587,13 +858,13 @@ const ReleasesPage = () => {
587
858
  ) })
588
859
  ] }),
589
860
  /* @__PURE__ */ jsxRuntime.jsxs(
590
- strapiAdmin.Pagination.Root,
861
+ strapiAdmin$1.Pagination.Root,
591
862
  {
592
863
  ...response?.currentData?.meta?.pagination,
593
864
  defaultPageSize: response?.currentData?.meta?.pagination?.pageSize,
594
865
  children: [
595
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
596
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
866
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.PageSize, { options: ["8", "16", "32", "64"] }),
867
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.Links, {})
597
868
  ]
598
869
  }
599
870
  )
@@ -645,105 +916,6 @@ const TrashIcon = styledComponents.styled(icons.Trash)`
645
916
  fill: ${({ theme }) => theme.colors.danger600};
646
917
  }
647
918
  `;
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
919
  const ReleaseDetailsLayout = ({
748
920
  toggleEditReleaseModal,
749
921
  toggleWarningSubmit,
@@ -762,12 +934,12 @@ const ReleaseDetailsLayout = ({
762
934
  }
763
935
  );
764
936
  const [publishRelease, { isLoading: isPublishing }] = index.usePublishReleaseMutation();
765
- const { toggleNotification } = strapiAdmin.useNotification();
766
- const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
767
- const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS);
937
+ const { toggleNotification } = strapiAdmin$1.useNotification();
938
+ const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
939
+ const { allowedActions } = strapiAdmin$1.useRBAC(index.PERMISSIONS);
768
940
  const { canUpdate, canDelete, canPublish } = allowedActions;
769
941
  const dispatch = useTypedDispatch();
770
- const { trackUsage } = strapiAdmin.useTracking();
942
+ const { trackUsage } = strapiAdmin$1.useTracking();
771
943
  const release = data?.data;
772
944
  const handlePublishRelease = (id) => async () => {
773
945
  const response = await publishRelease({ id });
@@ -785,7 +957,7 @@ const ReleaseDetailsLayout = ({
785
957
  totalPublishedEntries,
786
958
  totalUnpublishedEntries
787
959
  });
788
- } else if (strapiAdmin.isFetchError(response.error)) {
960
+ } else if (strapiAdmin$1.isFetchError(response.error)) {
789
961
  toggleNotification({
790
962
  type: "danger",
791
963
  message: formatAPIError(response.error)
@@ -818,7 +990,7 @@ const ReleaseDetailsLayout = ({
818
990
  return release.createdBy.email;
819
991
  };
820
992
  if (isLoadingDetails) {
821
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
993
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {});
822
994
  }
823
995
  if (isBaseQueryError(error) && "code" in error || !release) {
824
996
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -868,14 +1040,14 @@ const ReleaseDetailsLayout = ({
868
1040
  ) : "";
869
1041
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
870
1042
  /* @__PURE__ */ jsxRuntime.jsx(
871
- strapiAdmin.Layouts.Header,
1043
+ strapiAdmin$1.Layouts.Header,
872
1044
  {
873
1045
  title: release.name,
874
1046
  subtitle: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, lineHeight: 6, children: [
875
1047
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: numberOfEntriesText + (isScheduled ? ` - ${scheduledText}` : "") }),
876
1048
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getBadgeProps(release.status), children: release.status })
877
1049
  ] }),
878
- navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
1050
+ navigationAction: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.BackButton, {}),
879
1051
  primaryAction: !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
880
1052
  /* @__PURE__ */ jsxRuntime.jsxs(
881
1053
  SimpleMenuButton,
@@ -993,9 +1165,9 @@ const getGroupByOptionLabel = (value) => {
993
1165
  };
994
1166
  const ReleaseDetailsBody = ({ releaseId }) => {
995
1167
  const { formatMessage } = reactIntl.useIntl();
996
- const [{ query }, setQuery] = strapiAdmin.useQueryParams();
997
- const { toggleNotification } = strapiAdmin.useNotification();
998
- const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
1168
+ const [{ query }, setQuery] = strapiAdmin$1.useQueryParams();
1169
+ const { toggleNotification } = strapiAdmin$1.useNotification();
1170
+ const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
999
1171
  const {
1000
1172
  data: releaseData,
1001
1173
  isLoading: isReleaseLoading,
@@ -1003,8 +1175,8 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1003
1175
  } = index.useGetReleaseQuery({ id: releaseId });
1004
1176
  const {
1005
1177
  allowedActions: { canUpdate }
1006
- } = strapiAdmin.useRBAC(index.PERMISSIONS);
1007
- const runHookWaterfall = strapiAdmin.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
1178
+ } = strapiAdmin$1.useRBAC(index.PERMISSIONS);
1179
+ const runHookWaterfall = strapiAdmin$1.useStrapiApp("ReleaseDetailsPage", (state) => state.runHookWaterfall);
1008
1180
  const { displayedHeaders, hasI18nEnabled } = runHookWaterfall("ContentReleases/pages/ReleaseDetails/add-locale-in-releases", {
1009
1181
  displayedHeaders: [
1010
1182
  {
@@ -1045,7 +1217,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1045
1217
  // We are passing the action path to found the position in the cache of the action for optimistic updates
1046
1218
  });
1047
1219
  if ("error" in response) {
1048
- if (strapiAdmin.isFetchError(response.error)) {
1220
+ if (strapiAdmin$1.isFetchError(response.error)) {
1049
1221
  toggleNotification({
1050
1222
  type: "danger",
1051
1223
  message: formatAPIError(response.error)
@@ -1059,12 +1231,12 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1059
1231
  }
1060
1232
  };
1061
1233
  if (isLoading || isReleaseLoading) {
1062
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
1234
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {});
1063
1235
  }
1064
1236
  const releaseActions = data?.data;
1065
1237
  const releaseMeta = data?.meta;
1066
1238
  const contentTypes = releaseMeta?.contentTypes || {};
1067
- const components = releaseMeta?.components || {};
1239
+ releaseMeta?.components || {};
1068
1240
  if (isBaseQueryError(releaseError) || !release) {
1069
1241
  const errorsArray = [];
1070
1242
  if (releaseError && "code" in releaseError) {
@@ -1088,10 +1260,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1088
1260
  );
1089
1261
  }
1090
1262
  if (isError || !releaseActions) {
1091
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
1263
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Error, {});
1092
1264
  }
1093
1265
  if (Object.keys(releaseActions).length === 0) {
1094
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
1266
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(
1095
1267
  designSystem.EmptyStateLayout,
1096
1268
  {
1097
1269
  action: /* @__PURE__ */ jsxRuntime.jsx(
@@ -1148,7 +1320,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1148
1320
  ] : []
1149
1321
  ];
1150
1322
  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: [
1323
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
1152
1324
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
1153
1325
  designSystem.SingleSelect,
1154
1326
  {
@@ -1171,7 +1343,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1171
1343
  Object.keys(releaseActions).map((key) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, direction: "column", alignItems: "stretch", children: [
1172
1344
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { role: "separator", "aria-label": key, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: key }) }),
1173
1345
  /* @__PURE__ */ jsxRuntime.jsx(
1174
- strapiAdmin.Table.Root,
1346
+ strapiAdmin$1.Table.Root,
1175
1347
  {
1176
1348
  rows: releaseActions[key].map((item) => ({
1177
1349
  ...item,
@@ -1179,10 +1351,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1179
1351
  })),
1180
1352
  headers,
1181
1353
  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(
1354
+ children: /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin$1.Table.Content, { children: [
1355
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.Head, { children: headers.map(({ label, name }) => /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.HeaderCell, { label: formatMessage(label), name }, name)) }),
1356
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.Loading, {}),
1357
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Table.Body, { children: releaseActions[key].map(
1186
1358
  ({ id, contentType, locale, type, entry, status }, actionIndex) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
1187
1359
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "25%", maxWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { ellipsis: true, children: `${contentType.mainFieldValue || entry.id}` }) }),
1188
1360
  hasI18nEnabled && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "10%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: `${locale?.name ? locale.name : "-"}` }) }),
@@ -1207,11 +1379,10 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1207
1379
  ) }),
1208
1380
  !release.releasedAt && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1209
1381
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { width: "20%", minWidth: "200px", children: /* @__PURE__ */ jsxRuntime.jsx(
1210
- EntryValidationText,
1382
+ EntryValidationPopover,
1211
1383
  {
1212
1384
  action: type,
1213
1385
  schema: contentTypes?.[contentType.uid],
1214
- components,
1215
1386
  entry,
1216
1387
  status
1217
1388
  }
@@ -1241,13 +1412,13 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1241
1412
  )
1242
1413
  ] }, `releases-group-${key}`)),
1243
1414
  /* @__PURE__ */ jsxRuntime.jsxs(
1244
- strapiAdmin.Pagination.Root,
1415
+ strapiAdmin$1.Pagination.Root,
1245
1416
  {
1246
1417
  ...releaseMeta?.pagination,
1247
1418
  defaultPageSize: releaseMeta?.pagination?.pageSize,
1248
1419
  children: [
1249
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.PageSize, {}),
1250
- /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Pagination.Links, {})
1420
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.PageSize, {}),
1421
+ /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Pagination.Links, {})
1251
1422
  ]
1252
1423
  }
1253
1424
  )
@@ -1256,8 +1427,8 @@ const ReleaseDetailsBody = ({ releaseId }) => {
1256
1427
  const ReleaseDetailsPage = () => {
1257
1428
  const { formatMessage } = reactIntl.useIntl();
1258
1429
  const { releaseId } = reactRouterDom.useParams();
1259
- const { toggleNotification } = strapiAdmin.useNotification();
1260
- const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
1430
+ const { toggleNotification } = strapiAdmin$1.useNotification();
1431
+ const { formatAPIError } = strapiAdmin$1.useAPIErrorHandler();
1261
1432
  const navigate = reactRouterDom.useNavigate();
1262
1433
  const [releaseModalShown, setReleaseModalShown] = React__namespace.useState(false);
1263
1434
  const [showWarningSubmit, setWarningSubmit] = React__namespace.useState(false);
@@ -1294,7 +1465,7 @@ const ReleaseDetailsPage = () => {
1294
1465
  {
1295
1466
  toggleEditReleaseModal,
1296
1467
  toggleWarningSubmit,
1297
- children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {})
1468
+ children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Loading, {})
1298
1469
  }
1299
1470
  );
1300
1471
  }
@@ -1323,7 +1494,7 @@ const ReleaseDetailsPage = () => {
1323
1494
  })
1324
1495
  });
1325
1496
  toggleEditReleaseModal();
1326
- } else if (strapiAdmin.isFetchError(response.error)) {
1497
+ } else if (strapiAdmin$1.isFetchError(response.error)) {
1327
1498
  toggleNotification({
1328
1499
  type: "danger",
1329
1500
  message: formatAPIError(response.error)
@@ -1341,7 +1512,7 @@ const ReleaseDetailsPage = () => {
1341
1512
  });
1342
1513
  if ("data" in response) {
1343
1514
  navigate("..");
1344
- } else if (strapiAdmin.isFetchError(response.error)) {
1515
+ } else if (strapiAdmin$1.isFetchError(response.error)) {
1345
1516
  toggleNotification({
1346
1517
  type: "danger",
1347
1518
  message: formatAPIError(response.error)
@@ -1377,7 +1548,7 @@ const ReleaseDetailsPage = () => {
1377
1548
  }
1378
1549
  }
1379
1550
  ),
1380
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
1551
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarningSubmit, onOpenChange: toggleWarningSubmit, children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.ConfirmDialog, { onConfirm: handleDeleteRelease, children: formatMessage({
1381
1552
  id: "content-releases.dialog.confirmation-message",
1382
1553
  defaultMessage: "Are you sure you want to delete this release?"
1383
1554
  }) }) })
@@ -1386,10 +1557,10 @@ const ReleaseDetailsPage = () => {
1386
1557
  );
1387
1558
  };
1388
1559
  const App = () => {
1389
- return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
1560
+ return /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin$1.Page.Protect, { permissions: index.PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
1390
1561
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ReleasesPage, {}) }),
1391
1562
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: ":releaseId", element: /* @__PURE__ */ jsxRuntime.jsx(ReleaseDetailsPage, {}) })
1392
1563
  ] }) });
1393
1564
  };
1394
1565
  exports.App = App;
1395
- //# sourceMappingURL=App-BKB1esYS.js.map
1566
+ //# sourceMappingURL=App-bh0od5o7.js.map