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:
@@ -59,13 +59,18 @@ test('the landing shows a web-version entry linking /app/, with a caption', asyn
|
||||
await expect(page.getByText('Веб-версия')).toBeVisible();
|
||||
});
|
||||
|
||||
// The footer carries a public-offer link to the static /offer/ page (rendered from
|
||||
// ui/legal/offer_ru.md at build; the legal document a purchase accepts).
|
||||
test('the landing footer links to the public offer at /offer/', async ({ page }) => {
|
||||
// The footer carries the public-offer link (/offer/ — the legal document a purchase accepts,
|
||||
// rendered by the render sidecar) and, beside it, the feedback link to the Telegram bot the offer
|
||||
// lists as the seller's contact.
|
||||
test('the landing footer links to the public offer and the feedback bot', async ({ page }) => {
|
||||
await page.goto('/landing.html');
|
||||
await expect(page.getByText(/Играй в «Эрудита»/)).toBeVisible(); // Russian by default
|
||||
|
||||
const offer = page.getByRole('link', { name: 'Публичная оферта' });
|
||||
await expect(offer).toBeVisible();
|
||||
expect(await offer.getAttribute('href')).toBe('/offer/');
|
||||
|
||||
const feedback = page.getByRole('link', { name: 'Обратная связь' });
|
||||
await expect(feedback).toBeVisible();
|
||||
expect(await feedback.getAttribute('href')).toBe('https://t.me/Erudit_GameBot');
|
||||
});
|
||||
|
||||
@@ -80,6 +80,12 @@
|
||||
|
||||
**4.2.** Все расчеты по Договору производятся в безналичном порядке.
|
||||
|
||||
**4.3.** Порядок расчётов. Приобретаемым Товаром является внутриигровая валюта «Фишка» — условная учётная единица, используемая исключительно в пределах Сайта Продавца. «Фишки» предоставляют Покупателю возможность получения внутриигровых благ и дополнительных функций, включая, но не ограничиваясь: отказ от показа рекламы, приобретение подсказок в игре и иные внутриигровые возможности. «Фишка» не является электронным средством платежа либо денежным средством, не подлежит обмену на денежные средства и не может быть использована за пределами Сайта Продавца. «Фишки» зачисляются на внутриигровой счёт Покупателя единовременно после поступления оплаты; дальнейшее их использование для получения внутриигровых благ осуществляется Покупателем самостоятельно в интерфейсе игры.
|
||||
|
||||
**4.4.** Стоимость Товаров:
|
||||
|
||||
<#pricing_template#>
|
||||
|
||||
## 5. Обмен и возврат Товара
|
||||
|
||||
**5.1.** Покупатель вправе осуществить возврат (обмен) Продавцу Товара, приобретенный дистанционным способом, за исключением перечня товаров, не подлежащих обмену и возврату согласно действующему законодательству Российской Федерации. Условия, сроки и порядок возврата Товара надлежащего и ненадлежащего качества установлены в соответствии с Гражданским кодексом РФ, Закона РФ от 07.02.1992 N 2300-1 «О защите прав потребителей», Правил, утвержденных Постановлением Правительства РФ от 31.12.2020 N 2463.
|
||||
@@ -120,7 +126,7 @@
|
||||
|
||||
**9.3.** Договор вступает в силу с момента Акцепта условий настоящей Оферты Покупателем и действует до полного исполнения Сторонами обязательств по Договору.
|
||||
|
||||
**9.4.** Изменения, внесенные Продавцом в Договор и опубликованные на сайте в форме актуализированной Оферты, считаются принятыми Покупателем в полном объеме.
|
||||
**9.4.** Изменения, внесенные Продавцом в Договор и опубликованные на сайте в форме актуализированной Оферты, считаются принятыми Покупателем в полном объеме при оплате Товаров.
|
||||
|
||||
## 10. Дополнительные условия
|
||||
|
||||
@@ -143,3 +149,5 @@
|
||||
## 11. Реквизиты Продавца
|
||||
|
||||
Денисов Илья Аркадьевич, ИНН 290210610742.
|
||||
|
||||
Обратная связь в Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot).
|
||||
|
||||
+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>
|
||||
|
||||
@@ -3,7 +3,6 @@ import { resolve } from 'node:path';
|
||||
import { defineConfig, type Plugin } from 'vite';
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
import { renderOfferHtml } from './src/lib/offer';
|
||||
|
||||
/**
|
||||
* injectBootVersion stamps the app version into index.html's boot-capability guard, replacing its
|
||||
@@ -39,22 +38,6 @@ function emitPolyfills(): Plugin {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* emitOffer renders the public offer markdown (legal/offer_ru.md) to a standalone
|
||||
* static page and emits it as dist/offer/index.html, which the landing container
|
||||
* serves at /offer/ (deploy/landing/Caddyfile). The markdown is the owner-editable
|
||||
* source of truth, so the page is regenerated from it on every build.
|
||||
*/
|
||||
function emitOffer(): Plugin {
|
||||
return {
|
||||
name: 'emit-offer',
|
||||
generateBundle() {
|
||||
const md = readFileSync(resolve(import.meta.dirname, 'legal/offer_ru.md'), 'utf8');
|
||||
this.emitFile({ type: 'asset', fileName: 'offer/index.html', source: renderOfferHtml(md) });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// The edge Connect service is scrabble.edge.v1.Gateway; the gateway serves it over
|
||||
// h2c on :8081 by default. In dev we proxy the RPC path so the browser (which can
|
||||
// not speak h2c directly) talks to the dev server on the same origin. In `mock`
|
||||
@@ -77,7 +60,6 @@ export default defineConfig(({ mode }) => ({
|
||||
plugins: [
|
||||
svelte(),
|
||||
emitPolyfills(),
|
||||
emitOffer(),
|
||||
injectBootVersion(),
|
||||
// App-shell precache for the offline mode: a custom (injectManifest) service worker precaches
|
||||
// index.html + the hashed assets so the installed web PWA cold-launches with no network. It
|
||||
|
||||
Reference in New Issue
Block a user