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

campsi-login

v1.3.2

Published

HTML Widget for Campsi/API login with themable style

Readme

campsi/login

Client-side widget that implements campsi/api authentification and registration.

Features

  • [x] User / Password login flow
  • [x] Social and entreprise login flow
  • [x] Custom and built-in themes
  • [x] Follows jQuery plugins conventions
    • [x] Named methods
    • [x] Minimal $.fn footprint
  • [x] Responsive

Demo themes

| | | | |----| ---- | ---- | Modal.Transparent.Sunset | Modal.Flat.Carmin | Modal.Flat.Neonblue | | | |

Installation

Pre-requisites

campsi/login is a jQuery plugin, and therefore requires an instance of jQuery. You can either use an official jQuery CDN or download your own custom version, but do not use the slim version. This version strips out $.ajax(), which is required to call the authentification endpoint of the api.

Step 1 : Get the script

Using NPM

$ npm install --save campsi-login

Step 2 : Import the plugin

<!-- jQuery isn't bundled, you have to import it first. Reminder : do not use the slim version -->
<script src="node_modules/jquery/dist/jquery.js"></script>
<script src="node_modules/campsi-login/dist/jquery.campsi-login.js"></script>

Like most jQuery plugins, campsi/login ships with a minified version. Just use jquery.campsi-login.min.js if you need to.

Step 3 : Configure

camspi/api returns the auth token in the query string, so we have to parse it to obtain the value. The campsi/login plugin can also use an invitation token and display the issuer and the message.

// here's the URL to the campsi/api server
var apiUrl = 'http://api.mysuperwebsite.com/';

$('#login').CampsiLogin({
    baseUrl: apiUrl + '/auth'
}).on('login', function(event, user){
    console.info('user logged in', user);
});

Documentation

Methods

| Method | Description | |---------------- | ------------------------------------------------------------------------------- | | $div.CampsiLogin(options) | Constructor method| | $div.CampsiLogin('show')| Display the login widget by adding the class visible and removing the class closed to the container div | | $div.CampsiLogin('hide')| Display the login widget by adding the class closed and removing the class visible to the container div| | $div.CampsiLogin('logout')| Destroy the token in the browser's localStorage |

Constructor options

| Name | Type | Required | Description | |---------------- | ------------ | --------- | ----------------------------------------------------------------- | | baseUrl | string | Yes | The URL of your campsi/api setup | | token | string | No | force the authentification token | | invitation | string | No | force the invitation token | | state | string | No | which form to display by default (one of "signup", "signin", "reset")|

The parameters token and invitation have precedence over the query string and the local storage.

Events

| Name | Description | |---------------- | ------------------------------------------------------------------------------- | | ready | when the providers are loaded and the markup created | | login | when a token is successfully decoded and the user has been authentificated | | loginError | when an error happened while decoding the token or authentificating the user |

The login event listener is called with an additional parameter: an object containing the user infos:

$('#login').on('login', function(event, user){
    var whatAUserLooksLike =  {
        _id: "58334d2a41015672d3b3f147",
        displayName: "Romain Bessuges-Meusy",
        picture: "https://",
        email: "[email protected]",
        identities: {
            local: {
                id: "[email protected]",
                username: "[email protected]"
            }
        },
        token: {
            value: "9e7f91f5-9d47-403a-9604-dcb8b1d9e938",
            expiration: "2016-12-10T17:19:01.839Z"
        },
        isAdmin: false
   };
});