@strapi/content-releases 0.0.0-experimental.ee4d311a5e6a131fad03cf07e4696f49fdd9c2e6 → 0.0.0-experimental.f75e3c6d67cc47c64ab37479efdbb7b43be50b78

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 (110) hide show
  1. package/dist/_chunks/App-DUmziQ17.js +1366 -0
  2. package/dist/_chunks/App-DUmziQ17.js.map +1 -0
  3. package/dist/_chunks/App-D_6Y9N2F.mjs +1344 -0
  4. package/dist/_chunks/App-D_6Y9N2F.mjs.map +1 -0
  5. package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js +52 -0
  6. package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
  7. package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs +52 -0
  8. package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
  9. package/dist/_chunks/{en-MyLPoISH.mjs → en-B9Ur3VsE.mjs} +30 -7
  10. package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
  11. package/dist/_chunks/{en-gYDqKYFd.js → en-DtFJ5ViE.js} +30 -7
  12. package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
  13. package/dist/_chunks/{index-EIe8S-cw.mjs → index-BomF0-yY.mjs} +352 -221
  14. package/dist/_chunks/index-BomF0-yY.mjs.map +1 -0
  15. package/dist/_chunks/{index-l5iuP0Hb.js → index-C5Hc767q.js} +346 -217
  16. package/dist/_chunks/index-C5Hc767q.js.map +1 -0
  17. package/dist/admin/index.js +1 -15
  18. package/dist/admin/index.js.map +1 -1
  19. package/dist/admin/index.mjs +2 -16
  20. package/dist/admin/index.mjs.map +1 -1
  21. package/dist/admin/src/components/CMReleasesContainer.d.ts +22 -0
  22. package/dist/admin/src/components/RelativeTime.d.ts +28 -0
  23. package/dist/admin/src/components/ReleaseAction.d.ts +3 -0
  24. package/dist/admin/src/components/ReleaseActionMenu.d.ts +26 -0
  25. package/dist/admin/src/components/ReleaseActionOptions.d.ts +9 -0
  26. package/dist/admin/src/components/ReleaseListCell.d.ts +0 -0
  27. package/dist/admin/src/components/ReleaseModal.d.ts +16 -0
  28. package/dist/admin/src/constants.d.ts +58 -0
  29. package/dist/admin/src/index.d.ts +3 -0
  30. package/dist/admin/src/pages/App.d.ts +1 -0
  31. package/dist/admin/src/pages/PurchaseContentReleases.d.ts +2 -0
  32. package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +2 -0
  33. package/dist/admin/src/pages/ReleasesPage.d.ts +8 -0
  34. package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +181 -0
  35. package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +39 -0
  36. package/dist/admin/src/pluginId.d.ts +1 -0
  37. package/dist/admin/src/services/release.d.ts +105 -0
  38. package/dist/admin/src/store/hooks.d.ts +7 -0
  39. package/dist/admin/src/utils/api.d.ts +6 -0
  40. package/dist/admin/src/utils/prefixPluginTranslations.d.ts +3 -0
  41. package/dist/admin/src/utils/time.d.ts +1 -0
  42. package/dist/server/index.js +1113 -418
  43. package/dist/server/index.js.map +1 -1
  44. package/dist/server/index.mjs +1113 -418
  45. package/dist/server/index.mjs.map +1 -1
  46. package/dist/server/src/bootstrap.d.ts +5 -0
  47. package/dist/server/src/bootstrap.d.ts.map +1 -0
  48. package/dist/server/src/constants.d.ts +12 -0
  49. package/dist/server/src/constants.d.ts.map +1 -0
  50. package/dist/server/src/content-types/index.d.ts +99 -0
  51. package/dist/server/src/content-types/index.d.ts.map +1 -0
  52. package/dist/server/src/content-types/release/index.d.ts +48 -0
  53. package/dist/server/src/content-types/release/index.d.ts.map +1 -0
  54. package/dist/server/src/content-types/release/schema.d.ts +47 -0
  55. package/dist/server/src/content-types/release/schema.d.ts.map +1 -0
  56. package/dist/server/src/content-types/release-action/index.d.ts +50 -0
  57. package/dist/server/src/content-types/release-action/index.d.ts.map +1 -0
  58. package/dist/server/src/content-types/release-action/schema.d.ts +49 -0
  59. package/dist/server/src/content-types/release-action/schema.d.ts.map +1 -0
  60. package/dist/server/src/controllers/index.d.ts +20 -0
  61. package/dist/server/src/controllers/index.d.ts.map +1 -0
  62. package/dist/server/src/controllers/release-action.d.ts +10 -0
  63. package/dist/server/src/controllers/release-action.d.ts.map +1 -0
  64. package/dist/server/src/controllers/release.d.ts +12 -0
  65. package/dist/server/src/controllers/release.d.ts.map +1 -0
  66. package/dist/server/src/controllers/validation/release-action.d.ts +8 -0
  67. package/dist/server/src/controllers/validation/release-action.d.ts.map +1 -0
  68. package/dist/server/src/controllers/validation/release.d.ts +2 -0
  69. package/dist/server/src/controllers/validation/release.d.ts.map +1 -0
  70. package/dist/server/src/destroy.d.ts +5 -0
  71. package/dist/server/src/destroy.d.ts.map +1 -0
  72. package/dist/server/src/index.d.ts +2096 -0
  73. package/dist/server/src/index.d.ts.map +1 -0
  74. package/dist/server/src/migrations/index.d.ts +13 -0
  75. package/dist/server/src/migrations/index.d.ts.map +1 -0
  76. package/dist/server/src/register.d.ts +5 -0
  77. package/dist/server/src/register.d.ts.map +1 -0
  78. package/dist/server/src/routes/index.d.ts +35 -0
  79. package/dist/server/src/routes/index.d.ts.map +1 -0
  80. package/dist/server/src/routes/release-action.d.ts +18 -0
  81. package/dist/server/src/routes/release-action.d.ts.map +1 -0
  82. package/dist/server/src/routes/release.d.ts +18 -0
  83. package/dist/server/src/routes/release.d.ts.map +1 -0
  84. package/dist/server/src/services/index.d.ts +1826 -0
  85. package/dist/server/src/services/index.d.ts.map +1 -0
  86. package/dist/server/src/services/release.d.ts +66 -0
  87. package/dist/server/src/services/release.d.ts.map +1 -0
  88. package/dist/server/src/services/scheduling.d.ts +18 -0
  89. package/dist/server/src/services/scheduling.d.ts.map +1 -0
  90. package/dist/server/src/services/validation.d.ts +18 -0
  91. package/dist/server/src/services/validation.d.ts.map +1 -0
  92. package/dist/server/src/utils/index.d.ts +14 -0
  93. package/dist/server/src/utils/index.d.ts.map +1 -0
  94. package/dist/shared/contracts/release-actions.d.ts +131 -0
  95. package/dist/shared/contracts/release-actions.d.ts.map +1 -0
  96. package/dist/shared/contracts/releases.d.ts +182 -0
  97. package/dist/shared/contracts/releases.d.ts.map +1 -0
  98. package/dist/shared/types.d.ts +24 -0
  99. package/dist/shared/types.d.ts.map +1 -0
  100. package/dist/shared/validation-schemas.d.ts +2 -0
  101. package/dist/shared/validation-schemas.d.ts.map +1 -0
  102. package/package.json +31 -35
  103. package/dist/_chunks/App-0yPbcoGt.js +0 -1037
  104. package/dist/_chunks/App-0yPbcoGt.js.map +0 -1
  105. package/dist/_chunks/App-BWaM2ihP.mjs +0 -1015
  106. package/dist/_chunks/App-BWaM2ihP.mjs.map +0 -1
  107. package/dist/_chunks/en-MyLPoISH.mjs.map +0 -1
  108. package/dist/_chunks/en-gYDqKYFd.js.map +0 -1
  109. package/dist/_chunks/index-EIe8S-cw.mjs.map +0 -1
  110. package/dist/_chunks/index-l5iuP0Hb.js.map +0 -1
@@ -1,20 +1,17 @@
1
1
  "use strict";
2
- const helperPlugin = require("@strapi/helper-plugin");
3
2
  const icons = require("@strapi/icons");
4
3
  const jsxRuntime = require("react/jsx-runtime");
5
4
  const React = require("react");
6
5
  const query = require("@reduxjs/toolkit/query");
6
+ const strapiAdmin = require("@strapi/admin/strapi-admin");
7
+ const strapiAdmin$1 = require("@strapi/content-manager/strapi-admin");
7
8
  const designSystem = require("@strapi/design-system");
8
- const v2 = require("@strapi/design-system/v2");
9
- const axios = require("axios");
9
+ const symbols = require("@strapi/icons/symbols");
10
10
  const formik = require("formik");
11
11
  const reactIntl = require("react-intl");
12
12
  const reactRouterDom = require("react-router-dom");
13
13
  const yup = require("yup");
14
- const react = require("@reduxjs/toolkit/query/react");
15
- const styled = require("styled-components");
16
- const reactRedux = require("react-redux");
17
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
14
+ const styledComponents = require("styled-components");
18
15
  function _interopNamespace(e) {
19
16
  if (e && e.__esModule)
20
17
  return e;
@@ -35,7 +32,6 @@ function _interopNamespace(e) {
35
32
  }
36
33
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
37
34
  const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
38
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
39
35
  const __variableDynamicImportRuntimeHelper = (glob, path) => {
40
36
  const v = glob[path];
41
37
  if (v) {
@@ -117,49 +113,9 @@ const PERMISSIONS = {
117
113
  }
118
114
  ]
119
115
  };
120
- const pluginId = "content-releases";
121
- const axiosBaseQuery = async ({
122
- url,
123
- method,
124
- data,
125
- config
126
- }) => {
127
- try {
128
- const { get, post, del, put } = helperPlugin.getFetchClient();
129
- if (method === "POST") {
130
- const result2 = await post(url, data, config);
131
- return { data: result2.data };
132
- }
133
- if (method === "DELETE") {
134
- const result2 = await del(url, config);
135
- return { data: result2.data };
136
- }
137
- if (method === "PUT") {
138
- const result2 = await put(url, data, config);
139
- return { data: result2.data };
140
- }
141
- const result = await get(url, config);
142
- return { data: result.data };
143
- } catch (error) {
144
- const err = error;
145
- return {
146
- error: {
147
- status: err.response?.status,
148
- code: err.code,
149
- response: {
150
- data: err.response?.data
151
- }
152
- }
153
- };
154
- }
155
- };
156
- const isAxiosError = (err) => {
157
- return typeof err === "object" && err !== null && "response" in err && typeof err.response === "object" && err.response !== null && "data" in err.response;
158
- };
159
- const releaseApi = react.createApi({
160
- reducerPath: pluginId,
161
- baseQuery: axiosBaseQuery,
162
- tagTypes: ["Release", "ReleaseAction"],
116
+ const releaseApi = strapiAdmin.adminApi.enhanceEndpoints({
117
+ addTagTypes: ["Release", "ReleaseAction", "EntriesInRelease"]
118
+ }).injectEndpoints({
163
119
  endpoints: (build) => {
164
120
  return {
165
121
  getReleasesForEntry: build.query({
@@ -274,6 +230,20 @@ const releaseApi = react.createApi({
274
230
  { type: "ReleaseAction", id: "LIST" }
275
231
  ]
276
232
  }),
233
+ createManyReleaseActions: build.mutation({
234
+ query({ body, params }) {
235
+ return {
236
+ url: `/content-releases/${params.releaseId}/actions/bulk`,
237
+ method: "POST",
238
+ data: body
239
+ };
240
+ },
241
+ invalidatesTags: [
242
+ { type: "Release", id: "LIST" },
243
+ { type: "ReleaseAction", id: "LIST" },
244
+ { type: "EntriesInRelease" }
245
+ ]
246
+ }),
277
247
  updateReleaseAction: build.mutation({
278
248
  query({ body, params }) {
279
249
  return {
@@ -282,7 +252,31 @@ const releaseApi = react.createApi({
282
252
  data: body
283
253
  };
284
254
  },
285
- invalidatesTags: () => [{ type: "ReleaseAction", id: "LIST" }]
255
+ invalidatesTags: () => [{ type: "ReleaseAction", id: "LIST" }],
256
+ async onQueryStarted({ body, params, query: query2, actionPath }, { dispatch, queryFulfilled }) {
257
+ const paramsWithoutActionId = {
258
+ releaseId: params.releaseId,
259
+ ...query2
260
+ };
261
+ const patchResult = dispatch(
262
+ releaseApi.util.updateQueryData(
263
+ "getReleaseActions",
264
+ paramsWithoutActionId,
265
+ (draft) => {
266
+ const [key, index] = actionPath;
267
+ const action = draft.data[key][index];
268
+ if (action) {
269
+ action.type = body.type;
270
+ }
271
+ }
272
+ )
273
+ );
274
+ try {
275
+ await queryFulfilled;
276
+ } catch {
277
+ patchResult.undo();
278
+ }
279
+ }
286
280
  }),
287
281
  deleteReleaseAction: build.mutation({
288
282
  query({ params }) {
@@ -291,9 +285,11 @@ const releaseApi = react.createApi({
291
285
  method: "DELETE"
292
286
  };
293
287
  },
294
- invalidatesTags: [
288
+ invalidatesTags: (result, error, arg) => [
295
289
  { type: "Release", id: "LIST" },
296
- { type: "ReleaseAction", id: "LIST" }
290
+ { type: "Release", id: arg.params.releaseId },
291
+ { type: "ReleaseAction", id: "LIST" },
292
+ { type: "EntriesInRelease" }
297
293
  ]
298
294
  }),
299
295
  publishRelease: build.mutation({
@@ -312,7 +308,22 @@ const releaseApi = react.createApi({
312
308
  method: "DELETE"
313
309
  };
314
310
  },
315
- invalidatesTags: (result, error, arg) => [{ type: "Release", id: arg.id }]
311
+ invalidatesTags: () => [{ type: "Release", id: "LIST" }, { type: "EntriesInRelease" }]
312
+ }),
313
+ getMappedEntriesInReleases: build.query({
314
+ query(params) {
315
+ return {
316
+ url: "/content-releases/mapEntriesToReleases",
317
+ method: "GET",
318
+ config: {
319
+ params
320
+ }
321
+ };
322
+ },
323
+ transformResponse(response) {
324
+ return response.data;
325
+ },
326
+ providesTags: [{ type: "EntriesInRelease" }]
316
327
  })
317
328
  };
318
329
  }
@@ -324,22 +335,36 @@ const {
324
335
  useGetReleaseActionsQuery,
325
336
  useCreateReleaseMutation,
326
337
  useCreateReleaseActionMutation,
338
+ useCreateManyReleaseActionsMutation,
327
339
  useUpdateReleaseMutation,
328
340
  useUpdateReleaseActionMutation,
329
341
  usePublishReleaseMutation,
330
342
  useDeleteReleaseActionMutation,
331
- useDeleteReleaseMutation
343
+ useDeleteReleaseMutation,
344
+ useGetMappedEntriesInReleasesQuery
332
345
  } = releaseApi;
333
- const useTypedDispatch = reactRedux.useDispatch;
334
- const useTypedSelector = reactRedux.useSelector;
335
- const StyledMenuItem = styled__default.default(v2.Menu.Item)`
346
+ const getTimezoneOffset = (timezone, date) => {
347
+ try {
348
+ const offsetPart = new Intl.DateTimeFormat("en", {
349
+ timeZone: timezone,
350
+ timeZoneName: "longOffset"
351
+ }).formatToParts(date).find((part) => part.type === "timeZoneName");
352
+ const offset = offsetPart ? offsetPart.value : "";
353
+ let utcOffset = offset.replace("GMT", "UTC");
354
+ if (!utcOffset.includes("+") && !utcOffset.includes("-")) {
355
+ utcOffset = `${utcOffset}+00:00`;
356
+ }
357
+ return utcOffset;
358
+ } catch (error) {
359
+ return "";
360
+ }
361
+ };
362
+ const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
336
363
  &:hover {
337
- background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
364
+ background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
338
365
 
339
366
  svg {
340
- path {
341
- fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
342
- }
367
+ fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
343
368
  }
344
369
 
345
370
  a {
@@ -348,9 +373,7 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
348
373
  }
349
374
 
350
375
  svg {
351
- path {
352
- fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
353
- }
376
+ fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
354
377
  }
355
378
 
356
379
  a {
@@ -362,15 +385,14 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
362
385
  width: 100%;
363
386
  }
364
387
  `;
365
- const StyledIconButton = styled__default.default(designSystem.IconButton)`
366
- /* Setting this style inline with borderColor will not apply the style */
367
- border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
368
- `;
369
388
  const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
370
389
  const { formatMessage } = reactIntl.useIntl();
371
- const toggleNotification = helperPlugin.useNotification();
372
- const { formatAPIError } = helperPlugin.useAPIErrorHandler();
390
+ const { toggleNotification } = strapiAdmin.useNotification();
391
+ const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
373
392
  const [deleteReleaseAction] = useDeleteReleaseActionMutation();
393
+ const {
394
+ allowedActions: { canDeleteAction }
395
+ } = strapiAdmin.useRBAC(PERMISSIONS);
374
396
  const handleDeleteAction = async () => {
375
397
  const response = await deleteReleaseAction({
376
398
  params: { releaseId, actionId }
@@ -386,26 +408,29 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
386
408
  return;
387
409
  }
388
410
  if ("error" in response) {
389
- if (axios.isAxiosError(response.error)) {
411
+ if (strapiAdmin.isFetchError(response.error)) {
390
412
  toggleNotification({
391
- type: "warning",
413
+ type: "danger",
392
414
  message: formatAPIError(response.error)
393
415
  });
394
416
  } else {
395
417
  toggleNotification({
396
- type: "warning",
418
+ type: "danger",
397
419
  message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
398
420
  });
399
421
  }
400
422
  }
401
423
  };
402
- return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.deleteAction, children: /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
403
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Cross, padding: 1 }),
424
+ if (!canDeleteAction) {
425
+ return null;
426
+ }
427
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { $variant: "danger", onSelect: handleDeleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
428
+ /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, { width: "1.6rem", height: "1.6rem" }),
404
429
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
405
430
  id: "content-releases.content-manager-edit-view.remove-from-release",
406
431
  defaultMessage: "Remove from release"
407
432
  }) })
408
- ] }) }) });
433
+ ] }) });
409
434
  };
410
435
  const ReleaseActionEntryLinkItem = ({
411
436
  contentTypeUid,
@@ -413,66 +438,84 @@ const ReleaseActionEntryLinkItem = ({
413
438
  locale
414
439
  }) => {
415
440
  const { formatMessage } = reactIntl.useIntl();
416
- const collectionTypePermissions = useTypedSelector(
417
- (state) => state.rbacProvider.collectionTypesRelatedPermissions
418
- );
419
- const updatePermissions = contentTypeUid ? collectionTypePermissions[contentTypeUid]?.["plugin::content-manager.explorer.update"] : [];
420
- const canUpdateEntryForLocale = Boolean(
421
- !locale || updatePermissions?.find(
422
- (permission) => permission.properties?.locales?.includes(locale)
423
- )
424
- );
441
+ const userPermissions = strapiAdmin.useAuth("ReleaseActionEntryLinkItem", (state) => state.permissions);
442
+ const canUpdateEntryForLocale = React__namespace.useMemo(() => {
443
+ const updatePermissions = userPermissions.find(
444
+ (permission) => permission.subject === contentTypeUid && permission.action === "plugin::content-manager.explorer.update"
445
+ );
446
+ if (!updatePermissions) {
447
+ return false;
448
+ }
449
+ return Boolean(!locale || updatePermissions.properties?.locales?.includes(locale));
450
+ }, [contentTypeUid, locale, userPermissions]);
451
+ const {
452
+ allowedActions: { canUpdate: canUpdateContentType }
453
+ } = strapiAdmin.useRBAC({
454
+ updateContentType: [
455
+ {
456
+ action: "plugin::content-manager.explorer.update",
457
+ subject: contentTypeUid
458
+ }
459
+ ]
460
+ });
461
+ if (!canUpdateContentType || !canUpdateEntryForLocale) {
462
+ return null;
463
+ }
425
464
  return /* @__PURE__ */ jsxRuntime.jsx(
426
- helperPlugin.CheckPermissions,
465
+ StyledMenuItem,
427
466
  {
428
- permissions: [
429
- {
430
- action: "plugin::content-manager.explorer.update",
431
- subject: contentTypeUid
432
- }
433
- ],
434
- children: canUpdateEntryForLocale && /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
435
- v2.Link,
436
- {
437
- as: reactRouterDom.NavLink,
438
- to: {
439
- pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
440
- search: locale && `?plugins[i18n][locale]=${locale}`
441
- },
442
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil, padding: 1 }),
443
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
444
- id: "content-releases.content-manager-edit-view.edit-entry",
445
- defaultMessage: "Edit entry"
446
- }) })
447
- }
448
- ) })
467
+ tag: reactRouterDom.Link,
468
+ isLink: true,
469
+ to: {
470
+ pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
471
+ search: locale && `?plugins[i18n][locale]=${locale}`
472
+ },
473
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
474
+ /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, { width: "1.6rem", height: "1.6rem" }),
475
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
476
+ id: "content-releases.content-manager-edit-view.edit-entry",
477
+ defaultMessage: "Edit entry"
478
+ }) })
479
+ ] })
449
480
  }
450
481
  );
451
482
  };
452
- const Root = ({ children, hasTriggerBorder = false }) => {
483
+ const EditReleaseItem = ({ releaseId }) => {
484
+ const { formatMessage } = reactIntl.useIntl();
485
+ return (
486
+ /* @ts-expect-error inference isn't working in DS */
487
+ /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { tag: reactRouterDom.Link, isLink: true, to: `/plugins/content-releases/${releaseId}`, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
488
+ /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, { width: "1.6rem", height: "1.6rem" }),
489
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
490
+ id: "content-releases.content-manager-edit-view.edit-release",
491
+ defaultMessage: "Edit release"
492
+ }) })
493
+ ] }) })
494
+ );
495
+ };
496
+ const Root = ({ children }) => {
453
497
  const { formatMessage } = reactIntl.useIntl();
498
+ const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
454
499
  return (
455
500
  // A user can access the dropdown if they have permissions to delete a release-action OR update a release
456
- /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: [...PERMISSIONS.deleteAction, ...PERMISSIONS.update], children: /* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Root, { children: [
457
- /* @__PURE__ */ jsxRuntime.jsx(
458
- v2.Menu.Trigger,
501
+ allowedActions.canDeleteAction || allowedActions.canUpdate ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
502
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Trigger, { paddingLeft: 2, paddingRight: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
503
+ designSystem.AccessibleIcon,
459
504
  {
460
- as: hasTriggerBorder ? StyledIconButton : designSystem.IconButton,
461
- paddingLeft: 2,
462
- paddingRight: 2,
463
- "aria-label": formatMessage({
505
+ label: formatMessage({
464
506
  id: "content-releases.content-manager-edit-view.release-action-menu",
465
507
  defaultMessage: "Release action options"
466
508
  }),
467
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
509
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
468
510
  }
469
- ),
470
- /* @__PURE__ */ jsxRuntime.jsx(v2.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
471
- ] }) })
511
+ ) }),
512
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
513
+ ] }) : null
472
514
  );
473
515
  };
474
516
  const ReleaseActionMenu = {
475
517
  Root,
518
+ EditReleaseItem,
476
519
  DeleteReleaseActionItem,
477
520
  ReleaseActionEntryLinkItem
478
521
  };
@@ -482,11 +525,11 @@ const getBorderLeftRadiusValue = (actionType) => {
482
525
  const getBorderRightRadiusValue = (actionType) => {
483
526
  return actionType === "publish" ? 0 : 1;
484
527
  };
485
- const FieldWrapper = styled__default.default(designSystem.Field)`
486
- border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
487
- border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
488
- border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
489
- border-bottom-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
528
+ const FieldWrapper = styledComponents.styled(designSystem.Field.Root)`
529
+ border-top-left-radius: ${({ $actionType, theme }) => theme.spaces[getBorderLeftRadiusValue($actionType)]};
530
+ border-bottom-left-radius: ${({ $actionType, theme }) => theme.spaces[getBorderLeftRadiusValue($actionType)]};
531
+ border-top-right-radius: ${({ $actionType, theme }) => theme.spaces[getBorderRightRadiusValue($actionType)]};
532
+ border-bottom-right-radius: ${({ $actionType, theme }) => theme.spaces[getBorderRightRadiusValue($actionType)]};
490
533
 
491
534
  > label {
492
535
  color: inherit;
@@ -496,39 +539,61 @@ const FieldWrapper = styled__default.default(designSystem.Field)`
496
539
  text-transform: capitalize;
497
540
  }
498
541
 
499
- &:active,
500
542
  &[data-checked='true'] {
501
- color: ${({ theme }) => theme.colors.primary700};
502
- background-color: ${({ theme }) => theme.colors.primary100};
503
- border-color: ${({ theme }) => theme.colors.primary700};
543
+ color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
544
+ background-color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
545
+ border-color: ${({ theme, $actionType }) => $actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
504
546
  }
505
547
 
506
548
  &[data-checked='false'] {
507
- border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
508
- border-right: ${({ actionType }) => actionType === "publish" && "none"};
549
+ border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
550
+ border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
551
+ }
552
+
553
+ &[data-checked='false'][data-disabled='false']:hover {
554
+ color: ${({ theme }) => theme.colors.neutral700};
555
+ background-color: ${({ theme }) => theme.colors.neutral100};
556
+ border-color: ${({ theme }) => theme.colors.neutral200};
557
+
558
+ & > label {
559
+ cursor: pointer;
560
+ }
561
+ }
562
+
563
+ &[data-disabled='true'] {
564
+ color: ${({ theme }) => theme.colors.neutral600};
565
+ background-color: ${({ theme }) => theme.colors.neutral150};
566
+ border-color: ${({ theme }) => theme.colors.neutral300};
509
567
  }
510
568
  `;
511
- const ActionOption = ({ selected, actionType, handleChange, name }) => {
569
+ const ActionOption = ({
570
+ selected,
571
+ actionType,
572
+ handleChange,
573
+ name,
574
+ disabled = false
575
+ }) => {
512
576
  return /* @__PURE__ */ jsxRuntime.jsx(
513
577
  FieldWrapper,
514
578
  {
515
- actionType,
579
+ $actionType: actionType,
516
580
  background: "primary0",
517
581
  borderColor: "neutral200",
518
582
  color: selected === actionType ? "primary600" : "neutral600",
519
583
  position: "relative",
520
584
  cursor: "pointer",
521
585
  "data-checked": selected === actionType,
522
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.FieldLabel, { htmlFor: `${name}-${actionType}`, children: [
586
+ "data-disabled": disabled && selected !== actionType,
587
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
523
588
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
524
- designSystem.FieldInput,
589
+ designSystem.Field.Input,
525
590
  {
526
591
  type: "radio",
527
- id: `${name}-${actionType}`,
528
592
  name,
529
593
  checked: selected === actionType,
530
594
  onChange: handleChange,
531
- value: actionType
595
+ value: actionType,
596
+ disabled
532
597
  }
533
598
  ) }),
534
599
  actionType
@@ -536,7 +601,12 @@ const ActionOption = ({ selected, actionType, handleChange, name }) => {
536
601
  }
537
602
  );
538
603
  };
539
- const ReleaseActionOptions = ({ selected, handleChange, name }) => {
604
+ const ReleaseActionOptions = ({
605
+ selected,
606
+ handleChange,
607
+ name,
608
+ disabled = false
609
+ }) => {
540
610
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
541
611
  /* @__PURE__ */ jsxRuntime.jsx(
542
612
  ActionOption,
@@ -544,7 +614,8 @@ const ReleaseActionOptions = ({ selected, handleChange, name }) => {
544
614
  actionType: "publish",
545
615
  selected,
546
616
  handleChange,
547
- name
617
+ name,
618
+ disabled
548
619
  }
549
620
  ),
550
621
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -553,7 +624,8 @@ const ReleaseActionOptions = ({ selected, handleChange, name }) => {
553
624
  actionType: "unpublish",
554
625
  selected,
555
626
  handleChange,
556
- name
627
+ name,
628
+ disabled
557
629
  }
558
630
  )
559
631
  ] });
@@ -569,19 +641,20 @@ const INITIAL_VALUES = {
569
641
  const NoReleases = () => {
570
642
  const { formatMessage } = reactIntl.useIntl();
571
643
  return /* @__PURE__ */ jsxRuntime.jsx(
572
- helperPlugin.NoContent,
644
+ designSystem.EmptyStateLayout,
573
645
  {
574
- content: {
646
+ icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
647
+ content: formatMessage({
575
648
  id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
576
649
  defaultMessage: "No available releases. Open the list of releases and create a new one from there."
577
- },
650
+ }),
578
651
  action: /* @__PURE__ */ jsxRuntime.jsx(
579
- v2.LinkButton,
652
+ designSystem.LinkButton,
580
653
  {
581
654
  to: {
582
655
  pathname: "/plugins/content-releases"
583
656
  },
584
- as: reactRouterDom.Link,
657
+ tag: reactRouterDom.Link,
585
658
  variant: "secondary",
586
659
  children: formatMessage({
587
660
  id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
@@ -597,10 +670,12 @@ const AddActionToReleaseModal = ({
597
670
  contentTypeUid,
598
671
  entryId
599
672
  }) => {
673
+ const releaseHeaderId = React__namespace.useId();
600
674
  const { formatMessage } = reactIntl.useIntl();
601
- const toggleNotification = helperPlugin.useNotification();
602
- const { formatAPIError } = helperPlugin.useAPIErrorHandler();
603
- const { modifiedData } = helperPlugin.useCMEditViewDataManager();
675
+ const { toggleNotification } = strapiAdmin.useNotification();
676
+ const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
677
+ const [{ query: query2 }] = strapiAdmin.useQueryParams();
678
+ const locale = query2.plugins?.i18n?.locale;
604
679
  const response = useGetReleasesForEntryQuery({
605
680
  contentTypeUid,
606
681
  entryId,
@@ -609,7 +684,6 @@ const AddActionToReleaseModal = ({
609
684
  const releases = response.data?.data;
610
685
  const [createReleaseAction, { isLoading }] = useCreateReleaseActionMutation();
611
686
  const handleSubmit = async (values) => {
612
- const locale = modifiedData.locale;
613
687
  const releaseActionEntry = {
614
688
  contentType: contentTypeUid,
615
689
  id: entryId,
@@ -631,21 +705,21 @@ const AddActionToReleaseModal = ({
631
705
  return;
632
706
  }
633
707
  if ("error" in response2) {
634
- if (axios.isAxiosError(response2.error)) {
708
+ if (strapiAdmin.isFetchError(response2.error)) {
635
709
  toggleNotification({
636
- type: "warning",
710
+ type: "danger",
637
711
  message: formatAPIError(response2.error)
638
712
  });
639
713
  } else {
640
714
  toggleNotification({
641
- type: "warning",
715
+ type: "danger",
642
716
  message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
643
717
  });
644
718
  }
645
719
  }
646
720
  };
647
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { onClose: handleClose, labelledBy: "title", children: [
648
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "title", fontWeight: "bold", textColor: "neutral800", children: formatMessage({
721
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { onClose: handleClose, labelledBy: releaseHeaderId, children: [
722
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: releaseHeaderId, fontWeight: "bold", textColor: "neutral800", children: formatMessage({
649
723
  id: "content-releases.content-manager-edit-view.add-to-release",
650
724
  defaultMessage: "Add to release"
651
725
  }) }) }),
@@ -658,24 +732,25 @@ const AddActionToReleaseModal = ({
658
732
  children: ({ values, setFieldValue }) => {
659
733
  return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
660
734
  releases?.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(NoReleases, {}) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalBody, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
661
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
662
- designSystem.SingleSelect,
663
- {
664
- required: true,
665
- label: formatMessage({
666
- id: "content-releases.content-manager-edit-view.add-to-release.select-label",
667
- defaultMessage: "Select a release"
668
- }),
669
- placeholder: formatMessage({
670
- id: "content-releases.content-manager-edit-view.add-to-release.select-placeholder",
671
- defaultMessage: "Select"
672
- }),
673
- onChange: (value) => setFieldValue("releaseId", value),
674
- value: values.releaseId,
675
- children: releases?.map((release) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: release.id, children: release.name }, release.id))
676
- }
677
- ) }),
678
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
735
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { required: true, children: [
736
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
737
+ id: "content-releases.content-manager-edit-view.add-to-release.select-label",
738
+ defaultMessage: "Select a release"
739
+ }) }),
740
+ /* @__PURE__ */ jsxRuntime.jsx(
741
+ designSystem.SingleSelect,
742
+ {
743
+ placeholder: formatMessage({
744
+ id: "content-releases.content-manager-edit-view.add-to-release.select-placeholder",
745
+ defaultMessage: "Select"
746
+ }),
747
+ onChange: (value) => setFieldValue("releaseId", value),
748
+ value: values.releaseId,
749
+ children: releases?.map((release) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: release.id, children: release.name }, release.id))
750
+ }
751
+ )
752
+ ] }) }),
753
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
679
754
  id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
680
755
  defaultMessage: "What do you want to do with this entry?"
681
756
  }) }),
@@ -715,16 +790,22 @@ const AddActionToReleaseModal = ({
715
790
  };
716
791
  const CMReleasesContainer = () => {
717
792
  const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
718
- const { formatMessage } = reactIntl.useIntl();
719
- const {
720
- isCreatingEntry,
721
- allLayoutData: { contentType }
722
- } = helperPlugin.useCMEditViewDataManager();
723
- const params = reactRouterDom.useParams();
724
- const canFetch = params?.id != null && contentType?.uid != null;
793
+ const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
794
+ const { id, slug, collectionType } = reactRouterDom.useParams();
795
+ const isCreatingEntry = id === "create";
796
+ const entryId = parseInt(id, 10);
797
+ const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
798
+ const { canCreateAction, canRead: canMain, canDeleteAction } = allowedActions;
799
+ const { schema } = strapiAdmin$1.unstable_useDocument({
800
+ collectionType,
801
+ model: slug
802
+ });
803
+ const hasDraftAndPublish = schema?.options?.draftAndPublish;
804
+ const contentTypeUid = slug;
805
+ const canFetch = id != null && contentTypeUid != null;
725
806
  const fetchParams = canFetch ? {
726
- contentTypeUid: contentType.uid,
727
- entryId: params.id,
807
+ contentTypeUid,
808
+ entryId,
728
809
  hasEntryAttached: true
729
810
  } : query.skipToken;
730
811
  const response = useGetReleasesForEntryQuery(fetchParams);
@@ -732,7 +813,7 @@ const CMReleasesContainer = () => {
732
813
  if (!canFetch) {
733
814
  return null;
734
815
  }
735
- if (isCreatingEntry || !contentType?.options?.draftAndPublish) {
816
+ if (isCreatingEntry || !hasDraftAndPublish) {
736
817
  return null;
737
818
  }
738
819
  const toggleModal = () => setIsModalOpen((prev) => !prev);
@@ -742,10 +823,13 @@ const CMReleasesContainer = () => {
742
823
  }
743
824
  return `success${shade}`;
744
825
  };
745
- return /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.main, children: /* @__PURE__ */ jsxRuntime.jsxs(
826
+ if (!canMain) {
827
+ return null;
828
+ }
829
+ return /* @__PURE__ */ jsxRuntime.jsxs(
746
830
  designSystem.Box,
747
831
  {
748
- as: "aside",
832
+ tag: "aside",
749
833
  "aria-label": formatMessage({
750
834
  id: "content-releases.plugin.name",
751
835
  defaultMessage: "Releases"
@@ -769,7 +853,7 @@ const CMReleasesContainer = () => {
769
853
  alignItems: "start",
770
854
  borderWidth: "1px",
771
855
  borderStyle: "solid",
772
- borderColor: getReleaseColorVariant(release.action.type, "200"),
856
+ borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
773
857
  overflow: "hidden",
774
858
  hasRadius: true,
775
859
  children: [
@@ -780,41 +864,66 @@ const CMReleasesContainer = () => {
780
864
  paddingBottom: 3,
781
865
  paddingLeft: 4,
782
866
  paddingRight: 4,
783
- background: getReleaseColorVariant(release.action.type, "100"),
867
+ background: getReleaseColorVariant(release.actions[0].type, "100"),
784
868
  width: "100%",
785
869
  children: /* @__PURE__ */ jsxRuntime.jsx(
786
870
  designSystem.Typography,
787
871
  {
788
872
  fontSize: 1,
789
873
  variant: "pi",
790
- textColor: getReleaseColorVariant(release.action.type, "600"),
874
+ textColor: getReleaseColorVariant(release.actions[0].type, "600"),
791
875
  children: formatMessage(
792
876
  {
793
877
  id: "content-releases.content-manager-edit-view.list-releases.title",
794
878
  defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
795
879
  },
796
- { isPublish: release.action.type === "publish" }
880
+ { isPublish: release.actions[0].type === "publish" }
797
881
  )
798
882
  }
799
883
  )
800
884
  }
801
885
  ),
802
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 3, width: "100%", alignItems: "flex-start", children: [
886
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 2, width: "100%", alignItems: "flex-start", children: [
803
887
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
804
- /* @__PURE__ */ jsxRuntime.jsx(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: /* @__PURE__ */ jsxRuntime.jsx(
805
- ReleaseActionMenu.DeleteReleaseActionItem,
888
+ release.scheduledAt && release.timezone && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
806
889
  {
807
- releaseId: release.id,
808
- actionId: release.action.id
890
+ id: "content-releases.content-manager-edit-view.scheduled.date",
891
+ defaultMessage: "{date} at {time} ({offset})"
892
+ },
893
+ {
894
+ date: formatDate(new Date(release.scheduledAt), {
895
+ day: "2-digit",
896
+ month: "2-digit",
897
+ year: "numeric",
898
+ timeZone: release.timezone
899
+ }),
900
+ time: formatTime(new Date(release.scheduledAt), {
901
+ hourCycle: "h23",
902
+ timeZone: release.timezone
903
+ }),
904
+ offset: getTimezoneOffset(
905
+ release.timezone,
906
+ new Date(release.scheduledAt)
907
+ )
809
908
  }
810
- ) })
811
- ] })
909
+ ) }),
910
+ canDeleteAction ? /* @__PURE__ */ jsxRuntime.jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
911
+ /* @__PURE__ */ jsxRuntime.jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
912
+ /* @__PURE__ */ jsxRuntime.jsx(
913
+ ReleaseActionMenu.DeleteReleaseActionItem,
914
+ {
915
+ releaseId: release.id,
916
+ actionId: release.actions[0].id
917
+ }
918
+ )
919
+ ] }) : null
920
+ ] }) })
812
921
  ]
813
922
  },
814
923
  release.id
815
924
  );
816
925
  }),
817
- /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.createAction, children: /* @__PURE__ */ jsxRuntime.jsx(
926
+ canCreateAction ? /* @__PURE__ */ jsxRuntime.jsx(
818
927
  designSystem.Button,
819
928
  {
820
929
  justifyContent: "center",
@@ -829,53 +938,74 @@ const CMReleasesContainer = () => {
829
938
  defaultMessage: "Add to release"
830
939
  })
831
940
  }
832
- ) })
941
+ ) : null
833
942
  ] }),
834
943
  isModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
835
944
  AddActionToReleaseModal,
836
945
  {
837
946
  handleClose: toggleModal,
838
- contentTypeUid: contentType.uid,
839
- entryId: params.id
947
+ contentTypeUid,
948
+ entryId
840
949
  }
841
950
  )
842
951
  ]
843
952
  }
844
- ) });
953
+ );
954
+ };
955
+ const pluginId = "content-releases";
956
+ const prefixPluginTranslations = (trad, pluginId2) => {
957
+ if (!pluginId2) {
958
+ throw new TypeError("pluginId can't be empty");
959
+ }
960
+ return Object.keys(trad).reduce((acc, current) => {
961
+ acc[`${pluginId2}.${current}`] = trad[current];
962
+ return acc;
963
+ }, {});
845
964
  };
846
965
  const admin = {
847
966
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
848
967
  register(app) {
968
+ app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
849
969
  if (window.strapi.features.isEnabled("cms-content-releases")) {
850
970
  app.addMenuLink({
851
- to: `/plugins/${pluginId}`,
971
+ to: `plugins/${pluginId}`,
852
972
  icon: icons.PaperPlane,
853
973
  intlLabel: {
854
974
  id: `${pluginId}.plugin.name`,
855
975
  defaultMessage: "Releases"
856
976
  },
857
- async Component() {
858
- const { App } = await Promise.resolve().then(() => require("./App-0yPbcoGt.js"));
859
- return App;
860
- },
861
- permissions: PERMISSIONS.main
862
- });
863
- app.addMiddlewares([() => releaseApi.middleware]);
864
- app.addReducers({
865
- [releaseApi.reducerPath]: releaseApi.reducer
977
+ Component: () => Promise.resolve().then(() => require("./App-DUmziQ17.js")).then((mod) => ({ default: mod.App })),
978
+ permissions: PERMISSIONS.main,
979
+ position: 2
866
980
  });
867
- app.injectContentManagerComponent("editView", "right-links", {
981
+ app.getPlugin("content-manager").injectComponent("editView", "right-links", {
868
982
  name: `${pluginId}-link`,
869
983
  Component: CMReleasesContainer
870
984
  });
985
+ } else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
986
+ app.addMenuLink({
987
+ to: `/plugins/purchase-content-releases`,
988
+ icon: icons.PaperPlane,
989
+ intlLabel: {
990
+ id: `${pluginId}.plugin.name`,
991
+ defaultMessage: "Releases"
992
+ },
993
+ permissions: [],
994
+ async Component() {
995
+ const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-Be3acS2L.js"));
996
+ return { default: PurchaseContentReleases };
997
+ },
998
+ lockIcon: true,
999
+ position: 2
1000
+ });
871
1001
  }
872
1002
  },
873
1003
  async registerTrads({ locales }) {
874
1004
  const importedTrads = await Promise.all(
875
1005
  locales.map((locale) => {
876
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-gYDqKYFd.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
1006
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-DtFJ5ViE.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
877
1007
  return {
878
- data: helperPlugin.prefixPluginTranslations(data, "content-releases"),
1008
+ data: prefixPluginTranslations(data, "content-releases"),
879
1009
  locale
880
1010
  };
881
1011
  }).catch(() => {
@@ -893,7 +1023,7 @@ exports.PERMISSIONS = PERMISSIONS;
893
1023
  exports.ReleaseActionMenu = ReleaseActionMenu;
894
1024
  exports.ReleaseActionOptions = ReleaseActionOptions;
895
1025
  exports.admin = admin;
896
- exports.isAxiosError = isAxiosError;
1026
+ exports.getTimezoneOffset = getTimezoneOffset;
897
1027
  exports.pluginId = pluginId;
898
1028
  exports.releaseApi = releaseApi;
899
1029
  exports.useCreateReleaseMutation = useCreateReleaseMutation;
@@ -902,7 +1032,6 @@ exports.useGetReleaseActionsQuery = useGetReleaseActionsQuery;
902
1032
  exports.useGetReleaseQuery = useGetReleaseQuery;
903
1033
  exports.useGetReleasesQuery = useGetReleasesQuery;
904
1034
  exports.usePublishReleaseMutation = usePublishReleaseMutation;
905
- exports.useTypedDispatch = useTypedDispatch;
906
1035
  exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
907
1036
  exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
908
- //# sourceMappingURL=index-l5iuP0Hb.js.map
1037
+ //# sourceMappingURL=index-C5Hc767q.js.map