de5ab9186c
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m14s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m48s
Add English versions of the privacy policy, EULA and offer (ui/legal/*_en.md) and render each legal page as one self-contained bilingual document: both language bodies plus a header language toggle and theme toggle (no back), a small inline ES5 script that switches language client-side (no reload, default Russian + persisted) and applies the theme (system default + persisted override) — mirroring the landing. The offer's English view transliterates the Russian product names spliced from the live catalog. renderLegalHtml now takes both language sources; renderOffer splices the price list into both; the renderer bakes and reads the _en sources and pre-renders the static pages at boot. Also wrap the /offer/ contour probe in the same retry+timeout as the legal probe (the offer page is now bilingual and larger). Docs + renderer/ui tests updated.
22 lines
1.4 KiB
JavaScript
22 lines
1.4 KiB
JavaScript
// The public-offer page renderer: splices the live catalog price list into BOTH language sources of
|
|
// the owner-edited offer markdown at the pricing marker, and renders the bilingual /offer/ page with
|
|
// the SAME renderOfferHtml the browser build uses (bundled from ui/src/lib/offer). The English view
|
|
// transliterates the Russian product names client-side (renderLegalHtml). Kept out of server.mjs so
|
|
// the substitution is unit-testable without HTTP.
|
|
import { renderOfferHtml } from '../dist/gameimage.mjs';
|
|
|
|
// pricingMarker is the token ui/legal/offer_{ru,en}.md carry at §4.4 where the price list belongs. It
|
|
// mirrors the backend marker (backend/internal/payments/offer.go) and is replaced with the fetched
|
|
// tables before rendering.
|
|
export const pricingMarker = '<#pricing_template#>';
|
|
|
|
// renderOffer returns the standalone /offer/ HTML: the RU + EN offer markdown with the pricing marker
|
|
// replaced by pricingTables (the two markdown tables the backend projects from the active catalog),
|
|
// rendered to a self-contained bilingual document. The replacement is literal (a function replacer)
|
|
// so a "$" in a product title is never read as a replacement pattern; a missing marker leaves the
|
|
// text as is.
|
|
export function renderOffer(ruMarkdown, enMarkdown, pricingTables) {
|
|
const splice = (md) => md.replace(pricingMarker, () => pricingTables);
|
|
return renderOfferHtml(splice(ruMarkdown), splice(enMarkdown));
|
|
}
|