Full Site Editing - Version 0.18.2

Version Description

  • Address core/nux package deprecation.
Download this release

Release Info

Developer Copons
Plugin Icon wp plugin Full Site Editing
Version 0.18.2
Comparing to
See all releases

Code changes from version 0.18.1 to 0.18.2

blog-posts-block/dist/editor.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'moment', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => '3614c7b88f9588d96d19edc1a82772b4');
1
+ <?php return array('dependencies' => array('lodash', 'moment', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-polyfill', 'wp-url'), 'version' => 'ec515417dc86f08cafcea39fe0b3b918');
blog-posts-block/dist/view.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('wp-polyfill'), 'version' => '205364fc4e1fe4f20229ec21744b8df1');
1
+ <?php return array('dependencies' => array('wp-polyfill'), 'version' => 'd8823275e1ff84c94cff5fb1d9d191e7');
full-site-editing-plugin.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Full Site Editing
4
  * Description: Enhances your page creation workflow within the Block Editor.
5
- * Version: 0.18.1
6
  * Author: Automattic
7
  * Author URI: https://automattic.com/wordpress-plugins/
8
  * License: GPLv2 or later
@@ -35,7 +35,7 @@ namespace A8C\FSE;
35
  *
36
  * @var string
37
  */
38
- define( 'PLUGIN_VERSION', '0.18.1' );
39
 
40
  // Always include these helper files for FSE.
41
  require_once __DIR__ . '/full-site-editing/helpers.php';
2
  /**
3
  * Plugin Name: Full Site Editing
4
  * Description: Enhances your page creation workflow within the Block Editor.
5
+ * Version: 0.18.2
6
  * Author: Automattic
7
  * Author URI: https://automattic.com/wordpress-plugins/
8
  * License: GPLv2 or later
35
  *
36
  * @var string
37
  */
38
+ define( 'PLUGIN_VERSION', '0.18.2' );
39
 
40
  // Always include these helper files for FSE.
41
  require_once __DIR__ . '/full-site-editing/helpers.php';
full-site-editing/dist/full-site-editing.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-server-side-render', 'wp-url'), 'version' => 'd314406eee809bf46daf3796c393d1b0');
1
+ <?php return array('dependencies' => array('lodash', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-server-side-render', 'wp-url'), 'version' => 'ce35bb067918dc74b41096191243d826');
global-styles/dist/global-styles.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-plugins', 'wp-polyfill'), 'version' => '603bed5808f28d5f465cf89f412ee922');
1
+ <?php return array('dependencies' => array('wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-plugins', 'wp-polyfill'), 'version' => 'e69758b1ebc946c5bca258f7a5f9f1c6');
posts-list-block/dist/posts-list-block.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '2d46fa6b50eef5817f491385a0848338');
1
+ <?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '2e905e3964ed274472b3f8c1a8d8b638');
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: alexislloyd, allancole, automattic, codebykat, copons, dmsnell, ge
3
  Tags: block, blocks, editor, gutenberg, page
4
  Requires at least: 5.0
5
  Tested up to: 5.3
6
- Stable tag: 0.18.1
7
  Requires PHP: 5.6.20
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -42,7 +42,10 @@ This plugin is experimental, so we don't provide any support for it outside of w
42
 
43
  == Changelog ==
44
 
45
- = 0.18.1 =
 
 
 
46
  * Blog Posts Block: Tag Exclusion feature
47
  * Blog Posts Block: Image orientation issues resolved.
48
  * Blog Posts Block: Full width alignment issue resolved.
3
  Tags: block, blocks, editor, gutenberg, page
4
  Requires at least: 5.0
5
  Tested up to: 5.3
6
+ Stable tag: 0.18.2
7
  Requires PHP: 5.6.20
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
42
 
43
  == Changelog ==
44
 
45
+ = 0.18.2 =
46
+ * Address core/nux package deprecation.
47
+
48
+ = 0.18 =
49
  * Blog Posts Block: Tag Exclusion feature
50
  * Blog Posts Block: Image orientation issues resolved.
51
  * Blog Posts Block: Full width alignment issue resolved.
starter-page-templates/dist/starter-page-templates.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-nux', 'wp-plugins', 'wp-polyfill', 'wp-url'), 'version' => 'e501904b85a0fcfb52483517057457d1');
1
+ <?php return array('dependencies' => array('lodash', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-nux', 'wp-plugins', 'wp-polyfill', 'wp-url'), 'version' => 'e45af06081060aeb4ef73b6ce76c174b');
starter-page-templates/dist/starter-page-templates.js CHANGED
@@ -1,2 +1,2 @@
1
  /*! For license information please see starter-page-templates.js.LICENSE */
2
- !function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=33)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)&&r.length){var o=i.apply(null,r);o&&e.push(o)}else if("object"===a)for(var l in r)n.call(r,l)&&r[l]&&e.push(l)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t,n){var r=n(3);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t,n){var r=n(26),i=n(27),a=n(28);e.exports=function(e,t){return r(e)||i(e,t)||a()}},function(e,t,n){var r=n(23),i=n(24),a=n(25);e.exports=function(e){return r(e)||i(e)||a()}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(29),i=n(5);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var r=n(30);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.plugins}()},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,l=e[Symbol.iterator]();!(r=(o=l.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(s){i=!0,a=s}finally{try{r||null==l.return||l.return()}finally{if(i)throw a}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){!function(){e.exports=this.wp.nux}()},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(0),i=n(2),a=n(18),o=n(6),l=n(19),s=n(9),c=n.n(s),p=n(11),u=n.n(p),m=n(10),d=n.n(m),f=n(12),b=n.n(f),g=n(13),O=n.n(g),v=n(14),h=n.n(v),j=n(15),y=n.n(j),_=n(5),w=n.n(_),E=n(16),T=n.n(E),P=n(3),k=n.n(P),S=n(1),x=n(7),N=n.n(x),B=(n(31),n(8)),C=n(4),I=n(20),A=(n(32),n(17)),M=function(e){var t=e.blocks,n=void 0===t?[]:t,i=e.viewportWidth;return n&&n.length?Object(r.createElement)("div",{className:"edit-post-visual-editor"},Object(r.createElement)("div",{className:"editor-styles-wrapper"},Object(r.createElement)("div",{className:"editor-writing-flow"},Object(r.createElement)(A.BlockPreview,{blocks:n,viewportWidth:i})))):null},L=function(e){var t=e.id,n=e.value,i=e.onSelect,a=e.label,o=e.useDynamicPreview,l=void 0!==o&&o,s=e.staticPreviewImg,c=e.staticPreviewImgAlt,p=void 0===c?"":c,u=e.blocks,m=void 0===u?[]:u,d=e.isSelected;if(Object(S.isNil)(t)||Object(S.isNil)(a)||Object(S.isNil)(n))return null;if(l&&(Object(S.isNil)(m)||Object(S.isEmpty)(m)))return null;var f=l?Object(r.createElement)(C.Disabled,null,Object(r.createElement)(M,{blocks:m,viewportWidth:960})):Object(r.createElement)("img",{className:"template-selector-item__media",src:s,alt:p}),b="label-".concat(t,"-").concat(n);return Object(r.createElement)("button",{type:"button",className:N()("template-selector-item__label",{"is-selected":d}),value:n,onClick:function(){i(n)},"aria-labelledby":"".concat(t," ").concat(b)},Object(r.createElement)("div",{className:"template-selector-item__preview-wrap"},f),Object(r.createElement)("span",{className:"template-selector-item__template-title",id:b},a))},D={Address:Object(i._x)("123 Main St","default address","full-site-editing"),Phone:Object(i._x)("555-555-5555","default phone number","full-site-editing"),CompanyName:Object(i._x)("Your Company Name","default company name","full-site-editing"),Vertical:Object(i._x)("Business","default vertical name","full-site-editing")},F={CompanyName:"title",Address:"address",Phone:"phone",Vertical:"vertical"},W=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?e.replace(/{{(\w+)}}/g,(function(e,n){var r=D[n];return t[F[n]]||r||n})):""},U=Object(B.compose)(r.memo,B.withInstanceId)((function(e){var t=e.label,n=e.className,i=e.help,a=e.instanceId,o=e.templates,l=void 0===o?[]:o,s=e.blocksByTemplates,c=void 0===s?{}:s,p=e.useDynamicPreview,u=void 0!==p&&p,m=e.onTemplateSelect,d=void 0===m?S.noop:m,f=e.siteInformation,b=void 0===f?{}:f,g=e.selectedTemplate;if(Object(S.isEmpty)(l)||!Object(S.isArray)(l))return null;if(!0===u&&Object(S.isEmpty)(c))return null;var O="template-selector-control-".concat(a);return Object(r.createElement)(C.BaseControl,{label:t,id:O,help:i,className:N()(n,"template-selector-control")},Object(r.createElement)("ul",{className:"template-selector-control__options","data-testid":"template-selector-control-options"},Object(S.map)(l,(function(e){var t=e.slug,n=e.title,a=e.preview,o=e.previewAlt;return Object(r.createElement)("li",{key:"".concat(O,"-").concat(t),className:"template-selector-control__template"},Object(r.createElement)(L,{id:O,value:t,label:W(n,b),help:i,onSelect:d,staticPreviewImg:a,staticPreviewImgAlt:o,blocks:c.hasOwnProperty(t)?c[t]:[],useDynamicPreview:u,isSelected:t===g}))}))))})),R=function(e){var t=e.title,n=e.scale;return(Object(r.createElement)("div",{className:"editor-post-title",style:{transform:"scale(".concat(n,")")}},Object(r.createElement)("div",{className:"wp-block editor-post-title__block"},Object(r.createElement)("textarea",{className:"editor-post-title__input",value:t,onChange:function(){}}))))},q=function(e){return Object(r.createElement)(A.BlockPreview,e)},z=function(e){var t=e.blocks,n=e.viewportWidth,a=e.title,o=Object(r.useRef)(null),l=Object(r.useState)(n),s=d()(l,2),c=s[0],p=s[1],u=Object(r.useState)({scale:1,offset:120}),m=d()(u,2),f=m[0],b=m[1],g=Object(r.useReducer)((function(e){return e+1}),0),O=d()(g,2),v=O[0],h=O[1],j=function(){o&&o.current&&setTimeout((function(){var e=o.current.querySelector(".block-editor-block-preview__content");if(e){var t=parseFloat(Object(S.get)(e,["style","transform"],"").replace("scale(","").replace(")",""));if(t)b({scale:t,offset:120*t})}}),500)},y=Object(r.useCallback)((function(){if(o&&o.current){var e=o.current.clientWidth;p(e>=n?e:n)}}),[n]);return Object(r.useLayoutEffect)((function(){y(),j()}),[t,y]),Object(r.useEffect)((function(){if(t&&t.length){var e=function(){y(),j(),h()},n=Object(S.debounce)(e,300);return window.addEventListener("resize",n),window.jQuery&&window.jQuery(window.document).on("wp-collapse-menu",e),function(){window.removeEventListener("resize",n)}}}),[t,y]),Object(S.isEmpty)(t)||!Object(S.isArray)(t)?Object(r.createElement)("div",{className:N()("template-selector-preview","is-blank-preview")},Object(r.createElement)("div",{className:"template-selector-preview__placeholder"},Object(i.__)("Select a layout to preview.","full-site-editing"))):Object(r.createElement)("div",{className:"template-selector-preview"},Object(r.createElement)(C.Disabled,null,Object(r.createElement)("div",{ref:o,className:"edit-post-visual-editor"},Object(r.createElement)("div",{className:"editor-styles-wrapper"},Object(r.createElement)("div",{className:"editor-writing-flow"},Object(r.createElement)(R,{title:a,scale:f.scale}),Object(r.createElement)("div",{className:"template-selector-preview__offset-correction",style:{top:f.offset}},Object(r.createElement)(q,{key:v,blocks:t,viewportWidth:c})))))))};window._tkq=window._tkq||[];var G=null,Q=function(e,t){G&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_view",{blog_id:G.blogid,segment_id:e,vertical_id:t}])},V=function(e,t){G&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_dismiss",{blog_id:G.blogid,segment_id:e,vertical_id:t}])},H=function(e,t,n){G&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_template_selected",{blog_id:G.blogid,segment_id:e,vertical_id:t,template:n}])},Y=n(21),J=n.n(Y),K=n(22),X=function(e,t,n){var r=e[t=Object(K.removeQueryArgs)(t,"w","s")]||{url:t,usages:[]};return c()({},e,k()({},t,c()({},r,{usages:[].concat(u()(r.usages),u()(n))})))},Z=function e(t,n){switch(t.blocksByClientId[n.clientId]=n,n.name){case"core/cover":case"core/image":var r=n.attributes.url;r&&(t.assets=X(t.assets,r,[{prop:"url",path:[n.clientId,"attributes","url"]},{prop:"id",path:[n.clientId,"attributes","id"]}]));case"core/media-text":var i=n.attributes.mediaUrl;i&&"image"===n.attributes.mediaType&&(t.assets=X(t.assets,i,[{prop:"url",path:[n.clientId,"attributes","mediaUrl"]},{prop:"id",path:[n.clientId,"attributes","mediaId"]}]));case"core/gallery":Object(S.forEach)(n.attributes.images,(function(e,r){t.assets=X(t.assets,e.url,[{prop:"url",path:[n.clientId,"attributes","images",r,"url"]},{prop:"url",path:[n.clientId,"attributes","images",r,"link"]},{prop:"id",path:[n.clientId,"attributes","images",r,"id"]},{prop:"id",path:[n.clientId,"attributes","ids",r]}])}))}return Object(S.isEmpty)(n.innerBlocks)?t:Object(S.reduce)(n.innerBlocks,e,t)},$=function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,regeneratorRuntime.awrap(J()({method:"POST",path:"/fse/v1/sideload/image/batch",data:{resources:Object(S.map)(e)}}).then((function(t){return Object(S.reduce)(e,(function(e,n){var r=t.shift(),i=r.id,a=r.source_url;return c()({},e,k()({},n.url,{id:i,url:a}))}),{})})));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}))},ee=function(e,t){return Object(S.forEach)(e.assets,(function(n){var r=t[n.url];r&&Object(S.forEach)(n.usages,(function(t){Object(S.set)(e.blocksByClientId,t.path,r[t.prop])}))})),e.blocks},te=function(e){var t;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:if(t=Object(S.reduce)(e,Z,{assets:{},blocksByClientId:{},blocks:e}),!Object(S.isEmpty)(t.assets)){n.next=3;break}return n.abrupt("return",e);case 3:return n.abrupt("return",$(t.assets).then((function(e){return ee(t,e)})));case 4:case"end":return n.stop()}}))},ne="maywood",re=function(e){function t(){var e,n;b()(this,t);for(var a=arguments.length,o=new Array(a),l=0;l<a;l++)o[l]=arguments[l];return n=h()(this,(e=y()(t)).call.apply(e,[this].concat(o))),k()(w()(n),"state",{isLoading:!1,previewedTemplate:null,error:null,isOpen:!1}),k()(w()(n),"getTitlesByTemplateSlugs",Object(S.memoize)((function(e){return Object(S.mapValues)(Object(S.keyBy)(e,"slug"),"title")}))),k()(w()(n),"getBlocksByTemplateSlugs",Object(S.memoize)((function(e){return Object(S.reduce)(e,(function(e,t){var r=t.slug,i=t.content;return e[r]=i?Object(I.parse)(W(i,n.props.siteInformation)):[],e}),{})}))),k()(w()(n),"setTemplate",(function(e){H(n.props.segment.id,n.props.vertical.id,e),n.props.saveTemplateChoice(e);var t=Object(S.find)(n.props.templates,{slug:e,category:"home"}),r=n.getBlocksByTemplateSlug(e),i=t?null:n.getTitleByTemplateSlug(e);r&&r.length?(n.setState({error:null,isLoading:!0}),n.maybePrefetchAssets(r).then((function(e){n.state.isOpen&&(n.props.insertTemplate(i,e),n.setState({isOpen:!1}))})).catch((function(e){n.setState({isLoading:!1,error:e})}))):n.setState({isOpen:!1})})),k()(w()(n),"maybePrefetchAssets",(function(e){return n.props.shouldPrefetchAssets?te(e):Promise.resolve(e)})),k()(w()(n),"handleConfirmation",(function(e){"string"!=typeof e&&(e=n.state.previewedTemplate),n.setTemplate(e),n.props.isPromptedFromSidebar&&n.props.toggleTemplateModal()})),k()(w()(n),"previewTemplate",(function(e){n.setState({previewedTemplate:e}),window.matchMedia("(min-width: 660px)").matches||n.handleConfirmation(e)})),k()(w()(n),"closeModal",(function(e){if(e.target.matches("button.template-selector-item__label"))return!1;V(n.props.segment.id,n.props.vertical.id);var t=Object(S.get)(window,["calypsoifyGutenberg","closeUrl"]);window.top.location=t||"edit.php?post_type=page"})),k()(w()(n),"getTemplateGroups",(function(){var e=Object(S.partition)(n.props.templates,{category:"home"}),t=d()(e,2),r=t[0],i=t[1],a=Object(S.find)(n.props.templates,{slug:n.props.theme})||Object(S.find)(n.props.templates,{slug:ne});if(!n.props.isFrontPage||!a)return{homepageTemplates:Object(S.sortBy)(r,"title"),defaultTemplates:i};var o=Object(S.reject)(r,{slug:a.slug});return{homepageTemplates:[a].concat(u()(Object(S.sortBy)(o,"title"))),defaultTemplates:i}})),k()(w()(n),"renderTemplatesList",(function(e,t){return Object(r.createElement)("fieldset",{className:"page-template-modal__list"},Object(r.createElement)("legend",{className:"page-template-modal__form-title"},t),Object(r.createElement)(U,{label:Object(i.__)("Layout","full-site-editing"),templates:e,blocksByTemplates:n.getBlocksByTemplateSlugs(n.props.templates),onTemplateSelect:n.previewTemplate,useDynamicPreview:!1,siteInformation:n.props.siteInformation,selectedTemplate:n.state.previewedTemplate}))})),n}return T()(t,e),O()(t,[{key:"componentDidMount",value:function(){this.state.isOpen&&Q(this.props.segment.id,this.props.vertical.id)}},{key:"componentDidUpdate",value:function(e,t){!t.isOpen&&this.state.isOpen&&Q(this.props.segment.id,this.props.vertical.id)}},{key:"getBlocksByTemplateSlug",value:function(e){return Object(S.get)(this.getBlocksByTemplateSlugs(this.props.templates),[e],[])}},{key:"getTitleByTemplateSlug",value:function(e){return Object(S.get)(this.getTitlesByTemplateSlugs(this.props.templates),[e],"")}},{key:"render",value:function(){var e=this.state,t=e.previewedTemplate,n=e.isOpen,a=e.isLoading,o=this.props.isPromptedFromSidebar;if(!n)return null;var l=this.getTemplateGroups(),s=l.homepageTemplates,c=l.defaultTemplates;return Object(r.createElement)(C.Modal,{title:Object(i.__)("Select Page Layout","full-site-editing"),className:"page-template-modal",overlayClassName:"page-template-modal-screen-overlay",shouldCloseOnClickOutside:!1,isDismissable:!1,isDismissible:!1},o?Object(r.createElement)(C.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.props.toggleTemplateModal,icon:"no-alt",label:Object(i.__)("Close Layout Selector")}):Object(r.createElement)(C.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.closeModal,icon:"arrow-left-alt2",label:Object(i.__)("Go back")}),Object(r.createElement)("div",{className:"page-template-modal__inner"},a?Object(r.createElement)("div",{className:"page-template-modal__loading"},Object(r.createElement)(C.Spinner,null),Object(i.__)("Adding layout…","full-site-editing")):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("form",{className:"page-template-modal__form"},this.props.isFrontPage?Object(r.createElement)(r.Fragment,null,this.renderTemplatesList(s,Object(i.__)("Recommended Layouts","full-site-editing")),this.renderTemplatesList(c,Object(i.__)("Other Page Layouts","full-site-editing"))):Object(r.createElement)(r.Fragment,null,this.renderTemplatesList(c,Object(i.__)("Recommended Layouts","full-site-editing")),this.renderTemplatesList(s,Object(i.__)("Homepage Layouts","full-site-editing")))),Object(r.createElement)(z,{blocks:this.getBlocksByTemplateSlug(t),viewportWidth:960,title:this.getTitleByTemplateSlug(t)}))),Object(r.createElement)("div",{className:N()("page-template-modal__buttons",{"is-visually-hidden":Object(S.isEmpty)(t)||a})},Object(r.createElement)(C.Button,{isPrimary:!0,isLarge:!0,disabled:Object(S.isEmpty)(t)||a,onClick:this.handleConfirmation},Object(i.sprintf)(Object(i.__)("Use %s layout","full-site-editing"),this.getTitleByTemplateSlug(t)))))}}],[{key:"getDerivedStateFromProps",value:function(e,n){return n.previewedTemplate||Object(S.isEmpty)(e.templates)?null:{isOpen:!0,previewedTemplate:t.getDefaultSelectedTemplate(e)}}}]),t}(r.Component);k()(re,"getDefaultSelectedTemplate",(function(e){var t=Object(S.get)(e.templates,[0,"slug"]),n=e._starter_page_template;if(!e.isFrontPage&&!n)return t;"home"===n&&(n=e.theme);var r=n||e.theme;return Object(S.find)(e.templates,{slug:r})?r:Object(S.find)(e.templates,{slug:ne})?ne:t}));var ie,ae=Object(B.compose)(Object(o.withSelect)((function(e){var t=function(){return e("core/editor").getEditedPostAttribute("meta")},n=t();return{getMeta:t,_starter_page_template:n._starter_page_template,postContentBlock:e("core/editor").getBlocks().find((function(e){return"a8c/post-content"===e.name}))}})),Object(o.withDispatch)((function(e,t){e("core/nux").disableTips();var n=e("core/editor");return{saveTemplateChoice:function(e){var r=t.getMeta();n.editPost({meta:c()({},r,{_starter_page_template:e})})},insertTemplate:function(r,i){r&&n.editPost({title:r});var a=t.postContentBlock;e("core/block-editor").replaceInnerBlocks(a?a.clientId:"",i,!1)}}})))(re),oe=function(e){function t(){var e,n;b()(this,t);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=h()(this,(e=y()(t)).call.apply(e,[this].concat(i))),k()(w()(n),"state",{isTemplateModalOpen:!1,isWarningOpen:!1}),k()(w()(n),"toggleTemplateModal",(function(){n.setState({isTemplateModalOpen:!n.state.isTemplateModalOpen})})),k()(w()(n),"toggleWarningModal",(function(){n.setState({isWarningOpen:!n.state.isWarningOpen})})),k()(w()(n),"getLastTemplateUsed",(function(){var e=n.props,t=e.isFrontPage,r=e.templates,i=e.theme,a=n.props.lastTemplateUsedSlug;if(!a&&t&&(a=i),!a||"blank"===a)return r[0];var o=r.find((function(e){return e.slug===a}));return o||r[0]})),n}return T()(t,e),O()(t,[{key:"render",value:function(){var e=this.getLastTemplateUsed(),t=e.slug,n=e.title,a=e.preview,o=e.previewAlt,l=this.props,s=l.isFrontPage,c=l.templates,p=l.theme,u=l.vertical,m=l.segment,d=l.siteInformation;return Object(r.createElement)("div",{className:"sidebar-modal-opener"},Object(r.createElement)(L,{id:"sidebar-modal-opener__last-template-used-preview",value:t,label:W(n,d),staticPreviewImg:a,staticPreviewImgAlt:o,onSelect:this.toggleWarningModal}),Object(r.createElement)(C.Button,{isPrimary:!0,onClick:this.toggleWarningModal,className:"sidebar-modal-opener__button"},Object(i.__)("Change Layout")),this.state.isTemplateModalOpen&&Object(r.createElement)(ae,{shouldPrefetchAssets:!1,templates:c,theme:p,vertical:u,segment:m,toggleTemplateModal:this.toggleTemplateModal,isFrontPage:s,isPromptedFromSidebar:!0}),this.state.isWarningOpen&&Object(r.createElement)(C.Modal,{title:Object(i.__)("Overwrite Page Content?"),isDismissible:!1,onRequestClose:this.toggleWarningModal,className:"sidebar-modal-opener__warning-modal"},Object(r.createElement)("div",{className:"sidebar-modal-opener__warning-text"},Object(i.__)("Changing the page's layout will remove any customizations or edits you have already made.")),Object(r.createElement)("div",{className:"sidebar-modal-opener__warning-options"},Object(r.createElement)(C.Button,{isDefault:!0,onClick:this.toggleWarningModal},Object(i.__)("Cancel")),Object(r.createElement)(C.Button,{isPrimary:!0,onClick:this.toggleTemplateModal},Object(i.__)("Change Layout")))))}}]),t}(r.Component),le=Object(B.compose)(Object(o.withSelect)((function(e){return{lastTemplateUsedSlug:e("core/editor").getEditedPostAttribute("meta")._starter_page_template}})))(oe),se=window.starterPageTemplatesConfig,ce=se.templates,pe=void 0===ce?[]:ce,ue=se.vertical,me=se.segment,de=se.tracksUserData,fe=se.siteInformation,be=void 0===fe?{}:fe,ge=se.screenAction,Oe=se.theme,ve=se.isFrontPage;de&&(G=ie=de,window._tkq.push(["identifyUser",ie.userid,ie.username])),"add"===ge&&Object(a.registerPlugin)("page-templates",{render:function(){return Object(r.createElement)(ae,{isFrontPage:ve,segment:me,shouldPrefetchAssets:!1,templates:pe,theme:Oe,vertical:ue})}}),Object(a.registerPlugin)("page-templates-sidebar",{render:function(){return Object(r.createElement)(l.PluginDocumentSettingPanel,{name:"Template Modal Opener",title:Object(i.__)("Page Layout"),className:"page-template-modal__sidebar",icon:"none"},Object(r.createElement)(le,{isFrontPage:ve,segment:me,siteInformation:be,templates:pe,theme:Oe,vertical:ue}))}});var he=Object(o.subscribe)((function(){Object(o.select)("core/edit-post").isEditorPanelOpened("page-templates-sidebar/Template Modal Opener")||Object(o.dispatch)("core/edit-post").toggleEditorPanelOpened("page-templates-sidebar/Template Modal Opener"),he()}))}]));
1
  /*! For license information please see starter-page-templates.js.LICENSE */
2
+ !function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=33)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)&&r.length){var o=i.apply(null,r);o&&e.push(o)}else if("object"===a)for(var l in r)n.call(r,l)&&r[l]&&e.push(l)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)}()},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t,n){var r=n(3);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}},function(e,t,n){var r=n(26),i=n(27),a=n(28);e.exports=function(e,t){return r(e)||i(e,t)||a()}},function(e,t,n){var r=n(23),i=n(24),a=n(25);e.exports=function(e){return r(e)||i(e)||a()}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(29),i=n(5);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var r=n(30);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.plugins}()},function(e,t){!function(){e.exports=this.wp.editPost}()},function(e,t){!function(){e.exports=this.wp.blocks}()},function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t){!function(){e.exports=this.wp.url}()},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,l=e[Symbol.iterator]();!(r=(o=l.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(s){i=!0,a=s}finally{try{r||null==l.return||l.return()}finally{if(i)throw a}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t){!function(){e.exports=this.wp.nux}()},function(e,t,n){},function(e,t,n){"use strict";n.r(t);var r=n(0),i=n(2),a=n(18),o=n(6),l=n(19),s=n(9),c=n.n(s),p=n(11),u=n.n(p),m=n(10),d=n.n(m),f=n(12),b=n.n(f),g=n(13),O=n.n(g),v=n(14),h=n.n(v),j=n(15),y=n.n(j),_=n(5),w=n.n(_),E=n(16),T=n.n(E),P=n(3),k=n.n(P),S=n(1),x=n(7),N=n.n(x),B=(n(31),n(8)),C=n(4),A=n(20),I=(n(32),n(17)),M=function(e){var t=e.blocks,n=void 0===t?[]:t,i=e.viewportWidth;return n&&n.length?Object(r.createElement)("div",{className:"edit-post-visual-editor"},Object(r.createElement)("div",{className:"editor-styles-wrapper"},Object(r.createElement)("div",{className:"editor-writing-flow"},Object(r.createElement)(I.BlockPreview,{blocks:n,viewportWidth:i})))):null},L=function(e){var t=e.id,n=e.value,i=e.onSelect,a=e.label,o=e.useDynamicPreview,l=void 0!==o&&o,s=e.staticPreviewImg,c=e.staticPreviewImgAlt,p=void 0===c?"":c,u=e.blocks,m=void 0===u?[]:u,d=e.isSelected;if(Object(S.isNil)(t)||Object(S.isNil)(a)||Object(S.isNil)(n))return null;if(l&&(Object(S.isNil)(m)||Object(S.isEmpty)(m)))return null;var f=l?Object(r.createElement)(C.Disabled,null,Object(r.createElement)(M,{blocks:m,viewportWidth:960})):Object(r.createElement)("img",{className:"template-selector-item__media",src:s,alt:p}),b="label-".concat(t,"-").concat(n);return Object(r.createElement)("button",{type:"button",className:N()("template-selector-item__label",{"is-selected":d}),value:n,onClick:function(){i(n)},"aria-labelledby":"".concat(t," ").concat(b)},Object(r.createElement)("div",{className:"template-selector-item__preview-wrap"},f),Object(r.createElement)("span",{className:"template-selector-item__template-title",id:b},a))},D={Address:Object(i._x)("123 Main St","default address","full-site-editing"),Phone:Object(i._x)("555-555-5555","default phone number","full-site-editing"),CompanyName:Object(i._x)("Your Company Name","default company name","full-site-editing"),Vertical:Object(i._x)("Business","default vertical name","full-site-editing")},W={CompanyName:"title",Address:"address",Phone:"phone",Vertical:"vertical"},F=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?e.replace(/{{(\w+)}}/g,(function(e,n){var r=D[n];return t[W[n]]||r||n})):""},G=Object(B.compose)(r.memo,B.withInstanceId)((function(e){var t=e.label,n=e.className,i=e.help,a=e.instanceId,o=e.templates,l=void 0===o?[]:o,s=e.blocksByTemplates,c=void 0===s?{}:s,p=e.useDynamicPreview,u=void 0!==p&&p,m=e.onTemplateSelect,d=void 0===m?S.noop:m,f=e.siteInformation,b=void 0===f?{}:f,g=e.selectedTemplate;if(Object(S.isEmpty)(l)||!Object(S.isArray)(l))return null;if(!0===u&&Object(S.isEmpty)(c))return null;var O="template-selector-control-".concat(a);return Object(r.createElement)(C.BaseControl,{label:t,id:O,help:i,className:N()(n,"template-selector-control")},Object(r.createElement)("ul",{className:"template-selector-control__options","data-testid":"template-selector-control-options"},Object(S.map)(l,(function(e){var t=e.slug,n=e.title,a=e.preview,o=e.previewAlt;return Object(r.createElement)("li",{key:"".concat(O,"-").concat(t),className:"template-selector-control__template"},Object(r.createElement)(L,{id:O,value:t,label:F(n,b),help:i,onSelect:d,staticPreviewImg:a,staticPreviewImgAlt:o,blocks:c.hasOwnProperty(t)?c[t]:[],useDynamicPreview:u,isSelected:t===g}))}))))})),U=function(e){var t=e.title,n=e.scale;return(Object(r.createElement)("div",{className:"editor-post-title",style:{transform:"scale(".concat(n,")")}},Object(r.createElement)("div",{className:"wp-block editor-post-title__block"},Object(r.createElement)("textarea",{className:"editor-post-title__input",value:t,onChange:function(){}}))))},R=function(e){return Object(r.createElement)(I.BlockPreview,e)},q=function(e){var t=e.blocks,n=e.viewportWidth,a=e.title,o=Object(r.useRef)(null),l=Object(r.useState)(n),s=d()(l,2),c=s[0],p=s[1],u=Object(r.useState)({scale:1,offset:120}),m=d()(u,2),f=m[0],b=m[1],g=Object(r.useReducer)((function(e){return e+1}),0),O=d()(g,2),v=O[0],h=O[1],j=function(){o&&o.current&&setTimeout((function(){var e=o.current.querySelector(".block-editor-block-preview__content");if(e){var t=parseFloat(Object(S.get)(e,["style","transform"],"").replace("scale(","").replace(")",""));if(t)b({scale:t,offset:120*t})}}),500)},y=Object(r.useCallback)((function(){if(o&&o.current){var e=o.current.clientWidth;p(e>=n?e:n)}}),[n]);return Object(r.useLayoutEffect)((function(){y(),j()}),[t,y]),Object(r.useEffect)((function(){if(t&&t.length){var e=function(){y(),j(),h()},n=Object(S.debounce)(e,300);return window.addEventListener("resize",n),window.jQuery&&window.jQuery(window.document).on("wp-collapse-menu",e),function(){window.removeEventListener("resize",n)}}}),[t,y]),Object(S.isEmpty)(t)||!Object(S.isArray)(t)?Object(r.createElement)("div",{className:N()("template-selector-preview","is-blank-preview")},Object(r.createElement)("div",{className:"template-selector-preview__placeholder"},Object(i.__)("Select a layout to preview.","full-site-editing"))):Object(r.createElement)("div",{className:"template-selector-preview"},Object(r.createElement)(C.Disabled,null,Object(r.createElement)("div",{ref:o,className:"edit-post-visual-editor"},Object(r.createElement)("div",{className:"editor-styles-wrapper"},Object(r.createElement)("div",{className:"editor-writing-flow"},Object(r.createElement)(U,{title:a,scale:f.scale}),Object(r.createElement)("div",{className:"template-selector-preview__offset-correction",style:{top:f.offset}},Object(r.createElement)(R,{key:v,blocks:t,viewportWidth:c})))))))};window._tkq=window._tkq||[];var z=null,Q=function(e,t){z&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_view",{blog_id:z.blogid,segment_id:e,vertical_id:t}])},V=function(e,t){z&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_dismiss",{blog_id:z.blogid,segment_id:e,vertical_id:t}])},H=function(e,t,n){z&&window._tkq.push(["recordEvent","a8c_full_site_editing_template_selector_template_selected",{blog_id:z.blogid,segment_id:e,vertical_id:t,template:n}])},Y=n(21),J=n.n(Y),K=n(22),X=function(e,t,n){var r=e[t=Object(K.removeQueryArgs)(t,"w","s")]||{url:t,usages:[]};return c()({},e,k()({},t,c()({},r,{usages:[].concat(u()(r.usages),u()(n))})))},Z=function e(t,n){switch(t.blocksByClientId[n.clientId]=n,n.name){case"core/cover":case"core/image":var r=n.attributes.url;r&&(t.assets=X(t.assets,r,[{prop:"url",path:[n.clientId,"attributes","url"]},{prop:"id",path:[n.clientId,"attributes","id"]}]));case"core/media-text":var i=n.attributes.mediaUrl;i&&"image"===n.attributes.mediaType&&(t.assets=X(t.assets,i,[{prop:"url",path:[n.clientId,"attributes","mediaUrl"]},{prop:"id",path:[n.clientId,"attributes","mediaId"]}]));case"core/gallery":Object(S.forEach)(n.attributes.images,(function(e,r){t.assets=X(t.assets,e.url,[{prop:"url",path:[n.clientId,"attributes","images",r,"url"]},{prop:"url",path:[n.clientId,"attributes","images",r,"link"]},{prop:"id",path:[n.clientId,"attributes","images",r,"id"]},{prop:"id",path:[n.clientId,"attributes","ids",r]}])}))}return Object(S.isEmpty)(n.innerBlocks)?t:Object(S.reduce)(n.innerBlocks,e,t)},$=function(e){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,regeneratorRuntime.awrap(J()({method:"POST",path:"/fse/v1/sideload/image/batch",data:{resources:Object(S.map)(e)}}).then((function(t){return Object(S.reduce)(e,(function(e,n){var r=t.shift(),i=r.id,a=r.source_url;return c()({},e,k()({},n.url,{id:i,url:a}))}),{})})));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}))},ee=function(e,t){return Object(S.forEach)(e.assets,(function(n){var r=t[n.url];r&&Object(S.forEach)(n.usages,(function(t){Object(S.set)(e.blocksByClientId,t.path,r[t.prop])}))})),e.blocks},te=function(e){var t;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:if(t=Object(S.reduce)(e,Z,{assets:{},blocksByClientId:{},blocks:e}),!Object(S.isEmpty)(t.assets)){n.next=3;break}return n.abrupt("return",e);case 3:return n.abrupt("return",$(t.assets).then((function(e){return ee(t,e)})));case 4:case"end":return n.stop()}}))},ne="maywood",re=function(e){function t(){var e,n;b()(this,t);for(var a=arguments.length,o=new Array(a),l=0;l<a;l++)o[l]=arguments[l];return n=h()(this,(e=y()(t)).call.apply(e,[this].concat(o))),k()(w()(n),"state",{isLoading:!1,previewedTemplate:null,error:null,isOpen:!1}),k()(w()(n),"getTitlesByTemplateSlugs",Object(S.memoize)((function(e){return Object(S.mapValues)(Object(S.keyBy)(e,"slug"),"title")}))),k()(w()(n),"getBlocksByTemplateSlugs",Object(S.memoize)((function(e){return Object(S.reduce)(e,(function(e,t){var r=t.slug,i=t.content;return e[r]=i?Object(A.parse)(F(i,n.props.siteInformation)):[],e}),{})}))),k()(w()(n),"setTemplate",(function(e){H(n.props.segment.id,n.props.vertical.id,e),n.props.saveTemplateChoice(e);var t=Object(S.find)(n.props.templates,{slug:e,category:"home"}),r=n.getBlocksByTemplateSlug(e),i=t?null:n.getTitleByTemplateSlug(e);r&&r.length?(n.setState({error:null,isLoading:!0}),n.maybePrefetchAssets(r).then((function(e){n.state.isOpen&&(n.props.insertTemplate(i,e),n.setState({isOpen:!1}))})).catch((function(e){n.setState({isLoading:!1,error:e})}))):n.setState({isOpen:!1})})),k()(w()(n),"maybePrefetchAssets",(function(e){return n.props.shouldPrefetchAssets?te(e):Promise.resolve(e)})),k()(w()(n),"handleConfirmation",(function(e){"string"!=typeof e&&(e=n.state.previewedTemplate),n.setTemplate(e),n.props.isPromptedFromSidebar&&n.props.toggleTemplateModal()})),k()(w()(n),"previewTemplate",(function(e){n.setState({previewedTemplate:e}),window.matchMedia("(min-width: 660px)").matches||n.handleConfirmation(e)})),k()(w()(n),"closeModal",(function(e){if(e.target.matches("button.template-selector-item__label"))return!1;V(n.props.segment.id,n.props.vertical.id);var t=Object(S.get)(window,["calypsoifyGutenberg","closeUrl"]);window.top.location=t||"edit.php?post_type=page"})),k()(w()(n),"getTemplateGroups",(function(){var e=Object(S.partition)(n.props.templates,{category:"home"}),t=d()(e,2),r=t[0],i=t[1],a=Object(S.find)(n.props.templates,{slug:n.props.theme})||Object(S.find)(n.props.templates,{slug:ne});if(!n.props.isFrontPage||!a)return{homepageTemplates:Object(S.sortBy)(r,"title"),defaultTemplates:i};var o=Object(S.reject)(r,{slug:a.slug});return{homepageTemplates:[a].concat(u()(Object(S.sortBy)(o,"title"))),defaultTemplates:i}})),k()(w()(n),"renderTemplatesList",(function(e,t){return Object(r.createElement)("fieldset",{className:"page-template-modal__list"},Object(r.createElement)("legend",{className:"page-template-modal__form-title"},t),Object(r.createElement)(G,{label:Object(i.__)("Layout","full-site-editing"),templates:e,blocksByTemplates:n.getBlocksByTemplateSlugs(n.props.templates),onTemplateSelect:n.previewTemplate,useDynamicPreview:!1,siteInformation:n.props.siteInformation,selectedTemplate:n.state.previewedTemplate}))})),n}return T()(t,e),O()(t,[{key:"componentDidMount",value:function(){this.state.isOpen&&Q(this.props.segment.id,this.props.vertical.id)}},{key:"componentDidUpdate",value:function(e,t){!t.isOpen&&this.state.isOpen&&Q(this.props.segment.id,this.props.vertical.id),(this.props.isWelcomeGuideActive||this.props.areTipsEnabled)&&this.props.hideWelcomeGuide()}},{key:"getBlocksByTemplateSlug",value:function(e){return Object(S.get)(this.getBlocksByTemplateSlugs(this.props.templates),[e],[])}},{key:"getTitleByTemplateSlug",value:function(e){return Object(S.get)(this.getTitlesByTemplateSlugs(this.props.templates),[e],"")}},{key:"render",value:function(){var e=this.state,t=e.previewedTemplate,n=e.isOpen,a=e.isLoading,o=this.props.isPromptedFromSidebar;if(!n)return null;var l=this.getTemplateGroups(),s=l.homepageTemplates,c=l.defaultTemplates;return Object(r.createElement)(C.Modal,{title:Object(i.__)("Select Page Layout","full-site-editing"),className:"page-template-modal",overlayClassName:"page-template-modal-screen-overlay",shouldCloseOnClickOutside:!1,isDismissable:!1,isDismissible:!1},o?Object(r.createElement)(C.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.props.toggleTemplateModal,icon:"no-alt",label:Object(i.__)("Close Layout Selector")}):Object(r.createElement)(C.IconButton,{className:"page-template-modal__close-button components-icon-button",onClick:this.closeModal,icon:"arrow-left-alt2",label:Object(i.__)("Go back")}),Object(r.createElement)("div",{className:"page-template-modal__inner"},a?Object(r.createElement)("div",{className:"page-template-modal__loading"},Object(r.createElement)(C.Spinner,null),Object(i.__)("Adding layout…","full-site-editing")):Object(r.createElement)(r.Fragment,null,Object(r.createElement)("form",{className:"page-template-modal__form"},this.props.isFrontPage?Object(r.createElement)(r.Fragment,null,this.renderTemplatesList(s,Object(i.__)("Recommended Layouts","full-site-editing")),this.renderTemplatesList(c,Object(i.__)("Other Page Layouts","full-site-editing"))):Object(r.createElement)(r.Fragment,null,this.renderTemplatesList(c,Object(i.__)("Recommended Layouts","full-site-editing")),this.renderTemplatesList(s,Object(i.__)("Homepage Layouts","full-site-editing")))),Object(r.createElement)(q,{blocks:this.getBlocksByTemplateSlug(t),viewportWidth:960,title:this.getTitleByTemplateSlug(t)}))),Object(r.createElement)("div",{className:N()("page-template-modal__buttons",{"is-visually-hidden":Object(S.isEmpty)(t)||a})},Object(r.createElement)(C.Button,{isPrimary:!0,isLarge:!0,disabled:Object(S.isEmpty)(t)||a,onClick:this.handleConfirmation},Object(i.sprintf)(Object(i.__)("Use %s layout","full-site-editing"),this.getTitleByTemplateSlug(t)))))}}],[{key:"getDerivedStateFromProps",value:function(e,n){return n.previewedTemplate||Object(S.isEmpty)(e.templates)?null:{isOpen:!0,previewedTemplate:t.getDefaultSelectedTemplate(e)}}}]),t}(r.Component);k()(re,"getDefaultSelectedTemplate",(function(e){var t=Object(S.get)(e.templates,[0,"slug"]),n=e._starter_page_template;if(!e.isFrontPage&&!n)return t;"home"===n&&(n=e.theme);var r=n||e.theme;return Object(S.find)(e.templates,{slug:r})?r:Object(S.find)(e.templates,{slug:ne})?ne:t}));var ie,ae=Object(B.compose)(Object(o.withSelect)((function(e){var t=function(){return e("core/editor").getEditedPostAttribute("meta")},n=t();return{getMeta:t,_starter_page_template:n._starter_page_template,postContentBlock:e("core/editor").getBlocks().find((function(e){return"a8c/post-content"===e.name})),isWelcomeGuideActive:e("core/edit-post").isFeatureActive("welcomeGuide"),areTipsEnabled:!!e("core/nux")&&e("core/nux").areTipsEnabled()}})),Object(o.withDispatch)((function(e,t){var n=e("core/editor");return{saveTemplateChoice:function(e){var r=t.getMeta();n.editPost({meta:c()({},r,{_starter_page_template:e})})},insertTemplate:function(r,i){r&&n.editPost({title:r});var a=t.postContentBlock;e("core/block-editor").replaceInnerBlocks(a?a.clientId:"",i,!1)},hideWelcomeGuide:function(){t.isWelcomeGuideActive?e("core/edit-post").toggleFeature("welcomeGuide"):t.areTipsEnabled&&e("core/nux").disableTips()}}})))(re),oe=function(e){function t(){var e,n;b()(this,t);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=h()(this,(e=y()(t)).call.apply(e,[this].concat(i))),k()(w()(n),"state",{isTemplateModalOpen:!1,isWarningOpen:!1}),k()(w()(n),"toggleTemplateModal",(function(){n.setState({isTemplateModalOpen:!n.state.isTemplateModalOpen})})),k()(w()(n),"toggleWarningModal",(function(){n.setState({isWarningOpen:!n.state.isWarningOpen})})),k()(w()(n),"getLastTemplateUsed",(function(){var e=n.props,t=e.isFrontPage,r=e.templates,i=e.theme,a=n.props.lastTemplateUsedSlug;if(!a&&t&&(a=i),!a||"blank"===a)return r[0];var o=r.find((function(e){return e.slug===a}));return o||r[0]})),n}return T()(t,e),O()(t,[{key:"render",value:function(){var e=this.getLastTemplateUsed(),t=e.slug,n=e.title,a=e.preview,o=e.previewAlt,l=this.props,s=l.isFrontPage,c=l.templates,p=l.theme,u=l.vertical,m=l.segment,d=l.siteInformation;return Object(r.createElement)("div",{className:"sidebar-modal-opener"},Object(r.createElement)(L,{id:"sidebar-modal-opener__last-template-used-preview",value:t,label:F(n,d),staticPreviewImg:a,staticPreviewImgAlt:o,onSelect:this.toggleWarningModal}),Object(r.createElement)(C.Button,{isPrimary:!0,onClick:this.toggleWarningModal,className:"sidebar-modal-opener__button"},Object(i.__)("Change Layout")),this.state.isTemplateModalOpen&&Object(r.createElement)(ae,{shouldPrefetchAssets:!1,templates:c,theme:p,vertical:u,segment:m,toggleTemplateModal:this.toggleTemplateModal,isFrontPage:s,isPromptedFromSidebar:!0}),this.state.isWarningOpen&&Object(r.createElement)(C.Modal,{title:Object(i.__)("Overwrite Page Content?"),isDismissible:!1,onRequestClose:this.toggleWarningModal,className:"sidebar-modal-opener__warning-modal"},Object(r.createElement)("div",{className:"sidebar-modal-opener__warning-text"},Object(i.__)("Changing the page's layout will remove any customizations or edits you have already made.")),Object(r.createElement)("div",{className:"sidebar-modal-opener__warning-options"},Object(r.createElement)(C.Button,{isDefault:!0,onClick:this.toggleWarningModal},Object(i.__)("Cancel")),Object(r.createElement)(C.Button,{isPrimary:!0,onClick:this.toggleTemplateModal},Object(i.__)("Change Layout")))))}}]),t}(r.Component),le=Object(B.compose)(Object(o.withSelect)((function(e){return{lastTemplateUsedSlug:e("core/editor").getEditedPostAttribute("meta")._starter_page_template}})))(oe),se=window.starterPageTemplatesConfig,ce=se.templates,pe=void 0===ce?[]:ce,ue=se.vertical,me=se.segment,de=se.tracksUserData,fe=se.siteInformation,be=void 0===fe?{}:fe,ge=se.screenAction,Oe=se.theme,ve=se.isFrontPage;de&&(z=ie=de,window._tkq.push(["identifyUser",ie.userid,ie.username])),"add"===ge&&Object(a.registerPlugin)("page-templates",{render:function(){return Object(r.createElement)(ae,{isFrontPage:ve,segment:me,shouldPrefetchAssets:!1,templates:pe,theme:Oe,vertical:ue})}}),Object(a.registerPlugin)("page-templates-sidebar",{render:function(){return Object(r.createElement)(l.PluginDocumentSettingPanel,{name:"Template Modal Opener",title:Object(i.__)("Page Layout"),className:"page-template-modal__sidebar",icon:"none"},Object(r.createElement)(le,{isFrontPage:ve,segment:me,siteInformation:be,templates:pe,theme:Oe,vertical:ue}))}});var he=Object(o.subscribe)((function(){Object(o.select)("core/edit-post").isEditorPanelOpened("page-templates-sidebar/Template Modal Opener")||Object(o.dispatch)("core/edit-post").toggleEditorPanelOpened("page-templates-sidebar/Template Modal Opener"),he()}))}]));
starter-page-templates/page-template-modal/index.js CHANGED
@@ -93,6 +93,11 @@ class PageTemplateModal extends Component {
93
  if ( ! prevState.isOpen && this.state.isOpen ) {
94
  trackView( this.props.segment.id, this.props.vertical.id );
95
  }
 
 
 
 
 
96
  }
97
 
98
  static getDefaultSelectedTemplate = props => {
@@ -364,12 +369,11 @@ export const PageTemplatesPlugin = compose(
364
  postContentBlock: select( 'core/editor' )
365
  .getBlocks()
366
  .find( block => block.name === 'a8c/post-content' ),
 
 
367
  };
368
  } ),
369
  withDispatch( ( dispatch, ownProps ) => {
370
- // Disable tips right away as the collide with the modal window.
371
- dispatch( 'core/nux' ).disableTips();
372
-
373
  const editorDispatcher = dispatch( 'core/editor' );
374
  return {
375
  saveTemplateChoice: slug => {
@@ -396,6 +400,15 @@ export const PageTemplatesPlugin = compose(
396
  false
397
  );
398
  },
 
 
 
 
 
 
 
 
 
399
  };
400
  } )
401
  )( PageTemplateModal );
93
  if ( ! prevState.isOpen && this.state.isOpen ) {
94
  trackView( this.props.segment.id, this.props.vertical.id );
95
  }
96
+
97
+ // Disable welcome guide right away as it collides with the modal window.
98
+ if ( this.props.isWelcomeGuideActive || this.props.areTipsEnabled ) {
99
+ this.props.hideWelcomeGuide();
100
+ }
101
  }
102
 
103
  static getDefaultSelectedTemplate = props => {
369
  postContentBlock: select( 'core/editor' )
370
  .getBlocks()
371
  .find( block => block.name === 'a8c/post-content' ),
372
+ isWelcomeGuideActive: select( 'core/edit-post' ).isFeatureActive( 'welcomeGuide' ), // Gutenberg 7.2.0 or higher
373
+ areTipsEnabled: select( 'core/nux' ) ? select( 'core/nux' ).areTipsEnabled() : false, // Gutenberg 7.1.0 or lower
374
  };
375
  } ),
376
  withDispatch( ( dispatch, ownProps ) => {
 
 
 
377
  const editorDispatcher = dispatch( 'core/editor' );
378
  return {
379
  saveTemplateChoice: slug => {
400
  false
401
  );
402
  },
403
+ hideWelcomeGuide: () => {
404
+ if ( ownProps.isWelcomeGuideActive ) {
405
+ // Gutenberg 7.2.0 or higher.
406
+ dispatch( 'core/edit-post' ).toggleFeature( 'welcomeGuide' );
407
+ } else if ( ownProps.areTipsEnabled ) {
408
+ // Gutenberg 7.1.0 or lower.
409
+ dispatch( 'core/nux' ).disableTips();
410
+ }
411
+ },
412
  };
413
  } )
414
  )( PageTemplateModal );
starter-page-templates/page-template-modal/styles/starter-page-templates-editor.scss CHANGED
@@ -135,18 +135,15 @@ body.admin-bar:not( .is-fullscreen-mode ) .page-template-modal-screen-overlay {
135
 
136
  .template-selector-control__options {
137
  display: grid;
138
- // stylelint-disable-next-line unit-whitelist
139
  grid-template-columns: 1fr;
140
  grid-gap: 1.75em;
141
 
142
  @media screen and ( min-width: $breakpoint-mobile ) {
143
  margin-top: 0;
144
- // stylelint-disable unit-whitelist
145
  grid-template-columns: repeat(
146
  auto-fit,
147
  minmax( 110px, 1fr )
148
  ); // allow grid to take over number of cols on large screens
149
- // stylelint-enable unit-whitelist
150
  }
151
  }
152
 
135
 
136
  .template-selector-control__options {
137
  display: grid;
 
138
  grid-template-columns: 1fr;
139
  grid-gap: 1.75em;
140
 
141
  @media screen and ( min-width: $breakpoint-mobile ) {
142
  margin-top: 0;
 
143
  grid-template-columns: repeat(
144
  auto-fit,
145
  minmax( 110px, 1fr )
146
  ); // allow grid to take over number of cols on large screens
 
147
  }
148
  }
149