| 1 |
import changeHeroSection from '@agent/workflows/theme/tools/change-hero-section'; |
| 2 |
import updatePalette from '@agent/workflows/theme/tools/update-palette'; |
| 3 |
import updateSiteVibes from '@agent/workflows/theme/tools/update-site-vibes'; |
| 4 |
import updateVariation from '@agent/workflows/theme/tools/update-variation'; |
| 5 |
|
| 6 |
export default async ({ |
| 7 |
updatedPageBlocks, |
| 8 |
postId, |
| 9 |
vibeSlug, |
| 10 |
colorAndFontsVariation, |
| 11 |
colorPalette, |
| 12 |
}) => { |
| 13 |
if (!updatedPageBlocks || !vibeSlug || !colorAndFontsVariation) return; |
| 14 |
|
| 15 |
await Promise.all([ |
| 16 |
changeHeroSection({ updatedPageBlocks, postId }), |
| 17 |
(async () => { |
| 18 |
// The vibe write goes last so it owns the contested leaves. |
| 19 |
await updateVariation({ variation: colorAndFontsVariation }); |
| 20 |
// Absent or failing when /api/palettes is down; the vibe write must still run. |
| 21 |
if (colorPalette) await updatePalette({ colorPalette }).catch(() => null); |
| 22 |
await updateSiteVibes({ selectedVibe: vibeSlug }); |
| 23 |
})(), |
| 24 |
]); |
| 25 |
}; |
| 26 |
|