@wordpress/block-directory 5.32.0 → 5.32.1-next.b8c8708f3.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 (110) hide show
  1. package/build/components/auto-block-uninstaller/index.js +37 -31
  2. package/build/components/auto-block-uninstaller/index.js.map +7 -1
  3. package/build/components/block-ratings/index.js +40 -22
  4. package/build/components/block-ratings/index.js.map +7 -1
  5. package/build/components/block-ratings/stars.js +66 -40
  6. package/build/components/block-ratings/stars.js.map +7 -1
  7. package/build/components/compact-list/index.js +47 -46
  8. package/build/components/compact-list/index.js.map +7 -1
  9. package/build/components/downloadable-block-icon/index.js +28 -26
  10. package/build/components/downloadable-block-icon/index.js.map +7 -1
  11. package/build/components/downloadable-block-list-item/index.js +113 -127
  12. package/build/components/downloadable-block-list-item/index.js.map +7 -1
  13. package/build/components/downloadable-block-notice/index.js +41 -31
  14. package/build/components/downloadable-block-notice/index.js.map +7 -1
  15. package/build/components/downloadable-blocks-list/index.js +72 -56
  16. package/build/components/downloadable-blocks-list/index.js.map +7 -1
  17. package/build/components/downloadable-blocks-panel/index.js +108 -95
  18. package/build/components/downloadable-blocks-panel/index.js.map +7 -1
  19. package/build/components/downloadable-blocks-panel/inserter-panel.js +52 -38
  20. package/build/components/downloadable-blocks-panel/inserter-panel.js.map +7 -1
  21. package/build/components/downloadable-blocks-panel/no-results.js +37 -30
  22. package/build/components/downloadable-blocks-panel/no-results.js.map +7 -1
  23. package/build/index.js +27 -12
  24. package/build/index.js.map +7 -1
  25. package/build/lock-unlock.js +31 -15
  26. package/build/lock-unlock.js.map +7 -1
  27. package/build/plugins/get-install-missing/index.js +123 -102
  28. package/build/plugins/get-install-missing/index.js.map +7 -1
  29. package/build/plugins/get-install-missing/install-button.js +68 -50
  30. package/build/plugins/get-install-missing/install-button.js.map +7 -1
  31. package/build/plugins/index.js +46 -29
  32. package/build/plugins/index.js.map +7 -1
  33. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +55 -42
  34. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +7 -1
  35. package/build/plugins/installed-blocks-pre-publish-panel/index.js +65 -34
  36. package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +7 -1
  37. package/build/store/actions.js +142 -188
  38. package/build/store/actions.js.map +7 -1
  39. package/build/store/index.js +48 -46
  40. package/build/store/index.js.map +7 -1
  41. package/build/store/load-assets.js +48 -55
  42. package/build/store/load-assets.js.map +7 -1
  43. package/build/store/reducer.js +48 -54
  44. package/build/store/reducer.js.map +7 -1
  45. package/build/store/resolvers.js +52 -31
  46. package/build/store/resolvers.js.map +7 -1
  47. package/build/store/selectors.js +100 -127
  48. package/build/store/selectors.js.map +7 -1
  49. package/build/store/utils/get-plugin-url.js +23 -14
  50. package/build/store/utils/get-plugin-url.js.map +7 -1
  51. package/build-module/components/auto-block-uninstaller/index.js +18 -24
  52. package/build-module/components/auto-block-uninstaller/index.js.map +7 -1
  53. package/build-module/components/block-ratings/index.js +9 -15
  54. package/build-module/components/block-ratings/index.js.map +7 -1
  55. package/build-module/components/block-ratings/stars.js +48 -34
  56. package/build-module/components/block-ratings/stars.js.map +7 -1
  57. package/build-module/components/compact-list/index.js +19 -39
  58. package/build-module/components/compact-list/index.js.map +7 -1
  59. package/build-module/components/downloadable-block-icon/index.js +10 -20
  60. package/build-module/components/downloadable-block-icon/index.js.map +7 -1
  61. package/build-module/components/downloadable-block-list-item/index.js +89 -120
  62. package/build-module/components/downloadable-block-list-item/index.js.map +7 -1
  63. package/build-module/components/downloadable-block-notice/index.js +19 -24
  64. package/build-module/components/downloadable-block-notice/index.js.map +7 -1
  65. package/build-module/components/downloadable-blocks-list/index.js +44 -49
  66. package/build-module/components/downloadable-blocks-list/index.js.map +7 -1
  67. package/build-module/components/downloadable-blocks-panel/index.js +81 -89
  68. package/build-module/components/downloadable-blocks-panel/index.js.map +7 -1
  69. package/build-module/components/downloadable-blocks-panel/inserter-panel.js +33 -31
  70. package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +7 -1
  71. package/build-module/components/downloadable-blocks-panel/no-results.js +19 -24
  72. package/build-module/components/downloadable-blocks-panel/no-results.js.map +7 -1
  73. package/build-module/index.js +6 -6
  74. package/build-module/index.js.map +7 -1
  75. package/build-module/lock-unlock.js +8 -7
  76. package/build-module/lock-unlock.js.map +7 -1
  77. package/build-module/plugins/get-install-missing/index.js +99 -95
  78. package/build-module/plugins/get-install-missing/index.js.map +7 -1
  79. package/build-module/plugins/get-install-missing/install-button.js +50 -44
  80. package/build-module/plugins/get-install-missing/install-button.js.map +7 -1
  81. package/build-module/plugins/index.js +24 -25
  82. package/build-module/plugins/index.js.map +7 -1
  83. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +26 -34
  84. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +7 -1
  85. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +38 -28
  86. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +7 -1
  87. package/build-module/store/actions.js +100 -168
  88. package/build-module/store/actions.js.map +7 -1
  89. package/build-module/store/index.js +13 -36
  90. package/build-module/store/index.js.map +7 -1
  91. package/build-module/store/load-assets.js +15 -47
  92. package/build-module/store/load-assets.js.map +7 -1
  93. package/build-module/store/reducer.js +27 -49
  94. package/build-module/store/reducer.js.map +7 -1
  95. package/build-module/store/resolvers.js +16 -19
  96. package/build-module/store/resolvers.js.map +7 -1
  97. package/build-module/store/selectors.js +77 -121
  98. package/build-module/store/selectors.js.map +7 -1
  99. package/build-module/store/utils/get-plugin-url.js +6 -10
  100. package/build-module/store/utils/get-plugin-url.js.map +7 -1
  101. package/build-style/style-rtl.css +9 -142
  102. package/build-style/style.css +9 -142
  103. package/package.json +28 -21
  104. package/src/components/block-ratings/style.scss +2 -0
  105. package/src/components/compact-list/style.scss +3 -0
  106. package/src/components/downloadable-block-icon/style.scss +3 -0
  107. package/src/components/downloadable-block-list-item/style.scss +4 -0
  108. package/src/components/downloadable-block-notice/style.scss +3 -0
  109. package/src/components/downloadable-blocks-panel/style.scss +3 -1
  110. package/src/style.scss +8 -7
@@ -1 +1,7 @@
1
- {"version":3,"names":["_blockEditor","require","_compose","_element","_downloadableBlocksPanel","_interopRequireDefault","_jsxRuntime","InserterMenuDownloadableBlocksPanel","debouncedFilterValue","setFilterValue","useState","debouncedSetFilterValue","debounce","jsx","__unstableInserterMenuExtension","children","onSelect","onHover","filterValue","hasItems","default","hasLocalBlocks","isTyping","_default","exports"],"sources":["@wordpress/block-directory/src/plugins/inserter-menu-downloadable-blocks-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableInserterMenuExtension } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlocksPanel from '../../components/downloadable-blocks-panel';\n\nfunction InserterMenuDownloadableBlocksPanel() {\n\tconst [ debouncedFilterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSetFilterValue = debounce( setFilterValue, 400 );\n\n\treturn (\n\t\t<__unstableInserterMenuExtension>\n\t\t\t{ ( { onSelect, onHover, filterValue, hasItems } ) => {\n\t\t\t\tif ( debouncedFilterValue !== filterValue ) {\n\t\t\t\t\tdebouncedSetFilterValue( filterValue );\n\t\t\t\t}\n\n\t\t\t\tif ( ! debouncedFilterValue ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlocksPanel\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tfilterValue={ debouncedFilterValue }\n\t\t\t\t\t\thasLocalBlocks={ hasItems }\n\t\t\t\t\t\tisTyping={ filterValue !== debouncedFilterValue }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</__unstableInserterMenuExtension>\n\t);\n}\n\nexport default InserterMenuDownloadableBlocksPanel;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,wBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAiF,IAAAK,WAAA,GAAAL,OAAA;AAVjF;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASM,mCAAmCA,CAAA,EAAG;EAC9C,MAAM,CAAEC,oBAAoB,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,EAAG,CAAC;EAC/D,MAAMC,uBAAuB,GAAG,IAAAC,iBAAQ,EAAEH,cAAc,EAAE,GAAI,CAAC;EAE/D,oBACC,IAAAH,WAAA,CAAAO,GAAA,EAACb,YAAA,CAAAc,+BAA+B;IAAAC,QAAA,EAC7BA,CAAE;MAAEC,QAAQ;MAAEC,OAAO;MAAEC,WAAW;MAAEC;IAAS,CAAC,KAAM;MACrD,IAAKX,oBAAoB,KAAKU,WAAW,EAAG;QAC3CP,uBAAuB,CAAEO,WAAY,CAAC;MACvC;MAEA,IAAK,CAAEV,oBAAoB,EAAG;QAC7B,OAAO,IAAI;MACZ;MAEA,oBACC,IAAAF,WAAA,CAAAO,GAAA,EAACT,wBAAA,CAAAgB,OAAuB;QACvBJ,QAAQ,EAAGA,QAAU;QACrBC,OAAO,EAAGA,OAAS;QACnBC,WAAW,EAAGV,oBAAsB;QACpCa,cAAc,EAAGF,QAAU;QAC3BG,QAAQ,EAAGJ,WAAW,KAAKV;MAAsB,CACjD,CAAC;IAEJ;EAAC,CAC+B,CAAC;AAEpC;AAAC,IAAAe,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEcb,mCAAmC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/inserter-menu-downloadable-blocks-panel/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __unstableInserterMenuExtension } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlocksPanel from '../../components/downloadable-blocks-panel';\n\nfunction InserterMenuDownloadableBlocksPanel() {\n\tconst [ debouncedFilterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSetFilterValue = debounce( setFilterValue, 400 );\n\n\treturn (\n\t\t<__unstableInserterMenuExtension>\n\t\t\t{ ( { onSelect, onHover, filterValue, hasItems } ) => {\n\t\t\t\tif ( debouncedFilterValue !== filterValue ) {\n\t\t\t\t\tdebouncedSetFilterValue( filterValue );\n\t\t\t\t}\n\n\t\t\t\tif ( ! debouncedFilterValue ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlocksPanel\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tfilterValue={ debouncedFilterValue }\n\t\t\t\t\t\thasLocalBlocks={ hasItems }\n\t\t\t\t\t\tisTyping={ filterValue !== debouncedFilterValue }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</__unstableInserterMenuExtension>\n\t);\n}\n\nexport default InserterMenuDownloadableBlocksPanel;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BK;AAzBL,0BAAgD;AAChD,qBAAyB;AACzB,qBAAyB;AAKzB,uCAAoC;AAEpC,SAAS,sCAAsC;AAC9C,QAAM,CAAE,sBAAsB,cAAe,QAAI,yBAAU,EAAG;AAC9D,QAAM,8BAA0B,yBAAU,gBAAgB,GAAI;AAE9D,SACC,4CAAC,uDACE,WAAE,EAAE,UAAU,SAAS,aAAa,SAAS,MAAO;AACrD,QAAK,yBAAyB,aAAc;AAC3C,8BAAyB,WAAY;AAAA,IACtC;AAEA,QAAK,CAAE,sBAAuB;AAC7B,aAAO;AAAA,IACR;AAEA,WACC;AAAA,MAAC,iCAAAA;AAAA,MAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,aAAc;AAAA,QACd,gBAAiB;AAAA,QACjB,UAAW,gBAAgB;AAAA;AAAA,IAC5B;AAAA,EAEF,GACD;AAEF;AAEA,IAAO,kDAAQ;",
6
+ "names": ["DownloadableBlocksPanel"]
7
+ }
@@ -1,40 +1,71 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var installed_blocks_pre_publish_panel_exports = {};
29
+ __export(installed_blocks_pre_publish_panel_exports, {
30
+ default: () => InstalledBlocksPrePublishPanel
6
31
  });
7
- exports.default = InstalledBlocksPrePublishPanel;
8
- var _i18n = require("@wordpress/i18n");
9
- var _data = require("@wordpress/data");
10
- var _editor = require("@wordpress/editor");
11
- var _compactList = _interopRequireDefault(require("../../components/compact-list"));
12
- var _store = require("../../store");
13
- var _jsxRuntime = require("react/jsx-runtime");
14
- /**
15
- * WordPress dependencies
16
- */
17
-
18
- /**
19
- * Internal dependencies
20
- */
21
-
32
+ module.exports = __toCommonJS(installed_blocks_pre_publish_panel_exports);
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var import_i18n = require("@wordpress/i18n");
35
+ var import_data = require("@wordpress/data");
36
+ var import_editor = require("@wordpress/editor");
37
+ var import_compact_list = __toESM(require("../../components/compact-list"));
38
+ var import_store = require("../../store");
22
39
  function InstalledBlocksPrePublishPanel() {
23
- const newBlockTypes = (0, _data.useSelect)(select => select(_store.store).getNewBlockTypes(), []);
40
+ const newBlockTypes = (0, import_data.useSelect)(
41
+ (select) => select(import_store.store).getNewBlockTypes(),
42
+ []
43
+ );
24
44
  if (!newBlockTypes.length) {
25
45
  return null;
26
46
  }
27
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_editor.PluginPrePublishPanel, {
28
- title: (0, _i18n.sprintf)(
29
- // translators: %d: number of blocks (number).
30
- (0, _i18n._n)('Added: %d block', 'Added: %d blocks', newBlockTypes.length), newBlockTypes.length),
31
- initialOpen: true,
32
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
33
- className: "installed-blocks-pre-publish-panel__copy",
34
- children: (0, _i18n._n)('The following block has been added to your site.', 'The following blocks have been added to your site.', newBlockTypes.length)
35
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_compactList.default, {
36
- items: newBlockTypes
37
- })]
38
- });
47
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
48
+ import_editor.PluginPrePublishPanel,
49
+ {
50
+ title: (0, import_i18n.sprintf)(
51
+ // translators: %d: number of blocks (number).
52
+ (0, import_i18n._n)(
53
+ "Added: %d block",
54
+ "Added: %d blocks",
55
+ newBlockTypes.length
56
+ ),
57
+ newBlockTypes.length
58
+ ),
59
+ initialOpen: true,
60
+ children: [
61
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "installed-blocks-pre-publish-panel__copy", children: (0, import_i18n._n)(
62
+ "The following block has been added to your site.",
63
+ "The following blocks have been added to your site.",
64
+ newBlockTypes.length
65
+ ) }),
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_compact_list.default, { items: newBlockTypes })
67
+ ]
68
+ }
69
+ );
39
70
  }
40
- //# sourceMappingURL=index.js.map
71
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_i18n","require","_data","_editor","_compactList","_interopRequireDefault","_store","_jsxRuntime","InstalledBlocksPrePublishPanel","newBlockTypes","useSelect","select","blockDirectoryStore","getNewBlockTypes","length","jsxs","PluginPrePublishPanel","title","sprintf","_n","initialOpen","children","jsx","className","default","items"],"sources":["@wordpress/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PluginPrePublishPanel } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport CompactList from '../../components/compact-list';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstalledBlocksPrePublishPanel() {\n\tconst newBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getNewBlockTypes(),\n\t\t[]\n\t);\n\n\tif ( ! newBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PluginPrePublishPanel\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %d: number of blocks (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Added: %d block',\n\t\t\t\t\t'Added: %d blocks',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t),\n\t\t\t\tnewBlockTypes.length\n\t\t\t) }\n\t\t\tinitialOpen\n\t\t>\n\t\t\t<p className=\"installed-blocks-pre-publish-panel__copy\">\n\t\t\t\t{ _n(\n\t\t\t\t\t'The following block has been added to your site.',\n\t\t\t\t\t'The following blocks have been added to your site.',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<CompactList items={ newBlockTypes } />\n\t\t</PluginPrePublishPanel>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2D,IAAAM,WAAA,GAAAN,OAAA;AAX3D;AACA;AACA;;AAKA;AACA;AACA;;AAIe,SAASO,8BAA8BA,CAAA,EAAG;EACxD,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAC5BC,MAAM,IAAMA,MAAM,CAAEC,YAAoB,CAAC,CAACC,gBAAgB,CAAC,CAAC,EAC9D,EACD,CAAC;EAED,IAAK,CAAEJ,aAAa,CAACK,MAAM,EAAG;IAC7B,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAP,WAAA,CAAAQ,IAAA,EAACZ,OAAA,CAAAa,qBAAqB;IACrBC,KAAK,EAAG,IAAAC,aAAO;IACd;IACA,IAAAC,QAAE,EACD,iBAAiB,EACjB,kBAAkB,EAClBV,aAAa,CAACK,MACf,CAAC,EACDL,aAAa,CAACK,MACf,CAAG;IACHM,WAAW;IAAAC,QAAA,gBAEX,IAAAd,WAAA,CAAAe,GAAA;MAAGC,SAAS,EAAC,0CAA0C;MAAAF,QAAA,EACpD,IAAAF,QAAE,EACH,kDAAkD,EAClD,oDAAoD,EACpDV,aAAa,CAACK,MACf;IAAC,CACC,CAAC,eACJ,IAAAP,WAAA,CAAAe,GAAA,EAAClB,YAAA,CAAAoB,OAAW;MAACC,KAAK,EAAGhB;IAAe,CAAE,CAAC;EAAA,CACjB,CAAC;AAE1B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugins/installed-blocks-pre-publish-panel/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PluginPrePublishPanel } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport CompactList from '../../components/compact-list';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstalledBlocksPrePublishPanel() {\n\tconst newBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getNewBlockTypes(),\n\t\t[]\n\t);\n\n\tif ( ! newBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PluginPrePublishPanel\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %d: number of blocks (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Added: %d block',\n\t\t\t\t\t'Added: %d blocks',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t),\n\t\t\t\tnewBlockTypes.length\n\t\t\t) }\n\t\t\tinitialOpen\n\t\t>\n\t\t\t<p className=\"installed-blocks-pre-publish-panel__copy\">\n\t\t\t\t{ _n(\n\t\t\t\t\t'The following block has been added to your site.',\n\t\t\t\t\t'The following blocks have been added to your site.',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<CompactList items={ newBlockTypes } />\n\t\t</PluginPrePublishPanel>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBE;AArBF,kBAA4B;AAC5B,kBAA0B;AAC1B,oBAAsC;AAKtC,0BAAwB;AACxB,mBAA6C;AAE9B,SAAR,iCAAkD;AACxD,QAAM,oBAAgB;AAAA,IACrB,CAAE,WAAY,OAAQ,aAAAA,KAAoB,EAAE,iBAAiB;AAAA,IAC7D,CAAC;AAAA,EACF;AAEA,MAAK,CAAE,cAAc,QAAS;AAC7B,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAQ;AAAA;AAAA,YAEP;AAAA,UACC;AAAA,UACA;AAAA,UACA,cAAc;AAAA,QACf;AAAA,QACA,cAAc;AAAA,MACf;AAAA,MACA,aAAW;AAAA,MAEX;AAAA,oDAAC,OAAE,WAAU,4CACV;AAAA,UACD;AAAA,UACA;AAAA,UACA,cAAc;AAAA,QACf,GACD;AAAA,QACA,4CAAC,oBAAAC,SAAA,EAAY,OAAQ,eAAgB;AAAA;AAAA;AAAA,EACtC;AAEF;",
6
+ "names": ["blockDirectoryStore", "CompactList"]
7
+ }
@@ -1,161 +1,159 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var actions_exports = {};
29
+ __export(actions_exports, {
30
+ addInstalledBlockType: () => addInstalledBlockType,
31
+ clearErrorNotice: () => clearErrorNotice,
32
+ fetchDownloadableBlocks: () => fetchDownloadableBlocks,
33
+ installBlockType: () => installBlockType,
34
+ receiveDownloadableBlocks: () => receiveDownloadableBlocks,
35
+ removeInstalledBlockType: () => removeInstalledBlockType,
36
+ setErrorNotice: () => setErrorNotice,
37
+ setIsInstalling: () => setIsInstalling,
38
+ uninstallBlockType: () => uninstallBlockType
6
39
  });
7
- exports.addInstalledBlockType = addInstalledBlockType;
8
- exports.clearErrorNotice = clearErrorNotice;
9
- exports.fetchDownloadableBlocks = fetchDownloadableBlocks;
10
- exports.installBlockType = void 0;
11
- exports.receiveDownloadableBlocks = receiveDownloadableBlocks;
12
- exports.removeInstalledBlockType = removeInstalledBlockType;
13
- exports.setErrorNotice = setErrorNotice;
14
- exports.setIsInstalling = setIsInstalling;
15
- exports.uninstallBlockType = void 0;
16
- var _blocks = require("@wordpress/blocks");
17
- var _i18n = require("@wordpress/i18n");
18
- var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
19
- var _notices = require("@wordpress/notices");
20
- var _url = require("@wordpress/url");
21
- var _loadAssets = require("./load-assets");
22
- var _getPluginUrl = _interopRequireDefault(require("./utils/get-plugin-url"));
23
- /**
24
- * WordPress dependencies
25
- */
26
-
27
- /**
28
- * Internal dependencies
29
- */
30
-
31
- /**
32
- * Returns an action object used in signalling that the downloadable blocks
33
- * have been requested and are loading.
34
- *
35
- * @param {string} filterValue Search string.
36
- *
37
- * @return {Object} Action object.
38
- */
40
+ module.exports = __toCommonJS(actions_exports);
41
+ var import_blocks = require("@wordpress/blocks");
42
+ var import_i18n = require("@wordpress/i18n");
43
+ var import_api_fetch = __toESM(require("@wordpress/api-fetch"));
44
+ var import_notices = require("@wordpress/notices");
45
+ var import_url = require("@wordpress/url");
46
+ var import_load_assets = require("./load-assets");
47
+ var import_get_plugin_url = __toESM(require("./utils/get-plugin-url"));
39
48
  function fetchDownloadableBlocks(filterValue) {
40
- return {
41
- type: 'FETCH_DOWNLOADABLE_BLOCKS',
42
- filterValue
43
- };
49
+ return { type: "FETCH_DOWNLOADABLE_BLOCKS", filterValue };
44
50
  }
45
-
46
- /**
47
- * Returns an action object used in signalling that the downloadable blocks
48
- * have been updated.
49
- *
50
- * @param {Array} downloadableBlocks Downloadable blocks.
51
- * @param {string} filterValue Search string.
52
- *
53
- * @return {Object} Action object.
54
- */
55
51
  function receiveDownloadableBlocks(downloadableBlocks, filterValue) {
56
52
  return {
57
- type: 'RECEIVE_DOWNLOADABLE_BLOCKS',
53
+ type: "RECEIVE_DOWNLOADABLE_BLOCKS",
58
54
  downloadableBlocks,
59
55
  filterValue
60
56
  };
61
57
  }
62
-
63
- /**
64
- * Action triggered to install a block plugin.
65
- *
66
- * @param {Object} block The block item returned by search.
67
- *
68
- * @return {boolean} Whether the block was successfully installed & loaded.
69
- */
70
- const installBlockType = block => async ({
71
- registry,
72
- dispatch
73
- }) => {
74
- const {
75
- id,
76
- name
77
- } = block;
58
+ const installBlockType = (block) => async ({ registry, dispatch }) => {
59
+ const { id, name } = block;
78
60
  let success = false;
79
61
  dispatch.clearErrorNotice(id);
80
62
  try {
81
63
  dispatch.setIsInstalling(id, true);
82
-
83
- // If we have a wp:plugin link, the plugin is installed but inactive.
84
- const url = (0, _getPluginUrl.default)(block);
64
+ const url = (0, import_get_plugin_url.default)(block);
85
65
  let links = {};
86
66
  if (url) {
87
- await (0, _apiFetch.default)({
88
- method: 'PUT',
67
+ await (0, import_api_fetch.default)({
68
+ method: "PUT",
89
69
  url,
90
- data: {
91
- status: 'active'
92
- }
70
+ data: { status: "active" }
93
71
  });
94
72
  } else {
95
- const response = await (0, _apiFetch.default)({
96
- method: 'POST',
97
- path: 'wp/v2/plugins',
98
- data: {
99
- slug: id,
100
- status: 'active'
101
- }
73
+ const response = await (0, import_api_fetch.default)({
74
+ method: "POST",
75
+ path: "wp/v2/plugins",
76
+ data: { slug: id, status: "active" }
102
77
  });
103
- // Add the `self` link for newly-installed blocks.
104
78
  links = response._links;
105
79
  }
106
80
  dispatch.addInstalledBlockType({
107
81
  ...block,
108
- links: {
109
- ...block.links,
110
- ...links
111
- }
82
+ links: { ...block.links, ...links }
112
83
  });
113
-
114
- // Ensures that the block metadata is propagated to the editor when registered on the server.
115
- const metadataFields = ['api_version', 'title', 'category', 'parent', 'ancestor', 'icon', 'description', 'keywords', 'attributes', 'provides_context', 'uses_context', 'selectors', 'supports', 'styles', 'example', 'variations', 'allowed_blocks', 'block_hooks'];
116
- await (0, _apiFetch.default)({
117
- path: (0, _url.addQueryArgs)(`/wp/v2/block-types/${name}`, {
84
+ const metadataFields = [
85
+ "api_version",
86
+ "title",
87
+ "category",
88
+ "parent",
89
+ "ancestor",
90
+ "icon",
91
+ "description",
92
+ "keywords",
93
+ "attributes",
94
+ "provides_context",
95
+ "uses_context",
96
+ "selectors",
97
+ "supports",
98
+ "styles",
99
+ "example",
100
+ "variations",
101
+ "allowed_blocks",
102
+ "block_hooks"
103
+ ];
104
+ await (0, import_api_fetch.default)({
105
+ path: (0, import_url.addQueryArgs)(`/wp/v2/block-types/${name}`, {
118
106
  _fields: metadataFields
119
107
  })
120
- })
121
- // Ignore when the block is not registered on the server.
122
- .catch(() => {}).then(response => {
108
+ }).catch(() => {
109
+ }).then((response) => {
123
110
  if (!response) {
124
111
  return;
125
112
  }
126
- (0, _blocks.unstable__bootstrapServerSideBlockDefinitions)({
127
- [name]: Object.fromEntries(Object.entries(response).filter(([key]) => metadataFields.includes(key)))
113
+ (0, import_blocks.unstable__bootstrapServerSideBlockDefinitions)({
114
+ [name]: Object.fromEntries(
115
+ Object.entries(response).filter(
116
+ ([key]) => metadataFields.includes(key)
117
+ )
118
+ )
128
119
  });
129
120
  });
130
- await (0, _loadAssets.loadAssets)();
131
- const registeredBlocks = registry.select(_blocks.store).getBlockTypes();
132
- if (!registeredBlocks.some(i => i.name === name)) {
133
- throw new Error((0, _i18n.__)('Error registering block. Try reloading the page.'));
121
+ await (0, import_load_assets.loadAssets)();
122
+ const registeredBlocks = registry.select(import_blocks.store).getBlockTypes();
123
+ if (!registeredBlocks.some((i) => i.name === name)) {
124
+ throw new Error(
125
+ (0, import_i18n.__)("Error registering block. Try reloading the page.")
126
+ );
134
127
  }
135
- registry.dispatch(_notices.store).createInfoNotice((0, _i18n.sprintf)(
136
- // translators: %s is the block title.
137
- (0, _i18n.__)('Block %s installed and added.'), block.title), {
138
- speak: true,
139
- type: 'snackbar'
140
- });
128
+ registry.dispatch(import_notices.store).createInfoNotice(
129
+ (0, import_i18n.sprintf)(
130
+ // translators: %s is the block title.
131
+ (0, import_i18n.__)("Block %s installed and added."),
132
+ block.title
133
+ ),
134
+ {
135
+ speak: true,
136
+ type: "snackbar"
137
+ }
138
+ );
141
139
  success = true;
142
140
  } catch (error) {
143
- let message = error.message || (0, _i18n.__)('An error occurred.');
144
-
145
- // Errors we throw are fatal.
141
+ let message = error.message || (0, import_i18n.__)("An error occurred.");
146
142
  let isFatal = error instanceof Error;
147
-
148
- // Specific API errors that are fatal.
149
143
  const fatalAPIErrors = {
150
- folder_exists: (0, _i18n.__)('This block is already installed. Try reloading the page.'),
151
- unable_to_connect_to_filesystem: (0, _i18n.__)('Error installing block. You can reload the page and try again.')
144
+ folder_exists: (0, import_i18n.__)(
145
+ "This block is already installed. Try reloading the page."
146
+ ),
147
+ unable_to_connect_to_filesystem: (0, import_i18n.__)(
148
+ "Error installing block. You can reload the page and try again."
149
+ )
152
150
  };
153
151
  if (fatalAPIErrors[error.code]) {
154
152
  isFatal = true;
155
153
  message = fatalAPIErrors[error.code];
156
154
  }
157
155
  dispatch.setErrorNotice(id, message, isFatal);
158
- registry.dispatch(_notices.store).createErrorNotice(message, {
156
+ registry.dispatch(import_notices.store).createErrorNotice(message, {
159
157
  speak: true,
160
158
  isDismissible: true
161
159
  });
@@ -163,112 +161,68 @@ const installBlockType = block => async ({
163
161
  dispatch.setIsInstalling(id, false);
164
162
  return success;
165
163
  };
166
-
167
- /**
168
- * Action triggered to uninstall a block plugin.
169
- *
170
- * @param {Object} block The blockType object.
171
- */
172
- exports.installBlockType = installBlockType;
173
- const uninstallBlockType = block => async ({
174
- registry,
175
- dispatch
176
- }) => {
164
+ const uninstallBlockType = (block) => async ({ registry, dispatch }) => {
177
165
  try {
178
- const url = (0, _getPluginUrl.default)(block);
179
- await (0, _apiFetch.default)({
180
- method: 'PUT',
166
+ const url = (0, import_get_plugin_url.default)(block);
167
+ await (0, import_api_fetch.default)({
168
+ method: "PUT",
181
169
  url,
182
- data: {
183
- status: 'inactive'
184
- }
170
+ data: { status: "inactive" }
185
171
  });
186
- await (0, _apiFetch.default)({
187
- method: 'DELETE',
172
+ await (0, import_api_fetch.default)({
173
+ method: "DELETE",
188
174
  url
189
175
  });
190
176
  dispatch.removeInstalledBlockType(block);
191
177
  } catch (error) {
192
- registry.dispatch(_notices.store).createErrorNotice(error.message || (0, _i18n.__)('An error occurred.'));
178
+ registry.dispatch(import_notices.store).createErrorNotice(
179
+ error.message || (0, import_i18n.__)("An error occurred.")
180
+ );
193
181
  }
194
182
  };
195
-
196
- /**
197
- * Returns an action object used to add a block type to the "newly installed"
198
- * tracking list.
199
- *
200
- * @param {Object} item The block item with the block id and name.
201
- *
202
- * @return {Object} Action object.
203
- */
204
- exports.uninstallBlockType = uninstallBlockType;
205
183
  function addInstalledBlockType(item) {
206
184
  return {
207
- type: 'ADD_INSTALLED_BLOCK_TYPE',
185
+ type: "ADD_INSTALLED_BLOCK_TYPE",
208
186
  item
209
187
  };
210
188
  }
211
-
212
- /**
213
- * Returns an action object used to remove a block type from the "newly installed"
214
- * tracking list.
215
- *
216
- * @param {string} item The block item with the block id and name.
217
- *
218
- * @return {Object} Action object.
219
- */
220
189
  function removeInstalledBlockType(item) {
221
190
  return {
222
- type: 'REMOVE_INSTALLED_BLOCK_TYPE',
191
+ type: "REMOVE_INSTALLED_BLOCK_TYPE",
223
192
  item
224
193
  };
225
194
  }
226
-
227
- /**
228
- * Returns an action object used to indicate install in progress.
229
- *
230
- * @param {string} blockId
231
- * @param {boolean} isInstalling
232
- *
233
- * @return {Object} Action object.
234
- */
235
195
  function setIsInstalling(blockId, isInstalling) {
236
196
  return {
237
- type: 'SET_INSTALLING_BLOCK',
197
+ type: "SET_INSTALLING_BLOCK",
238
198
  blockId,
239
199
  isInstalling
240
200
  };
241
201
  }
242
-
243
- /**
244
- * Sets an error notice to be displayed to the user for a given block.
245
- *
246
- * @param {string} blockId The ID of the block plugin. eg: my-block
247
- * @param {string} message The message shown in the notice.
248
- * @param {boolean} isFatal Whether the user can recover from the error.
249
- *
250
- * @return {Object} Action object.
251
- */
252
202
  function setErrorNotice(blockId, message, isFatal = false) {
253
203
  return {
254
- type: 'SET_ERROR_NOTICE',
204
+ type: "SET_ERROR_NOTICE",
255
205
  blockId,
256
206
  message,
257
207
  isFatal
258
208
  };
259
209
  }
260
-
261
- /**
262
- * Sets the error notice to empty for specific block.
263
- *
264
- * @param {string} blockId The ID of the block plugin. eg: my-block
265
- *
266
- * @return {Object} Action object.
267
- */
268
210
  function clearErrorNotice(blockId) {
269
211
  return {
270
- type: 'CLEAR_ERROR_NOTICE',
212
+ type: "CLEAR_ERROR_NOTICE",
271
213
  blockId
272
214
  };
273
215
  }
274
- //# sourceMappingURL=actions.js.map
216
+ // Annotate the CommonJS export names for ESM import in node:
217
+ 0 && (module.exports = {
218
+ addInstalledBlockType,
219
+ clearErrorNotice,
220
+ fetchDownloadableBlocks,
221
+ installBlockType,
222
+ receiveDownloadableBlocks,
223
+ removeInstalledBlockType,
224
+ setErrorNotice,
225
+ setIsInstalling,
226
+ uninstallBlockType
227
+ });
228
+ //# sourceMappingURL=actions.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_blocks","require","_i18n","_apiFetch","_interopRequireDefault","_notices","_url","_loadAssets","_getPluginUrl","fetchDownloadableBlocks","filterValue","type","receiveDownloadableBlocks","downloadableBlocks","installBlockType","block","registry","dispatch","id","name","success","clearErrorNotice","setIsInstalling","url","getPluginUrl","links","apiFetch","method","data","status","response","path","slug","_links","addInstalledBlockType","metadataFields","addQueryArgs","_fields","catch","then","unstable__bootstrapServerSideBlockDefinitions","Object","fromEntries","entries","filter","key","includes","loadAssets","registeredBlocks","select","blocksStore","getBlockTypes","some","i","Error","__","noticesStore","createInfoNotice","sprintf","title","speak","error","message","isFatal","fatalAPIErrors","folder_exists","unable_to_connect_to_filesystem","code","setErrorNotice","createErrorNotice","isDismissible","exports","uninstallBlockType","removeInstalledBlockType","item","blockId","isInstalling"],"sources":["@wordpress/block-directory/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tstore as blocksStore,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n} from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { loadAssets } from './load-assets';\nimport getPluginUrl from './utils/get-plugin-url';\n\n/**\n * Returns an action object used in signalling that the downloadable blocks\n * have been requested and are loading.\n *\n * @param {string} filterValue Search string.\n *\n * @return {Object} Action object.\n */\nexport function fetchDownloadableBlocks( filterValue ) {\n\treturn { type: 'FETCH_DOWNLOADABLE_BLOCKS', filterValue };\n}\n\n/**\n * Returns an action object used in signalling that the downloadable blocks\n * have been updated.\n *\n * @param {Array} downloadableBlocks Downloadable blocks.\n * @param {string} filterValue Search string.\n *\n * @return {Object} Action object.\n */\nexport function receiveDownloadableBlocks( downloadableBlocks, filterValue ) {\n\treturn {\n\t\ttype: 'RECEIVE_DOWNLOADABLE_BLOCKS',\n\t\tdownloadableBlocks,\n\t\tfilterValue,\n\t};\n}\n\n/**\n * Action triggered to install a block plugin.\n *\n * @param {Object} block The block item returned by search.\n *\n * @return {boolean} Whether the block was successfully installed & loaded.\n */\nexport const installBlockType =\n\t( block ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\tconst { id, name } = block;\n\t\tlet success = false;\n\t\tdispatch.clearErrorNotice( id );\n\t\ttry {\n\t\t\tdispatch.setIsInstalling( id, true );\n\n\t\t\t// If we have a wp:plugin link, the plugin is installed but inactive.\n\t\t\tconst url = getPluginUrl( block );\n\t\t\tlet links = {};\n\t\t\tif ( url ) {\n\t\t\t\tawait apiFetch( {\n\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\turl,\n\t\t\t\t\tdata: { status: 'active' },\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst response = await apiFetch( {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tpath: 'wp/v2/plugins',\n\t\t\t\t\tdata: { slug: id, status: 'active' },\n\t\t\t\t} );\n\t\t\t\t// Add the `self` link for newly-installed blocks.\n\t\t\t\tlinks = response._links;\n\t\t\t}\n\n\t\t\tdispatch.addInstalledBlockType( {\n\t\t\t\t...block,\n\t\t\t\tlinks: { ...block.links, ...links },\n\t\t\t} );\n\n\t\t\t// Ensures that the block metadata is propagated to the editor when registered on the server.\n\t\t\tconst metadataFields = [\n\t\t\t\t'api_version',\n\t\t\t\t'title',\n\t\t\t\t'category',\n\t\t\t\t'parent',\n\t\t\t\t'ancestor',\n\t\t\t\t'icon',\n\t\t\t\t'description',\n\t\t\t\t'keywords',\n\t\t\t\t'attributes',\n\t\t\t\t'provides_context',\n\t\t\t\t'uses_context',\n\t\t\t\t'selectors',\n\t\t\t\t'supports',\n\t\t\t\t'styles',\n\t\t\t\t'example',\n\t\t\t\t'variations',\n\t\t\t\t'allowed_blocks',\n\t\t\t\t'block_hooks',\n\t\t\t];\n\t\t\tawait apiFetch( {\n\t\t\t\tpath: addQueryArgs( `/wp/v2/block-types/${ name }`, {\n\t\t\t\t\t_fields: metadataFields,\n\t\t\t\t} ),\n\t\t\t} )\n\t\t\t\t// Ignore when the block is not registered on the server.\n\t\t\t\t.catch( () => {} )\n\t\t\t\t.then( ( response ) => {\n\t\t\t\t\tif ( ! response ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tunstable__bootstrapServerSideBlockDefinitions( {\n\t\t\t\t\t\t[ name ]: Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( response ).filter( ( [ key ] ) =>\n\t\t\t\t\t\t\t\tmetadataFields.includes( key )\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\n\t\t\tawait loadAssets();\n\t\t\tconst registeredBlocks = registry\n\t\t\t\t.select( blocksStore )\n\t\t\t\t.getBlockTypes();\n\t\t\tif ( ! registeredBlocks.some( ( i ) => i.name === name ) ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t__( 'Error registering block. Try reloading the page.' )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createInfoNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s is the block title.\n\t\t\t\t\t__( 'Block %s installed and added.' ),\n\t\t\t\t\tblock.title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tspeak: true,\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t\tsuccess = true;\n\t\t} catch ( error ) {\n\t\t\tlet message = error.message || __( 'An error occurred.' );\n\n\t\t\t// Errors we throw are fatal.\n\t\t\tlet isFatal = error instanceof Error;\n\n\t\t\t// Specific API errors that are fatal.\n\t\t\tconst fatalAPIErrors = {\n\t\t\t\tfolder_exists: __(\n\t\t\t\t\t'This block is already installed. Try reloading the page.'\n\t\t\t\t),\n\t\t\t\tunable_to_connect_to_filesystem: __(\n\t\t\t\t\t'Error installing block. You can reload the page and try again.'\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tif ( fatalAPIErrors[ error.code ] ) {\n\t\t\t\tisFatal = true;\n\t\t\t\tmessage = fatalAPIErrors[ error.code ];\n\t\t\t}\n\n\t\t\tdispatch.setErrorNotice( id, message, isFatal );\n\t\t\tregistry.dispatch( noticesStore ).createErrorNotice( message, {\n\t\t\t\tspeak: true,\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t}\n\t\tdispatch.setIsInstalling( id, false );\n\t\treturn success;\n\t};\n\n/**\n * Action triggered to uninstall a block plugin.\n *\n * @param {Object} block The blockType object.\n */\nexport const uninstallBlockType =\n\t( block ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\ttry {\n\t\t\tconst url = getPluginUrl( block );\n\t\t\tawait apiFetch( {\n\t\t\t\tmethod: 'PUT',\n\t\t\t\turl,\n\t\t\t\tdata: { status: 'inactive' },\n\t\t\t} );\n\t\t\tawait apiFetch( {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\turl,\n\t\t\t} );\n\t\t\tdispatch.removeInstalledBlockType( block );\n\t\t} catch ( error ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice(\n\t\t\t\t\terror.message || __( 'An error occurred.' )\n\t\t\t\t);\n\t\t}\n\t};\n\n/**\n * Returns an action object used to add a block type to the \"newly installed\"\n * tracking list.\n *\n * @param {Object} item The block item with the block id and name.\n *\n * @return {Object} Action object.\n */\nexport function addInstalledBlockType( item ) {\n\treturn {\n\t\ttype: 'ADD_INSTALLED_BLOCK_TYPE',\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used to remove a block type from the \"newly installed\"\n * tracking list.\n *\n * @param {string} item The block item with the block id and name.\n *\n * @return {Object} Action object.\n */\nexport function removeInstalledBlockType( item ) {\n\treturn {\n\t\ttype: 'REMOVE_INSTALLED_BLOCK_TYPE',\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used to indicate install in progress.\n *\n * @param {string} blockId\n * @param {boolean} isInstalling\n *\n * @return {Object} Action object.\n */\nexport function setIsInstalling( blockId, isInstalling ) {\n\treturn {\n\t\ttype: 'SET_INSTALLING_BLOCK',\n\t\tblockId,\n\t\tisInstalling,\n\t};\n}\n\n/**\n * Sets an error notice to be displayed to the user for a given block.\n *\n * @param {string} blockId The ID of the block plugin. eg: my-block\n * @param {string} message The message shown in the notice.\n * @param {boolean} isFatal Whether the user can recover from the error.\n *\n * @return {Object} Action object.\n */\nexport function setErrorNotice( blockId, message, isFatal = false ) {\n\treturn {\n\t\ttype: 'SET_ERROR_NOTICE',\n\t\tblockId,\n\t\tmessage,\n\t\tisFatal,\n\t};\n}\n\n/**\n * Sets the error notice to empty for specific block.\n *\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {Object} Action object.\n */\nexport function clearErrorNotice( blockId ) {\n\treturn {\n\t\ttype: 'CLEAR_ERROR_NOTICE',\n\t\tblockId,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAhBA;AACA;AACA;;AAUA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,uBAAuBA,CAAEC,WAAW,EAAG;EACtD,OAAO;IAAEC,IAAI,EAAE,2BAA2B;IAAED;EAAY,CAAC;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,yBAAyBA,CAAEC,kBAAkB,EAAEH,WAAW,EAAG;EAC5E,OAAO;IACNC,IA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AAG;IACjB7C,QAAQ,CACNC,QAAQ,CAAEuC,cAAa,CAAC,CACxBa,iBAAiB,CACjBR,KAAK,CAACC,OAAO,IAAI,IAAAP,QAAE,EAAE,oBAAqB,CAC3C,CAAC;EACH;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAgB,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAQO,SAAStC,qBAAqBA,CAAEwC,IAAI,EAAG;EAC7C,OAAO;IACN/D,IAAI,EAAE,0BAA0B;IAChC+D;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASD,wBAAwBA,CAAEC,IAAI,EAAG;EAChD,OAAO;IACN/D,IAAI,EAAE,6BAA6B;IACnC+D;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASpD,eAAeA,CAAEqD,OAAO,EAAEC,YAAY,EAAG;EACxD,OAAO;IACNjE,IAAI,EAAE,sBAAsB;IAC5BgE,OAAO;IACPC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASR,cAAcA,CAAEO,OAAO,EAAEb,OAAO,EAAEC,OAAO,GAAG,KAAK,EAAG;EACnE,OAAO;IACNpD,IAAI,EAAE,kBAAkB;IACxBgE,OAAO;IACPb,OAAO;IACPC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS1C,gBAAgBA,CAAEsD,OAAO,EAAG;EAC3C,OAAO;IACNhE,IAAI,EAAE,oBAAoB;IAC1BgE;EACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/actions.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tstore as blocksStore,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n} from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { loadAssets } from './load-assets';\nimport getPluginUrl from './utils/get-plugin-url';\n\n/**\n * Returns an action object used in signalling that the downloadable blocks\n * have been requested and are loading.\n *\n * @param {string} filterValue Search string.\n *\n * @return {Object} Action object.\n */\nexport function fetchDownloadableBlocks( filterValue ) {\n\treturn { type: 'FETCH_DOWNLOADABLE_BLOCKS', filterValue };\n}\n\n/**\n * Returns an action object used in signalling that the downloadable blocks\n * have been updated.\n *\n * @param {Array} downloadableBlocks Downloadable blocks.\n * @param {string} filterValue Search string.\n *\n * @return {Object} Action object.\n */\nexport function receiveDownloadableBlocks( downloadableBlocks, filterValue ) {\n\treturn {\n\t\ttype: 'RECEIVE_DOWNLOADABLE_BLOCKS',\n\t\tdownloadableBlocks,\n\t\tfilterValue,\n\t};\n}\n\n/**\n * Action triggered to install a block plugin.\n *\n * @param {Object} block The block item returned by search.\n *\n * @return {boolean} Whether the block was successfully installed & loaded.\n */\nexport const installBlockType =\n\t( block ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\tconst { id, name } = block;\n\t\tlet success = false;\n\t\tdispatch.clearErrorNotice( id );\n\t\ttry {\n\t\t\tdispatch.setIsInstalling( id, true );\n\n\t\t\t// If we have a wp:plugin link, the plugin is installed but inactive.\n\t\t\tconst url = getPluginUrl( block );\n\t\t\tlet links = {};\n\t\t\tif ( url ) {\n\t\t\t\tawait apiFetch( {\n\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\turl,\n\t\t\t\t\tdata: { status: 'active' },\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst response = await apiFetch( {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tpath: 'wp/v2/plugins',\n\t\t\t\t\tdata: { slug: id, status: 'active' },\n\t\t\t\t} );\n\t\t\t\t// Add the `self` link for newly-installed blocks.\n\t\t\t\tlinks = response._links;\n\t\t\t}\n\n\t\t\tdispatch.addInstalledBlockType( {\n\t\t\t\t...block,\n\t\t\t\tlinks: { ...block.links, ...links },\n\t\t\t} );\n\n\t\t\t// Ensures that the block metadata is propagated to the editor when registered on the server.\n\t\t\tconst metadataFields = [\n\t\t\t\t'api_version',\n\t\t\t\t'title',\n\t\t\t\t'category',\n\t\t\t\t'parent',\n\t\t\t\t'ancestor',\n\t\t\t\t'icon',\n\t\t\t\t'description',\n\t\t\t\t'keywords',\n\t\t\t\t'attributes',\n\t\t\t\t'provides_context',\n\t\t\t\t'uses_context',\n\t\t\t\t'selectors',\n\t\t\t\t'supports',\n\t\t\t\t'styles',\n\t\t\t\t'example',\n\t\t\t\t'variations',\n\t\t\t\t'allowed_blocks',\n\t\t\t\t'block_hooks',\n\t\t\t];\n\t\t\tawait apiFetch( {\n\t\t\t\tpath: addQueryArgs( `/wp/v2/block-types/${ name }`, {\n\t\t\t\t\t_fields: metadataFields,\n\t\t\t\t} ),\n\t\t\t} )\n\t\t\t\t// Ignore when the block is not registered on the server.\n\t\t\t\t.catch( () => {} )\n\t\t\t\t.then( ( response ) => {\n\t\t\t\t\tif ( ! response ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tunstable__bootstrapServerSideBlockDefinitions( {\n\t\t\t\t\t\t[ name ]: Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( response ).filter( ( [ key ] ) =>\n\t\t\t\t\t\t\t\tmetadataFields.includes( key )\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\n\t\t\tawait loadAssets();\n\t\t\tconst registeredBlocks = registry\n\t\t\t\t.select( blocksStore )\n\t\t\t\t.getBlockTypes();\n\t\t\tif ( ! registeredBlocks.some( ( i ) => i.name === name ) ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t__( 'Error registering block. Try reloading the page.' )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createInfoNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s is the block title.\n\t\t\t\t\t__( 'Block %s installed and added.' ),\n\t\t\t\t\tblock.title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tspeak: true,\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t\tsuccess = true;\n\t\t} catch ( error ) {\n\t\t\tlet message = error.message || __( 'An error occurred.' );\n\n\t\t\t// Errors we throw are fatal.\n\t\t\tlet isFatal = error instanceof Error;\n\n\t\t\t// Specific API errors that are fatal.\n\t\t\tconst fatalAPIErrors = {\n\t\t\t\tfolder_exists: __(\n\t\t\t\t\t'This block is already installed. Try reloading the page.'\n\t\t\t\t),\n\t\t\t\tunable_to_connect_to_filesystem: __(\n\t\t\t\t\t'Error installing block. You can reload the page and try again.'\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tif ( fatalAPIErrors[ error.code ] ) {\n\t\t\t\tisFatal = true;\n\t\t\t\tmessage = fatalAPIErrors[ error.code ];\n\t\t\t}\n\n\t\t\tdispatch.setErrorNotice( id, message, isFatal );\n\t\t\tregistry.dispatch( noticesStore ).createErrorNotice( message, {\n\t\t\t\tspeak: true,\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t}\n\t\tdispatch.setIsInstalling( id, false );\n\t\treturn success;\n\t};\n\n/**\n * Action triggered to uninstall a block plugin.\n *\n * @param {Object} block The blockType object.\n */\nexport const uninstallBlockType =\n\t( block ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\ttry {\n\t\t\tconst url = getPluginUrl( block );\n\t\t\tawait apiFetch( {\n\t\t\t\tmethod: 'PUT',\n\t\t\t\turl,\n\t\t\t\tdata: { status: 'inactive' },\n\t\t\t} );\n\t\t\tawait apiFetch( {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\turl,\n\t\t\t} );\n\t\t\tdispatch.removeInstalledBlockType( block );\n\t\t} catch ( error ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice(\n\t\t\t\t\terror.message || __( 'An error occurred.' )\n\t\t\t\t);\n\t\t}\n\t};\n\n/**\n * Returns an action object used to add a block type to the \"newly installed\"\n * tracking list.\n *\n * @param {Object} item The block item with the block id and name.\n *\n * @return {Object} Action object.\n */\nexport function addInstalledBlockType( item ) {\n\treturn {\n\t\ttype: 'ADD_INSTALLED_BLOCK_TYPE',\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used to remove a block type from the \"newly installed\"\n * tracking list.\n *\n * @param {string} item The block item with the block id and name.\n *\n * @return {Object} Action object.\n */\nexport function removeInstalledBlockType( item ) {\n\treturn {\n\t\ttype: 'REMOVE_INSTALLED_BLOCK_TYPE',\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used to indicate install in progress.\n *\n * @param {string} blockId\n * @param {boolean} isInstalling\n *\n * @return {Object} Action object.\n */\nexport function setIsInstalling( blockId, isInstalling ) {\n\treturn {\n\t\ttype: 'SET_INSTALLING_BLOCK',\n\t\tblockId,\n\t\tisInstalling,\n\t};\n}\n\n/**\n * Sets an error notice to be displayed to the user for a given block.\n *\n * @param {string} blockId The ID of the block plugin. eg: my-block\n * @param {string} message The message shown in the notice.\n * @param {boolean} isFatal Whether the user can recover from the error.\n *\n * @return {Object} Action object.\n */\nexport function setErrorNotice( blockId, message, isFatal = false ) {\n\treturn {\n\t\ttype: 'SET_ERROR_NOTICE',\n\t\tblockId,\n\t\tmessage,\n\t\tisFatal,\n\t};\n}\n\n/**\n * Sets the error notice to empty for specific block.\n *\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {Object} Action object.\n */\nexport function clearErrorNotice( blockId ) {\n\treturn {\n\t\ttype: 'CLEAR_ERROR_NOTICE',\n\t\tblockId,\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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