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/Agent/workflows/theme/tools/update-variation.js +4 -10 3.1.6 → trunk View file →
@@ -1,17 +1,16 @@
1 +import { appliedVibeOwnership } from '@shared/lib/applied-vibes';
1 2 import { deepMerge } from '@shared/lib/utils';
2 3 import {
3 4 preserveVibeSettings,
4 5 preserveVibeStyles,
5 - vibeGlobalsEntry,
6 6 } from '@shared/lib/vibe-globals';
7 -import { getVibes, vibesBySlug } from '@shared/lib/vibes';
8 7 import apiFetch from '@wordpress/api-fetch';
9 8
10 9 const { globalStylesPostID } = window.extSharedData;
11 10
12 11 // The vibe layer keeps its owned leaves even when the variation declares them.
13 -export default async ({ variation }) => {
12 +export default async ({ variation, purge = (document) => document }) => {
14 13 const [current, vibes] = await Promise.all([
15 14 apiFetch({
16 15 path: `/wp/v2/global-styles/${globalStylesPostID}?context=edit`,
17 16 }),
@@ -18,9 +17,9 @@
18 17 getCurrentVibes(),
19 18 ]);
20 19
21 20 const merged = deepMerge(
22 - { settings: current.settings, styles: current.styles },
21 + purge({ settings: current.settings, styles: current.styles }),
23 22 variation,
24 23 );
25 24
26 25 return apiFetch({
@@ -46,14 +45,9 @@
46 45 try {
47 46 const { data } = await apiFetch({
48 47 path: '/extendify/v1/launch/options?option=extendify_siteStyle',
49 48 });
50 - const selectedVibe = data?.vibe || 'natural-1';
51 - const payloads = await getVibes(`agent,${selectedVibe}`);
52 - // Widening to the served set purges leaves this vibe never declared.
53 - const entry = vibeGlobalsEntry(vibesBySlug(payloads), selectedVibe);
54 - return entry ? { [selectedVibe]: entry } : {};
49 + return await appliedVibeOwnership(data?.vibe);
55 50 } catch {
56 - // No payloads means no ownership map; the merged document ships as-is.
57 51 return {};
58 52 }
59 53 };