@strapi/content-manager 0.0.0-next.6d1431fe2a53b80b47ad9f00187cd7bae9d5f46b → 0.0.0-next.6d1dbc97a99dbfe8847598f6cbea3f7a1df2c89c

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