# Wonderland Engine

The Wonderland package (`packages/sdk-engines/wonderland`) is a TypeScript package for **Wonderland Engine 1.x** web projects. `ZokoSDK` is a promise-based wrapper over `window.ZokoGames.SDK` with names identical to the JavaScript SDK (`ZokoSDK.game.gameplayStart()`), and the **zoko-sdk** component initialises it, makes it reachable from every other component, pauses the scene and silences audio while an ad plays, follows the portal's mute setting, ends the portal's loading bar and answers the feedback form with a picture of the canvas. Terms such as "midgame" and "rewarded" are in the [glossary](https://docs.zokogames.com/getting-started/glossary).

> [!NOTE]
> Plugin 1.7.3. Type-checked in strict mode against `@wonderlandengine/api` 1.6.1 and unit-tested with a stub of the engine. Verified 2026-11-23 with Wonderland Editor 1.6.1: a project packaged by the editor runs the plugin in the real runtime and passes the production check on all 12 areas. Observed in the runtime: the SDK boots once, components of paused types are deactivated during an ad and restored after, an audio context the plugin tracks is suspended during ads and resumed after, and banner projection gives a sane rectangle. Still unverified: the engine's own built-in audio sources, XR sessions and a camera with a partial viewport. Send the editor version and the exact error to [support](https://docs.zokogames.com/business/support) if something fails. Release 1.7.3 only adds a script-load timeout and is covered by unit tests; it was re-run in the engine and on production on 2026-11-23 (12 areas).

## Install

Download the Wonderland package: [/sdk-engines/zokogames-wonderland-1.7.3.zip](https://www.zokogames.com/sdk-engines/zokogames-wonderland-1.7.3.zip) (the same files as the folder in the repository).

[/sdk-engines/wonderland.zip](https://www.zokogames.com/sdk-engines/wonderland.zip) is always the latest version. Checksums: [`/sdk-engines/SHA256SUMS`](https://www.zokogames.com/sdk-engines/SHA256SUMS). Index of every engine package with its version, size and SHA-256: [`/sdk-engines/engines.json`](https://www.zokogames.com/sdk-engines/engines.json).

1. Copy the package's `src/` folder into your project's `js/` folder as `js/zokogames/` (`ZokoSDK.ts`, `ZokoSdkComponent.ts`, `ZokoClient.ts`, `ZokoTypes.ts`, `ZokoSimulator.ts`, and the helpers `ZokoPause.ts`, `ZokoAdFlow.ts`, `ZokoProjection.ts`). The editor compiles `.ts` files under `js/`.
2. Make the editor see the component: editor 1.6.1 lists components only from files directly under `js/`, not from subfolders. Add `js/zoko-sdk-component.ts` containing `export { ZokoSdkComponent } from './zokogames/index';` (see `examples/zoko-sdk-component.ts`), add `engine.registerComponent(ZokoSdkComponent)` (from `./zokogames/index`) to `js/index.js`, then press **Rebuild**.
3. Add the **zoko-sdk** component to an object of your first scene.
4. Put one script tag for `https://sdk.zokogames.com/zokogames-sdk-v1.js` in the `<head>` of the page the editor generates (use your own HTML template for the packaged page), before the engine script. If the tag is missing, the wrapper injects the script on the first `ready()`, but the upload validator looks for the tag, so add it.

## Which path

| You are | Do this |
| --- | --- |
| A Wonderland developer with a web build | Copy the folder, add the component, wrap ad and save calls as below, package, upload. |
| Writing plain TypeScript tests | Use `ZokoClient.ts` (no engine imports) instead of `ZokoSDK.ts`, which imports `@wonderlandengine/api`. |

## A working component

One component covering init, a midgame ad, a rewarded ad, gameplay start and stop, save and load, and a leaderboard score. The scene and audio pause by themselves during `ZokoSDK.requestAd`; the component only has to freeze its own logic.

```ts
import { Component } from "@wonderlandengine/api";
import { ZokoSDK } from "./zokogames/index";

export class Boot extends Component {
  static TypeName = "boot";
  private live = false;

  async start() {
    try { await ZokoSDK.ready(); } catch (e) { console.warn("ZokoGames init failed", e); }
    this.live = ZokoSDK.isAvailable;                       // initialised and not "disabled"
    if (!this.live) return this.beginGame();               // the game must run without the portal
    const best = Number(ZokoSDK.data.getItem("best") ?? "0") || 0;   // load: synchronous
    this.beginGame(best);
  }

  update(dt: number) {
    if (ZokoSDK.paused) return;                            // an ad is playing
    // ... your game logic
  }

  async showAd(type: "midgame" | "rewarded"): Promise<boolean> {
    if (!this.live) return false;
    const { finished, error } = await ZokoSDK.requestAd(type);   // never rejects for ad problems
    if (error) console.log("no ad:", error.code);                // adCooldown, unfilled, adblock ...
    return finished;
  }

  async onRewardClicked() { if (await this.showAd("rewarded")) this.grantReward(); }   // reward only when finished
  async onRoundEnded(score: number) {
    this.onPlayStop();
    this.save(score);
    await this.submitScore(score);
    await this.showAd("midgame");                          // natural break
  }

  onPlayStart() { if (this.live) void ZokoSDK.game.gameplayStart().catch(() => {}); }
  onPlayStop()  { if (this.live) void ZokoSDK.game.gameplayStop().catch(() => {}); }

  save(score: number) {
    if (!this.live) return;
    try { ZokoSDK.data.setItem("best", String(score)); }     // synchronous; uploaded in the background
    catch (e) { console.warn((e as { code?: string }).code); } // dataLimitExceeded
  }

  async submitScore(score: number) {
    if (!this.live) return;
    try {
      const user = await ZokoSDK.user.getUser();
      if (!user) return;                                     // guests are not ranked
      // "" works only on a board WITHOUT an encryption key; see leaderboards for the encrypted form.
      await ZokoSDK.user.submitScore({ encryptedScore: "", score });
    } catch (e) { console.warn((e as { code?: string }).code); }
  }

  private beginGame(_best = 0) { this.onPlayStart(); }
  private grantReward() { /* ... */ }
}
```

On a web build the Wonderland TypeScript runs in the page, where the Web Crypto API exists, so a keyed leaderboard is practical here: use the `encryptScore` function from the [leaderboards page](https://docs.zokogames.com/sdk/leaderboards#client-submission), passing `user.__dangerousUserId` and your game id, and send its result as `encryptedScore`. Keep in mind that a key shipped in the browser can be read; for real stakes compute scores on your server.

## The zoko-sdk component

| Property | Default | Meaning |
| --- | --- | --- |
| `syncMute` | on | Follow the portal's `muteAudio` setting. |
| `pauseTypes` | `animation` | Comma separated component type names stopped while the scene is paused. `animation` components are paused and resumed; every other type (native such as `physx`, or one of your own TypeNames) is deactivated and reactivated. |
| `captureAudio` | on | Wrap `AudioContext` so every context created from then on is suspended with the scene. |
| `reportLoading` | on | Call `game.loadingStop()` when the engine's loading screen ends. |
| `screenshots` | on | Answer the portal's feedback form with a JPG of the canvas. |
| `simulator` | off | Use the built-in simulator when the SDK script cannot load (offline preview). |

Wonderland has no switch that pauses a whole scene, so pausing is explicit: `pauseTypes` names what stops, and your own components read `ZokoSDK.paused` (or listen to `ZokoSDK.events.pause` and `resume`). Audio is silenced for every Web Audio `AudioContext` the wrapper tracked (created after the component's `init()`; call `ZokoSDK.captureAudio()` earlier, or `ZokoSDK.audio.track(context)` for one you hold), for Howler, and for `<audio>` and `<video>` elements. `ZokoSDK.pauseScene(reason)` and `resumeScene(reason)` do the same for your own pauses (a pause menu); several holds are counted. Ads are refused during an XR session (end the session first), and the feedback screenshot is `null` in XR or in a hidden tab. `pauseTypes` deactivates only the listed types, and `physx` loses its velocities.

## State and simulator

<!-- search: headings-only -->

| Member | Meaning |
| --- | --- |
| `ZokoSDK.ready()` (or `init()`) | Once, first; safe to call twice. Rejects with `sdkNotLoaded` when the script cannot load, unless the simulator is on. |
| `ZokoSDK.isInitialized`, `isAvailable`, `isSimulated`, `isSupportedPlatform` | Initialised; initialised and not disabled; the simulator is answering; running in a browser. |
| `ZokoSDK.environment` | `"local"`, `"zokogames"` or `"disabled"`. |
| `ZokoSDK.isQaTool` | Running in the QA tool. |
| `ZokoSDK.paused` | The scene is paused by an ad or by `pauseScene()`. |
| `ZokoSDK.events` | Wonderland emitters: `ready`, `adStarted`, `adFinished`, `adError`, `settingsChange`, `offlineChange`, `roomLeft`, `pause`, `resume`. |

`ZokoSDK.configureSimulator(options)` tunes the simulator; call it before `ready()`. Options: `disabled`, `accountAvailable`, `loggedIn`, `username`, `userId`, `friendCount`, `adBehaviour` (`"fill"`, `"no_fill"` or `"error"`), `adDurationMs` (default 1500), `adblock`, `muteAudio`, `disableChat`, `kidsMode`, `instantMultiplayer`, `offline`, `storeAvailable`, `verbose`.

## Mapping

<!-- search: headings-only -->

Names are identical to JavaScript; calls return promises (the `data` calls are synchronous). Errors are plain `{ code, message }` objects.

| JavaScript | Wonderland (TypeScript) |
| --- | --- |
| `SDK.init()` | `await ZokoSDK.ready()` |
| `SDK.ad.hasAdblock()` | `await ZokoSDK.ad.hasAdblock()` |
| `SDK.ad.requestAd(type, cbs)` | `await ZokoSDK.requestAd(type, cbs?)` (pauses the scene and audio, resolves `{ finished, error? }`) or the raw `await ZokoSDK.ad.requestAd(type, { adStarted, adFinished, adError })` |
| `SDK.banner.requestBanner(...)` | `ZokoSDK.banner.requestBanner(...)` (needs a DOM container) or `ZokoSDK.requestBannerForObject(id, object, width, height, size?)` |
| `SDK.banner.requestResponsiveBanner(id)`, `clearBanner(id)`, `clearAllBanners()` | The same names on `ZokoSDK.banner` |
| `SDK.game.*`, `SDK.user.*`, `SDK.data.*`, `SDK.store.*`, `SDK.analytics.*` | The same names (`game.loadingProgress`, `game.isOffline` with `addOfflineListener` / `removeOfflineListener`, invite params, `store.getPurchaseToken` included); `game.gameId` is `ZokoSDK.gameId` |
| `SDK.achievements.*` | `ZokoSDK.achievements.list()`, `unlock(key)`, `onUnlock(cb)` (returns an unsubscribe function); see [achievements](https://docs.zokogames.com/sdk/achievements) |
| `ERROR_CODES` | `ZOKO_ERROR_CODES.store`, `.ad`, `.banner`, `.user`, `.data`, `.room`, `.general` |

**Kids mode.** `ZokoSDK.game.settings.kidsMode` is true when the game runs in kids mode (a game with the kids flag, or a player in kids mode); hide chat, rooms, sign-in prompts and shop screens then. A portal that does not send the field gives false, so also keep honouring `disableChat`, which the portal sets to true in the same cases. See [kids mode](https://docs.zokogames.com/guides/kids-mode).

## Room data channel

Added in SDK 1.3.0. The room data channel lets the players of one room exchange small JSON messages and share a tiny state that only the host writes, so a simple multiplayer game needs no server of its own. It is for game data, not text chat. It exists after `updateRoom` (or after joining from an invite) and ends with `leftRoom`, needs a signed-in player and a portal with realtime enabled (otherwise `roomUnavailable`), and has these limits: 8 KB per message or patch, 20 messages per second, 64 KB of state, state keys of 1 to 40 characters of `A-Z a-z 0-9 _ . : -`. Messages are never echoed back to their sender on the portal; the first player in the room is the host. The full rules and error codes (`notInRoom`, `notHost`, `payloadTooLarge`, `stateTooLarge`, `unknownMember`, `rateLimited`, `roomUnavailable`) are in the [game module](https://docs.zokogames.com/sdk/game#room-data-channel) and the [multiplayer guide](https://docs.zokogames.com/guides/multiplayer-invites#6-exchange-game-data-in-the-room).

`ZokoSDK.game.room` passes straight through to the JavaScript `SDK.game.room`. It is `undefined` when the portal's SDK is older than 1.3.0 and in the built-in simulator, which has no room channel, so check it before use and test rooms in a web build. The methods are `send(data, { to })`, `setState(patch)`, `getState()`, `members()`, `isHost()` and `selfId`, with `onMessage`, `onState`, `onMembers`, `onHostChange` and `onError` (each returns an unsubscribe function) or the `add...Listener` and `remove...Listener` pairs.

```ts
async startMatch() {
  await ZokoSDK.ready();
  await ZokoSDK.game.updateRoom({ roomId: "match-1", isJoinable: true });
  const room = ZokoSDK.game.room;
  if (!room) return;                                   // simulator or an older SDK
  room.onMessage((m) => {
    const move = m.data as { cell: number; mark: string };   // data is typed unknown
    this.placeMark(move.cell, move.mark);
  });
  room.onHostChange((_hostId, isHost) => { if (isHost) void room.setState({ turn: "X" }); });
  room.onError((e) => console.warn("room:", e.code));
}
```

## Banners

Banners are drawn in the page, not in the canvas. Put an object where the banner should sit and let the wrapper place a container over its projected box. The first active view is the camera and is assumed to fill the canvas. Request banners on menu scenes only.

```ts
await ZokoSDK.requestBannerForObject("menu-banner", this.object, 3, 0.75);           // 3 x 0.75 world units, largest size that fits
await ZokoSDK.requestBannerForObject("menu-banner", this.object, 3, 0.75, "300x250"); // a static size
await ZokoSDK.banner.clearBanner("menu-banner");
```

`ZokoSDK.rectOfObject(object, width, height)` returns the normalised rectangle for `ZokoSDK.banner.requestBannerForRect(id, rect, size?)`. A box behind the camera, or a scene without an active view, fails with `invalidArgument`.

## Purchases

```ts
if (ZokoSDK.store.isAvailable) {
  try {
    const items = await ZokoSDK.store.getCatalogItems({ limit: 20 });
    const { itemId } = await ZokoSDK.store.buyItem(items[0].sku);
    const token = await ZokoSDK.store.getPurchaseToken();      // send to your server and verify there
  } catch (e) {
    if ((e as { code?: string }).code === "purchaseCancelled") return;
  }
}
```

Verify ownership on your server ([in-game purchases](https://docs.zokogames.com/sdk/purchases)). `examples/ZokoStoreExample.ts` is a ready component, and `examples/ZokoProbe.ts` runs a smoke test of the wrapper and prints `[zoko-probe] <check> <result>` lines.

## Web export settings that matter

- **Package, then zip the contents of `deploy/`** so `index.html` is at the archive root. Every path must be relative.
- **No pre-compression.** Wonderland requests plain names for its `.bin` and `.wasm` files; the game origin serves a `.br` or `.gz` suffix with the matching `Content-Encoding`, but only for files that carry the suffix. The initial-download estimate uses uncompressed sizes. Limits: 1,500 files, 250 MB unpacked, about 50 MB initial download (20 MB for mobile).
- **Size.** Compress textures (Basis or KTX2) and meshes (Draco) in the editor, keep the first scene small and load later scenes with `engine.loadScene` after the first frame.
- **Audio unlock.** Browsers keep audio suspended until the first tap or click. Start music from a "tap to play" screen.
- **Fullscreen.** Prefer the fullscreen button in the portal's frame bar (it fullscreens the whole frame).
- **Loading.** The scene is already loaded when components start. To report loading while it downloads, call `await ZokoSDK.ready()` first, then `const loading = ZokoSDK.trackLoading()`, pass `loading.progress` to `engine.loadMainScene(file, loading.progress)` and call `await loading.done()`. Otherwise the `zoko-sdk` component ends the portal's loading bar when the engine's loading screen ends.

Upload: package, zip the build folder **contents**, upload it in the developer console, and run the [Preview tool](https://www.zokogames.com/preview) first.

After an ad, a sign-in or account-link prompt or a checkout, keyboard focus goes back to the game frame and its canvas by itself, so the player's keys work again without a click.

## Chat reports, screenshots and storage mirror

Since SDK 1.4.0: `ZokoSDK.game.reportChat(report)`, `ZokoSDK.game.onScreenshotRequest(handler)` and `ZokoSDK.data.mirrorLocalStorage({ prefix: "save_" })` (returns a stop function). `ready()` registers a default provider that reads the canvas in the microtask right after a frame was drawn (the component's `update()` marks the frame); turn it off with the component's `screenshots` property or `ZokoSDK.useDefaultScreenshots(false)` before `ready()`.

## Ad rules

There are no prerolls: your game cannot request an ad before it starts. Midgame is the only interstitial type, so an interstitial or commercial break from another platform becomes a midgame ad (`ZokoSDK.requestAd("midgame")`); the only other type is `rewarded`. In local mode (testing on `localhost`, outside the portal) a midgame request fails with `adError` with `adCooldown` until your game has called `ZokoSDK.game.gameplayStart()` or 30 seconds of visible page time have passed. On the portal the first midgame ad needs `ZokoSDK.game.gameplayStart()` first as well, so call it when the player takes control (a game that never calls it gets midgame ads 30 seconds after play begins). Rewarded ads are not held back by this. Details: [ads reference](https://docs.zokogames.com/sdk/ads#gameplay-first) and [ads guide](https://docs.zokogames.com/guides/ad-monetisation).

## Test locally

- **The editor preview and a build served from `localhost`** use the real JavaScript SDK's [local mode](https://docs.zokogames.com/getting-started/local-testing): a three-second ad overlay, fake players, `localStorage` saves, `?sdk_debug=true`, `?ad_response=unfilled`. On another host without the portal around it, the environment is `disabled`, so calls reject with `sdkDisabled`; add `?useLocalSdk=true` to test.
- **Offline.** With the component's `simulator` property on, a missing script gives `ZokoSDK.isSimulated` true and fake ads and a fake player. The simulator does not enforce the three-minute midgame cooldown (`adCooldown`), so test ad handling on `localhost` as well.
- **Then** open the [Preview tool](https://www.zokogames.com/preview) with your local address and watch the checklist tick.

## API

### `init`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `pauseTypes` | `animation` |
| `init` | `await ZokoSDK.ready()` (or `await ZokoSDK.init()`) |
| `environment` | `ZokoSDK.environment` |
| `isQaTool` | `ZokoSDK.isQaTool` |

### `ad.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `ad.requestAd` | `await ZokoSDK.requestAd(type)` (pauses) or `ZokoSDK.ad.requestAd(type, callbacks)` (raw) |
| `ad.requestAd.adStarted` | `callbacks.adStarted` of `ZokoSDK.requestAd(type, callbacks)` / `ZokoSDK.ad.requestAd(type, callbacks)`; `ZokoSDK.events.adStarted` |
| `ad.requestAd.adFinished` | `callbacks.adFinished`; `ZokoSDK.requestAd` resolves `{ finished: true }`; `ZokoSDK.events.adFinished` |
| `ad.requestAd.adError` | `callbacks.adError(error)`; `ZokoSDK.requestAd` resolves `{ finished: false, error }`; `ZokoSDK.events.adError` |
| `ad.hasAdblock` | `ZokoSDK.ad.hasAdblock`() |

### `banner.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `banner.requestBanner` | `ZokoSDK.banner.requestBanner({ id, width, height })` |
| `banner.requestResponsiveBanner` | `ZokoSDK.banner.requestResponsiveBanner`() |
| `banner.clearBanner` | `ZokoSDK.banner.clearBanner`() |
| `banner.clearAllBanners` | `ZokoSDK.banner.clearAllBanners`() |

### `game.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `game.settings` | `ZokoSDK.game.settings` |
| `game.addSettingsChangeListener` | `ZokoSDK.game.addSettingsChangeListener(fn)` / `ZokoSDK.events.settingsChange.add(fn)` |
| `game.removeSettingsChangeListener` | `ZokoSDK.game.removeSettingsChangeListener`() |
| `game.gameplayStart` | `ZokoSDK.game.gameplayStart`() |
| `game.gameplayStop` | `ZokoSDK.game.gameplayStop`() |
| `game.loadingStart` | `ZokoSDK.game.loadingStart()` |
| `game.loadingStop` | `ZokoSDK.game.loadingStop()` |
| `game.loadingProgress` | `ZokoSDK.game.loadingProgress(percentage)` |
| `game.happytime` | `ZokoSDK.game.happytime`() |
| `game.reportGameCompletedPercentage` | `ZokoSDK.game.reportGameCompletedPercentage`() |
| `game.reportChat` | `ZokoSDK.game.reportChat(report)` |
| `game.onScreenshotRequest` | `ZokoSDK.game.onScreenshotRequest(handler)` / `ZokoSDK.setDefaultScreenshotProvider()` |
| `game.setGameContext` | `ZokoSDK.game.setGameContext`() |
| `game.clearGameContext` | `ZokoSDK.game.clearGameContext`() |
| `game.isInstantMultiplayer` | `ZokoSDK.game.isInstantMultiplayer` |
| `game.isInstantJoin` | `ZokoSDK.game.isInstantJoin` |
| `game.isOffline` | `ZokoSDK.game.isOffline` |
| `game.gameId` | `ZokoSDK.gameId` |
| `game.addOfflineListener` | `ZokoSDK.game.addOfflineListener(fn)` / `ZokoSDK.events.offlineChange.add(fn)` |
| `game.removeOfflineListener` | `ZokoSDK.game.removeOfflineListener(fn)` |
| `game.updateRoom` | `ZokoSDK.game.updateRoom`() |
| `game.leftRoom` | `ZokoSDK.game.leftRoom`() |
| `game.addJoinRoomListener` | `ZokoSDK.game.addJoinRoomListener`() |
| `game.removeJoinRoomListener` | `ZokoSDK.game.removeJoinRoomListener`() |
| `game.inviteParams` | `ZokoSDK.game.inviteParams` |
| `game.inviteLink` | `ZokoSDK.game.inviteLink`() |
| `game.getInviteParam` | `ZokoSDK.game.getInviteParam`() |
| `game.showInviteButton` | `ZokoSDK.game.showInviteButton(params)` |
| `game.hideInviteButton` | `ZokoSDK.game.hideInviteButton()` |
| `game.room` | `ZokoSDK.game.room` |
| `game.room.send` | `ZokoSDK.game.room.send(data, { to })` |
| `game.room.onMessage` | `ZokoSDK.game.room.onMessage(cb)` |
| `game.room.addMessageListener` | `ZokoSDK.game.room.addMessageListener(cb)` |
| `game.room.removeMessageListener` | `ZokoSDK.game.room.removeMessageListener(cb)` |
| `game.room.setState` | `ZokoSDK.game.room.setState(patch)` |
| `game.room.getState` | `ZokoSDK.game.room.getState()` |
| `game.room.onState` | `ZokoSDK.game.room.onState(cb)` |
| `game.room.addStateListener` | `ZokoSDK.game.room.addStateListener(cb)` |
| `game.room.removeStateListener` | `ZokoSDK.game.room.removeStateListener(cb)` |
| `game.room.members` | `ZokoSDK.game.room.members()` |
| `game.room.onMembers` | `ZokoSDK.game.room.onMembers(cb)` |
| `game.room.addMembersListener` | `ZokoSDK.game.room.addMembersListener(cb)` |
| `game.room.removeMembersListener` | `ZokoSDK.game.room.removeMembersListener(cb)` |
| `game.room.isHost` | `ZokoSDK.game.room.isHost()` |
| `game.room.onHostChange` | `ZokoSDK.game.room.onHostChange(cb)` |
| `game.room.addHostChangeListener` | `ZokoSDK.game.room.addHostChangeListener(cb)` |
| `game.room.removeHostChangeListener` | `ZokoSDK.game.room.removeHostChangeListener(cb)` |
| `game.room.selfId` | `ZokoSDK.game.room.selfId` |
| `game.room.onError` | `ZokoSDK.game.room.onError(cb)` |
| `game.room.addLeftListener` | `ZokoSDK.game.room.addLeftListener(cb)` / `ZokoSDK.events.roomLeft.add(cb)` |
| `game.room.removeLeftListener` | `ZokoSDK.game.room.removeLeftListener(cb)` |
| `game.room.addErrorListener` | `ZokoSDK.game.room.addErrorListener(cb)` |
| `game.room.removeErrorListener` | `ZokoSDK.game.room.removeErrorListener(cb)` |

### `user.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `user.isUserAccountAvailable` | `ZokoSDK.user.isUserAccountAvailable` |
| `user.systemInfo` | `ZokoSDK.user.systemInfo` |
| `user.getUser` | `ZokoSDK.user.getUser`() |
| `user.listFriends` | `ZokoSDK.user.listFriends`() |
| `user.getUserToken` | `ZokoSDK.user.getUserToken`() |
| `user.showAuthPrompt` | `ZokoSDK.user.showAuthPrompt`() |
| `user.addAuthListener` | `ZokoSDK.user.addAuthListener`() |
| `user.removeAuthListener` | `ZokoSDK.user.removeAuthListener`() |
| `user.showAccountLinkPrompt` | `ZokoSDK.user.showAccountLinkPrompt`() |
| `user.submitScore` | `ZokoSDK.user.submitScore`() |
| `user.getXsollaUserToken` | `ZokoSDK.user.getXsollaUserToken()` |

### `data.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `data.getItem` | `ZokoSDK.data.getItem(key)` |
| `data.setItem` | `ZokoSDK.data.setItem(key, value)` |
| `data.removeItem` | `ZokoSDK.data.removeItem`() |
| `data.clear` | `ZokoSDK.data.clear`() |
| `data.mirrorLocalStorage` | `ZokoSDK.data.mirrorLocalStorage(options)` |

### `store.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `store.isAvailable` | `ZokoSDK.store.isAvailable` |
| `store.getCatalogItems` | `ZokoSDK.store.getCatalogItems({ limit, offset })` |
| `store.getPlayerInventory` | `ZokoSDK.store.getPlayerInventory({ limit, offset })` |
| `store.buyItem` | `ZokoSDK.store.buyItem(itemId)` |
| `store.consumeItem` | `ZokoSDK.store.consumeItem`() |
| `store.getPurchaseToken` | `ZokoSDK.store.getPurchaseToken()` |
| `store.setSandbox` | `ZokoSDK.store.setSandbox`() |

### `achievements.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `achievements.list` | `ZokoSDK.achievements.list()` |
| `achievements.unlock` | `ZokoSDK.achievements.unlock(key)` |
| `achievements.onUnlock` | `ZokoSDK.achievements.onUnlock(fn)` |

### `analytics.*`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `analytics.track` | `ZokoSDK.analytics.track(name, params)` |
| `analytics.trackOrder` | `ZokoSDK.analytics.trackOrder`() |

### `constants`

<!-- search: headings-only -->

| JavaScript | Wonderland |
| --- | --- |
| `ERROR_CODES` | `ZOKO_ERROR_CODES.<module>` |
| `SDK_VERSION` | `ZokoSDK.version` |

## Known pitfalls

<!-- search: headings-only -->

- **`sdkNotLoaded`.** The SDK script did not load (offline, blocked, or the script tag is missing).
- **`sdkNotInitialized`.** `await ZokoSDK.ready()` first.
- **Sound keeps playing during an ad.** The audio is not on a Web Audio context created after the component's `init()`; call `ZokoSDK.captureAudio()` earlier or `ZokoSDK.audio.track(context)`.
- **A component keeps running during an ad.** Add its TypeName to `pauseTypes`, or return early from `update()` while `ZokoSDK.paused`.
- **Banner in the wrong place.** The box is projected with the first active view, which must fill the canvas; otherwise compute a rectangle yourself and use `requestBannerForRect`.
- **Black screenshot in the feedback form.** Report it with the editor version: the canvas is read right after the frame, which depends on the canvas keeping its picture until then.

## Next

- Check your build against the [build validation rules](https://docs.zokogames.com/requirements/build-validation) and the [launch checklist](https://docs.zokogames.com/requirements/checklist).
- Upload and publish: [submission walkthrough](https://docs.zokogames.com/getting-started/submission-walkthrough).
- Other engines and shared rules: [engines overview](https://docs.zokogames.com/engines/overview).
