feat(android): resolve gateway origin on native, skip SW, hide MVP purchases

Make the web SPA behave correctly inside the Capacitor native shell, where the
bundle loads from a local origin:

- New lib/origin.ts gatewayOrigin(): absolute URLs resolve to VITE_GATEWAY_URL on
  native (the finished-game export/share URL in Game.svelte and the Wallet
  site-root link), falling back to the page origin on web. transport.ts already
  resolved via VITE_GATEWAY_URL and is left as-is.
- Skip the PWA service worker on the native channel (the assets are already local;
  a worker would risk serving stale content across store updates).
- Hide the money-purchase UI in the MVP: new distribution.purchasesHidden() folds
  VITE_PAYMENTS_DISABLED and the Google Play flag. The Wallet "buy" tab shows a
  neutral, pointer-free note (wallet.purchasesSoon) for the RuStore MVP and keeps
  the RuStore stub Google-Play-only. A ?nopay mock force mirrors ?gp for the e2e.
- Native env types in vite-env.d.ts.

Client-only, contour-safe: no wire/proto/schema change; web/VK/Telegram unchanged.
Tests: origin + purchasesHidden unit tests, a ?nopay wallet e2e. svelte-check
clean, vitest green, web + native vite build clean.
This commit is contained in:
Ilia Denisov
2026-07-12 14:58:35 +02:00
parent aaf2825260
commit de003e862a
13 changed files with 163 additions and 20 deletions
+8 -1
View File
@@ -2,8 +2,15 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
/** Base URL of the gateway Connect endpoint. Empty in dev (same-origin proxy). */
/** Base URL of the gateway Connect endpoint. Empty in dev (same-origin proxy); set to the real
* gateway origin in a packaged native build. */
readonly VITE_GATEWAY_URL?: string;
/** "1" hides the in-app-currency purchase actions in the thin native MVP that defers store billing. */
readonly VITE_PAYMENTS_DISABLED?: string;
/** Store listing URL the native update overlay opens for its "update" action (e.g. the RuStore page). */
readonly VITE_STORE_URL?: string;
/** Bundled-dictionary version the native offline path requests; matches the packaged DAWG files. */
readonly VITE_DICT_VERSION?: string;
}
interface ImportMeta {