For the complete documentation index, see llms.txt. This page is also available as Markdown.

Migration v1 → v2

What changed in the public API when moving from Bridge v1 to v2, module by module

Bridge v2 is a TypeScript rewrite. The entry point is the same (window.bridge, await bridge.initialize(options)). Below is only what changed in the public API, one section per affected module. Modules not listed here are unchanged.

Game (removed)

The bridge.game module is gone, its members were redistributed:

v1
v2

game.setLoadingProgress(percent)

bridge.setGameLoadingProgress(percent)

game.visibilityState

platform.isPaused, platform.isAudioEnabled

VISIBILITY_STATE_CHANGED event

PAUSE_STATE_CHANGED, AUDIO_STATE_CHANGED on bridge.platform

// v1
bridge.game.setLoadingProgress(100)
bridge.game.on(bridge.EVENT_NAME.VISIBILITY_STATE_CHANGED, (state) => {})

// v2
bridge.setGameLoadingProgress(100)
bridge.platform.on(bridge.EVENT_NAME.PAUSE_STATE_CHANGED, (isPaused) => {})
bridge.platform.on(bridge.EVENT_NAME.AUDIO_STATE_CHANGED, (isEnabled) => {})

Platform

  • Removed getAllGames(), getGameById(options), isGetAllGamesSupported, isGetGameByIdSupported — the platform games catalog is now served by the new Cross-Promo module.

  • Added the isExternalCallsSupported getter.

  • Added the isExternalLinksAllowed getter — moved here from the Social module.

Player

  • Added the isGuest getter — true when the player is unauthorized or running as a guest.

Storage (breaking)

The storage-type concept is removed; v2 chooses cloud vs local storage automatically.

v1
v2

get(key, storageType, tryParseJson)

get(key, tryParseJson = true)

set(key, value, storageType)

set(key, value)

delete(key, storageType)

delete(key)

isSupported(), isAvailable(), defaultType, bridge.STORAGE_TYPE

removed

Leaderboards

  • Removed the bridge.leaderboard (singular) alias — use bridge.leaderboards.

Achievements (breaking)

v1
v2

unlock(options)

unlock(id) — a flat game-level id; per-platform ids live in the config file

getList(options)

getAchievements() — no arguments; resolves to { id, name?, description?, unlocked }[]

showNativePopup(), isSupported, isGetListSupported, isNativePopupSupported

removed

Achievements now work on every platform, so there is no support flag to check. Where the platform supports them natively the call is forwarded to the platform SDK; everywhere else the SDK tracks them locally and persists the unlocked state through storage (cloud when available, otherwise local) — the same approach as Daily Rewards. In the local case getAchievements() returns the achievements declared in the config with their locally tracked unlocked flag, or an empty array when none are configured.

See the Achievements page for configuration details.

Remote Config (breaking)

  • get(options)get() — no arguments.

  • Added setContext(parameters) to pass segmentation parameters ahead of time.

Cross-Promo (new)

Cross-promotion module: a "more games" modal and a normalized games-list API. Replaces the removed platform games catalog (getAllGames() / getGameById()).

See the Cross-Promo page for details and configuration.

Social (breaking)

  • The isExternalLinksAllowed getter moved to bridge.platform.

  • Options are no longer keyed by platform. v1 took a nested object and recursed into options[bridge.platform.id]; v2 takes a flat object of canonical, platform-agnostic fields — text, image, url — that each bridge maps to its native one (VK urllink, Discord imagemediaUrl, and so on). image accepts a base64 data-URI or a URL; the bridge converts as needed. Any other key is forwarded verbatim to the platform SDK, so raw platform-specific fields still work.

  • Per-platform content can now live in the config file: shared values go in the top-level social[method] block, platform overrides in platforms[id].social[method]; the loader deep-merges them, and call-time options win on top.

See the Social page for details and configuration.

Tasks (new)

Task / quest module. The game declares task groups (daily, weekly, or permanent) in the config, reports gameplay through addProgress(), and claims rewards once a task is complete. Progress is persisted through storage and roll-over uses platform server time.

See the Tasks page for the data model and configuration.

Daily Rewards (new)

Login-streak rewards persisted through storage and platform server time.

See the Daily Rewards page for details and configuration.

Constants

Constant
Change

PLATFORM_ID

removed ABSOLUTE_GAMES, BITQUEST

MODULE_NAME

removed GAME, RECORDER; added DAILY_REWARDS, TASKS, CROSS_PROMO

EVENT_NAME

removed VISIBILITY_STATE_CHANGED; added PLATFORM_STORAGE_AVAILABILITY_CHANGED

STORAGE_TYPE

removed entirely

VISIBILITY_STATE

no longer exposed on bridge

ERROR

ERROR.X.message still works; v2 adds ERROR_CODE, a BridgeError class, and a code on each entry. New codes: INITIALIZATION_FAILED, CONFIG_LOAD_FAILED, CONFIG_PARSE_FAILED, STORAGE_QUOTA_EXCEEDED

Last updated