@pixygon/site
The Pixygon website engine: one provider stack, the pearl page kit (SEO, i18n, language switcher, guides, hero, related products), the paid step (@pixygon/site/checkout), and the build engine every pearl runs as `pixygon-site` — so a pearl carries configuration, not engine code.
Install
# .npmrc @pixygon:registry=https://ppm.pixygon.io/ npm install @pixygon/site@0.12.14
Versions
| Version | Published | Integrity |
|---|---|---|
| 0.12.14 latest | 2026-11-24 | sha512-riuT01ich+sO+Gw… |
| 0.12.13 | 2026-11-24 | sha512-PyrkD3G4JoB/VMs… |
| 0.12.12 | 2026-11-23 | sha512-je5EASscIHAtpQl… |
| 0.12.11 | 2026-11-22 | sha512-Grpp2Q5YFGSz8o1… |
| 0.12.10 | 2026-11-16 | sha512-Yyd7h7Q1rgHBv2J… |
| 0.12.9 | 2026-11-14 | sha512-P44HBd7OBU+4wLr… |
| 0.12.8 | 2026-11-14 | sha512-5Un2FV5xV7DdATt… |
| 0.12.7 | 2026-11-10 | sha512-4xc+KD6uw7wMcWD… |
| 0.12.6 | 2026-11-10 | sha512-pKsKxRO544lzqCZ… |
| 0.12.5 | 2026-11-10 | sha512-+jhwCBS2MRq2P+7… |
| 0.12.4 | 2026-11-10 | sha512-bope3fKO9Ll3ofQ… |
| 0.12.3 | 2026-11-09 | sha512-qtyL6IyDzpNZvVZ… |
| 0.12.1 | 2026-11-04 | sha512-cxtEGrn2zYKBXXE… |
| 0.12.0 | 2026-11-04 | sha512-t53pNPEdp1XWDH0… |
| 0.11.0 | 2026-11-03 | sha512-3KBKWJMWLWe25FK… |
| 0.10.2 | 2026-10-24 | sha512-dwjIoK/xoSqxMrH… |
| 0.10.1 | 2026-10-24 | sha512-YC74Nrzb5cYbMvb… |
| 0.10.0 | 2026-10-23 | sha512-MFDHRObpQ2m4R/I… |
| 0.9.24 | 2026-10-22 | sha512-Nmvq3F/ogJNotmX… |
| 0.9.23 | 2026-10-22 | sha512-3O+3DZo/Q42ZPbL… |
| 0.9.22 | 2026-10-22 | sha512-n20/YILUXoLVTA8… |
| 0.9.21 | 2026-10-22 | sha512-P+GGZcRMls9eJXI… |
| 0.9.20 | 2026-10-22 | sha512-EzeH+q6MREfg9kM… |
| 0.9.19 | 2026-10-21 | sha512-uBTCfrDBNAicBHe… |
| 0.9.18 | 2026-10-20 | sha512-J11ELAnF8bz39G/… |
| 0.9.17 | 2026-10-19 | sha512-vOKOB5Lyd6+eIgq… |
| 0.9.16 | 2026-10-19 | sha512-A6Clficg/BtKSml… |
| 0.9.15 | 2026-10-19 | sha512-2z4pHx34uYLI9jU… |
| 0.9.14 | 2026-10-19 | sha512-6NXomLnw/OMdKyS… |
| 0.9.13 | 2026-10-17 | sha512-xZGEdblqg/EUyiC… |
| 0.9.12 | 2026-10-17 | sha512-N1V1/a1NNct8L8K… |
| 0.9.11 | 2026-10-16 | sha512-Nf3EUKPhvoNB0N1… |
| 0.9.10 | 2026-10-12 | sha512-gEJc9d0lnoGLJHM… |
| 0.9.9 | 2026-10-12 | sha512-IndC/oey6kyvegL… |
| 0.9.8 | 2026-10-12 | sha512-+fiLDCJZ0WP0gyT… |
| 0.9.7 | 2026-10-12 | sha512-m6QmUjnTvu0HhVg… |
| 0.9.6 | 2026-10-09 | sha512-xnhreKwIGzHxnlm… |
| 0.9.5 | 2026-10-07 | sha512-xJq81ZhXRfNNSEg… |
| 0.9.4 | 2026-10-05 | sha512-kFMzNd5l/PeYfQM… |
| 0.9.3 | 2026-10-05 | sha512-2o742qeBKt0fp/k… |
| 0.9.2 | 2026-10-04 | sha512-FEABmrScrydVRin… |
| 0.9.1 | 2026-10-04 | sha512-br5P7B/cZFQBbIz… |
| 0.9.0 | 2026-10-03 | sha512-z3IJKwoQYygz6Jd… |
| 0.8.4 | 2026-10-03 | sha512-NCFgabb2ee6QMV4… |
| 0.8.3 | 2026-10-02 | sha512-DYZYZEDYKYnuPyQ… |
| 0.8.2 | 2026-10-02 | sha512-+nmcQxFvcesChTi… |
| 0.8.1 | 2026-10-02 | sha512-Ri2tb2/O5yP/aiB… |
| 0.8.0 | 2026-10-02 | sha512-0g2P2NgOE6Blrlm… |
| 0.7.4 | 2026-10-02 | sha512-cxynf2ZpJ8Hm7eH… |
| 0.7.3 | 2026-10-02 | sha512-DQ0jGGODr2HIVH9… |
| 0.7.2 | 2026-10-02 | sha512-OVuMeqSCDmNnLpP… |
| 0.7.1 | 2026-10-02 | sha512-oUVIuLeduRnQ+GF… |
| 0.7.0 | 2026-10-02 | sha512-KpxTzvV+s9mnspQ… |
| 0.6.2 | 2026-10-01 | sha512-/ODbYHDozCLqBa+… |
| 0.6.1 | 2026-10-01 | sha512-SLIB90Cnxn0XWDM… |
| 0.6.0 | 2026-10-01 | sha512-4868lfRds1GS6IR… |
| 0.5.6 | 2026-10-01 | sha512-l2pxtoWQ1ad33lk… |
| 0.5.5 | 2026-10-01 | sha512-24qAqYpGKlSITyA… |
| 0.5.4 | 2026-10-01 | sha512-Hn3C8ro7V5bQMf6… |
| 0.5.3 | 2026-10-01 | sha512-xP2pNimEeHCKRtb… |
| 0.5.2 | 2026-10-01 | sha512-CGtMkkE0dbyK5ki… |
| 0.5.1 | 2026-09-30 | sha512-SJjCdhLfQ/P7utW… |
| 0.5.0 | 2026-09-30 | sha512-9S/VRAOs+RypLbd… |
| 0.4.1 | 2026-09-16 | sha512-+znh++w9YqDBrfQ… |
| 0.4.0 | 2026-09-15 | sha512-IS+M+IGcc/XwCGf… |
| 0.3.1 | 2026-09-04 | sha512-b/pmz29/zO7dnEp… |
| 0.3.0 | 2026-09-04 | sha512-gpj3p4nSr4vITGZ… |
| 0.2.2 | 2026-09-03 | sha512-Cg7perXn2zd6IGz… |
| 0.2.1 | 2026-09-03 | sha512-D6kv+um9Tru9tk2… |
| 0.2.0 | 2026-09-03 | sha512-8lTdfBSUo7twbjL… |
| 0.1.0 | 2026-09-03 | sha512-c0DbIISuhOmmF05… |
@pixygon/site
The Pixygon website scaffold. Every Pixygon Vite site mounts the same provider stack,
the same consent gate, the same SEO component and the same image discipline — from
one package instead of seven divergent copies of theme.ts, SEO.tsx and
basicAnalytics.ts.
import { foundationTheme } from '@pixygon/site';
import { PixygonSite, PixygonSEO, PixygonImage } from '@pixygon/site/react';
const theme = foundationTheme(); // or brandTheme('lonnlyst') / createSiteTheme({...})
root.render(
<PixygonSite
theme={theme}
analytics={{ projectId: '…', appName: 'Pixygon', endpoint: 'https://api.pixygon.io/v1/analytics', ga4Id: 'G-…' }}
auth={{ apiUrl: 'https://api.pixygon.io', projectId: '…' }} // omit on sites without accounts
>
<App />
</PixygonSite>
);
What <PixygonSite> mounts, outermost first: ErrorBoundary → HelmetProvider →
MUI ThemeProvider + CssBaseline → AnalyticsGate (three-state consent from
@pixygon/analytics, driven by this package's consent store) → AuthProvider →
BrowserRouter from react-router (router={false} if the app owns routing) → Suspense with
<PageLoader> → skip link, your app, <ConsentBanner>.
Consent
getConsent / subscribeConsent / acceptConsent / declineConsent / resetConsent
share one localStorage key across the estate. Undecided visitors are counted in
consent-free basic mode (page views + conversions, nothing stored on the device);
accepted starts the full SDK and GA4 (when ga4Id is set); declined stops
everything and wipes px_* storage and _ga cookies. useConsent() gives
components the live value. Register side effects with onConsentDecision.
<ConsentBanner> covers nothing the person came for (0.9.20). It measures the
first screen and docks at the bottom when no protected box there has its centre
under it (h1, h2, nav links, fields, buttons, button-styled links and
data-pixygon-primary, fixed bars included), else at the top when that is
free, else it reserves its space: flush with the top, the page (body
padding-top) and the pearl's fixed top bars move down by its height, and it
overlays nothing (data-consent-reserved). One row at every width, at most
64px on a phone (plus the safe area) and 72px wider; longer words are clamped
to two lines and a tap opens them. Phone buttons are 44px tall. While it shows
at the bottom it reserves its height (body padding-bottom,
scroll-padding-bottom, --pixygon-bottom-inset for the corner chat).
It stops moving once the person touches, types or scrolls, and its edge is on
data-consent-edge. The pure rule is chooseConsentEdge / coveredBy.
It never overlaps the pearl's work at all, not only its centre: a studio
(STUDIO_SELECTOR), a result or Download (RESULT_SELECTOR) or the demo
(#demo, [data-testid="home-demo"], data-pixygon-demo: DEMO_SELECTOR).
An edge that touches one is never taken, and a result that grows under the bar
moves it even after the person has started.
It hides only for the build-time prerender (a headless or webdriver browser on
localhost) and crawlers (isPrerenderOrCrawler): HeadlessChrome, Lighthouse
and pearl verify against the live site see it as a first-time visitor does.
Landing context (0.9.11)
src/landing.ts reads the first page's utm_source, utm_medium and utm_campaign, plus the external referrer (origin only), once per document. <PixygonSite auth={…}> hands it to @pixygon/auth as AuthConfig.attribution, and a sign-up two pages later still says which channel brought the person.
It is kept in a module variable only: no cookie and no storage. It survives SPA navigation and is gone on a reload. A visitor who declined measurement hands nothing over. A pearl may pass its own auth.attribution to override it. getLandingAttribution() is exported from /react and from the index.
The corner launcher
The corner chat's closed launcher ("Ask us" / "Spør oss", or the signed-in
Pixiel) sits where it is in the way of no control (0.9.8, same module as the
banner, src/placement.ts): bottom-right, bottom-left, then a compact 48px
round pill bottom-right and bottom-left. When the page's main action fills the
bottom of the first screen (Grensehandel's form, Cutout's slider) it goes up
the side to the lowest spot that covers nothing at all (no control, word or
picture), then the lowest spot clear of controls; nowhere clear, the spot in the
way of least. Any overlap with a field, button, link, slider or
data-pixygon-primary counts; a big card (over 96px tall) may have its corner
covered. It is never under 48px (overlay tokens in @pixygon/design) and sits
at the gutter plus --pixygon-bottom-inset (a bottom-docked consent banner, or a
pearl's own fixed bottom bar publishing its height) plus the safe-area inset. Once the person touches, types or scrolls it
moves only when a control comes under it (checked when a scroll ends, never
under a finger); a navigation, rotation or consent decision starts it over.
The spot is on data-pixygon-corner and the custom properties
--pixygon-corner-left/right/lift, which the Pixiel dock follows. The pure rule
is chooseLauncherSpot / inTheWay.
Keep-clear, phones, sign-up routes and typing (0.11.0)
-
data-pixygon-keep-clear: put it on anything the launcher may never overlap, such as an 18+ line, an AI notice or a sign-in link:<p data-pixygon-keep-clear>You must be 18 or older.</p> <a href="/login" data-pixygon-keep-clear>Sign in</a>The launcher moves off every keep-clear box on the screen (rechecked after a scroll). If every spot would cover one, it hides until a spot is clear. The constant is
KEEP_CLEAR_ATTR. -
Send buttons (0.12.2): the launcher never sits on a chat's Send button either: it moves up off it, or to the other corner. A Send button is a button whose name is "Send" or "Send message" (Norwegian "Send melding", Swedish "Skicka" too), the submit button of a form with a textarea or an editable box, or anything marked
data-pixygon-send(SEND_ATTR; use it when your Send has another name). The launcher looks again after every tap and every change, so a launcher moved before an 18+ tick comes back as soon as the page has room. The browser check isisSendControl. -
Studios (0.12.3): while an element matching
#studioor[data-testid="hero-studio"](STUDIO_SELECTOR) is on the screen, the launcher never overlaps it: it rises above the studio (past the usual low band if it has to) and comes back down once the studio scrolls away. It is never hidden for a studio. Give your hero studio one of those two names. -
Results: the launcher never overlaps a result or the control that saves it (
RESULT_SELECTOR:[data-testid="studio-result"],[data-testid="studio-download"],a[download], or anything markeddata-pixygon-result), even when the studio around them fills the screen. With no spot off them in reach it hides until the page moves. -
Result cards (0.12.7): while a result is on the screen, the card that holds it (the studio around it, a card marked
data-pixygon-result-card, or the MUI Card around a result:RESULT_CARD_SELECTOR) is kept clear too, primary actions included. On a phone (under 600px) it stays whole in its corner only when the corner is off the card; else it becomes a sliver tab in the 16px side gutter beside the card (its whole 48x48 off the card and any keep-clear box; keyboard focus brings it out whole), and on a card that runs to the screen's edge it is hidden (visibility: hidden) until the card scrolls off. Wider screens move it above the card first. It is checked again as soon as the result arrives, and comes back after a full-screen view on every engine. -
Top bar taps (0.12.3; every width since 0.12.7): every link and button in
SiteTopBar(your own Guides link included) and eachLanguageSwitchertoggle, wherever you mount it, is at least 44px tall at every width. Only the target grows: the type and padding are unchanged. -
Phones (under 600px,
PHONE_MAX_PX): the launcher is the round 48x48 icon from its first frame, with the same accessible name. Its width never changes while the page settles. Desktop keeps the full pill unless it would overlap a keep-clear box. -
Routes (
concierge.hideOn): the closed launcher hides on sign-up and sign-in routes. The default isAUTH_ROUTES:/register,/signup,/sign-up,/login,/signinand/sign-in, with or without a/xxlanguage prefix, and every path below them. Pass your own list ('/account*'matches by prefix), or[]to show it everywhere:<PixygonSite concierge={{ slug: 'hazechat', hideOn: ['/register', '/login', '/age-check'] }} /> -
Typing: while a text input, textarea or editable box on the page has focus, the closed launcher hides. It comes back on blur. The assistant's own open panel is not affected.
The closed Pixiel dock follows the same rules (data-pixygon-corner-away on
the corner).
Theme
createSiteTheme({ mode, primary, secondary, background, paper, fontFamily, headingFamily, overrides }) is the whole theme surface. brandTheme(key) reads the
design canon (@pixygon/design/tokens.mjs, frozen at build time) for a brand;
foundationTheme() is the Pixygon master brand.
Images
<PixygonImage src width height alt [priority] [widths] [sizes]> — sized, lazy
unless priority, async-decoded, and served through a srcSet of -{w}.webp
variants when src is on a Pixygon CDN host (variants are made by pearl images).
variantUrl / srcSetFor are exported for CSS backgrounds.
Stack manifest
stack.json pins the versions every site should be on. pearl doctor diffs a
site's package.json against it.
Engine guide pages (GuidePage + prebuild.mjs)
The SEO engine (PixygonAPI /v1/seo/*) writes search-gap pages per product. Any site renders them with one route:
import { GuidePage } from '@pixygon/site/react';
import { seoPages } from '@/data/seoPages.generated'; // written by the prebuild step
<Route path="/guide/:slug" element={<GuidePage project="tastarium" siteUrl="https://tastarium.com" siteName="Tastarium" ogImage="https://tastarium.com/og.png" baked={seoPages} defaultCta={{ label: 'Start your library', to: '/register' }} strings={{ chip: 'Guide', faqHeading: 'FAQ' }} />} />
and one script so the prerender and the sitemap see the pages without a network call:
"prebuild": "node node_modules/@pixygon/site/prebuild.mjs --project=tastarium --site=https://tastarium.com --out=src/data/seoPages.generated.ts"
Then set profile.extra.seo.createPages = true on the product's Board so the weekly engine creates pages there.
The pearl engine (0.5)
A pearl carries configuration; the engine lives here. Three parts:
Build — pixygon-site (bin). What every pearl used to copy into scripts/:
"build": "pixygon-site prebuild && tsc -b && vite build && pixygon-site postbuild",
"prerender": "pixygon-site prerender",
"visual-check": "pixygon-site visual-check"
prebuild = guides → related → prices → check-translations → check-prices; postbuild = sitemap → nginx.
Also publish-guides, declare-activation, og-image (run by hand). Languages,
origin and product come from src/config/site.ts; per-pearl variations go under
build in pixygon-seo.config.json: guides.lang, related.limit,
sitemap.priority, nginx.routeFiles, prerender.minHomeText,
visualCheck.{mustContain,neverOnPage}, publishGuides.{source,lang,forbidPrices},
activation.{event,target}, ogImage.{html,out}, prices.allow.
Guide CTAs resolve or the build fails (0.10). guides resolves every
cta.to before it bakes it (build/guide-ctas.mjs): a path the pearl serves
(route table: '/', /guide, config routes, every path= in App.tsx) is kept,
the pearl's own absolute URL becomes its path, a path naming another product
becomes that product's registry URL, anything else becomes '/'. Then the check:
a relative target not served, the own URL written absolute, or another host not
answering 200 fails the build. pixygon-site check-ctas [--fix] [--offline]
runs it alone. Known exceptions (imagepack credit packs, timesalong /priser) are
listed, never changed. GuidePage and PearlGuidePage render an absolute CTA as a
plain link with that exact href.
Guides never empty silently (0.7.3). guides keeps the committed
seoPages.generated.ts when the API is unreachable. An EMPTY answer while the
committed file holds pages fails the build, naming the slug and the count (one
such bake 404s every indexed /guide URL, e.g. after a SeoPage move), unless the
answer carries mergedInto (the Project was merged into a kit) or the build
sets PIXYGON_ALLOW_EMPTY_GUIDES=1. A shrink to fewer, non-zero pages is baked.
Prices — one catalogue, read, never written down (0.6.0). A pearl's products
and prices live only on its Project record. pixygon-site prices bakes
GET /v1/pricing/<slug> into src/data/prices.generated.ts (kept as committed
when the API is down; a selling pearl with nothing committed fails); pass it to
definePearl(site, { …, pricing }). site.ts PRODUCT names { key, kind }
only (priceNOK is deprecated; the generated price wins). The prerender and
crawlers show the baked price (chargeable.nok ? prices.nok : prices[base]);
a visitor sees their own from /stripe/tiers (usePearlPrice(key),
usePearlProduct()). pixygon-site check-prices fails a build whose site.ts,
locales or source hold OUR price as a literal; allow a competitor's equal figure
with a // price-literal-ok comment or build.prices.allow: [<locale key>].
The scanner is exported as @pixygon/site/price-literals.mjs for pearl doctor.
nginx / Docker. docker/nginx.base.conf is the server every pearl runs;
pixygon-site nginx fills it with the pearl's nginx.http.conf (http level),
nginx.extra.conf (inside server {}) and the route allowlist, and writes
nginx.generated.conf. The template Dockerfile copies that file and runs
npx pixygon-site prerender, which bakes, strips loopback origins and refuses to
ship a shell (or Stripe code in a free pearl). No registry image is needed: the
base travels in node_modules.
Page kit — @pixygon/site/react. Bind once in src/i18n/index.tsx:
export const { I18nProvider, useI18n, useT, localizePath, guidesFor } =
definePearl(site, { dictionaries: { no, en }, related: relatedProducts, guides: { pages: seoPages, translations: { en } } })
then use SEO, LanguageSwitcher, SiteTopBar, SiteFooter, RelatedProducts,
RichText, HeroShowcase + DemoKit, BuyButton, SupportCard, NotFoundPage,
PearlGuidePage, PearlGuideIndexPage, useScrollToTop, safeGet, safeSet.
installSafeLocalStorage() is a no-op kept for old main.tsx files: write through
safeSet, which returns false when storage is full and never clears it.
The engine ships its own no/en strings; a pearl's locale keys always win.
Three keys make the shared chrome follow the page language: site.description
(the 404 line and the default meta description; without it SITE_DESCRIPTION
shows only on the source-language and English pages), a11y.skipToContent
(the skip link, read even above the provider) and related.tagline.<slug>
(a related product's line; then its baked taglines[lang], then the tagline
baked for that language, and another language's only when none exists).
Default pages: /support, /privacy, /terms, /kontakt. Every pearl
answers them in every language with no route of its own: NotFoundPage (the
catch-all) renders SupportPage, PrivacyPage or TermsPage on those paths
and sends /kontakt to /support; pixygon-site sitemap lists them (so the
prerender bakes them), pixygon-site nginx allow-lists them and 301s /kontakt,
and pixygon-site prerender refuses to ship when one is missing from the
allowlist or the bake, or baked as the 404 page. SiteFooter links them. The
text is the standard Pixygon text: the app is made by Pixygon, the Pixygon
Privacy Policy and Terms of Service on pixygon.io apply (linked), support is by
email. The name is SITE_NAME, the address SUPPORT_EMAIL in site.ts (default
pixygon@pixygon.io), and every line is a locale key (support.page.*,
privacy.page.*, terms.page.*, legal.*) the pearl may reword. A route the
pearl declares for one of these paths is its own page and wins.
"build": { "defaultPages": false } in pixygon-seo.config.json (and
<NotFoundPage defaultPages={false} />) turns them off.
SupportCard (free pearls only) takes returnUrl — pass it when the page URL is a
capability (a shared key) so Stripe never stores it; the default is this page
without its query. It answers ?support=thanks|cancelled itself and reports
checkout_start once Stripe has a session.
t() reads flat or nested locale files and takes the i18next call shapes:
t(k, vars), t(k, 'Default'), t(k, 'Default', vars), count plurals
(k_one/k_other, ordinal: true), returnObjects. The source language is
served at /, every other under /<lang>/ (English-first is DEFAULT_LANG: 'en').
Options for app-like pearls: stickyLanguage (an in-app push from /no to an
unprefixed path stays in /no), routerBasename (the provider owns the router
and the language is its basename; router links use to(), href() stays the
full path), keepLanguageOn: /^\/guide/ (pages the browser preference never
redirects off), hardReloadOnSwitch, globalVars. setLang(lang, to?).
Checkout — @pixygon/site/checkout (ESM only). CheckoutPage / CheckoutReturnPage
driven by PRODUCT in site.ts; the server owns the price. Import it only under
__PEARL_PRICED__ so a free pearl bundles no Stripe code. Import it lazily: it
loads Stripe.js (@stripe/stripe-js/pure) when the page renders, and the
prerender refuses a build whose first-view chunks carry Stripe code. Need the
publishable key elsewhere? stripePublishableKey() from @pixygon/site/stripe-key
(no Stripe code behind it); in your own Stripe code use @stripe/stripe-js/pure.
Migrating a pearl: pearl template sync <repo> (template v4) replaces every
engine copy that matches a template version and keeps real variations with a diff.