PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | src/AutoLaunch/fetchers/get-home.js +13 -4 3.1.4 → trunk View file →
@@ -1,5 +1,8 @@
1 -import { applyDesignBuildHero } from '@auto-launch/fetchers/get-design-build';
1 +import {
2 + applyDesignBuildHero,
3 + applyDesignBuildNav,
4 +} from '@auto-launch/fetchers/get-design-build';
2 5 import { getHomeShape, homeTemplateShape } from '@auto-launch/fetchers/shape';
3 6 import {
4 7 fetchWithTimeout,
5 8 retryTwice,
@@ -5,12 +8,13 @@
5 8 retryTwice,
6 9 setStatus,
7 10 } from '@auto-launch/functions/helpers';
8 11 import { getHeadersAndFooters } from '@auto-launch/functions/wp';
12 +import { launchStrings } from '@auto-launch/strings';
9 13 import { PATTERNS_HOST } from '@constants';
10 14 import { digest } from '@shared/api/digest';
11 15 import { reqDataBasics } from '@shared/lib/data';
12 -import { __ } from '@wordpress/i18n';
16 +import { siteImageUrlsByType } from '@shared/lib/site-images';
13 17
14 18 const url = `${PATTERNS_HOST}/api/home`;
15 19 const { wpLanguage, showImprint } = window.extSharedData;
16 20 const method = 'POST';
@@ -23,9 +27,9 @@
23 27 aiHeaders,
24 28 designBuild,
25 29 }) => {
26 30 // translators: this is for a action log UI. Keep it short
27 - setStatus(__('Preparing your home page', 'extendify-local'));
31 + setStatus(launchStrings().statusHome);
28 32
29 33 // A full-page design build already carries the whole home; skip the
30 34 // /api/home fetch and build the page from the built patterns directly.
31 35 const builtHome = designBuild?.builtPages?.find((p) => p.slug === 'home');
@@ -44,9 +48,9 @@
44 48
45 49 const body = JSON.stringify({
46 50 ...reqDataBasics,
47 51 siteProfile,
48 - siteImages,
52 + siteImages: siteImageUrlsByType(siteImages),
49 53 sitePlugins,
50 54 aiHeaders,
51 55 // If pages are passed in they may be used
52 56 pages: designBuild?.pages ?? [],
@@ -71,8 +75,13 @@
71 75 throw new Error(response.statusText);
72 76 }
73 77
74 78 const template = homeTemplateShape.parse(await response.json());
79 + template.patterns = applyDesignBuildNav(
80 + template.patterns,
81 + designBuild,
82 + siteProfile.structure,
83 + );
75 84 template.patterns = applyDesignBuildHero(template.patterns, designBuild);
76 85
77 86 const parts = await resolveTemplateParts({ siteProfile, designBuild });
78 87 return getHomeShape.parse({ home: { ...template, ...parts } });