58 lines
5.2 KiB
Markdown
58 lines
5.2 KiB
Markdown
---
|
|
name: eitaa-mini-app
|
|
description: Build, integrate, review, debug, or release secure Eitaa apps and mini apps in any web stack. Use for the Eitaa WebApp SDK, EitaaYar registration and server APIs, initData authentication, native controls, themes, permissions, messages, sensors, testing, and deployment. Do not use for unrelated web apps or Telegram-only integrations.
|
|
---
|
|
|
|
# Eitaa apps and mini apps
|
|
|
|
Implement the requested Eitaa behavior in the project's existing stack. Preserve its architecture, dependency choices, design system, and deployment model unless the user asks to change them.
|
|
|
|
## Start with the repository
|
|
|
|
Inspect the relevant entry points, server boundary, configuration, tests, and any local Eitaa documentation before changing code. Determine whether the task is:
|
|
|
|
- a static/browser-only experience;
|
|
- a server-backed app that authenticates Eitaa users or calls EitaaYar;
|
|
- an integration into an existing React, Vue, Next.js, PHP, WordPress, Joomla, or other web application; or
|
|
- diagnosis, testing, registration, or release of an existing Eitaa app.
|
|
|
|
Do not introduce a wrapper package, backend, framework, or project scaffold when the existing stack can support the request directly. Treat third-party Eitaa packages and plugins as optional; verify their current interface before installing or relying on them.
|
|
|
|
## Route to the needed guidance
|
|
|
|
- Read [platform-and-release.md](references/platform-and-release.md) when planning architecture, distinguishing apps from mini apps, registering in EitaaYar, choosing a launch URL, or releasing.
|
|
- Read [sdk-reference.md](references/sdk-reference.md) before implementing or reviewing browser SDK calls, native UI, themes, events, sensors, QR, downloads, fullscreen, or compatibility guards.
|
|
- Read [security-and-server.md](references/security-and-server.md) before using identity, `initData`, contacts, sessions, EitaaYar verification, or message sending.
|
|
- Read [testing.md](references/testing.md) when adding tests, debugging WebViews, or preparing a release.
|
|
|
|
Read only the references needed for the current task.
|
|
|
|
## Implementation invariants
|
|
|
|
1. Load `https://developer.eitaa.com/eitaa-web-app.js` directly in `<head>` before application scripts. Do not download, vendor, proxy, or self-host it.
|
|
2. Access the bridge through `window.Eitaa?.WebApp`. In SSR frameworks, touch `window` only in client code after mount or through a guarded adapter.
|
|
3. Call `ready()` after essential UI is renderable. Use `expand()`, closing confirmation, fullscreen, orientation lock, vertical-swipe changes, and native buttons only when the product behavior calls for them.
|
|
4. Feature-detect every optional method or object and use `isVersionAtLeast()` when the documented minimum version is relevant. A missing bridge must produce a clear browser-preview or unsupported state, not fake native success.
|
|
5. Subscribe with stable handler references and unsubscribe with the same references. Stop sensors and remove listeners on unmount, page hide, or navigation as appropriate.
|
|
6. Build the layout from Eitaa theme and safe-area variables with readable fallbacks. React to `themeChanged`, safe-area, and viewport events when the UI depends on them.
|
|
7. Treat QR text, deep links, filenames, popup content, and all client input as untrusted. Validate schemes and render untrusted text as text, never executable HTML.
|
|
8. Keep app tokens and EitaaYar calls server-side. Send raw `initData` to the server and authenticate only after server validation; `initDataUnsafe` is display-only until matched to a verified identity.
|
|
9. Never accept a message recipient or authenticated user ID from an unverified client field. Derive it from the verified launch/session identity.
|
|
10. Do not log raw `initData`, hashes, signed contact payloads, tokens, phone numbers, or unnecessary user/device identifiers.
|
|
|
|
## Resolve documentation inconsistencies safely
|
|
|
|
Prefer the dedicated SDK and security rules over illustrative samples. In particular:
|
|
|
|
- The SDK must come from the official URL even if an older sample shows a local copy.
|
|
- Preserve the received `hash` if optional server authenticity verification will use it; some sample code deletes it too early.
|
|
- Compare signatures in constant time and enforce freshness; a plain string equality example is not production hardening.
|
|
- The documented fullscreen names and names observed in clients can differ in capitalization. Feature-detect both spellings as described in the SDK reference.
|
|
- Some documentation sections for cloud storage, biometrics, location, device/secure storage, stories, and emoji status are commented placeholders. Do not present them as supported merely because their names appear in source documentation.
|
|
|
|
If local project documentation is newer or the user asks for current platform behavior, verify the changing fact against current Eitaa documentation and state any uncertainty.
|
|
|
|
## Finish proportionally
|
|
|
|
Run the repository's existing checks plus focused tests for the changed bridge or server behavior. For production-facing work, distinguish browser simulation from real Eitaa verification and hand off the native Android/desktop checks that cannot be completed locally. Report any EitaaYar configuration, HTTPS URL, token, permission, or device action the user must supply without exposing secrets.
|