@strapi/content-manager 0.0.0-experimental.d954d57341a6623992a0d211daaec8e245c3517d → 0.0.0-experimental.da0467de7eccc163e893e9b332505a79a5d52ec7

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 (510) hide show
  1. package/LICENSE +18 -3
  2. package/dist/admin/chunks/CardDragPreview-DwuraT0K.mjs +80 -0
  3. package/dist/admin/chunks/CardDragPreview-DwuraT0K.mjs.map +1 -0
  4. package/dist/admin/chunks/CardDragPreview-_dubYgXO.js +82 -0
  5. package/dist/admin/chunks/CardDragPreview-_dubYgXO.js.map +1 -0
  6. package/dist/admin/chunks/ComponentConfigurationPage-BGBNQxFJ.js +299 -0
  7. package/dist/admin/chunks/ComponentConfigurationPage-BGBNQxFJ.js.map +1 -0
  8. package/dist/admin/chunks/ComponentConfigurationPage-DKtL-tec.mjs +277 -0
  9. package/dist/admin/chunks/ComponentConfigurationPage-DKtL-tec.mjs.map +1 -0
  10. package/dist/admin/chunks/ComponentIcon-BZcTc4rj.mjs +153 -0
  11. package/dist/admin/chunks/ComponentIcon-BZcTc4rj.mjs.map +1 -0
  12. package/dist/admin/chunks/ComponentIcon-C-EjOUPA.js +176 -0
  13. package/dist/admin/chunks/ComponentIcon-C-EjOUPA.js.map +1 -0
  14. package/dist/admin/chunks/EditConfigurationPage-KDwSFRyn.mjs +159 -0
  15. package/dist/admin/chunks/EditConfigurationPage-KDwSFRyn.mjs.map +1 -0
  16. package/dist/admin/chunks/EditConfigurationPage-yliOxLUv.js +181 -0
  17. package/dist/admin/chunks/EditConfigurationPage-yliOxLUv.js.map +1 -0
  18. package/dist/admin/chunks/EditViewPage-BAI2r49P.mjs +311 -0
  19. package/dist/admin/chunks/EditViewPage-BAI2r49P.mjs.map +1 -0
  20. package/dist/admin/chunks/EditViewPage-DpvonssD.js +334 -0
  21. package/dist/admin/chunks/EditViewPage-DpvonssD.js.map +1 -0
  22. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.mjs +56 -0
  23. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.mjs.map +1 -0
  24. package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js +58 -0
  25. package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js.map +1 -0
  26. package/dist/admin/chunks/Form-BrzQyDxU.mjs +955 -0
  27. package/dist/admin/chunks/Form-BrzQyDxU.mjs.map +1 -0
  28. package/dist/admin/chunks/Form-XD_sf25E.js +978 -0
  29. package/dist/admin/chunks/Form-XD_sf25E.js.map +1 -0
  30. package/dist/admin/chunks/History-C-_o7tz8.js +1380 -0
  31. package/dist/admin/chunks/History-C-_o7tz8.js.map +1 -0
  32. package/dist/admin/chunks/History-DClLuGIg.mjs +1357 -0
  33. package/dist/admin/chunks/History-DClLuGIg.mjs.map +1 -0
  34. package/dist/admin/chunks/Input-BMLRZBE3.mjs +7190 -0
  35. package/dist/admin/chunks/Input-BMLRZBE3.mjs.map +1 -0
  36. package/dist/admin/chunks/Input-Bv-rqfYH.js +7221 -0
  37. package/dist/admin/chunks/Input-Bv-rqfYH.js.map +1 -0
  38. package/dist/admin/chunks/ListConfigurationPage-D66hgG4-.js +819 -0
  39. package/dist/admin/chunks/ListConfigurationPage-D66hgG4-.js.map +1 -0
  40. package/dist/admin/chunks/ListConfigurationPage-Do3UDres.mjs +796 -0
  41. package/dist/admin/chunks/ListConfigurationPage-Do3UDres.mjs.map +1 -0
  42. package/dist/admin/chunks/ListViewPage-DNvysJaJ.js +1155 -0
  43. package/dist/admin/chunks/ListViewPage-DNvysJaJ.js.map +1 -0
  44. package/dist/admin/chunks/ListViewPage-Q0auz5lE.mjs +1133 -0
  45. package/dist/admin/chunks/ListViewPage-Q0auz5lE.mjs.map +1 -0
  46. package/dist/admin/chunks/NoContentTypePage-B_oOeOQb.mjs +58 -0
  47. package/dist/admin/chunks/NoContentTypePage-B_oOeOQb.mjs.map +1 -0
  48. package/dist/admin/chunks/NoContentTypePage-C5qFFfgn.js +60 -0
  49. package/dist/admin/chunks/NoContentTypePage-C5qFFfgn.js.map +1 -0
  50. package/dist/admin/chunks/NoPermissionsPage-BAW7WY-M.mjs +37 -0
  51. package/dist/admin/chunks/NoPermissionsPage-BAW7WY-M.mjs.map +1 -0
  52. package/dist/admin/chunks/NoPermissionsPage-C9sDJXRu.js +39 -0
  53. package/dist/admin/chunks/NoPermissionsPage-C9sDJXRu.js.map +1 -0
  54. package/dist/admin/chunks/Preview-05BZGpV2.mjs +675 -0
  55. package/dist/admin/chunks/Preview-05BZGpV2.mjs.map +1 -0
  56. package/dist/admin/chunks/Preview-B6ThL2SA.js +697 -0
  57. package/dist/admin/chunks/Preview-B6ThL2SA.js.map +1 -0
  58. package/dist/admin/chunks/Relations-CJ0GWuqq.js +1318 -0
  59. package/dist/admin/chunks/Relations-CJ0GWuqq.js.map +1 -0
  60. package/dist/admin/chunks/Relations-CiOfFNxW.mjs +1291 -0
  61. package/dist/admin/chunks/Relations-CiOfFNxW.mjs.map +1 -0
  62. package/dist/admin/chunks/ar-DckYq_WK.mjs +222 -0
  63. package/dist/{_chunks/ar-CCEVvqGG.mjs.map → admin/chunks/ar-DckYq_WK.mjs.map} +1 -1
  64. package/dist/admin/chunks/ar-DeQBSsfl.js +227 -0
  65. package/dist/{_chunks/ru-BT3ybNny.js.map → admin/chunks/ar-DeQBSsfl.js.map} +1 -1
  66. package/dist/admin/chunks/ca-ClDTvatJ.js +202 -0
  67. package/dist/admin/chunks/ca-ClDTvatJ.js.map +1 -0
  68. package/dist/admin/chunks/ca-DviY7mRj.mjs +197 -0
  69. package/dist/admin/chunks/ca-DviY7mRj.mjs.map +1 -0
  70. package/dist/admin/chunks/cs-BJFxwIWj.js +126 -0
  71. package/dist/{_chunks/cs-CkJy6B2v.js.map → admin/chunks/cs-BJFxwIWj.js.map} +1 -1
  72. package/dist/admin/chunks/cs-C7OSYFQ7.mjs +122 -0
  73. package/dist/{_chunks/cs-CM2aBUar.mjs.map → admin/chunks/cs-C7OSYFQ7.mjs.map} +1 -1
  74. package/dist/admin/chunks/de-5QRlDHyR.mjs +195 -0
  75. package/dist/{_chunks/eu-CdALomew.mjs.map → admin/chunks/de-5QRlDHyR.mjs.map} +1 -1
  76. package/dist/admin/chunks/de-CbImAUA5.js +200 -0
  77. package/dist/{_chunks/gu-BRmF601H.js.map → admin/chunks/de-CbImAUA5.js.map} +1 -1
  78. package/dist/admin/chunks/en-CImiNxXE.mjs +310 -0
  79. package/dist/{_chunks/en-Ux26r5pl.mjs.map → admin/chunks/en-CImiNxXE.mjs.map} +1 -1
  80. package/dist/admin/chunks/en-CLf4SuMQ.js +315 -0
  81. package/dist/admin/chunks/en-CLf4SuMQ.js.map +1 -0
  82. package/dist/admin/chunks/es-C8vLuvZL.js +197 -0
  83. package/dist/{_chunks/es-EUonQTon.js.map → admin/chunks/es-C8vLuvZL.js.map} +1 -1
  84. package/dist/admin/chunks/es-DkoWSExG.mjs +192 -0
  85. package/dist/{_chunks/ja-CtsUxOvk.mjs.map → admin/chunks/es-DkoWSExG.mjs.map} +1 -1
  86. package/dist/admin/chunks/eu-BG1xX7HK.mjs +198 -0
  87. package/dist/admin/chunks/eu-BG1xX7HK.mjs.map +1 -0
  88. package/dist/admin/chunks/eu-BJW3AvXu.js +203 -0
  89. package/dist/admin/chunks/eu-BJW3AvXu.js.map +1 -0
  90. package/dist/admin/chunks/fr-CFdRaRVj.mjs +215 -0
  91. package/dist/admin/chunks/fr-CFdRaRVj.mjs.map +1 -0
  92. package/dist/admin/chunks/fr-gQSilC7w.js +220 -0
  93. package/dist/admin/chunks/fr-gQSilC7w.js.map +1 -0
  94. package/dist/admin/chunks/gu-D5MMMXRs.mjs +196 -0
  95. package/dist/admin/chunks/gu-D5MMMXRs.mjs.map +1 -0
  96. package/dist/admin/chunks/gu-DPU4wyx7.js +201 -0
  97. package/dist/{_chunks/eu-VDH-3ovk.js.map → admin/chunks/gu-DPU4wyx7.js.map} +1 -1
  98. package/dist/admin/chunks/hi-Dp4omeBb.js +201 -0
  99. package/dist/admin/chunks/hi-Dp4omeBb.js.map +1 -0
  100. package/dist/admin/chunks/hi-lp17SCjr.mjs +196 -0
  101. package/dist/admin/chunks/hi-lp17SCjr.mjs.map +1 -0
  102. package/dist/{_chunks/hooks-BAaaKPS_.js → admin/chunks/hooks-D-sOYd1s.js} +6 -3
  103. package/dist/admin/chunks/hooks-D-sOYd1s.js.map +1 -0
  104. package/dist/admin/chunks/hooks-DMvik5y_.mjs +7 -0
  105. package/dist/admin/chunks/hooks-DMvik5y_.mjs.map +1 -0
  106. package/dist/admin/chunks/hu-CLka1U2C.mjs +198 -0
  107. package/dist/admin/chunks/hu-CLka1U2C.mjs.map +1 -0
  108. package/dist/admin/chunks/hu-CtFJuhTd.js +203 -0
  109. package/dist/admin/chunks/hu-CtFJuhTd.js.map +1 -0
  110. package/dist/admin/chunks/id-D7V5S1rB.js +161 -0
  111. package/dist/{_chunks/it-DkBIs7vD.js.map → admin/chunks/id-D7V5S1rB.js.map} +1 -1
  112. package/dist/admin/chunks/id-USfY9m1g.mjs +156 -0
  113. package/dist/{_chunks/id-BtwA9WJT.mjs.map → admin/chunks/id-USfY9m1g.mjs.map} +1 -1
  114. package/dist/admin/chunks/index-CcJLBLNf.mjs +5399 -0
  115. package/dist/admin/chunks/index-CcJLBLNf.mjs.map +1 -0
  116. package/dist/admin/chunks/index-SQ88CePz.js +5466 -0
  117. package/dist/admin/chunks/index-SQ88CePz.js.map +1 -0
  118. package/dist/admin/chunks/it-BAHrwmYS.mjs +158 -0
  119. package/dist/{_chunks/it-BrVPqaf1.mjs.map → admin/chunks/it-BAHrwmYS.mjs.map} +1 -1
  120. package/dist/admin/chunks/it-CQFpa_Dc.js +163 -0
  121. package/dist/{_chunks/ko-woFZPmLk.js.map → admin/chunks/it-CQFpa_Dc.js.map} +1 -1
  122. package/dist/admin/chunks/ja-BWKmBJFT.mjs +192 -0
  123. package/dist/{_chunks/ko-HVQRlfUI.mjs.map → admin/chunks/ja-BWKmBJFT.mjs.map} +1 -1
  124. package/dist/admin/chunks/ja-jdQM-B79.js +197 -0
  125. package/dist/{_chunks/de-CCEmbAah.js.map → admin/chunks/ja-jdQM-B79.js.map} +1 -1
  126. package/dist/admin/chunks/ko-CgADGBNt.mjs +191 -0
  127. package/dist/{_chunks/es-CeXiYflN.mjs.map → admin/chunks/ko-CgADGBNt.mjs.map} +1 -1
  128. package/dist/admin/chunks/ko-k46sEyzt.js +196 -0
  129. package/dist/{_chunks/ja-CcFe8diO.js.map → admin/chunks/ko-k46sEyzt.js.map} +1 -1
  130. package/dist/admin/chunks/layout-4nCaNnTs.mjs +599 -0
  131. package/dist/admin/chunks/layout-4nCaNnTs.mjs.map +1 -0
  132. package/dist/admin/chunks/layout-xxDnIsHG.js +619 -0
  133. package/dist/admin/chunks/layout-xxDnIsHG.js.map +1 -0
  134. package/dist/admin/chunks/ml-CnhCfOn_.mjs +196 -0
  135. package/dist/admin/chunks/ml-CnhCfOn_.mjs.map +1 -0
  136. package/dist/admin/chunks/ml-DqxPwODx.js +201 -0
  137. package/dist/admin/chunks/ml-DqxPwODx.js.map +1 -0
  138. package/dist/admin/chunks/ms-Bh09NFff.mjs +140 -0
  139. package/dist/{_chunks/ms-m_WjyWx7.mjs.map → admin/chunks/ms-Bh09NFff.mjs.map} +1 -1
  140. package/dist/admin/chunks/ms-CvSC0OdG.js +145 -0
  141. package/dist/{_chunks/ms-BuFotyP_.js.map → admin/chunks/ms-CvSC0OdG.js.map} +1 -1
  142. package/dist/admin/chunks/nl-BEubhS8C.js +203 -0
  143. package/dist/admin/chunks/nl-BEubhS8C.js.map +1 -0
  144. package/dist/admin/chunks/nl-C8HYflTc.mjs +198 -0
  145. package/dist/admin/chunks/nl-C8HYflTc.mjs.map +1 -0
  146. package/dist/admin/chunks/objects-C3EebVVe.js +76 -0
  147. package/dist/admin/chunks/objects-C3EebVVe.js.map +1 -0
  148. package/dist/admin/chunks/objects-wl73iEma.mjs +73 -0
  149. package/dist/admin/chunks/objects-wl73iEma.mjs.map +1 -0
  150. package/dist/admin/chunks/pl-DWhGDzmM.js +200 -0
  151. package/dist/{_chunks/ca-Cmk45QO6.js.map → admin/chunks/pl-DWhGDzmM.js.map} +1 -1
  152. package/dist/admin/chunks/pl-MFCZJZuZ.mjs +195 -0
  153. package/dist/{_chunks/ca-5U32ON2v.mjs.map → admin/chunks/pl-MFCZJZuZ.mjs.map} +1 -1
  154. package/dist/admin/chunks/pt-BR-CPtAXD-4.js +202 -0
  155. package/dist/{_chunks/pt-BR-BiOz37D9.js.map → admin/chunks/pt-BR-CPtAXD-4.js.map} +1 -1
  156. package/dist/admin/chunks/pt-BR-CcotyBGJ.mjs +197 -0
  157. package/dist/{_chunks/pt-BR-C71iDxnh.mjs.map → admin/chunks/pt-BR-CcotyBGJ.mjs.map} +1 -1
  158. package/dist/admin/chunks/pt-BoPxN80n.js +96 -0
  159. package/dist/admin/chunks/pt-BoPxN80n.js.map +1 -0
  160. package/dist/admin/chunks/pt-HbmgeiYO.mjs +93 -0
  161. package/dist/admin/chunks/pt-HbmgeiYO.mjs.map +1 -0
  162. package/dist/admin/chunks/relations-D1R7vM_e.mjs +173 -0
  163. package/dist/admin/chunks/relations-D1R7vM_e.mjs.map +1 -0
  164. package/dist/admin/chunks/relations-VlsO9KQZ.js +178 -0
  165. package/dist/admin/chunks/relations-VlsO9KQZ.js.map +1 -0
  166. package/dist/admin/chunks/ru-C0op0ALG.js +232 -0
  167. package/dist/{_chunks/en-fbKQxLGn.js.map → admin/chunks/ru-C0op0ALG.js.map} +1 -1
  168. package/dist/admin/chunks/ru-CB4BUyQp.mjs +230 -0
  169. package/dist/{_chunks/ru-BE6A4Exp.mjs.map → admin/chunks/ru-CB4BUyQp.mjs.map} +1 -1
  170. package/dist/admin/chunks/sa-B_FuPyMw.js +201 -0
  171. package/dist/admin/chunks/sa-B_FuPyMw.js.map +1 -0
  172. package/dist/admin/chunks/sa-n_aPA-pU.mjs +196 -0
  173. package/dist/admin/chunks/sa-n_aPA-pU.mjs.map +1 -0
  174. package/dist/admin/chunks/sk-D_iXML2C.js +203 -0
  175. package/dist/admin/chunks/sk-D_iXML2C.js.map +1 -0
  176. package/dist/admin/chunks/sk-tn_BDjE2.mjs +198 -0
  177. package/dist/admin/chunks/sk-tn_BDjE2.mjs.map +1 -0
  178. package/dist/admin/chunks/sv-BstBC1Yp.js +203 -0
  179. package/dist/admin/chunks/sv-BstBC1Yp.js.map +1 -0
  180. package/dist/admin/chunks/sv-cq4ZrQRd.mjs +198 -0
  181. package/dist/admin/chunks/sv-cq4ZrQRd.mjs.map +1 -0
  182. package/dist/admin/chunks/th-lXoOCqPC.js +149 -0
  183. package/dist/{_chunks/th-D9_GfAjc.js.map → admin/chunks/th-lXoOCqPC.js.map} +1 -1
  184. package/dist/admin/chunks/th-mUH7hEtc.mjs +144 -0
  185. package/dist/{_chunks/uk-CR-zDhAY.mjs.map → admin/chunks/th-mUH7hEtc.mjs.map} +1 -1
  186. package/dist/admin/chunks/tr-CkS6sLIE.js +200 -0
  187. package/dist/admin/chunks/tr-CkS6sLIE.js.map +1 -0
  188. package/dist/admin/chunks/tr-Yt38daxh.mjs +195 -0
  189. package/dist/{_chunks/de-C72KDNOl.mjs.map → admin/chunks/tr-Yt38daxh.mjs.map} +1 -1
  190. package/dist/admin/chunks/uk-BtM6WnaE.mjs +313 -0
  191. package/dist/admin/chunks/uk-BtM6WnaE.mjs.map +1 -0
  192. package/dist/admin/chunks/uk-DB6OgySY.js +318 -0
  193. package/dist/admin/chunks/uk-DB6OgySY.js.map +1 -0
  194. package/dist/admin/chunks/useDragAndDrop-HYwNDExe.mjs +247 -0
  195. package/dist/admin/chunks/useDragAndDrop-HYwNDExe.mjs.map +1 -0
  196. package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js +271 -0
  197. package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js.map +1 -0
  198. package/dist/admin/chunks/usePrev-Bjw2dhmq.mjs +18 -0
  199. package/dist/admin/chunks/usePrev-Bjw2dhmq.mjs.map +1 -0
  200. package/dist/admin/chunks/usePrev-DIYl-IAL.js +21 -0
  201. package/dist/admin/chunks/usePrev-DIYl-IAL.js.map +1 -0
  202. package/dist/admin/chunks/vi-BGr1X_HZ.js +112 -0
  203. package/dist/{_chunks/vi-CJlYDheJ.js.map → admin/chunks/vi-BGr1X_HZ.js.map} +1 -1
  204. package/dist/admin/chunks/vi-CvBGlTjr.mjs +108 -0
  205. package/dist/{_chunks/vi-DUXIk_fw.mjs.map → admin/chunks/vi-CvBGlTjr.mjs.map} +1 -1
  206. package/dist/admin/chunks/zh-BmF-sHaT.mjs +205 -0
  207. package/dist/admin/chunks/zh-BmF-sHaT.mjs.map +1 -0
  208. package/dist/admin/chunks/zh-DwFu_Kfj.js +210 -0
  209. package/dist/admin/chunks/zh-DwFu_Kfj.js.map +1 -0
  210. package/dist/admin/chunks/zh-Hans-CI0HKio3.mjs +934 -0
  211. package/dist/{_chunks/zh-Hans-BPQcRIyH.mjs.map → admin/chunks/zh-Hans-CI0HKio3.mjs.map} +1 -1
  212. package/dist/admin/chunks/zh-Hans-JVK9x7xr.js +953 -0
  213. package/dist/{_chunks/zh-Hans-9kOncHGw.js.map → admin/chunks/zh-Hans-JVK9x7xr.js.map} +1 -1
  214. package/dist/admin/index.js +26 -4
  215. package/dist/admin/index.js.map +1 -1
  216. package/dist/admin/index.mjs +17 -11
  217. package/dist/admin/index.mjs.map +1 -1
  218. package/dist/admin/src/components/InjectionZone.d.ts +7 -1
  219. package/dist/admin/src/content-manager.d.ts +7 -2
  220. package/dist/admin/src/exports.d.ts +2 -1
  221. package/dist/admin/src/history/index.d.ts +3 -0
  222. package/dist/admin/src/history/services/historyVersion.d.ts +2 -2
  223. package/dist/admin/src/hooks/useDocument.d.ts +52 -2
  224. package/dist/admin/src/hooks/useDocumentActions.d.ts +1 -0
  225. package/dist/admin/src/index.d.ts +2 -0
  226. package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
  227. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +4 -2
  228. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
  229. package/dist/admin/src/pages/EditView/components/EditorToolbarObserver.d.ts +11 -0
  230. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +55 -0
  231. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +5 -0
  232. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
  233. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
  234. package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +22 -1
  235. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
  236. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
  237. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.d.ts +1 -2
  238. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
  239. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +29 -1
  240. package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
  241. package/dist/admin/src/pages/EditView/utils/data.d.ts +1 -0
  242. package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
  243. package/dist/admin/src/preview/components/PreviewHeader.d.ts +3 -0
  244. package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
  245. package/dist/admin/src/preview/index.d.ts +3 -0
  246. package/dist/admin/src/preview/pages/Preview.d.ts +15 -0
  247. package/dist/admin/src/preview/routes.d.ts +3 -0
  248. package/dist/admin/src/preview/services/preview.d.ts +3 -0
  249. package/dist/admin/src/router.d.ts +1 -1
  250. package/dist/admin/src/services/api.d.ts +1 -1
  251. package/dist/admin/src/services/components.d.ts +2 -2
  252. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  253. package/dist/admin/src/services/documents.d.ts +19 -20
  254. package/dist/admin/src/services/init.d.ts +1 -1
  255. package/dist/admin/src/services/relations.d.ts +2 -2
  256. package/dist/admin/src/services/uid.d.ts +3 -3
  257. package/dist/admin/src/utils/validation.d.ts +4 -1
  258. package/dist/server/index.js +5483 -4083
  259. package/dist/server/index.js.map +1 -1
  260. package/dist/server/index.mjs +5504 -4101
  261. package/dist/server/index.mjs.map +1 -1
  262. package/dist/server/src/bootstrap.d.ts.map +1 -1
  263. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  264. package/dist/server/src/controllers/index.d.ts.map +1 -1
  265. package/dist/server/src/controllers/relations.d.ts.map +1 -1
  266. package/dist/server/src/controllers/uid.d.ts.map +1 -1
  267. package/dist/server/src/controllers/utils/metadata.d.ts +17 -2
  268. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  269. package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
  270. package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
  271. package/dist/server/src/history/controllers/history-version.d.ts +1 -1
  272. package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
  273. package/dist/server/src/history/services/history.d.ts +3 -3
  274. package/dist/server/src/history/services/history.d.ts.map +1 -1
  275. package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
  276. package/dist/server/src/history/services/utils.d.ts +8 -12
  277. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  278. package/dist/server/src/index.d.ts +7 -6
  279. package/dist/server/src/index.d.ts.map +1 -1
  280. package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
  281. package/dist/server/src/preview/controllers/index.d.ts +2 -0
  282. package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
  283. package/dist/server/src/preview/controllers/preview.d.ts +13 -0
  284. package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
  285. package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
  286. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
  287. package/dist/server/src/preview/index.d.ts +4 -0
  288. package/dist/server/src/preview/index.d.ts.map +1 -0
  289. package/dist/server/src/preview/routes/index.d.ts +8 -0
  290. package/dist/server/src/preview/routes/index.d.ts.map +1 -0
  291. package/dist/server/src/preview/routes/preview.d.ts +4 -0
  292. package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
  293. package/dist/server/src/preview/services/index.d.ts +16 -0
  294. package/dist/server/src/preview/services/index.d.ts.map +1 -0
  295. package/dist/server/src/preview/services/preview-config.d.ts +32 -0
  296. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
  297. package/dist/server/src/preview/services/preview.d.ts +12 -0
  298. package/dist/server/src/preview/services/preview.d.ts.map +1 -0
  299. package/dist/server/src/preview/utils.d.ts +19 -0
  300. package/dist/server/src/preview/utils.d.ts.map +1 -0
  301. package/dist/server/src/register.d.ts.map +1 -1
  302. package/dist/server/src/routes/index.d.ts.map +1 -1
  303. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  304. package/dist/server/src/services/document-metadata.d.ts +12 -10
  305. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  306. package/dist/server/src/services/index.d.ts +7 -6
  307. package/dist/server/src/services/index.d.ts.map +1 -1
  308. package/dist/server/src/services/permission-checker.d.ts.map +1 -1
  309. package/dist/server/src/services/utils/count.d.ts +1 -1
  310. package/dist/server/src/services/utils/count.d.ts.map +1 -1
  311. package/dist/server/src/services/utils/populate.d.ts +3 -3
  312. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  313. package/dist/server/src/utils/index.d.ts +2 -0
  314. package/dist/server/src/utils/index.d.ts.map +1 -1
  315. package/dist/shared/contracts/collection-types.d.ts +3 -2
  316. package/dist/shared/contracts/collection-types.d.ts.map +1 -1
  317. package/dist/shared/contracts/components.d.ts +0 -1
  318. package/dist/shared/contracts/content-types.d.ts +0 -1
  319. package/dist/shared/contracts/history-versions.d.ts +0 -1
  320. package/dist/shared/contracts/index.d.ts +1 -1
  321. package/dist/shared/contracts/index.d.ts.map +1 -1
  322. package/dist/shared/contracts/init.d.ts +0 -1
  323. package/dist/shared/contracts/preview.d.ts +26 -0
  324. package/dist/shared/contracts/preview.d.ts.map +1 -0
  325. package/dist/shared/contracts/relations.d.ts +1 -2
  326. package/dist/shared/contracts/relations.d.ts.map +1 -1
  327. package/dist/shared/contracts/review-workflows.d.ts +0 -1
  328. package/dist/shared/contracts/single-types.d.ts +0 -1
  329. package/dist/shared/contracts/uid.d.ts +0 -1
  330. package/dist/shared/index.d.ts +0 -1
  331. package/dist/shared/index.js +37 -22
  332. package/dist/shared/index.js.map +1 -1
  333. package/dist/shared/index.mjs +36 -23
  334. package/dist/shared/index.mjs.map +1 -1
  335. package/package.json +25 -21
  336. package/dist/_chunks/CardDragPreview-C0QyJgRA.js +0 -69
  337. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +0 -1
  338. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs +0 -70
  339. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +0 -1
  340. package/dist/_chunks/ComponentConfigurationPage-WRPUXGd6.js +0 -255
  341. package/dist/_chunks/ComponentConfigurationPage-WRPUXGd6.js.map +0 -1
  342. package/dist/_chunks/ComponentConfigurationPage-gdUj_t-O.mjs +0 -236
  343. package/dist/_chunks/ComponentConfigurationPage-gdUj_t-O.mjs.map +0 -1
  344. package/dist/_chunks/ComponentIcon-BXdiCGQp.js +0 -176
  345. package/dist/_chunks/ComponentIcon-BXdiCGQp.js.map +0 -1
  346. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs +0 -157
  347. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +0 -1
  348. package/dist/_chunks/EditConfigurationPage-BwuIPOJG.mjs +0 -132
  349. package/dist/_chunks/EditConfigurationPage-BwuIPOJG.mjs.map +0 -1
  350. package/dist/_chunks/EditConfigurationPage-C1vjMBgy.js +0 -151
  351. package/dist/_chunks/EditConfigurationPage-C1vjMBgy.js.map +0 -1
  352. package/dist/_chunks/EditViewPage-0MiFkXa8.mjs +0 -203
  353. package/dist/_chunks/EditViewPage-0MiFkXa8.mjs.map +0 -1
  354. package/dist/_chunks/EditViewPage-DbcGfyqK.js +0 -222
  355. package/dist/_chunks/EditViewPage-DbcGfyqK.js.map +0 -1
  356. package/dist/_chunks/Field-BDMSCcy5.mjs +0 -5199
  357. package/dist/_chunks/Field-BDMSCcy5.mjs.map +0 -1
  358. package/dist/_chunks/Field-BG1xu38N.js +0 -5231
  359. package/dist/_chunks/Field-BG1xu38N.js.map +0 -1
  360. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs +0 -50
  361. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +0 -1
  362. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js +0 -49
  363. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +0 -1
  364. package/dist/_chunks/Form-9BnFyUjy.js +0 -757
  365. package/dist/_chunks/Form-9BnFyUjy.js.map +0 -1
  366. package/dist/_chunks/Form-CPVWavB8.mjs +0 -736
  367. package/dist/_chunks/Form-CPVWavB8.mjs.map +0 -1
  368. package/dist/_chunks/History-BVpd8LP3.mjs +0 -1007
  369. package/dist/_chunks/History-BVpd8LP3.mjs.map +0 -1
  370. package/dist/_chunks/History-BWWxLt2Z.js +0 -1028
  371. package/dist/_chunks/History-BWWxLt2Z.js.map +0 -1
  372. package/dist/_chunks/ListConfigurationPage-6swzjdAZ.js +0 -640
  373. package/dist/_chunks/ListConfigurationPage-6swzjdAZ.js.map +0 -1
  374. package/dist/_chunks/ListConfigurationPage-DozVMKcR.mjs +0 -620
  375. package/dist/_chunks/ListConfigurationPage-DozVMKcR.mjs.map +0 -1
  376. package/dist/_chunks/ListViewPage-BlzfjS2Q.js +0 -834
  377. package/dist/_chunks/ListViewPage-BlzfjS2Q.js.map +0 -1
  378. package/dist/_chunks/ListViewPage-Ds0ulgfG.mjs +0 -810
  379. package/dist/_chunks/ListViewPage-Ds0ulgfG.mjs.map +0 -1
  380. package/dist/_chunks/NoContentTypePage-BH11kaKt.mjs +0 -51
  381. package/dist/_chunks/NoContentTypePage-BH11kaKt.mjs.map +0 -1
  382. package/dist/_chunks/NoContentTypePage-D2nCCWEl.js +0 -51
  383. package/dist/_chunks/NoContentTypePage-D2nCCWEl.js.map +0 -1
  384. package/dist/_chunks/NoPermissionsPage-BT2Tn0D_.mjs +0 -23
  385. package/dist/_chunks/NoPermissionsPage-BT2Tn0D_.mjs.map +0 -1
  386. package/dist/_chunks/NoPermissionsPage-DN_JlsU2.js +0 -23
  387. package/dist/_chunks/NoPermissionsPage-DN_JlsU2.js.map +0 -1
  388. package/dist/_chunks/Relations-CcgFTcWo.js +0 -714
  389. package/dist/_chunks/Relations-CcgFTcWo.js.map +0 -1
  390. package/dist/_chunks/Relations-Dnag3fhV.mjs +0 -694
  391. package/dist/_chunks/Relations-Dnag3fhV.mjs.map +0 -1
  392. package/dist/_chunks/ar-BUUWXIYu.js +0 -226
  393. package/dist/_chunks/ar-BUUWXIYu.js.map +0 -1
  394. package/dist/_chunks/ar-CCEVvqGG.mjs +0 -226
  395. package/dist/_chunks/ca-5U32ON2v.mjs +0 -201
  396. package/dist/_chunks/ca-Cmk45QO6.js +0 -201
  397. package/dist/_chunks/cs-CM2aBUar.mjs +0 -125
  398. package/dist/_chunks/cs-CkJy6B2v.js +0 -125
  399. package/dist/_chunks/de-C72KDNOl.mjs +0 -199
  400. package/dist/_chunks/de-CCEmbAah.js +0 -199
  401. package/dist/_chunks/en-Ux26r5pl.mjs +0 -291
  402. package/dist/_chunks/en-fbKQxLGn.js +0 -291
  403. package/dist/_chunks/es-CeXiYflN.mjs +0 -196
  404. package/dist/_chunks/es-EUonQTon.js +0 -196
  405. package/dist/_chunks/eu-CdALomew.mjs +0 -202
  406. package/dist/_chunks/eu-VDH-3ovk.js +0 -202
  407. package/dist/_chunks/fr-B7kGGg3E.js +0 -206
  408. package/dist/_chunks/fr-B7kGGg3E.js.map +0 -1
  409. package/dist/_chunks/fr-CD9VFbPM.mjs +0 -206
  410. package/dist/_chunks/fr-CD9VFbPM.mjs.map +0 -1
  411. package/dist/_chunks/gu-BRmF601H.js +0 -200
  412. package/dist/_chunks/gu-CNpaMDpH.mjs +0 -200
  413. package/dist/_chunks/gu-CNpaMDpH.mjs.map +0 -1
  414. package/dist/_chunks/hi-CCJBptSq.js +0 -200
  415. package/dist/_chunks/hi-CCJBptSq.js.map +0 -1
  416. package/dist/_chunks/hi-Dwvd04m3.mjs +0 -200
  417. package/dist/_chunks/hi-Dwvd04m3.mjs.map +0 -1
  418. package/dist/_chunks/hooks-BAaaKPS_.js.map +0 -1
  419. package/dist/_chunks/hooks-E5u1mcgM.mjs +0 -8
  420. package/dist/_chunks/hooks-E5u1mcgM.mjs.map +0 -1
  421. package/dist/_chunks/hu-CeYvaaO0.mjs +0 -202
  422. package/dist/_chunks/hu-CeYvaaO0.mjs.map +0 -1
  423. package/dist/_chunks/hu-sNV_yLYy.js +0 -202
  424. package/dist/_chunks/hu-sNV_yLYy.js.map +0 -1
  425. package/dist/_chunks/id-B5Ser98A.js +0 -160
  426. package/dist/_chunks/id-B5Ser98A.js.map +0 -1
  427. package/dist/_chunks/id-BtwA9WJT.mjs +0 -160
  428. package/dist/_chunks/index-CWpLBSt0.js +0 -3778
  429. package/dist/_chunks/index-CWpLBSt0.js.map +0 -1
  430. package/dist/_chunks/index-JNNNKUHs.mjs +0 -3759
  431. package/dist/_chunks/index-JNNNKUHs.mjs.map +0 -1
  432. package/dist/_chunks/it-BrVPqaf1.mjs +0 -162
  433. package/dist/_chunks/it-DkBIs7vD.js +0 -162
  434. package/dist/_chunks/ja-CcFe8diO.js +0 -196
  435. package/dist/_chunks/ja-CtsUxOvk.mjs +0 -196
  436. package/dist/_chunks/ko-HVQRlfUI.mjs +0 -195
  437. package/dist/_chunks/ko-woFZPmLk.js +0 -195
  438. package/dist/_chunks/layout--iHdZzRk.js +0 -476
  439. package/dist/_chunks/layout--iHdZzRk.js.map +0 -1
  440. package/dist/_chunks/layout-DC503LnF.mjs +0 -458
  441. package/dist/_chunks/layout-DC503LnF.mjs.map +0 -1
  442. package/dist/_chunks/ml-BihZwQit.mjs +0 -200
  443. package/dist/_chunks/ml-BihZwQit.mjs.map +0 -1
  444. package/dist/_chunks/ml-C2W8N8k1.js +0 -200
  445. package/dist/_chunks/ml-C2W8N8k1.js.map +0 -1
  446. package/dist/_chunks/ms-BuFotyP_.js +0 -144
  447. package/dist/_chunks/ms-m_WjyWx7.mjs +0 -144
  448. package/dist/_chunks/nl-D4R9gHx5.mjs +0 -202
  449. package/dist/_chunks/nl-D4R9gHx5.mjs.map +0 -1
  450. package/dist/_chunks/nl-bbEOHChV.js +0 -202
  451. package/dist/_chunks/nl-bbEOHChV.js.map +0 -1
  452. package/dist/_chunks/objects-gigeqt7s.js +0 -49
  453. package/dist/_chunks/objects-gigeqt7s.js.map +0 -1
  454. package/dist/_chunks/objects-mKMAmfec.mjs +0 -47
  455. package/dist/_chunks/objects-mKMAmfec.mjs.map +0 -1
  456. package/dist/_chunks/pl-sbx9mSt_.mjs +0 -199
  457. package/dist/_chunks/pl-sbx9mSt_.mjs.map +0 -1
  458. package/dist/_chunks/pl-uzwG-hk7.js +0 -199
  459. package/dist/_chunks/pl-uzwG-hk7.js.map +0 -1
  460. package/dist/_chunks/pt-BR-BiOz37D9.js +0 -201
  461. package/dist/_chunks/pt-BR-C71iDxnh.mjs +0 -201
  462. package/dist/_chunks/pt-BsaFvS8-.mjs +0 -95
  463. package/dist/_chunks/pt-BsaFvS8-.mjs.map +0 -1
  464. package/dist/_chunks/pt-CeXQuq50.js +0 -95
  465. package/dist/_chunks/pt-CeXQuq50.js.map +0 -1
  466. package/dist/_chunks/relations-BbHizA5K.js +0 -134
  467. package/dist/_chunks/relations-BbHizA5K.js.map +0 -1
  468. package/dist/_chunks/relations-CTje5t-a.mjs +0 -135
  469. package/dist/_chunks/relations-CTje5t-a.mjs.map +0 -1
  470. package/dist/_chunks/ru-BE6A4Exp.mjs +0 -231
  471. package/dist/_chunks/ru-BT3ybNny.js +0 -231
  472. package/dist/_chunks/sa-CcvkYInH.js +0 -200
  473. package/dist/_chunks/sa-CcvkYInH.js.map +0 -1
  474. package/dist/_chunks/sa-Dag0k-Z8.mjs +0 -200
  475. package/dist/_chunks/sa-Dag0k-Z8.mjs.map +0 -1
  476. package/dist/_chunks/sk-BFg-R8qJ.mjs +0 -202
  477. package/dist/_chunks/sk-BFg-R8qJ.mjs.map +0 -1
  478. package/dist/_chunks/sk-CvY09Xjv.js +0 -202
  479. package/dist/_chunks/sk-CvY09Xjv.js.map +0 -1
  480. package/dist/_chunks/sv-CUnfWGsh.mjs +0 -202
  481. package/dist/_chunks/sv-CUnfWGsh.mjs.map +0 -1
  482. package/dist/_chunks/sv-MYDuzgvT.js +0 -202
  483. package/dist/_chunks/sv-MYDuzgvT.js.map +0 -1
  484. package/dist/_chunks/th-BqbI8lIT.mjs +0 -148
  485. package/dist/_chunks/th-BqbI8lIT.mjs.map +0 -1
  486. package/dist/_chunks/th-D9_GfAjc.js +0 -148
  487. package/dist/_chunks/tr-CgeK3wJM.mjs +0 -199
  488. package/dist/_chunks/tr-CgeK3wJM.mjs.map +0 -1
  489. package/dist/_chunks/tr-D9UH-O_R.js +0 -199
  490. package/dist/_chunks/tr-D9UH-O_R.js.map +0 -1
  491. package/dist/_chunks/uk-C8EiqJY7.js +0 -144
  492. package/dist/_chunks/uk-C8EiqJY7.js.map +0 -1
  493. package/dist/_chunks/uk-CR-zDhAY.mjs +0 -144
  494. package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs +0 -231
  495. package/dist/_chunks/useDragAndDrop-DdHgKsqq.mjs.map +0 -1
  496. package/dist/_chunks/useDragAndDrop-J0TUUbR6.js +0 -249
  497. package/dist/_chunks/useDragAndDrop-J0TUUbR6.js.map +0 -1
  498. package/dist/_chunks/usePrev-B9w_-eYc.js +0 -15
  499. package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
  500. package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
  501. package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
  502. package/dist/_chunks/vi-CJlYDheJ.js +0 -111
  503. package/dist/_chunks/vi-DUXIk_fw.mjs +0 -111
  504. package/dist/_chunks/zh-BWZspA60.mjs +0 -209
  505. package/dist/_chunks/zh-BWZspA60.mjs.map +0 -1
  506. package/dist/_chunks/zh-CQQfszqR.js +0 -209
  507. package/dist/_chunks/zh-CQQfszqR.js.map +0 -1
  508. package/dist/_chunks/zh-Hans-9kOncHGw.js +0 -952
  509. package/dist/_chunks/zh-Hans-BPQcRIyH.mjs +0 -952
  510. package/strapi-server.js +0 -3
@@ -1,3759 +0,0 @@
1
- import { ClockCounterClockwise, CrossCircle, More, WarningCircle, ListPlus, Pencil, Trash, Check, CheckCircle, ArrowsCounterClockwise, ChevronRight, Duplicate, Feather } from "@strapi/icons";
2
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
3
- import { useStrapiApp, useQueryParams, createContext, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useTracking, useForm, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
4
- import { stringify } from "qs";
5
- import { useIntl } from "react-intl";
6
- import { useNavigate, useParams, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
7
- import * as React from "react";
8
- import { lazy } from "react";
9
- import { Button, Menu, VisuallyHidden, Flex, Typography, Dialog, Modal, Radio, Status, SingleSelect, SingleSelectOption, Box, Loader, IconButton, Tooltip, LinkButton } from "@strapi/design-system";
10
- import { styled } from "styled-components";
11
- import * as yup from "yup";
12
- import { ValidationError } from "yup";
13
- import pipe from "lodash/fp/pipe";
14
- import { intervalToDuration, isPast } from "date-fns";
15
- import { createSlice, combineReducers } from "@reduxjs/toolkit";
16
- const __variableDynamicImportRuntimeHelper = (glob, path) => {
17
- const v = glob[path];
18
- if (v) {
19
- return typeof v === "function" ? v() : Promise.resolve(v);
20
- }
21
- return new Promise((_, reject) => {
22
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path)));
23
- });
24
- };
25
- const PLUGIN_ID = "content-manager";
26
- const PERMISSIONS = [
27
- "plugin::content-manager.explorer.create",
28
- "plugin::content-manager.explorer.read",
29
- "plugin::content-manager.explorer.update",
30
- "plugin::content-manager.explorer.delete",
31
- "plugin::content-manager.explorer.publish"
32
- ];
33
- const INJECTION_ZONES = {
34
- editView: { informations: [], "right-links": [] },
35
- listView: {
36
- actions: [],
37
- deleteModalAdditionalInfos: [],
38
- publishModalAdditionalInfos: [],
39
- unpublishModalAdditionalInfos: []
40
- }
41
- };
42
- const InjectionZone = ({ area, ...props }) => {
43
- const components = useInjectionZone(area);
44
- return /* @__PURE__ */ jsx(Fragment, { children: components.map((component) => /* @__PURE__ */ jsx(component.Component, { ...props }, component.name)) });
45
- };
46
- const useInjectionZone = (area) => {
47
- const getPlugin = useStrapiApp("useInjectionZone", (state) => state.getPlugin);
48
- const contentManagerPlugin = getPlugin(PLUGIN_ID);
49
- const [page, position] = area.split(".");
50
- return contentManagerPlugin.getInjectedComponents(page, position);
51
- };
52
- const HistoryAction = ({ model, document }) => {
53
- const { formatMessage } = useIntl();
54
- const [{ query }] = useQueryParams();
55
- const navigate = useNavigate();
56
- const pluginsQueryParams = stringify({ plugins: query.plugins }, { encode: false });
57
- if (!window.strapi.features.isEnabled("cms-content-history")) {
58
- return null;
59
- }
60
- return {
61
- icon: /* @__PURE__ */ jsx(ClockCounterClockwise, {}),
62
- label: formatMessage({
63
- id: "content-manager.history.document-action",
64
- defaultMessage: "Content History"
65
- }),
66
- onClick: () => navigate({ pathname: "history", search: pluginsQueryParams }),
67
- disabled: (
68
- /**
69
- * The user is creating a new document.
70
- * It hasn't been saved yet, so there's no history to go to
71
- */
72
- !document || /**
73
- * The document has been created but the current dimension has never been saved.
74
- * For example, the user is creating a new locale in an existing document,
75
- * so there's no history for the document in that locale
76
- */
77
- !document.id || /**
78
- * History is only available for content types created by the user.
79
- * These have the `api::` prefix, as opposed to the ones created by Strapi or plugins,
80
- * which start with `admin::` or `plugin::`
81
- */
82
- !model.startsWith("api::")
83
- ),
84
- position: "header"
85
- };
86
- };
87
- HistoryAction.type = "history";
88
- const ID = "id";
89
- const CREATED_BY_ATTRIBUTE_NAME = "createdBy";
90
- const UPDATED_BY_ATTRIBUTE_NAME = "updatedBy";
91
- const CREATOR_FIELDS = [CREATED_BY_ATTRIBUTE_NAME, UPDATED_BY_ATTRIBUTE_NAME];
92
- const PUBLISHED_BY_ATTRIBUTE_NAME = "publishedBy";
93
- const CREATED_AT_ATTRIBUTE_NAME = "createdAt";
94
- const UPDATED_AT_ATTRIBUTE_NAME = "updatedAt";
95
- const PUBLISHED_AT_ATTRIBUTE_NAME = "publishedAt";
96
- const DOCUMENT_META_FIELDS = [
97
- ID,
98
- ...CREATOR_FIELDS,
99
- PUBLISHED_BY_ATTRIBUTE_NAME,
100
- CREATED_AT_ATTRIBUTE_NAME,
101
- UPDATED_AT_ATTRIBUTE_NAME,
102
- PUBLISHED_AT_ATTRIBUTE_NAME
103
- ];
104
- const ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD = [
105
- "dynamiczone",
106
- "json",
107
- "text",
108
- "relation",
109
- "component",
110
- "boolean",
111
- "media",
112
- "password",
113
- "richtext",
114
- "timestamp",
115
- "blocks"
116
- ];
117
- const SINGLE_TYPES = "single-types";
118
- const COLLECTION_TYPES = "collection-types";
119
- const [DocumentRBACProvider, useDocumentRBAC] = createContext(
120
- "DocumentRBAC",
121
- {
122
- canCreate: false,
123
- canCreateFields: [],
124
- canDelete: false,
125
- canPublish: false,
126
- canRead: false,
127
- canReadFields: [],
128
- canUpdate: false,
129
- canUpdateFields: [],
130
- canUserAction: () => false,
131
- isLoading: false
132
- }
133
- );
134
- const DocumentRBAC = ({ children, permissions }) => {
135
- const { slug } = useParams();
136
- if (!slug) {
137
- throw new Error("Cannot find the slug param in the URL");
138
- }
139
- const userPermissions = useAuth("DocumentRBAC", (state) => state.permissions);
140
- const contentTypePermissions = React.useMemo(() => {
141
- const contentTypePermissions2 = userPermissions.filter(
142
- (permission) => permission.subject === slug
143
- );
144
- return contentTypePermissions2.reduce((acc, permission) => {
145
- const [action] = permission.action.split(".").slice(-1);
146
- return { ...acc, [action]: [permission] };
147
- }, {});
148
- }, [slug, userPermissions]);
149
- const { isLoading, allowedActions } = useRBAC(contentTypePermissions, permissions ?? void 0);
150
- const canCreateFields = !isLoading && allowedActions.canCreate ? extractAndDedupeFields(contentTypePermissions.create) : [];
151
- const canReadFields = !isLoading && allowedActions.canRead ? extractAndDedupeFields(contentTypePermissions.read) : [];
152
- const canUpdateFields = !isLoading && allowedActions.canUpdate ? extractAndDedupeFields(contentTypePermissions.update) : [];
153
- const canUserAction = React.useCallback(
154
- (fieldName, fieldsUserCanAction, fieldType) => {
155
- const name = removeNumericalStrings(fieldName.split("."));
156
- const componentFieldNames = fieldsUserCanAction.filter((field) => field.split(".").length > 1);
157
- if (fieldType === "component") {
158
- return componentFieldNames.some((field) => {
159
- return field.includes(name.join("."));
160
- });
161
- }
162
- if (name.length > 1) {
163
- return componentFieldNames.includes(name.join("."));
164
- }
165
- return fieldsUserCanAction.includes(fieldName);
166
- },
167
- []
168
- );
169
- if (isLoading) {
170
- return /* @__PURE__ */ jsx(Page.Loading, {});
171
- }
172
- return /* @__PURE__ */ jsx(
173
- DocumentRBACProvider,
174
- {
175
- isLoading,
176
- canCreateFields,
177
- canReadFields,
178
- canUpdateFields,
179
- canUserAction,
180
- ...allowedActions,
181
- children
182
- }
183
- );
184
- };
185
- const extractAndDedupeFields = (permissions = []) => permissions.flatMap((permission) => permission.properties?.fields).filter(
186
- (field, index2, arr) => arr.indexOf(field) === index2 && typeof field === "string"
187
- );
188
- const removeNumericalStrings = (arr) => arr.filter((item) => isNaN(Number(item)));
189
- const contentManagerApi = adminApi.enhanceEndpoints({
190
- addTagTypes: [
191
- "ComponentConfiguration",
192
- "ContentTypesConfiguration",
193
- "ContentTypeSettings",
194
- "Document",
195
- "InitialData",
196
- "HistoryVersion",
197
- "Relations"
198
- ]
199
- });
200
- const documentApi = contentManagerApi.injectEndpoints({
201
- endpoints: (builder) => ({
202
- autoCloneDocument: builder.mutation({
203
- query: ({ model, sourceId, query }) => ({
204
- url: `/content-manager/collection-types/${model}/auto-clone/${sourceId}`,
205
- method: "POST",
206
- config: {
207
- params: query
208
- }
209
- }),
210
- invalidatesTags: (_result, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
211
- }),
212
- cloneDocument: builder.mutation({
213
- query: ({ model, sourceId, data, params }) => ({
214
- url: `/content-manager/collection-types/${model}/clone/${sourceId}`,
215
- method: "POST",
216
- data,
217
- config: {
218
- params
219
- }
220
- }),
221
- invalidatesTags: (_result, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
222
- }),
223
- /**
224
- * Creates a new collection-type document. This should ONLY be used for collection-types.
225
- * single-types should always be using `updateDocument` since they always exist.
226
- */
227
- createDocument: builder.mutation({
228
- query: ({ model, data, params }) => ({
229
- url: `/content-manager/collection-types/${model}`,
230
- method: "POST",
231
- data,
232
- config: {
233
- params
234
- }
235
- }),
236
- invalidatesTags: (result, _error, { model }) => [
237
- { type: "Document", id: `${model}_LIST` },
238
- "Relations"
239
- ]
240
- }),
241
- deleteDocument: builder.mutation({
242
- query: ({ collectionType, model, documentId, params }) => ({
243
- url: `/content-manager/${collectionType}/${model}${collectionType !== SINGLE_TYPES && documentId ? `/${documentId}` : ""}`,
244
- method: "DELETE",
245
- config: {
246
- params
247
- }
248
- }),
249
- invalidatesTags: (_result, _error, { collectionType, model }) => [
250
- { type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
251
- ]
252
- }),
253
- deleteManyDocuments: builder.mutation({
254
- query: ({ model, params, ...body }) => ({
255
- url: `/content-manager/collection-types/${model}/actions/bulkDelete`,
256
- method: "POST",
257
- data: body,
258
- config: {
259
- params
260
- }
261
- }),
262
- invalidatesTags: (_res, _error, { model }) => [{ type: "Document", id: `${model}_LIST` }]
263
- }),
264
- discardDocument: builder.mutation({
265
- query: ({ collectionType, model, documentId, params }) => ({
266
- url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/discard` : `/content-manager/${collectionType}/${model}/actions/discard`,
267
- method: "POST",
268
- config: {
269
- params
270
- }
271
- }),
272
- invalidatesTags: (_result, _error, { collectionType, model, documentId }) => {
273
- return [
274
- {
275
- type: "Document",
276
- id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
277
- },
278
- { type: "Document", id: `${model}_LIST` },
279
- "Relations"
280
- ];
281
- }
282
- }),
283
- /**
284
- * Gets all documents of a collection type or single type.
285
- * By passing different params you can get different results e.g. only published documents or 'es' documents.
286
- */
287
- getAllDocuments: builder.query({
288
- query: ({ model, params }) => ({
289
- url: `/content-manager/collection-types/${model}`,
290
- method: "GET",
291
- config: {
292
- params
293
- }
294
- }),
295
- providesTags: (result, _error, arg) => {
296
- return [
297
- { type: "Document", id: `${arg.model}_LIST` },
298
- ...result?.results.map(({ documentId }) => ({
299
- type: "Document",
300
- id: `${arg.model}_${documentId}`
301
- })) ?? []
302
- ];
303
- }
304
- }),
305
- getDraftRelationCount: builder.query({
306
- query: ({ collectionType, model, documentId, params }) => ({
307
- url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/countDraftRelations` : `/content-manager/${collectionType}/${model}/actions/countDraftRelations`,
308
- method: "GET",
309
- config: {
310
- params
311
- }
312
- })
313
- }),
314
- getDocument: builder.query({
315
- // @ts-expect-error – TODO: fix ts error where data unknown doesn't work with response via an assertion?
316
- queryFn: async ({ collectionType, model, documentId, params }, _api, _extraOpts, baseQuery) => {
317
- const res = await baseQuery({
318
- url: `/content-manager/${collectionType}/${model}${documentId ? `/${documentId}` : ""}`,
319
- method: "GET",
320
- config: {
321
- params
322
- }
323
- });
324
- if (res.error && res.error.name === "NotFoundError" && collectionType === SINGLE_TYPES) {
325
- return { data: { document: void 0 }, error: void 0 };
326
- }
327
- return res;
328
- },
329
- providesTags: (result, _error, { collectionType, model, documentId }) => {
330
- return [
331
- // we prefer the result's id because we don't fetch single-types with an ID.
332
- {
333
- type: "Document",
334
- id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
335
- }
336
- ];
337
- }
338
- }),
339
- getManyDraftRelationCount: builder.query({
340
- query: ({ model, ...params }) => ({
341
- url: `/content-manager/collection-types/${model}/actions/countManyEntriesDraftRelations`,
342
- method: "GET",
343
- config: {
344
- params
345
- }
346
- }),
347
- transformResponse: (response) => response.data
348
- }),
349
- /**
350
- * This endpoint will either create or update documents at the same time as publishing.
351
- */
352
- publishDocument: builder.mutation({
353
- query: ({ collectionType, model, documentId, params, data }) => ({
354
- url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/publish` : `/content-manager/${collectionType}/${model}/actions/publish`,
355
- method: "POST",
356
- data,
357
- config: {
358
- params
359
- }
360
- }),
361
- invalidatesTags: (_result, _error, { collectionType, model, documentId }) => {
362
- return [
363
- {
364
- type: "Document",
365
- id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
366
- },
367
- { type: "Document", id: `${model}_LIST` },
368
- "Relations"
369
- ];
370
- }
371
- }),
372
- publishManyDocuments: builder.mutation({
373
- query: ({ model, params, ...body }) => ({
374
- url: `/content-manager/collection-types/${model}/actions/bulkPublish`,
375
- method: "POST",
376
- data: body,
377
- config: {
378
- params
379
- }
380
- }),
381
- invalidatesTags: (_res, _error, { model, documentIds }) => documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` }))
382
- }),
383
- updateDocument: builder.mutation({
384
- query: ({ collectionType, model, documentId, data, params }) => ({
385
- url: `/content-manager/${collectionType}/${model}${documentId ? `/${documentId}` : ""}`,
386
- method: "PUT",
387
- data,
388
- config: {
389
- params
390
- }
391
- }),
392
- invalidatesTags: (_result, _error, { collectionType, model, documentId }) => {
393
- return [
394
- {
395
- type: "Document",
396
- id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
397
- },
398
- "Relations"
399
- ];
400
- }
401
- }),
402
- unpublishDocument: builder.mutation({
403
- query: ({ collectionType, model, documentId, params, data }) => ({
404
- url: documentId ? `/content-manager/${collectionType}/${model}/${documentId}/actions/unpublish` : `/content-manager/${collectionType}/${model}/actions/unpublish`,
405
- method: "POST",
406
- data,
407
- config: {
408
- params
409
- }
410
- }),
411
- invalidatesTags: (_result, _error, { collectionType, model, documentId }) => {
412
- return [
413
- {
414
- type: "Document",
415
- id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
416
- }
417
- ];
418
- }
419
- }),
420
- unpublishManyDocuments: builder.mutation({
421
- query: ({ model, params, ...body }) => ({
422
- url: `/content-manager/collection-types/${model}/actions/bulkUnpublish`,
423
- method: "POST",
424
- data: body,
425
- config: {
426
- params
427
- }
428
- }),
429
- invalidatesTags: (_res, _error, { model, documentIds }) => documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` }))
430
- })
431
- })
432
- });
433
- const {
434
- useAutoCloneDocumentMutation,
435
- useCloneDocumentMutation,
436
- useCreateDocumentMutation,
437
- useDeleteDocumentMutation,
438
- useDeleteManyDocumentsMutation,
439
- useDiscardDocumentMutation,
440
- useGetAllDocumentsQuery,
441
- useLazyGetDocumentQuery,
442
- useGetDocumentQuery,
443
- useLazyGetDraftRelationCountQuery,
444
- useGetManyDraftRelationCountQuery,
445
- usePublishDocumentMutation,
446
- usePublishManyDocumentsMutation,
447
- useUpdateDocumentMutation,
448
- useUnpublishDocumentMutation,
449
- useUnpublishManyDocumentsMutation
450
- } = documentApi;
451
- const buildValidParams = (query) => {
452
- if (!query)
453
- return query;
454
- const { plugins: _, ...validQueryParams } = {
455
- ...query,
456
- ...Object.values(query?.plugins ?? {}).reduce(
457
- (acc, current) => Object.assign(acc, current),
458
- {}
459
- )
460
- };
461
- if ("_q" in validQueryParams) {
462
- validQueryParams._q = encodeURIComponent(validQueryParams._q);
463
- }
464
- return validQueryParams;
465
- };
466
- const isBaseQueryError = (error) => {
467
- return error.name !== void 0;
468
- };
469
- const createYupSchema = (attributes = {}, components = {}) => {
470
- const createModelSchema = (attributes2) => yup.object().shape(
471
- Object.entries(attributes2).reduce((acc, [name, attribute]) => {
472
- if (DOCUMENT_META_FIELDS.includes(name)) {
473
- return acc;
474
- }
475
- const validations = [
476
- addRequiredValidation,
477
- addMinLengthValidation,
478
- addMaxLengthValidation,
479
- addMinValidation,
480
- addMaxValidation,
481
- addRegexValidation
482
- ].map((fn) => fn(attribute));
483
- const transformSchema = pipe(...validations);
484
- switch (attribute.type) {
485
- case "component": {
486
- const { attributes: attributes3 } = components[attribute.component];
487
- if (attribute.repeatable) {
488
- return {
489
- ...acc,
490
- [name]: transformSchema(
491
- yup.array().of(createModelSchema(attributes3).nullable(false))
492
- )
493
- };
494
- } else {
495
- return {
496
- ...acc,
497
- [name]: transformSchema(createModelSchema(attributes3))
498
- };
499
- }
500
- }
501
- case "dynamiczone":
502
- return {
503
- ...acc,
504
- [name]: transformSchema(
505
- yup.array().of(
506
- yup.lazy(
507
- (data) => {
508
- const attributes3 = components?.[data?.__component]?.attributes;
509
- const validation = yup.object().shape({
510
- __component: yup.string().required().oneOf(Object.keys(components))
511
- }).nullable(false);
512
- if (!attributes3) {
513
- return validation;
514
- }
515
- return validation.concat(createModelSchema(attributes3));
516
- }
517
- )
518
- )
519
- )
520
- };
521
- case "relation":
522
- return {
523
- ...acc,
524
- [name]: transformSchema(
525
- yup.lazy((value) => {
526
- if (!value) {
527
- return yup.mixed().nullable(true);
528
- } else if (Array.isArray(value)) {
529
- return yup.array().of(
530
- yup.object().shape({
531
- id: yup.string().required()
532
- })
533
- );
534
- } else if (typeof value === "object") {
535
- return yup.object();
536
- } else {
537
- return yup.mixed().test(
538
- "type-error",
539
- "Relation values must be either null, an array of objects with {id} or an object.",
540
- () => false
541
- );
542
- }
543
- })
544
- )
545
- };
546
- default:
547
- return {
548
- ...acc,
549
- [name]: transformSchema(createAttributeSchema(attribute))
550
- };
551
- }
552
- }, {})
553
- ).default(null);
554
- return createModelSchema(attributes);
555
- };
556
- const createAttributeSchema = (attribute) => {
557
- switch (attribute.type) {
558
- case "biginteger":
559
- return yup.string().matches(/^-?\d*$/);
560
- case "boolean":
561
- return yup.boolean();
562
- case "blocks":
563
- return yup.mixed().test("isBlocks", translatedErrors.json, (value) => {
564
- if (!value || Array.isArray(value)) {
565
- return true;
566
- } else {
567
- return false;
568
- }
569
- });
570
- case "decimal":
571
- case "float":
572
- case "integer":
573
- return yup.number();
574
- case "email":
575
- return yup.string().email(translatedErrors.email);
576
- case "enumeration":
577
- return yup.string().oneOf([...attribute.enum, null]);
578
- case "json":
579
- return yup.mixed().test("isJSON", translatedErrors.json, (value) => {
580
- if (!value || typeof value === "string" && value.length === 0) {
581
- return true;
582
- }
583
- try {
584
- JSON.parse(value);
585
- return true;
586
- } catch (err) {
587
- return false;
588
- }
589
- });
590
- case "password":
591
- case "richtext":
592
- case "string":
593
- case "text":
594
- return yup.string();
595
- case "uid":
596
- return yup.string().matches(/^[A-Za-z0-9-_.~]*$/);
597
- default:
598
- return yup.mixed();
599
- }
600
- };
601
- const addRequiredValidation = (attribute) => (schema) => {
602
- if (attribute.required) {
603
- return schema.required({
604
- id: translatedErrors.required.id,
605
- defaultMessage: "This field is required."
606
- });
607
- }
608
- return schema?.nullable ? schema.nullable() : (
609
- // In some cases '.nullable' will not be available on the schema.
610
- // e.g. when the schema has been built using yup.lazy (e.g. for relations).
611
- // In these cases we should just return the schema as it is.
612
- schema
613
- );
614
- };
615
- const addMinLengthValidation = (attribute) => (schema) => {
616
- if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
617
- return schema.min(attribute.minLength, {
618
- ...translatedErrors.minLength,
619
- values: {
620
- min: attribute.minLength
621
- }
622
- });
623
- }
624
- return schema;
625
- };
626
- const addMaxLengthValidation = (attribute) => (schema) => {
627
- if ("maxLength" in attribute && attribute.maxLength && Number.isInteger(attribute.maxLength) && "max" in schema) {
628
- return schema.max(attribute.maxLength, {
629
- ...translatedErrors.maxLength,
630
- values: {
631
- max: attribute.maxLength
632
- }
633
- });
634
- }
635
- return schema;
636
- };
637
- const addMinValidation = (attribute) => (schema) => {
638
- if ("min" in attribute) {
639
- const min = toInteger(attribute.min);
640
- if ("min" in schema && min) {
641
- return schema.min(min, {
642
- ...translatedErrors.min,
643
- values: {
644
- min
645
- }
646
- });
647
- }
648
- }
649
- return schema;
650
- };
651
- const addMaxValidation = (attribute) => (schema) => {
652
- if ("max" in attribute) {
653
- const max = toInteger(attribute.max);
654
- if ("max" in schema && max) {
655
- return schema.max(max, {
656
- ...translatedErrors.max,
657
- values: {
658
- max
659
- }
660
- });
661
- }
662
- }
663
- return schema;
664
- };
665
- const toInteger = (val) => {
666
- if (typeof val === "number" || val === void 0) {
667
- return val;
668
- } else {
669
- const num = Number(val);
670
- return isNaN(num) ? void 0 : num;
671
- }
672
- };
673
- const addRegexValidation = (attribute) => (schema) => {
674
- if ("regex" in attribute && attribute.regex && "matches" in schema) {
675
- return schema.matches(new RegExp(attribute.regex), {
676
- message: {
677
- id: translatedErrors.regex.id,
678
- defaultMessage: "The value does not match the defined pattern."
679
- },
680
- excludeEmptyString: !attribute.required
681
- });
682
- }
683
- return schema;
684
- };
685
- const initApi = contentManagerApi.injectEndpoints({
686
- endpoints: (builder) => ({
687
- getInitialData: builder.query({
688
- query: () => "/content-manager/init",
689
- transformResponse: (response) => response.data,
690
- providesTags: ["InitialData"]
691
- })
692
- })
693
- });
694
- const { useGetInitialDataQuery } = initApi;
695
- const useContentTypeSchema = (model) => {
696
- const { toggleNotification } = useNotification();
697
- const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
698
- const { data, error, isLoading, isFetching } = useGetInitialDataQuery(void 0);
699
- const { components, contentType, contentTypes } = React.useMemo(() => {
700
- const contentType2 = data?.contentTypes.find((ct) => ct.uid === model);
701
- const componentsByKey = data?.components.reduce((acc, component) => {
702
- acc[component.uid] = component;
703
- return acc;
704
- }, {});
705
- const components2 = extractContentTypeComponents(contentType2?.attributes, componentsByKey);
706
- return {
707
- components: Object.keys(components2).length === 0 ? void 0 : components2,
708
- contentType: contentType2,
709
- contentTypes: data?.contentTypes ?? []
710
- };
711
- }, [model, data]);
712
- React.useEffect(() => {
713
- if (error) {
714
- toggleNotification({
715
- type: "danger",
716
- message: formatAPIError(error)
717
- });
718
- }
719
- }, [toggleNotification, error, formatAPIError]);
720
- return {
721
- // This must be memoized to avoid inifiinite re-renders where the empty object is different everytime.
722
- components: React.useMemo(() => components ?? {}, [components]),
723
- schema: contentType,
724
- schemas: contentTypes,
725
- isLoading: isLoading || isFetching
726
- };
727
- };
728
- const extractContentTypeComponents = (attributes = {}, allComponents = {}) => {
729
- const getComponents = (attributes2) => {
730
- return attributes2.reduce((acc, attribute) => {
731
- if (attribute.type === "component") {
732
- const componentAttributes = Object.values(
733
- allComponents[attribute.component]?.attributes ?? {}
734
- );
735
- acc.push(attribute.component, ...getComponents(componentAttributes));
736
- } else if (attribute.type === "dynamiczone") {
737
- acc.push(
738
- ...attribute.components,
739
- ...attribute.components.flatMap((componentUid) => {
740
- const componentAttributes = Object.values(
741
- allComponents[componentUid]?.attributes ?? {}
742
- );
743
- return getComponents(componentAttributes);
744
- })
745
- );
746
- }
747
- return acc;
748
- }, []);
749
- };
750
- const componentUids = getComponents(Object.values(attributes));
751
- const uniqueComponentUids = [...new Set(componentUids)];
752
- const componentsByKey = uniqueComponentUids.reduce((acc, uid) => {
753
- acc[uid] = allComponents[uid];
754
- return acc;
755
- }, {});
756
- return componentsByKey;
757
- };
758
- const useDocument = (args, opts) => {
759
- const { toggleNotification } = useNotification();
760
- const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
761
- const {
762
- currentData: data,
763
- isLoading: isLoadingDocument,
764
- isFetching: isFetchingDocument,
765
- error
766
- } = useGetDocumentQuery(args, opts);
767
- const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
768
- React.useEffect(() => {
769
- if (error) {
770
- toggleNotification({
771
- type: "danger",
772
- message: formatAPIError(error)
773
- });
774
- }
775
- }, [toggleNotification, error, formatAPIError, args.collectionType]);
776
- const validationSchema = React.useMemo(() => {
777
- if (!schema) {
778
- return null;
779
- }
780
- return createYupSchema(schema.attributes, components);
781
- }, [schema, components]);
782
- const validate = React.useCallback(
783
- (document) => {
784
- if (!validationSchema) {
785
- throw new Error(
786
- "There is no validation schema generated, this is likely due to the schema not being loaded yet."
787
- );
788
- }
789
- try {
790
- validationSchema.validateSync(document, { abortEarly: false, strict: true });
791
- return null;
792
- } catch (error2) {
793
- if (error2 instanceof ValidationError) {
794
- return getYupValidationErrors(error2);
795
- }
796
- throw error2;
797
- }
798
- },
799
- [validationSchema]
800
- );
801
- const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
802
- return {
803
- components,
804
- document: data?.data,
805
- meta: data?.meta,
806
- isLoading,
807
- schema,
808
- validate
809
- };
810
- };
811
- const useDoc = () => {
812
- const { id, slug, collectionType, origin } = useParams();
813
- const [{ query }] = useQueryParams();
814
- const params = React.useMemo(() => buildValidParams(query), [query]);
815
- if (!collectionType) {
816
- throw new Error("Could not find collectionType in url params");
817
- }
818
- if (!slug) {
819
- throw new Error("Could not find model in url params");
820
- }
821
- return {
822
- collectionType,
823
- model: slug,
824
- id: origin || id === "create" ? void 0 : id,
825
- ...useDocument(
826
- { documentId: origin || id, model: slug, collectionType, params },
827
- {
828
- skip: id === "create" || !origin && !id && collectionType !== SINGLE_TYPES
829
- }
830
- )
831
- };
832
- };
833
- const prefixPluginTranslations = (trad, pluginId) => {
834
- if (!pluginId) {
835
- throw new TypeError("pluginId can't be empty");
836
- }
837
- return Object.keys(trad).reduce((acc, current) => {
838
- acc[`${pluginId}.${current}`] = trad[current];
839
- return acc;
840
- }, {});
841
- };
842
- const getTranslation = (id) => `content-manager.${id}`;
843
- const DEFAULT_UNEXPECTED_ERROR_MSG = {
844
- id: "notification.error",
845
- defaultMessage: "An error occurred, please try again"
846
- };
847
- const useDocumentActions = () => {
848
- const { toggleNotification } = useNotification();
849
- const { formatMessage } = useIntl();
850
- const { trackUsage } = useTracking();
851
- const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
852
- const [deleteDocument] = useDeleteDocumentMutation();
853
- const _delete = React.useCallback(
854
- async ({ collectionType, model, documentId, params }, trackerProperty) => {
855
- try {
856
- trackUsage("willDeleteEntry", trackerProperty);
857
- const res = await deleteDocument({
858
- collectionType,
859
- model,
860
- documentId,
861
- params
862
- });
863
- if ("error" in res) {
864
- toggleNotification({
865
- type: "danger",
866
- message: formatAPIError(res.error)
867
- });
868
- return { error: res.error };
869
- }
870
- toggleNotification({
871
- type: "success",
872
- message: formatMessage({
873
- id: getTranslation("success.record.delete"),
874
- defaultMessage: "Deleted document"
875
- })
876
- });
877
- trackUsage("didDeleteEntry", trackerProperty);
878
- return res.data;
879
- } catch (err) {
880
- toggleNotification({
881
- type: "danger",
882
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
883
- });
884
- trackUsage("didNotDeleteEntry", { error: err, ...trackerProperty });
885
- throw err;
886
- }
887
- },
888
- [trackUsage, deleteDocument, toggleNotification, formatMessage, formatAPIError]
889
- );
890
- const [deleteManyDocuments] = useDeleteManyDocumentsMutation();
891
- const deleteMany = React.useCallback(
892
- async ({ model, documentIds, params }) => {
893
- try {
894
- trackUsage("willBulkDeleteEntries");
895
- const res = await deleteManyDocuments({
896
- model,
897
- documentIds,
898
- params
899
- });
900
- if ("error" in res) {
901
- toggleNotification({
902
- type: "danger",
903
- message: formatAPIError(res.error)
904
- });
905
- return { error: res.error };
906
- }
907
- toggleNotification({
908
- type: "success",
909
- title: formatMessage({
910
- id: getTranslation("success.records.delete"),
911
- defaultMessage: "Successfully deleted."
912
- }),
913
- message: ""
914
- });
915
- trackUsage("didBulkDeleteEntries");
916
- return res.data;
917
- } catch (err) {
918
- toggleNotification({
919
- type: "danger",
920
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
921
- });
922
- trackUsage("didNotBulkDeleteEntries");
923
- throw err;
924
- }
925
- },
926
- [trackUsage, deleteManyDocuments, toggleNotification, formatMessage, formatAPIError]
927
- );
928
- const [discardDocument] = useDiscardDocumentMutation();
929
- const discard = React.useCallback(
930
- async ({ collectionType, model, documentId, params }) => {
931
- try {
932
- const res = await discardDocument({
933
- collectionType,
934
- model,
935
- documentId,
936
- params
937
- });
938
- if ("error" in res) {
939
- toggleNotification({
940
- type: "danger",
941
- message: formatAPIError(res.error)
942
- });
943
- return { error: res.error };
944
- }
945
- toggleNotification({
946
- type: "success",
947
- message: formatMessage({
948
- id: "content-manager.success.record.discard",
949
- defaultMessage: "Changes discarded"
950
- })
951
- });
952
- return res.data;
953
- } catch (err) {
954
- toggleNotification({
955
- type: "danger",
956
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
957
- });
958
- throw err;
959
- }
960
- },
961
- [discardDocument, formatAPIError, formatMessage, toggleNotification]
962
- );
963
- const [publishDocument] = usePublishDocumentMutation();
964
- const publish = React.useCallback(
965
- async ({ collectionType, model, documentId, params }, data) => {
966
- try {
967
- trackUsage("willPublishEntry");
968
- const res = await publishDocument({
969
- collectionType,
970
- model,
971
- documentId,
972
- data,
973
- params
974
- });
975
- if ("error" in res) {
976
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
977
- return { error: res.error };
978
- }
979
- trackUsage("didPublishEntry");
980
- toggleNotification({
981
- type: "success",
982
- message: formatMessage({
983
- id: getTranslation("success.record.publish"),
984
- defaultMessage: "Published document"
985
- })
986
- });
987
- return res.data;
988
- } catch (err) {
989
- toggleNotification({
990
- type: "danger",
991
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
992
- });
993
- throw err;
994
- }
995
- },
996
- [trackUsage, publishDocument, toggleNotification, formatMessage, formatAPIError]
997
- );
998
- const [publishManyDocuments] = usePublishManyDocumentsMutation();
999
- const publishMany = React.useCallback(
1000
- async ({ model, documentIds, params }) => {
1001
- try {
1002
- const res = await publishManyDocuments({
1003
- model,
1004
- documentIds,
1005
- params
1006
- });
1007
- if ("error" in res) {
1008
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1009
- return { error: res.error };
1010
- }
1011
- toggleNotification({
1012
- type: "success",
1013
- message: formatMessage({
1014
- id: getTranslation("success.record.publish"),
1015
- defaultMessage: "Published document"
1016
- })
1017
- });
1018
- return res.data;
1019
- } catch (err) {
1020
- toggleNotification({
1021
- type: "danger",
1022
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
1023
- });
1024
- throw err;
1025
- }
1026
- },
1027
- [
1028
- // trackUsage,
1029
- publishManyDocuments,
1030
- toggleNotification,
1031
- formatMessage,
1032
- formatAPIError
1033
- ]
1034
- );
1035
- const [updateDocument] = useUpdateDocumentMutation();
1036
- const update = React.useCallback(
1037
- async ({ collectionType, model, documentId, params }, data, trackerProperty) => {
1038
- try {
1039
- trackUsage("willEditEntry", trackerProperty);
1040
- const res = await updateDocument({
1041
- collectionType,
1042
- model,
1043
- documentId,
1044
- data,
1045
- params
1046
- });
1047
- if ("error" in res) {
1048
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1049
- trackUsage("didNotEditEntry", { error: res.error, ...trackerProperty });
1050
- return { error: res.error };
1051
- }
1052
- trackUsage("didEditEntry", trackerProperty);
1053
- toggleNotification({
1054
- type: "success",
1055
- message: formatMessage({
1056
- id: getTranslation("success.record.save"),
1057
- defaultMessage: "Saved document"
1058
- })
1059
- });
1060
- return res.data;
1061
- } catch (err) {
1062
- trackUsage("didNotEditEntry", { error: err, ...trackerProperty });
1063
- toggleNotification({
1064
- type: "danger",
1065
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
1066
- });
1067
- throw err;
1068
- }
1069
- },
1070
- [trackUsage, updateDocument, toggleNotification, formatMessage, formatAPIError]
1071
- );
1072
- const [unpublishDocument] = useUnpublishDocumentMutation();
1073
- const unpublish = React.useCallback(
1074
- async ({ collectionType, model, documentId, params }, discardDraft = false) => {
1075
- try {
1076
- trackUsage("willUnpublishEntry");
1077
- const res = await unpublishDocument({
1078
- collectionType,
1079
- model,
1080
- documentId,
1081
- params,
1082
- data: {
1083
- discardDraft
1084
- }
1085
- });
1086
- if ("error" in res) {
1087
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1088
- return { error: res.error };
1089
- }
1090
- trackUsage("didUnpublishEntry");
1091
- toggleNotification({
1092
- type: "success",
1093
- message: formatMessage({
1094
- id: getTranslation("success.record.unpublish"),
1095
- defaultMessage: "Unpublished document"
1096
- })
1097
- });
1098
- return res.data;
1099
- } catch (err) {
1100
- toggleNotification({
1101
- type: "danger",
1102
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
1103
- });
1104
- throw err;
1105
- }
1106
- },
1107
- [trackUsage, unpublishDocument, toggleNotification, formatMessage, formatAPIError]
1108
- );
1109
- const [unpublishManyDocuments] = useUnpublishManyDocumentsMutation();
1110
- const unpublishMany = React.useCallback(
1111
- async ({ model, documentIds, params }) => {
1112
- try {
1113
- trackUsage("willBulkUnpublishEntries");
1114
- const res = await unpublishManyDocuments({
1115
- model,
1116
- documentIds,
1117
- params
1118
- });
1119
- if ("error" in res) {
1120
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1121
- return { error: res.error };
1122
- }
1123
- trackUsage("didBulkUnpublishEntries");
1124
- toggleNotification({
1125
- type: "success",
1126
- title: formatMessage({
1127
- id: getTranslation("success.records.unpublish"),
1128
- defaultMessage: "Successfully unpublished."
1129
- }),
1130
- message: ""
1131
- });
1132
- return res.data;
1133
- } catch (err) {
1134
- toggleNotification({
1135
- type: "danger",
1136
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
1137
- });
1138
- trackUsage("didNotBulkUnpublishEntries");
1139
- throw err;
1140
- }
1141
- },
1142
- [trackUsage, unpublishManyDocuments, toggleNotification, formatMessage, formatAPIError]
1143
- );
1144
- const [createDocument] = useCreateDocumentMutation();
1145
- const create = React.useCallback(
1146
- async ({ model, params }, data, trackerProperty) => {
1147
- try {
1148
- const res = await createDocument({
1149
- model,
1150
- data,
1151
- params
1152
- });
1153
- if ("error" in res) {
1154
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1155
- trackUsage("didNotCreateEntry", { error: res.error, ...trackerProperty });
1156
- return { error: res.error };
1157
- }
1158
- trackUsage("didCreateEntry", trackerProperty);
1159
- toggleNotification({
1160
- type: "success",
1161
- message: formatMessage({
1162
- id: getTranslation("success.record.save"),
1163
- defaultMessage: "Saved document"
1164
- })
1165
- });
1166
- return res.data;
1167
- } catch (err) {
1168
- toggleNotification({
1169
- type: "danger",
1170
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
1171
- });
1172
- trackUsage("didNotCreateEntry", { error: err, ...trackerProperty });
1173
- throw err;
1174
- }
1175
- },
1176
- [createDocument, formatAPIError, formatMessage, toggleNotification, trackUsage]
1177
- );
1178
- const [autoCloneDocument] = useAutoCloneDocumentMutation();
1179
- const autoClone = React.useCallback(
1180
- async ({ model, sourceId }) => {
1181
- try {
1182
- const res = await autoCloneDocument({
1183
- model,
1184
- sourceId
1185
- });
1186
- if ("error" in res) {
1187
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1188
- return { error: res.error };
1189
- }
1190
- toggleNotification({
1191
- type: "success",
1192
- message: formatMessage({
1193
- id: getTranslation("success.record.clone"),
1194
- defaultMessage: "Cloned document"
1195
- })
1196
- });
1197
- return res.data;
1198
- } catch (err) {
1199
- toggleNotification({
1200
- type: "danger",
1201
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
1202
- });
1203
- throw err;
1204
- }
1205
- },
1206
- [autoCloneDocument, formatAPIError, formatMessage, toggleNotification]
1207
- );
1208
- const [cloneDocument] = useCloneDocumentMutation();
1209
- const clone = React.useCallback(
1210
- async ({ model, documentId, params }, body, trackerProperty) => {
1211
- try {
1212
- const { id: _id, ...restBody } = body;
1213
- const res = await cloneDocument({
1214
- model,
1215
- sourceId: documentId,
1216
- data: restBody,
1217
- params
1218
- });
1219
- if ("error" in res) {
1220
- toggleNotification({ type: "danger", message: formatAPIError(res.error) });
1221
- trackUsage("didNotCreateEntry", { error: res.error, ...trackerProperty });
1222
- return { error: res.error };
1223
- }
1224
- trackUsage("didCreateEntry", trackerProperty);
1225
- toggleNotification({
1226
- type: "success",
1227
- message: formatMessage({
1228
- id: getTranslation("success.record.clone"),
1229
- defaultMessage: "Cloned document"
1230
- })
1231
- });
1232
- return res.data;
1233
- } catch (err) {
1234
- toggleNotification({
1235
- type: "danger",
1236
- message: formatMessage(DEFAULT_UNEXPECTED_ERROR_MSG)
1237
- });
1238
- trackUsage("didNotCreateEntry", { error: err, ...trackerProperty });
1239
- throw err;
1240
- }
1241
- },
1242
- [cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
1243
- );
1244
- const [getDoc] = useLazyGetDocumentQuery();
1245
- const getDocument = React.useCallback(
1246
- async (args) => {
1247
- const { data } = await getDoc(args);
1248
- return data;
1249
- },
1250
- [getDoc]
1251
- );
1252
- return {
1253
- autoClone,
1254
- clone,
1255
- create,
1256
- delete: _delete,
1257
- deleteMany,
1258
- discard,
1259
- getDocument,
1260
- publish,
1261
- publishMany,
1262
- unpublish,
1263
- unpublishMany,
1264
- update
1265
- };
1266
- };
1267
- const ProtectedHistoryPage = lazy(
1268
- () => import("./History-BVpd8LP3.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
1269
- );
1270
- const routes$1 = [
1271
- {
1272
- path: ":collectionType/:slug/:id/history",
1273
- Component: ProtectedHistoryPage
1274
- },
1275
- {
1276
- path: ":collectionType/:slug/history",
1277
- Component: ProtectedHistoryPage
1278
- }
1279
- ];
1280
- const ProtectedEditViewPage = lazy(
1281
- () => import("./EditViewPage-0MiFkXa8.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
1282
- );
1283
- const ProtectedListViewPage = lazy(
1284
- () => import("./ListViewPage-Ds0ulgfG.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
1285
- );
1286
- const ProtectedListConfiguration = lazy(
1287
- () => import("./ListConfigurationPage-DozVMKcR.mjs").then((mod) => ({
1288
- default: mod.ProtectedListConfiguration
1289
- }))
1290
- );
1291
- const ProtectedEditConfigurationPage = lazy(
1292
- () => import("./EditConfigurationPage-BwuIPOJG.mjs").then((mod) => ({
1293
- default: mod.ProtectedEditConfigurationPage
1294
- }))
1295
- );
1296
- const ProtectedComponentConfigurationPage = lazy(
1297
- () => import("./ComponentConfigurationPage-gdUj_t-O.mjs").then((mod) => ({
1298
- default: mod.ProtectedComponentConfigurationPage
1299
- }))
1300
- );
1301
- const NoPermissions = lazy(
1302
- () => import("./NoPermissionsPage-BT2Tn0D_.mjs").then((mod) => ({ default: mod.NoPermissions }))
1303
- );
1304
- const NoContentType = lazy(
1305
- () => import("./NoContentTypePage-BH11kaKt.mjs").then((mod) => ({ default: mod.NoContentType }))
1306
- );
1307
- const CollectionTypePages = () => {
1308
- const { collectionType } = useParams();
1309
- if (collectionType !== COLLECTION_TYPES && collectionType !== SINGLE_TYPES) {
1310
- return /* @__PURE__ */ jsx(Navigate, { to: "/404" });
1311
- }
1312
- return collectionType === COLLECTION_TYPES ? /* @__PURE__ */ jsx(ProtectedListViewPage, {}) : /* @__PURE__ */ jsx(ProtectedEditViewPage, {});
1313
- };
1314
- const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
1315
- const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
1316
- const LIST_RELATIVE_PATH = ":collectionType/:slug";
1317
- const LIST_PATH = `/content-manager/${LIST_RELATIVE_PATH}`;
1318
- const routes = [
1319
- {
1320
- path: LIST_RELATIVE_PATH,
1321
- element: /* @__PURE__ */ jsx(CollectionTypePages, {})
1322
- },
1323
- {
1324
- path: ":collectionType/:slug/:id",
1325
- Component: ProtectedEditViewPage
1326
- },
1327
- {
1328
- path: CLONE_RELATIVE_PATH,
1329
- Component: ProtectedEditViewPage
1330
- },
1331
- {
1332
- path: ":collectionType/:slug/configurations/list",
1333
- Component: ProtectedListConfiguration
1334
- },
1335
- {
1336
- path: "components/:slug/configurations/edit",
1337
- Component: ProtectedComponentConfigurationPage
1338
- },
1339
- {
1340
- path: ":collectionType/:slug/configurations/edit",
1341
- Component: ProtectedEditConfigurationPage
1342
- },
1343
- {
1344
- path: "403",
1345
- Component: NoPermissions
1346
- },
1347
- {
1348
- path: "no-content-types",
1349
- Component: NoContentType
1350
- },
1351
- ...routes$1
1352
- ];
1353
- const DocumentActions = ({ actions: actions2 }) => {
1354
- const { formatMessage } = useIntl();
1355
- const [primaryAction, secondaryAction, ...restActions] = actions2.filter((action) => {
1356
- if (action.position === void 0) {
1357
- return true;
1358
- }
1359
- const positions = Array.isArray(action.position) ? action.position : [action.position];
1360
- return positions.includes("panel");
1361
- });
1362
- if (!primaryAction) {
1363
- return null;
1364
- }
1365
- return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, alignItems: "stretch", width: "100%", children: [
1366
- /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
1367
- /* @__PURE__ */ jsx(DocumentActionButton, { ...primaryAction, variant: primaryAction.variant || "default" }),
1368
- restActions.length > 0 ? /* @__PURE__ */ jsx(
1369
- DocumentActionsMenu,
1370
- {
1371
- actions: restActions,
1372
- label: formatMessage({
1373
- id: "content-manager.containers.edit.panels.default.more-actions",
1374
- defaultMessage: "More document actions"
1375
- })
1376
- }
1377
- ) : null
1378
- ] }),
1379
- secondaryAction ? /* @__PURE__ */ jsx(
1380
- DocumentActionButton,
1381
- {
1382
- ...secondaryAction,
1383
- variant: secondaryAction.variant || "secondary"
1384
- }
1385
- ) : null
1386
- ] });
1387
- };
1388
- const DocumentActionButton = (action) => {
1389
- const [dialogId, setDialogId] = React.useState(null);
1390
- const { toggleNotification } = useNotification();
1391
- const handleClick = (action2) => async (e) => {
1392
- const { onClick = () => false, dialog, id } = action2;
1393
- const muteDialog = await onClick(e);
1394
- if (dialog && !muteDialog) {
1395
- switch (dialog.type) {
1396
- case "notification":
1397
- toggleNotification({
1398
- title: dialog.title,
1399
- message: dialog.content,
1400
- type: dialog.status,
1401
- timeout: dialog.timeout,
1402
- onClose: dialog.onClose
1403
- });
1404
- break;
1405
- case "dialog":
1406
- case "modal":
1407
- e.preventDefault();
1408
- setDialogId(id);
1409
- }
1410
- }
1411
- };
1412
- const handleClose = () => {
1413
- setDialogId(null);
1414
- };
1415
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1416
- /* @__PURE__ */ jsx(
1417
- Button,
1418
- {
1419
- flex: 1,
1420
- startIcon: action.icon,
1421
- disabled: action.disabled,
1422
- onClick: handleClick(action),
1423
- justifyContent: "center",
1424
- variant: action.variant || "default",
1425
- children: action.label
1426
- }
1427
- ),
1428
- action.dialog?.type === "dialog" ? /* @__PURE__ */ jsx(
1429
- DocumentActionConfirmDialog,
1430
- {
1431
- ...action.dialog,
1432
- variant: action.variant,
1433
- isOpen: dialogId === action.id,
1434
- onClose: handleClose
1435
- }
1436
- ) : null,
1437
- action.dialog?.type === "modal" ? /* @__PURE__ */ jsx(
1438
- DocumentActionModal,
1439
- {
1440
- ...action.dialog,
1441
- onModalClose: handleClose,
1442
- isOpen: dialogId === action.id
1443
- }
1444
- ) : null
1445
- ] });
1446
- };
1447
- const DocumentActionsMenu = ({
1448
- actions: actions2,
1449
- children,
1450
- label,
1451
- variant = "tertiary"
1452
- }) => {
1453
- const [isOpen, setIsOpen] = React.useState(false);
1454
- const [dialogId, setDialogId] = React.useState(null);
1455
- const { formatMessage } = useIntl();
1456
- const { toggleNotification } = useNotification();
1457
- const isDisabled = actions2.every((action) => action.disabled) || actions2.length === 0;
1458
- const handleClick = (action) => async (e) => {
1459
- const { onClick = () => false, dialog, id } = action;
1460
- const muteDialog = await onClick(e);
1461
- if (dialog && !muteDialog) {
1462
- switch (dialog.type) {
1463
- case "notification":
1464
- toggleNotification({
1465
- title: dialog.title,
1466
- message: dialog.content,
1467
- type: dialog.status,
1468
- timeout: dialog.timeout,
1469
- onClose: dialog.onClose
1470
- });
1471
- break;
1472
- case "dialog":
1473
- case "modal":
1474
- setDialogId(id);
1475
- }
1476
- }
1477
- };
1478
- const handleClose = () => {
1479
- setDialogId(null);
1480
- setIsOpen(false);
1481
- };
1482
- return /* @__PURE__ */ jsxs(Menu.Root, { open: isOpen, onOpenChange: setIsOpen, children: [
1483
- /* @__PURE__ */ jsxs(
1484
- Menu.Trigger,
1485
- {
1486
- disabled: isDisabled,
1487
- size: "S",
1488
- endIcon: null,
1489
- paddingTop: "7px",
1490
- paddingLeft: "9px",
1491
- paddingRight: "9px",
1492
- variant,
1493
- children: [
1494
- /* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
1495
- /* @__PURE__ */ jsx(VisuallyHidden, { tag: "span", children: label || formatMessage({
1496
- id: "content-manager.containers.edit.panels.default.more-actions",
1497
- defaultMessage: "More document actions"
1498
- }) })
1499
- ]
1500
- }
1501
- ),
1502
- /* @__PURE__ */ jsxs(Menu.Content, { top: "4px", maxHeight: void 0, popoverPlacement: "bottom-end", children: [
1503
- actions2.map((action) => {
1504
- return /* @__PURE__ */ jsx(
1505
- Menu.Item,
1506
- {
1507
- disabled: action.disabled,
1508
- onSelect: handleClick(action),
1509
- display: "block",
1510
- children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", gap: 4, children: [
1511
- /* @__PURE__ */ jsxs(Flex, { color: convertActionVariantToColor(action.variant), gap: 2, tag: "span", children: [
1512
- action.icon,
1513
- action.label
1514
- ] }),
1515
- action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsx(
1516
- Flex,
1517
- {
1518
- alignItems: "center",
1519
- background: "alternative100",
1520
- borderStyle: "solid",
1521
- borderColor: "alternative200",
1522
- borderWidth: "1px",
1523
- height: 5,
1524
- paddingLeft: 2,
1525
- paddingRight: 2,
1526
- hasRadius: true,
1527
- color: "alternative600",
1528
- children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
1529
- }
1530
- )
1531
- ] })
1532
- },
1533
- action.id
1534
- );
1535
- }),
1536
- children
1537
- ] }),
1538
- actions2.map((action) => {
1539
- return /* @__PURE__ */ jsxs(React.Fragment, { children: [
1540
- action.dialog?.type === "dialog" ? /* @__PURE__ */ jsx(
1541
- DocumentActionConfirmDialog,
1542
- {
1543
- ...action.dialog,
1544
- variant: action.variant,
1545
- isOpen: dialogId === action.id,
1546
- onClose: handleClose
1547
- }
1548
- ) : null,
1549
- action.dialog?.type === "modal" ? /* @__PURE__ */ jsx(
1550
- DocumentActionModal,
1551
- {
1552
- ...action.dialog,
1553
- onModalClose: handleClose,
1554
- isOpen: dialogId === action.id
1555
- }
1556
- ) : null
1557
- ] }, action.id);
1558
- })
1559
- ] });
1560
- };
1561
- const convertActionVariantToColor = (variant = "secondary") => {
1562
- switch (variant) {
1563
- case "danger":
1564
- return "danger600";
1565
- case "secondary":
1566
- return void 0;
1567
- case "success":
1568
- return "success600";
1569
- default:
1570
- return "primary600";
1571
- }
1572
- };
1573
- const DocumentActionConfirmDialog = ({
1574
- onClose,
1575
- onCancel,
1576
- onConfirm,
1577
- title,
1578
- content,
1579
- isOpen,
1580
- variant = "secondary"
1581
- }) => {
1582
- const { formatMessage } = useIntl();
1583
- const handleClose = async () => {
1584
- if (onCancel) {
1585
- await onCancel();
1586
- }
1587
- onClose();
1588
- };
1589
- const handleConfirm = async () => {
1590
- if (onConfirm) {
1591
- await onConfirm();
1592
- }
1593
- onClose();
1594
- };
1595
- return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
1596
- /* @__PURE__ */ jsx(Dialog.Header, { children: title }),
1597
- /* @__PURE__ */ jsx(Dialog.Body, { children: content }),
1598
- /* @__PURE__ */ jsxs(Dialog.Footer, { children: [
1599
- /* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: formatMessage({
1600
- id: "app.components.Button.cancel",
1601
- defaultMessage: "Cancel"
1602
- }) }) }),
1603
- /* @__PURE__ */ jsx(Button, { onClick: handleConfirm, variant, children: formatMessage({
1604
- id: "app.components.Button.confirm",
1605
- defaultMessage: "Confirm"
1606
- }) })
1607
- ] })
1608
- ] }) });
1609
- };
1610
- const DocumentActionModal = ({
1611
- isOpen,
1612
- title,
1613
- onClose,
1614
- footer: Footer,
1615
- content: Content,
1616
- onModalClose
1617
- }) => {
1618
- const handleClose = () => {
1619
- if (onClose) {
1620
- onClose();
1621
- }
1622
- onModalClose();
1623
- };
1624
- return /* @__PURE__ */ jsx(Modal.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
1625
- /* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: title }) }),
1626
- typeof Content === "function" ? /* @__PURE__ */ jsx(Content, { onClose: handleClose }) : /* @__PURE__ */ jsx(Modal.Body, { children: Content }),
1627
- typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
1628
- ] }) });
1629
- };
1630
- const PublishAction$1 = ({
1631
- activeTab,
1632
- documentId,
1633
- model,
1634
- collectionType,
1635
- meta,
1636
- document
1637
- }) => {
1638
- const { schema } = useDoc();
1639
- const navigate = useNavigate();
1640
- const { toggleNotification } = useNotification();
1641
- const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
1642
- const isCloning = useMatch(CLONE_PATH) !== null;
1643
- const { formatMessage } = useIntl();
1644
- const { canPublish, canCreate, canUpdate } = useDocumentRBAC(
1645
- "PublishAction",
1646
- ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
1647
- );
1648
- const { publish } = useDocumentActions();
1649
- const [{ query, rawQuery }] = useQueryParams();
1650
- const params = React.useMemo(() => buildValidParams(query), [query]);
1651
- const modified = useForm("PublishAction", ({ modified: modified2 }) => modified2);
1652
- const setSubmitting = useForm("PublishAction", ({ setSubmitting: setSubmitting2 }) => setSubmitting2);
1653
- const isSubmitting = useForm("PublishAction", ({ isSubmitting: isSubmitting2 }) => isSubmitting2);
1654
- const validate = useForm("PublishAction", (state) => state.validate);
1655
- const setErrors = useForm("PublishAction", (state) => state.setErrors);
1656
- const formValues = useForm("PublishAction", ({ values }) => values);
1657
- const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
1658
- if (!schema?.options?.draftAndPublish) {
1659
- return null;
1660
- }
1661
- return {
1662
- /**
1663
- * Disabled when:
1664
- * - currently if you're cloning a document we don't support publish & clone at the same time.
1665
- * - the form is submitting
1666
- * - the active tab is the published tab
1667
- * - the document is already published & not modified
1668
- * - the document is being created & not modified
1669
- * - the user doesn't have the permission to publish
1670
- * - the user doesn't have the permission to create a new document
1671
- * - the user doesn't have the permission to update the document
1672
- */
1673
- disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
1674
- label: formatMessage({
1675
- id: "app.utils.publish",
1676
- defaultMessage: "Publish"
1677
- }),
1678
- onClick: async () => {
1679
- setSubmitting(true);
1680
- try {
1681
- const { errors } = await validate();
1682
- if (errors) {
1683
- toggleNotification({
1684
- type: "danger",
1685
- message: formatMessage({
1686
- id: "content-manager.validation.error",
1687
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
1688
- })
1689
- });
1690
- return;
1691
- }
1692
- const res = await publish(
1693
- {
1694
- collectionType,
1695
- model,
1696
- documentId,
1697
- params
1698
- },
1699
- formValues
1700
- );
1701
- if ("data" in res && collectionType !== SINGLE_TYPES) {
1702
- navigate({
1703
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1704
- search: rawQuery
1705
- });
1706
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1707
- setErrors(formatValidationErrors(res.error));
1708
- }
1709
- } finally {
1710
- setSubmitting(false);
1711
- }
1712
- }
1713
- };
1714
- };
1715
- PublishAction$1.type = "publish";
1716
- const UpdateAction = ({
1717
- activeTab,
1718
- documentId,
1719
- model,
1720
- collectionType
1721
- }) => {
1722
- const navigate = useNavigate();
1723
- const { toggleNotification } = useNotification();
1724
- const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
1725
- const cloneMatch = useMatch(CLONE_PATH);
1726
- const isCloning = cloneMatch !== null;
1727
- const { formatMessage } = useIntl();
1728
- const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
1729
- canCreate: canCreate2,
1730
- canUpdate: canUpdate2
1731
- }));
1732
- const { create, update, clone } = useDocumentActions();
1733
- const [{ query, rawQuery }] = useQueryParams();
1734
- const params = React.useMemo(() => buildValidParams(query), [query]);
1735
- const isSubmitting = useForm("UpdateAction", ({ isSubmitting: isSubmitting2 }) => isSubmitting2);
1736
- const modified = useForm("UpdateAction", ({ modified: modified2 }) => modified2);
1737
- const setSubmitting = useForm("UpdateAction", ({ setSubmitting: setSubmitting2 }) => setSubmitting2);
1738
- const document = useForm("UpdateAction", ({ values }) => values);
1739
- const validate = useForm("UpdateAction", (state) => state.validate);
1740
- const setErrors = useForm("UpdateAction", (state) => state.setErrors);
1741
- const resetForm = useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
1742
- return {
1743
- /**
1744
- * Disabled when:
1745
- * - the form is submitting
1746
- * - the document is not modified & we're not cloning (you can save a clone entity straight away)
1747
- * - the active tab is the published tab
1748
- * - the user doesn't have the permission to create a new document
1749
- * - the user doesn't have the permission to update the document
1750
- */
1751
- disabled: isSubmitting || !modified && !isCloning || activeTab === "published" || Boolean(!documentId && !canCreate || documentId && !canUpdate),
1752
- label: formatMessage({
1753
- id: "content-manager.containers.Edit.save",
1754
- defaultMessage: "Save"
1755
- }),
1756
- onClick: async () => {
1757
- setSubmitting(true);
1758
- try {
1759
- const { errors } = await validate();
1760
- if (errors) {
1761
- toggleNotification({
1762
- type: "danger",
1763
- message: formatMessage({
1764
- id: "content-manager.validation.error",
1765
- defaultMessage: "There are validation errors in your document. Please fix them before saving."
1766
- })
1767
- });
1768
- return;
1769
- }
1770
- if (isCloning) {
1771
- const res = await clone(
1772
- {
1773
- model,
1774
- documentId: cloneMatch.params.origin,
1775
- params
1776
- },
1777
- document
1778
- );
1779
- if ("data" in res) {
1780
- navigate({
1781
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1782
- search: rawQuery
1783
- });
1784
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1785
- setErrors(formatValidationErrors(res.error));
1786
- }
1787
- } else if (documentId || collectionType === SINGLE_TYPES) {
1788
- const res = await update(
1789
- {
1790
- collectionType,
1791
- model,
1792
- documentId,
1793
- params
1794
- },
1795
- document
1796
- );
1797
- if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1798
- setErrors(formatValidationErrors(res.error));
1799
- } else {
1800
- resetForm();
1801
- }
1802
- } else {
1803
- const res = await create(
1804
- {
1805
- model,
1806
- params
1807
- },
1808
- document
1809
- );
1810
- if ("data" in res && collectionType !== SINGLE_TYPES) {
1811
- navigate({
1812
- pathname: `../${collectionType}/${model}/${res.data.documentId}`,
1813
- search: rawQuery
1814
- });
1815
- } else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
1816
- setErrors(formatValidationErrors(res.error));
1817
- }
1818
- }
1819
- } finally {
1820
- setSubmitting(false);
1821
- }
1822
- }
1823
- };
1824
- };
1825
- UpdateAction.type = "update";
1826
- const UNPUBLISH_DRAFT_OPTIONS = {
1827
- KEEP: "keep",
1828
- DISCARD: "discard"
1829
- };
1830
- const UnpublishAction$1 = ({
1831
- activeTab,
1832
- documentId,
1833
- model,
1834
- collectionType,
1835
- document
1836
- }) => {
1837
- const { formatMessage } = useIntl();
1838
- const { schema } = useDoc();
1839
- const canPublish = useDocumentRBAC("UnpublishAction", ({ canPublish: canPublish2 }) => canPublish2);
1840
- const { unpublish } = useDocumentActions();
1841
- const [{ query }] = useQueryParams();
1842
- const params = React.useMemo(() => buildValidParams(query), [query]);
1843
- const { toggleNotification } = useNotification();
1844
- const [shouldKeepDraft, setShouldKeepDraft] = React.useState(true);
1845
- const isDocumentModified = document?.status === "modified";
1846
- const handleChange = (value) => {
1847
- setShouldKeepDraft(value === UNPUBLISH_DRAFT_OPTIONS.KEEP);
1848
- };
1849
- if (!schema?.options?.draftAndPublish) {
1850
- return null;
1851
- }
1852
- return {
1853
- disabled: !canPublish || activeTab === "published" || document?.status !== "published" && document?.status !== "modified",
1854
- label: formatMessage({
1855
- id: "app.utils.unpublish",
1856
- defaultMessage: "Unpublish"
1857
- }),
1858
- icon: /* @__PURE__ */ jsx(StyledCrossCircle, {}),
1859
- onClick: async () => {
1860
- if (!documentId && collectionType !== SINGLE_TYPES || isDocumentModified) {
1861
- if (!documentId) {
1862
- console.error(
1863
- "You're trying to unpublish a document without an id, this is likely a bug with Strapi. Please open an issue."
1864
- );
1865
- toggleNotification({
1866
- message: formatMessage({
1867
- id: "content-manager.actions.unpublish.error",
1868
- defaultMessage: "An error occurred while trying to unpublish the document."
1869
- }),
1870
- type: "danger"
1871
- });
1872
- }
1873
- return;
1874
- }
1875
- await unpublish({
1876
- collectionType,
1877
- model,
1878
- documentId,
1879
- params
1880
- });
1881
- },
1882
- dialog: isDocumentModified ? {
1883
- type: "dialog",
1884
- title: formatMessage({
1885
- id: "app.components.ConfirmDialog.title",
1886
- defaultMessage: "Confirmation"
1887
- }),
1888
- content: /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-start", direction: "column", gap: 6, children: [
1889
- /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", gap: 2, children: [
1890
- /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
1891
- /* @__PURE__ */ jsx(Typography, { tag: "p", variant: "omega", textAlign: "center", children: formatMessage({
1892
- id: "content-manager.actions.unpublish.dialog.body",
1893
- defaultMessage: "Are you sure?"
1894
- }) })
1895
- ] }),
1896
- /* @__PURE__ */ jsxs(
1897
- Radio.Group,
1898
- {
1899
- defaultValue: UNPUBLISH_DRAFT_OPTIONS.KEEP,
1900
- name: "discard-options",
1901
- "aria-label": formatMessage({
1902
- id: "content-manager.actions.unpublish.dialog.radio-label",
1903
- defaultMessage: "Choose an option to unpublish the document."
1904
- }),
1905
- onValueChange: handleChange,
1906
- children: [
1907
- /* @__PURE__ */ jsx(Radio.Item, { checked: shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.KEEP, children: formatMessage({
1908
- id: "content-manager.actions.unpublish.dialog.option.keep-draft",
1909
- defaultMessage: "Keep draft"
1910
- }) }),
1911
- /* @__PURE__ */ jsx(Radio.Item, { checked: !shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.DISCARD, children: formatMessage({
1912
- id: "content-manager.actions.unpublish.dialog.option.replace-draft",
1913
- defaultMessage: "Replace draft"
1914
- }) })
1915
- ]
1916
- }
1917
- )
1918
- ] }),
1919
- onConfirm: async () => {
1920
- if (!documentId && collectionType !== SINGLE_TYPES) {
1921
- console.error(
1922
- "You're trying to unpublish a document without an id, this is likely a bug with Strapi. Please open an issue."
1923
- );
1924
- toggleNotification({
1925
- message: formatMessage({
1926
- id: "content-manager.actions.unpublish.error",
1927
- defaultMessage: "An error occurred while trying to unpublish the document."
1928
- }),
1929
- type: "danger"
1930
- });
1931
- }
1932
- await unpublish(
1933
- {
1934
- collectionType,
1935
- model,
1936
- documentId,
1937
- params
1938
- },
1939
- !shouldKeepDraft
1940
- );
1941
- }
1942
- } : void 0,
1943
- variant: "danger",
1944
- position: ["panel", "table-row"]
1945
- };
1946
- };
1947
- UnpublishAction$1.type = "unpublish";
1948
- const DiscardAction = ({
1949
- activeTab,
1950
- documentId,
1951
- model,
1952
- collectionType,
1953
- document
1954
- }) => {
1955
- const { formatMessage } = useIntl();
1956
- const { schema } = useDoc();
1957
- const canUpdate = useDocumentRBAC("DiscardAction", ({ canUpdate: canUpdate2 }) => canUpdate2);
1958
- const { discard } = useDocumentActions();
1959
- const [{ query }] = useQueryParams();
1960
- const params = React.useMemo(() => buildValidParams(query), [query]);
1961
- if (!schema?.options?.draftAndPublish) {
1962
- return null;
1963
- }
1964
- return {
1965
- disabled: !canUpdate || activeTab === "published" || document?.status !== "modified",
1966
- label: formatMessage({
1967
- id: "content-manager.actions.discard.label",
1968
- defaultMessage: "Discard changes"
1969
- }),
1970
- icon: /* @__PURE__ */ jsx(StyledCrossCircle, {}),
1971
- position: ["panel", "table-row"],
1972
- variant: "danger",
1973
- dialog: {
1974
- type: "dialog",
1975
- title: formatMessage({
1976
- id: "app.components.ConfirmDialog.title",
1977
- defaultMessage: "Confirmation"
1978
- }),
1979
- content: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
1980
- /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
1981
- /* @__PURE__ */ jsx(Typography, { tag: "p", variant: "omega", textAlign: "center", children: formatMessage({
1982
- id: "content-manager.actions.discard.dialog.body",
1983
- defaultMessage: "Are you sure?"
1984
- }) })
1985
- ] }),
1986
- onConfirm: async () => {
1987
- await discard({
1988
- collectionType,
1989
- model,
1990
- documentId,
1991
- params
1992
- });
1993
- }
1994
- }
1995
- };
1996
- };
1997
- DiscardAction.type = "discard";
1998
- const StyledCrossCircle = styled(CrossCircle)`
1999
- path {
2000
- fill: currentColor;
2001
- }
2002
- `;
2003
- const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
2004
- const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
2005
- const RelativeTime = React.forwardRef(
2006
- ({ timestamp, customIntervals = [], ...restProps }, forwardedRef) => {
2007
- const { formatRelativeTime, formatDate, formatTime } = useIntl();
2008
- const interval = intervalToDuration({
2009
- start: timestamp,
2010
- end: Date.now()
2011
- // see https://github.com/date-fns/date-fns/issues/2891 – No idea why it's all partial it returns it every time.
2012
- });
2013
- const unit = intervals.find((intervalUnit) => {
2014
- return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
2015
- });
2016
- const relativeTime = isPast(timestamp) ? -interval[unit] : interval[unit];
2017
- const customInterval = customIntervals.find(
2018
- (custom) => interval[custom.unit] < custom.threshold
2019
- );
2020
- const displayText = customInterval ? customInterval.text : formatRelativeTime(relativeTime, unit, { numeric: "auto" });
2021
- return /* @__PURE__ */ jsx(
2022
- "time",
2023
- {
2024
- ref: forwardedRef,
2025
- dateTime: timestamp.toISOString(),
2026
- role: "time",
2027
- title: `${formatDate(timestamp)} ${formatTime(timestamp)}`,
2028
- ...restProps,
2029
- children: displayText
2030
- }
2031
- );
2032
- }
2033
- );
2034
- const getDisplayName = ({
2035
- firstname,
2036
- lastname,
2037
- username,
2038
- email
2039
- } = {}) => {
2040
- if (username) {
2041
- return username;
2042
- }
2043
- if (firstname) {
2044
- return `${firstname} ${lastname ?? ""}`.trim();
2045
- }
2046
- return email ?? "";
2047
- };
2048
- const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
2049
- const DocumentStatus = ({ status = "draft", ...restProps }) => {
2050
- const statusVariant = status === "draft" ? "primary" : status === "published" ? "success" : "alternative";
2051
- return /* @__PURE__ */ jsx(Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
2052
- };
2053
- const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
2054
- const { formatMessage } = useIntl();
2055
- const isCloning = useMatch(CLONE_PATH) !== null;
2056
- const title = isCreating ? formatMessage({
2057
- id: "content-manager.containers.edit.title.new",
2058
- defaultMessage: "Create an entry"
2059
- }) : documentTitle;
2060
- return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 8, paddingBottom: 4, gap: 3, children: [
2061
- /* @__PURE__ */ jsx(BackButton, {}),
2062
- /* @__PURE__ */ jsxs(
2063
- Flex,
2064
- {
2065
- width: "100%",
2066
- justifyContent: "space-between",
2067
- paddingTop: 1,
2068
- gap: "80px",
2069
- alignItems: "flex-start",
2070
- children: [
2071
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
2072
- /* @__PURE__ */ jsx(HeaderToolbar, {})
2073
- ]
2074
- }
2075
- ),
2076
- status ? /* @__PURE__ */ jsx(DocumentStatus, { status: isCloning ? "draft" : status }) : null
2077
- ] });
2078
- };
2079
- const HeaderToolbar = () => {
2080
- const { formatMessage } = useIntl();
2081
- const isCloning = useMatch(CLONE_PATH) !== null;
2082
- const [
2083
- {
2084
- query: { status = "draft" }
2085
- }
2086
- ] = useQueryParams();
2087
- const { model, id, document, meta, collectionType } = useDoc();
2088
- const plugins = useStrapiApp("HeaderToolbar", (state) => state.plugins);
2089
- return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
2090
- /* @__PURE__ */ jsx(
2091
- DescriptionComponentRenderer,
2092
- {
2093
- props: {
2094
- activeTab: status,
2095
- model,
2096
- documentId: id,
2097
- document: isCloning ? void 0 : document,
2098
- meta: isCloning ? void 0 : meta,
2099
- collectionType
2100
- },
2101
- descriptions: plugins["content-manager"].apis.getHeaderActions(),
2102
- children: (actions2) => {
2103
- if (actions2.length > 0) {
2104
- return /* @__PURE__ */ jsx(HeaderActions, { actions: actions2 });
2105
- } else {
2106
- return null;
2107
- }
2108
- }
2109
- }
2110
- ),
2111
- /* @__PURE__ */ jsx(
2112
- DescriptionComponentRenderer,
2113
- {
2114
- props: {
2115
- activeTab: status,
2116
- model,
2117
- documentId: id,
2118
- document: isCloning ? void 0 : document,
2119
- meta: isCloning ? void 0 : meta,
2120
- collectionType
2121
- },
2122
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2123
- children: (actions2) => {
2124
- const headerActions = actions2.filter((action) => {
2125
- const positions = Array.isArray(action.position) ? action.position : [action.position];
2126
- return positions.includes("header");
2127
- });
2128
- return /* @__PURE__ */ jsx(
2129
- DocumentActionsMenu,
2130
- {
2131
- actions: headerActions,
2132
- label: formatMessage({
2133
- id: "content-manager.containers.edit.header.more-actions",
2134
- defaultMessage: "More actions"
2135
- }),
2136
- children: /* @__PURE__ */ jsx(Information, { activeTab: status })
2137
- }
2138
- );
2139
- }
2140
- }
2141
- )
2142
- ] });
2143
- };
2144
- const Information = ({ activeTab }) => {
2145
- const { formatMessage } = useIntl();
2146
- const { document, meta } = useDoc();
2147
- if (!document || !document.id) {
2148
- return null;
2149
- }
2150
- const createAndUpdateDocument = activeTab === "draft" ? document : meta?.availableStatus.find((status) => status.publishedAt === null);
2151
- const publishDocument = activeTab === "published" ? document : meta?.availableStatus.find((status) => status.publishedAt !== null);
2152
- const creator = createAndUpdateDocument?.[CREATED_BY_ATTRIBUTE_NAME] ? getDisplayName(createAndUpdateDocument[CREATED_BY_ATTRIBUTE_NAME]) : null;
2153
- const updator = createAndUpdateDocument?.[UPDATED_BY_ATTRIBUTE_NAME] ? getDisplayName(createAndUpdateDocument[UPDATED_BY_ATTRIBUTE_NAME]) : null;
2154
- const information = [
2155
- {
2156
- isDisplayed: !!publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME],
2157
- label: formatMessage({
2158
- id: "content-manager.containers.edit.information.last-published.label",
2159
- defaultMessage: "Last published"
2160
- }),
2161
- value: formatMessage(
2162
- {
2163
- id: "content-manager.containers.edit.information.last-published.value",
2164
- defaultMessage: `Published {time}{isAnonymous, select, true {} other { by {author}}}`
2165
- },
2166
- {
2167
- time: /* @__PURE__ */ jsx(RelativeTime, { timestamp: new Date(publishDocument?.[PUBLISHED_AT_ATTRIBUTE_NAME]) }),
2168
- isAnonymous: !publishDocument?.[PUBLISHED_BY_ATTRIBUTE_NAME],
2169
- author: publishDocument?.[PUBLISHED_BY_ATTRIBUTE_NAME] ? getDisplayName(publishDocument?.[PUBLISHED_BY_ATTRIBUTE_NAME]) : null
2170
- }
2171
- )
2172
- },
2173
- {
2174
- isDisplayed: !!createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME],
2175
- label: formatMessage({
2176
- id: "content-manager.containers.edit.information.last-draft.label",
2177
- defaultMessage: "Last draft"
2178
- }),
2179
- value: formatMessage(
2180
- {
2181
- id: "content-manager.containers.edit.information.last-draft.value",
2182
- defaultMessage: `Modified {time}{isAnonymous, select, true {} other { by {author}}}`
2183
- },
2184
- {
2185
- time: /* @__PURE__ */ jsx(
2186
- RelativeTime,
2187
- {
2188
- timestamp: new Date(createAndUpdateDocument?.[UPDATED_AT_ATTRIBUTE_NAME])
2189
- }
2190
- ),
2191
- isAnonymous: !updator,
2192
- author: updator
2193
- }
2194
- )
2195
- },
2196
- {
2197
- isDisplayed: !!createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME],
2198
- label: formatMessage({
2199
- id: "content-manager.containers.edit.information.document.label",
2200
- defaultMessage: "Document"
2201
- }),
2202
- value: formatMessage(
2203
- {
2204
- id: "content-manager.containers.edit.information.document.value",
2205
- defaultMessage: `Created {time}{isAnonymous, select, true {} other { by {author}}}`
2206
- },
2207
- {
2208
- time: /* @__PURE__ */ jsx(
2209
- RelativeTime,
2210
- {
2211
- timestamp: new Date(createAndUpdateDocument?.[CREATED_AT_ATTRIBUTE_NAME])
2212
- }
2213
- ),
2214
- isAnonymous: !creator,
2215
- author: creator
2216
- }
2217
- )
2218
- }
2219
- ].filter((info) => info.isDisplayed);
2220
- return /* @__PURE__ */ jsx(
2221
- Flex,
2222
- {
2223
- borderWidth: "1px 0 0 0",
2224
- borderStyle: "solid",
2225
- borderColor: "neutral150",
2226
- direction: "column",
2227
- marginTop: 2,
2228
- tag: "dl",
2229
- padding: 5,
2230
- gap: 3,
2231
- alignItems: "flex-start",
2232
- marginLeft: "-0.4rem",
2233
- marginRight: "-0.4rem",
2234
- width: "calc(100% + 8px)",
2235
- children: information.map((info) => /* @__PURE__ */ jsxs(Flex, { gap: 1, direction: "column", alignItems: "flex-start", children: [
2236
- /* @__PURE__ */ jsx(Typography, { tag: "dt", variant: "pi", fontWeight: "bold", children: info.label }),
2237
- /* @__PURE__ */ jsx(Typography, { tag: "dd", variant: "pi", textColor: "neutral600", children: info.value })
2238
- ] }, info.label))
2239
- }
2240
- );
2241
- };
2242
- const HeaderActions = ({ actions: actions2 }) => {
2243
- return /* @__PURE__ */ jsx(Flex, { children: actions2.map((action) => {
2244
- if ("options" in action) {
2245
- return /* @__PURE__ */ jsx(
2246
- SingleSelect,
2247
- {
2248
- size: "S",
2249
- disabled: action.disabled,
2250
- "aria-label": action.label,
2251
- onChange: action.onSelect,
2252
- value: action.value,
2253
- children: action.options.map(({ label, ...option }) => /* @__PURE__ */ jsx(SingleSelectOption, { ...option, children: label }, option.value))
2254
- },
2255
- action.id
2256
- );
2257
- } else {
2258
- return null;
2259
- }
2260
- }) });
2261
- };
2262
- const ConfigureTheViewAction = ({ collectionType, model }) => {
2263
- const navigate = useNavigate();
2264
- const { formatMessage } = useIntl();
2265
- return {
2266
- label: formatMessage({
2267
- id: "app.links.configure-view",
2268
- defaultMessage: "Configure the view"
2269
- }),
2270
- icon: /* @__PURE__ */ jsx(ListPlus, {}),
2271
- onClick: () => {
2272
- navigate(`../${collectionType}/${model}/configurations/edit`);
2273
- },
2274
- position: "header"
2275
- };
2276
- };
2277
- ConfigureTheViewAction.type = "configure-the-view";
2278
- const EditTheModelAction = ({ model }) => {
2279
- const navigate = useNavigate();
2280
- const { formatMessage } = useIntl();
2281
- return {
2282
- label: formatMessage({
2283
- id: "content-manager.link-to-ctb",
2284
- defaultMessage: "Edit the model"
2285
- }),
2286
- icon: /* @__PURE__ */ jsx(Pencil, {}),
2287
- onClick: () => {
2288
- navigate(`/plugins/content-type-builder/content-types/${model}`);
2289
- },
2290
- position: "header"
2291
- };
2292
- };
2293
- EditTheModelAction.type = "edit-the-model";
2294
- const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
2295
- const navigate = useNavigate();
2296
- const { formatMessage } = useIntl();
2297
- const listViewPathMatch = useMatch(LIST_PATH);
2298
- const canDelete = useDocumentRBAC("DeleteAction", (state) => state.canDelete);
2299
- const { delete: deleteAction } = useDocumentActions();
2300
- const { toggleNotification } = useNotification();
2301
- const setSubmitting = useForm("DeleteAction", (state) => state.setSubmitting);
2302
- return {
2303
- disabled: !canDelete || !document,
2304
- label: formatMessage({
2305
- id: "content-manager.actions.delete.label",
2306
- defaultMessage: "Delete document"
2307
- }),
2308
- icon: /* @__PURE__ */ jsx(Trash, {}),
2309
- dialog: {
2310
- type: "dialog",
2311
- title: formatMessage({
2312
- id: "app.components.ConfirmDialog.title",
2313
- defaultMessage: "Confirmation"
2314
- }),
2315
- content: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
2316
- /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }),
2317
- /* @__PURE__ */ jsx(Typography, { tag: "p", variant: "omega", textAlign: "center", children: formatMessage({
2318
- id: "content-manager.actions.delete.dialog.body",
2319
- defaultMessage: "Are you sure?"
2320
- }) })
2321
- ] }),
2322
- onConfirm: async () => {
2323
- if (!listViewPathMatch) {
2324
- setSubmitting(true);
2325
- }
2326
- try {
2327
- if (!documentId && collectionType !== SINGLE_TYPES) {
2328
- console.error(
2329
- "You're trying to delete a document without an id, this is likely a bug with Strapi. Please open an issue."
2330
- );
2331
- toggleNotification({
2332
- message: formatMessage({
2333
- id: "content-manager.actions.delete.error",
2334
- defaultMessage: "An error occurred while trying to delete the document."
2335
- }),
2336
- type: "danger"
2337
- });
2338
- return;
2339
- }
2340
- const res = await deleteAction({
2341
- documentId,
2342
- model,
2343
- collectionType,
2344
- params: {
2345
- locale: "*"
2346
- }
2347
- });
2348
- if (!("error" in res)) {
2349
- navigate({ pathname: `../${collectionType}/${model}` }, { replace: true });
2350
- }
2351
- } finally {
2352
- if (!listViewPathMatch) {
2353
- setSubmitting(false);
2354
- }
2355
- }
2356
- }
2357
- },
2358
- variant: "danger",
2359
- position: ["header", "table-row"]
2360
- };
2361
- };
2362
- DeleteAction$1.type = "delete";
2363
- const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
2364
- const Panels = () => {
2365
- const isCloning = useMatch(CLONE_PATH) !== null;
2366
- const [
2367
- {
2368
- query: { status }
2369
- }
2370
- ] = useQueryParams({
2371
- status: "draft"
2372
- });
2373
- const { model, id, document, meta, collectionType } = useDoc();
2374
- const plugins = useStrapiApp("Panels", (state) => state.plugins);
2375
- const props = {
2376
- activeTab: status,
2377
- model,
2378
- documentId: id,
2379
- document: isCloning ? void 0 : document,
2380
- meta: isCloning ? void 0 : meta,
2381
- collectionType
2382
- };
2383
- return /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: /* @__PURE__ */ jsx(
2384
- DescriptionComponentRenderer,
2385
- {
2386
- props,
2387
- descriptions: plugins["content-manager"].apis.getEditViewSidePanels(),
2388
- children: (panels) => panels.map(({ content, id: id2, ...description }) => /* @__PURE__ */ jsx(Panel, { ...description, children: content }, id2))
2389
- }
2390
- ) });
2391
- };
2392
- const ActionsPanel = () => {
2393
- const { formatMessage } = useIntl();
2394
- return {
2395
- title: formatMessage({
2396
- id: "content-manager.containers.edit.panels.default.title",
2397
- defaultMessage: "Document"
2398
- }),
2399
- content: /* @__PURE__ */ jsx(ActionsPanelContent, {})
2400
- };
2401
- };
2402
- ActionsPanel.type = "actions";
2403
- const ActionsPanelContent = () => {
2404
- const isCloning = useMatch(CLONE_PATH) !== null;
2405
- const [
2406
- {
2407
- query: { status = "draft" }
2408
- }
2409
- ] = useQueryParams();
2410
- const { model, id, document, meta, collectionType } = useDoc();
2411
- const plugins = useStrapiApp("ActionsPanel", (state) => state.plugins);
2412
- const props = {
2413
- activeTab: status,
2414
- model,
2415
- documentId: id,
2416
- document: isCloning ? void 0 : document,
2417
- meta: isCloning ? void 0 : meta,
2418
- collectionType
2419
- };
2420
- return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, width: "100%", children: [
2421
- /* @__PURE__ */ jsx(
2422
- DescriptionComponentRenderer,
2423
- {
2424
- props,
2425
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
2426
- children: (actions2) => /* @__PURE__ */ jsx(DocumentActions, { actions: actions2 })
2427
- }
2428
- ),
2429
- /* @__PURE__ */ jsx(InjectionZone, { area: "editView.right-links", slug: model })
2430
- ] });
2431
- };
2432
- const Panel = React.forwardRef(({ children, title }, ref) => {
2433
- return /* @__PURE__ */ jsxs(
2434
- Flex,
2435
- {
2436
- ref,
2437
- tag: "aside",
2438
- "aria-labelledby": "additional-information",
2439
- background: "neutral0",
2440
- borderColor: "neutral150",
2441
- hasRadius: true,
2442
- paddingBottom: 4,
2443
- paddingLeft: 4,
2444
- paddingRight: 4,
2445
- paddingTop: 4,
2446
- shadow: "tableShadow",
2447
- gap: 3,
2448
- direction: "column",
2449
- justifyContent: "stretch",
2450
- alignItems: "flex-start",
2451
- children: [
2452
- /* @__PURE__ */ jsx(Typography, { tag: "h2", variant: "sigma", textTransform: "uppercase", children: title }),
2453
- children
2454
- ]
2455
- }
2456
- );
2457
- });
2458
- const HOOKS = {
2459
- /**
2460
- * Hook that allows to mutate the displayed headers of the list view table
2461
- * @constant
2462
- * @type {string}
2463
- */
2464
- INJECT_COLUMN_IN_TABLE: "Admin/CM/pages/ListView/inject-column-in-table",
2465
- /**
2466
- * Hook that allows to mutate the CM's collection types links pre-set filters
2467
- * @constant
2468
- * @type {string}
2469
- */
2470
- MUTATE_COLLECTION_TYPES_LINKS: "Admin/CM/pages/App/mutate-collection-types-links",
2471
- /**
2472
- * Hook that allows to mutate the CM's edit view layout
2473
- * @constant
2474
- * @type {string}
2475
- */
2476
- MUTATE_EDIT_VIEW_LAYOUT: "Admin/CM/pages/EditView/mutate-edit-view-layout",
2477
- /**
2478
- * Hook that allows to mutate the CM's single types links pre-set filters
2479
- * @constant
2480
- * @type {string}
2481
- */
2482
- MUTATE_SINGLE_TYPES_LINKS: "Admin/CM/pages/App/mutate-single-types-links"
2483
- };
2484
- const contentTypesApi = contentManagerApi.injectEndpoints({
2485
- endpoints: (builder) => ({
2486
- getContentTypeConfiguration: builder.query({
2487
- query: (uid) => ({
2488
- url: `/content-manager/content-types/${uid}/configuration`,
2489
- method: "GET"
2490
- }),
2491
- transformResponse: (response) => response.data,
2492
- providesTags: (_result, _error, uid) => [
2493
- { type: "ContentTypesConfiguration", id: uid },
2494
- { type: "ContentTypeSettings", id: "LIST" }
2495
- ]
2496
- }),
2497
- getAllContentTypeSettings: builder.query({
2498
- query: () => "/content-manager/content-types-settings",
2499
- transformResponse: (response) => response.data,
2500
- providesTags: [{ type: "ContentTypeSettings", id: "LIST" }]
2501
- }),
2502
- updateContentTypeConfiguration: builder.mutation({
2503
- query: ({ uid, ...body }) => ({
2504
- url: `/content-manager/content-types/${uid}/configuration`,
2505
- method: "PUT",
2506
- data: body
2507
- }),
2508
- transformResponse: (response) => response.data,
2509
- invalidatesTags: (_result, _error, { uid }) => [
2510
- { type: "ContentTypesConfiguration", id: uid },
2511
- { type: "ContentTypeSettings", id: "LIST" },
2512
- // Is this necessary?
2513
- { type: "InitialData" }
2514
- ]
2515
- })
2516
- })
2517
- });
2518
- const {
2519
- useGetContentTypeConfigurationQuery,
2520
- useGetAllContentTypeSettingsQuery,
2521
- useUpdateContentTypeConfigurationMutation
2522
- } = contentTypesApi;
2523
- const checkIfAttributeIsDisplayable = (attribute) => {
2524
- const { type } = attribute;
2525
- if (type === "relation") {
2526
- return !attribute.relation.toLowerCase().includes("morph");
2527
- }
2528
- return !["json", "dynamiczone", "richtext", "password", "blocks"].includes(type) && !!type;
2529
- };
2530
- const getMainField = (attribute, mainFieldName, { schemas, components }) => {
2531
- if (!mainFieldName) {
2532
- return void 0;
2533
- }
2534
- const mainFieldType = attribute.type === "component" ? components[attribute.component].attributes[mainFieldName].type : (
2535
- // @ts-expect-error – `targetModel` does exist on the attribute for a relation.
2536
- schemas.find((schema) => schema.uid === attribute.targetModel)?.attributes[mainFieldName].type
2537
- );
2538
- return {
2539
- name: mainFieldName,
2540
- type: mainFieldType ?? "string"
2541
- };
2542
- };
2543
- const DEFAULT_SETTINGS = {
2544
- bulkable: false,
2545
- filterable: false,
2546
- searchable: false,
2547
- pagination: false,
2548
- defaultSortBy: "",
2549
- defaultSortOrder: "asc",
2550
- mainField: "id",
2551
- pageSize: 10
2552
- };
2553
- const useDocumentLayout = (model) => {
2554
- const { schema, components } = useDocument({ model, collectionType: "" }, { skip: true });
2555
- const [{ query }] = useQueryParams();
2556
- const runHookWaterfall = useStrapiApp("useDocumentLayout", (state) => state.runHookWaterfall);
2557
- const { toggleNotification } = useNotification();
2558
- const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
2559
- const { isLoading: isLoadingSchemas, schemas } = useContentTypeSchema();
2560
- const {
2561
- data,
2562
- isLoading: isLoadingConfigs,
2563
- error,
2564
- isFetching: isFetchingConfigs
2565
- } = useGetContentTypeConfigurationQuery(model);
2566
- const isLoading = isLoadingSchemas || isFetchingConfigs || isLoadingConfigs;
2567
- React.useEffect(() => {
2568
- if (error) {
2569
- toggleNotification({
2570
- type: "danger",
2571
- message: formatAPIError(error)
2572
- });
2573
- }
2574
- }, [error, formatAPIError, toggleNotification]);
2575
- const editLayout = React.useMemo(
2576
- () => data && !isLoading ? formatEditLayout(data, { schemas, schema, components }) : {
2577
- layout: [],
2578
- components: {},
2579
- metadatas: {},
2580
- options: {},
2581
- settings: DEFAULT_SETTINGS
2582
- },
2583
- [data, isLoading, schemas, schema, components]
2584
- );
2585
- const listLayout = React.useMemo(() => {
2586
- return data && !isLoading ? formatListLayout(data, { schemas, schema, components }) : {
2587
- layout: [],
2588
- metadatas: {},
2589
- options: {},
2590
- settings: DEFAULT_SETTINGS
2591
- };
2592
- }, [data, isLoading, schemas, schema, components]);
2593
- const { layout: edit } = React.useMemo(
2594
- () => runHookWaterfall(HOOKS.MUTATE_EDIT_VIEW_LAYOUT, {
2595
- layout: editLayout,
2596
- query
2597
- }),
2598
- [editLayout, query, runHookWaterfall]
2599
- );
2600
- return {
2601
- error,
2602
- isLoading,
2603
- edit,
2604
- list: listLayout
2605
- };
2606
- };
2607
- const useDocLayout = () => {
2608
- const { model } = useDoc();
2609
- return useDocumentLayout(model);
2610
- };
2611
- const formatEditLayout = (data, {
2612
- schemas,
2613
- schema,
2614
- components
2615
- }) => {
2616
- let currentPanelIndex = 0;
2617
- const panelledEditAttributes = convertEditLayoutToFieldLayouts(
2618
- data.contentType.layouts.edit,
2619
- schema?.attributes,
2620
- data.contentType.metadatas,
2621
- { configurations: data.components, schemas: components },
2622
- schemas
2623
- ).reduce((panels, row) => {
2624
- if (row.some((field) => field.type === "dynamiczone")) {
2625
- panels.push([row]);
2626
- currentPanelIndex += 2;
2627
- } else {
2628
- if (!panels[currentPanelIndex]) {
2629
- panels.push([]);
2630
- }
2631
- panels[currentPanelIndex].push(row);
2632
- }
2633
- return panels;
2634
- }, []);
2635
- const componentEditAttributes = Object.entries(data.components).reduce(
2636
- (acc, [uid, configuration]) => {
2637
- acc[uid] = {
2638
- layout: convertEditLayoutToFieldLayouts(
2639
- configuration.layouts.edit,
2640
- components[uid].attributes,
2641
- configuration.metadatas
2642
- ),
2643
- settings: {
2644
- ...configuration.settings,
2645
- icon: components[uid].info.icon,
2646
- displayName: components[uid].info.displayName
2647
- }
2648
- };
2649
- return acc;
2650
- },
2651
- {}
2652
- );
2653
- const editMetadatas = Object.entries(data.contentType.metadatas).reduce(
2654
- (acc, [attribute, metadata]) => {
2655
- return {
2656
- ...acc,
2657
- [attribute]: metadata.edit
2658
- };
2659
- },
2660
- {}
2661
- );
2662
- return {
2663
- layout: panelledEditAttributes,
2664
- components: componentEditAttributes,
2665
- metadatas: editMetadatas,
2666
- settings: {
2667
- ...data.contentType.settings,
2668
- displayName: schema?.info.displayName
2669
- },
2670
- options: {
2671
- ...schema?.options,
2672
- ...schema?.pluginOptions,
2673
- ...data.contentType.options
2674
- }
2675
- };
2676
- };
2677
- const convertEditLayoutToFieldLayouts = (rows, attributes = {}, metadatas, components, schemas = []) => {
2678
- return rows.map(
2679
- (row) => row.map((field) => {
2680
- const attribute = attributes[field.name];
2681
- if (!attribute) {
2682
- return null;
2683
- }
2684
- const { edit: metadata } = metadatas[field.name];
2685
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2686
- return {
2687
- attribute,
2688
- disabled: !metadata.editable,
2689
- hint: metadata.description,
2690
- label: metadata.label ?? "",
2691
- name: field.name,
2692
- // @ts-expect-error – mainField does exist on the metadata for a relation.
2693
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2694
- schemas,
2695
- components: components?.schemas ?? {}
2696
- }),
2697
- placeholder: metadata.placeholder ?? "",
2698
- required: attribute.required ?? false,
2699
- size: field.size,
2700
- unique: "unique" in attribute ? attribute.unique : false,
2701
- visible: metadata.visible ?? true,
2702
- type: attribute.type
2703
- };
2704
- }).filter((field) => field !== null)
2705
- );
2706
- };
2707
- const formatListLayout = (data, {
2708
- schemas,
2709
- schema,
2710
- components
2711
- }) => {
2712
- const listMetadatas = Object.entries(data.contentType.metadatas).reduce(
2713
- (acc, [attribute, metadata]) => {
2714
- return {
2715
- ...acc,
2716
- [attribute]: metadata.list
2717
- };
2718
- },
2719
- {}
2720
- );
2721
- const listAttributes = convertListLayoutToFieldLayouts(
2722
- data.contentType.layouts.list,
2723
- schema?.attributes,
2724
- listMetadatas,
2725
- { configurations: data.components, schemas: components },
2726
- schemas
2727
- );
2728
- return {
2729
- layout: listAttributes,
2730
- settings: { ...data.contentType.settings, displayName: schema?.info.displayName },
2731
- metadatas: listMetadatas,
2732
- options: {
2733
- ...schema?.options,
2734
- ...schema?.pluginOptions,
2735
- ...data.contentType.options
2736
- }
2737
- };
2738
- };
2739
- const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, components, schemas = []) => {
2740
- return columns.map((name) => {
2741
- const attribute = attributes[name];
2742
- if (!attribute) {
2743
- return null;
2744
- }
2745
- const metadata = metadatas[name];
2746
- const settings = attribute.type === "component" && components ? components.configurations[attribute.component].settings : {};
2747
- return {
2748
- attribute,
2749
- label: metadata.label ?? "",
2750
- mainField: getMainField(attribute, metadata.mainField || settings.mainField, {
2751
- schemas,
2752
- components: components?.schemas ?? {}
2753
- }),
2754
- name,
2755
- searchable: metadata.searchable ?? true,
2756
- sortable: metadata.sortable ?? true
2757
- };
2758
- }).filter((field) => field !== null);
2759
- };
2760
- const ConfirmBulkActionDialog = ({
2761
- onToggleDialog,
2762
- isOpen = false,
2763
- dialogBody,
2764
- endAction
2765
- }) => {
2766
- const { formatMessage } = useIntl();
2767
- return /* @__PURE__ */ jsx(Dialog.Root, { onOpenChange: onToggleDialog, open: isOpen, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
2768
- /* @__PURE__ */ jsx(Dialog.Header, { children: formatMessage({
2769
- id: "app.components.ConfirmDialog.title",
2770
- defaultMessage: "Confirmation"
2771
- }) }),
2772
- /* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
2773
- /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
2774
- dialogBody
2775
- ] }) }),
2776
- /* @__PURE__ */ jsxs(Dialog.Footer, { children: [
2777
- /* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { fullWidth: true, onClick: onToggleDialog, variant: "tertiary", children: formatMessage({
2778
- id: "app.components.Button.cancel",
2779
- defaultMessage: "Cancel"
2780
- }) }) }),
2781
- endAction
2782
- ] })
2783
- ] }) });
2784
- };
2785
- const BoldChunk$1 = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
2786
- const ConfirmDialogPublishAll = ({
2787
- isOpen,
2788
- onToggleDialog,
2789
- isConfirmButtonLoading = false,
2790
- onConfirm
2791
- }) => {
2792
- const { formatMessage } = useIntl();
2793
- const selectedEntries = useTable("ConfirmDialogPublishAll", (state) => state.selectedRows);
2794
- const { toggleNotification } = useNotification();
2795
- const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler(getTranslation);
2796
- const { model, schema } = useDoc();
2797
- const [{ query }] = useQueryParams();
2798
- const {
2799
- data: countDraftRelations = 0,
2800
- isLoading,
2801
- error
2802
- } = useGetManyDraftRelationCountQuery(
2803
- {
2804
- model,
2805
- documentIds: selectedEntries.map((entry) => entry.documentId),
2806
- locale: query?.plugins?.i18n?.locale
2807
- },
2808
- {
2809
- skip: selectedEntries.length === 0
2810
- }
2811
- );
2812
- React.useEffect(() => {
2813
- if (error) {
2814
- toggleNotification({ type: "danger", message: formatAPIError(error) });
2815
- }
2816
- }, [error, formatAPIError, toggleNotification]);
2817
- if (error) {
2818
- return null;
2819
- }
2820
- return /* @__PURE__ */ jsx(
2821
- ConfirmBulkActionDialog,
2822
- {
2823
- isOpen: isOpen && !isLoading,
2824
- onToggleDialog,
2825
- dialogBody: /* @__PURE__ */ jsxs(Fragment, { children: [
2826
- /* @__PURE__ */ jsxs(Typography, { id: "confirm-description", textAlign: "center", children: [
2827
- countDraftRelations > 0 && formatMessage(
2828
- {
2829
- id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
2830
- defaultMessage: "<b>{count} {count, plural, one { relation } other { relations } } out of {entities} { entities, plural, one { entry } other { entries } } {count, plural, one { is } other { are } }</b> not published yet and might lead to unexpected behavior. "
2831
- },
2832
- {
2833
- b: BoldChunk$1,
2834
- count: countDraftRelations,
2835
- entities: selectedEntries.length
2836
- }
2837
- ),
2838
- formatMessage({
2839
- id: getTranslation("popUpWarning.bodyMessage.contentType.publish.all"),
2840
- defaultMessage: "Are you sure you want to publish these entries?"
2841
- })
2842
- ] }),
2843
- schema?.pluginOptions && "i18n" in schema.pluginOptions && schema?.pluginOptions.i18n && /* @__PURE__ */ jsx(Typography, { textColor: "danger500", textAlign: "center", children: formatMessage(
2844
- {
2845
- id: getTranslation("Settings.list.actions.publishAdditionalInfos"),
2846
- defaultMessage: "This will publish the active locale versions <em>(from Internationalization)</em>"
2847
- },
2848
- {
2849
- em: Emphasis
2850
- }
2851
- ) })
2852
- ] }),
2853
- endAction: /* @__PURE__ */ jsx(
2854
- Button,
2855
- {
2856
- onClick: onConfirm,
2857
- variant: "secondary",
2858
- startIcon: /* @__PURE__ */ jsx(Check, {}),
2859
- loading: isConfirmButtonLoading,
2860
- children: formatMessage({
2861
- id: "app.utils.publish",
2862
- defaultMessage: "Publish"
2863
- })
2864
- }
2865
- )
2866
- }
2867
- );
2868
- };
2869
- const TypographyMaxWidth = styled(Typography)`
2870
- max-width: 300px;
2871
- `;
2872
- const formatErrorMessages = (errors, parentKey, formatMessage) => {
2873
- const messages = [];
2874
- Object.entries(errors).forEach(([key, value]) => {
2875
- const currentKey = parentKey ? `${parentKey}.${key}` : key;
2876
- if (typeof value === "object" && value !== null && !Array.isArray(value)) {
2877
- if ("id" in value && "defaultMessage" in value) {
2878
- messages.push(
2879
- formatMessage(
2880
- {
2881
- id: `${value.id}.withField`,
2882
- defaultMessage: value.defaultMessage
2883
- },
2884
- { field: currentKey }
2885
- )
2886
- );
2887
- } else {
2888
- messages.push(...formatErrorMessages(value, currentKey, formatMessage));
2889
- }
2890
- } else {
2891
- messages.push(
2892
- formatMessage(
2893
- {
2894
- id: `${value}.withField`,
2895
- defaultMessage: value
2896
- },
2897
- { field: currentKey }
2898
- )
2899
- );
2900
- }
2901
- });
2902
- return messages;
2903
- };
2904
- const EntryValidationText = ({ validationErrors, status }) => {
2905
- const { formatMessage } = useIntl();
2906
- if (validationErrors) {
2907
- const validationErrorsMessages = formatErrorMessages(validationErrors, "", formatMessage).join(
2908
- " "
2909
- );
2910
- return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
2911
- /* @__PURE__ */ jsx(CrossCircle, { fill: "danger600" }),
2912
- /* @__PURE__ */ jsx(Tooltip, { description: validationErrorsMessages, children: /* @__PURE__ */ jsx(TypographyMaxWidth, { textColor: "danger600", variant: "omega", fontWeight: "semiBold", ellipsis: true, children: validationErrorsMessages }) })
2913
- ] });
2914
- }
2915
- if (status === "published") {
2916
- return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
2917
- /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
2918
- /* @__PURE__ */ jsx(Typography, { textColor: "success600", fontWeight: "bold", children: formatMessage({
2919
- id: "content-manager.bulk-publish.already-published",
2920
- defaultMessage: "Already Published"
2921
- }) })
2922
- ] });
2923
- }
2924
- if (status === "modified") {
2925
- return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
2926
- /* @__PURE__ */ jsx(ArrowsCounterClockwise, { fill: "alternative600" }),
2927
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({
2928
- id: "content-manager.bulk-publish.modified",
2929
- defaultMessage: "Ready to publish changes"
2930
- }) })
2931
- ] });
2932
- }
2933
- return /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
2934
- /* @__PURE__ */ jsx(CheckCircle, { fill: "success600" }),
2935
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({
2936
- id: "app.utils.ready-to-publish",
2937
- defaultMessage: "Ready to publish"
2938
- }) })
2939
- ] });
2940
- };
2941
- const TABLE_HEADERS = [
2942
- { name: "id", label: "id" },
2943
- { name: "name", label: "name" },
2944
- { name: "status", label: "status" },
2945
- { name: "publicationStatus", label: "Publication status" }
2946
- ];
2947
- const SelectedEntriesTableContent = ({
2948
- isPublishing,
2949
- rowsToDisplay = [],
2950
- entriesToPublish = [],
2951
- validationErrors = {}
2952
- }) => {
2953
- const { pathname } = useLocation();
2954
- const { formatMessage } = useIntl();
2955
- const {
2956
- list: {
2957
- settings: { mainField }
2958
- }
2959
- } = useDocLayout();
2960
- const shouldDisplayMainField = mainField != null && mainField !== "id";
2961
- return /* @__PURE__ */ jsxs(Table.Content, { children: [
2962
- /* @__PURE__ */ jsxs(Table.Head, { children: [
2963
- /* @__PURE__ */ jsx(Table.HeaderCheckboxCell, {}),
2964
- TABLE_HEADERS.filter((head) => head.name !== "name" || shouldDisplayMainField).map(
2965
- (head) => /* @__PURE__ */ jsx(Table.HeaderCell, { ...head }, head.name)
2966
- )
2967
- ] }),
2968
- /* @__PURE__ */ jsx(Table.Loading, {}),
2969
- /* @__PURE__ */ jsx(Table.Body, { children: rowsToDisplay.map((row, index2) => /* @__PURE__ */ jsxs(Table.Row, { children: [
2970
- /* @__PURE__ */ jsx(Table.CheckboxCell, { id: row.id }),
2971
- /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { children: row.id }) }),
2972
- shouldDisplayMainField && /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Typography, { children: row[mainField] }) }),
2973
- /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(DocumentStatus, { status: row.status, maxWidth: "min-content" }) }),
2974
- /* @__PURE__ */ jsx(Table.Cell, { children: isPublishing && entriesToPublish.includes(row.documentId) ? /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
2975
- /* @__PURE__ */ jsx(Typography, { children: formatMessage({
2976
- id: "content-manager.success.record.publishing",
2977
- defaultMessage: "Publishing..."
2978
- }) }),
2979
- /* @__PURE__ */ jsx(Loader, { small: true })
2980
- ] }) : /* @__PURE__ */ jsx(
2981
- EntryValidationText,
2982
- {
2983
- validationErrors: validationErrors[row.documentId],
2984
- status: row.status
2985
- }
2986
- ) }),
2987
- /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(
2988
- IconButton,
2989
- {
2990
- tag: Link,
2991
- to: {
2992
- pathname: `${pathname}/${row.documentId}`,
2993
- search: row.locale && `?plugins[i18n][locale]=${row.locale}`
2994
- },
2995
- state: { from: pathname },
2996
- label: formatMessage(
2997
- { id: "app.component.HelperPluginTable.edit", defaultMessage: "Edit {target}" },
2998
- {
2999
- target: formatMessage(
3000
- {
3001
- id: "content-manager.components.ListViewHelperPluginTable.row-line",
3002
- defaultMessage: "item line {number}"
3003
- },
3004
- { number: index2 + 1 }
3005
- )
3006
- }
3007
- ),
3008
- target: "_blank",
3009
- marginLeft: "auto",
3010
- children: /* @__PURE__ */ jsx(Pencil, {})
3011
- }
3012
- ) })
3013
- ] }, row.id)) })
3014
- ] });
3015
- };
3016
- const BoldChunk = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
3017
- const SelectedEntriesModalContent = ({
3018
- listViewSelectedEntries,
3019
- toggleModal,
3020
- setListViewSelectedDocuments,
3021
- model
3022
- }) => {
3023
- const { formatMessage } = useIntl();
3024
- const { schema, components } = useContentTypeSchema(model);
3025
- const documentIds = listViewSelectedEntries.map(({ documentId }) => documentId);
3026
- const [{ query }] = useQueryParams();
3027
- const params = React.useMemo(() => buildValidParams(query), [query]);
3028
- const { data, isLoading, isFetching, refetch } = useGetAllDocumentsQuery(
3029
- {
3030
- model,
3031
- params: {
3032
- page: "1",
3033
- pageSize: documentIds.length.toString(),
3034
- sort: query.sort,
3035
- filters: {
3036
- documentId: {
3037
- $in: documentIds
3038
- }
3039
- },
3040
- locale: query.plugins?.i18n?.locale
3041
- }
3042
- },
3043
- {
3044
- selectFromResult: ({ data: data2, ...restRes }) => ({ data: data2?.results ?? [], ...restRes })
3045
- }
3046
- );
3047
- const { rows, validationErrors } = React.useMemo(() => {
3048
- if (data.length > 0 && schema) {
3049
- const validate = createYupSchema(schema.attributes, components);
3050
- const validationErrors2 = {};
3051
- const rows2 = data.map((entry) => {
3052
- try {
3053
- validate.validateSync(entry, { abortEarly: false });
3054
- return entry;
3055
- } catch (e) {
3056
- if (e instanceof ValidationError) {
3057
- validationErrors2[entry.documentId] = getYupValidationErrors(e);
3058
- }
3059
- return entry;
3060
- }
3061
- });
3062
- return { rows: rows2, validationErrors: validationErrors2 };
3063
- }
3064
- return {
3065
- rows: [],
3066
- validationErrors: {}
3067
- };
3068
- }, [components, data, schema]);
3069
- const [publishedCount, setPublishedCount] = React.useState(0);
3070
- const [isDialogOpen, setIsDialogOpen] = React.useState(false);
3071
- const { publishMany: bulkPublishAction } = useDocumentActions();
3072
- const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();
3073
- const selectedRows = useTable("publishAction", (state) => state.selectedRows);
3074
- const selectedEntries = rows.filter(
3075
- (entry) => selectedRows.some((selectedEntry) => selectedEntry.documentId === entry.documentId)
3076
- );
3077
- const entriesToPublish = selectedEntries.filter((entry) => !validationErrors[entry.documentId]).map((entry) => entry.documentId);
3078
- const selectedEntriesWithErrorsCount = selectedEntries.filter(
3079
- ({ documentId }) => validationErrors[documentId]
3080
- ).length;
3081
- const selectedEntriesPublished = selectedEntries.filter(
3082
- ({ status }) => status === "published"
3083
- ).length;
3084
- const selectedEntriesWithNoErrorsCount = selectedEntries.length - selectedEntriesWithErrorsCount - selectedEntriesPublished;
3085
- const toggleDialog = () => setIsDialogOpen((prev) => !prev);
3086
- const handleConfirmBulkPublish = async () => {
3087
- toggleDialog();
3088
- const res = await bulkPublishAction({ model, documentIds: entriesToPublish, params });
3089
- if (!("error" in res)) {
3090
- setPublishedCount(res.count);
3091
- const unpublishedEntries = rows.filter((row) => {
3092
- return !entriesToPublish.includes(row.documentId);
3093
- });
3094
- setListViewSelectedDocuments(unpublishedEntries);
3095
- }
3096
- };
3097
- const getFormattedCountMessage = () => {
3098
- if (publishedCount) {
3099
- return formatMessage(
3100
- {
3101
- id: getTranslation("containers.list.selectedEntriesModal.publishedCount"),
3102
- defaultMessage: "<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} published. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
3103
- },
3104
- {
3105
- publishedCount,
3106
- withErrorsCount: selectedEntriesWithErrorsCount,
3107
- b: BoldChunk
3108
- }
3109
- );
3110
- }
3111
- return formatMessage(
3112
- {
3113
- id: getTranslation("containers.list.selectedEntriesModal.selectedCount"),
3114
- defaultMessage: "<b>{alreadyPublishedCount}</b> {alreadyPublishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{readyToPublishCount}</b> {readyToPublishCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
3115
- },
3116
- {
3117
- readyToPublishCount: selectedEntriesWithNoErrorsCount,
3118
- withErrorsCount: selectedEntriesWithErrorsCount,
3119
- alreadyPublishedCount: selectedEntriesPublished,
3120
- b: BoldChunk
3121
- }
3122
- );
3123
- };
3124
- return /* @__PURE__ */ jsxs(Fragment, { children: [
3125
- /* @__PURE__ */ jsxs(Modal.Body, { children: [
3126
- /* @__PURE__ */ jsx(Typography, { children: getFormattedCountMessage() }),
3127
- /* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsx(
3128
- SelectedEntriesTableContent,
3129
- {
3130
- isPublishing: isSubmittingForm,
3131
- rowsToDisplay: rows,
3132
- entriesToPublish,
3133
- validationErrors
3134
- }
3135
- ) })
3136
- ] }),
3137
- /* @__PURE__ */ jsxs(Modal.Footer, { children: [
3138
- /* @__PURE__ */ jsx(Button, { onClick: toggleModal, variant: "tertiary", children: formatMessage({
3139
- id: "app.components.Button.cancel",
3140
- defaultMessage: "Cancel"
3141
- }) }),
3142
- /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
3143
- /* @__PURE__ */ jsx(Button, { onClick: refetch, variant: "tertiary", loading: isFetching, children: formatMessage({ id: "app.utils.refresh", defaultMessage: "Refresh" }) }),
3144
- /* @__PURE__ */ jsx(
3145
- Button,
3146
- {
3147
- onClick: toggleDialog,
3148
- disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublished === selectedEntries.length || isLoading,
3149
- loading: isSubmittingForm,
3150
- children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
3151
- }
3152
- )
3153
- ] })
3154
- ] }),
3155
- /* @__PURE__ */ jsx(
3156
- ConfirmDialogPublishAll,
3157
- {
3158
- isOpen: isDialogOpen,
3159
- onToggleDialog: toggleDialog,
3160
- isConfirmButtonLoading: isSubmittingForm,
3161
- onConfirm: handleConfirmBulkPublish
3162
- }
3163
- )
3164
- ] });
3165
- };
3166
- const PublishAction = ({ documents, model }) => {
3167
- const { formatMessage } = useIntl();
3168
- const hasPublishPermission = useDocumentRBAC("unpublishAction", (state) => state.canPublish);
3169
- const showPublishButton = hasPublishPermission && documents.some(({ status }) => status !== "published");
3170
- const setListViewSelectedDocuments = useTable("publishAction", (state) => state.selectRow);
3171
- const refetchList = () => {
3172
- contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
3173
- };
3174
- if (!showPublishButton)
3175
- return null;
3176
- return {
3177
- actionType: "publish",
3178
- variant: "tertiary",
3179
- label: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" }),
3180
- dialog: {
3181
- type: "modal",
3182
- title: formatMessage({
3183
- id: getTranslation("containers.ListPage.selectedEntriesModal.title"),
3184
- defaultMessage: "Publish entries"
3185
- }),
3186
- content: ({ onClose }) => {
3187
- return /* @__PURE__ */ jsx(Table.Root, { rows: documents, defaultSelectedRows: documents, headers: TABLE_HEADERS, children: /* @__PURE__ */ jsx(
3188
- SelectedEntriesModalContent,
3189
- {
3190
- listViewSelectedEntries: documents,
3191
- toggleModal: () => {
3192
- onClose();
3193
- refetchList();
3194
- },
3195
- setListViewSelectedDocuments,
3196
- model
3197
- }
3198
- ) });
3199
- },
3200
- onClose: () => {
3201
- refetchList();
3202
- }
3203
- }
3204
- };
3205
- };
3206
- const BulkActionsRenderer = () => {
3207
- const plugins = useStrapiApp("BulkActionsRenderer", (state) => state.plugins);
3208
- const { model, collectionType } = useDoc();
3209
- const { selectedRows } = useTable("BulkActionsRenderer", (state) => state);
3210
- return /* @__PURE__ */ jsx(Flex, { gap: 2, children: /* @__PURE__ */ jsx(
3211
- DescriptionComponentRenderer,
3212
- {
3213
- props: {
3214
- model,
3215
- collectionType,
3216
- documents: selectedRows
3217
- },
3218
- descriptions: plugins["content-manager"].apis.getBulkActions(),
3219
- children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsx(DocumentActionButton, { ...action }, action.id))
3220
- }
3221
- ) });
3222
- };
3223
- const DeleteAction = ({ documents, model }) => {
3224
- const { formatMessage } = useIntl();
3225
- const { schema: contentType } = useDoc();
3226
- const selectRow = useTable("DeleteAction", (state) => state.selectRow);
3227
- const hasI18nEnabled = Boolean(contentType?.pluginOptions?.i18n);
3228
- const [{ query }] = useQueryParams();
3229
- const params = React.useMemo(() => buildValidParams(query), [query]);
3230
- const hasDeletePermission = useDocumentRBAC("deleteAction", (state) => state.canDelete);
3231
- const { deleteMany: bulkDeleteAction } = useDocumentActions();
3232
- const documentIds = documents.map(({ documentId }) => documentId);
3233
- const handleConfirmBulkDelete = async () => {
3234
- const res = await bulkDeleteAction({
3235
- documentIds,
3236
- model,
3237
- params
3238
- });
3239
- if (!("error" in res)) {
3240
- selectRow([]);
3241
- }
3242
- };
3243
- if (!hasDeletePermission)
3244
- return null;
3245
- return {
3246
- variant: "danger-light",
3247
- label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
3248
- dialog: {
3249
- type: "dialog",
3250
- title: formatMessage({
3251
- id: "app.components.ConfirmDialog.title",
3252
- defaultMessage: "Confirmation"
3253
- }),
3254
- content: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
3255
- /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
3256
- /* @__PURE__ */ jsx(Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
3257
- id: "popUpWarning.bodyMessage.contentType.delete.all",
3258
- defaultMessage: "Are you sure you want to delete these entries?"
3259
- }) }),
3260
- hasI18nEnabled && /* @__PURE__ */ jsx(Box, { textAlign: "center", padding: 3, children: /* @__PURE__ */ jsx(Typography, { textColor: "danger500", children: formatMessage(
3261
- {
3262
- id: getTranslation("Settings.list.actions.deleteAdditionalInfos"),
3263
- defaultMessage: "This will delete the active locale versions <em>(from Internationalization)</em>"
3264
- },
3265
- {
3266
- em: Emphasis
3267
- }
3268
- ) }) })
3269
- ] }),
3270
- onConfirm: handleConfirmBulkDelete
3271
- }
3272
- };
3273
- };
3274
- DeleteAction.type = "delete";
3275
- const UnpublishAction = ({ documents, model }) => {
3276
- const { formatMessage } = useIntl();
3277
- const { schema } = useDoc();
3278
- const selectRow = useTable("UnpublishAction", (state) => state.selectRow);
3279
- const hasPublishPermission = useDocumentRBAC("unpublishAction", (state) => state.canPublish);
3280
- const hasI18nEnabled = Boolean(schema?.pluginOptions?.i18n);
3281
- const hasDraftAndPublishEnabled = Boolean(schema?.options?.draftAndPublish);
3282
- const { unpublishMany: bulkUnpublishAction } = useDocumentActions();
3283
- const documentIds = documents.map(({ documentId }) => documentId);
3284
- const [{ query }] = useQueryParams();
3285
- const params = React.useMemo(() => buildValidParams(query), [query]);
3286
- const handleConfirmBulkUnpublish = async () => {
3287
- const data = await bulkUnpublishAction({ documentIds, model, params });
3288
- if (!("error" in data)) {
3289
- selectRow([]);
3290
- }
3291
- };
3292
- const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
3293
- if (!showUnpublishButton)
3294
- return null;
3295
- return {
3296
- variant: "tertiary",
3297
- label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
3298
- dialog: {
3299
- type: "dialog",
3300
- title: formatMessage({
3301
- id: "app.components.ConfirmDialog.title",
3302
- defaultMessage: "Confirmation"
3303
- }),
3304
- content: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
3305
- /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
3306
- /* @__PURE__ */ jsx(Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
3307
- id: "popUpWarning.bodyMessage.contentType.unpublish.all",
3308
- defaultMessage: "Are you sure you want to unpublish these entries?"
3309
- }) }),
3310
- hasI18nEnabled && /* @__PURE__ */ jsx(Box, { textAlign: "center", padding: 3, children: /* @__PURE__ */ jsx(Typography, { textColor: "danger500", children: formatMessage(
3311
- {
3312
- id: getTranslation("Settings.list.actions.unpublishAdditionalInfos"),
3313
- defaultMessage: "This will unpublish the active locale versions <em>(from Internationalization)</em>"
3314
- },
3315
- {
3316
- em: Emphasis
3317
- }
3318
- ) }) })
3319
- ] }),
3320
- confirmButton: formatMessage({
3321
- id: "app.utils.unpublish",
3322
- defaultMessage: "Unpublish"
3323
- }),
3324
- onConfirm: handleConfirmBulkUnpublish
3325
- }
3326
- };
3327
- };
3328
- UnpublishAction.type = "unpublish";
3329
- const Emphasis = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "semiBold", textColor: "danger500", children: chunks });
3330
- const DEFAULT_BULK_ACTIONS = [PublishAction, UnpublishAction, DeleteAction];
3331
- const AutoCloneFailureModalBody = ({ prohibitedFields }) => {
3332
- const { formatMessage } = useIntl();
3333
- const getDefaultErrorMessage = (reason) => {
3334
- switch (reason) {
3335
- case "relation":
3336
- return "Duplicating the relation could remove it from the original entry.";
3337
- case "unique":
3338
- return "Identical values in a unique field are not allowed";
3339
- default:
3340
- return reason;
3341
- }
3342
- };
3343
- return /* @__PURE__ */ jsxs(Fragment, { children: [
3344
- /* @__PURE__ */ jsx(Typography, { variant: "beta", children: formatMessage({
3345
- id: getTranslation("containers.list.autoCloneModal.title"),
3346
- defaultMessage: "This entry can't be duplicated directly."
3347
- }) }),
3348
- /* @__PURE__ */ jsx(Box, { marginTop: 2, children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatMessage({
3349
- id: getTranslation("containers.list.autoCloneModal.description"),
3350
- defaultMessage: "A new entry will be created with the same content, but you'll have to change the following fields to save it."
3351
- }) }) }),
3352
- /* @__PURE__ */ jsx(Flex, { marginTop: 6, gap: 2, direction: "column", alignItems: "stretch", children: prohibitedFields.map(([fieldPath, reason]) => /* @__PURE__ */ jsxs(
3353
- Flex,
3354
- {
3355
- direction: "column",
3356
- gap: 2,
3357
- alignItems: "flex-start",
3358
- borderColor: "neutral200",
3359
- hasRadius: true,
3360
- padding: 6,
3361
- children: [
3362
- /* @__PURE__ */ jsx(Flex, { direction: "row", tag: "ol", children: fieldPath.map((pathSegment, index2) => /* @__PURE__ */ jsxs(Typography, { fontWeight: "semiBold", tag: "li", children: [
3363
- pathSegment,
3364
- index2 !== fieldPath.length - 1 && /* @__PURE__ */ jsx(
3365
- ChevronRight,
3366
- {
3367
- fill: "neutral500",
3368
- height: "0.8rem",
3369
- width: "0.8rem",
3370
- style: { margin: "0 0.8rem" }
3371
- }
3372
- )
3373
- ] }, index2)) }),
3374
- /* @__PURE__ */ jsx(Typography, { tag: "p", textColor: "neutral600", children: formatMessage({
3375
- id: getTranslation(`containers.list.autoCloneModal.error.${reason}`),
3376
- defaultMessage: getDefaultErrorMessage(reason)
3377
- }) })
3378
- ]
3379
- },
3380
- fieldPath.join()
3381
- )) })
3382
- ] });
3383
- };
3384
- const TableActions = ({ document }) => {
3385
- const { formatMessage } = useIntl();
3386
- const { model, collectionType } = useDoc();
3387
- const plugins = useStrapiApp("TableActions", (state) => state.plugins);
3388
- const props = {
3389
- activeTab: null,
3390
- model,
3391
- documentId: document.documentId,
3392
- collectionType,
3393
- document
3394
- };
3395
- return /* @__PURE__ */ jsx(
3396
- DescriptionComponentRenderer,
3397
- {
3398
- props,
3399
- descriptions: plugins["content-manager"].apis.getDocumentActions(),
3400
- children: (actions2) => {
3401
- const tableRowActions = actions2.filter((action) => {
3402
- const positions = Array.isArray(action.position) ? action.position : [action.position];
3403
- return positions.includes("table-row");
3404
- });
3405
- return /* @__PURE__ */ jsx(
3406
- DocumentActionsMenu,
3407
- {
3408
- actions: tableRowActions,
3409
- label: formatMessage({
3410
- id: "content-manager.containers.list.table.row-actions",
3411
- defaultMessage: "Row action"
3412
- }),
3413
- variant: "ghost"
3414
- }
3415
- );
3416
- }
3417
- }
3418
- );
3419
- };
3420
- const EditAction = ({ documentId }) => {
3421
- const navigate = useNavigate();
3422
- const { formatMessage } = useIntl();
3423
- const { canRead } = useDocumentRBAC("EditAction", ({ canRead: canRead2 }) => ({ canRead: canRead2 }));
3424
- const { toggleNotification } = useNotification();
3425
- const [{ query }] = useQueryParams();
3426
- return {
3427
- disabled: !canRead,
3428
- icon: /* @__PURE__ */ jsx(StyledPencil, {}),
3429
- label: formatMessage({
3430
- id: "content-manager.actions.edit.label",
3431
- defaultMessage: "Edit"
3432
- }),
3433
- position: "table-row",
3434
- onClick: async () => {
3435
- if (!documentId) {
3436
- console.error(
3437
- "You're trying to edit a document without an id, this is likely a bug with Strapi. Please open an issue."
3438
- );
3439
- toggleNotification({
3440
- message: formatMessage({
3441
- id: "content-manager.actions.edit.error",
3442
- defaultMessage: "An error occurred while trying to edit the document."
3443
- }),
3444
- type: "danger"
3445
- });
3446
- return;
3447
- }
3448
- navigate({
3449
- pathname: documentId,
3450
- search: stringify({
3451
- plugins: query.plugins
3452
- })
3453
- });
3454
- }
3455
- };
3456
- };
3457
- EditAction.type = "edit";
3458
- const StyledPencil = styled(Pencil)`
3459
- path {
3460
- fill: currentColor;
3461
- }
3462
- `;
3463
- const CloneAction = ({ model, documentId }) => {
3464
- const navigate = useNavigate();
3465
- const { formatMessage } = useIntl();
3466
- const { canCreate } = useDocumentRBAC("CloneAction", ({ canCreate: canCreate2 }) => ({ canCreate: canCreate2 }));
3467
- const { toggleNotification } = useNotification();
3468
- const { autoClone } = useDocumentActions();
3469
- const [prohibitedFields, setProhibitedFields] = React.useState([]);
3470
- return {
3471
- disabled: !canCreate,
3472
- icon: /* @__PURE__ */ jsx(StyledDuplicate, {}),
3473
- label: formatMessage({
3474
- id: "content-manager.actions.clone.label",
3475
- defaultMessage: "Duplicate"
3476
- }),
3477
- position: "table-row",
3478
- onClick: async () => {
3479
- if (!documentId) {
3480
- console.error(
3481
- "You're trying to clone a document in the table without an id, this is likely a bug with Strapi. Please open an issue."
3482
- );
3483
- toggleNotification({
3484
- message: formatMessage({
3485
- id: "content-manager.actions.clone.error",
3486
- defaultMessage: "An error occurred while trying to clone the document."
3487
- }),
3488
- type: "danger"
3489
- });
3490
- return;
3491
- }
3492
- const res = await autoClone({ model, sourceId: documentId });
3493
- if ("data" in res) {
3494
- navigate(res.data.documentId);
3495
- return true;
3496
- }
3497
- if (isBaseQueryError(res.error) && res.error.details && typeof res.error.details === "object" && "prohibitedFields" in res.error.details && Array.isArray(res.error.details.prohibitedFields)) {
3498
- const prohibitedFields2 = res.error.details.prohibitedFields;
3499
- setProhibitedFields(prohibitedFields2);
3500
- }
3501
- },
3502
- dialog: {
3503
- type: "modal",
3504
- title: formatMessage({
3505
- id: "content-manager.containers.list.autoCloneModal.header",
3506
- defaultMessage: "Duplicate"
3507
- }),
3508
- content: /* @__PURE__ */ jsx(AutoCloneFailureModalBody, { prohibitedFields }),
3509
- footer: ({ onClose }) => {
3510
- return /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
3511
- /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
3512
- id: "cancel",
3513
- defaultMessage: "Cancel"
3514
- }) }),
3515
- /* @__PURE__ */ jsx(
3516
- LinkButton,
3517
- {
3518
- tag: NavLink,
3519
- to: {
3520
- pathname: `clone/${documentId}`
3521
- },
3522
- children: formatMessage({
3523
- id: "content-manager.containers.list.autoCloneModal.create",
3524
- defaultMessage: "Create"
3525
- })
3526
- }
3527
- )
3528
- ] });
3529
- }
3530
- }
3531
- };
3532
- };
3533
- CloneAction.type = "clone";
3534
- const StyledDuplicate = styled(Duplicate)`
3535
- path {
3536
- fill: currentColor;
3537
- }
3538
- `;
3539
- const DEFAULT_TABLE_ROW_ACTIONS = [EditAction, CloneAction];
3540
- class ContentManagerPlugin {
3541
- /**
3542
- * The following properties are the stored ones provided by any plugins registering with
3543
- * the content-manager. The function calls however, need to be called at runtime in the
3544
- * application, so instead we collate them and run them later with the complete list incl.
3545
- * ones already registered & the context of the view.
3546
- */
3547
- bulkActions = [...DEFAULT_BULK_ACTIONS];
3548
- documentActions = [
3549
- ...DEFAULT_ACTIONS,
3550
- ...DEFAULT_TABLE_ROW_ACTIONS,
3551
- ...DEFAULT_HEADER_ACTIONS,
3552
- HistoryAction
3553
- ];
3554
- editViewSidePanels = [ActionsPanel];
3555
- headerActions = [];
3556
- constructor() {
3557
- }
3558
- addEditViewSidePanel(panels) {
3559
- if (Array.isArray(panels)) {
3560
- this.editViewSidePanels = [...this.editViewSidePanels, ...panels];
3561
- } else if (typeof panels === "function") {
3562
- this.editViewSidePanels = panels(this.editViewSidePanels);
3563
- } else {
3564
- throw new Error(
3565
- `Expected the \`panels\` passed to \`addEditViewSidePanel\` to be an array or a function, but received ${getPrintableType(
3566
- panels
3567
- )}`
3568
- );
3569
- }
3570
- }
3571
- addDocumentAction(actions2) {
3572
- if (Array.isArray(actions2)) {
3573
- this.documentActions = [...this.documentActions, ...actions2];
3574
- } else if (typeof actions2 === "function") {
3575
- this.documentActions = actions2(this.documentActions);
3576
- } else {
3577
- throw new Error(
3578
- `Expected the \`actions\` passed to \`addDocumentAction\` to be an array or a function, but received ${getPrintableType(
3579
- actions2
3580
- )}`
3581
- );
3582
- }
3583
- }
3584
- addDocumentHeaderAction(actions2) {
3585
- if (Array.isArray(actions2)) {
3586
- this.headerActions = [...this.headerActions, ...actions2];
3587
- } else if (typeof actions2 === "function") {
3588
- this.headerActions = actions2(this.headerActions);
3589
- } else {
3590
- throw new Error(
3591
- `Expected the \`actions\` passed to \`addDocumentHeaderAction\` to be an array or a function, but received ${getPrintableType(
3592
- actions2
3593
- )}`
3594
- );
3595
- }
3596
- }
3597
- addBulkAction(actions2) {
3598
- if (Array.isArray(actions2)) {
3599
- this.bulkActions = [...this.bulkActions, ...actions2];
3600
- } else if (typeof actions2 === "function") {
3601
- this.bulkActions = actions2(this.bulkActions);
3602
- } else {
3603
- throw new Error(
3604
- `Expected the \`actions\` passed to \`addBulkAction\` to be an array or a function, but received ${getPrintableType(
3605
- actions2
3606
- )}`
3607
- );
3608
- }
3609
- }
3610
- get config() {
3611
- return {
3612
- id: PLUGIN_ID,
3613
- name: "Content Manager",
3614
- injectionZones: INJECTION_ZONES,
3615
- apis: {
3616
- addBulkAction: this.addBulkAction.bind(this),
3617
- addDocumentAction: this.addDocumentAction.bind(this),
3618
- addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
3619
- addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
3620
- getBulkActions: () => this.bulkActions,
3621
- getDocumentActions: () => this.documentActions,
3622
- getEditViewSidePanels: () => this.editViewSidePanels,
3623
- getHeaderActions: () => this.headerActions
3624
- }
3625
- };
3626
- }
3627
- }
3628
- const getPrintableType = (value) => {
3629
- const nativeType = typeof value;
3630
- if (nativeType === "object") {
3631
- if (value === null)
3632
- return "null";
3633
- if (Array.isArray(value))
3634
- return "array";
3635
- if (value instanceof Object && value.constructor.name !== "Object") {
3636
- return value.constructor.name;
3637
- }
3638
- }
3639
- return nativeType;
3640
- };
3641
- const initialState = {
3642
- collectionTypeLinks: [],
3643
- components: [],
3644
- fieldSizes: {},
3645
- models: [],
3646
- singleTypeLinks: [],
3647
- isLoading: true
3648
- };
3649
- const appSlice = createSlice({
3650
- name: "app",
3651
- initialState,
3652
- reducers: {
3653
- setInitialData(state, action) {
3654
- const {
3655
- authorizedCollectionTypeLinks,
3656
- authorizedSingleTypeLinks,
3657
- components,
3658
- contentTypeSchemas,
3659
- fieldSizes
3660
- } = action.payload;
3661
- state.collectionTypeLinks = authorizedCollectionTypeLinks.filter(
3662
- ({ isDisplayed }) => isDisplayed
3663
- );
3664
- state.singleTypeLinks = authorizedSingleTypeLinks.filter(({ isDisplayed }) => isDisplayed);
3665
- state.components = components;
3666
- state.models = contentTypeSchemas;
3667
- state.fieldSizes = fieldSizes;
3668
- state.isLoading = false;
3669
- }
3670
- }
3671
- });
3672
- const { actions, reducer: reducer$1 } = appSlice;
3673
- const { setInitialData } = actions;
3674
- const reducer = combineReducers({
3675
- app: reducer$1
3676
- });
3677
- const index = {
3678
- register(app) {
3679
- const cm = new ContentManagerPlugin();
3680
- app.addReducers({
3681
- [PLUGIN_ID]: reducer
3682
- });
3683
- app.addMenuLink({
3684
- to: PLUGIN_ID,
3685
- icon: Feather,
3686
- intlLabel: {
3687
- id: `content-manager.plugin.name`,
3688
- defaultMessage: "Content Manager"
3689
- },
3690
- permissions: [],
3691
- Component: () => import("./layout-DC503LnF.mjs").then((mod) => ({ default: mod.Layout })),
3692
- position: 1
3693
- });
3694
- app.registerPlugin(cm.config);
3695
- },
3696
- async registerTrads({ locales }) {
3697
- const importedTrads = await Promise.all(
3698
- locales.map((locale) => {
3699
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-Ux26r5pl.mjs"), "./translations/es.json": () => import("./es-CeXiYflN.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr-CD9VFbPM.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-CtsUxOvk.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
3700
- return {
3701
- data: prefixPluginTranslations(data, PLUGIN_ID),
3702
- locale
3703
- };
3704
- }).catch(() => {
3705
- return {
3706
- data: {},
3707
- locale
3708
- };
3709
- });
3710
- })
3711
- );
3712
- return Promise.resolve(importedTrads);
3713
- }
3714
- };
3715
- export {
3716
- ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD as A,
3717
- BulkActionsRenderer as B,
3718
- COLLECTION_TYPES as C,
3719
- DocumentStatus as D,
3720
- extractContentTypeComponents as E,
3721
- DEFAULT_SETTINGS as F,
3722
- convertEditLayoutToFieldLayouts as G,
3723
- HOOKS as H,
3724
- InjectionZone as I,
3725
- useDocument as J,
3726
- index as K,
3727
- useDocumentActions as L,
3728
- Panels as P,
3729
- RelativeTime as R,
3730
- SINGLE_TYPES as S,
3731
- TableActions as T,
3732
- useGetInitialDataQuery as a,
3733
- useGetAllContentTypeSettingsQuery as b,
3734
- useDoc as c,
3735
- buildValidParams as d,
3736
- contentManagerApi as e,
3737
- useDocumentRBAC as f,
3738
- getTranslation as g,
3739
- useDocumentLayout as h,
3740
- createYupSchema as i,
3741
- Header as j,
3742
- PERMISSIONS as k,
3743
- DocumentRBAC as l,
3744
- DOCUMENT_META_FIELDS as m,
3745
- useDocLayout as n,
3746
- useGetContentTypeConfigurationQuery as o,
3747
- CREATOR_FIELDS as p,
3748
- getMainField as q,
3749
- routes as r,
3750
- setInitialData as s,
3751
- getDisplayName as t,
3752
- useContentTypeSchema as u,
3753
- checkIfAttributeIsDisplayable as v,
3754
- useGetAllDocumentsQuery as w,
3755
- convertListLayoutToFieldLayouts as x,
3756
- capitalise as y,
3757
- useUpdateContentTypeConfigurationMutation as z
3758
- };
3759
- //# sourceMappingURL=index-JNNNKUHs.mjs.map