@wordpress/block-directory 5.34.0 → 5.35.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 (103) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/auto-block-uninstaller/index.js +2 -0
  3. package/build/components/auto-block-uninstaller/index.js.map +1 -1
  4. package/build/components/block-ratings/index.js +4 -2
  5. package/build/components/block-ratings/index.js.map +1 -1
  6. package/build/components/block-ratings/stars.js +3 -1
  7. package/build/components/block-ratings/stars.js.map +1 -1
  8. package/build/components/compact-list/index.js +3 -1
  9. package/build/components/compact-list/index.js.map +1 -1
  10. package/build/components/downloadable-block-icon/index.js +3 -1
  11. package/build/components/downloadable-block-icon/index.js.map +1 -1
  12. package/build/components/downloadable-block-list-item/index.js +3 -1
  13. package/build/components/downloadable-block-list-item/index.js.map +1 -1
  14. package/build/components/downloadable-block-notice/index.js +4 -2
  15. package/build/components/downloadable-block-notice/index.js.map +1 -1
  16. package/build/components/downloadable-blocks-list/index.js +4 -2
  17. package/build/components/downloadable-blocks-list/index.js.map +1 -1
  18. package/build/components/downloadable-blocks-panel/index.js +5 -3
  19. package/build/components/downloadable-blocks-panel/index.js.map +1 -1
  20. package/build/components/downloadable-blocks-panel/inserter-panel.js +3 -1
  21. package/build/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  22. package/build/components/downloadable-blocks-panel/no-results.js +3 -1
  23. package/build/components/downloadable-blocks-panel/no-results.js.map +1 -1
  24. package/build/index.js +2 -0
  25. package/build/index.js.map +1 -1
  26. package/build/lock-unlock.js +3 -1
  27. package/build/lock-unlock.js.map +1 -1
  28. package/build/plugins/get-install-missing/index.js +5 -3
  29. package/build/plugins/get-install-missing/index.js.map +2 -2
  30. package/build/plugins/get-install-missing/install-button.js +3 -1
  31. package/build/plugins/get-install-missing/install-button.js.map +1 -1
  32. package/build/plugins/index.js +3 -1
  33. package/build/plugins/index.js.map +1 -1
  34. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +3 -1
  35. package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  36. package/build/plugins/installed-blocks-pre-publish-panel/index.js +3 -1
  37. package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  38. package/build/store/actions.js +4 -2
  39. package/build/store/actions.js.map +1 -1
  40. package/build/store/index.js +5 -3
  41. package/build/store/index.js.map +1 -1
  42. package/build/store/load-assets.js +3 -1
  43. package/build/store/load-assets.js.map +1 -1
  44. package/build/store/reducer.js +5 -3
  45. package/build/store/reducer.js.map +1 -1
  46. package/build/store/resolvers.js +3 -1
  47. package/build/store/resolvers.js.map +1 -1
  48. package/build/store/selectors.js +5 -3
  49. package/build/store/selectors.js.map +1 -1
  50. package/build/store/utils/get-plugin-url.js +2 -0
  51. package/build/store/utils/get-plugin-url.js.map +1 -1
  52. package/build-module/components/auto-block-uninstaller/index.js +1 -0
  53. package/build-module/components/auto-block-uninstaller/index.js.map +1 -1
  54. package/build-module/components/block-ratings/index.js +3 -2
  55. package/build-module/components/block-ratings/index.js.map +1 -1
  56. package/build-module/components/block-ratings/stars.js +2 -1
  57. package/build-module/components/block-ratings/stars.js.map +1 -1
  58. package/build-module/components/compact-list/index.js +2 -1
  59. package/build-module/components/compact-list/index.js.map +1 -1
  60. package/build-module/components/downloadable-block-icon/index.js +2 -1
  61. package/build-module/components/downloadable-block-icon/index.js.map +1 -1
  62. package/build-module/components/downloadable-block-list-item/index.js +2 -1
  63. package/build-module/components/downloadable-block-list-item/index.js.map +1 -1
  64. package/build-module/components/downloadable-block-notice/index.js +3 -2
  65. package/build-module/components/downloadable-block-notice/index.js.map +1 -1
  66. package/build-module/components/downloadable-blocks-list/index.js +3 -2
  67. package/build-module/components/downloadable-blocks-list/index.js.map +1 -1
  68. package/build-module/components/downloadable-blocks-panel/index.js +4 -3
  69. package/build-module/components/downloadable-blocks-panel/index.js.map +1 -1
  70. package/build-module/components/downloadable-blocks-panel/inserter-panel.js +2 -1
  71. package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
  72. package/build-module/components/downloadable-blocks-panel/no-results.js +2 -1
  73. package/build-module/components/downloadable-blocks-panel/no-results.js.map +1 -1
  74. package/build-module/index.js +1 -0
  75. package/build-module/index.js.map +1 -1
  76. package/build-module/lock-unlock.js +2 -1
  77. package/build-module/lock-unlock.js.map +1 -1
  78. package/build-module/plugins/get-install-missing/index.js +4 -3
  79. package/build-module/plugins/get-install-missing/index.js.map +2 -2
  80. package/build-module/plugins/get-install-missing/install-button.js +2 -1
  81. package/build-module/plugins/get-install-missing/install-button.js.map +1 -1
  82. package/build-module/plugins/index.js +2 -1
  83. package/build-module/plugins/index.js.map +1 -1
  84. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +2 -1
  85. package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
  86. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +2 -1
  87. package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
  88. package/build-module/store/actions.js +3 -2
  89. package/build-module/store/actions.js.map +1 -1
  90. package/build-module/store/index.js +4 -3
  91. package/build-module/store/index.js.map +1 -1
  92. package/build-module/store/load-assets.js +2 -1
  93. package/build-module/store/load-assets.js.map +1 -1
  94. package/build-module/store/reducer.js +4 -3
  95. package/build-module/store/reducer.js.map +1 -1
  96. package/build-module/store/resolvers.js +2 -1
  97. package/build-module/store/resolvers.js.map +1 -1
  98. package/build-module/store/selectors.js +4 -3
  99. package/build-module/store/selectors.js.map +1 -1
  100. package/build-module/store/utils/get-plugin-url.js +1 -0
  101. package/build-module/store/utils/get-plugin-url.js.map +1 -1
  102. package/package.json +21 -21
  103. package/src/plugins/get-install-missing/index.js +0 -2
@@ -1,4 +1,4 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
+ // packages/block-directory/src/components/downloadable-blocks-panel/index.js
2
2
  import { __ } from "@wordpress/i18n";
3
3
  import { Spinner } from "@wordpress/components";
4
4
  import { store as coreStore } from "@wordpress/core-data";
@@ -8,8 +8,9 @@ import DownloadableBlocksList from "../downloadable-blocks-list";
8
8
  import DownloadableBlocksInserterPanel from "./inserter-panel";
9
9
  import DownloadableBlocksNoResults from "./no-results";
10
10
  import { store as blockDirectoryStore } from "../../store";
11
- const EMPTY_ARRAY = [];
12
- const useDownloadableBlocks = (filterValue) => useSelect(
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
+ var EMPTY_ARRAY = [];
13
+ var useDownloadableBlocks = (filterValue) => useSelect(
13
14
  (select) => {
14
15
  const {
15
16
  getDownloadableBlocks,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/downloadable-blocks-panel/index.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlocksList from '../downloadable-blocks-list';\nimport DownloadableBlocksInserterPanel from './inserter-panel';\nimport DownloadableBlocksNoResults from './no-results';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nconst useDownloadableBlocks = ( filterValue ) =>\n\tuseSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDownloadableBlocks,\n\t\t\t\tisRequestingDownloadableBlocks,\n\t\t\t\tgetInstalledBlockTypes,\n\t\t\t} = select( blockDirectoryStore );\n\n\t\t\tconst hasPermission = select( coreStore ).canUser(\n\t\t\t\t'read',\n\t\t\t\t'block-directory/search'\n\t\t\t);\n\n\t\t\tlet downloadableBlocks = EMPTY_ARRAY;\n\t\t\tif ( hasPermission ) {\n\t\t\t\tdownloadableBlocks = getDownloadableBlocks( filterValue );\n\n\t\t\t\t// Filter out blocks that are already installed.\n\t\t\t\tconst installedBlockTypes = getInstalledBlockTypes();\n\t\t\t\tconst installableBlocks = downloadableBlocks.filter(\n\t\t\t\t\t( { name } ) => {\n\t\t\t\t\t\t// Check if the block has just been installed, in which case it\n\t\t\t\t\t\t// should still show in the list to avoid suddenly disappearing.\n\t\t\t\t\t\t// `installedBlockTypes` only returns blocks stored in state\n\t\t\t\t\t\t// immediately after installation, not all installed blocks.\n\t\t\t\t\t\tconst isJustInstalled = installedBlockTypes.some(\n\t\t\t\t\t\t\t( blockType ) => blockType.name === name\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst isPreviouslyInstalled = getBlockType( name );\n\t\t\t\t\t\treturn isJustInstalled || ! isPreviouslyInstalled;\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Keep identity of the `downloadableBlocks` array if nothing was filtered out\n\t\t\t\tif ( installableBlocks.length !== downloadableBlocks.length ) {\n\t\t\t\t\tdownloadableBlocks = installableBlocks;\n\t\t\t\t}\n\n\t\t\t\t// Return identical empty array when there are no blocks\n\t\t\t\tif ( downloadableBlocks.length === 0 ) {\n\t\t\t\t\tdownloadableBlocks = EMPTY_ARRAY;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasPermission,\n\t\t\t\tdownloadableBlocks,\n\t\t\t\tisLoading: isRequestingDownloadableBlocks( filterValue ),\n\t\t\t};\n\t\t},\n\t\t[ filterValue ]\n\t);\n\nexport default function DownloadableBlocksPanel( {\n\tonSelect,\n\tonHover,\n\thasLocalBlocks,\n\tisTyping,\n\tfilterValue,\n} ) {\n\tconst { hasPermission, downloadableBlocks, isLoading } =\n\t\tuseDownloadableBlocks( filterValue );\n\n\tif ( hasPermission === undefined || isLoading || isTyping ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasPermission && ! hasLocalBlocks && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'No results available from your installed blocks.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel has-blocks-loading\">\n\t\t\t\t\t<Spinner />\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tif ( false === hasPermission ) {\n\t\tif ( ! hasLocalBlocks ) {\n\t\t\treturn <DownloadableBlocksNoResults />;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tif ( downloadableBlocks.length === 0 ) {\n\t\treturn hasLocalBlocks ? null : <DownloadableBlocksNoResults />;\n\t}\n\n\treturn (\n\t\t<DownloadableBlocksInserterPanel\n\t\t\tdownloadableItems={ downloadableBlocks }\n\t\t\thasLocalBlocks={ hasLocalBlocks }\n\t\t>\n\t\t\t<DownloadableBlocksList\n\t\t\t\titems={ downloadableBlocks }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tonHover={ onHover }\n\t\t\t/>\n\t\t</DownloadableBlocksInserterPanel>\n\t);\n}\n"],
5
- "mappings": "AAuFK,mBACC,KADD;AApFL,SAAS,UAAU;AACnB,SAAS,eAAe;AACxB,SAAS,SAAS,iBAAiB;AACnC,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAK7B,OAAO,4BAA4B;AACnC,OAAO,qCAAqC;AAC5C,OAAO,iCAAiC;AACxC,SAAS,SAAS,2BAA2B;AAE7C,MAAM,cAAc,CAAC;AAErB,MAAM,wBAAwB,CAAE,gBAC/B;AAAA,EACC,CAAE,WAAY;AACb,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,OAAQ,mBAAoB;AAEhC,UAAM,gBAAgB,OAAQ,SAAU,EAAE;AAAA,MACzC;AAAA,MACA;AAAA,IACD;AAEA,QAAI,qBAAqB;AACzB,QAAK,eAAgB;AACpB,2BAAqB,sBAAuB,WAAY;AAG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oB,UAAU,IACpD,sBAAuB,WAAY;AAEpC,MAAK,kBAAkB,UAAa,aAAa,UAAW;AAC3D,WACC,iCACG;AAAA,uBAAiB,CAAE,kBACpB,iCACC;AAAA,4BAAC,OAAE,WAAU,uDACV;AAAA,UACD;AAAA,QACD,GACD;AAAA,QACA,oBAAC,SAAI,WAAU,mDAAkD;AAAA,SAClE;AAAA,MAED,oBAAC,SAAI,WAAU,gEACd,8BAAC,WAAQ,GACV;AAAA,OACD;AAAA,EAEF;AAEA,MAAK,UAAU,eAAgB;AAC9B,QAAK,CAAE,gBAAiB;AACvB,aAAO,oBAAC,+BAA4B;AAAA,IACrC;AAEA,WAAO;AAAA,EACR;AAEA,MAAK,mBAAmB,WAAW,GAAI;AACtC,WAAO,iBAAiB,OAAO,oBAAC,+BAA4B;AAAA,EAC7D;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,mBAAoB;AAAA,MACpB;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ;AAAA,UACR;AAAA,UACA;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,8 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
+ // packages/block-directory/src/components/downloadable-blocks-panel/inserter-panel.js
2
2
  import { __, _n, sprintf } from "@wordpress/i18n";
3
3
  import { useEffect } from "@wordpress/element";
4
4
  import { speak } from "@wordpress/a11y";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
6
  function DownloadableBlocksInserterPanel({
6
7
  children,
7
8
  downloadableItems,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/downloadable-blocks-panel/inserter-panel.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\nfunction DownloadableBlocksInserterPanel( {\n\tchildren,\n\tdownloadableItems,\n\thasLocalBlocks,\n} ) {\n\tconst count = downloadableItems.length;\n\tuseEffect( () => {\n\t\tspeak(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of available blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'%d additional block is available to install.',\n\t\t\t\t\t'%d additional blocks are available to install.',\n\t\t\t\t\tcount\n\t\t\t\t),\n\t\t\t\tcount\n\t\t\t)\n\t\t);\n\t}, [ count ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! hasLocalBlocks && (\n\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t{ __( 'No results available from your installed blocks.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\n\t\t\t<div className=\"block-directory-downloadable-blocks-panel\">\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel__header\">\n\t\t\t\t\t<h2 className=\"block-directory-downloadable-blocks-panel__title\">\n\t\t\t\t\t\t{ __( 'Available to install' ) }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__description\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select a block to install and add it to your post.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksInserterPanel;\n"],
5
- "mappings": "AA4BE,mBAEE,KAQA,YAVF;AAzBF,SAAS,IAAI,IAAI,eAAe;AAChC,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AAEtB,SAAS,gCAAiC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,QAAQ,kBAAkB;AAChC,YAAW,MAAM;AAChB;AAAA,MACC;AAAA;AAAA,QAEC;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,QACA;AAAA,M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xs } from "react/jsx-runtime";
1
+ // packages/block-directory/src/components/downloadable-blocks-panel/no-results.js
2
2
  import { __ } from "@wordpress/i18n";
3
3
  import { Tip, ExternalLink } from "@wordpress/components";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
5
  function DownloadableBlocksNoResults() {
5
6
  return /* @__PURE__ */ jsxs(Fragment, { children: [
6
7
  /* @__PURE__ */ jsx("div", { className: "block-editor-inserter__no-results", children: /* @__PURE__ */ jsx("p", { children: __("No results found.") }) }),
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/downloadable-blocks-panel/no-results.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Tip, ExternalLink } from '@wordpress/components';\n\nfunction DownloadableBlocksNoResults() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__no-results\">\n\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t<Tip>\n\t\t\t\t\t{ __( 'Interested in creating your own block?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink href=\"https://developer.wordpress.org/block-editor/\">\n\t\t\t\t\t\t{ __( 'Get started here' ) }.\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</Tip>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksNoResults;\n"],
5
- "mappings": "AAQE,mBAEE,KAMC,YARH;AALF,SAAS,UAAU;AACnB,SAAS,KAAK,oBAAoB;AAElC,SAAS,8BAA8B;AACtC,SACC,iCACC;AAAA,wBAAC,SAAI,WAAU,qCACd,8BAAC,OAAI,aAAI,mBAAoB,GAAG,GACjC;AAAA,IACA,oBAAC,SAAI,WAAU,+BACd,+BAAC,OACE;AAAA,SAAI,wCAAyC;AAAA,MAC/C,oBAAC,QAAG;AAAA,MACJ,qBAAC,gBAAa,MAAK,iDAChB;AAAA,WAAI,kBAAmB;AAAA,QAAG;AAAA,SAC7B;AAAA,OACD,GACD;AAAA,KACD;AAEF;AAEA,IAAO,qBAAQ;",
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,KAAK,oBAAoB;AAIhC,mBAEE,KAMC,YARH;AAFF,SAAS,8BAA8B;AACtC,SACC,iCACC;AAAA,wBAAC,SAAI,WAAU,qCACd,8BAAC,OAAI,aAAI,mBAAoB,GAAG,GACjC;AAAA,IACA,oBAAC,SAAI,WAAU,+BACd,+BAAC,OACE;AAAA,SAAI,wCAAyC;AAAA,MAC/C,oBAAC,QAAG;AAAA,MACJ,qBAAC,gBAAa,MAAK,iDAChB;AAAA,WAAI,kBAAmB;AAAA,QAAG;AAAA,SAC7B;AAAA,OACD,GACD;AAAA,KACD;AAEF;AAEA,IAAO,qBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/block-directory/src/index.js
1
2
  import "./plugins";
2
3
  import { store } from "./store";
3
4
  export {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport './plugins';\n\nexport { store } from './store';\n"],
5
- "mappings": "AAGA,OAAO;AAEP,SAAS,aAAa;",
5
+ "mappings": ";AAGA,OAAO;AAEP,SAAS,aAAa;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
+ // packages/block-directory/src/lock-unlock.js
1
2
  import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from "@wordpress/private-apis";
2
- const { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules(
3
+ var { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules(
3
4
  "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
4
5
  "@wordpress/block-directory"
5
6
  );
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/lock-unlock.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/block-directory'\n\t);\n"],
5
- "mappings": "AAGA,SAAS,wDAAwD;AAE1D,MAAM,EAAE,MAAM,OAAO,IAC3B;AAAA,EACC;AAAA,EACA;AACD;",
5
+ "mappings": ";AAGA,SAAS,wDAAwD;AAE1D,IAAM,EAAE,MAAM,OAAO,IAC3B;AAAA,EACC;AAAA,EACA;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ // packages/block-directory/src/plugins/get-install-missing/index.js
2
2
  import { __, sprintf } from "@wordpress/i18n";
3
3
  import { Button } from "@wordpress/components";
4
4
  import { createBlock } from "@wordpress/blocks";
@@ -12,7 +12,8 @@ import {
12
12
  } from "@wordpress/block-editor";
13
13
  import InstallButton from "./install-button";
14
14
  import { store as blockDirectoryStore } from "../../store";
15
- const getInstallMissing = (OriginalComponent) => (props) => {
15
+ import { jsx, jsxs } from "react/jsx-runtime";
16
+ var getInstallMissing = (OriginalComponent) => (props) => {
16
17
  const { originalName } = props.attributes;
17
18
  const { block, hasPermission } = useSelect(
18
19
  (select) => {
@@ -35,7 +36,7 @@ const getInstallMissing = (OriginalComponent) => (props) => {
35
36
  }
36
37
  return /* @__PURE__ */ jsx(ModifiedWarning, { ...props, originalBlock: block });
37
38
  };
38
- const ModifiedWarning = ({ originalBlock, ...props }) => {
39
+ var ModifiedWarning = ({ originalBlock, ...props }) => {
39
40
  const { originalName, originalUndelimitedContent, clientId } = props.attributes;
40
41
  const { replaceBlock } = useDispatch(blockEditorStore);
41
42
  const convertToHTML = () => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/plugins/get-install-missing/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { RawHTML } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\t// Disable reason: This is a valid component, but it's mistaken for a callback.\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst { block, hasPermission } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getDownloadableBlocks } = select( blockDirectoryStore );\n\t\t\tconst blocks = getDownloadableBlocks(\n\t\t\t\t'block:' + originalName\n\t\t\t).filter( ( { name } ) => originalName === name );\n\t\t\treturn {\n\t\t\t\thasPermission: select( coreStore ).canUser(\n\t\t\t\t\t'read',\n\t\t\t\t\t'block-directory/search'\n\t\t\t\t),\n\t\t\t\tblock: blocks.length && blocks[ 0 ],\n\t\t\t};\n\t\t},\n\t\t[ originalName ]\n\t);\n\n\t// The user can't install blocks, or the block isn't available for download.\n\tif ( ! hasPermission || ! block ) {\n\t\treturn <OriginalComponent { ...props } />;\n\t}\n\n\treturn <ModifiedWarning { ...props } originalBlock={ block } />;\n};\n\nconst ModifiedWarning = ( { originalBlock, ...props } ) => {\n\tconst { originalName, originalUndelimitedContent, clientId } =\n\t\tprops.attributes;\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\tconst convertToHTML = () => {\n\t\treplaceBlock(\n\t\t\tprops.clientId,\n\t\t\tcreateBlock( 'core/html', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst hasHTMLBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn canInsertBlockType(\n\t\t\t\t'core/html',\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tlet messageHTML = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__(\n\t\t\t'Your site doesn\u2019t include support for the %s block. You can try installing the block or remove it entirely.'\n\t\t),\n\t\toriginalBlock.title || originalName\n\t);\n\tconst actions = [\n\t\t<InstallButton\n\t\t\tkey=\"install\"\n\t\t\tblock={ originalBlock }\n\t\t\tattributes={ props.attributes }\n\t\t\tclientId={ props.clientId }\n\t\t/>,\n\t];\n\n\tif ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn\u2019t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'\n\t\t\t),\n\t\t\toriginalBlock.title || originalName\n\t\t);\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tkey=\"convert\"\n\t\t\t\tonClick={ convertToHTML }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ __( 'Keep as HTML' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ originalUndelimitedContent }</RawHTML>\n\t\t</div>\n\t);\n};\n\nexport default getInstallMissing;\n"],
5
- "mappings": "AA4CS,cAsEP,YAtEO;AAzCT,SAAS,IAAI,eAAe;AAC5B,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,aAAa,iBAAiB;AACvC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,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAEA,MAAI,cAAc;AAAA;AAAA,IAEjB;AAAA,MACC;AAAA,IACD;AAAA,IACA,cAAc,SAAS;AAAA,EACxB;AACA,QAAM,UAAU;AAAA,IACf;AAAA,MAAC;AAAA;AAAA,QAEA,OAAQ;AAAA,QACR,YAAa,MAAM;AAAA,QACnB,UAAW,MAAM;AAAA;AAAA,MAHb;AAAA,IAIL;AAAA,EACD;AAEA,MAAK,cAAc,cAAe;AACjC,kBAAc;AAAA;AAAA,MAEb;AAAA,QACC;AAAA,MACD;AAAA,MACA,cAAc,SAAS;AAAA,IACxB;AACA,YAAQ;AAAA,MACP;AAAA,QAAC;AAAA;AAAA,UACA,uBAAqB;AAAA,UAErB,SAAU;AAAA,UACV,SAAQ;AAAA,UAEN,aAAI,cAAe;AAAA;AAAA,QAJjB;AAAA,MAKL;AAAA,IACD;AAAA,EACD;AAEA,SACC,qBAAC,SAAM,GAAG,cAAc,GACvB;AAAA,wBAAC,WAAQ,SAAsB,uBAAa;AAAA,IAC5C,oBAAC,WAAU,sCAA4B;AAAA,KACxC;AAEF;AAEA,IAAO,8BAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { RawHTML } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\tconst { block, hasPermission } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getDownloadableBlocks } = select( blockDirectoryStore );\n\t\t\tconst blocks = getDownloadableBlocks(\n\t\t\t\t'block:' + originalName\n\t\t\t).filter( ( { name } ) => originalName === name );\n\t\t\treturn {\n\t\t\t\thasPermission: select( coreStore ).canUser(\n\t\t\t\t\t'read',\n\t\t\t\t\t'block-directory/search'\n\t\t\t\t),\n\t\t\t\tblock: blocks.length && blocks[ 0 ],\n\t\t\t};\n\t\t},\n\t\t[ originalName ]\n\t);\n\n\t// The user can't install blocks, or the block isn't available for download.\n\tif ( ! hasPermission || ! block ) {\n\t\treturn <OriginalComponent { ...props } />;\n\t}\n\n\treturn <ModifiedWarning { ...props } originalBlock={ block } />;\n};\n\nconst ModifiedWarning = ( { originalBlock, ...props } ) => {\n\tconst { originalName, originalUndelimitedContent, clientId } =\n\t\tprops.attributes;\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\tconst convertToHTML = () => {\n\t\treplaceBlock(\n\t\t\tprops.clientId,\n\t\t\tcreateBlock( 'core/html', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst hasHTMLBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn canInsertBlockType(\n\t\t\t\t'core/html',\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tlet messageHTML = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__(\n\t\t\t'Your site doesn\u2019t include support for the %s block. You can try installing the block or remove it entirely.'\n\t\t),\n\t\toriginalBlock.title || originalName\n\t);\n\tconst actions = [\n\t\t<InstallButton\n\t\t\tkey=\"install\"\n\t\t\tblock={ originalBlock }\n\t\t\tattributes={ props.attributes }\n\t\t\tclientId={ props.clientId }\n\t\t/>,\n\t];\n\n\tif ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn\u2019t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'\n\t\t\t),\n\t\t\toriginalBlock.title || originalName\n\t\t);\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tkey=\"convert\"\n\t\t\t\tonClick={ convertToHTML }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ __( 'Keep as HTML' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ originalUndelimitedContent }</RawHTML>\n\t\t</div>\n\t);\n};\n\nexport default getInstallMissing;\n"],
5
+ "mappings": ";AAGA,SAAS,IAAI,eAAe;AAC5B,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,aAAa,iBAAiB;AACvC,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AAKP,OAAO,mBAAmB;AAC1B,SAAS,SAAS,2BAA2B;AAuBpC,cAsEP,YAtEO;AArBT,IAAM,oBAAoB,CAAE,sBAAuB,CAAE,UAAW;AAC/D,QAAM,EAAE,aAAa,IAAI,MAAM;AAC/B,QAAM,EAAE,OAAO,cAAc,IAAI;AAAA,IAChC,CAAE,WAAY;AACb,YAAM,EAAE,sBAAsB,IAAI,OAAQ,mBAAoB;AAC9D,YAAM,SAAS;AAAA,QACd,WAAW;AAAA,MACZ,EAAE,OAAQ,CAAE,EAAE,KAAK,MAAO,iBAAiB,IAAK;AAChD,aAAO;AAAA,QACN,eAAe,OAAQ,SAAU,EAAE;AAAA,UAClC;AAAA,UACA;AAAA,QACD;AAAA,QACA,OAAO,OAAO,UAAU,OAAQ,CAAE;AAAA,MACnC;AAAA,IACD;AAAA,IACA,CAAE,YAAa;AAAA,EAChB;AAGA,MA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GACvB;AAAA,wBAAC,WAAQ,SAAsB,uBAAa;AAAA,IAC5C,oBAAC,WAAU,sCAA4B;AAAA,KACxC;AAEF;AAEA,IAAO,8BAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,10 +1,11 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // packages/block-directory/src/plugins/get-install-missing/install-button.js
2
2
  import { __, sprintf } from "@wordpress/i18n";
3
3
  import { Button } from "@wordpress/components";
4
4
  import { createBlock, getBlockType, parse } from "@wordpress/blocks";
5
5
  import { useSelect, useDispatch } from "@wordpress/data";
6
6
  import { store as blockEditorStore } from "@wordpress/block-editor";
7
7
  import { store as blockDirectoryStore } from "../../store";
8
+ import { jsx } from "react/jsx-runtime";
8
9
  function InstallButton({ attributes, block, clientId }) {
9
10
  const isInstallingBlock = useSelect(
10
11
  (select) => select(blockDirectoryStore).isInstalling(block.id),
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/plugins/get-install-missing/install-button.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock, getBlockType, parse } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstallButton( { attributes, block, clientId } ) {\n\tconst isInstallingBlock = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).isInstalling( block.id ),\n\t\t[ block.id ]\n\t);\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tonClick={ () =>\n\t\t\t\tinstallBlockType( block ).then( ( success ) => {\n\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\tconst blockType = getBlockType( block.name );\n\t\t\t\t\t\tconst [ originalBlock ] = parse(\n\t\t\t\t\t\t\tattributes.originalContent\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( originalBlock && blockType ) {\n\t\t\t\t\t\t\treplaceBlock(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\tblockType.name,\n\t\t\t\t\t\t\t\t\toriginalBlock.attributes,\n\t\t\t\t\t\t\t\t\toriginalBlock.innerBlocks\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} )\n\t\t\t}\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ isInstallingBlock }\n\t\t\tisBusy={ isInstallingBlock }\n\t\t\tvariant=\"primary\"\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %s: block name */\n\t\t\t\t__( 'Install %s' ),\n\t\t\t\tblock.title\n\t\t\t) }\n\t\t</Button>\n\t);\n}\n"],
5
- "mappings": "AAuBE;AApBF,SAAS,IAAI,eAAe;AAC5B,SAAS,cAAc;AACvB,SAAS,aAAa,cAAc,aAAa;AACjD,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,wBAAwB;AAK1C,SAAS,SAAS,2BAA2B;AAE9B,SAAR,cAAgC,EAAE,YAAY,OAAO,SAAS,GAAI;AACxE,QAAM,oBAAoB;AAAA,IACzB,CAAE,WAAY,OAAQ,mBAAoB,EAAE,aAAc,MAAM,EAAG;AAAA,IACnE,CAAE,MAAM,EAAG;AAAA,EACZ;AACA,QAAM,EAAE,iBAAiB,IAAI,YAAa,mBAAoB;AAC9D,QAAM,EAAE,aAAa,IAAI,YAAa,gBAAiB;AAEvD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,SAAU,MACT,iBAAkB,KAAM,EAAE,KAAM,CAAE,YAAa;AAC9C,YAAK,SAAU;AACd,gBAAM,YAAY,aAAc,MAAM,IAAK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AE;AAAA,MAEH,wBAAsB;AAAA,MACtB,UAAW;AAAA,MACX,QAAS;AAAA,MACT,SAAQ;AAAA,MAEN;AAAA;AAAA,QAED,GAAI,YAAa;AAAA,QACjB,MAAM;AAAA,MACP;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,10 +1,11 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
+ // packages/block-directory/src/plugins/index.js
2
2
  import { registerPlugin } from "@wordpress/plugins";
3
3
  import { addFilter } from "@wordpress/hooks";
4
4
  import AutoBlockUninstaller from "../components/auto-block-uninstaller";
5
5
  import InserterMenuDownloadableBlocksPanel from "./inserter-menu-downloadable-blocks-panel";
6
6
  import InstalledBlocksPrePublishPanel from "./installed-blocks-pre-publish-panel";
7
7
  import getInstallMissing from "./get-install-missing";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
9
  registerPlugin("block-directory", {
9
10
  // The icon is explicitly set to undefined to prevent PluginPrePublishPanel
10
11
  // from rendering the fallback icon pluginIcon.
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/plugins/index.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport AutoBlockUninstaller from '../components/auto-block-uninstaller';\nimport InserterMenuDownloadableBlocksPanel from './inserter-menu-downloadable-blocks-panel';\nimport InstalledBlocksPrePublishPanel from './installed-blocks-pre-publish-panel';\nimport getInstallMissing from './get-install-missing';\n\nregisterPlugin( 'block-directory', {\n\t// The icon is explicitly set to undefined to prevent PluginPrePublishPanel\n\t// from rendering the fallback icon pluginIcon.\n\ticon: undefined,\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<AutoBlockUninstaller />\n\t\t\t\t<InserterMenuDownloadableBlocksPanel />\n\t\t\t\t<InstalledBlocksPrePublishPanel />\n\t\t\t</>\n\t\t);\n\t},\n} );\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-directory/fallback',\n\t( settings, name ) => {\n\t\tif ( name !== 'core/missing' ) {\n\t\t\treturn settings;\n\t\t}\n\t\tsettings.edit = getInstallMissing( settings.edit );\n\n\t\treturn settings;\n\t}\n);\n"],
5
- "mappings": "AAoBG,mBACC,KADD;AAjBH,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAK1B,OAAO,0BAA0B;AACjC,OAAO,yCAAyC;AAChD,OAAO,oCAAoC;AAC3C,OAAO,uBAAuB;AAE9B,eAAgB,mBAAmB;AAAA;AAAA;AAAA,EAGlC,MAAM;AAAA,EACN,SAAS;AACR,WACC,iCACC;AAAA,0BAAC,wBAAqB;AAAA,MACtB,oBAAC,uCAAoC;AAAA,MACrC,oBAAC,kCAA+B;AAAA,OACjC;AAAA,EAEF;AACD,CAAE;AAEF;AAAA,EACC;AAAA,EACA;AAAA,EACA,CAAE,UAAU,SAAU;AACrB,QAAK,SAAS,gBAAiB;AAC9B,aAAO;AAAA,IACR;AACA,aAAS,OAAO,kBAAmB,SAAS,IAAK;AAEjD,WAAO;AAAA,EACR;AACD;",
5
+ "mappings": ";AAGA,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAK1B,OAAO,0BAA0B;AACjC,OAAO,yCAAyC;AAChD,OAAO,oCAAoC;AAC3C,OAAO,uBAAuB;AAQ3B,mBACC,KADD;AANH,eAAgB,mBAAmB;AAAA;AAAA;AAAA,EAGlC,MAAM;AAAA,EACN,SAAS;AACR,WACC,iCACC;AAAA,0BAAC,wBAAqB;AAAA,MACtB,oBAAC,uCAAoC;AAAA,MACrC,oBAAC,kCAA+B;AAAA,OACjC;AAAA,EAEF;AACD,CAAE;AAEF;AAAA,EACC;AAAA,EACA;AAAA,EACA,CAAE,UAAU,SAAU;AACrB,QAAK,SAAS,gBAAiB;AAC9B,aAAO;AAAA,IACR;AACA,aAAS,OAAO,kBAAmB,SAAS,IAAK;AAEjD,WAAO;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,9 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // packages/block-directory/src/plugins/inserter-menu-downloadable-blocks-panel/index.js
2
2
  import { __unstableInserterMenuExtension } from "@wordpress/block-editor";
3
3
  import { debounce } from "@wordpress/compose";
4
4
  import { useState } from "@wordpress/element";
5
5
  import DownloadableBlocksPanel from "../../components/downloadable-blocks-panel";
6
+ import { jsx } from "react/jsx-runtime";
6
7
  function InserterMenuDownloadableBlocksPanel() {
7
8
  const [debouncedFilterValue, setFilterValue] = useState("");
8
9
  const debouncedSetFilterValue = debounce(setFilterValue, 400);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/plugins/inserter-menu-downloadable-blocks-panel/index.js"],
4
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": "AA4BK;AAzBL,SAAS,uCAAuC;AAChD,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAKzB,OAAO,6BAA6B;AAEpC,SAAS,sCAAsC;AAC9C,QAAM,CAAE,sBAAsB,cAAe,IAAI,SAAU,EAAG;AAC9D,QAAM,0BAA0B,SAAU,gBAAgB,GAAI;AAE9D,SACC,oBAAC,mCACE,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;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA,aAAc;AAAA,QACd,gBAAiB;AAAA,QACjB,UAAW,gBAAgB;AAAA;AAAA,IAC5B;AAAA,EAEF,GACD;AAEF;AAEA,IAAO,kDAAQ;",
5
+ "mappings": ";AAGA,SAAS,uCAAuC;AAChD,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AAKzB,OAAO,6BAA6B;AAkB/B;AAhBL,SAAS,sCAAsC;AAC9C,QAAM,CAAE,sBAAsB,cAAe,IAAI,SAAU,EAAG;AAC9D,QAAM,0BAA0B,SAAU,gBAAgB,GAAI;AAE9D,SACC,oBAAC,mCACE,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;AAAA;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
6
  "names": []
7
7
  }
@@ -1,9 +1,10 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ // packages/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js
2
2
  import { _n, sprintf } from "@wordpress/i18n";
3
3
  import { useSelect } from "@wordpress/data";
4
4
  import { PluginPrePublishPanel } from "@wordpress/editor";
5
5
  import CompactList from "../../components/compact-list";
6
6
  import { store as blockDirectoryStore } from "../../store";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
7
8
  function InstalledBlocksPrePublishPanel() {
8
9
  const newBlockTypes = useSelect(
9
10
  (select) => select(blockDirectoryStore).getNewBlockTypes(),
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/plugins/installed-blocks-pre-publish-panel/index.js"],
4
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": "AAwBE,SAYC,KAZD;AArBF,SAAS,IAAI,eAAe;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,6BAA6B;AAKtC,OAAO,iBAAiB;AACxB,SAAS,SAAS,2BAA2B;AAE9B,SAAR,iCAAkD;AACxD,QAAM,gBAAgB;AAAA,IACrB,CAAE,WAAY,OAAQ,mBAAoB,EAAE,iBAAiB;AAAA,IAC7D,CAAC;AAAA,EACF;AAEA,MAAK,CAAE,cAAc,QAAS;AAC7B,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ;AAAA;AAAA,QAEP;AAAA,UACC;AAAA,UACA;AAAA,UACA,cAAc;AAAA,QACf;AAAA,QACA,cAAc;AAAA,MACf;AAAA,MACA,aAAW;AAAA,MAEX;AAAA,4BAAC,OAAE,WAAU,4CACV;AAAA,UACD;AAAA,UACA;AAAA,UACA,cAAc;AAAA,QACf,GACD;AAAA,QACA,oBAAC,eAAY,OAAQ,eAAgB;AAAA;AAAA;AAAA,EACtC;AAEF;",
5
+ "mappings": ";AAGA,SAAS,IAAI,eAAe;AAC5B,SAAS,iBAAiB;AAC1B,SAAS,6BAA6B;AAKtC,OAAO,iBAAiB;AACxB,SAAS,SAAS,2BAA2B;AAa3C,SAYC,KAZD;AAXa,SAAR,iCAAkD;AACxD,QAAM,gBAAgB;AAAA,IACrB,CAAE,WAAY,OAAQ,mBAAoB,EAAE,iBAAiB;AAAA,IAC7D,CAAC;AAAA,EACF;AAEA,MAAK,CAAE,cAAc,QAAS;AAC7B,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ;AAAA;AAAA,QAEP;AAAA,UACC;AAAA,UACA;AAAA,UACA,cAAc;AAAA,QACf;AAAA,QACA,cAAc;AAAA,MACf;AAAA,MACA,aAAW;AAAA,MAEX;AAAA,4BAAC,OAAE,WAAU,4CACV;AAAA,UACD;AAAA,UACA;AAAA,UACA,cAAc;AAAA,QACf,GACD;AAAA,QACA,oBAAC,eAAY,OAAQ,eAAgB;AAAA;AAAA;AAAA,EACtC;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/block-directory/src/store/actions.js
1
2
  import {
2
3
  store as blocksStore,
3
4
  unstable__bootstrapServerSideBlockDefinitions
@@ -18,7 +19,7 @@ function receiveDownloadableBlocks(downloadableBlocks, filterValue) {
18
19
  filterValue
19
20
  };
20
21
  }
21
- const installBlockType = (block) => async ({ registry, dispatch }) => {
22
+ var installBlockType = (block) => async ({ registry, dispatch }) => {
22
23
  const { id, name } = block;
23
24
  let success = false;
24
25
  dispatch.clearErrorNotice(id);
@@ -124,7 +125,7 @@ const installBlockType = (block) => async ({ registry, dispatch }) => {
124
125
  dispatch.setIsInstalling(id, false);
125
126
  return success;
126
127
  };
127
- const uninstallBlockType = (block) => async ({ registry, dispatch }) => {
128
+ var uninstallBlockType = (block) => async ({ registry, dispatch }) => {
128
129
  try {
129
130
  const url = getPluginUrl(block);
130
131
  await apiFetch({
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/actions.js"],
4
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": "AAGA;AAAA,EACC,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,IAAI,eAAe;AAC5B,OAAO,cAAc;AACrB,SAAS,SAAS,oBAAoB;AACtC,SAAS,oBAAoB;AAK7B,SAAS,kBAAkB;AAC3B,OAAO,kBAAkB;AAUlB,SAAS,wBAAyB,aAAc;AACtD,SAAO,EAAE,MAAM,6BAA6B,YAAY;AACzD;AAWO,SAAS,0BAA2B,oBAAoB,aAAc;AAC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ACD;AAUO,SAAS,yBAA0B,MAAO;AAChD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAUO,SAAS,gBAAiB,SAAS,cAAe;AACxD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAWO,SAAS,eAAgB,SAAS,SAAS,UAAU,OAAQ;AACnE,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AASO,SAAS,iBAAkB,SAAU;AAC3C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,16 +1,17 @@
1
+ // packages/block-directory/src/store/index.js
1
2
  import { createReduxStore, register } from "@wordpress/data";
2
3
  import reducer from "./reducer";
3
4
  import * as selectors from "./selectors";
4
5
  import * as actions from "./actions";
5
6
  import * as resolvers from "./resolvers";
6
- const STORE_NAME = "core/block-directory";
7
- const storeConfig = {
7
+ var STORE_NAME = "core/block-directory";
8
+ var storeConfig = {
8
9
  reducer,
9
10
  selectors,
10
11
  actions,
11
12
  resolvers
12
13
  };
13
- const store = createReduxStore(STORE_NAME, storeConfig);
14
+ var store = createReduxStore(STORE_NAME, storeConfig);
14
15
  register(store);
15
16
  export {
16
17
  store,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/index.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport * as resolvers from './resolvers';\n\n/**\n * Module Constants\n */\nconst STORE_NAME = 'core/block-directory';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore\n *\n * @type {Object}\n */\nexport const storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n\tresolvers,\n};\n\n/**\n * Store definition for the block directory namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\n\nregister( store );\n"],
5
- "mappings": "AAGA,SAAS,kBAAkB,gBAAgB;AAK3C,OAAO,aAAa;AACpB,YAAY,eAAe;AAC3B,YAAY,aAAa;AACzB,YAAY,eAAe;AAK3B,MAAM,aAAa;AASZ,MAAM,cAAc;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AASO,MAAM,QAAQ,iBAAkB,YAAY,WAAY;AAE/D,SAAU,KAAM;",
5
+ "mappings": ";AAGA,SAAS,kBAAkB,gBAAgB;AAK3C,OAAO,aAAa;AACpB,YAAY,eAAe;AAC3B,YAAY,aAAa;AACzB,YAAY,eAAe;AAK3B,IAAM,aAAa;AASZ,IAAM,cAAc;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AASO,IAAM,QAAQ,iBAAkB,YAAY,WAAY;AAE/D,SAAU,KAAM;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
+ // packages/block-directory/src/store/load-assets.js
1
2
  import apiFetch from "@wordpress/api-fetch";
2
- const loadAsset = (el) => {
3
+ var loadAsset = (el) => {
3
4
  return new Promise((resolve, reject) => {
4
5
  const newNode = document.createElement(el.nodeName);
5
6
  ["id", "rel", "src", "href", "type"].forEach((attr) => {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/load-assets.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Load an asset for a block.\n *\n * This function returns a Promise that will resolve once the asset is loaded,\n * or in the case of Stylesheets and Inline JavaScript, will resolve immediately.\n *\n * @param {HTMLElement} el A HTML Element asset to inject.\n *\n * @return {Promise} Promise which will resolve when the asset is loaded.\n */\nexport const loadAsset = ( el ) => {\n\treturn new Promise( ( resolve, reject ) => {\n\t\t/*\n\t\t * Reconstruct the passed element, this is required as inserting the Node directly\n\t\t * won't always fire the required onload events, even if the asset wasn't already loaded.\n\t\t */\n\t\tconst newNode = document.createElement( el.nodeName );\n\n\t\t[ 'id', 'rel', 'src', 'href', 'type' ].forEach( ( attr ) => {\n\t\t\tif ( el[ attr ] ) {\n\t\t\t\tnewNode[ attr ] = el[ attr ];\n\t\t\t}\n\t\t} );\n\n\t\t// Append inline <script> contents.\n\t\tif ( el.innerHTML ) {\n\t\t\tnewNode.appendChild( document.createTextNode( el.innerHTML ) );\n\t\t}\n\n\t\tnewNode.onload = () => resolve( true );\n\t\tnewNode.onerror = () => reject( new Error( 'Error loading asset.' ) );\n\n\t\tdocument.body.appendChild( newNode );\n\n\t\t// Resolve Stylesheets and Inline JavaScript immediately.\n\t\tif (\n\t\t\t'link' === newNode.nodeName.toLowerCase() ||\n\t\t\t( 'script' === newNode.nodeName.toLowerCase() && ! newNode.src )\n\t\t) {\n\t\t\tresolve();\n\t\t}\n\t} );\n};\n\n/**\n * Load the asset files for a block\n */\nexport async function loadAssets() {\n\t/*\n\t * Fetch the current URL (post-new.php, or post.php?post=1&action=edit) and compare the\n\t * JavaScript and CSS assets loaded between the pages. This imports the required assets\n\t * for the block into the current page while not requiring that we know them up-front.\n\t * In the future this can be improved by reliance upon block.json and/or a script-loader\n\t * dependency API.\n\t */\n\tconst response = await apiFetch( {\n\t\turl: document.location.href,\n\t\tparse: false,\n\t} );\n\n\tconst data = await response.text();\n\n\tconst doc = new window.DOMParser().parseFromString( data, 'text/html' );\n\n\tconst newAssets = Array.from(\n\t\tdoc.querySelectorAll( 'link[rel=\"stylesheet\"],script' )\n\t).filter( ( asset ) => asset.id && ! document.getElementById( asset.id ) );\n\n\t/*\n\t * Load each asset in order, as they may depend upon an earlier loaded script.\n\t * Stylesheets and Inline Scripts will resolve immediately upon insertion.\n\t */\n\tfor ( const newAsset of newAssets ) {\n\t\tawait loadAsset( new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,UAAM,UAAU,SAAS,cAAe,GAAG,QAAS;AAEpD,KAAE,MAAM,OAAO,OAAO,QAAQ,MAAO,EAAE,QAAS,CAAE,SAAU;AAC3D,UAAK,GAAI,IAAK,GAAI;AACjB,gBAAS,IAAK,IAAI,GAAI,IAAK;AAAA,MAC5B;AAAA,IACD,CAAE;AAGF,QAAK,GAAG,WAAY;AACnB,cAAQ,YAAa,SAAS,eAAgB,GAAG,SAAU,CAAE;AAAA,IAC9D;AAEA,YAAQ,SAAS,MAAM,QAAS,IAAK;AACrC,YAAQ,UAAU,MAAM,OAAQ,IAAI,MAAO,sBAAuB,CAAE;AAEpE,aAAS,KAAK,YAAa,OAAQ;AAGnC,QACC,WAAW,QAAQ,SAAS,YAAY,KACtC,aAAa,QAAQ,SAAS,YAAY,KAAK,CAAE,QAAQ,KAC1D;AACD,cAAQ;AAAA,IACT;AAAA,EACD,CAAE;AACH;AAKA,eAAsB,aAAa;AAQlC,QAAM,WAAW,MAAM,SAAU;AAAA,IAChC,KAAK,SAAS,SAAS;AAAA,IACvB,OAAO;AAAA,EACR,CAAE;AAEF,QAAM,OAAO,MAAM,SAAS,KAAK;AAEjC,QAAM,MAAM,IAAI,OAAO,UAAU,EAAE,gBAAiB,MAAM,WAAY;AAEtE,QAAM,YAAY,MAAM;AAAA,IACvB,IAAI,iBAAkB,+BAAgC;AAAA,EACvD,EAAE,OAAQ,CAAE,UAAW,MAAM,MAAM,CAAE,SAAS,eAAgB,MAAM,EAAG,CAAE;AAMzE,aAAY,YAAY,WAAY;AACnC,UAAM,UAAW,QAAS;AAAA,EAC3B;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
+ // packages/block-directory/src/store/reducer.js
1
2
  import { combineReducers } from "@wordpress/data";
2
- const downloadableBlocks = (state = {}, action) => {
3
+ var downloadableBlocks = (state = {}, action) => {
3
4
  switch (action.type) {
4
5
  case "FETCH_DOWNLOADABLE_BLOCKS":
5
6
  return {
@@ -19,7 +20,7 @@ const downloadableBlocks = (state = {}, action) => {
19
20
  }
20
21
  return state;
21
22
  };
22
- const blockManagement = (state = {
23
+ var blockManagement = (state = {
23
24
  installedBlockTypes: [],
24
25
  isInstalling: {}
25
26
  }, action) => {
@@ -50,7 +51,7 @@ const blockManagement = (state = {
50
51
  }
51
52
  return state;
52
53
  };
53
- const errorNotices = (state = {}, action) => {
54
+ var errorNotices = (state = {}, action) => {
54
55
  switch (action.type) {
55
56
  case "SET_ERROR_NOTICE":
56
57
  return {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/reducer.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning an array of downloadable blocks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const downloadableBlocks = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'FETCH_DOWNLOADABLE_BLOCKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.filterValue ]: {\n\t\t\t\t\tisRequesting: true,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'RECEIVE_DOWNLOADABLE_BLOCKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.filterValue ]: {\n\t\t\t\t\tresults: action.downloadableBlocks,\n\t\t\t\t\tisRequesting: false,\n\t\t\t\t},\n\t\t\t};\n\t}\n\treturn state;\n};\n\n/**\n * Reducer managing the installation and deletion of blocks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const blockManagement = (\n\tstate = {\n\t\tinstalledBlockTypes: [],\n\t\tisInstalling: {},\n\t},\n\taction\n) => {\n\tswitch ( action.type ) {\n\t\tcase 'ADD_INSTALLED_BLOCK_TYPE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tinstalledBlockTypes: [\n\t\t\t\t\t...state.installedBlockTypes,\n\t\t\t\t\taction.item,\n\t\t\t\t],\n\t\t\t};\n\t\tcase 'REMOVE_INSTALLED_BLOCK_TYPE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tinstalledBlockTypes: state.installedBlockTypes.filter(\n\t\t\t\t\t( blockType ) => blockType.name !== action.item.name\n\t\t\t\t),\n\t\t\t};\n\t\tcase 'SET_INSTALLING_BLOCK':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisInstalling: {\n\t\t\t\t\t...state.isInstalling,\n\t\t\t\t\t[ action.blockId ]: action.isInstalling,\n\t\t\t\t},\n\t\t\t};\n\t}\n\treturn state;\n};\n\n/**\n * Reducer returning an object of error notices.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const errorNotices = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'SET_ERROR_NOTICE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.blockId ]: {\n\t\t\t\t\tmessage: action.message,\n\t\t\t\t\tisFatal: action.isFatal,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'CLEAR_ERROR_NOTICE':\n\t\t\tconst { [ action.blockId ]: blockId, ...restState } = state;\n\t\t\treturn restState;\n\t}\n\treturn state;\n};\n\nexport default combineReducers( {\n\tdownloadableBlocks,\n\tblockManagement,\n\terrorNotices,\n} );\n"],
5
- "mappings": "AAGA,SAAS,uBAAuB;AAUzB,MAAM,qBAAqB,CAAE,QAAQ,CAAC,GAAG,WAAY;AAC3D,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,WAAY,GAAG;AAAA,UACvB,cAAc;AAAA,QACf;AAAA,MACD;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,OAAO,WAAY,GAAG;AAAA,UACvB,SAAS,OAAO;AAAA,UAChB,cAA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,CAAE;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,8 @@
1
+ // packages/block-directory/src/store/resolvers.js
1
2
  import { camelCase } from "change-case";
2
3
  import apiFetch from "@wordpress/api-fetch";
3
4
  import { fetchDownloadableBlocks, receiveDownloadableBlocks } from "./actions";
4
- const getDownloadableBlocks = (filterValue) => async ({ dispatch }) => {
5
+ var getDownloadableBlocks = (filterValue) => async ({ dispatch }) => {
5
6
  if (!filterValue) {
6
7
  return;
7
8
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/resolvers.js"],
4
4
  "sourcesContent": ["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { fetchDownloadableBlocks, receiveDownloadableBlocks } from './actions';\n\nexport const getDownloadableBlocks =\n\t( filterValue ) =>\n\tasync ( { dispatch } ) => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispatch( fetchDownloadableBlocks( filterValue ) );\n\t\t\tconst results = await apiFetch( {\n\t\t\t\tpath: `wp/v2/block-directory/search?term=${ filterValue }`,\n\t\t\t} );\n\t\t\tconst blocks = results.map( ( result ) =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries( result ).map( ( [ key, value ] ) => [\n\t\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t] )\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tdispatch( receiveDownloadableBlocks( blocks, filterValue ) );\n\t\t} catch {\n\t\t\tdispatch( receiveDownloadableBlocks( [], filterValue ) );\n\t\t}\n\t};\n"],
5
- "mappings": "AAGA,SAAS,iBAAiB;AAK1B,OAAO,cAAc;AAKrB,SAAS,yBAAyB,iCAAiC;AAE5D,MAAM,wBACZ,CAAE,gBACF,OAAQ,EAAE,SAAS,MAAO;AACzB,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,MAAI;AACH,aAAU,wBAAyB,WAAY,CAAE;AACjD,UAAM,UAAU,MAAM,SAAU;AAAA,MAC/B,MAAM,qCAAsC,WAAY;AAAA,IACzD,CAAE;AACF,UAAM,SAAS,QAAQ;AAAA,MAAK,CAAE,WAC7B,OAAO;AAAA,QACN,OAAO,QAAS,MAAO,EAAE,IAAK,CAAE,CAAE,KAAK,KAAM,MAAO;AAAA,UACnD,UAAW,GAAI;AAAA,UACf;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAEA,aAAU,0BAA2B,QAAQ,WAAY,CAAE;AAAA,EAC5D,QAAQ;AACP,aAAU,0BAA2B,CAAC,GAAG,WAAY,CAAE;AAAA,EACxD;AACD;",
5
+ "mappings": ";AAGA,SAAS,iBAAiB;AAK1B,OAAO,cAAc;AAKrB,SAAS,yBAAyB,iCAAiC;AAE5D,IAAM,wBACZ,CAAE,gBACF,OAAQ,EAAE,SAAS,MAAO;AACzB,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,MAAI;AACH,aAAU,wBAAyB,WAAY,CAAE;AACjD,UAAM,UAAU,MAAM,SAAU;AAAA,MAC/B,MAAM,qCAAsC,WAAY;AAAA,IACzD,CAAE;AACF,UAAM,SAAS,QAAQ;AAAA,MAAK,CAAE,WAC7B,OAAO;AAAA,QACN,OAAO,QAAS,MAAO,EAAE,IAAK,CAAE,CAAE,KAAK,KAAM,MAAO;AAAA,UACnD,UAAW,GAAI;AAAA,UACf;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAEA,aAAU,0BAA2B,QAAQ,WAAY,CAAE;AAAA,EAC5D,QAAQ;AACP,aAAU,0BAA2B,CAAC,GAAG,WAAY,CAAE;AAAA,EACxD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,7 @@
1
+ // packages/block-directory/src/store/selectors.js
1
2
  import { createSelector, createRegistrySelector } from "@wordpress/data";
2
3
  import { store as blockEditorStore } from "@wordpress/block-editor";
3
- const EMPTY_ARRAY = [];
4
+ var EMPTY_ARRAY = [];
4
5
  function isRequestingDownloadableBlocks(state, filterValue) {
5
6
  return state.downloadableBlocks[filterValue]?.isRequesting ?? false;
6
7
  }
@@ -10,7 +11,7 @@ function getDownloadableBlocks(state, filterValue) {
10
11
  function getInstalledBlockTypes(state) {
11
12
  return state.blockManagement.installedBlockTypes;
12
13
  }
13
- const getNewBlockTypes = createRegistrySelector(
14
+ var getNewBlockTypes = createRegistrySelector(
14
15
  (select) => createSelector(
15
16
  (state) => {
16
17
  const installedBlockTypes = getInstalledBlockTypes(state);
@@ -38,7 +39,7 @@ const getNewBlockTypes = createRegistrySelector(
38
39
  ]
39
40
  )
40
41
  );
41
- const getUnusedBlockTypes = createRegistrySelector(
42
+ var getUnusedBlockTypes = createRegistrySelector(
42
43
  (select) => createSelector(
43
44
  (state) => {
44
45
  const installedBlockTypes = getInstalledBlockTypes(state);
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/selectors.js"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? EMPTY_ARRAY;\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\t\t\tif ( ! installedBlockTypes.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\n\t\t\tconst { getBlockName, getClientIdsWithDescendants } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst installedBlockNames = installedBlockTypes.map(\n\t\t\t\t( blockType ) => blockType.name\n\t\t\t);\n\t\t\tconst foundBlockNames = getClientIdsWithDescendants().flatMap(\n\t\t\t\t( clientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t\treturn installedBlockNames.includes( blockName )\n\t\t\t\t\t\t? blockName\n\t\t\t\t\t\t: [];\n\t\t\t\t}\n\t\t\t);\n\t\t\tconst newBlockTypes = installedBlockTypes.filter( ( blockType ) =>\n\t\t\t\tfoundBlockNames.includes( blockType.name )\n\t\t\t);\n\n\t\t\treturn newBlockTypes.length > 0 ? newBlockTypes : EMPTY_ARRAY;\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getClientIdsWithDescendants(),\n\t\t]\n\t)\n);\n\n/**\n * Returns the block types that have been installed on the server but are not\n * used in the current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getUnusedBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\t\t\tif ( ! installedBlockTypes.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\n\t\t\tconst { getBlockName, getClientIdsWithDescendants } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst installedBlockNames = installedBlockTypes.map(\n\t\t\t\t( blockType ) => blockType.name\n\t\t\t);\n\t\t\tconst foundBlockNames = getClientIdsWithDescendants().flatMap(\n\t\t\t\t( clientId ) => {\n\t\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t\treturn installedBlockNames.includes( blockName )\n\t\t\t\t\t\t? blockName\n\t\t\t\t\t\t: [];\n\t\t\t\t}\n\t\t\t);\n\t\t\tconst unusedBlockTypes = installedBlockTypes.filter(\n\t\t\t\t( blockType ) => ! foundBlockNames.includes( blockType.name )\n\t\t\t);\n\n\t\t\treturn unusedBlockTypes.length > 0 ? unusedBlockTypes : EMPTY_ARRAY;\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getClientIdsWithDescendants(),\n\t\t]\n\t)\n);\n\n/**\n * Returns true if a block plugin install is in progress.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId Id of the block.\n *\n * @return {boolean} Whether this block is currently being installed.\n */\nexport function isInstalling( state, blockId ) {\n\treturn state.blockManagement.isInstalling[ blockId ] || false;\n}\n\n/**\n * Returns all block error notices.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Object with error notices.\n */\nexport function getErrorNotices( state ) {\n\treturn state.errorNotices;\n}\n\n/**\n * Returns the error notice for a given block.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {string|boolean} The error text, or false if no error.\n */\nexport function getErrorNoticeForBlock( state, blockId ) {\n\treturn state.errorNotices[ blockId ];\n}\n"],
5
- "mappings": "AAGA,SAAS,gBAAgB,8BAA8B;AACvD,SAAS,SAAS,wBAAwB;AAE1C,MAAM,cAAc,CAAC;AAUd,SAAS,+BAAgC,OAAO,aAAc;AACpE,SAAO,MAAM,mBAAoB,WAAY,GAAG,gBAAgB;AACjE;AAUO,SAAS,sBAAuB,OAAO,aAAc;AAC3D,SAA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c,OAAQ;AACpC;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/block-directory/src/store/utils/get-plugin-url.js
1
2
  function getPluginUrl(block) {
2
3
  if (!block) {
3
4
  return false;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/store/utils/get-plugin-url.js"],
4
4
  "sourcesContent": ["/**\n * Get the plugin's direct API link out of a block-directory response.\n *\n * @param {Object} block The block object\n *\n * @return {string} The plugin URL, if exists.\n */\nexport default function getPluginUrl( block ) {\n\tif ( ! block ) {\n\t\treturn false;\n\t}\n\tconst link = block.links[ 'wp:plugin' ] || block.links.self;\n\tif ( link && link.length ) {\n\t\treturn link[ 0 ].href;\n\t}\n\treturn false;\n}\n"],
5
- "mappings": "AAOe,SAAR,aAA+B,OAAQ;AAC7C,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AACA,QAAM,OAAO,MAAM,MAAO,WAAY,KAAK,MAAM,MAAM;AACvD,MAAK,QAAQ,KAAK,QAAS;AAC1B,WAAO,KAAM,CAAE,EAAE;AAAA,EAClB;AACA,SAAO;AACR;",
5
+ "mappings": ";AAOe,SAAR,aAA+B,OAAQ;AAC7C,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AACA,QAAM,OAAO,MAAM,MAAO,WAAY,KAAK,MAAM,MAAM;AACvD,MAAK,QAAQ,KAAK,QAAS;AAC1B,WAAO,KAAM,CAAE,EAAE;AAAA,EAClB;AACA,SAAO;AACR;",
6
6
  "names": []
7
7
  }