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-design-build.js +20 -10 3.1.4 → trunk View file →
@@ -1,6 +1,6 @@
1 1 import { isExternalLogo, uploadLogo } from '@auto-launch/fetchers/get-logo';
2 -import { getThemeVariation } from '@auto-launch/fetchers/get-variation';
2 +import { getStyleDocument } from '@auto-launch/fetchers/get-style-document';
3 3 import {
4 4 getDesignBuildShape,
5 5 getLogoShape,
6 6 getPluginsShape,
@@ -13,11 +13,11 @@
13 13 setStatus,
14 14 } from '@auto-launch/functions/helpers';
15 15 import { updateOption } from '@auto-launch/functions/wp';
16 16 import { useLaunchDataStore } from '@auto-launch/state/launch-data';
17 +import { launchStrings } from '@auto-launch/strings';
17 18 import { AI_HOST } from '@constants';
18 19 import { digest } from '@shared/api/digest';
19 -import { __ } from '@wordpress/i18n';
20 20 import { mutate } from 'swr';
21 21
22 22 const fallback = null;
23 23 const headers = { 'Content-Type': 'application/json' };
@@ -32,9 +32,9 @@
32 32 const buildId = urlParams?.['build-id'];
33 33 if (!buildId) return fallback;
34 34
35 35 // translators: this is for a action log UI. Keep it short
36 - setStatus(__('Loading your design', 'extendify-local'));
36 + setStatus(launchStrings().statusDesign);
37 37
38 38 const url = `${AI_HOST}/api/design/${encodeURIComponent(buildId)}`;
39 39 const response = await retryTwice(() =>
40 40 fetchWithTimeout(url, { headers }),
@@ -62,17 +62,16 @@
62 62 const profile = parsed.siteProfile;
63 63 await updateOption('extendify_site_profile', JSON.stringify(profile));
64 64 mutate('siteProfile', { siteProfile: profile }, false);
65 65
66 - // Stash the site style and variation
67 66 const style = parsed.siteStyle;
68 - const fonts =
69 - style.fonts?.heading || style.fonts?.body ? style.fonts : null;
70 - const variation = await getThemeVariation(
71 - { slug: style.colorPalette, fonts },
72 - { fallback: true },
73 - );
67 + const variation = await getStyleDocument({
68 + colorPalette: style.colorPalette,
69 + fonts: style.fonts,
70 + });
74 71 const siteStyle = { ...style, variation };
72 + // The Agent reads extendify_siteStyle; the legacy row keeps old readers.
73 + await updateOption('extendify_siteStyle', siteStyle);
75 74 await updateOption('extendify_site_style', siteStyle);
76 75 await updateOption('extendify_animation_settings', {
77 76 type: style.animation ?? 'fade',
78 77 speed: 'medium',
@@ -130,8 +129,19 @@
130 129 export const applyDesignBuildHero = (patterns, designBuild) => {
131 130 const builtHome = designBuild?.builtPages?.find((p) => p.slug === 'home');
132 131 if (!builtHome?.patterns?.length) return patterns;
133 132 return [...builtHome.patterns, ...patterns];
133 +};
134 +
135 +// /api/home answers a locked nav with one section per entry, in order, and holds back
136 +// the hero, so a count mismatch means that broke: leave the names to the pattern types.
137 +export const applyDesignBuildNav = (patterns, designBuild, structure) => {
138 + const pages = designBuild?.pages ?? [];
139 + if (structure !== 'single-page' || patterns.length !== pages.length) {
140 + return patterns;
141 + }
142 +
143 + return patterns.map((pattern, i) => ({ ...pattern, navSlug: pages[i].slug }));
134 144 };
135 145
136 146 // Reorder pages to match the design build's page order; extras fall to the end.
137 147 export const applyDesignBuildOrder = (pages, designBuild) => {