@strapi/content-manager 0.0.0-next.af5da17207f828ea159182ea6e2d9a07ae6d34bf → 0.0.0-next.b4e84114b7bd2b58e34af3f2a7febca9845e6f86

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