@strapi/content-manager 0.0.0 → 5.0.0-beta.6

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