@strapi/review-workflows 0.0.0-experimental.cb311d9fcfbd8e441f790aea232f0a39bdd90e16 → 0.0.0-experimental.cfda358b7f27015e34e739b8742a2962ae2e7aee

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 (79) hide show
  1. package/dist/_chunks/{Layout-B8FL2x6-.js → Layout-C3IORH2n.js} +4 -5
  2. package/dist/_chunks/Layout-C3IORH2n.js.map +1 -0
  3. package/dist/_chunks/{Layout-Dx59M7TT.mjs → Layout-DNKR5bym.mjs} +3 -3
  4. package/dist/_chunks/Layout-DNKR5bym.mjs.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-AtadE_bb.mjs → id-C9Ku9Br9.mjs} +82 -26
  10. package/dist/_chunks/id-C9Ku9Br9.mjs.map +1 -0
  11. package/dist/_chunks/{_id-C-SYBc57.js → id-oOE1bYls.js} +83 -28
  12. package/dist/_chunks/id-oOE1bYls.js.map +1 -0
  13. package/dist/_chunks/{index-CtpGMTO2.mjs → index-ByXbOW-R.mjs} +37 -31
  14. package/dist/_chunks/index-ByXbOW-R.mjs.map +1 -0
  15. package/dist/_chunks/{index-CI4KFjfU.js → index-CmHHjN95.js} +12 -34
  16. package/dist/_chunks/index-CmHHjN95.js.map +1 -0
  17. package/dist/_chunks/{index-0pB4f3ex.mjs → index-CyhaJuJG.mjs} +13 -34
  18. package/dist/_chunks/index-CyhaJuJG.mjs.map +1 -0
  19. package/dist/_chunks/{index-Dj2vG7H2.js → index-DMT27jNE.js} +38 -33
  20. package/dist/_chunks/index-DMT27jNE.js.map +1 -0
  21. package/dist/_chunks/{purchase-review-workflows-DlCDg0fD.js → purchase-review-workflows-BxoDFxQ5.js} +2 -2
  22. package/dist/_chunks/purchase-review-workflows-BxoDFxQ5.js.map +1 -0
  23. package/dist/_chunks/{purchase-review-workflows-BN-5Ube7.mjs → purchase-review-workflows-DyFV_H0I.mjs} +2 -2
  24. package/dist/_chunks/{purchase-review-workflows-BN-5Ube7.mjs.map → purchase-review-workflows-DyFV_H0I.mjs.map} +1 -1
  25. package/dist/_chunks/{router-C6NXX9-N.mjs → router-BPl2HZMq.mjs} +3 -3
  26. package/dist/_chunks/router-BPl2HZMq.mjs.map +1 -0
  27. package/dist/_chunks/{router-Co81pRA9.js → router-vDfGt9bq.js} +3 -3
  28. package/dist/_chunks/router-vDfGt9bq.js.map +1 -0
  29. package/dist/admin/index.js +1 -1
  30. package/dist/admin/index.mjs +1 -1
  31. package/dist/admin/src/services/settings.d.ts +7 -3
  32. package/dist/server/index.js +455 -587
  33. package/dist/server/index.js.map +1 -1
  34. package/dist/server/index.mjs +455 -587
  35. package/dist/server/index.mjs.map +1 -1
  36. package/dist/server/src/bootstrap.d.ts.map +1 -1
  37. package/dist/server/src/constants/workflows.d.ts +1 -0
  38. package/dist/server/src/constants/workflows.d.ts.map +1 -1
  39. package/dist/server/src/content-types/index.d.ts +6 -0
  40. package/dist/server/src/content-types/index.d.ts.map +1 -1
  41. package/dist/server/src/content-types/workflow/index.d.ts +6 -0
  42. package/dist/server/src/content-types/workflow/index.d.ts.map +1 -1
  43. package/dist/server/src/controllers/assignees.d.ts.map +1 -1
  44. package/dist/server/src/controllers/stages.d.ts.map +1 -1
  45. package/dist/server/src/index.d.ts +28 -6
  46. package/dist/server/src/index.d.ts.map +1 -1
  47. package/dist/server/src/register.d.ts.map +1 -1
  48. package/dist/server/src/services/assignees.d.ts +8 -4
  49. package/dist/server/src/services/assignees.d.ts.map +1 -1
  50. package/dist/server/src/services/document-service-middleware.d.ts +1 -0
  51. package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
  52. package/dist/server/src/services/index.d.ts +16 -6
  53. package/dist/server/src/services/index.d.ts.map +1 -1
  54. package/dist/server/src/services/metrics/index.d.ts +4 -4
  55. package/dist/server/src/services/metrics/index.d.ts.map +1 -1
  56. package/dist/server/src/services/metrics/weekly-metrics.d.ts.map +1 -1
  57. package/dist/server/src/services/stages.d.ts +7 -7
  58. package/dist/server/src/services/stages.d.ts.map +1 -1
  59. package/dist/server/src/services/workflows.d.ts.map +1 -1
  60. package/dist/server/src/validation/review-workflows.d.ts +4 -0
  61. package/dist/server/src/validation/review-workflows.d.ts.map +1 -1
  62. package/dist/shared/contracts/review-workflows.d.ts +8 -3
  63. package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
  64. package/package.json +12 -13
  65. package/dist/_chunks/Layout-B8FL2x6-.js.map +0 -1
  66. package/dist/_chunks/Layout-Dx59M7TT.mjs.map +0 -1
  67. package/dist/_chunks/_id-AtadE_bb.mjs.map +0 -1
  68. package/dist/_chunks/_id-C-SYBc57.js.map +0 -1
  69. package/dist/_chunks/en-D9ZrQAV6.mjs.map +0 -1
  70. package/dist/_chunks/en-xcewH2pC.js.map +0 -1
  71. package/dist/_chunks/index-0pB4f3ex.mjs.map +0 -1
  72. package/dist/_chunks/index-CI4KFjfU.js.map +0 -1
  73. package/dist/_chunks/index-CtpGMTO2.mjs.map +0 -1
  74. package/dist/_chunks/index-Dj2vG7H2.js.map +0 -1
  75. package/dist/_chunks/purchase-review-workflows-DlCDg0fD.js.map +0 -1
  76. package/dist/_chunks/router-C6NXX9-N.mjs.map +0 -1
  77. package/dist/_chunks/router-Co81pRA9.js.map +0 -1
  78. package/strapi-server.js +0 -3
  79. /package/dist/admin/src/routes/settings/{:id.d.ts → id.d.ts} +0 -0
@@ -9,13 +9,20 @@ 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";
12
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
12
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
13
13
  const v = glob[path];
14
14
  if (v) {
15
15
  return typeof v === "function" ? v() : Promise.resolve(v);
16
16
  }
17
17
  return new Promise((_, reject) => {
18
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
18
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
19
+ reject.bind(
20
+ null,
21
+ new Error(
22
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
23
+ )
24
+ )
25
+ );
19
26
  });
20
27
  };
21
28
  const PLUGIN_ID = "review-workflows";
@@ -120,8 +127,7 @@ const isBaseQueryError = (error) => {
120
127
  return error.name !== void 0;
121
128
  };
122
129
  const buildValidParams = (query) => {
123
- if (!query)
124
- return query;
130
+ if (!query) return query;
125
131
  const { plugins: _, ...validQueryParams } = {
126
132
  ...query,
127
133
  ...Object.values(query?.plugins ?? {}).reduce(
@@ -129,9 +135,6 @@ const buildValidParams = (query) => {
129
135
  {}
130
136
  )
131
137
  };
132
- if ("_q" in validQueryParams) {
133
- validQueryParams._q = encodeURIComponent(validQueryParams._q);
134
- }
135
138
  return validQueryParams;
136
139
  };
137
140
  const getDisplayName = ({
@@ -176,13 +179,13 @@ const AssigneeSelect = () => {
176
179
  documentId: id
177
180
  },
178
181
  {
179
- skip: !id
182
+ skip: !id && collectionType !== "single-types"
180
183
  }
181
184
  );
182
185
  const users = data?.users || [];
183
186
  const currentAssignee = document ? document[ASSIGNEE_ATTRIBUTE_NAME] : null;
184
187
  const [updateAssignee, { error, isLoading: isMutating }] = useUpdateAssigneeMutation();
185
- if (!collectionType || !model || !id) {
188
+ if (!collectionType || !model || !document?.documentId) {
186
189
  return null;
187
190
  }
188
191
  const handleChange = async (assigneeId) => {
@@ -192,7 +195,7 @@ const AssigneeSelect = () => {
192
195
  const res = await updateAssignee({
193
196
  slug: collectionType,
194
197
  model,
195
- id,
198
+ id: document.documentId,
196
199
  params,
197
200
  data: {
198
201
  id: assigneeId ? parseInt(assigneeId, 10) : null
@@ -229,7 +232,7 @@ const AssigneeSelect = () => {
229
232
  id: "content-manager.reviewWorkflows.assignee.clear",
230
233
  defaultMessage: "Clear assignee"
231
234
  }),
232
- disabled: !isLoadingPermissions && !isLoading && users.length === 0 || !id,
235
+ disabled: !isLoadingPermissions && !isLoading && users.length === 0 || !document.documentId,
233
236
  value: currentAssignee ? currentAssignee.id.toString() : null,
234
237
  onChange: handleChange,
235
238
  onClear: () => handleChange(null),
@@ -371,25 +374,26 @@ const StageSelect = () => {
371
374
  const { toggleNotification } = useNotification();
372
375
  const [{ query }] = useQueryParams();
373
376
  const params = React.useMemo(() => buildValidParams(query), [query]);
374
- const { data, isLoading } = useGetStagesQuery(
377
+ const { document, isLoading: isLoadingDocument } = unstable_useDocument(
375
378
  {
376
- slug: collectionType,
379
+ collectionType,
377
380
  model,
378
- id,
379
- params
381
+ documentId: id
380
382
  },
381
383
  {
382
- skip: !id
384
+ skip: !id && collectionType !== "single-types"
383
385
  }
384
386
  );
385
- const { document } = unstable_useDocument(
387
+ const { data, isLoading: isLoadingStages } = useGetStagesQuery(
386
388
  {
387
- collectionType,
389
+ slug: collectionType,
388
390
  model,
389
- documentId: id
391
+ // @ts-expect-error – `id` is not correctly typed in the DS.
392
+ id: document?.documentId,
393
+ params
390
394
  },
391
395
  {
392
- skip: !id
396
+ skip: !document?.documentId
393
397
  }
394
398
  );
395
399
  const { meta, stages = [] } = data ?? {};
@@ -405,10 +409,10 @@ const StageSelect = () => {
405
409
  } else if (limits?.[CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME] && parseInt(limits[CHARGEBEE_STAGES_PER_WORKFLOW_ENTITLEMENT_NAME], 10) < stages.length) {
406
410
  setShowLimitModal("stage");
407
411
  } else {
408
- if (id) {
412
+ if (document?.documentId) {
409
413
  const res = await updateStage({
410
414
  model,
411
- id,
415
+ id: document.documentId,
412
416
  slug: collectionType,
413
417
  params,
414
418
  data: { id: stageId }
@@ -435,6 +439,7 @@ const StageSelect = () => {
435
439
  }
436
440
  };
437
441
  const { themeColorName } = getStageColorByHex(activeWorkflowStage?.color) ?? {};
442
+ const isLoading = isLoadingStages || isLoadingDocument;
438
443
  return /* @__PURE__ */ jsxs(Fragment, { children: [
439
444
  /* @__PURE__ */ jsxs(
440
445
  Field.Root,
@@ -547,12 +552,16 @@ const StageSelect = () => {
547
552
  ] });
548
553
  };
549
554
  const Panel = () => {
550
- const { slug = "", id } = useParams();
555
+ const {
556
+ slug = "",
557
+ id,
558
+ collectionType
559
+ } = useParams();
551
560
  const {
552
561
  edit: { options }
553
562
  } = unstable_useDocumentLayout(slug);
554
563
  const { formatMessage } = useIntl();
555
- if (!window.strapi.isEE || !options?.reviewWorkflows || !id || id === "create") {
564
+ if (!window.strapi.isEE || !options?.reviewWorkflows || collectionType !== "single-types" && !id || id === "create") {
556
565
  return null;
557
566
  }
558
567
  return {
@@ -725,9 +734,6 @@ const addColumnToTableHook = ({ displayedHeaders, layout }) => {
725
734
  };
726
735
  };
727
736
  const prefixPluginTranslations = (trad, pluginId) => {
728
- if (!pluginId) {
729
- throw new TypeError("pluginId can't be empty");
730
- }
731
737
  return Object.keys(trad).reduce((acc, current) => {
732
738
  acc[`${pluginId}.${current}`] = trad[current];
733
739
  return acc;
@@ -750,7 +756,7 @@ const admin = {
750
756
  },
751
757
  permissions: [],
752
758
  async Component() {
753
- const { Router } = await import("./router-C6NXX9-N.mjs");
759
+ const { Router } = await import("./router-BPl2HZMq.mjs");
754
760
  return { default: Router };
755
761
  }
756
762
  });
@@ -765,7 +771,7 @@ const admin = {
765
771
  licenseOnly: true,
766
772
  permissions: [],
767
773
  async Component() {
768
- const { PurchaseReviewWorkflows } = await import("./purchase-review-workflows-BN-5Ube7.mjs");
774
+ const { PurchaseReviewWorkflows } = await import("./purchase-review-workflows-DyFV_H0I.mjs");
769
775
  return { default: PurchaseReviewWorkflows };
770
776
  }
771
777
  });
@@ -774,7 +780,7 @@ const admin = {
774
780
  async registerTrads({ locales }) {
775
781
  const importedTrads = await Promise.all(
776
782
  locales.map((locale) => {
777
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-D9ZrQAV6.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
783
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-D9dxziEb.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
778
784
  return {
779
785
  data: prefixPluginTranslations(data, PLUGIN_ID),
780
786
  locale
@@ -806,4 +812,4 @@ export {
806
812
  reviewWorkflowsApi as r,
807
813
  useGetContentTypesQuery as u
808
814
  };
809
- //# sourceMappingURL=index-CtpGMTO2.mjs.map
815
+ //# sourceMappingURL=index-ByXbOW-R.mjs.map