@strapi/content-releases 0.0.0-experimental.bcfd4881e086b8126222bb894121c61ff9a1fc82 → 0.0.0-experimental.c3e9d4b26f9fd3d9eb530b5c11f9baa1d09b13ad

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--3HPsVgM.js → App-DUmziQ17.js} +401 -388
  2. package/dist/_chunks/App-DUmziQ17.js.map +1 -0
  3. package/dist/_chunks/{App-CRNZU_DZ.mjs → App-D_6Y9N2F.mjs} +378 -364
  4. package/dist/_chunks/App-D_6Y9N2F.mjs.map +1 -0
  5. package/dist/_chunks/{PurchaseContentReleases-bpIYXOfu.js → PurchaseContentReleases-Be3acS2L.js} +7 -6
  6. package/dist/_chunks/PurchaseContentReleases-Be3acS2L.js.map +1 -0
  7. package/dist/_chunks/{PurchaseContentReleases-3tRbmbY3.mjs → PurchaseContentReleases-_MxP6-Dt.mjs} +8 -7
  8. package/dist/_chunks/PurchaseContentReleases-_MxP6-Dt.mjs.map +1 -0
  9. package/dist/_chunks/{en-bpHsnU0n.mjs → en-B9Ur3VsE.mjs} +2 -1
  10. package/dist/_chunks/en-B9Ur3VsE.mjs.map +1 -0
  11. package/dist/_chunks/{en-3SGjiVyR.js → en-DtFJ5ViE.js} +2 -1
  12. package/dist/_chunks/en-DtFJ5ViE.js.map +1 -0
  13. package/dist/_chunks/{index-_wu9g0yG.mjs → index-BomF0-yY.mjs} +206 -392
  14. package/dist/_chunks/index-BomF0-yY.mjs.map +1 -0
  15. package/dist/_chunks/{index-xV3jXcZj.js → index-C5Hc767q.js} +206 -394
  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 +152 -93
  43. package/dist/server/index.js.map +1 -1
  44. package/dist/server/index.mjs +153 -93
  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 +29 -36
  103. package/dist/_chunks/App--3HPsVgM.js.map +0 -1
  104. package/dist/_chunks/App-CRNZU_DZ.mjs.map +0 -1
  105. package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +0 -1
  106. package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +0 -1
  107. package/dist/_chunks/en-3SGjiVyR.js.map +0 -1
  108. package/dist/_chunks/en-bpHsnU0n.mjs.map +0 -1
  109. package/dist/_chunks/index-_wu9g0yG.mjs.map +0 -1
  110. package/dist/_chunks/index-xV3jXcZj.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({
@@ -284,7 +240,8 @@ const releaseApi = react.createApi({
284
240
  },
285
241
  invalidatesTags: [
286
242
  { type: "Release", id: "LIST" },
287
- { type: "ReleaseAction", id: "LIST" }
243
+ { type: "ReleaseAction", id: "LIST" },
244
+ { type: "EntriesInRelease" }
288
245
  ]
289
246
  }),
290
247
  updateReleaseAction: build.mutation({
@@ -302,13 +259,17 @@ const releaseApi = react.createApi({
302
259
  ...query2
303
260
  };
304
261
  const patchResult = dispatch(
305
- releaseApi.util.updateQueryData("getReleaseActions", paramsWithoutActionId, (draft) => {
306
- const [key, index] = actionPath;
307
- const action = draft.data[key][index];
308
- if (action) {
309
- action.type = body.type;
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
+ }
310
271
  }
311
- })
272
+ )
312
273
  );
313
274
  try {
314
275
  await queryFulfilled;
@@ -327,7 +288,8 @@ const releaseApi = react.createApi({
327
288
  invalidatesTags: (result, error, arg) => [
328
289
  { type: "Release", id: "LIST" },
329
290
  { type: "Release", id: arg.params.releaseId },
330
- { type: "ReleaseAction", id: "LIST" }
291
+ { type: "ReleaseAction", id: "LIST" },
292
+ { type: "EntriesInRelease" }
331
293
  ]
332
294
  }),
333
295
  publishRelease: build.mutation({
@@ -346,7 +308,22 @@ const releaseApi = react.createApi({
346
308
  method: "DELETE"
347
309
  };
348
310
  },
349
- invalidatesTags: () => [{ type: "Release", id: "LIST" }]
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" }]
350
327
  })
351
328
  };
352
329
  }
@@ -363,7 +340,8 @@ const {
363
340
  useUpdateReleaseActionMutation,
364
341
  usePublishReleaseMutation,
365
342
  useDeleteReleaseActionMutation,
366
- useDeleteReleaseMutation
343
+ useDeleteReleaseMutation,
344
+ useGetMappedEntriesInReleasesQuery
367
345
  } = releaseApi;
368
346
  const getTimezoneOffset = (timezone, date) => {
369
347
  try {
@@ -381,16 +359,12 @@ const getTimezoneOffset = (timezone, date) => {
381
359
  return "";
382
360
  }
383
361
  };
384
- const useTypedDispatch = reactRedux.useDispatch;
385
- const useTypedSelector = reactRedux.useSelector;
386
- const StyledMenuItem = styled__default.default(v2.Menu.Item)`
362
+ const StyledMenuItem = styledComponents.styled(designSystem.Menu.Item)`
387
363
  &:hover {
388
- background: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}100`]};
364
+ background: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}100`]};
389
365
 
390
366
  svg {
391
- path {
392
- fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
393
- }
367
+ fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
394
368
  }
395
369
 
396
370
  a {
@@ -399,9 +373,7 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
399
373
  }
400
374
 
401
375
  svg {
402
- path {
403
- fill: ${({ theme, variant = "neutral" }) => theme.colors[`${variant}600`]};
404
- }
376
+ fill: ${({ theme, $variant = "neutral" }) => theme.colors[`${$variant}600`]};
405
377
  }
406
378
 
407
379
  a {
@@ -413,15 +385,14 @@ const StyledMenuItem = styled__default.default(v2.Menu.Item)`
413
385
  width: 100%;
414
386
  }
415
387
  `;
416
- const StyledIconButton = styled__default.default(designSystem.IconButton)`
417
- /* Setting this style inline with borderColor will not apply the style */
418
- border: ${({ theme }) => `1px solid ${theme.colors.neutral200}`};
419
- `;
420
388
  const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
421
389
  const { formatMessage } = reactIntl.useIntl();
422
- const toggleNotification = helperPlugin.useNotification();
423
- const { formatAPIError } = helperPlugin.useAPIErrorHandler();
390
+ const { toggleNotification } = strapiAdmin.useNotification();
391
+ const { formatAPIError } = strapiAdmin.useAPIErrorHandler();
424
392
  const [deleteReleaseAction] = useDeleteReleaseActionMutation();
393
+ const {
394
+ allowedActions: { canDeleteAction }
395
+ } = strapiAdmin.useRBAC(PERMISSIONS);
425
396
  const handleDeleteAction = async () => {
426
397
  const response = await deleteReleaseAction({
427
398
  params: { releaseId, actionId }
@@ -437,26 +408,29 @@ const DeleteReleaseActionItem = ({ releaseId, actionId }) => {
437
408
  return;
438
409
  }
439
410
  if ("error" in response) {
440
- if (axios.isAxiosError(response.error)) {
411
+ if (strapiAdmin.isFetchError(response.error)) {
441
412
  toggleNotification({
442
- type: "warning",
413
+ type: "danger",
443
414
  message: formatAPIError(response.error)
444
415
  });
445
416
  } else {
446
417
  toggleNotification({
447
- type: "warning",
418
+ type: "danger",
448
419
  message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
449
420
  });
450
421
  }
451
422
  }
452
423
  };
453
- 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: [
454
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Cross, width: 3, height: 3 }),
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" }),
455
429
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", variant: "omega", children: formatMessage({
456
430
  id: "content-releases.content-manager-edit-view.remove-from-release",
457
431
  defaultMessage: "Remove from release"
458
432
  }) })
459
- ] }) }) });
433
+ ] }) });
460
434
  };
461
435
  const ReleaseActionEntryLinkItem = ({
462
436
  contentTypeUid,
@@ -464,77 +438,79 @@ const ReleaseActionEntryLinkItem = ({
464
438
  locale
465
439
  }) => {
466
440
  const { formatMessage } = reactIntl.useIntl();
467
- const collectionTypePermissions = useTypedSelector(
468
- (state) => state.rbacProvider.collectionTypesRelatedPermissions
469
- );
470
- const updatePermissions = contentTypeUid ? collectionTypePermissions[contentTypeUid]?.["plugin::content-manager.explorer.update"] : [];
471
- const canUpdateEntryForLocale = Boolean(
472
- !locale || updatePermissions?.find(
473
- (permission) => permission.properties?.locales?.includes(locale)
474
- )
475
- );
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
+ }
476
464
  return /* @__PURE__ */ jsxRuntime.jsx(
477
- helperPlugin.CheckPermissions,
465
+ StyledMenuItem,
478
466
  {
479
- permissions: [
480
- {
481
- action: "plugin::content-manager.explorer.update",
482
- subject: contentTypeUid
483
- }
484
- ],
485
- children: canUpdateEntryForLocale && /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
486
- v2.Link,
487
- {
488
- as: reactRouterDom.NavLink,
489
- to: {
490
- pathname: `/content-manager/collection-types/${contentTypeUid}/${entryId}`,
491
- search: locale && `?plugins[i18n][locale]=${locale}`
492
- },
493
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil, width: 3, height: 3 }),
494
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
495
- id: "content-releases.content-manager-edit-view.edit-entry",
496
- defaultMessage: "Edit entry"
497
- }) })
498
- }
499
- ) })
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
+ ] })
500
480
  }
501
481
  );
502
482
  };
503
483
  const EditReleaseItem = ({ releaseId }) => {
504
484
  const { formatMessage } = reactIntl.useIntl();
505
- return /* @__PURE__ */ jsxRuntime.jsx(StyledMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
506
- v2.Link,
507
- {
508
- href: `/admin/plugins/content-releases/${releaseId}`,
509
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: icons.Pencil, width: 3, height: 3 }),
510
- isExternal: false,
511
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: formatMessage({
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({
512
490
  id: "content-releases.content-manager-edit-view.edit-release",
513
491
  defaultMessage: "Edit release"
514
492
  }) })
515
- }
516
- ) });
493
+ ] }) })
494
+ );
517
495
  };
518
- const Root = ({ children, hasTriggerBorder = false }) => {
496
+ const Root = ({ children }) => {
519
497
  const { formatMessage } = reactIntl.useIntl();
498
+ const { allowedActions } = strapiAdmin.useRBAC(PERMISSIONS);
520
499
  return (
521
500
  // A user can access the dropdown if they have permissions to delete a release-action OR update a release
522
- /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: [...PERMISSIONS.deleteAction, ...PERMISSIONS.update], children: /* @__PURE__ */ jsxRuntime.jsxs(v2.Menu.Root, { children: [
523
- /* @__PURE__ */ jsxRuntime.jsx(
524
- 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,
525
504
  {
526
- as: hasTriggerBorder ? StyledIconButton : designSystem.IconButton,
527
- paddingLeft: 2,
528
- paddingRight: 2,
529
- "aria-label": formatMessage({
505
+ label: formatMessage({
530
506
  id: "content-releases.content-manager-edit-view.release-action-menu",
531
507
  defaultMessage: "Release action options"
532
508
  }),
533
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
509
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {})
534
510
  }
535
- ),
536
- /* @__PURE__ */ jsxRuntime.jsx(v2.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
537
- ] }) })
511
+ ) }),
512
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { top: 1, popoverPlacement: "bottom-end", children })
513
+ ] }) : null
538
514
  );
539
515
  };
540
516
  const ReleaseActionMenu = {
@@ -549,11 +525,11 @@ const getBorderLeftRadiusValue = (actionType) => {
549
525
  const getBorderRightRadiusValue = (actionType) => {
550
526
  return actionType === "publish" ? 0 : 1;
551
527
  };
552
- const FieldWrapper = styled__default.default(designSystem.Field)`
553
- border-top-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
554
- border-bottom-left-radius: ${({ actionType, theme }) => theme.spaces[getBorderLeftRadiusValue(actionType)]};
555
- border-top-right-radius: ${({ actionType, theme }) => theme.spaces[getBorderRightRadiusValue(actionType)]};
556
- 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)]};
557
533
 
558
534
  > label {
559
535
  color: inherit;
@@ -564,14 +540,14 @@ const FieldWrapper = styled__default.default(designSystem.Field)`
564
540
  }
565
541
 
566
542
  &[data-checked='true'] {
567
- color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
568
- background-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary100 : theme.colors.danger100};
569
- border-color: ${({ theme, actionType }) => actionType === "publish" ? theme.colors.primary700 : theme.colors.danger600};
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};
570
546
  }
571
547
 
572
548
  &[data-checked='false'] {
573
- border-left: ${({ actionType }) => actionType === "unpublish" && "none"};
574
- border-right: ${({ actionType }) => actionType === "publish" && "none"};
549
+ border-left: ${({ $actionType }) => $actionType === "unpublish" && "none"};
550
+ border-right: ${({ $actionType }) => $actionType === "publish" && "none"};
575
551
  }
576
552
 
577
553
  &[data-checked='false'][data-disabled='false']:hover {
@@ -600,7 +576,7 @@ const ActionOption = ({
600
576
  return /* @__PURE__ */ jsxRuntime.jsx(
601
577
  FieldWrapper,
602
578
  {
603
- actionType,
579
+ $actionType: actionType,
604
580
  background: "primary0",
605
581
  borderColor: "neutral200",
606
582
  color: selected === actionType ? "primary600" : "neutral600",
@@ -608,12 +584,11 @@ const ActionOption = ({
608
584
  cursor: "pointer",
609
585
  "data-checked": selected === actionType,
610
586
  "data-disabled": disabled && selected !== actionType,
611
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.FieldLabel, { htmlFor: `${name}-${actionType}`, children: [
587
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
612
588
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
613
- designSystem.FieldInput,
589
+ designSystem.Field.Input,
614
590
  {
615
591
  type: "radio",
616
- id: `${name}-${actionType}`,
617
592
  name,
618
593
  checked: selected === actionType,
619
594
  onChange: handleChange,
@@ -666,19 +641,20 @@ const INITIAL_VALUES = {
666
641
  const NoReleases = () => {
667
642
  const { formatMessage } = reactIntl.useIntl();
668
643
  return /* @__PURE__ */ jsxRuntime.jsx(
669
- helperPlugin.NoContent,
644
+ designSystem.EmptyStateLayout,
670
645
  {
671
- content: {
646
+ icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem" }),
647
+ content: formatMessage({
672
648
  id: "content-releases.content-manager-edit-view.add-to-release.no-releases-message",
673
649
  defaultMessage: "No available releases. Open the list of releases and create a new one from there."
674
- },
650
+ }),
675
651
  action: /* @__PURE__ */ jsxRuntime.jsx(
676
- v2.LinkButton,
652
+ designSystem.LinkButton,
677
653
  {
678
654
  to: {
679
655
  pathname: "/plugins/content-releases"
680
656
  },
681
- as: reactRouterDom.Link,
657
+ tag: reactRouterDom.Link,
682
658
  variant: "secondary",
683
659
  children: formatMessage({
684
660
  id: "content-releases.content-manager-edit-view.add-to-release.redirect-button",
@@ -696,9 +672,10 @@ const AddActionToReleaseModal = ({
696
672
  }) => {
697
673
  const releaseHeaderId = React__namespace.useId();
698
674
  const { formatMessage } = reactIntl.useIntl();
699
- const toggleNotification = helperPlugin.useNotification();
700
- const { formatAPIError } = helperPlugin.useAPIErrorHandler();
701
- 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;
702
679
  const response = useGetReleasesForEntryQuery({
703
680
  contentTypeUid,
704
681
  entryId,
@@ -707,7 +684,6 @@ const AddActionToReleaseModal = ({
707
684
  const releases = response.data?.data;
708
685
  const [createReleaseAction, { isLoading }] = useCreateReleaseActionMutation();
709
686
  const handleSubmit = async (values) => {
710
- const locale = modifiedData.locale;
711
687
  const releaseActionEntry = {
712
688
  contentType: contentTypeUid,
713
689
  id: entryId,
@@ -729,14 +705,14 @@ const AddActionToReleaseModal = ({
729
705
  return;
730
706
  }
731
707
  if ("error" in response2) {
732
- if (axios.isAxiosError(response2.error)) {
708
+ if (strapiAdmin.isFetchError(response2.error)) {
733
709
  toggleNotification({
734
- type: "warning",
710
+ type: "danger",
735
711
  message: formatAPIError(response2.error)
736
712
  });
737
713
  } else {
738
714
  toggleNotification({
739
- type: "warning",
715
+ type: "danger",
740
716
  message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
741
717
  });
742
718
  }
@@ -756,24 +732,25 @@ const AddActionToReleaseModal = ({
756
732
  children: ({ values, setFieldValue }) => {
757
733
  return /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
758
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: [
759
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
760
- designSystem.SingleSelect,
761
- {
762
- required: true,
763
- label: formatMessage({
764
- id: "content-releases.content-manager-edit-view.add-to-release.select-label",
765
- defaultMessage: "Select a release"
766
- }),
767
- placeholder: formatMessage({
768
- id: "content-releases.content-manager-edit-view.add-to-release.select-placeholder",
769
- defaultMessage: "Select"
770
- }),
771
- onChange: (value) => setFieldValue("releaseId", value),
772
- value: values.releaseId,
773
- children: releases?.map((release) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: release.id, children: release.name }, release.id))
774
- }
775
- ) }),
776
- /* @__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({
777
754
  id: "content-releases.content-manager-edit-view.add-to-release.action-type-label",
778
755
  defaultMessage: "What do you want to do with this entry?"
779
756
  }) }),
@@ -814,14 +791,18 @@ const AddActionToReleaseModal = ({
814
791
  const CMReleasesContainer = () => {
815
792
  const [isModalOpen, setIsModalOpen] = React__namespace.useState(false);
816
793
  const { formatMessage, formatDate, formatTime } = reactIntl.useIntl();
817
- const {
818
- isCreatingEntry,
819
- hasDraftAndPublish,
820
- initialData: { id: entryId },
821
- slug
822
- } = helperPlugin.useCMEditViewDataManager();
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;
823
804
  const contentTypeUid = slug;
824
- const canFetch = entryId != null && contentTypeUid != null;
805
+ const canFetch = id != null && contentTypeUid != null;
825
806
  const fetchParams = canFetch ? {
826
807
  contentTypeUid,
827
808
  entryId,
@@ -842,10 +823,13 @@ const CMReleasesContainer = () => {
842
823
  }
843
824
  return `success${shade}`;
844
825
  };
845
- 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(
846
830
  designSystem.Box,
847
831
  {
848
- as: "aside",
832
+ tag: "aside",
849
833
  "aria-label": formatMessage({
850
834
  id: "content-releases.plugin.name",
851
835
  defaultMessage: "Releases"
@@ -869,7 +853,7 @@ const CMReleasesContainer = () => {
869
853
  alignItems: "start",
870
854
  borderWidth: "1px",
871
855
  borderStyle: "solid",
872
- borderColor: getReleaseColorVariant(release.action.type, "200"),
856
+ borderColor: getReleaseColorVariant(release.actions[0].type, "200"),
873
857
  overflow: "hidden",
874
858
  hasRadius: true,
875
859
  children: [
@@ -880,26 +864,26 @@ const CMReleasesContainer = () => {
880
864
  paddingBottom: 3,
881
865
  paddingLeft: 4,
882
866
  paddingRight: 4,
883
- background: getReleaseColorVariant(release.action.type, "100"),
867
+ background: getReleaseColorVariant(release.actions[0].type, "100"),
884
868
  width: "100%",
885
869
  children: /* @__PURE__ */ jsxRuntime.jsx(
886
870
  designSystem.Typography,
887
871
  {
888
872
  fontSize: 1,
889
873
  variant: "pi",
890
- textColor: getReleaseColorVariant(release.action.type, "600"),
874
+ textColor: getReleaseColorVariant(release.actions[0].type, "600"),
891
875
  children: formatMessage(
892
876
  {
893
877
  id: "content-releases.content-manager-edit-view.list-releases.title",
894
878
  defaultMessage: "{isPublish, select, true {Will be published in} other {Will be unpublished in}}"
895
879
  },
896
- { isPublish: release.action.type === "publish" }
880
+ { isPublish: release.actions[0].type === "publish" }
897
881
  )
898
882
  }
899
883
  )
900
884
  }
901
885
  ),
902
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { padding: 4, direction: "column", gap: 2, 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: [
903
887
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontSize: 2, fontWeight: "bold", variant: "omega", textColor: "neutral700", children: release.name }),
904
888
  release.scheduledAt && release.timezone && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(
905
889
  {
@@ -923,23 +907,23 @@ const CMReleasesContainer = () => {
923
907
  )
924
908
  }
925
909
  ) }),
926
- /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.deleteAction, children: /* @__PURE__ */ jsxRuntime.jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
910
+ canDeleteAction ? /* @__PURE__ */ jsxRuntime.jsxs(ReleaseActionMenu.Root, { hasTriggerBorder: true, children: [
927
911
  /* @__PURE__ */ jsxRuntime.jsx(ReleaseActionMenu.EditReleaseItem, { releaseId: release.id }),
928
912
  /* @__PURE__ */ jsxRuntime.jsx(
929
913
  ReleaseActionMenu.DeleteReleaseActionItem,
930
914
  {
931
915
  releaseId: release.id,
932
- actionId: release.action.id
916
+ actionId: release.actions[0].id
933
917
  }
934
918
  )
935
- ] }) })
936
- ] })
919
+ ] }) : null
920
+ ] }) })
937
921
  ]
938
922
  },
939
923
  release.id
940
924
  );
941
925
  }),
942
- /* @__PURE__ */ jsxRuntime.jsx(helperPlugin.CheckPermissions, { permissions: PERMISSIONS.createAction, children: /* @__PURE__ */ jsxRuntime.jsx(
926
+ canCreateAction ? /* @__PURE__ */ jsxRuntime.jsx(
943
927
  designSystem.Button,
944
928
  {
945
929
  justifyContent: "center",
@@ -954,7 +938,7 @@ const CMReleasesContainer = () => {
954
938
  defaultMessage: "Add to release"
955
939
  })
956
940
  }
957
- ) })
941
+ ) : null
958
942
  ] }),
959
943
  isModalOpen && /* @__PURE__ */ jsxRuntime.jsx(
960
944
  AddActionToReleaseModal,
@@ -966,178 +950,17 @@ const CMReleasesContainer = () => {
966
950
  )
967
951
  ]
968
952
  }
969
- ) });
970
- };
971
- const getContentPermissions = (subject) => {
972
- const permissions = {
973
- publish: [
974
- {
975
- action: "plugin::content-manager.explorer.publish",
976
- subject,
977
- id: "",
978
- actionParameters: {},
979
- properties: {},
980
- conditions: []
981
- }
982
- ]
983
- };
984
- return permissions;
953
+ );
985
954
  };
986
- const ReleaseAction = ({ ids, model }) => {
987
- const { formatMessage } = reactIntl.useIntl();
988
- const toggleNotification = helperPlugin.useNotification();
989
- const { formatAPIError } = helperPlugin.useAPIErrorHandler();
990
- const { modifiedData } = helperPlugin.useCMEditViewDataManager();
991
- const contentPermissions = getContentPermissions(model);
992
- const {
993
- allowedActions: { canPublish }
994
- } = helperPlugin.useRBAC(contentPermissions);
995
- const {
996
- allowedActions: { canCreate }
997
- } = helperPlugin.useRBAC(PERMISSIONS);
998
- const response = useGetReleasesQuery();
999
- const releases = response.data?.data;
1000
- const [createManyReleaseActions, { isLoading }] = useCreateManyReleaseActionsMutation();
1001
- const handleSubmit = async (values) => {
1002
- const locale = modifiedData.locale;
1003
- const releaseActionEntries = ids.map((id) => ({
1004
- type: values.type,
1005
- entry: {
1006
- contentType: model,
1007
- id,
1008
- locale
1009
- }
1010
- }));
1011
- const response2 = await createManyReleaseActions({
1012
- body: releaseActionEntries,
1013
- params: { releaseId: values.releaseId }
1014
- });
1015
- if ("data" in response2) {
1016
- const notificationMessage = formatMessage(
1017
- {
1018
- id: "content-releases.content-manager-list-view.add-to-release.notification.success.message",
1019
- defaultMessage: "{entriesAlreadyInRelease} out of {totalEntries} entries were already in the release."
1020
- },
1021
- {
1022
- entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
1023
- totalEntries: response2.data.meta.totalEntries
1024
- }
1025
- );
1026
- const notification = {
1027
- type: "success",
1028
- title: formatMessage(
1029
- {
1030
- id: "content-releases.content-manager-list-view.add-to-release.notification.success.title",
1031
- defaultMessage: "Successfully added to release."
1032
- },
1033
- {
1034
- entriesAlreadyInRelease: response2.data.meta.entriesAlreadyInRelease,
1035
- totalEntries: response2.data.meta.totalEntries
1036
- }
1037
- ),
1038
- message: response2.data.meta.entriesAlreadyInRelease ? notificationMessage : ""
1039
- };
1040
- toggleNotification(notification);
1041
- return true;
1042
- }
1043
- if ("error" in response2) {
1044
- if (axios.isAxiosError(response2.error)) {
1045
- toggleNotification({
1046
- type: "warning",
1047
- message: formatAPIError(response2.error)
1048
- });
1049
- } else {
1050
- toggleNotification({
1051
- type: "warning",
1052
- message: formatMessage({ id: "notification.error", defaultMessage: "An error occurred" })
1053
- });
1054
- }
1055
- }
1056
- };
1057
- if (!canCreate || !canPublish)
1058
- return null;
1059
- return {
1060
- actionType: "release",
1061
- variant: "tertiary",
1062
- label: formatMessage({
1063
- id: "content-manager-list-view.add-to-release",
1064
- defaultMessage: "Add to Release"
1065
- }),
1066
- dialog: {
1067
- type: "modal",
1068
- title: formatMessage({
1069
- id: "content-manager-list-view.add-to-release",
1070
- defaultMessage: "Add to Release"
1071
- }),
1072
- content: ({ onClose }) => {
1073
- return /* @__PURE__ */ jsxRuntime.jsx(
1074
- formik.Formik,
1075
- {
1076
- onSubmit: async (values) => {
1077
- const data = await handleSubmit(values);
1078
- if (data) {
1079
- return onClose();
1080
- }
1081
- },
1082
- validationSchema: RELEASE_ACTION_FORM_SCHEMA,
1083
- initialValues: INITIAL_VALUES,
1084
- children: ({ values, setFieldValue }) => /* @__PURE__ */ jsxRuntime.jsxs(formik.Form, { children: [
1085
- 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: [
1086
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
1087
- designSystem.SingleSelect,
1088
- {
1089
- required: true,
1090
- label: formatMessage({
1091
- id: "content-releases.content-manager-list-view.add-to-release.select-label",
1092
- defaultMessage: "Select a release"
1093
- }),
1094
- placeholder: formatMessage({
1095
- id: "content-releases.content-manager-list-view.add-to-release.select-placeholder",
1096
- defaultMessage: "Select"
1097
- }),
1098
- onChange: (value) => setFieldValue("releaseId", value),
1099
- value: values.releaseId,
1100
- children: releases?.map((release) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: release.id, children: release.name }, release.id))
1101
- }
1102
- ) }),
1103
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
1104
- id: "content-releases.content-manager-list-view.add-to-release.action-type-label",
1105
- defaultMessage: "What do you want to do with these entries?"
1106
- }) }),
1107
- /* @__PURE__ */ jsxRuntime.jsx(
1108
- ReleaseActionOptions,
1109
- {
1110
- selected: values.type,
1111
- handleChange: (e) => setFieldValue("type", e.target.value),
1112
- name: "type"
1113
- }
1114
- )
1115
- ] }) }),
1116
- /* @__PURE__ */ jsxRuntime.jsx(
1117
- designSystem.ModalFooter,
1118
- {
1119
- startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", name: "cancel", children: formatMessage({
1120
- id: "content-releases.content-manager-list-view.add-to-release.cancel-button",
1121
- defaultMessage: "Cancel"
1122
- }) }),
1123
- endActions: (
1124
- /**
1125
- * TODO: Ideally we would use isValid from Formik to disable the button, however currently it always returns true
1126
- * for yup.string().required(), even when the value is falsy (including empty string)
1127
- */
1128
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: !values.releaseId, loading: isLoading, children: formatMessage({
1129
- id: "content-releases.content-manager-list-view.add-to-release.continue-button",
1130
- defaultMessage: "Continue"
1131
- }) })
1132
- )
1133
- }
1134
- )
1135
- ] })
1136
- }
1137
- );
1138
- }
1139
- }
1140
- };
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
+ }, {});
1141
964
  };
1142
965
  const admin = {
1143
966
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1145,31 +968,20 @@ const admin = {
1145
968
  app.createHook("ContentReleases/pages/ReleaseDetails/add-locale-in-releases");
1146
969
  if (window.strapi.features.isEnabled("cms-content-releases")) {
1147
970
  app.addMenuLink({
1148
- to: `/plugins/${pluginId}`,
971
+ to: `plugins/${pluginId}`,
1149
972
  icon: icons.PaperPlane,
1150
973
  intlLabel: {
1151
974
  id: `${pluginId}.plugin.name`,
1152
975
  defaultMessage: "Releases"
1153
976
  },
1154
- async Component() {
1155
- const { App } = await Promise.resolve().then(() => require("./App--3HPsVgM.js"));
1156
- return App;
1157
- },
1158
- permissions: PERMISSIONS.main
977
+ Component: () => Promise.resolve().then(() => require("./App-DUmziQ17.js")).then((mod) => ({ default: mod.App })),
978
+ permissions: PERMISSIONS.main,
979
+ position: 2
1159
980
  });
1160
- app.addMiddlewares([() => releaseApi.middleware]);
1161
- app.addReducers({
1162
- [releaseApi.reducerPath]: releaseApi.reducer
1163
- });
1164
- app.injectContentManagerComponent("editView", "right-links", {
981
+ app.getPlugin("content-manager").injectComponent("editView", "right-links", {
1165
982
  name: `${pluginId}-link`,
1166
983
  Component: CMReleasesContainer
1167
984
  });
1168
- app.plugins["content-manager"].apis.addBulkAction((actions) => {
1169
- const deleteActionIndex = actions.findIndex((action) => action.name === "DeleteAction");
1170
- actions.splice(deleteActionIndex, 0, ReleaseAction);
1171
- return actions;
1172
- });
1173
985
  } else if (!window.strapi.features.isEnabled("cms-content-releases") && window.strapi?.flags?.promoteEE) {
1174
986
  app.addMenuLink({
1175
987
  to: `/plugins/purchase-content-releases`,
@@ -1178,20 +990,22 @@ const admin = {
1178
990
  id: `${pluginId}.plugin.name`,
1179
991
  defaultMessage: "Releases"
1180
992
  },
993
+ permissions: [],
1181
994
  async Component() {
1182
- const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-bpIYXOfu.js"));
1183
- return PurchaseContentReleases;
995
+ const { PurchaseContentReleases } = await Promise.resolve().then(() => require("./PurchaseContentReleases-Be3acS2L.js"));
996
+ return { default: PurchaseContentReleases };
1184
997
  },
1185
- lockIcon: true
998
+ lockIcon: true,
999
+ position: 2
1186
1000
  });
1187
1001
  }
1188
1002
  },
1189
1003
  async registerTrads({ locales }) {
1190
1004
  const importedTrads = await Promise.all(
1191
1005
  locales.map((locale) => {
1192
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-3SGjiVyR.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 }) => {
1193
1007
  return {
1194
- data: helperPlugin.prefixPluginTranslations(data, "content-releases"),
1008
+ data: prefixPluginTranslations(data, "content-releases"),
1195
1009
  locale
1196
1010
  };
1197
1011
  }).catch(() => {
@@ -1210,7 +1024,6 @@ exports.ReleaseActionMenu = ReleaseActionMenu;
1210
1024
  exports.ReleaseActionOptions = ReleaseActionOptions;
1211
1025
  exports.admin = admin;
1212
1026
  exports.getTimezoneOffset = getTimezoneOffset;
1213
- exports.isAxiosError = isAxiosError;
1214
1027
  exports.pluginId = pluginId;
1215
1028
  exports.releaseApi = releaseApi;
1216
1029
  exports.useCreateReleaseMutation = useCreateReleaseMutation;
@@ -1219,7 +1032,6 @@ exports.useGetReleaseActionsQuery = useGetReleaseActionsQuery;
1219
1032
  exports.useGetReleaseQuery = useGetReleaseQuery;
1220
1033
  exports.useGetReleasesQuery = useGetReleasesQuery;
1221
1034
  exports.usePublishReleaseMutation = usePublishReleaseMutation;
1222
- exports.useTypedDispatch = useTypedDispatch;
1223
1035
  exports.useUpdateReleaseActionMutation = useUpdateReleaseActionMutation;
1224
1036
  exports.useUpdateReleaseMutation = useUpdateReleaseMutation;
1225
- //# sourceMappingURL=index-xV3jXcZj.js.map
1037
+ //# sourceMappingURL=index-C5Hc767q.js.map