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 🙏

© 2024 – Pkg Stats / Ryan Hefner

puresdk

v2.9.9

Published

SDK for PureProfile's Business Apps Development

Downloads

290

Readme

Purpose

The purpose of this library is to aim developers create applications for the PureProfile Business Platform. The library provides:

  • authentication / authorization layer
  • navigation through apps and accounts
  • other help tools and features such as a notifications' mechanism are included

Distribution / Installation

The library is available through npm, bower and cdn.

versions x.x.x-alpha.x are not stable and are used only for development. For production purposes please always use "*" (for latest), x.x.x, >x.x.x, ^x.x.x etc semantic version. For development, in order to always have the latest version (either alpha or stable) please use ">x.y.z-alpha" semantic version. The npm repository is "puresdk". If you are working with npm you just need to require / import the library into your code. If you're loading the library in a script tag from CDN the library is exposed to window.PURESDK namespace.

The CDN version of the library is available on the urls:

Latest version:

http://purecdn.pureprofile.com/ppba.latest.minified.js

Specific version minified:

http://purecdn.pureprofile.com/ppba.<= version number >.minified.js

Specific version not-minified:

http://purecdn.pureprofile.com/ppba.<= version number >.js

Example: http://purecdn.pureprofile.com/ppba.2.1.14.minified.js http://purecdn.pureprofile.com/ppba.2.1.14.js

Warning:

CDN versions are available only from version 2.3.11 and up

Features

Initialize the library

First thing you should do is to initialize the library. This step is mandatory when using the library. In order to initialize the library use the "init" function exposed by it.

Commonjs version example:

CDN version example:

As noticed, init method takes one argument of type object which holds the initial configuration you want to pass to it. The supported params / keys of the configuration object are:

Authenticate / authorize the user

Second step (which is also absolutely mandatory) is to authenticate and authorize the current user. The library will automatically check if the user is logged in and also if the logged in user has access to the application. The flow goes as follows:

Commonjs version example:

CDN version example:

Mention the two ways of authentication provided by the library. You can either use the authenticatePromise method which returns a promise or the authenticate method which takes as parameter a success callback. Failure should not concern you as in such case the library automatically redirects the user to the login page.

getUserData

This function returns the full data of the user in an object.

Alert message boxes

The library provides a method for displaying message boxes on top of the page. The supported types are:

In order to show a message box just use the "setInfo" method exposed by the sdk. Here are a couple of examples:

Cloudinary image picker

A Cloudinary image picker is included out of the box. All images used among the various apps of an account are stored on a Cloudinary repository and can be reused at any time by either the same or any other app. In order to browse and pick an already existing image from Cloudinary you should use the openCloudinaryPicker method exposed by puresdk. This method will pop up an image picker modal allowing the user to browse, search and pick the image they want. The method accepts just one argument of type object. For now the only thing to set is the success callback function that will be executed once the user picks an image. Here is an example of how to use the Cloudinary image picker:

Loader

A loader is included on the sdk's top bar. It's positioned right next to the apps button and can be shown and hidden at any time. The methods that show/hide the loader are:

goToLoginPage

This method redirects the browser window to the login page. The method should be used in cases a 401 error code comes back from the backend (meaning the user is not logged in).

Development mode

Only for development reasons, in order to have puresdk running on any url (including localhost or any other) init method of puresdk supports the following configuration options:

the devKeys (key & secret) are unique for each organisation and should be acquired directly from the PureProfile Development Team.