@strapi/content-manager 0.0.0-experimental.d042f6a350fa3a48d61e7c56875e2a0a7ba3c8f5 → 0.0.0-experimental.d2a56e52af31fcf0f0c582a5a2e58e310966e96b

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 (431) 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-CGn9IYeg.js +298 -0
  6. package/dist/admin/chunks/ComponentConfigurationPage-CGn9IYeg.js.map +1 -0
  7. package/dist/admin/chunks/ComponentConfigurationPage-DgYK4xW6.mjs +276 -0
  8. package/dist/admin/chunks/ComponentConfigurationPage-DgYK4xW6.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-7w_-4jF4.js +180 -0
  14. package/dist/admin/chunks/EditConfigurationPage-7w_-4jF4.js.map +1 -0
  15. package/dist/admin/chunks/EditConfigurationPage-C05SwwH-.mjs +158 -0
  16. package/dist/admin/chunks/EditConfigurationPage-C05SwwH-.mjs.map +1 -0
  17. package/dist/admin/chunks/EditViewPage-CVRJBOEv.mjs +318 -0
  18. package/dist/admin/chunks/EditViewPage-CVRJBOEv.mjs.map +1 -0
  19. package/dist/admin/chunks/EditViewPage-CuQfZJDf.js +341 -0
  20. package/dist/admin/chunks/EditViewPage-CuQfZJDf.js.map +1 -0
  21. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.mjs +56 -0
  22. package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.mjs.map +1 -0
  23. package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js +58 -0
  24. package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js.map +1 -0
  25. package/dist/admin/chunks/Form-BqNYRsCb.js +978 -0
  26. package/dist/admin/chunks/Form-BqNYRsCb.js.map +1 -0
  27. package/dist/admin/chunks/Form-DaEnqAeV.mjs +955 -0
  28. package/dist/admin/chunks/Form-DaEnqAeV.mjs.map +1 -0
  29. package/dist/admin/chunks/History-B7dGNfmx.mjs +1361 -0
  30. package/dist/admin/chunks/History-B7dGNfmx.mjs.map +1 -0
  31. package/dist/admin/chunks/History-CEoOna4w.js +1384 -0
  32. package/dist/admin/chunks/History-CEoOna4w.js.map +1 -0
  33. package/dist/admin/chunks/Input-B3QUS9rv.mjs +8473 -0
  34. package/dist/admin/chunks/Input-B3QUS9rv.mjs.map +1 -0
  35. package/dist/admin/chunks/Input-B8I0b9aD.js +8507 -0
  36. package/dist/admin/chunks/Input-B8I0b9aD.js.map +1 -0
  37. package/dist/admin/chunks/ListConfigurationPage-BbjJweN-.js +818 -0
  38. package/dist/admin/chunks/ListConfigurationPage-BbjJweN-.js.map +1 -0
  39. package/dist/admin/chunks/ListConfigurationPage-VtFQ5mOK.mjs +795 -0
  40. package/dist/admin/chunks/ListConfigurationPage-VtFQ5mOK.mjs.map +1 -0
  41. package/dist/admin/chunks/ListViewPage-Cg3zbT7Y.mjs +1132 -0
  42. package/dist/admin/chunks/ListViewPage-Cg3zbT7Y.mjs.map +1 -0
  43. package/dist/admin/chunks/ListViewPage-CzUm2VJN.js +1154 -0
  44. package/dist/admin/chunks/ListViewPage-CzUm2VJN.js.map +1 -0
  45. package/dist/admin/chunks/NoContentTypePage-FcLLn2Wt.js +60 -0
  46. package/dist/admin/chunks/NoContentTypePage-FcLLn2Wt.js.map +1 -0
  47. package/dist/admin/chunks/NoContentTypePage-NOf7Aq_E.mjs +58 -0
  48. package/dist/admin/chunks/NoContentTypePage-NOf7Aq_E.mjs.map +1 -0
  49. package/dist/admin/chunks/NoPermissionsPage-DmeyXtCk.js +39 -0
  50. package/dist/admin/chunks/NoPermissionsPage-DmeyXtCk.js.map +1 -0
  51. package/dist/admin/chunks/NoPermissionsPage-OVr9KG6L.mjs +37 -0
  52. package/dist/admin/chunks/NoPermissionsPage-OVr9KG6L.mjs.map +1 -0
  53. package/dist/admin/chunks/Preview-BH9l1QXk.mjs +593 -0
  54. package/dist/admin/chunks/Preview-BH9l1QXk.mjs.map +1 -0
  55. package/dist/admin/chunks/Preview-BYKkpc11.js +615 -0
  56. package/dist/admin/chunks/Preview-BYKkpc11.js.map +1 -0
  57. package/dist/admin/chunks/ar-DckYq_WK.mjs +222 -0
  58. package/dist/{_chunks/ar-CCEVvqGG.mjs.map → admin/chunks/ar-DckYq_WK.mjs.map} +1 -1
  59. package/dist/admin/chunks/ar-DeQBSsfl.js +227 -0
  60. package/dist/{_chunks/ru-BT3ybNny.js.map → admin/chunks/ar-DeQBSsfl.js.map} +1 -1
  61. package/dist/admin/chunks/ca-ClDTvatJ.js +202 -0
  62. package/dist/admin/chunks/ca-ClDTvatJ.js.map +1 -0
  63. package/dist/admin/chunks/ca-DviY7mRj.mjs +197 -0
  64. package/dist/admin/chunks/ca-DviY7mRj.mjs.map +1 -0
  65. package/dist/admin/chunks/cs-BJFxwIWj.js +126 -0
  66. package/dist/{_chunks/cs-CkJy6B2v.js.map → admin/chunks/cs-BJFxwIWj.js.map} +1 -1
  67. package/dist/admin/chunks/cs-C7OSYFQ7.mjs +122 -0
  68. package/dist/{_chunks/cs-CM2aBUar.mjs.map → admin/chunks/cs-C7OSYFQ7.mjs.map} +1 -1
  69. package/dist/admin/chunks/de-5QRlDHyR.mjs +195 -0
  70. package/dist/{_chunks/eu-CdALomew.mjs.map → admin/chunks/de-5QRlDHyR.mjs.map} +1 -1
  71. package/dist/admin/chunks/de-CbImAUA5.js +200 -0
  72. package/dist/{_chunks/gu-BRmF601H.js.map → admin/chunks/de-CbImAUA5.js.map} +1 -1
  73. package/dist/admin/chunks/en-C2zEwS3-.mjs +313 -0
  74. package/dist/{_chunks/en-D65uIF6Y.mjs.map → admin/chunks/en-C2zEwS3-.mjs.map} +1 -1
  75. package/dist/admin/chunks/en-G976DLsg.js +318 -0
  76. package/dist/{_chunks/en-BR48D_RH.js.map → admin/chunks/en-G976DLsg.js.map} +1 -1
  77. package/dist/admin/chunks/es-C8vLuvZL.js +197 -0
  78. package/dist/{_chunks/es-9K52xZIr.js.map → admin/chunks/es-C8vLuvZL.js.map} +1 -1
  79. package/dist/admin/chunks/es-DkoWSExG.mjs +192 -0
  80. package/dist/{_chunks/ja-BHqhDq4V.mjs.map → admin/chunks/es-DkoWSExG.mjs.map} +1 -1
  81. package/dist/admin/chunks/eu-BG1xX7HK.mjs +198 -0
  82. package/dist/admin/chunks/eu-BG1xX7HK.mjs.map +1 -0
  83. package/dist/admin/chunks/eu-BJW3AvXu.js +203 -0
  84. package/dist/admin/chunks/eu-BJW3AvXu.js.map +1 -0
  85. package/dist/admin/chunks/fr-CFdRaRVj.mjs +215 -0
  86. package/dist/admin/chunks/fr-CFdRaRVj.mjs.map +1 -0
  87. package/dist/admin/chunks/fr-gQSilC7w.js +220 -0
  88. package/dist/admin/chunks/fr-gQSilC7w.js.map +1 -0
  89. package/dist/admin/chunks/gu-D5MMMXRs.mjs +196 -0
  90. package/dist/admin/chunks/gu-D5MMMXRs.mjs.map +1 -0
  91. package/dist/admin/chunks/gu-DPU4wyx7.js +201 -0
  92. package/dist/{_chunks/eu-VDH-3ovk.js.map → admin/chunks/gu-DPU4wyx7.js.map} +1 -1
  93. package/dist/admin/chunks/hi-Dp4omeBb.js +201 -0
  94. package/dist/admin/chunks/hi-Dp4omeBb.js.map +1 -0
  95. package/dist/admin/chunks/hi-lp17SCjr.mjs +196 -0
  96. package/dist/admin/chunks/hi-lp17SCjr.mjs.map +1 -0
  97. package/dist/{_chunks/hooks-BAaaKPS_.js → admin/chunks/hooks-D-sOYd1s.js} +6 -3
  98. package/dist/admin/chunks/hooks-D-sOYd1s.js.map +1 -0
  99. package/dist/admin/chunks/hooks-DMvik5y_.mjs +7 -0
  100. package/dist/admin/chunks/hooks-DMvik5y_.mjs.map +1 -0
  101. package/dist/admin/chunks/hu-CLka1U2C.mjs +198 -0
  102. package/dist/admin/chunks/hu-CLka1U2C.mjs.map +1 -0
  103. package/dist/admin/chunks/hu-CtFJuhTd.js +203 -0
  104. package/dist/admin/chunks/hu-CtFJuhTd.js.map +1 -0
  105. package/dist/admin/chunks/id-D7V5S1rB.js +161 -0
  106. package/dist/{_chunks/it-DkBIs7vD.js.map → admin/chunks/id-D7V5S1rB.js.map} +1 -1
  107. package/dist/admin/chunks/id-USfY9m1g.mjs +156 -0
  108. package/dist/{_chunks/id-BtwA9WJT.mjs.map → admin/chunks/id-USfY9m1g.mjs.map} +1 -1
  109. package/dist/admin/chunks/index-BE7PI9Wp.mjs +5450 -0
  110. package/dist/admin/chunks/index-BE7PI9Wp.mjs.map +1 -0
  111. package/dist/admin/chunks/index-BwIhYBsG.js +5520 -0
  112. package/dist/admin/chunks/index-BwIhYBsG.js.map +1 -0
  113. package/dist/admin/chunks/it-BAHrwmYS.mjs +158 -0
  114. package/dist/{_chunks/it-BrVPqaf1.mjs.map → admin/chunks/it-BAHrwmYS.mjs.map} +1 -1
  115. package/dist/admin/chunks/it-CQFpa_Dc.js +163 -0
  116. package/dist/{_chunks/ko-woFZPmLk.js.map → admin/chunks/it-CQFpa_Dc.js.map} +1 -1
  117. package/dist/admin/chunks/ja-BWKmBJFT.mjs +192 -0
  118. package/dist/{_chunks/ko-HVQRlfUI.mjs.map → admin/chunks/ja-BWKmBJFT.mjs.map} +1 -1
  119. package/dist/admin/chunks/ja-jdQM-B79.js +197 -0
  120. package/dist/{_chunks/de-CCEmbAah.js.map → admin/chunks/ja-jdQM-B79.js.map} +1 -1
  121. package/dist/admin/chunks/ko-CgADGBNt.mjs +191 -0
  122. package/dist/{_chunks/es-D34tqjMw.mjs.map → admin/chunks/ko-CgADGBNt.mjs.map} +1 -1
  123. package/dist/admin/chunks/ko-k46sEyzt.js +196 -0
  124. package/dist/{_chunks/ja-7sfIbjxE.js.map → admin/chunks/ko-k46sEyzt.js.map} +1 -1
  125. package/dist/admin/chunks/layout-9zlUM9V3.mjs +672 -0
  126. package/dist/admin/chunks/layout-9zlUM9V3.mjs.map +1 -0
  127. package/dist/admin/chunks/layout-Cr0HaJVS.js +692 -0
  128. package/dist/admin/chunks/layout-Cr0HaJVS.js.map +1 -0
  129. package/dist/admin/chunks/ml-CnhCfOn_.mjs +196 -0
  130. package/dist/admin/chunks/ml-CnhCfOn_.mjs.map +1 -0
  131. package/dist/admin/chunks/ml-DqxPwODx.js +201 -0
  132. package/dist/admin/chunks/ml-DqxPwODx.js.map +1 -0
  133. package/dist/admin/chunks/ms-Bh09NFff.mjs +140 -0
  134. package/dist/{_chunks/ms-m_WjyWx7.mjs.map → admin/chunks/ms-Bh09NFff.mjs.map} +1 -1
  135. package/dist/admin/chunks/ms-CvSC0OdG.js +145 -0
  136. package/dist/{_chunks/ms-BuFotyP_.js.map → admin/chunks/ms-CvSC0OdG.js.map} +1 -1
  137. package/dist/admin/chunks/nl-BEubhS8C.js +203 -0
  138. package/dist/admin/chunks/nl-BEubhS8C.js.map +1 -0
  139. package/dist/admin/chunks/nl-C8HYflTc.mjs +198 -0
  140. package/dist/admin/chunks/nl-C8HYflTc.mjs.map +1 -0
  141. package/dist/admin/chunks/objects-BJTP843m.js +343 -0
  142. package/dist/admin/chunks/objects-BJTP843m.js.map +1 -0
  143. package/dist/admin/chunks/objects-D2z-IJgu.mjs +317 -0
  144. package/dist/admin/chunks/objects-D2z-IJgu.mjs.map +1 -0
  145. package/dist/admin/chunks/pl-DWhGDzmM.js +200 -0
  146. package/dist/{_chunks/ca-Cmk45QO6.js.map → admin/chunks/pl-DWhGDzmM.js.map} +1 -1
  147. package/dist/admin/chunks/pl-MFCZJZuZ.mjs +195 -0
  148. package/dist/{_chunks/ca-5U32ON2v.mjs.map → admin/chunks/pl-MFCZJZuZ.mjs.map} +1 -1
  149. package/dist/admin/chunks/pt-BR-CPtAXD-4.js +202 -0
  150. package/dist/{_chunks/pt-BR-BiOz37D9.js.map → admin/chunks/pt-BR-CPtAXD-4.js.map} +1 -1
  151. package/dist/admin/chunks/pt-BR-CcotyBGJ.mjs +197 -0
  152. package/dist/{_chunks/pt-BR-C71iDxnh.mjs.map → admin/chunks/pt-BR-CcotyBGJ.mjs.map} +1 -1
  153. package/dist/admin/chunks/pt-BoPxN80n.js +96 -0
  154. package/dist/admin/chunks/pt-BoPxN80n.js.map +1 -0
  155. package/dist/admin/chunks/pt-HbmgeiYO.mjs +93 -0
  156. package/dist/admin/chunks/pt-HbmgeiYO.mjs.map +1 -0
  157. package/dist/admin/chunks/ru-C0op0ALG.js +232 -0
  158. package/dist/admin/chunks/ru-C0op0ALG.js.map +1 -0
  159. package/dist/admin/chunks/ru-CB4BUyQp.mjs +230 -0
  160. package/dist/{_chunks/ru-BE6A4Exp.mjs.map → admin/chunks/ru-CB4BUyQp.mjs.map} +1 -1
  161. package/dist/admin/chunks/sa-B_FuPyMw.js +201 -0
  162. package/dist/admin/chunks/sa-B_FuPyMw.js.map +1 -0
  163. package/dist/admin/chunks/sa-n_aPA-pU.mjs +196 -0
  164. package/dist/admin/chunks/sa-n_aPA-pU.mjs.map +1 -0
  165. package/dist/admin/chunks/sk-D_iXML2C.js +203 -0
  166. package/dist/admin/chunks/sk-D_iXML2C.js.map +1 -0
  167. package/dist/admin/chunks/sk-tn_BDjE2.mjs +198 -0
  168. package/dist/admin/chunks/sk-tn_BDjE2.mjs.map +1 -0
  169. package/dist/admin/chunks/sv-BstBC1Yp.js +203 -0
  170. package/dist/admin/chunks/sv-BstBC1Yp.js.map +1 -0
  171. package/dist/admin/chunks/sv-cq4ZrQRd.mjs +198 -0
  172. package/dist/admin/chunks/sv-cq4ZrQRd.mjs.map +1 -0
  173. package/dist/admin/chunks/th-lXoOCqPC.js +149 -0
  174. package/dist/{_chunks/th-D9_GfAjc.js.map → admin/chunks/th-lXoOCqPC.js.map} +1 -1
  175. package/dist/admin/chunks/th-mUH7hEtc.mjs +144 -0
  176. package/dist/{_chunks/uk-CR-zDhAY.mjs.map → admin/chunks/th-mUH7hEtc.mjs.map} +1 -1
  177. package/dist/admin/chunks/tr-CkS6sLIE.js +200 -0
  178. package/dist/admin/chunks/tr-CkS6sLIE.js.map +1 -0
  179. package/dist/admin/chunks/tr-Yt38daxh.mjs +195 -0
  180. package/dist/{_chunks/de-C72KDNOl.mjs.map → admin/chunks/tr-Yt38daxh.mjs.map} +1 -1
  181. package/dist/admin/chunks/uk-BtM6WnaE.mjs +313 -0
  182. package/dist/admin/chunks/uk-BtM6WnaE.mjs.map +1 -0
  183. package/dist/admin/chunks/uk-DB6OgySY.js +318 -0
  184. package/dist/admin/chunks/uk-DB6OgySY.js.map +1 -0
  185. package/dist/admin/chunks/usePrev-DgZBp9Oo.js +194 -0
  186. package/dist/admin/chunks/usePrev-DgZBp9Oo.js.map +1 -0
  187. package/dist/admin/chunks/usePrev-PisKKvhT.mjs +187 -0
  188. package/dist/admin/chunks/usePrev-PisKKvhT.mjs.map +1 -0
  189. package/dist/admin/chunks/vi-BGr1X_HZ.js +112 -0
  190. package/dist/{_chunks/vi-CJlYDheJ.js.map → admin/chunks/vi-BGr1X_HZ.js.map} +1 -1
  191. package/dist/admin/chunks/vi-CvBGlTjr.mjs +108 -0
  192. package/dist/{_chunks/vi-DUXIk_fw.mjs.map → admin/chunks/vi-CvBGlTjr.mjs.map} +1 -1
  193. package/dist/admin/chunks/zh-BmF-sHaT.mjs +205 -0
  194. package/dist/admin/chunks/zh-BmF-sHaT.mjs.map +1 -0
  195. package/dist/admin/chunks/zh-DwFu_Kfj.js +210 -0
  196. package/dist/admin/chunks/zh-DwFu_Kfj.js.map +1 -0
  197. package/dist/admin/chunks/zh-Hans-CI0HKio3.mjs +934 -0
  198. package/dist/{_chunks/zh-Hans-BPQcRIyH.mjs.map → admin/chunks/zh-Hans-CI0HKio3.mjs.map} +1 -1
  199. package/dist/admin/chunks/zh-Hans-JVK9x7xr.js +953 -0
  200. package/dist/{_chunks/zh-Hans-9kOncHGw.js.map → admin/chunks/zh-Hans-JVK9x7xr.js.map} +1 -1
  201. package/dist/admin/index.js +24 -4
  202. package/dist/admin/index.js.map +1 -1
  203. package/dist/admin/index.mjs +17 -13
  204. package/dist/admin/index.mjs.map +1 -1
  205. package/dist/admin/src/components/InjectionZone.d.ts +7 -1
  206. package/dist/admin/src/content-manager.d.ts +4 -0
  207. package/dist/admin/src/features/DocumentContext.d.ts +53 -0
  208. package/dist/admin/src/features/DocumentRBAC.d.ts +3 -2
  209. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  210. package/dist/admin/src/hooks/useDocument.d.ts +4 -2
  211. package/dist/admin/src/hooks/useDocumentActions.d.ts +1 -0
  212. package/dist/admin/src/index.d.ts +1 -0
  213. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +2 -1
  214. package/dist/admin/src/pages/EditView/components/EditorToolbarObserver.d.ts +11 -0
  215. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +49 -1
  216. package/dist/admin/src/pages/EditView/components/FormInputs/Relations/RelationModal.d.ts +8 -0
  217. package/dist/admin/src/pages/EditView/components/FormInputs/{Relations.d.ts → Relations/Relations.d.ts} +8 -2
  218. package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.d.ts +1 -2
  219. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +9 -3
  220. package/dist/admin/src/pages/EditView/components/InputRenderer.d.ts +7 -4
  221. package/dist/admin/src/preview/index.d.ts +2 -3
  222. package/dist/admin/src/preview/pages/Preview.d.ts +2 -0
  223. package/dist/server/index.js +5459 -4387
  224. package/dist/server/index.js.map +1 -1
  225. package/dist/server/index.mjs +5446 -4372
  226. package/dist/server/index.mjs.map +1 -1
  227. package/dist/server/src/controllers/utils/metadata.d.ts +1 -1
  228. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  229. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  230. package/dist/server/src/services/utils/count.d.ts +1 -1
  231. package/dist/server/src/services/utils/count.d.ts.map +1 -1
  232. package/dist/server/src/services/utils/populate.d.ts +1 -1
  233. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  234. package/dist/shared/contracts/collection-types.d.ts +0 -1
  235. package/dist/shared/contracts/components.d.ts +0 -1
  236. package/dist/shared/contracts/content-types.d.ts +0 -1
  237. package/dist/shared/contracts/history-versions.d.ts +0 -1
  238. package/dist/shared/contracts/index.d.ts +0 -1
  239. package/dist/shared/contracts/init.d.ts +0 -1
  240. package/dist/shared/contracts/preview.d.ts +0 -1
  241. package/dist/shared/contracts/relations.d.ts +1 -2
  242. package/dist/shared/contracts/relations.d.ts.map +1 -1
  243. package/dist/shared/contracts/review-workflows.d.ts +0 -1
  244. package/dist/shared/contracts/single-types.d.ts +0 -1
  245. package/dist/shared/contracts/uid.d.ts +0 -1
  246. package/dist/shared/index.d.ts +0 -1
  247. package/dist/shared/index.js +35 -24
  248. package/dist/shared/index.js.map +1 -1
  249. package/dist/shared/index.mjs +34 -25
  250. package/dist/shared/index.mjs.map +1 -1
  251. package/package.json +16 -13
  252. package/dist/_chunks/CardDragPreview-C0QyJgRA.js +0 -69
  253. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +0 -1
  254. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs +0 -70
  255. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +0 -1
  256. package/dist/_chunks/ComponentConfigurationPage-9_4yUE9L.mjs +0 -236
  257. package/dist/_chunks/ComponentConfigurationPage-9_4yUE9L.mjs.map +0 -1
  258. package/dist/_chunks/ComponentConfigurationPage-DBSh-kET.js +0 -254
  259. package/dist/_chunks/ComponentConfigurationPage-DBSh-kET.js.map +0 -1
  260. package/dist/_chunks/ComponentIcon-CRbtQEUV.js +0 -175
  261. package/dist/_chunks/ComponentIcon-CRbtQEUV.js.map +0 -1
  262. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs +0 -157
  263. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +0 -1
  264. package/dist/_chunks/EditConfigurationPage-Bl_U2JgH.js +0 -150
  265. package/dist/_chunks/EditConfigurationPage-Bl_U2JgH.js.map +0 -1
  266. package/dist/_chunks/EditConfigurationPage-COe6hjPC.mjs +0 -132
  267. package/dist/_chunks/EditConfigurationPage-COe6hjPC.mjs.map +0 -1
  268. package/dist/_chunks/EditViewPage-D4yFJET6.js +0 -209
  269. package/dist/_chunks/EditViewPage-D4yFJET6.js.map +0 -1
  270. package/dist/_chunks/EditViewPage-DrmVmYN0.mjs +0 -191
  271. package/dist/_chunks/EditViewPage-DrmVmYN0.mjs.map +0 -1
  272. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs +0 -50
  273. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +0 -1
  274. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js +0 -49
  275. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +0 -1
  276. package/dist/_chunks/Form-C4rSaGsz.js +0 -778
  277. package/dist/_chunks/Form-C4rSaGsz.js.map +0 -1
  278. package/dist/_chunks/Form-DamaxNpG.mjs +0 -758
  279. package/dist/_chunks/Form-DamaxNpG.mjs.map +0 -1
  280. package/dist/_chunks/History-D1PreDSY.mjs +0 -999
  281. package/dist/_chunks/History-D1PreDSY.mjs.map +0 -1
  282. package/dist/_chunks/History-DTm8UCCQ.js +0 -1019
  283. package/dist/_chunks/History-DTm8UCCQ.js.map +0 -1
  284. package/dist/_chunks/Input-B7sapvBG.js +0 -5617
  285. package/dist/_chunks/Input-B7sapvBG.js.map +0 -1
  286. package/dist/_chunks/Input-CZ1YvjHR.mjs +0 -5585
  287. package/dist/_chunks/Input-CZ1YvjHR.mjs.map +0 -1
  288. package/dist/_chunks/ListConfigurationPage-Bbi32isk.mjs +0 -633
  289. package/dist/_chunks/ListConfigurationPage-Bbi32isk.mjs.map +0 -1
  290. package/dist/_chunks/ListConfigurationPage-ysFMjKI3.js +0 -652
  291. package/dist/_chunks/ListConfigurationPage-ysFMjKI3.js.map +0 -1
  292. package/dist/_chunks/ListViewPage-Bud_jBDQ.mjs +0 -854
  293. package/dist/_chunks/ListViewPage-Bud_jBDQ.mjs.map +0 -1
  294. package/dist/_chunks/ListViewPage-DTuuxU3n.js +0 -877
  295. package/dist/_chunks/ListViewPage-DTuuxU3n.js.map +0 -1
  296. package/dist/_chunks/NoContentTypePage-CL7VVeYs.js +0 -51
  297. package/dist/_chunks/NoContentTypePage-CL7VVeYs.js.map +0 -1
  298. package/dist/_chunks/NoContentTypePage-DVhkugsf.mjs +0 -51
  299. package/dist/_chunks/NoContentTypePage-DVhkugsf.mjs.map +0 -1
  300. package/dist/_chunks/NoPermissionsPage-CMdM-dCo.mjs +0 -23
  301. package/dist/_chunks/NoPermissionsPage-CMdM-dCo.mjs.map +0 -1
  302. package/dist/_chunks/NoPermissionsPage-v7I599vC.js +0 -23
  303. package/dist/_chunks/NoPermissionsPage-v7I599vC.js.map +0 -1
  304. package/dist/_chunks/Preview-BNuU0SuQ.mjs +0 -287
  305. package/dist/_chunks/Preview-BNuU0SuQ.mjs.map +0 -1
  306. package/dist/_chunks/Preview-Cxq-uI6D.js +0 -305
  307. package/dist/_chunks/Preview-Cxq-uI6D.js.map +0 -1
  308. package/dist/_chunks/Relations-C2Ahkrdg.mjs +0 -728
  309. package/dist/_chunks/Relations-C2Ahkrdg.mjs.map +0 -1
  310. package/dist/_chunks/Relations-CWS79QQn.js +0 -747
  311. package/dist/_chunks/Relations-CWS79QQn.js.map +0 -1
  312. package/dist/_chunks/ar-BUUWXIYu.js +0 -226
  313. package/dist/_chunks/ar-BUUWXIYu.js.map +0 -1
  314. package/dist/_chunks/ar-CCEVvqGG.mjs +0 -226
  315. package/dist/_chunks/ca-5U32ON2v.mjs +0 -201
  316. package/dist/_chunks/ca-Cmk45QO6.js +0 -201
  317. package/dist/_chunks/cs-CM2aBUar.mjs +0 -125
  318. package/dist/_chunks/cs-CkJy6B2v.js +0 -125
  319. package/dist/_chunks/de-C72KDNOl.mjs +0 -199
  320. package/dist/_chunks/de-CCEmbAah.js +0 -199
  321. package/dist/_chunks/en-BR48D_RH.js +0 -312
  322. package/dist/_chunks/en-D65uIF6Y.mjs +0 -312
  323. package/dist/_chunks/es-9K52xZIr.js +0 -196
  324. package/dist/_chunks/es-D34tqjMw.mjs +0 -196
  325. package/dist/_chunks/eu-CdALomew.mjs +0 -202
  326. package/dist/_chunks/eu-VDH-3ovk.js +0 -202
  327. package/dist/_chunks/fr-C43IbhA_.js +0 -219
  328. package/dist/_chunks/fr-C43IbhA_.js.map +0 -1
  329. package/dist/_chunks/fr-DBseuRuB.mjs +0 -219
  330. package/dist/_chunks/fr-DBseuRuB.mjs.map +0 -1
  331. package/dist/_chunks/gu-BRmF601H.js +0 -200
  332. package/dist/_chunks/gu-CNpaMDpH.mjs +0 -200
  333. package/dist/_chunks/gu-CNpaMDpH.mjs.map +0 -1
  334. package/dist/_chunks/hi-CCJBptSq.js +0 -200
  335. package/dist/_chunks/hi-CCJBptSq.js.map +0 -1
  336. package/dist/_chunks/hi-Dwvd04m3.mjs +0 -200
  337. package/dist/_chunks/hi-Dwvd04m3.mjs.map +0 -1
  338. package/dist/_chunks/hooks-BAaaKPS_.js.map +0 -1
  339. package/dist/_chunks/hooks-E5u1mcgM.mjs +0 -8
  340. package/dist/_chunks/hooks-E5u1mcgM.mjs.map +0 -1
  341. package/dist/_chunks/hu-CeYvaaO0.mjs +0 -202
  342. package/dist/_chunks/hu-CeYvaaO0.mjs.map +0 -1
  343. package/dist/_chunks/hu-sNV_yLYy.js +0 -202
  344. package/dist/_chunks/hu-sNV_yLYy.js.map +0 -1
  345. package/dist/_chunks/id-B5Ser98A.js +0 -160
  346. package/dist/_chunks/id-B5Ser98A.js.map +0 -1
  347. package/dist/_chunks/id-BtwA9WJT.mjs +0 -160
  348. package/dist/_chunks/index-DQsvBb_N.js +0 -4500
  349. package/dist/_chunks/index-DQsvBb_N.js.map +0 -1
  350. package/dist/_chunks/index-ZKrsjv-2.mjs +0 -4481
  351. package/dist/_chunks/index-ZKrsjv-2.mjs.map +0 -1
  352. package/dist/_chunks/it-BrVPqaf1.mjs +0 -162
  353. package/dist/_chunks/it-DkBIs7vD.js +0 -162
  354. package/dist/_chunks/ja-7sfIbjxE.js +0 -196
  355. package/dist/_chunks/ja-BHqhDq4V.mjs +0 -196
  356. package/dist/_chunks/ko-HVQRlfUI.mjs +0 -195
  357. package/dist/_chunks/ko-woFZPmLk.js +0 -195
  358. package/dist/_chunks/layout-Cl0NhlQB.js +0 -488
  359. package/dist/_chunks/layout-Cl0NhlQB.js.map +0 -1
  360. package/dist/_chunks/layout-fQk1rMk9.mjs +0 -471
  361. package/dist/_chunks/layout-fQk1rMk9.mjs.map +0 -1
  362. package/dist/_chunks/ml-BihZwQit.mjs +0 -200
  363. package/dist/_chunks/ml-BihZwQit.mjs.map +0 -1
  364. package/dist/_chunks/ml-C2W8N8k1.js +0 -200
  365. package/dist/_chunks/ml-C2W8N8k1.js.map +0 -1
  366. package/dist/_chunks/ms-BuFotyP_.js +0 -144
  367. package/dist/_chunks/ms-m_WjyWx7.mjs +0 -144
  368. package/dist/_chunks/nl-D4R9gHx5.mjs +0 -202
  369. package/dist/_chunks/nl-D4R9gHx5.mjs.map +0 -1
  370. package/dist/_chunks/nl-bbEOHChV.js +0 -202
  371. package/dist/_chunks/nl-bbEOHChV.js.map +0 -1
  372. package/dist/_chunks/objects-BcXOv6_9.js +0 -47
  373. package/dist/_chunks/objects-BcXOv6_9.js.map +0 -1
  374. package/dist/_chunks/objects-D6yBsdmx.mjs +0 -45
  375. package/dist/_chunks/objects-D6yBsdmx.mjs.map +0 -1
  376. package/dist/_chunks/pl-sbx9mSt_.mjs +0 -199
  377. package/dist/_chunks/pl-sbx9mSt_.mjs.map +0 -1
  378. package/dist/_chunks/pl-uzwG-hk7.js +0 -199
  379. package/dist/_chunks/pl-uzwG-hk7.js.map +0 -1
  380. package/dist/_chunks/pt-BR-BiOz37D9.js +0 -201
  381. package/dist/_chunks/pt-BR-C71iDxnh.mjs +0 -201
  382. package/dist/_chunks/pt-BsaFvS8-.mjs +0 -95
  383. package/dist/_chunks/pt-BsaFvS8-.mjs.map +0 -1
  384. package/dist/_chunks/pt-CeXQuq50.js +0 -95
  385. package/dist/_chunks/pt-CeXQuq50.js.map +0 -1
  386. package/dist/_chunks/relations-BRfBxVbX.js +0 -133
  387. package/dist/_chunks/relations-BRfBxVbX.js.map +0 -1
  388. package/dist/_chunks/relations-BakOFl_1.mjs +0 -134
  389. package/dist/_chunks/relations-BakOFl_1.mjs.map +0 -1
  390. package/dist/_chunks/ru-BE6A4Exp.mjs +0 -231
  391. package/dist/_chunks/ru-BT3ybNny.js +0 -231
  392. package/dist/_chunks/sa-CcvkYInH.js +0 -200
  393. package/dist/_chunks/sa-CcvkYInH.js.map +0 -1
  394. package/dist/_chunks/sa-Dag0k-Z8.mjs +0 -200
  395. package/dist/_chunks/sa-Dag0k-Z8.mjs.map +0 -1
  396. package/dist/_chunks/sk-BFg-R8qJ.mjs +0 -202
  397. package/dist/_chunks/sk-BFg-R8qJ.mjs.map +0 -1
  398. package/dist/_chunks/sk-CvY09Xjv.js +0 -202
  399. package/dist/_chunks/sk-CvY09Xjv.js.map +0 -1
  400. package/dist/_chunks/sv-CUnfWGsh.mjs +0 -202
  401. package/dist/_chunks/sv-CUnfWGsh.mjs.map +0 -1
  402. package/dist/_chunks/sv-MYDuzgvT.js +0 -202
  403. package/dist/_chunks/sv-MYDuzgvT.js.map +0 -1
  404. package/dist/_chunks/th-BqbI8lIT.mjs +0 -148
  405. package/dist/_chunks/th-BqbI8lIT.mjs.map +0 -1
  406. package/dist/_chunks/th-D9_GfAjc.js +0 -148
  407. package/dist/_chunks/tr-CgeK3wJM.mjs +0 -199
  408. package/dist/_chunks/tr-CgeK3wJM.mjs.map +0 -1
  409. package/dist/_chunks/tr-D9UH-O_R.js +0 -199
  410. package/dist/_chunks/tr-D9UH-O_R.js.map +0 -1
  411. package/dist/_chunks/uk-C8EiqJY7.js +0 -144
  412. package/dist/_chunks/uk-C8EiqJY7.js.map +0 -1
  413. package/dist/_chunks/uk-CR-zDhAY.mjs +0 -144
  414. package/dist/_chunks/useDragAndDrop-BMtgCYzL.js +0 -245
  415. package/dist/_chunks/useDragAndDrop-BMtgCYzL.js.map +0 -1
  416. package/dist/_chunks/useDragAndDrop-DJ6jqvZN.mjs +0 -228
  417. package/dist/_chunks/useDragAndDrop-DJ6jqvZN.mjs.map +0 -1
  418. package/dist/_chunks/usePrev-CZGy2Vjf.mjs +0 -29
  419. package/dist/_chunks/usePrev-CZGy2Vjf.mjs.map +0 -1
  420. package/dist/_chunks/usePrev-D5J_2fEu.js +0 -28
  421. package/dist/_chunks/usePrev-D5J_2fEu.js.map +0 -1
  422. package/dist/_chunks/vi-CJlYDheJ.js +0 -111
  423. package/dist/_chunks/vi-DUXIk_fw.mjs +0 -111
  424. package/dist/_chunks/zh-BWZspA60.mjs +0 -209
  425. package/dist/_chunks/zh-BWZspA60.mjs.map +0 -1
  426. package/dist/_chunks/zh-CQQfszqR.js +0 -209
  427. package/dist/_chunks/zh-CQQfszqR.js.map +0 -1
  428. package/dist/_chunks/zh-Hans-9kOncHGw.js +0 -952
  429. package/dist/_chunks/zh-Hans-BPQcRIyH.mjs +0 -952
  430. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +0 -49
  431. package/dist/admin/src/preview/components/PreviewContent.d.ts +0 -2
@@ -0,0 +1,1361 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { useForm, useStrapiApp, InputRenderer, useField, Form, Layouts, useTracking, useNotification, useQueryParams, useRBAC, ConfirmDialog, createContext, Page } from '@strapi/admin/strapi-admin';
4
+ import { Alert, Link, Flex, Field, Box, Tooltip, Typography, Divider, Grid, Dialog, Button, Portal, FocusTrap, Main } from '@strapi/design-system';
5
+ import { stringify } from 'qs';
6
+ import { useIntl } from 'react-intl';
7
+ import { NavLink, useNavigate, useParams, Link as Link$1, Navigate } from 'react-router-dom';
8
+ import { m as useDoc, o as useDocumentRBAC, G as useDocLayout, C as COLLECTION_TYPES, D as DocumentStatus, O as removeFieldsThatDontExistOnSchema, Q as prepareTempKeys, l as contentManagerApi, P as PERMISSIONS, y as getDisplayName, R as RelativeTime, i as DocumentRBAC, U as useDocument, d as useDocumentLayout, v as useGetContentTypeConfigurationQuery, k as buildValidParams, p as DocumentContextProvider } from './index-BE7PI9Wp.mjs';
9
+ import pipe from 'lodash/fp/pipe';
10
+ import { u as useTypedSelector } from './hooks-DMvik5y_.mjs';
11
+ import { ArrowLeft, WarningCircle } from '@strapi/icons';
12
+ import { styled } from 'styled-components';
13
+ import { b as useDynamicZone, u as useLazyComponents, c as useFieldHint, N as NotAllowedInput, M as MemoizedUIDInput, d as MemoizedWysiwyg, e as DynamicZone, f as MemoizedComponentInput, g as MemoizedBlocksInput } from './Input-B3QUS9rv.mjs';
14
+ import { g as getRelationLabel } from './usePrev-PisKKvhT.mjs';
15
+ import 'lodash/fp/mapValues';
16
+ import 'yup';
17
+ import 'fractional-indexing';
18
+ import 'date-fns';
19
+ import '@reduxjs/toolkit';
20
+ import 'prismjs';
21
+ import 'react-redux';
22
+ import 'slate';
23
+ import 'slate-history';
24
+ import 'slate-react';
25
+ import 'prismjs/themes/prism-solarizedlight.css';
26
+ import 'prismjs/components/prism-asmatmel';
27
+ import 'prismjs/components/prism-bash';
28
+ import 'prismjs/components/prism-basic';
29
+ import 'prismjs/components/prism-c';
30
+ import 'prismjs/components/prism-clojure';
31
+ import 'prismjs/components/prism-cobol';
32
+ import 'prismjs/components/prism-cpp';
33
+ import 'prismjs/components/prism-csharp';
34
+ import 'prismjs/components/prism-dart';
35
+ import 'prismjs/components/prism-docker';
36
+ import 'prismjs/components/prism-elixir';
37
+ import 'prismjs/components/prism-erlang';
38
+ import 'prismjs/components/prism-fortran';
39
+ import 'prismjs/components/prism-fsharp';
40
+ import 'prismjs/components/prism-go';
41
+ import 'prismjs/components/prism-graphql';
42
+ import 'prismjs/components/prism-groovy';
43
+ import 'prismjs/components/prism-haskell';
44
+ import 'prismjs/components/prism-haxe';
45
+ import 'prismjs/components/prism-ini';
46
+ import 'prismjs/components/prism-java';
47
+ import 'prismjs/components/prism-javascript';
48
+ import 'prismjs/components/prism-jsx';
49
+ import 'prismjs/components/prism-json';
50
+ import 'prismjs/components/prism-julia';
51
+ import 'prismjs/components/prism-kotlin';
52
+ import 'prismjs/components/prism-latex';
53
+ import 'prismjs/components/prism-lua';
54
+ import 'prismjs/components/prism-markdown';
55
+ import 'prismjs/components/prism-matlab';
56
+ import 'prismjs/components/prism-makefile';
57
+ import 'prismjs/components/prism-objectivec';
58
+ import 'prismjs/components/prism-perl';
59
+ import 'prismjs/components/prism-php';
60
+ import 'prismjs/components/prism-powershell';
61
+ import 'prismjs/components/prism-python';
62
+ import 'prismjs/components/prism-r';
63
+ import 'prismjs/components/prism-ruby';
64
+ import 'prismjs/components/prism-rust';
65
+ import 'prismjs/components/prism-sas';
66
+ import 'prismjs/components/prism-scala';
67
+ import 'prismjs/components/prism-scheme';
68
+ import 'prismjs/components/prism-sql';
69
+ import 'prismjs/components/prism-stata';
70
+ import 'prismjs/components/prism-swift';
71
+ import 'prismjs/components/prism-typescript';
72
+ import 'prismjs/components/prism-tsx';
73
+ import 'prismjs/components/prism-vbnet';
74
+ import 'prismjs/components/prism-yaml';
75
+ import './objects-D2z-IJgu.mjs';
76
+ import 'react-dnd';
77
+ import 'lodash/clone';
78
+ import 'lodash/toPath';
79
+ import '@radix-ui/react-toolbar';
80
+ import 'react-dnd-html5-backend';
81
+ import './ComponentIcon-BZcTc4rj.mjs';
82
+ import '@strapi/icons/symbols';
83
+ import 'react-window';
84
+ import 'codemirror5';
85
+ import 'sanitize-html';
86
+ import 'highlight.js';
87
+ import 'markdown-it';
88
+ import 'markdown-it-abbr';
89
+ import 'markdown-it-container';
90
+ import 'markdown-it-deflist';
91
+ import 'markdown-it-emoji';
92
+ import 'markdown-it-footnote';
93
+ import 'markdown-it-ins';
94
+ import 'markdown-it-mark';
95
+ import 'markdown-it-sub';
96
+ import 'markdown-it-sup';
97
+ import 'highlight.js/styles/solarized-dark.css';
98
+ import 'codemirror5/addon/display/placeholder';
99
+
100
+ const StyledAlert = styled(Alert).attrs({
101
+ closeLabel: 'Close',
102
+ onClose: ()=>{},
103
+ shadow: 'none'
104
+ })`
105
+ button {
106
+ display: none;
107
+ }
108
+ `;
109
+ /* -------------------------------------------------------------------------------------------------
110
+ * CustomRelationInput
111
+ * -----------------------------------------------------------------------------------------------*/ const LinkEllipsis = styled(Link)`
112
+ display: block;
113
+
114
+ & > span {
115
+ white-space: nowrap;
116
+ overflow: hidden;
117
+ text-overflow: ellipsis;
118
+ display: block;
119
+ }
120
+ `;
121
+ const CustomRelationInput = (props)=>{
122
+ const { formatMessage } = useIntl();
123
+ const field = useField(props.name);
124
+ /**
125
+ * Ideally the server would return the correct shape, however, for admin user relations
126
+ * it sanitizes everything out when it finds an object for the relation value.
127
+ */ let formattedFieldValue;
128
+ if (field) {
129
+ formattedFieldValue = Array.isArray(field.value) ? {
130
+ results: field.value,
131
+ meta: {
132
+ missingCount: 0
133
+ }
134
+ } : field.value;
135
+ }
136
+ if (!formattedFieldValue || formattedFieldValue.results.length === 0 && formattedFieldValue.meta.missingCount === 0) {
137
+ return /*#__PURE__*/ jsxs(Fragment, {
138
+ children: [
139
+ /*#__PURE__*/ jsx(Field.Label, {
140
+ action: props.labelAction,
141
+ children: props.label
142
+ }),
143
+ /*#__PURE__*/ jsx(Box, {
144
+ marginTop: 1,
145
+ children: /*#__PURE__*/ jsx(StyledAlert, {
146
+ variant: "default",
147
+ children: formatMessage({
148
+ id: 'content-manager.history.content.no-relations',
149
+ defaultMessage: 'No relations.'
150
+ })
151
+ })
152
+ })
153
+ ]
154
+ });
155
+ }
156
+ const { results, meta } = formattedFieldValue;
157
+ return /*#__PURE__*/ jsxs(Box, {
158
+ children: [
159
+ /*#__PURE__*/ jsx(Field.Label, {
160
+ children: props.label
161
+ }),
162
+ results.length > 0 && /*#__PURE__*/ jsx(Flex, {
163
+ direction: "column",
164
+ gap: 2,
165
+ marginTop: 1,
166
+ alignItems: "stretch",
167
+ children: results.map((relationData)=>{
168
+ // @ts-expect-error - targetModel does exist on the attribute. But it's not typed.
169
+ const { targetModel } = props.attribute;
170
+ const href = `../${COLLECTION_TYPES}/${targetModel}/${relationData.documentId}`;
171
+ const label = getRelationLabel(relationData, props.mainField);
172
+ const isAdminUserRelation = targetModel === 'admin::user';
173
+ return /*#__PURE__*/ jsxs(Flex, {
174
+ paddingTop: 2,
175
+ paddingBottom: 2,
176
+ paddingLeft: 4,
177
+ paddingRight: 4,
178
+ hasRadius: true,
179
+ borderColor: "neutral200",
180
+ background: "neutral150",
181
+ justifyContent: "space-between",
182
+ children: [
183
+ /*#__PURE__*/ jsx(Box, {
184
+ minWidth: 0,
185
+ paddingTop: 1,
186
+ paddingBottom: 1,
187
+ paddingRight: 4,
188
+ children: /*#__PURE__*/ jsx(Tooltip, {
189
+ label: label,
190
+ children: isAdminUserRelation ? /*#__PURE__*/ jsx(Typography, {
191
+ children: label
192
+ }) : /*#__PURE__*/ jsx(LinkEllipsis, {
193
+ tag: NavLink,
194
+ to: href,
195
+ children: label
196
+ })
197
+ })
198
+ }),
199
+ /*#__PURE__*/ jsx(DocumentStatus, {
200
+ status: relationData.status
201
+ })
202
+ ]
203
+ }, relationData.documentId ?? relationData.id);
204
+ })
205
+ }),
206
+ meta.missingCount > 0 && /* @ts-expect-error – we dont need closeLabel */ /*#__PURE__*/ jsx(StyledAlert, {
207
+ marginTop: 1,
208
+ variant: "warning",
209
+ title: formatMessage({
210
+ id: 'content-manager.history.content.missing-relations.title',
211
+ defaultMessage: '{number, plural, =1 {Missing relation} other {{number} missing relations}}'
212
+ }, {
213
+ number: meta.missingCount
214
+ }),
215
+ children: formatMessage({
216
+ id: 'content-manager.history.content.missing-relations.message',
217
+ defaultMessage: "{number, plural, =1 {It has} other {They have}} been deleted and can't be restored."
218
+ }, {
219
+ number: meta.missingCount
220
+ })
221
+ })
222
+ ]
223
+ });
224
+ };
225
+ /* -------------------------------------------------------------------------------------------------
226
+ * CustomMediaInput
227
+ * -----------------------------------------------------------------------------------------------*/ // Create an object with value at key path (i.e. 'a.b.c')
228
+ const createInitialValuesForPath = (keyPath, value)=>{
229
+ const keys = keyPath.split('.');
230
+ // The root level object
231
+ const root = {};
232
+ // Make the first node the root
233
+ let node = root;
234
+ keys.forEach((key, index)=>{
235
+ // Skip prototype pollution keys
236
+ if (key === '__proto__' || key === 'constructor') return;
237
+ // If it's the last key, set the node value
238
+ if (index === keys.length - 1) {
239
+ node[key] = value;
240
+ } else {
241
+ // Ensure the key exists and is an object
242
+ node[key] = node[key] || {};
243
+ }
244
+ // Traverse down the tree
245
+ node = node[key];
246
+ });
247
+ return root;
248
+ };
249
+ const CustomMediaInput = (props)=>{
250
+ const { value } = useField(props.name);
251
+ const results = value?.results ?? [];
252
+ const meta = value?.meta ?? {
253
+ missingCount: 0
254
+ };
255
+ const { formatMessage } = useIntl();
256
+ const fields = useStrapiApp('CustomMediaInput', (state)=>state.fields);
257
+ const MediaLibrary = fields.media;
258
+ return /*#__PURE__*/ jsxs(Flex, {
259
+ direction: "column",
260
+ gap: 2,
261
+ alignItems: "stretch",
262
+ children: [
263
+ /*#__PURE__*/ jsx(Form, {
264
+ method: "PUT",
265
+ disabled: true,
266
+ initialValues: createInitialValuesForPath(props.name, results),
267
+ children: /*#__PURE__*/ jsx(MediaLibrary, {
268
+ ...props,
269
+ disabled: true,
270
+ multiple: results.length > 1
271
+ })
272
+ }),
273
+ meta.missingCount > 0 && /*#__PURE__*/ jsx(StyledAlert, {
274
+ variant: "warning",
275
+ closeLabel: "Close",
276
+ onClose: ()=>{},
277
+ title: formatMessage({
278
+ id: 'content-manager.history.content.missing-assets.title',
279
+ defaultMessage: '{number, plural, =1 {Missing asset} other {{number} missing assets}}'
280
+ }, {
281
+ number: meta.missingCount
282
+ }),
283
+ children: formatMessage({
284
+ id: 'content-manager.history.content.missing-assets.message',
285
+ defaultMessage: "{number, plural, =1 {It has} other {They have}} been deleted in the Media Library and can't be restored."
286
+ }, {
287
+ number: meta.missingCount
288
+ })
289
+ })
290
+ ]
291
+ });
292
+ };
293
+ /**
294
+ * Checks if the i18n plugin added a label action to the field and modifies it
295
+ * to adapt the wording for the history page.
296
+ */ const getLabelAction = (labelAction)=>{
297
+ if (!/*#__PURE__*/ React.isValidElement(labelAction)) {
298
+ return labelAction;
299
+ }
300
+ // TODO: find a better way to do this rather than access internals
301
+ const labelActionTitleId = labelAction.props.title.id;
302
+ if (labelActionTitleId === 'i18n.Field.localized') {
303
+ return /*#__PURE__*/ React.cloneElement(labelAction, {
304
+ ...labelAction.props,
305
+ title: {
306
+ id: 'history.content.localized',
307
+ defaultMessage: 'This value is specific to this locale. If you restore this version, the content will not be replaced for other locales.'
308
+ }
309
+ });
310
+ }
311
+ if (labelActionTitleId === 'i18n.Field.not-localized') {
312
+ return /*#__PURE__*/ React.cloneElement(labelAction, {
313
+ ...labelAction.props,
314
+ title: {
315
+ id: 'history.content.not-localized',
316
+ defaultMessage: 'This value is common to all locales. If you restore this version and save the changes, the content will be replaced for all locales.'
317
+ }
318
+ });
319
+ }
320
+ // Label action is unrelated to i18n, don't touch it.
321
+ return labelAction;
322
+ };
323
+ /**
324
+ * @internal
325
+ *
326
+ * @description An abstraction around the regular form input renderer designed specifically
327
+ * to be used on the History page in the content-manager. It understands how to render specific
328
+ * inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)
329
+ */ const VersionInputRenderer = ({ visible, hint: providedHint, shouldIgnoreRBAC = false, labelAction, ...props })=>{
330
+ const customLabelAction = getLabelAction(labelAction);
331
+ const { formatMessage } = useIntl();
332
+ const version = useHistoryContext('VersionContent', (state)=>state.selectedVersion);
333
+ const configuration = useHistoryContext('VersionContent', (state)=>state.configuration);
334
+ const fieldSizes = useTypedSelector((state)=>state['content-manager'].app.fieldSizes);
335
+ const { id, components } = useDoc();
336
+ const isFormDisabled = useForm('InputRenderer', (state)=>state.disabled);
337
+ const isInDynamicZone = useDynamicZone('isInDynamicZone', (state)=>state.isInDynamicZone);
338
+ const canCreateFields = useDocumentRBAC('InputRenderer', (rbac)=>rbac.canCreateFields);
339
+ const canReadFields = useDocumentRBAC('InputRenderer', (rbac)=>rbac.canReadFields);
340
+ const canUpdateFields = useDocumentRBAC('InputRenderer', (rbac)=>rbac.canUpdateFields);
341
+ const canUserAction = useDocumentRBAC('InputRenderer', (rbac)=>rbac.canUserAction);
342
+ const editableFields = id ? canUpdateFields : canCreateFields;
343
+ const readableFields = id ? canReadFields : canCreateFields;
344
+ /**
345
+ * Component fields are always readable and editable,
346
+ * however the fields within them may not be.
347
+ */ const canUserReadField = canUserAction(props.name, readableFields, props.type);
348
+ const canUserEditField = canUserAction(props.name, editableFields, props.type);
349
+ const fields = useStrapiApp('InputRenderer', (app)=>app.fields);
350
+ const { lazyComponentStore } = useLazyComponents(attributeHasCustomFieldProperty(props.attribute) ? [
351
+ props.attribute.customField
352
+ ] : undefined);
353
+ const hint = useFieldHint(providedHint, props.attribute);
354
+ const { edit: { components: componentsLayout } } = useDocLayout();
355
+ if (!visible) {
356
+ return null;
357
+ }
358
+ /**
359
+ * Don't render the field if the user can't read it.
360
+ */ if (!shouldIgnoreRBAC && !canUserReadField && !isInDynamicZone) {
361
+ return /*#__PURE__*/ jsx(NotAllowedInput, {
362
+ hint: hint,
363
+ ...props
364
+ });
365
+ }
366
+ const fieldIsDisabled = !canUserEditField && !isInDynamicZone || props.disabled || isFormDisabled;
367
+ /**
368
+ * Attributes found on the current content-type schema cannot be restored. We handle
369
+ * this by displaying a warning alert to the user instead of the input for that field type.
370
+ */ const addedAttributes = version.meta.unknownAttributes.added;
371
+ if (Object.keys(addedAttributes).includes(props.name)) {
372
+ return /*#__PURE__*/ jsxs(Flex, {
373
+ direction: "column",
374
+ alignItems: "flex-start",
375
+ gap: 1,
376
+ children: [
377
+ /*#__PURE__*/ jsx(Field.Label, {
378
+ children: props.label
379
+ }),
380
+ /*#__PURE__*/ jsx(StyledAlert, {
381
+ width: "100%",
382
+ closeLabel: "Close",
383
+ onClose: ()=>{},
384
+ variant: "warning",
385
+ title: formatMessage({
386
+ id: 'content-manager.history.content.new-field.title',
387
+ defaultMessage: 'New field'
388
+ }),
389
+ children: formatMessage({
390
+ id: 'content-manager.history.content.new-field.message',
391
+ defaultMessage: "This field didn't exist when this version was saved. If you restore this version, it will be empty."
392
+ })
393
+ })
394
+ ]
395
+ });
396
+ }
397
+ /**
398
+ * Because a custom field has a unique prop but the type could be confused with either
399
+ * the useField hook or the type of the field we need to handle it separately and first.
400
+ */ if (attributeHasCustomFieldProperty(props.attribute)) {
401
+ const CustomInput = lazyComponentStore[props.attribute.customField];
402
+ if (CustomInput) {
403
+ return /*#__PURE__*/ jsx(CustomInput, {
404
+ ...props,
405
+ // @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.
406
+ hint: hint,
407
+ labelAction: customLabelAction,
408
+ disabled: fieldIsDisabled
409
+ });
410
+ }
411
+ return /*#__PURE__*/ jsx(InputRenderer, {
412
+ ...props,
413
+ hint: hint,
414
+ labelAction: customLabelAction,
415
+ // @ts-expect-error – this workaround lets us display that the custom field is missing.
416
+ type: props.attribute.customField,
417
+ disabled: fieldIsDisabled
418
+ });
419
+ }
420
+ /**
421
+ * Since media fields use a custom input via the upload plugin provided by the useLibrary hook,
422
+ * we need to handle the them before other custom inputs coming from the useLibrary hook.
423
+ */ if (props.type === 'media') {
424
+ return /*#__PURE__*/ jsx(CustomMediaInput, {
425
+ ...props,
426
+ labelAction: customLabelAction,
427
+ disabled: fieldIsDisabled
428
+ });
429
+ }
430
+ /**
431
+ * This is where we handle ONLY the fields from the `useLibrary` hook.
432
+ */ const addedInputTypes = Object.keys(fields);
433
+ if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {
434
+ const CustomInput = fields[props.type];
435
+ return /*#__PURE__*/ jsx(CustomInput, {
436
+ ...props,
437
+ // @ts-expect-error – TODO: fix this type error in the useLibrary hook.
438
+ hint: hint,
439
+ labelAction: customLabelAction,
440
+ disabled: fieldIsDisabled
441
+ });
442
+ }
443
+ /**
444
+ * These include the content-manager specific fields, failing that we fall back
445
+ * to the more generic form input renderer.
446
+ */ switch(props.type){
447
+ case 'blocks':
448
+ return /*#__PURE__*/ jsx(MemoizedBlocksInput, {
449
+ ...props,
450
+ hint: hint,
451
+ type: props.type,
452
+ disabled: fieldIsDisabled
453
+ });
454
+ case 'component':
455
+ const { layout } = componentsLayout[props.attribute.component];
456
+ // Components can only have one panel, so only save the first layout item
457
+ const [remainingFieldsLayout] = getRemaingFieldsLayout({
458
+ layout: [
459
+ layout
460
+ ],
461
+ metadatas: configuration.components[props.attribute.component].metadatas,
462
+ fieldSizes,
463
+ schemaAttributes: components[props.attribute.component].attributes
464
+ });
465
+ return /*#__PURE__*/ jsx(MemoizedComponentInput, {
466
+ ...props,
467
+ layout: [
468
+ ...layout,
469
+ ...remainingFieldsLayout || []
470
+ ],
471
+ hint: hint,
472
+ labelAction: customLabelAction,
473
+ disabled: fieldIsDisabled,
474
+ children: (inputProps)=>/*#__PURE__*/ jsx(VersionInputRenderer, {
475
+ ...inputProps,
476
+ shouldIgnoreRBAC: true
477
+ })
478
+ });
479
+ case 'dynamiczone':
480
+ return /*#__PURE__*/ jsx(DynamicZone, {
481
+ ...props,
482
+ hint: hint,
483
+ labelAction: customLabelAction,
484
+ disabled: fieldIsDisabled,
485
+ children: (inputProps)=>/*#__PURE__*/ jsx(VersionInputRenderer, {
486
+ ...inputProps,
487
+ shouldIgnoreRBAC: true
488
+ })
489
+ });
490
+ case 'relation':
491
+ return /*#__PURE__*/ jsx(CustomRelationInput, {
492
+ ...props,
493
+ hint: hint,
494
+ labelAction: customLabelAction,
495
+ disabled: fieldIsDisabled
496
+ });
497
+ case 'richtext':
498
+ return /*#__PURE__*/ jsx(MemoizedWysiwyg, {
499
+ ...props,
500
+ hint: hint,
501
+ type: props.type,
502
+ labelAction: customLabelAction,
503
+ disabled: fieldIsDisabled
504
+ });
505
+ case 'uid':
506
+ return /*#__PURE__*/ jsx(MemoizedUIDInput, {
507
+ ...props,
508
+ hint: hint,
509
+ type: props.type,
510
+ labelAction: customLabelAction,
511
+ disabled: fieldIsDisabled
512
+ });
513
+ /**
514
+ * Enumerations are a special case because they require options.
515
+ */ case 'enumeration':
516
+ return /*#__PURE__*/ jsx(InputRenderer, {
517
+ ...props,
518
+ hint: hint,
519
+ labelAction: customLabelAction,
520
+ options: props.attribute.enum.map((value)=>({
521
+ value
522
+ })),
523
+ // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!
524
+ type: props.customField ? 'custom-field' : props.type,
525
+ disabled: fieldIsDisabled
526
+ });
527
+ default:
528
+ // These props are not needed for the generic form input renderer.
529
+ const { unique: _unique, mainField: _mainField, ...restProps } = props;
530
+ return /*#__PURE__*/ jsx(InputRenderer, {
531
+ ...restProps,
532
+ hint: hint,
533
+ labelAction: customLabelAction,
534
+ // @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!
535
+ type: props.customField ? 'custom-field' : props.type,
536
+ disabled: fieldIsDisabled
537
+ });
538
+ }
539
+ };
540
+ const attributeHasCustomFieldProperty = (attribute)=>'customField' in attribute && typeof attribute.customField === 'string';
541
+
542
+ const createLayoutFromFields = (fields)=>{
543
+ return fields.reduce((rows, field)=>{
544
+ if (field.type === 'dynamiczone') {
545
+ // Dynamic zones take up all the columns in a row
546
+ rows.push([
547
+ field
548
+ ]);
549
+ return rows;
550
+ }
551
+ if (!rows[rows.length - 1]) {
552
+ // Create a new row if there isn't one available
553
+ rows.push([]);
554
+ }
555
+ // Push fields to the current row, they wrap and handle their own column size
556
+ rows[rows.length - 1].push(field);
557
+ return rows;
558
+ }, [])// Map the rows to panels
559
+ .map((row)=>[
560
+ row
561
+ ]);
562
+ };
563
+ /**
564
+ * Build a layout for the fields that are were deleted from the edit view layout
565
+ * via the configure the view page. This layout will be merged with the main one.
566
+ * Those fields would be restored if the user restores the history version, which is why it's
567
+ * important to show them, even if they're not in the normal layout.
568
+ */ function getRemaingFieldsLayout({ layout, metadatas, schemaAttributes, fieldSizes }) {
569
+ const fieldsInLayout = layout.flatMap((panel)=>panel.flatMap((row)=>row.flatMap((field)=>field.name)));
570
+ const remainingFields = Object.entries(metadatas).reduce((currentRemainingFields, [name, field])=>{
571
+ // Make sure we do not fields that are not visible, e.g. "id"
572
+ if (!fieldsInLayout.includes(name) && field.edit.visible === true) {
573
+ const attribute = schemaAttributes[name];
574
+ // @ts-expect-error not sure why attribute causes type error
575
+ currentRemainingFields.push({
576
+ attribute,
577
+ type: attribute.type,
578
+ visible: true,
579
+ disabled: true,
580
+ label: field.edit.label || name,
581
+ name: name,
582
+ size: fieldSizes[attribute.type].default ?? 12
583
+ });
584
+ }
585
+ return currentRemainingFields;
586
+ }, []);
587
+ return createLayoutFromFields(remainingFields);
588
+ }
589
+ /* -------------------------------------------------------------------------------------------------
590
+ * FormPanel
591
+ * -----------------------------------------------------------------------------------------------*/ const FormPanel = ({ panel })=>{
592
+ if (panel.some((row)=>row.some((field)=>field.type === 'dynamiczone'))) {
593
+ const [row] = panel;
594
+ const [field] = row;
595
+ return /*#__PURE__*/ jsx(Grid.Root, {
596
+ gap: 4,
597
+ children: /*#__PURE__*/ jsx(Grid.Item, {
598
+ col: 12,
599
+ s: 12,
600
+ xs: 12,
601
+ direction: "column",
602
+ alignItems: "stretch",
603
+ children: /*#__PURE__*/ jsx(VersionInputRenderer, {
604
+ ...field
605
+ })
606
+ })
607
+ }, field.name);
608
+ }
609
+ return /*#__PURE__*/ jsx(Box, {
610
+ hasRadius: true,
611
+ background: "neutral0",
612
+ shadow: "tableShadow",
613
+ paddingLeft: 6,
614
+ paddingRight: 6,
615
+ paddingTop: 6,
616
+ paddingBottom: 6,
617
+ borderColor: "neutral150",
618
+ children: /*#__PURE__*/ jsx(Flex, {
619
+ direction: "column",
620
+ alignItems: "stretch",
621
+ gap: 6,
622
+ children: panel.map((row, gridRowIndex)=>/*#__PURE__*/ jsx(Grid.Root, {
623
+ gap: 4,
624
+ children: row.map(({ size, ...field })=>{
625
+ return /*#__PURE__*/ jsx(Grid.Item, {
626
+ col: size,
627
+ s: 12,
628
+ xs: 12,
629
+ direction: "column",
630
+ alignItems: "stretch",
631
+ children: /*#__PURE__*/ jsx(VersionInputRenderer, {
632
+ ...field
633
+ })
634
+ }, field.name);
635
+ })
636
+ }, gridRowIndex))
637
+ })
638
+ });
639
+ };
640
+ const VersionContent = ()=>{
641
+ const { formatMessage } = useIntl();
642
+ const { fieldSizes } = useTypedSelector((state)=>state['content-manager'].app);
643
+ const version = useHistoryContext('VersionContent', (state)=>state.selectedVersion);
644
+ const layout = useHistoryContext('VersionContent', (state)=>state.layout);
645
+ const configuration = useHistoryContext('VersionContent', (state)=>state.configuration);
646
+ const schema = useHistoryContext('VersionContent', (state)=>state.schema);
647
+ // Build a layout for the unknown fields section
648
+ const removedAttributes = version.meta.unknownAttributes.removed;
649
+ const removedAttributesAsFields = Object.entries(removedAttributes).map(([attributeName, attribute])=>{
650
+ const field = {
651
+ attribute,
652
+ shouldIgnoreRBAC: true,
653
+ type: attribute.type,
654
+ visible: true,
655
+ disabled: true,
656
+ label: attributeName,
657
+ name: attributeName,
658
+ size: fieldSizes[attribute.type].default ?? 12
659
+ };
660
+ return field;
661
+ });
662
+ const unknownFieldsLayout = createLayoutFromFields(removedAttributesAsFields);
663
+ // Build a layout for the fields that are were deleted from the layout
664
+ const remainingFieldsLayout = getRemaingFieldsLayout({
665
+ metadatas: configuration.contentType.metadatas,
666
+ layout,
667
+ schemaAttributes: schema.attributes,
668
+ fieldSizes
669
+ });
670
+ const { components } = useDoc();
671
+ /**
672
+ * Transform the data before passing it to the form so that each field
673
+ * has a uniquely generated key
674
+ */ const transformedData = React.useMemo(()=>{
675
+ const transform = (schemaAttributes, components = {})=>(document)=>{
676
+ const schema = {
677
+ attributes: schemaAttributes
678
+ };
679
+ const transformations = pipe(removeFieldsThatDontExistOnSchema(schema), prepareTempKeys(schema, components));
680
+ return transformations(document);
681
+ };
682
+ return transform(version.schema, components)(version.data);
683
+ }, [
684
+ components,
685
+ version.data,
686
+ version.schema
687
+ ]);
688
+ return /*#__PURE__*/ jsxs(Layouts.Content, {
689
+ children: [
690
+ /*#__PURE__*/ jsx(Box, {
691
+ paddingBottom: 8,
692
+ children: /*#__PURE__*/ jsx(Form, {
693
+ disabled: true,
694
+ method: "PUT",
695
+ initialValues: transformedData,
696
+ children: /*#__PURE__*/ jsx(Flex, {
697
+ direction: "column",
698
+ alignItems: "stretch",
699
+ gap: 6,
700
+ position: "relative",
701
+ children: [
702
+ ...layout,
703
+ ...remainingFieldsLayout
704
+ ].map((panel, index)=>{
705
+ return /*#__PURE__*/ jsx(FormPanel, {
706
+ panel: panel
707
+ }, index);
708
+ })
709
+ })
710
+ })
711
+ }),
712
+ removedAttributesAsFields.length > 0 && /*#__PURE__*/ jsxs(Fragment, {
713
+ children: [
714
+ /*#__PURE__*/ jsx(Divider, {}),
715
+ /*#__PURE__*/ jsxs(Box, {
716
+ paddingTop: 8,
717
+ children: [
718
+ /*#__PURE__*/ jsxs(Flex, {
719
+ direction: "column",
720
+ alignItems: "flex-start",
721
+ paddingBottom: 6,
722
+ gap: 1,
723
+ children: [
724
+ /*#__PURE__*/ jsx(Typography, {
725
+ variant: "delta",
726
+ children: formatMessage({
727
+ id: 'content-manager.history.content.unknown-fields.title',
728
+ defaultMessage: 'Unknown fields'
729
+ })
730
+ }),
731
+ /*#__PURE__*/ jsx(Typography, {
732
+ variant: "pi",
733
+ children: formatMessage({
734
+ id: 'content-manager.history.content.unknown-fields.message',
735
+ defaultMessage: 'These fields have been deleted or renamed in the Content-Type Builder. <b>These fields will not be restored.</b>'
736
+ }, {
737
+ b: (chunks)=>/*#__PURE__*/ jsx(Typography, {
738
+ variant: "pi",
739
+ fontWeight: "bold",
740
+ children: chunks
741
+ })
742
+ })
743
+ })
744
+ ]
745
+ }),
746
+ /*#__PURE__*/ jsx(Form, {
747
+ disabled: true,
748
+ method: "PUT",
749
+ initialValues: version.data,
750
+ children: /*#__PURE__*/ jsx(Flex, {
751
+ direction: "column",
752
+ alignItems: "stretch",
753
+ gap: 6,
754
+ position: "relative",
755
+ children: unknownFieldsLayout.map((panel, index)=>{
756
+ return /*#__PURE__*/ jsx(FormPanel, {
757
+ panel: panel
758
+ }, index);
759
+ })
760
+ })
761
+ })
762
+ ]
763
+ })
764
+ ]
765
+ })
766
+ ]
767
+ });
768
+ };
769
+
770
+ const historyVersionsApi = contentManagerApi.injectEndpoints({
771
+ endpoints: (builder)=>({
772
+ getHistoryVersions: builder.query({
773
+ query (params) {
774
+ return {
775
+ url: `/content-manager/history-versions`,
776
+ method: 'GET',
777
+ config: {
778
+ params
779
+ }
780
+ };
781
+ },
782
+ providesTags: [
783
+ 'HistoryVersion'
784
+ ]
785
+ }),
786
+ restoreVersion: builder.mutation({
787
+ query ({ params, body }) {
788
+ return {
789
+ url: `/content-manager/history-versions/${params.versionId}/restore`,
790
+ method: 'PUT',
791
+ data: body
792
+ };
793
+ },
794
+ invalidatesTags: (_res, _error, { documentId, collectionType, params })=>{
795
+ return [
796
+ 'HistoryVersion',
797
+ {
798
+ type: 'Document',
799
+ id: collectionType === COLLECTION_TYPES ? `${params.contentType}_${documentId}` : params.contentType
800
+ }
801
+ ];
802
+ }
803
+ })
804
+ })
805
+ });
806
+ const { useGetHistoryVersionsQuery, useRestoreVersionMutation } = historyVersionsApi;
807
+
808
+ const VersionHeader = ({ headerId })=>{
809
+ const [isConfirmDialogOpen, setIsConfirmDialogOpen] = React.useState(false);
810
+ const navigate = useNavigate();
811
+ const { formatMessage, formatDate } = useIntl();
812
+ const { trackUsage } = useTracking();
813
+ const { toggleNotification } = useNotification();
814
+ const [{ query }] = useQueryParams();
815
+ const { collectionType, slug } = useParams();
816
+ const [restoreVersion, { isLoading }] = useRestoreVersionMutation();
817
+ const { allowedActions } = useRBAC(PERMISSIONS.map((action)=>({
818
+ action,
819
+ subject: slug
820
+ })));
821
+ const version = useHistoryContext('VersionHeader', (state)=>state.selectedVersion);
822
+ const mainField = useHistoryContext('VersionHeader', (state)=>state.mainField);
823
+ const schema = useHistoryContext('VersionHeader', (state)=>state.schema);
824
+ const isCurrentVersion = useHistoryContext('VersionHeader', (state)=>state.page === 1 && state.versions.data[0].id === state.selectedVersion.id);
825
+ const mainFieldValue = version.data[mainField];
826
+ const getNextNavigation = ()=>{
827
+ const pluginsQueryParams = stringify({
828
+ plugins: query.plugins
829
+ }, {
830
+ encode: false
831
+ });
832
+ return {
833
+ pathname: '..',
834
+ search: pluginsQueryParams
835
+ };
836
+ };
837
+ const handleRestore = async ()=>{
838
+ try {
839
+ const response = await restoreVersion({
840
+ documentId: version.relatedDocumentId,
841
+ collectionType,
842
+ params: {
843
+ versionId: version.id,
844
+ contentType: version.contentType
845
+ },
846
+ body: {
847
+ contentType: version.contentType
848
+ }
849
+ });
850
+ if ('data' in response) {
851
+ navigate(getNextNavigation(), {
852
+ relative: 'path'
853
+ });
854
+ toggleNotification({
855
+ type: 'success',
856
+ title: formatMessage({
857
+ id: 'content-manager.restore.success.title',
858
+ defaultMessage: 'Version restored.'
859
+ }),
860
+ message: formatMessage({
861
+ id: 'content-manager.restore.success.message',
862
+ defaultMessage: 'A past version of the content was restored.'
863
+ })
864
+ });
865
+ trackUsage('didRestoreHistoryVersion');
866
+ }
867
+ if ('error' in response) {
868
+ toggleNotification({
869
+ type: 'danger',
870
+ message: formatMessage({
871
+ id: 'content-manager.history.restore.error.message',
872
+ defaultMessage: 'Could not restore version.'
873
+ })
874
+ });
875
+ }
876
+ } catch (error) {
877
+ toggleNotification({
878
+ type: 'danger',
879
+ message: formatMessage({
880
+ id: 'notification.error',
881
+ defaultMessage: 'An error occurred'
882
+ })
883
+ });
884
+ }
885
+ };
886
+ return /*#__PURE__*/ jsxs(Dialog.Root, {
887
+ open: isConfirmDialogOpen,
888
+ onOpenChange: setIsConfirmDialogOpen,
889
+ children: [
890
+ /*#__PURE__*/ jsx(Layouts.BaseHeader, {
891
+ id: headerId,
892
+ title: formatDate(new Date(version.createdAt), {
893
+ year: 'numeric',
894
+ month: 'numeric',
895
+ day: 'numeric',
896
+ hour: 'numeric',
897
+ minute: 'numeric'
898
+ }),
899
+ subtitle: /*#__PURE__*/ jsx(Typography, {
900
+ variant: "epsilon",
901
+ textColor: "neutral600",
902
+ children: formatMessage({
903
+ id: 'content-manager.history.version.subtitle',
904
+ defaultMessage: '{hasLocale, select, true {{subtitle}, in {locale}} other {{subtitle}}}'
905
+ }, {
906
+ hasLocale: Boolean(version.locale),
907
+ subtitle: `${mainFieldValue || ''} (${schema.info.singularName})`.trim(),
908
+ locale: version.locale?.name
909
+ })
910
+ }),
911
+ navigationAction: /*#__PURE__*/ jsx(Link, {
912
+ startIcon: /*#__PURE__*/ jsx(ArrowLeft, {}),
913
+ tag: NavLink,
914
+ to: getNextNavigation(),
915
+ relative: "path",
916
+ isExternal: false,
917
+ children: formatMessage({
918
+ id: 'global.back',
919
+ defaultMessage: 'Back'
920
+ })
921
+ }),
922
+ sticky: false,
923
+ primaryAction: /*#__PURE__*/ jsx(Dialog.Trigger, {
924
+ children: /*#__PURE__*/ jsx(Button, {
925
+ disabled: !allowedActions.canUpdate || isCurrentVersion,
926
+ onClick: ()=>{
927
+ setIsConfirmDialogOpen(true);
928
+ },
929
+ children: formatMessage({
930
+ id: 'content-manager.history.restore.confirm.button',
931
+ defaultMessage: 'Restore'
932
+ })
933
+ })
934
+ })
935
+ }),
936
+ /*#__PURE__*/ jsx(ConfirmDialog, {
937
+ onConfirm: handleRestore,
938
+ endAction: /*#__PURE__*/ jsx(Button, {
939
+ variant: "secondary",
940
+ onClick: handleRestore,
941
+ loading: isLoading,
942
+ children: formatMessage({
943
+ id: 'content-manager.history.restore.confirm.button',
944
+ defaultMessage: 'Restore'
945
+ })
946
+ }),
947
+ children: /*#__PURE__*/ jsxs(Flex, {
948
+ direction: "column",
949
+ alignItems: "center",
950
+ justifyContent: "center",
951
+ gap: 2,
952
+ textAlign: "center",
953
+ children: [
954
+ /*#__PURE__*/ jsx(Flex, {
955
+ justifyContent: "center",
956
+ children: /*#__PURE__*/ jsx(WarningCircle, {
957
+ width: "24px",
958
+ height: "24px",
959
+ fill: "danger600"
960
+ })
961
+ }),
962
+ /*#__PURE__*/ jsx(Typography, {
963
+ children: formatMessage({
964
+ id: 'content-manager.history.restore.confirm.title',
965
+ defaultMessage: 'Are you sure you want to restore this version?'
966
+ })
967
+ }),
968
+ /*#__PURE__*/ jsx(Typography, {
969
+ children: formatMessage({
970
+ id: 'content-manager.history.restore.confirm.message',
971
+ defaultMessage: "{isDraft, select, true {The restored content will override your draft.} other {The restored content won't be published, it will override the draft and be saved as pending changes. You'll be able to publish the changes at anytime.}}"
972
+ }, {
973
+ isDraft: version.status === 'draft'
974
+ })
975
+ })
976
+ ]
977
+ })
978
+ })
979
+ ]
980
+ });
981
+ };
982
+
983
+ /* -------------------------------------------------------------------------------------------------
984
+ * BlueText
985
+ * -----------------------------------------------------------------------------------------------*/ const BlueText = (children)=>/*#__PURE__*/ jsx(Typography, {
986
+ textColor: "primary600",
987
+ variant: "pi",
988
+ children: children
989
+ });
990
+ const VersionCard = ({ version, isCurrent })=>{
991
+ const { formatDate, formatMessage } = useIntl();
992
+ const [{ query }] = useQueryParams();
993
+ const isActive = query.id === version.id.toString();
994
+ const author = version.createdBy && getDisplayName(version.createdBy);
995
+ return /*#__PURE__*/ jsxs(Flex, {
996
+ direction: "column",
997
+ alignItems: "flex-start",
998
+ gap: 3,
999
+ hasRadius: true,
1000
+ borderWidth: "1px",
1001
+ borderStyle: "solid",
1002
+ borderColor: isActive ? 'primary600' : 'neutral200',
1003
+ color: "neutral800",
1004
+ padding: 5,
1005
+ tag: Link$1,
1006
+ to: `?${stringify({
1007
+ ...query,
1008
+ id: version.id
1009
+ })}`,
1010
+ style: {
1011
+ textDecoration: 'none'
1012
+ },
1013
+ children: [
1014
+ /*#__PURE__*/ jsxs(Flex, {
1015
+ direction: "column",
1016
+ gap: 1,
1017
+ alignItems: "flex-start",
1018
+ children: [
1019
+ /*#__PURE__*/ jsx(Typography, {
1020
+ tag: "h3",
1021
+ fontWeight: "semiBold",
1022
+ children: formatDate(version.createdAt, {
1023
+ day: 'numeric',
1024
+ month: 'numeric',
1025
+ year: 'numeric',
1026
+ hour: '2-digit',
1027
+ minute: '2-digit'
1028
+ })
1029
+ }),
1030
+ /*#__PURE__*/ jsx(Typography, {
1031
+ tag: "p",
1032
+ variant: "pi",
1033
+ textColor: "neutral600",
1034
+ children: formatMessage({
1035
+ id: 'content-manager.history.sidebar.versionDescription',
1036
+ defaultMessage: '{distanceToNow}{isAnonymous, select, true {} other { by {author}}}{isCurrent, select, true { <b>(current)</b>} other {}}'
1037
+ }, {
1038
+ distanceToNow: /*#__PURE__*/ jsx(RelativeTime, {
1039
+ timestamp: new Date(version.createdAt)
1040
+ }),
1041
+ author,
1042
+ isAnonymous: !Boolean(version.createdBy),
1043
+ isCurrent,
1044
+ b: BlueText
1045
+ })
1046
+ })
1047
+ ]
1048
+ }),
1049
+ version.status && /*#__PURE__*/ jsx(DocumentStatus, {
1050
+ status: version.status,
1051
+ size: "XS"
1052
+ })
1053
+ ]
1054
+ });
1055
+ };
1056
+ const PaginationButton = ({ page, children })=>{
1057
+ const [{ query }] = useQueryParams();
1058
+ // Remove the id from the pagination link, so that the history page can redirect
1059
+ // to the id of the first history version in the new page once it's loaded
1060
+ const { id: _id, ...queryRest } = query;
1061
+ return /*#__PURE__*/ jsx(Link$1, {
1062
+ to: {
1063
+ search: stringify({
1064
+ ...queryRest,
1065
+ page
1066
+ })
1067
+ },
1068
+ style: {
1069
+ textDecoration: 'none'
1070
+ },
1071
+ children: /*#__PURE__*/ jsx(Typography, {
1072
+ variant: "omega",
1073
+ textColor: "primary600",
1074
+ children: children
1075
+ })
1076
+ });
1077
+ };
1078
+ /* -------------------------------------------------------------------------------------------------
1079
+ * VersionsList
1080
+ * -----------------------------------------------------------------------------------------------*/ const VersionsList = ()=>{
1081
+ const { formatMessage } = useIntl();
1082
+ const { versions, page } = useHistoryContext('VersionsList', (state)=>({
1083
+ versions: state.versions,
1084
+ page: state.page
1085
+ }));
1086
+ return /*#__PURE__*/ jsxs(Flex, {
1087
+ shrink: 0,
1088
+ direction: "column",
1089
+ alignItems: "stretch",
1090
+ width: "320px",
1091
+ height: "100vh",
1092
+ background: "neutral0",
1093
+ borderColor: "neutral200",
1094
+ borderWidth: "0 0 0 1px",
1095
+ borderStyle: "solid",
1096
+ tag: "aside",
1097
+ children: [
1098
+ /*#__PURE__*/ jsxs(Flex, {
1099
+ direction: "row",
1100
+ justifyContent: "space-between",
1101
+ padding: 4,
1102
+ borderColor: "neutral200",
1103
+ borderWidth: "0 0 1px",
1104
+ borderStyle: "solid",
1105
+ tag: "header",
1106
+ children: [
1107
+ /*#__PURE__*/ jsx(Typography, {
1108
+ tag: "h2",
1109
+ variant: "omega",
1110
+ fontWeight: "semiBold",
1111
+ children: formatMessage({
1112
+ id: 'content-manager.history.sidebar.title',
1113
+ defaultMessage: 'Versions'
1114
+ })
1115
+ }),
1116
+ /*#__PURE__*/ jsx(Box, {
1117
+ background: "neutral150",
1118
+ hasRadius: true,
1119
+ padding: 1,
1120
+ children: /*#__PURE__*/ jsx(Typography, {
1121
+ variant: "sigma",
1122
+ textColor: "neutral600",
1123
+ children: versions.meta.pagination.total
1124
+ })
1125
+ })
1126
+ ]
1127
+ }),
1128
+ /*#__PURE__*/ jsxs(Box, {
1129
+ flex: 1,
1130
+ overflow: "auto",
1131
+ children: [
1132
+ versions.meta.pagination.page > 1 && /*#__PURE__*/ jsx(Box, {
1133
+ paddingTop: 4,
1134
+ textAlign: "center",
1135
+ children: /*#__PURE__*/ jsx(PaginationButton, {
1136
+ page: page - 1,
1137
+ children: formatMessage({
1138
+ id: 'content-manager.history.sidebar.show-newer',
1139
+ defaultMessage: 'Show newer versions'
1140
+ })
1141
+ })
1142
+ }),
1143
+ /*#__PURE__*/ jsx(Flex, {
1144
+ direction: "column",
1145
+ gap: 3,
1146
+ padding: 4,
1147
+ tag: "ul",
1148
+ alignItems: "stretch",
1149
+ children: versions.data.map((version, index)=>/*#__PURE__*/ jsx("li", {
1150
+ "aria-label": formatMessage({
1151
+ id: 'content-manager.history.sidebar.title.version-card.aria-label',
1152
+ defaultMessage: 'Version card'
1153
+ }),
1154
+ children: /*#__PURE__*/ jsx(VersionCard, {
1155
+ version: version,
1156
+ isCurrent: page === 1 && index === 0
1157
+ })
1158
+ }, version.id))
1159
+ }),
1160
+ versions.meta.pagination.page < versions.meta.pagination.pageCount && /*#__PURE__*/ jsx(Box, {
1161
+ paddingBottom: 4,
1162
+ textAlign: "center",
1163
+ children: /*#__PURE__*/ jsx(PaginationButton, {
1164
+ page: page + 1,
1165
+ children: formatMessage({
1166
+ id: 'content-manager.history.sidebar.show-older',
1167
+ defaultMessage: 'Show older versions'
1168
+ })
1169
+ })
1170
+ })
1171
+ ]
1172
+ })
1173
+ ]
1174
+ });
1175
+ };
1176
+
1177
+ const [HistoryProvider, useHistoryContext] = createContext('HistoryPage');
1178
+ /* -------------------------------------------------------------------------------------------------
1179
+ * HistoryPage
1180
+ * -----------------------------------------------------------------------------------------------*/ const HistoryPage = ()=>{
1181
+ const headerId = React.useId();
1182
+ const { formatMessage } = useIntl();
1183
+ const { slug, id: documentId, collectionType } = useParams();
1184
+ const { isLoading: isLoadingDocument, schema } = useDocument({
1185
+ collectionType: collectionType,
1186
+ model: slug
1187
+ });
1188
+ const { isLoading: isLoadingLayout, edit: { layout, settings: { displayName, mainField } } } = useDocumentLayout(slug);
1189
+ const { data: configuration, isLoading: isLoadingConfiguration } = useGetContentTypeConfigurationQuery(slug);
1190
+ // Parse state from query params
1191
+ const [{ query }] = useQueryParams();
1192
+ const { id: selectedVersionId, ...queryWithoutId } = query;
1193
+ const validQueryParamsWithoutId = buildValidParams(queryWithoutId);
1194
+ const page = validQueryParamsWithoutId.page ? Number(validQueryParamsWithoutId.page) : 1;
1195
+ const versionsResponse = useGetHistoryVersionsQuery({
1196
+ contentType: slug,
1197
+ ...documentId ? {
1198
+ documentId
1199
+ } : {},
1200
+ // Omit id since it's not needed by the endpoint and caused extra refetches
1201
+ ...validQueryParamsWithoutId
1202
+ }, {
1203
+ refetchOnMountOrArgChange: true
1204
+ });
1205
+ /**
1206
+ * When the page is first mounted, if there's already data in the cache, RTK has a fullfilled
1207
+ * status for the first render, right before it triggers a new request. This means the code
1208
+ * briefly reaches the part that redirects to the first history version (if none is set).
1209
+ * But since that data is stale, that means auto-selecting a version that may not be the most
1210
+ * recent. To avoid this, we identify through requestId if the query is stale despite the
1211
+ * fullfilled status, and show the loader in that case.
1212
+ * This means we essentially don't want cache. We always refetch when the page mounts, and
1213
+ * we always show the loader until we have the most recent data. That's fine for this page.
1214
+ */ const initialRequestId = React.useRef(versionsResponse.requestId);
1215
+ const isStaleRequest = versionsResponse.requestId === initialRequestId.current;
1216
+ /**
1217
+ * Ensure that we have the necessary data to render the page:
1218
+ * - slug for single types
1219
+ * - slug _and_ documentId for collection types
1220
+ */ if (!slug || collectionType === COLLECTION_TYPES && !documentId) {
1221
+ return /*#__PURE__*/ jsx(Navigate, {
1222
+ to: "/content-manager"
1223
+ });
1224
+ }
1225
+ if (isLoadingDocument || isLoadingLayout || versionsResponse.isFetching || isStaleRequest || isLoadingConfiguration) {
1226
+ return /*#__PURE__*/ jsx(Page.Loading, {});
1227
+ }
1228
+ // It was a success, handle empty data
1229
+ if (!versionsResponse.isError && !versionsResponse.data?.data?.length) {
1230
+ return /*#__PURE__*/ jsx(Fragment, {
1231
+ children: /*#__PURE__*/ jsx(Page.NoData, {
1232
+ action: /*#__PURE__*/ jsx(Link, {
1233
+ tag: NavLink,
1234
+ to: `/content-manager/${collectionType}/${slug}${documentId ? `/${documentId}` : ''}`,
1235
+ children: formatMessage({
1236
+ id: 'global.back',
1237
+ defaultMessage: 'Back'
1238
+ })
1239
+ })
1240
+ })
1241
+ });
1242
+ }
1243
+ // We have data, handle selected version
1244
+ if (versionsResponse.data?.data?.length && !selectedVersionId) {
1245
+ return /*#__PURE__*/ jsx(Navigate, {
1246
+ to: {
1247
+ search: stringify({
1248
+ ...query,
1249
+ id: versionsResponse.data.data[0].id
1250
+ })
1251
+ },
1252
+ replace: true
1253
+ });
1254
+ }
1255
+ const selectedVersion = versionsResponse.data?.data?.find((version)=>version.id.toString() === selectedVersionId);
1256
+ if (versionsResponse.isError || !layout || !schema || !selectedVersion || !configuration || // This should not happen as it's covered by versionsResponse.isError, but we need it for TS
1257
+ versionsResponse.data.error) {
1258
+ return /*#__PURE__*/ jsx(Page.Error, {});
1259
+ }
1260
+ return /*#__PURE__*/ jsxs(Fragment, {
1261
+ children: [
1262
+ /*#__PURE__*/ jsx(Page.Title, {
1263
+ children: formatMessage({
1264
+ id: 'content-manager.history.page-title',
1265
+ defaultMessage: '{contentType} history'
1266
+ }, {
1267
+ contentType: displayName
1268
+ })
1269
+ }),
1270
+ /*#__PURE__*/ jsx(HistoryProvider, {
1271
+ contentType: slug,
1272
+ id: documentId,
1273
+ schema: schema,
1274
+ layout: layout,
1275
+ configuration: configuration,
1276
+ selectedVersion: selectedVersion,
1277
+ versions: versionsResponse.data,
1278
+ page: page,
1279
+ mainField: mainField,
1280
+ children: /*#__PURE__*/ jsxs(Flex, {
1281
+ direction: "row",
1282
+ alignItems: "flex-start",
1283
+ children: [
1284
+ /*#__PURE__*/ jsxs(Main, {
1285
+ grow: 1,
1286
+ height: "100vh",
1287
+ background: "neutral100",
1288
+ paddingBottom: 6,
1289
+ overflow: "auto",
1290
+ labelledBy: headerId,
1291
+ children: [
1292
+ /*#__PURE__*/ jsx(VersionHeader, {
1293
+ headerId: headerId
1294
+ }),
1295
+ /*#__PURE__*/ jsx(DocumentContextProvider, {
1296
+ initialDocument: {
1297
+ documentId: documentId || '',
1298
+ model: slug,
1299
+ collectionType: collectionType || ''
1300
+ },
1301
+ children: /*#__PURE__*/ jsx(VersionContent, {})
1302
+ })
1303
+ ]
1304
+ }),
1305
+ /*#__PURE__*/ jsx(VersionsList, {})
1306
+ ]
1307
+ })
1308
+ })
1309
+ ]
1310
+ });
1311
+ };
1312
+ /* -------------------------------------------------------------------------------------------------
1313
+ * ProtectedHistoryPage
1314
+ * -----------------------------------------------------------------------------------------------*/ const ProtectedHistoryPageImpl = ()=>{
1315
+ const { slug } = useParams();
1316
+ const { permissions = [], isLoading, error } = useRBAC(PERMISSIONS.map((action)=>({
1317
+ action,
1318
+ subject: slug
1319
+ })));
1320
+ if (isLoading) {
1321
+ return /*#__PURE__*/ jsx(Page.Loading, {});
1322
+ }
1323
+ if (error || !slug) {
1324
+ return /*#__PURE__*/ jsx(Box, {
1325
+ height: "100vh",
1326
+ width: "100vw",
1327
+ position: "fixed",
1328
+ top: 0,
1329
+ left: 0,
1330
+ zIndex: 2,
1331
+ background: "neutral0",
1332
+ children: /*#__PURE__*/ jsx(Page.Error, {})
1333
+ });
1334
+ }
1335
+ return /*#__PURE__*/ jsx(Box, {
1336
+ height: "100vh",
1337
+ width: "100vw",
1338
+ position: "fixed",
1339
+ top: 0,
1340
+ left: 0,
1341
+ zIndex: 2,
1342
+ background: "neutral0",
1343
+ children: /*#__PURE__*/ jsx(Page.Protect, {
1344
+ permissions: permissions,
1345
+ children: ({ permissions })=>/*#__PURE__*/ jsx(DocumentRBAC, {
1346
+ permissions: permissions,
1347
+ children: /*#__PURE__*/ jsx(HistoryPage, {})
1348
+ })
1349
+ })
1350
+ });
1351
+ };
1352
+ const ProtectedHistoryPage = ()=>{
1353
+ return /*#__PURE__*/ jsx(Portal, {
1354
+ children: /*#__PURE__*/ jsx(FocusTrap, {
1355
+ children: /*#__PURE__*/ jsx(ProtectedHistoryPageImpl, {})
1356
+ })
1357
+ });
1358
+ };
1359
+
1360
+ export { HistoryProvider, ProtectedHistoryPage, useHistoryContext };
1361
+ //# sourceMappingURL=History-B7dGNfmx.mjs.map