import { formatPrice, formatUsd } from "./config.js"; const esc = (s) => String(s).replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]); // Тексты лендинга по языкам. Русская версия — как в SP-1, без изменений. const TEXT = { ru: { title: "Универсальная финансовая модель в Excel", description: "Финансовая модель на 7 лет в Excel: формулы, пример и пустая версия, инструкция. Для любого предпринимателя.", lead: "Посчитайте запуск продукта или бизнеса на 7 лет вперёд: выручка, затраты, налоги, денежный поток, баланс и окупаемость в одном файле.", buy: "Купить", inside: "Что внутри", items: [ "Excel-файл на русском: 7 лет, первый год помесячно, остальные по годам.", "Выручка по трём линейкам, затраты, ФОТ, инвестиции, кредит, ОПиУ, денежный поток, упрощённый баланс.", "Окупаемость, NPV, IRR, точка безубыточности и три сценария: базовый, пессимистичный, оптимистичный.", "Две версии: с условным примером и пустая. Всё на формулах, без макросов и скрытых листов.", "Инструкция на 1 страницу и лицензия на личное или внутреннее использование.", ], forWhom: "Для кого", audience: [ "Предпринимателям, которые считают запуск нового продукта или бизнеса.", "Тем, кто готовит расчёты для банка, инвестора или партнёра.", "Тем, кому нужна понятная модель без привязки к стране, программе или отрасли: налоги и валюту вы вводите сами.", ], looks: "Как выглядит", shots: [ ["/img/dashboard.svg", "Дашборд: выручка по годам"], ["/img/pnl.svg", "Отчёт о прибылях и убытках"], ["/img/assumptions.svg", "Лист допущений с ячейками для ввода"], ], howTo: "Как купить", footer: "Модель — инструмент расчёта, а не финансовая, налоговая или юридическая консультация.", offer: "Публичная оферта", refund: "Политика возврата", }, en: { title: "Universal Financial Model in Excel", description: "A 7-year financial model in Excel: formulas, a sample and an empty version, and a guide. For any entrepreneur.", lead: "Plan a product or business launch seven years ahead: revenue, costs, taxes, cash flow, balance sheet and payback in a single file.", buy: "Buy", inside: "What’s inside", items: [ "An Excel file in English: 7 years, the first year by month, the rest by year.", "Revenue for three product lines, costs, payroll, investment, a loan, P&L, cash flow and a simplified balance sheet.", "Payback, NPV, IRR, break-even point and three scenarios: base, pessimistic and optimistic.", "Two versions: with sample data and empty. Everything runs on formulas, with no macros and no hidden sheets.", "A one-page guide and a licence for personal or internal use.", ], forWhom: "Who it’s for", audience: [ "Entrepreneurs planning a new product or business.", "Anyone preparing numbers for a bank, an investor or a partner.", "Anyone who wants a clear model that isn’t tied to a country, programme or industry: you enter taxes and currency yourself.", ], looks: "What it looks like", shots: [ ["/img/dashboard-en.svg", "Dashboard: revenue by year"], ["/img/pnl-en.svg", "Profit and loss statement"], ["/img/assumptions-en.svg", "Assumptions sheet with input cells"], ], howTo: "How to buy", footer: "The model is a calculation tool, not financial, tax or legal advice.", offer: "Public offer", refund: "Refund policy", }, }; export function renderLanding(config, locale = "ru") { const t = TEXT[locale]; const en = locale === "en"; const tg = `https://t.me/${encodeURIComponent(config.botUsername)}?start=${en ? "site_en" : "site"}`; // EN: покупка ведёт на международную оплату из SP-2; пока она не выбрана — «Coming soon», оплата не принимается. const payUrl = en ? config.intlPaymentUrl : ""; const buyHref = en && payUrl ? tg : en ? "" : tg; const buyBtn = buyHref ? `${t.buy}` : `Coming soon`; const price = en ? formatUsd(config.priceUsd) : formatPrice(config.priceKzt); const legal = config.legalApproved && !en ? `` : ""; const shots = t.shots .map(([src, alt]) => `
${esc(alt)}
${esc(alt)}
`) .join(""); const li = (a) => a.map((x) => `
  • ${x}
  • `).join("\n"); const steps = en ? [ "Press “Buy” — the Telegram bot opens.", `Pay ${price} using the international payment link in the bot and press “I’ve paid”.`, "After the payment is checked, the bot sends you the English files.", ] : [ "Нажмите «Купить» — откроется Telegram-бот.", `Переведите ${price} через Kaspi по реквизитам в боте и нажмите «Я оплатил(а)».`, "После проверки платежа (в рабочее время до 15 минут) бот пришлёт файлы.", ]; const howTo = en && !payUrl ? `

    International payment is not open yet. The English version will be on sale soon.

    ` : `
      \n${li(steps)}\n
    `; const switcher = ``; return ` ${t.title}
    ${switcher}

    ${t.title}

    ${t.lead}

    ${price}

    ${buyBtn}

    ${t.inside}

    ${t.forWhom}

    ${t.looks}

    ${shots}

    ${t.howTo}

    ${howTo} ${buyBtn} ${legal}
    `; }