@strapi/review-workflows 5.0.0-rc.2 → 5.0.0-rc.21

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 (54) hide show
  1. package/dist/_chunks/{Layout-Da8jupiA.mjs → Layout-BL8djfsC.mjs} +7 -8
  2. package/dist/_chunks/Layout-BL8djfsC.mjs.map +1 -0
  3. package/dist/_chunks/{Layout-D3DDQmMI.js → Layout-C03LlqOq.js} +7 -8
  4. package/dist/_chunks/Layout-C03LlqOq.js.map +1 -0
  5. package/dist/_chunks/{_id-CnRDP3Xx.js → _id-DJbIpA0G.js} +10 -36
  6. package/dist/_chunks/_id-DJbIpA0G.js.map +1 -0
  7. package/dist/_chunks/{_id-xSrgPSJs.mjs → _id-Dqkyfusr.mjs} +10 -36
  8. package/dist/_chunks/_id-Dqkyfusr.mjs.map +1 -0
  9. package/dist/_chunks/{index-jfO5GxtW.mjs → index-BPEorVRx.mjs} +11 -31
  10. package/dist/_chunks/index-BPEorVRx.mjs.map +1 -0
  11. package/dist/_chunks/{index-DDsJlZQw.mjs → index-BZLIQ0fO.mjs} +56 -48
  12. package/dist/_chunks/index-BZLIQ0fO.mjs.map +1 -0
  13. package/dist/_chunks/{index-DhPxWpsW.js → index-C8M5OkXj.js} +55 -47
  14. package/dist/_chunks/index-C8M5OkXj.js.map +1 -0
  15. package/dist/_chunks/{index-4kp4AkBB.js → index-D3id9TXV.js} +9 -29
  16. package/dist/_chunks/index-D3id9TXV.js.map +1 -0
  17. package/dist/_chunks/{router-DOEULOpS.mjs → router-Bh38qGTT.mjs} +3 -3
  18. package/dist/_chunks/{router-DOEULOpS.mjs.map → router-Bh38qGTT.mjs.map} +1 -1
  19. package/dist/_chunks/{router-DSXpeew4.js → router-glyRmw5L.js} +3 -3
  20. package/dist/_chunks/{router-DSXpeew4.js.map → router-glyRmw5L.js.map} +1 -1
  21. package/dist/admin/index.js +1 -1
  22. package/dist/admin/index.mjs +1 -1
  23. package/dist/admin/src/services/admin.d.ts +1 -1
  24. package/dist/admin/src/services/api.d.ts +1 -1
  25. package/dist/admin/src/services/content-manager.d.ts +4 -4
  26. package/dist/admin/src/services/settings.d.ts +1733 -7
  27. package/dist/server/index.js +14 -54
  28. package/dist/server/index.js.map +1 -1
  29. package/dist/server/index.mjs +14 -54
  30. package/dist/server/index.mjs.map +1 -1
  31. package/dist/server/src/controllers/index.d.ts +0 -1
  32. package/dist/server/src/controllers/index.d.ts.map +1 -1
  33. package/dist/server/src/controllers/stages.d.ts.map +1 -1
  34. package/dist/server/src/controllers/workflows.d.ts +0 -7
  35. package/dist/server/src/controllers/workflows.d.ts.map +1 -1
  36. package/dist/server/src/index.d.ts +1 -2
  37. package/dist/server/src/index.d.ts.map +1 -1
  38. package/dist/server/src/routes/review-workflows.d.ts.map +1 -1
  39. package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
  40. package/dist/server/src/services/index.d.ts +1 -1
  41. package/dist/server/src/services/stages.d.ts +2 -7
  42. package/dist/server/src/services/stages.d.ts.map +1 -1
  43. package/dist/shared/contracts/review-workflows.d.ts +1 -14
  44. package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
  45. package/package.json +9 -9
  46. package/dist/_chunks/Layout-D3DDQmMI.js.map +0 -1
  47. package/dist/_chunks/Layout-Da8jupiA.mjs.map +0 -1
  48. package/dist/_chunks/_id-CnRDP3Xx.js.map +0 -1
  49. package/dist/_chunks/_id-xSrgPSJs.mjs.map +0 -1
  50. package/dist/_chunks/index-4kp4AkBB.js.map +0 -1
  51. package/dist/_chunks/index-DDsJlZQw.mjs.map +0 -1
  52. package/dist/_chunks/index-DhPxWpsW.js.map +0 -1
  53. package/dist/_chunks/index-jfO5GxtW.mjs.map +0 -1
  54. package/strapi-server.js +0 -3
@@ -5,7 +5,7 @@ import { useIntl } from "react-intl";
5
5
  import { useParams } from "react-router-dom";
6
6
  import * as React from "react";
7
7
  import { adminApi, useAPIErrorHandler, useNotification, useRBAC, useQueryParams, useAdminUsers } from "@strapi/admin/strapi-admin";
8
- import { useSelector, useDispatch } from "react-redux";
8
+ import { useSelector } from "react-redux";
9
9
  import { useLicenseLimits } from "@strapi/admin/strapi-admin/ee";
10
10
  import { Cross } from "@strapi/icons";
11
11
  import { styled } from "styled-components";
@@ -25,8 +25,9 @@ const CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME = "stagesPerWorkflow";
25
25
  const STAGE_COLOR_DEFAULT = lightTheme.colors.primary600;
26
26
  const useTypedSelector = useSelector;
27
27
  const reviewWorkflowsApi = adminApi.enhanceEndpoints({
28
- addTagTypes: ["ReviewWorkflow", "ReviewWorkflowStages"]
28
+ addTagTypes: ["ReviewWorkflow", "ReviewWorkflowStages", "Document", "ContentTypeSettings"]
29
29
  });
30
+ const SINGLE_TYPES = "single-types";
30
31
  const contentManagerApi = reviewWorkflowsApi.injectEndpoints({
31
32
  endpoints: (builder) => ({
32
33
  getStages: builder.query({
@@ -54,7 +55,17 @@ const contentManagerApi = reviewWorkflowsApi.injectEndpoints({
54
55
  params
55
56
  }
56
57
  }),
57
- transformResponse: (res) => res.data
58
+ transformResponse: (res) => res.data,
59
+ invalidatesTags: (_result, _error, { slug, id, model }) => {
60
+ return [
61
+ {
62
+ type: "Document",
63
+ id: slug !== SINGLE_TYPES ? `${model}_${id}` : model
64
+ },
65
+ { type: "Document", id: `${model}_LIST` },
66
+ "ReviewWorkflowStages"
67
+ ];
68
+ }
58
69
  }),
59
70
  updateAssignee: builder.mutation({
60
71
  query: ({ model, slug, id, params, ...data }) => ({
@@ -65,7 +76,16 @@ const contentManagerApi = reviewWorkflowsApi.injectEndpoints({
65
76
  params
66
77
  }
67
78
  }),
68
- transformResponse: (res) => res.data
79
+ transformResponse: (res) => res.data,
80
+ invalidatesTags: (_result, _error, { slug, id, model }) => {
81
+ return [
82
+ {
83
+ type: "Document",
84
+ id: slug !== SINGLE_TYPES ? `${model}_${id}` : model
85
+ },
86
+ { type: "Document", id: `${model}_LIST` }
87
+ ];
88
+ }
69
89
  }),
70
90
  getContentTypes: builder.query({
71
91
  query: () => ({
@@ -136,7 +156,6 @@ const AssigneeSelect = () => {
136
156
  id,
137
157
  slug: model = ""
138
158
  } = useParams();
139
- const dispatch = useDispatch();
140
159
  const permissions = useTypedSelector((state) => state.admin_app.permissions);
141
160
  const { formatMessage } = useIntl();
142
161
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
@@ -180,15 +199,6 @@ const AssigneeSelect = () => {
180
199
  }
181
200
  });
182
201
  if ("data" in res) {
183
- dispatch({
184
- type: "contentManagerApi/invalidateTags",
185
- payload: [
186
- {
187
- type: "Document",
188
- id: `${model}_${id}`
189
- }
190
- ]
191
- });
192
202
  toggleNotification({
193
203
  type: "success",
194
204
  message: formatMessage({
@@ -356,7 +366,6 @@ const StageSelect = () => {
356
366
  slug: model = "",
357
367
  id = ""
358
368
  } = useParams();
359
- const dispatch = useDispatch();
360
369
  const { formatMessage } = useIntl();
361
370
  const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
362
371
  const { toggleNotification } = useNotification();
@@ -405,15 +414,6 @@ const StageSelect = () => {
405
414
  data: { id: stageId }
406
415
  });
407
416
  if ("data" in res) {
408
- dispatch({
409
- type: "contentManagerApi/invalidateTags",
410
- payload: [
411
- {
412
- type: "Document",
413
- id: `${model}_${id}`
414
- }
415
- ]
416
- });
417
417
  toggleNotification({
418
418
  type: "success",
419
419
  message: formatMessage({
@@ -571,36 +571,25 @@ const settingsApi = reviewWorkflowsApi.injectEndpoints({
571
571
  endpoints: (builder) => ({
572
572
  getWorkflows: builder.query({
573
573
  query: (args) => {
574
- const { id, ...params } = args ?? {};
575
574
  return {
576
- url: `/review-workflows/workflows${id ? `/${id}` : ""}`,
575
+ url: "/review-workflows/workflows",
577
576
  method: "GET",
578
577
  config: {
579
- params
578
+ params: args ?? {}
580
579
  }
581
580
  };
582
581
  },
583
582
  transformResponse: (res) => {
584
- let workflows = [];
585
- if (Array.isArray(res.data)) {
586
- workflows = res.data;
587
- } else {
588
- workflows = [res.data];
589
- }
590
583
  return {
591
- workflows,
584
+ workflows: res.data,
592
585
  meta: "meta" in res ? res.meta : void 0
593
586
  };
594
587
  },
595
- providesTags: (res, _err, arg) => {
596
- if (typeof arg === "object" && "id" in arg && arg.id !== "") {
597
- return [{ type: "ReviewWorkflow", id: arg.id }];
598
- } else {
599
- return [
600
- ...res?.workflows.map(({ id }) => ({ type: "ReviewWorkflow", id })) ?? [],
601
- { type: "ReviewWorkflow", id: "LIST" }
602
- ];
603
- }
588
+ providesTags: (res) => {
589
+ return [
590
+ ...res?.workflows.map(({ id }) => ({ type: "ReviewWorkflow", id })) ?? [],
591
+ { type: "ReviewWorkflow", id: "LIST" }
592
+ ];
604
593
  }
605
594
  }),
606
595
  createWorkflow: builder.mutation({
@@ -610,7 +599,18 @@ const settingsApi = reviewWorkflowsApi.injectEndpoints({
610
599
  data
611
600
  }),
612
601
  transformResponse: (res) => res.data,
613
- invalidatesTags: [{ type: "ReviewWorkflow", id: "LIST" }, "ReviewWorkflowStages"]
602
+ invalidatesTags(res) {
603
+ return [
604
+ { type: "ReviewWorkflow", id: "LIST" },
605
+ "ReviewWorkflowStages",
606
+ { type: "Document", id: `ALL_LIST` },
607
+ { type: "ContentTypeSettings", id: "LIST" },
608
+ ...res?.contentTypes.map((uid) => ({
609
+ type: "Document",
610
+ id: `${uid}_ALL_ITEMS`
611
+ })) ?? []
612
+ ];
613
+ }
614
614
  }),
615
615
  updateWorkflow: builder.mutation({
616
616
  query: ({ id, ...data }) => ({
@@ -621,7 +621,13 @@ const settingsApi = reviewWorkflowsApi.injectEndpoints({
621
621
  transformResponse: (res) => res.data,
622
622
  invalidatesTags: (res, _err, arg) => [
623
623
  { type: "ReviewWorkflow", id: arg.id },
624
- "ReviewWorkflowStages"
624
+ "ReviewWorkflowStages",
625
+ { type: "Document", id: "ALL_LIST" },
626
+ { type: "ContentTypeSettings", id: "LIST" },
627
+ ...res?.contentTypes.map((uid) => ({
628
+ type: "Document",
629
+ id: `${uid}_ALL_ITEMS`
630
+ })) ?? []
625
631
  ]
626
632
  }),
627
633
  deleteWorkflow: builder.mutation({
@@ -632,7 +638,9 @@ const settingsApi = reviewWorkflowsApi.injectEndpoints({
632
638
  transformResponse: (res) => res.data,
633
639
  invalidatesTags: (res, _err, arg) => [
634
640
  { type: "ReviewWorkflow", id: arg.id },
635
- "ReviewWorkflowStages"
641
+ "ReviewWorkflowStages",
642
+ { type: "Document", id: `ALL_LIST` },
643
+ { type: "ContentTypeSettings", id: "LIST" }
636
644
  ]
637
645
  })
638
646
  }),
@@ -742,7 +750,7 @@ const admin = {
742
750
  },
743
751
  permissions: [],
744
752
  async Component() {
745
- const { Router } = await import("./router-DOEULOpS.mjs");
753
+ const { Router } = await import("./router-Bh38qGTT.mjs");
746
754
  return { default: Router };
747
755
  }
748
756
  });
@@ -798,4 +806,4 @@ export {
798
806
  reviewWorkflowsApi as r,
799
807
  useGetContentTypesQuery as u
800
808
  };
801
- //# sourceMappingURL=index-DDsJlZQw.mjs.map
809
+ //# sourceMappingURL=index-BZLIQ0fO.mjs.map