@strapi/content-releases 5.0.0-beta.6 → 5.0.0-beta.8
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-CbOy9Yd2.js → App-DUmziQ17.js} +170 -170
- package/dist/_chunks/App-DUmziQ17.js.map +1 -0
- package/dist/_chunks/{App-CVlffj0R.mjs → App-D_6Y9N2F.mjs} +165 -164
- package/dist/_chunks/App-D_6Y9N2F.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-DAHdUpAA.js → PurchaseContentReleases-Be3acS2L.js} +4 -3
- package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Ex09YpKR.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +5 -4
- package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
- package/dist/_chunks/{index-B7mc1tVq.mjs → index-BomF0-yY.mjs} +86 -307
- package/dist/_chunks/index-BomF0-yY.mjs.map +1 -0
- package/dist/_chunks/{index-Bwn36oqx.js → index-C5Hc767q.js} +83 -306
- package/dist/_chunks/index-C5Hc767q.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +1 -1
- package/dist/admin/src/components/ReleaseModal.d.ts +1 -1
- package/dist/admin/src/services/release.d.ts +36 -360
- package/dist/admin/src/utils/api.d.ts +6 -0
- package/package.json +15 -17
- package/dist/_chunks/App-CVlffj0R.mjs.map +0 -1
- package/dist/_chunks/App-CbOy9Yd2.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-DAHdUpAA.js.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Ex09YpKR.mjs.map +0 -1
- package/dist/_chunks/index-B7mc1tVq.mjs.map +0 -1
- package/dist/_chunks/index-Bwn36oqx.js.map +0 -1
- package/dist/admin/src/services/axios.d.ts +0 -29
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useNotification, useAPIErrorHandler, useQueryParams, useTracking, useRBAC, Page, Pagination, ConfirmDialog, BackButton, useStrapiApp, Table } from "@strapi/admin/strapi-admin";
|
|
3
|
-
import { useLocation, useNavigate, useParams, Navigate, Link as Link$1, Routes, Route } from "react-router-dom";
|
|
4
|
-
import { g as getTimezoneOffset, p as pluginId, u as useGetReleasesQuery, a as useCreateReleaseMutation, P as PERMISSIONS,
|
|
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, Link as Link$1, Routes, Route } from "react-router-dom";
|
|
4
|
+
import { g as getTimezoneOffset, p as pluginId, u as useGetReleasesQuery, a as useCreateReleaseMutation, P as PERMISSIONS, b as useGetReleaseQuery, c as useUpdateReleaseMutation, d as useDeleteReleaseMutation, e as usePublishReleaseMutation, f as useGetReleaseActionsQuery, h as useUpdateReleaseActionMutation, R as ReleaseActionOptions, i as ReleaseActionMenu, r as releaseApi } from "./index-BomF0-yY.mjs";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { unstable_useDocument } from "@strapi/content-manager/strapi-admin";
|
|
7
|
-
import { ModalLayout, ModalHeader, Typography, ModalBody, Flex, TextInput, Box, Checkbox, DatePicker, TimePicker, ModalFooter, Button, Combobox, ComboboxOption, Link, Alert, Main,
|
|
7
|
+
import { ModalLayout, ModalHeader, Typography, ModalBody, Flex, Field, TextInput, Box, Checkbox, DatePicker, TimePicker, ModalFooter, Button, Combobox, ComboboxOption, Link, Alert, Main, TabGroup, Tabs, Tab, Divider, TabPanels, TabPanel, EmptyStateLayout, Grid, GridItem, Badge, Menu, LinkButton, SingleSelect, SingleSelectOption, Tr, Td, Tooltip } from "@strapi/design-system";
|
|
8
8
|
import { Plus, Pencil, Trash, More, CrossCircle, CheckCircle } from "@strapi/icons";
|
|
9
9
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
10
10
|
import format from "date-fns/format";
|
|
11
11
|
import { utcToZonedTime, zonedTimeToUtc } from "date-fns-tz";
|
|
12
12
|
import { useIntl } from "react-intl";
|
|
13
|
-
import styled from "styled-components";
|
|
13
|
+
import { styled } from "styled-components";
|
|
14
14
|
import { intervalToDuration, isPast, formatISO } from "date-fns";
|
|
15
15
|
import { Formik, Form, useFormikContext } from "formik";
|
|
16
16
|
import * as yup from "yup";
|
|
@@ -115,120 +115,119 @@ const ReleaseModal = ({
|
|
|
115
115
|
},
|
|
116
116
|
validationSchema: RELEASE_SCHEMA,
|
|
117
117
|
validateOnChange: false,
|
|
118
|
-
children: ({ values, errors, handleChange, setFieldValue }) =>
|
|
119
|
-
|
|
120
|
-
/* @__PURE__ */ jsx(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
label: formatMessage({
|
|
118
|
+
children: ({ values, errors, handleChange, setFieldValue }) => {
|
|
119
|
+
return /* @__PURE__ */ jsxs(Form, { children: [
|
|
120
|
+
/* @__PURE__ */ jsx(ModalBody, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
121
|
+
/* @__PURE__ */ jsxs(Field.Root, { name: "name", error: errors.name, required: true, children: [
|
|
122
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
124
123
|
id: "content-releases.modal.form.input.label.release-name",
|
|
125
124
|
defaultMessage: "Name"
|
|
126
|
-
}),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
DatePicker,
|
|
168
|
-
{
|
|
169
|
-
label: formatMessage({
|
|
125
|
+
}) }),
|
|
126
|
+
/* @__PURE__ */ jsx(TextInput, { value: values.name, onChange: handleChange }),
|
|
127
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
128
|
+
] }),
|
|
129
|
+
/* @__PURE__ */ jsx(Box, { width: "max-content", children: /* @__PURE__ */ jsx(
|
|
130
|
+
Checkbox,
|
|
131
|
+
{
|
|
132
|
+
name: "isScheduled",
|
|
133
|
+
value: values.isScheduled,
|
|
134
|
+
onChange: (event) => {
|
|
135
|
+
setFieldValue("isScheduled", event.target.checked);
|
|
136
|
+
if (!event.target.checked) {
|
|
137
|
+
setFieldValue("date", null);
|
|
138
|
+
setFieldValue("time", "");
|
|
139
|
+
setFieldValue("timezone", null);
|
|
140
|
+
} else {
|
|
141
|
+
setFieldValue("date", initialValues.date);
|
|
142
|
+
setFieldValue("time", initialValues.time);
|
|
143
|
+
setFieldValue(
|
|
144
|
+
"timezone",
|
|
145
|
+
initialValues.timezone ?? systemTimezone?.value
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
children: /* @__PURE__ */ jsx(
|
|
150
|
+
Typography,
|
|
151
|
+
{
|
|
152
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
153
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
154
|
+
children: formatMessage({
|
|
155
|
+
id: "modal.form.input.label.schedule-release",
|
|
156
|
+
defaultMessage: "Schedule release"
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
) }),
|
|
162
|
+
values.isScheduled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
163
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 4, alignItems: "start", children: [
|
|
164
|
+
/* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsxs(Field.Root, { name: "date", error: errors.date, required: true, children: [
|
|
165
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
170
166
|
id: "content-releases.modal.form.input.label.date",
|
|
171
167
|
defaultMessage: "Date"
|
|
172
|
-
}),
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
{
|
|
194
|
-
|
|
168
|
+
}) }),
|
|
169
|
+
/* @__PURE__ */ jsx(
|
|
170
|
+
DatePicker,
|
|
171
|
+
{
|
|
172
|
+
onChange: (date) => {
|
|
173
|
+
const isoFormatDate = date ? formatISO(date, { representation: "date" }) : null;
|
|
174
|
+
setFieldValue("date", isoFormatDate);
|
|
175
|
+
},
|
|
176
|
+
clearLabel: formatMessage({
|
|
177
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
178
|
+
defaultMessage: "Clear"
|
|
179
|
+
}),
|
|
180
|
+
onClear: () => {
|
|
181
|
+
setFieldValue("date", null);
|
|
182
|
+
},
|
|
183
|
+
value: values.date ? new Date(values.date) : /* @__PURE__ */ new Date(),
|
|
184
|
+
minDate: utcToZonedTime(/* @__PURE__ */ new Date(), values.timezone.split("&")[1])
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
188
|
+
] }) }),
|
|
189
|
+
/* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsxs(Field.Root, { name: "time", error: errors.time, required: true, children: [
|
|
190
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
195
191
|
id: "content-releases.modal.form.input.label.time",
|
|
196
192
|
defaultMessage: "Time"
|
|
197
|
-
}),
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
193
|
+
}) }),
|
|
194
|
+
/* @__PURE__ */ jsx(
|
|
195
|
+
TimePicker,
|
|
196
|
+
{
|
|
197
|
+
onChange: (time) => {
|
|
198
|
+
setFieldValue("time", time);
|
|
199
|
+
},
|
|
200
|
+
clearLabel: formatMessage({
|
|
201
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
202
|
+
defaultMessage: "Clear"
|
|
203
|
+
}),
|
|
204
|
+
onClear: () => {
|
|
205
|
+
setFieldValue("time", "");
|
|
206
|
+
},
|
|
207
|
+
value: values.time || void 0
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
211
|
+
] }) })
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
214
|
+
] })
|
|
215
|
+
] }) }),
|
|
216
|
+
/* @__PURE__ */ jsx(
|
|
217
|
+
ModalFooter,
|
|
218
|
+
{
|
|
219
|
+
startActions: /* @__PURE__ */ jsx(Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
220
|
+
endActions: /* @__PURE__ */ jsx(Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
221
|
+
{
|
|
222
|
+
id: "content-releases.modal.form.button.submit",
|
|
223
|
+
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
224
|
+
},
|
|
225
|
+
{ isCreatingRelease }
|
|
213
226
|
) })
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
/* @__PURE__ */ jsx(
|
|
219
|
-
ModalFooter,
|
|
220
|
-
{
|
|
221
|
-
startActions: /* @__PURE__ */ jsx(Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
222
|
-
endActions: /* @__PURE__ */ jsx(Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
223
|
-
{
|
|
224
|
-
id: "content-releases.modal.form.button.submit",
|
|
225
|
-
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
226
|
-
},
|
|
227
|
-
{ isCreatingRelease }
|
|
228
|
-
) })
|
|
229
|
-
}
|
|
230
|
-
)
|
|
231
|
-
] })
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
] });
|
|
230
|
+
}
|
|
232
231
|
}
|
|
233
232
|
)
|
|
234
233
|
] });
|
|
@@ -257,33 +256,36 @@ const TimezoneComponent = ({ timezoneOptions }) => {
|
|
|
257
256
|
}
|
|
258
257
|
}
|
|
259
258
|
}, [setFieldValue, values.date, values.timezone]);
|
|
260
|
-
return /* @__PURE__ */
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
);
|
|
259
|
+
return /* @__PURE__ */ jsxs(Field.Root, { name: "timezone", error: errors.timezone, required: true, children: [
|
|
260
|
+
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
261
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
262
|
+
defaultMessage: "Timezone"
|
|
263
|
+
}) }),
|
|
264
|
+
/* @__PURE__ */ jsx(
|
|
265
|
+
Combobox,
|
|
266
|
+
{
|
|
267
|
+
autocomplete: { type: "list", filter: "contains" },
|
|
268
|
+
value: values.timezone || void 0,
|
|
269
|
+
textValue: values.timezone ? values.timezone.replace(/&/, " ") : void 0,
|
|
270
|
+
onChange: (timezone) => {
|
|
271
|
+
setFieldValue("timezone", timezone);
|
|
272
|
+
},
|
|
273
|
+
onTextValueChange: (timezone) => {
|
|
274
|
+
setFieldValue("timezone", timezone);
|
|
275
|
+
},
|
|
276
|
+
onClear: () => {
|
|
277
|
+
setFieldValue("timezone", "");
|
|
278
|
+
},
|
|
279
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsx(ComboboxOption, { value: timezone.value, children: timezone.value.replace(/&/, " ") }, timezone.value))
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
283
|
+
] });
|
|
285
284
|
};
|
|
286
285
|
const useTypedDispatch = useDispatch;
|
|
286
|
+
const isBaseQueryError = (error) => {
|
|
287
|
+
return typeof error !== "undefined" && error.name !== void 0;
|
|
288
|
+
};
|
|
287
289
|
const LinkCard = styled(Link)`
|
|
288
290
|
display: block;
|
|
289
291
|
`;
|
|
@@ -340,7 +342,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
340
342
|
}
|
|
341
343
|
);
|
|
342
344
|
}
|
|
343
|
-
return /* @__PURE__ */ jsx(Grid, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsx(GridItem, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsx(LinkCard, {
|
|
345
|
+
return /* @__PURE__ */ jsx(Grid, { gap: 4, children: releases.map(({ id, name, scheduledAt, status }) => /* @__PURE__ */ jsx(GridItem, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsx(LinkCard, { tag: NavLink, to: `${id}`, isExternal: false, children: /* @__PURE__ */ jsxs(
|
|
344
346
|
Flex,
|
|
345
347
|
{
|
|
346
348
|
direction: "column",
|
|
@@ -355,7 +357,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
355
357
|
gap: 4,
|
|
356
358
|
children: [
|
|
357
359
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "start", gap: 1, children: [
|
|
358
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
360
|
+
/* @__PURE__ */ jsx(Typography, { tag: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
359
361
|
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: scheduledAt ? /* @__PURE__ */ jsx(RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
360
362
|
id: "content-releases.pages.Releases.not-scheduled",
|
|
361
363
|
defaultMessage: "Not scheduled"
|
|
@@ -376,7 +378,7 @@ const StyledAlert = styled(Alert)`
|
|
|
376
378
|
`;
|
|
377
379
|
const INITIAL_FORM_VALUES = {
|
|
378
380
|
name: "",
|
|
379
|
-
date:
|
|
381
|
+
date: void 0,
|
|
380
382
|
time: "",
|
|
381
383
|
isScheduled: true,
|
|
382
384
|
scheduledAt: null,
|
|
@@ -459,7 +461,7 @@ const ReleasesPage = () => {
|
|
|
459
461
|
});
|
|
460
462
|
trackUsage("didCreateRelease");
|
|
461
463
|
navigate(response2.data.data.id.toString());
|
|
462
|
-
} else if (
|
|
464
|
+
} else if (isFetchError(response2.error)) {
|
|
463
465
|
toggleNotification({
|
|
464
466
|
type: "danger",
|
|
465
467
|
message: formatAPIError(response2.error)
|
|
@@ -473,7 +475,7 @@ const ReleasesPage = () => {
|
|
|
473
475
|
};
|
|
474
476
|
return /* @__PURE__ */ jsxs(Main, { "aria-busy": isLoading, children: [
|
|
475
477
|
/* @__PURE__ */ jsx(
|
|
476
|
-
|
|
478
|
+
Layouts.Header,
|
|
477
479
|
{
|
|
478
480
|
title: formatMessage({
|
|
479
481
|
id: "content-releases.pages.Releases.title",
|
|
@@ -497,7 +499,7 @@ const ReleasesPage = () => {
|
|
|
497
499
|
) : null
|
|
498
500
|
}
|
|
499
501
|
),
|
|
500
|
-
/* @__PURE__ */ jsx(
|
|
502
|
+
/* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
501
503
|
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsx(
|
|
502
504
|
StyledAlert,
|
|
503
505
|
{
|
|
@@ -611,7 +613,7 @@ const StyledMenuItem = styled(Menu.Item)`
|
|
|
611
613
|
}
|
|
612
614
|
|
|
613
615
|
&:hover {
|
|
614
|
-
background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
|
|
616
|
+
background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
|
|
615
617
|
}
|
|
616
618
|
`;
|
|
617
619
|
const PencilIcon = styled(Pencil)`
|
|
@@ -646,6 +648,7 @@ const EntryValidationText = ({ action, schema, entry }) => {
|
|
|
646
648
|
if (Object.keys(errors).length > 0) {
|
|
647
649
|
const validationErrorsMessages = Object.entries(errors).map(
|
|
648
650
|
([key, value]) => formatMessage(
|
|
651
|
+
// @ts-expect-error – TODO: fix this will better checks
|
|
649
652
|
{ id: `${value.id}.withField`, defaultMessage: value.defaultMessage },
|
|
650
653
|
{ field: key }
|
|
651
654
|
)
|
|
@@ -688,7 +691,6 @@ const ReleaseDetailsLayout = ({
|
|
|
688
691
|
const {
|
|
689
692
|
data,
|
|
690
693
|
isLoading: isLoadingDetails,
|
|
691
|
-
isError,
|
|
692
694
|
error
|
|
693
695
|
} = useGetReleaseQuery(
|
|
694
696
|
{ id: releaseId },
|
|
@@ -720,7 +722,7 @@ const ReleaseDetailsLayout = ({
|
|
|
720
722
|
totalPublishedEntries,
|
|
721
723
|
totalUnpublishedEntries
|
|
722
724
|
});
|
|
723
|
-
} else if (
|
|
725
|
+
} else if (isFetchError(response.error)) {
|
|
724
726
|
toggleNotification({
|
|
725
727
|
type: "danger",
|
|
726
728
|
message: formatAPIError(response.error)
|
|
@@ -755,7 +757,7 @@ const ReleaseDetailsLayout = ({
|
|
|
755
757
|
if (isLoadingDetails) {
|
|
756
758
|
return /* @__PURE__ */ jsx(Page.Loading, {});
|
|
757
759
|
}
|
|
758
|
-
if (
|
|
760
|
+
if (isBaseQueryError(error) && "code" in error || !release) {
|
|
759
761
|
return /* @__PURE__ */ jsx(
|
|
760
762
|
Navigate,
|
|
761
763
|
{
|
|
@@ -763,6 +765,7 @@ const ReleaseDetailsLayout = ({
|
|
|
763
765
|
state: {
|
|
764
766
|
errors: [
|
|
765
767
|
{
|
|
768
|
+
// @ts-expect-error – TODO: fix this weird error flow
|
|
766
769
|
code: error?.code
|
|
767
770
|
}
|
|
768
771
|
]
|
|
@@ -802,7 +805,7 @@ const ReleaseDetailsLayout = ({
|
|
|
802
805
|
) : "";
|
|
803
806
|
return /* @__PURE__ */ jsxs(Main, { "aria-busy": isLoadingDetails, children: [
|
|
804
807
|
/* @__PURE__ */ jsx(
|
|
805
|
-
|
|
808
|
+
Layouts.Header,
|
|
806
809
|
{
|
|
807
810
|
title: release.name,
|
|
808
811
|
subtitle: /* @__PURE__ */ jsxs(Flex, { gap: 2, lineHeight: 6, children: [
|
|
@@ -815,15 +818,14 @@ const ReleaseDetailsLayout = ({
|
|
|
815
818
|
/* @__PURE__ */ jsx(
|
|
816
819
|
Menu.Trigger,
|
|
817
820
|
{
|
|
818
|
-
as: IconButton,
|
|
819
821
|
paddingLeft: 2,
|
|
820
822
|
paddingRight: 2,
|
|
821
823
|
"aria-label": formatMessage({
|
|
822
824
|
id: "content-releases.header.actions.open-release-actions",
|
|
823
825
|
defaultMessage: "Release edit and delete menu"
|
|
824
826
|
}),
|
|
825
|
-
|
|
826
|
-
|
|
827
|
+
variant: "tertiary",
|
|
828
|
+
children: /* @__PURE__ */ jsx(More, {})
|
|
827
829
|
}
|
|
828
830
|
),
|
|
829
831
|
/* @__PURE__ */ jsxs(Menu.Content, { top: 1, popoverPlacement: "bottom-end", maxHeight: void 0, children: [
|
|
@@ -848,7 +850,7 @@ const ReleaseDetailsLayout = ({
|
|
|
848
850
|
{
|
|
849
851
|
disabled: !canDelete,
|
|
850
852
|
onSelect: toggleWarningSubmit,
|
|
851
|
-
variant: "danger",
|
|
853
|
+
$variant: "danger",
|
|
852
854
|
children: /* @__PURE__ */ jsxs(Flex, { alignItems: "center", gap: 2, hasRadius: true, width: "100%", children: [
|
|
853
855
|
/* @__PURE__ */ jsx(TrashIcon, {}),
|
|
854
856
|
/* @__PURE__ */ jsx(Typography, { ellipsis: true, textColor: "danger600", children: formatMessage({
|
|
@@ -941,7 +943,6 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
941
943
|
const {
|
|
942
944
|
data: releaseData,
|
|
943
945
|
isLoading: isReleaseLoading,
|
|
944
|
-
isError: isReleaseError,
|
|
945
946
|
error: releaseError
|
|
946
947
|
} = useGetReleaseQuery({ id: releaseId });
|
|
947
948
|
const {
|
|
@@ -989,7 +990,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
989
990
|
// We are passing the action path to found the position in the cache of the action for optimistic updates
|
|
990
991
|
});
|
|
991
992
|
if ("error" in response) {
|
|
992
|
-
if (
|
|
993
|
+
if (isFetchError(response.error)) {
|
|
993
994
|
toggleNotification({
|
|
994
995
|
type: "danger",
|
|
995
996
|
message: formatAPIError(response.error)
|
|
@@ -1009,14 +1010,14 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1009
1010
|
const releaseMeta = data?.meta;
|
|
1010
1011
|
const contentTypes = releaseMeta?.contentTypes || {};
|
|
1011
1012
|
const components = releaseMeta?.components || {};
|
|
1012
|
-
if (
|
|
1013
|
+
if (isBaseQueryError(releaseError) || !release) {
|
|
1013
1014
|
const errorsArray = [];
|
|
1014
|
-
if (releaseError) {
|
|
1015
|
+
if (releaseError && "code" in releaseError) {
|
|
1015
1016
|
errorsArray.push({
|
|
1016
1017
|
code: releaseError.code
|
|
1017
1018
|
});
|
|
1018
1019
|
}
|
|
1019
|
-
if (releaseActionsError) {
|
|
1020
|
+
if (releaseActionsError && "code" in releaseActionsError) {
|
|
1020
1021
|
errorsArray.push({
|
|
1021
1022
|
code: releaseActionsError.code
|
|
1022
1023
|
});
|
|
@@ -1035,13 +1036,13 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1035
1036
|
return /* @__PURE__ */ jsx(Page.Error, {});
|
|
1036
1037
|
}
|
|
1037
1038
|
if (Object.keys(releaseActions).length === 0) {
|
|
1038
|
-
return /* @__PURE__ */ jsx(
|
|
1039
|
+
return /* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsx(
|
|
1039
1040
|
EmptyStateLayout,
|
|
1040
1041
|
{
|
|
1041
1042
|
action: /* @__PURE__ */ jsx(
|
|
1042
1043
|
LinkButton,
|
|
1043
1044
|
{
|
|
1044
|
-
|
|
1045
|
+
tag: Link$1,
|
|
1045
1046
|
to: {
|
|
1046
1047
|
pathname: "/content-manager"
|
|
1047
1048
|
},
|
|
@@ -1099,7 +1100,7 @@ const ReleaseDetailsBody = ({ releaseId }) => {
|
|
|
1099
1100
|
] : []
|
|
1100
1101
|
];
|
|
1101
1102
|
const options = hasI18nEnabled ? GROUP_BY_OPTIONS : GROUP_BY_OPTIONS_NO_LOCALE;
|
|
1102
|
-
return /* @__PURE__ */ jsx(
|
|
1103
|
+
return /* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsxs(Flex, { gap: 8, direction: "column", alignItems: "stretch", children: [
|
|
1103
1104
|
/* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(
|
|
1104
1105
|
SingleSelect,
|
|
1105
1106
|
{
|
|
@@ -1244,7 +1245,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1244
1245
|
const title = releaseData?.name || "";
|
|
1245
1246
|
const timezone = releaseData?.timezone ?? null;
|
|
1246
1247
|
const scheduledAt = releaseData?.scheduledAt && timezone ? utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
1247
|
-
const date = scheduledAt ? format(scheduledAt, "yyyy-MM-dd") :
|
|
1248
|
+
const date = scheduledAt ? format(scheduledAt, "yyyy-MM-dd") : void 0;
|
|
1248
1249
|
const time = scheduledAt ? format(scheduledAt, "HH:mm") : "";
|
|
1249
1250
|
const handleEditRelease = async (values) => {
|
|
1250
1251
|
const response = await updateRelease({
|
|
@@ -1262,7 +1263,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1262
1263
|
})
|
|
1263
1264
|
});
|
|
1264
1265
|
toggleEditReleaseModal();
|
|
1265
|
-
} else if (
|
|
1266
|
+
} else if (isFetchError(response.error)) {
|
|
1266
1267
|
toggleNotification({
|
|
1267
1268
|
type: "danger",
|
|
1268
1269
|
message: formatAPIError(response.error)
|
|
@@ -1280,7 +1281,7 @@ const ReleaseDetailsPage = () => {
|
|
|
1280
1281
|
});
|
|
1281
1282
|
if ("data" in response) {
|
|
1282
1283
|
navigate("..");
|
|
1283
|
-
} else if (
|
|
1284
|
+
} else if (isFetchError(response.error)) {
|
|
1284
1285
|
toggleNotification({
|
|
1285
1286
|
type: "danger",
|
|
1286
1287
|
message: formatAPIError(response.error)
|
|
@@ -1340,4 +1341,4 @@ const App = () => {
|
|
|
1340
1341
|
export {
|
|
1341
1342
|
App
|
|
1342
1343
|
};
|
|
1343
|
-
//# sourceMappingURL=App-
|
|
1344
|
+
//# sourceMappingURL=App-D_6Y9N2F.mjs.map
|