Skip to content

Commit 7a136a1

Browse files
committed
fix(landing): coordinate campaign and pricing help
Generated-By: looper 0.11.8 (runner=fixer, agent=codex)
1 parent dc6fe17 commit 7a136a1

5 files changed

Lines changed: 86 additions & 6 deletions

File tree

apps/landing-page/app/_components/go-banner.astro

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ const apiOrigin =
156156
try {
157157
if (window.localStorage.getItem(dismissKey) === '1') return;
158158
} catch (error) {}
159+
const announceOwnershipChange = () => {
160+
window.dispatchEvent(new Event('go-banner:state-change'));
161+
};
159162
document.documentElement.classList.add('go-banner-pending');
163+
announceOwnershipChange();
160164

161165
const track = (name, extra) => {
162166
try {
@@ -172,10 +176,12 @@ const apiOrigin =
172176
const hide = () => {
173177
banner.setAttribute('hidden', '');
174178
document.documentElement.classList.remove('go-banner-active', 'go-banner-pending');
179+
announceOwnershipChange();
175180
};
176181
const show = () => {
177182
banner.removeAttribute('hidden');
178183
document.documentElement.classList.add('go-banner-active');
184+
announceOwnershipChange();
179185
track('surface_view');
180186
};
181187

@@ -191,6 +197,7 @@ const apiOrigin =
191197
const apiOrigin = (banner.getAttribute('data-api-origin') || '').replace(/\/$/, '');
192198
if (!apiOrigin) {
193199
document.documentElement.classList.remove('go-banner-pending');
200+
announceOwnershipChange();
194201
return;
195202
}
196203
fetch(apiOrigin + '/api/auth/get-session', {
@@ -222,6 +229,7 @@ const apiOrigin =
222229
.catch(() => {
223230
// A failed entitlement probe cannot safely classify a signed-in visitor.
224231
})
225-
.finally(() => document.documentElement.classList.remove('go-banner-pending'));
232+
.finally(() => document.documentElement.classList.remove('go-banner-pending'))
233+
.then(announceOwnershipChange);
226234
})();
227235
</script>

apps/landing-page/app/_components/pricing-individual-plans.astro

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,12 @@ const otherModels = 'Gemini-3.1-Pro, Grok-4.5, GPT-5.4, GPT-5.6-Terra, Qwen3.7-M
516516
<th class="model-group-cell" rowspan={models.length} scope="rowgroup">
517517
<span class="model-group-title">
518518
<span>{categoryCopy[category].title}</span>
519-
{category === 'popular' && <button type="button" class="model-group-help" aria-label={P.aboutPopularAllowance}>?</button>}
519+
{category === 'popular' && (
520+
<details class="model-group-help">
521+
<summary aria-label={P.aboutPopularAllowance}>?</summary>
522+
<span class="model-group-help-copy">{P.usageAllowanceNote}</span>
523+
</details>
524+
)}
520525
</span>
521526
<small>{categoryCopy[category].count}</small>
522527
</th>
@@ -1457,23 +1462,57 @@ const otherModels = 'Gemini-3.1-Pro, Grok-4.5, GPT-5.4, GPT-5.6-Terra, Qwen3.7-M
14571462
}
14581463

14591464
.model-group-help {
1460-
display: flex;
1465+
position: relative;
14611466
flex: 0 0 17px;
1467+
width: 17px;
1468+
height: 17px;
1469+
align-items: center;
1470+
margin-top: 2px;
1471+
}
1472+
1473+
.model-group-help summary {
1474+
display: flex;
14621475
align-items: center;
14631476
justify-content: center;
14641477
width: 17px;
14651478
height: 17px;
1466-
margin-top: 2px;
14671479
padding: 0;
14681480
color: #555a52;
14691481
font-size: 10px;
14701482
line-height: 1;
1483+
list-style: none;
14711484
cursor: help;
14721485
background: transparent;
14731486
border: 1px solid #777c74;
14741487
border-radius: 50%;
14751488
}
14761489

1490+
.model-group-help summary::-webkit-details-marker { display: none; }
1491+
.model-group-help summary::marker { content: ''; }
1492+
.model-group-help summary:focus-visible {
1493+
outline: 2px solid #1f7e16;
1494+
outline-offset: 2px;
1495+
}
1496+
1497+
.model-group-help-copy {
1498+
position: absolute;
1499+
z-index: 4;
1500+
top: 25px;
1501+
left: 0;
1502+
display: block;
1503+
width: 280px;
1504+
padding: 10px 12px;
1505+
color: #30342e;
1506+
font-size: 11px;
1507+
font-weight: 500;
1508+
line-height: 1.5;
1509+
text-align: left;
1510+
background: #fff;
1511+
border: 1px solid rgba(65, 72, 61, 0.16);
1512+
border-radius: 10px;
1513+
box-shadow: 0 10px 30px rgba(28, 35, 24, 0.12);
1514+
}
1515+
14771516
.model-name-cell {
14781517
color: #30342e !important;
14791518
font-size: 15px;

apps/landing-page/app/pages/index.astro

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,10 @@ const cobeEnhancerUrl = `/enhancers/cobe.js?v=${
371371
const updateCampaignVisibility = () => {
372372
const now = Date.now();
373373
const active = now >= startAt && now < endAt;
374-
const visible = active && !dismissed;
374+
const goOwns =
375+
document.documentElement.classList.contains('go-banner-active') ||
376+
document.documentElement.classList.contains('go-banner-pending');
377+
const visible = active && !dismissed && !goOwns;
375378
if (banner) banner.hidden = !visible;
376379
document.documentElement.classList.toggle('home-campaign-banner-active', visible);
377380
if (!active || !countdown) return active;
@@ -387,9 +390,13 @@ const cobeEnhancerUrl = `/enhancers/cobe.js?v=${
387390
}
388391
return active;
389392
};
393+
window.addEventListener('go-banner:state-change', updateCampaignVisibility);
390394
updateCampaignVisibility();
391395
const campaignTimer = window.setInterval(updateCampaignVisibility, 1000);
392-
window.addEventListener('pagehide', () => window.clearInterval(campaignTimer), { once: true });
396+
window.addEventListener('pagehide', () => {
397+
window.clearInterval(campaignTimer);
398+
window.removeEventListener('go-banner:state-change', updateCampaignVisibility);
399+
}, { once: true });
393400
campaignLink?.addEventListener('click', (event) => {
394401
const eligible = Date.now() >= startAt && Date.now() < endAt;
395402
const attribution = eligible

apps/landing-page/tests/go-banner.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ test('Go banner suppresses DeepSeek while audience classification is pending', (
8282
);
8383
});
8484

85+
test('DeepSeek visibility and impressions follow Go banner ownership changes', () => {
86+
assert.match(
87+
home,
88+
/const goOwns =\s*document\.documentElement\.classList\.contains\('go-banner-active'\) \|\|\s*document\.documentElement\.classList\.contains\('go-banner-pending'\);/,
89+
);
90+
assert.match(home, /const visible = active && !dismissed && !goOwns;/);
91+
assert.match(
92+
home,
93+
/window\.addEventListener\('go-banner:state-change', updateCampaignVisibility\);/,
94+
);
95+
assert.match(banner, /new Event\('go-banner:state-change'\)/);
96+
});
97+
8598
test('Go banner uses the confirmed short copy and links to localized Pricing', () => {
8699
for (const locale of Object.keys(expectedGoBannerDetails) as Array<
87100
keyof typeof expectedGoBannerDetails

apps/landing-page/tests/pricing-contract.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,19 @@ describe("pricing contract", () => {
221221
assert.doesNotMatch(individualPlans, />UP TO \{imageResolution\}<\/em>/);
222222
});
223223

224+
it("reveals the localized popular-model allowance from the comparison help control", async () => {
225+
const individualPlans = await readFile(PRICING_INDIVIDUAL_PATH, "utf8");
226+
227+
assert.match(
228+
individualPlans,
229+
/<details class="model-group-help">\s*<summary aria-label=\{P\.aboutPopularAllowance\}>\?<\/summary>\s*<span class="model-group-help-copy">\{P\.usageAllowanceNote\}<\/span>\s*<\/details>/s,
230+
);
231+
assert.doesNotMatch(
232+
individualPlans,
233+
/<button[^>]*class="model-group-help"/,
234+
);
235+
});
236+
224237
it("keeps the Max wordmark readable on its dark card", async () => {
225238
const [individualPlans, logo] = await Promise.all([
226239
readFile(PRICING_INDIVIDUAL_PATH, "utf8"),

0 commit comments

Comments
 (0)