(
html: string,
variantB: { headlineId: string; text: string; color: string },
)
| 66 | // Produce two HTML variants from one template. |
| 67 | |
| 68 | export async function createABVariants( |
| 69 | html: string, |
| 70 | variantB: { headlineId: string; text: string; color: string }, |
| 71 | ): Promise<{ variantA: string; variantB: string }> { |
| 72 | const compA = await openComposition(html); |
| 73 | const variantAHtml = compA.serialize(); |
| 74 | compA.dispose(); |
| 75 | |
| 76 | const compB = await openComposition(html); |
| 77 | compB.setText(variantB.headlineId, variantB.text); |
| 78 | compB.setStyle(variantB.headlineId, { color: variantB.color }); |
| 79 | const variantBHtml = compB.serialize(); |
| 80 | compB.dispose(); |
| 81 | |
| 82 | return { variantA: variantAHtml, variantB: variantBHtml }; |
| 83 | } |
| 84 | |
| 85 | // ── Asset swap agent ────────────────────────────────────────────────────────── |
| 86 | // F3: setAttribute handles img src, href, alt — the full attribute space. |
nothing calls this directly
no test coverage detected