@strapi/review-workflows 0.0.0-experimental.c592deb623aed3f74ef7fdacfad9757ed59d34f7 → 0.0.0-experimental.cb74730ce5154c26404d4dccca14976a22319002

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 (75) hide show
  1. package/dist/_chunks/{Layout-BL8djfsC.mjs → Layout-BGC42hTJ.mjs} +3 -3
  2. package/dist/_chunks/Layout-BGC42hTJ.mjs.map +1 -0
  3. package/dist/_chunks/{Layout-C03LlqOq.js → Layout-DcZnQxp9.js} +4 -5
  4. package/dist/_chunks/Layout-DcZnQxp9.js.map +1 -0
  5. package/dist/_chunks/{en-xcewH2pC.js → en-CYgjfSep.js} +5 -2
  6. package/dist/_chunks/en-CYgjfSep.js.map +1 -0
  7. package/dist/_chunks/{en-D9ZrQAV6.mjs → en-D9dxziEb.mjs} +5 -2
  8. package/dist/_chunks/en-D9dxziEb.mjs.map +1 -0
  9. package/dist/_chunks/{_id-DJbIpA0G.js → id-BI6AAFQF.js} +80 -25
  10. package/dist/_chunks/id-BI6AAFQF.js.map +1 -0
  11. package/dist/_chunks/{_id-Dqkyfusr.mjs → id-FuGqdNs8.mjs} +79 -23
  12. package/dist/_chunks/id-FuGqdNs8.mjs.map +1 -0
  13. package/dist/_chunks/{index-D3id9TXV.js → index-B05ot-RJ.js} +6 -8
  14. package/dist/_chunks/index-B05ot-RJ.js.map +1 -0
  15. package/dist/_chunks/{index-BZLIQ0fO.mjs → index-C_-s412E.mjs} +36 -30
  16. package/dist/_chunks/index-C_-s412E.mjs.map +1 -0
  17. package/dist/_chunks/{index-BPEorVRx.mjs → index-D0D7uQQv.mjs} +5 -6
  18. package/dist/_chunks/index-D0D7uQQv.mjs.map +1 -0
  19. package/dist/_chunks/{index-C8M5OkXj.js → index-Nf1qO5tM.js} +37 -32
  20. package/dist/_chunks/index-Nf1qO5tM.js.map +1 -0
  21. package/dist/_chunks/purchase-review-workflows-BN-5Ube7.mjs.map +1 -1
  22. package/dist/_chunks/purchase-review-workflows-DlCDg0fD.js.map +1 -1
  23. package/dist/_chunks/{router-Bh38qGTT.mjs → router-BslCQGgZ.mjs} +3 -3
  24. package/dist/_chunks/router-BslCQGgZ.mjs.map +1 -0
  25. package/dist/_chunks/{router-glyRmw5L.js → router-DXipg2gI.js} +3 -3
  26. package/dist/_chunks/router-DXipg2gI.js.map +1 -0
  27. package/dist/admin/index.js +1 -1
  28. package/dist/admin/index.mjs +1 -1
  29. package/dist/admin/src/services/settings.d.ts +7 -3
  30. package/dist/server/index.js +449 -582
  31. package/dist/server/index.js.map +1 -1
  32. package/dist/server/index.mjs +449 -582
  33. package/dist/server/index.mjs.map +1 -1
  34. package/dist/server/src/bootstrap.d.ts.map +1 -1
  35. package/dist/server/src/constants/workflows.d.ts +1 -0
  36. package/dist/server/src/constants/workflows.d.ts.map +1 -1
  37. package/dist/server/src/content-types/index.d.ts +6 -0
  38. package/dist/server/src/content-types/index.d.ts.map +1 -1
  39. package/dist/server/src/content-types/workflow/index.d.ts +6 -0
  40. package/dist/server/src/content-types/workflow/index.d.ts.map +1 -1
  41. package/dist/server/src/controllers/assignees.d.ts.map +1 -1
  42. package/dist/server/src/controllers/stages.d.ts.map +1 -1
  43. package/dist/server/src/index.d.ts +28 -6
  44. package/dist/server/src/index.d.ts.map +1 -1
  45. package/dist/server/src/register.d.ts.map +1 -1
  46. package/dist/server/src/services/assignees.d.ts +8 -4
  47. package/dist/server/src/services/assignees.d.ts.map +1 -1
  48. package/dist/server/src/services/document-service-middleware.d.ts +1 -0
  49. package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
  50. package/dist/server/src/services/index.d.ts +16 -6
  51. package/dist/server/src/services/index.d.ts.map +1 -1
  52. package/dist/server/src/services/metrics/index.d.ts +4 -4
  53. package/dist/server/src/services/metrics/index.d.ts.map +1 -1
  54. package/dist/server/src/services/metrics/weekly-metrics.d.ts.map +1 -1
  55. package/dist/server/src/services/stages.d.ts +6 -1
  56. package/dist/server/src/services/stages.d.ts.map +1 -1
  57. package/dist/server/src/services/workflows.d.ts.map +1 -1
  58. package/dist/server/src/validation/review-workflows.d.ts +4 -0
  59. package/dist/server/src/validation/review-workflows.d.ts.map +1 -1
  60. package/dist/shared/contracts/review-workflows.d.ts +8 -3
  61. package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
  62. package/package.json +12 -12
  63. package/dist/_chunks/Layout-BL8djfsC.mjs.map +0 -1
  64. package/dist/_chunks/Layout-C03LlqOq.js.map +0 -1
  65. package/dist/_chunks/_id-DJbIpA0G.js.map +0 -1
  66. package/dist/_chunks/_id-Dqkyfusr.mjs.map +0 -1
  67. package/dist/_chunks/en-D9ZrQAV6.mjs.map +0 -1
  68. package/dist/_chunks/en-xcewH2pC.js.map +0 -1
  69. package/dist/_chunks/index-BPEorVRx.mjs.map +0 -1
  70. package/dist/_chunks/index-BZLIQ0fO.mjs.map +0 -1
  71. package/dist/_chunks/index-C8M5OkXj.js.map +0 -1
  72. package/dist/_chunks/index-D3id9TXV.js.map +0 -1
  73. package/dist/_chunks/router-Bh38qGTT.mjs.map +0 -1
  74. package/dist/_chunks/router-glyRmw5L.js.map +0 -1
  75. /package/dist/admin/src/routes/settings/{:id.d.ts → id.d.ts} +0 -0
@@ -11,8 +11,7 @@ const ee = require("@strapi/admin/strapi-admin/ee");
11
11
  const icons = require("@strapi/icons");
12
12
  const styledComponents = require("styled-components");
13
13
  function _interopNamespace(e) {
14
- if (e && e.__esModule)
15
- return e;
14
+ if (e && e.__esModule) return e;
16
15
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
17
16
  if (e) {
18
17
  for (const k in e) {
@@ -29,13 +28,20 @@ function _interopNamespace(e) {
29
28
  return Object.freeze(n);
30
29
  }
31
30
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
32
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
31
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
33
32
  const v = glob[path];
34
33
  if (v) {
35
34
  return typeof v === "function" ? v() : Promise.resolve(v);
36
35
  }
37
36
  return new Promise((_, reject) => {
38
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
37
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
38
+ reject.bind(
39
+ null,
40
+ new Error(
41
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
42
+ )
43
+ )
44
+ );
39
45
  });
40
46
  };
41
47
  const PLUGIN_ID = "review-workflows";
@@ -140,8 +146,7 @@ const isBaseQueryError = (error) => {
140
146
  return error.name !== void 0;
141
147
  };
142
148
  const buildValidParams = (query) => {
143
- if (!query)
144
- return query;
149
+ if (!query) return query;
145
150
  const { plugins: _, ...validQueryParams } = {
146
151
  ...query,
147
152
  ...Object.values(query?.plugins ?? {}).reduce(
@@ -149,9 +154,6 @@ const buildValidParams = (query) => {
149
154
  {}
150
155
  )
151
156
  };
152
- if ("_q" in validQueryParams) {
153
- validQueryParams._q = encodeURIComponent(validQueryParams._q);
154
- }
155
157
  return validQueryParams;
156
158
  };
157
159
  const getDisplayName = ({
@@ -196,13 +198,13 @@ const AssigneeSelect = () => {
196
198
  documentId: id
197
199
  },
198
200
  {
199
- skip: !id
201
+ skip: !id && collectionType !== "single-types"
200
202
  }
201
203
  );
202
204
  const users = data?.users || [];
203
205
  const currentAssignee = document ? document[ASSIGNEE_ATTRIBUTE_NAME] : null;
204
206
  const [updateAssignee, { error, isLoading: isMutating }] = useUpdateAssigneeMutation();
205
- if (!collectionType || !model || !id) {
207
+ if (!collectionType || !model || !document?.documentId) {
206
208
  return null;
207
209
  }
208
210
  const handleChange = async (assigneeId) => {
@@ -212,7 +214,7 @@ const AssigneeSelect = () => {
212
214
  const res = await updateAssignee({
213
215
  slug: collectionType,
214
216
  model,
215
- id,
217
+ id: document.documentId,
216
218
  params,
217
219
  data: {
218
220
  id: assigneeId ? parseInt(assigneeId, 10) : null
@@ -249,7 +251,7 @@ const AssigneeSelect = () => {
249
251
  id: "content-manager.reviewWorkflows.assignee.clear",
250
252
  defaultMessage: "Clear assignee"
251
253
  }),
252
- disabled: !isLoadingPermissions && !isLoading && users.length === 0 || !id,
254
+ disabled: !isLoadingPermissions && !isLoading && users.length === 0 || !document.documentId,
253
255
  value: currentAssignee ? currentAssignee.id.toString() : null,
254
256
  onChange: handleChange,
255
257
  onClear: () => handleChange(null),
@@ -391,25 +393,26 @@ const StageSelect = () => {
391
393
  const { toggleNotification } = strapiAdmin.useNotification();
392
394
  const [{ query }] = strapiAdmin.useQueryParams();
393
395
  const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
394
- const { data, isLoading } = useGetStagesQuery(
396
+ const { document, isLoading: isLoadingDocument } = strapiAdmin$1.unstable_useDocument(
395
397
  {
396
- slug: collectionType,
398
+ collectionType,
397
399
  model,
398
- id,
399
- params
400
+ documentId: id
400
401
  },
401
402
  {
402
- skip: !id
403
+ skip: !id && collectionType !== "single-types"
403
404
  }
404
405
  );
405
- const { document } = strapiAdmin$1.unstable_useDocument(
406
+ const { data, isLoading: isLoadingStages } = useGetStagesQuery(
406
407
  {
407
- collectionType,
408
+ slug: collectionType,
408
409
  model,
409
- documentId: id
410
+ // @ts-expect-error – `id` is not correctly typed in the DS.
411
+ id: document?.documentId,
412
+ params
410
413
  },
411
414
  {
412
- skip: !id
415
+ skip: !document?.documentId
413
416
  }
414
417
  );
415
418
  const { meta, stages = [] } = data ?? {};
@@ -425,10 +428,10 @@ const StageSelect = () => {
425
428
  } else if (limits?.[CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME] && parseInt(limits[CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME], 10) < stages.length) {
426
429
  setShowLimitModal("stage");
427
430
  } else {
428
- if (id) {
431
+ if (document?.documentId) {
429
432
  const res = await updateStage({
430
433
  model,
431
- id,
434
+ id: document.documentId,
432
435
  slug: collectionType,
433
436
  params,
434
437
  data: { id: stageId }
@@ -455,6 +458,7 @@ const StageSelect = () => {
455
458
  }
456
459
  };
457
460
  const { themeColorName } = getStageColorByHex(activeWorkflowStage?.color) ?? {};
461
+ const isLoading = isLoadingStages || isLoadingDocument;
458
462
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
459
463
  /* @__PURE__ */ jsxRuntime.jsxs(
460
464
  designSystem.Field.Root,
@@ -567,12 +571,16 @@ const StageSelect = () => {
567
571
  ] });
568
572
  };
569
573
  const Panel = () => {
570
- const { slug = "", id } = reactRouterDom.useParams();
574
+ const {
575
+ slug = "",
576
+ id,
577
+ collectionType
578
+ } = reactRouterDom.useParams();
571
579
  const {
572
580
  edit: { options }
573
581
  } = strapiAdmin$1.unstable_useDocumentLayout(slug);
574
582
  const { formatMessage } = reactIntl.useIntl();
575
- if (!window.strapi.isEE || !options?.reviewWorkflows || !id || id === "create") {
583
+ if (!window.strapi.isEE || !options?.reviewWorkflows || collectionType !== "single-types" && !id || id === "create") {
576
584
  return null;
577
585
  }
578
586
  return {
@@ -745,9 +753,6 @@ const addColumnToTableHook = ({ displayedHeaders, layout }) => {
745
753
  };
746
754
  };
747
755
  const prefixPluginTranslations = (trad, pluginId) => {
748
- if (!pluginId) {
749
- throw new TypeError("pluginId can't be empty");
750
- }
751
756
  return Object.keys(trad).reduce((acc, current) => {
752
757
  acc[`${pluginId}.${current}`] = trad[current];
753
758
  return acc;
@@ -770,7 +775,7 @@ const admin = {
770
775
  },
771
776
  permissions: [],
772
777
  async Component() {
773
- const { Router } = await Promise.resolve().then(() => require("./router-glyRmw5L.js"));
778
+ const { Router } = await Promise.resolve().then(() => require("./router-DXipg2gI.js"));
774
779
  return { default: Router };
775
780
  }
776
781
  });
@@ -794,7 +799,7 @@ const admin = {
794
799
  async registerTrads({ locales }) {
795
800
  const importedTrads = await Promise.all(
796
801
  locales.map((locale) => {
797
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-xcewH2pC.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
802
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-CYgjfSep.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
798
803
  return {
799
804
  data: prefixPluginTranslations(data, PLUGIN_ID),
800
805
  locale
@@ -824,4 +829,4 @@ exports.useGetContentTypesQuery = useGetContentTypesQuery;
824
829
  exports.useGetWorkflowsQuery = useGetWorkflowsQuery;
825
830
  exports.useTypedSelector = useTypedSelector;
826
831
  exports.useUpdateWorkflowMutation = useUpdateWorkflowMutation;
827
- //# sourceMappingURL=index-C8M5OkXj.js.map
832
+ //# sourceMappingURL=index-Nf1qO5tM.js.map