@strapi/content-manager 0.0.0-experimental.d1602f22dc638a4c3c5084965fd6126fff5e9d4f → 0.0.0-experimental.d325780feab1caf1b9e4423588eb1cc73b74c376

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