MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / createABVariants

Function createABVariants

packages/sdk/examples/headless-agent.ts:68–83  ·  view source on GitHub ↗
(
  html: string,
  variantB: { headlineId: string; text: string; color: string },
)

Source from the content-addressed store, hash-verified

66// Produce two HTML variants from one template.
67
68export 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.

Callers

nothing calls this directly

Calls 5

openCompositionFunction · 0.85
serializeMethod · 0.65
disposeMethod · 0.65
setTextMethod · 0.65
setStyleMethod · 0.65

Tested by

no test coverage detected