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

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