# Customer interface — native-flow Implemented the bounded customer interface against the supplied native peer contracts. Offline behavior is checked. **The complete production payment-to-report workflow is not certified complete:** peer modules are absent from this wave checkout, and no live payment, signing, deployment, or hosting change was performed. ## Changed files - `web/src/main.tsx`: all new purchase entry points mount only `NativeCheckout` from `checkout.tsx`, with `onClose` and `onSubmitted(txHash: string)`. Submission closes checkout and immediately sets `#/tx/`. Routes include transaction tracking and `#/job/?tx=`. Native CTAs use `NATIVE_RESEARCH_OPEN`. Tracking pages suppress the purchase dock. Home steps and footer use the native flow and current checkout quote. - `web/src/pages.tsx`: dashboard includes native order recovery links alongside historical orders/escrow controls. Known native transaction records are excluded from the duplicate historical dashboard list and its historical delivery notifications. Archive links for locally known native orders point to native tracking; historical report links retain their previous format. How, tutorial, and follow-up copy describe the existing Intake and current quote. - `web/src/games.tsx`: selection, saved games, sports, deadlines, and questions remain; selection CTAs use native policy and the checkout quote notice, without tier prices. - `web/src/tiers.tsx`: `TierTable` is now the current native quote notice. Historical `priceOf`, `priceText`, and `PayTerms` are retained for escrow receipt/recovery callers. - `web/src/native/view.tsx`: route parser, transaction recovery form, native dashboard list, sequential polling controller, and report/status UI. Uses `readNative`, `nativeOrdersOf`, `saveNativeJob`, and `fetchNativeReport`; implements no payment or backend signing operation. - `web/src/i18n-ui/native.ts` and `web/src/i18n-ui/index.ts`: 35 native strings defined once and translated into French, Spanish, Portuguese, Italian, Russian, Japanese, Chinese, Thai, and Nigerian Pidgin. English/en-NG retain source text. Existing catalogues stay intact. - `web/tests/native-ui.test.mjs`: 28 offline tests using Node test, existing esbuild/TypeScript/React dependencies, actual source callbacks, and the existing `ReportView`. - `web/tests/fixtures/native-ui/{client.ts,orders.ts,policy.ts,report.ts,checkout.tsx}`: explicit offline peer-interface fixtures. These are never imported by production source. Test-only IDs and responses never reach an RPC. No package, lockfile, build configuration, contract, worker, or other worker's source file was modified. No submodule was introduced. This result file is left untracked for separate upload. ## Behavior and confirmation gates `SELECT GAMES → PAY IN IMD → SWARM RESEARCH → RECEIVE REPORT`. After admission, the controller persists `saveNativeJob(txHash, requestId, jobId)` and the view navigates to the job URL retaining its transaction. Persistence failures do not remove the recovery URL or prevent reading the confirmed report. Dashboard records are recovery links, never payment/completion evidence. A connected customer is identified only when the confirmed payer matches their connected account; other payers retain a neutral payer label. Stored orders are also filtered by payer. Polling is sequential, nominally 30 seconds with +/-15% jitter, exponential transport-error backoff, and Retry-After as a minimum delay. Manual retry cancels/queues behind an in-flight operation without overlap. Hidden tabs abort/pause; becoming visible resumes. Unmount and account/route changes abort and fence stale responses, including readers that resolve after abort. Success, failed, refused, blocked, and mismatch states stop automatic polling; manual confirmation retry remains available. Pending/indexing lag offers recovery and expressly discourages another payment. Only `paid === true` with the matching transaction and route job permits the native paid badge. A UUID alone renders transaction recovery. A different confirmed UUID renders mismatch; absent admission remains unconfirmed on a UUID route. Report loading requires paid verification, request ID, job ID, body, completion, and a finite positive actual delivery timestamp. After downloading, the controller reads confirmation again and compares the transaction, payer, phase, request, job, body, hash, URI, and timestamp before accepting the result. `Report ready` requires `complete === true` and matching current confirmation; failed reads and stale/changed completions cannot publish success. Verified partial research remains readable with issues and retry. Unverified prose/JSON is excluded from native report rendering. The existing `ReportView` receives body-derived events, report language, the confirmed hash/URI, and `completion.deliveredAtMs`; its prediction/probability/research/citation rendering is reused. Historical report parsing and refund controls remain available. ## Exported signatures New exports from `native/view.tsx`: ```ts type NativeRoute = | { kind: 'tx'; txHash: string } | { kind: 'job'; jobId: string; txHash?: string } | { kind: 'invalid' }; type NativeViewState = { confirmation?: Awaited>; report?: Awaited>; loading: boolean; ready: boolean; error?: string; mismatch?: boolean; }; parseNativeRoute(hash: string): NativeRoute | null; nativeJobHash(jobId: string, txHash: string): string; payerMatches(payer?: string, account?: string | null): boolean; nativeRetryDelay(attempt: number, retryAfterMs?: number, random?: number): number; trackNative(options: TrackerOptions): { retry(): void; setVisible(value: boolean): void; stop(): void; }; NativeResearch({ route }: { route: NativeRoute }): JSX.Element; NativeStatus(props: { state: NativeViewState; txHash: string; jobId?: string; payer?: string | null; onRetry?: () => void; }): JSX.Element; NativeRecovery({ jobId }: { jobId?: string }): JSX.Element; NativeOrders({ payer }: { payer: string }): JSX.Element; ``` `TrackerOptions` requires `txHash` and `onChange(state)`; accepts `jobId`, `onAdmission(jobId)`, injected `read`/`fetchReport`/`saveJob` functions with the advertised peer signatures, `schedule`/`cancel`, `random(): number`, and initial `visible`. `pages.tsx` extends the existing `shareHash` input compatibly to `{requestId: string, block: bigint, tx?: string, payer?: string}`; it still returns a hash route. Existing `TierTable({n, compact?})`, `priceOf(n)`, `priceText(n)`, and `PayTerms({n, due})` signatures remain. The new catalogue exports `NATIVE_KEYS`, `NATIVE_ROWS`, and `NATIVE_DICTS`. ## Checks Commands run from `web/` unless stated otherwise. Temporary output/cache is inside checkout `test/scratch/` and is not delivered. - `npm ci --cache ../test/scratch/npm-cache`: exit 0, installed existing dependencies without changing package files. npm reported its existing two dependency audit findings; no dependency upgrade was attempted. - `TMPDIR="$PWD/../test/scratch" node scripts/i18n-check.mjs`: exit 0, **630 translatable strings, nine non-English languages, all entries/placeholders pass**. The extra native test checks the nested `native/view.tsx` literals too, since the existing script scans root source files only. - `TMPDIR="$PWD/../test/scratch" node --test tests/native-ui.test.mjs`: exit 0, **28 passed, zero failed**. Covers routing, actual checkout submission/close callbacks and native-only mount selection, pending/indexing, payment and completion gates, admission mapping, reload, mismatch, final reconfirmation races, terminal/retry behavior, jitter/backoff/Retry-After, overlap, visibility, unmount/account cancellation, verified partials, rejection of unverified content, connected payer ownership, citations/probability rendering, native archive links, and all language rows. - That command also creates a disposable source copy under `test/scratch/` and runs `node web/node_modules/typescript/bin/tsc --noEmit -p `: exit 0. Missing peers are supplied only in that scratch copy from the advertised interface fixtures. Actual merged peer files, when present, take precedence in this typecheck. This is interface/type checking, not proof of merged production integration. - `TMPDIR="$PWD/../test/scratch" node --test tests/*.test.mjs`: exit 1, **70 passed, two failed** (72 total). The checkout lacks the peer native policy; the two affected legacy test files are recorded below. - In `test/scratch/native-legacy-probe`, with current source copied unchanged and only the missing policy supplied from the offline fixture: `TMPDIR="$PWD/.." node --test tests/revision.test.mjs tests/revision-v11.test.mjs`: exit 0, **12 passed, zero failed**. This exercises preserved historical body parsing, manifest/report recovery, missing-file retry, late refund pricing, schedule rechecks, and language defaults. - `git diff --check` from root: exit 0. The initial new-test harness had a React SSR resolution error and an incomplete document stub; both were repaired before the successful runs. An initial i18n invocation could not create its default `/tmp` directory; setting TMPDIR to checkout scratch resolved it. ### Real checkout build / merge dependencies `npm run typecheck` and `npm run build` exit 2 in the unmerged checkout. Build stops at TypeScript; Vite does not run. The final build diagnostics were: ```text src/games.tsx(8,38): TS2307 missing ./native/policy src/main.tsx(7,10): TS2305 checkout has no NativeCheckout export src/main.tsx(8,38): TS2307 missing ./native/policy src/native/view.tsx(2,28): TS2307 missing ./client src/native/view.tsx(3,47): TS2307 missing ./orders src/native/view.tsx(4,20): TS2305 swarm has no fetchNativeReport export src/native/view.tsx(191,76), (191,83): TS7006 issue/i implicit any src/native/view.tsx(215,45), (215,86): TS7006 o implicit any src/pages.tsx(24,38): TS2307 missing ./native/policy src/pages.tsx(26,32): TS2307 missing ./native/orders src/pages.tsx(51,58), (905,78), (905,121): TS7006 o implicit any ``` The implicit-any diagnostics derive from those unresolved peer exports; the scratch typecheck with their advertised types passes. The broad test failures are `tests/revision-v11.test.mjs:1:1` (bundle setup) and `tests/revision.test.mjs:74:1` (V9.2 purchased-body test), both reporting `src/games.tsx:8:37: Could not resolve "./native/policy"`. Their 12 individual tests pass in the isolated policy-fixture probe. ## Protocol, coordination, and external requirements Inspected the imported production trunk before edits (`bea3299`), its existing direct `Intake.request` code, report readers, historical escrow recovery, and backend signing code. The linked production GitHub repository was readable. Both explorer job URLs returned inaccessible/internal-error responses, so live job coordination/status could not be read. No attempt was made to duplicate the peer-owned checkout, admission client, order store, native policy, or report verifier. Existing `config.ts` documents the Intake forwarding its quoted payment and emitting `Requested`; the customer's existing wallet signs its approval/request. IMD's own writer confirms completion. Native tracking/report retrieval is read-only and adds **no VERIFIER_PRIVATE_KEY requirement**. The existing historical worker's verifier key serves historical escrow verification/settlement operations (`web/worker/src/chain.ts`, `keeper.ts`); that separate recovery behavior was not removed or changed. No key, secret, arbitrary recipient, or invented production configuration was added. Deferred until merge: real `NativeCheckout` export, `native/policy.ts`, `native/client.ts`, `native/orders.ts`, and `swarm.ts`'s `fetchNativeReport` implementation. Rerun the real build and complete test suite after those land. The served site needs its peer native status/admission endpoint reachable with appropriate existing IMD authorization and browser CORS, plus public RPC/report gateway access. Owner activation/hosting choices belong to the existing integration and policy; this item does not configure or deploy them. An authorized end-to-end payment, IMD admission, report delivery, reconnect/reload, and failure-path check remains required before declaring the overall production goal complete.