@strapi/review-workflows 5.0.0-rc.6 → 5.0.0-rc.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 (46) hide show
  1. package/dist/_chunks/{Layout-D3DDQmMI.js → Layout-B8FL2x6-.js} +7 -8
  2. package/dist/_chunks/Layout-B8FL2x6-.js.map +1 -0
  3. package/dist/_chunks/{Layout-Da8jupiA.mjs → Layout-Dx59M7TT.mjs} +7 -8
  4. package/dist/_chunks/Layout-Dx59M7TT.mjs.map +1 -0
  5. package/dist/_chunks/{_id-xSrgPSJs.mjs → _id-AtadE_bb.mjs} +6 -32
  6. package/dist/_chunks/_id-AtadE_bb.mjs.map +1 -0
  7. package/dist/_chunks/{_id-CnRDP3Xx.js → _id-C-SYBc57.js} +6 -32
  8. package/dist/_chunks/_id-C-SYBc57.js.map +1 -0
  9. package/dist/_chunks/{index-jfO5GxtW.mjs → index-0pB4f3ex.mjs} +3 -3
  10. package/dist/_chunks/{index-jfO5GxtW.mjs.map → index-0pB4f3ex.mjs.map} +1 -1
  11. package/dist/_chunks/{index-4kp4AkBB.js → index-CI4KFjfU.js} +3 -3
  12. package/dist/_chunks/{index-4kp4AkBB.js.map → index-CI4KFjfU.js.map} +1 -1
  13. package/dist/_chunks/{index-DDsJlZQw.mjs → index-CtpGMTO2.mjs} +56 -48
  14. package/dist/_chunks/index-CtpGMTO2.mjs.map +1 -0
  15. package/dist/_chunks/{index-DhPxWpsW.js → index-Dj2vG7H2.js} +55 -47
  16. package/dist/_chunks/index-Dj2vG7H2.js.map +1 -0
  17. package/dist/_chunks/{router-DOEULOpS.mjs → router-C6NXX9-N.mjs} +3 -3
  18. package/dist/_chunks/{router-DOEULOpS.mjs.map → router-C6NXX9-N.mjs.map} +1 -1
  19. package/dist/_chunks/{router-DSXpeew4.js → router-Co81pRA9.js} +3 -3
  20. package/dist/_chunks/{router-DSXpeew4.js.map → router-Co81pRA9.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 +0 -41
  28. package/dist/server/index.js.map +1 -1
  29. package/dist/server/index.mjs +0 -41
  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/workflows.d.ts +0 -7
  34. package/dist/server/src/controllers/workflows.d.ts.map +1 -1
  35. package/dist/server/src/index.d.ts +0 -1
  36. package/dist/server/src/index.d.ts.map +1 -1
  37. package/dist/server/src/routes/review-workflows.d.ts.map +1 -1
  38. package/dist/shared/contracts/review-workflows.d.ts +1 -14
  39. package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
  40. package/package.json +6 -6
  41. package/dist/_chunks/Layout-D3DDQmMI.js.map +0 -1
  42. package/dist/_chunks/Layout-Da8jupiA.mjs.map +0 -1
  43. package/dist/_chunks/_id-CnRDP3Xx.js.map +0 -1
  44. package/dist/_chunks/_id-xSrgPSJs.mjs.map +0 -1
  45. package/dist/_chunks/index-DDsJlZQw.mjs.map +0 -1
  46. package/dist/_chunks/index-DhPxWpsW.js.map +0 -1
@@ -45,8 +45,9 @@ const CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME = "stagesPerWorkflow";
45
45
  const STAGE_COLOR_DEFAULT = designSystem.lightTheme.colors.primary600;
46
46
  const useTypedSelector = reactRedux.useSelector;
47
47
  const reviewWorkflowsApi = strapiAdmin.adminApi.enhanceEndpoints({
48
- addTagTypes: ["ReviewWorkflow", "ReviewWorkflowStages"]
48
+ addTagTypes: ["ReviewWorkflow", "ReviewWorkflowStages", "Document", "ContentTypeSettings"]
49
49
  });
50
+ const SINGLE_TYPES = "single-types";
50
51
  const contentManagerApi = reviewWorkflowsApi.injectEndpoints({
51
52
  endpoints: (builder) => ({
52
53
  getStages: builder.query({
@@ -74,7 +75,17 @@ const contentManagerApi = reviewWorkflowsApi.injectEndpoints({
74
75
  params
75
76
  }
76
77
  }),
77
- transformResponse: (res) => res.data
78
+ transformResponse: (res) => res.data,
79
+ invalidatesTags: (_result, _error, { slug, id, model }) => {
80
+ return [
81
+ {
82
+ type: "Document",
83
+ id: slug !== SINGLE_TYPES ? `${model}_${id}` : model
84
+ },
85
+ { type: "Document", id: `${model}_LIST` },
86
+ "ReviewWorkflowStages"
87
+ ];
88
+ }
78
89
  }),
79
90
  updateAssignee: builder.mutation({
80
91
  query: ({ model, slug, id, params, ...data }) => ({
@@ -85,7 +96,16 @@ const contentManagerApi = reviewWorkflowsApi.injectEndpoints({
85
96
  params
86
97
  }
87
98
  }),
88
- transformResponse: (res) => res.data
99
+ transformResponse: (res) => res.data,
100
+ invalidatesTags: (_result, _error, { slug, id, model }) => {
101
+ return [
102
+ {
103
+ type: "Document",
104
+ id: slug !== SINGLE_TYPES ? `${model}_${id}` : model
105
+ },
106
+ { type: "Document", id: `${model}_LIST` }
107
+ ];
108
+ }
89
109
  }),
90
110
  getContentTypes: builder.query({
91
111
  query: () => ({
@@ -156,7 +176,6 @@ const AssigneeSelect = () => {
156
176
  id,
157
177
  slug: model = ""
158
178
  } = reactRouterDom.useParams();
159
- const dispatch = reactRedux.useDispatch();
160
179
  const permissions = useTypedSelector((state) => state.admin_app.permissions);
161
180
  const { formatMessage } = reactIntl.useIntl();
162
181
  const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
@@ -200,15 +219,6 @@ const AssigneeSelect = () => {
200
219
  }
201
220
  });
202
221
  if ("data" in res) {
203
- dispatch({
204
- type: "contentManagerApi/invalidateTags",
205
- payload: [
206
- {
207
- type: "Document",
208
- id: `${model}_${id}`
209
- }
210
- ]
211
- });
212
222
  toggleNotification({
213
223
  type: "success",
214
224
  message: formatMessage({
@@ -376,7 +386,6 @@ const StageSelect = () => {
376
386
  slug: model = "",
377
387
  id = ""
378
388
  } = reactRouterDom.useParams();
379
- const dispatch = reactRedux.useDispatch();
380
389
  const { formatMessage } = reactIntl.useIntl();
381
390
  const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
382
391
  const { toggleNotification } = strapiAdmin.useNotification();
@@ -425,15 +434,6 @@ const StageSelect = () => {
425
434
  data: { id: stageId }
426
435
  });
427
436
  if ("data" in res) {
428
- dispatch({
429
- type: "contentManagerApi/invalidateTags",
430
- payload: [
431
- {
432
- type: "Document",
433
- id: `${model}_${id}`
434
- }
435
- ]
436
- });
437
437
  toggleNotification({
438
438
  type: "success",
439
439
  message: formatMessage({
@@ -591,36 +591,25 @@ const settingsApi = reviewWorkflowsApi.injectEndpoints({
591
591
  endpoints: (builder) => ({
592
592
  getWorkflows: builder.query({
593
593
  query: (args) => {
594
- const { id, ...params } = args ?? {};
595
594
  return {
596
- url: `/review-workflows/workflows${id ? `/${id}` : ""}`,
595
+ url: "/review-workflows/workflows",
597
596
  method: "GET",
598
597
  config: {
599
- params
598
+ params: args ?? {}
600
599
  }
601
600
  };
602
601
  },
603
602
  transformResponse: (res) => {
604
- let workflows = [];
605
- if (Array.isArray(res.data)) {
606
- workflows = res.data;
607
- } else {
608
- workflows = [res.data];
609
- }
610
603
  return {
611
- workflows,
604
+ workflows: res.data,
612
605
  meta: "meta" in res ? res.meta : void 0
613
606
  };
614
607
  },
615
- providesTags: (res, _err, arg) => {
616
- if (typeof arg === "object" && "id" in arg && arg.id !== "") {
617
- return [{ type: "ReviewWorkflow", id: arg.id }];
618
- } else {
619
- return [
620
- ...res?.workflows.map(({ id }) => ({ type: "ReviewWorkflow", id })) ?? [],
621
- { type: "ReviewWorkflow", id: "LIST" }
622
- ];
623
- }
608
+ providesTags: (res) => {
609
+ return [
610
+ ...res?.workflows.map(({ id }) => ({ type: "ReviewWorkflow", id })) ?? [],
611
+ { type: "ReviewWorkflow", id: "LIST" }
612
+ ];
624
613
  }
625
614
  }),
626
615
  createWorkflow: builder.mutation({
@@ -630,7 +619,18 @@ const settingsApi = reviewWorkflowsApi.injectEndpoints({
630
619
  data
631
620
  }),
632
621
  transformResponse: (res) => res.data,
633
- invalidatesTags: [{ type: "ReviewWorkflow", id: "LIST" }, "ReviewWorkflowStages"]
622
+ invalidatesTags(res) {
623
+ return [
624
+ { type: "ReviewWorkflow", id: "LIST" },
625
+ "ReviewWorkflowStages",
626
+ { type: "Document", id: `ALL_LIST` },
627
+ { type: "ContentTypeSettings", id: "LIST" },
628
+ ...res?.contentTypes.map((uid) => ({
629
+ type: "Document",
630
+ id: `${uid}_ALL_ITEMS`
631
+ })) ?? []
632
+ ];
633
+ }
634
634
  }),
635
635
  updateWorkflow: builder.mutation({
636
636
  query: ({ id, ...data }) => ({
@@ -641,7 +641,13 @@ const settingsApi = reviewWorkflowsApi.injectEndpoints({
641
641
  transformResponse: (res) => res.data,
642
642
  invalidatesTags: (res, _err, arg) => [
643
643
  { type: "ReviewWorkflow", id: arg.id },
644
- "ReviewWorkflowStages"
644
+ "ReviewWorkflowStages",
645
+ { type: "Document", id: "ALL_LIST" },
646
+ { type: "ContentTypeSettings", id: "LIST" },
647
+ ...res?.contentTypes.map((uid) => ({
648
+ type: "Document",
649
+ id: `${uid}_ALL_ITEMS`
650
+ })) ?? []
645
651
  ]
646
652
  }),
647
653
  deleteWorkflow: builder.mutation({
@@ -652,7 +658,9 @@ const settingsApi = reviewWorkflowsApi.injectEndpoints({
652
658
  transformResponse: (res) => res.data,
653
659
  invalidatesTags: (res, _err, arg) => [
654
660
  { type: "ReviewWorkflow", id: arg.id },
655
- "ReviewWorkflowStages"
661
+ "ReviewWorkflowStages",
662
+ { type: "Document", id: `ALL_LIST` },
663
+ { type: "ContentTypeSettings", id: "LIST" }
656
664
  ]
657
665
  })
658
666
  }),
@@ -762,7 +770,7 @@ const admin = {
762
770
  },
763
771
  permissions: [],
764
772
  async Component() {
765
- const { Router } = await Promise.resolve().then(() => require("./router-DSXpeew4.js"));
773
+ const { Router } = await Promise.resolve().then(() => require("./router-Co81pRA9.js"));
766
774
  return { default: Router };
767
775
  }
768
776
  });
@@ -816,4 +824,4 @@ exports.useGetContentTypesQuery = useGetContentTypesQuery;
816
824
  exports.useGetWorkflowsQuery = useGetWorkflowsQuery;
817
825
  exports.useTypedSelector = useTypedSelector;
818
826
  exports.useUpdateWorkflowMutation = useUpdateWorkflowMutation;
819
- //# sourceMappingURL=index-DhPxWpsW.js.map
827
+ //# sourceMappingURL=index-Dj2vG7H2.js.map