| @@ -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,16 +62,13 @@ | ||
| 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 }; |
| 75 | 72 | // The Agent reads extendify_siteStyle; the legacy row keeps old readers. |
| 76 | 73 | await updateOption('extendify_siteStyle', siteStyle); |
| 77 | 74 | await updateOption('extendify_site_style', siteStyle); |