feat(offer): live catalog price list in the public offer, served by the render sidecar
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 26s
CI / ui (pull_request) Successful in 1m13s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Failing after 16m19s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 26s
CI / ui (pull_request) Successful in 1m13s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Failing after 16m19s
Robokassa moderation requires the public offer to list every digital good with its price. Move /offer/ off the static landing container to the render sidecar: it splices the live catalog price list (§4.4) into the owner-edited ui/legal/offer_ru.md and renders it with the shared ui/src/lib/offer.ts — one renderer, no drift, always matching the current catalog with no redeploy. - backend: /api/v1/internal/offer/pricing (internal, off the edge allow-list) projects the active catalog into two markdown tables — chip packs priced per rail (roubles / VK votes / Telegram Stars) and chip-priced values — through payments.Money so no float reaches the page. Cached in memory: warmed at boot, marked stale on every catalog mutation, so a served render issues no query. - renderer: GET /offer/ fetches the tables and substitutes them at the <#pricing_template#> marker, then renders; offer_ru.md is baked into the image and marked is bundled from ui. GET /offer -> 301. Only /offer/ is edge-exposed. - caddy: route /offer/ to the sidecar; drop the now-dead landing /offer/ handlers and the vite emit-offer plugin. - offer: fill §4.3 (the chip-payment wording) and drop the in-page back link. - landing footer: a feedback link (the offer's Telegram contact) beside the offer link. - docs (ARCHITECTURE, FUNCTIONAL +_ru, renderer README), CI /offer/ probe, unit + integration + node tests.
This commit is contained in:
+15
-1
@@ -125,7 +125,13 @@
|
||||
</section>
|
||||
|
||||
<footer class="ft">
|
||||
<a class="offer" href="/offer/">{t('landing.offer')}</a>
|
||||
<span class="legal">
|
||||
<a class="offer" href="/offer/">{t('landing.offer')}</a>
|
||||
<span class="sep" aria-hidden="true">|</span>
|
||||
<!-- The feedback bot: the same Telegram contact the offer lists (section 11 «Реквизиты»);
|
||||
external, opens in a new tab. -->
|
||||
<a class="offer" href="https://t.me/Erudit_GameBot" target="_blank" rel="noopener noreferrer">{t('landing.feedback')}</a>
|
||||
</span>
|
||||
<span>{t('about.version', { v: __APP_VERSION__ })}</span>
|
||||
</footer>
|
||||
</main>
|
||||
@@ -287,6 +293,14 @@
|
||||
color: var(--text-muted);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.ft .legal {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.ft .sep {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.ft .offer {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
@@ -285,6 +285,7 @@ export const en = {
|
||||
'landing.captionVK': 'VK',
|
||||
'landing.captionWeb': 'Web',
|
||||
'landing.offer': 'Public offer',
|
||||
'landing.feedback': 'Feedback',
|
||||
|
||||
'install.title': 'Install the app',
|
||||
'install.subtitle': 'Put the app icon on your desktop (home screen) to open the game in one tap.',
|
||||
|
||||
@@ -285,6 +285,7 @@ export const ru: Record<MessageKey, string> = {
|
||||
'landing.captionVK': 'VK',
|
||||
'landing.captionWeb': 'Веб-версия',
|
||||
'landing.offer': 'Публичная оферта',
|
||||
'landing.feedback': 'Обратная связь',
|
||||
|
||||
'install.title': 'Установить приложение',
|
||||
'install.subtitle': 'Поместите иконку приложения на рабочий стол (домашний экран), чтобы открывать игру одним нажатием.',
|
||||
|
||||
@@ -10,8 +10,8 @@ describe('renderOfferHtml', () => {
|
||||
// The markdown heading is rendered, not left as literal source.
|
||||
expect(html).toContain('<h1>Публичная оферта</h1>');
|
||||
expect(html).not.toContain('# Публичная оферта');
|
||||
// A back link to the landing root is always present.
|
||||
expect(html).toContain('href="/"');
|
||||
// No in-page navigation: the standalone offer carries no "back" link.
|
||||
expect(html).not.toContain('class="back"');
|
||||
});
|
||||
|
||||
it('renders headings, bold clause numbers and lists', () => {
|
||||
|
||||
+8
-12
@@ -2,13 +2,15 @@ import { marked } from 'marked';
|
||||
|
||||
/**
|
||||
* renderOfferHtml renders the public-offer markdown source into a standalone,
|
||||
* self-contained HTML document served statically at `/offer/`. The build emits
|
||||
* the result as `dist/offer/index.html` (see the `emit-offer` plugin in
|
||||
* `vite.config.ts`), which the landing container serves.
|
||||
* self-contained HTML document served at `/offer/`. It runs server-side in the
|
||||
* render sidecar (`renderer/src/offer.mjs`), which reads the owner-edited
|
||||
* `ui/legal/offer_ru.md`, splices the live catalog price list into it and calls
|
||||
* this function — one renderer shared with the browser build, kept unit-tested
|
||||
* here (`offer.test.ts`).
|
||||
*
|
||||
* The input `markdown` is trusted repository content (the owner-edited
|
||||
* `ui/legal/offer_ru.md`), not user input, so the rendered HTML is deliberately
|
||||
* not sanitised. The page carries its own minimal light/dark styling so it needs
|
||||
* The input `markdown` is trusted repository content plus the backend's own
|
||||
* catalog projection, not user input, so the rendered HTML is deliberately not
|
||||
* sanitised. The page carries its own minimal light/dark styling so it needs
|
||||
* neither the app bundle nor `app.css`.
|
||||
*/
|
||||
export function renderOfferHtml(markdown: string): string {
|
||||
@@ -55,11 +57,6 @@ export function renderOfferHtml(markdown: string): string {
|
||||
a {
|
||||
color: var(--accent);
|
||||
}
|
||||
.back {
|
||||
display: inline-block;
|
||||
margin-bottom: 20px;
|
||||
text-decoration: none;
|
||||
}
|
||||
h1 {
|
||||
font-size: 1.6rem;
|
||||
text-align: center;
|
||||
@@ -84,7 +81,6 @@ export function renderOfferHtml(markdown: string): string {
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<a class="back" href="/">← На главную</a>
|
||||
${body}
|
||||
</main>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user