@strapi/content-manager 0.0.0-experimental.31a5317d54179a9ce6225bf1b6e1f9fb6c372fa9 → 0.0.0-experimental.36632203b17974c18103c138ffbef53a82e448c3

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 (165) hide show
  1. package/dist/_chunks/{ComponentConfigurationPage-BlAzljQ6.js → ComponentConfigurationPage-Br8hp2Xt.js} +4 -4
  2. package/dist/_chunks/{ComponentConfigurationPage-BlAzljQ6.js.map → ComponentConfigurationPage-Br8hp2Xt.js.map} +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-Ccwb19Qj.mjs → ComponentConfigurationPage-DhwMhiRn.mjs} +4 -4
  4. package/dist/_chunks/{ComponentConfigurationPage-Ccwb19Qj.mjs.map → ComponentConfigurationPage-DhwMhiRn.mjs.map} +1 -1
  5. package/dist/_chunks/{EditConfigurationPage-BPoOzhCM.js → EditConfigurationPage-BG7rpPjL.js} +4 -4
  6. package/dist/_chunks/{EditConfigurationPage-BPoOzhCM.js.map → EditConfigurationPage-BG7rpPjL.js.map} +1 -1
  7. package/dist/_chunks/{EditConfigurationPage-C19b_9RL.mjs → EditConfigurationPage-CWao3CZ3.mjs} +4 -4
  8. package/dist/_chunks/{EditConfigurationPage-C19b_9RL.mjs.map → EditConfigurationPage-CWao3CZ3.mjs.map} +1 -1
  9. package/dist/_chunks/{EditViewPage-D9xH8HYD.js → EditViewPage-BUtpHsMz.js} +23 -7
  10. package/dist/_chunks/EditViewPage-BUtpHsMz.js.map +1 -0
  11. package/dist/_chunks/{EditViewPage-nmrHNiJ9.mjs → EditViewPage-hiwZg61J.mjs} +24 -8
  12. package/dist/_chunks/EditViewPage-hiwZg61J.mjs.map +1 -0
  13. package/dist/_chunks/{Field--kmlJuSb.mjs → Field-BQQLwyUs.mjs} +71 -27
  14. package/dist/_chunks/Field-BQQLwyUs.mjs.map +1 -0
  15. package/dist/_chunks/{Field-BB_pHo6D.js → Field-DEdug-Ll.js} +71 -27
  16. package/dist/_chunks/Field-DEdug-Ll.js.map +1 -0
  17. package/dist/_chunks/{Form-CUtOiC4S.mjs → Form-DwJovCha.mjs} +3 -3
  18. package/dist/_chunks/Form-DwJovCha.mjs.map +1 -0
  19. package/dist/_chunks/{Form-iwbkoaAF.js → Form-v5pkY-X_.js} +3 -3
  20. package/dist/_chunks/Form-v5pkY-X_.js.map +1 -0
  21. package/dist/_chunks/{History-guuZF4lR.js → History-40apIShV.js} +37 -47
  22. package/dist/_chunks/History-40apIShV.js.map +1 -0
  23. package/dist/_chunks/{History-BKR3KyU3.mjs → History-B9uJsxZl.mjs} +38 -48
  24. package/dist/_chunks/History-B9uJsxZl.mjs.map +1 -0
  25. package/dist/_chunks/{ListConfigurationPage-B_O3hiLT.mjs → ListConfigurationPage-CA4oi4Hj.mjs} +3 -3
  26. package/dist/_chunks/{ListConfigurationPage-B_O3hiLT.mjs.map → ListConfigurationPage-CA4oi4Hj.mjs.map} +1 -1
  27. package/dist/_chunks/{ListConfigurationPage-Cu26t5sE.js → ListConfigurationPage-DAGbWDIL.js} +3 -3
  28. package/dist/_chunks/{ListConfigurationPage-Cu26t5sE.js.map → ListConfigurationPage-DAGbWDIL.js.map} +1 -1
  29. package/dist/_chunks/{ListViewPage-B4sTBfu6.mjs → ListViewPage-Ca8F1NL-.mjs} +16 -5
  30. package/dist/_chunks/{ListViewPage-B4sTBfu6.mjs.map → ListViewPage-Ca8F1NL-.mjs.map} +1 -1
  31. package/dist/_chunks/{ListViewPage-DWqqGno8.js → ListViewPage-CjaHQ2_V.js} +16 -5
  32. package/dist/_chunks/ListViewPage-CjaHQ2_V.js.map +1 -0
  33. package/dist/_chunks/{NoContentTypePage-TTkwA8uk.js → NoContentTypePage-CGxqLI8j.js} +2 -2
  34. package/dist/_chunks/{NoContentTypePage-TTkwA8uk.js.map → NoContentTypePage-CGxqLI8j.js.map} +1 -1
  35. package/dist/_chunks/{NoContentTypePage-Daktt4t9.mjs → NoContentTypePage-CwfnU-aN.mjs} +2 -2
  36. package/dist/_chunks/{NoContentTypePage-Daktt4t9.mjs.map → NoContentTypePage-CwfnU-aN.mjs.map} +1 -1
  37. package/dist/_chunks/{NoPermissionsPage-D8_k39Q0.js → NoPermissionsPage-CY3_QduF.js} +2 -2
  38. package/dist/_chunks/{NoPermissionsPage-D8_k39Q0.js.map → NoPermissionsPage-CY3_QduF.js.map} +1 -1
  39. package/dist/_chunks/{NoPermissionsPage-CBUXY2Pt.mjs → NoPermissionsPage-iPk2lFR6.mjs} +2 -2
  40. package/dist/_chunks/{NoPermissionsPage-CBUXY2Pt.mjs.map → NoPermissionsPage-iPk2lFR6.mjs.map} +1 -1
  41. package/dist/_chunks/Preview-DRJhcaIO.mjs +267 -0
  42. package/dist/_chunks/Preview-DRJhcaIO.mjs.map +1 -0
  43. package/dist/_chunks/Preview-V8XOfrQf.js +286 -0
  44. package/dist/_chunks/Preview-V8XOfrQf.js.map +1 -0
  45. package/dist/_chunks/{Relations-DjvmZ_XQ.js → Relations-CGerEwji.js} +71 -35
  46. package/dist/_chunks/Relations-CGerEwji.js.map +1 -0
  47. package/dist/_chunks/{Relations-HKmXF7eO.mjs → Relations-DGWa9W2j.mjs} +72 -36
  48. package/dist/_chunks/Relations-DGWa9W2j.mjs.map +1 -0
  49. package/dist/_chunks/{en-BVzUkPxZ.js → en-CHOp_xJv.js} +18 -9
  50. package/dist/_chunks/{en-BVzUkPxZ.js.map → en-CHOp_xJv.js.map} +1 -1
  51. package/dist/_chunks/{en-CPTj6CjC.mjs → en-D_BMf0hT.mjs} +18 -9
  52. package/dist/_chunks/{en-CPTj6CjC.mjs.map → en-D_BMf0hT.mjs.map} +1 -1
  53. package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
  54. package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
  55. package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
  56. package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
  57. package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
  58. package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
  59. package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
  60. package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
  61. package/dist/_chunks/{index-CB1AN26E.mjs → index-V8MWkDSd.mjs} +838 -676
  62. package/dist/_chunks/index-V8MWkDSd.mjs.map +1 -0
  63. package/dist/_chunks/{index-jDJgW_Lf.js → index-tN1hpOMN.js} +836 -673
  64. package/dist/_chunks/index-tN1hpOMN.js.map +1 -0
  65. package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
  66. package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
  67. package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
  68. package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
  69. package/dist/_chunks/{layout-BCzDsMgN.mjs → layout-Bue_C6ui.mjs} +3 -3
  70. package/dist/_chunks/{layout-BCzDsMgN.mjs.map → layout-Bue_C6ui.mjs.map} +1 -1
  71. package/dist/_chunks/{layout-D6A3K-ut.js → layout-BzX903CL.js} +3 -3
  72. package/dist/_chunks/{layout-D6A3K-ut.js.map → layout-BzX903CL.js.map} +1 -1
  73. package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
  74. package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
  75. package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
  76. package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
  77. package/dist/_chunks/{relations-C10QoukP.js → relations-C4HcWYYJ.js} +6 -7
  78. package/dist/_chunks/relations-C4HcWYYJ.js.map +1 -0
  79. package/dist/_chunks/{relations-B5Jnw32V.mjs → relations-C8eyDiIO.mjs} +6 -7
  80. package/dist/_chunks/relations-C8eyDiIO.mjs.map +1 -0
  81. package/dist/admin/index.js +2 -1
  82. package/dist/admin/index.js.map +1 -1
  83. package/dist/admin/index.mjs +4 -3
  84. package/dist/admin/src/exports.d.ts +1 -1
  85. package/dist/admin/src/hooks/useDocument.d.ts +32 -1
  86. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  87. package/dist/admin/src/pages/EditView/components/Header.d.ts +1 -0
  88. package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
  89. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  90. package/dist/admin/src/preview/constants.d.ts +1 -0
  91. package/dist/admin/src/preview/index.d.ts +4 -0
  92. package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
  93. package/dist/admin/src/preview/routes.d.ts +3 -0
  94. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  95. package/dist/server/index.js +374 -160
  96. package/dist/server/index.js.map +1 -1
  97. package/dist/server/index.mjs +374 -160
  98. package/dist/server/index.mjs.map +1 -1
  99. package/dist/server/src/bootstrap.d.ts.map +1 -1
  100. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  101. package/dist/server/src/controllers/index.d.ts.map +1 -1
  102. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  103. package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
  104. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  105. package/dist/server/src/history/services/history.d.ts.map +1 -1
  106. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  107. package/dist/server/src/history/services/utils.d.ts +2 -3
  108. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  109. package/dist/server/src/index.d.ts +4 -4
  110. package/dist/server/src/preview/constants.d.ts +2 -0
  111. package/dist/server/src/preview/constants.d.ts.map +1 -0
  112. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  113. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  114. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  115. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  116. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  117. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  118. package/dist/server/src/preview/index.d.ts +4 -0
  119. package/dist/server/src/preview/index.d.ts.map +1 -0
  120. package/dist/server/src/preview/routes/index.d.ts +8 -0
  121. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  122. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  123. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  124. package/dist/server/src/preview/services/index.d.ts +15 -0
  125. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  126. package/dist/server/src/preview/services/preview-config.d.ts +30 -0
  127. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  128. package/dist/server/src/preview/services/preview.d.ts +12 -0
  129. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  130. package/dist/server/src/preview/utils.d.ts +18 -0
  131. package/dist/server/src/preview/utils.d.ts.map +1 -0
  132. package/dist/server/src/routes/index.d.ts.map +1 -1
  133. package/dist/server/src/services/document-metadata.d.ts +8 -8
  134. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  135. package/dist/server/src/services/index.d.ts +4 -4
  136. package/dist/server/src/services/index.d.ts.map +1 -1
  137. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  138. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  139. package/dist/server/src/utils/index.d.ts +2 -0
  140. package/dist/server/src/utils/index.d.ts.map +1 -1
  141. package/dist/shared/contracts/index.d.ts +1 -0
  142. package/dist/shared/contracts/index.d.ts.map +1 -1
  143. package/dist/shared/contracts/preview.d.ts +27 -0
  144. package/dist/shared/contracts/preview.d.ts.map +1 -0
  145. package/dist/shared/index.js +4 -0
  146. package/dist/shared/index.js.map +1 -1
  147. package/dist/shared/index.mjs +4 -0
  148. package/dist/shared/index.mjs.map +1 -1
  149. package/package.json +12 -12
  150. package/dist/_chunks/EditViewPage-D9xH8HYD.js.map +0 -1
  151. package/dist/_chunks/EditViewPage-nmrHNiJ9.mjs.map +0 -1
  152. package/dist/_chunks/Field--kmlJuSb.mjs.map +0 -1
  153. package/dist/_chunks/Field-BB_pHo6D.js.map +0 -1
  154. package/dist/_chunks/Form-CUtOiC4S.mjs.map +0 -1
  155. package/dist/_chunks/Form-iwbkoaAF.js.map +0 -1
  156. package/dist/_chunks/History-BKR3KyU3.mjs.map +0 -1
  157. package/dist/_chunks/History-guuZF4lR.js.map +0 -1
  158. package/dist/_chunks/ListViewPage-DWqqGno8.js.map +0 -1
  159. package/dist/_chunks/Relations-DjvmZ_XQ.js.map +0 -1
  160. package/dist/_chunks/Relations-HKmXF7eO.mjs.map +0 -1
  161. package/dist/_chunks/index-CB1AN26E.mjs.map +0 -1
  162. package/dist/_chunks/index-jDJgW_Lf.js.map +0 -1
  163. package/dist/_chunks/relations-B5Jnw32V.mjs.map +0 -1
  164. package/dist/_chunks/relations-C10QoukP.js.map +0 -1
  165. package/strapi-server.js +0 -3
@@ -4,6 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const strapiAdmin = require("@strapi/admin/strapi-admin");
5
5
  const React = require("react");
6
6
  const designSystem = require("@strapi/design-system");
7
+ const mapValues = require("lodash/fp/mapValues");
7
8
  const reactIntl = require("react-intl");
8
9
  const reactRouterDom = require("react-router-dom");
9
10
  const yup = require("yup");
@@ -32,6 +33,7 @@ function _interopNamespace(e) {
32
33
  return Object.freeze(n);
33
34
  }
34
35
  const React__namespace = /* @__PURE__ */ _interopNamespace(React);
36
+ const mapValues__default = /* @__PURE__ */ _interopDefault(mapValues);
35
37
  const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
36
38
  const pipe__default = /* @__PURE__ */ _interopDefault(pipe);
37
39
  const __variableDynamicImportRuntimeHelper = (glob, path) => {
@@ -121,6 +123,7 @@ const DocumentRBAC = ({ children, permissions }) => {
121
123
  if (!slug) {
122
124
  throw new Error("Cannot find the slug param in the URL");
123
125
  }
126
+ const [{ rawQuery }] = strapiAdmin.useQueryParams();
124
127
  const userPermissions = strapiAdmin.useAuth("DocumentRBAC", (state) => state.permissions);
125
128
  const contentTypePermissions = React__namespace.useMemo(() => {
126
129
  const contentTypePermissions2 = userPermissions.filter(
@@ -131,7 +134,14 @@ const DocumentRBAC = ({ children, permissions }) => {
131
134
  return { ...acc, [action]: [permission] };
132
135
  }, {});
133
136
  }, [slug, userPermissions]);
134
- const { isLoading, allowedActions } = strapiAdmin.useRBAC(contentTypePermissions, permissions ?? void 0);
137
+ const { isLoading, allowedActions } = strapiAdmin.useRBAC(
138
+ contentTypePermissions,
139
+ permissions ?? void 0,
140
+ // TODO: useRBAC context should be typed and built differently
141
+ // We are passing raw query as context to the hook so that it can
142
+ // rely on the locale provided from DocumentRBAC for its permission calculations.
143
+ rawQuery
144
+ );
135
145
  const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
136
146
  const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
137
147
  const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
@@ -482,6 +492,24 @@ const buildValidParams = (query) => {
482
492
  const isBaseQueryError = (error) => {
483
493
  return error.name !== void 0;
484
494
  };
495
+ const arrayValidator = (attribute, options) => ({
496
+ message: strapiAdmin.translatedErrors.required,
497
+ test(value) {
498
+ if (options.status === "draft") {
499
+ return true;
500
+ }
501
+ if (!attribute.required) {
502
+ return true;
503
+ }
504
+ if (!value) {
505
+ return false;
506
+ }
507
+ if (Array.isArray(value) && value.length === 0) {
508
+ return false;
509
+ }
510
+ return true;
511
+ }
512
+ });
485
513
  const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
486
514
  const createModelSchema = (attributes2) => yup__namespace.object().shape(
487
515
  Object.entries(attributes2).reduce((acc, [name, attribute]) => {
@@ -489,6 +517,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
489
517
  return acc;
490
518
  }
491
519
  const validations = [
520
+ addNullableValidation,
492
521
  addRequiredValidation,
493
522
  addMinLengthValidation,
494
523
  addMaxLengthValidation,
@@ -505,12 +534,12 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
505
534
  ...acc,
506
535
  [name]: transformSchema(
507
536
  yup__namespace.array().of(createModelSchema(attributes3).nullable(false))
508
- )
537
+ ).test(arrayValidator(attribute, options))
509
538
  };
510
539
  } else {
511
540
  return {
512
541
  ...acc,
513
- [name]: transformSchema(createModelSchema(attributes3))
542
+ [name]: transformSchema(createModelSchema(attributes3).nullable())
514
543
  };
515
544
  }
516
545
  }
@@ -532,7 +561,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
532
561
  }
533
562
  )
534
563
  )
535
- )
564
+ ).test(arrayValidator(attribute, options))
536
565
  };
537
566
  case "relation":
538
567
  return {
@@ -544,7 +573,7 @@ const createYupSchema = (attributes = {}, components = {}, options = { status: n
544
573
  } else if (Array.isArray(value)) {
545
574
  return yup__namespace.array().of(
546
575
  yup__namespace.object().shape({
547
- id: yup__namespace.string().required()
576
+ id: yup__namespace.number().required()
548
577
  })
549
578
  );
550
579
  } else if (typeof value === "object") {
@@ -630,17 +659,17 @@ const nullableSchema = (schema) => {
630
659
  schema
631
660
  );
632
661
  };
662
+ const addNullableValidation = () => (schema) => {
663
+ return nullableSchema(schema);
664
+ };
633
665
  const addRequiredValidation = (attribute, options) => (schema) => {
634
- if (options.status === "draft") {
635
- return nullableSchema(schema);
636
- }
637
- if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
638
- return schema.min(1, strapiAdmin.translatedErrors.required);
666
+ if (options.status === "draft" || !attribute.required) {
667
+ return schema;
639
668
  }
640
- if (attribute.required && attribute.type !== "relation") {
669
+ if (attribute.required && "required" in schema) {
641
670
  return schema.required(strapiAdmin.translatedErrors.required);
642
671
  }
643
- return nullableSchema(schema);
672
+ return schema;
644
673
  };
645
674
  const addMinLengthValidation = (attribute, options) => (schema) => {
646
675
  if (options.status === "draft") {
@@ -668,31 +697,12 @@ const addMaxLengthValidation = (attribute) => (schema) => {
668
697
  return schema;
669
698
  };
670
699
  const addMinValidation = (attribute, options) => (schema) => {
671
- if ("min" in attribute) {
700
+ if (options.status === "draft") {
701
+ return schema;
702
+ }
703
+ if ("min" in attribute && "min" in schema) {
672
704
  const min = toInteger(attribute.min);
673
- if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
674
- if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
675
- return schema.test(
676
- "custom-min",
677
- {
678
- ...strapiAdmin.translatedErrors.min,
679
- values: {
680
- min: attribute.min
681
- }
682
- },
683
- (value) => {
684
- if (!value) {
685
- return true;
686
- }
687
- if (Array.isArray(value) && value.length === 0) {
688
- return true;
689
- }
690
- return value.length >= min;
691
- }
692
- );
693
- }
694
- }
695
- if ("min" in schema && min) {
705
+ if (min) {
696
706
  return schema.min(min, {
697
707
  ...strapiAdmin.translatedErrors.min,
698
708
  values: {
@@ -810,19 +820,115 @@ const extractContentTypeComponents = (attributes = {}, allComponents = {}) => {
810
820
  }, {});
811
821
  return componentsByKey;
812
822
  };
813
- const useDocument = (args, opts) => {
823
+ const HOOKS = {
824
+ /**
825
+ * Hook that allows to mutate the displayed headers of the list view table
826
+ * @constant
827
+ * @type {string}
828
+ */
829
+ INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
830
+ /**
831
+ * Hook that allows to mutate the CM's collection types links pre-set filters
832
+ * @constant
833
+ * @type {string}
834
+ */
835
+ MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
836
+ /**
837
+ * Hook that allows to mutate the CM's edit view layout
838
+ * @constant
839
+ * @type {string}
840
+ */
841
+ MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
842
+ /**
843
+ * Hook that allows to mutate the CM's single types links pre-set filters
844
+ * @constant
845
+ * @type {string}
846
+ */
847
+ MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
848
+ };
849
+ const contentTypesApi = contentManagerApi.injectEndpoints({
850
+ endpoints: (builder) => ({
851
+ getContentTypeConfiguration: builder.query({
852
+ query: (uid) => ({
853
+ url: `/content-manager/content-types/${uid}/configuration`,
854
+ method: "GET"
855
+ }),
856
+ transformResponse: (response) => response.data,
857
+ providesTags: (_result, _error, uid) => [
858
+ { type: "ContentTypesConfiguration", id: uid },
859
+ { type: "ContentTypeSettings", id: "LIST" }
860
+ ]
861
+ }),
862
+ getAllContentTypeSettings: builder.query({
863
+ query: () => "/content-manager/content-types-settings",
864
+ transformResponse: (response) => response.data,
865
+ providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
866
+ }),
867
+ updateContentTypeConfiguration: builder.mutation({
868
+ query: ({ uid, ...body }) => ({
869
+ url: `/content-manager/content-types/${uid}/configuration`,
870
+ method: "PUT",
871
+ data: body
872
+ }),
873
+ transformResponse: (response) => response.data,
874
+ invalidatesTags: (_result, _error, { uid }) => [
875
+ { type: "ContentTypesConfiguration", id: uid },
876
+ { type: "ContentTypeSettings", id: "LIST" },
877
+ // Is this necessary?
878
+ { type: "InitialData" }
879
+ ]
880
+ })
881
+ })
882
+ });
883
+ const {
884
+ useGetContentTypeConfigurationQuery,
885
+ useGetAllContentTypeSettingsQuery,
886
+ useUpdateContentTypeConfigurationMutation
887
+ } = contentTypesApi;
888
+ const checkIfAttributeIsDisplayable = (attribute) => {
889
+ const { type } = attribute;
890
+ if (type === "relation") {
891
+ return !attribute.relation.toLowerCase().includes("morph");
892
+ }
893
+ return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
894
+ };
895
+ const getMainField = (attribute, mainFieldName, { schemas, components }) => {
896
+ if (!mainFieldName) {
897
+ return void 0;
898
+ }
899
+ const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
900
+ // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
901
+ schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
902
+ );
903
+ return {
904
+ name: mainFieldName,
905
+ type: mainFieldType ?? "string"
906
+ };
907
+ };
908
+ const DEFAULT_SETTINGS = {
909
+ bulkable: false,
910
+ filterable: false,
911
+ searchable: false,
912
+ pagination: false,
913
+ defaultSortBy: "",
914
+ defaultSortOrder: "asc",
915
+ mainField: "id",
916
+ pageSize: 10
917
+ };
918
+ const useDocumentLayout = (model) => {
919
+ const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
920
+ const [{ query }] = strapiAdmin.useQueryParams();
921
+ const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
814
922
  const { toggleNotification } = strapiAdmin.useNotification();
815
923
  const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
924
+ const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
816
925
  const {
817
- currentData: data,
818
- isLoading: isLoadingDocument,
819
- isFetching: isFetchingDocument,
820
- error
821
- } = useGetDocumentQuery(args, {
822
- ...opts,
823
- skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
824
- });
825
- const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
926
+ data,
927
+ isLoading: isLoadingConfigs,
928
+ error,
929
+ isFetching: isFetchingConfigs
930
+ } = useGetContentTypeConfigurationQuery(model);
931
+ const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
826
932
  React__namespace.useEffect(() => {
827
933
  if (error) {
828
934
  toggleNotification({
@@ -830,100 +936,355 @@ const useDocument = (args, opts) => {
830
936
  message: formatAPIError(error)
831
937
  });
832
938
  }
833
- }, [toggleNotification, error, formatAPIError, args.collectionType]);
834
- const validationSchema = React__namespace.useMemo(() => {
835
- if (!schema) {
836
- return null;
837
- }
838
- return createYupSchema(schema.attributes, components);
839
- }, [schema, components]);
840
- const validate = React__namespace.useCallback(
841
- (document) => {
842
- if (!validationSchema) {
843
- throw new Error(
844
- "There is no validation schema generated, this is likely due to the schema not being loaded yet."
845
- );
846
- }
847
- try {
848
- validationSchema.validateSync(document, { abortEarly: false, strict: true });
849
- return null;
850
- } catch (error2) {
851
- if (error2 instanceof yup.ValidationError) {
852
- return strapiAdmin.getYupValidationErrors(error2);
853
- }
854
- throw error2;
855
- }
939
+ }, [error, formatAPIError, toggleNotification]);
940
+ const editLayout = React__namespace.useMemo(
941
+ () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
942
+ layout: [],
943
+ components: {},
944
+ metadatas: {},
945
+ options: {},
946
+ settings: DEFAULT_SETTINGS
856
947
  },
857
- [validationSchema]
948
+ [data, isLoading, schemas, schema, components]
949
+ );
950
+ const listLayout = React__namespace.useMemo(() => {
951
+ return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
952
+ layout: [],
953
+ metadatas: {},
954
+ options: {},
955
+ settings: DEFAULT_SETTINGS
956
+ };
957
+ }, [data, isLoading, schemas, schema, components]);
958
+ const { layout: edit } = React__namespace.useMemo(
959
+ () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
960
+ layout: editLayout,
961
+ query
962
+ }),
963
+ [editLayout, query, runHookWaterfall]
858
964
  );
859
- const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
860
965
  return {
861
- components,
862
- document: data?.data,
863
- meta: data?.meta,
966
+ error,
864
967
  isLoading,
865
- schema,
866
- validate
867
- };
868
- };
869
- const useDoc = () => {
870
- const { id, slug, collectionType, origin } = reactRouterDom.useParams();
871
- const [{ query }] = strapiAdmin.useQueryParams();
872
- const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
873
- if (!collectionType) {
874
- throw new Error("Could not find collectionType in url params");
875
- }
876
- if (!slug) {
877
- throw new Error("Could not find model in url params");
878
- }
879
- return {
880
- collectionType,
881
- model: slug,
882
- id: origin || id === "create" ? void 0 : id,
883
- ...useDocument(
884
- { documentId: origin || id, model: slug, collectionType, params },
885
- {
886
- skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
887
- }
888
- )
968
+ edit,
969
+ list: listLayout
889
970
  };
890
971
  };
891
- const prefixPluginTranslations = (trad, pluginId) => {
892
- if (!pluginId) {
893
- throw new TypeError("pluginId can't be empty");
894
- }
895
- return Object.keys(trad).reduce((acc, current) => {
896
- acc[`${pluginId}.${current}`] = trad[current];
897
- return acc;
898
- }, {});
899
- };
900
- const getTranslation = (id) => `content-manager.${id}`;
901
- const DEFAULT_UNEXPECTED_ERROR_MSG = {
902
- id: "notification.error",
903
- defaultMessage: "An error occurred, please try again"
972
+ const useDocLayout = () => {
973
+ const { model } = useDoc();
974
+ return useDocumentLayout(model);
904
975
  };
905
- const useDocumentActions = () => {
906
- const { toggleNotification } = strapiAdmin.useNotification();
907
- const { formatMessage } = reactIntl.useIntl();
908
- const { trackUsage } = strapiAdmin.useTracking();
909
- const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
910
- const navigate = reactRouterDom.useNavigate();
911
- const [deleteDocument] = useDeleteDocumentMutation();
912
- const _delete = React__namespace.useCallback(
913
- async ({ collectionType, model, documentId, params }, trackerProperty) => {
914
- try {
915
- trackUsage("willDeleteEntry", trackerProperty);
916
- const res = await deleteDocument({
917
- collectionType,
918
- model,
919
- documentId,
920
- params
921
- });
922
- if ("error" in res) {
923
- toggleNotification({
924
- type: "danger",
925
- message: formatAPIError(res.error)
926
- });
976
+ const formatEditLayout = (data, {
977
+ schemas,
978
+ schema,
979
+ components
980
+ }) => {
981
+ let currentPanelIndex = 0;
982
+ const panelledEditAttributes = convertEditLayoutToFieldLayouts(
983
+ data.contentType.layouts.edit,
984
+ schema?.attributes,
985
+ data.contentType.metadatas,
986
+ { configurations: data.components, schemas: components },
987
+ schemas
988
+ ).reduce((panels, row) => {
989
+ if (row.some((field) => field.type === "dynamiczone")) {
990
+ panels.push([row]);
991
+ currentPanelIndex += 2;
992
+ } else {
993
+ if (!panels[currentPanelIndex]) {
994
+ panels.push([row]);
995
+ } else {
996
+ panels[currentPanelIndex].push(row);
997
+ }
998
+ }
999
+ return panels;
1000
+ }, []);
1001
+ const componentEditAttributes = Object.entries(data.components).reduce(
1002
+ (acc, [uid, configuration]) => {
1003
+ acc[uid] = {
1004
+ layout: convertEditLayoutToFieldLayouts(
1005
+ configuration.layouts.edit,
1006
+ components[uid].attributes,
1007
+ configuration.metadatas,
1008
+ { configurations: data.components, schemas: components }
1009
+ ),
1010
+ settings: {
1011
+ ...configuration.settings,
1012
+ icon: components[uid].info.icon,
1013
+ displayName: components[uid].info.displayName
1014
+ }
1015
+ };
1016
+ return acc;
1017
+ },
1018
+ {}
1019
+ );
1020
+ const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
1021
+ (acc, [attribute, metadata]) => {
1022
+ return {
1023
+ ...acc,
1024
+ [attribute]: metadata.edit
1025
+ };
1026
+ },
1027
+ {}
1028
+ );
1029
+ return {
1030
+ layout: panelledEditAttributes,
1031
+ components: componentEditAttributes,
1032
+ metadatas: editMetadatas,
1033
+ settings: {
1034
+ ...data.contentType.settings,
1035
+ displayName: schema?.info.displayName
1036
+ },
1037
+ options: {
1038
+ ...schema?.options,
1039
+ ...schema?.pluginOptions,
1040
+ ...data.contentType.options
1041
+ }
1042
+ };
1043
+ };
1044
+ const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
1045
+ return rows.map(
1046
+ (row) => row.map((field) => {
1047
+ const attribute = attributes[field.name];
1048
+ if (!attribute) {
1049
+ return null;
1050
+ }
1051
+ const { edit: metadata } = metadatas[field.name];
1052
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
1053
+ return {
1054
+ attribute,
1055
+ disabled: !metadata.editable,
1056
+ hint: metadata.description,
1057
+ label: metadata.label ?? "",
1058
+ name: field.name,
1059
+ // @ts-expect-error – mainField does exist on the metadata for a relation.
1060
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
1061
+ schemas,
1062
+ components: components?.schemas ?? {}
1063
+ }),
1064
+ placeholder: metadata.placeholder ?? "",
1065
+ required: attribute.required ?? false,
1066
+ size: field.size,
1067
+ unique: "unique" in attribute ? attribute.unique : false,
1068
+ visible: metadata.visible ?? true,
1069
+ type: attribute.type
1070
+ };
1071
+ }).filter((field) => field !== null)
1072
+ );
1073
+ };
1074
+ const formatListLayout = (data, {
1075
+ schemas,
1076
+ schema,
1077
+ components
1078
+ }) => {
1079
+ const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
1080
+ (acc, [attribute, metadata]) => {
1081
+ return {
1082
+ ...acc,
1083
+ [attribute]: metadata.list
1084
+ };
1085
+ },
1086
+ {}
1087
+ );
1088
+ const listAttributes = convertListLayoutToFieldLayouts(
1089
+ data.contentType.layouts.list,
1090
+ schema?.attributes,
1091
+ listMetadatas,
1092
+ { configurations: data.components, schemas: components },
1093
+ schemas
1094
+ );
1095
+ return {
1096
+ layout: listAttributes,
1097
+ settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
1098
+ metadatas: listMetadatas,
1099
+ options: {
1100
+ ...schema?.options,
1101
+ ...schema?.pluginOptions,
1102
+ ...data.contentType.options
1103
+ }
1104
+ };
1105
+ };
1106
+ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
1107
+ return columns.map((name) => {
1108
+ const attribute = attributes[name];
1109
+ if (!attribute) {
1110
+ return null;
1111
+ }
1112
+ const metadata = metadatas[name];
1113
+ const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
1114
+ return {
1115
+ attribute,
1116
+ label: metadata.label ?? "",
1117
+ mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
1118
+ schemas,
1119
+ components: components?.schemas ?? {}
1120
+ }),
1121
+ name,
1122
+ searchable: metadata.searchable ?? true,
1123
+ sortable: metadata.sortable ?? true
1124
+ };
1125
+ }).filter((field) => field !== null);
1126
+ };
1127
+ const useDocument = (args, opts) => {
1128
+ const { toggleNotification } = strapiAdmin.useNotification();
1129
+ const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
1130
+ const {
1131
+ currentData: data,
1132
+ isLoading: isLoadingDocument,
1133
+ isFetching: isFetchingDocument,
1134
+ error
1135
+ } = useGetDocumentQuery(args, {
1136
+ ...opts,
1137
+ skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
1138
+ });
1139
+ const {
1140
+ components,
1141
+ schema,
1142
+ schemas,
1143
+ isLoading: isLoadingSchema
1144
+ } = useContentTypeSchema(args.model);
1145
+ React__namespace.useEffect(() => {
1146
+ if (error) {
1147
+ toggleNotification({
1148
+ type: "danger",
1149
+ message: formatAPIError(error)
1150
+ });
1151
+ }
1152
+ }, [toggleNotification, error, formatAPIError, args.collectionType]);
1153
+ const validationSchema = React__namespace.useMemo(() => {
1154
+ if (!schema) {
1155
+ return null;
1156
+ }
1157
+ return createYupSchema(schema.attributes, components);
1158
+ }, [schema, components]);
1159
+ const validate = React__namespace.useCallback(
1160
+ (document) => {
1161
+ if (!validationSchema) {
1162
+ throw new Error(
1163
+ "There is no validation schema generated, this is likely due to the schema not being loaded yet."
1164
+ );
1165
+ }
1166
+ try {
1167
+ validationSchema.validateSync(document, { abortEarly: false, strict: true });
1168
+ return null;
1169
+ } catch (error2) {
1170
+ if (error2 instanceof yup.ValidationError) {
1171
+ return strapiAdmin.getYupValidationErrors(error2);
1172
+ }
1173
+ throw error2;
1174
+ }
1175
+ },
1176
+ [validationSchema]
1177
+ );
1178
+ const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
1179
+ const hasError = !!error;
1180
+ return {
1181
+ components,
1182
+ document: data?.data,
1183
+ meta: data?.meta,
1184
+ isLoading,
1185
+ hasError,
1186
+ schema,
1187
+ schemas,
1188
+ validate
1189
+ };
1190
+ };
1191
+ const useDoc = () => {
1192
+ const { id, slug, collectionType, origin } = reactRouterDom.useParams();
1193
+ const [{ query }] = strapiAdmin.useQueryParams();
1194
+ const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
1195
+ if (!collectionType) {
1196
+ throw new Error("Could not find collectionType in url params");
1197
+ }
1198
+ if (!slug) {
1199
+ throw new Error("Could not find model in url params");
1200
+ }
1201
+ const document = useDocument(
1202
+ { documentId: origin || id, model: slug, collectionType, params },
1203
+ {
1204
+ skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
1205
+ }
1206
+ );
1207
+ const returnId = origin || id === "create" ? void 0 : id;
1208
+ return {
1209
+ collectionType,
1210
+ model: slug,
1211
+ id: returnId,
1212
+ ...document
1213
+ };
1214
+ };
1215
+ const useContentManagerContext = () => {
1216
+ const {
1217
+ collectionType,
1218
+ model,
1219
+ id,
1220
+ components,
1221
+ isLoading: isLoadingDoc,
1222
+ schema,
1223
+ schemas
1224
+ } = useDoc();
1225
+ const layout = useDocumentLayout(model);
1226
+ const form = strapiAdmin.useForm("useContentManagerContext", (state) => state);
1227
+ const isSingleType = collectionType === SINGLE_TYPES;
1228
+ const slug = model;
1229
+ const isCreatingEntry = id === "create";
1230
+ useContentTypeSchema();
1231
+ const isLoading = isLoadingDoc || layout.isLoading;
1232
+ const error = layout.error;
1233
+ return {
1234
+ error,
1235
+ isLoading,
1236
+ // Base metadata
1237
+ model,
1238
+ collectionType,
1239
+ id,
1240
+ slug,
1241
+ isCreatingEntry,
1242
+ isSingleType,
1243
+ hasDraftAndPublish: schema?.options?.draftAndPublish ?? false,
1244
+ // All schema infos
1245
+ components,
1246
+ contentType: schema,
1247
+ contentTypes: schemas,
1248
+ // Form state
1249
+ form,
1250
+ // layout infos
1251
+ layout
1252
+ };
1253
+ };
1254
+ const prefixPluginTranslations = (trad, pluginId) => {
1255
+ return Object.keys(trad).reduce((acc, current) => {
1256
+ acc[`${pluginId}.${current}`] = trad[current];
1257
+ return acc;
1258
+ }, {});
1259
+ };
1260
+ const getTranslation = (id) => `content-manager.${id}`;
1261
+ const DEFAULT_UNEXPECTED_ERROR_MSG = {
1262
+ id: "notification.error",
1263
+ defaultMessage: "An error occurred, please try again"
1264
+ };
1265
+ const useDocumentActions = () => {
1266
+ const { toggleNotification } = strapiAdmin.useNotification();
1267
+ const { formatMessage } = reactIntl.useIntl();
1268
+ const { trackUsage } = strapiAdmin.useTracking();
1269
+ const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
1270
+ const navigate = reactRouterDom.useNavigate();
1271
+ const setCurrentStep = strapiAdmin.useGuidedTour("useDocumentActions", (state) => state.setCurrentStep);
1272
+ const [deleteDocument] = useDeleteDocumentMutation();
1273
+ const _delete = React__namespace.useCallback(
1274
+ async ({ collectionType, model, documentId, params }, trackerProperty) => {
1275
+ try {
1276
+ trackUsage("willDeleteEntry", trackerProperty);
1277
+ const res = await deleteDocument({
1278
+ collectionType,
1279
+ model,
1280
+ documentId,
1281
+ params
1282
+ });
1283
+ if ("error" in res) {
1284
+ toggleNotification({
1285
+ type: "danger",
1286
+ message: formatAPIError(res.error)
1287
+ });
927
1288
  return { error: res.error };
928
1289
  }
929
1290
  toggleNotification({
@@ -1222,6 +1583,7 @@ const useDocumentActions = () => {
1222
1583
  defaultMessage: "Saved document"
1223
1584
  })
1224
1585
  });
1586
+ setCurrentStep("contentManager.success");
1225
1587
  return res.data;
1226
1588
  } catch (err) {
1227
1589
  toggleNotification({
@@ -1323,10 +1685,10 @@ const useDocumentActions = () => {
1323
1685
  update
1324
1686
  };
1325
1687
  };
1326
- const ProtectedHistoryPage = React.lazy(
1327
- () => Promise.resolve().then(() => require("./History-guuZF4lR.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1688
+ const ProtectedHistoryPage = React__namespace.lazy(
1689
+ () => Promise.resolve().then(() => require("./History-40apIShV.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
1328
1690
  );
1329
- const routes$1 = [
1691
+ const routes$2 = [
1330
1692
  {
1331
1693
  path: ":collectionType/:slug/:id/history",
1332
1694
  Component: ProtectedHistoryPage
@@ -1336,32 +1698,45 @@ const routes$1 = [
1336
1698
  Component: ProtectedHistoryPage
1337
1699
  }
1338
1700
  ];
1701
+ const ProtectedPreviewPage = React__namespace.lazy(
1702
+ () => Promise.resolve().then(() => require("./Preview-V8XOfrQf.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
1703
+ );
1704
+ const routes$1 = [
1705
+ {
1706
+ path: ":collectionType/:slug/:id/preview",
1707
+ Component: ProtectedPreviewPage
1708
+ },
1709
+ {
1710
+ path: ":collectionType/:slug/preview",
1711
+ Component: ProtectedPreviewPage
1712
+ }
1713
+ ];
1339
1714
  const ProtectedEditViewPage = React.lazy(
1340
- () => Promise.resolve().then(() => require("./EditViewPage-D9xH8HYD.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1715
+ () => Promise.resolve().then(() => require("./EditViewPage-BUtpHsMz.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
1341
1716
  );
1342
1717
  const ProtectedListViewPage = React.lazy(
1343
- () => Promise.resolve().then(() => require("./ListViewPage-DWqqGno8.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1718
+ () => Promise.resolve().then(() => require("./ListViewPage-CjaHQ2_V.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
1344
1719
  );
1345
1720
  const ProtectedListConfiguration = React.lazy(
1346
- () => Promise.resolve().then(() => require("./ListConfigurationPage-Cu26t5sE.js")).then((mod) => ({
1721
+ () => Promise.resolve().then(() => require("./ListConfigurationPage-DAGbWDIL.js")).then((mod) => ({
1347
1722
  default: mod.ProtectedListConfiguration
1348
1723
  }))
1349
1724
  );
1350
1725
  const ProtectedEditConfigurationPage = React.lazy(
1351
- () => Promise.resolve().then(() => require("./EditConfigurationPage-BPoOzhCM.js")).then((mod) => ({
1726
+ () => Promise.resolve().then(() => require("./EditConfigurationPage-BG7rpPjL.js")).then((mod) => ({
1352
1727
  default: mod.ProtectedEditConfigurationPage
1353
1728
  }))
1354
1729
  );
1355
1730
  const ProtectedComponentConfigurationPage = React.lazy(
1356
- () => Promise.resolve().then(() => require("./ComponentConfigurationPage-BlAzljQ6.js")).then((mod) => ({
1731
+ () => Promise.resolve().then(() => require("./ComponentConfigurationPage-Br8hp2Xt.js")).then((mod) => ({
1357
1732
  default: mod.ProtectedComponentConfigurationPage
1358
1733
  }))
1359
1734
  );
1360
1735
  const NoPermissions = React.lazy(
1361
- () => Promise.resolve().then(() => require("./NoPermissionsPage-D8_k39Q0.js")).then((mod) => ({ default: mod.NoPermissions }))
1736
+ () => Promise.resolve().then(() => require("./NoPermissionsPage-CY3_QduF.js")).then((mod) => ({ default: mod.NoPermissions }))
1362
1737
  );
1363
1738
  const NoContentType = React.lazy(
1364
- () => Promise.resolve().then(() => require("./NoContentTypePage-TTkwA8uk.js")).then((mod) => ({ default: mod.NoContentType }))
1739
+ () => Promise.resolve().then(() => require("./NoContentTypePage-CGxqLI8j.js")).then((mod) => ({ default: mod.NoContentType }))
1365
1740
  );
1366
1741
  const CollectionTypePages = () => {
1367
1742
  const { collectionType } = reactRouterDom.useParams();
@@ -1407,6 +1782,7 @@ const routes = [
1407
1782
  path: "no-content-types",
1408
1783
  Component: NoContentType
1409
1784
  },
1785
+ ...routes$2,
1410
1786
  ...routes$1
1411
1787
  ];
1412
1788
  const DocumentActions = ({ actions: actions2 }) => {
@@ -1560,7 +1936,7 @@ const DocumentActionsMenu = ({
1560
1936
  ]
1561
1937
  }
1562
1938
  ),
1563
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { top: "4px", maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1939
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1564
1940
  actions2.map((action) => {
1565
1941
  return /* @__PURE__ */ jsxRuntime.jsx(
1566
1942
  designSystem.Menu.Item,
@@ -1715,6 +2091,18 @@ const DocumentActionModal = ({
1715
2091
  typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
1716
2092
  ] }) });
1717
2093
  };
2094
+ const transformData = (data) => {
2095
+ if (Array.isArray(data)) {
2096
+ return data.map(transformData);
2097
+ }
2098
+ if (typeof data === "object" && data !== null) {
2099
+ if ("apiData" in data) {
2100
+ return data.apiData;
2101
+ }
2102
+ return mapValues__default.default(transformData)(data);
2103
+ }
2104
+ return data;
2105
+ };
1718
2106
  const PublishAction$1 = ({
1719
2107
  activeTab,
1720
2108
  documentId,
@@ -1808,7 +2196,9 @@ const PublishAction$1 = ({
1808
2196
  const performPublish = async () => {
1809
2197
  setSubmitting(true);
1810
2198
  try {
1811
- const { errors } = await validate();
2199
+ const { errors } = await validate(true, {
2200
+ status: "published"
2201
+ });
1812
2202
  if (errors) {
1813
2203
  toggleNotification({
1814
2204
  type: "danger",
@@ -1826,7 +2216,7 @@ const PublishAction$1 = ({
1826
2216
  documentId,
1827
2217
  params
1828
2218
  },
1829
- formValues
2219
+ transformData(formValues)
1830
2220
  );
1831
2221
  if ("data" in res && collectionType !== SINGLE_TYPES) {
1832
2222
  navigate({
@@ -1922,18 +2312,18 @@ const UpdateAction = ({
1922
2312
  onClick: async () => {
1923
2313
  setSubmitting(true);
1924
2314
  try {
1925
- if (activeTab !== "draft") {
1926
- const { errors } = await validate();
1927
- if (errors) {
1928
- toggleNotification({
1929
- type: "danger",
1930
- message: formatMessage({
1931
- id: "content-manager.validation.error",
1932
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
1933
- })
1934
- });
1935
- return;
1936
- }
2315
+ const { errors } = await validate(true, {
2316
+ status: "draft"
2317
+ });
2318
+ if (errors) {
2319
+ toggleNotification({
2320
+ type: "danger",
2321
+ message: formatMessage({
2322
+ id: "content-manager.validation.error",
2323
+ defaultMessage: "There are validation errors in your document. Please fix them before saving."
2324
+ })
2325
+ });
2326
+ return;
1937
2327
  }
1938
2328
  if (isCloning) {
1939
2329
  const res = await clone(
@@ -1942,7 +2332,7 @@ const UpdateAction = ({
1942
2332
  documentId: cloneMatch.params.origin,
1943
2333
  params
1944
2334
  },
1945
- document
2335
+ transformData(document)
1946
2336
  );
1947
2337
  if ("data" in res) {
1948
2338
  navigate(
@@ -1963,7 +2353,7 @@ const UpdateAction = ({
1963
2353
  documentId,
1964
2354
  params
1965
2355
  },
1966
- document
2356
+ transformData(document)
1967
2357
  );
1968
2358
  if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1969
2359
  setErrors(formatValidationErrors(res.error));
@@ -1976,7 +2366,7 @@ const UpdateAction = ({
1976
2366
  model,
1977
2367
  params
1978
2368
  },
1979
- document
2369
+ transformData(document)
1980
2370
  );
1981
2371
  if ("data" in res && collectionType !== SINGLE_TYPES) {
1982
2372
  navigate(
@@ -2217,7 +2607,11 @@ const getDisplayName = ({
2217
2607
  const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
2218
2608
  const DocumentStatus = ({ status = "draft", ...restProps }) => {
2219
2609
  const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
2220
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
2610
+ const { formatMessage } = reactIntl.useIntl();
2611
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
2612
+ id: `content-manager.containers.List.${status}`,
2613
+ defaultMessage: capitalise(status)
2614
+ }) }) });
2221
2615
  };
2222
2616
  const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2223
2617
  const { formatMessage } = reactIntl.useIntl();
@@ -2315,12 +2709,12 @@ const Information = ({ activeTab }) => {
2315
2709
  isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
2316
2710
  label: formatMessage({
2317
2711
  id: "content-manager.containers.edit.information.last-published.label",
2318
- defaultMessage: "Last published"
2712
+ defaultMessage: "Published"
2319
2713
  }),
2320
2714
  value: formatMessage(
2321
2715
  {
2322
2716
  id: "content-manager.containers.edit.information.last-published.value",
2323
- defaultMessage: `Published {time}{isAnonymous, select, true {} other { by {author}}}`
2717
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2324
2718
  },
2325
2719
  {
2326
2720
  time: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
@@ -2333,12 +2727,12 @@ const Information = ({ activeTab }) => {
2333
2727
  isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
2334
2728
  label: formatMessage({
2335
2729
  id: "content-manager.containers.edit.information.last-draft.label",
2336
- defaultMessage: "Last draft"
2730
+ defaultMessage: "Updated"
2337
2731
  }),
2338
2732
  value: formatMessage(
2339
2733
  {
2340
2734
  id: "content-manager.containers.edit.information.last-draft.value",
2341
- defaultMessage: `Modified {time}{isAnonymous, select, true {} other { by {author}}}`
2735
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2342
2736
  },
2343
2737
  {
2344
2738
  time: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2356,12 +2750,12 @@ const Information = ({ activeTab }) => {
2356
2750
  isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
2357
2751
  label: formatMessage({
2358
2752
  id: "content-manager.containers.edit.information.document.label",
2359
- defaultMessage: "Document"
2753
+ defaultMessage: "Created"
2360
2754
  }),
2361
2755
  value: formatMessage(
2362
2756
  {
2363
2757
  id: "content-manager.containers.edit.information.document.value",
2364
- defaultMessage: `Created {time}{isAnonymous, select, true {} other { by {author}}}`
2758
+ defaultMessage: `{time}{isAnonymous, select, true {} other { by {author}}}`
2365
2759
  },
2366
2760
  {
2367
2761
  time: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2419,10 +2813,9 @@ const HeaderActions = ({ actions: actions2 }) => {
2419
2813
  designSystem.SingleSelect,
2420
2814
  {
2421
2815
  size: "S",
2422
- disabled: action.disabled,
2423
- "aria-label": action.label,
2424
2816
  onChange: action.onSelect,
2425
- value: action.value,
2817
+ "aria-label": action.label,
2818
+ ...action,
2426
2819
  children: action.options.map(({ label, ...option }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { ...option, children: label }, option.value))
2427
2820
  },
2428
2821
  action.id
@@ -2452,524 +2845,225 @@ const HeaderActions = ({ actions: actions2 }) => {
2452
2845
  }
2453
2846
  }
2454
2847
  }) });
2455
- };
2456
- const HeaderActionDialog = ({
2457
- onClose,
2458
- onCancel,
2459
- title,
2460
- content: Content,
2461
- isOpen
2462
- }) => {
2463
- const handleClose = async () => {
2464
- if (onCancel) {
2465
- await onCancel();
2466
- }
2467
- onClose();
2468
- };
2469
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
2470
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
2471
- typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : Content
2472
- ] }) });
2473
- };
2474
- const ConfigureTheViewAction = ({ collectionType, model }) => {
2475
- const navigate = reactRouterDom.useNavigate();
2476
- const { formatMessage } = reactIntl.useIntl();
2477
- return {
2478
- label: formatMessage({
2479
- id: "app.links.configure-view",
2480
- defaultMessage: "Configure the view"
2481
- }),
2482
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ListPlus, {}),
2483
- onClick: () => {
2484
- navigate(`../${collectionType}/${model}/configurations/edit`);
2485
- },
2486
- position: "header"
2487
- };
2488
- };
2489
- ConfigureTheViewAction.type = "configure-the-view";
2490
- const EditTheModelAction = ({ model }) => {
2491
- const navigate = reactRouterDom.useNavigate();
2492
- const { formatMessage } = reactIntl.useIntl();
2493
- return {
2494
- label: formatMessage({
2495
- id: "content-manager.link-to-ctb",
2496
- defaultMessage: "Edit the model"
2497
- }),
2498
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, {}),
2499
- onClick: () => {
2500
- navigate(`/plugins/content-type-builder/content-types/${model}`);
2501
- },
2502
- position: "header"
2503
- };
2504
- };
2505
- EditTheModelAction.type = "edit-the-model";
2506
- const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2507
- const navigate = reactRouterDom.useNavigate();
2508
- const { formatMessage } = reactIntl.useIntl();
2509
- const listViewPathMatch = reactRouterDom.useMatch(LIST_PATH);
2510
- const canDelete = useDocumentRBAC("DeleteAction", (state) => state.canDelete);
2511
- const { delete: deleteAction } = useDocumentActions();
2512
- const { toggleNotification } = strapiAdmin.useNotification();
2513
- const setSubmitting = strapiAdmin.useForm("DeleteAction", (state) => state.setSubmitting);
2514
- return {
2515
- disabled: !canDelete || !document,
2516
- label: formatMessage({
2517
- id: "content-manager.actions.delete.label",
2518
- defaultMessage: "Delete document"
2519
- }),
2520
- icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}),
2521
- dialog: {
2522
- type: "dialog",
2523
- title: formatMessage({
2524
- id: "app.components.ConfirmDialog.title",
2525
- defaultMessage: "Confirmation"
2526
- }),
2527
- content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
2528
- /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
2529
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", variant: "omega", textAlign: "center", children: formatMessage({
2530
- id: "content-manager.actions.delete.dialog.body",
2531
- defaultMessage: "Are you sure?"
2532
- }) })
2533
- ] }),
2534
- onConfirm: async () => {
2535
- if (!listViewPathMatch) {
2536
- setSubmitting(true);
2537
- }
2538
- try {
2539
- if (!documentId && collectionType !== SINGLE_TYPES) {
2540
- console.error(
2541
- "You're trying to delete a document without an id, this is likely a bug with Strapi. Please open an issue."
2542
- );
2543
- toggleNotification({
2544
- message: formatMessage({
2545
- id: "content-manager.actions.delete.error",
2546
- defaultMessage: "An error occurred while trying to delete the document."
2547
- }),
2548
- type: "danger"
2549
- });
2550
- return;
2551
- }
2552
- const res = await deleteAction({
2553
- documentId,
2554
- model,
2555
- collectionType,
2556
- params: {
2557
- locale: "*"
2558
- }
2559
- });
2560
- if (!("error" in res)) {
2561
- navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
2562
- }
2563
- } finally {
2564
- if (!listViewPathMatch) {
2565
- setSubmitting(false);
2566
- }
2567
- }
2568
- }
2569
- },
2570
- variant: "danger",
2571
- position: ["header", "table-row"]
2572
- };
2573
- };
2574
- DeleteAction$1.type = "delete";
2575
- const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2576
- const Panels = () => {
2577
- const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2578
- const [
2579
- {
2580
- query: { status }
2581
- }
2582
- ] = strapiAdmin.useQueryParams({
2583
- status: "draft"
2584
- });
2585
- const { model, id, document, meta, collectionType } = useDoc();
2586
- const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
2587
- const props = {
2588
- activeTab: status,
2589
- model,
2590
- documentId: id,
2591
- document: isCloning ? void 0 : document,
2592
- meta: isCloning ? void 0 : meta,
2593
- collectionType
2594
- };
2595
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
2596
- strapiAdmin.DescriptionComponentRenderer,
2597
- {
2598
- props,
2599
- descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
2600
- children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
2601
- }
2602
- ) });
2603
- };
2604
- const ActionsPanel = () => {
2605
- const { formatMessage } = reactIntl.useIntl();
2606
- return {
2607
- title: formatMessage({
2608
- id: "content-manager.containers.edit.panels.default.title",
2609
- defaultMessage: "Entry"
2610
- }),
2611
- content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
2612
- };
2613
- };
2614
- ActionsPanel.type = "actions";
2615
- const ActionsPanelContent = () => {
2616
- const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2617
- const [
2618
- {
2619
- query: { status = "draft" }
2620
- }
2621
- ] = strapiAdmin.useQueryParams();
2622
- const { model, id, document, meta, collectionType } = useDoc();
2623
- const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
2624
- const props = {
2625
- activeTab: status,
2626
- model,
2627
- documentId: id,
2628
- document: isCloning ? void 0 : document,
2629
- meta: isCloning ? void 0 : meta,
2630
- collectionType
2631
- };
2632
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
2633
- /* @__PURE__ */ jsxRuntime.jsx(
2634
- strapiAdmin.DescriptionComponentRenderer,
2635
- {
2636
- props,
2637
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2638
- children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
2639
- }
2640
- ),
2641
- /* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
2642
- ] });
2643
- };
2644
- const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
2645
- return /* @__PURE__ */ jsxRuntime.jsxs(
2646
- designSystem.Flex,
2647
- {
2648
- ref,
2649
- tag: "aside",
2650
- "aria-labelledby": "additional-information",
2651
- background: "neutral0",
2652
- borderColor: "neutral150",
2653
- hasRadius: true,
2654
- paddingBottom: 4,
2655
- paddingLeft: 4,
2656
- paddingRight: 4,
2657
- paddingTop: 4,
2658
- shadow: "tableShadow",
2659
- gap: 3,
2660
- direction: "column",
2661
- justifyContent: "stretch",
2662
- alignItems: "flex-start",
2663
- children: [
2664
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
2665
- children
2666
- ]
2848
+ };
2849
+ const HeaderActionDialog = ({
2850
+ onClose,
2851
+ onCancel,
2852
+ title,
2853
+ content: Content,
2854
+ isOpen
2855
+ }) => {
2856
+ const handleClose = async () => {
2857
+ if (onCancel) {
2858
+ await onCancel();
2667
2859
  }
2668
- );
2669
- });
2670
- const HOOKS = {
2671
- /**
2672
- * Hook that allows to mutate the displayed headers of the list view table
2673
- * @constant
2674
- * @type {string}
2675
- */
2676
- INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
2677
- /**
2678
- * Hook that allows to mutate the CM's collection types links pre-set filters
2679
- * @constant
2680
- * @type {string}
2681
- */
2682
- MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
2683
- /**
2684
- * Hook that allows to mutate the CM's edit view layout
2685
- * @constant
2686
- * @type {string}
2687
- */
2688
- MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
2689
- /**
2690
- * Hook that allows to mutate the CM's single types links pre-set filters
2691
- * @constant
2692
- * @type {string}
2693
- */
2694
- MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
2860
+ onClose();
2861
+ };
2862
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
2863
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
2864
+ typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : Content
2865
+ ] }) });
2695
2866
  };
2696
- const contentTypesApi = contentManagerApi.injectEndpoints({
2697
- endpoints: (builder) => ({
2698
- getContentTypeConfiguration: builder.query({
2699
- query: (uid) => ({
2700
- url: `/content-manager/content-types/${uid}/configuration`,
2701
- method: "GET"
2702
- }),
2703
- transformResponse: (response) => response.data,
2704
- providesTags: (_result, _error, uid) => [
2705
- { type: "ContentTypesConfiguration", id: uid },
2706
- { type: "ContentTypeSettings", id: "LIST" }
2707
- ]
2708
- }),
2709
- getAllContentTypeSettings: builder.query({
2710
- query: () => "/content-manager/content-types-settings",
2711
- transformResponse: (response) => response.data,
2712
- providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
2867
+ const ConfigureTheViewAction = ({ collectionType, model }) => {
2868
+ const navigate = reactRouterDom.useNavigate();
2869
+ const { formatMessage } = reactIntl.useIntl();
2870
+ return {
2871
+ label: formatMessage({
2872
+ id: "app.links.configure-view",
2873
+ defaultMessage: "Configure the view"
2713
2874
  }),
2714
- updateContentTypeConfiguration: builder.mutation({
2715
- query: ({ uid, ...body }) => ({
2716
- url: `/content-manager/content-types/${uid}/configuration`,
2717
- method: "PUT",
2718
- data: body
2719
- }),
2720
- transformResponse: (response) => response.data,
2721
- invalidatesTags: (_result, _error, { uid }) => [
2722
- { type: "ContentTypesConfiguration", id: uid },
2723
- { type: "ContentTypeSettings", id: "LIST" },
2724
- // Is this necessary?
2725
- { type: "InitialData" }
2726
- ]
2727
- })
2728
- })
2729
- });
2730
- const {
2731
- useGetContentTypeConfigurationQuery,
2732
- useGetAllContentTypeSettingsQuery,
2733
- useUpdateContentTypeConfigurationMutation
2734
- } = contentTypesApi;
2735
- const checkIfAttributeIsDisplayable = (attribute) => {
2736
- const { type } = attribute;
2737
- if (type === "relation") {
2738
- return !attribute.relation.toLowerCase().includes("morph");
2739
- }
2740
- return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
2875
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ListPlus, {}),
2876
+ onClick: () => {
2877
+ navigate(`../${collectionType}/${model}/configurations/edit`);
2878
+ },
2879
+ position: "header"
2880
+ };
2741
2881
  };
2742
- const getMainField = (attribute, mainFieldName, { schemas, components }) => {
2743
- if (!mainFieldName) {
2744
- return void 0;
2745
- }
2746
- const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
2747
- // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
2748
- schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
2749
- );
2882
+ ConfigureTheViewAction.type = "configure-the-view";
2883
+ const EditTheModelAction = ({ model }) => {
2884
+ const navigate = reactRouterDom.useNavigate();
2885
+ const { formatMessage } = reactIntl.useIntl();
2750
2886
  return {
2751
- name: mainFieldName,
2752
- type: mainFieldType ?? "string"
2887
+ label: formatMessage({
2888
+ id: "content-manager.link-to-ctb",
2889
+ defaultMessage: "Edit the model"
2890
+ }),
2891
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, {}),
2892
+ onClick: () => {
2893
+ navigate(`/plugins/content-type-builder/content-types/${model}`);
2894
+ },
2895
+ position: "header"
2753
2896
  };
2754
2897
  };
2755
- const DEFAULT_SETTINGS = {
2756
- bulkable: false,
2757
- filterable: false,
2758
- searchable: false,
2759
- pagination: false,
2760
- defaultSortBy: "",
2761
- defaultSortOrder: "asc",
2762
- mainField: "id",
2763
- pageSize: 10
2764
- };
2765
- const useDocumentLayout = (model) => {
2766
- const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
2767
- const [{ query }] = strapiAdmin.useQueryParams();
2768
- const runHookWaterfall = strapiAdmin.useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
2898
+ EditTheModelAction.type = "edit-the-model";
2899
+ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2900
+ const navigate = reactRouterDom.useNavigate();
2901
+ const { formatMessage } = reactIntl.useIntl();
2902
+ const listViewPathMatch = reactRouterDom.useMatch(LIST_PATH);
2903
+ const canDelete = useDocumentRBAC("DeleteAction", (state) => state.canDelete);
2904
+ const { delete: deleteAction } = useDocumentActions();
2769
2905
  const { toggleNotification } = strapiAdmin.useNotification();
2770
- const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
2771
- const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
2772
- const {
2773
- data,
2774
- isLoading: isLoadingConfigs,
2775
- error,
2776
- isFetching: isFetchingConfigs
2777
- } = useGetContentTypeConfigurationQuery(model);
2778
- const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
2779
- React__namespace.useEffect(() => {
2780
- if (error) {
2781
- toggleNotification({
2782
- type: "danger",
2783
- message: formatAPIError(error)
2784
- });
2785
- }
2786
- }, [error, formatAPIError, toggleNotification]);
2787
- const editLayout = React__namespace.useMemo(
2788
- () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
2789
- layout: [],
2790
- components: {},
2791
- metadatas: {},
2792
- options: {},
2793
- settings: DEFAULT_SETTINGS
2794
- },
2795
- [data, isLoading, schemas, schema, components]
2796
- );
2797
- const listLayout = React__namespace.useMemo(() => {
2798
- return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
2799
- layout: [],
2800
- metadatas: {},
2801
- options: {},
2802
- settings: DEFAULT_SETTINGS
2803
- };
2804
- }, [data, isLoading, schemas, schema, components]);
2805
- const { layout: edit } = React__namespace.useMemo(
2806
- () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
2807
- layout: editLayout,
2808
- query
2809
- }),
2810
- [editLayout, query, runHookWaterfall]
2811
- );
2906
+ const setSubmitting = strapiAdmin.useForm("DeleteAction", (state) => state.setSubmitting);
2907
+ const isLocalized = document?.locale != null;
2812
2908
  return {
2813
- error,
2814
- isLoading,
2815
- edit,
2816
- list: listLayout
2817
- };
2818
- };
2819
- const useDocLayout = () => {
2820
- const { model } = useDoc();
2821
- return useDocumentLayout(model);
2822
- };
2823
- const formatEditLayout = (data, {
2824
- schemas,
2825
- schema,
2826
- components
2827
- }) => {
2828
- let currentPanelIndex = 0;
2829
- const panelledEditAttributes = convertEditLayoutToFieldLayouts(
2830
- data.contentType.layouts.edit,
2831
- schema?.attributes,
2832
- data.contentType.metadatas,
2833
- { configurations: data.components, schemas: components },
2834
- schemas
2835
- ).reduce((panels, row) => {
2836
- if (row.some((field) => field.type === "dynamiczone")) {
2837
- panels.push([row]);
2838
- currentPanelIndex += 2;
2839
- } else {
2840
- if (!panels[currentPanelIndex]) {
2841
- panels.push([]);
2842
- }
2843
- panels[currentPanelIndex].push(row);
2844
- }
2845
- return panels;
2846
- }, []);
2847
- const componentEditAttributes = Object.entries(data.components).reduce(
2848
- (acc, [uid, configuration]) => {
2849
- acc[uid] = {
2850
- layout: convertEditLayoutToFieldLayouts(
2851
- configuration.layouts.edit,
2852
- components[uid].attributes,
2853
- configuration.metadatas,
2854
- { configurations: data.components, schemas: components }
2855
- ),
2856
- settings: {
2857
- ...configuration.settings,
2858
- icon: components[uid].info.icon,
2859
- displayName: components[uid].info.displayName
2909
+ disabled: !canDelete || !document,
2910
+ label: formatMessage(
2911
+ {
2912
+ id: "content-manager.actions.delete.label",
2913
+ defaultMessage: "Delete entry{isLocalized, select, true { (all locales)} other {}}"
2914
+ },
2915
+ { isLocalized }
2916
+ ),
2917
+ icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}),
2918
+ dialog: {
2919
+ type: "dialog",
2920
+ title: formatMessage({
2921
+ id: "app.components.ConfirmDialog.title",
2922
+ defaultMessage: "Confirmation"
2923
+ }),
2924
+ content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, children: [
2925
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
2926
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", variant: "omega", textAlign: "center", children: formatMessage({
2927
+ id: "content-manager.actions.delete.dialog.body",
2928
+ defaultMessage: "Are you sure?"
2929
+ }) })
2930
+ ] }),
2931
+ onConfirm: async () => {
2932
+ if (!listViewPathMatch) {
2933
+ setSubmitting(true);
2934
+ }
2935
+ try {
2936
+ if (!documentId && collectionType !== SINGLE_TYPES) {
2937
+ console.error(
2938
+ "You're trying to delete a document without an id, this is likely a bug with Strapi. Please open an issue."
2939
+ );
2940
+ toggleNotification({
2941
+ message: formatMessage({
2942
+ id: "content-manager.actions.delete.error",
2943
+ defaultMessage: "An error occurred while trying to delete the document."
2944
+ }),
2945
+ type: "danger"
2946
+ });
2947
+ return;
2948
+ }
2949
+ const res = await deleteAction({
2950
+ documentId,
2951
+ model,
2952
+ collectionType,
2953
+ params: {
2954
+ locale: "*"
2955
+ }
2956
+ });
2957
+ if (!("error" in res)) {
2958
+ navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
2959
+ }
2960
+ } finally {
2961
+ if (!listViewPathMatch) {
2962
+ setSubmitting(false);
2963
+ }
2860
2964
  }
2861
- };
2862
- return acc;
2863
- },
2864
- {}
2865
- );
2866
- const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
2867
- (acc, [attribute, metadata]) => {
2868
- return {
2869
- ...acc,
2870
- [attribute]: metadata.edit
2871
- };
2872
- },
2873
- {}
2874
- );
2875
- return {
2876
- layout: panelledEditAttributes,
2877
- components: componentEditAttributes,
2878
- metadatas: editMetadatas,
2879
- settings: {
2880
- ...data.contentType.settings,
2881
- displayName: schema?.info.displayName
2965
+ }
2882
2966
  },
2883
- options: {
2884
- ...schema?.options,
2885
- ...schema?.pluginOptions,
2886
- ...data.contentType.options
2887
- }
2967
+ variant: "danger",
2968
+ position: ["header", "table-row"]
2888
2969
  };
2889
2970
  };
2890
- const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
2891
- return rows.map(
2892
- (row) => row.map((field) => {
2893
- const attribute = attributes[field.name];
2894
- if (!attribute) {
2895
- return null;
2896
- }
2897
- const { edit: metadata } = metadatas[field.name];
2898
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2899
- return {
2900
- attribute,
2901
- disabled: !metadata.editable,
2902
- hint: metadata.description,
2903
- label: metadata.label ?? "",
2904
- name: field.name,
2905
- // @ts-expect-error – mainField does exist on the metadata for a relation.
2906
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2907
- schemas,
2908
- components: components?.schemas ?? {}
2909
- }),
2910
- placeholder: metadata.placeholder ?? "",
2911
- required: attribute.required ?? false,
2912
- size: field.size,
2913
- unique: "unique" in attribute ? attribute.unique : false,
2914
- visible: metadata.visible ?? true,
2915
- type: attribute.type
2916
- };
2917
- }).filter((field) => field !== null)
2918
- );
2971
+ DeleteAction$1.type = "delete";
2972
+ const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2973
+ const Panels = () => {
2974
+ const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
2975
+ const [
2976
+ {
2977
+ query: { status }
2978
+ }
2979
+ ] = strapiAdmin.useQueryParams({
2980
+ status: "draft"
2981
+ });
2982
+ const { model, id, document, meta, collectionType } = useDoc();
2983
+ const plugins = strapiAdmin.useStrapiApp("Panels", (state) => state.plugins);
2984
+ const props = {
2985
+ activeTab: status,
2986
+ model,
2987
+ documentId: id,
2988
+ document: isCloning ? void 0 : document,
2989
+ meta: isCloning ? void 0 : meta,
2990
+ collectionType
2991
+ };
2992
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
2993
+ strapiAdmin.DescriptionComponentRenderer,
2994
+ {
2995
+ props,
2996
+ descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
2997
+ children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsxRuntime.jsx(Panel, { ...description, children: content }, id2))
2998
+ }
2999
+ ) });
2919
3000
  };
2920
- const formatListLayout = (data, {
2921
- schemas,
2922
- schema,
2923
- components
2924
- }) => {
2925
- const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
2926
- (acc, [attribute, metadata]) => {
2927
- return {
2928
- ...acc,
2929
- [attribute]: metadata.list
2930
- };
2931
- },
2932
- {}
2933
- );
2934
- const listAttributes = convertListLayoutToFieldLayouts(
2935
- data.contentType.layouts.list,
2936
- schema?.attributes,
2937
- listMetadatas,
2938
- { configurations: data.components, schemas: components },
2939
- schemas
2940
- );
3001
+ const ActionsPanel = () => {
3002
+ const { formatMessage } = reactIntl.useIntl();
2941
3003
  return {
2942
- layout: listAttributes,
2943
- settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
2944
- metadatas: listMetadatas,
2945
- options: {
2946
- ...schema?.options,
2947
- ...schema?.pluginOptions,
2948
- ...data.contentType.options
2949
- }
3004
+ title: formatMessage({
3005
+ id: "content-manager.containers.edit.panels.default.title",
3006
+ defaultMessage: "Entry"
3007
+ }),
3008
+ content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
2950
3009
  };
2951
3010
  };
2952
- const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
2953
- return columns.map((name) => {
2954
- const attribute = attributes[name];
2955
- if (!attribute) {
2956
- return null;
3011
+ ActionsPanel.type = "actions";
3012
+ const ActionsPanelContent = () => {
3013
+ const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
3014
+ const [
3015
+ {
3016
+ query: { status = "draft" }
2957
3017
  }
2958
- const metadata = metadatas[name];
2959
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2960
- return {
2961
- attribute,
2962
- label: metadata.label ?? "",
2963
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2964
- schemas,
2965
- components: components?.schemas ?? {}
2966
- }),
2967
- name,
2968
- searchable: metadata.searchable ?? true,
2969
- sortable: metadata.sortable ?? true
2970
- };
2971
- }).filter((field) => field !== null);
3018
+ ] = strapiAdmin.useQueryParams();
3019
+ const { model, id, document, meta, collectionType } = useDoc();
3020
+ const plugins = strapiAdmin.useStrapiApp("ActionsPanel", (state) => state.plugins);
3021
+ const props = {
3022
+ activeTab: status,
3023
+ model,
3024
+ documentId: id,
3025
+ document: isCloning ? void 0 : document,
3026
+ meta: isCloning ? void 0 : meta,
3027
+ collectionType
3028
+ };
3029
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, width: "100%", children: [
3030
+ /* @__PURE__ */ jsxRuntime.jsx(
3031
+ strapiAdmin.DescriptionComponentRenderer,
3032
+ {
3033
+ props,
3034
+ descriptions: plugins["content-manager"].apis.getDocumentActions(),
3035
+ children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
3036
+ }
3037
+ ),
3038
+ /* @__PURE__ */ jsxRuntime.jsx(InjectionZone, { area: "editView.right-links", slug: model })
3039
+ ] });
2972
3040
  };
3041
+ const Panel = React__namespace.forwardRef(({ children, title }, ref) => {
3042
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3043
+ designSystem.Flex,
3044
+ {
3045
+ ref,
3046
+ tag: "aside",
3047
+ "aria-labelledby": "additional-information",
3048
+ background: "neutral0",
3049
+ borderColor: "neutral150",
3050
+ hasRadius: true,
3051
+ paddingBottom: 4,
3052
+ paddingLeft: 4,
3053
+ paddingRight: 4,
3054
+ paddingTop: 4,
3055
+ shadow: "tableShadow",
3056
+ gap: 3,
3057
+ direction: "column",
3058
+ justifyContent: "stretch",
3059
+ alignItems: "flex-start",
3060
+ children: [
3061
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", textColor: "neutral600", children: title }),
3062
+ children
3063
+ ]
3064
+ }
3065
+ );
3066
+ });
2973
3067
  const ConfirmBulkActionDialog = ({
2974
3068
  onToggleDialog,
2975
3069
  isOpen = false,
@@ -3947,6 +4041,70 @@ const { setInitialData } = actions;
3947
4041
  const reducer = toolkit.combineReducers({
3948
4042
  app: reducer$1
3949
4043
  });
4044
+ const previewApi = contentManagerApi.injectEndpoints({
4045
+ endpoints: (builder) => ({
4046
+ getPreviewUrl: builder.query({
4047
+ query({ query, params }) {
4048
+ return {
4049
+ url: `/content-manager/preview/url/${params.contentType}`,
4050
+ method: "GET",
4051
+ config: {
4052
+ params: query
4053
+ }
4054
+ };
4055
+ }
4056
+ })
4057
+ })
4058
+ });
4059
+ const { useGetPreviewUrlQuery } = previewApi;
4060
+ const PreviewSidePanel = ({ model, documentId, document }) => {
4061
+ const { formatMessage } = reactIntl.useIntl();
4062
+ const { trackUsage } = strapiAdmin.useTracking();
4063
+ const [{ query }] = strapiAdmin.useQueryParams();
4064
+ const { data, error } = useGetPreviewUrlQuery({
4065
+ params: {
4066
+ contentType: model
4067
+ },
4068
+ query: {
4069
+ documentId,
4070
+ locale: document?.locale,
4071
+ status: document?.status
4072
+ }
4073
+ });
4074
+ if (!data?.data?.url || error) {
4075
+ return null;
4076
+ }
4077
+ const handleClick = () => {
4078
+ trackUsage("willOpenPreview");
4079
+ };
4080
+ return {
4081
+ title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
4082
+ content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
4083
+ designSystem.Button,
4084
+ {
4085
+ variant: "tertiary",
4086
+ tag: reactRouterDom.Link,
4087
+ to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
4088
+ onClick: handleClick,
4089
+ flex: "auto",
4090
+ children: formatMessage({
4091
+ id: "content-manager.preview.panel.button",
4092
+ defaultMessage: "Open preview"
4093
+ })
4094
+ }
4095
+ ) })
4096
+ };
4097
+ };
4098
+ const FEATURE_ID = "preview";
4099
+ const previewAdmin = {
4100
+ bootstrap(app) {
4101
+ if (!window.strapi.future.isEnabled(FEATURE_ID)) {
4102
+ return;
4103
+ }
4104
+ const contentManagerPluginApis = app.getPlugin("content-manager").apis;
4105
+ contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
4106
+ }
4107
+ };
3950
4108
  const index = {
3951
4109
  register(app) {
3952
4110
  const cm = new ContentManagerPlugin();
@@ -3966,7 +4124,7 @@ const index = {
3966
4124
  app.router.addRoute({
3967
4125
  path: "content-manager/*",
3968
4126
  lazy: async () => {
3969
- const { Layout } = await Promise.resolve().then(() => require("./layout-D6A3K-ut.js"));
4127
+ const { Layout } = await Promise.resolve().then(() => require("./layout-BzX903CL.js"));
3970
4128
  return {
3971
4129
  Component: Layout
3972
4130
  };
@@ -3979,11 +4137,14 @@ const index = {
3979
4137
  if (typeof historyAdmin.bootstrap === "function") {
3980
4138
  historyAdmin.bootstrap(app);
3981
4139
  }
4140
+ if (typeof previewAdmin.bootstrap === "function") {
4141
+ previewAdmin.bootstrap(app);
4142
+ }
3982
4143
  },
3983
4144
  async registerTrads({ locales }) {
3984
4145
  const importedTrads = await Promise.all(
3985
4146
  locales.map((locale) => {
3986
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-BVzUkPxZ.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-EUonQTon.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B7kGGg3E.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-CcFe8diO.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
4147
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-CHOp_xJv.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-9K52xZIr.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B2Kyv8Z9.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-7sfIbjxE.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
3987
4148
  return {
3988
4149
  data: prefixPluginTranslations(data, PLUGIN_ID),
3989
4150
  locale
@@ -4029,6 +4190,7 @@ exports.getMainField = getMainField;
4029
4190
  exports.getTranslation = getTranslation;
4030
4191
  exports.index = index;
4031
4192
  exports.setInitialData = setInitialData;
4193
+ exports.useContentManagerContext = useContentManagerContext;
4032
4194
  exports.useContentTypeSchema = useContentTypeSchema;
4033
4195
  exports.useDoc = useDoc;
4034
4196
  exports.useDocLayout = useDocLayout;
@@ -4040,5 +4202,6 @@ exports.useGetAllContentTypeSettingsQuery = useGetAllContentTypeSettingsQuery;
4040
4202
  exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
4041
4203
  exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
4042
4204
  exports.useGetInitialDataQuery = useGetInitialDataQuery;
4205
+ exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
4043
4206
  exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
4044
- //# sourceMappingURL=index-jDJgW_Lf.js.map
4207
+ //# sourceMappingURL=index-tN1hpOMN.js.map