@strapi/content-manager 0.0.0-next.f09127d8df0234ad0b771b931b044b7c2e09c686 → 0.0.0-next.f09bff0783c6e3dfd3c34ed73b6f1a47de7b8d80

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