1# Download action
2
3Shared production control in
4`src/components/brand-system/download-action.tsx`; the workshop export
5forwards to it. OS/architecture detection comes from `src/lib/download.ts`.
6
7## Destinations and channels
8
9Without `href`, server rendering provides `fallbackHref` (default
10`/download`). After hydration, the control awaits asynchronous detection.
11Mac and Windows with known architecture use their detected installer;
12Linux, unknown platforms and Windows without usable architecture hints
13keep the fallback. Within the
14download page use `fallbackHref="#downloads"` to avoid self-navigation.
15
16`channel="preview"` appends the preview channel to a detected installer.
17An explicit `href` owns the complete package/channel URL and is never
18replaced by detection; use the channel-aware choices from
19`src/data/download-columns.tsx`.
20
21## Mobile
22
23Default `mobileMode="link"` preserves the fallback-link behavior.
24Use `mobileMode="email"` for the existing brand-styled email sheet on
25phones/tablets. iPad tablet and desktop-style user agents both use the
26mobile path. The `/download` page also mounts `DownloadAutoTrigger` once,
27with its session/iframe guards and existing telemetry.
28
29The form calls `/api/mobile-download-email`. Rendering or mocked tests do
30not prove Customer.io delivery. Its Site ID, Track API key and App API
31key must be configured for a real end-to-end check; do not send real
32email or create profiles without authorization.
33
34## Presentation and tracking
35
36`label`, `variant` (`solid` or `outline`), `trackingEvent` (existing
37registry key) and `trackingProperties` are caller-controlled. Read the
38website-telemetry skill before changing events. Catalog specimens do
39not load production trackers; verify emission on the real page.
40
41### Existing page and package events
42
43`DownloadAction` carries the caller's existing event, not a newly invented
44download series. It uses the shared delegated interceptor; do not add a
45second programmatic SDK call to its click handler.
46
47The `/download` Terminal product card retains `DOWNLOAD_ON_PAGE_CLICKED`
48(`download on page clicked`) without custom properties, including when
49the mobile control opens its email sheet. The Factories card is a separate
50link retaining `CTA_ON_PAGE_CLICKED` (`cta on page clicked`), not a
51DownloadAction. The Home Terminal card instead retains the legacy
52`DownloadCTA` literal `download cta clicked`; do not substitute the
53download-page event merely because the buttons look alike.
54
55Package links preserve the old `DownloadColumns` /
56`src/components/sections/downloads-three-column.tsx` contract:
57`DOWNLOAD_IN_FOOTER_CLICKED` (`download in footer clicked`) carries
58`{label, package}`. Primary labels retain their authored value, including
59the preview suffix; secondary labels use `row.title + '-' + option.label`.
60`package` is the selected installer query value, not a guessed OS.
61Stable/preview choices retain their original URLs and channel parameters.
62The shared page wiring lives in `src/components/brand-system/download-page.tsx`.
63
64`MobileEmailToast` keeps its established separate semantics: identify the
65email through `identifyEmail`, emit `mobile download email submitted` only
66after a successful response, or `send download form submission error` on
67failure. Never put the email in track properties or interpret a sheet-open
68click as a completed submission. Do not add unused focus/started/result
69registry events simply because their keys exist.
70
71`DownloadPage.test.tsx` owns exact package/CTA wiring and footer commands;
72`HomepageNavigation.test.tsx` checks the download routes' legacy nav profile.
73The existing `download-brand.test.tsx` and `download-cta.test.tsx` cover
74mobile form behavior. Rendering or a stubbed SDK does not prove ingestion.
75
76Download links are exempt from external arrows but open external
77installers safely in a new tab. Action shape follows R-15; OS grouping
78cards follow R-16. Preserve the separate legacy `DownloadCTA` contracts.