npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@orbit-software/sdk

v1.98.1

Published

Browser SDK for Orbit/Portal games running in Telegram Mini Apps and regular browsers. It provides authentication-aware API access, profile and balance data, game storage, ads, shop/payments, wages, and the Portal overlay.

Readme

@orbit-software/sdk

Browser SDK for Orbit/Portal games running in Telegram Mini Apps and regular browsers. It provides authentication-aware API access, profile and balance data, game storage, ads, shop/payments, wages, and the Portal overlay.

Use

import PortalSDK from '@orbit-software/sdk';

await PortalSDK.initialize('BOT_ID', {
  disable_startup_ads: false,
});

PortalSDK.initializeOverlay({
  variant: 'translucent',
  visible: true,
});
PortalSDK.gameReady();

const profile = await PortalSDK.getProfile();
const completed = await PortalSDK.requestRewardAd({
  placementId: 'level-complete',
});

The SDK also exposes the same object as window.PortalSDK and window.CryptoSteamSDK in the UMD build. A browser launch without a Portal session runs in guest mode; call PortalSDK.requestLogin() when sign-in is needed.

Authentication and storage

PortalSDK.getAuthState() returns one of:

  • telegram — Telegram initData is used automatically.
  • web — a Portal launch code is exchanged for SDK-scoped tokens.
  • guest — no account is available; profile, shop, and purchase calls are unavailable.

Guest game progress is kept locally and can be migrated to the account after a Portal login. Use getValue, setValue, removeValue, and getAllKeyValues for game saves. telegramCloudStorage is intended for Telegram-only storage.

Ads

Ads are delivered by the external Orbit ad SDK. Use requestAd() for interstitials and requestRewardAd() for reward flows; both return Promise<boolean>. Startup ads are enabled by default and can be disabled with disable_startup_ads: true in initialize().

When a game runs in an iframe, each ad request sends { type: 'orbit-sdk:ad-start' } to its immediate parent, then { type: 'orbit-sdk:ad-end', result: boolean } when the request finishes. These events bracket the request, including requests that skip showing an ad. The launcher should check both event.source === gameIframe.contentWindow and event.origin against the expected game origin before changing its UI. Hiding the game iframe itself can also hide an ad rendered inside that iframe.

The old direct ad-network controllers are no longer owned by this SDK. isAdEnabled() and getAdsgramController() remain only for backwards compatibility.

Development

pnpm install
pnpm dev              # ESM development build
pnpm dev:confirm      # payment-confirmation app
pnpm test
pnpm typecheck
pnpm lint
pnpm format:fix
pnpm build

pnpm build generates:

  • dist/esm — ES module and TypeScript declarations;
  • dist/umd — UMD build;
  • dist/umd_react — UMD build with the React runtime;
  • dist_confirm — single-file payment-confirmation app;
  • dist/assets — copied runtime assets.

The source entry point is src/sdk.ts. The public API types are in src/types/sdk.ts.

Build-time configuration

Environment variables are injected during the build, not read from the consumer at runtime:

| Variable | Purpose | Default | | --- | --- | --- | | BASE_URL | SDK API base URL | https://app.portalgames.com/sdk | | ADS_SCRIPT_URL | Orbit ad SDK script URL | none; required for ads | | ASSETS_BASE_URL | Base URL for SDK assets | configure for deployed assets | | IDENTITY_URL | Web-auth identity service | https://id.portalgames.com | | PORTAL_URL | Portal and default login URL | https://portalgames.com | | PORT | Local Vite server port | 3000 |

CI deploys production builds from pushed version tags. Manual deployment targets production only. Do not edit dist; it is generated output.

Launcher-selected dev environment

The production browser bundle can use the dev backend when the game is opened from the dev launcher. Browser launches carry __portal_env=dev in the game URL. Web tutorial launches carry __portal_source=tutorial in both environments for the tutorial ad placement and SDK game analytics. Telegram launches carry a base64url-encoded startapp value: a plain source such as tutorial becomes ?__portal_env=dev&__portal_source=tutorial, while a /games/{id} start path gains the marker and keeps its route and attribution parameters. The SDK reads the marker from tgWebAppStartParam or Telegram init data before authentication, analytics, or API requests and selects the dev Portal, identity, and SDK API URLs together. The Orbit ads script and SDK static assets keep the production bundle's configured URLs. Web auth tokens are stored separately for dev and prod.

The marker only selects a destination; the destination backend still authenticates every request. Dev launches do not emit to the production Google Analytics property; Sentry events carry the selected environment. The launcher-to-SDK format is documented in the workspace CONTRACTS.md.

Release the production SDK bundle before deploying the launcher change. Existing game pages load that production bundle; an older bundle ignores the marker and still calls production.