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

@basetime/a2w-template

v0.1.1

Published

Standalone pass-rendering React library.

Readme

@basetime/a2w-template

Standalone React library for rendering Add to Wallet pass templates (Apple Wallet and Google Wallet) in the browser. Extracted from the Add to Wallet monorepo so it can be embedded in other projects without pulling in the rest of the @a2w/frontend or @a2w/shared workspaces.

Installation

This package is published from the Add to Wallet monorepo and re-uses the monorepo's pnpm workspace tooling.

pnpm add @basetime/a2w-template

Peer dependencies (host app must provide):

  • react ^18
  • react-dom ^18
  • @emotion/react ^11
  • @emotion/styled ^11
  • @emotion/cache ^11

Usage

Render a pass by providing a TemplateSlice to PassContext. No state management is required for read-only rendering; the library falls back to sensible defaults and no-op editing actions when no PassStateContext is mounted.

import { PassContext, PassSwitcher, type TemplateSlice } from '@basetime/a2w-template';

const TemplatePreview = ({ template }: { template: TemplateSlice }) => (
  <PassContext.Provider
    value={{
      template,
      category: null,
      onClick: () => {},
    }}
  >
    <PassSwitcher onClick={() => {}} />
  </PassContext.Provider>
);

To enable in-place editing (changing field values, swapping images, picking barcodes, etc.), wrap the consumer in a PassStateContext.Provider with the current UI / template state and the action methods that should mutate it:

import {
  PassStateContext,
  type PassStateContextValue,
} from '@basetime/a2w-template';

const value: PassStateContextValue = {
  ui: { device: 'phone', os: 'apple', /* ...other UI fields... */ },
  template: { past: [], present: template, future: [] },
  appleUpdate: (pass) => { /* persist to your store */ },
  appleUpdateField: (fieldName, index, data) => { /* ... */ },
  // ...other action methods
};

<PassStateContext.Provider value={value}>
  <TemplatePreview template={template} />
</PassStateContext.Provider>;

Without a provider, PassSwitcher still renders the pass; only editing is unavailable.

Server-Side HTML Rendering

For server runtimes (for example workers or Node SSR), use the server subpath:

import { renderTemplateToHtml } from '@basetime/a2w-template/server';
import type { TemplateSlice } from '@basetime/a2w-template';

const htmlFragment = renderTemplateToHtml(template as TemplateSlice);

renderTemplateToHtml returns an HTML fragment that includes:

  • Apple preview (front only)

Public exports

  • PassSwitcher - top-level pass renderer that picks Apple or Google based on the active OS in PassStateContext (defaults to apple).
  • ApplePass, ApplePassBack, AppleField, ApplePassContainer - Apple rendering primitives.
  • GooglePass, GooglePassBack, GooglePassBackControls - Google rendering primitives.
  • PassContext, PreviewContext, DeviceContext, OSContext - render-time contexts.
  • PassStateContext, usePassState, defaultPassStateContextValue, PassStateContextValue - editing state and action methods.
  • TemplateSlice, Device, FieldName, OS and other state types.
  • @basetime/a2w-template/server - server-only SSR helpers, including renderTemplateToHtml.

Building

  • pnpm build - bundle for the in-monorepo runtime (esbuild ESM).
  • pnpm build:npm - bundle for npm distribution.
  • pnpm build:types - emit .d.ts files into dist/.
  • pnpm watch - rebuild on change.
  • pnpm lint - ESLint.
  • pnpm test - Jest.

License

UNLICENSED — internal use only until officially published.