@strapi/content-releases 0.0.0-next.aa7c7ec6724534e157d8a23fe85ee8318dabbf37 → 0.0.0-next.b6d552f6e63dec5627cb8611ab2adcb8244359be
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-pspKUC-W.js → App-5G7GEzBM.js} +292 -69
- package/dist/_chunks/App-5G7GEzBM.js.map +1 -0
- package/dist/_chunks/{App-8FCxPK8-.mjs → App-WMxox0mk.mjs} +293 -71
- package/dist/_chunks/App-WMxox0mk.mjs.map +1 -0
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs +51 -0
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +1 -0
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js +51 -0
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +1 -0
- package/dist/_chunks/{en-m9eTk4UF.mjs → en-WuuhP6Bn.mjs} +15 -4
- package/dist/_chunks/en-WuuhP6Bn.mjs.map +1 -0
- package/dist/_chunks/{en-r9YocBH0.js → en-gcJJ5htG.js} +15 -4
- package/dist/_chunks/en-gcJJ5htG.js.map +1 -0
- package/dist/_chunks/{index-8aK7GzI5.mjs → index-BZ8RPGiV.mjs} +91 -14
- package/dist/_chunks/index-BZ8RPGiV.mjs.map +1 -0
- package/dist/_chunks/{index-nGaPcY9m.js → index-pQ3hnZJy.js} +87 -10
- package/dist/_chunks/index-pQ3hnZJy.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/server/index.js +769 -431
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +768 -431
- package/dist/server/index.mjs.map +1 -1
- package/package.json +13 -11
- package/dist/_chunks/App-8FCxPK8-.mjs.map +0 -1
- package/dist/_chunks/App-pspKUC-W.js.map +0 -1
- package/dist/_chunks/en-m9eTk4UF.mjs.map +0 -1
- package/dist/_chunks/en-r9YocBH0.js.map +0 -1
- package/dist/_chunks/index-8aK7GzI5.mjs.map +0 -1
- package/dist/_chunks/index-nGaPcY9m.js.map +0 -1
|
@@ -3,14 +3,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const helperPlugin = require("@strapi/helper-plugin");
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-pQ3hnZJy.js");
|
|
7
7
|
const React = require("react");
|
|
8
8
|
const strapiAdmin = require("@strapi/admin/strapi-admin");
|
|
9
9
|
const designSystem = require("@strapi/design-system");
|
|
10
10
|
const v2 = require("@strapi/design-system/v2");
|
|
11
11
|
const icons = require("@strapi/icons");
|
|
12
|
+
const format = require("date-fns/format");
|
|
13
|
+
const dateFnsTz = require("date-fns-tz");
|
|
12
14
|
const reactIntl = require("react-intl");
|
|
13
15
|
const styled = require("styled-components");
|
|
16
|
+
const dateFns = require("date-fns");
|
|
14
17
|
const formik = require("formik");
|
|
15
18
|
const yup = require("yup");
|
|
16
19
|
require("@reduxjs/toolkit/query");
|
|
@@ -37,12 +40,28 @@ function _interopNamespace(e) {
|
|
|
37
40
|
return Object.freeze(n);
|
|
38
41
|
}
|
|
39
42
|
const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
43
|
+
const format__default = /* @__PURE__ */ _interopDefault(format);
|
|
40
44
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
41
45
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
42
46
|
const RELEASE_SCHEMA = yup__namespace.object().shape({
|
|
43
47
|
name: yup__namespace.string().trim().required(),
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
scheduledAt: yup__namespace.string().nullable(),
|
|
49
|
+
isScheduled: yup__namespace.boolean().optional(),
|
|
50
|
+
time: yup__namespace.string().when("isScheduled", {
|
|
51
|
+
is: true,
|
|
52
|
+
then: yup__namespace.string().trim().required(),
|
|
53
|
+
otherwise: yup__namespace.string().nullable()
|
|
54
|
+
}),
|
|
55
|
+
timezone: yup__namespace.string().when("isScheduled", {
|
|
56
|
+
is: true,
|
|
57
|
+
then: yup__namespace.string().required().nullable(),
|
|
58
|
+
otherwise: yup__namespace.string().nullable()
|
|
59
|
+
}),
|
|
60
|
+
date: yup__namespace.string().when("isScheduled", {
|
|
61
|
+
is: true,
|
|
62
|
+
then: yup__namespace.string().required().nullable(),
|
|
63
|
+
otherwise: yup__namespace.string().nullable()
|
|
64
|
+
})
|
|
46
65
|
}).required().noUnknown();
|
|
47
66
|
const ReleaseModal = ({
|
|
48
67
|
handleClose,
|
|
@@ -53,6 +72,24 @@ const ReleaseModal = ({
|
|
|
53
72
|
const { formatMessage } = reactIntl.useIntl();
|
|
54
73
|
const { pathname } = reactRouterDom.useLocation();
|
|
55
74
|
const isCreatingRelease = pathname === `/plugins/${index.pluginId}`;
|
|
75
|
+
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
76
|
+
const { timezoneList, systemTimezone = { value: "UTC+00:00-Africa/Abidjan " } } = getTimezones(
|
|
77
|
+
initialValues.scheduledAt ? new Date(initialValues.scheduledAt) : /* @__PURE__ */ new Date()
|
|
78
|
+
);
|
|
79
|
+
const getScheduledTimestamp = (values) => {
|
|
80
|
+
const { date, time, timezone } = values;
|
|
81
|
+
if (!date || !time || !timezone)
|
|
82
|
+
return null;
|
|
83
|
+
const formattedDate = dateFns.parse(time, "HH:mm", new Date(date));
|
|
84
|
+
const timezoneWithoutOffset = timezone.split("_")[1];
|
|
85
|
+
return dateFnsTz.zonedTimeToUtc(formattedDate, timezoneWithoutOffset);
|
|
86
|
+
};
|
|
87
|
+
const getTimezoneWithOffset = () => {
|
|
88
|
+
const currentTimezone = timezoneList.find(
|
|
89
|
+
(timezone) => timezone.value.split("_")[1] === initialValues.timezone
|
|
90
|
+
);
|
|
91
|
+
return currentTimezone?.value || systemTimezone.value;
|
|
92
|
+
};
|
|
56
93
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { onClose: handleClose, labelledBy: "title", children: [
|
|
57
94
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "title", fontWeight: "bold", textColor: "neutral800", children: formatMessage(
|
|
58
95
|
{
|
|
@@ -64,45 +101,134 @@ const ReleaseModal = ({
|
|
|
64
101
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
65
102
|
formik.Formik,
|
|
66
103
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
104
|
+
onSubmit: (values) => {
|
|
105
|
+
handleSubmit({
|
|
106
|
+
...values,
|
|
107
|
+
timezone: values.timezone ? values.timezone.split("_")[1] : null,
|
|
108
|
+
scheduledAt: values.isScheduled ? getScheduledTimestamp(values) : null
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
initialValues: {
|
|
112
|
+
...initialValues,
|
|
113
|
+
timezone: initialValues.timezone ? getTimezoneWithOffset() : systemTimezone.value
|
|
114
|
+
},
|
|
70
115
|
validationSchema: RELEASE_SCHEMA,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
116
|
+
validateOnChange: false,
|
|
117
|
+
children: ({ values, errors, handleChange, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
119
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
+
designSystem.TextInput,
|
|
121
|
+
{
|
|
122
|
+
label: formatMessage({
|
|
123
|
+
id: "content-releases.modal.form.input.label.release-name",
|
|
124
|
+
defaultMessage: "Name"
|
|
125
|
+
}),
|
|
126
|
+
name: "name",
|
|
127
|
+
value: values.name,
|
|
128
|
+
error: errors.name,
|
|
129
|
+
onChange: handleChange,
|
|
130
|
+
required: true
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
IsSchedulingEnabled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
134
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "max-content", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
135
|
+
designSystem.Checkbox,
|
|
136
|
+
{
|
|
137
|
+
name: "isScheduled",
|
|
138
|
+
value: values.isScheduled,
|
|
139
|
+
onChange: (event) => {
|
|
140
|
+
setFieldValue("isScheduled", event.target.checked);
|
|
141
|
+
if (!event.target.checked) {
|
|
142
|
+
setFieldValue("date", null);
|
|
143
|
+
setFieldValue("time", "");
|
|
144
|
+
setFieldValue("timezone", null);
|
|
145
|
+
} else {
|
|
146
|
+
setFieldValue("date", initialValues.date);
|
|
147
|
+
setFieldValue("time", initialValues.time);
|
|
148
|
+
setFieldValue(
|
|
149
|
+
"timezone",
|
|
150
|
+
initialValues.timezone ?? systemTimezone?.value
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
155
|
+
designSystem.Typography,
|
|
156
|
+
{
|
|
157
|
+
textColor: values.isScheduled ? "primary600" : "neutral800",
|
|
158
|
+
fontWeight: values.isScheduled ? "semiBold" : "regular",
|
|
159
|
+
children: formatMessage({
|
|
160
|
+
id: "modal.form.input.label.schedule-release",
|
|
161
|
+
defaultMessage: "Schedule release"
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
) }),
|
|
167
|
+
values.isScheduled && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
168
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, alignItems: "start", children: [
|
|
169
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
170
|
+
designSystem.DatePicker,
|
|
171
|
+
{
|
|
172
|
+
label: formatMessage({
|
|
173
|
+
id: "content-releases.modal.form.input.label.date",
|
|
174
|
+
defaultMessage: "Date"
|
|
175
|
+
}),
|
|
176
|
+
name: "date",
|
|
177
|
+
error: errors.date,
|
|
178
|
+
onChange: (date) => {
|
|
179
|
+
const isoFormatDate = date ? dateFns.formatISO(date, { representation: "date" }) : null;
|
|
180
|
+
setFieldValue("date", isoFormatDate);
|
|
181
|
+
},
|
|
182
|
+
clearLabel: formatMessage({
|
|
183
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
184
|
+
defaultMessage: "Clear"
|
|
185
|
+
}),
|
|
186
|
+
onClear: () => {
|
|
187
|
+
setFieldValue("date", null);
|
|
188
|
+
},
|
|
189
|
+
selectedDate: values.date || void 0,
|
|
190
|
+
required: true
|
|
191
|
+
}
|
|
192
|
+
) }),
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
+
designSystem.TimePicker,
|
|
195
|
+
{
|
|
196
|
+
label: formatMessage({
|
|
197
|
+
id: "content-releases.modal.form.input.label.time",
|
|
198
|
+
defaultMessage: "Time"
|
|
199
|
+
}),
|
|
200
|
+
name: "time",
|
|
201
|
+
error: errors.time,
|
|
202
|
+
onChange: (time) => {
|
|
203
|
+
setFieldValue("time", time);
|
|
204
|
+
},
|
|
205
|
+
clearLabel: formatMessage({
|
|
206
|
+
id: "content-releases.modal.form.input.clearLabel",
|
|
207
|
+
defaultMessage: "Clear"
|
|
208
|
+
}),
|
|
209
|
+
onClear: () => {
|
|
210
|
+
setFieldValue("time", "");
|
|
211
|
+
},
|
|
212
|
+
value: values.time || void 0,
|
|
213
|
+
required: true
|
|
214
|
+
}
|
|
215
|
+
) })
|
|
216
|
+
] }),
|
|
217
|
+
/* @__PURE__ */ jsxRuntime.jsx(TimezoneComponent, { timezoneOptions: timezoneList })
|
|
218
|
+
] })
|
|
219
|
+
] })
|
|
220
|
+
] }) }),
|
|
86
221
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
87
222
|
designSystem.ModalFooter,
|
|
88
223
|
{
|
|
89
224
|
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", name: "cancel", children: formatMessage({ id: "cancel", defaultMessage: "Cancel" }) }),
|
|
90
|
-
endActions: /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
-
designSystem.Button,
|
|
225
|
+
endActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { name: "submit", loading: isLoading, type: "submit", children: formatMessage(
|
|
92
226
|
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
{
|
|
99
|
-
id: "content-releases.modal.form.button.submit",
|
|
100
|
-
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
101
|
-
},
|
|
102
|
-
{ isCreatingRelease }
|
|
103
|
-
)
|
|
104
|
-
}
|
|
105
|
-
)
|
|
227
|
+
id: "content-releases.modal.form.button.submit",
|
|
228
|
+
defaultMessage: "{isCreatingRelease, select, true {Continue} other {Save}}"
|
|
229
|
+
},
|
|
230
|
+
{ isCreatingRelease }
|
|
231
|
+
) })
|
|
106
232
|
}
|
|
107
233
|
)
|
|
108
234
|
] })
|
|
@@ -110,6 +236,52 @@ const ReleaseModal = ({
|
|
|
110
236
|
)
|
|
111
237
|
] });
|
|
112
238
|
};
|
|
239
|
+
const getTimezones = (selectedDate) => {
|
|
240
|
+
const timezoneList = Intl.supportedValuesOf("timeZone").map((timezone) => {
|
|
241
|
+
const utcOffset = index.getTimezoneOffset(timezone, selectedDate);
|
|
242
|
+
return { offset: utcOffset, value: `${utcOffset}_${timezone}` };
|
|
243
|
+
});
|
|
244
|
+
const systemTimezone = timezoneList.find(
|
|
245
|
+
(timezone) => timezone.value.split("_")[1] === Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
246
|
+
);
|
|
247
|
+
return { timezoneList, systemTimezone };
|
|
248
|
+
};
|
|
249
|
+
const TimezoneComponent = ({ timezoneOptions }) => {
|
|
250
|
+
const { values, errors, setFieldValue } = formik.useFormikContext();
|
|
251
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
252
|
+
const [timezoneList, setTimezoneList] = React__namespace.useState(timezoneOptions);
|
|
253
|
+
React__namespace.useEffect(() => {
|
|
254
|
+
if (values.date) {
|
|
255
|
+
const { timezoneList: timezoneList2 } = getTimezones(new Date(values.date));
|
|
256
|
+
setTimezoneList(timezoneList2);
|
|
257
|
+
const updatedTimezone = values.timezone && timezoneList2.find((tz) => tz.value.split("_")[1] === values.timezone.split("_")[1]);
|
|
258
|
+
if (updatedTimezone) {
|
|
259
|
+
setFieldValue("timezone", updatedTimezone.value);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}, [setFieldValue, values.date, values.timezone]);
|
|
263
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
264
|
+
designSystem.Combobox,
|
|
265
|
+
{
|
|
266
|
+
label: formatMessage({
|
|
267
|
+
id: "content-releases.modal.form.input.label.timezone",
|
|
268
|
+
defaultMessage: "Timezone"
|
|
269
|
+
}),
|
|
270
|
+
name: "timezone",
|
|
271
|
+
value: values.timezone || void 0,
|
|
272
|
+
textValue: values.timezone ? values.timezone.replace("_", " ") : void 0,
|
|
273
|
+
onChange: (timezone) => {
|
|
274
|
+
setFieldValue("timezone", timezone);
|
|
275
|
+
},
|
|
276
|
+
onClear: () => {
|
|
277
|
+
setFieldValue("timezone", "");
|
|
278
|
+
},
|
|
279
|
+
error: errors.timezone,
|
|
280
|
+
required: true,
|
|
281
|
+
children: timezoneList.map((timezone) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: timezone.value, children: timezone.value.replace("_", " ") }, timezone.value))
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
};
|
|
113
285
|
const ReleaseInfoWrapper = styled__default.default(designSystem.Flex)`
|
|
114
286
|
align-self: stretch;
|
|
115
287
|
border-bottom-right-radius: ${({ theme }) => theme.borderRadius};
|
|
@@ -189,7 +361,7 @@ const ReleaseDetailsLayout = ({
|
|
|
189
361
|
toggleWarningSubmit,
|
|
190
362
|
children
|
|
191
363
|
}) => {
|
|
192
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
364
|
+
const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
|
|
193
365
|
const { releaseId } = reactRouterDom.useParams();
|
|
194
366
|
const {
|
|
195
367
|
data,
|
|
@@ -271,18 +443,41 @@ const ReleaseDetailsLayout = ({
|
|
|
271
443
|
}
|
|
272
444
|
const totalEntries = release.actions.meta.count || 0;
|
|
273
445
|
const hasCreatedByUser = Boolean(getCreatedByUser());
|
|
446
|
+
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
447
|
+
const isScheduled = release.scheduledAt && release.timezone;
|
|
448
|
+
const numberOfEntriesText = formatMessage(
|
|
449
|
+
{
|
|
450
|
+
id: "content-releases.pages.Details.header-subtitle",
|
|
451
|
+
defaultMessage: "{number, plural, =0 {No entries} one {# entry} other {# entries}}"
|
|
452
|
+
},
|
|
453
|
+
{ number: totalEntries }
|
|
454
|
+
);
|
|
455
|
+
const scheduledText = isScheduled ? formatMessage(
|
|
456
|
+
{
|
|
457
|
+
id: "content-releases.pages.ReleaseDetails.header-subtitle.scheduled",
|
|
458
|
+
defaultMessage: "Scheduled for {date} at {time} ({offset})"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
date: formatDate(new Date(release.scheduledAt), {
|
|
462
|
+
weekday: "long",
|
|
463
|
+
day: "numeric",
|
|
464
|
+
month: "long",
|
|
465
|
+
year: "numeric",
|
|
466
|
+
timeZone: release.timezone
|
|
467
|
+
}),
|
|
468
|
+
time: formatTime(new Date(release.scheduledAt), {
|
|
469
|
+
timeZone: release.timezone,
|
|
470
|
+
hourCycle: "h23"
|
|
471
|
+
}),
|
|
472
|
+
offset: index.getTimezoneOffset(release.timezone, new Date(release.scheduledAt))
|
|
473
|
+
}
|
|
474
|
+
) : "";
|
|
274
475
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Main, { "aria-busy": isLoadingDetails, children: [
|
|
275
476
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
276
477
|
designSystem.HeaderLayout,
|
|
277
478
|
{
|
|
278
479
|
title: release.name,
|
|
279
|
-
subtitle:
|
|
280
|
-
{
|
|
281
|
-
id: "content-releases.pages.Details.header-subtitle",
|
|
282
|
-
defaultMessage: "{number, plural, =0 {No entries} one {# entry} other {# entries}}"
|
|
283
|
-
},
|
|
284
|
-
{ number: totalEntries }
|
|
285
|
-
),
|
|
480
|
+
subtitle: numberOfEntriesText + (IsSchedulingEnabled && isScheduled ? ` - ${scheduledText}` : ""),
|
|
286
481
|
navigationAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Link, { startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, {}), to: "/plugins/content-releases", children: formatMessage({
|
|
287
482
|
id: "global.back",
|
|
288
483
|
defaultMessage: "Back"
|
|
@@ -731,11 +926,18 @@ const ReleaseDetailsPage = () => {
|
|
|
731
926
|
}
|
|
732
927
|
);
|
|
733
928
|
}
|
|
734
|
-
const
|
|
929
|
+
const releaseData = isSuccessDetails && data?.data || null;
|
|
930
|
+
const title = releaseData?.name || "";
|
|
931
|
+
const timezone = releaseData?.timezone ?? null;
|
|
932
|
+
const scheduledAt = releaseData?.scheduledAt && timezone ? dateFnsTz.utcToZonedTime(releaseData.scheduledAt, timezone) : null;
|
|
933
|
+
const date = scheduledAt ? new Date(format__default.default(scheduledAt, "yyyy-MM-dd")) : null;
|
|
934
|
+
const time = scheduledAt ? format__default.default(scheduledAt, "HH:mm") : "";
|
|
735
935
|
const handleEditRelease = async (values) => {
|
|
736
936
|
const response = await updateRelease({
|
|
737
937
|
id: releaseId,
|
|
738
|
-
name: values.name
|
|
938
|
+
name: values.name,
|
|
939
|
+
scheduledAt: values.scheduledAt,
|
|
940
|
+
timezone: values.timezone
|
|
739
941
|
});
|
|
740
942
|
if ("data" in response) {
|
|
741
943
|
toggleNotification({
|
|
@@ -789,7 +991,14 @@ const ReleaseDetailsPage = () => {
|
|
|
789
991
|
handleClose: toggleEditReleaseModal,
|
|
790
992
|
handleSubmit: handleEditRelease,
|
|
791
993
|
isLoading: isLoadingDetails || isSubmittingForm,
|
|
792
|
-
initialValues: {
|
|
994
|
+
initialValues: {
|
|
995
|
+
name: title || "",
|
|
996
|
+
scheduledAt,
|
|
997
|
+
date,
|
|
998
|
+
time,
|
|
999
|
+
isScheduled: Boolean(scheduledAt),
|
|
1000
|
+
timezone
|
|
1001
|
+
}
|
|
793
1002
|
}
|
|
794
1003
|
),
|
|
795
1004
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -814,6 +1023,7 @@ const LinkCard = styled__default.default(v2.Link)`
|
|
|
814
1023
|
`;
|
|
815
1024
|
const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
816
1025
|
const { formatMessage } = reactIntl.useIntl();
|
|
1026
|
+
const IsSchedulingEnabled = window.strapi.future.isEnabled("contentReleasesScheduling");
|
|
817
1027
|
if (isError) {
|
|
818
1028
|
return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.AnErrorOccurred, {});
|
|
819
1029
|
}
|
|
@@ -834,7 +1044,7 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
834
1044
|
}
|
|
835
1045
|
);
|
|
836
1046
|
}
|
|
837
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name, actions }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(LinkCard, { href: `content-releases/${id}`, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1047
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: releases.map(({ id, name, actions, scheduledAt }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.GridItem, { col: 3, s: 6, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(LinkCard, { href: `content-releases/${id}`, isExternal: false, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
838
1048
|
designSystem.Flex,
|
|
839
1049
|
{
|
|
840
1050
|
direction: "column",
|
|
@@ -849,7 +1059,10 @@ const ReleasesGrid = ({ sectionTitle, releases = [], isError = false }) => {
|
|
|
849
1059
|
gap: 2,
|
|
850
1060
|
children: [
|
|
851
1061
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { as: "h3", variant: "delta", fontWeight: "bold", children: name }),
|
|
852
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", children: formatMessage(
|
|
1062
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: IsSchedulingEnabled ? scheduledAt ? /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.RelativeTime, { timestamp: new Date(scheduledAt) }) : formatMessage({
|
|
1063
|
+
id: "content-releases.pages.Releases.not-scheduled",
|
|
1064
|
+
defaultMessage: "Not scheduled"
|
|
1065
|
+
}) : formatMessage(
|
|
853
1066
|
{
|
|
854
1067
|
id: "content-releases.page.Releases.release-item.entries",
|
|
855
1068
|
defaultMessage: "{number, plural, =0 {No entries} one {# entry} other {# entries}}"
|
|
@@ -869,7 +1082,13 @@ const StyledAlert = styled__default.default(designSystem.Alert)`
|
|
|
869
1082
|
}
|
|
870
1083
|
`;
|
|
871
1084
|
const INITIAL_FORM_VALUES = {
|
|
872
|
-
name: ""
|
|
1085
|
+
name: "",
|
|
1086
|
+
date: null,
|
|
1087
|
+
time: "",
|
|
1088
|
+
// Remove future flag check after Scheduling Beta release and replace with true as creating new release should include scheduling by default
|
|
1089
|
+
isScheduled: window.strapi.future.isEnabled("contentReleasesScheduling"),
|
|
1090
|
+
scheduledAt: null,
|
|
1091
|
+
timezone: null
|
|
873
1092
|
};
|
|
874
1093
|
const ReleasesPage = () => {
|
|
875
1094
|
const tabRef = React__namespace.useRef(null);
|
|
@@ -915,8 +1134,8 @@ const ReleasesPage = () => {
|
|
|
915
1134
|
if (isLoading) {
|
|
916
1135
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { "aria-busy": isLoading, children: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.LoadingIndicatorPage, {}) });
|
|
917
1136
|
}
|
|
918
|
-
const
|
|
919
|
-
const hasReachedMaximumPendingReleases =
|
|
1137
|
+
const totalPendingReleases = isSuccess && response.currentData?.meta?.pendingReleasesCount || 0;
|
|
1138
|
+
const hasReachedMaximumPendingReleases = totalPendingReleases >= maximumReleases;
|
|
920
1139
|
const handleTabChange = (index2) => {
|
|
921
1140
|
setQuery({
|
|
922
1141
|
...query,
|
|
@@ -929,9 +1148,11 @@ const ReleasesPage = () => {
|
|
|
929
1148
|
}
|
|
930
1149
|
});
|
|
931
1150
|
};
|
|
932
|
-
const handleAddRelease = async (
|
|
1151
|
+
const handleAddRelease = async ({ name, scheduledAt, timezone }) => {
|
|
933
1152
|
const response2 = await createRelease({
|
|
934
|
-
name
|
|
1153
|
+
name,
|
|
1154
|
+
scheduledAt,
|
|
1155
|
+
timezone
|
|
935
1156
|
});
|
|
936
1157
|
if ("data" in response2) {
|
|
937
1158
|
toggleNotification({
|
|
@@ -963,13 +1184,10 @@ const ReleasesPage = () => {
|
|
|
963
1184
|
id: "content-releases.pages.Releases.title",
|
|
964
1185
|
defaultMessage: "Releases"
|
|
965
1186
|
}),
|
|
966
|
-
subtitle: formatMessage(
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
},
|
|
971
|
-
{ number: totalReleases }
|
|
972
|
-
),
|
|
1187
|
+
subtitle: formatMessage({
|
|
1188
|
+
id: "content-releases.pages.Releases.header-subtitle",
|
|
1189
|
+
defaultMessage: "Create and manage content updates"
|
|
1190
|
+
}),
|
|
973
1191
|
primaryAction: /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: index.PERMISSIONS.create, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
974
1192
|
designSystem.Button,
|
|
975
1193
|
{
|
|
@@ -985,7 +1203,7 @@ const ReleasesPage = () => {
|
|
|
985
1203
|
}
|
|
986
1204
|
),
|
|
987
1205
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ContentLayout, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
988
|
-
|
|
1206
|
+
hasReachedMaximumPendingReleases && /* @__PURE__ */ jsxRuntime.jsx(
|
|
989
1207
|
StyledAlert,
|
|
990
1208
|
{
|
|
991
1209
|
marginBottom: 6,
|
|
@@ -1023,10 +1241,15 @@ const ReleasesPage = () => {
|
|
|
1023
1241
|
children: [
|
|
1024
1242
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingBottom: 8, children: [
|
|
1025
1243
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
1026
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage(
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1244
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage(
|
|
1245
|
+
{
|
|
1246
|
+
id: "content-releases.pages.Releases.tab.pending",
|
|
1247
|
+
defaultMessage: "Pending ({count})"
|
|
1248
|
+
},
|
|
1249
|
+
{
|
|
1250
|
+
count: totalPendingReleases
|
|
1251
|
+
}
|
|
1252
|
+
) }),
|
|
1030
1253
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage({
|
|
1031
1254
|
id: "content-releases.pages.Releases.tab.done",
|
|
1032
1255
|
defaultMessage: "Done"
|
|
@@ -1055,7 +1278,7 @@ const ReleasesPage = () => {
|
|
|
1055
1278
|
]
|
|
1056
1279
|
}
|
|
1057
1280
|
),
|
|
1058
|
-
|
|
1281
|
+
response.currentData?.meta?.pagination?.total ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { paddingTop: 4, alignItems: "flex-end", justifyContent: "space-between", children: [
|
|
1059
1282
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1060
1283
|
helperPlugin.PageSizeURLQuery,
|
|
1061
1284
|
{
|
|
@@ -1071,7 +1294,7 @@ const ReleasesPage = () => {
|
|
|
1071
1294
|
}
|
|
1072
1295
|
}
|
|
1073
1296
|
)
|
|
1074
|
-
] })
|
|
1297
|
+
] }) : null
|
|
1075
1298
|
] }) }),
|
|
1076
1299
|
releaseModalShown && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1077
1300
|
ReleaseModal,
|
|
@@ -1091,4 +1314,4 @@ const App = () => {
|
|
|
1091
1314
|
] }) });
|
|
1092
1315
|
};
|
|
1093
1316
|
exports.App = App;
|
|
1094
|
-
//# sourceMappingURL=App-
|
|
1317
|
+
//# sourceMappingURL=App-5G7GEzBM.js.map
|