@wordpress/editor 14.0.3 → 14.0.5

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 (66) hide show
  1. package/build/bindings/pattern-overrides.js +8 -5
  2. package/build/bindings/pattern-overrides.js.map +1 -1
  3. package/build/bindings/post-meta.js +4 -0
  4. package/build/bindings/post-meta.js.map +1 -1
  5. package/build/components/editor/index.js +5 -0
  6. package/build/components/editor/index.js.map +1 -1
  7. package/build/components/editor-interface/index.js +2 -1
  8. package/build/components/editor-interface/index.js.map +1 -1
  9. package/build/components/page-attributes/parent.js +2 -1
  10. package/build/components/page-attributes/parent.js.map +1 -1
  11. package/build/components/post-actions/actions.js +14 -36
  12. package/build/components/post-actions/actions.js.map +1 -1
  13. package/build/components/post-actions/export-pattern-action.js +2 -2
  14. package/build/components/post-actions/export-pattern-action.js.map +1 -1
  15. package/build/components/post-saved-state/index.js +11 -1
  16. package/build/components/post-saved-state/index.js.map +1 -1
  17. package/build/components/post-status/index.js +2 -1
  18. package/build/components/post-status/index.js.map +1 -1
  19. package/build/components/save-publish-panels/index.js +30 -16
  20. package/build/components/save-publish-panels/index.js.map +1 -1
  21. package/build/hooks/pattern-overrides.js +2 -2
  22. package/build/hooks/pattern-overrides.js.map +1 -1
  23. package/build/store/utils/is-template-revertable.js +6 -8
  24. package/build/store/utils/is-template-revertable.js.map +1 -1
  25. package/build-module/bindings/pattern-overrides.js +8 -5
  26. package/build-module/bindings/pattern-overrides.js.map +1 -1
  27. package/build-module/bindings/post-meta.js +4 -0
  28. package/build-module/bindings/post-meta.js.map +1 -1
  29. package/build-module/components/editor/index.js +5 -0
  30. package/build-module/components/editor/index.js.map +1 -1
  31. package/build-module/components/editor-interface/index.js +2 -1
  32. package/build-module/components/editor-interface/index.js.map +1 -1
  33. package/build-module/components/page-attributes/parent.js +2 -1
  34. package/build-module/components/page-attributes/parent.js.map +1 -1
  35. package/build-module/components/post-actions/actions.js +14 -36
  36. package/build-module/components/post-actions/actions.js.map +1 -1
  37. package/build-module/components/post-actions/export-pattern-action.js +2 -2
  38. package/build-module/components/post-actions/export-pattern-action.js.map +1 -1
  39. package/build-module/components/post-saved-state/index.js +11 -1
  40. package/build-module/components/post-saved-state/index.js.map +1 -1
  41. package/build-module/components/post-status/index.js +1 -1
  42. package/build-module/components/post-status/index.js.map +1 -1
  43. package/build-module/components/save-publish-panels/index.js +30 -16
  44. package/build-module/components/save-publish-panels/index.js.map +1 -1
  45. package/build-module/hooks/pattern-overrides.js +3 -1
  46. package/build-module/hooks/pattern-overrides.js.map +1 -1
  47. package/build-module/store/utils/is-template-revertable.js +6 -8
  48. package/build-module/store/utils/is-template-revertable.js.map +1 -1
  49. package/build-style/style-rtl.css +13 -1
  50. package/build-style/style.css +13 -1
  51. package/package.json +6 -6
  52. package/src/bindings/pattern-overrides.js +9 -10
  53. package/src/bindings/post-meta.js +5 -0
  54. package/src/components/editor/index.js +6 -0
  55. package/src/components/editor-interface/index.js +17 -12
  56. package/src/components/page-attributes/parent.js +6 -3
  57. package/src/components/post-actions/actions.js +33 -58
  58. package/src/components/post-actions/export-pattern-action.js +4 -2
  59. package/src/components/post-featured-image/style.scss +15 -0
  60. package/src/components/post-panel-row/style.scss +1 -0
  61. package/src/components/post-saved-state/index.js +11 -1
  62. package/src/components/post-status/index.js +1 -1
  63. package/src/components/save-publish-panels/index.js +33 -23
  64. package/src/components/visual-editor/style.scss +1 -1
  65. package/src/hooks/pattern-overrides.js +4 -1
  66. package/src/store/utils/is-template-revertable.js +8 -8
@@ -1 +1 @@
1
- {"version":3,"names":["_icons","require","_url","_data","_htmlEntities","_coreData","_i18n","_notices","_element","_patterns","_components","_constants","_store","_lockUnlock","_isTemplateRevertable","_interopRequireDefault","_exportPatternAction","_createTemplatePartModal","_jsxRuntime","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","unlock","patternsPrivateApis","isTemplateRemovable","template","source","templatePart","includes","TEMPLATE_ORIGINS","custom","has_theme_file","canDeleteOrReset","item","isTemplatePart","type","TEMPLATE_PART_POST_TYPE","isUserPattern","user","isCustom","getItemTitle","title","decodeEntities","rendered","deletePostAction","id","label","__","isPrimary","icon","trash","isEligible","post","TEMPLATE_POST_TYPE","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionStart","onActionPerformed","isBusy","setIsBusy","useState","removeTemplates","useDispatch","editorStore","jsxs","__experimentalVStack","spacing","children","jsx","__experimentalText","length","sprintf","_n","__experimentalHStack","justify","Button","variant","onClick","disabled","__experimentalIsFocusable","allowUndo","useCanUserEligibilityCheckPostType","capability","resource","action","registry","useRegistry","useMemo","select","coreStore","canUser","trashPostAction","status","createSuccessNotice","createErrorNotice","noticesStore","deleteEntityRecord","promiseResult","Promise","allSettled","map","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","useTrashPostAction","usePermanentlyDeletePostAction","permanentlyDeletePostAction","callback","posts","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","restorePostAction","backup","viewPostAction","external","window","open","link","postRevisionsAction","context","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","addQueryArgs","revision","document","location","renamePostAction","Object","values","is_custom","isCustomPattern","hasThemeFile","originalTitle","setTitle","onRename","event","preventDefault","error","code","onSubmit","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","useRenamePostAction","duplicatePostAction","_x","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItem","slug","author","comment_status","content","raw","excerpt","meta","parent","password","format","featured_media","menu_order","ping_status","categories","tags","placeholder","isTemplatePartRevertable","resetTemplateAction","isTemplateRevertable","revertTemplate","onConfirm","fallbackErrorMessage","duplicatePatternAction","exports","modalHeader","isThemePattern","theme","duplicatedProps","pattern","patternPost","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","onTemplatePartSuccess","CreateTemplatePartModalContents","blocks","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","postType","postTypeObject","cachedCanUserResolvers","userCanCreatePostType","useSelect","getPostType","getCachedResolvers","_postTypeObject","_resource","rest_base","trashPostActionForPostType","permanentlyDeletePostActionForPostType","renamePostActionForPostType","restorePostActionForPostType","isTemplateOrTemplatePart","isPattern","PATTERN_POST_TYPE","isLoaded","supportsRevisions","supports","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","exportPatternAsJSONAction","Boolean","i","existingCallback","_onActionPerformed","_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';\n\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 isTemplateRevertable from '../../store/utils/is-template-revertable';\nimport { exportPatternAsJSONAction } from './export-pattern-action';\nimport { CreateTemplatePartModalContents } from '../create-template-part-modal';\n\n// Patterns.\nconst { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\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\t[ template.source, template.templatePart?.source ].includes(\n\t\t\tTEMPLATE_ORIGINS.custom\n\t\t) &&\n\t\t! template.has_theme_file &&\n\t\t! template.templatePart?.has_theme_file\n\t);\n}\nconst canDeleteOrReset = ( item ) => {\n\tconst isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;\n\tconst isUserPattern = item.type === PATTERN_TYPES.user;\n\treturn isUserPattern || ( isTemplatePart && item.isCustom );\n};\n\nfunction getItemTitle( item ) {\n\tif ( typeof item.title === 'string' ) {\n\t\treturn decodeEntities( item.title );\n\t}\n\treturn decodeEntities( item.title?.rendered || '' );\n}\n\n// This action is used for templates, patterns and template parts.\n// Every other post type uses the similar `trashPostAction` which\n// moves the post to trash.\nconst deletePostAction = {\n\tid: 'delete-post',\n\tlabel: __( 'Delete' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( post ) {\n\t\tif (\n\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\tpost.type\n\t\t\t)\n\t\t) {\n\t\t\treturn isTemplateRemovable( post );\n\t\t}\n\t\t// We can only remove user patterns.\n\t\treturn post.type === PATTERN_TYPES.user;\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { removeTemplates } = unlock( useDispatch( editorStore ) );\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: %d: number of items to delete.\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Delete %d item?',\n\t\t\t\t\t\t\t\t\t'Delete %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\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The template or template part's titles\n\t\t\t\t\t\t\t\t__( 'Delete \"%s\"?' ),\n\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait removeTemplates( items, {\n\t\t\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonActionPerformed?.( items );\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\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Delete' ) }\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\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: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\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 if ( items[ 0 ].type === 'page' ) {\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__( '%s items moved to trash.' ),\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} 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 posts. */\n\t\t\t\t\t\t\t\t\t\t__( '%s items move to trash.' ),\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\t__experimentalIsFocusable\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 useTrashPostAction( resource ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tresource,\n\t\ttrashPostAction\n\t);\n}\n\nfunction usePermanentlyDeletePostAction( resource ) {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst permanentlyDeletePostAction = useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t'The posts were permanently deleted.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'permanently-delete-post-action',\n\t\t\t\t\t} );\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to permanently delete a single post.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\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__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tresource,\n\t\tpermanentlyDeletePostAction\n\t);\n}\n\nfunction useRestorePostAction( resource ) {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\tconst restorePostAction = useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\tawait Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstatus: 'draft',\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\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn saveEditedEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( posts.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if ( posts[ 0 ].type === 'page' ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '%d pages have been restored.' ),\n\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'restore-post-action',\n\t\t\t\t\t} );\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to move a single post to the trash.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while restoring the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\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__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while restoring the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\n\t);\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 &&\n\t\t\t\t( post.isCustom || post.source === TEMPLATE_ORIGINS.custom ) );\n\t\tconst hasThemeFile =\n\t\t\tisTemplatePart &&\n\t\t\t( post.templatePart?.has_theme_file || post.has_theme_file );\n\t\treturn isCustomPattern && ! hasThemeFile;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst originalTitle = decodeEntities(\n\t\t\ttypeof item.title === 'string' ? item.title : item.title.rendered\n\t\t);\n\t\tconst [ title, setTitle ] = useState( () => originalTitle );\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 duplicatePostAction = {\n\tid: 'duplicate-post',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\t\tconst [ title, setTitle ] = useState(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: Existing item title */\n\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\tgetItemTitle( item )\n\t\t\t)\n\t\t);\n\n\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function createPage( event ) {\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( isCreatingPage ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsCreatingPage( true );\n\t\t\ttry {\n\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\titem.type,\n\t\t\t\t\t{\n\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t\t\tauthor: item.author,\n\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\tcategories: item.categories,\n\t\t\t\t\t\ttags: item.tags,\n\t\t\t\t\t},\n\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t);\n\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\tdecodeEntities( newItem.title?.rendered || title )\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t}\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 duplicating the page.' );\n\n\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t} finally {\n\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\tcloseModal();\n\t\t\t}\n\t\t}\n\t\treturn (\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\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\nconst isTemplatePartRevertable = ( item ) => {\n\tif ( ! item ) {\n\t\treturn false;\n\t}\n\tconst hasThemeFile = item.templatePart?.has_theme_file;\n\treturn canDeleteOrReset( item ) && hasThemeFile;\n};\n\nconst resetTemplateAction = {\n\tid: 'reset-template',\n\tlabel: __( 'Reset' ),\n\tisEligible: ( item ) => {\n\t\treturn item.type === TEMPLATE_PART_POST_TYPE\n\t\t\t? isTemplatePartRevertable( item )\n\t\t\t: isTemplateRevertable( item );\n\t},\n\ticon: backup,\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { revertTemplate, removeTemplates } = unlock(\n\t\t\tuseDispatch( editorStore )\n\t\t);\n\t\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst onConfirm = async () => {\n\t\t\ttry {\n\t\t\t\tif ( items[ 0 ].type === TEMPLATE_PART_POST_TYPE ) {\n\t\t\t\t\tawait removeTemplates( items );\n\t\t\t\t} else {\n\t\t\t\t\tfor ( const template of items ) {\n\t\t\t\t\t\tif ( template.type === TEMPLATE_POST_TYPE ) {\n\t\t\t\t\t\t\tawait revertTemplate( template, {\n\t\t\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\t\ttemplate.id\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\tcreateSuccessNotice(\n\t\t\t\t\t\titems.length > 1\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of items. */\n\t\t\t\t\t\t\t\t\t__( '%s items reset.' ),\n\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities( getItemTitle( items[ 0 ] ) )\n\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'revert-template-action',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch ( error ) {\n\t\t\t\tlet fallbackErrorMessage;\n\t\t\t\tif ( items[ 0 ].type === TEMPLATE_POST_TYPE ) {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the templates.'\n\t\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template parts.'\n\t\t\t\t\t\t\t );\n\t\t\t\t}\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: fallbackErrorMessage;\n\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t};\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ __( 'Reset to default and clear all customizations?' ) }\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait onConfirm( items );\n\t\t\t\t\t\t\tonActionPerformed?.( items );\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\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\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\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 isThemePattern = item.type === PATTERN_TYPES.theme;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern:\n\t\t\t\tisThemePattern || ! item.patternPost ? item : item.patternPost,\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 { 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\titem.title\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={ item.blocks }\n\t\t\t\tdefaultArea={ item.templatePart?.area || 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\titem.title\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\tpostTypeObject,\n\t\tresource,\n\t\tcachedCanUserResolvers,\n\t\tuserCanCreatePostType,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, getCachedResolvers, canUser } =\n\t\t\t\tselect( coreStore );\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\tresource: _resource,\n\t\t\t\tcachedCanUserResolvers: getCachedResolvers()?.canUser,\n\t\t\t\tuserCanCreatePostType: canUser( 'create', _resource ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\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\tisPattern && exportPatternAsJSONAction,\n\t\t\tisTemplateOrTemplatePart\n\t\t\t\t? resetTemplateAction\n\t\t\t\t: restorePostActionForPostType,\n\t\t\tisTemplateOrTemplatePart || isPattern\n\t\t\t\t? deletePostAction\n\t\t\t\t: trashPostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\tpermanentlyDeletePostActionForPostType,\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, _onActionPerformed ) => {\n\t\t\t\t\t\t\texistingCallback( items, ( _items ) => {\n\t\t\t\t\t\t\t\tif ( _onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t_onActionPerformed( _items );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonActionPerformed( actions[ i ].id, _items );\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\tisTemplateOrTemplatePart,\n\t\tisPattern,\n\t\tpostTypeObject?.viewable,\n\t\tpermanentlyDeletePostActionForPostType,\n\t\trestorePostActionForPostType,\n\t\trenamePostActionForPostType,\n\t\ttrashPostActionForPostType,\n\t\tonActionPerformed,\n\t\tisLoaded,\n\t\tsupportsRevisions,\n\t\tsupportsTitle,\n\t\tcontext,\n\t\tuserCanCreatePostType,\n\t\tcachedCanUserResolvers,\n\t] );\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAEA,IAAAS,WAAA,GAAAT,OAAA;AAWA,IAAAU,UAAA,GAAAV,OAAA;AAMA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,qBAAA,GAAAC,sBAAA,CAAAd,OAAA;AACA,IAAAe,oBAAA,GAAAf,OAAA;AACA,IAAAgB,wBAAA,GAAAhB,OAAA;AAAgF,IAAAiB,WAAA,GAAAjB,OAAA;AAlChF;AACA;AACA;;AAmBA;AACA;AACA;;AAaA;AACA,MAAM;EAAEkB,aAAa;EAAEC,0BAA0B;EAAEC;AAAyB,CAAC,GAC5E,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAAEC,QAAQ,EAAG;EACxC,IAAK,CAAEA,QAAQ,EAAG;IACjB,OA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BD,sBAAsB,CACrB,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["_icons","require","_url","_data","_htmlEntities","_coreData","_i18n","_notices","_element","_patterns","_components","_constants","_store","_lockUnlock","_isTemplateRevertable","_interopRequireDefault","_exportPatternAction","_createTemplatePartModal","_jsxRuntime","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","unlock","patternsPrivateApis","isTemplateRemovable","template","source","templatePart","includes","TEMPLATE_ORIGINS","custom","has_theme_file","getItemTitle","item","title","decodeEntities","rendered","deletePostAction","id","label","__","isPrimary","icon","trash","isEligible","post","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","type","user","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionStart","onActionPerformed","isBusy","setIsBusy","useState","removeTemplates","useDispatch","editorStore","jsxs","__experimentalVStack","spacing","children","jsx","__experimentalText","length","sprintf","_n","__experimentalHStack","justify","Button","variant","onClick","disabled","__experimentalIsFocusable","allowUndo","useCanUserEligibilityCheckPostType","capability","resource","action","registry","useRegistry","useMemo","select","coreStore","canUser","trashPostAction","status","createSuccessNotice","createErrorNotice","noticesStore","deleteEntityRecord","promiseResult","Promise","allSettled","map","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","useTrashPostAction","usePermanentlyDeletePostAction","permanentlyDeletePostAction","callback","posts","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","restorePostAction","backup","viewPostAction","external","window","open","link","postRevisionsAction","context","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","addQueryArgs","revision","document","location","renamePostAction","Object","values","is_custom","isTemplatePart","isUserPattern","isCustomPattern","isCustom","hasThemeFile","originalTitle","setTitle","onRename","event","preventDefault","error","code","onSubmit","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","useRenamePostAction","duplicatePostAction","_x","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItem","slug","author","comment_status","content","raw","excerpt","meta","parent","password","format","featured_media","menu_order","ping_status","categories","tags","placeholder","resetTemplateAction","isTemplateRevertable","revertTemplate","onConfirm","fallbackErrorMessage","duplicatePatternAction","exports","modalHeader","isThemePattern","theme","duplicatedProps","pattern","patternPost","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","onTemplatePartSuccess","CreateTemplatePartModalContents","blocks","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","postType","postTypeObject","cachedCanUserResolvers","userCanCreatePostType","useSelect","getPostType","getCachedResolvers","_postTypeObject","_resource","rest_base","trashPostActionForPostType","permanentlyDeletePostActionForPostType","renamePostActionForPostType","restorePostActionForPostType","isTemplateOrTemplatePart","isPattern","PATTERN_POST_TYPE","isLoaded","supportsRevisions","supports","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","exportPatternAsJSONAction","Boolean","i","existingCallback","_onActionPerformed","_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';\n\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 isTemplateRevertable from '../../store/utils/is-template-revertable';\nimport { exportPatternAsJSONAction } from './export-pattern-action';\nimport { CreateTemplatePartModalContents } from '../create-template-part-modal';\n\n// Patterns.\nconst { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\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\t[ template.source, template.templatePart?.source ].includes(\n\t\t\tTEMPLATE_ORIGINS.custom\n\t\t) &&\n\t\t! template.has_theme_file &&\n\t\t! template.templatePart?.has_theme_file\n\t);\n}\n\nfunction getItemTitle( item ) {\n\tif ( typeof item.title === 'string' ) {\n\t\treturn decodeEntities( item.title );\n\t}\n\treturn decodeEntities( item.title?.rendered || '' );\n}\n\n// This action is used for templates, patterns and template parts.\n// Every other post type uses the similar `trashPostAction` which\n// moves the post to trash.\nconst deletePostAction = {\n\tid: 'delete-post',\n\tlabel: __( 'Delete' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( post ) {\n\t\tif (\n\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\tpost.type\n\t\t\t)\n\t\t) {\n\t\t\treturn isTemplateRemovable( post );\n\t\t}\n\t\t// We can only remove user patterns.\n\t\treturn post.type === PATTERN_TYPES.user;\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { removeTemplates } = unlock( useDispatch( editorStore ) );\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: %d: number of items to delete.\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Delete %d item?',\n\t\t\t\t\t\t\t\t\t'Delete %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\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The template or template part's titles\n\t\t\t\t\t\t\t\t__( 'Delete \"%s\"?' ),\n\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait removeTemplates( items, {\n\t\t\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tonActionPerformed?.( items );\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\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Delete' ) }\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\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: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\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\t__experimentalIsFocusable\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 useTrashPostAction( resource ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tresource,\n\t\ttrashPostAction\n\t);\n}\n\nfunction usePermanentlyDeletePostAction( resource ) {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst permanentlyDeletePostAction = useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t'The posts were permanently deleted.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'permanently-delete-post-action',\n\t\t\t\t\t} );\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to permanently delete a single post.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\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__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tresource,\n\t\tpermanentlyDeletePostAction\n\t);\n}\n\nfunction useRestorePostAction( resource ) {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\tconst restorePostAction = useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts, onActionPerformed ) {\n\t\t\t\tawait Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstatus: 'draft',\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\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn saveEditedEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( posts.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if ( posts[ 0 ].type === 'page' ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '%d pages have been restored.' ),\n\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'restore-post-action',\n\t\t\t\t\t} );\n\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\tonActionPerformed( posts );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to move a single post to the trash.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\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\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while restoring the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\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__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while restoring the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\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\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\n\t);\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 &&\n\t\t\t\t( post.isCustom || post.source === TEMPLATE_ORIGINS.custom ) );\n\t\tconst hasThemeFile =\n\t\t\tisTemplatePart &&\n\t\t\t( post.templatePart?.has_theme_file || post.has_theme_file );\n\t\treturn isCustomPattern && ! hasThemeFile;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst originalTitle = decodeEntities(\n\t\t\ttypeof item.title === 'string' ? item.title : item.title.rendered\n\t\t);\n\t\tconst [ title, setTitle ] = useState( () => originalTitle );\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 duplicatePostAction = {\n\tid: 'duplicate-post',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\t\tconst [ title, setTitle ] = useState(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: Existing item title */\n\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\tgetItemTitle( item )\n\t\t\t)\n\t\t);\n\n\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function createPage( event ) {\n\t\t\tevent.preventDefault();\n\n\t\t\tif ( isCreatingPage ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsCreatingPage( true );\n\t\t\ttry {\n\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\titem.type,\n\t\t\t\t\t{\n\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t\t\tauthor: item.author,\n\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\tcategories: item.categories,\n\t\t\t\t\t\ttags: item.tags,\n\t\t\t\t\t},\n\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t);\n\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\tdecodeEntities( newItem.title?.rendered || title )\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t}\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 duplicating the page.' );\n\n\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t} finally {\n\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\tcloseModal();\n\t\t\t}\n\t\t}\n\t\treturn (\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\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\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\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\nconst resetTemplateAction = {\n\tid: 'reset-template',\n\tlabel: __( 'Reset' ),\n\tisEligible: ( item ) => {\n\t\treturn isTemplateRevertable( item );\n\t},\n\ticon: backup,\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( {\n\t\titems,\n\t\tcloseModal,\n\t\tonActionStart,\n\t\tonActionPerformed,\n\t} ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { revertTemplate } = unlock( useDispatch( editorStore ) );\n\t\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst onConfirm = async () => {\n\t\t\ttry {\n\t\t\t\tfor ( const template of items ) {\n\t\t\t\t\tawait revertTemplate( template, {\n\t\t\t\t\t\tallowUndo: false,\n\t\t\t\t\t} );\n\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\ttemplate.id\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\titems.length > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: The number of items. */\n\t\t\t\t\t\t\t\t__( '%s items reset.' ),\n\t\t\t\t\t\t\t\titems.length\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: The template/part's name. */\n\t\t\t\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\t\t\t\tdecodeEntities( getItemTitle( items[ 0 ] ) )\n\t\t\t\t\t\t ),\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'revert-template-action',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} catch ( error ) {\n\t\t\t\tlet fallbackErrorMessage;\n\t\t\t\tif ( items[ 0 ].type === TEMPLATE_POST_TYPE ) {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the templates.'\n\t\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\tfallbackErrorMessage =\n\t\t\t\t\t\titems.length === 1\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while reverting the template parts.'\n\t\t\t\t\t\t\t );\n\t\t\t\t}\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: fallbackErrorMessage;\n\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t};\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ __( 'Reset to default and clear all customizations?' ) }\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\t__experimentalIsFocusable\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\tif ( onActionStart ) {\n\t\t\t\t\t\t\t\tonActionStart( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tawait onConfirm( items );\n\t\t\t\t\t\t\tonActionPerformed?.( items );\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\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\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\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 isThemePattern = item.type === PATTERN_TYPES.theme;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern:\n\t\t\t\tisThemePattern || ! item.patternPost ? item : item.patternPost,\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 { 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\titem.title\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={ item.blocks }\n\t\t\t\tdefaultArea={ item.templatePart?.area || 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\titem.title\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\tpostTypeObject,\n\t\tresource,\n\t\tcachedCanUserResolvers,\n\t\tuserCanCreatePostType,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, getCachedResolvers, canUser } =\n\t\t\t\tselect( coreStore );\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\tresource: _resource,\n\t\t\t\tcachedCanUserResolvers: getCachedResolvers()?.canUser,\n\t\t\t\tuserCanCreatePostType: canUser( 'create', _resource ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\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\tisPattern && exportPatternAsJSONAction,\n\t\t\tisTemplateOrTemplatePart\n\t\t\t\t? resetTemplateAction\n\t\t\t\t: restorePostActionForPostType,\n\t\t\tisTemplateOrTemplatePart || isPattern\n\t\t\t\t? deletePostAction\n\t\t\t\t: trashPostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\tpermanentlyDeletePostActionForPostType,\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, _onActionPerformed ) => {\n\t\t\t\t\t\t\texistingCallback( items, ( _items ) => {\n\t\t\t\t\t\t\t\tif ( _onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t_onActionPerformed( _items );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonActionPerformed( actions[ i ].id, _items );\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\tisTemplateOrTemplatePart,\n\t\tisPattern,\n\t\tpostTypeObject?.viewable,\n\t\tpermanentlyDeletePostActionForPostType,\n\t\trestorePostActionForPostType,\n\t\trenamePostActionForPostType,\n\t\ttrashPostActionForPostType,\n\t\tonActionPerformed,\n\t\tisLoaded,\n\t\tsupportsRevisions,\n\t\tsupportsTitle,\n\t\tcontext,\n\t\tuserCanCreatePostType,\n\t\tcachedCanUserResolvers,\n\t] );\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,I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AM,IAAM;gBACtC,IAAKD,kBAAkB,EAAG;kBACzBA,kBAAkB,CAAEC,MAAO,CAAC;gBAC7B;gBACAhM,iBAAiB,CAAEuL,OAAO,CAAEM,CAAC,CAAE,CAAC/M,EAAE,EAAEkN,MAAO,CAAC;cAC7C,CAAE,CAAC;YACJ;UACD,CAAC;QACF;QACA,IAAKT,OAAO,CAAEM,CAAC,CAAE,CAACjM,WAAW,EAAG;UAC/B,MAAMqM,mBAAmB,GAAGV,OAAO,CAAEM,CAAC,CAAE,CAACjM,WAAW;UACpD2L,OAAO,CAAEM,CAAC,CAAE,GAAG;YACd,GAAGN,OAAO,CAAEM,CAAC,CAAE;YACfjM,WAAW,EAAIsM,KAAK,IAAM;cACzB,oBACC,IAAAxO,WAAA,CAAAiD,GAAA,EAACsL,mBAAmB;gBAAA,GACdC,KAAK;gBACVlM,iBAAiB,EAAKgM,MAAM,IAAM;kBACjC,IAAKE,KAAK,CAAClM,iBAAiB,EAAG;oBAC9BkM,KAAK,CAAClM,iBAAiB,CAAEgM,MAAO,CAAC;kBAClC;kBACAhM,iBAAiB,CAChBuL,OAAO,CAAEM,CAAC,CAAE,CAAC/M,EAAE,EACfkN,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOT,OAAO;IACd;IACA;IACA;EACD,CAAC,EAAE,CACFR,wBAAwB,EACxBC,SAAS,EACTd,cAAc,EAAEsB,QAAQ,EACxBZ,sCAAsC,EACtCE,4BAA4B,EAC5BD,2BAA2B,EAC3BF,0BAA0B,EAC1B3K,iBAAiB,EACjBkL,QAAQ,EACRC,iBAAiB,EACjBG,aAAa,EACb3G,OAAO,EACPyF,qBAAqB,EACrBD,sBAAsB,CACrB,CAAC;AACJ","ignoreList":[]}
@@ -30,8 +30,8 @@ function getJsonFromItem(item) {
30
30
  return JSON.stringify({
31
31
  __file: item.type,
32
32
  title: item.title || item.name,
33
- content: item.patternPost.content.raw,
34
- syncStatus: item.patternPost.wp_pattern_sync_status
33
+ content: item?.patternPost?.content?.raw || item.content,
34
+ syncStatus: item?.patternPost?.wp_pattern_sync_status || item.wp_pattern_sync_status
35
35
  }, null, 2);
36
36
  }
37
37
  const exportPatternAsJSONAction = exports.exportPatternAsJSONAction = {
@@ -1 +1 @@
1
- {"version":3,"names":["_changeCase","require","_clientZip","_blob","_i18n","_patterns","_lockUnlock","PATTERN_TYPES","unlock","patternsPrivateApis","getJsonFromItem","item","JSON","stringify","__file","type","title","name","content","patternPost","raw","syncStatus","wp_pattern_sync_status","exportPatternAsJSONAction","exports","id","label","__","supportsBulk","isEligible","user","callback","items","length","downloadBlob","kebabCase","nameCount","filesToZip","map","lastModified","Date","input","downloadZip","blob"],"sources":["@wordpress/editor/src/components/post-actions/export-pattern-action.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\nimport { downloadZip } from 'client-zip';\n\n/**\n * WordPress dependencies\n */\nimport { downloadBlob } from '@wordpress/blob';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\n// Patterns.\nconst { PATTERN_TYPES } = unlock( patternsPrivateApis );\n\nfunction getJsonFromItem( item ) {\n\treturn JSON.stringify(\n\t\t{\n\t\t\t__file: item.type,\n\t\t\ttitle: item.title || item.name,\n\t\t\tcontent: item.patternPost.content.raw,\n\t\t\tsyncStatus: item.patternPost.wp_pattern_sync_status,\n\t\t},\n\t\tnull,\n\t\t2\n\t);\n}\n\nexport const exportPatternAsJSONAction = {\n\tid: 'export-pattern',\n\tlabel: __( 'Export as JSON' ),\n\tsupportsBulk: true,\n\tisEligible: ( item ) => {\n\t\tif ( ! item.type ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn item.type === PATTERN_TYPES.user;\n\t},\n\tcallback: async ( items ) => {\n\t\tif ( items.length === 1 ) {\n\t\t\treturn downloadBlob(\n\t\t\t\t`${ kebabCase( items[ 0 ].title || items[ 0 ].name ) }.json`,\n\t\t\t\tgetJsonFromItem( items[ 0 ] ),\n\t\t\t\t'application/json'\n\t\t\t);\n\t\t}\n\t\tconst nameCount = {};\n\t\tconst filesToZip = items.map( ( item ) => {\n\t\t\tconst name = kebabCase( item.title || item.name );\n\t\t\tnameCount[ name ] = ( nameCount[ name ] || 0 ) + 1;\n\t\t\treturn {\n\t\t\t\tname: `${\n\t\t\t\t\tname +\n\t\t\t\t\t( nameCount[ name ] > 1\n\t\t\t\t\t\t? '-' + ( nameCount[ name ] - 1 )\n\t\t\t\t\t\t: '' )\n\t\t\t\t}.json`,\n\t\t\t\tlastModified: new Date(),\n\t\t\t\tinput: getJsonFromItem( item ),\n\t\t\t};\n\t\t} );\n\t\treturn downloadBlob(\n\t\t\t__( 'patterns-export' ) + '.zip',\n\t\t\tawait downloadZip( filesToZip ).blob(),\n\t\t\t'application/zip'\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA,MAAM;EAAEM;AAAc,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;AAEvD,SAASC,eAAeA,CAAEC,IAAI,EAAG;EAChC,OAAOC,IAAI,CAACC,SAAS,CACpB;IACCC,MAAM,EAAEH,IAAI,CAACI,IAAI;IACjBC,KAAK,EAAEL,IAAI,CAACK,KAAK,IAAIL,IAAI,CAACM,IAAI;IAC9BC,OAAO,EAAEP,IAAI,CAACQ,WAAW,CAACD,OAAO,CAACE,GAAG;IACrCC,UAAU,EAAEV,IAAI,CAACQ,WAAW,CAACG;EAC9B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,eAAe,CAAEC,IAAK;MAC9B,CAAC;IACF,CAAE,CAAC;IACH,OAAO,IAAAuB,kBAAY,EAClB,IAAAP,QAAE,EAAE,iBAAkB,CAAC,GAAG,MAAM,EAChC,MAAM,IAAAe,sBAAW,EAAEL,UAAW,CAAC,CAACM,IAAI,CAAC,CAAC,EACtC,iBACD,CAAC;EACF;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_changeCase","require","_clientZip","_blob","_i18n","_patterns","_lockUnlock","PATTERN_TYPES","unlock","patternsPrivateApis","getJsonFromItem","item","JSON","stringify","__file","type","title","name","content","patternPost","raw","syncStatus","wp_pattern_sync_status","exportPatternAsJSONAction","exports","id","label","__","supportsBulk","isEligible","user","callback","items","length","downloadBlob","kebabCase","nameCount","filesToZip","map","lastModified","Date","input","downloadZip","blob"],"sources":["@wordpress/editor/src/components/post-actions/export-pattern-action.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\nimport { downloadZip } from 'client-zip';\n\n/**\n * WordPress dependencies\n */\nimport { downloadBlob } from '@wordpress/blob';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\n// Patterns.\nconst { PATTERN_TYPES } = unlock( patternsPrivateApis );\n\nfunction getJsonFromItem( item ) {\n\treturn JSON.stringify(\n\t\t{\n\t\t\t__file: item.type,\n\t\t\ttitle: item.title || item.name,\n\t\t\tcontent: item?.patternPost?.content?.raw || item.content,\n\t\t\tsyncStatus:\n\t\t\t\titem?.patternPost?.wp_pattern_sync_status ||\n\t\t\t\titem.wp_pattern_sync_status,\n\t\t},\n\t\tnull,\n\t\t2\n\t);\n}\n\nexport const exportPatternAsJSONAction = {\n\tid: 'export-pattern',\n\tlabel: __( 'Export as JSON' ),\n\tsupportsBulk: true,\n\tisEligible: ( item ) => {\n\t\tif ( ! item.type ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn item.type === PATTERN_TYPES.user;\n\t},\n\tcallback: async ( items ) => {\n\t\tif ( items.length === 1 ) {\n\t\t\treturn downloadBlob(\n\t\t\t\t`${ kebabCase( items[ 0 ].title || items[ 0 ].name ) }.json`,\n\t\t\t\tgetJsonFromItem( items[ 0 ] ),\n\t\t\t\t'application/json'\n\t\t\t);\n\t\t}\n\t\tconst nameCount = {};\n\t\tconst filesToZip = items.map( ( item ) => {\n\t\t\tconst name = kebabCase( item.title || item.name );\n\t\t\tnameCount[ name ] = ( nameCount[ name ] || 0 ) + 1;\n\t\t\treturn {\n\t\t\t\tname: `${\n\t\t\t\t\tname +\n\t\t\t\t\t( nameCount[ name ] > 1\n\t\t\t\t\t\t? '-' + ( nameCount[ name ] - 1 )\n\t\t\t\t\t\t: '' )\n\t\t\t\t}.json`,\n\t\t\t\tlastModified: new Date(),\n\t\t\t\tinput: getJsonFromItem( item ),\n\t\t\t};\n\t\t} );\n\t\treturn downloadBlob(\n\t\t\t__( 'patterns-export' ) + '.zip',\n\t\t\tawait downloadZip( filesToZip ).blob(),\n\t\t\t'application/zip'\n\t\t);\n\t},\n};\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA,MAAM;EAAEM;AAAc,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;AAEvD,SAASC,eAAeA,CAAEC,IAAI,EAAG;EAChC,OAAOC,IAAI,CAACC,SAAS,CACpB;IACCC,MAAM,EAAEH,IAAI,CAACI,IAAI;IACjBC,KAAK,EAAEL,IAAI,CAACK,KAAK,IAAIL,IAAI,CAACM,IAAI;IAC9BC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AG,CAAC,GACpB,GAAG,IAAKmB,SAAS,CAAEnB,IAAI,CAAE,GAAG,CAAC,CAAE,GAC/B,EAAE,CACL,OAAM;QACPsB,YAAY,EAAE,IAAIC,IAAI,CAAC,CAAC;QACxBC,KAAK,EAAE/B,eAAe,CAAEC,IAAK;MAC9B,CAAC;IACF,CAAE,CAAC;IACH,OAAO,IAAAuB,kBAAY,EAClB,IAAAP,QAAE,EAAE,iBAAkB,CAAC,GAAG,MAAM,EAChC,MAAM,IAAAe,sBAAW,EAAEL,UAAW,CAAC,CAACM,IAAI,CAAC,CAAC,EACtC,iBACD,CAAC;EACF;AACD,CAAC","ignoreList":[]}
@@ -14,6 +14,7 @@ var _i18n = require("@wordpress/i18n");
14
14
  var _icons = require("@wordpress/icons");
15
15
  var _keycodes = require("@wordpress/keycodes");
16
16
  var _preferences = require("@wordpress/preferences");
17
+ var _postStatus = require("../../components/post-status");
17
18
  var _store = require("../../store");
18
19
  var _jsxRuntime = require("react/jsx-runtime");
19
20
  /**
@@ -105,7 +106,16 @@ var _jsxRuntime = require("react/jsx-runtime");
105
106
  if (!hasPublishAction && isPending) {
106
107
  return null;
107
108
  }
108
- if (isPublished || isScheduled || !['pending', 'draft', 'auto-draft'].includes(postStatus) || postStatusHasChanged && ['pending', 'draft'].includes(postStatus)) {
109
+
110
+ // We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft.
111
+ // The reason for this is that this button handles the `save as pending` and `save draft` actions.
112
+ // An exception for this is when the post has a custom status and there should be a way to save changes without
113
+ // having to publish. This should be handled better in the future when custom statuses have better support.
114
+ // @see https://github.com/WordPress/gutenberg/issues/3144.
115
+ const isIneligibleStatus = !['pending', 'draft', 'auto-draft'].includes(postStatus) && _postStatus.STATUS_OPTIONS.map(({
116
+ value
117
+ }) => value).includes(postStatus);
118
+ if (isPublished || isScheduled || isIneligibleStatus || postStatusHasChanged && ['pending', 'draft'].includes(postStatus)) {
109
119
  return null;
110
120
  }
111
121
 
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_preferences","_store","_jsxRuntime","PostSavedState","forceIsDirty","forceSavedMessage","setForceSavedMessage","useState","isLargeViewport","useViewportMatch","isAutosaving","isDirty","isNew","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","showIconLabels","postStatus","postStatusHasChanged","useSelect","select","_getCurrentPost$_link","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","getPostEdits","editorStore","get","preferencesStore","_links","status","isPending","savePost","useDispatch","wasSaving","usePrevious","useEffect","timeoutId","setTimeout","clearTimeout","includes","label","__","shortLabel","isSaved","isSavedState","isDisabled","text","jsxs","Button","className","clsx","getAnimateClassName","type","undefined","onClick","shortcut","displayShortcut","primary","variant","size","icon","cloudUpload","children","jsx","Icon","check","cloud"],"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @return {import('react').ComponentType} The component.\n */\nexport default function PostSavedState( { forceIsDirty } ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t\tshowIconLabels,\n\t\tpostStatus,\n\t\tpostStatusHasChanged,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetPostEdits,\n\t\t\t} = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t\tpostStatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tpostStatusHasChanged: !! getPostEdits()?.status,\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty ]\n\t);\n\tconst isPending = postStatus === 'pending';\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\tif (\n\t\tisPublished ||\n\t\tisScheduled ||\n\t\t! [ 'pending', 'draft', 'auto-draft' ].includes( postStatus ) ||\n\t\t( postStatusHasChanged &&\n\t\t\t[ 'pending', 'draft' ].includes( postStatus ) )\n\t) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled = isSaving || isSaved || ! isSaveable;\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Button\n\t\t\tclassName={\n\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t? clsx( {\n\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\tvariant=\"tertiary\"\n\t\t\tsize=\"compact\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\tlabel={ text || label }\n\t\t\taria-disabled={ isDisabled }\n\t\t>\n\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t{ text }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AAAmD,IAAAU,WAAA,GAAAV,OAAA;AAvBnD;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASW,cAAcA,CAAE;EAAEC;AAAa,CAAC,EAAG;EAC1D,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACrE,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,OAAQ,CAAC;EAEnD,MAAM;IACLC,YAAY;IACZC,OAAO;IACPC,KAAK;IACLC,WAAW;IACXC,UAAU;IACVC,QAAQ;IACRC,WAAW;IACXC,gBAAgB;IAChBC,cAAc;IACdC,UAAU;IACVC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AC,MAAM,IAAK1C,eAAe,EAAG;IAC7B+C,IAAI,GAAGN,KAAK;EACb,CAAC,MAAM,IAAK/B,cAAc,EAAG;IAC5BqC,IAAI,GAAGJ,UAAU;EAClB;;EAEA;EACA;EACA,oBACC,IAAAjD,WAAA,CAAAsD,IAAA,EAAC/D,WAAA,CAAAgE,MAAM;IACNC,SAAS,EACR5C,UAAU,IAAIC,QAAQ,GACnB,IAAA4C,aAAI,EAAE;MACN,wBAAwB,EAAE,CAAEN,YAAY;MACxC,yBAAyB,EAAEA,YAAY;MACvC,WAAW,EAAEtC,QAAQ;MACrB,eAAe,EAAEL,YAAY;MAC7B,UAAU,EAAE0C,OAAO;MACnB,CAAE,IAAAQ,yCAAmB,EAAE;QACtBC,IAAI,EAAE;MACP,CAAE,CAAC,GAAI9C;IACP,CAAE,CAAC,GACH+C,SACH;IACDC,OAAO,EAAGT,UAAU,GAAGQ,SAAS,GAAG,MAAMtB,QAAQ,CAAC;IAClD;AACH;AACA;AACA,OAHG;IAIAwB,QAAQ,EAAGV,UAAU,GAAGQ,SAAS,GAAGG,yBAAe,CAACC,OAAO,CAAE,GAAI,CAAG;IACpEC,OAAO,EAAC,UAAU;IAClBC,IAAI,EAAC,SAAS;IACdC,IAAI,EAAG7D,eAAe,GAAGsD,SAAS,GAAGQ,kBAAa;IAClDrB,KAAK,EAAGM,IAAI,IAAIN,KAAO;IACvB,iBAAgBK,UAAY;IAAAiB,QAAA,GAE1BlB,YAAY,iBAAI,IAAAnD,WAAA,CAAAsE,GAAA,EAAC1E,MAAA,CAAA2E,IAAI;MAACJ,IAAI,EAAGjB,OAAO,GAAGsB,YAAK,GAAGC;IAAO,CAAE,CAAC,EACzDpB,IAAI;EAAA,CACC,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_preferences","_postStatus","_store","_jsxRuntime","PostSavedState","forceIsDirty","forceSavedMessage","setForceSavedMessage","useState","isLargeViewport","useViewportMatch","isAutosaving","isDirty","isNew","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","showIconLabels","postStatus","postStatusHasChanged","useSelect","select","_getCurrentPost$_link","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","getPostEdits","editorStore","get","preferencesStore","_links","status","isPending","savePost","useDispatch","wasSaving","usePrevious","useEffect","timeoutId","setTimeout","clearTimeout","isIneligibleStatus","includes","STATUS_OPTIONS","map","value","label","__","shortLabel","isSaved","isSavedState","isDisabled","text","jsxs","Button","className","clsx","getAnimateClassName","type","undefined","onClick","shortcut","displayShortcut","primary","variant","size","icon","cloudUpload","children","jsx","Icon","check","cloud"],"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STATUS_OPTIONS } from '../../components/post-status';\nimport { store as editorStore } from '../../store';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @return {import('react').ComponentType} The component.\n */\nexport default function PostSavedState( { forceIsDirty } ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t\tshowIconLabels,\n\t\tpostStatus,\n\t\tpostStatusHasChanged,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetPostEdits,\n\t\t\t} = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t\tpostStatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tpostStatusHasChanged: !! getPostEdits()?.status,\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty ]\n\t);\n\tconst isPending = postStatus === 'pending';\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\t// We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft.\n\t// The reason for this is that this button handles the `save as pending` and `save draft` actions.\n\t// An exception for this is when the post has a custom status and there should be a way to save changes without\n\t// having to publish. This should be handled better in the future when custom statuses have better support.\n\t// @see https://github.com/WordPress/gutenberg/issues/3144.\n\tconst isIneligibleStatus =\n\t\t! [ 'pending', 'draft', 'auto-draft' ].includes( postStatus ) &&\n\t\tSTATUS_OPTIONS.map( ( { value } ) => value ).includes( postStatus );\n\n\tif (\n\t\tisPublished ||\n\t\tisScheduled ||\n\t\tisIneligibleStatus ||\n\t\t( postStatusHasChanged &&\n\t\t\t[ 'pending', 'draft' ].includes( postStatus ) )\n\t) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled = isSaving || isSaved || ! isSaveable;\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Button\n\t\t\tclassName={\n\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t? clsx( {\n\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\tvariant=\"tertiary\"\n\t\t\tsize=\"compact\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\tlabel={ text || label }\n\t\t\taria-disabled={ isDisabled }\n\t\t>\n\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t{ text }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAAmD,IAAAW,WAAA,GAAAX,OAAA;AAxBnD;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASY,cAAcA,CAAE;EAAEC;AAAa,CAAC,EAAG;EAC1D,MAAM,CAAEC,iBAAiB,EAAEC,oBAAoB,CAA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Aa;IAClDrB,KAAK,EAAGM,IAAI,IAAIN,KAAO;IACvB,iBAAgBK,UAAY;IAAAiB,QAAA,GAE1BlB,YAAY,iBAAI,IAAAvD,WAAA,CAAA0E,GAAA,EAAC/E,MAAA,CAAAgF,IAAI;MAACJ,IAAI,EAAGjB,OAAO,GAAGsB,YAAK,GAAGC;IAAO,CAAE,CAAC,EACzDpB,IAAI;EAAA,CACC,CAAC;AAEX","ignoreList":[]}
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ exports.STATUS_OPTIONS = void 0;
7
8
  exports.default = PostStatus;
8
9
  var _components = require("@wordpress/components");
9
10
  var _i18n = require("@wordpress/i18n");
@@ -33,7 +34,7 @@ const labels = {
33
34
  future: (0, _i18n.__)('Scheduled'),
34
35
  publish: (0, _i18n.__)('Published')
35
36
  };
36
- const STATUS_OPTIONS = [{
37
+ const STATUS_OPTIONS = exports.STATUS_OPTIONS = [{
37
38
  label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
38
39
  children: [(0, _i18n.__)('Draft'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
39
40
  variant: "muted",
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_blockEditor","_compose","_constants","_postPanelRow","_interopRequireDefault","_postSchedule","_store","_jsxRuntime","labels","__","draft","pending","private","future","publish","STATUS_OPTIONS","label","jsxs","Fragment","children","jsx","__experimentalText","variant","size","value","DESIGN_POST_TYPES","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","NAVIGATION_POST_TYPE","PostStatus","status","date","password","postId","postType","canEdit","useSelect","select","_getCurrentPost$_link","getEditedPostAttribute","getCurrentPostId","getCurrentPostType","getCurrentPost","editorStore","_links","showPassword","setShowPassword","useState","passwordInputId","useInstanceId","editEntityRecord","useDispatch","coreStore","popoverAnchor","setPopoverAnchor","popoverProps","useMemo","anchor","headerTitle","placement","offset","shift","includes","updatePost","newStatus","newPassword","newDate","handleTogglePassword","handleStatus","Date","default","ref","Dropdown","className","contentClassName","focusOnMount","renderToggle","onToggle","Button","onClick","sprintf","renderContent","onClose","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","RadioControl","hideLabelFromVision","options","onChange","selected","PrivatePostSchedule","showPopoverHeaderActions","isCompact","as","CheckboxControl","__nextHasNoMarginBottom","help","checked","TextControl","placeholder","type","id","__next40pxDefaultSize"],"sources":["@wordpress/editor/src/components/post-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCheckboxControl,\n\tDropdown,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tTextControl,\n\tRadioControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport PostPanelRow from '../post-panel-row';\nimport { PrivatePostSchedule } from '../post-schedule';\nimport { store as editorStore } from '../../store';\n\nconst labels = {\n\t'auto-draft': __( 'Draft' ),\n\tdraft: __( 'Draft' ),\n\tpending: __( 'Pending' ),\n\tprivate: __( 'Private' ),\n\tfuture: __( 'Scheduled' ),\n\tpublish: __( 'Published' ),\n};\n\nconst STATUS_OPTIONS = [\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Draft' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Not ready to publish.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'draft',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Pending' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Waiting for review before publishing.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'pending',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Private' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Only visible to site admins and editors.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'private',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Scheduled' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Publish automatically on a chosen date.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'future',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Published' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Visible to everyone.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'publish',\n\t},\n];\n\nconst DESIGN_POST_TYPES = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n];\n\nexport default function PostStatus() {\n\tconst { status, date, password, postId, postType, canEdit } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPost,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tstatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tdate: getEditedPostAttribute( 'date' ),\n\t\t\t\tpassword: getEditedPostAttribute( 'password' ),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tcanEdit:\n\t\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ showPassword, setShowPassword ] = useState( !! password );\n\tconst passwordInputId = useInstanceId(\n\t\tPostStatus,\n\t\t'editor-change-status__password-input'\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\t'aria-label': __( 'Status & visibility' ),\n\t\t\theaderTitle: __( 'Status & visibility' ),\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( DESIGN_POST_TYPES.includes( postType ) ) {\n\t\treturn null;\n\t}\n\n\tconst updatePost = ( {\n\t\tstatus: newStatus = status,\n\t\tpassword: newPassword = password,\n\t\tdate: newDate = date,\n\t} ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tstatus: newStatus,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\tconst handleTogglePassword = ( value ) => {\n\t\tsetShowPassword( value );\n\t\tif ( ! value ) {\n\t\t\tupdatePost( { password: '' } );\n\t\t}\n\t};\n\n\tconst handleStatus = ( value ) => {\n\t\tlet newDate = date;\n\t\tlet newPassword = password;\n\t\tif ( status === 'future' && new Date( date ) > new Date() ) {\n\t\t\tnewDate = null;\n\t\t}\n\t\tif ( value === 'private' && password ) {\n\t\t\tnewPassword = '';\n\t\t}\n\t\tupdatePost( {\n\t\t\tstatus: value,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Status' ) } ref={ setPopoverAnchor }>\n\t\t\t{ canEdit ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tclassName=\"editor-post-status\"\n\t\t\t\t\tcontentClassName=\"editor-change-status__content\"\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Current post status.\n\t\t\t\t\t\t\t\t__( 'Change post status: %s' ),\n\t\t\t\t\t\t\t\tlabels[ status ]\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels[ status ] }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Status & visibility' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Status' ) }\n\t\t\t\t\t\t\t\t\t\toptions={ STATUS_OPTIONS }\n\t\t\t\t\t\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\t\t\t\tstatus === 'auto-draft'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'draft'\n\t\t\t\t\t\t\t\t\t\t\t\t: status\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{ status === 'future' && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__publish-date-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<PrivatePostSchedule\n\t\t\t\t\t\t\t\t\t\t\t\tshowPopoverHeaderActions={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tisCompact\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ status !== 'private' && (\n\t\t\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\t\t\tas=\"fieldset\"\n\t\t\t\t\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__password-fieldset\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Password protected'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Only visible to those who know the password'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tchecked={ showPassword }\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t\t\t\t\thandleTogglePassword\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ showPassword && (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__password-input\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatePost( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpassword: value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Use a secure password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ passwordInputId }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</form>\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\t\t<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AA,EAAC1B,WAAA,CAAA2G,WAAW;kBACXrF,KAAK,EAAG,IAAAP,QAAE,EACT,UACD,CAAG;kBACHkF,QAAQ,EAAKnE,KAAK,IACjBwC,UAAU,CAAE;oBACX/B,QAAQ,EAAET;kBACX,CAAE,CACF;kBACDA,KAAK,EAAGS,QAAU;kBAClBqE,WAAW,EAAG,IAAA7F,QAAE,EACf,uBACD,CAAG;kBACH8F,IAAI,EAAC,MAAM;kBACXC,EAAE,EAAGvD,eAAiB;kBACtBwD,qBAAqB;kBACrBP,uBAAuB;gBAAA,CACvB;cAAC,CACE,CACL;YAAA,CACM,CACR;UAAA,CACM;QAAC,CACJ,CAAC;MAAA,CACN;IACA,CACH,CAAC,gBAEF,IAAA3F,WAAA,CAAAa,GAAA;MAAKsD,SAAS,EAAC,iCAAiC;MAAAvD,QAAA,EAC7CX,MAAM,CAAEuB,MAAM;IAAE,CACd;EACL,CACY,CAAC;AAEjB","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_element","_coreData","_blockEditor","_compose","_constants","_postPanelRow","_interopRequireDefault","_postSchedule","_store","_jsxRuntime","labels","__","draft","pending","private","future","publish","STATUS_OPTIONS","exports","label","jsxs","Fragment","children","jsx","__experimentalText","variant","size","value","DESIGN_POST_TYPES","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","NAVIGATION_POST_TYPE","PostStatus","status","date","password","postId","postType","canEdit","useSelect","select","_getCurrentPost$_link","getEditedPostAttribute","getCurrentPostId","getCurrentPostType","getCurrentPost","editorStore","_links","showPassword","setShowPassword","useState","passwordInputId","useInstanceId","editEntityRecord","useDispatch","coreStore","popoverAnchor","setPopoverAnchor","popoverProps","useMemo","anchor","headerTitle","placement","offset","shift","includes","updatePost","newStatus","newPassword","newDate","handleTogglePassword","handleStatus","Date","default","ref","Dropdown","className","contentClassName","focusOnMount","renderToggle","onToggle","Button","onClick","sprintf","renderContent","onClose","__experimentalInspectorPopoverHeader","title","__experimentalVStack","spacing","RadioControl","hideLabelFromVision","options","onChange","selected","PrivatePostSchedule","showPopoverHeaderActions","isCompact","as","CheckboxControl","__nextHasNoMarginBottom","help","checked","TextControl","placeholder","type","id","__next40pxDefaultSize"],"sources":["@wordpress/editor/src/components/post-status/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tCheckboxControl,\n\tDropdown,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tTextControl,\n\tRadioControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../../store/constants';\nimport PostPanelRow from '../post-panel-row';\nimport { PrivatePostSchedule } from '../post-schedule';\nimport { store as editorStore } from '../../store';\n\nconst labels = {\n\t'auto-draft': __( 'Draft' ),\n\tdraft: __( 'Draft' ),\n\tpending: __( 'Pending' ),\n\tprivate: __( 'Private' ),\n\tfuture: __( 'Scheduled' ),\n\tpublish: __( 'Published' ),\n};\n\nexport const STATUS_OPTIONS = [\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Draft' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Not ready to publish.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'draft',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Pending' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Waiting for review before publishing.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'pending',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Private' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Only visible to site admins and editors.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'private',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Scheduled' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Publish automatically on a chosen date.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'future',\n\t},\n\t{\n\t\tlabel: (\n\t\t\t<>\n\t\t\t\t{ __( 'Published' ) }\n\t\t\t\t<Text variant=\"muted\" size={ 12 }>\n\t\t\t\t\t{ __( 'Visible to everyone.' ) }\n\t\t\t\t</Text>\n\t\t\t</>\n\t\t),\n\t\tvalue: 'publish',\n\t},\n];\n\nconst DESIGN_POST_TYPES = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n];\n\nexport default function PostStatus() {\n\tconst { status, date, password, postId, postType, canEdit } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t\tgetCurrentPostId,\n\t\t\t\tgetCurrentPostType,\n\t\t\t\tgetCurrentPost,\n\t\t\t} = select( editorStore );\n\t\t\treturn {\n\t\t\t\tstatus: getEditedPostAttribute( 'status' ),\n\t\t\t\tdate: getEditedPostAttribute( 'date' ),\n\t\t\t\tpassword: getEditedPostAttribute( 'password' ),\n\t\t\t\tpostId: getCurrentPostId(),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t\tcanEdit:\n\t\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ showPassword, setShowPassword ] = useState( !! password );\n\tconst passwordInputId = useInstanceId(\n\t\tPostStatus,\n\t\t'editor-change-status__password-input'\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\t'aria-label': __( 'Status & visibility' ),\n\t\t\theaderTitle: __( 'Status & visibility' ),\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tif ( DESIGN_POST_TYPES.includes( postType ) ) {\n\t\treturn null;\n\t}\n\n\tconst updatePost = ( {\n\t\tstatus: newStatus = status,\n\t\tpassword: newPassword = password,\n\t\tdate: newDate = date,\n\t} ) => {\n\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\tstatus: newStatus,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\tconst handleTogglePassword = ( value ) => {\n\t\tsetShowPassword( value );\n\t\tif ( ! value ) {\n\t\t\tupdatePost( { password: '' } );\n\t\t}\n\t};\n\n\tconst handleStatus = ( value ) => {\n\t\tlet newDate = date;\n\t\tlet newPassword = password;\n\t\tif ( status === 'future' && new Date( date ) > new Date() ) {\n\t\t\tnewDate = null;\n\t\t}\n\t\tif ( value === 'private' && password ) {\n\t\t\tnewPassword = '';\n\t\t}\n\t\tupdatePost( {\n\t\t\tstatus: value,\n\t\t\tdate: newDate,\n\t\t\tpassword: newPassword,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Status' ) } ref={ setPopoverAnchor }>\n\t\t\t{ canEdit ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tclassName=\"editor-post-status\"\n\t\t\t\t\tcontentClassName=\"editor-change-status__content\"\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Current post status.\n\t\t\t\t\t\t\t\t__( 'Change post status: %s' ),\n\t\t\t\t\t\t\t\tlabels[ status ]\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels[ status ] }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Status & visibility' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<RadioControl\n\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__options\"\n\t\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Status' ) }\n\t\t\t\t\t\t\t\t\t\toptions={ STATUS_OPTIONS }\n\t\t\t\t\t\t\t\t\t\tonChange={ handleStatus }\n\t\t\t\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\t\t\t\tstatus === 'auto-draft'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'draft'\n\t\t\t\t\t\t\t\t\t\t\t\t: status\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{ status === 'future' && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__publish-date-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<PrivatePostSchedule\n\t\t\t\t\t\t\t\t\t\t\t\tshowPopoverHeaderActions={\n\t\t\t\t\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tisCompact\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ status !== 'private' && (\n\t\t\t\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\t\t\t\tas=\"fieldset\"\n\t\t\t\t\t\t\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"editor-change-status__password-fieldset\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Password protected'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Only visible to those who know the password'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tchecked={ showPassword }\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t\t\t\t\thandleTogglePassword\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t{ showPassword && (\n\t\t\t\t\t\t\t\t\t\t\t\t<div className=\"editor-change-status__password-input\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatePost( {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tpassword: value,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={ password }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Use a secure password'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid={ passwordInputId }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</form>\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\t\t<div className=\"editor-post-status is-read-only\">\n\t\t\t\t\t{ labels[ status ] }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</PostPanelRow>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AASA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAA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