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

@verse8/ads-parent

v0.2.0

Published

Verse8 web shell parent module — relays ad requests between game iframe and SSV verifier

Downloads

336

Readme

@verse8/ads-parent

Verse8 web shell parent module. Runs inside https://verse8.io and brokers the postMessage relationship between the Verse8 game iframe and the SSV verifier worker.

Architecture overview: see ../ads/ARCHITECTURE.md for how this package fits with the unified SDK (which absorbed the old @verse8/ads-h5-renderer package in v0.3.0), mobile parent, and verifier worker.

What it does

  1. Receives VERSE8_ADS_PING / VERSE8_ADS_SHOW_* / VERSE8_ADS_RENDER_RESULT from the game iframe.
  2. Replies with VERSE8_ADS_PONG within 500 ms. When adSenseClientId is configured, includes it in the PONG payload so the SDK's built-in H5 listener (since @verse8/[email protected]) installs itself.
  3. Dispatches VERSE8_ADS_RENDER_H5_REWARDED / VERSE8_ADS_RENDER_H5_INTERSTITIAL to the SDK's in-iframe H5 listener.
  4. For rewarded ads: when the renderer reports viewed, polls GET {verifierBaseUrl}/ads/status?requestId=… until SSV is verified, then forwards VERSE8_ADS_RESULT { status:'rewarded', reward } to the SDK.
  5. For interstitial ads: forwards VERSE8_ADS_RESULT immediately based on the renderer outcome (no SSV polling).
  6. On mobile bridges (e.g. window.FlutterVerse8Ads injected by the Flutter app), the parent is a no-op — the native bridge owns the lifecycle.

Quick start

import { startVerse8AdsParent } from "@verse8/ads-parent";

const handle = startVerse8AdsParent({
  iframeSelector: "#game-frame",
  gameOrigin: "https://a.verse8.games",
  verifierBaseUrl: "https://ads-verifier.verse8.io",
  ssvWaitMs: 5000,
  onTelemetry: (event) => {
    console.log("[ads-parent]", event.type, event);
  },
});

// On unmount / page nav:
handle.stop();

Or via the IIFE bundle (loads window.Verse8AdsParent):

<script src="https://unpkg.com/@verse8/[email protected]/dist/index.global.js"></script>
<script>
  Verse8AdsParent.startVerse8AdsParent({
    iframeSelector: "#game-frame",
    gameOrigin: "https://a.verse8.games",
    verifierBaseUrl: "https://ads-verifier.verse8.io",
  });
</script>

API

startVerse8AdsParent(config: ParentConfig): { stop(): void }

| Field | Type | Default | Notes | |---|---|---|---| | iframeSelector | string | — | CSS selector for the game iframe element. | | iframeWindow | HTMLIFrameElement \| Window | — | Alternative to iframeSelector. | | gameOrigin | string | required | Expected child origin (used as targetOrigin and trusted inbound origin). | | verifierBaseUrl | string | required | Base URL of the ads-verifier worker. | | ssvWaitMs | number | 5000 | Total budget for /ads/status polling. | | onTelemetry | (event) => void | — | Analytics hook. Errors thrown here are swallowed. | | trustedIframeOrigins | string[] | [] | Additional origins to accept (in addition to gameOrigin). |

Either iframeSelector OR iframeWindow must be supplied — both are acceptable; if both are present, iframeWindow wins.

Telemetry events

type TelemetryEvent =
  | { type: 'ping'; requestId }
  | { type: 'show'; adType: 'rewarded'|'interstitial'; placementId; requestId }
  | { type: 'render_dispatched'; requestId }
  | { type: 'renderer_result'; requestId; outcome: 'viewed'|'dismissed'|'not-ready'|'failed' }
  | { type: 'ssv_polling'; requestId }
  | { type: 'ssv_arrived'; requestId }
  | { type: 'ssv_timeout'; requestId }
  | { type: 'result_dispatched'; requestId; status: 'rewarded'|'dismissed'|'failed' };

Wire protocol

This package implements the parent half of the protocol documented in @verse8/ads/PROTOCOL.md, plus the new render-plane envelopes:

| Direction | Type | Payload | |---|---|---| | Iframe → Parent | VERSE8_ADS_PING | { sdkVersion? } | | Iframe → Parent | VERSE8_ADS_SHOW_REWARDED | { placementId } | | Iframe → Parent | VERSE8_ADS_SHOW_INTERSTITIAL | { placementId } | | Iframe → Parent | VERSE8_ADS_RENDER_RESULT | { outcome, reason? } | | Parent → Iframe | VERSE8_ADS_PONG | { platform: 'web' } | | Parent → Iframe | VERSE8_ADS_RENDER_H5_REWARDED | { placementId } | | Parent → Iframe | VERSE8_ADS_RENDER_H5_INTERSTITIAL | { placementId } | | Parent → Iframe | VERSE8_ADS_RESULT | { status, reward?, error? } |

Origin validation runs BEFORE any payload inspection. Unknown / malformed envelopes are silently dropped.

Environment detection

The parent module short-circuits to a no-op handle when:

  • typeof window === 'undefined' (SSR / Node)
  • window.FlutterVerse8Ads is defined (the Flutter app's JS channel marker — the native bridge handles ad lifecycle directly)

In both cases, startVerse8AdsParent returns { stop: () => {} } immediately without installing listeners.

Test helpers (dev only)

Convenience wrappers for E2E shells, demos, and fixture pages live on a separate sub-path so production bundles can tree-shake them out:

import { startTestParent, GOOGLE_TEST_PUBLISHER_ID } from "@verse8/ads-parent/test-helpers";

const handle = startTestParent({
  iframeSelector: "#game-frame",
  gameOrigin: "https://a.verse8.games",
  verifierBaseUrl: "https://ads-verifier.verse8.io",
});

These wrappers default to Google's public test publisher ID, enable adBreakTestMode, and short-circuit the SSV verifier via skipResultUpload. Not for productionskipResultUpload bypasses the server-side verification boundary.

Bundle size

IIFE bundle target: < 12 KB gzipped.

License

MIT