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

o10r-pp-core

v0.5.19

Published

`o10r-pp-core` is the lowest level helper library for building a modern Payment Page. It offers small, composable utilities for working with APIs, events, HTTP requests, JWT tokens, translations, cookies and card detection.

Downloads

71

Readme

o10r-pp-core

o10r-pp-core is the lowest level helper library for building a modern Payment Page. It offers small, composable utilities for working with APIs, events, HTTP requests, JWT tokens, translations, cookies and card detection.


📦 Installation

npm install o10r-pp-core

Requires Node.js v24+


🧰 Features

1. useApi

Creates an API client object with all available payment page methods, fully typed.

import { useApi } from 'o10r-pp-core';

const api = useApi('https://example.com');
const settings = await api.getProjectSettings();

2. useEventManager

Provides an object for subscribing to, emitting and unsubscribing from events.

import { useEventManager } from 'o10r-pp-core';

type EventMap = { eventName: (p1: string, p2: number) => void };

const events = useEventManager<EventMap>();
const handler = (p1: string, p2: number) => console.log(p1, p2);

events.on('eventName', handler);
events.emit('eventName', 'test', 4324);
events.off('eventName', handler);

3. useHttp

A simple HTTP utility that allows making typed requests and handling errors gracefully.

import { useHttp } from 'o10r-pp-core';

type ResponseExample = { id: number };

const { request } = useHttp();
const data = await request<ResponseExample>('https://example.com/test');

4. useJwtToken

Extracts initialization data for the payment page from a Base64‑encoded JWT token payload.

import { useJwtToken } from 'o10r-pp-core';

const token = '...';
const initData = useJwtToken(token);

5. useTranslator

Loads translation dictionaries from an API endpoint and provides a translate function for substituting template variables. It also exposes helpers for switching the current language and listening for language changes.

import { useApi, useTranslator, Language } from 'o10r-pp-core';

const api = useApi('https://example.com');
const { translate, setLanguage, on } = useTranslator(api);

on('languageChanged', lang => console.log('Language switched to', lang));
await setLanguage(Language.RU);
const hello = translate('hello', { user: { email: '[email protected]' } });

6. useCookies

Utility for getting, setting and removing cookies in the browser.

import { useCookies } from 'o10r-pp-core';

const cookies = useCookies();

cookies.set('session', '123', { path: '/', secure: true });
const session = cookies.get('session');
cookies.remove('session');

7. useCardTypeDetector

Detects the card type based on the card number using built‑in patterns.

import { useCardTypeDetector } from 'o10r-pp-core';

const { detect } = useCardTypeDetector();
const card = detect('4111111111111111');
console.log(card?.code); // "VISA"