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

@onside/install-widget

v1.1.3

Published

Onside install button widget for partner landings

Readme

Onside Install Widget

Install Flow Contract (Target Behavior)

This section defines the expected runtime behavior of the install package. It is the source of truth for UX + analytics for partner integrations.

Scenario Matrix

| Scenario | Condition | Button text | Modal | GTM event(s) | Action | | --- | --- | --- | --- | --- | --- | | Direct install | canInstall === true and isEligible !== false and install URL loaded | Install Onside | none | install_button_click with event_type=install_click (or ios_18_6_plus) | Redirect to install URL | | Browser unsupported on iOS | shouldGoToSafari === true | Install Onside | go_to_safari instruction modal | go_to_safari.opened | Block redirect until user opens supported browser | | iOS version unsupported | shouldUpdateIOS === true | Install Onside | update_ios instruction modal | update_ios.opened | Block redirect until iOS update | | Android device | isAndroid === true | Onside is for iPhone and iPad | is_android info modal | is_android.opened | Block install | | Region not eligible | isEligible === false | Install Onside + caption Only available in the EU. Install from an eligible region. | none | optional install_button_click with event_type=not_eligible | Allow install attempt (system flow may still permit install) | | Install API error | install URL fetch failed after retries | Install Onside | none | optional install_button_click with event_type=api_error | Show inline error only; fallback modal/retry flow is not required for current release |

Notes

  • Required analytics context in GTM payload: location, page, onside_token, attribution_token, platform, browser.
  • Optional additive device fields (for richer analytics/debug): iosDeviceClass, isInAppBrowser, browserDetail. Existing required fields remain backward-compatible.
  • If a modal is shown, redirect must not happen in the same click action.
  • onside_token cookie must be present before requesting install URL.

Delivery Modes

The button is delivered in two supported ways:

  1. React package (@onside/install-widget)
  2. CDN script (IIFE widget, no React required in host app)

1) React package

Install dependencies:

pnpm add @onside/install-widget react react-dom

Usage:

import { InstallAppButton, InstallWidgetProvider } from "@onside/install-widget";
import "@onside/install-widget/styles.css";

function App() {
  return (
    <InstallWidgetProvider>
      <InstallAppButton />
    </InstallWidgetProvider>
  );
}

Mount InstallWidgetProvider once per page. It hosts all install modals and supports multiple InstallAppButton instances. For per-button attribution, set id and location on each button (button_id + location in analytics events).

Optional custom analytics callback:

import { InstallAppButton, InstallWidgetProvider } from "@onside/install-widget";
import "@onside/install-widget/styles.css";

function App() {
  return (
    <InstallWidgetProvider>
      <InstallAppButton
        customAnalytics={{
          onEvent: (event) => {
            // full enriched event payload (event_name, event_properties, url, etc.)
            console.log(event);
          },
        }}
      />
    </InstallWidgetProvider>
  );
}

Core modules can be imported via subpaths (without the UI layer):

import { useInstallUrl } from "@onside/install-widget/hooks";
import {
  getDeviceInfo,
  resolveInstallConditions,
  getInstallUrl,
} from "@onside/install-widget/utils";

Style customization:

<InstallAppButton
  className="w-full"
  captionClassName="opacity-80"
  styleVars={
    {
      "--onside-btn-bg": "#111827",
      "--onside-btn-bg-hover": "#1f2937",
      "--onside-btn-text": "#ffffff",
      "--onside-btn-radius": "16px",
      "--onside-btn-px": "24px",
      "--onside-btn-py": "14px",
      "--onside-btn-font-size": "16px",
      "--onside-caption-color": "rgba(17,24,39,0.7)",
      "--onside-caption-size": "12px",
      "--onside-caption-line-height": "16px",
    }
  }
/>

2) CDN script (no React in host)

Build artifacts are produced in dist/ (widget script) and loaded directly on the partner page.

Example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>Onside Widget</title>
</head>
<body>
  <div class="install-button"></div>
  <script
    src="https://<your-cdn>/provider-widget.iife.js"
    data-selector=".install-button"
    data-css-href="https://<your-cdn>/onside-install-widget.css"
  ></script>
</body>
</html>

Required script attributes:

  • data-selector: CSS selector of target container.
  • data-css-href: URL to widget stylesheet.

CDN media manifest (images/video)

Media paths are resolved by cdn("/path/to/file") using a local manifest snapshot:

  • source manifest URL: https://cdn.onside.io/assets/onside-install-widget/manifest.json
  • generated file in repo: src/generated/cdnManifest.ts

Update the local snapshot before release:

pnpm run sync:cdn-manifest

Release Preflight

Run before publishing a new package version:

pnpm run sync:cdn-manifest
pnpm run lint
pnpm run build:lib

QA artifacts/checklists:

  • docs/checklists/install-flow-release-checklist.md
  • docs/checklists/install-flow-qa-report-template.md
  • docs/checklists/install-flow-qa-report-draft.md

Release Flow (GitHub + npm)

  1. Add a changeset in feature PRs that affect package behavior:
    • pnpm changeset
  2. Merge PRs into main.
  3. Release workflow opens/updates a release PR with version/changelog changes.
  4. Merge the release PR.
  5. Release workflow publishes the package to npm via OIDC trusted publishing (no npm token in GitHub secrets).

Troubleshooting

  • If sync:cdn-manifest fails locally due to network restrictions, run the manual workflow:
    • GitHub Actions -> Sync CDN Manifest -> Run workflow
  • If manifest did not change, no PR is created by the workflow.

Packaging notes

  • React package output is in dist-lib/:
    • install-package.js (ESM)
    • install-package.cjs (CJS)
    • install-package.d.ts (types)
  • Script widget output is in dist/:
    • provider-widget.iife.js