@strapi/content-manager 0.0.0-experimental.bffd3c1819cd08304e7d270e88b4973e9fcbc183 → 0.0.0-experimental.c23f51fc41b3ef5de081f427d07e87af93cdcb2c

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