@strapi/content-manager 0.0.0-next.d6ed4fcf2c833656b8c91a90909c1e77c79379e5 → 0.0.0-next.e61eff51f9834ffdef16bdc236aecab5f837723b

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