@wordpress/editor 14.3.0 → 14.4.0

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 (400) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -1
  3. package/build/bindings/api.js +65 -0
  4. package/build/bindings/api.js.map +1 -0
  5. package/build/bindings/pattern-overrides.js +23 -13
  6. package/build/bindings/pattern-overrides.js.map +1 -1
  7. package/build/bindings/post-meta.js +23 -12
  8. package/build/bindings/post-meta.js.map +1 -1
  9. package/build/components/block-settings-menu/content-only-settings-menu.js +4 -1
  10. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  11. package/build/components/blog-title/index.js +6 -2
  12. package/build/components/blog-title/index.js.map +1 -1
  13. package/build/components/collapsible-block-toolbar/index.js +2 -3
  14. package/build/components/collapsible-block-toolbar/index.js.map +1 -1
  15. package/build/components/global-styles-provider/index.js +15 -3
  16. package/build/components/global-styles-provider/index.js.map +1 -1
  17. package/build/components/header/back-button.js +7 -8
  18. package/build/components/header/back-button.js.map +1 -1
  19. package/build/components/header/index.js +19 -17
  20. package/build/components/header/index.js.map +1 -1
  21. package/build/components/page-attributes/order.js +1 -67
  22. package/build/components/page-attributes/order.js.map +1 -1
  23. package/build/components/page-attributes/panel.js +1 -4
  24. package/build/components/page-attributes/panel.js.map +1 -1
  25. package/build/components/post-actions/actions.js +126 -33
  26. package/build/components/post-actions/actions.js.map +1 -1
  27. package/build/components/post-card-panel/index.js +8 -2
  28. package/build/components/post-card-panel/index.js.map +1 -1
  29. package/build/components/post-comments/index.js +1 -1
  30. package/build/components/post-comments/index.js.map +1 -1
  31. package/build/components/post-content-information/index.js +7 -1
  32. package/build/components/post-content-information/index.js.map +1 -1
  33. package/build/components/post-discussion/panel.js +2 -2
  34. package/build/components/post-discussion/panel.js.map +1 -1
  35. package/build/components/post-excerpt/panel.js +1 -1
  36. package/build/components/post-excerpt/panel.js.map +1 -1
  37. package/build/components/post-featured-image/index.js +3 -1
  38. package/build/components/post-featured-image/index.js.map +1 -1
  39. package/build/components/post-last-revision/index.js +2 -1
  40. package/build/components/post-last-revision/index.js.map +1 -1
  41. package/build/components/post-publish-button/index.js +4 -11
  42. package/build/components/post-publish-button/index.js.map +1 -1
  43. package/build/components/post-publish-panel/maybe-category-panel.js +4 -1
  44. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  45. package/build/components/post-publish-panel/maybe-tags-panel.js +2 -1
  46. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  47. package/build/components/post-status/index.js +30 -10
  48. package/build/components/post-status/index.js.map +1 -1
  49. package/build/components/post-taxonomies/flat-term-selector.js +17 -6
  50. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  51. package/build/components/post-taxonomies/index.js +7 -1
  52. package/build/components/post-taxonomies/index.js.map +1 -1
  53. package/build/components/post-template/block-theme.js +4 -4
  54. package/build/components/post-template/block-theme.js.map +1 -1
  55. package/build/components/post-template/classic-theme.js +8 -2
  56. package/build/components/post-template/classic-theme.js.map +1 -1
  57. package/build/components/post-template/create-new-template.js +4 -1
  58. package/build/components/post-template/create-new-template.js.map +1 -1
  59. package/build/components/post-template/hooks.js +5 -1
  60. package/build/components/post-template/hooks.js.map +1 -1
  61. package/build/components/post-template/panel.js +8 -2
  62. package/build/components/post-template/panel.js.map +1 -1
  63. package/build/components/post-trash/check.js +6 -4
  64. package/build/components/post-trash/check.js.map +1 -1
  65. package/build/components/post-url/panel.js +6 -2
  66. package/build/components/post-url/panel.js.map +1 -1
  67. package/build/components/posts-per-page/index.js +6 -2
  68. package/build/components/posts-per-page/index.js.map +1 -1
  69. package/build/components/provider/use-block-editor-settings.js +15 -6
  70. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  71. package/build/components/save-publish-panels/index.js +1 -2
  72. package/build/components/save-publish-panels/index.js.map +1 -1
  73. package/build/components/sidebar/index.js +3 -9
  74. package/build/components/sidebar/index.js.map +1 -1
  75. package/build/components/site-discussion/index.js +7 -3
  76. package/build/components/site-discussion/index.js.map +1 -1
  77. package/build/components/template-content-panel/index.js +5 -5
  78. package/build/components/template-content-panel/index.js.map +1 -1
  79. package/build/components/visual-editor/edit-template-blocks-notification.js +4 -4
  80. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  81. package/build/components/visual-editor/index.js +5 -2
  82. package/build/components/visual-editor/index.js.map +1 -1
  83. package/build/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  84. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -0
  85. package/build/dataviews/actions/delete-post.js +2 -0
  86. package/build/dataviews/actions/delete-post.js.map +1 -1
  87. package/build/hooks/pattern-overrides.js +1 -1
  88. package/build/hooks/pattern-overrides.js.map +1 -1
  89. package/build/index.js +0 -1
  90. package/build/index.js.map +1 -1
  91. package/build/private-apis.js +3 -0
  92. package/build/private-apis.js.map +1 -1
  93. package/build/utils/media-upload/index.js +35 -2
  94. package/build/utils/media-upload/index.js.map +1 -1
  95. package/build-module/bindings/api.js +57 -0
  96. package/build-module/bindings/api.js.map +1 -0
  97. package/build-module/bindings/pattern-overrides.js +23 -13
  98. package/build-module/bindings/pattern-overrides.js.map +1 -1
  99. package/build-module/bindings/post-meta.js +23 -12
  100. package/build-module/bindings/post-meta.js.map +1 -1
  101. package/build-module/components/block-settings-menu/content-only-settings-menu.js +4 -1
  102. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  103. package/build-module/components/blog-title/index.js +6 -2
  104. package/build-module/components/blog-title/index.js.map +1 -1
  105. package/build-module/components/collapsible-block-toolbar/index.js +1 -2
  106. package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
  107. package/build-module/components/global-styles-provider/index.js +15 -3
  108. package/build-module/components/global-styles-provider/index.js.map +1 -1
  109. package/build-module/components/header/back-button.js +5 -7
  110. package/build-module/components/header/back-button.js.map +1 -1
  111. package/build-module/components/header/index.js +19 -19
  112. package/build-module/components/header/index.js.map +1 -1
  113. package/build-module/components/page-attributes/order.js +4 -70
  114. package/build-module/components/page-attributes/order.js.map +1 -1
  115. package/build-module/components/page-attributes/panel.js +1 -6
  116. package/build-module/components/page-attributes/panel.js.map +1 -1
  117. package/build-module/components/post-actions/actions.js +127 -34
  118. package/build-module/components/post-actions/actions.js.map +1 -1
  119. package/build-module/components/post-card-panel/index.js +8 -2
  120. package/build-module/components/post-card-panel/index.js.map +1 -1
  121. package/build-module/components/post-comments/index.js +2 -2
  122. package/build-module/components/post-comments/index.js.map +1 -1
  123. package/build-module/components/post-content-information/index.js +7 -1
  124. package/build-module/components/post-content-information/index.js.map +1 -1
  125. package/build-module/components/post-discussion/panel.js +3 -3
  126. package/build-module/components/post-discussion/panel.js.map +1 -1
  127. package/build-module/components/post-excerpt/panel.js +1 -1
  128. package/build-module/components/post-excerpt/panel.js.map +1 -1
  129. package/build-module/components/post-featured-image/index.js +3 -1
  130. package/build-module/components/post-featured-image/index.js.map +1 -1
  131. package/build-module/components/post-last-revision/index.js +2 -1
  132. package/build-module/components/post-last-revision/index.js.map +1 -1
  133. package/build-module/components/post-publish-button/index.js +4 -11
  134. package/build-module/components/post-publish-button/index.js.map +1 -1
  135. package/build-module/components/post-publish-panel/maybe-category-panel.js +4 -1
  136. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  137. package/build-module/components/post-publish-panel/maybe-tags-panel.js +2 -1
  138. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  139. package/build-module/components/post-status/index.js +30 -10
  140. package/build-module/components/post-status/index.js.map +1 -1
  141. package/build-module/components/post-taxonomies/flat-term-selector.js +17 -6
  142. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  143. package/build-module/components/post-taxonomies/index.js +7 -1
  144. package/build-module/components/post-taxonomies/index.js.map +1 -1
  145. package/build-module/components/post-template/block-theme.js +4 -4
  146. package/build-module/components/post-template/block-theme.js.map +1 -1
  147. package/build-module/components/post-template/classic-theme.js +8 -2
  148. package/build-module/components/post-template/classic-theme.js.map +1 -1
  149. package/build-module/components/post-template/create-new-template.js +4 -1
  150. package/build-module/components/post-template/create-new-template.js.map +1 -1
  151. package/build-module/components/post-template/hooks.js +5 -1
  152. package/build-module/components/post-template/hooks.js.map +1 -1
  153. package/build-module/components/post-template/panel.js +8 -2
  154. package/build-module/components/post-template/panel.js.map +1 -1
  155. package/build-module/components/post-trash/check.js +6 -4
  156. package/build-module/components/post-trash/check.js.map +1 -1
  157. package/build-module/components/post-url/panel.js +6 -2
  158. package/build-module/components/post-url/panel.js.map +1 -1
  159. package/build-module/components/posts-per-page/index.js +6 -2
  160. package/build-module/components/posts-per-page/index.js.map +1 -1
  161. package/build-module/components/provider/use-block-editor-settings.js +15 -6
  162. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  163. package/build-module/components/save-publish-panels/index.js +1 -2
  164. package/build-module/components/save-publish-panels/index.js.map +1 -1
  165. package/build-module/components/sidebar/index.js +3 -9
  166. package/build-module/components/sidebar/index.js.map +1 -1
  167. package/build-module/components/site-discussion/index.js +8 -4
  168. package/build-module/components/site-discussion/index.js.map +1 -1
  169. package/build-module/components/template-content-panel/index.js +5 -5
  170. package/build-module/components/template-content-panel/index.js.map +1 -1
  171. package/build-module/components/visual-editor/edit-template-blocks-notification.js +4 -4
  172. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  173. package/build-module/components/visual-editor/index.js +5 -2
  174. package/build-module/components/visual-editor/index.js.map +1 -1
  175. package/build-module/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  176. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -0
  177. package/build-module/dataviews/actions/delete-post.js +2 -0
  178. package/build-module/dataviews/actions/delete-post.js.map +1 -1
  179. package/build-module/hooks/pattern-overrides.js +1 -1
  180. package/build-module/hooks/pattern-overrides.js.map +1 -1
  181. package/build-module/index.js +0 -1
  182. package/build-module/index.js.map +1 -1
  183. package/build-module/private-apis.js +3 -0
  184. package/build-module/private-apis.js.map +1 -1
  185. package/build-module/utils/media-upload/index.js +36 -3
  186. package/build-module/utils/media-upload/index.js.map +1 -1
  187. package/build-style/style-rtl.css +78 -42
  188. package/build-style/style.css +78 -42
  189. package/build-types/bindings/api.d.ts +25 -0
  190. package/build-types/bindings/api.d.ts.map +1 -0
  191. package/build-types/bindings/pattern-overrides.d.ts +5 -6
  192. package/build-types/bindings/pattern-overrides.d.ts.map +1 -1
  193. package/build-types/bindings/post-meta.d.ts +5 -7
  194. package/build-types/bindings/post-meta.d.ts.map +1 -1
  195. package/build-types/components/autocompleters/user.d.ts +2 -2
  196. package/build-types/components/autocompleters/user.d.ts.map +1 -1
  197. package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts.map +1 -1
  198. package/build-types/components/blog-title/index.d.ts.map +1 -1
  199. package/build-types/components/collapsible-block-toolbar/index.d.ts +1 -2
  200. package/build-types/components/collapsible-block-toolbar/index.d.ts.map +1 -1
  201. package/build-types/components/document-bar/index.d.ts.map +1 -1
  202. package/build-types/components/document-outline/check.d.ts.map +1 -1
  203. package/build-types/components/document-outline/index.d.ts.map +1 -1
  204. package/build-types/components/editor-history/redo.d.ts +1 -1
  205. package/build-types/components/editor-history/undo.d.ts +1 -1
  206. package/build-types/components/editor-notices/index.d.ts.map +1 -1
  207. package/build-types/components/editor-snackbars/index.d.ts.map +1 -1
  208. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  209. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  210. package/build-types/components/header/back-button.d.ts +1 -0
  211. package/build-types/components/header/back-button.d.ts.map +1 -1
  212. package/build-types/components/header/index.d.ts.map +1 -1
  213. package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
  214. package/build-types/components/media-categories/index.d.ts.map +1 -1
  215. package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
  216. package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
  217. package/build-types/components/page-attributes/check.d.ts.map +1 -1
  218. package/build-types/components/page-attributes/order.d.ts +1 -1
  219. package/build-types/components/page-attributes/order.d.ts.map +1 -1
  220. package/build-types/components/page-attributes/panel.d.ts.map +1 -1
  221. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  222. package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
  223. package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
  224. package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
  225. package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
  226. package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
  227. package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts.map +1 -1
  228. package/build-types/components/post-actions/actions.d.ts.map +1 -1
  229. package/build-types/components/post-author/check.d.ts.map +1 -1
  230. package/build-types/components/post-author/index.d.ts.map +1 -1
  231. package/build-types/components/post-author/panel.d.ts.map +1 -1
  232. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  233. package/build-types/components/post-content-information/index.d.ts.map +1 -1
  234. package/build-types/components/post-discussion/panel.d.ts.map +1 -1
  235. package/build-types/components/post-excerpt/check.d.ts.map +1 -1
  236. package/build-types/components/post-excerpt/index.d.ts.map +1 -1
  237. package/build-types/components/post-excerpt/panel.d.ts.map +1 -1
  238. package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
  239. package/build-types/components/post-featured-image/check.d.ts.map +1 -1
  240. package/build-types/components/post-featured-image/panel.d.ts.map +1 -1
  241. package/build-types/components/post-format/index.d.ts.map +1 -1
  242. package/build-types/components/post-format/panel.d.ts.map +1 -1
  243. package/build-types/components/post-last-revision/check.d.ts.map +1 -1
  244. package/build-types/components/post-last-revision/index.d.ts.map +1 -1
  245. package/build-types/components/post-last-revision/panel.d.ts.map +1 -1
  246. package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
  247. package/build-types/components/post-pending-status/check.d.ts.map +1 -1
  248. package/build-types/components/post-pending-status/index.d.ts.map +1 -1
  249. package/build-types/components/post-preview-button/index.d.ts.map +1 -1
  250. package/build-types/components/post-publish-button/index.d.ts.map +1 -1
  251. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
  252. package/build-types/components/post-saved-state/index.d.ts +1 -1
  253. package/build-types/components/post-saved-state/index.d.ts.map +1 -1
  254. package/build-types/components/post-schedule/check.d.ts.map +1 -1
  255. package/build-types/components/post-schedule/index.d.ts.map +1 -1
  256. package/build-types/components/post-schedule/label.d.ts.map +1 -1
  257. package/build-types/components/post-schedule/panel.d.ts.map +1 -1
  258. package/build-types/components/post-slug/check.d.ts.map +1 -1
  259. package/build-types/components/post-slug/index.d.ts.map +1 -1
  260. package/build-types/components/post-status/index.d.ts.map +1 -1
  261. package/build-types/components/post-sticky/check.d.ts.map +1 -1
  262. package/build-types/components/post-sticky/index.d.ts.map +1 -1
  263. package/build-types/components/post-switch-to-draft-button/index.d.ts.map +1 -1
  264. package/build-types/components/post-sync-status/index.d.ts.map +1 -1
  265. package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
  266. package/build-types/components/post-taxonomies/flat-term-selector.d.ts +9 -7
  267. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  268. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +13 -11
  269. package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
  270. package/build-types/components/post-taxonomies/index.d.ts.map +1 -1
  271. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  272. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  273. package/build-types/components/post-template/create-new-template.d.ts.map +1 -1
  274. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  275. package/build-types/components/post-template/panel.d.ts.map +1 -1
  276. package/build-types/components/post-text-editor/index.d.ts.map +1 -1
  277. package/build-types/components/post-trash/check.d.ts.map +1 -1
  278. package/build-types/components/post-trash/index.d.ts.map +1 -1
  279. package/build-types/components/post-type-support-check/index.d.ts.map +1 -1
  280. package/build-types/components/post-url/check.d.ts.map +1 -1
  281. package/build-types/components/post-url/index.d.ts.map +1 -1
  282. package/build-types/components/post-url/label.d.ts.map +1 -1
  283. package/build-types/components/post-url/panel.d.ts.map +1 -1
  284. package/build-types/components/post-visibility/check.d.ts.map +1 -1
  285. package/build-types/components/post-visibility/index.d.ts.map +1 -1
  286. package/build-types/components/posts-per-page/index.d.ts.map +1 -1
  287. package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
  288. package/build-types/components/provider/index.d.ts.map +1 -1
  289. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  290. package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
  291. package/build-types/components/sidebar/index.d.ts.map +1 -1
  292. package/build-types/components/site-discussion/index.d.ts.map +1 -1
  293. package/build-types/components/template-content-panel/index.d.ts +1 -3
  294. package/build-types/components/template-content-panel/index.d.ts.map +1 -1
  295. package/build-types/components/theme-support-check/index.d.ts.map +1 -1
  296. package/build-types/components/time-to-read/index.d.ts.map +1 -1
  297. package/build-types/components/unsaved-changes-warning/index.d.ts.map +1 -1
  298. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts +1 -1
  299. package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
  300. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  301. package/build-types/components/visual-editor/use-select-nearest-editable-block.d.ts.map +1 -0
  302. package/build-types/components/word-count/index.d.ts.map +1 -1
  303. package/build-types/dataviews/actions/delete-post.d.ts.map +1 -1
  304. package/build-types/dataviews/api.d.ts +1 -1
  305. package/build-types/dataviews/api.d.ts.map +1 -1
  306. package/build-types/dataviews/store/private-selectors.d.ts +0 -1
  307. package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
  308. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts +1 -1
  309. package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -1
  310. package/build-types/hooks/pattern-overrides.d.ts.map +1 -1
  311. package/build-types/private-apis.d.ts.map +1 -1
  312. package/build-types/store/actions.d.ts.map +1 -1
  313. package/build-types/store/private-actions.d.ts.map +1 -1
  314. package/build-types/store/reducer.d.ts.map +1 -1
  315. package/build-types/store/selectors.d.ts +0 -1
  316. package/build-types/store/selectors.d.ts.map +1 -1
  317. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  318. package/package.json +38 -37
  319. package/src/bindings/api.js +57 -0
  320. package/src/bindings/pattern-overrides.js +28 -17
  321. package/src/bindings/post-meta.js +19 -14
  322. package/src/components/block-settings-menu/content-only-settings-menu.js +4 -4
  323. package/src/components/blog-title/index.js +7 -2
  324. package/src/components/collapsible-block-toolbar/index.js +1 -3
  325. package/src/components/collapsible-block-toolbar/style.scss +0 -3
  326. package/src/components/document-bar/style.scss +1 -5
  327. package/src/components/document-tools/style.scss +4 -4
  328. package/src/components/editor-interface/style.scss +4 -0
  329. package/src/components/global-styles-provider/index.js +22 -11
  330. package/src/components/header/back-button.js +6 -6
  331. package/src/components/header/index.js +26 -25
  332. package/src/components/header/style.scss +64 -21
  333. package/src/components/inserter-sidebar/style.scss +1 -6
  334. package/src/components/page-attributes/order.js +3 -77
  335. package/src/components/page-attributes/panel.js +1 -7
  336. package/src/components/post-actions/actions.js +150 -32
  337. package/src/components/post-card-panel/index.js +8 -2
  338. package/src/components/post-comments/index.js +2 -2
  339. package/src/components/post-content-information/index.js +7 -1
  340. package/src/components/post-discussion/panel.js +5 -3
  341. package/src/components/post-excerpt/panel.js +2 -1
  342. package/src/components/post-featured-image/index.js +5 -1
  343. package/src/components/post-last-revision/index.js +1 -0
  344. package/src/components/post-panel-row/style.scss +0 -1
  345. package/src/components/post-publish-button/index.js +4 -17
  346. package/src/components/post-publish-panel/maybe-category-panel.js +4 -1
  347. package/src/components/post-publish-panel/maybe-tags-panel.js +1 -1
  348. package/src/components/post-status/index.js +18 -10
  349. package/src/components/post-taxonomies/flat-term-selector.js +19 -5
  350. package/src/components/post-taxonomies/index.js +8 -1
  351. package/src/components/post-template/block-theme.js +5 -1
  352. package/src/components/post-template/classic-theme.js +8 -3
  353. package/src/components/post-template/create-new-template.js +4 -1
  354. package/src/components/post-template/hooks.js +8 -2
  355. package/src/components/post-template/panel.js +10 -2
  356. package/src/components/post-trash/check.js +9 -5
  357. package/src/components/post-url/panel.js +7 -2
  358. package/src/components/posts-per-page/index.js +7 -2
  359. package/src/components/provider/use-block-editor-settings.js +15 -6
  360. package/src/components/save-publish-panels/index.js +1 -4
  361. package/src/components/sidebar/index.js +2 -5
  362. package/src/components/site-discussion/index.js +9 -4
  363. package/src/components/template-content-panel/index.js +3 -2
  364. package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
  365. package/src/components/visual-editor/index.js +5 -2
  366. package/src/components/visual-editor/style.scss +0 -1
  367. package/src/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
  368. package/src/dataviews/actions/delete-post.tsx +2 -0
  369. package/src/hooks/pattern-overrides.js +1 -1
  370. package/src/index.js +0 -1
  371. package/src/private-apis.js +6 -0
  372. package/src/store/test/actions.js +9 -3
  373. package/src/utils/media-upload/index.js +38 -3
  374. package/tsconfig.tsbuildinfo +1 -1
  375. package/build/bindings/index.js +0 -22
  376. package/build/bindings/index.js.map +0 -1
  377. package/build/hooks/use-select-nearest-editable-block.js.map +0 -1
  378. package/build/store/utils/get-filtered-template-parts.js +0 -71
  379. package/build/store/utils/get-filtered-template-parts.js.map +0 -1
  380. package/build/utils/set-nested-value.js +0 -44
  381. package/build/utils/set-nested-value.js.map +0 -1
  382. package/build-module/bindings/index.js +0 -17
  383. package/build-module/bindings/index.js.map +0 -1
  384. package/build-module/hooks/use-select-nearest-editable-block.js.map +0 -1
  385. package/build-module/store/utils/get-filtered-template-parts.js +0 -64
  386. package/build-module/store/utils/get-filtered-template-parts.js.map +0 -1
  387. package/build-module/utils/set-nested-value.js +0 -38
  388. package/build-module/utils/set-nested-value.js.map +0 -1
  389. package/build-types/bindings/index.d.ts +0 -2
  390. package/build-types/bindings/index.d.ts.map +0 -1
  391. package/build-types/hooks/use-select-nearest-editable-block.d.ts.map +0 -1
  392. package/build-types/store/utils/get-filtered-template-parts.d.ts +0 -3
  393. package/build-types/store/utils/get-filtered-template-parts.d.ts.map +0 -1
  394. package/build-types/utils/set-nested-value.d.ts +0 -20
  395. package/build-types/utils/set-nested-value.d.ts.map +0 -1
  396. package/src/bindings/index.js +0 -15
  397. package/src/store/utils/get-filtered-template-parts.js +0 -69
  398. package/src/store/utils/test/get-filtered-template-parts.js +0 -189
  399. package/src/utils/set-nested-value.js +0 -39
  400. /package/build-types/{hooks → components/visual-editor}/use-select-nearest-editable-block.d.ts +0 -0
@@ -12,7 +12,7 @@ import { useMemo, useState } from '@wordpress/element';
12
12
  import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
13
13
  import { parse } from '@wordpress/blocks';
14
14
  import { DataForm } from '@wordpress/dataviews';
15
- import { Button, TextControl, __experimentalText as Text, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
15
+ import { Button, TextControl, __experimentalText as Text, __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalNumberControl as NumberControl } from '@wordpress/components';
16
16
 
17
17
  /**
18
18
  * Internal dependencies
@@ -173,17 +173,21 @@ const trashPostAction = {
173
173
  });
174
174
  }
175
175
  };
176
- function useCanUserEligibilityCheckPostType(capability, resource, action) {
176
+ function useCanUserEligibilityCheckPostType(capability, postType, action) {
177
177
  const registry = useRegistry();
178
178
  return useMemo(() => ({
179
179
  ...action,
180
180
  isEligible(item) {
181
- return action.isEligible(item) && registry.select(coreStore).canUser(capability, resource, item.id);
181
+ return action.isEligible(item) && registry.select(coreStore).canUser(capability, {
182
+ kind: 'postType',
183
+ name: postType,
184
+ id: item.id
185
+ });
182
186
  }
183
- }), [action, registry, capability, resource]);
187
+ }), [action, registry, capability, postType]);
184
188
  }
185
- function useTrashPostAction(resource) {
186
- return useCanUserEligibilityCheckPostType('delete', resource, trashPostAction);
189
+ function useTrashPostAction(postType) {
190
+ return useCanUserEligibilityCheckPostType('delete', postType, trashPostAction);
187
191
  }
188
192
  const permanentlyDeletePostAction = {
189
193
  id: 'permanently-delete',
@@ -265,8 +269,8 @@ const permanentlyDeletePostAction = {
265
269
  }
266
270
  }
267
271
  };
268
- function usePermanentlyDeletePostAction(resource) {
269
- return useCanUserEligibilityCheckPostType('delete', resource, permanentlyDeletePostAction);
272
+ function usePermanentlyDeletePostAction(postType) {
273
+ return useCanUserEligibilityCheckPostType('delete', postType, permanentlyDeletePostAction);
270
274
  }
271
275
  const restorePostAction = {
272
276
  id: 'restore',
@@ -359,8 +363,8 @@ const restorePostAction = {
359
363
  }
360
364
  }
361
365
  };
362
- function useRestorePostAction(resource) {
363
- return useCanUserEligibilityCheckPostType('update', resource, restorePostAction);
366
+ function useRestorePostAction(postType) {
367
+ return useCanUserEligibilityCheckPostType('update', postType, restorePostAction);
364
368
  }
365
369
  const viewPostAction = {
366
370
  id: 'view-post',
@@ -506,21 +510,109 @@ const renamePostAction = {
506
510
  });
507
511
  }
508
512
  };
509
- function useRenamePostAction(resource) {
510
- return useCanUserEligibilityCheckPostType('update', resource, renamePostAction);
513
+ function useRenamePostAction(postType) {
514
+ return useCanUserEligibilityCheckPostType('update', postType, renamePostAction);
511
515
  }
512
- const useDuplicatePostAction = postType => {
516
+ function ReorderModal({
517
+ items,
518
+ closeModal,
519
+ onActionPerformed
520
+ }) {
521
+ const [item] = items;
513
522
  const {
514
- userCanCreatePost
515
- } = useSelect(select => {
523
+ editEntityRecord,
524
+ saveEditedEntityRecord
525
+ } = useDispatch(coreStore);
526
+ const {
527
+ createSuccessNotice,
528
+ createErrorNotice
529
+ } = useDispatch(noticesStore);
530
+ const [orderInput, setOrderInput] = useState(item.menu_order);
531
+ async function onOrder(event) {
532
+ event.preventDefault();
533
+ if (!Number.isInteger(Number(orderInput)) || orderInput?.trim?.() === '') {
534
+ return;
535
+ }
536
+ try {
537
+ await editEntityRecord('postType', item.type, item.id, {
538
+ menu_order: orderInput
539
+ });
540
+ closeModal();
541
+ // Persist edited entity.
542
+ await saveEditedEntityRecord('postType', item.type, item.id, {
543
+ throwOnError: true
544
+ });
545
+ createSuccessNotice(__('Order updated'), {
546
+ type: 'snackbar'
547
+ });
548
+ onActionPerformed?.(items);
549
+ } catch (error) {
550
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while updating the order');
551
+ createErrorNotice(errorMessage, {
552
+ type: 'snackbar'
553
+ });
554
+ }
555
+ }
556
+ const saveIsDisabled = !Number.isInteger(Number(orderInput)) || orderInput?.trim?.() === '';
557
+ return /*#__PURE__*/_jsx("form", {
558
+ onSubmit: onOrder,
559
+ children: /*#__PURE__*/_jsxs(VStack, {
560
+ spacing: "5",
561
+ children: [/*#__PURE__*/_jsx("div", {
562
+ children: __('Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.')
563
+ }), /*#__PURE__*/_jsx(NumberControl, {
564
+ __next40pxDefaultSize: true,
565
+ label: __('Order'),
566
+ help: __('Set the page order.'),
567
+ value: orderInput,
568
+ onChange: setOrderInput
569
+ }), /*#__PURE__*/_jsxs(HStack, {
570
+ justify: "right",
571
+ children: [/*#__PURE__*/_jsx(Button, {
572
+ __next40pxDefaultSize: true,
573
+ variant: "tertiary",
574
+ onClick: () => {
575
+ closeModal();
576
+ },
577
+ children: __('Cancel')
578
+ }), /*#__PURE__*/_jsx(Button, {
579
+ __next40pxDefaultSize: true,
580
+ variant: "primary",
581
+ type: "submit",
582
+ accessibleWhenDisabled: true,
583
+ disabled: saveIsDisabled,
584
+ __experimentalIsFocusable: true,
585
+ children: __('Save')
586
+ })]
587
+ })]
588
+ })
589
+ });
590
+ }
591
+ function useReorderPagesAction(postType) {
592
+ const supportsPageAttributes = useSelect(select => {
516
593
  const {
517
- getPostType,
518
- canUser
594
+ getPostType
519
595
  } = select(coreStore);
520
- const resource = getPostType(postType)?.rest_base || '';
521
- return {
522
- userCanCreatePost: canUser('create', resource)
523
- };
596
+ const postTypeObject = getPostType(postType);
597
+ return !!postTypeObject?.supports?.['page-attributes'];
598
+ }, [postType]);
599
+ return useMemo(() => supportsPageAttributes && {
600
+ id: 'order-pages',
601
+ label: __('Order'),
602
+ isEligible({
603
+ status
604
+ }) {
605
+ return status !== 'trash';
606
+ },
607
+ RenderModal: ReorderModal
608
+ }, [supportsPageAttributes]);
609
+ }
610
+ const useDuplicatePostAction = postType => {
611
+ const userCanCreatePost = useSelect(select => {
612
+ return select(coreStore).canUser('create', {
613
+ kind: 'postType',
614
+ name: postType
615
+ });
524
616
  }, [postType]);
525
617
  return useMemo(() => userCanCreatePost && {
526
618
  id: 'duplicate-post',
@@ -666,10 +758,10 @@ export const duplicateTemplatePartAction = {
666
758
  const [item] = items;
667
759
  const blocks = useMemo(() => {
668
760
  var _item$blocks;
669
- return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : parse(item.content.raw, {
761
+ return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : parse(typeof item.content === 'string' ? item.content : item.content.raw, {
670
762
  __unstableSkipMigrationLogs: true
671
763
  });
672
- }, [item?.content?.raw, item.blocks]);
764
+ }, [item.content, item.blocks]);
673
765
  const {
674
766
  createSuccessNotice
675
767
  } = useDispatch(noticesStore);
@@ -702,7 +794,6 @@ export function usePostActions({
702
794
  defaultActions,
703
795
  postTypeObject,
704
796
  userCanCreatePostType,
705
- resource,
706
797
  cachedCanUserResolvers
707
798
  } = useSelect(select => {
708
799
  const {
@@ -714,20 +805,22 @@ export function usePostActions({
714
805
  getEntityActions
715
806
  } = unlock(select(editorStore));
716
807
  const _postTypeObject = getPostType(postType);
717
- const _resource = _postTypeObject?.rest_base || '';
718
808
  return {
719
809
  postTypeObject: _postTypeObject,
720
810
  defaultActions: getEntityActions('postType', postType),
721
- userCanCreatePostType: canUser('create', _resource),
722
- resource: _resource,
811
+ userCanCreatePostType: canUser('create', {
812
+ kind: 'postType',
813
+ name: postType
814
+ }),
723
815
  cachedCanUserResolvers: getCachedResolvers()?.canUser
724
816
  };
725
817
  }, [postType]);
726
818
  const duplicatePostAction = useDuplicatePostAction(postType);
727
- const trashPostActionForPostType = useTrashPostAction(resource);
728
- const permanentlyDeletePostActionForPostType = usePermanentlyDeletePostAction(resource);
729
- const renamePostActionForPostType = useRenamePostAction(resource);
730
- const restorePostActionForPostType = useRestorePostAction(resource);
819
+ const trashPostActionForPostType = useTrashPostAction(postType);
820
+ const permanentlyDeletePostActionForPostType = usePermanentlyDeletePostAction(postType);
821
+ const renamePostActionForPostType = useRenamePostAction(postType);
822
+ const restorePostActionForPostType = useRestorePostAction(postType);
823
+ const reorderPagesAction = useReorderPagesAction(postType);
731
824
  const isTemplateOrTemplatePart = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType);
732
825
  const isPattern = postType === PATTERN_POST_TYPE;
733
826
  const isLoaded = !!postTypeObject;
@@ -737,7 +830,7 @@ export function usePostActions({
737
830
  if (!isLoaded) {
738
831
  return [];
739
832
  }
740
- let actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, globalThis.IS_GUTENBERG_PLUGIN ? !isTemplateOrTemplatePart && !isPattern && duplicatePostAction : false, isTemplateOrTemplatePart && userCanCreatePostType && duplicateTemplatePartAction, isPattern && userCanCreatePostType && duplicatePatternAction, supportsTitle && renamePostActionForPostType, !isTemplateOrTemplatePart && restorePostActionForPostType, !isTemplateOrTemplatePart && !isPattern && trashPostActionForPostType, !isTemplateOrTemplatePart && permanentlyDeletePostActionForPostType, ...defaultActions].filter(Boolean);
833
+ let actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, globalThis.IS_GUTENBERG_PLUGIN ? !isTemplateOrTemplatePart && !isPattern && duplicatePostAction : false, isTemplateOrTemplatePart && userCanCreatePostType && duplicateTemplatePartAction, isPattern && userCanCreatePostType && duplicatePatternAction, supportsTitle && renamePostActionForPostType, reorderPagesAction, !isTemplateOrTemplatePart && restorePostActionForPostType, !isTemplateOrTemplatePart && !isPattern && trashPostActionForPostType, !isTemplateOrTemplatePart && permanentlyDeletePostActionForPostType, ...defaultActions].filter(Boolean);
741
834
  // Filter actions based on provided context. If not provided
742
835
  // all actions are returned. We'll have a single entry for getting the actions
743
836
  // and the consumer should provide the context to filter the actions, if needed.
@@ -760,7 +853,7 @@ export function usePostActions({
760
853
  existingCallback(items, {
761
854
  ...argsObject,
762
855
  onActionPerformed: _items => {
763
- if (argsObject.onActionPerformed) {
856
+ if (argsObject?.onActionPerformed) {
764
857
  argsObject.onActionPerformed(_items);
765
858
  }
766
859
  onActionPerformed(actions[i].id, _items);
@@ -792,6 +885,6 @@ export function usePostActions({
792
885
  // We are making this use memo depend on cachedCanUserResolvers as a way to make the component using this hook re-render
793
886
  // when user capabilities are resolved. This makes sure the isEligible functions of actions dependent on capabilities are re-evaluated.
794
887
  // eslint-disable-next-line react-hooks/exhaustive-deps
795
- }, [defaultActions, userCanCreatePostType, isTemplateOrTemplatePart, isPattern, postTypeObject?.viewable, duplicatePostAction, trashPostActionForPostType, restorePostActionForPostType, renamePostActionForPostType, permanentlyDeletePostActionForPostType, onActionPerformed, isLoaded, supportsRevisions, supportsTitle, context, cachedCanUserResolvers]);
888
+ }, [defaultActions, userCanCreatePostType, isTemplateOrTemplatePart, isPattern, postTypeObject?.viewable, duplicatePostAction, reorderPagesAction, trashPostActionForPostType, restorePostActionForPostType, renamePostActionForPostType, permanentlyDeletePostActionForPostType, onActionPerformed, isLoaded, supportsRevisions, supportsTitle, context, cachedCanUserResolvers]);
796
889
  }
797
890
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["external","trash","backup","addQueryArgs","useDispatch","useSelect","useRegistry","decodeEntities","store","coreStore","__","_n","sprintf","_x","noticesStore","useMemo","useState","privateApis","patternsPrivateApis","parse","DataForm","Button","TextControl","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","TEMPLATE_ORIGINS","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","PATTERN_POST_TYPE","editorStore","unlock","CreateTemplatePartModalContents","getItemTitle","jsx","_jsx","jsxs","_jsxs","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","fields","type","header","id","placeholder","getValue","item","title","form","visibleFields","isTemplateRemovable","template","source","custom","has_theme_file","trashPostAction","label","isPrimary","icon","isEligible","includes","status","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionPerformed","isBusy","setIsBusy","createSuccessNotice","createErrorNotice","deleteEntityRecord","spacing","children","length","justify","variant","onClick","disabled","accessibleWhenDisabled","promiseResult","Promise","allSettled","map","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","useCanUserEligibilityCheckPostType","capability","resource","action","registry","select","canUser","useTrashPostAction","permanentlyDeletePostAction","callback","posts","dispatch","post","force","usePermanentlyDeletePostAction","restorePostAction","editEntityRecord","saveEditedEntityRecord","useRestorePostAction","viewPostAction","window","open","link","postRevisionsAction","context","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","revision","document","location","renamePostAction","Object","values","is_custom","isTemplatePart","isUserPattern","user","isCustomPattern","hasThemeFile","setTitle","onRename","event","preventDefault","error","code","onSubmit","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","useRenamePostAction","useDuplicatePostAction","postType","userCanCreatePost","getPostType","rest_base","setItem","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItemOject","slug","comment_status","content","raw","excerpt","meta","parent","password","format","featured_media","menu_order","ping_status","assignablePropertiesPrefix","assignableProperties","keys","property","startsWith","slice","forEach","newItem","rendered","data","duplicatePatternAction","modalHeader","duplicatedProps","pattern","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","blocks","_item$blocks","__unstableSkipMigrationLogs","onTemplatePartSuccess","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","defaultActions","postTypeObject","userCanCreatePostType","cachedCanUserResolvers","getCachedResolvers","getEntityActions","_postTypeObject","_resource","duplicatePostAction","trashPostActionForPostType","permanentlyDeletePostActionForPostType","renamePostActionForPostType","restorePostActionForPostType","isTemplateOrTemplatePart","isPattern","isLoaded","supportsRevisions","supports","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","Boolean","i","existingCallback","argsObject","_items","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _n, sprintf, _x } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo, useState } from '@wordpress/element';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { parse } from '@wordpress/blocks';\nimport { DataForm } from '@wordpress/dataviews';\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_ORIGINS,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tPATTERN_POST_TYPE,\n} from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { CreateTemplatePartModalContents } from '../create-template-part-modal';\nimport { getItemTitle } from '../../dataviews/actions/utils';\n\n// Patterns.\nconst { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\n\n// TODO: this should be shared with other components (page-pages).\nconst fields = [\n\t{\n\t\ttype: 'text',\n\t\theader: __( 'Title' ),\n\t\tid: 'title',\n\t\tplaceholder: __( 'No title' ),\n\t\tgetValue: ( { item } ) => item.title,\n\t},\n];\n\nconst form = {\n\tvisibleFields: [ 'title' ],\n};\n\n/**\n * Check if a template is removable.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is removable.\n */\nfunction isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t// In patterns list page we map the templates parts to a different object\n\t// than the one returned from the endpoint. This is why we need to check for\n\t// two props whether is custom or has a theme file.\n\treturn (\n\t\ttemplate?.source === TEMPLATE_ORIGINS.custom &&\n\t\t! template?.has_theme_file\n\t);\n}\n\nconst trashPostAction = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to Trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( item ) {\n\t\treturn ! [ 'auto-draft', 'trash' ].includes( item.status );\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ items.length === 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The item's title.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash \"%s\"?'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %d: The number of items (2 or more).\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash %d item?',\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash %d items?',\n\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tsetIsBusy( true );\n\t\t\t\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\t\t\t\titems.map( ( item ) =>\n\t\t\t\t\t\t\t\t\tdeleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\t\t\titem.id,\n\t\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tlet successMessage;\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The item's title. */\n\t\t\t\t\t\t\t\t\t\t__( '\"%s\" moved to trash.' ),\n\t\t\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The number of items. */\n\t\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t\t'%s item moved to trash.',\n\t\t\t\t\t\t\t\t\t\t\t'%s items moved to trash.',\n\t\t\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tid: 'move-to-trash-action',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If there was at least one failure.\n\t\t\t\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t\t\t\t// If we were trying to delete a single item.\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\t\t\tpromiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the item.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// If we were trying to delete multiple items.\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the items.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the item: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'Some errors occurred while moving to trash the items: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetIsBusy( false );\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Trash' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nfunction useCanUserEligibilityCheckPostType( capability, resource, action ) {\n\tconst registry = useRegistry();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...action,\n\t\t\tisEligible( item ) {\n\t\t\t\treturn (\n\t\t\t\t\taction.isEligible( item ) &&\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.select( coreStore )\n\t\t\t\t\t\t.canUser( capability, resource, item.id )\n\t\t\t\t);\n\t\t\t},\n\t\t} ),\n\t\t[ action, registry, capability, resource ]\n\t);\n}\n\nfunction useTrashPostAction( resource ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tresource,\n\t\ttrashPostAction\n\t);\n}\n\nconst permanentlyDeletePostAction = {\n\tid: 'permanently-delete',\n\tlabel: __( 'Permanently delete' ),\n\tsupportsBulk: true,\n\tisEligible( { status } ) {\n\t\treturn status === 'trash';\n\t},\n\tasync callback( posts, { registry, onActionPerformed } ) {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tregistry.dispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = registry.dispatch( coreStore );\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpost.type,\n\t\t\t\t\tpost.id,\n\t\t\t\t\t{ force: true },\n\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t);\n\t\t\t} )\n\t\t);\n\t\t// If all the promises were fulfilled with success.\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = __( 'The posts were permanently deleted.' );\n\t\t\t}\n\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'permanently-delete-post-action',\n\t\t\t} );\n\t\t\tonActionPerformed?.( posts );\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to permanently delete a single post.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t},\n};\n\nfunction usePermanentlyDeletePostAction( resource ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tresource,\n\t\tpermanentlyDeletePostAction\n\t);\n}\n\nconst restorePostAction = {\n\tid: 'restore',\n\tlabel: __( 'Restore' ),\n\tisPrimary: true,\n\ticon: backup,\n\tsupportsBulk: true,\n\tisEligible( { status } ) {\n\t\treturn status === 'trash';\n\t},\n\tasync callback( posts, { registry, onActionPerformed } ) {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tregistry.dispatch( noticesStore );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tregistry.dispatch( coreStore );\n\t\tawait Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t} );\n\t\t\t} )\n\t\t);\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn saveEditedEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t} )\n\t\t);\n\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\t\t\tif ( posts.length === 1 ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t);\n\t\t\t} else if ( posts[ 0 ].type === 'page' ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '%d pages have been restored.' ),\n\t\t\t\t\tposts.length\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\tposts.length\n\t\t\t\t);\n\t\t\t}\n\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'restore-post-action',\n\t\t\t} );\n\t\t\tif ( onActionPerformed ) {\n\t\t\t\tonActionPerformed( posts );\n\t\t\t}\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to move a single post to the trash.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t__( 'An error occurred while restoring the posts: %s' ),\n\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Some errors occurred while restoring the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t},\n};\n\nfunction useRestorePostAction( resource ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'update',\n\t\tresource,\n\t\trestorePostAction\n\t);\n}\n\nconst viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\twindow.open( post.link, '_blank' );\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tcontext: 'list',\n\tlabel( items ) {\n\t\tconst revisionsCount =\n\t\t\titems[ 0 ]._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn sprintf(\n\t\t\t/* translators: %s: number of revisions */\n\t\t\t__( 'View revisions (%s)' ),\n\t\t\trevisionsCount\n\t\t);\n\t},\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst renamePostAction = {\n\tid: 'rename-post',\n\tlabel: __( 'Rename' ),\n\tisEligible( post ) {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Templates, template parts and patterns have special checks for renaming.\n\t\tif (\n\t\t\t! [\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t...Object.values( PATTERN_TYPES ),\n\t\t\t].includes( post.type )\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t\t// In the case of templates, we can only rename custom templates.\n\t\tif ( post.type === TEMPLATE_POST_TYPE ) {\n\t\t\treturn isTemplateRemovable( post ) && post.is_custom;\n\t\t}\n\t\t// Make necessary checks for template parts and patterns.\n\t\tconst isTemplatePart = post.type === TEMPLATE_PART_POST_TYPE;\n\t\tconst isUserPattern = post.type === PATTERN_TYPES.user;\n\t\t// In patterns list page we map the templates parts to a different object\n\t\t// than the one returned from the endpoint. This is why we need to check for\n\t\t// two props whether is custom or has a theme file.\n\t\tconst isCustomPattern =\n\t\t\tisUserPattern ||\n\t\t\t( isTemplatePart && post.source === TEMPLATE_ORIGINS.custom );\n\t\tconst hasThemeFile = post?.has_theme_file;\n\t\treturn isCustomPattern && ! hasThemeFile;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ title, setTitle ] = useState( () => getItemTitle( item ) );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tuseDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function onRename( event ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\ttitle,\n\t\t\t\t} );\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetTitle( '' );\n\t\t\t\tcloseModal();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t\tcreateSuccessNotice( __( 'Name updated' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tonActionPerformed?.( items );\n\t\t\t} catch ( error ) {\n\t\t\t\tconst errorMessage =\n\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: __( 'An error occurred while updating the name' );\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<form onSubmit={ onRename }>\n\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t);\n\t},\n};\n\nfunction useRenamePostAction( resource ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'update',\n\t\tresource,\n\t\trenamePostAction\n\t);\n}\n\nconst useDuplicatePostAction = ( postType ) => {\n\tconst { userCanCreatePost } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser } = select( coreStore );\n\t\t\tconst resource = getPostType( postType )?.rest_base || '';\n\t\t\treturn {\n\t\t\t\tuserCanCreatePost: canUser( 'create', resource ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tuserCanCreatePost && {\n\t\t\t\tid: 'duplicate-post',\n\t\t\t\tlabel: _x( 'Duplicate', 'action label' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\t\t\t\tconst [ item, setItem ] = useState( {\n\t\t\t\t\t\t...items[ 0 ],\n\t\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Existing template title */\n\t\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t),\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst [ isCreatingPage, setIsCreatingPage ] =\n\t\t\t\t\t\tuseState( false );\n\n\t\t\t\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\t\t\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\t\t\t\tuseDispatch( noticesStore );\n\n\t\t\t\t\tasync function createPage( event ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\tif ( isCreatingPage ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst newItemOject = {\n\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t\ttitle: item.title,\n\t\t\t\t\t\t\tslug: item.title || __( 'No title' ),\n\t\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst assignablePropertiesPrefix = 'wp:action-assign-';\n\t\t\t\t\t\t// Get all the properties that the current user is able to assign normally author, categories, tags,\n\t\t\t\t\t\t// and custom taxonomies.\n\t\t\t\t\t\tconst assignableProperties = Object.keys(\n\t\t\t\t\t\t\titem?._links || {}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.filter( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.startsWith(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.slice(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tassignableProperties.forEach( ( property ) => {\n\t\t\t\t\t\t\tif ( item[ property ] ) {\n\t\t\t\t\t\t\t\tnewItemOject[ property ] = item[ property ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetIsCreatingPage( true );\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\tnewItemOject,\n\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\t\tnewItem.title?.rendered || item.title\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch ( error ) {\n\t\t\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while duplicating the page.'\n\t\t\t\t\t\t\t\t\t );\n\n\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t\t\t<DataForm\n\t\t\t\t\t\t\t\t\tdata={ item }\n\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\tform={ form }\n\t\t\t\t\t\t\t\t\tonChange={ setItem }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t[ userCanCreatePost ]\n\t);\n};\n\nexport const duplicatePatternAction = {\n\tid: 'duplicate-pattern',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type !== TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate pattern', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern: item,\n\t\t\tonSuccess: () => closeModal(),\n\t\t} );\n\t\treturn (\n\t\t\t<CreatePatternModalContents\n\t\t\t\tonClose={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t{ ...duplicatedProps }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport const duplicateTemplatePartAction = {\n\tid: 'duplicate-template-part',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type === TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate template part', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst blocks = useMemo( () => {\n\t\t\treturn (\n\t\t\t\titem.blocks ??\n\t\t\t\tparse( item.content.raw, {\n\t\t\t\t\t__unstableSkipMigrationLogs: true,\n\t\t\t\t} )\n\t\t\t);\n\t\t}, [ item?.content?.raw, item.blocks ] );\n\t\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\t\tfunction onTemplatePartSuccess() {\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The new template part's title e.g. 'Call to action (copy)'.\n\t\t\t\t\t__( '\"%s\" duplicated.' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t\tcloseModal();\n\t\t}\n\t\treturn (\n\t\t\t<CreateTemplatePartModalContents\n\t\t\t\tblocks={ blocks }\n\t\t\t\tdefaultArea={ item.area }\n\t\t\t\tdefaultTitle={ sprintf(\n\t\t\t\t\t/* translators: %s: Existing template part title */\n\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t) }\n\t\t\t\tonCreate={ onTemplatePartSuccess }\n\t\t\t\tonError={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst {\n\t\tdefaultActions,\n\t\tpostTypeObject,\n\t\tuserCanCreatePostType,\n\t\tresource,\n\t\tcachedCanUserResolvers,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser, getCachedResolvers } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\tconst _postTypeObject = getPostType( postType );\n\t\t\tconst _resource = _postTypeObject?.rest_base || '';\n\t\t\treturn {\n\t\t\t\tpostTypeObject: _postTypeObject,\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t\tuserCanCreatePostType: canUser( 'create', _resource ),\n\t\t\t\tresource: _resource,\n\t\t\t\tcachedCanUserResolvers: getCachedResolvers()?.canUser,\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst duplicatePostAction = useDuplicatePostAction( postType );\n\tconst trashPostActionForPostType = useTrashPostAction( resource );\n\tconst permanentlyDeletePostActionForPostType =\n\t\tusePermanentlyDeletePostAction( resource );\n\tconst renamePostActionForPostType = useRenamePostAction( resource );\n\tconst restorePostActionForPostType = useRestorePostAction( resource );\n\tconst isTemplateOrTemplatePart = [\n\t\tTEMPLATE_POST_TYPE,\n\t\tTEMPLATE_PART_POST_TYPE,\n\t].includes( postType );\n\tconst isPattern = postType === PATTERN_POST_TYPE;\n\tconst isLoaded = !! postTypeObject;\n\tconst supportsRevisions = !! postTypeObject?.supports?.revisions;\n\tconst supportsTitle = !! postTypeObject?.supports?.title;\n\treturn useMemo( () => {\n\t\tif ( ! isLoaded ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet actions = [\n\t\t\tpostTypeObject?.viewable && viewPostAction,\n\t\t\tsupportsRevisions && postRevisionsAction,\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! isTemplateOrTemplatePart &&\n\t\t\t\t ! isPattern &&\n\t\t\t\t duplicatePostAction\n\t\t\t\t: false,\n\t\t\tisTemplateOrTemplatePart &&\n\t\t\t\tuserCanCreatePostType &&\n\t\t\t\tduplicateTemplatePartAction,\n\t\t\tisPattern && userCanCreatePostType && duplicatePatternAction,\n\t\t\tsupportsTitle && renamePostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart && restorePostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\t! isPattern &&\n\t\t\t\ttrashPostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\tpermanentlyDeletePostActionForPostType,\n\t\t\t...defaultActions,\n\t\t].filter( Boolean );\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tactions = actions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t\t// We are making this use memo depend on cachedCanUserResolvers as a way to make the component using this hook re-render\n\t\t// when user capabilities are resolved. This makes sure the isEligible functions of actions dependent on capabilities are re-evaluated.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tdefaultActions,\n\t\tuserCanCreatePostType,\n\t\tisTemplateOrTemplatePart,\n\t\tisPattern,\n\t\tpostTypeObject?.viewable,\n\t\tduplicatePostAction,\n\t\ttrashPostActionForPostType,\n\t\trestorePostActionForPostType,\n\t\trenamePostActionForPostType,\n\t\tpermanentlyDeletePostActionForPostType,\n\t\tonActionPerformed,\n\t\tisLoaded,\n\t\tsupportsRevisions,\n\t\tsupportsTitle,\n\t\tcontext,\n\t\tcachedCanUserResolvers,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,KAAK,EAAEC,MAAM,QAAQ,kBAAkB;AAC1D,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACrD,SAASL,KAAK,IAAIM,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,WAAW,IAAIC,mBAAmB,QAAQ,qBAAqB;AACxE,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,QAAQ,QAAQ,sBAAsB;AAC/C,SACCC,MAAM,EACNC,WAAW,EACXC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;;AAE9B;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,uBAAuB,EACvBC,kBAAkB,EAClBC,iBAAiB,QACX,uBAAuB;AAC9B,SAASxB,KAAK,IAAIyB,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,+BAA+B,QAAQ,+BAA+B;AAC/E,SAASC,YAAY,QAAQ,+BAA+B;;AA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":3,"names":["external","trash","backup","addQueryArgs","useDispatch","useSelect","useRegistry","decodeEntities","store","coreStore","__","_n","sprintf","_x","noticesStore","useMemo","useState","privateApis","patternsPrivateApis","parse","DataForm","Button","TextControl","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNumberControl","NumberControl","TEMPLATE_ORIGINS","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","PATTERN_POST_TYPE","editorStore","unlock","CreateTemplatePartModalContents","getItemTitle","jsx","_jsx","jsxs","_jsxs","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","fields","type","header","id","placeholder","getValue","item","title","form","visibleFields","isTemplateRemovable","template","source","custom","has_theme_file","trashPostAction","label","isPrimary","icon","isEligible","includes","status","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionPerformed","isBusy","setIsBusy","createSuccessNotice","createErrorNotice","deleteEntityRecord","spacing","children","length","justify","variant","onClick","disabled","accessibleWhenDisabled","promiseResult","Promise","allSettled","map","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","useCanUserEligibilityCheckPostType","capability","postType","action","registry","select","canUser","kind","name","useTrashPostAction","permanentlyDeletePostAction","callback","posts","dispatch","post","force","usePermanentlyDeletePostAction","restorePostAction","editEntityRecord","saveEditedEntityRecord","useRestorePostAction","viewPostAction","window","open","link","postRevisionsAction","context","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","revision","document","location","renamePostAction","Object","values","is_custom","isTemplatePart","isUserPattern","user","isCustomPattern","hasThemeFile","setTitle","onRename","event","preventDefault","error","code","onSubmit","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","useRenamePostAction","ReorderModal","orderInput","setOrderInput","menu_order","onOrder","Number","isInteger","trim","saveIsDisabled","help","__experimentalIsFocusable","useReorderPagesAction","supportsPageAttributes","getPostType","postTypeObject","supports","useDuplicatePostAction","userCanCreatePost","setItem","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItemOject","slug","comment_status","content","raw","excerpt","meta","parent","password","format","featured_media","ping_status","assignablePropertiesPrefix","assignableProperties","keys","property","startsWith","slice","forEach","newItem","rendered","data","duplicatePatternAction","modalHeader","duplicatedProps","pattern","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","blocks","_item$blocks","__unstableSkipMigrationLogs","onTemplatePartSuccess","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","defaultActions","userCanCreatePostType","cachedCanUserResolvers","getCachedResolvers","getEntityActions","_postTypeObject","duplicatePostAction","trashPostActionForPostType","permanentlyDeletePostActionForPostType","renamePostActionForPostType","restorePostActionForPostType","reorderPagesAction","isTemplateOrTemplatePart","isPattern","isLoaded","supportsRevisions","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","Boolean","i","existingCallback","argsObject","_items","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _n, sprintf, _x } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo, useState } from '@wordpress/element';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { parse } from '@wordpress/blocks';\nimport { DataForm } from '@wordpress/dataviews';\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_ORIGINS,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tPATTERN_POST_TYPE,\n} from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { CreateTemplatePartModalContents } from '../create-template-part-modal';\nimport { getItemTitle } from '../../dataviews/actions/utils';\n\n// Patterns.\nconst { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\n\n// TODO: this should be shared with other components (page-pages).\nconst fields = [\n\t{\n\t\ttype: 'text',\n\t\theader: __( 'Title' ),\n\t\tid: 'title',\n\t\tplaceholder: __( 'No title' ),\n\t\tgetValue: ( { item } ) => item.title,\n\t},\n];\n\nconst form = {\n\tvisibleFields: [ 'title' ],\n};\n\n/**\n * Check if a template is removable.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is removable.\n */\nfunction isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t// In patterns list page we map the templates parts to a different object\n\t// than the one returned from the endpoint. This is why we need to check for\n\t// two props whether is custom or has a theme file.\n\treturn (\n\t\ttemplate?.source === TEMPLATE_ORIGINS.custom &&\n\t\t! template?.has_theme_file\n\t);\n}\n\nconst trashPostAction = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to Trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( item ) {\n\t\treturn ! [ 'auto-draft', 'trash' ].includes( item.status );\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ items.length === 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The item's title.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash \"%s\"?'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %d: The number of items (2 or more).\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash %d item?',\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash %d items?',\n\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tsetIsBusy( true );\n\t\t\t\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\t\t\t\titems.map( ( item ) =>\n\t\t\t\t\t\t\t\t\tdeleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\t\t\titem.id,\n\t\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tlet successMessage;\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The item's title. */\n\t\t\t\t\t\t\t\t\t\t__( '\"%s\" moved to trash.' ),\n\t\t\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The number of items. */\n\t\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t\t'%s item moved to trash.',\n\t\t\t\t\t\t\t\t\t\t\t'%s items moved to trash.',\n\t\t\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tid: 'move-to-trash-action',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If there was at least one failure.\n\t\t\t\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t\t\t\t// If we were trying to delete a single item.\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\t\t\tpromiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the item.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// If we were trying to delete multiple items.\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the items.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the item: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'Some errors occurred while moving to trash the items: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetIsBusy( false );\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Trash' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nfunction useCanUserEligibilityCheckPostType( capability, postType, action ) {\n\tconst registry = useRegistry();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...action,\n\t\t\tisEligible( item ) {\n\t\t\t\treturn (\n\t\t\t\t\taction.isEligible( item ) &&\n\t\t\t\t\tregistry.select( coreStore ).canUser( capability, {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: postType,\n\t\t\t\t\t\tid: item.id,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t} ),\n\t\t[ action, registry, capability, postType ]\n\t);\n}\n\nfunction useTrashPostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tpostType,\n\t\ttrashPostAction\n\t);\n}\n\nconst permanentlyDeletePostAction = {\n\tid: 'permanently-delete',\n\tlabel: __( 'Permanently delete' ),\n\tsupportsBulk: true,\n\tisEligible( { status } ) {\n\t\treturn status === 'trash';\n\t},\n\tasync callback( posts, { registry, onActionPerformed } ) {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tregistry.dispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = registry.dispatch( coreStore );\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpost.type,\n\t\t\t\t\tpost.id,\n\t\t\t\t\t{ force: true },\n\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t);\n\t\t\t} )\n\t\t);\n\t\t// If all the promises were fulfilled with success.\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = __( 'The posts were permanently deleted.' );\n\t\t\t}\n\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'permanently-delete-post-action',\n\t\t\t} );\n\t\t\tonActionPerformed?.( posts );\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to permanently delete a single post.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t},\n};\n\nfunction usePermanentlyDeletePostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tpostType,\n\t\tpermanentlyDeletePostAction\n\t);\n}\n\nconst restorePostAction = {\n\tid: 'restore',\n\tlabel: __( 'Restore' ),\n\tisPrimary: true,\n\ticon: backup,\n\tsupportsBulk: true,\n\tisEligible( { status } ) {\n\t\treturn status === 'trash';\n\t},\n\tasync callback( posts, { registry, onActionPerformed } ) {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tregistry.dispatch( noticesStore );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tregistry.dispatch( coreStore );\n\t\tawait Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t} );\n\t\t\t} )\n\t\t);\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn saveEditedEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t} )\n\t\t);\n\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\t\t\tif ( posts.length === 1 ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t);\n\t\t\t} else if ( posts[ 0 ].type === 'page' ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '%d pages have been restored.' ),\n\t\t\t\t\tposts.length\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\tposts.length\n\t\t\t\t);\n\t\t\t}\n\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'restore-post-action',\n\t\t\t} );\n\t\t\tif ( onActionPerformed ) {\n\t\t\t\tonActionPerformed( posts );\n\t\t\t}\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to move a single post to the trash.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t__( 'An error occurred while restoring the posts: %s' ),\n\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Some errors occurred while restoring the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t},\n};\n\nfunction useRestorePostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'update',\n\t\tpostType,\n\t\trestorePostAction\n\t);\n}\n\nconst viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\twindow.open( post.link, '_blank' );\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tcontext: 'list',\n\tlabel( items ) {\n\t\tconst revisionsCount =\n\t\t\titems[ 0 ]._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn sprintf(\n\t\t\t/* translators: %s: number of revisions */\n\t\t\t__( 'View revisions (%s)' ),\n\t\t\trevisionsCount\n\t\t);\n\t},\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst renamePostAction = {\n\tid: 'rename-post',\n\tlabel: __( 'Rename' ),\n\tisEligible( post ) {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Templates, template parts and patterns have special checks for renaming.\n\t\tif (\n\t\t\t! [\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t...Object.values( PATTERN_TYPES ),\n\t\t\t].includes( post.type )\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t\t// In the case of templates, we can only rename custom templates.\n\t\tif ( post.type === TEMPLATE_POST_TYPE ) {\n\t\t\treturn isTemplateRemovable( post ) && post.is_custom;\n\t\t}\n\t\t// Make necessary checks for template parts and patterns.\n\t\tconst isTemplatePart = post.type === TEMPLATE_PART_POST_TYPE;\n\t\tconst isUserPattern = post.type === PATTERN_TYPES.user;\n\t\t// In patterns list page we map the templates parts to a different object\n\t\t// than the one returned from the endpoint. This is why we need to check for\n\t\t// two props whether is custom or has a theme file.\n\t\tconst isCustomPattern =\n\t\t\tisUserPattern ||\n\t\t\t( isTemplatePart && post.source === TEMPLATE_ORIGINS.custom );\n\t\tconst hasThemeFile = post?.has_theme_file;\n\t\treturn isCustomPattern && ! hasThemeFile;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ title, setTitle ] = useState( () => getItemTitle( item ) );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tuseDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function onRename( event ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\ttitle,\n\t\t\t\t} );\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetTitle( '' );\n\t\t\t\tcloseModal();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t\tcreateSuccessNotice( __( 'Name updated' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tonActionPerformed?.( items );\n\t\t\t} catch ( error ) {\n\t\t\t\tconst errorMessage =\n\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: __( 'An error occurred while updating the name' );\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<form onSubmit={ onRename }>\n\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t);\n\t},\n};\n\nfunction useRenamePostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'update',\n\t\tpostType,\n\t\trenamePostAction\n\t);\n}\n\nfunction ReorderModal( { items, closeModal, onActionPerformed } ) {\n\tconst [ item ] = items;\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst [ orderInput, setOrderInput ] = useState( item.menu_order );\n\n\tasync function onOrder( event ) {\n\t\tevent.preventDefault();\n\t\tif (\n\t\t\t! Number.isInteger( Number( orderInput ) ) ||\n\t\t\torderInput?.trim?.() === ''\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tmenu_order: orderInput,\n\t\t\t} );\n\t\t\tcloseModal();\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tcreateSuccessNotice( __( 'Order updated' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tonActionPerformed?.( items );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while updating the order' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t}\n\tconst saveIsDisabled =\n\t\t! Number.isInteger( Number( orderInput ) ) ||\n\t\torderInput?.trim?.() === '';\n\treturn (\n\t\t<form onSubmit={ onOrder }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<div>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.'\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<NumberControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Order' ) }\n\t\t\t\t\thelp={ __( 'Set the page order.' ) }\n\t\t\t\t\tvalue={ orderInput }\n\t\t\t\t\tonChange={ setOrderInput }\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ saveIsDisabled }\n\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nfunction useReorderPagesAction( postType ) {\n\tconst supportsPageAttributes = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst postTypeObject = getPostType( postType );\n\n\t\t\treturn !! postTypeObject?.supports?.[ 'page-attributes' ];\n\t\t},\n\t\t[ postType ]\n\t);\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupportsPageAttributes && {\n\t\t\t\tid: 'order-pages',\n\t\t\t\tlabel: __( 'Order' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ReorderModal,\n\t\t\t},\n\t\t[ supportsPageAttributes ]\n\t);\n}\n\nconst useDuplicatePostAction = ( postType ) => {\n\tconst userCanCreatePost = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tuserCanCreatePost && {\n\t\t\t\tid: 'duplicate-post',\n\t\t\t\tlabel: _x( 'Duplicate', 'action label' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\t\t\t\tconst [ item, setItem ] = useState( {\n\t\t\t\t\t\t...items[ 0 ],\n\t\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Existing template title */\n\t\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t),\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst [ isCreatingPage, setIsCreatingPage ] =\n\t\t\t\t\t\tuseState( false );\n\n\t\t\t\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\t\t\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\t\t\t\tuseDispatch( noticesStore );\n\n\t\t\t\t\tasync function createPage( event ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\tif ( isCreatingPage ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst newItemOject = {\n\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t\ttitle: item.title,\n\t\t\t\t\t\t\tslug: item.title || __( 'No title' ),\n\t\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst assignablePropertiesPrefix = 'wp:action-assign-';\n\t\t\t\t\t\t// Get all the properties that the current user is able to assign normally author, categories, tags,\n\t\t\t\t\t\t// and custom taxonomies.\n\t\t\t\t\t\tconst assignableProperties = Object.keys(\n\t\t\t\t\t\t\titem?._links || {}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.filter( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.startsWith(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.slice(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tassignableProperties.forEach( ( property ) => {\n\t\t\t\t\t\t\tif ( item[ property ] ) {\n\t\t\t\t\t\t\t\tnewItemOject[ property ] = item[ property ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetIsCreatingPage( true );\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\tnewItemOject,\n\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\t\tnewItem.title?.rendered || item.title\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch ( error ) {\n\t\t\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while duplicating the page.'\n\t\t\t\t\t\t\t\t\t );\n\n\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t\t\t<DataForm\n\t\t\t\t\t\t\t\t\tdata={ item }\n\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\tform={ form }\n\t\t\t\t\t\t\t\t\tonChange={ setItem }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t[ userCanCreatePost ]\n\t);\n};\n\nexport const duplicatePatternAction = {\n\tid: 'duplicate-pattern',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type !== TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate pattern', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern: item,\n\t\t\tonSuccess: () => closeModal(),\n\t\t} );\n\t\treturn (\n\t\t\t<CreatePatternModalContents\n\t\t\t\tonClose={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t{ ...duplicatedProps }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport const duplicateTemplatePartAction = {\n\tid: 'duplicate-template-part',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type === TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate template part', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst blocks = useMemo( () => {\n\t\t\treturn (\n\t\t\t\titem.blocks ??\n\t\t\t\tparse(\n\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t{\n\t\t\t\t\t\t__unstableSkipMigrationLogs: true,\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t);\n\t\t}, [ item.content, item.blocks ] );\n\t\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\t\tfunction onTemplatePartSuccess() {\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The new template part's title e.g. 'Call to action (copy)'.\n\t\t\t\t\t__( '\"%s\" duplicated.' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t\tcloseModal();\n\t\t}\n\t\treturn (\n\t\t\t<CreateTemplatePartModalContents\n\t\t\t\tblocks={ blocks }\n\t\t\t\tdefaultArea={ item.area }\n\t\t\t\tdefaultTitle={ sprintf(\n\t\t\t\t\t/* translators: %s: Existing template part title */\n\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t) }\n\t\t\t\tonCreate={ onTemplatePartSuccess }\n\t\t\t\tonError={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst {\n\t\tdefaultActions,\n\t\tpostTypeObject,\n\t\tuserCanCreatePostType,\n\t\tcachedCanUserResolvers,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser, getCachedResolvers } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\tconst _postTypeObject = getPostType( postType );\n\t\t\treturn {\n\t\t\t\tpostTypeObject: _postTypeObject,\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t\tuserCanCreatePostType: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t} ),\n\t\t\t\tcachedCanUserResolvers: getCachedResolvers()?.canUser,\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst duplicatePostAction = useDuplicatePostAction( postType );\n\tconst trashPostActionForPostType = useTrashPostAction( postType );\n\tconst permanentlyDeletePostActionForPostType =\n\t\tusePermanentlyDeletePostAction( postType );\n\tconst renamePostActionForPostType = useRenamePostAction( postType );\n\tconst restorePostActionForPostType = useRestorePostAction( postType );\n\tconst reorderPagesAction = useReorderPagesAction( postType );\n\tconst isTemplateOrTemplatePart = [\n\t\tTEMPLATE_POST_TYPE,\n\t\tTEMPLATE_PART_POST_TYPE,\n\t].includes( postType );\n\tconst isPattern = postType === PATTERN_POST_TYPE;\n\tconst isLoaded = !! postTypeObject;\n\tconst supportsRevisions = !! postTypeObject?.supports?.revisions;\n\tconst supportsTitle = !! postTypeObject?.supports?.title;\n\treturn useMemo( () => {\n\t\tif ( ! isLoaded ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet actions = [\n\t\t\tpostTypeObject?.viewable && viewPostAction,\n\t\t\tsupportsRevisions && postRevisionsAction,\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! isTemplateOrTemplatePart &&\n\t\t\t\t ! isPattern &&\n\t\t\t\t duplicatePostAction\n\t\t\t\t: false,\n\t\t\tisTemplateOrTemplatePart &&\n\t\t\t\tuserCanCreatePostType &&\n\t\t\t\tduplicateTemplatePartAction,\n\t\t\tisPattern && userCanCreatePostType && duplicatePatternAction,\n\t\t\tsupportsTitle && renamePostActionForPostType,\n\t\t\treorderPagesAction,\n\t\t\t! isTemplateOrTemplatePart && restorePostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\t! isPattern &&\n\t\t\t\ttrashPostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\tpermanentlyDeletePostActionForPostType,\n\t\t\t...defaultActions,\n\t\t].filter( Boolean );\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tactions = actions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t\t// We are making this use memo depend on cachedCanUserResolvers as a way to make the component using this hook re-render\n\t\t// when user capabilities are resolved. This makes sure the isEligible functions of actions dependent on capabilities are re-evaluated.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tdefaultActions,\n\t\tuserCanCreatePostType,\n\t\tisTemplateOrTemplatePart,\n\t\tisPattern,\n\t\tpostTypeObject?.viewable,\n\t\tduplicatePostAction,\n\t\treorderPagesAction,\n\t\ttrashPostActionForPostType,\n\t\trestorePostActionForPostType,\n\t\trenamePostActionForPostType,\n\t\tpermanentlyDeletePostActionForPostType,\n\t\tonActionPerformed,\n\t\tisLoaded,\n\t\tsupportsRevisions,\n\t\tsupportsTitle,\n\t\tcontext,\n\t\tcachedCanUserResolvers,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,KAAK,EAAEC,MAAM,QAAQ,kBAAkB;AAC1D,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACrD,SAASL,KAAK,IAAIM,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,WAAW,IAAIC,mBAAmB,QAAQ,qBAAqB;AACxE,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,QAAQ,QAAQ,sBAAsB;AAC/C,SACCC,MAAM,EACNC,W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f6M,MACD,CAAC;gBACF;cACD,CAAE,CAAC;YACJ;UACD,CAAC;QACF;QACA,IAAKR,OAAO,CAAEK,CAAC,CAAE,CAACrL,WAAW,EAAG;UAC/B,MAAMyL,mBAAmB,GAAGT,OAAO,CAAEK,CAAC,CAAE,CAACrL,WAAW;UACpDgL,OAAO,CAAEK,CAAC,CAAE,GAAG;YACd,GAAGL,OAAO,CAAEK,CAAC,CAAE;YACfrL,WAAW,EAAI0L,KAAK,IAAM;cACzB,oBACCxN,IAAA,CAACuN,mBAAmB;gBAAA,GACdC,KAAK;gBACVvL,iBAAiB,EAAKqL,MAAM,IAAM;kBACjC,IAAKE,KAAK,CAACvL,iBAAiB,EAAG;oBAC9BuL,KAAK,CAACvL,iBAAiB,CAAEqL,MAAO,CAAC;kBAClC;kBACArL,iBAAiB,CAChB6K,OAAO,CAAEK,CAAC,CAAE,CAAC1M,EAAE,EACf6M,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOR,OAAO;IACd;IACA;IACA;EACD,CAAC,EAAE,CACFlB,cAAc,EACdC,qBAAqB,EACrBW,wBAAwB,EACxBC,SAAS,EACT9D,cAAc,EAAEoE,QAAQ,EACxBb,mBAAmB,EACnBK,kBAAkB,EAClBJ,0BAA0B,EAC1BG,4BAA4B,EAC5BD,2BAA2B,EAC3BD,sCAAsC,EACtCnK,iBAAiB,EACjByK,QAAQ,EACRC,iBAAiB,EACjBE,aAAa,EACblH,OAAO,EACPmG,sBAAsB,CACrB,CAAC;AACJ","ignoreList":[]}
@@ -35,10 +35,16 @@ export default function PostCardPanel({
35
35
  getCurrentPostId,
36
36
  __experimentalGetTemplateInfo
37
37
  } = select(editorStore);
38
+ const {
39
+ canUser
40
+ } = select(coreStore);
38
41
  const {
39
42
  getEditedEntityRecord
40
43
  } = select(coreStore);
41
- const siteSettings = getEditedEntityRecord('root', 'site');
44
+ const siteSettings = canUser('read', {
45
+ kind: 'root',
46
+ name: 'site'
47
+ }) ? getEditedEntityRecord('root', 'site') : undefined;
42
48
  const _type = getCurrentPostType();
43
49
  const _id = getCurrentPostId();
44
50
  const _record = getEditedEntityRecord('postType', _type, _id);
@@ -83,7 +89,7 @@ export default function PostCardPanel({
83
89
  lineHeight: "20px",
84
90
  children: [title ? decodeEntities(title) : __('No Title'), isFrontPage && /*#__PURE__*/_jsx("span", {
85
91
  className: "editor-post-card-panel__title-badge",
86
- children: __('Front Page')
92
+ children: __('Homepage')
87
93
  }), isPostsPage && /*#__PURE__*/_jsx("span", {
88
94
  className: "editor-post-card-panel__title-badge",
89
95
  children: __('Posts Page')