/** * Convert a price from USD to target currency. */ export declare function convertPrice(priceUsd: number, rate: number): number; /** * Format a price with currency symbol. * Examples: "1 234 ₽", "$12.34", "€12.34" */ export declare function formatPrice(amount: number, currency?: string): string; /** * Generate a unique idempotency key for checkout requests. */ export declare function generateIdempotencyKey(): string; import type { FeeMode } from "./types"; /** * Client-side PREVIEW of the surcharge fee for a payment method, BIT-EXACT * with the server (apps/api site-payment-fees.ts `computeFee` + * `resolveCheckoutCharge`). Lets a storefront render the "Комиссия платёжной * системы" line at method-selection time without a round-trip. * * Matches the server byte-for-byte: * fee = max(0, round2(goods * percent / 100 + fixed)) // computeFee * gross = round2(goods + fee) when surcharge, else goods // resolveCheckoutCharge * round2 = Math.round(x * 100) / 100 * * The order of operations is load-bearing: `(goods * percent) / 100 + fixed`, * THEN round2 — NOT `goods * (percent / 100)`. e.g. goods=23, percent=2.5: * `(23 * 2.5) / 100` = 0.575 (float 0.5749…) → round2 = 0.57, but the naive * `23 * (2.5 / 100)` = 0.5750000000000001 → round2 = 0.58 — a kopeck off, and * the previewed button would disagree with the actual charge. * * `applies` is true ONLY for `feeMode === "surcharge"`; absorb/included/ * undefined ⇒ `applies:false, fee:0, gross:goods` (matches the server default * `feeMode ?? "included"`). Source of truth stays the checkout response * `payment.fee` — this is preview-only. NEVER use it for topup (always net). */ export declare function estimateSurcharge(input: { goods: number; feePercent?: number; feeFixed?: number; feeMode?: FeeMode; }): { applies: boolean; fee: number; gross: number; }; /** * Clamp a persisted marketing-visit id to a positive integer, or undefined. * Storefronts keep mvFirst/mvLast in localStorage — a user can tamper with * them, and a garbage value must be DROPPED client-side rather than sent * (a non-numeric field would 422 the whole auth call / checkout). */ export declare function sanitizeMvId(value: unknown): number | undefined;