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-style.js +11 -12 3.1.3 → trunk View file →
@@ -1,5 +1,5 @@
1 -import { getThemeVariation } from '@auto-launch/fetchers/get-variation';
1 +import { getStyleDocument } from '@auto-launch/fetchers/get-style-document';
2 2 import { getStyleShape, styleShape } from '@auto-launch/fetchers/shape';
3 3 import {
4 4 failWithFallback,
5 5 fetchWithTimeout,
@@ -6,25 +6,25 @@
6 6 retryTwice,
7 7 setStatus,
8 8 } from '@auto-launch/functions/helpers';
9 9 import { updateOption } from '@auto-launch/functions/wp';
10 +import { launchStrings } from '@auto-launch/strings';
10 11 import { AI_HOST } from '@constants';
11 12 import { digest } from '@shared/api/digest';
12 13 import { reqDataBasics } from '@shared/lib/data';
13 -import { __ } from '@wordpress/i18n';
14 14 import { z } from 'zod';
15 15
16 16 const fallback = { siteStyle: {} };
17 -const url = `${AI_HOST}/api/styles`;
17 +const url = `${AI_HOST}/api/style-recipes`;
18 18 const method = 'POST';
19 19 const headers = { 'Content-Type': 'application/json' };
20 20
21 -// variation gets merged in after fetch
21 +// The styles route serves no global-styles document.
22 22 const shapeLocal = z.array(styleShape.omit({ variation: true }));
23 23
24 24 export const handleSiteStyle = async ({ siteProfile }) => {
25 25 // translators: this is for a action log UI. Keep it short
26 - setStatus(__('Picking the perfect design', 'extendify-local'));
26 + setStatus(launchStrings().statusStyle);
27 27
28 28 const body = JSON.stringify({ ...reqDataBasics, siteProfile, count: 1 });
29 29
30 30 const response = await retryTwice(() =>
@@ -48,16 +48,15 @@
48 48 return failWithFallback(
49 49 async () => {
50 50 const data = await response.json();
51 51 const style = shapeLocal.parse(data)[0];
52 - const variation = await getThemeVariation(
53 - {
54 - slug: style.colorPalette,
55 - fonts: style.fonts,
56 - },
57 - { fallback: true },
58 - );
52 + const variation = await getStyleDocument({
53 + colorPalette: style.colorPalette,
54 + fonts: style.fonts,
55 + });
59 56 const siteStyle = { ...style, variation };
57 + // The Agent reads extendify_siteStyle; the legacy row keeps old readers.
58 + await updateOption('extendify_siteStyle', siteStyle);
60 59 await updateOption('extendify_site_style', siteStyle);
61 60 // Set animation default
62 61 await updateOption('extendify_animation_settings', {
63 62 type: style.animation ?? 'fade',