@wordpress/fields 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +20 -0
  3. package/build/actions/delete-post.js +130 -0
  4. package/build/actions/delete-post.js.map +1 -0
  5. package/build/actions/{pattern/duplicate-pattern.js → duplicate-pattern.js} +1 -1
  6. package/build/actions/duplicate-pattern.js.map +1 -0
  7. package/build/actions/{base-post/duplicate-post.js → duplicate-post.js} +2 -2
  8. package/build/actions/duplicate-post.js.map +1 -0
  9. package/build/actions/duplicate-post.native.js.map +1 -0
  10. package/build/actions/{pattern/export-pattern.js → export-pattern.js} +1 -1
  11. package/build/actions/export-pattern.js.map +1 -0
  12. package/build/actions/export-pattern.native.js.map +1 -0
  13. package/build/actions/index.js +105 -32
  14. package/build/actions/index.js.map +1 -1
  15. package/build/actions/{common/permanently-delete-post.js → permanently-delete-post.js} +1 -1
  16. package/build/actions/permanently-delete-post.js.map +1 -0
  17. package/build/actions/rename-post.js +124 -0
  18. package/build/actions/rename-post.js.map +1 -0
  19. package/build/actions/{base-post/reorder-page.js → reorder-page.js} +1 -1
  20. package/build/actions/reorder-page.js.map +1 -0
  21. package/build/actions/reorder-page.native.js.map +1 -0
  22. package/build/actions/reset-post.js +206 -0
  23. package/build/actions/reset-post.js.map +1 -0
  24. package/build/actions/restore-post.js +112 -0
  25. package/build/actions/restore-post.js.map +1 -0
  26. package/build/actions/trash-post.js +144 -0
  27. package/build/actions/trash-post.js.map +1 -0
  28. package/build/actions/view-post-revisions.js.map +1 -0
  29. package/build/actions/view-post.js.map +1 -0
  30. package/build/index.native.js +2 -2
  31. package/build/index.native.js.map +1 -1
  32. package/build/mutation/index.js +139 -0
  33. package/build/mutation/index.js.map +1 -0
  34. package/build/types.js.map +1 -1
  35. package/build-module/actions/delete-post.js +123 -0
  36. package/build-module/actions/delete-post.js.map +1 -0
  37. package/build-module/actions/{pattern/duplicate-pattern.js → duplicate-pattern.js} +1 -1
  38. package/build-module/actions/duplicate-pattern.js.map +1 -0
  39. package/build-module/actions/{base-post/duplicate-post.js → duplicate-post.js} +2 -2
  40. package/build-module/actions/duplicate-post.js.map +1 -0
  41. package/build-module/actions/duplicate-post.native.js.map +1 -0
  42. package/build-module/actions/{pattern/export-pattern.js → export-pattern.js} +1 -1
  43. package/build-module/actions/export-pattern.js.map +1 -0
  44. package/build-module/actions/export-pattern.native.js.map +1 -0
  45. package/build-module/actions/index.js +15 -3
  46. package/build-module/actions/index.js.map +1 -1
  47. package/build-module/actions/{common/permanently-delete-post.js → permanently-delete-post.js} +1 -1
  48. package/build-module/actions/permanently-delete-post.js.map +1 -0
  49. package/build-module/actions/rename-post.js +118 -0
  50. package/build-module/actions/rename-post.js.map +1 -0
  51. package/build-module/actions/{base-post/reorder-page.js → reorder-page.js} +1 -1
  52. package/build-module/actions/reorder-page.js.map +1 -0
  53. package/build-module/actions/reorder-page.native.js.map +1 -0
  54. package/build-module/actions/reset-post.js +198 -0
  55. package/build-module/actions/reset-post.js.map +1 -0
  56. package/build-module/actions/restore-post.js +104 -0
  57. package/build-module/actions/restore-post.js.map +1 -0
  58. package/build-module/actions/trash-post.js +137 -0
  59. package/build-module/actions/trash-post.js.map +1 -0
  60. package/build-module/actions/view-post-revisions.js.map +1 -0
  61. package/build-module/actions/view-post.js.map +1 -0
  62. package/build-module/index.native.js +2 -2
  63. package/build-module/index.native.js.map +1 -1
  64. package/build-module/mutation/index.js +131 -0
  65. package/build-module/mutation/index.js.map +1 -0
  66. package/build-module/types.js.map +1 -1
  67. package/build-types/actions/delete-post.d.ts +5 -0
  68. package/build-types/actions/delete-post.d.ts.map +1 -0
  69. package/build-types/actions/{pattern/duplicate-pattern.d.ts → duplicate-pattern.d.ts} +1 -1
  70. package/build-types/actions/duplicate-pattern.d.ts.map +1 -0
  71. package/build-types/actions/{base-post/duplicate-post.d.ts → duplicate-post.d.ts} +1 -1
  72. package/build-types/actions/duplicate-post.d.ts.map +1 -0
  73. package/build-types/actions/duplicate-post.native.d.ts.map +1 -0
  74. package/build-types/actions/{pattern/export-pattern.d.ts → export-pattern.d.ts} +1 -1
  75. package/build-types/actions/export-pattern.d.ts.map +1 -0
  76. package/build-types/actions/export-pattern.native.d.ts.map +1 -0
  77. package/build-types/actions/index.d.ts +15 -3
  78. package/build-types/actions/index.d.ts.map +1 -1
  79. package/build-types/actions/{common/permanently-delete-post.d.ts → permanently-delete-post.d.ts} +1 -1
  80. package/build-types/actions/permanently-delete-post.d.ts.map +1 -0
  81. package/build-types/actions/rename-post.d.ts +5 -0
  82. package/build-types/actions/rename-post.d.ts.map +1 -0
  83. package/build-types/actions/{base-post/reorder-page.d.ts → reorder-page.d.ts} +1 -1
  84. package/build-types/actions/reorder-page.d.ts.map +1 -0
  85. package/build-types/actions/reorder-page.native.d.ts.map +1 -0
  86. package/build-types/actions/reset-post.d.ts +5 -0
  87. package/build-types/actions/reset-post.d.ts.map +1 -0
  88. package/build-types/actions/restore-post.d.ts +5 -0
  89. package/build-types/actions/restore-post.d.ts.map +1 -0
  90. package/build-types/actions/trash-post.d.ts +5 -0
  91. package/build-types/actions/trash-post.d.ts.map +1 -0
  92. package/build-types/actions/{common/view-post-revisions.d.ts → view-post-revisions.d.ts} +1 -1
  93. package/build-types/actions/view-post-revisions.d.ts.map +1 -0
  94. package/build-types/actions/{base-post/view-post.d.ts → view-post.d.ts} +1 -1
  95. package/build-types/actions/view-post.d.ts.map +1 -0
  96. package/build-types/index.native.d.ts +2 -2
  97. package/build-types/index.native.d.ts.map +1 -1
  98. package/build-types/mutation/index.d.ts +34 -0
  99. package/build-types/mutation/index.d.ts.map +1 -0
  100. package/build-types/types.d.ts +1 -0
  101. package/build-types/types.d.ts.map +1 -1
  102. package/package.json +21 -20
  103. package/src/actions/delete-post.tsx +203 -0
  104. package/src/actions/{pattern/duplicate-pattern.tsx → duplicate-pattern.tsx} +2 -2
  105. package/src/actions/{base-post/duplicate-post.tsx → duplicate-post.tsx} +3 -3
  106. package/src/actions/{pattern/export-pattern.tsx → export-pattern.tsx} +2 -2
  107. package/src/actions/index.ts +15 -3
  108. package/src/actions/{common/permanently-delete-post.tsx → permanently-delete-post.tsx} +2 -2
  109. package/src/actions/rename-post.tsx +145 -0
  110. package/src/actions/{base-post/reorder-page.tsx → reorder-page.tsx} +2 -2
  111. package/src/actions/reset-post.tsx +300 -0
  112. package/src/actions/restore-post.tsx +134 -0
  113. package/src/actions/trash-post.tsx +198 -0
  114. package/src/actions/{common/view-post-revisions.tsx → view-post-revisions.tsx} +1 -1
  115. package/src/actions/{base-post/view-post.tsx → view-post.tsx} +1 -1
  116. package/src/index.native.ts +2 -2
  117. package/src/mutation/index.ts +184 -0
  118. package/src/types.ts +1 -0
  119. package/tsconfig.json +2 -2
  120. package/tsconfig.tsbuildinfo +1 -1
  121. package/build/actions/base-post/duplicate-post.js.map +0 -1
  122. package/build/actions/base-post/duplicate-post.native.js.map +0 -1
  123. package/build/actions/base-post/index.js +0 -42
  124. package/build/actions/base-post/index.js.map +0 -1
  125. package/build/actions/base-post/reorder-page.js.map +0 -1
  126. package/build/actions/base-post/reorder-page.native.js.map +0 -1
  127. package/build/actions/base-post/view-post.js.map +0 -1
  128. package/build/actions/common/index.js +0 -21
  129. package/build/actions/common/index.js.map +0 -1
  130. package/build/actions/common/permanently-delete-post.js.map +0 -1
  131. package/build/actions/common/view-post-revisions.js.map +0 -1
  132. package/build/actions/pattern/duplicate-pattern.js.map +0 -1
  133. package/build/actions/pattern/export-pattern.js.map +0 -1
  134. package/build/actions/pattern/export-pattern.native.js.map +0 -1
  135. package/build/actions/pattern/index.js +0 -28
  136. package/build/actions/pattern/index.js.map +0 -1
  137. package/build/wordpress-editor.d.js +0 -2
  138. package/build/wordpress-editor.d.js.map +0 -1
  139. package/build-module/actions/base-post/duplicate-post.js.map +0 -1
  140. package/build-module/actions/base-post/duplicate-post.native.js.map +0 -1
  141. package/build-module/actions/base-post/index.js +0 -6
  142. package/build-module/actions/base-post/index.js.map +0 -1
  143. package/build-module/actions/base-post/reorder-page.js.map +0 -1
  144. package/build-module/actions/base-post/reorder-page.native.js.map +0 -1
  145. package/build-module/actions/base-post/view-post.js.map +0 -1
  146. package/build-module/actions/common/index.js +0 -3
  147. package/build-module/actions/common/index.js.map +0 -1
  148. package/build-module/actions/common/permanently-delete-post.js.map +0 -1
  149. package/build-module/actions/common/view-post-revisions.js.map +0 -1
  150. package/build-module/actions/pattern/duplicate-pattern.js.map +0 -1
  151. package/build-module/actions/pattern/export-pattern.js.map +0 -1
  152. package/build-module/actions/pattern/export-pattern.native.js.map +0 -1
  153. package/build-module/actions/pattern/index.js +0 -4
  154. package/build-module/actions/pattern/index.js.map +0 -1
  155. package/build-module/wordpress-editor.d.js +0 -2
  156. package/build-module/wordpress-editor.d.js.map +0 -1
  157. package/build-types/actions/base-post/duplicate-post.d.ts.map +0 -1
  158. package/build-types/actions/base-post/duplicate-post.native.d.ts.map +0 -1
  159. package/build-types/actions/base-post/index.d.ts +0 -6
  160. package/build-types/actions/base-post/index.d.ts.map +0 -1
  161. package/build-types/actions/base-post/reorder-page.d.ts.map +0 -1
  162. package/build-types/actions/base-post/reorder-page.native.d.ts.map +0 -1
  163. package/build-types/actions/base-post/view-post.d.ts.map +0 -1
  164. package/build-types/actions/common/index.d.ts +0 -3
  165. package/build-types/actions/common/index.d.ts.map +0 -1
  166. package/build-types/actions/common/permanently-delete-post.d.ts.map +0 -1
  167. package/build-types/actions/common/view-post-revisions.d.ts.map +0 -1
  168. package/build-types/actions/pattern/duplicate-pattern.d.ts.map +0 -1
  169. package/build-types/actions/pattern/export-pattern.d.ts.map +0 -1
  170. package/build-types/actions/pattern/export-pattern.native.d.ts.map +0 -1
  171. package/build-types/actions/pattern/index.d.ts +0 -4
  172. package/build-types/actions/pattern/index.d.ts.map +0 -1
  173. package/src/actions/base-post/index.ts +0 -5
  174. package/src/actions/common/index.ts +0 -2
  175. package/src/actions/pattern/index.ts +0 -3
  176. package/src/wordpress-editor.d.ts +0 -1
  177. /package/build/actions/{base-post/duplicate-post.native.js → duplicate-post.native.js} +0 -0
  178. /package/build/actions/{pattern/export-pattern.native.js → export-pattern.native.js} +0 -0
  179. /package/build/actions/{base-post/reorder-page.native.js → reorder-page.native.js} +0 -0
  180. /package/build/actions/{common/view-post-revisions.js → view-post-revisions.js} +0 -0
  181. /package/build/actions/{base-post/view-post.js → view-post.js} +0 -0
  182. /package/build-module/actions/{base-post/duplicate-post.native.js → duplicate-post.native.js} +0 -0
  183. /package/build-module/actions/{pattern/export-pattern.native.js → export-pattern.native.js} +0 -0
  184. /package/build-module/actions/{base-post/reorder-page.native.js → reorder-page.native.js} +0 -0
  185. /package/build-module/actions/{common/view-post-revisions.js → view-post-revisions.js} +0 -0
  186. /package/build-module/actions/{base-post/view-post.js → view-post.js} +0 -0
  187. /package/build-types/actions/{base-post/duplicate-post.native.d.ts → duplicate-post.native.d.ts} +0 -0
  188. /package/build-types/actions/{pattern/export-pattern.native.d.ts → export-pattern.native.d.ts} +0 -0
  189. /package/build-types/actions/{base-post/reorder-page.native.d.ts → reorder-page.native.d.ts} +0 -0
  190. /package/src/actions/{base-post/duplicate-post.native.tsx → duplicate-post.native.tsx} +0 -0
  191. /package/src/actions/{pattern/export-pattern.native.tsx → export-pattern.native.tsx} +0 -0
  192. /package/src/actions/{base-post/reorder-page.native.tsx → reorder-page.native.tsx} +0 -0
@@ -11,7 +11,7 @@ var _notices = require("@wordpress/notices");
11
11
  var _element = require("@wordpress/element");
12
12
  var _dataviews = require("@wordpress/dataviews");
13
13
  var _components = require("@wordpress/components");
14
- var _fields = require("../../fields");
14
+ var _fields = require("../fields");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
16
  /**
17
17
  * WordPress dependencies
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_data","require","_coreData","_i18n","_notices","_element","_dataviews","_components","_fields","_jsxRuntime","fields","orderField","formOrderAction","ReorderModal","items","closeModal","onActionPerformed","item","setItem","useState","orderInput","menu_order","editEntityRecord","saveEditedEntityRecord","useDispatch","coreStore","createSuccessNotice","createErrorNotice","noticesStore","onOrder","event","preventDefault","isItemValid","type","id","throwOnError","__","error","typedError","errorMessage","message","code","isSaveDisabled","jsx","onSubmit","children","jsxs","__experimentalVStack","spacing","DataForm","data","form","onChange","changes","__experimentalHStack","justify","Button","__next40pxDefaultSize","variant","onClick","accessibleWhenDisabled","disabled","reorderPage","label","isEligible","status","RenderModal","_default","exports","default"],"sources":["@wordpress/fields/src/actions/reorder-page.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useState } from '@wordpress/element';\nimport { DataForm, isItemValid } from '@wordpress/dataviews';\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport type { Action, RenderModalProps } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { CoreDataError, BasePost } from '../types';\nimport { orderField } from '../fields';\n\nconst fields = [ orderField ];\nconst formOrderAction = {\n\tfields: [ 'menu_order' ],\n};\n\nfunction ReorderModal( {\n\titems,\n\tcloseModal,\n\tonActionPerformed,\n}: RenderModalProps< BasePost > ) {\n\tconst [ item, setItem ] = useState( items[ 0 ] );\n\tconst orderInput = item.menu_order;\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tasync function onOrder( event: React.FormEvent ) {\n\t\tevent.preventDefault();\n\n\t\tif ( ! isItemValid( item, fields, formOrderAction ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tmenu_order: orderInput,\n\t\t\t} );\n\t\t\tcloseModal?.();\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tcreateSuccessNotice( __( 'Order updated.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tonActionPerformed?.( items );\n\t\t} catch ( error ) {\n\t\t\tconst typedError = error as CoreDataError;\n\t\t\tconst errorMessage =\n\t\t\t\ttypedError.message && typedError.code !== 'unknown_error'\n\t\t\t\t\t? typedError.message\n\t\t\t\t\t: __( 'An error occurred while updating the order' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t}\n\tconst isSaveDisabled = ! isItemValid( item, fields, formOrderAction );\n\treturn (\n\t\t<form onSubmit={ onOrder }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<div>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.'\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ item }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ formOrderAction }\n\t\t\t\t\tonChange={ ( changes ) =>\n\t\t\t\t\t\tsetItem( {\n\t\t\t\t\t\t\t...item,\n\t\t\t\t\t\t\t...changes,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal?.();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ isSaveDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nconst reorderPage: Action< BasePost > = {\n\tid: 'order-pages',\n\tlabel: __( 'Order' ),\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tRenderModal: ReorderModal,\n};\n\nexport default reorderPage;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAWA,IAAAO,OAAA,GAAAP,OAAA;AAAuC,IAAAQ,WAAA,GAAAR,OAAA;AApBvC;AACA;AACA;;AAcA;AACA;AACA;;AAIA,MAAMS,MAAM,GAAG,CAAEC,kBAAU,CAAE;AAC7B,MAAMC,eAAe,GAAG;EACvBF,MAAM,EAAE,CAAE,YAAY;AACvB,CAAC;AAED,SAASG,YAAYA,CAAE;EACtBC,KAAK;EACLC,UAAU;EACVC;AAC6B,CAAC,EAAG;EACjC,MAAM,CAAEC,IAAI,EAAEC,OAAO,CAAE,GAAG,IAAAC,iBAAQ,EAAEL,KAAK,CAAE,CAAC,CAAG,CAAC;EAChD,MAAMM,UAAU,GAAGH,IAAI,CAACI,UAAU;EAClC,MAAM;IAAEC,gBAAgB;IAAEC;EAAuB,CAAC,GACjD,IAAAC,iBAAW,EAAEC,eAAU,CAAC;EACzB,MAAM;IAAEC,mBAAmB;IAAEC;EAAkB,CAAC,GAC/C,IAAAH,iBAAW,EAAEI,cAAa,CAAC;EAE5B,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
+ {"version":3,"names":["reorderPage","undefined","_default","exports","default"],"sources":["@wordpress/fields/src/actions/reorder-page.native.tsx"],"sourcesContent":["const reorderPage = undefined;\n\nexport default reorderPage;\n"],"mappings":";;;;;;AAAA,MAAMA,WAAW,GAAGC,SAAS;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEfJ,WAAW","ignoreList":[]}
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _icons = require("@wordpress/icons");
9
+ var _data = require("@wordpress/data");
10
+ var _coreData = require("@wordpress/core-data");
11
+ var _i18n = require("@wordpress/i18n");
12
+ var _notices = require("@wordpress/notices");
13
+ var _element = require("@wordpress/element");
14
+ var _blocks = require("@wordpress/blocks");
15
+ var _components = require("@wordpress/components");
16
+ var _url = require("@wordpress/url");
17
+ var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
18
+ var _utils = require("./utils");
19
+ var _jsxRuntime = require("react/jsx-runtime");
20
+ /**
21
+ * WordPress dependencies
22
+ */
23
+
24
+ // @ts-ignore
25
+
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+
30
+ const isTemplateRevertable = templateOrTemplatePart => {
31
+ if (!templateOrTemplatePart) {
32
+ return false;
33
+ }
34
+ return templateOrTemplatePart.source === _utils.TEMPLATE_ORIGINS.custom && (Boolean(templateOrTemplatePart?.plugin) || templateOrTemplatePart?.has_theme_file);
35
+ };
36
+
37
+ /**
38
+ * Copied - pasted from https://github.com/WordPress/gutenberg/blob/bf1462ad37d4637ebbf63270b9c244b23c69e2a8/packages/editor/src/store/private-actions.js#L233-L365
39
+ *
40
+ * @param {Object} template The template to revert.
41
+ * @param {Object} [options]
42
+ * @param {boolean} [options.allowUndo] Whether to allow the user to undo
43
+ * reverting the template. Default true.
44
+ */
45
+ const revertTemplate = async (template, {
46
+ allowUndo = true
47
+ } = {}) => {
48
+ const noticeId = 'edit-site-template-reverted';
49
+ (0, _data.dispatch)(_notices.store).removeNotice(noticeId);
50
+ if (!isTemplateRevertable(template)) {
51
+ (0, _data.dispatch)(_notices.store).createErrorNotice((0, _i18n.__)('This template is not revertable.'), {
52
+ type: 'snackbar'
53
+ });
54
+ return;
55
+ }
56
+ try {
57
+ const templateEntityConfig = (0, _data.select)(_coreData.store).getEntityConfig('postType', template.type);
58
+ if (!templateEntityConfig) {
59
+ (0, _data.dispatch)(_notices.store).createErrorNotice((0, _i18n.__)('The editor has encountered an unexpected error. Please reload.'), {
60
+ type: 'snackbar'
61
+ });
62
+ return;
63
+ }
64
+ const fileTemplatePath = (0, _url.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, {
65
+ context: 'edit',
66
+ source: template.origin
67
+ });
68
+ const fileTemplate = await (0, _apiFetch.default)({
69
+ path: fileTemplatePath
70
+ });
71
+ if (!fileTemplate) {
72
+ (0, _data.dispatch)(_notices.store).createErrorNotice((0, _i18n.__)('The editor has encountered an unexpected error. Please reload.'), {
73
+ type: 'snackbar'
74
+ });
75
+ return;
76
+ }
77
+ const serializeBlocks = ({
78
+ blocks: blocksForSerialization = []
79
+ }) => (0, _blocks.__unstableSerializeAndClean)(blocksForSerialization);
80
+ const edited = (0, _data.select)(_coreData.store).getEditedEntityRecord('postType', template.type, template.id);
81
+
82
+ // We are fixing up the undo level here to make sure we can undo
83
+ // the revert in the header toolbar correctly.
84
+ (0, _data.dispatch)(_coreData.store).editEntityRecord('postType', template.type, template.id, {
85
+ content: serializeBlocks,
86
+ // Required to make the `undo` behave correctly.
87
+ blocks: edited.blocks,
88
+ // Required to revert the blocks in the editor.
89
+ source: 'custom' // required to avoid turning the editor into a dirty state
90
+ }, {
91
+ undoIgnore: true // Required to merge this edit with the last undo level.
92
+ });
93
+ const blocks = (0, _blocks.parse)(fileTemplate?.content?.raw);
94
+ (0, _data.dispatch)(_coreData.store).editEntityRecord('postType', template.type, fileTemplate.id, {
95
+ content: serializeBlocks,
96
+ blocks,
97
+ source: 'theme'
98
+ });
99
+ if (allowUndo) {
100
+ const undoRevert = () => {
101
+ (0, _data.dispatch)(_coreData.store).editEntityRecord('postType', template.type, edited.id, {
102
+ content: serializeBlocks,
103
+ blocks: edited.blocks,
104
+ source: 'custom'
105
+ });
106
+ };
107
+ (0, _data.dispatch)(_notices.store).createSuccessNotice((0, _i18n.__)('Template reset.'), {
108
+ type: 'snackbar',
109
+ id: noticeId,
110
+ actions: [{
111
+ label: (0, _i18n.__)('Undo'),
112
+ onClick: undoRevert
113
+ }]
114
+ });
115
+ }
116
+ } catch (error) {
117
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('Template revert failed. Please reload.');
118
+ (0, _data.dispatch)(_notices.store).createErrorNotice(errorMessage, {
119
+ type: 'snackbar'
120
+ });
121
+ }
122
+ };
123
+ const resetPostAction = {
124
+ id: 'reset-post',
125
+ label: (0, _i18n.__)('Reset'),
126
+ isEligible: item => {
127
+ return (0, _utils.isTemplateOrTemplatePart)(item) && item?.source === _utils.TEMPLATE_ORIGINS.custom && (Boolean(item.type === 'wp_template' && item?.plugin) || item?.has_theme_file);
128
+ },
129
+ icon: _icons.backup,
130
+ supportsBulk: true,
131
+ hideModalHeader: true,
132
+ RenderModal: ({
133
+ items,
134
+ closeModal,
135
+ onActionPerformed
136
+ }) => {
137
+ const [isBusy, setIsBusy] = (0, _element.useState)(false);
138
+ const {
139
+ saveEditedEntityRecord
140
+ } = (0, _data.useDispatch)(_coreData.store);
141
+ const {
142
+ createSuccessNotice,
143
+ createErrorNotice
144
+ } = (0, _data.useDispatch)(_notices.store);
145
+ const onConfirm = async () => {
146
+ try {
147
+ for (const template of items) {
148
+ await revertTemplate(template, {
149
+ allowUndo: false
150
+ });
151
+ await saveEditedEntityRecord('postType', template.type, template.id);
152
+ }
153
+ createSuccessNotice(items.length > 1 ? (0, _i18n.sprintf)( /* translators: The number of items. */
154
+ (0, _i18n.__)('%s items reset.'), items.length) : (0, _i18n.sprintf)( /* translators: The template/part's name. */
155
+ (0, _i18n.__)('"%s" reset.'), (0, _utils.getItemTitle)(items[0])), {
156
+ type: 'snackbar',
157
+ id: 'revert-template-action'
158
+ });
159
+ } catch (error) {
160
+ let fallbackErrorMessage;
161
+ if (items[0].type === _utils.TEMPLATE_POST_TYPE) {
162
+ fallbackErrorMessage = items.length === 1 ? (0, _i18n.__)('An error occurred while reverting the template.') : (0, _i18n.__)('An error occurred while reverting the templates.');
163
+ } else {
164
+ fallbackErrorMessage = items.length === 1 ? (0, _i18n.__)('An error occurred while reverting the template part.') : (0, _i18n.__)('An error occurred while reverting the template parts.');
165
+ }
166
+ const typedError = error;
167
+ const errorMessage = typedError.message && typedError.code !== 'unknown_error' ? typedError.message : fallbackErrorMessage;
168
+ createErrorNotice(errorMessage, {
169
+ type: 'snackbar'
170
+ });
171
+ }
172
+ };
173
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
174
+ spacing: "5",
175
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
176
+ children: (0, _i18n.__)('Reset to default and clear all customizations?')
177
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
178
+ justify: "right",
179
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
180
+ __next40pxDefaultSize: true,
181
+ variant: "tertiary",
182
+ onClick: closeModal,
183
+ disabled: isBusy,
184
+ accessibleWhenDisabled: true,
185
+ children: (0, _i18n.__)('Cancel')
186
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
187
+ __next40pxDefaultSize: true,
188
+ variant: "primary",
189
+ onClick: async () => {
190
+ setIsBusy(true);
191
+ await onConfirm();
192
+ onActionPerformed?.(items);
193
+ setIsBusy(false);
194
+ closeModal?.();
195
+ },
196
+ isBusy: isBusy,
197
+ disabled: isBusy,
198
+ accessibleWhenDisabled: true,
199
+ children: (0, _i18n.__)('Reset')
200
+ })]
201
+ })]
202
+ });
203
+ }
204
+ };
205
+ var _default = exports.default = resetPostAction;
206
+ //# sourceMappingURL=reset-post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_icons","require","_data","_coreData","_i18n","_notices","_element","_blocks","_components","_url","_apiFetch","_interopRequireDefault","_utils","_jsxRuntime","isTemplateRevertable","templateOrTemplatePart","source","TEMPLATE_ORIGINS","custom","Boolean","plugin","has_theme_file","revertTemplate","template","allowUndo","noticeId","dispatch","noticesStore","removeNotice","createErrorNotice","__","type","templateEntityConfig","select","coreStore","getEntityConfig","fileTemplatePath","addQueryArgs","baseURL","id","context","origin","fileTemplate","apiFetch","path","serializeBlocks","blocks","blocksForSerialization","__unstableSerializeAndClean","edited","getEditedEntityRecord","editEntityRecord","content","undoIgnore","parse","raw","undoRevert","createSuccessNotice","actions","label","onClick","error","errorMessage","message","code","resetPostAction","isEligible","item","isTemplateOrTemplatePart","icon","backup","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionPerformed","isBusy","setIsBusy","useState","saveEditedEntityRecord","useDispatch","onConfirm","length","sprintf","getItemTitle","fallbackErrorMessage","TEMPLATE_POST_TYPE","typedError","jsxs","__experimentalVStack","spacing","children","jsx","__experimentalText","__experimentalHStack","justify","Button","__next40pxDefaultSize","variant","disabled","accessibleWhenDisabled","_default","exports","default"],"sources":["@wordpress/fields/src/actions/reset-post.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { backup } from '@wordpress/icons';\nimport { dispatch, select, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useState } from '@wordpress/element';\n// @ts-ignore\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport type { Action } from '@wordpress/dataviews';\nimport { addQueryArgs } from '@wordpress/url';\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetItemTitle,\n\tisTemplateOrTemplatePart,\n\tTEMPLATE_ORIGINS,\n\tTEMPLATE_POST_TYPE,\n} from './utils';\nimport type { CoreDataError, Template, TemplatePart } from '../types';\n\nconst isTemplateRevertable = (\n\ttemplateOrTemplatePart: Template | TemplatePart\n) => {\n\tif ( ! templateOrTemplatePart ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttemplateOrTemplatePart.source === TEMPLATE_ORIGINS.custom &&\n\t\t( Boolean( templateOrTemplatePart?.plugin ) ||\n\t\t\ttemplateOrTemplatePart?.has_theme_file )\n\t);\n};\n\n/**\n * Copied - pasted from https://github.com/WordPress/gutenberg/blob/bf1462ad37d4637ebbf63270b9c244b23c69e2a8/packages/editor/src/store/private-actions.js#L233-L365\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nconst revertTemplate = async (\n\ttemplate: TemplatePart | Template,\n\t{ allowUndo = true } = {}\n) => {\n\tconst noticeId = 'edit-site-template-reverted';\n\tdispatch( noticesStore ).removeNotice( noticeId );\n\tif ( ! isTemplateRevertable( template ) ) {\n\t\tdispatch( noticesStore ).createErrorNotice(\n\t\t\t__( 'This template is not revertable.' ),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst templateEntityConfig = select( coreStore ).getEntityConfig(\n\t\t\t'postType',\n\t\t\ttemplate.type\n\t\t);\n\n\t\tif ( ! templateEntityConfig ) {\n\t\t\tdispatch( noticesStore ).createErrorNotice(\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t{ context: 'edit', source: template.origin }\n\t\t);\n\n\t\tconst fileTemplate = ( await apiFetch( {\n\t\t\tpath: fileTemplatePath,\n\t\t} ) ) as any;\n\t\tif ( ! fileTemplate ) {\n\t\t\tdispatch( noticesStore ).createErrorNotice(\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializeBlocks = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\n\t\tconst edited = select( coreStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id\n\t\t) as any;\n\n\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t// the revert in the header toolbar correctly.\n\t\tdispatch( coreStore ).editEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t},\n\t\t\t{\n\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t}\n\t\t);\n\n\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\n\t\tdispatch( coreStore ).editEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\tfileTemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks,\n\t\t\t\tblocks,\n\t\t\t\tsource: 'theme',\n\t\t\t}\n\t\t);\n\n\t\tif ( allowUndo ) {\n\t\t\tconst undoRevert = () => {\n\t\t\t\tdispatch( coreStore ).editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\tedited.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tdispatch( noticesStore ).createSuccessNotice(\n\t\t\t\t__( 'Template reset.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: noticeId,\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: undoRevert,\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\t} catch ( error: any ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\n\t\tdispatch( noticesStore ).createErrorNotice( errorMessage, {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n};\n\nconst resetPostAction: Action< Template | TemplatePart > = {\n\tid: 'reset-post',\n\tlabel: __( 'Reset' ),\n\tisEligible: ( item ) => {\n\t\treturn (\n\t\t\tisTemplateOrTemplatePart( item ) &&\n\t\t\titem?.source === TEMPLATE_ORIGINS.custom &&\n\t\t\t( Boolean( item.type === 'wp_template' && item?.plugin ) ||\n\t\t\t\titem?.has_theme_file )\n\t\t);\n\t},\n\ticon: backup,\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\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\tgetItemTitle( 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\n\t\t\t\tconst typedError = error as CoreDataError;\n\t\t\t\tconst errorMessage =\n\t\t\t\t\ttypedError.message && typedError.code !== 'unknown_error'\n\t\t\t\t\t\t? typedError.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\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\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\tawait onConfirm();\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\taccessibleWhenDisabled\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 default resetPostAction;\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAA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sBAAsB;UAAAT,QAAA,EAEpB,IAAA9D,QAAE,EAAE,QAAS;QAAC,CACT,CAAC,eACT,IAAAjB,WAAA,CAAAgF,GAAA,EAACrF,WAAA,CAAAyF,MAAM;UACNC,qBAAqB;UACrBC,OAAO,EAAC,SAAS;UACjBvC,OAAO,EAAG,MAAAA,CAAA,KAAY;YACrBkB,SAAS,CAAE,IAAK,CAAC;YACjB,MAAMI,SAAS,CAAC,CAAC;YACjBN,iBAAiB,GAAIF,KAAM,CAAC;YAC5BI,SAAS,CAAE,KAAM,CAAC;YAClBH,UAAU,GAAG,CAAC;UACf,CAAG;UACHE,MAAM,EAAGA,MAAQ;UACjBuB,QAAQ,EAAGvB,MAAQ;UACnBwB,sBAAsB;UAAAT,QAAA,EAEpB,IAAA9D,QAAE,EAAE,OAAQ;QAAC,CACR,CAAC;MAAA,CACF,CAAC;IAAA,CACF,CAAC;EAEX;AACD,CAAC;AAAC,IAAAwE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEavC,eAAe","ignoreList":[]}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _icons = require("@wordpress/icons");
8
+ var _coreData = require("@wordpress/core-data");
9
+ var _i18n = require("@wordpress/i18n");
10
+ var _notices = require("@wordpress/notices");
11
+ var _utils = require("./utils");
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ const restorePost = {
21
+ id: 'restore',
22
+ label: (0, _i18n.__)('Restore'),
23
+ isPrimary: true,
24
+ icon: _icons.backup,
25
+ supportsBulk: true,
26
+ isEligible(item) {
27
+ return !(0, _utils.isTemplateOrTemplatePart)(item) && item.type !== 'wp_block' && item.status === 'trash' && item.permissions?.update;
28
+ },
29
+ async callback(posts, {
30
+ registry,
31
+ onActionPerformed
32
+ }) {
33
+ const {
34
+ createSuccessNotice,
35
+ createErrorNotice
36
+ } = registry.dispatch(_notices.store);
37
+ const {
38
+ editEntityRecord,
39
+ saveEditedEntityRecord
40
+ } = registry.dispatch(_coreData.store);
41
+ await Promise.allSettled(posts.map(post => {
42
+ return editEntityRecord('postType', post.type, post.id, {
43
+ status: 'draft'
44
+ });
45
+ }));
46
+ const promiseResult = await Promise.allSettled(posts.map(post => {
47
+ return saveEditedEntityRecord('postType', post.type, post.id, {
48
+ throwOnError: true
49
+ });
50
+ }));
51
+ if (promiseResult.every(({
52
+ status
53
+ }) => status === 'fulfilled')) {
54
+ let successMessage;
55
+ if (posts.length === 1) {
56
+ successMessage = (0, _i18n.sprintf)( /* translators: The number of posts. */
57
+ (0, _i18n.__)('"%s" has been restored.'), (0, _utils.getItemTitle)(posts[0]));
58
+ } else if (posts[0].type === 'page') {
59
+ successMessage = (0, _i18n.sprintf)( /* translators: The number of posts. */
60
+ (0, _i18n.__)('%d pages have been restored.'), posts.length);
61
+ } else {
62
+ successMessage = (0, _i18n.sprintf)( /* translators: The number of posts. */
63
+ (0, _i18n.__)('%d posts have been restored.'), posts.length);
64
+ }
65
+ createSuccessNotice(successMessage, {
66
+ type: 'snackbar',
67
+ id: 'restore-post-action'
68
+ });
69
+ if (onActionPerformed) {
70
+ onActionPerformed(posts);
71
+ }
72
+ } else {
73
+ // If there was at lease one failure.
74
+ let errorMessage;
75
+ // If we were trying to move a single post to the trash.
76
+ if (promiseResult.length === 1) {
77
+ const typedError = promiseResult[0];
78
+ if (typedError.reason?.message) {
79
+ errorMessage = typedError.reason.message;
80
+ } else {
81
+ errorMessage = (0, _i18n.__)('An error occurred while restoring the post.');
82
+ }
83
+ // If we were trying to move multiple posts to the trash
84
+ } else {
85
+ const errorMessages = new Set();
86
+ const failedPromises = promiseResult.filter(({
87
+ status
88
+ }) => status === 'rejected');
89
+ for (const failedPromise of failedPromises) {
90
+ const typedError = failedPromise;
91
+ if (typedError.reason?.message) {
92
+ errorMessages.add(typedError.reason.message);
93
+ }
94
+ }
95
+ if (errorMessages.size === 0) {
96
+ errorMessage = (0, _i18n.__)('An error occurred while restoring the posts.');
97
+ } else if (errorMessages.size === 1) {
98
+ errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
99
+ (0, _i18n.__)('An error occurred while restoring the posts: %s'), [...errorMessages][0]);
100
+ } else {
101
+ errorMessage = (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
102
+ (0, _i18n.__)('Some errors occurred while restoring the posts: %s'), [...errorMessages].join(','));
103
+ }
104
+ }
105
+ createErrorNotice(errorMessage, {
106
+ type: 'snackbar'
107
+ });
108
+ }
109
+ }
110
+ };
111
+ var _default = exports.default = restorePost;
112
+ //# sourceMappingURL=restore-post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_icons","require","_coreData","_i18n","_notices","_utils","restorePost","id","label","__","isPrimary","icon","backup","supportsBulk","isEligible","item","isTemplateOrTemplatePart","type","status","permissions","update","callback","posts","registry","onActionPerformed","createSuccessNotice","createErrorNotice","dispatch","noticesStore","editEntityRecord","saveEditedEntityRecord","coreStore","Promise","allSettled","map","post","promiseResult","throwOnError","every","successMessage","length","sprintf","getItemTitle","errorMessage","typedError","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","_default","exports","default"],"sources":["@wordpress/fields/src/actions/restore-post.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { backup } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport type { Action } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport { getItemTitle, isTemplateOrTemplatePart } from './utils';\nimport type { CoreDataError, PostWithPermissions } from '../types';\n\nconst restorePost: Action< PostWithPermissions > = {\n\tid: 'restore',\n\tlabel: __( 'Restore' ),\n\tisPrimary: true,\n\ticon: backup,\n\tsupportsBulk: true,\n\tisEligible( item ) {\n\t\treturn (\n\t\t\t! isTemplateOrTemplatePart( item ) &&\n\t\t\titem.type !== 'wp_block' &&\n\t\t\titem.status === 'trash' &&\n\t\t\titem.permissions?.update\n\t\t);\n\t},\n\tasync callback( posts, { registry, onActionPerformed } ) {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tregistry.dispatch( noticesStore );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tregistry.dispatch( coreStore );\n\t\tawait Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t} );\n\t\t\t} )\n\t\t);\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn saveEditedEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t} )\n\t\t);\n\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\t\t\tif ( posts.length === 1 ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t);\n\t\t\t} else if ( posts[ 0 ].type === 'page' ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '%d pages have been restored.' ),\n\t\t\t\t\tposts.length\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\tposts.length\n\t\t\t\t);\n\t\t\t}\n\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'restore-post-action',\n\t\t\t} );\n\t\t\tif ( onActionPerformed ) {\n\t\t\t\tonActionPerformed( posts );\n\t\t\t}\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to move a single post to the trash.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tconst typedError = promiseResult[ 0 ] as {\n\t\t\t\t\treason?: CoreDataError;\n\t\t\t\t};\n\t\t\t\tif ( typedError.reason?.message ) {\n\t\t\t\t\terrorMessage = typedError.reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tconst typedError = failedPromise as {\n\t\t\t\t\t\treason?: CoreDataError;\n\t\t\t\t\t};\n\t\t\t\t\tif ( typedError.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( typedError.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t__( 'An error occurred while restoring the posts: %s' ),\n\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Some errors occurred while restoring the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t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: true
5
+ });
6
+ exports.default = void 0;
7
+ var _icons = require("@wordpress/icons");
8
+ var _data = require("@wordpress/data");
9
+ var _coreData = require("@wordpress/core-data");
10
+ var _i18n = require("@wordpress/i18n");
11
+ var _notices = require("@wordpress/notices");
12
+ var _element = require("@wordpress/element");
13
+ var _components = require("@wordpress/components");
14
+ var _utils = require("./utils");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * Internal dependencies
22
+ */
23
+
24
+ const trashPost = {
25
+ id: 'move-to-trash',
26
+ label: (0, _i18n.__)('Move to trash'),
27
+ isPrimary: true,
28
+ icon: _icons.trash,
29
+ isEligible(item) {
30
+ if ((0, _utils.isTemplateOrTemplatePart)(item) || item.type === 'wp_block') {
31
+ return false;
32
+ }
33
+ return !!item.status && !['auto-draft', 'trash'].includes(item.status) && item.permissions?.delete;
34
+ },
35
+ supportsBulk: true,
36
+ hideModalHeader: true,
37
+ RenderModal: ({
38
+ items,
39
+ closeModal,
40
+ onActionPerformed
41
+ }) => {
42
+ const [isBusy, setIsBusy] = (0, _element.useState)(false);
43
+ const {
44
+ createSuccessNotice,
45
+ createErrorNotice
46
+ } = (0, _data.useDispatch)(_notices.store);
47
+ const {
48
+ deleteEntityRecord
49
+ } = (0, _data.useDispatch)(_coreData.store);
50
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
51
+ spacing: "5",
52
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
53
+ children: items.length === 1 ? (0, _i18n.sprintf)(
54
+ // translators: %s: The item's title.
55
+ (0, _i18n.__)('Are you sure you want to move "%s" to the trash?'), (0, _utils.getItemTitle)(items[0])) : (0, _i18n.sprintf)(
56
+ // translators: %d: The number of items (2 or more).
57
+ (0, _i18n._n)('Are you sure you want to move %d item to the trash ?', 'Are you sure you want to move %d items to the trash ?', items.length), items.length)
58
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
59
+ justify: "right",
60
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
61
+ __next40pxDefaultSize: true,
62
+ variant: "tertiary",
63
+ onClick: closeModal,
64
+ disabled: isBusy,
65
+ accessibleWhenDisabled: true,
66
+ children: (0, _i18n.__)('Cancel')
67
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
68
+ __next40pxDefaultSize: true,
69
+ variant: "primary",
70
+ onClick: async () => {
71
+ setIsBusy(true);
72
+ const promiseResult = await Promise.allSettled(items.map(item => deleteEntityRecord('postType', item.type, item.id.toString(), {}, {
73
+ throwOnError: true
74
+ })));
75
+ // If all the promises were fulfilled with success.
76
+ if (promiseResult.every(({
77
+ status
78
+ }) => status === 'fulfilled')) {
79
+ let successMessage;
80
+ if (promiseResult.length === 1) {
81
+ successMessage = (0, _i18n.sprintf)( /* translators: The item's title. */
82
+ (0, _i18n.__)('"%s" moved to the trash.'), (0, _utils.getItemTitle)(items[0]));
83
+ } else {
84
+ successMessage = (0, _i18n.sprintf)( /* translators: The number of items. */
85
+ (0, _i18n._n)('%s item moved to the trash.', '%s items moved to the trash.', items.length), items.length);
86
+ }
87
+ createSuccessNotice(successMessage, {
88
+ type: 'snackbar',
89
+ id: 'move-to-trash-action'
90
+ });
91
+ } else {
92
+ // If there was at least one failure.
93
+ let errorMessage;
94
+ // If we were trying to delete a single item.
95
+ if (promiseResult.length === 1) {
96
+ const typedError = promiseResult[0];
97
+ if (typedError.reason?.message) {
98
+ errorMessage = typedError.reason.message;
99
+ } else {
100
+ errorMessage = (0, _i18n.__)('An error occurred while moving the item to the trash.');
101
+ }
102
+ // If we were trying to delete multiple items.
103
+ } else {
104
+ const errorMessages = new Set();
105
+ const failedPromises = promiseResult.filter(({
106
+ status
107
+ }) => status === 'rejected');
108
+ for (const failedPromise of failedPromises) {
109
+ const typedError = failedPromise;
110
+ if (typedError.reason?.message) {
111
+ errorMessages.add(typedError.reason.message);
112
+ }
113
+ }
114
+ if (errorMessages.size === 0) {
115
+ errorMessage = (0, _i18n.__)('An error occurred while moving the items to the trash.');
116
+ } else if (errorMessages.size === 1) {
117
+ errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
118
+ (0, _i18n.__)('An error occurred while moving the item to the trash: %s'), [...errorMessages][0]);
119
+ } else {
120
+ errorMessage = (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
121
+ (0, _i18n.__)('Some errors occurred while moving the items to the trash: %s'), [...errorMessages].join(','));
122
+ }
123
+ }
124
+ createErrorNotice(errorMessage, {
125
+ type: 'snackbar'
126
+ });
127
+ }
128
+ if (onActionPerformed) {
129
+ onActionPerformed(items);
130
+ }
131
+ setIsBusy(false);
132
+ closeModal?.();
133
+ },
134
+ isBusy: isBusy,
135
+ disabled: isBusy,
136
+ accessibleWhenDisabled: true,
137
+ children: (0, _i18n._x)('Trash', 'verb')
138
+ })]
139
+ })]
140
+ });
141
+ }
142
+ };
143
+ var _default = exports.default = trashPost;
144
+ //# sourceMappingURL=trash-post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_icons","require","_data","_coreData","_i18n","_notices","_element","_components","_utils","_jsxRuntime","trashPost","id","label","__","isPrimary","icon","trash","isEligible","item","isTemplateOrTemplatePart","type","status","includes","permissions","delete","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionPerformed","isBusy","setIsBusy","useState","createSuccessNotice","createErrorNotice","useDispatch","noticesStore","deleteEntityRecord","coreStore","jsxs","__experimentalVStack","spacing","children","jsx","__experimentalText","length","sprintf","getItemTitle","_n","__experimentalHStack","justify","Button","__next40pxDefaultSize","variant","onClick","disabled","accessibleWhenDisabled","promiseResult","Promise","allSettled","map","toString","throwOnError","every","successMessage","errorMessage","typedError","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","_x","_default","exports","default"],"sources":["@wordpress/fields/src/actions/trash-post.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { trash } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _n, sprintf, _x } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport type { Action } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport { getItemTitle, isTemplateOrTemplatePart } from './utils';\nimport type { CoreDataError, PostWithPermissions } from '../types';\n\nconst trashPost: Action< PostWithPermissions > = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( item ) {\n\t\tif ( isTemplateOrTemplatePart( item ) || item.type === 'wp_block' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn (\n\t\t\t!! item.status &&\n\t\t\t! [ 'auto-draft', 'trash' ].includes( item.status ) &&\n\t\t\titem.permissions?.delete\n\t\t);\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ items.length === 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The item's title.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move \"%s\" to the trash?'\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 %d item to the trash ?',\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move %d items to the trash ?',\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\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tsetIsBusy( true );\n\t\t\t\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\t\t\t\titems.map( ( item ) =>\n\t\t\t\t\t\t\t\t\tdeleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\t\t\titem.id.toString(),\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 the 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 the trash.',\n\t\t\t\t\t\t\t\t\t\t\t'%s items moved to the 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\tconst typedError = promiseResult[ 0 ] as {\n\t\t\t\t\t\t\t\t\t\treason?: CoreDataError;\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\tif ( typedError.reason?.message ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\t\t\ttypedError.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 the item to the trash.'\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\tconst typedError = failedPromise as {\n\t\t\t\t\t\t\t\t\t\t\treason?: CoreDataError;\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\tif ( typedError.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\ttypedError.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 the items to the trash.'\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 the item to the trash: %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 the items to the trash: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetIsBusy( false );\n\t\t\t\t\t\t\tcloseModal?.();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ _x( 'Trash', 'verb' ) }\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 default trashPost;\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAWA,IAAAO,MAAA,GAAAP,OAAA;AAAiE,IAAAQ,WAAA,GAAAR,OAAA;AApBjE;AACA;AACA;;AAeA;AACA;AACA;;AAIA,MAAMS,SAAwC,GAAG;EAChDC,EAAE,EAAE,eAAe;EACnBC,KAAK,EAAE,IAAAC,QAAE,EAAE,eAAgB,CAAC;EAC5BC,SAAS,EAAE,IAAI;EACfC,IAAI,E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E,EACD,8DACD,CAAC,EACD,CAAE,GAAGyD,aAAa,CAAE,CAACO,IAAI,CAAE,GAAI,CAChC,CAAC;gBACF;cACD;cACA1C,iBAAiB,CAAE+B,YAAY,EAAE;gBAChC9C,IAAI,EAAE;cACP,CAAE,CAAC;YACJ;YACA,IAAKU,iBAAiB,EAAG;cACxBA,iBAAiB,CAAEF,KAAM,CAAC;YAC3B;YACAI,SAAS,CAAE,KAAM,CAAC;YAClBH,UAAU,GAAG,CAAC;UACf,CAAG;UACHE,MAAM,EAAGA,MAAQ;UACjByB,QAAQ,EAAGzB,MAAQ;UACnB0B,sBAAsB;UAAAd,QAAA,EAEpB,IAAAmC,QAAE,EAAE,OAAO,EAAE,MAAO;QAAC,CAChB,CAAC;MAAA,CACF,CAAC;IAAA,CACF,CAAC;EAEX;AACD,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEavE,SAAS","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_url","require","_i18n","viewPostRevisions","id","context","label","items","_items$0$_links$versi","revisionsCount","_links","count","sprintf","__","isEligible","post","_post$_links$predeces","_post$_links$version","status","lastRevisionId","callback","posts","onActionPerformed","href","addQueryArgs","revision","document","location","_default","exports","default"],"sources":["@wordpress/fields/src/actions/view-post-revisions.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport type { Action } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { Post } from '../types';\n\nconst viewPostRevisions: Action< Post > = {\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\nexport default viewPostRevisions;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,MAAME,iBAAiC,GAAG;EACzCC,EAAE,EAAE,qBAAqB;EACzBC,OAAO,EAAE,MAAM;EACfC,KAAKA,CAAEC,KAAK,EAAG;IAAA,IAAAC,qBAAA;IACd,MAAMC,cAAc,IAAAD,qBAAA,GACnBD,KAAK,CAAE,CAAC,CAAE,CAACG,MAAM,GAAI,iBAAiB,CAAE,GAAI,CAAC,CAAE,EAAEC,KAAK,cAAAH,qBAAA,cAAAA,qBAAA,GAAI,CAAC;IAC5D,OAAO,IAAAI,aAAO,GACb;IACA,IAAAC,QAAE,EAAE,qBAAsB,CAAC,EAC3BJ,cACD,CAAC;EACF,CAAC;EACDK,UAAUA,CAAEC,IAAI,EAAG;IAAA,IAAAC,qBAAA,EAAAC,oBAAA;IAClB,IAAKF,IAAI,CAACG,MAAM,KAAK,OAAO,EAAG;MAC9B,OAAO,KAAK;IACb;IACA,MAAMC,cAAc,IAAAH,qBAAA,GACnBD,IAAI,EAAEL,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEN,EAAE,cAAAY,qBAAA,cAAAA,qBAAA,GAAI,IAAI;IAC3D,MAAMP,cAAc,IAAAQ,oBAAA,GACnBF,IAAI,EAAEL,MAAM,GAAI,iBAAiB,CAAE,GAAI,CAAC,CAAE,EAAEC,KAAK,cAAAM,oBAAA,cAAAA,oBAAA,GAAI,CAAC;IACvD,OAAO,CAAC,CAAEE,cAAc,IAAIV,cAAc,GAAG,CAAC;EAC/C,CAAC;EACDW,QAAQA,CAAEC,KAAK,EAAE;IAAEC;EAAkB,CAAC,EAAG;IACxC,MAAMP,IAAI,GAAGM,KAAK,CAAE,CAAC,CAAE;IACvB,MAAME,IAAI,GAAG,IAAAC,iBAAY,EAAE,cAAc,EAAE;MAC1CC,QAAQ,EAAEV,IAAI,EAAEL,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEN;IAC3D,CAAE,CAAC;IACHsB,QAAQ,CAACC,QAAQ,CAACJ,IAAI,GAAGA,IAAI;IAC7B,IAAKD,iBAAiB,EAAG;MACxBA,iBAAiB,CAAED,KAAM,CAAC;IAC3B;EACD;AACD,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa3B,iBAAiB","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_icons","require","_i18n","viewPost","id","label","_x","isPrimary","icon","external","isEligible","post","status","callback","posts","onActionPerformed","window","open","link","_default","exports","default"],"sources":["@wordpress/fields/src/actions/view-post.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external } from '@wordpress/icons';\nimport { _x } from '@wordpress/i18n';\nimport type { Action } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../types';\n\nconst viewPost: Action< BasePost > = {\n\tid: 'view-post',\n\tlabel: _x( 'View', 'verb' ),\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\nexport default viewPost;\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,MAAME,QAA4B,GAAG;EACpCC,EAAE,EAAE,WAAW;EACfC,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAM,EAAE,MAAO,CAAC;EAC3BC,SAAS,EAAE,IAAI;EACfC,IAAI,EAAEC,eAAQ;EACdC,UAAUA,CAAEC,IAAI,EAAG;IAClB,OAAOA,IAAI,CAACC,MAAM,KAAK,OAAO;EAC/B,CAAC;EACDC,QAAQA,CAAEC,KAAK,EAAE;IAAEC;EAAkB,CAAC,EAAG;IACxC,MAAMJ,IAAI,GAAGG,KAAK,CAAE,CAAC,CAAE;IACvBE,MAAM,CAACC,IAAI,CAAEN,IAAI,EAAEO,IAAI,EAAE,QAAS,CAAC;IACnC,IAAKH,iBAAiB,EAAG;MACxBA,iBAAiB,CAAED,KAAM,CAAC;IAC3B;EACD;AACD,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEalB,QAAQ","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _duplicatePost = require("./actions/base-post/duplicate-post.native");
6
+ var _duplicatePost = require("./actions/duplicate-post.native");
7
7
  Object.keys(_duplicatePost).forEach(function (key) {
8
8
  if (key === "default" || key === "__esModule") return;
9
9
  if (key in exports && exports[key] === _duplicatePost[key]) return;
@@ -14,7 +14,7 @@ Object.keys(_duplicatePost).forEach(function (key) {
14
14
  }
15
15
  });
16
16
  });
17
- var _reorderPage = require("./actions/base-post/reorder-page.native");
17
+ var _reorderPage = require("./actions/reorder-page.native");
18
18
  Object.keys(_reorderPage).forEach(function (key) {
19
19
  if (key === "default" || key === "__esModule") return;
20
20
  if (key in exports && exports[key] === _reorderPage[key]) return;
@@ -1 +1 @@
1
- {"version":3,"names":["_duplicatePost","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_reorderPage"],"sources":["@wordpress/fields/src/index.native.ts"],"sourcesContent":["export * from './actions/base-post/duplicate-post.native';\nexport * from './actions/base-post/reorder-page.native';\n"],"mappings":";;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,cAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["_duplicatePost","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_reorderPage"],"sources":["@wordpress/fields/src/index.native.ts"],"sourcesContent":["export * from './actions/duplicate-post.native';\nexport * from './actions/reorder-page.native';\n"],"mappings":";;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,cAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}