@strapi/review-workflows 5.0.0-beta.7 → 5.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/_chunks/{Layout-60gjGInX.js → Layout-BMqtFafC.js} +4 -10
  2. package/dist/_chunks/Layout-BMqtFafC.js.map +1 -0
  3. package/dist/_chunks/{Layout-CJYuYwXO.mjs → Layout-lg3hbwGL.mjs} +4 -10
  4. package/dist/_chunks/Layout-lg3hbwGL.mjs.map +1 -0
  5. package/dist/_chunks/{_id-UJ-8gken.mjs → _id-B3jMqqMH.mjs} +71 -101
  6. package/dist/_chunks/_id-B3jMqqMH.mjs.map +1 -0
  7. package/dist/_chunks/{_id-BO7wNLt1.js → _id-B853wt9z.js} +69 -99
  8. package/dist/_chunks/_id-B853wt9z.js.map +1 -0
  9. package/dist/_chunks/{index-DhEhUlv9.mjs → index-BhJmjDbj.mjs} +7 -6
  10. package/dist/_chunks/{index-DhEhUlv9.mjs.map → index-BhJmjDbj.mjs.map} +1 -1
  11. package/dist/_chunks/{index-DnXnsrOM.js → index-CdU1x9cZ.js} +7 -6
  12. package/dist/_chunks/index-CdU1x9cZ.js.map +1 -0
  13. package/dist/_chunks/{index-CfiZnfhM.js → index-Ujtj1Rcp.js} +28 -96
  14. package/dist/_chunks/index-Ujtj1Rcp.js.map +1 -0
  15. package/dist/_chunks/{index-DmQNXb0P.mjs → index-lebOqdrv.mjs} +29 -97
  16. package/dist/_chunks/index-lebOqdrv.mjs.map +1 -0
  17. package/dist/_chunks/{router-BiQI7EcM.js → router-BboD243b.js} +3 -3
  18. package/dist/_chunks/{router-BiQI7EcM.js.map → router-BboD243b.js.map} +1 -1
  19. package/dist/_chunks/{router-DFD0S0ey.mjs → router-CvMnSjb9.mjs} +3 -3
  20. package/dist/_chunks/{router-DFD0S0ey.mjs.map → router-CvMnSjb9.mjs.map} +1 -1
  21. package/dist/admin/index.js +1 -1
  22. package/dist/admin/index.mjs +1 -1
  23. package/dist/admin/src/routes/settings/hooks/useReviewWorkflows.d.ts +3 -3
  24. package/dist/admin/src/services/admin.d.ts +2 -2
  25. package/dist/admin/src/services/api.d.ts +2 -3
  26. package/dist/admin/src/services/content-manager.d.ts +6 -6
  27. package/dist/admin/src/services/settings.d.ts +4 -4
  28. package/dist/admin/src/utils/api.d.ts +3 -17
  29. package/package.json +11 -11
  30. package/dist/_chunks/Layout-60gjGInX.js.map +0 -1
  31. package/dist/_chunks/Layout-CJYuYwXO.mjs.map +0 -1
  32. package/dist/_chunks/_id-BO7wNLt1.js.map +0 -1
  33. package/dist/_chunks/_id-UJ-8gken.mjs.map +0 -1
  34. package/dist/_chunks/index-CfiZnfhM.js.map +0 -1
  35. package/dist/_chunks/index-DmQNXb0P.mjs.map +0 -1
  36. package/dist/_chunks/index-DnXnsrOM.js.map +0 -1
@@ -4,9 +4,8 @@ import { unstable_useDocument, unstable_useDocumentLayout } from "@strapi/conten
4
4
  import { useIntl } from "react-intl";
5
5
  import { useParams } from "react-router-dom";
6
6
  import * as React from "react";
7
- import { getFetchClient, isFetchError, useAPIErrorHandler, useNotification, useRBAC, useQueryParams, useAdminUsers } from "@strapi/admin/strapi-admin";
7
+ import { adminApi, useAPIErrorHandler, useNotification, useRBAC, useQueryParams, useAdminUsers } from "@strapi/admin/strapi-admin";
8
8
  import { useSelector, useDispatch } from "react-redux";
9
- import { createApi } from "@reduxjs/toolkit/query/react";
10
9
  import { useLicenseLimits } from "@strapi/admin/strapi-admin/ee";
11
10
  import { Cross } from "@strapi/icons";
12
11
  import { styled } from "styled-components";
@@ -25,91 +24,8 @@ const CHARGEBEE_WORKFLOW_ENTITLEMENT_NAME = "numberOfWorkflows";
25
24
  const CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME = "stagesPerWorkflow";
26
25
  const STAGE_COLOR_DEFAULT = lightTheme.colors.primary600;
27
26
  const useTypedSelector = useSelector;
28
- const fetchBaseQuery = () => async (query, { signal }) => {
29
- try {
30
- const { get, post, del, put } = getFetchClient();
31
- if (typeof query === "string") {
32
- const result = await get(query, { signal });
33
- return { data: result.data };
34
- } else {
35
- const { url, method = "GET", data, config } = query;
36
- if (method === "POST") {
37
- const result2 = await post(url, data, {
38
- ...config,
39
- signal
40
- });
41
- return { data: result2.data };
42
- }
43
- if (method === "DELETE") {
44
- const result2 = await del(url, {
45
- ...config,
46
- signal
47
- });
48
- return { data: result2.data };
49
- }
50
- if (method === "PUT") {
51
- const result2 = await put(url, data, {
52
- ...config,
53
- signal
54
- });
55
- return { data: result2.data };
56
- }
57
- const result = await get(url, {
58
- ...config,
59
- signal
60
- });
61
- return { data: result.data };
62
- }
63
- } catch (err) {
64
- if (isFetchError(err)) {
65
- if (typeof err.response?.data === "object" && err.response?.data !== null && "error" in err.response?.data) {
66
- return { data: void 0, error: err.response?.data.error };
67
- } else {
68
- return {
69
- data: void 0,
70
- error: {
71
- name: "UnknownError",
72
- message: "There was an unknown error response from the API",
73
- details: err.response,
74
- status: err.status
75
- }
76
- };
77
- }
78
- }
79
- const error = err;
80
- return {
81
- data: void 0,
82
- error: {
83
- name: error.name,
84
- message: error.message,
85
- stack: error.stack
86
- }
87
- };
88
- }
89
- };
90
- const isBaseQueryError = (error) => {
91
- return error.name !== void 0;
92
- };
93
- const buildValidParams = (query) => {
94
- if (!query)
95
- return query;
96
- const { plugins: _, ...validQueryParams } = {
97
- ...query,
98
- ...Object.values(query?.plugins ?? {}).reduce(
99
- (acc, current) => Object.assign(acc, current),
100
- {}
101
- )
102
- };
103
- if ("_q" in validQueryParams) {
104
- validQueryParams._q = encodeURIComponent(validQueryParams._q);
105
- }
106
- return validQueryParams;
107
- };
108
- const reviewWorkflowsApi = createApi({
109
- reducerPath: "reviewWorkflowsApi",
110
- baseQuery: fetchBaseQuery(),
111
- tagTypes: ["ReviewWorkflow", "ReviewWorkflowStages"],
112
- endpoints: () => ({})
27
+ const reviewWorkflowsApi = adminApi.enhanceEndpoints({
28
+ addTagTypes: ["ReviewWorkflow", "ReviewWorkflowStages"]
113
29
  });
114
30
  const contentManagerApi = reviewWorkflowsApi.injectEndpoints({
115
31
  endpoints: (builder) => ({
@@ -171,7 +87,8 @@ const contentManagerApi = reviewWorkflowsApi.injectEndpoints({
171
87
  );
172
88
  }
173
89
  })
174
- })
90
+ }),
91
+ overrideExisting: true
175
92
  });
176
93
  const {
177
94
  useGetStagesQuery,
@@ -179,6 +96,24 @@ const {
179
96
  useUpdateAssigneeMutation,
180
97
  useGetContentTypesQuery
181
98
  } = contentManagerApi;
99
+ const isBaseQueryError = (error) => {
100
+ return error.name !== void 0;
101
+ };
102
+ const buildValidParams = (query) => {
103
+ if (!query)
104
+ return query;
105
+ const { plugins: _, ...validQueryParams } = {
106
+ ...query,
107
+ ...Object.values(query?.plugins ?? {}).reduce(
108
+ (acc, current) => Object.assign(acc, current),
109
+ {}
110
+ )
111
+ };
112
+ if ("_q" in validQueryParams) {
113
+ validQueryParams._q = encodeURIComponent(validQueryParams._q);
114
+ }
115
+ return validQueryParams;
116
+ };
182
117
  const getDisplayName = ({
183
118
  firstname,
184
119
  lastname,
@@ -359,12 +294,13 @@ const Root = ({
359
294
  /* @__PURE__ */ jsx(Box, { display: "flex", position: "absolute", right: 0, top: 0, children: /* @__PURE__ */ jsx(
360
295
  IconButton,
361
296
  {
362
- icon: /* @__PURE__ */ jsx(Cross, {}),
363
- "aria-label": formatMessage({
297
+ withTooltip: false,
298
+ label: formatMessage({
364
299
  id: "global.close",
365
300
  defaultMessage: "Close"
366
301
  }),
367
- onClick: onClose
302
+ onClick: onClose,
303
+ children: /* @__PURE__ */ jsx(Cross, {})
368
304
  }
369
305
  ) })
370
306
  ] })
@@ -790,10 +726,6 @@ const prefixPluginTranslations = (trad, pluginId) => {
790
726
  const admin = {
791
727
  register(app) {
792
728
  if (window.strapi.features.isEnabled(FEATURE_ID)) {
793
- app.addReducers({
794
- [reviewWorkflowsApi.reducerPath]: reviewWorkflowsApi.reducer
795
- });
796
- app.addMiddlewares([() => reviewWorkflowsApi.middleware]);
797
729
  app.registerHook("Admin/CM/pages/ListView/inject-column-in-table", addColumnToTableHook);
798
730
  const contentManagerPluginApis = app.getPlugin("content-manager").apis;
799
731
  if ("addEditViewSidePanel" in contentManagerPluginApis && typeof contentManagerPluginApis.addEditViewSidePanel === "function") {
@@ -808,7 +740,7 @@ const admin = {
808
740
  },
809
741
  permissions: [],
810
742
  async Component() {
811
- const { Router } = await import("./router-DFD0S0ey.mjs");
743
+ const { Router } = await import("./router-CvMnSjb9.mjs");
812
744
  return { default: Router };
813
745
  }
814
746
  });
@@ -864,4 +796,4 @@ export {
864
796
  reviewWorkflowsApi as r,
865
797
  useGetContentTypesQuery as u
866
798
  };
867
- //# sourceMappingURL=index-DmQNXb0P.mjs.map
799
+ //# sourceMappingURL=index-lebOqdrv.mjs.map